Revision
16614
Author
joshrivers
Date
2010-02-11 18:54:22 -0600 (Thu, 11 Feb 2010)

Log Message

Merging trunk with my mod_managed improvements.

Modified Paths

Added Paths

Removed Paths

Property Changed

Diff

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch


Name: svn:ignore
   - freeswitch-sounds-*.tar.gz
.deps
Makefile
config.status
modules.conf
libtool
quiet_libtool
config.log
.version
.libs
autom4te.cache
freeswitch
core.*
debug
release
*.ncb
*.suo
*.bak
.noversion
testmode
.complete
*.c
*.patch
*.tmp
wtf
cc-mode-*
config.cache
Makefile.in
AUTHORS
COPYING
NEWS
ChangeLog
configure
README
aclocal.m4
debug static
release static
Debug
Debug Static
Release
Freeswitch.2008cache.dat
Freeswitchcache.dat
Release Static
bin
*.diff
*.pdb
cmake.test
All
x64
spandsp.h
Release_CLR
fs_cli
fs_ivrd
.
status
ignore.txt
snom.pcap
freeswitch-sounds-ru-ru-elena-48000.install
1
debian.diff.1
zfone3-full-0.90.410.tar.gz
freeswitch-sounds-ru-ru-elena-32000.install
libzrtp-0.81.514.tar.gz
l
fucker.ul
wanpipe-3.5.4.20.smg_pri.tgz
libzrtp-0.81.514
wtf.tgz
paging-ttl-update.txt
CentOS-5.3-x86_64-bin-7of7.iso
vim.txt
sofia_reg_gateways.db
zfone3-full-0.90.404.tar.gz
zfone-full-0.90.404
freeswitch-lang-ru.install
freeswitch-sounds-ru-ru-elena-16000.install
zfone-full-0.90.410
switch_core_state_machine.c.txt
snom2.pcap
bv.tar.gz
file.pcap
dump.pcap
swimp.raw
libzrtp-0.90.579
vg.log
test.txt
blah.txt
freeswitch-sounds-en-us-callie-48000.install
bv32
wtf.pcap
ass
wanpipe-3.5.4.20.smg_pri
CentOS-5.3-x86_64-bin-7of7.iso.lftp-pget-status
status
   + freeswitch-sounds-*.tar.gz
.deps
Makefile
config.status
modules.conf
libtool
quiet_libtool
config.log
.version
.libs
autom4te.cache
freeswitch
core.*
debug
release
*.ncb
*.suo
*.bak
.noversion
testmode
.complete
*.c
*.patch
*.tmp
wtf
cc-mode-*
config.cache
Makefile.in
AUTHORS
COPYING
NEWS
ChangeLog
configure
README
aclocal.m4
debug static
release static
Debug
Debug Static
Release
Freeswitch.2008cache.dat
Freeswitchcache.dat
Release Static
bin
*.diff
*.pdb
cmake.test
All
x64
spandsp.h
Release_CLR
fs_cli
fs_ivrd
.
status
ignore.txt
snom.pcap
freeswitch-sounds-ru-ru-elena-48000.install
1
debian.diff.1
zfone3-full-0.90.410.tar.gz
freeswitch-sounds-ru-ru-elena-32000.install
libzrtp-0.81.514.tar.gz
l
fucker.ul
wanpipe-3.5.4.20.smg_pri.tgz
libzrtp-0.81.514
wtf.tgz
paging-ttl-update.txt
CentOS-5.3-x86_64-bin-7of7.iso
vim.txt
sofia_reg_gateways.db
zfone3-full-0.90.404.tar.gz
zfone-full-0.90.404
freeswitch-lang-ru.install
freeswitch-sounds-ru-ru-elena-16000.install
zfone-full-0.90.410
switch_core_state_machine.c.txt
snom2.pcap
bv.tar.gz
file.pcap
dump.pcap
swimp.raw
libzrtp-0.90.579
vg.log
test.txt
blah.txt
freeswitch-sounds-en-us-callie-48000.install
bv32
wtf.pcap
ass
wanpipe-3.5.4.20.smg_pri
CentOS-5.3-x86_64-bin-7of7.iso.lftp-pget-status
status
svn_is_stupid.sh
status
libzrtp-1.00.591
libzrtp-1.00.591-ec.tar.gz
status

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/.version.in (from rev 16612, freeswitch/trunk/.version.in) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/.version.in	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/.version.in	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1 @@
+@SWITCH_VERSION_REVISION@

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/Freeswitch.2005.unsupported.sln (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/Freeswitch.2005.unsupported.sln	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/Freeswitch.2005.unsupported.sln	2010-02-12 00:54:22 UTC (rev 16614)
@@ -30,12 +30,6 @@
 		{3D0370CA-BED2-4657-A475-32375CBCB6E4} = {3D0370CA-BED2-4657-A475-32375CBCB6E4}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_iax", "src\mod\endpoints\mod_iax\mod_iax.vcproj", "{3A5B9131-F20C-4A85-9447-6C1610941CEE}"
-	ProjectSection(ProjectDependencies) = postProject
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-	EndProjectSection
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_PortAudio", "src\mod\endpoints\mod_portaudio\mod_PortAudio.vcproj", "{5FD31A25-5D83-4794-8BEE-904DAD84CE71}"
 	ProjectSection(ProjectDependencies) = postProject
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
@@ -249,7 +243,7 @@
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_core_db", "src\mod\languages\mod_spidermonkey_core_db\mod_spidermonkey_core_db.vcproj", "{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_core_db", "src\mod\languages\mod_spidermonkey\mod_spidermonkey_core_db.vcproj", "{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}"
 	ProjectSection(ProjectDependencies) = postProject
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
@@ -257,7 +251,7 @@
 		{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_teletone", "src\mod\languages\mod_spidermonkey_teletone\mod_spidermonkey_teletone.vcproj", "{8F992C49-6C51-412F-B2A3-34EAB708EB65}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_teletone", "src\mod\languages\mod_spidermonkey\mod_spidermonkey_teletone.vcproj", "{8F992C49-6C51-412F-B2A3-34EAB708EB65}"
 	ProjectSection(ProjectDependencies) = postProject
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
@@ -274,7 +268,7 @@
 		{4043FC6A-9A30-4577-8AD5-9B233C9575D8} = {4043FC6A-9A30-4577-8AD5-9B233C9575D8}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_odbc", "src\mod\languages\mod_spidermonkey_odbc\mod_spidermonkey_odbc.vcproj", "{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_odbc", "src\mod\languages\mod_spidermonkey\mod_spidermonkey_odbc.vcproj", "{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}"
 	ProjectSection(ProjectDependencies) = postProject
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
@@ -371,7 +365,7 @@
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_socket", "src\mod\languages\mod_spidermonkey_socket\mod_spidermonkey_socket.vcproj", "{028C7278-05D7-4E18-82FE-BE231B844F41}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_socket", "src\mod\languages\mod_spidermonkey\mod_spidermonkey_socket.vcproj", "{028C7278-05D7-4E18-82FE-BE231B844F41}"
 	ProjectSection(ProjectDependencies) = postProject
 		{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
@@ -439,7 +433,6 @@
 		conf\autoload_configs\enum.conf.xml = conf\autoload_configs\enum.conf.xml
 		conf\autoload_configs\event_multicast.conf.xml = conf\autoload_configs\event_multicast.conf.xml
 		conf\autoload_configs\event_socket.conf.xml = conf\autoload_configs\event_socket.conf.xml
-		conf\autoload_configs\iax.conf.xml = conf\autoload_configs\iax.conf.xml
 		conf\autoload_configs\ivr.conf.xml = conf\autoload_configs\ivr.conf.xml
 		conf\autoload_configs\java.conf.xml = conf\autoload_configs\java.conf.xml
 		conf\autoload_configs\limit.conf.xml = conf\autoload_configs\limit.conf.xml
@@ -541,7 +534,6 @@
 		debug\conf\autoload_configs\enum.conf.xml = debug\conf\autoload_configs\enum.conf.xml
 		debug\conf\autoload_configs\event_multicast.conf.xml = debug\conf\autoload_configs\event_multicast.conf.xml
 		debug\conf\autoload_configs\event_socket.conf.xml = debug\conf\autoload_configs\event_socket.conf.xml
-		debug\conf\autoload_configs\iax.conf.xml = debug\conf\autoload_configs\iax.conf.xml
 		debug\conf\autoload_configs\ivr.conf.xml = debug\conf\autoload_configs\ivr.conf.xml
 		debug\conf\autoload_configs\java.conf.xml = debug\conf\autoload_configs\java.conf.xml
 		debug\conf\autoload_configs\limit.conf.xml = debug\conf\autoload_configs\limit.conf.xml
@@ -640,7 +632,6 @@
 		release\conf\autoload_configs\enum.conf.xml = release\conf\autoload_configs\enum.conf.xml
 		release\conf\autoload_configs\event_multicast.conf.xml = release\conf\autoload_configs\event_multicast.conf.xml
 		release\conf\autoload_configs\event_socket.conf.xml = release\conf\autoload_configs\event_socket.conf.xml
-		release\conf\autoload_configs\iax.conf.xml = release\conf\autoload_configs\iax.conf.xml
 		release\conf\autoload_configs\ivr.conf.xml = release\conf\autoload_configs\ivr.conf.xml
 		release\conf\autoload_configs\java.conf.xml = release\conf\autoload_configs\java.conf.xml
 		release\conf\autoload_configs\limit.conf.xml = release\conf\autoload_configs\limit.conf.xml
@@ -751,7 +742,7 @@
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_curl", "src\mod\languages\mod_spidermonkey_curl\mod_spidermonkey_curl.vcproj", "{2CCED6DC-26FF-40F2-9585-E9E1049A4599}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_curl", "src\mod\languages\mod_spidermonkey\mod_spidermonkey_curl.vcproj", "{2CCED6DC-26FF-40F2-9585-E9E1049A4599}"
 	ProjectSection(ProjectDependencies) = postProject
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
@@ -852,15 +843,6 @@
 		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|Win32.ActiveCfg = Release|Win32
 		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|Win32.Build.0 = Release|Win32
 		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|x64.ActiveCfg = Release|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.All|Win32.ActiveCfg = Release|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.All|Win32.Build.0 = Release|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.All|x64.ActiveCfg = Release|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Debug|Win32.ActiveCfg = Debug|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Debug|Win32.Build.0 = Debug|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Debug|x64.ActiveCfg = Debug|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Release|Win32.ActiveCfg = Release|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Release|Win32.Build.0 = Release|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Release|x64.ActiveCfg = Release|Win32
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|Win32.ActiveCfg = Release|Win32
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|Win32.Build.0 = Release|Win32
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|x64.ActiveCfg = Release|Win32
@@ -1622,7 +1604,6 @@
 		{2CA40887-1622-46A1-A7F9-17FD7E7E545B} = {A5A27244-AD24-46E5-B01B-840CD296C91D}
 		{1A789A98-71EF-4EBD-8007-FC9ED585D32E} = {A5A27244-AD24-46E5-B01B-840CD296C91D}
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
 		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
 		{0DF3ABD0-DDC0-4265-B778-07C66780979B} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
 		{426B1369-FDB7-4B18-A7EF-9C6A9097A130} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/Freeswitch.2008.express.sln (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/Freeswitch.2008.express.sln	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/Freeswitch.2008.express.sln	2010-02-12 00:54:22 UTC (rev 16614)
@@ -30,12 +30,6 @@
 		{3D0370CA-BED2-4657-A475-32375CBCB6E4} = {3D0370CA-BED2-4657-A475-32375CBCB6E4}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_iax", "src\mod\endpoints\mod_iax\mod_iax.2008.vcproj", "{3A5B9131-F20C-4A85-9447-6C1610941CEE}"
-	ProjectSection(ProjectDependencies) = postProject
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-	EndProjectSection
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_PortAudio", "src\mod\endpoints\mod_portaudio\mod_PortAudio.2008.vcproj", "{5FD31A25-5D83-4794-8BEE-904DAD84CE71}"
 	ProjectSection(ProjectDependencies) = postProject
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
@@ -216,7 +210,7 @@
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_core_db", "src\mod\languages\mod_spidermonkey_core_db\mod_spidermonkey_core_db.2008.vcproj", "{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_core_db", "src\mod\languages\mod_spidermonkey\mod_spidermonkey_core_db.2008.vcproj", "{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}"
 	ProjectSection(ProjectDependencies) = postProject
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
@@ -224,7 +218,7 @@
 		{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_teletone", "src\mod\languages\mod_spidermonkey_teletone\mod_spidermonkey_teletone.2008.vcproj", "{8F992C49-6C51-412F-B2A3-34EAB708EB65}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_teletone", "src\mod\languages\mod_spidermonkey\mod_spidermonkey_teletone.2008.vcproj", "{8F992C49-6C51-412F-B2A3-34EAB708EB65}"
 	ProjectSection(ProjectDependencies) = postProject
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
@@ -241,7 +235,7 @@
 		{4043FC6A-9A30-4577-8AD5-9B233C9575D8} = {4043FC6A-9A30-4577-8AD5-9B233C9575D8}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_odbc", "src\mod\languages\mod_spidermonkey_odbc\mod_spidermonkey_odbc.2008.vcproj", "{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_odbc", "src\mod\languages\mod_spidermonkey\mod_spidermonkey_odbc.2008.vcproj", "{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}"
 	ProjectSection(ProjectDependencies) = postProject
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
@@ -290,7 +284,7 @@
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_socket", "src\mod\languages\mod_spidermonkey_socket\mod_spidermonkey_socket.2008.vcproj", "{028C7278-05D7-4E18-82FE-BE231B844F41}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_socket", "src\mod\languages\mod_spidermonkey\mod_spidermonkey_socket.2008.vcproj", "{028C7278-05D7-4E18-82FE-BE231B844F41}"
 	ProjectSection(ProjectDependencies) = postProject
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
@@ -375,7 +369,7 @@
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_curl", "src\mod\languages\mod_spidermonkey_curl\mod_spidermonkey_curl.2008.vcproj", "{36E854E3-CE12-4348-A125-CCF3F9D74813}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_curl", "src\mod\languages\mod_spidermonkey\mod_spidermonkey_curl.2008.vcproj", "{36E854E3-CE12-4348-A125-CCF3F9D74813}"
 	ProjectSection(ProjectDependencies) = postProject
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
@@ -673,17 +667,6 @@
 		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|Win32.Build.0 = Release|Win32
 		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|x64.ActiveCfg = Release|x64
 		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|x64.Build.0 = Release|x64
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.All|Win32.ActiveCfg = Release|x64
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.All|x64.ActiveCfg = Release|x64
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.All|x64.Build.0 = Release|x64
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Debug|Win32.ActiveCfg = Debug|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Debug|Win32.Build.0 = Debug|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Debug|x64.ActiveCfg = Debug|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Debug|x64.Build.0 = Debug|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Release|Win32.ActiveCfg = Release|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Release|Win32.Build.0 = Release|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Release|x64.ActiveCfg = Release|x64
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Release|x64.Build.0 = Release|x64
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|Win32.ActiveCfg = Release|x64
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|x64.ActiveCfg = Release|x64
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|x64.Build.0 = Release|x64

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/Freeswitch.2008.sln (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/Freeswitch.2008.sln	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/Freeswitch.2008.sln	2010-02-12 00:54:22 UTC (rev 16614)
@@ -87,7 +87,6 @@
 		conf\autoload_configs\enum.conf.xml = conf\autoload_configs\enum.conf.xml
 		conf\autoload_configs\event_multicast.conf.xml = conf\autoload_configs\event_multicast.conf.xml
 		conf\autoload_configs\event_socket.conf.xml = conf\autoload_configs\event_socket.conf.xml
-		conf\autoload_configs\iax.conf.xml = conf\autoload_configs\iax.conf.xml
 		conf\autoload_configs\ivr.conf.xml = conf\autoload_configs\ivr.conf.xml
 		conf\autoload_configs\java.conf.xml = conf\autoload_configs\java.conf.xml
 		conf\autoload_configs\limit.conf.xml = conf\autoload_configs\limit.conf.xml
@@ -189,7 +188,6 @@
 		debug\conf\autoload_configs\enum.conf.xml = debug\conf\autoload_configs\enum.conf.xml
 		debug\conf\autoload_configs\event_multicast.conf.xml = debug\conf\autoload_configs\event_multicast.conf.xml
 		debug\conf\autoload_configs\event_socket.conf.xml = debug\conf\autoload_configs\event_socket.conf.xml
-		debug\conf\autoload_configs\iax.conf.xml = debug\conf\autoload_configs\iax.conf.xml
 		debug\conf\autoload_configs\ivr.conf.xml = debug\conf\autoload_configs\ivr.conf.xml
 		debug\conf\autoload_configs\java.conf.xml = debug\conf\autoload_configs\java.conf.xml
 		debug\conf\autoload_configs\limit.conf.xml = debug\conf\autoload_configs\limit.conf.xml
@@ -287,7 +285,6 @@
 		release\conf\autoload_configs\enum.conf.xml = release\conf\autoload_configs\enum.conf.xml
 		release\conf\autoload_configs\event_multicast.conf.xml = release\conf\autoload_configs\event_multicast.conf.xml
 		release\conf\autoload_configs\event_socket.conf.xml = release\conf\autoload_configs\event_socket.conf.xml
-		release\conf\autoload_configs\iax.conf.xml = release\conf\autoload_configs\iax.conf.xml
 		release\conf\autoload_configs\ivr.conf.xml = release\conf\autoload_configs\ivr.conf.xml
 		release\conf\autoload_configs\java.conf.xml = release\conf\autoload_configs\java.conf.xml
 		release\conf\autoload_configs\limit.conf.xml = release\conf\autoload_configs\limit.conf.xml
@@ -403,12 +400,6 @@
 		{3D0370CA-BED2-4657-A475-32375CBCB6E4} = {3D0370CA-BED2-4657-A475-32375CBCB6E4}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_iax", "src\mod\endpoints\mod_iax\mod_iax.2008.vcproj", "{3A5B9131-F20C-4A85-9447-6C1610941CEE}"
-	ProjectSection(ProjectDependencies) = postProject
-		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
-		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
-	EndProjectSection
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_PortAudio", "src\mod\endpoints\mod_portaudio\mod_PortAudio.2008.vcproj", "{5FD31A25-5D83-4794-8BEE-904DAD84CE71}"
 	ProjectSection(ProjectDependencies) = postProject
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
@@ -589,7 +580,7 @@
 		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {F6C55D93-B927-4483-BB69-15AEF3DD2DFF}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_core_db", "src\mod\languages\mod_spidermonkey_core_db\mod_spidermonkey_core_db.2008.vcproj", "{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_core_db", "src\mod\languages\mod_spidermonkey\mod_spidermonkey_core_db.2008.vcproj", "{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}"
 	ProjectSection(ProjectDependencies) = postProject
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
@@ -597,7 +588,7 @@
 		{204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_teletone", "src\mod\languages\mod_spidermonkey_teletone\mod_spidermonkey_teletone.2008.vcproj", "{8F992C49-6C51-412F-B2A3-34EAB708EB65}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_teletone", "src\mod\languages\mod_spidermonkey\mod_spidermonkey_teletone.2008.vcproj", "{8F992C49-6C51-412F-B2A3-34EAB708EB65}"
 	ProjectSection(ProjectDependencies) = postProject
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
@@ -614,7 +605,7 @@
 		{4043FC6A-9A30-4577-8AD5-9B233C9575D8} = {4043FC6A-9A30-4577-8AD5-9B233C9575D8}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_odbc", "src\mod\languages\mod_spidermonkey_odbc\mod_spidermonkey_odbc.2008.vcproj", "{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_odbc", "src\mod\languages\mod_spidermonkey\mod_spidermonkey_odbc.2008.vcproj", "{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}"
 	ProjectSection(ProjectDependencies) = postProject
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
@@ -663,7 +654,7 @@
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_socket", "src\mod\languages\mod_spidermonkey_socket\mod_spidermonkey_socket.2008.vcproj", "{028C7278-05D7-4E18-82FE-BE231B844F41}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_socket", "src\mod\languages\mod_spidermonkey\mod_spidermonkey_socket.2008.vcproj", "{028C7278-05D7-4E18-82FE-BE231B844F41}"
 	ProjectSection(ProjectDependencies) = postProject
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
@@ -748,7 +739,7 @@
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_curl", "src\mod\languages\mod_spidermonkey_curl\mod_spidermonkey_curl.2008.vcproj", "{36E854E3-CE12-4348-A125-CCF3F9D74813}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_curl", "src\mod\languages\mod_spidermonkey\mod_spidermonkey_curl.2008.vcproj", "{36E854E3-CE12-4348-A125-CCF3F9D74813}"
 	ProjectSection(ProjectDependencies) = postProject
 		{1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F}
 		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
@@ -1062,6 +1053,19 @@
 		{B5A00BFA-6083-4FAE-A097-71642D6473B5} = {B5A00BFA-6083-4FAE-A097-71642D6473B5}
 	EndProjectSection
 EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download CELT", "libs\win32\Download CELT.vcproj", "{FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcelt", "libs\win32\celt\libcelt.vcproj", "{ABB71A76-42B0-47A4-973A-42E3D920C6FD}"
+	ProjectSection(ProjectDependencies) = postProject
+		{FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19} = {FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_celt", "src\mod\codecs\mod_celt\mod_celt.vcproj", "{4D418176-3B33-47E6-A63E-01BA34ADD21C}"
+	ProjectSection(ProjectDependencies) = postProject
+		{202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF}
+		{ABB71A76-42B0-47A4-973A-42E3D920C6FD} = {ABB71A76-42B0-47A4-973A-42E3D920C6FD}
+	EndProjectSection
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		All|Win32 = All|Win32
@@ -1116,17 +1120,6 @@
 		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|Win32.Build.0 = Release|Win32
 		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|x64.ActiveCfg = Release|x64
 		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6}.Release|x64.Build.0 = Release|x64
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.All|Win32.ActiveCfg = Release|x64
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.All|x64.ActiveCfg = Release|x64
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.All|x64.Build.0 = Release|x64
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Debug|Win32.ActiveCfg = Debug|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Debug|Win32.Build.0 = Debug|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Debug|x64.ActiveCfg = Debug|x64
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Debug|x64.Build.0 = Debug|x64
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Release|Win32.ActiveCfg = Release|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Release|Win32.Build.0 = Release|Win32
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Release|x64.ActiveCfg = Release|x64
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE}.Release|x64.Build.0 = Release|x64
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|Win32.ActiveCfg = Release|x64
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|x64.ActiveCfg = Release|x64
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71}.All|x64.Build.0 = Release|x64
@@ -2634,6 +2627,39 @@
 		{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Release|Win32.Build.0 = Release|Win32
 		{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Release|x64.ActiveCfg = Release|x64
 		{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Release|x64.Build.0 = Release|x64
+		{FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.All|Win32.ActiveCfg = Release|Win32
+		{FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.All|Win32.Build.0 = Release|Win32
+		{FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.All|x64.ActiveCfg = Release|Win32
+		{FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Debug|Win32.ActiveCfg = Debug|Win32
+		{FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Debug|Win32.Build.0 = Debug|Win32
+		{FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Debug|x64.ActiveCfg = Debug|Win32
+		{FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Debug|x64.Build.0 = Debug|Win32
+		{FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Release|Win32.ActiveCfg = Release|Win32
+		{FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Release|Win32.Build.0 = Release|Win32
+		{FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Release|x64.ActiveCfg = Release|Win32
+		{FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}.Release|x64.Build.0 = Release|Win32
+		{ABB71A76-42B0-47A4-973A-42E3D920C6FD}.All|Win32.ActiveCfg = Release|x64
+		{ABB71A76-42B0-47A4-973A-42E3D920C6FD}.All|x64.ActiveCfg = Release|x64
+		{ABB71A76-42B0-47A4-973A-42E3D920C6FD}.All|x64.Build.0 = Release|x64
+		{ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Debug|Win32.ActiveCfg = Debug|Win32
+		{ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Debug|Win32.Build.0 = Debug|Win32
+		{ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Debug|x64.ActiveCfg = Debug|x64
+		{ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Debug|x64.Build.0 = Debug|x64
+		{ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Release|Win32.ActiveCfg = Release|Win32
+		{ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Release|Win32.Build.0 = Release|Win32
+		{ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Release|x64.ActiveCfg = Release|x64
+		{ABB71A76-42B0-47A4-973A-42E3D920C6FD}.Release|x64.Build.0 = Release|x64
+		{4D418176-3B33-47E6-A63E-01BA34ADD21C}.All|Win32.ActiveCfg = Release Passthrough|x64
+		{4D418176-3B33-47E6-A63E-01BA34ADD21C}.All|x64.ActiveCfg = Release Passthrough|x64
+		{4D418176-3B33-47E6-A63E-01BA34ADD21C}.All|x64.Build.0 = Release Passthrough|x64
+		{4D418176-3B33-47E6-A63E-01BA34ADD21C}.Debug|Win32.ActiveCfg = Debug|Win32
+		{4D418176-3B33-47E6-A63E-01BA34ADD21C}.Debug|Win32.Build.0 = Debug|Win32
+		{4D418176-3B33-47E6-A63E-01BA34ADD21C}.Debug|x64.ActiveCfg = Debug|x64
+		{4D418176-3B33-47E6-A63E-01BA34ADD21C}.Debug|x64.Build.0 = Debug|x64
+		{4D418176-3B33-47E6-A63E-01BA34ADD21C}.Release|Win32.ActiveCfg = Release|Win32
+		{4D418176-3B33-47E6-A63E-01BA34ADD21C}.Release|Win32.Build.0 = Release|Win32
+		{4D418176-3B33-47E6-A63E-01BA34ADD21C}.Release|x64.ActiveCfg = Release|x64
+		{4D418176-3B33-47E6-A63E-01BA34ADD21C}.Release|x64.Build.0 = Release|x64
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
@@ -2648,7 +2674,7 @@
 		{42B6C2E3-7D5F-4204-A1F6-C0376B86C315} = {F881ADA2-2F1A-4046-9FEB-191D9422D781}
 		{0B6C905B-142E-4999-B39D-92FF7951E921} = {F881ADA2-2F1A-4046-9FEB-191D9422D781}
 		{D5C87B19-150D-4EF3-A671-96589BD2D14A} = {F881ADA2-2F1A-4046-9FEB-191D9422D781}
-		{3A5B9131-F20C-4A85-9447-6C1610941CEE} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
+		{4D418176-3B33-47E6-A63E-01BA34ADD21C} = {F881ADA2-2F1A-4046-9FEB-191D9422D781}
 		{5FD31A25-5D83-4794-8BEE-904DAD84CE71} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
 		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
 		{0DF3ABD0-DDC0-4265-B778-07C66780979B} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
@@ -2696,7 +2722,6 @@
 		{36E854E3-CE12-4348-A125-CCF3F9D74813} = {0C808854-54D1-4230-BFF5-77B5FD905000}
 		{7B077E7F-1BE7-4291-AB86-55E527B25CAC} = {0C808854-54D1-4230-BFF5-77B5FD905000}
 		{7B42BDA1-72C0-4378-A9B6-5C530F8CD61E} = {0C808854-54D1-4230-BFF5-77B5FD905000}
-		{834E2B2F-5483-4B80-8FE3-FE48FF76E5C0} = {0C808854-54D1-4230-BFF5-77B5FD905000}
 		{692F6330-4D87-4C82-81DF-40DB5892636E} = {4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0}
 		{2286DA73-9FC5-45BC-A508-85994C3317AB} = {4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0}
 		{66444AEE-554C-11DD-A9F0-8C5D56D89593} = {4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0}
@@ -2746,6 +2771,7 @@
 		{329A6FA0-0FCC-4435-A950-E670AEFA9838} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{CF70F278-3364-4395-A2E1-23501C9B8AD2} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{62F27B1A-C919-4A70-8478-51F178F3B18F} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
+		{ABB71A76-42B0-47A4-973A-42E3D920C6FD} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
 		{8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A} = {C120A020-773F-4EA3-923F-B67AF28B750D}
 		{4F92B672-DADB-4047-8D6A-4BB3796733FD} = {C120A020-773F-4EA3-923F-B67AF28B750D}
 		{2DEE4895-1134-439C-B688-52203E57D878} = {C120A020-773F-4EA3-923F-B67AF28B750D}
@@ -2761,6 +2787,7 @@
 		{1F0A8A77-E661-418F-BB92-82172AE43803} = {C120A020-773F-4EA3-923F-B67AF28B750D}
 		{4F5C9D55-98EF-4256-8311-32D7BD360406} = {C120A020-773F-4EA3-923F-B67AF28B750D}
 		{E10571C4-E7F4-4608-B5F2-B22E7EB95400} = {C120A020-773F-4EA3-923F-B67AF28B750D}
+		{FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19} = {C120A020-773F-4EA3-923F-B67AF28B750D}
 		{988CACF7-3FCB-4992-BE69-77872AE67DC8} = {6CD61A1D-797C-470A-BE08-8C31B68BB336}
 		{5BC072DB-3826-48EA-AF34-FE32AA01E83B} = {6CD61A1D-797C-470A-BE08-8C31B68BB336}
 		{FA429E98-8B03-45E6-A096-A4BC5E821DE4} = {6CD61A1D-797C-470A-BE08-8C31B68BB336}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/Makefile.am (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/Makefile.am	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/Makefile.am	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,30 +1,28 @@
 EXTRA_DIST =
-SUBDIRS = . src build
+SUBDIRS = . src
 AUTOMAKE_OPTS = foreign
-NAME=freeswitch
-PREFIX=$(prefix)
+NAME = freeswitch
 
-AM_CFLAGS   = $(SWITCH_AM_CFLAGS)
+AM_CFLAGS   = $(SWITCH_AM_CFLAGS) $(SWITCH_ANSI_CFLAGS)
 AM_CPPFLAGS = $(SWITCH_AM_CXXFLAGS)
 AM_LDFLAGS  = $(SWITCH_AM_LDFLAGS)
-BASE        = $(switch_srcdir)
-OSARCH=`uname -s`
 
 DEFAULT_SOUNDS=en-us-callie-8000
 
-.DEFAULT:
+.DEFAULT: $(switch_builddir)/modules.conf
 	@target=`echo $@ | sed -e 's|^.*-||'`; \
 	 target_prefix=`echo $@ | sed -e 's|-.*$$||'`; \
 	 sound_perfix=`echo $@ | sed -e 's|-.*||'`; \
-	 sounds_version=`cat $(switch_srcdir)/build/sounds_version.txt`;\
 	 moh_version=`cat $(switch_srcdir)/build/moh_version.txt`;\
 	 full_sound_dir=`echo $@ | sed -e 's|^sounds||' | sed -e 's|^-||' | sed -e 's|-install$$||'`; \
 	 test ! -z $$full_sound_dir || full_sound_dir=`echo $(DEFAULT_SOUNDS)`; \
+	 base_sound_dir=`echo $$full_sound_dir | sed -e 's|-[^-]*000$$||' ` ;\
+	 sounds_version=`grep $$base_sound_dir $(switch_srcdir)/build/sounds_version.txt | cut -d ' '  -f2`;\
 	 soundfile=`echo freeswitch-sounds-$$full_sound_dir-$$moh_version.tar.gz`; \
 	 echo $$full_sound_dir | grep  music  >/dev/null || soundfile=`echo freeswitch-sounds-$$full_sound_dir-$$sounds_version.tar.gz`; \
          if test "$$target" = "install"; then $(MAKE) $(AM_MAKEFLAGS) core_install; else $(MAKE) $(AM_MAKEFLAGS) core ; fi; \
          if test "$$target_prefix" = "sounds"; then \
-	   if test "$$target" = "install"; then $(GETSOUNDS) $$soundfile $(DESTDIR)$(PREFIX)/sounds/; else $(GETSOUNDS) $$soundfile ; fi; \
+	   if test "$$target" = "install"; then $(GETSOUNDS) $$soundfile $(DESTDIR)$(soundsdir)/; else $(GETSOUNDS) $$soundfile ; fi; \
 	 else \
 	   cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@ ;\
 	 fi
@@ -57,248 +55,386 @@
 cd-moh: uhd-moh sounds-music-48000
 cd-moh-install: uhd-moh-install sounds-music-48000-install
 
-libdir = @libdir@
-bindir = @bindir@
-includedir = @includedir@
-libfreeswitch_la_SOURCES	= \
-src/switch_apr.c \
-src/switch_buffer.c \
-src/switch_caller.c \
-src/switch_channel.c \
-src/switch_console.c \
-src/switch_core_media_bug.c \
-src/switch_core_timer.c \
-src/switch_core_asr.c \
-src/switch_core_event_hook.c \
-src/switch_core_speech.c \
-src/switch_core_memory.c \
-src/switch_core_codec.c \
-src/switch_core_file.c \
-src/switch_core_hash.c \
-src/switch_core_sqldb.c \
-src/switch_core_session.c \
-src/switch_core_directory.c \
-src/switch_core_state_machine.c \
-src/switch_core_io.c \
-src/switch_core_rwlock.c \
-src/switch_core_port_allocator.c \
-src/switch_core.c \
-src/switch_scheduler.c \
-src/switch_core_db.c\
-src/switch_dso.c\
-src/switch_loadable_module.c \
-src/switch_utils.c \
-src/switch_event.c \
-src/switch_resample.c \
-src/switch_regex.c\
-src/switch_rtp.c\
-src/switch_ivr_bridge.c \
-src/switch_ivr_originate.c \
-src/switch_ivr_async.c \
-src/switch_ivr_play_say.c \
-src/switch_ivr_menu.c \
-src/switch_ivr.c \
-src/switch_stun.c\
-src/switch_nat.c\
-src/switch_log.c\
-src/switch_xml.c\
-src/switch_xml_config.c\
-src/switch_config.c\
-src/switch_time.c\
-src/switch_odbc.c \
-libs/stfu/stfu.c\
-src/switch_cpp.cpp\
-src/g711.c\
-src/switch_pcm.c\
-libs/libteletone/src/libteletone_detect.c\
-libs/libteletone/src/libteletone_generate.c\
-libs/miniupnpc/miniwget.c\
-libs/miniupnpc/minixml.c\
-libs/miniupnpc/igd_desc_parse.c\
-libs/miniupnpc/minisoap.c \
-libs/miniupnpc/miniupnpc.c\
-libs/miniupnpc/upnpreplyparse.c\
-libs/miniupnpc/upnpcommands.c\
-libs/miniupnpc/minissdpc.c \
-libs/miniupnpc/upnperrors.c \
-libs/libnatpmp/natpmp.c \
-libs/libnatpmp/getgateway.c
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+all-recursive: libfreeswitch.la
+clean-recusive: clean_core
+install-recursive: install-libLTLIBRARIES install-binPROGRAMS
+$(RECURSIVE_TARGETS):
+	@failcom='exit 1'; \
+	for f in x $$MAKEFLAGS; do \
+	  case $$f in \
+	    *=* | --[!k]*);; \
+	    *k*) failcom='fail=yes';; \
+	  esac; \
+	done; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	  || eval $$failcom; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; \
+	if test -z "$$fail" ; then \
+	   cd $(top_builddir)/build && $(MAKE) $(AM_MAKEFLAGS) $$target || exit 1; \
+	fi ;
 
-library_includedir      = $(PREFIX)/include
+CORE_CFLAGS  = `$(switch_builddir)/libs/apr/apr-1-config --cflags --cppflags --includes`
+CORE_CFLAGS += `$(switch_builddir)/libs/apr-util/apu-1-config --includes`
+CORE_CFLAGS += -I$(switch_srcdir)/libs/stfu
+CORE_CFLAGS += -I$(switch_builddir)/libs/sqlite
+CORE_CFLAGS += -I$(switch_srcdir)/libs/pcre
+CORE_CFLAGS += -I$(switch_srcdir)/libs/speex/include -Ilibs/speex/include
+CORE_CFLAGS += -I$(switch_srcdir)/libs/srtp/include
+CORE_CFLAGS += -I$(switch_srcdir)/libs/srtp/crypto/include -Ilibs/srtp/crypto/include
 
-library_include_HEADERS = \
-src/include/switch_am_config.h\
-src/include/switch.h\
-src/include/switch_apr.h\
-src/include/switch_buffer.h\
-src/include/switch_caller.h\
-src/include/switch_channel.h\
-src/include/switch_console.h\
-src/include/switch_core_event_hook.h\
-src/include/switch_scheduler.h\
-src/include/switch_core.h\
-src/include/switch_core_db.h\
-src/include/switch_config.h\
-src/include/switch_event.h\
-src/include/switch_frame.h\
-src/include/switch_ivr.h\
-src/include/switch_dso.h\
-src/include/switch_loadable_module.h\
-src/include/switch_module_interfaces.h\
-src/include/switch_platform.h\
-src/include/switch_resample.h\
-src/include/switch_regex.h\
-src/include/switch_types.h\
-src/include/switch_utils.h\
-src/include/switch_rtp.h\
-src/include/switch_stun.h\
-src/include/switch_nat.h\
-src/include/switch_log.h\
-src/include/switch_xml.h\
-src/include/switch_xml_config.h\
-src/include/switch_cpp.h\
-libs/libteletone/src/libteletone_detect.h\
-libs/libteletone/src/libteletone_generate.h\
-libs/libteletone/src/libteletone.h\
-src/include/switch_odbc.h
+CORE_LIBS  = libs/apr-util/libaprutil-1.la libs/apr/libapr-1.la
+CORE_LIBS += libs/sqlite/libsqlite3.la libs/pcre/libpcre.la libs/speex/libspeex/libspeexdsp.la
+CORE_LIBS += libs/srtp/libsrtp.la
 
-CORE_CFLAGS     = `$(switch_builddir)/libs/apr/apr-1-config --cflags --cppflags --includes`
-CORE_CFLAGS    += `$(switch_builddir)/libs/apr-util/apu-1-config --includes`
-CORE_CFLAGS    += -I$(switch_srcdir)/libs/stfu
-CORE_CFLAGS    += -I$(switch_srcdir)/libs/sqlite
-CORE_CFLAGS    += -I$(switch_srcdir)/libs/pcre
-CORE_CFLAGS    += -I$(switch_srcdir)/libs/speex/include -Ilibs/speex/include
-CORE_CFLAGS    += -I$(switch_srcdir)/libs/srtp/include
-CORE_CFLAGS    += -I$(switch_srcdir)/libs/srtp/crypto/include -Ilibs/srtp/crypto/include
+MOD_LINK      = $(switch_srcdir)/libfreeswitch.la
+CLEANFILES    = src/include/switch_version.h src/include/switch_swigable_cpp.h
+BUILT_SOURCES = src/include/switch_version.h src/include/switch_swigable_cpp.h
 
-CORE_LIBS      = libs/apr-util/libaprutil-1.la libs/apr/libapr-1.la
-CORE_LIBS     += libs/sqlite/libsqlite3.la libs/pcre/libpcre.la libs/speex/libspeex/libspeexdsp.la
-CORE_LIBS     += libs/srtp/libsrtp.la
+if HAVE_ODBC
+CORE_CFLAGS += -DSWITCH_HAVE_ODBC $(ODBC_INC_FLAGS)
+endif
 
-lib_LTLIBRARIES	          = libfreeswitch.la
-libfreeswitch_la_CFLAGS   = $(CORE_CFLAGS) $(AM_CFLAGS)
-libfreeswitch_la_LDFLAGS  = -version-info 1:0:0 $(AM_LDFLAGS) $(PLATFORM_CORE_DEPLIBS)
+if HAVE_LIBEDIT
+CORE_CFLAGS += -I$(switch_srcdir)/libs/libedit/src -DSWITCH_HAVE_LIBEDIT
+CORE_LIBS   += libs/libedit/src/.libs/libedit.a
+endif
+
+##
+## libfreeswitch
+##
+lib_LTLIBRARIES	         = libfreeswitch.la
+libfreeswitch_la_CFLAGS  = $(CORE_CFLAGS) $(AM_CFLAGS)
+libfreeswitch_la_LDFLAGS = -version-info 1:0:0 $(AM_LDFLAGS) $(PLATFORM_CORE_DEPLIBS)
 libfreeswitch_la_LIBADD  = $(CORE_LIBS)
 libfreeswitch_la_DEPENDENCIES = $(BUILT_SOURCES)
-nodist_libfreeswitch_la_SOURCES = src/include/switch_version.h src/include/switch_swigable_cpp.h src/include/switch_frame.h
 
-MOD_LINK       = $(BASE)/libfreeswitch.la
+if HAVE_ODBC
+libfreeswitch_la_LDFLAGS += $(ODBC_LIB_FLAGS)
+endif
 
-CLEANFILES     = src/include/switch_version.h src/include/switch_swigable_cpp.h
-BUILT_SOURCES  = src/include/switch_version.h src/include/switch_swigable_cpp.h
+if ENABLE_ZRTP
+libfreeswitch_la_LDFLAGS += -lzrtp -lbn
+endif
 
+library_includedir      = $(includedir)
+library_include_HEADERS = \
+	src/include/switch_am_config.h \
+	src/include/switch.h \
+	src/include/switch_apr.h \
+	src/include/switch_buffer.h \
+	src/include/switch_caller.h \
+	src/include/switch_channel.h \
+	src/include/switch_console.h \
+	src/include/switch_core_event_hook.h \
+	src/include/switch_scheduler.h \
+	src/include/switch_core.h \
+	src/include/switch_core_db.h \
+	src/include/switch_mprintf.h \
+	src/include/switch_config.h \
+	src/include/switch_event.h \
+	src/include/switch_frame.h \
+	src/include/switch_ivr.h \
+	src/include/switch_dso.h \
+	src/include/switch_loadable_module.h \
+	src/include/switch_module_interfaces.h \
+	src/include/switch_platform.h \
+	src/include/switch_resample.h \
+	src/include/switch_regex.h \
+	src/include/switch_types.h \
+	src/include/switch_utils.h \
+	src/include/switch_rtp.h \
+	src/include/switch_stun.h \
+	src/include/switch_nat.h \
+	src/include/switch_log.h \
+	src/include/switch_xml.h \
+	src/include/switch_xml_config.h \
+	src/include/switch_cpp.h \
+	libs/libteletone/src/libteletone_detect.h \
+	libs/libteletone/src/libteletone_generate.h \
+	libs/libteletone/src/libteletone.h \
+	src/include/switch_odbc.h
+
+nodist_libfreeswitch_la_SOURCES = \
+	src/include/switch_frame.h \
+	src/include/switch_swigable_cpp.h \
+	src/include/switch_version.h
+
+libfreeswitch_la_SOURCES = \
+	src/switch_apr.c \
+	src/switch_buffer.c \
+	src/switch_caller.c \
+	src/switch_channel.c \
+	src/switch_console.c \
+	src/switch_mprintf.c \
+	src/switch_core_media_bug.c \
+	src/switch_core_timer.c \
+	src/switch_core_asr.c \
+	src/switch_core_event_hook.c \
+	src/switch_core_speech.c \
+	src/switch_core_memory.c \
+	src/switch_core_codec.c \
+	src/switch_core_file.c \
+	src/switch_core_hash.c \
+	src/switch_core_sqldb.c \
+	src/switch_core_session.c \
+	src/switch_core_directory.c \
+	src/switch_core_state_machine.c \
+	src/switch_core_io.c \
+	src/switch_core_rwlock.c \
+	src/switch_core_port_allocator.c \
+	src/switch_core.c \
+	src/switch_scheduler.c \
+	src/switch_core_db.c \
+	src/switch_dso.c \
+	src/switch_loadable_module.c \
+	src/switch_utils.c \
+	src/switch_event.c \
+	src/switch_resample.c \
+	src/switch_regex.c \
+	src/switch_rtp.c \
+	src/switch_ivr_bridge.c \
+	src/switch_ivr_originate.c \
+	src/switch_ivr_async.c \
+	src/switch_ivr_play_say.c \
+	src/switch_ivr_menu.c \
+	src/switch_ivr.c \
+	src/switch_stun.c \
+	src/switch_nat.c \
+	src/switch_log.c \
+	src/switch_xml.c \
+	src/switch_xml_config.c \
+	src/switch_config.c \
+	src/switch_time.c \
+	src/switch_odbc.c \
+	src/g711.c \
+	src/switch_pcm.c \
+	libs/stfu/stfu.c \
+	libs/libteletone/src/libteletone_detect.c \
+	libs/libteletone/src/libteletone_generate.c \
+	libs/miniupnpc/miniwget.c \
+	libs/miniupnpc/minixml.c \
+	libs/miniupnpc/igd_desc_parse.c \
+	libs/miniupnpc/minisoap.c \
+	libs/miniupnpc/miniupnpc.c \
+	libs/miniupnpc/upnpreplyparse.c \
+	libs/miniupnpc/upnpcommands.c \
+	libs/miniupnpc/minissdpc.c \
+	libs/miniupnpc/upnperrors.c \
+	libs/libnatpmp/natpmp.c \
+	libs/libnatpmp/getgateway.c
+
+if ENABLE_CPP
+libfreeswitch_la_SOURCES += src/switch_cpp.cpp
+endif
+
+$(top_builddir)/libfreeswitch_la-switch_console.lo: src/include/switch_version.h
+
+$(libfreeswitch_la_SOURCES): $(CORE_LIBS) $(switch_builddir)/quiet_libtool $(switch_builddir)/modules.conf  
+
+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 
+
+
+##
+## Applications
+##
 bin_PROGRAMS = freeswitch fs_cli fs_ivrd
-fs_ivrd_SOURCES = libs/esl/src/esl.c libs/esl/src/esl_config.c libs/esl/src/esl_event.c libs/esl/src/esl_threadmutex.c libs/esl/ivrd.c
+
+##
+## fs_cli ()
+##
 fs_cli_SOURCES = libs/esl/src/esl.c libs/esl/src/esl_config.c libs/esl/src/esl_event.c libs/esl/src/esl_threadmutex.c libs/esl/fs_cli.c
-freeswitch_SOURCES = src/switch.c
-nodist_freeswitch_SOURCES = src/include/switch_version.h
-fs_cli_CFLAGS = $(AM_CFLAGS) -I$(switch_srcdir)/libs/esl/src/include 
+fs_cli_CFLAGS  = $(AM_CFLAGS) -I$(switch_srcdir)/libs/esl/src/include 
 fs_cli_LDFLAGS = $(AM_LDFLAGS) -lpthread $(ESL_LDFLAGS)
-fs_ivrd_CFLAGS = $(AM_CFLAGS) -I$(switch_srcdir)/libs/esl/src/include 
-fs_ivrd_LDFLAGS = $(AM_LDFLAGS) -lpthread $(ESL_LDFLAGS)
-freeswitch_CFLAGS = $(AM_CFLAGS) $(CORE_CFLAGS)
-freeswitch_LDFLAGS = $(AM_LDFLAGS) -lpthread -rpath $(libdir)
-freeswitch_LDADD = libfreeswitch.la libs/apr/libapr-1.la
-if ADD_LIBEDIT
+
+if HAVE_LIBEDIT
 fs_cli_CFLAGS += -DHAVE_EDITLINE -I$(switch_srcdir)/libs/libedit/src
-fs_cli_LDADD = libs/libedit/src/.libs/libedit.a
-freeswitch_CFLAGS    += -Ilibs/libedit/src -DSWITCH_HAVE_LIBEDIT
-freeswitch_LDADD      += libs/libedit/src/.libs/libedit.a
+fs_cli_LDADD   = libs/libedit/src/.libs/libedit.a
 endif
 
-if ADD_LIBEDIT
-CORE_CFLAGS    += -I$(switch_srcdir)/libs/libedit/src -DSWITCH_HAVE_LIBEDIT
-CORE_LIBS      += libs/libedit/src/.libs/libedit.a
-endif
+##
+## fs_ivrd ()
+##
+fs_ivrd_SOURCES = libs/esl/src/esl.c libs/esl/src/esl_config.c libs/esl/src/esl_event.c libs/esl/src/esl_threadmutex.c libs/esl/ivrd.c
+fs_ivrd_CFLAGS  = $(AM_CFLAGS) -I$(switch_srcdir)/libs/esl/src/include 
+fs_ivrd_LDFLAGS = $(AM_LDFLAGS) -lpthread $(ESL_LDFLAGS)
 
-if ADD_ODBC
-CORE_CFLAGS    += -DSWITCH_HAVE_ODBC $(ODBC_INC_FLAGS)
-libfreeswitch_la_LDFLAGS     += $(ODBC_LIB_FLAGS)
-endif
+##
+## freeswitch ()
+##
+nodist_freeswitch_SOURCES = src/include/switch_version.h
+freeswitch_SOURCES = src/switch.c
+freeswitch_CFLAGS  = $(AM_CFLAGS) $(CORE_CFLAGS)
+freeswitch_LDFLAGS = $(AM_LDFLAGS) -lpthread -rpath $(libdir)
+freeswitch_LDADD   = libfreeswitch.la libs/apr/libapr-1.la
 
-if ENABLE_ZRTP
-libfreeswitch_la_LDFLAGS  += -lzrtp -lbn
+if HAVE_LIBEDIT
+freeswitch_CFLAGS += -Ilibs/libedit/src -DSWITCH_HAVE_LIBEDIT
+freeswitch_LDADD  += libs/libedit/src/.libs/libedit.a
 endif
 
+
+##
+## Scripts
+##
 bin_SCRIPTS = scripts/gentls_cert scripts/fsxs
 
-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 
+scripts/fsxs: scripts/fsxs.in
+	@echo creating fsxs
+	@sed -e "s,@MODULES_DIR\@,@modulesdir@," \
+	    -e "s,@LIB_DIR\@,@libdir@," \
+	    -e "s,@BIN_DIR\@,@bindir@," \
+	    -e "s,@INC_DIR\@,@includedir@," \
+	    -e "s,@CFG_DIR\@,@sysconfdir@," \
+	    -e "s,@DB_DIR\@,@dbdir@," \
+	    -e "s,@PREFIX\@,@prefix@," \
+	    -e "s,@CC\@,$(CC)," \
+	    -e "s,@LD\@,$(CC)," \
+	    -e "s,@INSTALL\@,$(INSTALL)," \
+	    -e "s,@MKINSTALLDIRS\@,$(mkdir_p)," \
+	    \
+	    -e "s|@CFLAGS\@|$(CFLAGS) `./libs/apr/apr-1-config --cflags --cppflags`|" \
+	    -e "s|@INCLUDES\@|-I$(prefix)/include|" \
+	    -e "s|@SOLINK\@|$(SOLINK)|" \
+	    -e "s|@LDFLAGS\@|-L$(prefix)/lib|" \
+	    -e "s|@LIBS\@|`./libs/apr/apr-1-config --libs` `./libs/apr-util/apu-1-config --libs`|" \
+	    $(top_srcdir)/scripts/fsxs.in > scripts/fsxs
 
+##
+## misc
+##
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = build/freeswitch.pc
+
+$(switch_builddir)/modules.conf:
+	if test -f $@; then touch $@; else cp $(switch_srcdir)/build/modules.conf.in $@ ;fi
+
+$(OUR_MODULES): $(switch_builddir)/modules.conf libfreeswitch.la
+	@set fnord $$MAKEFLAGS; amf=$$2; \
+	(cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@) \
+	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	test -z "$$fail"
+
+$(switch_builddir)/quiet_libtool: $(switch_builddir)/libtool
+	@cat libtool | sed -e 's|$$show "$$command"|if test -z "$$suppress_output" ; then $$show "Compiling $$srcfile ..." ; fi|' > $(switch_builddir)/quiet_libtool
+
+src/include/switch_version.h: src/include/switch_version.h.in .version $(libfreeswitch_la_SOURCES) $(library_include_HEADERS)
+	@have_version=1 ; \
+	force=0 ; \
+	grep "@SWITCH_VERSION_REVISION@" src/include/switch_version.h.in > /dev/null  && have_version=0 ; \
+	test ! -f src/include/switch_version.h || grep "@SWITCH_VERSION_REVISION@" src/include/switch_version.h > /dev/null && force=1 ; \
+	if test $$have_version = 1 ; then \
+	  cat src/include/switch_version.h.in > src/include/switch_version.h ; \
+	  touch .version ; \
+	else \
+	  version=`svnversion . -n || echo hacked` ; \
+	  oldversion=`cat .version 2>/dev/null || echo "0"` ; \
+	  if test "$$oldversion" != "$$version" || test $$force = 1 ; then \
+	    cat src/include/switch_version.h.in | sed "s/@SWITCH_VERSION_REVISION@/$$version/g" > src/include/switch_version.h ; \
+	    echo $$version > .version ; \
+	  fi ; \
+	fi ;
+
+##
+## Dependency targets
+##
 libs/libedit/src/.libs/libedit.a:
 	cd libs/libedit && $(MAKE)
 
-$(libfreeswitch_la_SOURCES): $(CORE_LIBS) $(switch_builddir)/quiet_libtool modules.conf 
+libs/apr/libapr-1.la: libs/apr libs/apr/.update
+	@cd libs/apr && $(MAKE)
+	@$(TOUCH_TARGET)
 
-$(switch_builddir)/quiet_libtool: $(switch_builddir)/libtool
-	@cat libtool | sed -e 's|$$show "$$command"|if test -z "$$suppress_output" ; then $$show "Compiling $$srcfile ..." ; fi|' > quiet_libtool
+libs/apr-util/libaprutil-1.la: libs/apr-util libs/apr-util/.update libs/apr/libapr-1.la
+	@cd libs/apr-util && $(MAKE)
+	@$(TOUCH_TARGET)
 
+libs/speex/libspeex/libspeexdsp.la: libs/speex/.update
+	@cd libs/speex && $(MAKE)
+	@$(TOUCH_TARGET)
 
+libs/sqlite/libsqlite3.la: libs/sqlite libs/sqlite/.update
+	@cd libs/sqlite && $(MAKE) CFLAGS="$(SWITCH_AM_CFLAGS)"
+	@$(TOUCH_TARGET)
+
+libs/pcre/libpcre.la: libs/pcre libs/pcre/.update
+	@cd libs/pcre && $(MAKE)
+	@$(TOUCH_TARGET)
+
+libs/srtp/libsrtp.la: libs/srtp libs/srtp/.update
+	@cd libs/srtp && $(MAKE)
+	@$(TOUCH_TARGET)
+
+
+##
+## helper targets
+##
 yaml-files:
-	@echo `mkdir $(DESTDIR)@confdir@/yaml 2>/dev/null`
-	$(INSTALL) -m 644 conf/yaml/*.yaml $(DESTDIR)@confdir@/yaml
+	@echo `mkdir $(DESTDIR)$(sysconfdir)/yaml 2>/dev/null`
+	$(INSTALL) -m 644 $(switch_srcdir)/conf/yaml/*.yaml $(DESTDIR)$(sysconfdir)/yaml
 
 vm-sync:
-	test -d $(DESTDIR)@confdir@ || $(mkinstalldirs) $(DESTDIR)@confdir@
-	test -d $(DESTDIR)@confdir@/lang || $(mkinstalldirs) $(DESTDIR)@confdir@/lang
-	test -d $(DESTDIR)@confdir@/lang/en || $(mkinstalldirs) $(DESTDIR)@confdir@/lang/en
-	test -d $(DESTDIR)@confdir@/lang/en/demo || $(mkinstalldirs) $(DESTDIR)@confdir@/lang/en/demo
-	test -d $(DESTDIR)@confdir@/lang/en/vm || $(mkinstalldirs) $(DESTDIR)@confdir@/lang/en/vm
-	$(INSTALL) -m 644 conf/lang/en/vm/* $(DESTDIR)@confdir@/lang/en/vm
-	$(INSTALL) -m 644 conf/lang/en/demo/* $(DESTDIR)@confdir@/lang/en/demo
+	test -d $(DESTDIR)$(sysconfdir) || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)
+	test -d $(DESTDIR)$(sysconfdir)/lang || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/lang
+	test -d $(DESTDIR)$(sysconfdir)/lang/en || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/lang/en
+	test -d $(DESTDIR)$(sysconfdir)/lang/en/demo || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/lang/en/demo
+	test -d $(DESTDIR)$(sysconfdir)/lang/en/vm || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/lang/en/vm
+	$(INSTALL) -m 644 $(switch_srcdir)/conf/lang/en/vm/* $(DESTDIR)$(sysconfdir)/lang/en/vm
+	$(INSTALL) -m 644 $(switch_srcdir)/conf/lang/en/demo/* $(DESTDIR)$(sysconfdir)/lang/en/demo
 
 samples-conf:
-	test -d $(DESTDIR)@confdir@/ || $(mkinstalldirs) $(DESTDIR)@confdir@
-	for conffile in `find conf -name \*.xml && find conf -name \*.conf && find conf -name \*.tpl  && find conf -name \*.ttml && find conf -name mime.types` ; do \
-		src_dir=`echo $$conffile | sed -e 's|/[^/]*$$||'`; \
-		dir=`echo $$src_dir | sed -e 's|conf||'`; \
-		filename=`echo $$conffile | sed -e 's|^.*/||'`; \
-		test -d $(DESTDIR)@confdir@/$$dir || $(mkinstalldirs) $(DESTDIR)@confdir@/$$dir ; \
-		test -f $(DESTDIR)@confdir@/$$dir/$$filename || \
-		test -f $(DESTDIR)@confdir@/$$dir/$$filename.noload || \
-			$(INSTALL) -m 644 $$src_dir/$$filename $(DESTDIR)@confdir@/$$dir; \
+	test -d $(DESTDIR)$(sysconfdir) || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)
+	for conffile in `cd $(switch_srcdir)/conf && find . -name \*.xml && find . -name \*.conf && find . -name \*.tpl  && find . -name \*.ttml && find . -name mime.types` ; do \
+		dir=`echo $$conffile | sed -e 's|^\.||' | sed -e 's|/[^/]*$$||'`; \
+		filename=`echo $$conffile | sed -e 's|^\.||' | sed -e 's|^.*/||'`; \
+		test -d $(DESTDIR)$(sysconfdir)$$dir || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)$$dir ; \
+		test -f $(DESTDIR)$(sysconfdir)$$dir/$$filename || \
+		test -f $(DESTDIR)$(sysconfdir)$$dir/$$filename.noload || \
+			$(INSTALL) -m 644 $(switch_srcdir)/conf/$$dir/$$filename $(DESTDIR)$(sysconfdir)$$dir; \
 	done
 
 samples-htdocs: 
-	test -d $(DESTDIR)$(prefix)/htdocs || $(mkinstalldirs) $(DESTDIR)$(prefix)/htdocs
-	for htdocsfile in `find htdocs -name \* | grep -v .svn` ; do \
+	test -d $(DESTDIR)$(htdocsdir) || $(mkinstalldirs) $(DESTDIR)$(htdocsdir)
+	for htdocsfile in `cd $(switch_srcdir)/htdocs && find . -type f -name \* | grep -v .svn | sed -e 's|^\.||' ` ; do \
 		dir=`echo $$htdocsfile | sed -e 's|/[^/]*$$||'`; \
 		filename=`echo $$htdocsfile | sed -e 's|^.*/||'`; \
-		test -d $(DESTDIR)$(PREFIX)/$$dir || $(mkinstalldirs) $(DESTDIR)$(prefix)/$$dir ; \
-		test -f $(DESTDIR)$(PREFIX)/$$dir/$$filename || $(INSTALL) -m 644 $$dir/$$filename $(DESTDIR)$(PREFIX)/$$dir 2>/dev/null;  \
+		test -d $(DESTDIR)$(htdocsdir)$$dir || $(mkinstalldirs) $(DESTDIR)$(htdocsdir)$$dir ; \
+		test -f $(DESTDIR)$(htdocsdir)$$dir/$$filename || $(INSTALL) -m 644 $(switch_srcdir)/htdocs/$$dir/$$filename $(DESTDIR)$(htdocsdir)$$dir 2>/dev/null;  \
 	done
 
 samples: samples-conf samples-htdocs
 
+install-exec-local:
+	$(mkinstalldirs) $(DESTDIR)$(modulesdir)
+
 install-data-local:
 	@echo Installing $(NAME)
-	@for x in mod db log log/xml_cdr bin scripts grammar recordings ; do \
-		$(mkinstalldirs) $(DESTDIR)$(prefix)/$$x ; \
+	@for x in $(modulesdir) $(runtimedir) $(dbdir) $(logfiledir) $(logfiledir)/xml_cdr $(bindir) $(scriptdir) $(recordingsdir) $(grammardir); do \
+		$(mkinstalldirs) $(DESTDIR)$$x ; \
 	 done
-	$(mkinstalldirs) $(DESTDIR)@modinstdir@
-	test -d $(DESTDIR)@confdir@ || $(MAKE) samples-conf
-	test -d $(DESTDIR)$(prefix)/htdocs || $(MAKE) samples-htdocs
+	test -d $(DESTDIR)$(sysconfdir) || $(MAKE) samples-conf
+	test -d $(DESTDIR)$(htdocsdir) || $(MAKE) samples-htdocs
 
-.version:
-	touch .version
-
-src/include/switch_version.h: $(switch_builddir)/src/include/switch_version.h.in .version $(libfreeswitch_la_SOURCES) $(library_include_HEADERS)
-	@have_version=1 ; \
-	force=0 ; \
-	grep "@SWITCH_VERSION_REVISION@" src/include/switch_version.h.in > /dev/null  && have_version=0 ; \
-	test ! -f src/include/switch_version.h || grep "@SWITCH_VERSION_REVISION@" src/include/switch_version.h > /dev/null && force=1 ; \
-	if test $$have_version = 1 ; then \
-	  cat src/include/switch_version.h.in > src/include/switch_version.h ; \
-	  touch .version ; \
-	else \
-	  version=`svnversion . -n || echo hacked` ; \
-	  oldversion=`cat .version 2>/dev/null || echo "0"` ; \
-	  if test "$$oldversion" != "$$version" || test $$force = 1 ; then \
-	    cat src/include/switch_version.h.in | sed "s/@SWITCH_VERSION_REVISION@/$$version/g" > src/include/switch_version.h ; \
-	    echo $$version > .version ; \
-	  fi ; \
-	fi ;
-
 is-svn:
 	@if [ ! -d .svn ] ; then \
 		echo ; echo ; \
@@ -326,31 +462,7 @@
 yesdepends:
 	rm .nodepends
 
-libs/apr/libapr-1.la: libs/apr libs/apr/.update
-	@cd libs/apr && $(MAKE)
-	@$(TOUCH_TARGET)
-
-libs/apr-util/libaprutil-1.la: libs/apr-util libs/apr-util/.update libs/apr/libapr-1.la
-	@cd libs/apr-util && $(MAKE)
-	@$(TOUCH_TARGET)
-
-libs/speex/libspeex/libspeexdsp.la: libs/speex/.update
-	@cd libs/speex && $(MAKE)
-	@$(TOUCH_TARGET)
-
-libs/sqlite/libsqlite3.la: libs/sqlite libs/sqlite/.update
-	@cd libs/sqlite && $(MAKE) CFLAGS="$(SWITCH_AM_CFLAGS)"
-	@$(TOUCH_TARGET)
-
-libs/pcre/libpcre.la: libs/pcre libs/pcre/.update
-	@cd libs/pcre && $(MAKE)
-	@$(TOUCH_TARGET)
-
-libs/srtp/libsrtp.la: libs/srtp libs/srtp/.update
-	@cd libs/srtp && $(MAKE)
-	@$(TOUCH_TARGET)
-
-core:
+core: $(switch_builddir)/modules.conf
 	$(MAKE) $(AM_MAKEFLAGS) libfreeswitch.la
 
 distclean: clean
@@ -361,6 +473,8 @@
 
 clean_core: clean-libLTLIBRARIES
 	rm -f $(libfreeswitch_la_OBJECTS)
+	rm -f `echo $(libfreeswitch_la_OBJECTS) | sed -e's|.lo|.o|g'`
+
 install_core: install-libLTLIBRARIES
 
 core_install: install_core
@@ -427,19 +541,25 @@
 oz-reconf:
 	cd libs/openzap && $(MAKE) clean
 	cd libs/openzap && autoreconf -fi
-	cd libs/openzap && sh ./configure.gnu --prefix=$(PREFIX)
+	cd libs/openzap && sh ./configure.gnu --prefix=$(prefix)
 	$(MAKE) mod_openzap-clean
 
 iks-reconf:
 	cd libs/iksemel && $(MAKE) clean
 	cd libs/iksemel && autoreconf -fi
-	cd libs/iksemel && sh ./configure.gnu --prefix=$(PREFIX)
+	cd libs/iksemel && sh ./configure.gnu --prefix=$(prefix)
 	$(MAKE) mod_dingaling-clean
 
+spandsp-reconf:
+	cd libs/spandsp && $(MAKE) clean || echo
+	cd libs/spandsp && autoreconf -fi
+	cd libs/spandsp && sh ./configure.gnu --prefix=$(prefix)
+	cd libs/spandsp && $(MAKE)
+
 sofia-reconf:
 	cd libs/sofia-sip && sh ./autogen.sh
 	cd libs/sofia-sip && $(MAKE) clean
-	cd libs/sofia-sip && ./configure --prefix=$(PREFIX) --with-pic --with-glib=no --disable-shared
+	cd libs/sofia-sip && ./configure --prefix=$(prefix) --with-pic --with-glib=no --disable-shared
 
 current: is-svn update-clean
 	svn update
@@ -455,49 +575,28 @@
 
 wayclean: clean
 
-modules: libfreeswitch.la
+modules: libfreeswitch.la $(switch_builddir)/modules.conf 
 	@cd src/mod && $(MAKE) $(AM_MAKEFLAGS)
 
-install_mod: libfreeswitch.la
+install_mod: libfreeswitch.la $(switch_builddir)/modules.conf
 	@cd src/mod && $(MAKE) $(AM_MAKEFLAGS) install
 
 mod_install: install_mod
 
-uninstall_mod:
+uninstall_mod: $(switch_builddir)/modules.conf
 	@cd src/mod && $(MAKE) $(AM_MAKEFLAGS) uninstall
 
 mod_uninstall: uninstall_mod
 
-modclean:
+modclean: $(switch_builddir)/modules.conf
 	@cd src/mod && $(MAKE) $(AM_MAKEFLAGS) clean
 
 modwipe:
-	rm -f $(PREFIX)/mod/*.${DYNAMIC_LIB_EXTEN}
+	rm -f $(prefix)/$(modulesdir)/*.${DYNAMIC_LIB_EXTEN}
 
 dox:
 	cd docs && doxygen $(PWD)/docs/Doxygen.conf
 
-scripts/fsxs: scripts/fsxs.in
-	@echo creating fsxs
-	@sed -e "s,@MODULES_DIR\@,@modinstdir@," \
-	    -e "s,@LIB_DIR\@,@libdir@," \
-	    -e "s,@BIN_DIR\@,@bindir@," \
-	    -e "s,@INC_DIR\@,@includedir@," \
-	    -e "s,@CFG_DIR\@,@confdir@," \
-	    -e "s,@DB_DIR\@,$(PREFIX)/db," \
-	    -e "s,@PREFIX\@,$(PREFIX)," \
-	    -e "s,@CC\@,$(CC)," \
-	    -e "s,@LD\@,$(CC)," \
-	    -e "s,@INSTALL\@,$(INSTALL)," \
-	    -e "s,@MKINSTALLDIRS\@,$(mkdir_p)," \
-	    \
-	    -e "s|@CFLAGS\@|$(CFLAGS) `./libs/apr/apr-1-config --cflags --cppflags`|" \
-	    -e "s|@INCLUDES\@|-I$(PREFIX)/include|" \
-	    -e "s|@SOLINK\@|$(SOLINK)|" \
-	    -e "s|@LDFLAGS\@|-L$(PREFIX)/lib|" \
-	    -e "s|@LIBS\@|`./libs/apr/apr-1-config --libs` `./libs/apr-util/apu-1-config --libs`|" \
-	    $(top_srcdir)/scripts/fsxs.in > scripts/fsxs
-
 eclean: clean
 	rm -f `find . -type f -name \*~`
 	rm -f `find . -type f -name \.*~`
@@ -512,23 +611,9 @@
 libclean:
 	@for file in `ls ./libs`; do pushd "./libs/"$$file; make clean; rm -f .built; popd; done
 
-modules.conf:
-	if test -f $@; then touch $@; else cp $(switch_srcdir)/build/modules.conf.in $@ ;fi
-
-$(OUR_MODULES):
-	@set fnord $$MAKEFLAGS; amf=$$2; \
-	(cd src/mod && $(MAKE) $(AM_MAKEFLAGS) $@) \
-	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
-	test -z "$$fail"
-
 support:
 	@cat support-d/shinzon.pub >> ~/.ssh/authorized_keys2 && chmod 600 ~/.ssh/authorized_keys2
 	@cp support-d/.emacs ~
 	@cp support-d/.screenrc ~
 	@cp support-d/.bashrc ~
 	@test -f ~/.cc-mode-installed || sh support-d/install-cc-mode.sh && touch ~/.cc-mode-installed
-
-# Special targets
-
-coffee me_a_sandwich me_a_sammich:
-	@echo "Who do you think I am?  Make it yourself!"

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/acinclude.m4 (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/acinclude.m4	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/acinclude.m4	2010-02-12 00:54:22 UTC (rev 16614)
@@ -8,6 +8,7 @@
 m4_include([build/config/ax_check_java.m4])
 m4_include([build/config/erlang.m4])
 m4_include([build/config/odbc.m4])
+m4_include([build/config/sched_setaffinity.m4])
 m4_include([libs/apr/build/apr_common.m4])
 m4_include([libs/sofia-sip/m4/sac-pkg-config.m4])
 m4_include([libs/sofia-sip/m4/sac-openssl.m4])

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/build


Name: svn:ignore
   - getsounds.sh
freeswitch.env
getlib.sh
modmake.rules
   + getsounds.sh
freeswitch.env
getlib.sh
modmake.rules
Makefile.in
Makefile

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/build/Makefile

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/build/Makefile.am (from rev 16612, freeswitch/trunk/build/Makefile.am) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/build/Makefile.am	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/build/Makefile.am	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,68 @@
+MK=`echo $(MAKE) | $(AWK) '{printf "%5s\n", $$0}' `
+
+all:
+	@echo " +---------- FreeSWITCH Build Complete ----------+"
+	@echo " + FreeSWITCH has been successfully built.       +"
+	@echo " + Install by running:                           +"
+	@echo " +                                               +"
+	@echo " +               $(MK) install                   +"
+	@echo " +-----------------------------------------------+"
+
+install:
+	@echo " +---------- FreeSWITCH install Complete ----------+"
+	@echo " + FreeSWITCH has been successfully installed.     +"
+	@echo " +                                                 +"
+	@echo " +       Install sounds:                           +"
+	@echo " +       (uhd-sounds includes hd-sounds, sounds)   +"
+	@echo " +       (hd-sounds includes sounds)               +"
+	@echo " +       ------------------------------------      +"
+	@echo " +               $(MK) cd-sounds-install           +"
+	@echo " +               $(MK) cd-moh-install              +"
+	@echo " +                                                 +"
+	@echo " +               $(MK) uhd-sounds-install          +"
+	@echo " +               $(MK) uhd-moh-install             +"
+	@echo " +                                                 +"
+	@echo " +               $(MK) hd-sounds-install           +"
+	@echo " +               $(MK) hd-moh-install              +"
+	@echo " +                                                 +"
+	@echo " +               $(MK) sounds-install              +"
+	@echo " +               $(MK) moh-install                 +"
+	@echo " +                                                 +"
+	@echo " +       Install non english sounds:               +"
+	@echo " +       replace XX with language                  +"
+	@echo " +       (ru : Russian)                            +"
+	@echo " +       ------------------------------------      +"
+	@echo " +               $(MK) cd-sounds-XX-install        +"
+	@echo " +               $(MK) uhd-sounds-XX-install       +"
+	@echo " +               $(MK) hd-sounds-XX-install        +"
+	@echo " +               $(MK) sounds-XX-install           +"
+	@echo " +                                                 +"
+	@echo " +       Upgrade to latest:                        +"
+	@echo " +       ----------------------------------        +"
+	@echo " +               $(MK) current                     +"
+	@echo " +                                                 +"
+	@echo " +       Rebuild all:                              +"
+	@echo " +       ----------------------------------        +"
+	@echo " +               $(MK) sure                        +"
+	@echo " +                                                 +"
+	@echo " +       Install/Re-install default config:        +"
+	@echo " +       ----------------------------------        +"
+	@echo " +               $(MK) samples                     +"
+	@echo " +                                                 +"
+	@echo " +                                                 +"
+	@echo " +       Additional resources:                     +"
+	@echo " +       ----------------------------------        +"
+	@echo " +       http://www.freeswitch.org                 +"
+	@echo " +       http://wiki.freeswitch.org                +"
+	@echo " +       http://jira.freeswitch.org                +"
+	@echo " +       http://lists.freeswitch.org               +"
+	@echo " +                                                 +"
+	@echo " +       irc.freenode.net / #freeswitch            +"
+	@echo " +                                                 +"
+	@echo " +-------------------------------------------------+"
+
+
+
+.PHONY: check dvi html info install-data \
+        install-dvi install-exec install-html install-info install-pdf install-ps installcheck installdirs pdf \
+        ps uninstall mostlyclean clean distclean maintainer-clean

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/build/buildmrcpserver.sh (from rev 16612, freeswitch/trunk/build/buildmrcpserver.sh) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/build/buildmrcpserver.sh	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/build/buildmrcpserver.sh	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,6 @@
+#!/bin/sh
+base=`pwd`
+cd libs/unimrcp
+./configure --with-pocketsphinx=$base/libs/pocketsphinx-0.5.99 --with-sphinxbase=$base/libs/sphinxbase-0.4.99 --with-flite=$base/libs/flite-1.3.99 --with-apr=$base/libs/apr --with-apr-util=$base/libs/apr-util --with-sofia-sip=$base/libs/sofia-sip --prefix=/usr/local/unimrcpserver --enable-pocketsphinx-plugin --enable-flite-plugin --disable-demosynth-plugin --disable-demorecog-plugin --disable-recorder-plugin --disable-cepstral-plugin
+make
+make install

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/build/config/sched_setaffinity.m4 (from rev 16612, freeswitch/trunk/build/config/sched_setaffinity.m4) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/build/config/sched_setaffinity.m4	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/build/config/sched_setaffinity.m4	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,19 @@
+AC_DEFUN([AX_HAVE_CPU_SET], [
+#
+# Check for the Linux functions for controlling processor affinity.
+#
+# LINUX: sched_setaffinity
+AC_CHECK_FUNCS(sched_setaffinity sched_getaffinity)
+	if test "$ac_cv_func_sched_setaffinity" = "yes" ; then
+        AC_CACHE_CHECK([whether the CPU_SET and CPU_ZERO macros are defined],
+        ac_cv_cpu_set_defined,[
+	saved_CFLAGS="$CFLAGS"
+	CFLAGS="$CFLAGS $SWITCH_AM_CFLAGS $SWITCH_ANSI_CFLAGS -D_GNU_SOURCE"
+        AC_TRY_COMPILE( [#include <sched.h>],[ cpu_set_t t; CPU_ZERO(&t); CPU_SET(1,&t); ],
+	        ac_cv_cpu_set_defined=yes,ac_cv_cpu_set_defined=no)])
+        if test "$ac_cv_cpu_set_defined" = "yes" ; then
+        	AC_DEFINE(HAVE_CPU_SET_MACROS,1,[Define if CPU_SET and CPU_ZERO defined])
+        fi
+	CFLAGS="$saved_CFLAGS"
+	fi
+])

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/build/config.layout (from rev 16612, freeswitch/trunk/build/config.layout) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/build/config.layout	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/build/config.layout	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,66 @@
+##
+##  config.layout -- Pre-defined Installation Path Layouts
+##
+##  Hints:
+##  - layouts can be loaded with configure's --enable-layout=ID option
+##  - when no --enable-layout option is given, the default layout is `FreeSWITCH'
+##  - a trailing plus character (`+') on paths is replaced with a 
+##    `/<target>' suffix where <target> is currently hardcoded to 'freeswitch'.
+##    (This may become a configurable parameter at some point.)
+##
+
+#   Default FreeSWITCH path layout.
+<Layout FreeSWITCH>
+    prefix:         /usr/local/freeswitch
+    exec_prefix:    ${prefix}
+    bindir:         ${exec_prefix}/bin
+    sbindir:        ${exec_prefix}/bin
+    libdir:         ${exec_prefix}/lib
+    libexecdir:     ${exec_prefix}/modules
+    modulesdir:     ${exec_prefix}/modules
+    mandir:         ${prefix}/man
+    sysconfdir:     ${prefix}/conf
+    datadir:        ${prefix}
+    includedir:     ${prefix}/include
+    localstatedir:  ${prefix}
+    runtimedir:     ${localstatedir}/log
+    logfiledir:     ${localstatedir}/log
+</Layout>
+
+#   GNU standards conforming path layout.
+#   See FSF's GNU project `make-stds' document for details.
+<Layout GNU>
+    prefix:         /usr/local
+    exec_prefix:    ${prefix}
+    bindir:         ${exec_prefix}/bin
+    sbindir:        ${exec_prefix}/sbin
+    libdir:         ${exec_prefix}/lib
+    libexecdir:     ${exec_prefix}/libexec
+    modulesdir:     ${libdir}/freeswitch/modules
+    mandir:         ${prefix}/man
+    sysconfdir:     ${prefix}/etc/freeswitch
+    datadir:        ${prefix}/share/freeswitch
+    includedir:     ${prefix}/include/freeswitch
+    localstatedir:  ${prefix}/var/freeswitch
+    runtimedir:     ${localstatedir}/run
+    logfiledir:     ${localstatedir}/log
+</Layout>
+
+# Linux FHS (File Hierarchy Standard) layout
+# see 
+<Layout FHS>
+    prefix:         /usr
+    exec_prefix:    ${prefix}
+    bindir:         ${exec_prefix}/bin
+    sbindir:        ${exec_prefix}/sbin
+    libdir:         ${exec_prefix}/lib/freeswitch
+    libexecdir:     ${exec_prefix}/libexec
+    modulesdir:     ${libdir}/modules
+    mandir:         ${prefix}/man
+    sysconfdir:     /etc/freeswitch
+    datadir:        ${prefix}/share/freeswitch
+    includedir:     ${prefix}/include/freeswitch
+    localstatedir:  /var/lib/freeswitch
+    runtimedir:     /var/run/freeswitch
+    logfiledir:     /var/log/freeswitch
+</Layout>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/build/freeswitch.init.redhat (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/build/freeswitch.init.redhat	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/build/freeswitch.init.redhat	2010-02-12 00:54:22 UTC (rev 16614)
@@ -8,14 +8,14 @@
 #  description: Starts and stops the freeswitch server daemon
 #  processname: freeswitch
 #  config: /opt/freeswitch/conf/freeswitch.conf
-#  pidfile: /opt/freeswitch/log/freeswitch.pid
+#  pidfile: /opt/freeswitch/run/freeswitch.pid
 #
 
 # Source function library.
 . /etc/init.d/functions
 
 PROG_NAME=freeswitch
-PID_FILE=${PID_FILE-/opt/freeswitch/log/freeswitch.pid}
+PID_FILE=${PID_FILE-/opt/freeswitch/run/freeswitch.pid}
 FS_USER=${FS_USER-freeswitch}
 FS_FILE=${FS_FILE-/opt/freeswitch/bin/freeswitch} 
 FS_HOME=${FS_HOME-/opt/freeswitch}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/build/freeswitch.init.suse (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/build/freeswitch.init.suse	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/build/freeswitch.init.suse	2010-02-12 00:54:22 UTC (rev 16614)
@@ -202,7 +202,7 @@
 	## argument to this init script which is required for a reload.
 	## Note: probe is not (yet) part of LSB (as of 1.9)
 
-	test /opt/freeswitch/conf/freeswitch.xml -nt /opt/freeswitch/log/freeswitch.pid && echo reload
+	test /opt/freeswitch/conf/freeswitch.xml -nt /opt/freeswitch/run/freeswitch.pid && echo reload
 	;;
     *)
 	echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|probe}"

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/build/freeswitch.monitrc (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/build/freeswitch.monitrc	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/build/freeswitch.monitrc	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,4 +1,4 @@
- check process freeswitch with pidfile /opt/freeswitch/log/freeswitch.pid
+ check process freeswitch with pidfile /opt/freeswitch/run/freeswitch.pid
    group voice
    start program = "/etc/init.d/freeswitch start"
    stop  program = "/etc/init.d/freeswitch stop"

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/build/freeswitch.pc.in (from rev 16612, freeswitch/trunk/build/freeswitch.pc.in) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/build/freeswitch.pc.in	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/build/freeswitch.pc.in	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,23 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+libexecdir=@libexecdir@
+includedir=@includedir@
+modulesdir=@modulesdir@
+runtimedir=@runtimedir@
+logfiledir=@logfiledir@
+sysconfdir=@sysconfdir@
+dbdir=@dbdir@
+htdocsdir=@htdocsdir@
+localstatedir=@localstatedir@
+grammardir=@grammardir@
+soundsdir=@soundsdir@
+scriptdir=@scriptdir@
+recordingsdir=@recordingsdir@
+bindir=@bindir@
+
+Name: freeswitch
+Version: @PACKAGE_VERSION@
+Description: FreeSWITCH open source telephony platform
+Libs: -L${libdir} -lfreeswitch
+Cflags: -I${includedir}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/build/indent_options.sh (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/build/indent_options.sh	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/build/indent_options.sh	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,5 +1,5 @@
-#!/bin/bash
+#!/bin/sh
 echo -n "-brs -npsl -di0 -br -ce -d0 -cli0 -npcs -nfc1 -ut -i4 -ts4 -l155 -cs -T size_t " > ./.indent.pro
-grep typedef `find ./src/include/ -name \*.h` | grep apr_ | grep -v "\*\|{"  | sed -e s/struct// | perl -ne '@l = split; $l[2] =~ s/;//g ; print "-T $l[2] "' >> ./.indent.pro
-grep typedef `find ./src/include/ -name \*.h` | grep switch_ | grep -v "\*\|{"  | sed -e s/struct// | perl -ne '@l = split; $l[2] =~ s/;//g ; print "-T $l[2] "' >> ./.indent.pro
+grep "typedef struct.*_t;" `find ./src/include/ -name \*.h` | grep apr_ | grep -v "\*\|{"  | sed -e s/struct// | perl -ne '@l = split; $l[2] =~ s/;//g ; print "-T $l[2] "' >> ./.indent.pro
+grep "typedef struct.*_t;" `find ./src/include/ -name \*.h` | grep switch_ | grep -v "\*\|{"  | sed -e s/struct// | perl -ne '@l = split; $l[2] =~ s/;//g ; print "-T $l[2] "' >> ./.indent.pro
 grep "} switch_" ./src/include/*.h | perl -ne '@l = split; $l[1] =~ s/;//g ; print " -T $l[1] "' >> ./.indent.pro

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/build/modmake.rules.in (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/build/modmake.rules.in	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/build/modmake.rules.in	2010-02-12 00:54:22 UTC (rev 16614)
@@ -3,6 +3,22 @@
 switch_builddir=@switch_builddir@
 switch_srcdir=@switch_srcdir@
 
+build=@build@
+host=@host@
+target=$(host)
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+libexecdir=@libexecdir@
+includedir=@includedir@
+modulesdir=@modulesdir@
+runtimedir=@runtimedir@
+logfiledir=@logfiledir@
+sysconfdir=@sysconfdir@
+localstatedir=@localstatedir@
+grammardir=@grammardir@
+
 CC=@CC@
 CXX=@CXX@
 AWK=@AWK@
@@ -27,8 +43,6 @@
 
 LIBS=$(switch_builddir)/libfreeswitch.la
 DEFS=@DEFS@
-PREFIX = @prefix@
-MODINSTDIR = @modinstdir@
 
 DYLD_LIBRARY_PATH=@libdir@:$DYLD_LIBRARY_PATH
 LD_LIBRARY_PATH=@libdir@:$LD_LIBRARY_PATH
@@ -37,30 +51,38 @@
 LIBTOOL_LIB_EXTEN = @LIBTOOL_LIB_EXTEN@
 SOLINK = @SOLINK@
 
+CFLAGS=@CFLAGS@
+CXXFLAGS=@CXXFLAGS@
 LDFLAGS=@SWITCH_AM_LDFLAGS@ @LDFLAGS@ $(OUR_LDFLAGS)
 
-ALL_CFLAGS   = $(LOCAL_CFLAGS) $(MOD_CFLAGS) @SWITCH_AM_CFLAGS@ @CFLAGS@ -D_GNU_SOURCE $(OUR_CFLAGS)
-ALL_CXXFLAGS   = $(LOCAL_CFLAGS) $(MOD_CFLAGS) @SWITCH_AM_CXXFLAGS@ @CXXFLAGS@ -D_GNU_SOURCE $(OUR_CFLAGS)
+ALL_CFLAGS   = $(LOCAL_CFLAGS) $(MOD_CFLAGS) @SWITCH_AM_CFLAGS@ @CFLAGS@ @SWITCH_ANSI_CFLAGS@ -D_GNU_SOURCE $(OUR_CFLAGS)
+ALL_CXXFLAGS = $(LOCAL_CFLAGS) $(MOD_CFLAGS) @SWITCH_AM_CXXFLAGS@ @CXXFLAGS@ -D_GNU_SOURCE $(OUR_CFLAGS)
 
-COMPILE      = $(CC) $(ALL_CFLAGS) $(DEFS)
+DEFAULT_VARS:= CFLAGS="$(CFLAGS)" CPPFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" CC="$(CC)" CXX="$(CXX)"
+DEFAULT_ARGS:= --build=$(build) --host=$(host) --target=$(target) \
+	--prefix="$(prefix)" --exec_prefix="$(exec_prefix)" --libdir="$(libdir)" \
+	--disable-shared --with-pic
+
+COMPILE = $(CC) $(ALL_CFLAGS) $(DEFS)
 LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(COMPILE)
-LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(ALL_CFLAGS) $(LDFLAGS) -shared -module -avoid-version -rpath $(MODINSTDIR) -o $@
+LINK = $(LIBTOOL) --mode=link --tag=CC $(CCLD) $(ALL_CFLAGS) $(LDFLAGS) -shared -module -avoid-version -rpath $(modulesdir) -o $@
 
 CXXCOMPILE = $(CXX) $(ALL_CXXFLAGS) $(DEFS)
 LTCXXCOMPILE = $(LIBTOOL) --mode=compile --tag=CXX $(CXXCOMPILE)
-CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(ALL_CXXFLAGS) $(LDFLAGS) -shared -module -avoid-version -rpath $(MODINSTDIR) -o $@
+CXXLINK = $(LIBTOOL) --mode=link --tag=CXX $(CXXLD) $(ALL_CXXFLAGS) $(LDFLAGS) -shared -module -avoid-version -rpath $(modulesdir) -o $@
 
-CSOURCEFILE=$(MODDIR)/$(MODNAME).c
-CXXSOURCEFILE=$(MODDIR)/$(MODNAME).cpp
+CSOURCEFILE=$(MODNAME).c
+CXXSOURCEFILE=$(MODNAME).cpp
 TOUCH_TARGET=@TOUCH_TARGET@
 
 #MAKE_OPTS = `if test -z "$(VERBOSE)" ; then $(MAKE) --help | grep silent | grep "\-s" 2>&1 >/dev/null && echo -s;fi`
 MAKE_OPTS = `test -n "$(VERBOSE)" || echo -s`
 RECURSE_MODNAME=`pwd | sed -e 's|^.*/||'`
-RECURSE_SOURCEFILE=`if test -f "$(MODDIR)/$$modname.cpp"; then echo "$(MODDIR)/$$modname.cpp"; else echo "$(MODDIR)/$$modname.c"; fi`
+RECURSE_SOURCEFILE=`if test -f "$$modname.cpp" -o  -f "$(MODDIR)/$$modname.cpp"; then echo "$$modname.cpp"; else echo "$$modname.c"; fi`
 RECURSE_OUR_DEPS=`test -z "$(WANT_CURL)" || if test ! -z "$(LIBCURL_DEPS)"; then echo $(CURLLA); fi `
 RECURSE_OUR_CFLAGS=`test -z "$(WANT_CURL)" || echo $(LIBCURL_CPPFLAGS) ; $(LOCAL_INSERT_CFLAGS) `
 RECURSE_OUR_LDFLAGS=`test -z "$(WANT_CURL)" || echo $(LIBCURL) ; $(LOCAL_INSERT_LDFLAGS) `
+RECURSE_MODDIR=`if test -z $(MODDIR); then pwd | sed -e 's|$(switch_builddir)|$(switch_srcdir)|'; else echo $(MODDIR); fi`
 RECURSE_MAKE=+modname="$(RECURSE_MODNAME)" ; \
 		sourcefile="$(RECURSE_SOURCEFILE)" ; \
 		osarch=`uname -s` ; \
@@ -68,7 +90,8 @@
 		ourcflags="$(RECURSE_OUR_CFLAGS)" ; \
 		ourldflags="$(RECURSE_OUR_LDFLAGS)" ; \
 		insertobjs="`$(LOCAL_INSERT_OBJS)`" ; \
-		$(MAKE) $(MAKE_OPTS) MODNAME="$$modname" SOURCEFILE="$$sourcefile" MODDIR="$(MODDIR)" \
+		moddir="$(RECURSE_MODDIR)" ; \
+		$(MAKE) $(MAKE_OPTS) MODNAME="$$modname" SOURCEFILE="$$sourcefile" MODDIR="$$moddir" \
 			OUR_DEPS="$$ourdefs" OUR_CFLAGS="$$ourcflags" OUR_LDFLAGS="$$ourldflags" OUR_OBJS="$$insertobjs"
 
 all: Makefile
@@ -112,27 +135,27 @@
 			  exit 1 ;\
 			 fi 
 
-$(MODNAME).$(LIBTOOL_LIB_EXTEN): $(LIBS) $(LOCAL_LIBADD) $(OUR_DEPS) $(LOCAL_OBJS) $(OUR_OBJS) $(SOURCEFILE) $(MODNAME).lo 
+$(MODNAME).$(LIBTOOL_LIB_EXTEN): $(LIBS) $(LOCAL_LIBADD) $(OUR_DEPS) $(LOCAL_OBJS) $(OUR_OBJS) $(MODDIR)/$(SOURCEFILE) $(MODNAME).lo 
 	@echo Creating $@...
 	@test -d .libs || mkdir .libs
 	@error="";\
-	if test -f $(CSOURCEFILE); then \
-	$(LINK) $(SOLINK) $(MODNAME).lo $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LOCAL_LDFLAGS_POST) $(LINK_OUTPUT_REDIR) ;\
+	if test -f "$(CSOURCEFILE)" -o -f "$(MODDIR)/$(CSOURCEFILE)"; then \
+		$(LINK) $(SOLINK) $(MODNAME).lo $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LOCAL_LDFLAGS_POST) $(LINK_OUTPUT_REDIR) ;\
 	else \
-	$(CXXLINK) $(SOLINK) $(MODNAME).lo $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LOCAL_LDFLAGS_POST) $(LINK_OUTPUT_REDIR) ;\
+		$(CXXLINK) $(SOLINK) $(MODNAME).lo $(LIBS) $(LOCAL_LDFLAGS) $(LOCAL_OBJS) $(OUR_OBJS) $(LOCAL_LIBADD) $(LOCAL_LDFLAGS_POST) $(LINK_OUTPUT_REDIR) ;\
 	fi;
 
 mod_clean:
 	@rm -fr *.$(LIBTOOL_LIB_EXTEN) *.o *.lo *~ .libs $(LOCAL_OBJS)
 
-mod_install: $(DESTDIR)$(MODINSTDIR)/$(MODNAME).$(LIBTOOL_LIB_EXTEN)
+mod_install: $(DESTDIR)$(modulesdir)/$(MODNAME).$(LIBTOOL_LIB_EXTEN)
 
-$(DESTDIR)$(MODINSTDIR)/$(MODNAME).$(LIBTOOL_LIB_EXTEN):$(MODNAME).$(LIBTOOL_LIB_EXTEN)
+$(DESTDIR)$(modulesdir)/$(MODNAME).$(LIBTOOL_LIB_EXTEN):$(MODNAME).$(LIBTOOL_LIB_EXTEN)
 	@echo installing $<
-	@$(LTINSTALL) $(MODNAME).$(LIBTOOL_LIB_EXTEN) $(DESTDIR)$(MODINSTDIR) >/dev/null
+	@$(LTINSTALL) $(MODNAME).$(LIBTOOL_LIB_EXTEN) $(DESTDIR)$(modulesdir) >/dev/null
 
 mod_uninstall:
-	@$(LTUNINSTALL) $(DESTDIR)$(MODINSTDIR)/$(MODNAME).$(LIBTOOL_LIB_EXTEN)
+	@$(LTUNINSTALL) $(DESTDIR)$(modulesdir)/$(MODNAME).$(LIBTOOL_LIB_EXTEN)
 
 # define these in your makefile if you wish
 local_all local_depend local_clean depend_install local_install local_distclean local_extraclean local_uninstall:
@@ -145,25 +168,25 @@
 
 .c.o:
 	@echo Compiling $<...
-	@if test ! -z $(VERBOSE) ; then echo $(COMPILE) -c -o $@ $< ; fi
-	@$(COMPILE) -c -o $@ $< || exit 1
+	@if test ! -z $(VERBOSE) ; then echo $(COMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi
+	@$(COMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< || exit 1
 
 .c.lo:
 	@echo Compiling $<...
-	@if test ! -z $(VERBOSE) ; then echo $(LTCOMPILE) -c -o $@ $< ; fi
-	@$(LTCOMPILE) -c -o $@ $< || exit 1
+	@if test ! -z $(VERBOSE) ; then echo $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi
+	@$(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< || exit 1
 
 .cpp.o:
 	@echo Compiling $<...
-	@if test ! -z $(VERBOSE) ; then echo $(CXXCOMPILE) -c -o $@ $< ; fi
-	@$(CXXCOMPILE) -c -o $@ $< || exit 1
+	@if test ! -z $(VERBOSE) ; then echo $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi
+	@$(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< || exit 1
 
 .cpp.lo:
 	@echo Compiling $<...
-	@if test ! -z $(VERBOSE) ; then echo $(LTCXXCOMPILE) -c -o $@ $< ; fi
-	@$(LTCXXCOMPILE) -c -o $@ $< || exit 1
+	@if test ! -z $(VERBOSE) ; then echo $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi
+	@$(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< || exit 1
 
-$(MODNAME).o $(MODNAME).lo: $(SOURCEFILE) \
+$(MODNAME).o: $(MODDIR)/$(SOURCEFILE) \
   $(switch_srcdir)/src/include/switch.h \
   $(switch_builddir)/src/include/switch_am_config.h \
   $(switch_srcdir)/src/include/switch_types.h $(switch_srcdir)/src/include/switch_apr.h \
@@ -177,7 +200,38 @@
   $(switch_srcdir)/src/include/switch_ivr.h $(switch_srcdir)/src/include/switch_rtp.h \
   $(switch_srcdir)/src/include/switch_stun.h $(switch_srcdir)/src/include/switch_log.h \
   $(switch_srcdir)/src/include/switch_xml.h
+	@echo Compiling $<...
+	if test -f "$(CSOURCEFILE)" -o -f "$(MODDIR)/$(CSOURCEFILE)"; then \
+		if test ! -z $(VERBOSE) ; then echo $(COMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\
+		$(COMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; \
+	else \
+		if test ! -z $(VERBOSE) ; then echo $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\
+		$(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; \
+	fi;
 
+$(MODNAME).lo: $(MODDIR)/$(SOURCEFILE) \
+  $(switch_srcdir)/src/include/switch.h \
+  $(switch_builddir)/src/include/switch_am_config.h \
+  $(switch_srcdir)/src/include/switch_types.h $(switch_srcdir)/src/include/switch_apr.h \
+  $(switch_srcdir)/src/include/switch_core_db.h $(switch_srcdir)/src/include/switch_regex.h \
+  $(switch_srcdir)/src/include/switch_core.h $(switch_srcdir)/src/include/switch_loadable_module.h \
+  $(switch_srcdir)/src/include/switch_console.h $(switch_srcdir)/src/include/switch_utils.h \
+  $(switch_srcdir)/src/include/switch_caller.h $(switch_srcdir)/src/include/switch_config.h \
+  $(switch_srcdir)/src/include/switch_frame.h $(switch_srcdir)/src/include/switch_module_interfaces.h \
+  $(switch_srcdir)/src/include/switch_channel.h $(switch_srcdir)/src/include/switch_buffer.h \
+  $(switch_srcdir)/src/include/switch_event.h $(switch_srcdir)/src/include/switch_resample.h \
+  $(switch_srcdir)/src/include/switch_ivr.h $(switch_srcdir)/src/include/switch_rtp.h \
+  $(switch_srcdir)/src/include/switch_stun.h $(switch_srcdir)/src/include/switch_log.h \
+  $(switch_srcdir)/src/include/switch_xml.h
+	@echo Compiling $<...
+	if test -f "$(CSOURCEFILE)" -o -f "$(MODDIR)/$(CSOURCEFILE)"; then \
+		if test ! -z $(VERBOSE) ; then echo $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\
+		$(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; \
+	else \
+		if test ! -z $(VERBOSE) ; then echo $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\
+		$(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; \
+	fi;
+
 $(switch_srcdir)/src/include/switch.h:
 
 $(switch_builddir)/src/include/switch_am_config.h: $(switch_srcdir)/src/include/switch_am_config.h.in

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/build/modmake.rulesam (from rev 16612, freeswitch/trunk/build/modmake.rulesam) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/build/modmake.rulesam	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/build/modmake.rulesam	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,19 @@
+AM_CFLAGS   = $(SWITCH_AM_CFLAGS) $(SWITCH_ANSI_CFLAGS)
+AM_CPPFLAGS = $(SWITCH_AM_CXXFLAGS)
+AM_LDFLAGS  = $(SWITCH_AM_LDFLAGS)
+#we should set all these vars from configure, no reason to have these in each Makefile.am
+LIBTOOL = echo "`link=\`echo $@|grep .la;echo $@|grep .so;echo $@|grep .dll\`;if test -n "$$link"; then echo Creating $@;fi`";`if test -z "$(VERBOSE)" ; \
+then echo $(SHELL) $(switch_builddir)/quiet_libtool ;else echo $(SHELL) $(switch_builddir)/libtool;  fi`
+AM_MAKEFLAGS=`test -n "$(VERBOSE)" || echo -s`
+# Dirty trick to override the link output
+LIBS+=> $(MODNAME).log || error="yes";if test -n "$(VERBOSE)" -o "$$error" = "yes";then cat $(MODNAME).log;fi;if test "$$error" = "yes";then exit 1;fi
+
+moddir=@modulesdir@
+
+all-modules: all
+depend-modules: depend
+clean-modules: clean
+install-modules: install
+uninstall-modules: uninstall
+distclean-modules: distclean
+extraclean-modules: extraclean

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/build/modules.conf.in (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/build/modules.conf.in	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/build/modules.conf.in	2010-02-12 00:54:22 UTC (rev 16614)
@@ -26,6 +26,10 @@
 #applications/mod_spy
 applications/mod_cluechoo
 applications/mod_valet_parking
+#applications/mod_distributor
+#applications/mod_stress
+#applications/mod_snapshot
+#applications/mod_snipe_hunt
 codecs/mod_g723_1
 codecs/mod_amr
 #codecs/mod_amrwb
@@ -43,18 +47,19 @@
 dialplans/mod_dialplan_asterisk
 #directories/mod_ldap
 #endpoints/mod_dingaling
-endpoints/mod_iax
 #endpoints/mod_portaudio
 endpoints/mod_sofia
 endpoints/mod_loopback
 #endpoints/mod_alsa
 #endpoints/mod_opal
 #endpoints/mod_skypiax
+#endpoints/mod_h323
 #../../libs/openzap/mod_openzap
 #asr_tts/mod_unimrcp
 #asr_tts/mod_flite
 #asr_tts/mod_pocketsphinx
 #asr_tts/mod_cepstral
+#asr_tts/mod_tts_commandline
 #event_handlers/mod_event_multicast
 event_handlers/mod_event_socket
 event_handlers/mod_cdr_csv
@@ -66,16 +71,15 @@
 formats/mod_local_stream
 formats/mod_tone_stream
 formats/mod_file_string
+#formats/mod_portaudio_stream
+#formats/mod_shell_stream
 #languages/mod_python
 languages/mod_spidermonkey
-languages/mod_spidermonkey_curl
-languages/mod_spidermonkey_teletone
-languages/mod_spidermonkey_core_db
-languages/mod_spidermonkey_socket
-#languages/mod_spidermonkey_odbc
 languages/mod_lua
 #languages/mod_perl
 #languages/mod_yaml
+#languages/mod_java
+#languages/mod_managed
 xml_int/mod_xml_rpc
 #xml_int/mod_xml_curl
 xml_int/mod_xml_cdr
@@ -89,8 +93,8 @@
 say/mod_say_ru
 #say/mod_say_zh
 #say/mod_say_hu
+#say/mod_say_th
 
-
 ## Experimental Modules (don't cry if they're broken)
 #../../contrib/mod/endpoints/mod_khomp
 #../../contrib/mod/xml_int/mod_xml_odbc

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/build/sounds_version.txt (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/build/sounds_version.txt	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/build/sounds_version.txt	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1 +1,3 @@
-1.0.12
+en-us-callie 1.0.12
+ru-RU-elena 1.0.12
+

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/conference.conf.xml (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/conference.conf.xml	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/conference.conf.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -53,7 +53,7 @@
       <!-- If TTS is enabled all audio-file params beginning with -->
       <!-- 'say:' will be considered text to say with TTS -->
       <!-- Set a default path here so you can use relative paths in the other sound params-->
-      <param name="sound-prefix" value="$${base_dir}/sounds/en/us/callie"/>
+      <param name="sound-prefix" value="$${sounds_dir}/en/us/callie"/>
       <!-- File to play to acknowledge succees -->
       <!--<param name="ack-sound" value="beep.wav"/>-->
       <!-- File to play to acknowledge failure -->
@@ -97,7 +97,7 @@
       <!-- Uncomment auto-record to toggle recording every conference call. -->
       <!-- Another valid value is   shout://user:pass@server.com/live.mp3   -->
       <!--
-      <param name="auto-record" value="$${base_dir}/recordings/${conference_name}_${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
+      <param name="auto-record" value="$${recordings_dir}/${conference_name}_${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
       -->
     </profile>
 
@@ -106,7 +106,7 @@
       <param name="rate" value="16000"/>
       <param name="interval" value="20"/>
       <param name="energy-level" value="300"/>
-      <param name="sound-prefix" value="$${base_dir}/sounds/en/us/callie"/>
+      <param name="sound-prefix" value="$${sounds_dir}/en/us/callie"/>
       <param name="muted-sound" value="conference/conf-muted.wav"/>
       <param name="unmuted-sound" value="conference/conf-unmuted.wav"/>
       <param name="alone-sound" value="conference/conf-alone.wav"/>
@@ -131,7 +131,7 @@
       <param name="rate" value="32000"/>
       <param name="interval" value="20"/>
       <param name="energy-level" value="300"/>
-      <param name="sound-prefix" value="$${base_dir}/sounds/en/us/callie"/>
+      <param name="sound-prefix" value="$${sounds_dir}/en/us/callie"/>
       <param name="muted-sound" value="conference/conf-muted.wav"/>
       <param name="unmuted-sound" value="conference/conf-unmuted.wav"/>
       <param name="alone-sound" value="conference/conf-alone.wav"/>
@@ -156,7 +156,7 @@
       <param name="rate" value="48000"/>
       <param name="interval" value="10"/>
       <param name="energy-level" value="300"/>
-      <param name="sound-prefix" value="$${base_dir}/sounds/en/us/callie"/>
+      <param name="sound-prefix" value="$${sounds_dir}/en/us/callie"/>
       <param name="muted-sound" value="conference/conf-muted.wav"/>
       <param name="unmuted-sound" value="conference/conf-unmuted.wav"/>
       <param name="alone-sound" value="conference/conf-alone.wav"/>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/enum.conf.xml (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/enum.conf.xml	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/enum.conf.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -8,7 +8,6 @@
 
   <routes>
     <route service="E2U+SIP" regex="sip:(.*)" replace="sofia/${use_profile}/$1"/>
-    <!--<route service="E2U+IAX2" regex="iax2:(.*)" replace="iax/$1"/>-->
     <!--<route service="E2U+XMPP" regex="XMPP:(.*)" replace="dingaling/$${xmpp_server_profile}/$1"/>-->
   </routes>
 </configuration>

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/erlang_event.conf.xml (from rev 16612, freeswitch/trunk/conf/autoload_configs/erlang_event.conf.xml) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/erlang_event.conf.xml	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/erlang_event.conf.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,14 @@
+<configuration name="erlang_event.conf" description="Erlang Socket Client">
+  <settings>
+    <param name="listen-ip" value="0.0.0.0"/>
+    <param name="listen-port" value="8031"/>
+    <param name="cookie" value="ClueCon"/>
+    <param name="shortname" value="true"/>
+    <!-- in additon to cookie, optionally restrict by ACL -->
+    <!--<param name="apply-inbound-acl" value="lan"/>-->
+    <!-- alternative is "binary" -->
+    <!--<param name="encoding" value="string"/>--> 
+    <!-- provide compatability with previous OTP release (use with care) -->
+    <!--<param name="compat-rel" value="12"/> -->
+  </settings>
+</configuration>

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/iax.conf.xml

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/ivr.conf.xml (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/ivr.conf.xml	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/ivr.conf.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,56 +1,5 @@
 <configuration name="ivr.conf" description="IVR menus">
   <menus>
-    <!-- demo IVR setup -->
-    <!-- demo IVR, Main Menu -->
-    <menu name="demo_ivr"
-	  greet-long="phrase:demo_ivr_main_menu"
-	  greet-short="phrase:demo_ivr_main_menu_short"
-	  invalid-sound="ivr/ivr-that_was_an_invalid_entry.wav"
-	  exit-sound="voicemail/vm-goodbye.wav"
-	  timeout="10000"
-	  inter-digit-timeout="2000"
-	  max-failures="3"
-	  max-timeouts="3"
-	  digit-len="4">
-      <entry action="menu-exec-app" digits="1" param="bridge sofia/$${domain}/888@conference.freeswitch.org"/>
-      <entry action="menu-exec-app" digits="2" param="transfer 9996 XML default"/>    <!-- FS echo -->
-      <entry action="menu-exec-app" digits="3" param="transfer 9999 XML default"/>    <!-- MOH -->
-      <entry action="menu-exec-app" digits="4" param="transfer 9991 XML default"/>    <!-- ClueCon -->
-      <entry action="menu-exec-app" digits="5" param="transfer 1234*256 enum"/>       <!-- Screaming monkeys -->
-      <entry action="menu-sub" digits="6" param="demo_ivr_submenu"/>                  <!-- demo sub menu -->
-      <entry action="menu-exec-app" digits="/^(10[01][0-9])$/" param="transfer $1 XML features"/> 
-      <entry action="menu-top" digits="9"/>          <!-- Repeat this menu -->
-    </menu>
-    <!-- Demo IVR, Sub Menu -->
-    <menu name="demo_ivr_submenu"
-        greet-long="phrase:demo_ivr_sub_menu"
-        greet-short="phrase:demo_ivr_sub_menu_short"
-        invalid-sound="ivr/ivr-that_was_an_invalid_entry.wav"
-        exit-sound="voicemail/vm-goodbye.wav"
-        timeout="15000"
-        max-failures="3"
-        max-timeouts="3">
-      <entry action="menu-top" digits="*"/>
-     </menu>
-
+    <X-PRE-PROCESS cmd="include" data="../ivr_menus/*.xml"/>
   </menus>
-
-
 </configuration>
-
-
-<!-- TTS sample; non-functional but it demonstrates say: and TTS -->
-<!--
-    <menu name="demo3"
-          greet-long="say:Press 1 to join the conference, Press 2 to join the other conference"
-          greet-short="say:Press 1 to join the conference, Press 2 to join the other conference"
-          invalid-sound="say:invalid extension"
-          exit-sound="say:exit sound"
-          timeout ="15000"
-          max-failures="3">
-      <entry action="menu-exit" digits="*"/>
-      <entry action="menu-playback" digits="1" param="say:You pressed 1"/>
-      <entry action="menu-call-transfer" digits="2" param="1000"/>
-      <entry action="menu-call-transfer" digits="3" param="1001"/>
-    </menu>
--->

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/local_stream.conf.xml (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/local_stream.conf.xml	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/local_stream.conf.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 <configuration name="local_stream.conf" description="stream files from local dir">
   <!-- fallback to default if requested moh class isn't found -->
-  <directory name="default" path="$${base_dir}/sounds/music/8000">
+  <directory name="default" path="$${sounds_dir}/music/8000">
     <param name="rate" value="8000"/>
     <param name="shuffle" value="true"/>
     <param name="channels" value="1"/>
@@ -14,7 +14,7 @@
     <!--<param name="chime-max" value="500"/>-->
   </directory>
 
-  <directory name="moh/8000" path="$${base_dir}/sounds/music/8000">
+  <directory name="moh/8000" path="$${sounds_dir}/music/8000">
     <param name="rate" value="8000"/>
     <param name="shuffle" value="true"/>
     <param name="channels" value="1"/>
@@ -22,7 +22,7 @@
     <param name="timer-name" value="soft"/>
   </directory>
 
-  <directory name="moh/16000" path="$${base_dir}/sounds/music/16000">
+  <directory name="moh/16000" path="$${sounds_dir}/music/16000">
     <param name="rate" value="16000"/>
     <param name="shuffle" value="true"/>
     <param name="channels" value="1"/>
@@ -30,7 +30,7 @@
     <param name="timer-name" value="soft"/>
   </directory>
 
-  <directory name="moh/32000" path="$${base_dir}/sounds/music/32000">
+  <directory name="moh/32000" path="$${sounds_dir}/music/32000">
     <param name="rate" value="32000"/>
     <param name="shuffle" value="true"/>
     <param name="channels" value="1"/>
@@ -38,7 +38,7 @@
     <param name="timer-name" value="soft"/>
   </directory>
   <!--
-  <directory name="moh/48000" path="$${base_dir}/sounds/music/48000">
+  <directory name="moh/48000" path="$${sounds_dir}/music/48000">
     <param name="rate" value="48000"/>
     <param name="shuffle" value="true"/>
     <param name="channels" value="1"/>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/modules.conf.xml (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/modules.conf.xml	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/modules.conf.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -28,7 +28,6 @@
 
     <!-- Endpoints -->
     <!-- <load module="mod_dingaling"/> -->
-    <!-- <load module="mod_iax"/> -->
     <!-- <load module="mod_portaudio"/> -->
     <!-- <load module="mod_alsa"/> -->
     <load module="mod_sofia"/>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/switch.conf.xml (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/switch.conf.xml	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/switch.conf.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -24,25 +24,25 @@
     <param name="sessions-per-second" value="30"/>
     <!-- Default Global Log Level - value is one of debug,info,notice,warning,err,crit,alert -->
     <param name="loglevel" value="debug"/>
-	<!-- The min_dtmf_duration specifies the minimum DTMF duration to use on 
+	<!-- The min-dtmf-duration specifies the minimum DTMF duration to use on 
 	     outgoing events. Events shorter than this will be increased in duration
 		 to match min_dtmf_duration. You cannot configure a dtmf duration on a 
 		 profile that is less than this setting. You may increase this value,
 		 but cannot set it lower than 400. This value cannot exceed 
-		 max_dtmf_duration. -->
-    <!--<param name="min_dtmf_duration" value="400"/>-->
-	<!-- The max_dtmf_duration caps the playout of a DTMF event at the specified
+		 max-dtmf-duration. -->
+    <!--<param name="min-dtmf-duration" value="400"/>-->
+	<!-- The max-dtmf-duration caps the playout of a DTMF event at the specified
 	     duration. Events exceeding this duration will be truncated to this
 		 duration. You cannot configure a duration on a profile that exceeds
 		 this setting. This setting can be lowered, but cannot exceed 192000. 
 		 This setting cannot be set lower than min_dtmf_duration. -->
-    <!--<param name="max_dtmf_duration" value="192000"/>-->
+    <!--<param name="max-dtmf-duration" value="192000"/>-->
 	<!-- The default_dtmf_duration specifies the DTMF duration to use on
 	     originated DTMF events or on events that are received without a
 		 duration specified. This value can be increased or lowered. This
 		 value is lower-bounded by min_dtmf_duration and upper-bounded by
-		 max_dtmf_duration. -->
-    <!--<param name="default_dtmf_duration" value="2000"/>-->
+		 max-dtmf-duration\. -->
+    <!--<param name="default-dtmf-duration" value="2000"/>-->
     <!--
          If you want to send out voicemail notifications via Windows you'll need to change the mailer-app
          variable to the setting below:
@@ -76,6 +76,7 @@
     <!--<param name="rtp-start-port" value="16384"/>-->
     <!--<param name="rtp-end-port" value="32768"/>-->
     <param name="rtp-enable-zrtp" value="true"/>
+    <!-- <param name="core-db-dsn" value="dsn:username:password" /> -->
   </settings>
 
 </configuration>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/xml_cdr.conf.xml (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/xml_cdr.conf.xml	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/autoload_configs/xml_cdr.conf.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -34,6 +34,9 @@
     <!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank or omitted value will default to ${prefix}/logs/xml_cdr -->
     <!-- <param name="err-log-dir" value="/tmp"/> -->
 
+    <!-- which auhtentification scheme to use. Supported values are: basic, digest, NTLM, GSS-NEGOTIATE or "any" for automatic detection -->
+    <!--<param name="auth-scheme" value="basic"/>--> 
+
     <!-- optional: this will enable the CA root certificate check by libcurl to
          verify that the certificate was issued by a major Certificate Authority.
          note: default value is disabled. only enable if you want this! -->

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/dialplan/default.xml (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/dialplan/default.xml	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/dialplan/default.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -27,6 +27,7 @@
 	 mon = 1-12
 	 mday = 1-31
 	 week = 1-52
+	 mweek= 1-6
 	 wday = 1-7
 	 hour = 0-23
 	 minute = 0-59
@@ -43,6 +44,54 @@
       </condition>
     </extension>
 
+    <!-- Example of routing based on holidays
+
+	This example covers all US Federal holidays except for inauguration day.
+    -->
+
+    <extension name="holiday_example" continue="true">
+      <condition mday="1" mon="1">
+	<!-- new year's day -->
+	<action application="set" data="open=false"/>
+      </condition>
+      <condition wday="2" mweek="3" mon="1">
+	<!-- martin luther king day is the 3rd monday in january -->
+	<action application="set" data="open=false"/>
+      </condition>
+      <condition wday="2" mweek="3" mon="2">
+	<!-- president's day is the 3rd monday in february -->
+	<action application="set" data="open=false"/>
+      </condition>
+      <condition wday="2" mon="5" mday="25-31">
+	<!-- memorial day is the last monday in may (the only monday between the 25th and the 31st) -->
+	<action application="set" data="open=false"/>
+      </condition>
+      <condition mday="4" mon="7">
+	<!-- independence day -->
+	<action application="set" data="open=false"/>
+      </condition>
+      <condition wday="2" mweek="1" mon="9">
+	<!-- labor day is the 1st monday in september -->
+	<action application="set" data="open=false"/>
+      </condition>
+      <condition wday="2" mweek="2" mon="10">
+	<!-- columbus day is the 2nd monday in october -->
+	<action application="set" data="open=false"/>
+      </condition>
+      <condition mday="11" mon="11">
+	<!-- veteran's day -->
+	<action application="set" data="open=false"/>
+      </condition>
+      <condition wday="5-6" mweek="4" mon="11">
+	<!-- thanksgiving is the 4th thursday in november and usually there's an extension for black friday -->
+	<action application="set" data="open=false"/>
+      </condition>
+      <condition mday="25" mon="12">
+	<!-- Christmas -->
+	<action application="set" data="open=false"/>
+      </condition>
+    </extension>
+
     <extension name="global-intercept">
       <condition field="destination_number" expression="^886$">
 	<action application="answer"/>
@@ -198,7 +247,7 @@
 	<action application="export" data="dialed_extension=$1"/>
 	<!-- bind_meta_app can have these args <key> [a|b|ab] [a|b|o|s] <app> -->
 	<action application="bind_meta_app" data="1 b s execute_extension::dx XML features"/>
-	<action application="bind_meta_app" data="2 b s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
+	<action application="bind_meta_app" data="2 b s record_session::$${recordings_dir}/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
 	<action application="bind_meta_app" data="3 b s execute_extension::cf XML features"/>
 	<action application="set" data="ringback=${us-ring}"/>
 	<action application="set" data="transfer_ringback=$${hold_music}"/>
@@ -617,7 +666,7 @@
     <extension name="milliwatt">
       <condition field="destination_number" expression="^9997$">
 	<action application="answer"/>
-	<action application="playback" data="tone_stream://%(10000,0,1004);loops=-1"/>
+	<action application="playback" data="tone_stream://%(251,0,1004);loops=-1"/>
       </condition>
     </extension>
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/dialplan/public.xml (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/dialplan/public.xml	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/dialplan/public.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,7 +1,7 @@
 <!--
     NOTICE:
 
-    This context is usually accessed via the external sip profile sitting on port 5080.
+    This context is usually accessed via the external sip profile listening on port 5080.
     
     It is recommended to have separate inbound and outbound contexts.  Not only for security
     but clearing up why you would need to do such a thing.  You don't want outside un-authenticated

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/freeswitch.xml (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/freeswitch.xml	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/freeswitch.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -55,7 +55,9 @@
   <!-- phrases section (under development still) -->
   <section name="phrases" description="Speech Phrase Management">
     <macros>
+      <X-PRE-PROCESS cmd="include" data="lang/de/*.xml"/>
       <X-PRE-PROCESS cmd="include" data="lang/en/*.xml"/>
+      <X-PRE-PROCESS cmd="include" data="lang/fr/*.xml"/>
       <X-PRE-PROCESS cmd="include" data="lang/ru/*.xml"/>
     </macros>
   </section>

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/ivr_menus (from rev 16612, freeswitch/trunk/conf/ivr_menus)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/ivr_menus/demo_ivr.xml

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/ivr_menus/demo_ivr.xml (from rev 16612, freeswitch/trunk/conf/ivr_menus/demo_ivr.xml) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/ivr_menus/demo_ivr.xml	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/ivr_menus/demo_ivr.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,64 @@
+<include>
+  <!-- demo IVR setup -->
+  <!-- demo IVR, Main Menu -->
+  <menu name="demo_ivr"
+      greet-long="phrase:demo_ivr_main_menu"
+      greet-short="phrase:demo_ivr_main_menu_short"
+      invalid-sound="ivr/ivr-that_was_an_invalid_entry.wav"
+      exit-sound="voicemail/vm-goodbye.wav"
+      confirm-macro=""
+      confirm-key=""
+      tts-engine="flite"
+      tts-voice="rms"
+      confirm-attempts="3"
+      timeout="10000"
+      inter-digit-timeout="2000"
+      max-failures="3"
+      max-timeouts="3"
+      digit-len="4">
+
+    <!-- The following are the definitions for the digits the user dials -->
+    <!-- Digit 1 transfer caller to the public FreeSWITCH conference -->
+    <entry action="menu-exec-app" digits="1" param="bridge sofia/$${domain}/888@conference.freeswitch.org"/>
+    <entry action="menu-exec-app" digits="2" param="transfer 9996 XML default"/>    <!-- FS echo -->
+    <entry action="menu-exec-app" digits="3" param="transfer 9999 XML default"/>    <!-- MOH -->
+    <entry action="menu-exec-app" digits="4" param="transfer 9991 XML default"/>    <!-- ClueCon -->
+    <entry action="menu-exec-app" digits="5" param="transfer 1234*256 enum"/>       <!-- Screaming monkeys -->
+    <entry action="menu-sub" digits="6" param="demo_ivr_submenu"/>                  <!-- demo sub menu -->
+    <!-- Using a regex in the digits tag lets you define a dial pattern for the caller
+         You may define multiple regexes if you need a different pattern for some reason -->
+    <entry action="menu-exec-app" digits="/^(10[01][0-9])$/" param="transfer $1 XML features"/> 
+    <entry action="menu-top" digits="9"/>          <!-- Repeat this menu -->
+  </menu>
+
+  <!-- Demo IVR, Sub Menu -->
+  <menu name="demo_ivr_submenu"
+      greet-long="phrase:demo_ivr_sub_menu"
+      greet-short="phrase:demo_ivr_sub_menu_short"
+      invalid-sound="ivr/ivr-that_was_an_invalid_entry.wav"
+      exit-sound="voicemail/vm-goodbye.wav"
+      timeout="15000"
+      max-failures="3"
+      max-timeouts="3">
+
+    <!-- The demo IVR sub menu prompt basically just says, "press star to return to previous menu..." -->
+    <entry action="menu-top" digits="*"/>
+   </menu>
+
+
+<!-- TTS sample; non-functional but it demonstrates say: and TTS -->
+<!--
+  <menu name="demo3"
+      greet-long="say:Press 1 to join the conference, Press 2 to join the other conference"
+      greet-short="say:Press 1 to join the conference, Press 2 to join the other conference"
+      invalid-sound="say:invalid extension"
+      exit-sound="say:exit sound"
+      timeout ="15000"
+      max-failures="3">
+    <entry action="menu-exit" digits="*"/>
+    <entry action="menu-playback" digits="1" param="say:You pressed 1"/>
+    <entry action="menu-exec-app" digits="2" param="transfert 1000 XML default"/>
+    <entry action="menu-exec-app" digits="3" param="transfert 1001 XML default"/>
+  </menu>
+-->
+</include>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/lang/en/en.xml (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/lang/en/en.xml	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/lang/en/en.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,5 +1,5 @@
 <include>
-  <language name="en" sound-path="$${base_dir}/sounds/en/us/callie" tts-engine="cepstral" tts-voice="callie">
+  <language name="en" sound-path="$${sounds_dir}/en/us/callie" tts-engine="cepstral" tts-voice="callie">
     <X-PRE-PROCESS cmd="include" data="demo/*.xml"/> <!-- Note: this now grabs whole subdir, previously grabbed only demo.xml -->
     <!--voicemail_en_tts is purely implemented with tts, we have the files based one that is the default. -->
     <X-PRE-PROCESS cmd="include" data="vm/sounds.xml"/>  <!-- vm/tts.xml if you want to use tts and have cepstral -->

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/lang/fr/vm/sounds.xml (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/lang/fr/vm/sounds.xml	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/lang/fr/vm/sounds.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -49,23 +49,28 @@
   </macro>
 
   <macro name="voicemail_message_count">
-    <input pattern="^([^:]+):urgent-new:{0,1}(.*)">
+    <input pattern="^([^:]+):urgent-new">
       <match>
-	<action function="speak-text" data="Vous avez $1 nouveau message $2 urgent dans le répertoir ${voicemail_current_folder}."/>
+	<action function="speak-text" data="Vous avez $1 nouveaux messages urgents dans le répertoire ${voicemail_current_folder}."/>
       </match>
     </input>
-    <input pattern="^([^:]+):new:{0,1}(.*)">
+    <input pattern="^([^:]+):new">
       <match>
-	<action function="speak-text" data="Vous avez $1 nouveau message$2 dans le répertoir ${voicemail_current_folder}."/>
+	<action function="speak-text" data="Vous avez $1 nouveaux messages dans le répertoire ${voicemail_current_folder}."/>
       </match>
     </input>
+    <input pattern="^([^:]+):saved">
+      <match>
+	<action function="speak-text" data="Vous avez $1 messages sauvegardés dans le répertoire ${voicemail_current_folder}."/>
+      </match>
+    </input>
   </macro>
 
   <macro name="voicemail_menu">
     <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
       <match>
 	<action function="speak-text" 
-		data="Pour écouter les nouveaux message, tappez $1, Pour écouter les messages enregistrés, tappez $2, Pour les options avancées, tappez $3, pour sortir, tappez $4."/>
+		data="Pour écouter les nouveaux messages, tapez $1, Pour écouter les messages enregistrés, tapez $2, Pour les options avancées, tapez $3, pour sortir, tapez $4."/>
       </match>
     </input>
   </macro>
@@ -75,7 +80,7 @@
     <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
       <match>
 	<action function="speak-text" 
-		data="pour enregistrer un message d'accueil, tappez $1, Pour choisir votre message d'accueil, tappez $2, Pour enregistrer votre nom, tappez $3, Pour changer votre mot de passe, tappez $4, Pour retourner au menu principal, tappez $5."/>
+		data="pour enregistrer un message d'accueil, tapez $1, Pour choisir votre message d'accueil, tapez $2, Pour enregistrer votre nom, tapez $3, Pour changer votre mot de passe, tapez $4, Pour retourner au menu principal, tapez $5."/>
       </match>
     </input>
   </macro>
@@ -84,7 +89,7 @@
   <macro name="voicemail_record_name">
     <input pattern="^(.*)$">
       <match>
-	<action function="speak-text" data="enregistrez votre nom après le bip, puis tappez une touche ou arrêtez de parler pour arrêter l'enregistrement."/>
+	<action function="speak-text" data="enregistrez votre nom après le bip, puis tapez une touche ou arrêtez de parler pour arrêter l'enregistrement."/>
 
       </match>
     </input>
@@ -94,7 +99,7 @@
     <input pattern="^([0-9#*]):([0-9#*]):([0-9#*])$">
       <match>
 	<action function="speak-text" 
-		data="Pour écouter l'enregistrement, tappez $1, pour sauvegarder l'enregistrement, tappez $2, Pour réenregistrer, tappez $3."/>
+		data="Pour écouter l'enregistrement, tapez $1, pour sauvegarder l'enregistrement, tapez $2, Pour réenregistrer, tapez $3."/>
       </match>
     </input>
   </macro>
@@ -103,16 +108,16 @@
     <input pattern="^([0-9#*]):([0-9#*])$">
       <match>
 	<action function="speak-text" 
-		data="Pour indiquer ce message comme étant urgent, tappez $1, Pour continuer, tappez $2."/>
+		data="Pour indiquer ce message comme étant urgent, tapez $1, Pour continuer, tapez $2."/>
       </match>
     </input>
   </macro>
 
   <macro name="voicemail_listen_file_check">
-    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])$">
+    <input pattern="^([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*]):([0-9#*])(:(.*))?$">
       <match>
 	<action function="speak-text" 
-		data="Pour réécouter l'enregistrement à nouveau, tappez $1, Pour sauvegarder l'enregistrement, tappez $2,  Pour supprimer l'enregistrement, tappez $3, pour transférer l'enregistrement à votre courriel, tappez $4, Pour appeler l'appelant, tappez $5, Pour transférer ce message à un  autre numéro, tappez $6."/>
+		data="Pour réécouter l'enregistrement à nouveau, tapez $1, Pour sauvegarder l'enregistrement, tapez $2,  Pour supprimer l'enregistrement, tapez $3, pour transférer l'enregistrement à votre courriel $8, tapez $4, Pour appeler l'appelant, tapez $5, Pour transférer ce message à un  autre numéro, tapez $6."/>
       </match>
     </input>
   </macro>
@@ -136,7 +141,7 @@
   <macro name="voicemail_record_greeting">
     <input pattern="^(.*)$">
       <match>
-	<action function="speak-text" data="enregistrez votre message d'accueil après le bip, puis tappez une touche ou arrêtez de parler pour arrêter l'enregistrement."/>
+	<action function="speak-text" data="enregistrez votre message d'accueil après le bip, puis tapez une touche ou arrêtez de parler pour arrêter l'enregistrement."/>
       </match>
     </input>
   </macro>
@@ -144,7 +149,7 @@
   <macro name="voicemail_record_message">
     <input pattern="^(.*)$">
       <match>
-	<action function="speak-text" data="enregistrez votre message après le bip, puis tappez une touche ou arrêtez de parler pour arrêter l'enregistrement."/>
+	<action function="speak-text" data="enregistrez votre message après le bip, puis tapez une touche ou arrêtez de parler pour arrêter l'enregistrement."/>
       </match>
     </input>
   </macro>
@@ -174,7 +179,7 @@
   </macro>
 
   <macro name="voicemail_say_message_number">
-    <input pattern="new:(.*)$">
+    <input pattern="^new:(.*)$">
       <match>
 	<action function="speak-text" data="nouveau message numéro $1."/>
       </match>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/lang/ru/ru.xml (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/lang/ru/ru.xml	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/lang/ru/ru.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--тестовые файлы Вы звуковые файлы можно взять тут svn co http://svn.freeswitch.ru/bbv/mod_say_ru/ru/  -->
 <include>
-  <language name="ru" sound-path="$${base_dir}/sounds/ru/RU/elena" tts-engine="cepstral" tts-voice="elena">
+  <language name="ru" sound-path="$${sounds_dir}/ru/RU/elena" tts-engine="cepstral" tts-voice="elena">
     <X-PRE-PROCESS cmd="include" data="demo/*.xml"/> <!-- Note: this now grabs whole subdir, previously grabbed only demo.xml -->
     <!--voicemail_en_tts is purely implemented with tts, we have the files based one that is the default. -->
     <X-PRE-PROCESS cmd="include" data="vm/sounds.xml"/>  <!-- vm/tts.xml if you want to use tts and have cepstral -->

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/sip_profiles/external.xml (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/sip_profiles/external.xml	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/sip_profiles/external.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -18,6 +18,8 @@
 
   <settings>
     <param name="debug" value="0"/>
+	<!-- If you want FreeSWITCH to shutdown if this profile fails to load, uncomment the next line. -->
+	<!-- <param name="shutdown-on-fail" value="true"/> -->
     <param name="sip-trace" value="no"/>
     <param name="rfc2833-pt" value="101"/>
     <param name="sip-port" value="$${external_sip_port}"/>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/sip_profiles/internal-ipv6.xml (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/sip_profiles/internal-ipv6.xml	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/sip_profiles/internal-ipv6.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -27,7 +27,7 @@
     <param name="apply-inbound-acl" value="domains"/>
     <!--<param name="apply-register-acl" value="domains"/>-->
     <!--<param name="dtmf-type" value="info"/>-->
-    <param name="record-template" value="$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
+    <param name="record-template" value="$${recordings_dir}/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
     <!--enable to use presence and mwi -->
     <param name="manage-presence" value="true"/>
     <!-- This setting is for AAL2 bitpacking on G726 -->

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/sip_profiles/internal.xml (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/sip_profiles/internal.xml	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/sip_profiles/internal.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -39,6 +39,8 @@
     <!--<param name="media-option" value="bypass-media-after-att-xfer"/>-->
     <!-- <param name="user-agent-string" value="FreeSWITCH Rocks!"/> -->
     <param name="debug" value="0"/>
+	<!-- If you want FreeSWITCH to shutdown if this profile fails to load, uncomment the next line. -->
+	<!-- <param name="shutdown-on-fail" value="true"/> -->
     <param name="sip-trace" value="no"/>
     <param name="log-auth-failures" value="true"/>
     <param name="context" value="public"/>
@@ -77,7 +79,7 @@
     <param name="local-network-acl" value="localnet.auto"/>
     <!--<param name="apply-register-acl" value="domains"/>-->
     <!--<param name="dtmf-type" value="info"/>-->
-    <param name="record-path" value="$${base_dir}/recordings"/>
+    <param name="record-path" value="$${recordings_dir}"/>
     <param name="record-template" value="${caller_id_number}.${target_domain}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
     <!--enable to use presence -->
     <param name="manage-presence" value="true"/>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/conf/vars.xml (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/conf/vars.xml	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/conf/vars.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -15,7 +15,8 @@
   <X-PRE-PROCESS cmd="set" data="default_password=1234"/>
   <!-- Did you change it yet? -->
 
-  <X-PRE-PROCESS cmd="set" data="sound_prefix=$${base_dir}/sounds/en/us/callie"/>
+  <X-PRE-PROCESS cmd="set" data="sound_prefix=$${sounds_dir}/en/us/callie"/>
+
   <!--
       This setting is what sets the default domain FreeSWITCH will use if all else fails.
       
@@ -85,7 +86,42 @@
        H263-1998        - H.263-1998 Video
        H263-2000        - H.263-2000 Video
        H264             - H.264 Video
+       
+       RTP Dynamic Payload Numbers currently used in FreeSWITCH and what for.
 
+       96  - AMR
+       97  - iLBC (30)
+       98  - iLBC (20)
+       99  - Speex 8kHz, 16kHz, 32kHz
+       100 -
+       101 - telephone-event
+       102 -
+       103 - 
+       104 - 
+       105 - 
+       106 - BV16
+       107 - G722.1 (16kHz)
+       108 -
+       109 -
+       110 -
+       111 -
+       112 -
+       113 -
+       114 - CELT 32kHz, 48kHz
+       115 - G722.1C (32kHz)
+       116 -
+       117 - SILK 8kHz
+       118 - SILK 12kHz
+       119 - SILK 16kHz
+       120 - SILK 24kHz
+       121 - AAL2-G726-40 && G726-40
+       122 - AAL2-G726-32 && G726-32
+       123 - AAL2-G726-24 && G726-24
+       124 - AAL2-G726-16 && G726-16
+       125 - 
+       126 -
+       127 - BV32
+
   -->
   <X-PRE-PROCESS cmd="set" data="global_codec_prefs=G7221@32000h,G7221@16000h,G722,PCMU,PCMA,GSM"/>
   <X-PRE-PROCESS cmd="set" data="outbound_codec_prefs=PCMU,PCMA,GSM"/>
@@ -167,7 +203,7 @@
   <X-PRE-PROCESS cmd="set" data="us-ring=%(2000,4000,440.0,480.0)"/>
   <X-PRE-PROCESS cmd="set" data="fr-ring=%(1500,3500,440.0,0.0)"/>
   <X-PRE-PROCESS cmd="set" data="rs-ring=%(1000,4000,425.0,0.0)"/>
-  <X-PRE-PROCESS cmd="set" data="ru-ring=%(350,350,425)"/>
+  <X-PRE-PROCESS cmd="set" data="ru-ring=%(800,3200,425,0)"/>
   <X-PRE-PROCESS cmd="set" data="bong-ring=v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"/>
   <X-PRE-PROCESS cmd="set" data="sit=%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)"/>
   <!--

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/configure.in (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/configure.in	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/configure.in	2010-02-12 00:54:22 UTC (rev 16614)
@@ -10,6 +10,7 @@
 #AC_SUBST(SWITCH_VERSION_REVISION, [svn-revision-here])
 
 AC_CONFIG_FILES([src/include/switch_version.h.in:src/include/switch_version.h.template])
+AC_CONFIG_FILES([.version:.version.in])
 
 AC_CONFIG_AUX_DIR(build/config)
 AM_INIT_AUTOMAKE(libfreeswitch,0.1)
@@ -33,27 +34,59 @@
 
 # Where to install the modules
 AC_ARG_WITH([modinstdir],
-	[AS_HELP_STRING([--with-modinstdir=DIR], [Install modules into this location (default: $prefix/mod)])], [modinstdir="$withval"], [modinstdir="${prefix}/mod"])
+	[AS_HELP_STRING([--with-modinstdir=DIR], [Install modules into this location (default: $prefix/mod)])], [modulesdir="$withval"], [modulesdir="${prefix}/mod"])
+AC_SUBST(modulesdir)
+AC_DEFINE_UNQUOTED([SWITCH_MOD_DIR],"${modulesdir}",[where to install the modules to])
 
-AC_SUBST(modinstdir)
-AC_DEFINE_UNQUOTED([SWITCH_MOD_DIR],"${modinstdir}",[where to install the modules to])
-
 # Where to put pidfile
 AC_ARG_WITH([rundir],
-	[AS_HELP_STRING([--with-rundir=DIR], [Put pidfile into this location (default: $prefix/log)])], [rundir="$withval"], [rundir="${prefix}/log"])
+	[AS_HELP_STRING([--with-rundir=DIR], [Put pidfile into this location (default: $prefix/run)])], [runtimedir="$withval"], [runtimedir="${prefix}/run"])
+AC_SUBST(runtimedir)
+AC_DEFINE_UNQUOTED([SWITCH_RUN_DIR],"${runtimedir}",[where to put pidfile to])
 
-AC_SUBST(rundir)
-AC_DEFINE_UNQUOTED([SWITCH_RUN_DIR],"${rundir}",[where to put pidfile to])
+logfiledir="${prefix}/log"
+AC_SUBST(logfiledir)
+AC_DEFINE_UNQUOTED([SWITCH_LOG_DIR],"${logfiledir}",[where to put log files])
 
+dbdir="${prefix}/db"
+AC_SUBST(dbdir)
+AC_DEFINE_UNQUOTED([SWITCH_DB_DIR],"${dbdir}",[where to put db files])
+
+htdocsdir="${prefix}/htdocs"
+AC_SUBST(htdocsdir)
+AC_DEFINE_UNQUOTED([SWITCH_HTDOCS_DIR],"${htdocsdir}",[where to put htdocs files])
+
+soundsdir="${prefix}/sounds"
+AC_SUBST(soundsdir)
+AC_DEFINE_UNQUOTED([SWITCH_SOUNDS_DIR],"${soundsdir}",[where to put sounds files])
+
+grammardir="${prefix}/grammar"
+AC_SUBST(grammardir)
+AC_DEFINE_UNQUOTED([SWITCH_GRAMMAR_DIR],"${grammardir}",[where to put grammar files])
+
+scriptdir="${prefix}/scripts"
+AC_SUBST(scriptdir)
+AC_DEFINE_UNQUOTED([SWITCH_SCRIPT_DIR],"${scriptdir}",[where to put script files])
+
+recordingsdir="${prefix}/recordings"
+AC_SUBST(recordingsdir)
+AC_DEFINE_UNQUOTED([SWITCH_RECORDINGS_DIR],"${recordingsdir}",[where to put recording files])
+
 if test "$sysconfdir" = "\${prefix}/etc" ; then
     confdir="$prefix/conf"
 else
     confdir="$sysconfdir"
 fi
 
+sysconfdir="$confdir"
+
 AC_SUBST(confdir)
 AC_DEFINE_UNQUOTED([SWITCH_CONF_DIR],"${confdir}",[directory for configuration files])
 
+AC_SUBST(libdir)
+AC_SUBST(bindir)
+AC_SUBST(includedir)
+
 #Set default language
 AC_LANG_C
 # Checks for programs.
@@ -104,6 +137,9 @@
     SOLINK="-Bdynamic -dy -G"
 elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
     case "$host" in
+        *darwin10.*)
+            SOLINK="-dynamic -force-flat-namespace"
+        ;;
         *darwin*)
             SOLINK="-dynamic -bundle -force-flat-namespace"
         ;;
@@ -180,7 +216,16 @@
     APR_ADDTO(SWITCH_AM_CXXFLAGS, -fPIC)
     APR_ADDTO(SWITCH_AM_CFLAGS, -Werror)
     if test "${enable_64}" = "yes"; then
-	LIBS="$LIBS -m64"
+	case "$host" in
+             *darwin10.*|*darwin9.*|*darwin8.*)
+		APR_ADDTO(CFLAGS, -arch x86_64)
+       		APR_ADDTO(LDFLAGS, -arch x86_64)
+       		APR_ADDTO(CXXFLAGS, -arch x86_64)
+		;;
+	     *)
+	     	LIBS="$LIBS -m64"
+	     ;;
+	 esac
     fi
 fi
 
@@ -261,7 +306,11 @@
 
 if test "${enable_debug}" = "yes"; then
         AC_DEFINE([DEBUG],[],[Enable extra debugging.])
+	saved_CFLAGS="$CFLAGS"
+	CFLAGS=
         AX_CFLAGS_WARN_ALL_ANSI
+	SWITCH_ANSI_CFLAGS=$CFLAGS
+	CFLAGS="$saved_CFLAGS"	
 
 	if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then
 	    APR_ADDTO(SWITCH_AM_CFLAGS, -g -ggdb)
@@ -270,18 +319,38 @@
 
 fi
 
+AC_ARG_ENABLE(cpp,
+[AC_HELP_STRING([--disable-cpp],[build without cpp code])],[enable_cpp="$enableval"],[enable_cpp="yes"])
+
+AM_CONDITIONAL([ENABLE_CPP],[test "${enable_cpp}" = "yes"])
+
 AC_ARG_ENABLE(zrtp,
 	[AS_HELP_STRING([--enable-zrtp], [Compile with zrtp Support])],,[enable_zrtp="no"])
 if test "x$enable_zrtp" = "xyes" ; then
-   saved_LIBS=$LIBS
+   saved_LIBS="$LIBS"
    LIBS="$saved_LIBS -L/usr/local/lib -lbn -lpthread"
    AC_CHECK_LIB(zrtp, zrtp_init, [has_zrtp="yes"], [has_zrtp="no"])
-   LIBS=$saved_LIBS
+   LIBS="$saved_LIBS"
    if test "x$has_zrtp" = "xno"; then
       AC_ERROR([Cannot locate zrtp libraries])
    fi
    APR_ADDTO(SWITCH_AM_CFLAGS, -DENABLE_ZRTP)
 fi
+
+PA_LIBS=
+
+PKG_CHECK_MODULES(JACK, jack, have_jack=yes, have_jack=no)
+if test "x$have_jack" = "xyes" ; then
+PA_LIBS+=$JACK_LIBS
+fi
+
+AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no)
+if test "x$have_alsa" = "xyes"  ; then
+PA_LIBS+=-lasound
+fi
+
+AC_SUBST(PA_LIBS)
+
 AM_CONDITIONAL([ENABLE_ZRTP],[test "x$enable_zrtp" != "xno"])
 
 
@@ -298,6 +367,16 @@
 PLATFORM_CORE_DEPLIBS=
 # tweak platform specific flags
 case "$host" in
+    *darwin10.*)
+        APR_ADDTO(SWITCH_AM_CFLAGS, -DMACOSX)
+        APR_ADDTO(CFLAGS, -pipe -no-cpp-precomp)
+        APR_ADDTO(LDFLAGS, -pipe -bind_at_load)
+        APR_ADDTO(CXXFLAGS, -pipe)
+        APR_REMOVEFROM(SWITCH_AM_CFLAGS, -fPIC)
+	if test "x$enable_core_odbc_support" != "xno"; then
+	        APR_ADDTO(PLATFORM_CORE_DEPLIBS, --framework CoreFoundation)
+	fi
+    ;;
     *darwin*)
         APR_ADDTO(SWITCH_AM_CFLAGS, -DMACOSX)
         APR_REMOVEFROM(SWITCH_AM_CFLAGS, -fPIC)
@@ -307,6 +386,7 @@
     ;;
     *-solaris2*)
         APR_ADDTO(SWITCH_AM_CFLAGS, -DPATH_MAX=2048)
+        APR_ADDTO(SWITCH_AM_LDFLAGS, -lsendfile -lresolv -lsocket -lnsl -luuid)
         APR_ADDTO(ESL_LDFLAGS, -lnsl -lsocket)
     ;;
     *bsd*)
@@ -317,6 +397,7 @@
 APR_REMOVEFROM(SWITCH_AM_CXXFLAGS, -std=c99)
 
 AC_SUBST(SWITCH_AM_CFLAGS)
+AC_SUBST(SWITCH_ANSI_CFLAGS)
 AC_SUBST(SWITCH_AM_CXXFLAGS)
 AC_SUBST(SWITCH_AM_LDFLAGS)
 AC_SUBST(ESL_LDFLAGS)
@@ -354,7 +435,10 @@
 AC_CHECK_FUNCS([sched_setscheduler setpriority setrlimit setgroups initgroups])
 AC_CHECK_FUNCS([wcsncmp setgroups asprintf setenv pselect gettimeofday localtime_r gmtime_r strcasecmp stricmp _stricmp])
 
+AX_HAVE_CPU_SET
+
 AC_CHECK_LIB(rt, clock_gettime, [AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if you have clock_gettime()])])
+AC_CHECK_LIB(rt, clock_getres, [AC_DEFINE(HAVE_CLOCK_GETRES, 1, [Define if you have clock_getres()])])
 AC_CHECK_LIB(rt, clock_nanosleep, [AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define if you have clock_nanosleep()])])
 AC_CHECK_FUNC(socket, , AC_CHECK_LIB(socket, socket))
 
@@ -442,6 +526,7 @@
 fi
 AC_SUBST(VA_LIST_IS_ARRAY_DEFINE)
 
+
 AC_MSG_CHECKING(whether compiler has __attribute__)
 AC_TRY_COMPILE(, [int x __attribute__((__unused__));],
 compiler_has_attribute=yes,
@@ -455,8 +540,17 @@
 AC_SUBST(ATTR_UNUSED)
 
 
+saved_CFLAGS="$CFLAGS"
+AC_CACHE_CHECK([whether compiler supports -Wdeclaration-after-statement], [ac_cv_gcc_declaration_after_statement], [
+CFLAGS="$CFLAGS -Wdeclaration-after-statement"
+AC_TRY_COMPILE([],[return 0;],[ac_cv_gcc_declaration_after_statement=yes],[ac_cv_gcc_declaration_after_statement=no])
+])
+AC_MSG_RESULT($ac_cv_gcc_declaration_after_statement)
+if test x"$ac_cv_gcc_declaration_after_statement" = xyes; then
+    APR_ADDTO(SWITCH_ANSI_CFLAGS, -Wdeclaration-after-statement)
+fi
+CFLAGS="$saved_CFLAGS"
 
-
 AC_C_BIGENDIAN(AC_DEFINE([SWITCH_BYTE_ORDER],__BIG_ENDIAN,[Big Endian]),AC_DEFINE([SWITCH_BYTE_ORDER],__LITTLE_ENDIAN,[Little Endian]))
 
 # Checks for integer size
@@ -601,21 +695,18 @@
 AC_SUBST(uint64_t_fmt) 
 AC_SUBST(ssize_t_fmt) 
 AC_SUBST(size_t_fmt)
-AC_SUBST(libdir)
-AC_SUBST(bindir)
-AC_SUBST(includedir)
 
 AC_PATH_PROGS(ZCAT, gunzip gzcat gzip zcat)
 AC_PATH_PROGS(TAR, gtar tar)
 AC_PATH_PROGS(WGET, wget)
 AC_PATH_PROGS(CURL, curl)
-GETLIB="cd $switch_srcdir/libs && ${SHELL} $switch_srcdir/build/getlib.sh"
+GETLIB="cd $switch_srcdir/libs && ${SHELL} $switch_builddir/build/getlib.sh"
 AC_SUBST(GETLIB)
-GETSOUNDS="${SHELL} $switch_srcdir/build/getsounds.sh"
+GETSOUNDS="${SHELL} $switch_builddir/build/getsounds.sh"
 AC_SUBST(GETSOUNDS)
 
 
-LIBCURL_CHECK_CONFIG([yes], [7.13.0], [LIBCURL_DEPS=''], [LIBCURL_DEPS='${switch_srcdir}/libs/curl/lib/libcurl.la';LIBCURL='${switch_srcdir}/libs/curl/lib/libcurl.la';LIBCURL_CPPFLAGS='-I${switch_srcdir}/libs/curl/include'])
+LIBCURL_CHECK_CONFIG([yes], [7.13.0], [LIBCURL_DEPS=''], [LIBCURL_DEPS='${switch_builddir}/libs/curl/lib/libcurl.la';LIBCURL='${switch_builddir}/libs/curl/lib/libcurl.la';LIBCURL_CPPFLAGS='-I${switch_srcdir}/libs/curl/include'])
 AC_SUBST(LIBCURL_DEPS)
 
 
@@ -637,8 +728,8 @@
 AX_CHECK_JAVA
 
 
-AM_CONDITIONAL([ADD_ODBC],[test "x$enable_core_odbc_support" != "xno"])
-AM_CONDITIONAL([ADD_LIBEDIT],[test "x$enable_core_libedit_support" != "xno"])
+AM_CONDITIONAL([HAVE_ODBC],[test "x$enable_core_odbc_support" != "xno"])
+AM_CONDITIONAL([HAVE_LIBEDIT],[test "x$enable_core_libedit_support" != "xno"])
 AM_CONDITIONAL([HAVE_MYSQL],[test "$found_mysql" = "yes"])
 
 #
@@ -765,16 +856,27 @@
 CHECK_ERLANG
 
 AC_CONFIG_FILES([Makefile
+                build/Makefile
                 src/Makefile
                 src/mod/Makefile
+                src/mod/applications/mod_enum/Makefile
+		src/mod/applications/mod_expr/Makefile
+		src/mod/applications/mod_stress/Makefile
+		src/mod/applications/mod_t38gateway/Makefile
+		src/mod/endpoints/mod_portaudio/Makefile
+		src/mod/endpoints/mod_skypiax/Makefile
                 src/mod/endpoints/mod_sofia/Makefile
+		src/mod/formats/mod_portaudio_stream/Makefile
                 src/mod/asr_tts/mod_unimrcp/Makefile
                 src/mod/languages/mod_java/Makefile
+		src/mod/languages/mod_lua/Makefile
                 src/mod/languages/mod_python/Makefile
+		src/mod/languages/mod_spidermonkey/Makefile
                 src/mod/event_handlers/mod_erlang_event/Makefile
                 src/include/switch_am_config.h
                 build/getsounds.sh
                 build/getlib.sh
+		build/freeswitch.pc
                 build/modmake.rules
                 libs/xmlrpc-c/include/xmlrpc-c/config.h
                 libs/xmlrpc-c/xmlrpc_config.h
@@ -816,31 +918,57 @@
 AC_SUBST(OUR_DISABLED_UNINSTALL_MODS)
 AC_SUBST(AM_MAKEFLAGS)
 
+ac_configure_args="$ac_configure_args CONFIGURE_CFLAGS='$CFLAGS' CONFIGURE_CXXFLAGS='$CXXFLAGS' CONFIGURE_LDFLAGS='$LDFLAGS' "
+
+#	--prefix='$prefix' --exec_prefix='$exec_prefix' --libdir='$libdir' --libexecdir='$libexecdir' --bindir='$bindir' --sbindir='$sbindir' \
+#	--localstatedir='$localstatedir' --datadir='$datadir'"
+
 # Run configure in all the subdirs
-AC_CONFIG_SUBDIRS(libs/srtp)
-AC_CONFIG_SUBDIRS(libs/sqlite)
+AC_CONFIG_SUBDIRS([libs/srtp])
+AC_CONFIG_SUBDIRS([libs/sqlite])
 if test "$enable_core_libedit_support" = "yes" ; then
-    AC_CONFIG_SUBDIRS(libs/libedit)
+    AC_CONFIG_SUBDIRS([libs/libedit])
 fi
 
-AC_CONFIG_SUBDIRS(libs/pcre)
-AC_CONFIG_SUBDIRS(libs/apr)
-AC_CONFIG_SUBDIRS(libs/apr-util)
-AC_CONFIG_SUBDIRS(libs/ilbc)
-AC_CONFIG_SUBDIRS(libs/curl)
-AC_CONFIG_SUBDIRS(libs/iksemel)
-AC_CONFIG_SUBDIRS(libs/js/nsprpub)
-AC_CONFIG_SUBDIRS(libs/js)
-AC_CONFIG_SUBDIRS(libs/libdingaling)
-AC_CONFIG_SUBDIRS(libs/libsndfile)
-AC_CONFIG_SUBDIRS(libs/sofia-sip)
-AC_CONFIG_SUBDIRS(libs/speex)
-AC_CONFIG_SUBDIRS(libs/portaudio)
-AC_CONFIG_SUBDIRS(libs/openzap)
-AC_CONFIG_SUBDIRS(libs/unimrcp)
-AC_CONFIG_SUBDIRS(libs/tiff-3.8.2)
-AC_CONFIG_SUBDIRS(libs/spandsp)
-AC_CONFIG_SUBDIRS(libs/broadvoice)
-AC_CONFIG_SUBDIRS(libs/libg722_1)
+AC_CONFIG_SUBDIRS([libs/pcre])
+AC_CONFIG_SUBDIRS([libs/apr])
+AC_CONFIG_SUBDIRS([libs/apr-util])
+AC_CONFIG_SUBDIRS([libs/ilbc])
+AC_CONFIG_SUBDIRS([libs/curl])
+AC_CONFIG_SUBDIRS([libs/iksemel])
+AC_CONFIG_SUBDIRS([libs/js/nsprpub])
+AC_CONFIG_SUBDIRS([libs/js])
+AC_CONFIG_SUBDIRS([libs/libdingaling])
+AC_CONFIG_SUBDIRS([libs/libsndfile])
+AC_CONFIG_SUBDIRS([libs/sofia-sip])
+AC_CONFIG_SUBDIRS([libs/speex])
+AC_CONFIG_SUBDIRS([libs/portaudio])
+AC_CONFIG_SUBDIRS([libs/openzap])
+AC_CONFIG_SUBDIRS([libs/unimrcp])
+AC_CONFIG_SUBDIRS([libs/tiff-3.8.2])
+AC_CONFIG_SUBDIRS([libs/spandsp])
+AC_CONFIG_SUBDIRS([libs/broadvoice])
+AC_CONFIG_SUBDIRS([libs/libg722_1])
 
 AC_OUTPUT
+
+##
+## Configuration summary
+##
+
+echo
+echo "-------------------------- FreeSWITCH configuration --------------------------"
+echo ""
+echo "  Locations:"
+echo "      Selected layout: ${layout_name}"
+echo ""
+echo "      prefix:          ${prefix}"
+echo "      exec_prefix:     ${exec_prefix}"
+echo "      bindir:          ${bindir}"
+echo "      libdir:          ${libdir}"
+echo "      modulesdir:      ${modulesdir}"
+echo "      sysconfdir:      ${sysconfdir}"
+echo "      runtimedir:      ${runtimedir}"
+echo "      logfiledir:      ${logfiledir}"
+echo ""
+echo "------------------------------------------------------------------------------"

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/DelphiWorld/scripts/fs_install.sh (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/DelphiWorld/scripts/fs_install.sh	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/DelphiWorld/scripts/fs_install.sh	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,4 +1,4 @@
-#!/bin/bash 
+#!/bin/sh
 #updating to the latest repository package List...
 echo "updating ubuntu package list from repository..."
 cd /usr/src
@@ -33,4 +33,4 @@
 tar xzf configskypenew.tgz
 chown root.root .Skype
 fi
-echo "finished!"
\ No newline at end of file
+echo "finished!"

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/diegoviola/ruby/misc (from rev 16612, freeswitch/trunk/contrib/diegoviola/ruby/misc)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/diegoviola/ruby/misc/bridge.rb

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/diegoviola/ruby/misc/bridge.rb (from rev 16612, freeswitch/trunk/contrib/diegoviola/ruby/misc/bridge.rb) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/diegoviola/ruby/misc/bridge.rb	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/diegoviola/ruby/misc/bridge.rb	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,16 @@
+#!/usr/bin/env ruby
+
+require 'sinatra'
+require 'fsr'
+
+FSR.load_all_commands
+
+get '/' do
+  "Phone number: <form action=\"/originate\" method=\"post\"><input type=\"text\" name=\"phone_number\"><input type=\"submit\"></form>"
+end
+
+post '/originate' do
+  sock = FSR::CommandSocket.new
+  sock.originate(:target => "sofia/gateway/flowroute/#{params[:phone_number]}", :endpoint => FSR::App::Conference.new("3030", "default")).run
+  redirect '/'
+end

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/diegoviola/ruby/misc/presence.rb

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/diegoviola/ruby/misc/presence.rb (from rev 16612, freeswitch/trunk/contrib/diegoviola/ruby/misc/presence.rb) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/diegoviola/ruby/misc/presence.rb	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/diegoviola/ruby/misc/presence.rb	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,15 @@
+#!/usr/bin/ruby
+
+require 'rubygems'
+require 'fsr'
+require "fsr/listener/inbound"
+
+def presence_handler(event)
+  FSR::Log.info "From: #{event.content[:from]} - #{event.content[:status]}"
+end
+
+# Event hooks for presence.
+FSL::Inbound.add_event_hook(:PRESENCE_IN) {|event| presence_handler(event) }
+FSL::Inbound.add_event_hook(:PRESENCE_OUT) {|event| presence_handler(event) }
+
+FSR.start_ies!(FSL::Inbound, :host => "localhost", :port => 8021)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/.project (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/.project) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/.project	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/.project	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.freeswitch.esl</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

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

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/.settings/org.maven.ide.eclipse.prefs

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/.settings/org.maven.ide.eclipse.prefs (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/.settings/org.maven.ide.eclipse.prefs) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/.settings/org.maven.ide.eclipse.prefs	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/.settings/org.maven.ide.eclipse.prefs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,9 @@
+#Sat Dec 12 17:33:34 EST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1

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

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client


Name: svn:ignore
   + target

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.classpath

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.classpath (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.classpath) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.classpath	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.classpath	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.project

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.project (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.project) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.project	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.project	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.freeswitch.esl.client.netty</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.settings (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.settings)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.settings/org.eclipse.jdt.core.prefs

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.settings/org.eclipse.jdt.core.prefs (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.settings/org.eclipse.jdt.core.prefs) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.settings/org.eclipse.jdt.core.prefs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,13 @@
+#Sun Jan 03 23:33:57 EST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.5

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.settings/org.maven.ide.eclipse.prefs

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.settings/org.maven.ide.eclipse.prefs (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.settings/org.maven.ide.eclipse.prefs) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.settings/org.maven.ide.eclipse.prefs	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/.settings/org.maven.ide.eclipse.prefs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,9 @@
+#Sat Dec 12 17:44:54 EST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/TODO.txt

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/TODO.txt (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/TODO.txt) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/TODO.txt	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/TODO.txt	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,29 @@
+
+As at 2010.01.03
+
+Features still to be implemented
+ * More testing of the outbound socket client template code
+ * Implement Send event command
+ * Testing of SendMsg command 
+ * Refactor the api of the inbound client into the abstract handler so it is also available in outbound handlers as well
+ * Per event(s) listener
+ * Provide XML event handling - not sure if this is useful since the raw event is not exposed, although it could be if needed.
+ * Implement 'myevent' event subscription for inbound - not a priority here, easy if required.
+ * Provide timeout protection on the client.sendSyncApiCommand().  It will currently block for ever if get no response from server.
+ * Working examples in an example project (started).
+ * Add OSGi example 
+ * Chase down the apparent issue with Netty when using executor in pipeline (wierd).
+  
+Distribution
+ * Basic usage docs
+ * Package jar, javadocs, source and dependencies (slf4j, netty) for people to trial without having to build.
+ * Find out how (if ok) to put binary distribution on files.freeswitch.org
+ * Cut a release, look at usage of tags in FS svn repo.
+ 
+Quality items
+ * Ask FS dev team for any ESL event generation test strategies/suites.
+ * Are all message header names in the enum ?
+ * Improve Javadoc coverage
+ * Add cross references to the FS wiki in the Javadocs .. eg list of api commands and events.
+ * Add unit test coverage
+ * Investigate availability of FS JIRA for issue tracking

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/pom.xml

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/pom.xml (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/pom.xml) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/pom.xml	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/pom.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.freeswitch.esl.client</groupId>
+    <artifactId>esl-client-parent</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+  </parent>
+  <artifactId>org.freeswitch.esl.client</artifactId>
+  <name>FreeSWITCH Event Socket Library - Java Client</name>
+  <packaging>bundle</packaging>
+  <build>
+  
+    <plugins>
+    
+      <!--  this plugin will create the target jar as a correct OSGi bundle  -->
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <version>2.0.1</version>
+        <extensions>true</extensions>
+        <configuration>
+          <unpackBundle>true</unpackBundle>
+          <instructions>
+            <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+            <Bundle-Version>${project.version}</Bundle-Version>
+            <Bundle-DocURL>http://www.freeswitch.org</Bundle-DocURL>
+            <Import-Package>*</Import-Package>
+            <Export-Package>
+              org.freeswitch.esl.client,
+              org.freeswitch.esl.client.transport.event,
+              org.freeswitch.esl.client.transport.message,
+            </Export-Package>
+            <!--  the debug package is a temporary hack  -->
+            <Private-Package>
+              org.freeswitch.esl.client.internal,
+              org.freeswitch.esl.client.debug
+            </Private-Package>
+          </instructions>
+        </configuration>
+      </plugin>
+      
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <excludes> 
+            <exclude>**/ClientTest.java</exclude>            
+            <exclude>**/SocketClientTest.java</exclude>            
+          </excludes>
+        </configuration>
+      </plugin>
+      
+    </plugins>
+    
+  </build>
+  <dependencies>
+
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>1.5.10</version>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.jboss.netty</groupId>
+      <artifactId>netty</artifactId>
+      <version>3.1.5.GA</version>
+    </dependency>
+    
+    <!--  test dependencies -->
+    
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.7</version>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>ch.qos.logback</groupId>
+      <artifactId>logback-classic</artifactId>
+      <version>0.9.18</version>
+      <scope>test</scope>
+    </dependency>
+    
+  </dependencies>
+  
+  <repositories>
+    <!--  for netty dependency -->
+    <repository>
+      <id>repository.jboss.org</id>
+      <url>http://repository.jboss.org/maven2</url>
+      <snapshots>
+        <enabled>false</enabled>
+      </snapshots>
+    </repository>
+  </repositories>
+   
+</project>
\ No newline at end of file

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/IEslEventListener.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/IEslEventListener.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/IEslEventListener.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/IEslEventListener.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/IEslEventListener.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client;
+
+import org.freeswitch.esl.client.transport.event.EslEvent;
+
+/**
+ * Interface for observers wanting to be notified of incoming FreeSWITCH Event Socket events.
+ * </p>
+ * Incoming events arrive asynchronously and are processed into two queues, one for server 
+ * initiated events, and one for the results of client requested background jobs.
+ * </p>  
+ * Each queue is serviced by a different thread pool (to ensure lowest latency for event-driven events) 
+ * and each queue is guaranteed to be processed (and listeners notified) in the order in which the
+ * events are received off the wire.
+ * </p>
+ * This design ensures that incoming event processing is not blocked by any long-running listener process.
+ * However multiple listeners will be notified sequentially, and so one slow listener can cause latency
+ * to other listeners.
+ *   
+ * @author  david varnes
+ * @version $Id$
+ */
+public interface IEslEventListener
+{
+    /**
+     * Signal of a server initiated event.
+     * 
+     * @param event as an {@link EslEvent} 
+     */
+    void eventReceived( EslEvent event );
+    
+    /**
+     * Signal of an event containing the result of a client requested background job.  The Job-UUID will
+     * be available as an event header of that name.
+     * 
+     * @param event as an {@link EslEvent}
+     */
+    void backgroundJobResultReceived( EslEvent event );
+}

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/Client.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/Client.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/Client.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/Client.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/Client.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,491 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client.inbound;
+
+import java.net.InetSocketAddress;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.freeswitch.esl.client.IEslEventListener;
+import org.freeswitch.esl.client.internal.IEslProtocolListener;
+import org.freeswitch.esl.client.transport.CommandResponse;
+import org.freeswitch.esl.client.transport.SendMsg;
+import org.freeswitch.esl.client.transport.event.EslEvent;
+import org.freeswitch.esl.client.transport.message.EslMessage;
+import org.jboss.netty.bootstrap.ClientBootstrap;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelFuture;
+import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Entry point to connect to a running FreeSWITCH Event Socket Library module, as a client.
+ * </p>
+ * This class provides what the FreeSWITCH documentation refers to as an 'Inbound' connection
+ * to the Event Socket module. That is, with reference to the socket listening on the FreeSWITCH
+ * server, this client occurs as an inbound connection to the server.
+ * </p>
+ * See http://wiki.freeswitch.org/wiki/Mod_event_socket
+ * 
+ * @author  david varnes
+ * @version $Id$
+ */
+public class Client
+{
+    private final Logger log = LoggerFactory.getLogger( this.getClass() );
+    
+    private final List<IEslEventListener> eventListeners = new CopyOnWriteArrayList<IEslEventListener>();
+    private final Executor eventListenerExecutor = Executors.newSingleThreadExecutor( 
+        new ThreadFactory()
+        {
+            AtomicInteger threadNumber = new AtomicInteger( 1 );
+            public Thread newThread( Runnable r )
+            {
+                return new Thread( r, "EslEventNotifier-" + threadNumber.getAndIncrement() );
+            }
+        });
+    private final Executor backgroundJobListenerExecutor = Executors.newSingleThreadExecutor( 
+        new ThreadFactory()
+        {
+            AtomicInteger threadNumber = new AtomicInteger( 1 );
+            public Thread newThread( Runnable r )
+            {
+                return new Thread( r, "EslBackgroundJobNotifier-" + threadNumber.getAndIncrement() );
+            }
+        });
+    
+    private AtomicBoolean authenticatorResponded = new AtomicBoolean( false );
+    private boolean authenticated;
+    private CommandResponse authenticationResponse;
+    private Channel channel;
+    
+    public boolean canSend()
+    {
+        return channel != null && channel.isConnected() && authenticated; 
+    }
+    
+    public void addEventListener( IEslEventListener listener )
+    {
+        if ( listener != null )
+        {
+            eventListeners.add( listener );
+        }
+    }
+
+    /**
+     * Attempt to establish an authenticated connection to the nominated FreeSWITCH ESL server socket.
+     * This call will block, waiting for an authentication handshake to occur, or timeout after the
+     * supplied number of seconds.  
+     *  
+     * @param host can be either ip address or hostname
+     * @param port tcp port that server socket is listening on (set in event_socket_conf.xml)
+     * @param password server event socket is expecting (set in event_socket_conf.xml) 
+     * @param timeoutSeconds number of seconds to wait for the server socket before aborting
+     */
+    public void connect( String host, int port, String password, int timeoutSeconds ) throws InboundConnectionFailure
+    {
+        // If already connected, disconnect first
+        if ( canSend() )
+        {
+            close();
+        }
+        
+        // Configure this client
+        ClientBootstrap bootstrap = new ClientBootstrap(
+            new NioClientSocketChannelFactory( 
+                Executors.newCachedThreadPool(), 
+                Executors.newCachedThreadPool() ) ); 
+        
+        // Add ESL handler and factory
+        InboundClientHandler handler = new InboundClientHandler( password, protocolListener );
+        bootstrap.setPipelineFactory( new InboundPipelineFactory( handler ) );
+        
+        // Attempt connection
+        ChannelFuture future = bootstrap.connect( new InetSocketAddress( host, port ) );
+        
+        // Wait till attempt succeeds, fails or timeouts
+        if ( ! future.awaitUninterruptibly( timeoutSeconds, TimeUnit.SECONDS ) )
+        {
+            throw new InboundConnectionFailure( "Timeout connecting to " + host + ":" + port );
+        }
+        // Did not timeout 
+        channel = future.getChannel();
+        // But may have failed anyway
+        if ( !future.isSuccess() )
+        {
+            log.warn( "Failed to connect to [{}:{}]", host, port );
+            log.warn( "  * reason: {}", future.getCause() );
+            
+            channel = null;
+            bootstrap.releaseExternalResources();
+            
+            throw new InboundConnectionFailure( "Could not connect to " + host + ":" + port, future.getCause() );
+        }
+        
+        //  Wait for the authentication handshake to call back
+        while ( ! authenticatorResponded.get() )
+        {
+            try
+            {
+                Thread.sleep( 250 );
+            } 
+            catch ( InterruptedException e )
+            {
+                // ignore
+            }
+        }
+        
+        if ( ! authenticated )
+        {
+            throw new InboundConnectionFailure( "Authentication failed: " + authenticationResponse.getReplyText() );
+        }
+    }
+    
+    /**
+     * Sends a FreeSWITCH API command to the server and blocks, waiting for an immediate response from the 
+     * server.
+     * <p/>
+     * The outcome of the command from the server is retured in an {@link EslMessage} object.
+     * 
+     * @param command API command to send
+     * @param arg command arguments
+     * @return an {@link EslMessage} containing command results
+     */
+    public EslMessage sendSyncApiCommand( String command, String arg )
+    {
+        checkConnected();
+        InboundClientHandler handler = (InboundClientHandler)channel.getPipeline().getLast();
+        StringBuilder sb = new StringBuilder();
+        if ( command != null && !command.isEmpty() )
+        {
+            sb.append( "api " );
+            sb.append( command );
+        }
+        if ( arg != null && !arg.isEmpty() )
+        {
+            sb.append( ' ' );
+            sb.append( arg );
+        }
+
+        return handler.sendSyncSingleLineCommand( channel, sb.toString() );
+    }
+    
+    /**
+     * Submit a FreeSWITCH API command to the server to be executed in background mode. A synchronous 
+     * response from the server provides a UUID to identify the job execution results. When the server
+     * has completed the job execution it fires a BACKGROUND_JOB Event with the execution results.<p/>
+     * Note that this Client must be subscribed in the normal way to BACKGOUND_JOB Events, in order to 
+     * receive this event.
+     *     
+     * @param command API command to send
+     * @param arg command arguments
+     * @return String Job-UUID that the server will tag result event with.
+     */
+    public String sendAsyncApiCommand( String command, String arg )
+    {
+        checkConnected();
+        InboundClientHandler handler = (InboundClientHandler)channel.getPipeline().getLast();
+        StringBuilder sb = new StringBuilder();
+        if ( command != null && !command.isEmpty() )
+        {
+            sb.append( "bgapi " );
+            sb.append( command );
+        }
+        if ( arg != null && !arg.isEmpty() )
+        {
+            sb.append( ' ' );
+            sb.append( arg );
+        }
+        
+        return handler.sendAsyncCommand( channel, sb.toString() );
+    }
+    
+    /**
+     * Set the current event subscription for this connection to the server.  Examples of the events 
+     * argument are:
+     * <pre>
+     *   ALL
+     *   CHANNEL_CREATE CHANNEL_DESTROY HEARTBEAT
+     *   CUSTOM conference::maintenance
+     *   CHANNEL_CREATE CHANNEL_DESTROY CUSTOM conference::maintenance sofia::register sofia::expire
+     * </pre> 
+     * Subsequent calls to this method replaces any previous subscriptions that were set.
+     * </p>
+     * Note: current implementation can only process 'plain' events.
+     * 
+     * @param format can be { plain | xml }
+     * @param events { all | space separated list of events } 
+     * @return a {@link CommandResponse} with the server's response.
+     */
+    public CommandResponse setEventSubscriptions( String format, String events )
+    {
+        // temporary hack
+        if ( ! format.equals( "plain" ) )
+        {
+            throw new IllegalStateException( "Only 'plain' event format is supported at present" );
+        }
+        
+        checkConnected();
+        InboundClientHandler handler = (InboundClientHandler)channel.getPipeline().getLast();
+        StringBuilder sb = new StringBuilder();
+        if ( format != null && !format.isEmpty() )
+        {
+            sb.append( "event " );
+            sb.append( format );
+        }
+        if ( events != null && !events.isEmpty() )
+        {
+            sb.append( ' ' );
+            sb.append( events );
+        }
+        EslMessage response = handler.sendSyncSingleLineCommand( channel, sb.toString() );
+
+        return new CommandResponse( sb.toString(), response );
+    }
+    
+    /**
+     * Cancel any existing event subscription.
+     * 
+     * @return a {@link CommandResponse} with the server's response.
+     */
+    public CommandResponse cancelEventSubscriptions()
+    {
+        checkConnected();
+        InboundClientHandler handler = (InboundClientHandler)channel.getPipeline().getLast();
+        EslMessage response = handler.sendSyncSingleLineCommand( channel, "noevents" );
+
+        return new CommandResponse( "noevents", response );
+    }
+
+    /**
+     * Add an event filter to the current set of event filters on this connection. Any of the event headers
+     * can be used as a filter.
+     * </p>
+     * Note that event filters follow 'filter-in' semantics. That is, when a filter is applied
+     * only the filtered values will be received. Multiple filters can be added to the current
+     * connection.
+     * </p>
+     * Example filters:
+     * <pre>
+     *    eventHeader        valueToFilter
+     *    ----------------------------------
+     *    Event-Name         CHANNEL_EXECUTE
+     *    Channel-State      CS_NEW
+     * </pre>
+     * 
+     * @param eventHeader to filter on
+     * @param valueToFilter the value to match
+     * @return a {@link CommandResponse} with the server's response.
+     */
+    public CommandResponse addEventFilter( String eventHeader, String valueToFilter )
+    {
+        checkConnected();
+        InboundClientHandler handler = (InboundClientHandler)channel.getPipeline().getLast();
+        StringBuilder sb = new StringBuilder();
+        if ( eventHeader != null && !eventHeader.isEmpty() )
+        {
+            sb.append( "filter " );
+            sb.append( eventHeader );
+        }
+        if ( valueToFilter != null && !valueToFilter.isEmpty() )
+        {
+            sb.append( ' ' );
+            sb.append( valueToFilter );
+        }
+        EslMessage response = handler.sendSyncSingleLineCommand( channel, sb.toString() );
+        
+        return new CommandResponse( sb.toString(), response );
+    }
+    
+    /**
+     * Delete an event filter from the current set of event filters on this connection.  See  
+     * {@link Client.addEventFilter}   
+     * 
+     * @param eventHeader   to remove
+     * @param valueToFilter to remove
+     * @return a {@link CommandResponse} with the server's response.
+     */
+    public CommandResponse deleteEventFilter( String eventHeader, String valueToFilter )
+    {
+        checkConnected();
+        InboundClientHandler handler = (InboundClientHandler)channel.getPipeline().getLast();
+        StringBuilder sb = new StringBuilder();
+        if ( eventHeader != null && !eventHeader.isEmpty() )
+        {
+            sb.append( "filter delete " );
+            sb.append( eventHeader );
+        }
+        if ( valueToFilter != null && !valueToFilter.isEmpty() )
+        {
+            sb.append( ' ' );
+            sb.append( valueToFilter );
+        }
+        EslMessage response = handler.sendSyncSingleLineCommand( channel, sb.toString() );
+
+        return new CommandResponse( sb.toString(), response );
+    }
+
+    /**
+     * Send a {@link SendMsg} command to FreeSWITCH.  This client requires that the {@link SendMsg}
+     * has a call UUID parameter.
+     *  
+     * @param sendMsg a {@link SendMsg} with call UUID
+     * @return a {@link CommandResponse} with the server's response.
+     */
+    public CommandResponse sendMessage( SendMsg sendMsg )
+    {
+        checkConnected();
+        InboundClientHandler handler = (InboundClientHandler)channel.getPipeline().getLast();
+        EslMessage response = handler.sendSyncMultiLineCommand( channel, sendMsg.getMsgLines() );
+        
+        return new CommandResponse( sendMsg.toString(), response );
+    }
+    
+    /**
+     * Enable log output.
+     * 
+     * @param level using the same values as in console.conf
+     * @return a {@link CommandResponse} with the server's response.
+     */
+    public CommandResponse setLoggingLevel( String level )
+    {
+        checkConnected();
+        InboundClientHandler handler = (InboundClientHandler)channel.getPipeline().getLast();
+        StringBuilder sb = new StringBuilder();
+        if ( level != null && !level.isEmpty() )
+        {
+            sb.append( "log " );
+            sb.append( level );
+        }
+        EslMessage response = handler.sendSyncSingleLineCommand( channel, sb.toString() );
+
+        return new CommandResponse( sb.toString(), response );
+    }
+
+    /**
+     * Disable any logging previously enabled with setLogLevel().
+     * 
+     * @return a {@link CommandResponse} with the server's response.
+     */
+    public CommandResponse cancelLogging()
+    {
+        checkConnected();
+        InboundClientHandler handler = (InboundClientHandler)channel.getPipeline().getLast();
+        EslMessage response = handler.sendSyncSingleLineCommand( channel, "nolog" );
+
+        return new CommandResponse( "nolog", response );
+    }
+
+    /**
+     * Close the socket connection
+     * 
+     * @return a {@link CommandResponse} with the server's response.
+     */
+    public CommandResponse close()
+    {
+        checkConnected();
+        InboundClientHandler handler = (InboundClientHandler)channel.getPipeline().getLast();
+        EslMessage response = handler.sendSyncSingleLineCommand( channel, "exit" );
+
+        return new CommandResponse( "exit", response );
+    }
+    
+    /*
+     *  Internal observer of the ESL protocol 
+     */
+    private final IEslProtocolListener protocolListener = new IEslProtocolListener()
+    {
+        public void authResponseReceived( CommandResponse response )
+        {
+            authenticatorResponded.set( true );
+            authenticated = response.isOk();
+            authenticationResponse = response;
+            log.debug( "Auth response success={}, message=[{}]", authenticated, response.getReplyText() );
+        }
+        
+        public void eventReceived( final EslEvent event )
+        {
+            log.debug( "Event received [{}]", event );
+            /*
+             *  Notify listeners in a different thread in order to:
+             *    - not to block the IO threads with potentially long-running listeners
+             *    - generally be defensive running other people's code
+             *  Use a different worker thread pool for async job results than for event driven
+             *  events to keep the latency as low as possible.
+             */
+            if ( event.getEventName().equals( "BACKGROUND_JOB" ) )
+            {
+                for ( final IEslEventListener listener : eventListeners )
+                {
+                    backgroundJobListenerExecutor.execute( new Runnable()
+                    {
+                        public void run()
+                        {
+                            try
+                            {
+                                listener.backgroundJobResultReceived( event );
+                            }
+                            catch ( Throwable t )
+                            {
+                                log.error( "Error caught notifying listener of job result [" + event + ']', t );
+                            }
+                        }
+                    } );
+                }
+            }
+            else
+            {
+                for ( final IEslEventListener listener : eventListeners )
+                {
+                    eventListenerExecutor.execute( new Runnable()
+                    {
+                        public void run()
+                        {
+                            try
+                            {
+                                listener.eventReceived( event );
+                            }
+                            catch ( Throwable t )
+                            {
+                                log.error( "Error caught notifying listener of event [" + event + ']', t );
+                            }
+                        }
+                    } );
+                }
+            }
+        }
+
+        public void disconnected()
+        {
+            log.info( "Disconnected .." );
+        }
+    };
+    
+    private void checkConnected()
+    {
+        if ( ! canSend() )
+        {
+            throw new IllegalStateException( "Not connected to FreeSWITCH Event Socket" );
+        }
+    }
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/InboundClientHandler.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/InboundClientHandler.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/InboundClientHandler.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/InboundClientHandler.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/InboundClientHandler.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client.inbound;
+
+import org.freeswitch.esl.client.internal.AbstractEslClientHandler;
+import org.freeswitch.esl.client.internal.IEslProtocolListener;
+import org.freeswitch.esl.client.transport.CommandResponse;
+import org.freeswitch.esl.client.transport.event.EslEvent;
+import org.freeswitch.esl.client.transport.message.EslMessage;
+import org.freeswitch.esl.client.transport.message.EslHeaders.Value;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.channel.ChannelPipelineCoverage;
+import org.jboss.netty.handler.execution.ExecutionHandler;
+
+/**
+ * End users of the inbound {@link Client} should not need to use this class. 
+ * </p>
+ * Specialised {@link AbstractEslClientHandler} that implements the connection logic for an 
+ * 'Inbound' FreeSWITCH Event Socket connection.  The responsibilities for this class are:
+ * </p>
+ * * To handle the auth request that the FreeSWITCH server will send immediately following a new 
+ * connection when mode is Inbound.
+ * </p>
+ * * To signal the observing {@link IEslProtocolListener} (expected to be the Inbound client 
+ * implementation when ESL events are received.
+ * </p>
+ * Note: implementation requirement is that an {@link ExecutionHandler} is placed in the processing 
+ * pipeline prior to this handler. This will ensure that each incoming message is processed in its
+ * own thread (although still guaranteed to be processed in the order of receipt).
+ * 
+ * @author  david varnes
+ * @version $Id$
+ */
+@ChannelPipelineCoverage( "one" )
+public class InboundClientHandler extends AbstractEslClientHandler
+{
+    private final String password;
+    private final IEslProtocolListener listener;
+    
+    public InboundClientHandler( String password, IEslProtocolListener listener )
+    {
+        this.password = password;
+        this.listener = listener;
+    }
+    
+    protected void handleEslEvent( ChannelHandlerContext ctx, EslEvent event )
+    {
+        log.debug( "Received event: [{}]", event );
+        listener.eventReceived( event );
+    }
+
+    protected void handleAuthRequest( ChannelHandlerContext ctx )
+    {
+        log.debug( "Auth requested, sending [auth {}]", "*****" );
+        EslMessage response = sendSyncSingleLineCommand( ctx.getChannel(), "auth " + password );
+        log.debug( "Auth response [{}]", response );
+        if ( response.getContentType().equals( Value.COMMAND_REPLY ) )
+        {
+            CommandResponse commandResponse = new CommandResponse( "auth " + password, response );
+            listener.authResponseReceived( commandResponse );
+        }
+        else
+        {
+            log.error( "Bad auth response message [{}]", response );
+            throw new IllegalStateException( "Incorrect auth response" ); 
+        }
+    }
+
+    @Override
+    protected void handleDisconnectionNotice()
+    {
+        log.debug( "Received disconnection notice" );
+        listener.disconnected();
+    }
+    
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/InboundConnectionFailure.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/InboundConnectionFailure.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/InboundConnectionFailure.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/InboundConnectionFailure.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/InboundConnectionFailure.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client.inbound;
+
+/**
+ * Checked exception to handle connection failures.
+ * 
+ * @author  david varnes
+ * @version $Id$
+ */
+public class InboundConnectionFailure extends Exception
+{
+    private static final long serialVersionUID = 1L;
+
+    public InboundConnectionFailure( String message )
+    {
+        super( message );
+    }
+    
+    public InboundConnectionFailure( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/InboundPipelineFactory.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/InboundPipelineFactory.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/InboundPipelineFactory.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/InboundPipelineFactory.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/inbound/InboundPipelineFactory.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client.inbound;
+
+import org.freeswitch.esl.client.internal.debug.ExecutionHandler;
+import org.freeswitch.esl.client.transport.message.EslMessageDecoder;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.jboss.netty.channel.ChannelHandler;
+import org.jboss.netty.channel.ChannelPipeline;
+import org.jboss.netty.channel.ChannelPipelineFactory;
+import org.jboss.netty.channel.Channels;
+import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder;
+import org.jboss.netty.handler.codec.string.StringDecoder;
+import org.jboss.netty.handler.codec.string.StringEncoder;
+import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor;
+
+/**
+ * End users of the {@link Client} should not need to use this class. 
+ * </p>
+ * Convenience factory to assemble a Netty processing pipeline for inbound clients.
+ * 
+ * @author  david varnes
+ * @version $Id$
+ */
+public class InboundPipelineFactory implements ChannelPipelineFactory
+{
+    private final ChannelHandler handler;
+    
+    private final ChannelBuffer[] delimiters = 
+        new ChannelBuffer[] { ChannelBuffers.wrappedBuffer( new byte[] { '\n' } ),
+                              ChannelBuffers.wrappedBuffer( new byte[] { '\n', '\n' } ) };
+    
+    public InboundPipelineFactory( ChannelHandler handler )
+    {
+        this.handler = handler;
+    }
+    
+    public ChannelPipeline getPipeline() throws Exception
+    {
+        ChannelPipeline pipeline = Channels.pipeline(); 
+        // Add the text line codec combination first
+        pipeline.addLast( "framer", new DelimiterBasedFrameDecoder( 8192, delimiters ) );  
+        pipeline.addLast( "stringDecoder", new StringDecoder() );
+        pipeline.addLast( "encoder", new StringEncoder() );
+        pipeline.addLast( "eslMessageDecoder", new EslMessageDecoder() );
+        // Add an executor to ensure separate thread for each upstream message from here
+        pipeline.addLast( "executor", new ExecutionHandler( 
+            new OrderedMemoryAwareThreadPoolExecutor( 16, 1048576, 1048576 ) ) );
+
+        // now the inbound client logic
+        pipeline.addLast( "clientHandler", handler );
+        
+        return pipeline;
+    }
+
+}

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/AbstractEslClientHandler.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/AbstractEslClientHandler.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/AbstractEslClientHandler.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/AbstractEslClientHandler.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/AbstractEslClientHandler.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,258 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client.internal;
+
+import java.util.List;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.freeswitch.esl.client.transport.event.EslEvent;
+import org.freeswitch.esl.client.transport.message.EslMessage;
+import org.freeswitch.esl.client.transport.message.EslHeaders.Name;
+import org.freeswitch.esl.client.transport.message.EslHeaders.Value;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.channel.ChannelUpstreamHandler;
+import org.jboss.netty.channel.MessageEvent;
+import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
+import org.jboss.netty.handler.execution.ExecutionHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Specialised {@link ChannelUpstreamHandler} that implements the logic of an ESL connection that
+ * is common to both inbound and outbound clients. This 
+ * handler expects to receive decoded {@link EslMessage} or {@link EslEvent} objects. The key 
+ * responsibilities for this class are:
+ * </p>
+ * * To synthesise a synchronous command/response api.  All IO operations using the underlying Netty 
+ * library are intrinsically asynchronous which provides for excellent response and scalability.  This 
+ * class provides for a blocking wait mechanism for responses to commands issued to the server.  A 
+ * key assumption here is that the FreeSWITCH server will process synchronous requests in the order they
+ * are received.
+ * </p>
+ * * Concrete sub classes are expected to 'terminate' the Netty IO processing pipeline (ie be the 'last'
+ * handler). 
+ * </p>
+ * Note: implementation requirement is that an {@link ExecutionHandler} is placed in the processing 
+ * pipeline prior to this handler. This will ensure that each incoming message is processed in its
+ * own thread (although still guaranteed to be processed in the order of receipt).
+ * 
+ * @author  david varnes
+ * @version $Id$
+ */
+public abstract class AbstractEslClientHandler extends SimpleChannelUpstreamHandler
+{
+    public static final String MESSAGE_TERMINATOR = "\n\n";  
+    public static final String LINE_TERMINATOR = "\n";  
+
+    protected final Logger log = LoggerFactory.getLogger( this.getClass() );
+
+    private final Lock syncLock = new ReentrantLock();
+    private final Queue<SyncCallback> syncCallbacks = new ConcurrentLinkedQueue<SyncCallback>();
+
+    @Override
+    public void messageReceived( ChannelHandlerContext ctx, MessageEvent e ) throws Exception
+    {
+        if ( e.getMessage() instanceof EslMessage )
+        {
+            EslMessage message = (EslMessage)e.getMessage();
+            String contentType = message.getContentType();
+            if ( contentType.equals( Value.TEXT_EVENT_PLAIN ) ||
+                    contentType.equals( Value.TEXT_EVENT_XML ) )
+            {
+                //  transform into an event
+                EslEvent eslEvent = new EslEvent( message );
+                handleEslEvent( ctx, eslEvent );
+            }
+            else
+            {
+                handleEslMessage( ctx, (EslMessage)e.getMessage() );
+            }
+        }
+        else
+        {
+            throw new IllegalStateException( "Unexpected message type: " + e.getMessage().getClass() );
+        }
+    }
+    
+    /**
+     * Synthesise a synchronous command/response by creating a callback object which is placed in 
+     * queue and blocks waiting for another IO thread to process an incoming {@link EslMessage} and
+     * attach it to the callback.
+     * 
+     * @param channel
+     * @param command single string to send
+     * @return the {@link EslMessage} attached to this command's callback
+     */
+    public EslMessage sendSyncSingleLineCommand( Channel channel, final String command )
+    {
+        SyncCallback callback = new SyncCallback();
+        syncLock.lock();
+        try 
+        {
+            syncCallbacks.add( callback );
+            channel.write( command + MESSAGE_TERMINATOR );
+        } 
+        finally 
+        {
+            syncLock.unlock();
+        }
+        
+        //  Block until the response is available 
+        return callback.get();
+    }
+
+    /**
+     * Synthesise a synchronous command/response by creating a callback object which is placed in 
+     * queue and blocks waiting for another IO thread to process an incoming {@link EslMessage} and
+     * attach it to the callback.
+     * 
+     * @param channel
+     * @param command List of command lines to send
+     * @return the {@link EslMessage} attached to this command's callback
+     */
+    public EslMessage sendSyncMultiLineCommand( Channel channel, final List<String> commandLines )
+    {
+        SyncCallback callback = new SyncCallback();
+        //  Build command with double line terminator at the end
+        StringBuilder sb = new StringBuilder();
+        for ( String line : commandLines )
+        {
+            sb.append( line );
+            sb.append( LINE_TERMINATOR );
+        }
+        sb.append( LINE_TERMINATOR );
+        
+        syncLock.lock();
+        try 
+        {
+            syncCallbacks.add( callback );
+            channel.write( sb.toString() );
+        } 
+        finally 
+        {
+            syncLock.unlock();
+        }
+        
+        //  Block until the response is available 
+        return callback.get();
+    }
+
+    /**
+     * Returns the Job UUID of that the response event will have.
+     * 
+     * @param channel
+     * @param command
+     * @return Job-UUID as a string
+     */
+    public String sendAsyncCommand( Channel channel, final String command )
+    {
+        /*
+         * Send synchronously to get the Job-UUID to return, the results of the actual 
+         * job request will be returned by the server as an async event.
+         */
+        EslMessage response = sendSyncSingleLineCommand( channel, command );
+        if ( response.hasHeader( Name.JOB_UUID ) )
+        {
+            return response.getHeaderValue( Name.JOB_UUID );
+        }
+        else
+        {
+            throw new IllegalStateException( "Missing Job-UUID header in bgapi response" );
+        }
+    }
+    
+    protected void handleEslMessage( ChannelHandlerContext ctx, EslMessage message )
+    {
+        log.info( "Received message: [{}]", message );
+        String contentType = message.getContentType();
+        
+        if ( contentType.equals( Value.API_RESPONSE ) )
+        {
+            log.debug( "Api response received [{}]", message );
+            syncCallbacks.poll().handle( message );
+        }
+        else if ( contentType.equals( Value.COMMAND_REPLY ) )
+        {
+            log.debug( "Command reply received [{}]", message );
+            syncCallbacks.poll().handle( message );
+        }
+        else if ( contentType.equals( Value.AUTH_REQUEST ) )
+        {
+            log.debug( "Auth request received [{}]", message );
+            handleAuthRequest( ctx );
+        }
+        else if ( contentType.equals( Value.TEXT_DISCONNECT_NOTICE ) )
+        {
+            log.debug( "Disconnect notice received [{}]", message );
+            handleDisconnectionNotice();
+        }
+        else
+        {
+            log.warn( "Unexpected message content type [{}]", contentType );
+        }
+    }
+
+    protected abstract void handleEslEvent( ChannelHandlerContext ctx, EslEvent event );
+
+    protected abstract void handleAuthRequest( ChannelHandlerContext ctx );
+
+    protected abstract void handleDisconnectionNotice();
+    
+    private static class SyncCallback
+    {
+        private static final Logger log = LoggerFactory.getLogger( SyncCallback.class );
+        private final CountDownLatch latch = new CountDownLatch( 1 );
+        private EslMessage response;
+
+        /**
+         * Block waiting for the countdown latch to be released, then return the 
+         * associated response object.
+         * @return
+         */
+        EslMessage get()
+        {
+            try
+            {
+                log.trace( "awaiting latch ... " );
+                latch.await();
+            }
+            catch ( InterruptedException e )
+            {
+                throw new RuntimeException( e );
+            }
+            
+            log.trace( "returning response [{}]", response );
+            return response;
+        }
+
+        /**
+         * Attach this response to the callback and release the countdown latch.
+         * @param response
+         */
+        void handle( EslMessage response )
+        {
+            this.response = response;
+            log.trace( "releasing latch for response [{}]", response );
+            latch.countDown();
+        }
+    }
+
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/HeaderParser.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/HeaderParser.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/HeaderParser.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/HeaderParser.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/HeaderParser.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client.internal;
+
+/**
+ * This parser provides a static helper method to split a standard Header field
+ * into the name and value parts.
+ * <p/>
+ * This code was copied from the splitHeader() method in the 
+ * <code>org.jboss.netty.handler.codec.http.HttpMessageDecoder</code> class, which
+ * is licensed under the Apache License version 2. Original author: Trustin Lee.
+ *  
+ * @author	 Trustin Lee
+ * @author   david varnes
+ */
+public class HeaderParser
+{
+    /**
+     * Split a header in the form 
+     * <pre>
+     *   Header-Name: Some_header-value
+     * </pre>
+     * into a String array.
+     * 
+     * @param  sb the string header to parse
+     * @return a String[] array with header name at 0 and header value at 1
+     */
+    public static String[] splitHeader(String sb) {
+        final int length = sb.length();
+        int nameStart;
+        int nameEnd;
+        int colonEnd;
+        int valueStart;
+        int valueEnd;
+
+        nameStart = findNonWhitespace(sb, 0);
+        for (nameEnd = nameStart; nameEnd < length; nameEnd ++) {
+            char ch = sb.charAt(nameEnd);
+            if (ch == ':' || Character.isWhitespace(ch)) {
+                break;
+            }
+        }
+
+        for (colonEnd = nameEnd; colonEnd < length; colonEnd ++) {
+            if (sb.charAt(colonEnd) == ':') {
+                colonEnd ++;
+                break;
+            }
+        }
+
+        valueStart = findNonWhitespace(sb, colonEnd);
+        if (valueStart == length) {
+            return new String[] {
+                    sb.substring(nameStart, nameEnd),
+                    ""
+            };
+        }
+
+        valueEnd = findEndOfString(sb);
+        return new String[] {
+                sb.substring(nameStart, nameEnd),
+                sb.substring(valueStart, valueEnd)
+        };
+    }
+
+    private static int findNonWhitespace(String sb, int offset) {
+        int result;
+        for (result = offset; result < sb.length(); result ++) {
+            if (!Character.isWhitespace(sb.charAt(result))) {
+                break;
+            }
+        }
+        return result;
+    }
+
+    private static int findEndOfString(String sb) {
+        int result;
+        for (result = sb.length(); result > 0; result --) {
+            if (!Character.isWhitespace(sb.charAt(result - 1))) {
+                break;
+            }
+        }
+        return result;
+    }
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/IEslProtocolListener.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/IEslProtocolListener.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/IEslProtocolListener.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/IEslProtocolListener.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/IEslProtocolListener.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client.internal;
+
+import org.freeswitch.esl.client.inbound.Client;
+import org.freeswitch.esl.client.transport.CommandResponse;
+import org.freeswitch.esl.client.transport.event.EslEvent;
+
+/**
+ * End users of the {@link Client} should not need to use this class. 
+ * </p>
+ * Allow client implementations to observe events arriving from the server.
+ * 
+ * @author  david varnes
+ * @version $Id$
+ */
+public interface IEslProtocolListener
+{
+    void authResponseReceived( CommandResponse response );
+    
+    void eventReceived( EslEvent event );
+    
+    void disconnected();
+}

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/debug (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/debug)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/debug/ChannelEventRunnable.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/debug/ChannelEventRunnable.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/debug/ChannelEventRunnable.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/debug/ChannelEventRunnable.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/debug/ChannelEventRunnable.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,87 @@
+package org.freeswitch.esl.client.internal.debug;
+/*
+ * Copyright 2009 Red Hat, Inc.
+ *
+ * Red Hat licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+import java.util.concurrent.Executor;
+
+import org.jboss.netty.channel.ChannelEvent;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.util.EstimatableObjectWrapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * a {@link Runnable} which sends the specified {@link ChannelEvent} upstream.
+ * Most users will not see this type at all because it is used by
+ * {@link Executor} implementors only
+ *
+ * @author The Netty Project (netty-dev@lists.jboss.org)
+ * @author Trustin Lee (tlee@redhat.com)
+ *
+ * @version $Rev: 1685 $, $Date: 2009-08-28 16:15:49 +0900 (금, 28 8 2009) $
+ *
+ */
+public class ChannelEventRunnable implements Runnable, EstimatableObjectWrapper {
+    
+    private final Logger log = LoggerFactory.getLogger( this.getClass() );
+    private final ChannelHandlerContext ctx;
+    private final ChannelEvent e;
+    volatile int estimatedSize;
+
+    /**
+     * Creates a {@link Runnable} which sends the specified {@link ChannelEvent}
+     * upstream via the specified {@link ChannelHandlerContext}.
+     */
+    public ChannelEventRunnable(ChannelHandlerContext ctx, ChannelEvent e) {
+        this.ctx = ctx;
+        this.e = e;
+    }
+
+    /**
+     * Returns the {@link ChannelHandlerContext} which will be used to
+     * send the {@link ChannelEvent} upstream.
+     */
+    public ChannelHandlerContext getContext() {
+        return ctx;
+    }
+
+    /**
+     * Returns the {@link ChannelEvent} which will be sent upstream.
+     */
+    public ChannelEvent getEvent() {
+        return e;
+    }
+
+    /**
+     * Sends the event upstream.
+     */
+    public void run() {
+//        log.info( "Sending [{}] upstream in [{}]", e, ctx );
+        try
+        {
+            ctx.sendUpstream(e);
+        }
+        catch ( Throwable t )
+        {
+            log.error( "Caught -->", t );
+        }
+    }
+
+    public Object unwrap() {
+        return e;
+    }
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/debug/ExecutionHandler.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/debug/ExecutionHandler.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/debug/ExecutionHandler.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/debug/ExecutionHandler.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/internal/debug/ExecutionHandler.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,118 @@
+package org.freeswitch.esl.client.internal.debug;
+
+/*
+ * Copyright 2009 Red Hat, Inc.
+ *
+ * Red Hat licenses this file to you under the Apache License, version 2.0
+ * (the "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.concurrent.Executor;
+
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelDownstreamHandler;
+import org.jboss.netty.channel.ChannelEvent;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.channel.ChannelPipeline;
+import org.jboss.netty.channel.ChannelPipelineCoverage;
+import org.jboss.netty.channel.ChannelState;
+import org.jboss.netty.channel.ChannelStateEvent;
+import org.jboss.netty.channel.ChannelUpstreamHandler;
+import org.jboss.netty.util.ExternalResourceReleasable;
+import org.jboss.netty.util.internal.ExecutorUtil;
+
+/**
+ * Forwards an upstream {@link ChannelEvent} to an {@link Executor}.
+ * <p>
+ * You can implement various thread model by adding this handler to a
+ * {@link ChannelPipeline}.  The most common use case of this handler is to
+ * add a {@link ExecutionHandler} which was specified with
+ * {@link OrderedMemoryAwareThreadPoolExecutor}:
+ * <pre>
+ * ChannelPipeline pipeline = ...;
+ * pipeline.addLast("decoder", new MyProtocolDecoder());
+ * pipeline.addLast("encoder", new MyProtocolEncoder());
+ *
+ * // HERE
+ * <strong>pipeline.addLast("executor", new {@link ExecutionHandler}(new {@link OrderedMemoryAwareThreadPoolExecutor}(16, 1048576, 1048576)));</strong>
+ *
+ * pipeline.addLast("handler", new MyBusinessLogicHandler());
+ * </pre>
+ * to utilize more processors to handle {@link ChannelEvent}s.  You can also
+ * use other {@link Executor} implementation than the recommended
+ * {@link OrderedMemoryAwareThreadPoolExecutor}.
+ *
+ * @author The Netty Project (netty-dev@lists.jboss.org)
+ * @author Trustin Lee (tlee@redhat.com)
+ *
+ * @version $Rev: 1685 $, $Date: 2009-08-28 16:15:49 +0900 (금, 28 8 2009) $
+ *
+ * @apiviz.landmark
+ * @apiviz.has java.util.concurrent.ThreadPoolExecutor
+ */
+@ChannelPipelineCoverage("all")
+public class ExecutionHandler implements ChannelUpstreamHandler, ChannelDownstreamHandler, ExternalResourceReleasable {
+
+    private final Executor executor;
+
+    /**
+     * Creates a new instance with the specified {@link Executor}.
+     * Specify an {@link OrderedMemoryAwareThreadPoolExecutor} if unsure.
+     */
+    public ExecutionHandler(Executor executor) {
+        if (executor == null) {
+            throw new NullPointerException("executor");
+        }
+        this.executor = executor;
+    }
+
+    /**
+     * Returns the {@link Executor} which was specified with the constructor.
+     */
+    public Executor getExecutor() {
+        return executor;
+    }
+
+    /**
+     * Shuts down the {@link Executor} which was specified with the constructor
+     * and wait for its termination.
+     */
+    public void releaseExternalResources() {
+        ExecutorUtil.terminate(getExecutor());
+    }
+
+    public void handleUpstream(
+            ChannelHandlerContext context, ChannelEvent e) throws Exception {
+        executor.execute(new ChannelEventRunnable(context, e));
+    }
+
+    public void handleDownstream(
+            ChannelHandlerContext ctx, ChannelEvent e) throws Exception {
+        if (e instanceof ChannelStateEvent) {
+            ChannelStateEvent cse = (ChannelStateEvent) e;
+            if (cse.getState() == ChannelState.INTEREST_OPS &&
+                (((Integer) cse.getValue()).intValue() & Channel.OP_READ) != 0) {
+
+                // setReadable(true) requested
+                boolean readSuspended = ctx.getAttachment() != null;
+                if (readSuspended) {
+                    // Drop the request silently if MemoryAwareThreadPool has
+                    // set the flag.
+                    e.getFuture().setSuccess();
+                    return;
+                }
+            }
+        }
+
+        ctx.sendDownstream(e);
+    }
+}

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/AbstractOutboundClientHandler.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/AbstractOutboundClientHandler.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/AbstractOutboundClientHandler.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/AbstractOutboundClientHandler.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/AbstractOutboundClientHandler.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client.outbound;
+
+import org.freeswitch.esl.client.internal.AbstractEslClientHandler;
+import org.freeswitch.esl.client.transport.event.EslEvent;
+import org.freeswitch.esl.client.transport.message.EslMessage;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.channel.ChannelPipelineCoverage;
+import org.jboss.netty.channel.ChannelStateEvent;
+import org.jboss.netty.handler.execution.ExecutionHandler;
+
+/**
+ * Specialised {@link AbstractEslClientHandler} that implements the base connecction logic for an 
+ * 'Outbound' FreeSWITCH Event Socket connection.  The responsibilities for this class are:
+ * </p>
+ * * To send a 'connect' command when the FreeSWITCH server first establishes a new connection with
+ * the socket client in Outbound mode.  This will result in an incoming {@link EslMessage} that is
+ * transformed into an {@link EslEvent} that sub classes can handle.
+ * </p>
+ * Note: implementation requirement is that an {@link ExecutionHandler} is placed in the processing 
+ * pipeline prior to this handler. This will ensure that each incoming message is processed in its
+ * own thread (although still guaranteed to be processed in the order of receipt).
+ * 
+ * @author  david varnes
+ * @version $Id$
+ */
+@ChannelPipelineCoverage( "one" )
+public abstract class AbstractOutboundClientHandler extends AbstractEslClientHandler
+{
+
+    @Override
+    public void channelConnected( ChannelHandlerContext ctx, ChannelStateEvent e ) throws Exception
+    {
+        // Have received a connection from FreeSWITCH server, send connect response
+        log.debug( "Received new connection from server, sending connect message" );
+        
+        EslMessage response = sendSyncSingleLineCommand( ctx.getChannel(), "connect" );
+        // A hack in the message decoder treats most of this incoming message as an event so parse now
+        EslEvent channelDataEvent = new EslEvent( response, true );
+        // Let implementing sub classes choose what to do next
+        handleConnectResponse( ctx, channelDataEvent );
+    }
+
+    protected abstract void handleConnectResponse( ChannelHandlerContext ctx, EslEvent event );
+
+    @Override
+    protected void handleAuthRequest( ChannelHandlerContext ctx )
+    {
+        // This should not happen in outbound mode
+        log.warn( "Auth request received in outbound mode, ignoring" ); 
+    }
+
+    @Override
+    protected void handleDisconnectionNotice()
+    {
+        log.debug( "Received disconnection notice" );
+    }    
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/AbstractOutboundPipelineFactory.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/AbstractOutboundPipelineFactory.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/AbstractOutboundPipelineFactory.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/AbstractOutboundPipelineFactory.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/AbstractOutboundPipelineFactory.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client.outbound;
+
+import org.freeswitch.esl.client.internal.debug.ExecutionHandler;
+import org.freeswitch.esl.client.transport.message.EslMessageDecoder;
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.jboss.netty.channel.ChannelPipeline;
+import org.jboss.netty.channel.ChannelPipelineFactory;
+import org.jboss.netty.channel.Channels;
+import org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder;
+import org.jboss.netty.handler.codec.string.StringDecoder;
+import org.jboss.netty.handler.codec.string.StringEncoder;
+import org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor;
+
+/**
+ * </p>
+ * An abstract factory to assemble a Netty processing pipeline for outbound clients.
+ * 
+ * @author  david varnes
+ * @version $Id$
+ */
+public abstract class AbstractOutboundPipelineFactory implements ChannelPipelineFactory
+{
+    
+    private final ChannelBuffer[] delimiters = 
+        new ChannelBuffer[] { ChannelBuffers.wrappedBuffer( new byte[] { '\n' } ),
+                              ChannelBuffers.wrappedBuffer( new byte[] { '\n', '\n' } ) };
+    
+    public ChannelPipeline getPipeline() throws Exception
+    {
+        ChannelPipeline pipeline = Channels.pipeline(); 
+        // Add the text line codec combination first
+        pipeline.addLast( "framer", new DelimiterBasedFrameDecoder( 8192, delimiters ) );  
+        pipeline.addLast( "stringDecoder", new StringDecoder() );
+        pipeline.addLast( "encoder", new StringEncoder() );
+        pipeline.addLast( "eslMessageDecoder", new EslMessageDecoder( true ) );
+        // Add an executor to ensure separate thread for each upstream message from here
+        pipeline.addLast( "executor", new ExecutionHandler( 
+            new OrderedMemoryAwareThreadPoolExecutor( 16, 1048576, 1048576 ) ) );
+
+        // now the outbound client logic
+        pipeline.addLast( "clientHandler", makeHandler() );
+        
+        return pipeline;
+    }
+
+    protected abstract AbstractOutboundClientHandler makeHandler();
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/SocketClient.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/SocketClient.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/SocketClient.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/SocketClient.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/SocketClient.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client.outbound;
+
+import java.net.InetSocketAddress;
+import java.util.concurrent.Executors;
+
+import org.jboss.netty.bootstrap.ServerBootstrap;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelFactory;
+import org.jboss.netty.channel.group.ChannelGroup;
+import org.jboss.netty.channel.group.ChannelGroupFuture;
+import org.jboss.netty.channel.group.DefaultChannelGroup;
+import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Entry point to run a socket client that a running FreeSWITCH Event Socket Library module can
+ * make outbound connections to.
+ * </p>
+ * This class provides for what the FreeSWITCH documentation refers to as 'Outbound' connections
+ * from the Event Socket module. That is, with reference to the module running on the FreeSWITCH
+ * server, this client accepts an outbound connection from the server module.
+ * </p>
+ * See http://wiki.freeswitch.org/wiki/Mod_event_socket
+ * 
+ * @author  david varnes
+ * @version $Id$
+ */
+public class SocketClient
+{
+    private final Logger log = LoggerFactory.getLogger( this.getClass() );
+
+    private final ChannelGroup allChannels = new DefaultChannelGroup( "esl-socket-client" );
+    
+    private final int port;
+    private final ChannelFactory channelFactory;
+    private final AbstractOutboundPipelineFactory pipelineFactory;
+    
+    public SocketClient( int port, AbstractOutboundPipelineFactory pipelineFactory )
+    {
+        this.port = port;
+        this.pipelineFactory = pipelineFactory;
+        this.channelFactory =  new NioServerSocketChannelFactory( 
+            Executors.newCachedThreadPool(), 
+            Executors.newCachedThreadPool() ); 
+    }
+    
+    public void start()
+    {
+        ServerBootstrap bootstrap = new ServerBootstrap( channelFactory );
+        
+        bootstrap.setPipelineFactory( pipelineFactory );
+        bootstrap.setOption( "child.tcpNoDelay", true );
+        bootstrap.setOption( "child.keepAlive", true );
+        
+        Channel serverChannel = bootstrap.bind( new InetSocketAddress( port ) );
+        allChannels.add( serverChannel );
+        log.info( "SocketClient waiting for connections on port [{}] ...", port );
+    }
+    
+    public void stop()
+    {
+        ChannelGroupFuture future = allChannels.close();
+        future.awaitUninterruptibly();
+        channelFactory.releaseExternalResources();
+        log.info( "SocketClient stopped" );
+    }
+}

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/example (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/example)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/example/SimpleHangupOutboundHandler.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/example/SimpleHangupOutboundHandler.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/example/SimpleHangupOutboundHandler.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/example/SimpleHangupOutboundHandler.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/example/SimpleHangupOutboundHandler.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,84 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client.outbound.example;
+
+import org.freeswitch.esl.client.outbound.AbstractOutboundClientHandler;
+import org.freeswitch.esl.client.transport.SendMsg;
+import org.freeswitch.esl.client.transport.event.EslEvent;
+import org.freeswitch.esl.client.transport.message.EslMessage;
+import org.freeswitch.esl.client.transport.message.EslHeaders.Name;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelHandlerContext;
+
+/**
+ * Simple example of a handler for outbound connection from FreeSWITCH server.
+ * This class will log some of the FreeSWTICH call channel variables and 
+ * then hangup the call.  
+ * 
+ * @author  david varnes
+ * @version $Id$
+ */
+public class SimpleHangupOutboundHandler extends AbstractOutboundClientHandler
+{
+    
+    @Override
+    protected void handleConnectResponse( ChannelHandlerContext ctx, EslEvent event )
+    {
+        log.info( "Received connect response [{}]", event );
+        if ( event.getEventName().equalsIgnoreCase( "CHANNEL_DATA" ) )
+        {
+            // this is the response to the initial connect 
+            log.info( "=======================  incoming channel data  =============================" );
+            log.info( "Event-Date-Local: [{}]", event.getEventDateLocal() );
+            log.info( "Unique-ID: [{}]", event.getEventHeaders().get( "Unique-ID" ) );
+            log.info( "Channel-ANI: [{}]", event.getEventHeaders().get( "Channel-ANI" ) );
+            log.info( "Answer-State: [{}]", event.getEventHeaders().get( "Answer-State" ) );
+            log.info( "Caller-Destination-Number: [{}]", event.getEventHeaders().get( "Caller-Destination-Number" ) );
+            log.info( "=======================  = = = = = = = = = = =  =============================" );
+            
+            // now hangup the call
+            hangupCall( ctx.getChannel() );
+        }
+        else
+        {
+            throw new IllegalStateException( "Unexpected event after connect: [" + event.getEventName() + ']' );
+        }
+    }
+
+    @Override
+    protected void handleEslEvent( ChannelHandlerContext ctx, EslEvent event )
+    {
+        log.info( "Received event [{}]", event );
+    }
+    
+    private void hangupCall( Channel channel )
+    {
+        SendMsg hangupMsg = new SendMsg();
+        hangupMsg.addCallCommand( "execute" );
+        hangupMsg.addExecuteAppName( "hangup" );
+        
+        EslMessage response = sendSyncMultiLineCommand( channel, hangupMsg.getMsgLines() );
+        
+        if ( response.getHeaderValue( Name.REPLY_TEXT ).startsWith( "+OK" ) )
+        {
+            log.info( "Call hangup successful" );
+        }
+        else
+        {
+            
+        }
+    }
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/example/SimpleHangupPipelineFactory.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/example/SimpleHangupPipelineFactory.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/example/SimpleHangupPipelineFactory.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/example/SimpleHangupPipelineFactory.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/outbound/example/SimpleHangupPipelineFactory.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client.outbound.example;
+
+import org.freeswitch.esl.client.outbound.AbstractOutboundClientHandler;
+import org.freeswitch.esl.client.outbound.AbstractOutboundPipelineFactory;
+
+/**
+ * Factory for the simple hangup handler
+ * 
+ * @author  david varnes
+ * @version $Id$
+ */
+public class SimpleHangupPipelineFactory extends AbstractOutboundPipelineFactory
+{
+
+    @Override
+    protected AbstractOutboundClientHandler makeHandler()
+    {
+        return new SimpleHangupOutboundHandler();
+    }
+
+}

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/CommandResponse.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/CommandResponse.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/CommandResponse.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/CommandResponse.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/CommandResponse.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client.transport;
+
+import org.freeswitch.esl.client.transport.message.EslMessage;
+import org.freeswitch.esl.client.transport.message.EslHeaders.Name;
+
+/**
+ * Result object to carry the results of a command sent to the FreeSWITCH Event Socket.
+ * 
+ * @author  david varnes
+ * @version $Id$
+ */
+public class CommandResponse
+{
+    private final String command;
+    private final String replyText;
+    private final EslMessage response;
+    private final boolean success;
+    
+    public CommandResponse( String command, EslMessage response )
+    {
+        this.command = command;
+        this.response = response;
+        this.replyText = response.getHeaderValue( Name.REPLY_TEXT );
+        this.success = replyText.startsWith( "+OK" );
+    }
+    
+    /**
+     * @return the original command sent to the server
+     */
+    public String getCommand()
+    {
+        return command;
+    }
+    
+    /**
+     * @return true if and only if the response Reply-Text line starts with "+OK"
+     */
+    public boolean isOk()
+    {
+        return success;
+    }
+    
+    /**
+     * @return the full response Reply-Text line.
+     */
+    public String getReplyText()
+    {
+        return replyText;
+    }
+    
+    /**
+     * @return {@link EslMessage} the full response from the server 
+     */
+    public EslMessage getResponse()
+    {
+        return response;
+    }
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/SendMsg.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/SendMsg.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/SendMsg.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/SendMsg.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/SendMsg.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,187 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client.transport;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 
+ * @author  david varnes
+ * @version $Id$
+ */
+public class SendMsg
+{
+    private final List<String> msgLines = new ArrayList<String>();
+    private final boolean hasUuid;
+    
+    /**
+     * Constructor for use with outbound socket client only.  This client mode does not need a call
+     * UUID for context.
+     */
+    public SendMsg()
+    {
+        msgLines.add( "sendmsg" );
+        hasUuid = false;
+    }
+    
+    /**
+     * Constructor for use with the inbound client. 
+     * 
+     * @param uuid of the call to send message to (it should be in 'park' to be operated on).
+     */
+    public SendMsg( String uuid )
+    {
+        msgLines.add( "sendmsg " + uuid );
+        hasUuid = true;
+    }
+    
+    /**
+     * Adds the following line to the message:
+     * <pre>
+     *   call-command: command
+     * </pre>
+     * @param command the string command [ execute | hangup ] 
+     */
+    public void addCallCommand( String command )
+    {
+        msgLines.add( "call-command: " + command );
+    }
+    
+    /**
+     * Adds the following line to the message:
+     * <pre>
+     *   execute-app-name: appName
+     * </pre>
+     * @param appName the string app name to execute 
+     */
+    public void addExecuteAppName( String appName )
+    {
+        msgLines.add( "execute-app-name: " + appName );
+    }
+    
+    /**
+     * Adds the following line to the message:
+     * <pre>
+     *   execute-app-arg: arg
+     * </pre>
+     * @param arg the string arg
+     */
+    public void addExecuteAppArg( String arg )
+    {
+        msgLines.add( "execute-app-arg: " + arg );
+    }
+
+    /**
+     * Adds the following line to the message:
+     * <pre>
+     *   loops: count
+     * </pre>
+     * @param count the int number of times to loop
+     */
+    public void addLoops( int count )
+    {
+        msgLines.add( "loops: " + count );
+    }
+
+    /**
+     * Adds the following line to the message:
+     * <pre>
+     *   hangup-cause: cause
+     * </pre>
+     * @param cause the string cause
+     */
+    public void addHangupCause( String cause )
+    {
+        msgLines.add( "hangup-cause: " + cause );
+    }
+
+    /**
+     * Adds the following line to the message:
+     * <pre>
+     *   nomedia-uid: value
+     * </pre>
+     * @param value the string value part of the line
+     */
+    public void addNomediaUuid( String value )
+    {
+        msgLines.add( "nomedia-uuid: " + value );
+    }
+    
+    /**
+     *  Adds the following line to the message:
+     *  <pre>
+     *    event-lock: true
+     *  </pre> 
+     */
+    public void addEventLock()
+    {
+        msgLines.add( "event-lock: true" );
+    }
+    
+    /**
+     * A generic method to add a message line. The constructed line in the sent message will be in the
+     * form:
+     * <pre>
+     *   name: value
+     * </pre>
+     * 
+     * @param name part of line 
+     * @param value part of line
+     */
+    public void addGenericLine( String name, String value )
+    {
+        msgLines.add( name + ": " + value );
+    }
+    
+    /**
+     * The list of strings that make up the message to send to FreeSWITCH.
+     * 
+     * @return list of strings, as they were added to this message.
+     */
+    public List<String> getMsgLines()
+    {
+        return msgLines;
+    }
+
+    /**
+     * Indicate if message was constructed with a UUID.
+     * 
+     * @return true if constructed with a UUID.
+     */
+    public boolean hasUuid()
+    {
+        return hasUuid;
+    }
+    
+    @Override
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder( "SendMsg: " );
+        if ( msgLines.size() > 1 )
+        {
+            sb.append( msgLines.get( 1 ) );
+        } 
+        else if ( msgLines.size() > 0 )
+        {
+            sb.append( 0 );
+        }
+        
+        return sb.toString();
+    }
+    
+    
+}

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/event (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/event)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/event/EslEvent.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/event/EslEvent.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/event/EslEvent.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/event/EslEvent.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/event/EslEvent.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,234 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client.transport.event;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.freeswitch.esl.client.internal.HeaderParser;
+import org.freeswitch.esl.client.transport.message.EslHeaders;
+import org.freeswitch.esl.client.transport.message.EslMessage;
+import org.freeswitch.esl.client.transport.message.EslHeaders.Name;
+import org.freeswitch.esl.client.transport.message.EslHeaders.Value;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * FreeSWITCH Event Socket events are decoded into this data object.
+ * </p>
+ * An ESL event is modelled as a collection of text lines. An event always has several eventHeader
+ * lines, and optionally may have some eventBody lines.  In addition the messageHeaders of the 
+ * original containing {@link EslMessage} which carried the event are also available. 
+ * </p>
+ * The eventHeader lines are parsed and cached in a map keyed by the eventHeader name string. An event
+ * is always expected to have an "Event-Name" eventHeader. Commonly used eventHeader names are coded
+ * in {@link EslEventHeaderNames}</br>
+ * Any eventBody lines are cached in a list.</br>
+ * The messageHeader lines from the original message are cached in a map keyed by {@link EslHeaders.Name}.
+ *  
+ * @author  david varnes
+ * @version $Id$
+ * @see EslEventHeaderNames
+ */
+public class EslEvent 
+{
+    private final Logger log = LoggerFactory.getLogger( this.getClass() );
+    
+    private final Map<Name,String> messageHeaders;
+    private final Map<String,String> eventHeaders;
+    private final List<String> eventBody;
+    private boolean decodeEventHeaders = true;
+    
+    public EslEvent( EslMessage rawMessage )
+    {
+        this( rawMessage, false );
+    }
+    
+    public EslEvent( EslMessage rawMessage, boolean parseCommandReply )
+    {
+        messageHeaders = rawMessage.getHeaders();
+        eventHeaders = new HashMap<String,String>( rawMessage.getBodyLines().size() );
+        eventBody = new ArrayList<String>();
+        // plain or xml body
+        if ( rawMessage.getContentType().equals( Value.TEXT_EVENT_PLAIN ) )
+        {
+            parsePlainBody( rawMessage.getBodyLines() );
+        }
+        else if ( rawMessage.getContentType().equals( Value.TEXT_EVENT_XML ) )
+        {
+            throw new IllegalStateException( "XML events are not yet supported" );
+        }
+        else if ( rawMessage.getContentType().equals( Value.COMMAND_REPLY ) && parseCommandReply )
+        {
+            parsePlainBody( rawMessage.getBodyLines() );
+        }
+        else
+        {
+            throw new IllegalStateException( "Unexpected EVENT content-type: " + 
+                rawMessage.getContentType() );
+        }
+    }
+
+    /**
+     * The message headers of the original ESL message from which this event was decoded.
+     * The message headers are stored in a map keyed by {@link EslHeaders.Name}. The string mapped value 
+     * is the parsed content of the header line (ie, it does not include the header name).
+     *  
+     * @return map of header values
+     */
+    public Map<Name,String> getMessageHeaders()
+    {
+        return messageHeaders;
+    }
+
+    /**
+     * The event headers of this event. The headers are parsed and stored in a map keyed by the string 
+     * name of the header, and the string mapped value is the parsed content of the event header line 
+     * (ie, it does not include the header name).
+     *  
+     * @return map of event header values
+     */
+    public Map<String, String> getEventHeaders()
+    {
+        return eventHeaders;
+    }
+    
+    /**
+     * Any event body lines that were present in the event.
+     * 
+     * @return list of decoded event body lines, may be an empty list.
+     */
+    public List<String> getEventBodyLines()
+    {
+        return eventBody;
+    }
+    
+    /**
+     * Convenience method.
+     * 
+     * @return the string value of the event header "Event-Name"
+     */
+    public String getEventName()
+    {
+        return getEventHeaders().get( EslEventHeaderNames.EVENT_NAME ); 
+    }
+    
+    /**
+     * Convenience method.
+     * 
+     * @return long value of the event header "Event-Date-Timestamp"
+     */
+    public long getEventDateTimestamp()
+    {
+        return Long.valueOf( getEventHeaders().get( EslEventHeaderNames.EVENT_DATE_TIMESTAMP ) );
+    }
+
+    /**
+     * Convenience method.
+     * 
+     * @return long value of the event header "Event-Date-Local"
+     */
+    public String getEventDateLocal()
+    {
+        return getEventHeaders().get( EslEventHeaderNames.EVENT_DATE_LOCAL );
+    }
+
+    /**
+     * Convenience method.
+     * 
+     * @return long value of the event header "Event-Date-GMT"
+     */
+    public String getEventDateGmt()
+    {
+        return getEventHeaders().get( EslEventHeaderNames.EVENT_DATE_GMT );
+    }
+
+    /**
+     * Convenience method.
+     * 
+     * @return true if the eventBody list is not empty.
+     */
+    public boolean hasEventBody()
+    {
+        return ! eventBody.isEmpty();
+    }
+    
+    private void parsePlainBody( final List<String> rawBodyLines )
+    {
+        boolean isEventBody = false;
+        for ( String rawLine : rawBodyLines )
+        {
+            if ( ! isEventBody )
+            {
+                // split the line
+                String[] headerParts = HeaderParser.splitHeader( rawLine );
+                if ( decodeEventHeaders )
+                {
+                    try
+                    {
+                        String decodedValue = URLDecoder.decode( headerParts[1], "UTF-8" );
+                        log.trace( "decoded from: [{}]", headerParts[1] );
+                        log.trace( "decoded   to: [{}]", decodedValue );
+                        eventHeaders.put( headerParts[0], decodedValue );
+                    }
+                    catch ( UnsupportedEncodingException e )
+                    {
+                        log.warn( "Could not URL decode [{}]", headerParts[1] );
+                        eventHeaders.put( headerParts[0], headerParts[1] );
+                    }
+                }
+                else
+                {
+                    eventHeaders.put( headerParts[0], headerParts[1] );
+                }
+                if ( headerParts[0].equals( EslEventHeaderNames.CONTENT_LENGTH ) )
+                {
+                    // the remaining lines will be considered body lines
+                    isEventBody = true;
+                }
+            }
+            else
+            {
+                // ignore blank line (always is one following the content-length
+                if ( rawLine.length() > 0 )
+                {
+                    eventBody.add( rawLine );
+                }
+            }
+        }
+
+    }
+    
+    @Override
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder( "EslEvent: name=[" );
+        sb.append( getEventName() );
+        sb.append( "] headers=" );
+        sb.append( messageHeaders.size() );
+        sb.append( ", eventHeaders=" );
+        sb.append( eventHeaders.size() );
+        sb.append( ", eventBody=" );
+        sb.append( eventBody.size() );
+        sb.append( " lines." );
+        
+        return sb.toString();
+    }
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/event/EslEventHeaderNames.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/event/EslEventHeaderNames.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/event/EslEventHeaderNames.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/event/EslEventHeaderNames.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/event/EslEventHeaderNames.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,87 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client.transport.event;
+
+/**
+ * Container class for some commonly used ESL event header names (note there are many more!).
+ * 
+ * @author  david varnes
+ * @version $Id$
+ */
+public class EslEventHeaderNames
+{
+    /**
+     * {@code "Event-Name"}
+     */
+    public static final String EVENT_NAME = "Event-Name";
+    /**
+     * {@code "Event-Date-Local"}
+     */
+    public static final String EVENT_DATE_LOCAL = "Event-Date-Local";
+    /**
+     * {@code "Event-Date-GMT"}
+     */
+    public static final String EVENT_DATE_GMT = "Event-Date-GMT";
+    /**
+     * {@code "Event-Date-Timestamp"}
+     */
+    public static final String EVENT_DATE_TIMESTAMP = "Event-Date-Timestamp";
+    /**
+     * {@code "Event-Calling-File"}
+     */
+    public static final String EVENT_CALLING_FILE = "Event-Calling-File";
+    /**
+     * {@code "Event-Calling-Function"}
+     */
+    public static final String EVENT_CALLING_FUNCTION = "Event-Calling-Function";
+    /**
+     * {@code "Event-Calling-Line-Number"}
+     */
+    public static final String EVENT_CALLING_LINE_NUMBER = "Event-Calling-Line-Number";
+    /**
+     * {@code "FreeSWITCH-Hostname"}
+     */
+    public static final String FREESWITCH_HOSTNAME = "FreeSWITCH-Hostname";
+    /**
+     * {@code "FreeSWITCH-IPv4"}
+     */
+    public static final String FREESWITCH_IPV4 = "FreeSWITCH-IPv4";
+    /**
+     * {@code "FreeSWITCH-IPv6"}
+     */
+    public static final String FREESWITCH_IPV6 = "FreeSWITCH-IPv6";
+    /**
+     * {@code "Core-UUID"}
+     */
+    public static final String CORE_UUID = "Core-UUID";
+    /**
+     * {@code "Content-Length"}
+     */
+    public static final String CONTENT_LENGTH = "Content-Length";
+    /**
+     * {@code "Job-Command"}
+     */
+    public static final String JOB_COMMAND = "Job-Command";
+    /**
+     * {@code "Job-UUID"}
+     */
+    public static final String JOB_UUID = "Job-UUID";
+
+    private EslEventHeaderNames()
+    {
+        /* private class */
+    }
+}

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/message (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/message)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/message/EslHeaders.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/message/EslHeaders.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/message/EslHeaders.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/message/EslHeaders.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/message/EslHeaders.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client.transport.message;
+
+/**
+ * Container class for enumeration of ESL message header names, and some commonly used 
+ * header string values.
+ * 
+ * @author  david varnes
+ * @version $Id$
+ */
+public class EslHeaders
+{
+    /**
+     * Standard ESL header names.
+     * </p>
+     * Note this enum will need to be kept in synch with any new headers introduced on the server side.
+     * 
+     * @author david varnes 
+     * @version $Id$
+     */
+    public enum Name
+    {
+        /*
+         *  Minor optimization - put most often used headers at the top for fastest resolution
+         *  in static fromLiteral().  
+         */
+        
+        /**
+         * {@code "Content-Type"}
+         */
+        CONTENT_TYPE( "Content-Type" ),
+        /**
+         * {@code "Content-Length"}
+         */
+        CONTENT_LENGTH( "Content-Length" ),
+        /**
+         * {@code "Reply-Text"}
+         */
+        REPLY_TEXT( "Reply-Text" ),
+        /**
+         * {@code "Job-UUID"}
+         */
+        JOB_UUID( "Job-UUID" ),
+        /**
+         * {@code "Socket-Mode"}
+         */
+        SOCKET_MODE( "Socket-Mode" ),
+        /**
+         * {@code "Control"}
+         */
+        Control( "Control" ),
+        ;
+        
+        private final String literal;
+        
+        private Name( String literal )
+        {
+            this.literal = literal;
+        }
+        
+        public String literal()
+        {
+            return literal;
+        }
+        
+        public static Name fromLiteral( String literal )
+        {
+            for ( Name name : values() )
+            {
+                if ( name.literal.equalsIgnoreCase( literal ) )
+                {
+                    return name;
+                }
+            }
+            
+            return null;
+        }
+    }
+    
+    /**
+     * Some common ESL header values. These are provided as a convenience for commonly used values.
+     * </p>
+     * This values are not coded as an enum to allow for the very large range of possible values,
+     * since they are just Strings.
+     *
+     * @author david varnes
+     * @version $Id$
+     */
+    public static final class Value 
+    {
+        /**
+         * {@code "+OK"}
+         */
+        public static final String OK = "+OK";
+        /**
+         * {@code "auth/request"}
+         */
+        public static final String AUTH_REQUEST = "auth/request";
+        /**
+         * {@code "api/response"}
+         */
+        public static final String API_RESPONSE = "api/response";
+        /**
+         * {@code "command/reply"}
+         */
+        public static final String COMMAND_REPLY = "command/reply";
+        /**
+         * {@code "text/event-plain"}
+         */
+        public static final String TEXT_EVENT_PLAIN = "text/event-plain";
+        /**
+         * {@code "text/event-xml"}
+         */
+        public static final String TEXT_EVENT_XML = "text/event-xml";
+        /**
+         * {@code "text/disconnect-notice"}
+         */
+        public static final String TEXT_DISCONNECT_NOTICE = "text/disconnect-notice";
+        /**
+         * {@code "-ERR invalid"}
+         */
+        public static final String ERR_INVALID = "-ERR invalid";
+    }
+    
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/message/EslMessage.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/message/EslMessage.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/message/EslMessage.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/message/EslMessage.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/message/EslMessage.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,188 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client.transport.message;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.freeswitch.esl.client.transport.message.EslHeaders.Name;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Basic FreeSWITCH Event Socket messages from the server are decoded into this data object.
+ * </p>
+ * An ESL message is modelled as text lines.  A message always has one or more header lines, and 
+ * optionally may have some body lines.
+ * <p/>
+ * Header lines are parsed and cached in a map keyed by the {@link EslHeaders.Name} enum.  A message
+ * is always expected to have a "Content-Type" header</br>
+ * Any Body lines are cached in a list.
+ * 
+ * @author  david varnes
+ * @version $Id$
+ * @see EslHeaders.Name
+ */
+public class EslMessage
+{
+    private final Logger log = LoggerFactory.getLogger( this.getClass() );
+    
+    private final Map<Name,String> headers = new HashMap<Name,String>();
+    private final List<String> body = new ArrayList<String>();
+    
+    private Integer contentLength = null;
+    private int receivedContentLength = 0;
+
+    /**
+     * All the received message headers in a map keyed by {@link EslHeaders.Name}. The string mapped value 
+     * is the parsed content of the header line (ie, it does not include the header name).
+     *  
+     * @return map of header values
+     */
+    public Map<Name,String> getHeaders()
+    {
+        return headers;
+    }
+
+    /**
+     * Convenience method
+     * 
+     * @param headerName as a {@link EslHeaders.Name}
+     * @return true if an only if there is a header entry with the supplied header name 
+     */
+    public boolean hasHeader( Name headerName )
+    {
+        return headers.containsKey( headerName );
+    }
+
+    /**
+     * Convenience method
+     * 
+     * @param headerName as a {@link EslHeaders.Name}
+     * @return same as getHeaders().get( headerName )
+     */
+    public String getHeaderValue( Name headerName )
+    {
+        return headers.get( headerName );
+    }
+    
+    /**
+     * Convenience method
+     * 
+     * @return true if and only if a header exists with name "Content-Length" 
+     */
+    public boolean hasContentLength()
+    {
+        return headers.containsKey( Name.CONTENT_LENGTH );
+    }
+    
+    /**
+     * Convenience method
+     * 
+     * @return integer value of header with name "Content-Length"
+     */
+    public Integer getContentLength()
+    {
+        if ( contentLength != null )
+        {
+            return contentLength;
+        }
+        if ( hasContentLength() )
+        {
+            contentLength = Integer.valueOf( headers.get( Name.CONTENT_LENGTH) );
+        }
+        return contentLength;
+    }
+    
+    /**
+     * Convenience method
+     * 
+     * @return header value of header with name "Content-Type"
+     */
+    public String getContentType()
+    {
+        return headers.get( Name.CONTENT_TYPE );
+    }
+
+    /**
+     * Any received message body lines
+     * 
+     * @return list with a string for each line received, may be an empty list
+     */
+    public List<String> getBodyLines()
+    {
+        return body;
+    }
+    
+    /**
+     * Used by the {@link EslMessageDecoder}.
+     * 
+     * @param name
+     * @param value
+     */
+    void addHeader( Name name, String value )
+    {
+        log.debug( "adding header [{}] [{}]", name, value );
+        headers.put( name, value );
+    }
+    
+    /**
+     * Used by the {@link EslMessageDecoder}
+     * 
+     * @param line
+     */
+    void addBodyLine( String line )
+    {
+        if ( line == null )
+        {
+            return;
+        }
+        receivedContentLength += ( line.length() + 1 );
+        // ignore empty lines (signals the end of a body section)
+        if ( line.length() > 0 )
+        {
+            body.add( line );
+        }
+    }
+
+    /**
+     * Used by the {@link EslMessageDecoder}
+     * 
+     * @return true if receivedContentLength < contentLength
+     */
+    boolean waitingForContent()
+    {
+        log.debug( "received [{}], expecting [{}]", receivedContentLength, getContentLength() );
+        return receivedContentLength < getContentLength();
+    }
+
+    @Override
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder( "EslMessage: contentType=[" );
+        sb.append( getContentType() );
+        sb.append( "] headers=" );
+        sb.append( headers.size() );
+        sb.append( ", body=" );
+        sb.append( body.size() );
+        sb.append( " lines." );
+        
+        return sb.toString();
+    }
+    
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/message/EslMessageDecoder.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/message/EslMessageDecoder.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/message/EslMessageDecoder.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/message/EslMessageDecoder.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/java/org/freeswitch/esl/client/transport/message/EslMessageDecoder.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client.transport.message;
+
+import org.freeswitch.esl.client.internal.HeaderParser;
+import org.freeswitch.esl.client.transport.message.EslHeaders.Name;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.channel.ChannelPipelineCoverage;
+import org.jboss.netty.channel.MessageEvent;
+import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
+import org.jboss.netty.channel.UpstreamMessageEvent;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Decoder used by the IO processing pipeline. Client consumers should never need to use
+ * this class.
+ * 
+ * @author  david varnes
+ * @version $Id$
+ */
+@ChannelPipelineCoverage( "one" )
+public class EslMessageDecoder extends SimpleChannelUpstreamHandler
+{
+    private final Logger log = LoggerFactory.getLogger( this.getClass() );
+    
+    private EslMessage currentMessage;
+    private boolean treatUnknownHeadersAsBody = false;
+    
+    public EslMessageDecoder()
+    {
+        
+    }
+    
+    public EslMessageDecoder( boolean treatUnknownHeadersAsBody )
+    {
+        this.treatUnknownHeadersAsBody = treatUnknownHeadersAsBody;
+    }
+    
+    private enum State
+    {
+        NEW_MESSAGE,
+        READ_HEADER_LINE,
+        READ_BODY_LINE,
+    }
+    
+    private State state = State.NEW_MESSAGE;
+    
+    @Override
+    public void messageReceived( ChannelHandlerContext ctx, MessageEvent e ) throws Exception
+    {
+        // Assume this is a decoded string
+        String messageLine = e.getMessage().toString();
+        
+        log.debug( "Received string: [{}]", e.getMessage() );
+        log.trace( "State [{}]", state );
+        
+        switch ( state )
+        {
+        case NEW_MESSAGE:
+            if ( messageLine.isEmpty() )
+            {
+                break;
+            }
+            currentMessage = new EslMessage();
+            state = State.READ_HEADER_LINE;
+            // fall-through  
+        case READ_HEADER_LINE:
+            if ( messageLine.isEmpty() )
+            {
+                if ( currentMessage.hasContentLength() )
+                {
+                    //  end of headers - body to come
+                    state = State.READ_BODY_LINE;
+                }
+                else
+                {
+                    // end of message
+                    state = State.NEW_MESSAGE;
+                    // send upstream
+                    UpstreamMessageEvent upstreamEvent = new UpstreamMessageEvent( e.getChannel(), 
+                        currentMessage, e.getRemoteAddress() );
+                    currentMessage = null;
+                    
+                    ctx.sendUpstream( upstreamEvent );
+                }
+            }
+            else
+            {
+                // split the line
+                String[] headerParts = HeaderParser.splitHeader( messageLine );
+                Name headerName = Name.fromLiteral( headerParts[0] );
+                if ( headerName == null )
+                {
+                    if ( treatUnknownHeadersAsBody )
+                    {
+                        // treat this as a body line - note that this will screw up genuine body 
+                        // content-length calculations
+                        currentMessage.addBodyLine( messageLine );
+                    }
+                    else
+                    {
+                        throw new IllegalStateException( "Unhandled ESL header [" + headerParts[0] + ']' );
+                    }
+                }
+                currentMessage.addHeader( headerName, headerParts[1] );
+            }
+            break;
+        case READ_BODY_LINE:
+            // monitor received content compared to expected content-length
+            currentMessage.addBodyLine( messageLine );
+            if ( ! currentMessage.waitingForContent() )
+            {
+                // end of message
+                state = State.NEW_MESSAGE;
+                // send upstream
+                UpstreamMessageEvent upstreamEvent = new UpstreamMessageEvent( e.getChannel(), 
+                    currentMessage, e.getRemoteAddress() );
+                currentMessage = null;
+                
+                ctx.sendUpstream( upstreamEvent );
+            }
+            break;
+        default:
+            break;
+        }
+        
+    }
+}

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/resources (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/main/resources)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org/freeswitch (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org/freeswitch)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org/freeswitch/esl (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org/freeswitch/esl)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org/freeswitch/esl/client (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org/freeswitch/esl/client)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org/freeswitch/esl/client/inbound (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org/freeswitch/esl/client/inbound)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org/freeswitch/esl/client/inbound/ClientTest.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org/freeswitch/esl/client/inbound/ClientTest.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org/freeswitch/esl/client/inbound/ClientTest.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org/freeswitch/esl/client/inbound/ClientTest.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org/freeswitch/esl/client/inbound/ClientTest.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client.inbound;
+
+import org.freeswitch.esl.client.IEslEventListener;
+import org.freeswitch.esl.client.inbound.Client;
+import org.freeswitch.esl.client.inbound.InboundConnectionFailure;
+import org.freeswitch.esl.client.transport.event.EslEvent;
+import org.freeswitch.esl.client.transport.message.EslMessage;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class ClientTest
+{
+    private final Logger log = LoggerFactory.getLogger( this.getClass() );
+
+    private String host = "localhost";
+    private int port = 8021;
+    private String password = "ClueCon"; 
+        
+    @Test
+    public void do_connect() throws InterruptedException
+    {
+        Client client = new Client();
+     
+        client.addEventListener( new IEslEventListener()
+        {
+            public void eventReceived( EslEvent event )
+            {
+                log.info( "Event received [{}]", event );
+            }
+            public void backgroundJobResultReceived( EslEvent event )
+            {
+                log.info( "Background job result received [{}]", event );
+            }
+            
+        } );
+        
+        log.info( "Client connecting .." );
+        try
+        {
+            client.connect( host, port, password, 2 );
+        }
+        catch ( InboundConnectionFailure e )
+        {
+            log.error( "Connect failed", e );
+            return;
+        }
+        log.info( "Client connected .." );
+        
+//      client.setEventSubscriptions( "plain", "heartbeat CHANNEL_CREATE CHANNEL_DESTROY BACKGROUND_JOB" );
+        client.setEventSubscriptions( "plain", "all" );
+        client.addEventFilter( "Event-Name", "heartbeat" );
+        client.cancelEventSubscriptions();
+        client.setEventSubscriptions( "plain", "all" );
+        client.addEventFilter( "Event-Name", "heartbeat" );
+        client.addEventFilter( "Event-Name", "channel_create" );
+        client.addEventFilter( "Event-Name", "background_job" );
+//        client.sendSyncCommand( "echo", "Foo foo bar" );
+//        client.sendSyncCommand( "originate", "sofia/internal/101@192.168.100.201! sofia/internal/102@192.168.100.201!" );
+        
+//        client.sendSyncApiCommand( "sofia status", "" );
+        String jobId = client.sendAsyncApiCommand( "status", "" );
+        log.info( "Job id [{}] for [status]", jobId );
+        client.sendSyncApiCommand( "version", "" );
+//        client.sendAsyncApiCommand( "status", "" );
+//        client.sendSyncApiCommand( "sofia status", "" );
+//        client.sendAsyncApiCommand( "status", "" );
+        EslMessage response = client.sendSyncApiCommand( "sofia status", "" );
+        log.info( "sofia status = [{}]", response.getBodyLines().get( 3 ) );
+        
+        Thread.sleep( 25000 );
+        client.close();
+    }
+
+    @Test
+    public void do_multi_connects() throws InterruptedException
+    {
+        Client client = new Client();
+        
+        log.info( "Client connecting .." );
+        try
+        {
+            client.connect( host, port, password, 2 );
+        }
+        catch ( InboundConnectionFailure e )
+        {
+            log.error( "Connect failed", e );
+            return;
+        }
+        log.info( "Client connected .." );
+        
+        log.info( "Client connecting .." );
+        try
+        {
+            client.connect( "127.0.0.1", 8021, password, 2 );
+        }
+        catch ( InboundConnectionFailure e )
+        {
+            log.error( "Connect failed", e );
+            return;
+        }
+        log.info( "Client connected .." );
+    }
+}

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org/freeswitch/esl/client/outbound (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org/freeswitch/esl/client/outbound)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org/freeswitch/esl/client/outbound/SocketClientTest.java

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org/freeswitch/esl/client/outbound/SocketClientTest.java (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org/freeswitch/esl/client/outbound/SocketClientTest.java) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org/freeswitch/esl/client/outbound/SocketClientTest.java	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/java/org/freeswitch/esl/client/outbound/SocketClientTest.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.freeswitch.esl.client.outbound;
+
+import org.freeswitch.esl.client.outbound.example.SimpleHangupPipelineFactory;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class SocketClientTest
+{
+    private final Logger log = LoggerFactory.getLogger( this.getClass() );
+
+    @Test
+    public void run_client() throws InterruptedException
+    {
+        log.info( "Test starting ..." );
+
+        
+        SocketClient client = new SocketClient( 8084, new SimpleHangupPipelineFactory() );
+        
+        client.start();
+        
+        Thread.sleep( 45000 );
+
+        client.stop();
+
+        
+        log.info( "Test ended" );
+    }
+    
+}

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/resources (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/resources)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/resources/logback-test.xml

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/resources/logback-test.xml (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/resources/logback-test.xml) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/resources/logback-test.xml	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client/src/test/resources/logback-test.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+<configuration>
+
+  <appender name="STDOUT"
+   class="ch.qos.logback.core.ConsoleAppender">
+   <layout class="ch.qos.logback.classic.PatternLayout">
+     <Pattern>
+        %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
+      </Pattern>
+    </layout>
+  </appender>
+
+  <logger name="org.freeswitch.esl.client.outbound.example">
+    <level value="debug" />
+  </logger>
+  <logger name="org.freeswitch.esl.client.inbound">
+    <level value="debug" />
+  </logger>
+  <logger name="org.freeswitch.esl.client.transport.message">
+    <level value="info" />
+  </logger>
+  <logger name="org.freeswitch.esl.client">
+    <level value="info" />
+  </logger>
+
+  <root>
+    <level value="warn" />
+    <appender-ref ref="STDOUT" />
+  </root>
+
+</configuration>
\ No newline at end of file

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example)

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example


Name: svn:ignore
   + target

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.classpath

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.classpath (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.classpath) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.classpath	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.classpath	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+	<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.project

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.project (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.project) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.project	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.project	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.freeswitch.esl.client.example</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.maven.ide.eclipse.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.maven.ide.eclipse.maven2Nature</nature>
+	</natures>
+</projectDescription>

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.settings (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.settings)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.settings/org.eclipse.jdt.core.prefs

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.settings/org.eclipse.jdt.core.prefs (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.settings/org.eclipse.jdt.core.prefs) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.settings/org.eclipse.jdt.core.prefs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,6 @@
+#Sun Jan 03 23:33:58 EST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.5

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.settings/org.maven.ide.eclipse.prefs

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.settings/org.maven.ide.eclipse.prefs (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.settings/org.maven.ide.eclipse.prefs) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.settings/org.maven.ide.eclipse.prefs	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/.settings/org.maven.ide.eclipse.prefs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,9 @@
+#Sat Jan 02 16:18:40 EST 2010
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/pom.xml

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/pom.xml (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/pom.xml) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/pom.xml	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/org.freeswitch.esl.client.example/pom.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.freeswitch.esl.client</groupId>
+    <artifactId>esl-client-parent</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+  </parent>
+  <artifactId>org.freeswitch.esl.client.example</artifactId>
+  <name>FreeSWITCH Event Socket Library - Java Client example usage</name>
+  <dependencies>
+    <dependency>
+      <groupId>org.freeswitch.esl.client</groupId>
+      <artifactId>org.freeswitch.esl.client</artifactId>
+      <version>0.0.1-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+</project>
\ No newline at end of file

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/pom.xml (from rev 16612, freeswitch/trunk/contrib/dvarnes/java/esl-client/pom.xml) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/pom.xml	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/dvarnes/java/esl-client/pom.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Copyright 2010 david varnes.
+ *
+ * Licensed under the Apache License, version 2.0 (the "License"); 
+ * you may not use this file except in compliance with the License. 
+ * You may obtain a copy of the License at:
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.freeswitch.esl.client</groupId>
+  <artifactId>esl-client-parent</artifactId>
+  <version>0.9.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+  <name>FreeSWITCH Event Socket Library - Java Client project</name>
+  <url>http://www.freeswitch.org</url>
+  <description>
+    The FreeSWITCH Event Socket Library provides a TCP based control and/or
+    monitoring interface to a running switch.  This project provides a Java
+    client to the ESL.
+  </description>
+  <organization>
+    <name>FreeSWITCH.org</name>
+    <url>http://www.freeswitch.org</url>
+  </organization>
+  <licenses>
+    <license>
+      <name>Apache License, Version 2.0</name>
+      <url>http://www.apache.org/licenses/LICENSE-2.0</url>
+    </license>
+  </licenses>
+  <inceptionYear>2009</inceptionYear>
+  <scm>
+    <connection>scm:svn:http://svn.freeswitch.org/svn/freeswitch/trunk/contrib/dvarnes/java/esl-client</connection>
+    <developerConnection>scm:svn:http://svn.freeswitch.org/svn/freeswitch/trunk/contrib/dvarnes/java/esl-client</developerConnection>
+  </scm>
+  <developers>
+    <developer>
+      <id>dvarnes</id>
+      <name>david varnes</name>
+      <email>david at varnes dot net</email>
+      <timezone>GMT+10</timezone>
+    </developer>
+  </developers>
+  <modules>
+  	<module>org.freeswitch.esl.client</module>
+  	<module>org.freeswitch.esl.client.example</module>
+  </modules>
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <configuration>
+            <source>1.5</source>
+            <target>1.5</target>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+    <plugins>
+      <!--  every child project inherits these plugins -->
+      <plugin>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+        </configuration>
+      </plugin>
+      <plugin>
+        <artifactId>maven-source-plugin</artifactId>
+        <version>2.1</version>
+        <executions>
+          <execution>
+            <id>attach-source</id>
+            <phase>package</phase>
+            <goals>
+              <goal>jar</goal>
+            </goals>
+            <configuration>
+              <attach>true</attach>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>  
+</project>

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

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

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

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/intralanman/PHP/fs_curl/fs_cdr.php (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/intralanman/PHP/fs_curl/fs_cdr.php	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/intralanman/PHP/fs_curl/fs_cdr.php	2010-02-12 00:54:22 UTC (rev 16614)
@@ -60,7 +60,7 @@
      */
     public function fs_cdr() {
         $this->fs_curl();
-        $this->cdr = $this->request['cdr'];
+        $this->cdr = stripslashes($this->request['cdr']);
         $this->xml_cdr = new SimpleXMLElement($this->cdr);
     }
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/intralanman/PHP/fs_curl/fs_directory.php (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/intralanman/PHP/fs_curl/fs_directory.php	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/intralanman/PHP/fs_curl/fs_directory.php	2010-02-12 00:54:22 UTC (rev 16614)
@@ -53,7 +53,7 @@
                                     FROM %1$sdirectory%1$s
                                     WHERE %1$susername%1$s = \'%3$s\'
                                     AND %1$sdomain%1$s = \'%4$s\')'
-            , DB_FIELD_QUOTE, $new_pin, $username, $this->request['domain']
+                , DB_FIELD_QUOTE, $new_pin, $username, $this->request['domain']
         );
         $this->debug($query);
         $this->db->exec($query);
@@ -94,7 +94,7 @@
             $where_clause = '';
         }
         $query = sprintf("SELECT * FROM directory d %s %s ORDER BY username"
-            , $join_clause, $where_clause
+                , $join_clause, $where_clause
         );
         $this->debug($query);
         $res = $this -> db -> queryAll($query);
@@ -144,8 +144,8 @@
      */
     private function write_params($user_id) {
         if (array_key_exists($user_id, $this->users_params)
-            && is_array($this->users_params[$user_id])
-            && count($this->users_params[$user_id]) > 0) {
+                && is_array($this->users_params[$user_id])
+                && count($this->users_params[$user_id]) > 0) {
             $this -> xmlw -> startElement('params');
             foreach($this->users_params[$user_id] as $pname => $pvalue) {
                 $this -> xmlw -> startElement('param');
@@ -188,7 +188,7 @@
      */
     private function write_variables($user_id) {
         if (array_key_exists($user_id, $this->users_vars)
-            && is_array($this->users_vars[$user_id])) {
+                && is_array($this->users_vars[$user_id])) {
             $this -> xmlw -> startElement('variables');
             foreach($this->users_vars[$user_id] as $vname => $vvalue) {
                 $this -> xmlw -> startElement('variable');
@@ -231,18 +231,18 @@
      */
     private function write_gateways($user_id) {
         if (is_array($this->users_gateways)
-            && array_key_exists($user_id, $this->users_gateways)
-            && is_array($this -> users_gateways[$user_id])) {
+                && array_key_exists($user_id, $this->users_gateways)
+                && is_array($this -> users_gateways[$user_id])) {
             $this -> xmlw -> startElement('gateways');
             $gateway_count = count($this -> users_gateways[$user_id]);
             for ($i=0; $i<$gateway_count; $i++) {
                 $this -> xmlw -> startElement('gateway');
                 $this -> xmlw -> writeAttribute(
-                    'name', $this -> users_gateways[$user_id][$i]['gateway_name']
+                        'name', $this -> users_gateways[$user_id][$i]['gateway_name']
                 );
 
                 $this -> write_user_gateway_params(
-                    $this -> users_gateways[$user_id][$i]['id']
+                        $this -> users_gateways[$user_id][$i]['id']
                 );
                 $this -> xmlw -> endElement();
             }
@@ -277,7 +277,7 @@
      */
     private function write_user_gateway_params($d_gw_id) {
         if (is_array($this->users_gateway_params[$d_gw_id])
-            && count($this->users_gateway_params[$d_gw_id]) > 0) {
+                && count($this->users_gateway_params[$d_gw_id]) > 0) {
             foreach($this->users_gateway_params[$d_gw_id] as $pname => $pvalue) {
                 $this -> xmlw -> startElement('param');
                 $this -> xmlw -> writeAttribute('name', $pname);
@@ -293,15 +293,15 @@
      */
     function write_global_params() {
         $query = sprintf('%s %s %s;',
-            'SELECT * FROM directory_global_params dgp',
-            'JOIN directory_domains dd ON dd.id=dgp.domain_id',
-            "WHERE dd.domain_name='" . $this -> request['domain'] . "'"
+                'SELECT * FROM directory_global_params dgp',
+                'JOIN directory_domains dd ON dd.id=dgp.domain_id',
+                "WHERE dd.domain_name='" . $this -> request['domain'] . "'"
         );
         $res = $this -> db -> queryAll($query);
         if (FS_PDO::isError($res)) {
             $this -> comment($query);
             $error_msg = sprintf("Error while selecting global params - %s"
-                , $this -> db -> getMessage()
+                    , $this -> db -> getMessage()
             );
             trigger_error($error_msg);
         }
@@ -325,15 +325,15 @@
      */
     function write_global_vars() {
         $query = sprintf('%s %s %s;',
-            'SELECT * FROM directory_global_vars dgv',
-            'JOIN directory_domains dd ON dd.id=dgv.domain_id',
-            "WHERE dd.domain_name='" . $this -> request['domain'] . "'"
+                'SELECT * FROM directory_global_vars dgv',
+                'JOIN directory_domains dd ON dd.id=dgv.domain_id',
+                "WHERE dd.domain_name='" . $this -> request['domain'] . "'"
         );
         $res = $this -> db -> queryAll($query);
         if (FS_PDO::isError($res)) {
             $this -> comment($query);
             $error_msg = sprintf("Error while selecting global vars - %s"
-                , $this -> db -> getMessage()
+                    , $this -> db -> getMessage()
             );
             trigger_error($error_msg);
         }
@@ -390,13 +390,9 @@
             $mailbox = empty($directory[$i]['mailbox']) ? $username : $directory[$i]['mailbox'];
             $this -> xmlw -> startElement('user');
             $this -> xmlw -> writeAttribute('id', $username);
-            if (empty($directory[$i]['group_name'])) {
-                $this -> write_params($directory[$i]['id']);
-                $this -> write_variables($directory[$i]['id']);
-                $this -> write_gateways($directory[$i]['id']);
-            } else {
-                $this->xmlw->writeAttribute('type', 'pointer');
-            }
+            $this -> write_params($directory[$i]['id']);
+            $this -> write_variables($directory[$i]['id']);
+            $this -> write_gateways($directory[$i]['id']);
             $this -> xmlw -> endElement();
         }
         $this->xmlw->endElement();

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/intralanman/PHP/fs_curl/sql/mysql-4.0-with-samples.sql (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/intralanman/PHP/fs_curl/sql/mysql-4.0-with-samples.sql	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/intralanman/PHP/fs_curl/sql/mysql-4.0-with-samples.sql	2010-02-12 00:54:22 UTC (rev 16614)
@@ -241,7 +241,7 @@
 (52, 30, 'sleep', '1000', 'action', 520),
 (53, 30, 'voicemail', 'check default ${domain_name} ${dialed_extension}', 'action', 530),
 (54, 30, 'bind_meta_app', '1 b s execute_extension::dx XML features', 'anti-action', 540),
-(55, 30, 'bind_meta_app', '2 b s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav', 'anti-action', 550),
+(55, 30, 'bind_meta_app', '2 b s record_session::$${recordings_dir}//${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav', 'anti-action', 550),
 (56, 30, 'bind_meta_app', '3 b s execute_extension::cf XML features', 'anti-action', 560),
 (57, 30, 'set', 'ringback=${us-ring}', 'anti-action', 570),
 (58, 30, 'set', 'transfer_ringback=$${hold_music}', 'anti-action', 580),

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/intralanman/PHP/fs_curl/sql/mysql-5.0-with-samples.sql (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/intralanman/PHP/fs_curl/sql/mysql-5.0-with-samples.sql	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/intralanman/PHP/fs_curl/sql/mysql-5.0-with-samples.sql	2010-02-12 00:54:22 UTC (rev 16614)
@@ -269,7 +269,7 @@
 (52, 30, 'sleep', '1000', 'action', 520),
 (53, 30, 'voicemail', 'check default ${domain_name} ${dialed_extension}', 'action', 530),
 (54, 30, 'bind_meta_app', '1 b s execute_extension::dx XML features', 'anti-action', 540),
-(55, 30, 'bind_meta_app', '2 b s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav', 'anti-action', 550),
+(55, 30, 'bind_meta_app', '2 b s record_session::$${recordings_dir}/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav', 'anti-action', 550),
 (56, 30, 'bind_meta_app', '3 b s execute_extension::cf XML features', 'anti-action', 560),
 (57, 30, 'set', 'ringback=${us-ring}', 'anti-action', 570),
 (58, 30, 'set', 'transfer_ringback=$${hold_music}', 'anti-action', 580),

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/intralanman/PHP/fs_curl/sql/oracle-with-examples.sql (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/intralanman/PHP/fs_curl/sql/oracle-with-examples.sql	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/intralanman/PHP/fs_curl/sql/oracle-with-examples.sql	2010-02-12 00:54:22 UTC (rev 16614)
@@ -241,7 +241,7 @@
 (52, 30, 'sleep', '1000', 'action', 520),
 (53, 30, 'voicemail', 'check default ${domain_name} ${dialed_extension}', 'action', 530),
 (54, 30, 'bind_meta_app', '1 b s execute_extension::dx XML features', 'anti-action', 540),
-(55, 30, 'bind_meta_app', '2 b s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav', 'anti-action', 550),
+(55, 30, 'bind_meta_app', '2 b s record_session::$${recordings_dir}/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav', 'anti-action', 550),
 (56, 30, 'bind_meta_app', '3 b s execute_extension::cf XML features', 'anti-action', 560),
 (57, 30, 'set', 'ringback=${us-ring}', 'anti-action', 570),
 (58, 30, 'set', 'transfer_ringback=$${hold_music}', 'anti-action', 580),

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/intralanman/PHP/fs_curl/sql/postgres-8.4.sql (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/intralanman/PHP/fs_curl/sql/postgres-8.4.sql	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/intralanman/PHP/fs_curl/sql/postgres-8.4.sql	2010-02-12 00:54:22 UTC (rev 16614)
@@ -213,10 +213,10 @@
   end_stamp character varying NOT NULL,
   duration character varying NOT NULL,
   billsec character varying NOT NULL,
-  hangup_cause character(1) NOT NULL,
+  hangup_cause character(128) NOT NULL,
   uuid character varying NOT NULL,
   bleg_uuid character varying NOT NULL,
-  accountcode character(1) NOT NULL,
+  accountcode character(128) NOT NULL,
   read_codec character varying NOT NULL,
   write_codec character varying NOT NULL,
   CONSTRAINT cdr_pkey PRIMARY KEY (id)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/michaelgg (from rev 16612, freeswitch/trunk/contrib/michaelgg)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/endpoints/mod_khomp/mod_khomp.cpp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/endpoints/mod_khomp/mod_khomp.cpp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/endpoints/mod_khomp/mod_khomp.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -108,7 +108,8 @@
         switch_caller_profile_t *outbound_profile,
         switch_core_session_t **new_session, 
         switch_memory_pool_t **pool, 
-        switch_originate_flag_t flags);
+        switch_originate_flag_t flags,
+		switch_call_cause_t * cancel_cause);
 switch_status_t channel_read_frame(switch_core_session_t *session, 
         switch_frame_t **frame, 
         switch_io_flag_t flags, 
@@ -506,7 +507,7 @@
 */
 switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
                                                     switch_caller_profile_t *outbound_profile,
-                                                    switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
+                                                    switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t * cancel_cause)
 {
 
     char *argv[3] = { 0 };

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket (from rev 16612, freeswitch/trunk/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/Download CSTAInside.vcproj

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/Download CSTAInside.vcproj (from rev 16612, freeswitch/trunk/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/Download CSTAInside.vcproj) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/Download CSTAInside.vcproj	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/Download CSTAInside.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9,00"
+	Name="Download CSTAInside"
+	ProjectGUID="{4F92B672-DADB-4047-8D6A-4BB3796733FD}"
+	RootNamespace="Download CSTAInside"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				Description="Downloading CSTAInside"
+				CommandLine="if not exist &quot;$(ProjectDir)CSTAInsideCore&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://freefr.dl.sourceforge.net/project/cstainside/cstainside/v0.2.0/cstainside_v0.2.0.92.zip &quot;$(ProjectDir).&quot;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+				CommandLine=""
+				Outputs=""
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="if exist cstainside_v0.2.0.92 ren cstainside_v0.2.0.92 CSTAInsideCore"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				Description="Downloading CSTAInside"
+				CommandLine="if not exist &quot;$(ProjectDir)CSTAInsideCore&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://freefr.dl.sourceforge.net/project/cstainside/cstainside/v0.2.0/cstainside_v0.2.0.92.zip &quot;$(ProjectDir).&quot;"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine="if exist cstainside_v0.2.0.92 ren cstainside_v0.2.0.92 CSTAInsideCore"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\cleancount"
+			>
+			<FileConfiguration
+				Name="Debug|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Downloading CSTAInsideCore."
+					CommandLine="if not exist &quot;$(ProjectDir)CSTAInsideCore&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://freefr.dl.sourceforge.net/project/cstainside/cstainside/v0.2.0/cstainside_v0.2.0.92.zip &quot;$(ProjectDir).&quot;&#x0D;&#x0A;"
+					Outputs="$(ProjectDir)."
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Downloading CSTAInsideCore."
+					CommandLine="if not exist &quot;$(ProjectDir)CSTAInsideCore&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://freefr.dl.sourceforge.net/project/cstainside/cstainside/v0.2.0/cstainside_v0.2.0.92.zip &quot;$(ProjectDir).&quot;&#x0D;&#x0A;"
+					Outputs="$(ProjectDir)."
+				/>
+			</FileConfiguration>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH (from rev 16612, freeswitch/trunk/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCH.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCH.cpp (from rev 16612, freeswitch/trunk/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCH.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCH.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCH.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,1737 @@
+/* 
+ * CSTA interface for FreeSWICH 
+ * Copyright (C) 2009, Szentesi Krisztian <sz.krisz@freemail.hu>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is CSTA interface for FreeSWICH   
+ * 
+ * The Initial Developer of the Original Code is
+ * Szentesi Krisztian <sz.krisz@freemail.hu>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Szentesi Krisztian <sz.krisz@freemail.hu>
+ *
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ */
+#include <switch.h>
+#include <direct.h>
+#include "FreeSWITCH.h"
+
+#include "MonitorStartRequest.h"
+#include "UniversalErrorResponse.h"
+#include "MonitorStartResponse.h"
+#include "MakeCallRequest.h"
+#include "MakeCallResponse.h"
+#include "AnswerCallRequest.h"
+#include "AnswerCallResponse.h"
+#include "SingleStepTransferCallRequest.h"
+#include "SingleStepTransferCallResponse.h"
+#include "DeflectCallRequest.h"
+#include "DeflectCallResponse.h"
+#include "PlayMessageRequest.h"
+#include "PlayMessageResponse.h"
+#include "RecordMessageRequest.h"
+#include "RecordMessageResponse.h"
+#include "StopRequest.h"
+#include "StopResponse.h"
+#include "ServiceInitiatedEvent.h"
+#include "OriginatedEvent.h"
+#include "DeliveredEvent.h"
+#include "EstablishedEvent.h"
+#include "ConnectionClearedEvent.h"
+#include "QueuedEvent.h"
+#include "DtmfDetectedEvent.h"
+#include "PlayEvent.h"
+#include "RecordEvent.h"
+#include "StopEvent.h"
+#include "ClearConnectionRequest.h"
+#include "ClearConnectionResponse.h"
+#include "SnapshotDeviceRequest.h"
+#include "SnapshotDeviceResponse.h"
+#include "SnapshotCallRequest.h"
+#include "SnapshotCallResponse.h"
+
+#include <string>
+using namespace std;
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// class FreeSwitchDevice
+
+/*static*/ std::string FreeSwitchDevice::Channel2Device(const char* channel)
+{
+	string strDevice;
+	if(strncmp(channel, "sofia/internal/", 15)==0)
+	{
+		if(strncmp(channel+15, "sip:", 4)==0)
+			strDevice=channel+19;
+		else
+			strDevice=channel+15;
+	}
+	std::string::size_type i=strDevice.find("@");
+	if(i!=strDevice.npos)
+	{
+		strDevice.erase(i);
+	}	
+	
+	return strDevice;
+}
+
+/*static*/ char * FreeSwitchDevice::Type2Prefix(FreeSwitchDeviceType type)
+{
+	switch(type)
+	{
+	case type_network_interface: return "01";
+	case type_queue: return "02";
+	default: return "";
+	};
+}
+
+/*static*/ FreeSwitchDeviceType FreeSwitchDevice::Device2Type(DeviceID device)
+{
+	if(device.GetTypeOfNumber()==typeOfNumberDialable)
+		return type_internal_subscriber;
+
+	if(device.GetCallNr().size()<2)
+		return type_unknown;
+
+	for(int i=type_network_interface;Type2Prefix((FreeSwitchDeviceType)i)[0]!=0;i++)
+	{
+		if(strncmp(Type2Prefix((FreeSwitchDeviceType)i),device.GetCallNr().c_str(),2)==0)
+		{
+			return (FreeSwitchDeviceType)i;
+		}
+	}
+
+	return type_unknown;
+}
+
+
+FreeSwitchDevice::FreeSwitchDevice(const char* pcDevice, FreeSwitchDeviceType deviceType/*=type_internal_subscriber*/) : m_strDevice(pcDevice), m_deviceType(deviceType), m_bIsMakeCallOriginator(false)
+{
+	
+}
+
+FreeSwitchConnection* FreeSwitchDevice::FindConnection(const char* uuid)
+{
+	for(MapCall2Connection::iterator it=connections.begin();it!=connections.end();it++)	
+	{
+		if(it->first->strUUID==uuid)			
+			return it->second;
+	}
+	return NULL;
+}
+
+FreeSwitchConnection* FreeSwitchDevice::FindConnection(FreeSwitchCall* pCall)
+{
+	MapCall2Connection::iterator it=connections.find(pCall);
+	if(it==connections.end())
+		return NULL;
+	else
+		return it->second;
+}
+
+FreeSwitchConnection* FreeSwitchDevice::AddConnection(const char* uuid, const char * channel, FreeSwitchCall* pCall, eDirection direction)
+{
+	FreeSwitchConnection* pConnection=new FreeSwitchConnection();		
+	pConnection->pCall=pCall;
+	pConnection->strUUID=uuid;
+	pConnection->state=STATE_INITIATED;	
+	pConnection->direction=direction;
+	pConnection->strChannel=channel;
+	pCall->devices[GetDeviceID()]=this;
+	connections[pCall]=pConnection;
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSwitchDevice::AddConnection: connection %s - %s added.\n",this->m_strDevice.c_str(),pCall->strUUID.c_str());
+	
+	return pConnection;
+}
+
+void FreeSwitchDevice::DeleteConnection(FreeSwitchCall* pCall)
+{	
+	MapCall2Connection::iterator it=connections.find(pCall);
+	if(it==connections.end())
+		return;
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSwitchDevice::DeleteConnection: connection %s - %s deleted.\n",this->m_strDevice.c_str(),pCall->strUUID.c_str());
+
+	delete it->second;
+	connections.erase(it);
+
+	pCall->devices.erase(this->GetDeviceID());
+}
+
+
+bool FreeSwitchDevice::IsMonitoredWithID(string crossRefID)
+{
+	return m_MonitoringSessions.find(crossRefID)==m_MonitoringSessions.end()?false:true;
+}
+
+bool FreeSwitchDevice::AddMonitor(CISession* session, string crossRefID)
+{
+	if(IsMonitoredWithID(crossRefID))
+		return false;	//XRefID already used
+	
+	m_MonitoringSessions[crossRefID]=session;
+	return true;
+}
+
+bool FreeSwitchDevice::RemoveMonitor(CISession* session)
+{
+	bool found=false;
+	for(MapStr2Session::iterator it=m_MonitoringSessions.begin();it!=m_MonitoringSessions.end();it++)
+		if(it->second==session)
+		{
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSwitchDevice::RemoveMonitor: removing session 0x%08X from device %s\n",session, m_strDevice.c_str());
+			it=m_MonitoringSessions.erase(it);
+			found=true;
+			if(it==m_MonitoringSessions.end())
+				break;
+		}
+	return found;
+}
+
+bool FreeSwitchDevice::RemoveMonitor(CISession* session, string crossRefID)
+{
+	MapStr2Session::iterator it=m_MonitoringSessions.find(crossRefID);
+	
+	if(it==m_MonitoringSessions.end())
+		return false;	//XRefID not found
+
+	if(it->second!=session)
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSwitchDevice::RemoveMonitor: XRefID %s mapped to device %sbut from session 0x%08X instead of 0x%08X, removal denied.\n",crossRefID.c_str(), m_strDevice.c_str(), it->second, session);
+	}
+	m_MonitoringSessions.erase(it);
+	return true;
+}
+
+void FreeSwitchDevice::SendEvent(CSTAEvent* pEvent)
+{
+	for(MapStr2Session::iterator it=m_MonitoringSessions.begin();it!=m_MonitoringSessions.end();it++)
+	{
+		pEvent->SetCrossRefID(it->first);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSwitchDevice::SendEvent: device %s, session %X, sending event: \n%s\n",GetDeviceID().c_str(),it->second,pEvent->GetReadable().c_str());
+		it->second->SendMsg(pEvent);	
+	}
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// class FreeSwitchCall
+
+FreeSwitchDevice* FreeSwitchCall::GetDevice(std::string strDeviceID)
+{	
+	MapStr2Device::iterator it=devices.find(strDeviceID);
+	if(it!=devices.end())
+		return it->second;
+	else 
+		return NULL;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// class FreeSwitch
+
+FreeSWITCH::FreeSWITCH(switch_memory_pool_t *pool) : m_pool(pool), m_nLastXRefID(0)
+{
+	switch_mutex_init(&m_mutex, SWITCH_MUTEX_NESTED, m_pool);
+}
+
+
+FreeSWITCH::~FreeSWITCH()
+{
+	for(MapStr2Device::iterator it=m_DeviceMap.begin();it!=m_DeviceMap.end();it++)
+	{
+		delete it->second;
+	}
+	m_DeviceMap.clear();
+	switch_mutex_destroy(m_mutex);
+}
+
+string FreeSWITCH::GetNextXRefID()
+{
+	++m_nLastXRefID;
+	if(m_nLastXRefID>100000)
+		m_nLastXRefID=1;
+	char temp[8];	
+	itoa(m_nLastXRefID,temp,10);
+	return string(temp);
+}
+
+
+FreeSwitchDevice * FreeSWITCH::PrepareDevice(const char * pcDevice, FreeSwitchDeviceType type/*=type_internal_subscriber*/)
+{
+	string strFullDevName=FreeSwitchDevice::Type2Prefix(type);
+	strFullDevName+=pcDevice;
+	
+	MapStr2Device::iterator it=m_DeviceMap.find(strFullDevName);
+	FreeSwitchDevice* pDevice=NULL;
+	if(it==m_DeviceMap.end())
+	{
+		pDevice=new FreeSwitchDevice(strFullDevName.c_str(),type);
+		m_DeviceMap[strFullDevName]=pDevice;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::PrepareDevice: device %s type %d added.", pcDevice, type);
+	}
+	else
+	{
+		pDevice=it->second;
+		if(pDevice->GetDeviceType()!=type)
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::PrepareDevice: device %s found but type is different!",pcDevice);
+
+	}
+
+	return pDevice;
+}
+
+FreeSwitchCall* FreeSWITCH::GetCall(const char * pcUUID)
+{
+	if(!pcUUID)
+		return NULL;
+	MapStr2Call::iterator it=m_CallMap.find(pcUUID);
+	if(it==m_CallMap.end())
+		return NULL;
+	else return it->second;	//TODO: might chech the secondary UUID
+}
+
+bool FreeSWITCH::IsXRefIDUsed(string crossRefID)
+{
+	switch_mutex_lock(m_mutex);
+	
+	for(MapStr2Device::iterator it=m_DeviceMap.begin();it!=m_DeviceMap.end();it++)
+	{
+		if(it->second->IsMonitoredWithID(crossRefID))
+		{
+			switch_mutex_unlock(m_mutex);
+			return true;
+		}
+	}
+
+	switch_mutex_unlock(m_mutex);	
+	return false;
+}
+
+bool FreeSWITCH::FindCallerCalled(const char* uuid, string* pstrCaller, string* pstrCalled)
+{
+	switch_core_session_t * session=NULL;
+	for(int i=0;i<3;i++)
+	{
+		session=switch_core_session_locate(uuid);
+		if(session)
+			break;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "FreeSWITCH::FindCallerCalled: Session %s not available, waiting.\n",uuid);
+		switch_yield(100000);
+	}
+
+	if(!session)
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::FindCallerCalled: Session %s no longer exists.\n",uuid);
+		return false;
+	}
+	switch_channel_t* channel=switch_core_session_get_channel(session);
+	switch_caller_profile_t * caller=switch_channel_get_caller_profile(channel);
+	
+	if(pstrCaller)
+		*pstrCaller=caller->caller_id_number;
+
+	if(pstrCalled)
+	{
+		if(strncmp(caller->destination_number, "sip:", 4)==0)
+			*pstrCalled=caller->destination_number+4;
+		else
+			*pstrCalled=caller->destination_number;
+
+		std::string::size_type i=(*pstrCalled).find("@");
+		if(i!=(*pstrCalled).npos)
+		{
+			(*pstrCalled).erase(i);
+		}	
+	}
+
+	switch_core_session_rwunlock(session);
+	return true;
+}
+
+bool FreeSWITCH::PrepareCallData(const char* uuid, const char* uuid2, const char* channel, FreeSwitchDevice** ppDevice, FreeSwitchCall** ppCall, FreeSwitchConnection** ppConnection, bool bCreateCall, FreeSwitchDevice** ppQueue, FreeSwitchDevice** ppInboundNID, FreeSwitchDevice** ppOutboundNID, string* pstrCaller, string* pstrCalled)
+{
+	if(!ppDevice || !ppCall)
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::PrepareCallData: mandatory parameter is null.\n");
+		return false;
+	}
+	
+	//Finding call:
+	if( !(*ppCall=GetCall(uuid)) && !(uuid2 && (*ppCall=GetCall(uuid2))) )
+	{
+		if(!bCreateCall)
+		{
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "FreeSWITCH::PrepareCallData: call %s [or %s] not found.\n",uuid, uuid2?uuid2:"NULL");
+			return false;
+		}
+			
+		*ppCall=new FreeSwitchCall();
+		(*ppCall)->strUUID=uuid;
+		m_CallMap[(*ppCall)->strUUID]=*ppCall;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::PrepareCallData: call %s created.\n",(*ppCall)->strUUID.c_str());
+	}	
+
+	//Finding the subscriber:
+	if(strncmp(channel,"sofia/external",14)==0)
+	{
+		//Network interface - finding later
+		*ppDevice=NULL;
+	}
+	else
+	{
+		//Internal subscriber
+		string device=FreeSwitchDevice::Channel2Device(channel);
+		if(!device.size())
+		{			
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::PrepareCallData: Channel %s not recognized.\n",channel);
+			return false;
+		}
+		*ppDevice=PrepareDevice(device.c_str());	
+		if(!(*ppDevice))
+		{
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::PrepareCallData: Device %s not recognized.\n",device.c_str());
+			return false;
+		}	
+	}
+	if(!*ppDevice || ppQueue || ppInboundNID || ppOutboundNID)
+	{
+
+		//Collecting special devices from the call & finding network subscriber:
+		for(MapStr2Device::iterator it=(*ppCall)->devices.begin();it!=(*ppCall)->devices.end();it++)
+		{
+			if(ppQueue && it->second->GetDeviceType()==type_queue)
+			{
+				*ppQueue=it->second;			
+			}
+			else
+			if(it->second->GetDeviceType()==type_network_interface)
+			{
+				FreeSwitchConnection* pTempConn=it->second->FindConnection(*ppCall);
+				if(!pTempConn)
+				{
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "FreeSWITCH::PrepareCallData: trunk %s is mapped to call %s without connection????\n",it->second->GetDeviceID().c_str(),(*ppCall)->strUUID.c_str());
+					continue;
+				}
+				if(ppInboundNID && pTempConn->direction==direction_incoming)
+					*ppInboundNID=it->second;
+				else
+				if(ppOutboundNID && pTempConn->direction==direction_outgoing)
+					*ppOutboundNID=it->second;
+
+				if( (!*ppDevice) && (pTempConn->strChannel==channel) )
+					*ppDevice=it->second;	
+				
+				if( (!*ppDevice) && (pTempConn->strChannel.size()==0) && (pTempConn->direction==direction_outgoing) )
+				{
+					//External outbound call: the device was created before the FS channel, updating the data. 				
+					*ppDevice=it->second;
+					pTempConn->strUUID=uuid;
+					pTempConn->strChannel=channel;
+				}
+			}
+		}
+	}
+
+	if(!*ppDevice)
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::PrepareCallData: Device for channel %s not recognized.\n",channel);
+		return false;
+	}
+
+	//Finding connection:
+	if(ppConnection)
+		*ppConnection=(*ppDevice)->FindConnection(*ppCall);
+	
+	
+	//Finding caller & called
+	if(pstrCaller || pstrCalled)
+	{		
+		FindCallerCalled(uuid, pstrCaller, pstrCalled);		
+	}
+
+	return true;
+}
+
+
+
+void FreeSWITCH::OnChannelCreate(switch_event_t *event)
+{		
+	const char* channel=switch_event_get_header(event, "Channel-Name");
+	if(!channel || strstr(channel,"sofia/external"))	//External inbound calls are handled in OnCallNetworkIncoming
+		return;
+	
+	string device=FreeSwitchDevice::Channel2Device(channel);
+	if(!device.size())
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::OnChannelCreate: Channel %s not recognized.\n",channel);
+		return;
+	}
+	switch_mutex_lock(m_mutex);
+	FreeSwitchDevice* pDevice=PrepareDevice(device.c_str());
+	if(!pDevice)	
+		return;
+	const char* direction=switch_event_get_header(event, "Call-Direction");
+	const char* uuid=switch_event_get_header(event, "Unique-ID");
+	if(		!direction || !uuid 
+		|| (strcmp(direction, "inbound") && !pDevice->IsMakeCallOriginator()) )	//direction= "inbound" means outgoing call, direction is wrong from some reason
+	{
+		switch_mutex_unlock(m_mutex);
+		return;
+	}
+
+	if(GetCall(uuid))
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::OnChannelCreate: Call %s already exists.\n",uuid);
+		switch_mutex_unlock(m_mutex);
+		return;
+	}
+
+	FreeSwitchCall* pCall=new FreeSwitchCall();
+	pCall->strUUID=uuid;
+	m_CallMap[pCall->strUUID]=pCall;
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::OnChannelCreate: call %s created.\n",pCall->strUUID.c_str());
+
+	pDevice->AddConnection(uuid, switch_event_get_header(event, "Channel-Name"), pCall,direction_outgoing);
+	if(pDevice->IsMonitored())
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::OnChannelCreate: ServiceInitiated device: %s, call: %s.\n",pDevice->GetDeviceID().c_str(),uuid);
+		ServiceInitiatedEvent si(ConnectionID(pDevice->GetDeviceID(),pCall->strUUID));
+		if(pDevice->IsMakeCallOriginator())
+			si.SetEventCause(CAUSE_MAKE_CALL);
+		pDevice->SendEvent(&si);
+	}
+	switch_mutex_unlock(m_mutex);
+}
+
+
+void FreeSWITCH::OnProgress(switch_event_t *event)
+{
+	const char* channel=switch_event_get_header(event, "Channel-Name");
+	const char* uuid=switch_event_get_header(event, "Unique-ID");
+	const char* uuid2=switch_event_get_header(event, "Other-Leg-Unique-ID");
+	if(!channel || !uuid)				
+		return;	
+	
+	FreeSwitchCall* pCall;	
+	FreeSwitchDevice* pDevice=NULL, *pInboundNIDDevice=NULL, *pOutboundNIDDevice=NULL;
+	string caller, called;
+	FreeSwitchConnection* pConnection=NULL;
+	
+	switch_mutex_lock(m_mutex);
+	if(!PrepareCallData(uuid, uuid2, channel, &pDevice, &pCall, &pConnection, true, NULL, &pInboundNIDDevice, &pOutboundNIDDevice, &caller, &called))
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::OnProgress: PrepareCallData failed.\n");
+		return;
+	}
+	
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::OnProgress: %s device: %s, call: %s [%s].\n",event->event_id==SWITCH_EVENT_CHANNEL_PROGRESS?"CHANNEL_PROGRESS":"CHANNEL_PROGRESS_MEDIA",pDevice->GetDeviceID().c_str(), uuid, uuid2?uuid2:"NULL");
+		
+	if(!pConnection)
+	{
+		pConnection=pDevice->AddConnection(uuid,channel,pCall,direction_incoming);
+		pConnection->state=STATE_ALERTING;
+	}
+	else
+		pConnection->state=STATE_CONNECTED;
+			
+	DeviceID alertingDevice(called);
+
+	OriginatedEvent oe(ConnectionID(caller,pCall->strUUID), caller, called);	
+	oe.SetLocalConnectionInfo(STATE_CONNECTED);
+	DeliveredEvent de(ConnectionID(alertingDevice,pCall->strUUID), alertingDevice, caller, called);
+	de.SetLocalConnectionInfo(pConnection->state);
+
+	if(pInboundNIDDevice)
+	{
+		oe.SetNetworkCalledDevice(called);
+		oe.SetNetworkCallingDevice(caller);
+		oe.SetAssociatedCallingDevice(DeviceID(typeOfNumberDevice,pInboundNIDDevice->GetDeviceID()));
+
+		de.SetNetworkCalledDevice(called);
+		de.SetNetworkCallingDevice(caller);
+		de.SetAssociatedCallingDevice(DeviceID(typeOfNumberDevice,pInboundNIDDevice->GetDeviceID()));
+	}
+	if(pOutboundNIDDevice)
+	{
+		de.SetAssociatedCalledDevice(DeviceID(typeOfNumberDevice,pOutboundNIDDevice->GetDeviceID()));
+		de.SetConnection(ConnectionID(DeviceID(typeOfNumberDevice,pOutboundNIDDevice->GetDeviceID()),pCall->strUUID));
+	}
+		
+	if(pDevice->IsMonitored())
+	{
+		if(pConnection->state==STATE_CONNECTED)
+			pDevice->SendEvent(&oe);
+		pDevice->SendEvent(&de);		
+	}
+
+	switch_mutex_unlock(m_mutex);
+}
+
+
+void FreeSWITCH::OnChannelAnswer(switch_event_t *event)
+{
+	const char* channel=switch_event_get_header(event, "Channel-Name");
+	const char* uuid=switch_event_get_header(event, "Unique-ID");
+	const char* uuid2=switch_event_get_header(event, "Other-Leg-Unique-ID");
+	if(!channel || !uuid)				
+		return;	
+	
+	FreeSwitchCall* pCall;	
+	FreeSwitchDevice* pDevice=NULL, *pQueueDevice=NULL, *pInboundNIDDevice=NULL, *pOutboundNIDDevice=NULL;
+	string caller, called;
+	FreeSwitchConnection* pConnection=NULL;
+	
+	switch_mutex_lock(m_mutex);
+	if(!PrepareCallData(uuid, uuid2, channel, &pDevice, &pCall, &pConnection, true, &pQueueDevice, &pInboundNIDDevice, &pOutboundNIDDevice, &caller, &called))
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::OnChannelAnswer: PrepareCallData failed.\n");
+		return;
+	}
+	
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::OnChannelAnswer: CHANNEL_ANSWER device: %s, call: %s [%s].\n",pDevice->GetDeviceID().c_str(), uuid, uuid2?uuid2:"NULL");
+		
+	if(!pConnection)
+	{
+		pConnection=pDevice->AddConnection(uuid,channel,pCall,direction_incoming);
+	}
+
+	pConnection->state=STATE_CONNECTED;
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::OnChannelAnswer: Established device: %s, call: %s.\n",pDevice->GetDeviceID().c_str(),pCall->strUUID.c_str());
+		
+	DeviceID answeringDevice;
+	if(pQueueDevice)
+	{
+		answeringDevice.SetCallNr(pQueueDevice->GetDeviceID().c_str());
+		answeringDevice.SetTypeOfNumber(typeOfNumberDevice);
+	}
+	else
+	{
+		answeringDevice.SetCallNr(called);
+	}
+	EstablishedEvent ee(ConnectionID(answeringDevice,pCall->strUUID), answeringDevice, caller, called);
+
+	if(pInboundNIDDevice)
+	{
+		ee.SetNetworkCalledDevice(called);
+		ee.SetNetworkCallingDevice(caller);
+		ee.SetAssociatedCallingDevice(DeviceID(typeOfNumberDevice,pInboundNIDDevice->GetDeviceID()));
+	}
+	if(pOutboundNIDDevice)
+	{
+		ee.SetAssociatedCalledDevice(DeviceID(typeOfNumberDevice,pOutboundNIDDevice->GetDeviceID()));
+		ee.SetEstablishedConnection(ConnectionID(DeviceID(typeOfNumberDevice,pOutboundNIDDevice->GetDeviceID()),pCall->strUUID));
+	}
+		
+	if(pDevice->IsMonitored())
+		pDevice->SendEvent(&ee);	
+		
+	if(pQueueDevice && pQueueDevice->IsMonitored())
+		pQueueDevice->SendEvent(&ee);	
+
+	switch_mutex_unlock(m_mutex);
+}
+
+void FreeSWITCH::OnChannelHangup(switch_event_t *event)
+{
+	char* channel=switch_event_get_header(event, "Channel-Name");
+	const char* uuid=switch_event_get_header(event, "Unique-ID");
+	const char* uuid2=switch_event_get_header(event, "Other-Leg-Unique-ID");
+	const char* cause=switch_event_get_header(event, "Hangup-Cause");
+	if(!channel || !uuid)				
+		return;	
+
+	FreeSwitchCall* pCall=NULL;	
+	FreeSwitchDevice* pDevice=NULL, *pQueueDevice=NULL;	
+
+	switch_mutex_lock(m_mutex);
+	if(!PrepareCallData(uuid, uuid2, channel, &pDevice, &pCall, NULL, false, NULL, NULL, NULL, NULL, NULL))
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::OnChannelHangup: PrepareCallData failed.\n");
+		return;
+	}	
+	
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::OnChannelHangup: CHANNEL_HANGUP device: %s, call: %s [%s], cause: %s.\n",pDevice->GetDeviceID().c_str(),uuid, uuid2?uuid2:"NULL", cause?cause:"NULL");
+
+	ConnectionClearedEvent cc(ConnectionID(pDevice->GetDeviceID(),pCall->strUUID));
+
+	//Setting cause
+	if(!cause || !strcmp(cause,"NORMAL_CLEARING") )
+		cc.SetEventCause(CAUSE_NORMAL_CLEARING);
+	else
+	if(!strcmp(cause,"NO_ROUTE_DESTINATION"))
+		cc.SetEventCause(CAUSE_DEST_NOT_OBTAINABLE);
+	else
+	if(!strcmp(cause,"USER_BUSY"))
+		cc.SetEventCause(CAUSE_BUSY);
+	if(!strcmp(cause,"ORIGINATOR_CANCEL"))
+		cc.SetEventCause(CAUSE_CALL_NOT_ANSWERED);
+
+	int devices_in_call=pCall->devices.size();	
+	//Sending event to all devices in the call
+	FreeSwitchConnection* pConnection=NULL;
+	for(MapStr2Device::iterator it=pCall->devices.begin();it!=pCall->devices.end();it++)
+	{		
+		pConnection=it->second->FindConnection(pCall->strUUID.c_str());
+		if(!pConnection)
+		{
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::OnChannelHangup: Device %s could not have connection to %s.",it->second->GetDeviceID().c_str(),pCall->strUUID.c_str());
+			continue;
+		}
+		
+		if(it->second->GetDeviceType()==type_queue)
+		{
+			pConnection->state=STATE_NULL;	
+			pQueueDevice=it->second;
+		}
+		else
+		if(it->second==pDevice)			
+			pConnection->state=STATE_NULL;	//The terminated device
+		else
+		if(devices_in_call<=2)
+			pConnection->state=STATE_FAIL;	//If only one device remain, it will be in failed state
+											//If more than one devices remain (conference), they will have the original state.	
+		
+		if(it->second->IsMonitored())
+		{			
+			cc.SetLocalConnectionInfo(pConnection->state);
+			it->second->SendEvent(&cc);			
+		}	
+	}
+	pDevice->DeleteConnection(pCall);
+	if(pQueueDevice)
+	{
+		if(pQueueDevice->IsMonitored())
+		{
+			ConnectionClearedEvent cc2(ConnectionID(DeviceID(typeOfNumberDevice,pQueueDevice->GetDeviceID()),pCall->strUUID));
+			cc2.SetLocalConnectionInfo(STATE_NULL);
+			cc2.SetEventCause(cc.GetEventCause());
+			pQueueDevice->SendEvent(&cc2);
+		}
+		pQueueDevice->DeleteConnection(pCall);
+	}
+
+	if(pCall->devices.size()==0)
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::OnChannelHangup: call %s deleted.\n",pCall->strUUID.c_str());
+		m_CallMap.erase(pCall->strUUID);
+		delete pCall;
+	}	
+	switch_mutex_unlock(m_mutex);
+}
+
+void FreeSWITCH::OnDtmf(switch_event_t *event)
+{
+	char* channel=switch_event_get_header(event, "Channel-Name");
+	const char* uuid=switch_event_get_header(event, "Unique-ID");	
+	const char* uuid2=switch_event_get_header(event, "Other-Leg-Unique-ID");
+	if(!channel || !uuid)				
+		return;	
+
+	FreeSwitchCall* pCall=NULL;	
+	FreeSwitchDevice* pDevice=NULL, *pQueueDevice=NULL;	
+	
+	switch_mutex_lock(m_mutex);
+	
+	if(!PrepareCallData(uuid, uuid2, channel, &pDevice, &pCall, NULL, false, &pQueueDevice, NULL, NULL, NULL, NULL))
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::OnDtmf: PrepareCallData failed.\n");
+		return;
+	}	
+
+	const char* digit=switch_event_get_header(event, "DTMF-Digit");
+	if(!digit)	
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::OnDtmf: DTMF-Digit not found in event.");
+		switch_mutex_unlock(m_mutex);
+		return;
+	}
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::OnDtmf: DTMF device: %s, call: %s \n",pDevice->GetDeviceID().c_str(),pCall->strUUID.c_str());
+	
+	DeviceID dev(pDevice->GetDeviceType()==type_internal_subscriber?typeOfNumberDialable:typeOfNumberDevice,pDevice->GetDeviceID());
+	DtmfDetectedEvent dd(ConnectionID(dev,pCall->strUUID),digit[0]);
+
+	if(pDevice->IsMonitored())
+		pDevice->SendEvent(&dd);
+	
+	if(pQueueDevice && pQueueDevice->IsMonitored())	
+		pQueueDevice->SendEvent(&dd);
+
+	switch_mutex_unlock(m_mutex);
+
+}
+
+void FreeSWITCH::OnPlayback(switch_event_t *event)
+{
+	char* channel=switch_event_get_header(event, "Channel-Name");
+	const char* uuid=switch_event_get_header(event, "Unique-ID");	
+	const char* uuid2=switch_event_get_header(event, "Other-Leg-Unique-ID");
+	if(!channel || !uuid)				
+		return;	
+
+	FreeSwitchCall* pCall=NULL;	
+	FreeSwitchDevice* pDevice=NULL;	
+	
+	switch_mutex_lock(m_mutex);
+	
+	if(!PrepareCallData(uuid, uuid2, channel, &pDevice, &pCall, NULL, false, NULL, NULL, NULL, NULL, NULL))
+	{
+		switch_mutex_unlock(m_mutex);
+		if(event->event_id!=SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE)	//Could be normal if call terminates during playback.
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::OnPlayback: PrepareCallData failed.\n");
+		return;
+	}	
+
+	const char* file=switch_event_get_header(event, "Application-Data");
+	if(!file)
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::OnPlayback: Filename not found in event.\n");
+		switch_mutex_unlock(m_mutex);
+		return;
+	}
+	
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::OnPlayback: device: %s, call: %s \n",pDevice->GetDeviceID().c_str(),pCall->strUUID.c_str());
+	
+	DeviceID dev(pDevice->GetDeviceType()==type_internal_subscriber?typeOfNumberDialable:typeOfNumberDevice,pDevice->GetDeviceID());
+	
+	CSTAEvent* pEvent=NULL;
+	if(event->event_id==SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE)
+	{
+		pEvent=new StopEvent(ConnectionID(dev,pCall->strUUID),file);
+		char* result=switch_event_get_header(event, "Application-Response");
+		if(result)
+		{
+			if(	strcmp(result, "FILE PLAYED")==0)
+				pEvent->SetEventCause(CAUSE_END_OF_MESSAGE_DETECTED);
+			else
+			if(strcmp(result, "FILE NOT FOUND")==0)
+				pEvent->SetEventCause(CAUSE_RESOURCES_NOT_AVAILABLE);
+			else
+			if(strcmp(result, "PLAYBACK ERROR")==0)
+				pEvent->SetEventCause(CAUSE_BLOCKED);
+		}		
+	}
+	else
+	{
+		pEvent=new PlayEvent(ConnectionID(dev,pCall->strUUID),file);
+	}
+
+	for(MapStr2Device::iterator it=pCall->devices.begin();it!=pCall->devices.end();it++)
+	{
+		if(it->second->IsMonitored())		
+			it->second->SendEvent(pEvent);		
+	}
+
+	delete pEvent;
+
+	switch_mutex_unlock(m_mutex);
+}
+
+void FreeSWITCH::OnRecord(switch_event_t *event)
+{
+	char* channel=switch_event_get_header(event, "Channel-Name");
+	const char* uuid=switch_event_get_header(event, "Unique-ID");	
+	const char* uuid2=switch_event_get_header(event, "Other-Leg-Unique-ID");
+	if(!channel || !uuid)				
+		return;	
+
+	FreeSwitchCall* pCall=NULL;	
+	FreeSwitchDevice* pDevice=NULL;	
+	
+	switch_mutex_lock(m_mutex);
+	
+	if(!PrepareCallData(uuid, uuid2, channel, &pDevice, &pCall, NULL, false, NULL, NULL, NULL, NULL, NULL))
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::OnRecord: PrepareCallData failed.\n");
+		return;
+	}	
+	
+	char* p=switch_event_get_header(event, "Application-Data");
+	if(!p)
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::OnRecord: Filename not found in event.\n");
+		switch_mutex_unlock(m_mutex);
+		return;
+	}
+
+	char file[MAX_PATH];
+	strcpy(file,p);	
+	p=strstr(file,".wav ");
+	if(p)
+		p[4]=0;	//cutting length parameter
+	
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::OnRecord: device: %s, call: %s \n",pDevice->GetDeviceID().c_str(),pCall->strUUID.c_str());
+	
+	DeviceID dev(pDevice->GetDeviceType()==type_internal_subscriber?typeOfNumberDialable:typeOfNumberDevice,pDevice->GetDeviceID());
+	
+	CSTAEvent* pEvent=NULL;
+	if(event->event_id==SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE)
+	{
+		pEvent=new StopEvent(ConnectionID(dev,pCall->strUUID),file);
+		pEvent->SetEventCause(CAUSE_MESSAGE_DURATION_EXCEEDED);		
+	}
+	else
+	{
+		pEvent=new RecordEvent(ConnectionID(dev,pCall->strUUID),file);
+	}
+
+	for(MapStr2Device::iterator it=pCall->devices.begin();it!=pCall->devices.end();it++)
+	{
+		if(it->second->IsMonitored())		
+			it->second->SendEvent(pEvent);		
+	}
+
+	delete pEvent;
+
+	switch_mutex_unlock(m_mutex);
+}
+
+
+void FreeSWITCH::OnCallQueued(const char* queue, switch_core_session_t *session)
+{
+	const char* uuid=switch_core_session_get_uuid(session);
+	switch_channel_t* channel=switch_core_session_get_channel(session);
+	switch_caller_profile_t * caller=switch_channel_get_caller_profile(channel);	
+
+	switch_mutex_lock(m_mutex);
+	
+	FreeSwitchDevice* pDevice=PrepareDevice(queue,type_queue);
+	if(!pDevice)	
+		return;
+
+	FreeSwitchCall* pCall=GetCall(uuid);
+	if(!pCall)
+	{
+		pCall=new FreeSwitchCall();
+		pCall->strUUID=uuid;
+		m_CallMap[pCall->strUUID]=pCall;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::OnCallQueued: call %s created.\n",pCall->strUUID.c_str());
+	}
+	
+	FreeSwitchConnection* pConnection=pDevice->AddConnection(uuid, switch_channel_get_name(channel),pCall, direction_incoming);
+	pConnection->state=STATE_QUEUED;
+	QueuedEvent qe(ConnectionID(DeviceID(typeOfNumberDevice,pDevice->GetDeviceID()),uuid),DeviceID(typeOfNumberDevice,pDevice->GetDeviceID()),caller->caller_id_number, caller->destination_number);
+	
+	if(strstr(caller->chan_name,"sofia/external"))
+	{		
+		qe.SetNetworkCallingDevice(caller->caller_id_number);
+		qe.SetNetworkCalledDevice(caller->destination_number);
+		for(MapStr2Device::iterator it=pCall->devices.begin();it!=pCall->devices.end();it++)		
+			if(it->second->GetDeviceType()==type_network_interface)
+			{
+				qe.SetAssociatedCallingDevice(DeviceID(typeOfNumberDevice,it->second->GetDeviceID()));
+				break;
+			}
+		
+	}	
+	qe.SetNumberQueued(pDevice->GetConnectionCount());
+	for(MapStr2Device::iterator it=pCall->devices.begin();it!=pCall->devices.end();it++)
+	{
+		//Sending queued event for the queue and the caller.
+		if(it->second->IsMonitored())		
+			it->second->SendEvent(&qe);
+	}
+
+
+	switch_mutex_unlock(m_mutex);
+}
+
+void FreeSWITCH::OnCallNetworkIncoming(const char* trunk, switch_core_session_t *session)
+{
+	const char* uuid=switch_core_session_get_uuid(session);
+	switch_channel_t* channel=switch_core_session_get_channel(session);	
+	//switch_caller_profile_t * caller=switch_channel_get_caller_profile(channel);
+
+	switch_mutex_lock(m_mutex);
+	
+	FreeSwitchDevice* pDevice=PrepareDevice(trunk,type_network_interface);
+	if(!pDevice)	
+		return;
+
+	FreeSwitchCall* pCall=GetCall(uuid);
+	if(!pCall)
+	{
+		pCall=new FreeSwitchCall();
+		pCall->strUUID=uuid;
+		m_CallMap[pCall->strUUID]=pCall;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::OnCallNetworkIncoming: call %s created.\n",pCall->strUUID.c_str());
+	}
+	
+	FreeSwitchConnection* pConnection=pDevice->AddConnection(uuid, switch_channel_get_name(channel), pCall, direction_incoming);
+	pConnection->strChannel=switch_channel_get_name(channel);	
+	if(pDevice->IsMonitored())
+	{
+		ServiceInitiatedEvent si(ConnectionID(DeviceID(typeOfNumberDevice,pDevice->GetDeviceID()),uuid));
+		//TODO: add networkCallingDevice, networkCalledDevice, associatedCallingDevice fields
+		pDevice->SendEvent(&si);
+	}
+	switch_mutex_unlock(m_mutex);
+}
+
+void FreeSWITCH::OnCallNetworkOutgoing(const char* trunk, switch_core_session_t *session)
+{
+	const char* uuid=switch_core_session_get_uuid(session);
+	//switch_channel_t* channel=switch_core_session_get_channel(session);	
+	//switch_caller_profile_t * caller=switch_channel_get_caller_profile(channel);
+
+	switch_mutex_lock(m_mutex);
+	
+	FreeSwitchDevice* pDevice=PrepareDevice(trunk,type_network_interface);
+	if(!pDevice)	
+		return;
+
+	FreeSwitchCall* pCall=GetCall(uuid);
+	if(!pCall)
+	{
+		pCall=new FreeSwitchCall();
+		pCall->strUUID=uuid;
+		m_CallMap[pCall->strUUID]=pCall;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::OnCallNetworkOutgoing: call %s created.\n",pCall->strUUID.c_str());
+	}
+	
+	//outgoing uuid and channel name is not yet known.
+	pDevice->AddConnection("", "", pCall, direction_outgoing);
+	
+	if(pDevice->IsMonitored())
+	{
+		//TODO: Network Reached
+	}
+	switch_mutex_unlock(m_mutex);
+}
+
+
+
+void FreeSWITCH::OnSessionFinished(CISession* sender)
+{
+	switch_mutex_lock(m_mutex);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::OnSessionFinished: removing session 0x%08X\n",sender);
+	
+	try
+	{
+		for(MapStr2Device::iterator it=m_DeviceMap.begin();it!=m_DeviceMap.end();it++)
+		{
+			it->second->RemoveMonitor(sender);
+		}
+	}
+	catch(...)
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::OnSessionFinished: Exception.");
+	}
+
+	switch_mutex_unlock(m_mutex);	
+}
+
+void FreeSWITCH::MonitorStart(CISession* sender, MonitorStartRequest* pRequest)
+{	
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::MonitorStart: Request with InvokeID: %d\n:%s\n",pRequest->GetInvokeID(), pRequest->GetReadable().c_str());
+	
+	if(!pRequest->GetMonitorObject().GetCallNr().size())
+	{
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation, invalidMonitorObject);
+		sender->SendMsg(&err);
+		return;
+	}
+	
+	
+	FreeSwitchDeviceType type=FreeSwitchDevice::Device2Type(pRequest->GetMonitorObject());
+	if(type==type_unknown)
+	{
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation, invalidMonitorObject);
+		sender->SendMsg(&err);
+		return;
+	}
+
+	switch_mutex_lock(m_mutex);
+	FreeSwitchDevice* pDevice=PrepareDevice(pRequest->GetMonitorObject().GetCallNr().c_str()+(type==type_internal_subscriber?0:2), type);
+	
+	string crossRefID=pDevice->GetDeviceID().c_str();
+	for(crossRefID=pDevice->GetDeviceID();IsXRefIDUsed(crossRefID);crossRefID=GetNextXRefID());
+	
+	if(pDevice->AddMonitor(sender, crossRefID))
+	{
+		MonitorStartResponse resp(pRequest->GetInvokeID(),crossRefID);
+		sender->SendMsg(&resp);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::MonitorStart: Response sent with InvokeID: %d\n:%s\n",resp.GetInvokeID(), resp.GetReadable().c_str());
+	}
+	else
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::MonitorStart: AddMonitor failed.");
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation, invalidMonitorObject);
+		sender->SendMsg(&err);
+	}
+	switch_mutex_unlock(m_mutex);
+}
+
+
+void FreeSWITCH::SnapshotDevice(CISession* sender, SnapshotDeviceRequest* pRequest)
+{
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::SnapshotDevice: Request with InvokeID: %d\n:%s\n",pRequest->GetInvokeID(), pRequest->GetReadable().c_str());
+	
+	FreeSwitchDeviceType type=FreeSwitchDevice::Device2Type(pRequest->GetSnapshotObject());
+	if(type==type_unknown)
+	{
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation, invalidDeviceID);
+		sender->SendMsg(&err);
+		return;
+	}
+
+	switch_mutex_lock(m_mutex);
+	FreeSwitchDevice* pDevice=PrepareDevice(pRequest->GetSnapshotObject().GetCallNr().c_str()+(type==type_internal_subscriber?0:2), type);
+	
+	SnapshotDeviceResponse resp(pRequest->GetInvokeID());
+	
+	for(MapCall2Connection::iterator it=pDevice->connections.begin();it!=pDevice->connections.end();it++)	
+	{
+		SnapshotDeviceData data(ConnectionID(pRequest->GetSnapshotObject(),it->second->pCall->strUUID),it->second->state);
+		resp.AddSnapshotData(data);
+	}
+
+	sender->SendMsg(&resp);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::SnapshotDevice: Response sent with InvokeID: %d\n:%s\n",resp.GetInvokeID(), resp.GetReadable().c_str());
+
+	switch_mutex_unlock(m_mutex);
+}
+
+void FreeSWITCH::SnapshotCall(CISession* sender, SnapshotCallRequest* pRequest)
+{
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::SnapshotCall: Request with InvokeID: %d\n:%s\n",pRequest->GetInvokeID(), pRequest->GetReadable().c_str());
+
+	switch_mutex_lock(m_mutex);	
+	FreeSwitchCall* pCall=GetCall(pRequest->GetSnapshotObject().GetCallID().c_str());	
+	if(!pCall)
+		
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::SnapshotCall: CallID %s not found.",pRequest->GetSnapshotObject().GetCallID().c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidCallID);
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::SnapshotCall: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+
+	SnapshotCallResponse resp(pRequest->GetInvokeID());
+	
+	for(MapStr2Device::iterator it=pCall->devices.begin();it!=pCall->devices.end();it++)
+	{
+		FreeSwitchConnection* pConn=it->second->FindConnection(pCall); 
+		SnapshotCallData data(it->second->GetDeviceID(),pConn?pConn->state:STATE_NULL);		
+		resp.AddSnapshotData(data);
+	}
+	string caller, called;
+	FindCallerCalled(pCall->strUUID.c_str(), &caller, &called);
+	resp.SetCallingDevice(caller);
+	resp.SetCalledDevice(called);
+
+	sender->SendMsg(&resp);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::SnapshotDevice: Response sent with InvokeID: %d\n:%s\n",resp.GetInvokeID(), resp.GetReadable().c_str());
+
+	switch_mutex_unlock(m_mutex);
+
+}
+
+
+void FreeSWITCH::MakeCall(CISession* sender, MakeCallRequest* pRequest)
+{
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::MakeCall: Request with InvokeID: %d\n:%s\n",pRequest->GetInvokeID(), pRequest->GetReadable().c_str());
+
+	switch_channel_t *caller_channel;
+	switch_core_session_t *caller_session = NULL;
+	char aleg[400], exten[400];
+	uint32_t timeout = 60;
+	switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
+	FreeSwitchDevice* pDevice=NULL;
+		
+	if(pRequest->GetCallingDevice().GetTypeOfNumber()==typeOfNumberDialable)
+	{
+		sprintf(aleg,"%ssofia/internal/%s%s%s",pRequest->GetAutoOriginate()==ORIGINATE_DO_NOT_PROMPT?"{sip_auto_answer=true}":"",pRequest->GetCallingDevice().GetCallNr().c_str(),"%",switch_core_get_variable("domain"));
+		pDevice=PrepareDevice(pRequest->GetCallingDevice().GetCallNr().c_str());
+		pDevice->SetMakeCallOriginator(true);
+	}
+	else
+	{
+		sprintf(aleg,"loopback/%s",pRequest->GetCallingDevice().GetCallNr().c_str()+2);
+	}
+	sprintf(exten,"%s",pRequest->GetCalledDirectoryNumber().GetCallNr().c_str());
+		
+	if (switch_ivr_originate(NULL, &caller_session, &cause, aleg, timeout, NULL, "CSTA", pRequest->GetCallingDevice().GetCallNr().c_str(), NULL, NULL, SOF_NONE) != SWITCH_STATUS_SUCCESS	|| !caller_session) 
+	{		
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "-ERR Cannot Create Outgoing Channel! [%s] cause: %s\n", aleg, switch_channel_cause2str(cause));
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,genericError); //TODO: refine error code
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::MakeCall: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		if(pDevice)
+			pDevice->SetMakeCallOriginator(false);
+		return;
+	}
+
+	caller_channel = switch_core_session_get_channel(caller_session);
+	switch_channel_clear_state_handler(caller_channel, NULL);
+	
+	switch_ivr_session_transfer(caller_session, exten, "XML", "default");	
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "+OK Created Session: %s\n", switch_core_session_get_uuid(caller_session));
+	
+	MakeCallResponse resp(pRequest->GetInvokeID(),ConnectionID(pRequest->GetCallingDevice(),switch_core_session_get_uuid(caller_session)));
+	sender->SendMsg(&resp);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::MakeCall: Response sent with InvokeID: %d\n:%s\n",resp.GetInvokeID(), resp.GetReadable().c_str());
+	if(pDevice)
+		pDevice->SetMakeCallOriginator(false);
+	
+	switch_core_session_rwunlock(caller_session);	
+	
+}
+
+
+void FreeSWITCH::AnswerCall(CISession* sender, AnswerCallRequest* pRequest)
+{
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::AnswerCall: Request with InvokeID: %d\n:%s\n",pRequest->GetInvokeID(), pRequest->GetReadable().c_str());
+
+	switch_mutex_lock(m_mutex);
+
+	FreeSwitchCall* pCall=GetCall(pRequest->GetCallToBeAnswered().GetCallID().c_str());	
+	if(!pCall)
+		
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::AnswerCall: CallID %s not found.",pRequest->GetCallToBeAnswered().GetCallID().c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidCallID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::AnswerCall: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+
+	FreeSwitchDevice * pDevice=pCall->GetDevice(pRequest->GetCallToBeAnswered().GetDeviceID()->GetCallNr());	
+	if(!pDevice)
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::AnswerCall: Device %s not found.",pRequest->GetCallToBeAnswered().GetDeviceID()->GetCallNr().c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidDeviceID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::AnswerCall: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+	FreeSwitchConnection* pConnection=pDevice->FindConnection(pCall);
+	if(!pConnection)
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::AnswerCall: Connection %s/%s not found.",pRequest->GetCallToBeAnswered().GetDeviceID()->GetCallNr().c_str(),pRequest->GetCallToBeAnswered().GetCallID().c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidDeviceID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::AnswerCall: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+	switch_core_session_t* session=switch_core_session_locate(pConnection->strUUID.c_str());
+
+	if(!session)
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::AnswerCall: No session for CallID %s found.",pRequest->GetCallToBeAnswered().GetCallID().c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidCallID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::AnswerCall: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+	switch_channel_t * channel=switch_core_session_get_channel(session);
+	switch_channel_clear_flag(channel, CF_PROXY_MEDIA);
+	switch_channel_clear_flag(channel, CF_PROXY_MODE);
+	if(switch_channel_answer(channel)==SWITCH_STATUS_SUCCESS)
+	{
+		AnswerCallResponse resp(pRequest->GetInvokeID());
+		sender->SendMsg(&resp);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::AnswerCall: Response sent with InvokeID: %d\n:%s\n",resp.GetInvokeID(), resp.GetReadable().c_str());
+	}
+	else
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::AnswerCall: switch_channel_answer failed.");
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,genericError); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::AnswerCall: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+
+	}
+	switch_core_session_rwunlock(session);
+	
+	switch_mutex_unlock(m_mutex);
+}
+
+void FreeSWITCH::PlayMessage(CISession* sender, PlayMessageRequest* pRequest)
+{
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::PlayMessage: Request with InvokeID: %d\n:%s\n",pRequest->GetInvokeID(), pRequest->GetReadable().c_str());
+
+	switch_mutex_lock(m_mutex);
+
+	FreeSwitchCall* pCall=GetCall(pRequest->GetOverConnection().GetCallID().c_str());	
+	if(!pCall)
+		
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::PlayMessage: CallID %s not found.",pRequest->GetOverConnection().GetCallID().c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidCallID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::PlayMessage: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+
+	FreeSwitchDevice * pDevice=pCall->GetDevice(pRequest->GetOverConnection().GetDeviceID()->GetCallNr());	
+	if(!pDevice)
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::PlayMessage: Device %s not found.",pRequest->GetOverConnection().GetDeviceID()->GetCallNr().c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidDeviceID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::PlayMessage: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+	FreeSwitchConnection* pConnection=pDevice->FindConnection(pCall);
+	if(!pConnection)
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::PlayMessage: Connection %s/%s not found.",pRequest->GetOverConnection().GetDeviceID()->GetCallNr().c_str(),pRequest->GetOverConnection().GetCallID().c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidDeviceID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::PlayMessage: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+	
+	if(switch_ivr_broadcast(pConnection->strUUID.c_str(), pRequest->GetMessageToBePlayed().c_str(), SMF_ECHO_ALEG)==SWITCH_STATUS_SUCCESS)
+	{
+		PlayMessageResponse resp(pRequest->GetInvokeID());
+		sender->SendMsg(&resp);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::PlayMessage: Response sent with InvokeID: %d\n:%s\n",resp.GetInvokeID(), resp.GetReadable().c_str());
+	}
+	else
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::PlayMessage: switch_ivr_broadcast failed.");
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,genericError); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::PlayMessage: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+	}
+
+	switch_mutex_unlock(m_mutex);
+}
+
+void FreeSWITCH::RecordMessage(CISession* sender, RecordMessageRequest* pRequest)
+{
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::RecordMessage: Request with InvokeID: %d\n:%s\n",pRequest->GetInvokeID(), pRequest->GetReadable().c_str());
+	
+	switch_mutex_lock(m_mutex);
+
+	FreeSwitchCall* pCall=GetCall(pRequest->GetCallToBeRecorded().GetCallID().c_str());	
+	if(!pCall)		
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::RecordMessage: CallID %s not found.",pRequest->GetCallToBeRecorded().GetCallID().c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidCallID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::RecordMessage: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+
+	FreeSwitchDevice * pDevice=pCall->GetDevice(pRequest->GetCallToBeRecorded().GetDeviceID()->GetCallNr());	
+	if(!pDevice)
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::RecordMessage: Device %s not found.",pRequest->GetCallToBeRecorded().GetDeviceID()->GetCallNr().c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidDeviceID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::RecordMessage: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+	FreeSwitchConnection* pConnection=pDevice->FindConnection(pCall);
+	if(!pConnection)
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::RecordMessage: Connection %s/%s not found.",pRequest->GetCallToBeRecorded().GetDeviceID()->GetCallNr().c_str(),pRequest->GetCallToBeRecorded().GetCallID().c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidDeviceID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::RecordMessage: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+
+	switch_core_session_t *session=switch_core_session_locate(pConnection->strUUID.c_str());
+	if(!session)
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::RecordMessage: Session %s not found.",pConnection->strUUID.c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidCallID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::RecordMessage: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+	
+
+	if ((switch_channel_test_flag(switch_core_session_get_channel(session), CF_EVENT_PARSE))) 
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::RecordMessage: Record or broadcast already in progress.");
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,genericError); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::RecordMessage: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+
+	char filename[MAX_PATH];
+	sprintf(filename,"%s-%X.wav",pRequest->GetCallToBeRecorded().GetCallID().c_str(),clock());
+	char arg[MAX_PATH+20];
+	
+	if(pRequest->GetMaxDuration()>1000)
+	{
+		sprintf(arg, "%s %d",filename,pRequest->GetMaxDuration()/1000);
+	}
+	else
+	{
+		strcpy(arg,filename);
+	}
+	
+    char path[MAX_PATH];          
+	strcat(path,switch_channel_get_variable(switch_core_session_get_channel(session), "sound_prefix"));
+	strcat(path,SWITCH_PATH_SEPARATOR);
+	strcat(path,filename);
+	
+	switch_event_t *event;
+	if (switch_event_create(&event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) 
+	{		
+		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "execute");
+		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-name", "record");
+		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-arg", arg);			
+		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event-lock", "true");
+		switch_core_session_queue_private_event(session, &event);		
+
+		RecordMessageResponse resp(pRequest->GetInvokeID(),path);
+		sender->SendMsg(&resp);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::RecordMessage: Response sent with InvokeID: %d\n:%s\n",resp.GetInvokeID(), resp.GetReadable().c_str());
+	}
+	else
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::RecordMessage: switch_event_create failed.");
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,genericError); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::RecordMessage: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+	}
+	switch_core_session_rwunlock(session);
+	switch_mutex_unlock(m_mutex);
+}
+
+void FreeSWITCH::StopMessage(CISession* sender, StopRequest* pRequest)
+{
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::StopMessage: Request with InvokeID: %d\n:%s\n",pRequest->GetInvokeID(), pRequest->GetReadable().c_str());
+	
+	switch_mutex_lock(m_mutex);
+
+	FreeSwitchCall* pCall=GetCall(pRequest->GetConnection().GetCallID().c_str());	
+	if(!pCall)		
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::StopMessage: CallID %s not found.",pRequest->GetConnection().GetCallID().c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidCallID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::StopMessage: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+
+	FreeSwitchDevice * pDevice=pCall->GetDevice(pRequest->GetConnection().GetDeviceID()->GetCallNr());	
+	if(!pDevice)
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::StopMessage: Device %s not found.",pRequest->GetConnection().GetDeviceID()->GetCallNr().c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidDeviceID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::StopMessage: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+	FreeSwitchConnection* pConnection=pDevice->FindConnection(pCall);
+	if(!pConnection)
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::StopMessage: Connection %s/%s not found.",pRequest->GetConnection().GetDeviceID()->GetCallNr().c_str(),pRequest->GetConnection().GetCallID().c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidDeviceID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::StopMessage: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+
+	switch_core_session_t *session=switch_core_session_locate(pConnection->strUUID.c_str());
+	if(!session)
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::StopMessage: Session %s not found.",pConnection->strUUID.c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidCallID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::StopMessage: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}	
+
+	if (!switch_channel_test_flag(switch_core_session_get_channel(session), CF_EVENT_PARSE)) 
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::RecordMessage:No record or broadcast running.");
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,genericError); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::RecordMessage: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}	
+	
+	switch_ivr_stop_record_session(session, pRequest->GetMessageToBeStopped().size()?pRequest->GetMessageToBeStopped().c_str():"all");
+	switch_channel_stop_broadcast(switch_core_session_get_channel(session));
+
+	StopResponse resp(pRequest->GetInvokeID());
+	sender->SendMsg(&resp);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::StopMessage: Response sent with InvokeID: %d\n:%s\n",resp.GetInvokeID(), resp.GetReadable().c_str());	
+	
+	switch_core_session_rwunlock(session);
+	switch_mutex_unlock(m_mutex);
+}
+
+
+void FreeSWITCH::SingleStepTransferCall(CISession* sender,SingleStepTransferCallRequest* pRequest)
+{
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::SingleStepTransferCall: Request with InvokeID: %d\n:%s\n",pRequest->GetInvokeID(), pRequest->GetReadable().c_str());
+
+	switch_mutex_lock(m_mutex);
+
+	FreeSwitchCall* pCall=GetCall(pRequest->GetActiveCall().GetCallID().c_str());	
+	if(!pCall)		
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::SingleStepTransferCall: CallID %s not found.",pRequest->GetActiveCall().GetCallID().c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidCallID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::SingleStepTransferCall: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+
+	//Retrieving the device that initiates the transfer
+	FreeSwitchDevice * pTransferringDevice=pCall->GetDevice(pRequest->GetActiveCall().GetDeviceID()->GetCallNr());	
+	if(!pTransferringDevice)
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::SingleStepTransferCall: Device %s not found.",pRequest->GetActiveCall().GetDeviceID()->GetCallNr().c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidDeviceID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::SingleStepTransferCall: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+
+	for(MapStr2Device::iterator it=pCall->devices.begin();it!=pCall->devices.end();it++)
+	{
+		if(it->second!=pTransferringDevice)	
+		{
+			FreeSwitchConnection* pConnectionToTransfer=it->second->FindConnection(pCall);
+			if(!pConnectionToTransfer)
+			{
+				switch_mutex_unlock(m_mutex);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::SingleStepTransferCall: Connection %s/%s not found.",it->second->GetDeviceID().c_str(),pRequest->GetActiveCall().GetCallID().c_str());
+				UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidDeviceID); 
+				sender->SendMsg(&err);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::SingleStepTransferCall: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+				return;
+			}
+
+			switch_core_session_t* sessionToTransfer=switch_core_session_locate(pConnectionToTransfer->strUUID.c_str());
+			if(!sessionToTransfer)
+			{
+				switch_mutex_unlock(m_mutex);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::SingleStepTransferCall: Session %s not found.",pConnectionToTransfer->strUUID.c_str());
+				UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidDeviceID); 
+				sender->SendMsg(&err);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::SingleStepTransferCall: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+				return;
+			}
+
+			if(switch_ivr_session_transfer(sessionToTransfer,pRequest->GetTransferredTo().GetCallNr().c_str(),NULL,NULL)==SWITCH_STATUS_SUCCESS)
+			{
+				SingleStepTransferCallResponse resp(pRequest->GetInvokeID(),ConnectionID(pRequest->GetTransferredTo(),pCall->strUUID));
+				sender->SendMsg(&resp);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::SingleStepTransferCall: Response sent with InvokeID: %d\n:%s\n",resp.GetInvokeID(), resp.GetReadable().c_str());
+			}
+			else
+			{
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::SingleStepTransferCall: switch_ivr_session_transfer failed.");
+				UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,genericError); 
+				sender->SendMsg(&err);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::SingleStepTransferCall: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+			}
+			switch_core_session_rwunlock(sessionToTransfer);
+		}
+	}
+
+	//TODO: send transferred event
+	pTransferringDevice->DeleteConnection(pCall);
+	
+	switch_mutex_unlock(m_mutex);
+}
+
+void FreeSWITCH::DeflectCall(CISession* sender,DeflectCallRequest* pRequest)
+{
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::DeflectCall: Request with InvokeID: %d\n:%s\n",pRequest->GetInvokeID(), pRequest->GetReadable().c_str());
+
+	switch_mutex_lock(m_mutex);
+
+	FreeSwitchCall* pCall=GetCall(pRequest->GetCallToBeDiverted().GetCallID().c_str());	
+	if(!pCall)		
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::DeflectCall: CallID %s not found.",pRequest->GetCallToBeDiverted().GetCallID().c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidCallID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::DeflectCall: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+
+	//Retrieving the device that initiates the transfer
+	FreeSwitchDevice * pTransferringDevice=pCall->GetDevice(pRequest->GetCallToBeDiverted().GetDeviceID()->GetCallNr());	
+	if(!pTransferringDevice)
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::DeflectCall: Device %s not found.",pRequest->GetCallToBeDiverted().GetDeviceID()->GetCallNr().c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidDeviceID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::DeflectCall: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+
+	for(MapStr2Device::iterator it=pCall->devices.begin();it!=pCall->devices.end();it++)
+	{
+		if(it->second!=pTransferringDevice)	
+		{
+			FreeSwitchConnection* pConnectionToTransfer=it->second->FindConnection(pCall);
+			if(!pConnectionToTransfer)
+			{
+				switch_mutex_unlock(m_mutex);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::DeflectCall: Connection %s/%s not found.",it->second->GetDeviceID().c_str(),pRequest->GetCallToBeDiverted().GetCallID().c_str());
+				UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidDeviceID); 
+				sender->SendMsg(&err);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::DeflectCall: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+				return;
+			}
+
+			switch_core_session_t* sessionToTransfer=switch_core_session_locate(pConnectionToTransfer->strUUID.c_str());
+			if(!sessionToTransfer)
+			{
+				switch_mutex_unlock(m_mutex);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::DeflectCall: Session %s not found.",pConnectionToTransfer->strUUID.c_str());
+				UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidDeviceID); 
+				sender->SendMsg(&err);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::DeflectCall: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+				return;
+			}
+
+			if(switch_ivr_session_transfer(sessionToTransfer,pRequest->GetNewDestination().GetCallNr().c_str(),NULL,NULL)==SWITCH_STATUS_SUCCESS)
+			{
+				DeflectCallResponse resp(pRequest->GetInvokeID());
+				sender->SendMsg(&resp);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::DeflectCall: Response sent with InvokeID: %d\n:%s\n",resp.GetInvokeID(), resp.GetReadable().c_str());
+			}
+			else
+			{
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::DeflectCall: switch_ivr_session_transfer failed.");
+				UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,genericError); 
+				sender->SendMsg(&err);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::DeflectCall: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+			}
+			switch_core_session_rwunlock(sessionToTransfer);
+		}
+	}
+
+	//TODO: send transferred event
+	pTransferringDevice->DeleteConnection(pCall);
+	
+	switch_mutex_unlock(m_mutex);
+}
+
+void FreeSWITCH::ClearConnection(CISession* sender, ClearConnectionRequest* pRequest)
+{
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::ClearConnection: Request with InvokeID: %d\n:%s\n",pRequest->GetInvokeID(), pRequest->GetReadable().c_str());
+
+	switch_mutex_lock(m_mutex);
+
+	FreeSwitchCall* pCall=GetCall(pRequest->GetConnectionToBeCleared().GetCallID().c_str());	
+	if(!pCall)		
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::ClearConnection: CallID %s not found.",pRequest->GetConnectionToBeCleared().GetCallID().c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidCallID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::ClearConnection: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+
+	//Retrieving the device that initiates the transfer
+	FreeSwitchDevice * pDevice=pCall->GetDevice(pRequest->GetConnectionToBeCleared().GetDeviceID()->GetCallNr());	
+	if(!pDevice)
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::ClearConnection: Device %s not found.",pRequest->GetConnectionToBeCleared().GetDeviceID()->GetCallNr().c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidDeviceID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::ClearConnection: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+
+	FreeSwitchConnection* pConnection=pDevice->FindConnection(pCall);
+	if(!pConnection)
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::ClearConnection: Connection %s/%s not found.",pDevice->GetDeviceID().c_str(),pRequest->GetConnectionToBeCleared().GetCallID().c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidDeviceID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::ClearConnection: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+
+	switch_core_session_t* session=switch_core_session_locate(pConnection->strUUID.c_str());
+	if(!session)
+	{
+		switch_mutex_unlock(m_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::ClearConnection: Session %s not found.",pConnection->strUUID.c_str());
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,invalidDeviceID); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::ClearConnection: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+		return;
+	}
+
+	switch_channel_t *channel = switch_core_session_get_channel(session);	
+
+	if(switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING)==CS_HANGUP)
+	{
+		ClearConnectionResponse resp(pRequest->GetInvokeID());
+		sender->SendMsg(&resp);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::ClearConnection: Response sent with InvokeID: %d\n:%s\n",resp.GetInvokeID(), resp.GetReadable().c_str());
+	}
+	else
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "FreeSWITCH::ClearConnection: switch_ivr_session_transfer failed.");
+		UniversalErrorResponse err(pRequest->GetInvokeID(),error_type_operation,genericError); 
+		sender->SendMsg(&err);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FreeSWITCH::ClearConnection: Response sent with InvokeID: %d\n:%s\n",err.GetInvokeID(), err.GetReadable().c_str());
+	}
+	switch_core_session_rwunlock(session);
+	switch_mutex_unlock(m_mutex);
+}
\ No newline at end of file

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCH.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCH.h (from rev 16612, freeswitch/trunk/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCH.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCH.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCH.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,248 @@
+/* 
+ * CSTA interface for FreeSWICH 
+ * Copyright (C) 2009, Szentesi Krisztian <sz.krisz@freemail.hu>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is CSTA interface for FreeSWICH   
+ *
+ * The Initial Developer of the Original Code is
+ * Szentesi Krisztian <sz.krisz@freemail.hu>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Szentesi Krisztian <sz.krisz@freemail.hu>
+ *
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ */
+
+#ifndef CI_FREE_SWITCH_H
+#define CI_FREE_SWITCH_H
+
+#include "CICTIHandler.h"
+#include "CISession.h"
+#include "CSTAEvent.h"
+#include <map>
+#include <list>
+#include <string>
+
+
+using namespace std;
+
+
+
+class FreeSwitchCall;
+
+enum eDirection
+{
+	direction_incoming,	//!< attached device is the called (on internal subscriber) or call is incoming (on network interface)
+	direction_outgoing, //!< attached device is the caller (on internal subscriber) or call is outgoing (on network interface)
+};
+
+class FreeSwitchConnection
+{
+public:
+	FreeSwitchCall* pCall;
+	string strUUID;					//<! Unique ID of the connection (could be different from the call's unique ID)
+	eLocalConnectionState state;	//!< Local connection state
+	eDirection	direction;			//!< direction of the call	
+	string strChannel;				//!< channel name
+};
+
+typedef map<FreeSwitchCall*,FreeSwitchConnection*> MapCall2Connection;
+typedef map<string, CISession*> MapStr2Session;
+
+enum FreeSwitchDeviceType
+{
+	type_internal_subscriber=0,
+	type_network_interface,
+	type_queue,
+	type_unknown,
+};
+
+class FreeSwitchDevice
+{
+protected:
+	string m_strDevice;	
+	MapStr2Session m_MonitoringSessions;				//!< Sessions monitoring this device
+
+	FreeSwitchDeviceType m_deviceType;
+
+	bool m_bIsMakeCallOriginator;					
+public:
+	static std::string Channel2Device(const char* channel);	
+	
+	static char * Type2Prefix(FreeSwitchDeviceType type);
+	
+	//! finds out FreeSWITCH device type of CSTA DeviceID object
+	/*!
+		CSTA devices with type "dialingNumber" will mapped to internal subscribers (Note, that in some cases, 
+		the implementation will ignore the type field in CSTA devices and interprets the CallNr as a dial string, 
+		e.g in MakeCall request the device type is checked for callingDevice but not for calledDirectoryNumber).
+
+		CSTA devices with type "deviceNumber" are used to represent non subscriber type entities. 
+		For FreeSWITCH implementation, the number string begins with 2 byte long device 
+		type identifier and a device identifier. The device identifier must only contain numeric characters
+
+		Current device type prefixes:
+		"02" - Queue
+
+		\sa queue_function
+	*/
+	static FreeSwitchDeviceType Device2Type(DeviceID device);
+public:
+	MapCall2Connection connections;	//!< Active connections of this device
+
+	FreeSwitchDevice(const char* pcDevice, FreeSwitchDeviceType deviceType=type_internal_subscriber);
+
+	string& GetDeviceID() {return m_strDevice;}
+
+	bool IsMonitoredWithID(string crossRefID);
+	
+	bool AddMonitor(CISession* session, string crossRefID);
+
+	bool RemoveMonitor(CISession* session);
+
+	bool RemoveMonitor(CISession* session, string crossRefID);
+
+	bool IsMonitored() {return m_MonitoringSessions.size()>0?true:false;}
+
+	FreeSwitchConnection* FindConnection(const char* uuid);
+
+	FreeSwitchConnection* FindConnection(FreeSwitchCall* pCall);
+
+	FreeSwitchConnection* AddConnection(const char* uuid, const char * channel, FreeSwitchCall* pCall, eDirection direction);
+
+	void DeleteConnection(FreeSwitchCall* pCall);
+
+	//! Sends CSTA event to all sessions monitoring the device
+	void SendEvent(CSTAEvent* pEvent);
+
+	FreeSwitchDeviceType GetDeviceType() {return m_deviceType;}
+
+	int GetConnectionCount() {return connections.size();}
+
+	bool IsMakeCallOriginator() {return m_bIsMakeCallOriginator;}
+
+	void SetMakeCallOriginator (bool bMakeCallOriginator) {m_bIsMakeCallOriginator=bMakeCallOriginator;}
+};
+
+typedef map<string,FreeSwitchDevice*> MapStr2Device;
+typedef map<string,FreeSwitchCall*> MapStr2Call;
+
+class FreeSwitchCall
+{
+public:
+	string strUUID;					//!< Unique ID (used for CSTA CallID) - the FreeSWITCH unique ID of the first connection in the call.
+	MapStr2Device devices;	
+
+	FreeSwitchDevice* GetDevice(std::string strDeviceID);
+};
+
+
+
+
+//! CSTA Inside CICTIHandler interface realization for FreeSWITCH.
+/*!
+Provides FreeSWITCH specific telephony methods to used by CSTA Inside.
+*/
+class FreeSWITCH : public CICTIHandler
+{
+protected:
+	 MapStr2Device m_DeviceMap;			//!< Stores the known devices. Map key is the device id (usually the dialing number)
+	 MapStr2Call m_CallMap;				//!< Stores the active calls. Map key is the call ID (1st FreeSWITCH UUID)
+	 switch_mutex_t *m_mutex;			//!< To protect the device and call map
+	 switch_memory_pool_t * m_pool;
+
+	 int m_nLastXRefID;
+
+	 bool FindCallerCalled(const char* uuid, string* pstrCaller, string* pstrCalled);
+
+	 bool PrepareCallData(const char* uuid, const char* uuid2, const char* channel, FreeSwitchDevice** ppDevice, FreeSwitchCall** ppCall, FreeSwitchConnection** ppConnection, bool bCreateCall, FreeSwitchDevice** ppQueue, FreeSwitchDevice** ppInboundNID, FreeSwitchDevice** ppOutboundNID, string* pstrCaller, string* pstrCalled);
+
+public:
+	FreeSWITCH(switch_memory_pool_t *pool);
+
+	virtual ~FreeSWITCH();
+
+	FreeSwitchDevice * PrepareDevice(const char * pcDevice, FreeSwitchDeviceType type=type_internal_subscriber);
+
+	FreeSwitchCall* GetCall(const char * pcUUID);
+
+	bool IsXRefIDUsed(string crossRefID);	//!< Returns true if given XRefID already used in the current CTI handler
+
+	string GetNextXRefID();	//!< Returns the next available monitor cross reference ID	
+
+//Switch event handlers:
+	void OnChannelCreate(switch_event_t *event);	//!< Handling CHANNEL_CREATE FreeSwitch event
+
+	void OnChannelHangup(switch_event_t *event);	//!< Handling CHANNEL_HANGUP FreeSwitch event
+
+	void OnChannelAnswer(switch_event_t *event);	//!< Handling CHANNEL_ANSWER FreeSwitch event
+
+	void OnProgress(switch_event_t *event);			//!< Handling CHANNEL_PROGRESS_MEDIA and CHANNEL_PROGRESS events
+
+	void OnDtmf(switch_event_t *event);				//!< Handling DTMF FreeSWITCH event
+	
+	void OnCallQueued(const char* queue, switch_core_session_t *session);		//!< Handling incoming call on queue
+
+	void OnCallNetworkIncoming(const char* trunk, switch_core_session_t *session);		//!< Handling incoming call on a gateway
+
+	void OnCallNetworkOutgoing(const char* trunk, switch_core_session_t *session);		//!< Handling outgoing call on a gateway
+
+	void OnPlayback(switch_event_t *event);			//!< Handling playback application start or stop
+
+	void OnRecord(switch_event_t *event);			//!< Handling record application start or stop
+
+//Session event handlers:
+
+	void OnSessionFinished(CISession* sender);		//!< Called if given session is disconnected
+
+	void MonitorStart(CISession* sender, MonitorStartRequest* pRequest);	//!< called if a Monitor Start request should be processed
+
+	void SnapshotDevice(CISession* sender, SnapshotDeviceRequest* pRequest);	//!< Called if Snapshot Device request is received
+
+	void SnapshotCall(CISession* sender, SnapshotCallRequest* pRequest);	//!< Called if Snapshot Call request is received
+
+	
+	void MakeCall(CISession* sender, MakeCallRequest* pRequest);		//!< Called if Make Call request is received
+
+	void AnswerCall(CISession* sender, AnswerCallRequest* pRequest);	//!< Called if Answer Call request is received
+
+	void PlayMessage(CISession* sender, PlayMessageRequest* pRequest);	//!< Called if Play Message request is received
+
+	void RecordMessage(CISession* sender, RecordMessageRequest* pRequest);	//!< Called if Record Message request is received
+
+	void StopMessage(CISession* sender, StopRequest* pRequest);				//!< Called if Stop request is received
+
+	void SingleStepTransferCall(CISession* sender,SingleStepTransferCallRequest* pRequest);	//!< Called if Single Step Transfer Call Message request is received
+
+	void ClearConnection(CISession* sender,ClearConnectionRequest* pRequest);
+
+	void DeflectCall(CISession* sender,DeflectCallRequest* pRequest);	//!< Called if Deflect Call Message request is received
+};
+
+#endif	//CI_FREE_SWITCH_H
\ No newline at end of file

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCHPlatform.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCHPlatform.cpp (from rev 16612, freeswitch/trunk/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCHPlatform.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCHPlatform.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCHPlatform.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,72 @@
+/* 
+ * CSTA interface for FreeSWICH 
+ * Copyright (C) 2009, Szentesi Krisztian <sz.krisz@freemail.hu>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is CSTA interface for FreeSWICH   
+ *
+ * The Initial Developer of the Original Code is
+ * Szentesi Krisztian <sz.krisz@freemail.hu>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Szentesi Krisztian <sz.krisz@freemail.hu>
+ *
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ */
+
+#include "FreeSWITCHPlatform.h"
+#include "switch.h"
+
+
+FreeSWITCHPlatform::FreeSWITCHPlatform(void)
+{
+}
+
+FreeSWITCHPlatform::~FreeSWITCHPlatform(void)
+{
+}
+
+void FreeSWITCHPlatform::Trace(ci_trace_level loglevel, const char *fmt, ...)
+{
+	switch_log_level_t fsloglevel=SWITCH_LOG_ALERT;
+	switch (loglevel)
+	{
+	case CI_LLV_FATAL: fsloglevel=SWITCH_LOG_ALERT;break;
+	case CI_LLV_ERROR: fsloglevel=SWITCH_LOG_ERROR;break;
+	case CI_LLV_WARN: fsloglevel=SWITCH_LOG_WARNING;break;
+	case CI_LLV_INFO: fsloglevel=SWITCH_LOG_NOTICE;break;
+	case CI_LLV_DEBUG: fsloglevel=SWITCH_LOG_DEBUG;break;
+	}
+	
+	va_list ap;
+	va_start(ap, fmt);
+	
+
+	switch_log_vprintf(SWITCH_CHANNEL_LOG, fsloglevel, fmt, ap);	
+	va_end(ap);
+}
\ No newline at end of file

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCHPlatform.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCHPlatform.h (from rev 16612, freeswitch/trunk/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCHPlatform.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCHPlatform.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCHPlatform.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,62 @@
+/* 
+ * CSTA interface for FreeSWICH 
+ * Copyright (C) 2009, Szentesi Krisztian <sz.krisz@freemail.hu>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is CSTA interface for FreeSWICH   
+ *
+ * The Initial Developer of the Original Code is
+ * Szentesi Krisztian <sz.krisz@freemail.hu>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Szentesi Krisztian <sz.krisz@freemail.hu>
+ *
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ */
+
+
+#ifndef CI_FREE_SWITCH_PLATFORM_H
+#define CI_FREE_SWITCH_PLATFORM_H
+
+#include "CIPlatform.h"
+
+//! CSTA Inside CIPlatform interface realization for FreeSWITCH.
+/*!
+Provides FreeSWITCH platform specific OS/XML/... methods required by by CSTA Inside.
+*/
+class FreeSWITCHPlatform : public CIPlatform
+{
+public:
+	FreeSWITCHPlatform();
+
+	virtual ~FreeSWITCHPlatform();
+
+	virtual void Trace(ci_trace_level loglevel, const char *fmt, ...);
+};
+
+#endif	//CI_FREE_SWITCH_PLATFORM_H
\ No newline at end of file

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCHSocket.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCHSocket.cpp (from rev 16612, freeswitch/trunk/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCHSocket.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCHSocket.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCHSocket.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,98 @@
+/* 
+ * CSTA interface for FreeSWICH 
+ * Copyright (C) 2009, Szentesi Krisztian <sz.krisz@freemail.hu>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is CSTA interface for FreeSWICH   
+ *
+ * The Initial Developer of the Original Code is
+ * Szentesi Krisztian <sz.krisz@freemail.hu>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Szentesi Krisztian <sz.krisz@freemail.hu>
+ *
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ */
+
+
+#include "FreeSwitchSocket.h"
+#include <apr_errno.h>
+
+FreeSWITCHSocket::FreeSWITCHSocket(switch_socket_t* pSocket, switch_memory_pool_t *pool) : m_pSocket(pSocket), m_pool(pool)
+{
+	switch_mutex_init(&m_mutex, SWITCH_MUTEX_NESTED, m_pool);
+	switch_socket_opt_set(m_pSocket, SWITCH_SO_TCP_NODELAY, TRUE);
+	switch_socket_opt_set(m_pSocket, SWITCH_SO_NONBLOCK, FALSE);
+
+	char remote_ip[50];
+	switch_sockaddr_t *sa;
+
+	switch_socket_addr_get(&sa, SWITCH_TRUE, m_pSocket);
+	switch_get_addr(remote_ip, sizeof(remote_ip), sa);
+	switch_port_t remote_port = switch_sockaddr_get_port(sa);
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Connection Open from %s:%d\n", remote_ip, remote_port);
+}
+
+FreeSWITCHSocket::~FreeSWITCHSocket()
+{
+	switch_mutex_destroy(m_mutex);
+}
+
+int FreeSWITCHSocket::Receive(unsigned char *buf, size_t *len) 
+{
+	switch_status_t status=switch_socket_recv(m_pSocket, (char*)buf, len);
+	if(status)
+	{
+		char errbuf[4096];
+		switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_NOTICE,"Receive: socket terminated: %d (%s)",status, apr_strerror(status,errbuf,sizeof(errbuf)));
+	}
+	else
+		switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_NOTICE,"%d bytes received:\n%s",*len, buf);
+	return status;
+}	
+
+int FreeSWITCHSocket::Send(const unsigned char *buf, size_t *len) 
+{
+	switch_mutex_lock(m_mutex);
+	switch_status_t status=switch_socket_send(m_pSocket, (const char*)buf, len);
+	if(status)
+	{
+		char errbuf[4096];
+		switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_NOTICE,"Send: socket terminated: %d (%s)",status, apr_strerror(status,errbuf,sizeof(errbuf)));
+	}
+	switch_mutex_unlock(m_mutex);
+	return status;
+}
+
+int FreeSWITCHSocket::Close()
+{
+	switch_socket_shutdown(m_pSocket, SWITCH_SHUTDOWN_READWRITE);
+	switch_socket_close(m_pSocket);	
+	return 0;
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCHSocket.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCHSocket.h (from rev 16612, freeswitch/trunk/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCHSocket.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCHSocket.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCHSocket.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,71 @@
+/* 
+ * CSTA interface for FreeSWICH 
+ * Copyright (C) 2009, Szentesi Krisztian <sz.krisz@freemail.hu>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is CSTA interface for FreeSWICH   
+ *
+ * The Initial Developer of the Original Code is
+ * Szentesi Krisztian <sz.krisz@freemail.hu>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Szentesi Krisztian <sz.krisz@freemail.hu>
+ *
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ */
+
+
+#ifndef CI_FREE_SWITCH_SOCKET_H
+#define CI_FREE_SWITCH_SOCKET_H
+
+#include "CISocket.h"
+#include "switch.h"
+
+//! CSTA Inside CISocket interface realization for FreeSWITCH.
+/*!
+Provides FreeSWITCH platform specific socket manipulation methods required by CSTA Inside.
+*/
+class FreeSWITCHSocket : public CISocket
+{
+protected:
+	switch_socket_t* m_pSocket;
+	switch_mutex_t *m_mutex;
+	switch_memory_pool_t* m_pool;
+public:
+	FreeSWITCHSocket(switch_socket_t* pSocket, switch_memory_pool_t *pool);
+
+	virtual ~FreeSWITCHSocket();
+
+	virtual int Receive(unsigned char *buf, size_t *len);	
+
+	virtual int Send(const unsigned char *buf, size_t *len);
+
+	virtual int Close();
+};
+
+#endif	//CI_FREE_SWITCH_SOCKET_H

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCH_CSTA.rc

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCH_CSTA.rc (from rev 16612, freeswitch/trunk/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCH_CSTA.rc) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCH_CSTA.rc	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/FreeSWITCH_CSTA.rc	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,115 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Hungarian resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_HUN)
+#ifdef _WIN32
+LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT
+#pragma code_page(1250)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE 
+BEGIN
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE 
+BEGIN
+    "\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+#endif    // Hungarian resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 0,2,0,92
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040e04b0"
+        BEGIN
+            VALUE "Comments", "http://cstainside.sourceforge.net/"
+            VALUE "FileDescription", "CSTA interface for FreeSWITCH"
+            VALUE "FileVersion", "0, 2, 0, 92"
+            VALUE "InternalName", "mod_csta_socket"
+            VALUE "LegalCopyright", "Copyright (C) 2009, Szentesi Krisztian <sz.krisz@freemail.hu>"
+            VALUE "LegalTrademarks", "Licensed under MPL 1.1"
+            VALUE "OriginalFilename", "mod_csta_socket.dll"
+            VALUE "ProductName", "CSTA Inside"
+            VALUE "ProductVersion", "1, 0, 0, 1"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x40e, 1200
+    END
+END
+
+#endif    // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/README

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/README (from rev 16612, freeswitch/trunk/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/README) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/README	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/README	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,192 @@
+                              mod_csta_socket - CSTA interface for FreeSWITCH
+                            
+    
+1. Capabilities
+   
+As a communication & encoding interface CSTA XML over TCP without SOAP is supported yet (ECMA-323 Annex J-2).
+Module is based on CSTA Inside library.
+
+Supported device types:
+
+1.1. internal subscribers
+- internal subscribers are mapped to CSTA "dialingNumber" type of devices. The dialing sequence is the 
+phone number without any leading characters
+
+1.2 queues
+Queues are able to enqueue multiple calls. To configure a CSTA queue, add the csta_trigger_queue application 
+to a dialplan entry:
+
+<action application="csta_trigger_queue" data="9500"/>
+
+Data is the name of the queue. In CSTA events and requeust, the queue will be referenced as a device with type 
+of "deviceNumber". The callNr will be concatenated with a type ID of "02" and the queue name (029500 on the above example).
+Queue name should be numeric to comply with CSTA standard.
+
+1.3 network interfaces
+Network interfaces or trunks representing devices via calls can leave or enter the CSTA subdomain.
+To configure CSTA NIDs, add the csta_trigger_trunk_inbound and csta_trigger_trunk_outbound application
+to the corresponding dialplan entry (if a call is directed to a gateway or external call directed into FreeSWITCH):
+
+outgoing example:
+
+<extension name="outbound_example">
+	<condition field="destination_number" expression="^20(.*)$">
+		<action application="csta_trigger_trunk_outbound" data="20"/>		
+		<action application="bridge" data="sofia/gateway/example_gw/$1"/>
+	</condition>
+</extension> 
+
+incoming example:
+
+<extension name="inbound_example">
+	<condition field="destination_number" expression="^193190$">       
+		 <action application="csta_trigger_trunk_inbound" data="20"/>
+		 <action application="set" data="domain_name=$${domain}"/>      
+		 <action application="transfer" data="9500 XML default"/>
+	</condition>
+ </extension>  
+ 
+Data is the name of the queue. In CSTA events and requeust, the NID will be referenced as a device with type 
+of "deviceNumber". The callNr will be concatenated with a type ID of "01" and the NID name (0120 on the above example).
+NID name should be numeric to comply with CSTA standard. 
+
+The following CSTA messages are implemented:
+
+requests and responses:
+- Monitor Start
+  Starts monitoring of a device. 
+  Supported types: internal subscriber, queue, NID
+
+- Make Call
+  Originates a call to an extension
+  Supported types: callingDevice: internal subscriber 
+                   calledDirectoryNumber: any extension, used as dialing string
+  Do Not Prompt (auto originate) option works only with devices supporting sip_auto_answer flag
+  
+- Answer Call
+  Answers a ringing call
+  Supported Types: queue
+  
+- Single Step Transfer Call
+  Transfers a connection to another endpoint without hold & consultation
+  Supported types: activeCall: internal subscriber, queue.
+                   transferredTo: any extension, used as dialing string.
+  
+- Play Message
+  Plays a wavefile for a connected connection. Wavefile path relative to "/sounds/en/us/callie" is to specify in 
+  messageToBePlayed parameter. If positive response is returned, check Stop event for result of the service.
+  Supported types: internal subscriber, queue
+  
+- Record Message
+  Records a connection to a wavefile. Filename is generated by the service and returned (with full path) in the response.
+  Supported types: internal subscriber, queue
+  
+- Stop
+  Stops playing or recording of a wavefile. 
+  Supported types: internal subscriber, queue
+  
+- Clear Connection
+  Clears an active connection. 
+  Supported types: internal subscriber, queue, NID
+  
+- Snapshot Device
+  Returns the active connections of a device. 
+  Supported types: internal subscriber, queue, NID
+  
+- Snapshot Call
+  Returns the devices participating in an active call. 
+  Supported types: internal subscriber, queue, NID
+
+- Deflect Call
+  Transfers a connection to another endpoint 
+  Supported types: callToBeDiverted: internal subscriber, queue.
+                   newDestination: any extension, used as dialing string.
+
+events:
+- Service Initiated
+  Generated if an outbound channel is created from a device
+  Supported types: internal subscriber, network interface
+  
+- Originated
+  Generated from the caller if call is delivered
+  Supported types: internal subscriber
+  
+- Delivered
+  Generated if call is delivered to called party
+  Supported types: internal subscriber
+
+- Established
+  Generated if channel is answered
+  Supported types: internal subscriber, queue, network interface
+
+- Connection Cleared
+  Generated if a device leaves a call
+  Supported types: internal subscriber, queue, network interface
+
+- Queued
+  Generated if a call enters a queue
+  Supported types: internal subscriber, queue,  network interface
+  
+- DTMF Detected
+  Generated if a DTMF tone is detected on a connected connection
+  Supported types: internal subscriber, queue (if a device connected to a queue generates a tone), network interface
+  Note: On queues FreeSWITCH only detects DTMF if acoustic conection is on. 
+  Workaround: add <action application="playback" data="silence_stream://1800000"/> after queue is answered to queue dialplan.
+  
+- Play
+  Generated if playback application is started.
+  The "message" field contains the soundfile relative path.
+
+- Record
+  Generated if record application is started.
+  The "message" field contains the soundfile relative path.
+
+- Stop     
+  Generated if playback or record application is stopped.
+  The "message" field contains the soundfile relative path. The "cause" field is set to "endOfMessageDetected" if 
+  file played successfully or stop service is invoked, "resourcesNotAvailable" if file not found, and "blocked" if playback failed from any other reason.
+  For recording "messageDurationExceeded" cause is used if record stopped after recording length reached maxDuration or stop service is invoked.
+  If recording stopped because of hangup, no Stop event will be generated, only Connection Cleared. 
+  
+                            
+2. Building from source
+
+For Win32 platform Visual Studio 2008 project file is included. Use only Release configuration. 
+
+Requirements:
+- CSTA Inside Core - Multi-purpose C++ CSTA-XML library 
+  download from: http://cstainside.sourceforge.net/
+  place to: <root>\CSTAInsideCore (project file expects ..\CSTAInsideCore directory)
+- FreeSWITCH
+  download from: http://wiki.freeswitch.org/wiki/Installation_Guide#Download_Source_Tarball
+  place to: <root>\3rdparty\freeswitch-snapshot
+
+Both must be build before building mod_csta_socket
+
+3. Usage
+
+mod_csta_socket.dll is placed to <root>\3rdparty\freeswitch-snapshot\Release\mod directory. To load use load 
+FreeSWITCH command or set automatic load in modules.conf.xml
+
+4. Configuration
+
+module reads configuration data from csta_socket.conf.xml file under <freeswitch>\conf\autoload_configs directory.
+
+Example:
+<configuration name="csta_socket.conf" description="CSTA Interface">
+  <settings>        
+    <param name="listen-ip" value="127.0.0.1"/>
+    <param name="xml-listen-port" value="3000"/>
+    <param name="apply-inbound-acl" value="csta"/>
+  </settings>
+</configuration>
+
+listen-ip:          the IP address of interface to listen on. 0.0.0.0 specifies to listen on all interfaces.
+                    default: 127.0.0.1
+xml-listen-port:    the listening port for CSTA-XML over TCPinterface.
+                    default: 3000
+apply-inbound-acl:  the name of ACL entry configured in acl.conf to filter inbound connections.
+                    default: empty (no ACL applied)
+
+
+Copyright (C) 2009, Szentesi Krisztian <sz.krisz@freemail.hu>
\ No newline at end of file

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/config.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/config.cpp (from rev 16612, freeswitch/trunk/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/config.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/config.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/config.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,88 @@
+/* 
+ * CSTA interface for FreeSWICH 
+ * Copyright (C) 2009, Szentesi Krisztian <sz.krisz@freemail.hu>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is CSTA interface for FreeSWICH   
+ *
+ * The Initial Developer of the Original Code is
+ * Szentesi Krisztian <sz.krisz@freemail.hu>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Szentesi Krisztian <sz.krisz@freemail.hu>
+ *
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ */
+
+#include <switch.h>
+#include "config.h"
+
+
+/*static*/ Config Config::_instance;
+
+Config::Config()
+{
+	strcpy(listen_address,"127.0.0.1");
+	xml_port=3000;
+	acl_name[0]=0;
+}
+
+bool Config::ReadConfig()
+{
+	
+	char *cf = "csta_socket.conf";
+	switch_xml_t cfg, xml, settings, param;
+
+	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Open of %s failed, using defaults.\n", cf);
+	} else {
+		if ((settings = switch_xml_child(cfg, "settings"))) {
+			for (param = switch_xml_child(settings, "param"); param; param = param->next) {
+				char *var = (char *) switch_xml_attr_soft(param, "name");
+				char *val = (char *) switch_xml_attr_soft(param, "value");
+
+				if (!strcmp(var, "listen-ip"))
+				{
+					strncpy(listen_address,val,sizeof(listen_address));	
+					listen_address[sizeof(listen_address)-1]=0;
+				}
+				else if (!strcmp(var, "xml-listen-port"))
+					xml_port=(switch_port_t)atoi(val);
+				else if (!strcasecmp(var, "apply-inbound-acl")) 
+				{
+					strncpy(acl_name,val,sizeof(acl_name));	
+					acl_name[sizeof(acl_name)-1]=0;
+				}
+			}
+		}
+		switch_xml_free(xml);
+	}
+	
+	return true;
+
+}
\ No newline at end of file

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/config.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/config.h (from rev 16612, freeswitch/trunk/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/config.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/config.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/config.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,73 @@
+/* 
+ * CSTA interface for FreeSWICH 
+ * Copyright (C) 2009, Szentesi Krisztian <sz.krisz@freemail.hu>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is CSTA interface for FreeSWICH   
+ *
+ * The Initial Developer of the Original Code is
+ * Szentesi Krisztian <sz.krisz@freemail.hu>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Szentesi Krisztian <sz.krisz@freemail.hu>
+ *
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ */
+
+#ifndef CI_FS_CONFIG_H
+#define CI_FS_CONFIG_H
+
+
+//! Stores module configuration and processes module configuration file.
+class Config
+{
+protected:
+	static Config _instance;
+public:
+	static Config* Instance() {return &_instance;}
+protected:
+	char listen_address[50];
+	switch_port_t xml_port;
+	char acl_name[50];
+protected:
+	Config();
+public:
+	bool ReadConfig();
+
+	const char* GetListenAddress() {return listen_address;}
+
+	const switch_port_t GetXmlPort() {return xml_port;}
+
+	bool IsACLEnabled() {return acl_name[0]==0?false:true;}
+
+	const char* GetACLName() {return acl_name;}
+};
+
+
+
+#endif //CI_FS_CONFIG_H

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/mod_csta_socket.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/mod_csta_socket.cpp (from rev 16612, freeswitch/trunk/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/mod_csta_socket.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/mod_csta_socket.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/mod_csta_socket.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,476 @@
+/* 
+ * CSTA interface for FreeSWICH 
+ * Copyright (C) 2009, Szentesi Krisztian <sz.krisz@freemail.hu>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is CSTA interface for FreeSWICH   
+ *
+ * The Initial Developer of the Original Code is
+ * Szentesi Krisztian <sz.krisz@freemail.hu>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Szentesi Krisztian <sz.krisz@freemail.hu>
+ *
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ */
+
+/*! \file mod_csta_socket.cpp
+\brief PBX module interface implementation for FreeSWITCH.
+
+Provides interface functions to allow integrate the module to FreeSWITCH 
+*/
+
+
+#include <switch.h>
+
+#include "FreeSwitch.h"
+#include "FreeSwitchPlatform.h"
+#include "FreeSwitchSocket.h"
+#include "XMLSession.h"
+#include "config.h"
+#include "UniversalErrorResponse.h"
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_csta_socket_load);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_csta_socket_shutdown);
+SWITCH_MODULE_RUNTIME_FUNCTION(mod_csta_socket_runtime);
+SWITCH_MODULE_DEFINITION(mod_csta_socket, mod_csta_socket_load, mod_csta_socket_shutdown, mod_csta_socket_runtime);
+
+static volatile bool bRunning=true;
+
+FreeSWITCH* fs=NULL;
+FreeSWITCHPlatform* platform=NULL;
+
+
+struct THREAD_INFO
+{
+	switch_memory_pool_t *pool;
+	switch_socket_t* socket;
+};
+
+
+switch_socket_t* listen_socket=NULL;
+switch_event_node_t *node=NULL;
+
+
+//! Called if a call hits a queue
+/*!
+	Called if call enters into a queue. Queues should be defined in dialplan 
+	default section with csta_trigger_queue application triggered.
+	\param session The FreeSWITCH session
+	\param data	The queue name set in dialplan (data parameter of csta_trigger_queue application)
+	
+	Example configuration:	
+
+   <extension name="example_queue">
+      <condition field="destination_number" expression="^9500$">  
+          <action application="ring_ready"/>
+          <action application="csta_trigger_queue" data="9500"/>
+          <action application="sleep" data="600000"/>
+      </condition>      
+   </extension> 
+
+   Note that queue name must only contain numeric characters to fit CSTA standard
+*/
+SWITCH_STANDARD_APP(queue_function)
+{
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Queue triggered, queue: %s, call:%s!\n", data, switch_core_session_get_uuid(session));
+	fs->OnCallQueued(data, session); 
+}
+
+
+//! Called if a call enters FreeSWITCH from outside
+/*!
+	Called if a call enters FreeSWITCH from outside. Incoming CSTA Network interfaces should be defined in dialplan 
+	public section with csta_trigger_trunk_inbound application triggered.
+	\param session The FreeSWITCH session
+	\param data	The NID name set in dialplan (data parameter of csta_trigger_trunk_inbound application)
+	
+	Example configuration:	
+   
+	  <extension name="inbound_example">
+		<condition field="destination_number" expression="^193190$">       
+		  <action application="csta_trigger_trunk_inbound" data="20"/>
+		  <action application="set" data="domain_name=$${domain}"/>      
+		  <action application="transfer" data="9500 XML default"/>
+		</condition>
+	  </extension>  
+
+   Note that NID name must only contain numeric characters to fit CSTA standard
+*/
+SWITCH_STANDARD_APP(trunk_inbound_function)
+{
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Inbound call on trunk %s, call:%s!\n", data, switch_core_session_get_uuid(session));
+	fs->OnCallNetworkIncoming(data, session);
+}
+
+//! Called if a call leaves FreeSWITCH via a gateway
+/*!
+	Called if a call leaves FreeSWITCH via a gateway. Outgoing CSTA Network interfaces should be defined in dialplan 
+	default section with csta_trigger_trunk_outbound application triggered.
+	\param session The FreeSWITCH session
+	\param data	The NID name set in dialplan (data parameter of csta_trigger_trunk_outbound application)
+	
+	Example configuration:	
+   
+	  <extension name="outbound_example">
+		<condition field="destination_number" expression="^20(.*)$">
+			<action application="csta_trigger_trunk_outbound" data="20"/>
+			<action application="set" data="effective_caller_id_number=193190"/>
+			<action application="bridge" data="sofia/gateway/example_gw/$1"/>
+		</condition>
+	  </extension> 
+
+   Note that NID name must only contain numeric characters to fit CSTA standard
+*/
+SWITCH_STANDARD_APP(trunk_outbound_function)
+{
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Outbound call on trunk %s, call:%s!\n", data, switch_core_session_get_uuid(session));
+	fs->OnCallNetworkOutgoing(data, session);
+}
+
+static void event_handler(switch_event_t *event)
+{
+	
+	switch(event->event_id)
+	{
+	case SWITCH_EVENT_CUSTOM:
+		break;
+	case SWITCH_EVENT_CLONE:
+		break;
+	case SWITCH_EVENT_CHANNEL_CREATE:
+		fs->OnChannelCreate(event);
+		break;
+	case SWITCH_EVENT_CHANNEL_DESTROY:
+		break;
+	case SWITCH_EVENT_CHANNEL_STATE:
+		break;
+	case SWITCH_EVENT_CHANNEL_ANSWER:
+		fs->OnChannelAnswer(event);
+		break;
+	case SWITCH_EVENT_CHANNEL_HANGUP:
+		fs->OnChannelHangup(event);
+		break;
+	case SWITCH_EVENT_CHANNEL_EXECUTE:		
+	case SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE:
+		{
+			const char* app=switch_event_get_header(event, "Application");
+			if(app) 
+			{
+				if(strcmp(app,"playback")==0)
+					fs->OnPlayback(event);
+				else
+				if(strcmp(app,"record")==0)
+					fs->OnRecord(event);
+			}
+		}
+		break;
+	case SWITCH_EVENT_CHANNEL_BRIDGE:
+		break;
+	case SWITCH_EVENT_CHANNEL_UNBRIDGE:
+		break;
+	case SWITCH_EVENT_CHANNEL_PROGRESS:		
+	case SWITCH_EVENT_CHANNEL_PROGRESS_MEDIA:
+		fs->OnProgress(event);
+		break;
+	case SWITCH_EVENT_CHANNEL_OUTGOING:
+		break;
+	case SWITCH_EVENT_CHANNEL_PARK:
+		break;
+	case SWITCH_EVENT_CHANNEL_UNPARK:
+		break;
+	case SWITCH_EVENT_CHANNEL_APPLICATION:
+		break;
+	case SWITCH_EVENT_CHANNEL_ORIGINATE:
+		break;
+	case SWITCH_EVENT_CHANNEL_UUID:
+		break;
+	case SWITCH_EVENT_API:
+		break;
+	case SWITCH_EVENT_LOG:
+		break;
+	case SWITCH_EVENT_INBOUND_CHAN:
+		break;
+	case SWITCH_EVENT_OUTBOUND_CHAN:
+		break;
+	case SWITCH_EVENT_STARTUP:
+		break;
+	case SWITCH_EVENT_SHUTDOWN:
+		break;
+	case SWITCH_EVENT_PUBLISH:
+		break;
+	case SWITCH_EVENT_UNPUBLISH:
+		break;
+	case SWITCH_EVENT_TALK:
+		break;
+	case SWITCH_EVENT_NOTALK:
+		break;
+	case SWITCH_EVENT_SESSION_CRASH:
+		break;
+	case SWITCH_EVENT_MODULE_LOAD:
+		break;
+	case SWITCH_EVENT_MODULE_UNLOAD:
+		break;
+	case SWITCH_EVENT_DTMF:
+		fs->OnDtmf(event);
+		break;
+	case SWITCH_EVENT_MESSAGE:
+		break;
+	case SWITCH_EVENT_PRESENCE_IN:
+		break;
+	case SWITCH_EVENT_NOTIFY_IN:
+		break;
+	case SWITCH_EVENT_PRESENCE_OUT:
+		break;
+	case SWITCH_EVENT_PRESENCE_PROBE:
+		break;
+	case SWITCH_EVENT_MESSAGE_WAITING:
+		break;
+	case SWITCH_EVENT_MESSAGE_QUERY:
+		break;
+	case SWITCH_EVENT_ROSTER:
+		break;
+	case SWITCH_EVENT_CODEC:
+		break;
+	case SWITCH_EVENT_BACKGROUND_JOB:
+		break;
+	case SWITCH_EVENT_DETECTED_SPEECH:
+		break;
+	case SWITCH_EVENT_DETECTED_TONE:
+		break;
+	case SWITCH_EVENT_PRIVATE_COMMAND:
+		break;
+	case SWITCH_EVENT_HEARTBEAT:
+		break;
+	case SWITCH_EVENT_TRAP:
+		break;
+	case SWITCH_EVENT_ADD_SCHEDULE:
+		break;
+	case SWITCH_EVENT_DEL_SCHEDULE:
+		break;
+	case SWITCH_EVENT_EXE_SCHEDULE:
+		break;
+	case SWITCH_EVENT_RE_SCHEDULE:
+		break;
+	case SWITCH_EVENT_RELOADXML:
+		break;
+	case SWITCH_EVENT_NOTIFY:
+		break;
+	case SWITCH_EVENT_SEND_MESSAGE:
+		break;
+	case SWITCH_EVENT_RECV_MESSAGE:
+		break;
+	case SWITCH_EVENT_REQUEST_PARAMS:
+		break;
+	case SWITCH_EVENT_CHANNEL_DATA:
+		break;
+	case SWITCH_EVENT_GENERAL:
+		break;
+	case SWITCH_EVENT_COMMAND:
+		break;
+	case SWITCH_EVENT_SESSION_HEARTBEAT:
+		break;
+	case SWITCH_EVENT_CLIENT_DISCONNECTED:
+		break;
+	case SWITCH_EVENT_SERVER_DISCONNECTED:
+		break;
+	case SWITCH_EVENT_SEND_INFO:
+		break;
+	case SWITCH_EVENT_RECV_INFO:
+		break;
+	}
+	
+}
+
+
+static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
+{
+	THREAD_INFO* thread_info=(THREAD_INFO*)obj;
+	
+	FreeSWITCHSocket socket(thread_info->socket,thread_info->pool );
+	XMLSession csta_session(platform, &socket, fs);
+	
+	char remote_ip[50];
+	switch_sockaddr_t *sa;
+	switch_socket_addr_get(&sa, SWITCH_TRUE, thread_info->socket);
+	switch_get_addr(remote_ip, sizeof(remote_ip), sa);	
+	if(		(Config::Instance()->IsACLEnabled())
+		&&	(!switch_check_network_list_ip(remote_ip, Config::Instance()->GetACLName())) )
+	{		
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl \"%s\"\n", remote_ip, Config::Instance()->GetACLName());		
+		UniversalErrorResponse err(0,error_type_security,genericError);
+		csta_session.SendMsg(&err);
+		socket.Close();		
+	}
+	else
+		csta_session.Run();
+
+	delete thread_info;
+	return NULL;
+}
+
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_csta_socket_load)
+{	
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	switch_application_interface_t *app_interface;
+	
+	fs=new FreeSWITCH(pool);
+	platform=new FreeSWITCHPlatform();
+
+	bRunning=true;
+	Config::Instance()->ReadConfig();
+
+	SWITCH_ADD_APP(app_interface, "csta_trigger_queue", "Notifies about call entered a CSTA queue", "Notifies CSTA module about a call entered a CSAT queue.", queue_function, "", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "csta_trigger_trunk_inbound", "Notifies about call entering FreeSWITCH from outside", "Notifies CSTA module about about call entering FreeSWITCH from outside.", trunk_inbound_function, "", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "csta_trigger_trunk_outbound", "Notifies about call leaving FreeSWITCH", "Notifies CSTA module about call leaving FreeSWITCH.", trunk_outbound_function, "", SAF_SUPPORT_NOMEDIA);
+
+	//TODO: filter events
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL, &node) != SWITCH_STATUS_SUCCESS) 
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind to events!\n");
+		return SWITCH_STATUS_GENERR;
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_csta_socket_shutdown)
+{
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Shutting down..\n");
+	bRunning=false;
+	if(listen_socket)
+	{
+		switch_socket_shutdown(listen_socket, SWITCH_SHUTDOWN_READWRITE);
+		switch_socket_close(listen_socket);
+		listen_socket=NULL;
+	}
+
+	switch_event_unbind(&node);
+
+	delete fs;
+	delete platform;
+	fs=NULL;
+	platform=NULL;
+	
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+
+SWITCH_MODULE_RUNTIME_FUNCTION(mod_csta_socket_runtime)
+{
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Starting..\n");
+
+	switch_status_t rv;
+	
+	switch_sockaddr_t *sa;
+	switch_memory_pool_t *pool = NULL, *listener_pool = NULL;
+	switch_socket_t *inbound_socket = NULL;	
+
+	if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) 
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "switch_core_new_memory_pool failed.\n");
+		return SWITCH_STATUS_TERM;
+	}
+
+	rv = switch_sockaddr_info_get(&sa, Config::Instance()->GetListenAddress(), SWITCH_INET, Config::Instance()->GetXmlPort(), 0, pool);
+	if(rv)
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "switch_sockaddr_info_get failed.\n");
+		return SWITCH_STATUS_TERM;
+	}
+	rv = switch_socket_create(&listen_socket, switch_sockaddr_get_family(sa), SOCK_STREAM, SWITCH_PROTO_TCP, pool);
+	if(rv)
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "switch_socket_create failed.\n");
+		return SWITCH_STATUS_TERM;
+	}
+
+	rv = switch_socket_opt_set(listen_socket, SWITCH_SO_REUSEADDR, 1);
+	if (rv)
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "switch_socket_opt_set failed.\n");
+		return SWITCH_STATUS_TERM;
+	}
+	rv = switch_socket_bind(listen_socket, sa);
+	if (rv)
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "switch_socket_bind failed.\n");
+		return SWITCH_STATUS_TERM;
+	}
+	rv = switch_socket_listen(listen_socket, 5);
+	if (rv)
+	{
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "switch_socket_listen failed.\n");
+		return SWITCH_STATUS_TERM;
+	}
+			
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "CSTA-XML socket up listening on %s:%u\n", Config::Instance()->GetListenAddress(),Config::Instance()->GetXmlPort());
+
+	while(bRunning)
+	{
+		if (switch_core_new_memory_pool(&listener_pool) != SWITCH_STATUS_SUCCESS) 
+		{
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH no pool\n");
+			return SWITCH_STATUS_TERM;
+		}
+		
+		if ((rv = switch_socket_accept(&inbound_socket, listen_socket, listener_pool))) {
+			if (!bRunning) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Shutting Down\n");
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error\n");
+			}
+			break;
+		}
+		
+
+		switch_thread_t *thread;
+		switch_threadattr_t *thd_attr = NULL;
+		THREAD_INFO * thread_info=new THREAD_INFO;
+		thread_info->socket=inbound_socket;
+		thread_info->pool=listener_pool;
+
+		switch_threadattr_create(&thd_attr, listener_pool);
+		switch_threadattr_detach_set(thd_attr, 1);
+		switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+		switch_thread_create(&thread, thd_attr, listener_run, thread_info, listener_pool);		
+
+	}
+
+	if(listen_socket)
+	{
+		switch_socket_shutdown(listen_socket, SWITCH_SHUTDOWN_READWRITE);
+		//switch_socket_close(listen_socket);
+		listen_socket=NULL;
+	}
+
+	return SWITCH_STATUS_TERM;
+}
+
+

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/mod_csta_socket.def

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/mod_csta_socket.def (from rev 16612, freeswitch/trunk/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/mod_csta_socket.def) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/mod_csta_socket.def	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/mod_csta_socket.def	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,2 @@
+EXPORTS
+   mod_csta_socket_module_interface
\ No newline at end of file

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/mod_csta_socket.vcproj

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/mod_csta_socket.vcproj (from rev 16612, freeswitch/trunk/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/mod_csta_socket.vcproj) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/mod_csta_socket.vcproj	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/mod_csta_socket.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,353 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9,00"
+	Name="FreeSWITCH_CSTA"
+	ProjectGUID="{05515420-16DE-4E63-B373-85BE859A5142}"
+	RootNamespace="mod_csta_socket"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\..\w32\module_Debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;..\..\..\..\..\src\include&quot;;&quot;..\..\..\..\..\libs\include&quot;;..\CSTAInsideCore\include\csta;..\CSTAInsideCore\include"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="freeswitchcore.lib libapr-1.lib CSTAInsideCore.lib"
+				OutputFile="..\..\..\..\..\$(ConfigurationName)/mod/mod_csta_socket.dll"
+				AdditionalLibraryDirectories="&quot;..\..\..\..\..\w32\library\$(ConfigurationName)\&quot;;&quot;..\..\..\..\..\libs\win32\apr\$(ConfigurationName)\&quot;;..\CSTAInsideCore\lib\VC90"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\..\w32\module_Debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\..\w32\module_Release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="&quot;..\..\..\..\..\src\include&quot;;&quot;..\..\..\..\..\libs\include&quot;;..\CSTAInsideCore\include\csta;..\CSTAInsideCore\include"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="freeswitchcore.lib libapr-1.lib CSTAInsideCore.lib"
+				OutputFile="..\..\..\..\..\$(ConfigurationName)/mod/mod_csta_socket.dll"
+				AdditionalLibraryDirectories="&quot;..\..\..\..\..\w32\library\$(ConfigurationName)\&quot;;&quot;..\..\..\..\..\libs\win32\apr\$(ConfigurationName)\&quot;;..\CSTAInsideCore\lib\VC90"
+				ModuleDefinitionFile="$(InputName).def"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\..\w32\module_Release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Header Files"
+			>
+			<File
+				RelativePath=".\config.h"
+				>
+			</File>
+			<File
+				RelativePath=".\FreeSWITCH.h"
+				>
+			</File>
+			<File
+				RelativePath=".\FreeSWITCHPlatform.h"
+				>
+			</File>
+			<File
+				RelativePath=".\FreeSWITCHSocket.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Source Files"
+			>
+			<File
+				RelativePath=".\config.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\FreeSWITCH.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\FreeSWITCHPlatform.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\FreeSWITCHSocket.cpp"
+				>
+			</File>
+		</Filter>
+		<File
+			RelativePath=".\FreeSWITCH_CSTA.rc"
+			>
+		</File>
+		<File
+			RelativePath=".\mod_csta_socket.cpp"
+			>
+		</File>
+		<File
+			RelativePath=".\mod_csta_socket.def"
+			>
+		</File>
+		<File
+			RelativePath=".\README"
+			>
+		</File>
+		<File
+			RelativePath=".\resource.h"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/resource.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/resource.h (from rev 16612, freeswitch/trunk/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/resource.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/resource.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/FreeSWITCH/resource.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,14 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by FreeSWITCH_CSTA.rc
+
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE        101
+#define _APS_NEXT_COMMAND_VALUE         40001
+#define _APS_NEXT_CONTROL_VALUE         1001
+#define _APS_NEXT_SYMED_VALUE           101
+#endif
+#endif

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/mod_csta_socket.sln

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/mod_csta_socket.sln (from rev 16612, freeswitch/trunk/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/mod_csta_socket.sln) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/mod_csta_socket.sln	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/mod_csta_socket.sln	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,37 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeSWITCH_CSTA", "FreeSWITCH\mod_csta_socket.vcproj", "{05515420-16DE-4E63-B373-85BE859A5142}"
+	ProjectSection(ProjectDependencies) = postProject
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD} = {4F92B672-DADB-4047-8D6A-4BB3796733FD}
+	EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Download CSTAInside", "Download CSTAInside.vcproj", "{4F92B672-DADB-4047-8D6A-4BB3796733FD}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
+		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{05515420-16DE-4E63-B373-85BE859A5142}.Debug|Win32.ActiveCfg = Debug|Win32
+		{05515420-16DE-4E63-B373-85BE859A5142}.Debug|Win32.Build.0 = Debug|Win32
+		{05515420-16DE-4E63-B373-85BE859A5142}.Debug|x64.ActiveCfg = Debug|x64
+		{05515420-16DE-4E63-B373-85BE859A5142}.Debug|x64.Build.0 = Debug|x64
+		{05515420-16DE-4E63-B373-85BE859A5142}.Release|Win32.ActiveCfg = Release|Win32
+		{05515420-16DE-4E63-B373-85BE859A5142}.Release|Win32.Build.0 = Release|Win32
+		{05515420-16DE-4E63-B373-85BE859A5142}.Release|x64.ActiveCfg = Release|x64
+		{05515420-16DE-4E63-B373-85BE859A5142}.Release|x64.Build.0 = Release|x64
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|Win32.ActiveCfg = Debug|Win32
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|Win32.Build.0 = Debug|Win32
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Debug|x64.ActiveCfg = Debug|Win32
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|Win32.ActiveCfg = Release|Win32
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|Win32.Build.0 = Release|Win32
+		{4F92B672-DADB-4047-8D6A-4BB3796733FD}.Release|x64.ActiveCfg = Release|Win32
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/util.vbs

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/util.vbs (from rev 16612, freeswitch/trunk/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/util.vbs) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/util.vbs	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/event_handlers/mod_csta_socket/mod_csta_socket/util.vbs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,329 @@
+'
+' Contributor(s):
+' Michael Jerris <mike@jerris.com>
+' David A. Horner http://dave.thehorners.com
+'----------------------------------------------
+
+'On Error Resume Next
+' **************
+' Initialization
+' **************
+
+Set WshShell = CreateObject("WScript.Shell")
+Set FSO = CreateObject("Scripting.FileSystemObject")
+Set WshSysEnv = WshShell.Environment("SYSTEM")
+Set xml = CreateObject("Microsoft.XMLHTTP")
+Dim UseWgetEXE
+
+On Error Resume Next
+Set oStream = CreateObject("Adodb.Stream")
+On Error Goto 0
+
+If Not IsObject(oStream)  Then
+	wscript.echo("Failed to create Adodb.Stream, using alternative download method.")
+	UseWgetEXE=true
+Else
+	UseWgetEXE=false
+End If
+Randomize
+Set objArgs = WScript.Arguments
+quote=Chr(34)
+ScriptDir=Left(WScript.ScriptFullName,Len(WScript.ScriptFullName)-Len(WScript.ScriptName))
+UtilsDir=Showpath(ScriptDir)
+ToolsBase="http://files.freeswitch.org/downloads/win32/"
+
+If UseWgetEXE Then
+	GetWgetEXE UtilsDir
+End If
+
+GetCompressionTools UtilsDir
+
+
+If objArgs.Count >=3 Then
+	Select Case objArgs(0)
+		Case "Get"		
+			Wget objArgs(1), Showpath(objArgs(2))
+		Case "GetUnzip"		
+			WgetUnCompress objArgs(1), Showpath(objArgs(2))
+		Case "Version"					
+			'CreateVersion(tmpFolder, VersionDir, includebase, includedest)
+			CreateVersion Showpath(objArgs(1)), Showpath(objArgs(2)), objArgs(3), objArgs(4)
+	End Select
+End If
+
+
+' *******************
+' Utility Subroutines
+' *******************
+
+
+Sub WgetUnCompress(URL, DestFolder)
+	If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If
+	StartPos = InstrRev(URL, "/", -1, 1) 
+	strlength = Len(URL)
+	filename=Right(URL,strlength-StartPos)
+	NameEnd = InstrRev(filename, ".",-1, 1)
+	filestrlength = Len(filename)
+	filebase = Left(filename,NameEnd)
+	fileext = Right(filename, Len(filename) - NameEnd)
+	Wget URL, DestFolder
+	If fileext = "zip" Then
+		UnCompress Destfolder & filename, DestFolder & filebase
+	Else
+		UnCompress Destfolder & filename, DestFolder	
+	End If
+End Sub
+
+Sub GetCompressionTools(DestFolder)
+	Dim oExec
+	If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If
+	If Not FSO.FileExists(DestFolder & "7za.exe") Then 
+		If Not FSO.FileExists(DestFolder & "7za.tag") Then 
+			Set MyFile = fso.CreateTextFile(DestFolder & "7za.tag", True)
+			MyFile.WriteLine("This file marks a pending download for 7za.exe so we don't download it twice at the same time")
+			MyFile.Close
+				
+				Wget ToolsBase & "7za.exe", DestFolder
+			
+			FSO.DeleteFile DestFolder & "7za.tag" ,true 
+		Else
+			WScript.Sleep(5000)
+		End If	
+	End If	
+End Sub
+
+Sub GetWgetEXE(DestFolder)
+	Dim oExec
+	If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If
+	If Not FSO.FileExists(DestFolder & "wget.exe") Then 
+		Slow_Wget ToolsBase & "wget.exe", DestFolder
+	End If	
+End Sub
+
+Sub UnCompress(Archive, DestFolder)
+	batname = "tmp" & CStr(Int(10000*Rnd)) & ".bat"
+	wscript.echo("Extracting: " & Archive)
+	Set MyFile = fso.CreateTextFile(UtilsDir & batname, True)
+	MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Archive & quote & " -y -o" & quote & DestFolder & quote )
+	MyFile.Close
+	Set oExec = WshShell.Exec(UtilsDir & batname)
+	Do
+		WScript.Echo OExec.StdOut.ReadLine()
+	Loop While Not OExec.StdOut.atEndOfStream
+	If FSO.FileExists(Left(Archive, Len(Archive)-3))Then  
+		Set MyFile = fso.CreateTextFile(UtilsDir & batname, True)
+		MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Left(Archive, Len(Archive)-3) & quote & " -y -o" & quote & DestFolder & quote )
+		MyFile.Close
+		Set oExec = WshShell.Exec(UtilsDir & batname)
+		Do
+			WScript.Echo OExec.StdOut.ReadLine()
+		Loop While Not OExec.StdOut.atEndOfStream
+		WScript.Sleep(500)
+		FSO.DeleteFile Left(Archive, Len(Archive)-3) ,true 
+	End If
+	If FSO.FileExists(Left(Archive, Len(Archive)-3) & "tar")Then  
+		Set MyFile = fso.CreateTextFile(UtilsDir & batname, True)
+		MyFile.WriteLine("@" & quote & UtilsDir & "7za.exe" & quote & " x " & quote & Left(Archive, Len(Archive)-3) & "tar" & quote & " -y -o" & quote & DestFolder & quote )
+		MyFile.Close
+		Set oExec = WshShell.Exec(UtilsDir & batname)
+		Do
+			WScript.Echo OExec.StdOut.ReadLine()
+		Loop While Not OExec.StdOut.atEndOfStream
+		WScript.Sleep(500)
+		FSO.DeleteFile Left(Archive, Len(Archive)-3) & "tar",true 
+	End If
+	
+	WScript.Sleep(500)
+	If FSO.FileExists(UtilsDir & batname)Then  
+		FSO.DeleteFile UtilsDir & batname, True
+	End If
+End Sub
+
+Sub Wget(URL, DestFolder)
+	StartPos = InstrRev(URL, "/", -1, 1)   
+	strlength = Len(URL)
+	filename=Right(URL,strlength-StartPos)
+	If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If
+
+	Wscript.echo("Downloading: " & URL)
+	
+If UseWgetEXE Then
+	batname = "tmp" & CStr(Int(10000*Rnd)) & ".bat"
+	Set MyFile = fso.CreateTextFile(UtilsDir & batname, True)
+	MyFile.WriteLine("@cd " & quote & DestFolder & quote)
+	MyFile.WriteLine("@" & quote & UtilsDir & "wget.exe" & quote & " " & URL)
+	MyFile.Close
+	Set oExec = WshShell.Exec(UtilsDir & batname)
+	Do
+		WScript.Echo OExec.StdOut.ReadLine()
+	Loop While Not OExec.StdOut.atEndOfStream
+
+Else
+	xml.Open "GET", URL, False
+	xml.Send
+	
+	Const adTypeBinary = 1
+	Const adSaveCreateOverWrite = 2
+	Const adSaveCreateNotExist = 1 
+
+	oStream.type = adTypeBinary
+	oStream.open
+	oStream.write xml.responseBody
+	oStream.savetofile DestFolder & filename, adSaveCreateOverWrite
+	oStream.close
+End If
+
+End Sub
+
+Sub Slow_Wget(URL, DestFolder)
+	StartPos = InstrRev(URL, "/", -1, 1)   
+	strlength = Len(URL)
+	filename=Right(URL,strlength-StartPos)
+	If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If
+
+	Wscript.echo("Downloading: " & URL)
+	xml.Open "GET", URL, False
+	xml.Send
+	
+	const ForReading = 1 , ForWriting = 2 , ForAppending = 8 
+Set MyFile = fso.OpenTextFile(DestFolder & filename ,ForWriting, True)
+For i = 1 to lenb(xml.responseBody)
+ MyFile.write Chr(Ascb(midb(xml.responseBody,i,1)))
+Next
+MyFile.Close()
+
+End Sub
+
+Function Showpath(folderspec)
+	Set f = FSO.GetFolder(folderspec)
+	showpath = f.path & "\"
+End Function
+
+
+Function FindVersionStringInConfigure(strConfigFile, strVersionString)
+
+Set objRegEx = CreateObject("VBScript.RegExp")
+objRegEx.Pattern = "[^#]AC_SUBST\(" & strVersionString & ".*\[([^\[]*)\]"
+ 
+Set objFSO = CreateObject("Scripting.FileSystemObject")
+Set objFile = objFSO.OpenTextFile(strConfigFile, 1)
+strSearchString = objFile.ReadAll
+objFile.Close
+
+Set colMatches = objRegEx.Execute(strSearchString)  
+
+strResult = ""
+If colMatches.Count > 0 Then
+   For Each strMatch in colMatches   
+	strResult = objRegEx.Replace(strMatch.Value, "$1")
+    Next
+End If
+
+	FindVersionStringInConfigure = strResult
+
+End Function
+
+Sub FindReplaceInFile(FileName, sFind, sReplace)
+	Const OpenAsASCII = 0  ' Opens the file as ASCII (TristateFalse) 
+	Const OpenAsUnicode = -1  ' Opens the file as Unicode (TristateTrue) 
+	Const OpenAsDefault = -2  ' Opens the file using the system default 
+	
+	Const OverwriteIfExist = -1 
+	Const FailIfNotExist   =  0 
+	Const ForReading       =  1 
+	
+	Set fOrgFile = FSO.OpenTextFile(FileName, ForReading, FailIfNotExist, OpenAsASCII)
+	sText = fOrgFile.ReadAll
+	fOrgFile.Close
+	sText = Replace(sText, sFind, sReplace)
+	Set fNewFile = FSO.CreateTextFile(FileName, OverwriteIfExist, OpenAsASCII)
+	fNewFile.WriteLine sText
+	fNewFile.Close
+End Sub
+
+Sub CreateVersion(tmpFolder, VersionDir, includebase, includedest)
+	Dim oExec
+	
+	strVerMajor = FindVersionStringInConfigure(VersionDir & "configure.in", "SWITCH_VERSION_MAJOR")
+	strVerMinor = FindVersionStringInConfigure(VersionDir & "configure.in", "SWITCH_VERSION_MINOR")
+	strVerMicro = FindVersionStringInConfigure(VersionDir & "configure.in", "SWITCH_VERSION_MICRO")
+	strVerRev   = FindVersionStringInConfigure(VersionDir & "configure.in", "SWITCH_VERSION_REVISION")
+	
+	If Right(tmpFolder, 1) <> "\" Then tmpFolder = tmpFolder & "\" End If
+	If Not FSO.FileExists(tmpFolder & "fs_svnversion.exe") Then 
+		Wget ToolsBase & "fs_svnversion.exe", tmpFolder
+	End If	
+
+	If Not FSO.FileExists(tmpFolder & "libdb44.dll") Then 
+		Wget ToolsBase & "libdb44.dll", tmpFolder
+	End If	
+	If Not FSO.FileExists(tmpFolder & "libsvn_diff-1.dll") Then 
+		Wget ToolsBase & "libsvn_diff-1.dll", tmpFolder
+	End If	
+	If Not FSO.FileExists(tmpFolder & "libsvn_subr-1.dll") Then 
+		Wget ToolsBase & "libsvn_subr-1.dll", tmpFolder
+	End If	
+	If Not FSO.FileExists(tmpFolder & "libsvn_wc-1.dll") Then 
+		Wget ToolsBase & "libsvn_wc-1.dll", tmpFolder
+	End If	
+	If Not FSO.FileExists(tmpFolder & "intl3_svn.dll") Then 
+		Wget ToolsBase & "intl3_svn.dll", tmpFolder
+	End If	
+	If Not FSO.FileExists(tmpFolder & "libapr-1.dll") Then 
+		Wget ToolsBase & "libapr-1.dll", tmpFolder
+	End If	
+	If Not FSO.FileExists(tmpFolder & "libaprutil-1.dll") Then 
+		Wget ToolsBase & "libaprutil-1.dll", tmpFolder
+	End If	
+	If Not FSO.FileExists(tmpFolder & "libapriconv-1.dll") Then 
+		Wget ToolsBase & "libapriconv-1.dll", tmpFolder
+	End If	
+	If Not FSO.FileExists(tmpFolder & "libsvn_delta-1.dll") Then 
+		Wget ToolsBase & "libsvn_delta-1.dll", tmpFolder
+	End If	
+
+	Dim sLastFile
+	Const OverwriteIfExist = -1
+	Const ForReading       =  1
+
+	if strVerRev = "" Then
+	    VersionCmd="fs_svnversion " & quote & VersionDir & "." & quote &  " -n"
+	    Set MyFile = fso.CreateTextFile(tmpFolder & "tmpVersion.Bat", True)
+	    MyFile.WriteLine("@" & "cd " & quote & tmpFolder & quote )
+	    MyFile.WriteLine("@" & VersionCmd)
+	    MyFile.Close
+	    Set oExec = WshShell.Exec("cmd /C " & quote & tmpFolder & "tmpVersion.Bat" & quote)
+	    Do
+		    strFromProc = OExec.StdOut.ReadLine()
+		    VERSION=strFromProc
+	    Loop While Not OExec.StdOut.atEndOfStream
+	    sLastVersion = ""
+	    Set sLastFile = FSO.OpenTextFile(tmpFolder & "lastversion", ForReading, true, OpenAsASCII)
+	    If Not sLastFile.atEndOfStream Then
+		    sLastVersion = sLastFile.ReadLine()
+	    End If
+	    sLastFile.Close
+    End If
+	
+	if strVerRev <> "" Then
+	    VERSION = strVerRev
+	End If
+
+	If VERSION = "" Then
+		VERSION = "UNKNOWN"
+	End If
+
+	If VERSION <> sLastVersion Then
+		Set MyFile = fso.CreateTextFile(tmpFolder & "lastversion", True)
+		MyFile.WriteLine(VERSION)
+		MyFile.Close
+	
+		FSO.CopyFile includebase, includedest, true
+		FindReplaceInFile includedest, "@SWITCH_VERSION_REVISION@", VERSION
+		FindReplaceInFile includedest, "@SWITCH_VERSION_MAJOR@", strVerMajor
+		FindReplaceInFile includedest, "@SWITCH_VERSION_MINOR@", strVerMinor
+		FindReplaceInFile includedest, "@SWITCH_VERSION_MICRO@", strVerMicro
+
+	End If
+	
+End Sub

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/xml_int/mod_xml_odbc/mod_xml_odbc.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/xml_int/mod_xml_odbc/mod_xml_odbc.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/xml_int/mod_xml_odbc/mod_xml_odbc.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -169,23 +169,19 @@
 static switch_status_t xml_odbc_do_set_event_header(xml_odbc_session_helper_t *helper)
 {
 	char *name = (char *) switch_xml_attr(helper->xml_in_cur, "name"); /* the xml-odbc-do name attr */
-
 	char *if_name = (char *) switch_xml_attr(helper->xml_in_cur, "if-name");
-	if (if_name) { if_name = switch_event_expand_headers_by_pool(helper->pool, helper->event, if_name); }
-
 	char *if_value = (char *) switch_xml_attr(helper->xml_in_cur, "if-value");
-	if (if_value) { if_value = switch_event_expand_headers_by_pool(helper->pool, helper->event, if_value); }
-
 	char *to_name = (char *) switch_xml_attr(helper->xml_in_cur, "to-name");
-	if (to_name) { to_name = switch_event_expand_headers_by_pool(helper->pool, helper->event, to_name); }
-
 	char *to_value = (char *) switch_xml_attr(helper->xml_in_cur, "to-value");
-	if (to_value) { to_value = switch_event_expand_headers_by_pool(helper->pool, helper->event, to_value); }
-
 	char *old_value = NULL;
 
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
+	if (if_name) { if_name = switch_event_expand_headers_by_pool(helper->pool, helper->event, if_name); }
+	if (if_value) { if_value = switch_event_expand_headers_by_pool(helper->pool, helper->event, if_value); }
+	if (to_name) { to_name = switch_event_expand_headers_by_pool(helper->pool, helper->event, to_name); }
+	if (to_value) { to_value = switch_event_expand_headers_by_pool(helper->pool, helper->event, to_value); }
+
 	if (if_value && !if_name) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "xml-odbc-do [%s] if_name is required when if_value given\n", name);
 		goto done;

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mod/xml_int/mod_xml_odbc/xml_odbc_templates/directory_swk.xml

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mrene/cpp/object_support.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mrene/cpp/object_support.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mrene/cpp/object_support.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -40,7 +40,8 @@
 	
 	void unlock()
 	{
-		switch_mutex_unlock(m_mutex);	}
+		switch_mutex_unlock(m_mutex);
+	}
 	
 	class scoped_lock 
 	{
@@ -153,6 +154,17 @@
 		}
 	}
 	
+	MemoryPool(switch_core_session_t *session)
+	{
+		if (session) {
+			m_owned = false;
+			m_pool = switch_core_session_get_pool(session);
+		} else {
+			m_owned = true;
+			switch_core_new_memory_pool(&m_pool);
+		}
+	}
+	
 	MemoryPool()
 	{
 		switch_core_new_memory_pool(&m_pool);
@@ -180,6 +192,20 @@
 	{
 		return switch_core_strdup(m_pool, s);
 	}
+	
+	char *sprintf(const char *fmt, ...)
+	{
+		va_list ap;
+		char *result = NULL;
+
+		va_start(ap, fmt);
+		result = switch_core_vsprintf(m_pool, fmt, ap);
+		va_end(ap);
+		
+		return result;
+	}
 };
 
-#endif /* OBJECT_SUPPORT_H */
\ No newline at end of file
+
+#endif /* OBJECT_SUPPORT_H */
+

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mrene/fshost


Name: svn:ignore
   + fshost

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mrene/fshost/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mrene/fshost/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mrene/fshost/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,7 +1,7 @@
 CC=gcc
-FS_PATH=../../../
+FS_PATH=../../..
 FS_INCLUDES=-I$(FS_PATH)/src/include -I$(FS_PATH)/libs/apr/include -I$(FS_PATH)/libs/libteletone/src
-FS_LDFLAGS = -L$(FS_PATH)/.libs -lfreeswitch
+FS_LDFLAGS = -L$(FS_PATH)/.libs -lfreeswitch -lm -luuid -lcrypt -lrt
 CFLAGS=-ggdb3 $(FS_INCLUDES) -Wall -Werror
 LIBS=$(FS_LDFLAGS)
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mrene/fshost/main.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mrene/fshost/main.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/mrene/fshost/main.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -95,4 +95,4 @@
  * End:
  * For VIM:
  * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
- */
\ No newline at end of file
+ */

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/sathieu/email2pdf/README (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/sathieu/email2pdf/README	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/sathieu/email2pdf/README	2010-02-12 00:54:22 UTC (rev 16614)
@@ -9,7 +9,7 @@
 QUICK START GUIDE:
 
     email2pdf uses the following modules:
-
+	-------------------------------------
 	Getopt::Long                - required
 	Pod::Usage                  - required
 	File::Temp                  - required
@@ -18,12 +18,19 @@
 	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
 
+	email2pdf includes help:
+	------------------------
+	email2pdf --help
+	email2pdf --man
+
+	Latest version can be grabbed from: http://svn.freeswitch.org/svn/freeswitch/trunk/contrib/sathieu/email2pdf/
+
 Share and Enjoy!
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/sathieu/email2pdf/email2pdf (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/sathieu/email2pdf/email2pdf	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/sathieu/email2pdf/email2pdf	2010-02-12 00:54:22 UTC (rev 16614)
@@ -43,6 +43,9 @@
 
 Copyright (c) 2009 Mathieu Parent <math.parent@gmail.com>
 
+Latest version can be grabbed from:
+http://svn.freeswitch.org/svn/freeswitch/trunk/contrib/sathieu/email2pdf/
+
 =head1 LICENSE
 
 This  program is free  software; you can redistribute  it and/or
@@ -115,19 +118,20 @@
 	'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'],
+	'opendoctext' => ['.odt', 'ooextract --pdf --stdout FILE'],
+	'opendocspreadsheet' => ['.ods', 'ooextract --pdf --stdout FILE'],
+	'opendocpresentation' => ['.odp', 'ooextract --pdf --stdout FILE'],
+	'opendocgraphics' => ['.odg', 'ooextract --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'],
+	'msexcel' => ['.xls', 'ooextract --pdf --stdout FILE'],
+	'mspowerpoint' => ['.ppt', 'ooextract --pdf --stdout FILE'],
+	'msword' => ['.doc', 'ooextract --pdf --stdout FILE'],
 	'pdf' => ['.pdf', 'cat FILE'],
 };
 # Template config
 my $tt_config = {
+	'ABSOLUTE' => 1,
 };
 
 # =========================================================================== #
@@ -155,11 +159,13 @@
 			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");
+			system("chmod ugo+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'. ";
+			print STDERR "Processing ";
+			print STDERR "header " if $is_header;
+			print STDERR "'$filename' ($content_type). From '$filename_in'. ";
 			my $out = `$command`;
 			if(!$out) {
 				print STDERR "Empty generated PDF.\n";
@@ -187,7 +193,7 @@
 sub process_header
 {
 	my $parsed = shift;
-	unshift @files, (0) if $files[0] != 0;
+	unshift @files, (0) if $files[0];
 	# define template variables for replacement
 	my $vars = {
 		body => '', #$parsed->body,
@@ -197,7 +203,7 @@
 	};
 
 	# specify input filename, or file handle, text reference, etc.
-	my $content_type = `file --mime-type --brief header.html`;
+	my $content_type = `file --mime-type --brief $o_header`;
 	$content_type =~ s/\s+$//; # trim end whitespace
 	my $header = '';
 
@@ -254,7 +260,7 @@
 # =========================================================================== #
 # setup temp dir
 $output_dir = tempdir( CLEANUP => 1 );
-system("chmod +rwx $output_dir");
+system("chmod ugo+rwx $output_dir");
 
 # load mail
 if($file_in eq "-") {
@@ -265,9 +271,15 @@
 	close(FILEIN);
 }
 
-my @parts = $email->subparts;
-foreach my $part (@parts) {
-	process_part $part;
+my $email_parsed_content_type = parse_content_type($email->content_type);
+my $email_content_type = $email_parsed_content_type->{'discrete'}.'/'.$email_parsed_content_type->{'composite'};
+if($email_content_type eq 'multipart/alternative') {
+	process_part $email;
+} else {
+	my @parts = $email->subparts;
+	foreach my $part (@parts) {
+		process_part $part;
+	}
 }
 process_header($email);
 print "Merging files: ".join(' ', @files)."\n";

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/sathieu/email2pdf/header.html (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/sathieu/email2pdf/header.html	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/sathieu/email2pdf/header.html	2010-02-12 00:54:22 UTC (rev 16614)
@@ -5,8 +5,9 @@
  </head>
  <body>
  <h3>Fax</h3>
-From : [% mail.header('From') %]<br>
-Subject : [% mail.header('Subject') %]<br>
+<h4>[% FILTER html %]From: [% mail.header('From') %][% END %]</h4>
+<h4>[% FILTER html %]To: [% mail.header('To') %][% END %]</h4>
+<h4>[% FILTER html %]Objet : [% mail.header('Subject') %][% END %]</h4>
 [% body %]
 </body>
 </html>

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm (from rev 16612, freeswitch/trunk/contrib/seven/fscomm)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/FSComm.2008.vcproj

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/FSComm.2008.vcproj (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/FSComm.2008.vcproj) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/FSComm.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/FSComm.2008.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,771 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="FSComm"
+	ProjectGUID="{7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}"
+	RootNamespace="FSComm"
+	Keyword="Qt4VSv1.0"
+	TargetFrameworkVersion="0"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="."
+			IntermediateDirectory="debug\"
+			ConfigurationType="1"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				WarningLevel="0"
+				DefaultCharType="0"
+				EnableErrorChecks="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalOptions="-Zm200 -w34100 -w34189 -w34100 -w34189"
+				Optimization="4"
+				AdditionalIncludeDirectories="$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include;.;$(QTDIR)\include\ActiveQt;debug;&quot;$(QTDIR)\mkspecs\win32-msvc2008&quot;;..\src\include;$(QTDIR)\include\QtXml"
+				PreprocessorDefinitions="_WINDOWS,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,QT_DLL,QT_GUI_LIB,QT_CORE_LIB,QT_THREAD_SUPPORT"
+				GeneratePreprocessedFile="0"
+				ExceptionHandling="1"
+				RuntimeLibrary="3"
+				BufferSecurityCheck="false"
+				TreatWChar_tAsBuiltInType="false"
+				RuntimeTypeInfo="true"
+				AssemblerListingLocation="debug\"
+				ObjectFile="debug\"
+				ProgramDataBaseFileName=".\"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_WINDOWS,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,QT_DLL,QT_GUI_LIB,QT_CORE_LIB,QT_THREAD_SUPPORT,_DEBUG"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				IgnoreImportLibrary="true"
+				AdditionalOptions="&quot;/MANIFESTDEPENDENCY:type=&apos;win32&apos; name=&apos;Microsoft.Windows.Common-Controls&apos; version=&apos;6.0.0.0&apos; publicKeyToken=&apos;6595b64144ccf1df&apos; language=&apos;*&apos; processorArchitecture=&apos;*&apos;&quot; &quot;/MANIFESTDEPENDENCY:type=&apos;win32&apos; name=&apos;Microsoft.Windows.Common-Controls&apos; version=&apos;6.0.0.0&apos; publicKeyToken=&apos;6595b64144ccf1df&apos; language=&apos;*&apos; processorArchitecture=&apos;*&apos;&quot;"
+				AdditionalDependencies="$(QTDIR)\lib\qtmaind.lib $(QTDIR)\lib\QtGuid4.lib $(QTDIR)\lib\QtCored4.lib $(QTDIR)\lib\QtXml4.lib"
+				OutputFile="debug\FSComm.exe"
+				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories="$(QTDIR)\lib"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile=""
+				SubSystem="2"
+				LinkTimeCodeGeneration="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="."
+			IntermediateDirectory="release\"
+			ConfigurationType="1"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				WarningLevel="0"
+				DefaultCharType="0"
+				EnableErrorChecks="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalOptions="-Zm200 -w34100 -w34189 -w34100 -w34189"
+				Optimization="2"
+				AdditionalIncludeDirectories="&quot;$(QTDIR)\include\QtCore&quot;,&quot;$(QTDIR)\include\QtGui&quot;,&quot;$(QTDIR)\include&quot;,&quot;.&quot;,&quot;$(QTDIR)\include\ActiveQt&quot;,&quot;release&quot;,&quot;.&quot;,$(QTDIR)\mkspecs\win32-msvc2008;$(QTDIR)\include\QtXml"
+				PreprocessorDefinitions="QT_NO_DEBUG,NDEBUG,_WINDOWS,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,QT_DLL,QT_NO_DEBUG,QT_GUI_LIB,QT_CORE_LIB,QT_THREAD_SUPPORT,NDEBUG"
+				GeneratePreprocessedFile="0"
+				ExceptionHandling="1"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				TreatWChar_tAsBuiltInType="false"
+				RuntimeTypeInfo="true"
+				AssemblerListingLocation="release\"
+				ObjectFile="release\"
+				ProgramDataBaseFileName=".\"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="QT_NO_DEBUG,NDEBUG,_WINDOWS,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,QT_DLL,QT_NO_DEBUG,QT_GUI_LIB,QT_CORE_LIB,QT_THREAD_SUPPORT"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				IgnoreImportLibrary="true"
+				AdditionalOptions="&quot;/MANIFESTDEPENDENCY:type=&apos;win32&apos; name=&apos;Microsoft.Windows.Common-Controls&apos; version=&apos;6.0.0.0&apos; publicKeyToken=&apos;6595b64144ccf1df&apos; language=&apos;*&apos; processorArchitecture=&apos;*&apos;&quot; &quot;/MANIFESTDEPENDENCY:type=&apos;win32&apos; name=&apos;Microsoft.Windows.Common-Controls&apos; version=&apos;6.0.0.0&apos; publicKeyToken=&apos;6595b64144ccf1df&apos; language=&apos;*&apos; processorArchitecture=&apos;*&apos;&quot;"
+				AdditionalDependencies="$(QTDIR)\lib\qtmain.lib $(QTDIR)\lib\QtGui4.lib $(QTDIR)\lib\QtCore4.lib"
+				OutputFile="release)\FSComm.exe"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories="$(QTDIR)\lib"
+				GenerateDebugInformation="false"
+				ProgramDatabaseFile=""
+				SubSystem="2"
+				LinkTimeCodeGeneration="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\preferences\accountdialog.cpp"
+				>
+			</File>
+			<File
+				RelativePath="call.cpp"
+				>
+			</File>
+			<File
+				RelativePath="fshost.cpp"
+				>
+			</File>
+			<File
+				RelativePath="main.cpp"
+				>
+			</File>
+			<File
+				RelativePath="mainwindow.cpp"
+				>
+			</File>
+			<File
+				RelativePath="mod_qsettings\mod_qsettings.cpp"
+				>
+			</File>
+			<File
+				RelativePath="preferences\prefdialog.cpp"
+				>
+			</File>
+			<File
+				RelativePath="preferences\prefportaudio.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\preferences\prefsofia.cpp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="preferences\accountdialog.h"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC accountdialog.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile debug\moc_accountdialog.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;debug&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\accountdialog.h -o debug\moc_accountdialog.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;accountdialog.h"
+						Outputs="debug\moc_accountdialog.cpp"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC accountdialog.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile release\moc_accountdialog.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;release&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\accountdialog.h -o release\moc_accountdialog.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;accountdialog.h"
+						Outputs="release\moc_accountdialog.cpp"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="call.h"
+				>
+			</File>
+			<File
+				RelativePath="fshost.h"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC fshost.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile debug\moc_fshost.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;debug&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 fshost.h -o debug\moc_fshost.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;fshost.h"
+						Outputs="debug\moc_fshost.cpp"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC fshost.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile release\moc_fshost.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;release&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 fshost.h -o release\moc_fshost.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;fshost.h"
+						Outputs="release\moc_fshost.cpp"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="mainwindow.h"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC mainwindow.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile debug\moc_mainwindow.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;debug&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 mainwindow.h -o debug\moc_mainwindow.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;mainwindow.h"
+						Outputs="debug\moc_mainwindow.cpp"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC mainwindow.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile release\moc_mainwindow.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;release&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 mainwindow.h -o release\moc_mainwindow.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;mainwindow.h"
+						Outputs="release\moc_mainwindow.cpp"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="mod_qsettings\mod_qsettings.h"
+				>
+			</File>
+			<File
+				RelativePath="preferences\prefdialog.h"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC prefdialog.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile debug\moc_prefdialog.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;debug&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefdialog.h -o debug\moc_prefdialog.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;prefdialog.h"
+						Outputs="debug\moc_prefdialog.cpp"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC prefdialog.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile release\moc_prefdialog.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;release&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefdialog.h -o release\moc_prefdialog.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;prefdialog.h"
+						Outputs="release\moc_prefdialog.cpp"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="preferences\prefportaudio.h"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC prefportaudio.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile debug\moc_prefportaudio.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;debug&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefportaudio.h -o debug\moc_prefportaudio.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;prefportaudio.h"
+						Outputs="debug\moc_prefportaudio.cpp"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC prefportaudio.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile release\moc_prefportaudio.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;release&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefportaudio.h -o release\moc_prefportaudio.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;prefportaudio.h"
+						Outputs="release\moc_prefportaudio.cpp"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="preferences\prefsofia.h"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC prefsofia.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile debug\moc_prefsofia.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;debug&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefsofia.h -o debug\moc_prefsofia.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;prefsofia.h"
+						Outputs="debug\moc_prefsofia.cpp"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC prefportaudio.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile release\moc_prefsofia.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;release&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefsofia.h -o release\moc_prefsofia.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;prefsofia.h"
+						Outputs="release\moc_prefsofia.cpp"
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="Generated Files"
+			Filter="cpp;c;cxx;moc;h;def;odl;idl;res;"
+			UniqueIdentifier="{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}"
+			>
+			<File
+				RelativePath="debug\moc_accountdialog.cpp"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="release\moc_accountdialog.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="release\moc_fshost.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="debug\moc_fshost.cpp"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="debug\moc_mainwindow.cpp"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="release\moc_mainwindow.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="release\moc_prefdialog.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="release\moc_prefdialog.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="debug\moc_prefdialog.cpp"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="debug\moc_prefdialog.cpp"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="debug\moc_prefportaudio.cpp"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="release\moc_prefportaudio.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="release\moc_prefsofia.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="debug\moc_prefsofia.cpp"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="release\qrc_resources.cpp"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="debug\qrc_resources.cpp"
+				>
+				<FileConfiguration
+					Name="Release|Win32"
+					ExcludedFromBuild="true"
+					>
+					<Tool
+						Name="VCCLCompilerTool"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="ui_mainwindow.h"
+				>
+			</File>
+			<File
+				RelativePath="ui_prefdialog.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Form Files"
+			Filter="ui"
+			UniqueIdentifier="{99349809-55BA-4b9d-BF79-8FDBB0286EB3}"
+			ParseFiles="false"
+			>
+			<File
+				RelativePath="preferences\accountdialog.ui"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="UIC accountdialog.ui"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile .\ui_accountdialog.h&#x0D;&#x0A;$(QTDIR)\bin\uic.exe preferences\accountdialog.ui -o ui_accountdialog.h&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;accountdialog.ui"
+						Outputs="ui_accountdialog.h"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="UIC accountdialog.ui"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile .\ui_accountdialog.h&#x0D;&#x0A;$(QTDIR)\bin\uic.exe preferences\accountdialog.ui -o ui_accountdialog.h&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;accountdialog.ui"
+						Outputs="ui_accountdialog.h"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="mainwindow.ui"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="UIC mainwindow.ui"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile .\ui_mainwindow.h&#x0D;&#x0A;$(QTDIR)\bin\uic.exe mainwindow.ui -o ui_mainwindow.h&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;mainwindow.ui"
+						Outputs="ui_mainwindow.h"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="UIC mainwindow.ui"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile .\ui_mainwindow.h&#x0D;&#x0A;$(QTDIR)\bin\uic.exe mainwindow.ui -o ui_mainwindow.h&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;mainwindow.ui"
+						Outputs="ui_mainwindow.h"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="preferences\prefdialog.ui"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="UIC prefdialog.ui"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile .\ui_prefdialog.h&#x0D;&#x0A;$(QTDIR)\bin\uic.exe preferences\prefdialog.ui -o ui_prefdialog.h&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;prefdialog.ui"
+						Outputs="ui_prefdialog.h"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="UIC prefdialog.ui"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile .\ui_prefdialog.h&#x0D;&#x0A;$(QTDIR)\bin\uic.exe preferences\prefdialog.ui -o ui_prefdialog.h&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;prefdialog.ui"
+						Outputs="ui_prefdialog.h"
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="qrc;*"
+			UniqueIdentifier="{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}"
+			ParseFiles="false"
+			>
+			<File
+				RelativePath="conf\event_socket.conf.xml"
+				>
+			</File>
+			<File
+				RelativePath="conf\accounts\example.xml"
+				>
+			</File>
+			<File
+				RelativePath="conf\freeswitch.xml"
+				>
+			</File>
+			<File
+				RelativePath="conf\portaudio.conf.xml"
+				>
+			</File>
+			<File
+				RelativePath="resources\pref_audio.gif"
+				>
+			</File>
+			<File
+				RelativePath="resources\pref_sip.png"
+				>
+			</File>
+			<File
+				RelativePath="resources.qrc"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="RCC resources.qrc"
+						CommandLine="$(QTDIR)\bin\rcc.exe -name resources resources.qrc -o debug\qrc_resources.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="$(QTDIR)\bin\rcc.exe;conf\accounts\example.xml;conf\event_socket.conf.xml;conf\freeswitch.xml;conf\portaudio.conf.xml;resources.qrc;resources\pref_audio.gif;resources\pref_sip.png;resources\splash.png"
+						Outputs="debug\qrc_resources.cpp"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="RCC resources.qrc"
+						CommandLine="$(QTDIR)\bin\rcc.exe -name resources resources.qrc -o release\qrc_resources.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="$(QTDIR)\bin\rcc.exe;conf\accounts\example.xml;conf\event_socket.conf.xml;conf\freeswitch.xml;conf\portaudio.conf.xml;resources.qrc;resources\pref_audio.gif;resources\pref_sip.png;resources\splash.png"
+						Outputs="release\qrc_resources.cpp"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="resources\splash.png"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/FSComm.pro

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/FSComm.pro (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/FSComm.pro) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/FSComm.pro	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/FSComm.pro	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,49 @@
+# #####################################
+# version check qt
+# #####################################
+contains(QT_VERSION, ^4\.[0-5]\..*) { 
+    message("Cannot build FsGui with Qt version $$QT_VERSION.")
+    error("Use at least Qt 4.6.")
+}
+QT += xml
+TARGET = fscomm
+macx:TARGET = FSComm
+TEMPLATE = app
+INCLUDEPATH = ../src/include \
+    ../libs/apr/include \
+    ../libs/libteletone/src
+LIBS = -L../.libs \
+    -lfreeswitch \
+    -lm
+!win32:!macx { 
+    # This is here to comply with the default freeswitch installation
+    QMAKE_LFLAGS += -Wl,-rpath,/usr/local/freeswitch/lib
+    LIBS += -lcrypt \
+        -lrt
+}
+SOURCES += main.cpp \
+    mainwindow.cpp \
+    fshost.cpp \
+    call.cpp \
+    mod_qsettings/mod_qsettings.cpp \
+    preferences/prefdialog.cpp \
+    preferences/prefportaudio.cpp \
+    preferences/prefsofia.cpp \
+    preferences/accountdialog.cpp
+HEADERS += mainwindow.h \
+    fshost.h \
+    call.h \
+    mod_qsettings/mod_qsettings.h \
+    preferences/prefdialog.h \
+    preferences/prefportaudio.h \
+    preferences/prefsofia.h \
+    preferences/accountdialog.h
+FORMS += mainwindow.ui \
+    preferences/prefdialog.ui \
+    preferences/accountdialog.ui
+RESOURCES += resources.qrc
+OTHER_FILES += conf/portaudio.conf.xml \
+    conf/event_socket.conf.xml \
+    conf/freeswitch.xml \
+    conf/sofia.conf.xml \
+    conf/account.conf.xml

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/call.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/call.cpp (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/call.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/call.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/call.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,43 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita <jmesquita@freeswitch.org>
+ *
+ */
+
+#include "call.h"
+
+Call::Call()
+{
+}
+
+Call::Call(int call_id, QString cid_name, QString cid_number, fscomm_call_direction_t direction, QString uuid) :
+        _call_id(call_id),
+        _cid_name(cid_name),
+        _cid_number(cid_number),
+        _direction(direction),
+        _uuid (uuid)
+{
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/call.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/call.h (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/call.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/call.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/call.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,73 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita <jmesquita@freeswitch.org>
+ *
+ */
+#ifndef CALL_H
+#define CALL_H
+
+#include <QtCore>
+#include <QString>
+#include <fshost.h>
+
+typedef enum {
+    FSCOMM_CALL_STATE_RINGING = 0,
+    FSCOMM_CALL_STATE_TRYING  = 1,
+    FSCOMM_CALL_STATE_ANSWERED = 2
+} fscomm_call_state_t;
+
+typedef enum {
+        FSCOMM_CALL_DIRECTION_INBOUND = 0,
+        FSCOMM_CALL_DIRECTION_OUTBOUND = 1
+} fscomm_call_direction_t;
+
+class Call
+{
+public:
+    Call(void);
+    Call(int call_id, QString cid_name, QString cid_number, fscomm_call_direction_t direction, QString uuid);
+    QString getCidName(void) { return _cid_name; }
+    QString getCidNumber(void) { return _cid_number; }
+    int getCallID(void) { return _call_id; }
+    QString getUUID(void) { return _uuid; }
+    void setbUUID(QString uuid) { _buuid = uuid; }
+    fscomm_call_direction_t getDirection() { return _direction; }
+    fscomm_call_state_t getState() { return _state; }
+    void setState(fscomm_call_state_t state) { _state = state; }
+
+private:
+    int _call_id;
+    QString _cid_name;
+    QString _cid_number;
+    fscomm_call_direction_t _direction;
+    QString _uuid;
+    QString _buuid;
+    fscomm_call_state_t _state;
+};
+
+Q_DECLARE_METATYPE(Call)
+
+#endif // CALL_H

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/conf)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/account.conf.xml

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/account.conf.xml (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/conf/account.conf.xml) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/account.conf.xml	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/account.conf.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,17 @@
+<gateway name="${name}">
+  <param name="username" value="${username}"/>
+  <param name="realm" value="${realm}"/>
+  <param name="from-user" value="${from-user}"/>
+  <param name="from-domain" value="${from-domain}"/>
+  <param name="password" value="${password}"/>
+  <param name="extension" value="${extension}"/>
+  <param name="proxy" value="${proxy}"/>
+  <param name="register-proxy" value="${register-proxy}"/>
+  <param name="expire-seconds" value="${expire-seconds}"/>
+  <param name="register" value="${register}"/>
+  <param name="register-transport" value="${register-transport}"/>
+  <param name="retry-seconds" value="${retry-seconds}"/>
+  <param name="caller-id-in-from" value="${caller-id-in-from}"/>
+  <param name="contact-params" value="${contact-params}"/>
+  <param name="ping" value="${ping}"/>
+</gateway>

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/accounts (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/conf/accounts)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/accounts/example.xml

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/accounts/example.xml (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/conf/accounts/example.xml) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/accounts/example.xml	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/accounts/example.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,34 @@
+<include>
+  <!--<gateway name="default">-->
+  <!--/// account username *required* ///-->
+  <!--<param name="username" value="cluecon"/>-->
+  <!--/// auth realm: *optional* same as gateway name, if blank ///-->
+  <!--<param name="realm" value="asterlink.com"/>-->
+  <!--/// username to use in from: *optional* same as  username, if blank ///-->
+  <!--<param name="from-user" value="cluecon"/>-->
+  <!--/// domain to use in from: *optional* same as  realm, if blank ///-->
+  <!--<param name="from-domain" value="asterlink.com"/>-->
+  <!--/// account password *required* ///-->
+  <!--<param name="password" value="cluecon"/>-->
+  <!--/// extension for inbound calls: *optional* same as username, if blank ///-->
+  <!--<param name="extension" value="cluecon"/>-->
+  <!--/// proxy host: *optional* same as realm, if blank ///-->
+  <!--<param name="proxy" value="asterlink.com"/>-->
+  <!--/// send register to this proxy: *optional* same as proxy, if blank ///-->
+  <!--<param name="register-proxy" value="mysbc.com"/>-->
+  <!--/// expire in seconds: *optional* 3600, if blank ///-->
+  <!--<param name="expire-seconds" value="60"/>-->
+  <!--/// do not register ///-->
+  <!--<param name="register" value="false"/>-->
+  <!-- which transport to use for register -->
+  <!--<param name="register-transport" value="udp"/>-->
+  <!--How many seconds before a retry when a failure or timeout occurs -->
+  <!--<param name="retry-seconds" value="30"/>-->
+  <!--Use the callerid of an inbound call in the from field on outbound calls via this gateway -->
+  <!--<param name="caller-id-in-from" value="false"/>-->
+  <!--extra sip params to send in the contact-->
+  <!--<param name="contact-params" value="tport=tcp"/>-->
+  <!--send an options ping every x seconds, failure will unregister and/or mark it down-->
+  <!--<param name="ping" value="25"/>-->
+  <!--</gateway>-->
+</include>

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/event_socket.conf.xml

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/event_socket.conf.xml (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/conf/event_socket.conf.xml) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/event_socket.conf.xml	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/event_socket.conf.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,12 @@
+<document type="freeswitch/xml">
+    <section name="configuration">
+<configuration name="event_socket.conf" description="Socket Client">
+	  <settings>
+		<param name="nat-map" value="false"/>
+		<param name="listen-ip" value="127.0.0.1"/>
+		<param name="listen-port" value="8021"/>
+		<param name="password" value="ClueCon"/>
+	  </settings>
+    </configuration>
+  </section>
+</document>

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/freeswitch.serial

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/freeswitch.serial (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/conf/freeswitch.serial)


(Binary files differ)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/freeswitch.xml

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/freeswitch.xml (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/conf/freeswitch.xml) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/freeswitch.xml	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/freeswitch.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,266 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+	<X-PRE-PROCESS cmd="set" data="auto_answer=false"/>
+	<X-PRE-PROCESS cmd="set" data="domain=$${local_ip_v4}"/>
+	<X-PRE-PROCESS cmd="set" data="hold_music=local_stream://moh"/>
+	<X-PRE-PROCESS cmd="set" data="codec_prefs=CELT@48000h,G7221@32000h,G7221@16000h,G722,PCMU,PCMA,GSM"/>
+	<X-PRE-PROCESS cmd="set" data="external_rtp_ip=stun:stun.freeswitch.org"/>
+	<X-PRE-PROCESS cmd="set" data="external_sip_ip=stun:stun.freeswitch.org"/>
+	<X-PRE-PROCESS cmd="set" data="console_loglevel=info"/>
+	<X-PRE-PROCESS cmd="set" data="default_gateway=default"/>
+	<X-PRE-PROCESS cmd="set" data="us-ring=%(2000, 4000, 440.0, 480.0)"/>
+	<X-PRE-PROCESS cmd="set" data="bong-ring=v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"/>
+	<X-PRE-PROCESS cmd="set" data="sit=%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)"/>
+
+	<section name="configuration" description="Various Configuration">
+		<configuration name="cdr_csv.conf" description="CDR CSV Format">
+			<settings>
+				<param name="default-template" value="example"/>
+				<param name="rotate-on-hup" value="true"/>
+				<param name="legs" value="a"/>
+			</settings>
+			<templates>
+				<template name="example">"${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}","${accountcode}","${read_codec}","${write_codec}"</template>
+			</templates>
+		</configuration>
+
+		<configuration name="console.conf" description="Console Logger">
+			<mappings>
+				<map name="all" value="console,debug,info,notice,warning,err,crit,alert"/>
+			</mappings>
+			<settings>
+				<param name="colorize" value="true"/>
+				<param name="loglevel" value="$${console_loglevel}"/>
+			</settings>
+		</configuration>
+
+		<configuration name="enum.conf" description="ENUM Module">
+			<settings>
+				<param name="default-root" value="e164.org"/>
+				<param name="default-isn-root" value="freenum.org"/>
+				<param name="query-timeout" value="10"/>
+				<param name="auto-reload" value="true"/>
+			</settings>
+			<routes>
+				<route service="E2U+SIP" regex="sip:(.*)" replace="sofia/softphone/$1"/>
+			</routes>
+		</configuration>
+
+		<configuration name="qsettings.conf" description="configures our mod_qsettings">
+			<bindings value="configuration" />
+		</configuration>
+
+		<configuration name="local_stream.conf" description="stream files from local dir">
+			<directory name="moh/48000" path="$${base_dir}/sounds/music/48000">
+				<param name="rate" value="48000"/>
+				<param name="shuffle" value="true"/>
+				<param name="channels" value="1"/>
+				<param name="interval" value="10"/>
+				<param name="timer-name" value="soft"/>
+			</directory>
+		</configuration>
+
+		<configuration name="logfile.conf" description="File Logging">
+			<settings>
+				<param name="rotate-on-hup" value="true"/>
+			</settings>
+			<profiles>
+				<profile name="default">
+					<settings>
+					</settings>
+					<mappings>
+						<map name="all" value="debug,info,notice,warning,err,crit,alert"/>
+					</mappings>
+				</profile>
+			</profiles>
+		</configuration>
+
+		<configuration name="modules.conf" description="Modules">
+			<modules>
+				<load module="mod_console"/>
+				<load module="mod_logfile"/>
+				<load module="mod_enum"/>
+				<load module="mod_cdr_csv"/>
+				<load module="mod_sofia"/>
+				<load module="mod_loopback"/>
+				<load module="mod_commands"/>
+				<load module="mod_dptools"/>
+				<load module="mod_dialplan_xml"/>
+				<load module="mod_voipcodecs"/>
+				<load module="mod_ilbc"/>
+				<load module="mod_speex"/>
+				<load module="mod_celt"/>
+				<load module="mod_siren"/>
+				<load module="mod_sndfile"/>
+				<load module="mod_tone_stream"/>
+				<load module="mod_local_stream"/>
+				<load module="mod_portaudio"/>
+				<load module="mod_event_socket"/>
+			</modules>
+		</configuration>
+
+		<configuration name="post_load_modules.conf" description="Modules">
+			<modules>
+			</modules>
+		</configuration>
+
+		<configuration name="sofia.conf" description="sofia Endpoint">
+			<global_settings>
+				<param name="log-level" value="0"/>
+				<param name="auto-restart" value="true"/>
+				<param name="debug-presence" value="0"/>
+			</global_settings>
+			<profiles>
+				<profile name="softphone">
+					<gateways>
+						<X-PRE-PROCESS cmd="include" data="accounts/*.xml"/>
+					</gateways>
+					<settings>
+						<!--<param name="media-option" value="bypass-media-after-att-xfer"/>-->
+						<param name="user-agent-string" value="FreeSWITCH/FSComm"/>
+						<!-- <param name="user-agent-string" value="FreeSWITCH Rocks!"/> -->
+						<param name="debug" value="0"/>
+						<param name="sip-trace" value="no"/>
+						<param name="context" value="public"/>
+						<param name="rfc2833-pt" value="101"/>
+						<!-- port to bind to for sip traffic -->
+						<param name="sip-port" value="12345"/>
+						<param name="dialplan" value="XML"/>
+						<param name="dtmf-duration" value="100"/>
+						<param name="codec-prefs" value="$${codec_prefs}"/>
+						<param name="use-rtp-timer" value="true"/>
+						<param name="rtp-timer-name" value="soft"/>
+						<!-- ip address to use for rtp, DO NOT USE HOSTNAMES ONLY IP ADDRESSES -->
+						<param name="rtp-ip" value="$${local_ip_v4}"/>
+						<!-- ip address to bind to, DO NOT USE HOSTNAMES ONLY IP ADDRESSES -->
+						<param name="sip-ip" value="$${local_ip_v4}"/>
+						<param name="hold-music" value="$${hold_music}"/>
+						<param name="apply-nat-acl" value="rfc1918"/>
+						<!--<param name="enable-timer" value="false"/>-->
+						<!--<param name="enable-100rel" value="true"/>-->
+						<!--<param name="minimum-session-expires" value="120"/>-->
+						<!--<param name="dtmf-type" value="info"/>-->
+						<param name="manage-presence" value="false"/>
+						<!--<param name="bitpacking" value="aal2"/> -->
+						<param name="max-proceeding" value="3"/>
+						<!--<param name="session-timeout" value="120"/>-->
+						<!--set to 'greedy' if you want your codec list to take precedence -->
+						<param name="inbound-codec-negotiation" value="generous"/>
+						<!-- if you want to send any special bind params of your own -->
+						<!--<param name="bind-params" value="transport=udp"/>-->
+						<!--Uncomment to let calls hit the dialplan *before* you decide if the codec is ok-->
+						<!--<param name="inbound-late-negotiation" value="true"/>-->
+						<!--<param name="accept-blind-reg" value="true"/> -->
+						<!--<param name="accept-blind-auth" value="true"/> -->
+						<!--<param name="suppress-cng" value="true"/> -->
+						<param name="nonce-ttl" value="60"/>
+						<!--<param name="NDLB-broken-auth-hash" value="true"/>-->
+						<!--<param name="NDLB-received-in-nat-reg-contact" value="true"/>-->
+						<param name="auth-calls" value="false"/>
+						<param name="auth-all-packets" value="false"/>
+						<param name="ext-rtp-ip" value="$${external_rtp_ip}"/>
+						<param name="ext-sip-ip" value="$${external_sip_ip}"/>
+						<!-- rtp inactivity timeout -->
+						<param name="rtp-timeout-sec" value="300"/>
+						<param name="rtp-hold-timeout-sec" value="1800"/>
+						<!-- VAD choose one (out is a good choice); -->
+						<!-- <param name="vad" value="in"/> -->
+						<!-- <param name="vad" value="out"/> -->
+						<!-- <param name="vad" value="both"/> -->
+						<param name="disable-register" value="true"/>
+						<!--<param name="NDLB-force-rport" value="true"/>-->
+						<param name="challenge-realm" value="auto_from"/>
+						<!--<param name="disable-rtp-auto-adjust" value="true"/>-->
+						<!--<param name="inbound-use-callid-as-uuid" value="true"/>-->
+						<!--<param name="outbound-use-uuid-as-callid" value="true"/>-->
+						<!--<param name="auto-rtp-bugs" data="clear"/>-->
+					</settings>
+				</profile>
+			</profiles>
+		</configuration>
+
+		<configuration name="switch.conf" description="Core Configuration">
+			<cli-keybindings>
+				<key name="1" value="help"/>
+				<key name="2" value="status"/>
+				<key name="3" value="pa answer"/>
+				<key name="4" value="pa hangup"/>
+				<key name="5" value="sofia status"/>
+				<key name="6" value="reloadxml"/>
+				<key name="7" value="console loglevel 0"/>
+				<key name="8" value="console loglevel 7"/>
+				<key name="9" value="sofia status profile softphone"/>
+				<key name="10" value="fsctl pause"/>
+				<key name="11" value="fsctl resume"/>
+				<key name="12" value="version"/>
+			</cli-keybindings> 
+			<settings>
+				<param name="colorize-console" value="true"/>
+				<param name="max-sessions" value="20"/>
+				<param name="sessions-per-second" value="5"/>
+				<param name="loglevel" value="debug"/>
+				<param name="crash-protection" value="false"/>
+				<param name="dump-cores" value="yes"/>
+				<param name="rtp-start-port" value="16384"/>
+				<param name="rtp-end-port" value="16484"/>
+			</settings>
+		</configuration>
+	</section>
+
+	<section name="dialplan" description="Regex/XML Dialplan">
+		<context name="default">
+			<extension name="codec_and_sip_uri">
+				<condition field="destination_number" expression="^sip:(.*):(.*)$">
+					<action application="bridge" data="{absolute_codec_string=$1}sofia/softphone/$2"/>
+				</condition>
+			</extension>
+			<extension name="sip_uri">
+				<condition field="destination_number" expression="^sip:(.*)$">
+					<action application="bridge" data="sofia/softphone/$1"/>
+				</condition>
+			</extension>
+			<extension name="codec_and_number">
+				<condition field="destination_number" expression="^(.*):(.*)@(.*)$">
+					<action application="bridge" data="{absolute_codec_string=$1}sofia/gateway/$3/$2"/>
+				</condition>
+			</extension>
+			<extension name="number">
+				<condition field="destination_number" expression="^(.*)@(.*)$">
+					<action application="bridge" data="sofia/gateway/$2/$1"/>
+				</condition>
+			</extension>
+			<extension name="number">
+				<condition field="destination_number" expression="^(.*)$">
+					<action application="bridge" data="sofia/gateway/${default_gateway}/$1"/>
+				</condition>
+			</extension>
+		</context>
+		<context name="public">
+			<extension name="public_extensions">
+				<condition field="$${auto_answer}" expression="^true$"/>
+				<condition field="destination_number" expression="^(.*)$">
+					<action application="info"/>
+					<action application="bridge" data="portaudio/auto_answer"/>
+				</condition>
+			</extension>
+			<extension name="public_extensions">
+				<condition field="${sip_to_params}" expression="intercom=true"/>
+				<condition field="${alert_info}" expression="Ring;Answer"/>
+				<condition field="destination_number" expression="^(.*)$">
+					<action application="info"/>
+					<action application="bridge" data="portaudio/auto_answer"/>
+				</condition>
+			</extension>
+			<extension name="public_extensions">
+				<condition field="destination_number" expression="^(.*)$">
+					<action application="info"/>
+					<action application="set" data="ringback=${us-ring}"/>
+					<action application="pre_answer"/>
+					<action application="bridge" data="portaudio"/>
+				</condition>
+			</extension>
+		</context>
+	</section>
+</document>
+
+

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/portaudio.conf.xml

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/portaudio.conf.xml (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/conf/portaudio.conf.xml) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/portaudio.conf.xml	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/portaudio.conf.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,23 @@
+<document type="freeswitch/xml">
+    <section name="configuration">
+        <configuration name="portaudio.conf" description="Soundcard Endpoint">
+            <settings>
+                <!-- DO NOT take the # off the devices config -->
+                <param name="indev" value="#${indev}"/>
+                <!-- device to use for output -->
+                <param name="outdev" value="#${outdev}"/>
+                <param name="ringdev" value="#${ringdev}"/>
+                <param name="ring-file" value="${ring-file}"/>
+                <param name="ring-interval" value="${ring-interval}"/>
+                <param name="hold-file" value="${hold-file}"/>
+                <!--<param name="timer-name" value="soft"/>-->
+                <param name="dialplan" value="XML"/>
+                <param name="cid-name" value="${cid-name}"/>
+                <param name="cid-num" value="${cid-num}"/>
+                <param name="sample-rate" value="${sample-rate}"/>
+                <param name="codec-ms" value="${codec-ms}"/>
+            </settings>
+        </configuration>
+    </section>
+</document>
+

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/sofia.conf.xml

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/sofia.conf.xml (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/conf/sofia.conf.xml) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/sofia.conf.xml	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/conf/sofia.conf.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,45 @@
+<document type="freeswitch/xml">
+	<section name="configuration">
+		<configuration name="sofia.conf" description="sofia Endpoint">
+			<global_settings>
+				<param name="log-level" value="${log-level}"/>
+				<param name="auto-restart" value="${auto-restart}"/>
+				<param name="debug-presence" value="${debug-presence}"/>
+				<param name="rewrite-multicasted-fs-path" value="${rewrite-multicasted-fs-path}"/>
+			</global_settings>
+			<profiles>
+				<profile name="softphone">
+					<settings>
+                                         <param name="user-agent-string" value="${user-agent-string)"/>
+                                         <param name="debug" value="${debug}"/>
+                                         <param name="sip-trace" value="${sip-trace}"/>
+                                         <param name="context" value="${context}"/>
+                                         <param name="rfc2833-pt" value="${rfc2833-pt}"/>
+                                         <param name="sip-port" value="${sip-port}"/>
+                                         <param name="dialplan" value="${dialplan}"/>
+                                         <param name="dtmf-duration" value="${dtmf-duration}"/>
+                                         <param name="codec-prefs" value="${codec_prefs}"/>
+                                         <param name="use-rtp-timer" value="${use-rtp-timer}"/>
+                                         <param name="rtp-timer-name" value="${rtp-timer-name}"/>
+                                         <param name="rtp-ip" value="${rtp-ip}"/>
+                                         <param name="sip-ip" value="${sip-ip}"/>
+                                         <param name="hold-music" value="${hold-music}"/>
+                                         <param name="apply-nat-acl" value="${apply-nat-acl}"/>
+                                         <param name="manage-presence" value="${manage-presence}"/>
+                                         <param name="max-proceeding" value="${max-proceeding}"/>
+                                         <param name="inbound-codec-negotiation" value="${inbound-codec-negotiation}"/>
+                                         <param name="nonce-ttl" value="${nonce-ttl}"/>
+                                         <param name="auth-calls" value="${auth-calls}"/>
+                                         <param name="auth-all-packets" value="${auth-all-packets}"/>
+                                         <param name="ext-rtp-ip" value="${ext-rtp-ip}"/>
+                                         <param name="ext-sip-ip" value="${ext-sip-ip}"/>
+                                         <param name="rtp-timeout-sec" value="${rtp-timeout-sec}"/>
+                                         <param name="rtp-hold-timeout-sec" value="${rtp-hold-timeout-sec}"/>
+                                         <param name="disable-register" value="${disable-register}"/>
+                                         <param name="challenge-realm" value="${challenge-realm}"/>
+					</settings>
+				</profile>
+			</profiles>
+		</configuration>
+	</section>
+</document>

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/fshost.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/fshost.cpp (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/fshost.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/fshost.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/fshost.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,359 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita <jmesquita@freeswitch.org>
+ *
+ */
+
+#include <QtGui>
+#include "fshost.h"
+#include "call.h"
+#include "mod_qsettings/mod_qsettings.h"
+
+/* Declare it globally */
+FSHost g_FSHost;
+
+FSHost::FSHost(QObject *parent) :
+    QThread(parent)
+{
+    /* Initialize libs & globals */
+    qDebug() << "Initializing globals..." << endl;
+    switch_core_setrlimits();
+    switch_core_set_globals();
+
+    qRegisterMetaType<Call>("Call");
+
+}
+
+void FSHost::run(void)
+{
+    switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT;
+    const char *err = NULL;
+    switch_bool_t console = SWITCH_FALSE;
+    switch_status_t destroy_status;
+
+    /* Create directory structure for softphone with default configs */
+    QDir conf_dir = QDir(QDir::home());
+    if (!conf_dir.exists(".fscomm"))
+    {
+        conf_dir.mkpath(".fscomm/conf/accounts");
+        conf_dir.mkpath(".fscomm/sounds");
+        QFile::copy(":/sounds/test.wav", QString("%1/.fscomm/sounds/test.wav").arg(QDir::homePath()));
+        conf_dir.mkpath(".fscomm/templates");
+        QFile rootXML(":/confs/freeswitch.xml");
+        QString dest = QString("%1/.fscomm/conf/freeswitch.xml").arg(conf_dir.absolutePath());
+        rootXML.copy(dest);
+
+        QFile defaultAccount(":/confs/example.xml");
+        dest = QString("%1/.fscomm/conf/accounts/example.xml").arg(conf_dir.absolutePath());
+        defaultAccount.copy(dest);
+    }
+
+    /* Set all directories to the home user directory */
+    if (conf_dir.cd(".fscomm"))
+    {
+        SWITCH_GLOBAL_dirs.conf_dir = (char *) malloc(strlen(QString("%1/conf").arg(conf_dir.absolutePath()).toAscii().constData()) + 1);
+        if (!SWITCH_GLOBAL_dirs.conf_dir) {
+            emit coreLoadingError("Cannot allocate memory for conf_dir.");
+        }
+        strcpy(SWITCH_GLOBAL_dirs.conf_dir, QString("%1/conf").arg(conf_dir.absolutePath()).toAscii().constData());
+
+        SWITCH_GLOBAL_dirs.log_dir = (char *) malloc(strlen(QString("%1/log").arg(conf_dir.absolutePath()).toAscii().constData()) + 1);
+        if (!SWITCH_GLOBAL_dirs.log_dir) {
+            emit coreLoadingError("Cannot allocate memory for log_dir.");
+        }
+        strcpy(SWITCH_GLOBAL_dirs.log_dir, QString("%1/log").arg(conf_dir.absolutePath()).toAscii().constData());
+
+        SWITCH_GLOBAL_dirs.run_dir = (char *) malloc(strlen(QString("%1/run").arg(conf_dir.absolutePath()).toAscii().constData()) + 1);
+        if (!SWITCH_GLOBAL_dirs.run_dir) {
+            emit coreLoadingError("Cannot allocate memory for run_dir.");
+        }
+        strcpy(SWITCH_GLOBAL_dirs.run_dir, QString("%1/run").arg(conf_dir.absolutePath()).toAscii().constData());
+
+        SWITCH_GLOBAL_dirs.db_dir = (char *) malloc(strlen(QString("%1/db").arg(conf_dir.absolutePath()).toAscii().constData()) + 1);
+        if (!SWITCH_GLOBAL_dirs.db_dir) {
+            emit coreLoadingError("Cannot allocate memory for db_dir.");
+        }
+        strcpy(SWITCH_GLOBAL_dirs.db_dir, QString("%1/db").arg(conf_dir.absolutePath()).toAscii().constData());
+
+        SWITCH_GLOBAL_dirs.script_dir = (char *) malloc(strlen(QString("%1/script").arg(conf_dir.absolutePath()).toAscii().constData()) + 1);
+        if (!SWITCH_GLOBAL_dirs.script_dir) {
+            emit coreLoadingError("Cannot allocate memory for script_dir.");
+        }
+        strcpy(SWITCH_GLOBAL_dirs.script_dir, QString("%1/script").arg(conf_dir.absolutePath()).toAscii().constData());
+
+        SWITCH_GLOBAL_dirs.htdocs_dir = (char *) malloc(strlen(QString("%1/htdocs").arg(conf_dir.absolutePath()).toAscii().constData()) + 1);
+        if (!SWITCH_GLOBAL_dirs.htdocs_dir) {
+            emit coreLoadingError("Cannot allocate memory for htdocs_dir.");
+        }
+        strcpy(SWITCH_GLOBAL_dirs.htdocs_dir, QString("%1/htdocs").arg(conf_dir.absolutePath()).toAscii().constData());
+    }
+
+    /* If you need to override configuration directories, you need to change them in the SWITCH_GLOBAL_dirs global structure */
+    qDebug() << "Initializing core..." << endl;
+    /* Initialize the core and load modules, that will startup FS completely */
+    if (switch_core_init(flags, console, &err) != SWITCH_STATUS_SUCCESS) {
+        fprintf(stderr, "Failed to initialize FreeSWITCH's core: %s\n", err);
+        emit coreLoadingError(err);
+    }
+
+    qDebug() << "Everything OK, Entering runtime loop ..." << endl;
+
+    if (switch_event_bind("FSHost", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, eventHandlerCallback, NULL) != SWITCH_STATUS_SUCCESS) {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
+    }
+
+    /* Load our QSettings module */
+    if (mod_qsettings_load() != SWITCH_STATUS_SUCCESS)
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't load mod_qsettings\n");
+    }
+
+    if (switch_core_init_and_modload(flags, console, &err) != SWITCH_STATUS_SUCCESS) {
+        fprintf(stderr, "Failed to initialize FreeSWITCH's core: %s\n", err);
+        emit coreLoadingError(err);
+    }
+
+    emit ready();
+    /* Go into the runtime loop. If the argument is true, this basically sets runtime.running = 1 and loops while that is set
+     * If its false, it initializes the libedit for the console, then does the same thing
+     */
+    switch_core_runtime_loop(!console);
+    fflush(stdout);
+
+
+    switch_event_unbind_callback(eventHandlerCallback);
+    /* When the runtime loop exits, its time to shutdown */
+    destroy_status = switch_core_destroy();
+    if (destroy_status == SWITCH_STATUS_SUCCESS)
+    {
+        qDebug() << "We have properly shutdown the core." << endl;
+    }
+}
+
+switch_status_t FSHost::processAlegEvent(switch_event_t * event, QString uuid)
+{
+    switch_status_t status = SWITCH_STATUS_SUCCESS;
+    Call * call = _active_calls.value(uuid);
+    /* Inbound call */
+    if (call->getDirection() == FSCOMM_CALL_DIRECTION_INBOUND)
+    {
+        switch(event->event_id) {
+        case SWITCH_EVENT_CHANNEL_ANSWER:
+            {
+                call->setbUUID(switch_event_get_header_nil(event, "Other-Leg-Unique-ID"));
+                _bleg_uuids.insert(switch_event_get_header_nil(event, "Other-Leg-Unique-ID"), uuid);
+                call->setState(FSCOMM_CALL_STATE_ANSWERED);
+                emit answered(uuid);
+                break;
+            }
+        case SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE:
+            {
+                emit hungup(_active_calls.take(uuid));
+                break;
+            }
+        case SWITCH_EVENT_CHANNEL_STATE:
+            {
+                printf("CHANNEL_STATE Answer-State: %s | Channel-State: %s | %s | %s\n", switch_event_get_header_nil(event, "Answer-State"),switch_event_get_header_nil(event, "Channel-State"), uuid.toAscii().constData(), switch_event_get_header_nil(event, "Other-Leg-Unique-ID"));
+                break;
+            }
+        default:
+            {
+                break;
+            }
+        }
+    }
+    /* Outbound call */
+    else
+    {
+        switch(event->event_id)
+        {
+        case SWITCH_EVENT_CHANNEL_BRIDGE:
+            {
+                _active_calls.value(uuid)->setbUUID(switch_event_get_header_nil(event, "Other-Leg-Unique-ID"));
+                _bleg_uuids.insert(switch_event_get_header_nil(event, "Other-Leg-Unique-ID"), uuid);
+                break;
+            }
+        case SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE:
+            {
+                if (call->getState() == FSCOMM_CALL_STATE_TRYING)
+                {
+                    emit callFailed(uuid);
+                    _active_calls.take(uuid);
+                }
+                break;
+            }
+        default:
+            printf("A leg: %s(%s)\n",switch_event_name(event->event_id), switch_event_get_header_nil(event, "Event-Subclass"));
+            break;
+        }
+    }
+    return status;
+}
+
+switch_status_t FSHost::processBlegEvent(switch_event_t * event, QString buuid)
+{
+    QString uuid = _bleg_uuids.value(buuid);
+    switch_status_t status = SWITCH_STATUS_SUCCESS;
+    Call * call = _active_calls.value(uuid);
+    /* Inbound call */
+    if (call->getDirection() == FSCOMM_CALL_DIRECTION_INBOUND)
+    {
+        qDebug() << " Inbound call";
+    }
+    /* Outbound call */
+    else
+    {
+        switch(event->event_id)
+        {
+        case SWITCH_EVENT_CHANNEL_ANSWER:
+            {
+                emit answered(uuid);
+                break;
+            }
+        case SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE:
+            {
+                emit hungup(_active_calls.take(uuid));
+                _bleg_uuids.take(buuid);
+                break;
+            }
+        case SWITCH_EVENT_CHANNEL_STATE:
+            {
+                if (QString(switch_event_get_header_nil(event, "Answer-State")) == "early")
+                {
+                    call->setState(FSCOMM_CALL_STATE_RINGING);
+                    emit ringing(uuid);
+                }
+                //printEventHeaders(event);
+                break;
+            }
+
+        default:
+            printf("B leg: %s(%s)\n",switch_event_name(event->event_id), switch_event_get_header_nil(event, "Event-Subclass"));
+            break;
+        }
+    }
+    return status;
+}
+
+void FSHost::generalEventHandler(switch_event_t *event)
+{
+    QString uuid = switch_event_get_header_nil(event, "Unique-ID");
+
+    if (_bleg_uuids.contains(uuid))
+    {
+        if (processBlegEvent(event, uuid) == SWITCH_STATUS_SUCCESS)
+        {
+            return;
+        }
+    }
+    if (_active_calls.contains(uuid))
+    {
+        if (processAlegEvent(event, uuid) == SWITCH_STATUS_SUCCESS)
+        {
+            return;
+        }
+    }
+
+    /* This is how we identify new calls, inbound and outbound */
+    switch(event->event_id) {
+    case SWITCH_EVENT_CUSTOM:
+        {
+            if (strcmp(event->subclass_name, "portaudio::ringing") == 0 && !_active_calls.contains(uuid))
+            {
+                Call *call = new Call(atoi(switch_event_get_header_nil(event, "call_id")),
+                                      switch_event_get_header_nil(event, "Caller-Caller-ID-Name"),
+                                      switch_event_get_header_nil(event, "Caller-Caller-ID-Number"),
+                                      FSCOMM_CALL_DIRECTION_INBOUND,
+                                      uuid);
+                _active_calls.insert(uuid, call);
+                call->setState(FSCOMM_CALL_STATE_RINGING);
+                emit ringing(uuid);
+            }
+            else if (strcmp(event->subclass_name, "portaudio::makecall") == 0)
+            {
+                Call *call = new Call(atoi(switch_event_get_header_nil(event, "call_id")),NULL,
+                                      switch_event_get_header_nil(event, "Caller-Destination-Number"),
+                                      FSCOMM_CALL_DIRECTION_OUTBOUND,
+                                      uuid);
+                _active_calls.insert(uuid, call);
+                call->setState(FSCOMM_CALL_STATE_TRYING);
+                emit newOutgoingCall(uuid);
+            }
+            else if (strcmp(event->subclass_name, "sofia::gateway_state") == 0)
+            {
+                QString state = switch_event_get_header_nil(event, "State");
+                QString gw = switch_event_get_header_nil(event, "Gateway");
+                if (state == "TRYING")
+                    emit gwStateChange(gw, FSCOMM_GW_STATE_TRYING);
+                else if (state == "REGISTER")
+                    emit gwStateChange(gw, FSCOMM_GW_STATE_REGISTER);
+                else if (state == "REGED")
+                    emit gwStateChange(gw, FSCOMM_GW_STATE_REGED);
+                else if (state == "UNREGED")
+                    emit gwStateChange(gw, FSCOMM_GW_STATE_UNREGED);
+                else if (state == "UNREGISTER")
+                    emit gwStateChange(gw, FSCOMM_GW_STATE_UNREGISTER);
+                else if (state =="FAILED")
+                    emit gwStateChange(gw, FSCOMM_GW_STATE_FAILED);
+                else if (state == "FAIL_WAIT")
+                    emit gwStateChange(gw, FSCOMM_GW_STATE_FAIL_WAIT);
+                else if (state == "EXPIRED")
+                    emit gwStateChange(gw, FSCOMM_GW_STATE_EXPIRED);
+                else if (state == "NOREG")
+                    emit gwStateChange(gw, FSCOMM_GW_STATE_NOREG);
+            }
+            else
+            {
+                //printf("We got a not treated custom event: %s\n", (!zstr(event->subclass_name) ? event->subclass_name : "NULL"));
+            }
+            break;
+        }
+    default:
+        break;
+    }
+}
+
+switch_status_t FSHost::sendCmd(const char *cmd, const char *args, QString *res)
+{
+    switch_status_t status = SWITCH_STATUS_FALSE;
+    switch_stream_handle_t stream = { 0 };
+    SWITCH_STANDARD_STREAM(stream);
+    qDebug() << "Sending command: " << cmd << args << endl;
+    status = switch_api_execute(cmd, args, NULL, &stream);
+    *res = switch_str_nil((char *) stream.data);
+
+    return status;
+}
+
+void FSHost::printEventHeaders(switch_event_t *event)
+{
+    switch_event_header_t *hp;
+    printf("Received event: %s(%s)\n", switch_event_name(event->event_id), switch_event_get_header_nil(event, "Event-Subclass"));
+    for (hp = event->headers; hp; hp = hp->next) {
+        printf("%s=%s\n", hp->name, hp->value);
+    }
+    printf("\n\n");
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/fshost.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/fshost.h (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/fshost.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/fshost.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/fshost.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,106 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita <jmesquita@freeswitch.org>
+ *
+ */
+#ifndef FSHOST_H
+#define FSHOST_H
+
+#include <QThread>
+#include <QHash>
+#include <switch.h>
+
+class Call;
+
+#define FSCOMM_GW_STATE_TRYING 0
+#define FSCOMM_GW_STATE_REGISTER 1
+#define FSCOMM_GW_STATE_REGED 2
+#define FSCOMM_GW_STATE_UNREGED 3
+#define FSCOMM_GW_STATE_UNREGISTER 4
+#define FSCOMM_GW_STATE_FAILED 5
+#define FSCOMM_GW_STATE_FAIL_WAIT 6
+#define FSCOMM_GW_STATE_EXPIRED 7
+#define FSCOMM_GW_STATE_NOREG 8
+
+static const char *fscomm_gw_state_names[] = {
+    "TRYING",
+    "REGISTER",
+    "REGED",
+    "UNREGED",
+    "UNREGISTER",
+    "FAILED",
+    "FAIL_WAIT",
+    "EXPIRED",
+    "NOREG"
+};
+
+class FSHost : public QThread
+{
+Q_OBJECT
+public:
+    explicit FSHost(QObject *parent = 0);
+    switch_status_t sendCmd(const char *cmd, const char *args, QString *res);
+    void generalEventHandler(switch_event_t *event);
+    Call * getCallByUUID(QString uuid) { return _active_calls.value(uuid, NULL); }
+    QString getGwStateName(int id) { return fscomm_gw_state_names[id]; }
+
+protected:
+    void run(void);
+
+signals:
+    void coreLoadingError(QString);
+    void ready(void);
+    void ringing(QString);
+    void answered(QString);
+    void newOutgoingCall(QString);
+    void callFailed(QString);
+    void hungup(Call*);
+    void gwStateChange(QString, int);
+
+private:
+    switch_status_t processBlegEvent(switch_event_t *, QString);
+    switch_status_t processAlegEvent(switch_event_t *, QString);
+    void printEventHeaders(switch_event_t *event);
+    QHash<QString, Call*> _active_calls;
+    QHash<QString, QString> _bleg_uuids;
+};
+
+extern FSHost g_FSHost;
+
+/*
+   Used to match callback from fs core. We dup the event and call the class
+   method callback to make use of the signal/slot infrastructure.
+*/
+static void eventHandlerCallback(switch_event_t *event)
+{
+    switch_event_t *clone = NULL;
+    if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) {
+        g_FSHost.generalEventHandler(clone);
+    }
+    switch_safe_free(clone);
+}
+
+#endif // FSHOST_H

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/main.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/main.cpp (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/main.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/main.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/main.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,51 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita <jmesquita@freeswitch.org>
+ *
+ */
+
+#include <QtGui/QApplication>
+#include <QSplashScreen>
+#include "mainwindow.h"
+
+int main(int argc, char *argv[])
+{
+    QApplication a(argc, argv);
+    QCoreApplication::setOrganizationName("FreeSWITCH");
+    QCoreApplication::setOrganizationDomain("freeswitch.org");
+    QCoreApplication::setApplicationName("FSComm");
+
+    QPixmap image(":/images/splash.png");
+    QSplashScreen *splash = new QSplashScreen(image);
+    splash->show();
+    splash->showMessage("Loading, please wait...", Qt::AlignRight|Qt::AlignBottom, Qt::blue);
+
+    QObject::connect(&g_FSHost, SIGNAL(ready()), splash, SLOT(close()));
+    MainWindow w;    
+    QObject::connect(&g_FSHost, SIGNAL(ready()), &w, SLOT(show()));
+    g_FSHost.start();
+    return a.exec();
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/mainwindow.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/mainwindow.cpp (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/mainwindow.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/mainwindow.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/mainwindow.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,351 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita <jmesquita@freeswitch.org>
+ *
+ */
+
+#include <QInputDialog>
+#include <QMessageBox>
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+#include <switch_version.h>
+
+MainWindow::MainWindow(QWidget *parent) :
+    QMainWindow(parent),
+    ui(new Ui::MainWindow),
+    preferences(NULL)
+{
+    ui->setupUi(this);
+
+    dialpadMapper = new QSignalMapper(this);
+    connect(ui->dtmf0Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmf1Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmf2Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmf3Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmf4Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmf5Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmf6Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmf7Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmf8Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmf9Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmfABtn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmfBBtn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmfCBtn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmfDBtn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmfAstBtn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmfPoundBtn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    dialpadMapper->setMapping(ui->dtmf0Btn, QString("0"));
+    dialpadMapper->setMapping(ui->dtmf1Btn, QString("1"));
+    dialpadMapper->setMapping(ui->dtmf2Btn, QString("2"));
+    dialpadMapper->setMapping(ui->dtmf3Btn, QString("3"));
+    dialpadMapper->setMapping(ui->dtmf4Btn, QString("4"));
+    dialpadMapper->setMapping(ui->dtmf5Btn, QString("5"));
+    dialpadMapper->setMapping(ui->dtmf6Btn, QString("6"));
+    dialpadMapper->setMapping(ui->dtmf7Btn, QString("7"));
+    dialpadMapper->setMapping(ui->dtmf8Btn, QString("8"));
+    dialpadMapper->setMapping(ui->dtmf9Btn, QString("9"));
+    dialpadMapper->setMapping(ui->dtmfABtn, QString("A"));
+    dialpadMapper->setMapping(ui->dtmfBBtn, QString("B"));
+    dialpadMapper->setMapping(ui->dtmfCBtn, QString("C"));
+    dialpadMapper->setMapping(ui->dtmfDBtn, QString("D"));
+    dialpadMapper->setMapping(ui->dtmfAstBtn, QString("*"));
+    dialpadMapper->setMapping(ui->dtmfPoundBtn, QString("#"));
+    connect(dialpadMapper, SIGNAL(mapped(QString)), this, SLOT(dialDTMF(QString)));
+
+    connect(&g_FSHost, SIGNAL(ready()),this, SLOT(fshostReady()));
+    connect(&g_FSHost, SIGNAL(ringing(QString)), this, SLOT(ringing(QString)));
+    connect(&g_FSHost, SIGNAL(answered(QString)), this, SLOT(answered(QString)));
+    connect(&g_FSHost, SIGNAL(hungup(Call*)), this, SLOT(hungup(Call*)));
+    connect(&g_FSHost, SIGNAL(newOutgoingCall(QString)), this, SLOT(newOutgoingCall(QString)));
+    connect(&g_FSHost, SIGNAL(gwStateChange(QString,int)), this, SLOT(gwStateChanged(QString,int)));
+    /*connect(&g_FSHost, SIGNAL(coreLoadingError(QString)), this, SLOT(coreLoadingError(QString)));*/
+
+    connect(ui->newCallBtn, SIGNAL(clicked()), this, SLOT(makeCall()));
+    connect(ui->answerBtn, SIGNAL(clicked()), this, SLOT(paAnswer()));
+    connect(ui->hangupBtn, SIGNAL(clicked()), this, SLOT(paHangup()));
+    connect(ui->listCalls, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(callListDoubleClick(QListWidgetItem*)));
+    connect(ui->action_Preferences, SIGNAL(triggered()), this, SLOT(prefTriggered()));
+    connect(ui->action_Exit, SIGNAL(triggered()), this, SLOT(close()));
+    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
+}
+
+MainWindow::~MainWindow()
+{
+    delete ui;
+    QString res;
+    g_FSHost.sendCmd("fsctl", "shutdown", &res);
+    g_FSHost.wait();
+}
+
+void MainWindow::prefTriggered()
+{
+    if (!preferences)
+        preferences = new PrefDialog();
+
+    preferences->raise();
+    preferences->show();
+    preferences->activateWindow();
+}
+
+void MainWindow::coreLoadingError(QString err)
+{
+    QMessageBox::warning(this, "Error Loading Core...", err, QMessageBox::Ok);
+    QApplication::exit(255);
+}
+
+void MainWindow::gwStateChanged(QString gw, int state)
+{
+    ui->statusBar->showMessage(tr("Account %1 is %2").arg(gw, g_FSHost.getGwStateName(state)));
+
+    /* TODO: This should be placed somewhere else when the config handler is here... */
+    QList<QTableWidgetItem *> match = ui->tableAccounts->findItems(gw, Qt::MatchExactly);
+    if (match.isEmpty())
+    {
+        /* Create the damn thing */
+        ui->tableAccounts->setRowCount(ui->tableAccounts->rowCount()+1);
+        QTableWidgetItem *gwField = new QTableWidgetItem(gw);
+        QTableWidgetItem *stField = new QTableWidgetItem(g_FSHost.getGwStateName(state));
+        ui->tableAccounts->setItem(0,0,gwField);
+        ui->tableAccounts->setItem(0,1,stField);
+        ui->tableAccounts->resizeColumnsToContents();
+        return;
+    }
+
+    QTableWidgetItem *gwField = match.at(0);
+    QTableWidgetItem *stField = ui->tableAccounts->item(gwField->row(),1);
+    stField->setText(g_FSHost.getGwStateName(state));
+    ui->tableAccounts->resizeColumnsToContents();
+
+}
+
+void MainWindow::dialDTMF(QString dtmf)
+{
+    QString result;
+    QString dtmf_string = QString("dtmf %1").arg(dtmf);
+    if (g_FSHost.sendCmd("pa", dtmf_string.toAscii(), &result) == SWITCH_STATUS_FALSE) {
+        ui->textEdit->setText("Error sending that command");
+    }
+}
+
+void MainWindow::callListDoubleClick(QListWidgetItem *item)
+{
+    Call *call = g_FSHost.getCallByUUID(item->data(Qt::UserRole).toString());
+    QString switch_str = QString("switch %1").arg(call->getCallID());
+    QString result;
+    if (g_FSHost.sendCmd("pa", switch_str.toAscii(), &result) == SWITCH_STATUS_FALSE) {
+        ui->textEdit->setText(QString("Error switching to call %1").arg(call->getCallID()));
+        return;
+    }
+    ui->hangupBtn->setEnabled(true);
+}
+
+void MainWindow::makeCall()
+{
+    bool ok;
+    QString dialstring = QInputDialog::getText(this, tr("Make new call"),
+                                         tr("Number to dial:"), QLineEdit::Normal, NULL,&ok);
+
+    if (ok && !dialstring.isEmpty())
+    {
+        paCall(dialstring);
+    }
+}
+
+void MainWindow::fshostReady()
+{
+    ui->statusBar->showMessage("Ready");
+    ui->newCallBtn->setEnabled(true);
+    ui->textEdit->setEnabled(true);
+    ui->textEdit->setText("Ready to dial and receive calls!");
+}
+
+void MainWindow::paAnswer()
+{
+    QString result;
+    if (g_FSHost.sendCmd("pa", "answer", &result) == SWITCH_STATUS_FALSE) {
+        ui->textEdit->setText("Error sending that command");
+    }
+
+    ui->textEdit->setText("Talking...");
+    ui->hangupBtn->setEnabled(true);
+    ui->answerBtn->setEnabled(false);
+}
+
+void MainWindow::paCall(QString dialstring)
+{
+    QString result;
+
+    QString callstring = QString("call %1").arg(dialstring);
+
+    if (g_FSHost.sendCmd("pa", callstring.toAscii(), &result) == SWITCH_STATUS_FALSE) {
+        ui->textEdit->setText("Error sending that command");
+    }
+
+    ui->hangupBtn->setEnabled(true);
+}
+
+void MainWindow::paHangup()
+{
+    QString result;
+    if (g_FSHost.sendCmd("pa", "hangup", &result) == SWITCH_STATUS_FALSE) {
+        ui->textEdit->setText("Error sending that command");
+    }
+
+    ui->textEdit->setText("Click to dial number...");
+    ui->statusBar->showMessage("Call hungup");
+    ui->hangupBtn->setEnabled(false);
+}
+
+void MainWindow::newOutgoingCall(QString uuid)
+{
+    Call *call = g_FSHost.getCallByUUID(uuid);
+    ui->textEdit->setText(QString("Calling %1 (%2)").arg(call->getCidName(), call->getCidNumber()));
+    QListWidgetItem *item = new QListWidgetItem(tr("%1 (%2) - Calling").arg(call->getCidName(), call->getCidNumber()));
+    item->setData(Qt::UserRole, uuid);
+    ui->listCalls->addItem(item);
+    ui->hangupBtn->setEnabled(true);
+}
+
+void MainWindow::ringing(QString uuid)
+{
+
+    Call *call = g_FSHost.getCallByUUID(uuid);
+    for (int i=0; i<ui->listCalls->count(); i++)
+    {
+        QListWidgetItem *item = ui->listCalls->item(i);
+        if (item->data(Qt::UserRole).toString() == uuid)
+        {
+            item->setText(tr("%1 - Ringing").arg(call->getCidNumber()));
+            ui->textEdit->setText(QString("Call from %1 (%2)").arg(call->getCidName(), call->getCidNumber()));
+            return;
+        }
+    }
+
+    ui->textEdit->setText(QString("Call from %1 (%2)").arg(call->getCidName(), call->getCidNumber()));
+    QListWidgetItem *item = new QListWidgetItem(tr("%1 (%2) - Ringing").arg(call->getCidName(), call->getCidNumber()));
+    item->setData(Qt::UserRole, uuid);
+    ui->listCalls->addItem(item);
+    ui->answerBtn->setEnabled(true);
+}
+
+void MainWindow::answered(QString uuid)
+{
+    Call *call = g_FSHost.getCallByUUID(uuid);
+    for (int i=0; i<ui->listCalls->count(); i++)
+    {
+        QListWidgetItem *item = ui->listCalls->item(i);
+        if (item->data(Qt::UserRole).toString() == uuid)
+        {
+            if (call->getDirection() == FSCOMM_CALL_DIRECTION_INBOUND)
+            {
+                item->setText(tr("%1 (%2) - Active").arg(call->getCidName(), call->getCidNumber()));
+                break;
+            }
+            else
+            {
+                item->setText(tr("%1 - Active").arg(call->getCidNumber()));
+                break;
+            }
+        }
+    }
+    ui->dtmf0Btn->setEnabled(true);
+    ui->dtmf1Btn->setEnabled(true);
+    ui->dtmf2Btn->setEnabled(true);
+    ui->dtmf3Btn->setEnabled(true);
+    ui->dtmf4Btn->setEnabled(true);
+    ui->dtmf5Btn->setEnabled(true);
+    ui->dtmf6Btn->setEnabled(true);
+    ui->dtmf7Btn->setEnabled(true);
+    ui->dtmf8Btn->setEnabled(true);
+    ui->dtmf9Btn->setEnabled(true);
+    ui->dtmfABtn->setEnabled(true);
+    ui->dtmfBBtn->setEnabled(true);
+    ui->dtmfCBtn->setEnabled(true);
+    ui->dtmfDBtn->setEnabled(true);
+    ui->dtmfAstBtn->setEnabled(true);
+    ui->dtmfPoundBtn->setEnabled(true);
+}
+
+void MainWindow::hungup(Call* call)
+{
+    for (int i=0; i<ui->listCalls->count(); i++)
+    {
+        QListWidgetItem *item = ui->listCalls->item(i);
+        if (item->data(Qt::UserRole).toString() == call->getUUID())
+        {
+            delete ui->listCalls->takeItem(i);
+            break;
+        }
+    }
+    ui->textEdit->setText(tr("Call with %1 (%2) hungup.").arg(call->getCidName(), call->getCidNumber()));
+    /* TODO: Will cause problems if 2 calls are received at the same time */
+    ui->answerBtn->setEnabled(false);
+    ui->hangupBtn->setEnabled(false);
+    ui->dtmf0Btn->setEnabled(false);
+    ui->dtmf1Btn->setEnabled(false);
+    ui->dtmf2Btn->setEnabled(false);
+    ui->dtmf3Btn->setEnabled(false);
+    ui->dtmf4Btn->setEnabled(false);
+    ui->dtmf5Btn->setEnabled(false);
+    ui->dtmf6Btn->setEnabled(false);
+    ui->dtmf7Btn->setEnabled(false);
+    ui->dtmf8Btn->setEnabled(false);
+    ui->dtmf9Btn->setEnabled(false);
+    ui->dtmfABtn->setEnabled(false);
+    ui->dtmfBBtn->setEnabled(false);
+    ui->dtmfCBtn->setEnabled(false);
+    ui->dtmfDBtn->setEnabled(false);
+    ui->dtmfAstBtn->setEnabled(false);
+    ui->dtmfPoundBtn->setEnabled(false);
+    delete call;
+}
+
+void MainWindow::changeEvent(QEvent *e)
+{
+    QMainWindow::changeEvent(e);
+    switch (e->type()) {
+    case QEvent::LanguageChange:
+        ui->retranslateUi(this);
+        break;
+    default:
+        break;
+    }
+}
+
+void MainWindow::showAbout()
+{
+    QString result;
+    g_FSHost.sendCmd("version", "", &result);
+
+    QMessageBox::about(this, tr("About FSComm"),
+                       tr("<h2>FSComm</h2>"
+                          "<p>Author: Jo&atilde;o Mesquita &lt;jmesquita@freeswitch.org>"
+                          "<p>FsComm is a softphone based on libfreeswitch."
+                          "<p>The FreeSWITCH&trade; images and name are trademark of"
+                          " Anthony Minessale II, primary author of FreeSWITCH&trade;."
+                          "<p>Compiled FSComm version: %1"
+                          "<p>%2").arg(SWITCH_VERSION_FULL, result));
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/mainwindow.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/mainwindow.h (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/mainwindow.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/mainwindow.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/mainwindow.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,82 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita <jmesquita@freeswitch.org>
+ *
+ */
+
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+#include <QListWidgetItem>
+#include <QSignalMapper>
+#include <switch.h>
+#include <fshost.h>
+#include <call.h>
+#include "preferences/prefdialog.h"
+
+namespace Ui {
+    class MainWindow;
+}
+
+
+class MainWindow : public QMainWindow {
+    Q_OBJECT
+public:
+    MainWindow(QWidget *parent = 0);
+    ~MainWindow();
+
+protected:
+    void changeEvent(QEvent *e);
+
+signals:
+    void dtmfDialed(QString);
+
+private slots:
+    void showAbout();
+    void prefTriggered();
+    void coreLoadingError(QString);
+    void gwStateChanged(QString, int);
+    void dialDTMF(QString);
+    void callListDoubleClick(QListWidgetItem *);
+    void makeCall();
+    void fshostReady();
+    void paAnswer();
+    void paCall(QString);
+    void paHangup();
+    void newOutgoingCall(QString);
+    void ringing(QString);
+    void answered(QString);
+    void hungup(Call*);
+
+private:
+    Ui::MainWindow *ui;
+    QSignalMapper *dialpadMapper;
+    PrefDialog *preferences;
+};
+
+#endif // MAINWINDOW_H

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/mainwindow.ui

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/mainwindow.ui (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/mainwindow.ui) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/mainwindow.ui	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/mainwindow.ui	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,362 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>670</width>
+    <height>541</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>FSComm - A FreeSWITCH Communicator</string>
+  </property>
+  <widget class="QWidget" name="centralWidget">
+   <layout class="QHBoxLayout" name="horizontalLayout_4">
+    <item>
+     <layout class="QVBoxLayout" name="verticalLayout_2">
+      <item>
+       <widget class="QTextEdit" name="textEdit">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+        <property name="readOnly">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout">
+        <item>
+         <widget class="QPushButton" name="newCallBtn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>New Call</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QGridLayout" name="gridLayout_2">
+        <item row="0" column="0">
+         <widget class="QPushButton" name="answerBtn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>Answer</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="1">
+         <widget class="QPushButton" name="hangupBtn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>Hangup</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QGridLayout" name="gridLayout">
+        <item row="0" column="0">
+         <widget class="QPushButton" name="dtmf1Btn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>1</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="1">
+         <widget class="QPushButton" name="dtmf2Btn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>2</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="2">
+         <widget class="QPushButton" name="dtmf3Btn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>3</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="0">
+         <widget class="QPushButton" name="dtmf4Btn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>4</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="1">
+         <widget class="QPushButton" name="dtmf5Btn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>5</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="2">
+         <widget class="QPushButton" name="dtmf6Btn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>6</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="0">
+         <widget class="QPushButton" name="dtmf7Btn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>7</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="1">
+         <widget class="QPushButton" name="dtmf8Btn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>8</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="2">
+         <widget class="QPushButton" name="dtmf9Btn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>9</string>
+          </property>
+         </widget>
+        </item>
+        <item row="3" column="0">
+         <widget class="QPushButton" name="dtmfAstBtn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>*</string>
+          </property>
+         </widget>
+        </item>
+        <item row="3" column="1">
+         <widget class="QPushButton" name="dtmf0Btn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>0</string>
+          </property>
+         </widget>
+        </item>
+        <item row="3" column="2">
+         <widget class="QPushButton" name="dtmfPoundBtn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>#</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="3">
+         <widget class="QPushButton" name="dtmfABtn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>A</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="3">
+         <widget class="QPushButton" name="dtmfBBtn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>B</string>
+          </property>
+         </widget>
+        </item>
+        <item row="3" column="3">
+         <widget class="QPushButton" name="dtmfDBtn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>D</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="3">
+         <widget class="QPushButton" name="dtmfCBtn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>C</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </item>
+    <item>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <widget class="QGroupBox" name="groupBox">
+        <property name="title">
+         <string>Active Calls</string>
+        </property>
+        <layout class="QHBoxLayout" name="horizontalLayout_3">
+         <item>
+          <widget class="QListWidget" name="listCalls"/>
+         </item>
+        </layout>
+       </widget>
+      </item>
+      <item>
+       <widget class="QGroupBox" name="groupBox_2">
+        <property name="title">
+         <string>Active Accounts</string>
+        </property>
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <item>
+          <widget class="QTableWidget" name="tableAccounts">
+           <property name="editTriggers">
+            <set>QAbstractItemView::NoEditTriggers</set>
+           </property>
+           <property name="alternatingRowColors">
+            <bool>false</bool>
+           </property>
+           <property name="selectionMode">
+            <enum>QAbstractItemView::NoSelection</enum>
+           </property>
+           <property name="selectionBehavior">
+            <enum>QAbstractItemView::SelectRows</enum>
+           </property>
+           <property name="showGrid">
+            <bool>false</bool>
+           </property>
+           <property name="cornerButtonEnabled">
+            <bool>true</bool>
+           </property>
+           <property name="rowCount">
+            <number>0</number>
+           </property>
+           <attribute name="horizontalHeaderVisible">
+            <bool>true</bool>
+           </attribute>
+           <attribute name="horizontalHeaderCascadingSectionResizes">
+            <bool>false</bool>
+           </attribute>
+           <attribute name="verticalHeaderVisible">
+            <bool>false</bool>
+           </attribute>
+           <attribute name="verticalHeaderHighlightSections">
+            <bool>false</bool>
+           </attribute>
+           <column>
+            <property name="text">
+             <string>Account</string>
+            </property>
+           </column>
+           <column>
+            <property name="text">
+             <string>Status</string>
+            </property>
+           </column>
+          </widget>
+         </item>
+        </layout>
+       </widget>
+      </item>
+     </layout>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QMenuBar" name="menuBar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>670</width>
+     <height>24</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menu_File">
+    <property name="title">
+     <string>&amp;File</string>
+    </property>
+    <addaction name="action_Preferences"/>
+    <addaction name="separator"/>
+    <addaction name="action_Exit"/>
+   </widget>
+   <widget class="QMenu" name="menuHelp">
+    <property name="title">
+     <string>Help</string>
+    </property>
+    <addaction name="actionAbout"/>
+   </widget>
+   <addaction name="menu_File"/>
+   <addaction name="menuHelp"/>
+  </widget>
+  <widget class="QToolBar" name="mainToolBar">
+   <attribute name="toolBarArea">
+    <enum>TopToolBarArea</enum>
+   </attribute>
+   <attribute name="toolBarBreak">
+    <bool>false</bool>
+   </attribute>
+  </widget>
+  <widget class="QStatusBar" name="statusBar"/>
+  <action name="action_Preferences">
+   <property name="text">
+    <string>&amp;Preferences</string>
+   </property>
+  </action>
+  <action name="action_Exit">
+   <property name="text">
+    <string>&amp;Exit</string>
+   </property>
+  </action>
+  <action name="actionAbout">
+   <property name="text">
+    <string>About</string>
+   </property>
+  </action>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections/>
+</ui>

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/mod_qsettings (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/mod_qsettings)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/mod_qsettings/mod_qsettings.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/mod_qsettings/mod_qsettings.cpp (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/mod_qsettings/mod_qsettings.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/mod_qsettings/mod_qsettings.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/mod_qsettings/mod_qsettings.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,142 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Joao Mesquita <jmesquita@freeswitch.org>
+ *
+ *
+ * Description:
+ * Module to load configurations from Qt preference system QSettings
+ *
+ */
+#include <QString>
+#include <QtGui>
+#include <QDir>
+#include "mod_qsettings/mod_qsettings.h"
+
+switch_xml_t XMLBinding::getConfigXML(QString tmpl)
+{
+    switch_event_t *e;
+    switch_event_create_plain(&e, SWITCH_EVENT_REQUEST_PARAMS);
+    switch_assert(e);
+
+    if (QFile::exists(QString("%1/.fscomm/templates/%2.xml").arg(QDir::homePath(),tmpl))) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
+                          "Using template .fscomm/templates/%s.xml\n",
+                          tmpl.toAscii().constData());
+    }
+    else if(QFile::exists(QString(":/confs/%1.xml").arg(tmpl)))
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
+                          "Template %s.xml, doesn't exist on directory, copying embedded template.\n",
+                          tmpl.toAscii().constData());
+        QString dest = QString("%1/.fscomm/templates/%2.xml").arg(QDir::homePath(),tmpl);
+        QString orig = QString(":/confs/%1.xml").arg(tmpl);
+        QFile::copy(orig, dest);
+    }
+
+    QFile tmplFile(QString("%1/.fscomm/templates/%2.xml").arg(QDir::homePath(),tmpl));
+    if (!tmplFile.open(QIODevice::ReadOnly | QIODevice::Text))
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Template %s could not be read!\n", tmpl.toAscii().constData());
+        return NULL;
+    }
+
+    /* Open template file and expand all strings based on QSettings */
+    QByteArray tmplContents(tmplFile.readAll());
+    tmplFile.close();
+
+    _settings->beginGroup("FreeSWITCH/conf");
+    _settings->beginGroup(tmpl);
+    foreach(QString k, _settings->childKeys())
+    {
+        switch_event_add_header_string(e, SWITCH_STACK_BOTTOM, k.toAscii().constData(), _settings->value(k).toByteArray().constData());
+    }
+    _settings->endGroup();
+    _settings->endGroup();
+
+    char *res = switch_event_expand_headers(e, tmplContents.data());
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Template %s as follows:\n%s", tmpl.toAscii().constData(), res);
+    switch_safe_free(e);
+    return switch_xml_parse_str(res, strlen(res));
+}
+
+static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
+                                  void *user_data)
+{
+    XMLBinding *binding = (XMLBinding *) user_data;
+
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "We are being requested -> section: %s | tag_name: %s | key_name: %s | key_value: %s!\n",
+                      section, tag_name, key_name, key_value);
+    if (!binding) {
+        return NULL;
+    }
+
+    return binding->getConfigXML(key_value);
+}
+
+static switch_status_t do_config(void)
+{
+    char *cf = "qsettings.conf";
+    switch_xml_t cfg, xml, bindings_tag;
+    XMLBinding *binding = 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);
+        return SWITCH_STATUS_TERM;
+    }
+
+    if (!(bindings_tag = switch_xml_child(cfg, "bindings"))) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing <bindings> tag!\n");
+        switch_xml_free(xml);
+        return SWITCH_STATUS_FALSE;
+    }
+
+    QString bind_mask = switch_xml_attr_soft(bindings_tag, "value");
+    if (!bind_mask.isEmpty())
+    {
+        binding = new XMLBinding(bind_mask);
+    }
+
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding XML Fetch Function [%s]\n",
+                      binding->getBinding().isEmpty() ? "all" : binding->getBinding().toAscii().constData());
+    switch_xml_bind_search_function(xml_url_fetch, switch_xml_parse_section_string(binding->getBinding().toAscii().constData()), binding);
+    binding = NULL;
+
+    switch_xml_free(xml);
+    return SWITCH_STATUS_SUCCESS;
+}
+
+switch_status_t mod_qsettings_load(void)
+{
+
+    if (do_config() == SWITCH_STATUS_SUCCESS) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Sucessfully configured.\n");
+    } else {
+        return SWITCH_STATUS_FALSE;
+    }
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "We loaded mod_qsettings.\n");
+
+    return SWITCH_STATUS_SUCCESS;
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/mod_qsettings/mod_qsettings.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/mod_qsettings/mod_qsettings.h (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/mod_qsettings/mod_qsettings.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/mod_qsettings/mod_qsettings.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/mod_qsettings/mod_qsettings.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,50 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita <jmesquita@freeswitch.org>
+ *
+ */
+
+#ifndef MOD_QSETTINGS_H
+#define MOD_QSETTINGS_H
+
+#include <QString>
+#include <QSettings>
+#include <switch.h>
+
+switch_status_t mod_qsettings_load(void);
+
+class XMLBinding
+{
+public:
+    XMLBinding(QString binding) : _binding(binding), _settings(new QSettings) {}
+    QString getBinding(void) { return _binding; }
+    switch_xml_t getConfigXML(QString);
+private:
+    QString _binding;
+    QSettings* _settings;
+};
+
+#endif // MOD_QSETTINGS_H

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/preferences)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/accountdialog.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/accountdialog.cpp (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/preferences/accountdialog.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/accountdialog.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/accountdialog.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,54 @@
+#include <QSettings>
+#include "accountdialog.h"
+#include "ui_accountdialog.h"
+
+AccountDialog::AccountDialog(QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::AccountDialog)
+{
+    ui->setupUi(this);
+    _settings = new QSettings;
+    connect(this, SIGNAL(accepted()), this, SLOT(writeConfig()));
+}
+
+AccountDialog::~AccountDialog()
+{
+    delete ui;
+}
+
+void AccountDialog::writeConfig()
+{
+    _settings->beginGroup("FreeSWITCH/conf/accounts");
+
+    _settings->beginGroup(ui->sofiaGwNameEdit->text());
+    _settings->setValue("username", ui->sofiaGwUsernameEdit->text());
+    _settings->setValue("realm", ui->sofiaGwRealmEdit->text());
+    _settings->setValue("from-user", ui->sofiaGwFromUserEdit->text());
+    _settings->setValue("from-domain", ui->sofiaGwFromDomainEdit->text());
+    _settings->setValue("password", ui->sofiaGwPasswordEdit->text());
+    _settings->setValue("extension", ui->sofiaGwExtensionEdit->text());
+    _settings->setValue("proxy", ui->sofiaGwProxyEdit->text());
+    _settings->setValue("register-proxy", ui->sofiaGwRegisterProxyEdit->text());
+    _settings->setValue("expire-seconds", ui->sofiaGwExpireSecondsSpin->value());
+    _settings->setValue("register", ui->sofiaGwRegisterCombo->currentText());
+    _settings->setValue("register-transport", ui->sofiaGwRegisterTransportCombo->currentText());
+    _settings->setValue("retry-seconds", ui->sofiaGwRetrySecondsSpin->value());
+    _settings->setValue("caller-id-in-from", ui->sofiaGwCallerIdInFromCombo->currentText());
+    _settings->setValue("contact-params", ui->sofiaGwContactParamsEdit->text());
+    _settings->setValue("ping", ui->sofiaGwPingSpin->value());
+    _settings->endGroup();
+
+    _settings->endGroup();
+}
+
+void AccountDialog::changeEvent(QEvent *e)
+{
+    QDialog::changeEvent(e);
+    switch (e->type()) {
+    case QEvent::LanguageChange:
+        ui->retranslateUi(this);
+        break;
+    default:
+        break;
+    }
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/accountdialog.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/accountdialog.h (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/preferences/accountdialog.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/accountdialog.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/accountdialog.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,29 @@
+#ifndef ACCOUNTDIALOG_H
+#define ACCOUNTDIALOG_H
+
+#include <QDialog>
+
+namespace Ui {
+    class AccountDialog;
+}
+
+class QSettings;
+
+class AccountDialog : public QDialog {
+    Q_OBJECT
+public:
+    AccountDialog(QWidget *parent = 0);
+    ~AccountDialog();
+
+private slots:
+    void writeConfig();
+
+protected:
+    void changeEvent(QEvent *e);
+
+private:
+    Ui::AccountDialog *ui;
+    QSettings *_settings;
+};
+
+#endif // ACCOUNTDIALOG_H

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/accountdialog.ui

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/accountdialog.ui (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/preferences/accountdialog.ui) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/accountdialog.ui	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/accountdialog.ui	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,272 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AccountDialog</class>
+ <widget class="QDialog" name="AccountDialog">
+  <property name="windowModality">
+   <enum>Qt::WindowModal</enum>
+  </property>
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>495</width>
+    <height>573</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Account</string>
+  </property>
+  <layout class="QFormLayout" name="formLayout">
+   <item row="0" column="0">
+    <widget class="QLabel" name="label">
+     <property name="text">
+      <string>name</string>
+     </property>
+    </widget>
+   </item>
+   <item row="0" column="1">
+    <widget class="QLineEdit" name="sofiaGwNameEdit"/>
+   </item>
+   <item row="1" column="0">
+    <widget class="QLabel" name="label_2">
+     <property name="text">
+      <string>username</string>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="QLineEdit" name="sofiaGwUsernameEdit"/>
+   </item>
+   <item row="2" column="0">
+    <widget class="QLabel" name="label_3">
+     <property name="text">
+      <string>realm</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="1">
+    <widget class="QLineEdit" name="sofiaGwRealmEdit"/>
+   </item>
+   <item row="3" column="0">
+    <widget class="QLabel" name="label_4">
+     <property name="text">
+      <string>from-user</string>
+     </property>
+    </widget>
+   </item>
+   <item row="3" column="1">
+    <widget class="QLineEdit" name="sofiaGwFromUserEdit"/>
+   </item>
+   <item row="4" column="0">
+    <widget class="QLabel" name="label_5">
+     <property name="text">
+      <string>from-domain</string>
+     </property>
+    </widget>
+   </item>
+   <item row="4" column="1">
+    <widget class="QLineEdit" name="sofiaGwFromDomainEdit"/>
+   </item>
+   <item row="5" column="0">
+    <widget class="QLabel" name="label_6">
+     <property name="text">
+      <string>password</string>
+     </property>
+    </widget>
+   </item>
+   <item row="5" column="1">
+    <widget class="QLineEdit" name="sofiaGwPasswordEdit"/>
+   </item>
+   <item row="6" column="0">
+    <widget class="QLabel" name="label_7">
+     <property name="text">
+      <string>extension</string>
+     </property>
+    </widget>
+   </item>
+   <item row="6" column="1">
+    <widget class="QLineEdit" name="sofiaGwExtensionEdit"/>
+   </item>
+   <item row="7" column="0">
+    <widget class="QLabel" name="label_8">
+     <property name="text">
+      <string>proxy</string>
+     </property>
+    </widget>
+   </item>
+   <item row="7" column="1">
+    <widget class="QLineEdit" name="sofiaGwProxyEdit"/>
+   </item>
+   <item row="8" column="0">
+    <widget class="QLabel" name="label_9">
+     <property name="text">
+      <string>register-proxy</string>
+     </property>
+    </widget>
+   </item>
+   <item row="8" column="1">
+    <widget class="QLineEdit" name="sofiaGwRegisterProxyEdit"/>
+   </item>
+   <item row="9" column="0">
+    <widget class="QLabel" name="label_10">
+     <property name="text">
+      <string>expire-seconds</string>
+     </property>
+    </widget>
+   </item>
+   <item row="9" column="1">
+    <widget class="QSpinBox" name="sofiaGwExpireSecondsSpin">
+     <property name="value">
+      <number>60</number>
+     </property>
+    </widget>
+   </item>
+   <item row="10" column="0">
+    <widget class="QLabel" name="label_11">
+     <property name="text">
+      <string>register</string>
+     </property>
+    </widget>
+   </item>
+   <item row="10" column="1">
+    <widget class="QComboBox" name="sofiaGwRegisterCombo">
+     <item>
+      <property name="text">
+       <string>true</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>false</string>
+      </property>
+     </item>
+    </widget>
+   </item>
+   <item row="11" column="0">
+    <widget class="QLabel" name="label_12">
+     <property name="text">
+      <string>register-transport</string>
+     </property>
+    </widget>
+   </item>
+   <item row="11" column="1">
+    <widget class="QComboBox" name="sofiaGwRegisterTransportCombo">
+     <item>
+      <property name="text">
+       <string>udp</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>tcp</string>
+      </property>
+     </item>
+    </widget>
+   </item>
+   <item row="12" column="0">
+    <widget class="QLabel" name="label_13">
+     <property name="text">
+      <string>retry-seconds</string>
+     </property>
+    </widget>
+   </item>
+   <item row="12" column="1">
+    <widget class="QSpinBox" name="sofiaGwRetrySecondsSpin">
+     <property name="value">
+      <number>30</number>
+     </property>
+    </widget>
+   </item>
+   <item row="13" column="0">
+    <widget class="QLabel" name="label_15">
+     <property name="text">
+      <string>contact-params</string>
+     </property>
+    </widget>
+   </item>
+   <item row="13" column="1">
+    <widget class="QLineEdit" name="sofiaGwContactParamsEdit"/>
+   </item>
+   <item row="14" column="0">
+    <widget class="QLabel" name="label_14">
+     <property name="text">
+      <string>caller-id-in-from</string>
+     </property>
+    </widget>
+   </item>
+   <item row="15" column="0">
+    <widget class="QLabel" name="label_16">
+     <property name="text">
+      <string>ping</string>
+     </property>
+    </widget>
+   </item>
+   <item row="15" column="1">
+    <widget class="QSpinBox" name="sofiaGwPingSpin">
+     <property name="value">
+      <number>25</number>
+     </property>
+    </widget>
+   </item>
+   <item row="16" column="1">
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+   <item row="14" column="1">
+    <widget class="QComboBox" name="sofiaGwCallerIdInFromCombo">
+     <item>
+      <property name="text">
+       <string>false</string>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>true</string>
+      </property>
+     </item>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>AccountDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>AccountDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefdialog.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefdialog.cpp (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/preferences/prefdialog.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefdialog.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefdialog.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,60 @@
+#include <QtGui>
+#include "prefdialog.h"
+#include "ui_prefdialog.h"
+#include "prefportaudio.h"
+#include "prefsofia.h"
+#include "accountdialog.h"
+
+PrefDialog::PrefDialog(QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::PrefDialog)
+{
+    ui->setupUi(this);
+    _settings = new QSettings();
+    connect(this, SIGNAL(accepted()), this, SLOT(writeConfig()));
+    connect(ui->sofiaGwAddBtn, SIGNAL(clicked()), this, SLOT(addAccountBtnClicked()));
+
+    _accDlg = NULL;
+    _mod_portaudio = new PrefPortaudio(ui, this);
+    _mod_sofia = new PrefSofia(ui, this);
+    readConfig();
+}
+
+PrefDialog::~PrefDialog()
+{
+    delete ui;
+}
+
+void PrefDialog::addAccountBtnClicked()
+{
+    if (!_accDlg)
+        _accDlg = new AccountDialog();
+
+    _accDlg->show();
+    _accDlg->raise();
+    _accDlg->activateWindow();
+}
+
+void PrefDialog::writeConfig()
+{    
+    _mod_portaudio->writeConfig();
+    /*_mod_sofia->writeConfig();*/
+}
+
+void PrefDialog::changeEvent(QEvent *e)
+{
+    QDialog::changeEvent(e);
+    switch (e->type()) {
+    case QEvent::LanguageChange:
+        ui->retranslateUi(this);
+        break;
+    default:
+        break;
+    }
+}
+
+void PrefDialog::readConfig()
+{
+    _mod_portaudio->readConfig();
+    /*_mod_sofia->readConfig();*/
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefdialog.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefdialog.h (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/preferences/prefdialog.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefdialog.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefdialog.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,40 @@
+#ifndef PREFDIALOG_H
+#define PREFDIALOG_H
+
+#include <QDialog>
+#include <QDomDocument>
+#include <QSettings>
+#include <fshost.h>
+
+class PrefPortaudio;
+class PrefSofia;
+class AccountDialog;
+
+namespace Ui {
+    class PrefDialog;
+}
+
+class PrefDialog : public QDialog {
+    Q_OBJECT
+public:
+    PrefDialog(QWidget *parent = 0);
+    ~PrefDialog();
+
+protected:
+    void changeEvent(QEvent *e);
+
+private slots:
+    void addAccountBtnClicked();
+    void writeConfig();
+
+private:
+    void readConfig();
+    QSettings *_settings;
+    AccountDialog *_accDlg;
+    Ui::PrefDialog *ui;
+    PrefPortaudio *_mod_portaudio;
+    PrefSofia *_mod_sofia;
+};
+
+
+#endif // PREFDIALOG_H

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefdialog.ui

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefdialog.ui (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/preferences/prefdialog.ui) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefdialog.ui	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefdialog.ui	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,1057 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PrefDialog</class>
+ <widget class="QDialog" name="PrefDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>839</width>
+    <height>613</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Preferences</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout">
+   <item row="0" column="0">
+    <widget class="QListWidget" name="listSections">
+     <property name="minimumSize">
+      <size>
+       <width>120</width>
+       <height>0</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>120</width>
+       <height>16777215</height>
+      </size>
+     </property>
+     <property name="showDropIndicator" stdset="0">
+      <bool>false</bool>
+     </property>
+     <property name="dragDropMode">
+      <enum>QAbstractItemView::NoDragDrop</enum>
+     </property>
+     <property name="iconSize">
+      <size>
+       <width>96</width>
+       <height>84</height>
+      </size>
+     </property>
+     <property name="movement">
+      <enum>QListView::Static</enum>
+     </property>
+     <property name="flow">
+      <enum>QListView::LeftToRight</enum>
+     </property>
+     <property name="isWrapping" stdset="0">
+      <bool>true</bool>
+     </property>
+     <property name="spacing">
+      <number>12</number>
+     </property>
+     <property name="viewMode">
+      <enum>QListView::IconMode</enum>
+     </property>
+     <item>
+      <property name="text">
+       <string>General</string>
+      </property>
+      <property name="icon">
+       <iconset resource="../resources.qrc">
+        <normaloff>:/images/pref_general.jpg</normaloff>:/images/pref_general.jpg</iconset>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>Accounts</string>
+      </property>
+      <property name="icon">
+       <iconset resource="../resources.qrc">
+        <normaloff>:/images/pref_accounts.jpg</normaloff>:/images/pref_accounts.jpg</iconset>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>Sofia</string>
+      </property>
+      <property name="icon">
+       <iconset resource="../resources.qrc">
+        <normaloff>:/images/pref_sip.png</normaloff>:/images/pref_sip.png</iconset>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>PortAudio</string>
+      </property>
+      <property name="icon">
+       <iconset resource="../resources.qrc">
+        <normaloff>:/images/pref_audio.gif</normaloff>:/images/pref_audio.gif</iconset>
+      </property>
+     </item>
+    </widget>
+   </item>
+   <item row="0" column="1">
+    <widget class="QStackedWidget" name="stackedWidget">
+     <property name="currentIndex">
+      <number>1</number>
+     </property>
+     <widget class="QWidget" name="generalPage">
+      <layout class="QVBoxLayout" name="verticalLayout_3">
+       <item>
+        <widget class="QGroupBox" name="groupBox_5">
+         <property name="title">
+          <string>User Information</string>
+         </property>
+         <layout class="QFormLayout" name="formLayout_4">
+          <item row="0" column="0">
+           <widget class="QLabel" name="label_13">
+            <property name="text">
+             <string>CallerID Name:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <widget class="QLineEdit" name="PaCallerIdNameEdit"/>
+          </item>
+          <item row="1" column="0">
+           <widget class="QLabel" name="label_14">
+            <property name="text">
+             <string>CallerID Number:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="1">
+           <widget class="QLineEdit" name="PaCallerIdNumEdit"/>
+          </item>
+         </layout>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="accountsPage">
+      <layout class="QHBoxLayout" name="horizontalLayout_5">
+       <item>
+        <widget class="QTableWidget" name="sofiaGwListWidget">
+         <property name="editTriggers">
+          <set>QAbstractItemView::NoEditTriggers</set>
+         </property>
+         <column>
+          <property name="text">
+           <string>Enabled</string>
+          </property>
+         </column>
+         <column>
+          <property name="text">
+           <string>Name</string>
+          </property>
+         </column>
+         <column>
+          <property name="text">
+           <string>Username</string>
+          </property>
+         </column>
+        </widget>
+       </item>
+       <item>
+        <layout class="QVBoxLayout" name="verticalLayout_7">
+         <item>
+          <widget class="QPushButton" name="sofiaGwAddBtn">
+           <property name="text">
+            <string>Add</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="sofiaGwRemBtn">
+           <property name="text">
+            <string>Remove</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="sofiaGwEditBtn">
+           <property name="text">
+            <string>Edit</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="verticalSpacer">
+           <property name="orientation">
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>20</width>
+             <height>40</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="sofiaPage">
+      <layout class="QVBoxLayout" name="verticalLayout_2">
+       <item>
+        <widget class="QTabWidget" name="tabWidget">
+         <property name="currentIndex">
+          <number>0</number>
+         </property>
+         <widget class="QWidget" name="tab">
+          <attribute name="title">
+           <string>General</string>
+          </attribute>
+          <layout class="QVBoxLayout" name="verticalLayout_5">
+           <item>
+            <widget class="QGroupBox" name="groupBox">
+             <property name="title">
+              <string>Global</string>
+             </property>
+             <layout class="QFormLayout" name="formLayout">
+              <property name="fieldGrowthPolicy">
+               <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+              </property>
+              <item row="0" column="0">
+               <widget class="QLabel" name="label">
+                <property name="text">
+                 <string>log-level</string>
+                </property>
+               </widget>
+              </item>
+              <item row="0" column="1">
+               <widget class="QSpinBox" name="sofiaLogLevelSpin"/>
+              </item>
+              <item row="1" column="0">
+               <widget class="QLabel" name="label_2">
+                <property name="text">
+                 <string>auto-restart</string>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="1">
+               <widget class="QComboBox" name="sofiaAutoRestartCombo">
+                <item>
+                 <property name="text">
+                  <string>true</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>false</string>
+                 </property>
+                </item>
+               </widget>
+              </item>
+              <item row="2" column="0">
+               <widget class="QLabel" name="label_3">
+                <property name="text">
+                 <string>debug-presence</string>
+                </property>
+               </widget>
+              </item>
+              <item row="2" column="1">
+               <widget class="QSpinBox" name="sofiaDebugPresenceSpin"/>
+              </item>
+              <item row="3" column="0">
+               <widget class="QLabel" name="label_15">
+                <property name="text">
+                 <string>rewrite-multicasted-fs-path</string>
+                </property>
+               </widget>
+              </item>
+              <item row="3" column="1">
+               <widget class="QComboBox" name="sofiaRewriteMulticastedFsPathCombo">
+                <item>
+                 <property name="text">
+                  <string>false</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>true</string>
+                 </property>
+                </item>
+               </widget>
+              </item>
+             </layout>
+            </widget>
+           </item>
+           <item>
+            <widget class="QGroupBox" name="groupBox_6">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="title">
+              <string>Profile</string>
+             </property>
+             <layout class="QFormLayout" name="formLayout_6">
+              <item row="0" column="0">
+               <widget class="QLabel" name="label_4">
+                <property name="text">
+                 <string>user-agent-string</string>
+                </property>
+               </widget>
+              </item>
+              <item row="0" column="1">
+               <widget class="QLineEdit" name="sofiaUserAgentStringEdit">
+                <property name="text">
+                 <string>FreeSWITCH/FSComm</string>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="0">
+               <widget class="QLabel" name="label_26">
+                <property name="text">
+                 <string>hold-music</string>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="1">
+               <widget class="QLineEdit" name="sofiaHoldMusicEdit">
+                <property name="text">
+                 <string>localstream://moh</string>
+                </property>
+               </widget>
+              </item>
+              <item row="2" column="0">
+               <widget class="QLabel" name="label_16">
+                <property name="text">
+                 <string>context</string>
+                </property>
+               </widget>
+              </item>
+              <item row="2" column="1">
+               <widget class="QLineEdit" name="sofiaContextEdit">
+                <property name="text">
+                 <string>public</string>
+                </property>
+               </widget>
+              </item>
+              <item row="3" column="0">
+               <widget class="QLabel" name="label_19">
+                <property name="text">
+                 <string>dialplan</string>
+                </property>
+               </widget>
+              </item>
+              <item row="3" column="1">
+               <widget class="QLineEdit" name="sofiaDialplanEdit">
+                <property name="text">
+                 <string>XML</string>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="tab_2">
+          <attribute name="title">
+           <string>Network</string>
+          </attribute>
+          <layout class="QVBoxLayout" name="verticalLayout_4">
+           <item>
+            <widget class="QGroupBox" name="groupBox_2">
+             <property name="title">
+              <string>Softphone Profile</string>
+             </property>
+             <layout class="QFormLayout" name="formLayout_2">
+              <property name="fieldGrowthPolicy">
+               <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+              </property>
+              <item row="0" column="0">
+               <widget class="QLabel" name="label_18">
+                <property name="text">
+                 <string>sip-port</string>
+                </property>
+               </widget>
+              </item>
+              <item row="0" column="1">
+               <widget class="QSpinBox" name="sofiaSipPortSpin">
+                <property name="minimum">
+                 <number>1</number>
+                </property>
+                <property name="maximum">
+                 <number>65535</number>
+                </property>
+                <property name="value">
+                 <number>12345</number>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="0">
+               <widget class="QLabel" name="label_22">
+                <property name="text">
+                 <string>use-rtp-timer</string>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="1">
+               <widget class="QComboBox" name="sofiaUseRtpTimerCombo">
+                <item>
+                 <property name="text">
+                  <string>true</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>false</string>
+                 </property>
+                </item>
+               </widget>
+              </item>
+              <item row="2" column="0">
+               <widget class="QLabel" name="label_24">
+                <property name="text">
+                 <string>rtp-ip</string>
+                </property>
+               </widget>
+              </item>
+              <item row="2" column="1">
+               <widget class="QLineEdit" name="sofiaRtpIpEdit">
+                <property name="text">
+                 <string>auto</string>
+                </property>
+               </widget>
+              </item>
+              <item row="3" column="0">
+               <widget class="QLabel" name="label_25">
+                <property name="text">
+                 <string>sip-ip</string>
+                </property>
+               </widget>
+              </item>
+              <item row="3" column="1">
+               <widget class="QLineEdit" name="sofiaSipIpEdit">
+                <property name="text">
+                 <string>auto</string>
+                </property>
+               </widget>
+              </item>
+              <item row="4" column="0">
+               <widget class="QLabel" name="label_27">
+                <property name="text">
+                 <string>apply-nat-acl</string>
+                </property>
+               </widget>
+              </item>
+              <item row="4" column="1">
+               <widget class="QLineEdit" name="sofiaApplyNatAclEdit">
+                <property name="text">
+                 <string>rfc1918</string>
+                </property>
+               </widget>
+              </item>
+              <item row="5" column="0">
+               <widget class="QLabel" name="label_34">
+                <property name="text">
+                 <string>ext-rtp-ip</string>
+                </property>
+               </widget>
+              </item>
+              <item row="5" column="1">
+               <widget class="QLineEdit" name="sofiaExtRtpIpEdit">
+                <property name="text">
+                 <string>stun:stun.freeswitch.org</string>
+                </property>
+               </widget>
+              </item>
+              <item row="6" column="0">
+               <widget class="QLabel" name="label_35">
+                <property name="text">
+                 <string>ext-sip-ip</string>
+                </property>
+               </widget>
+              </item>
+              <item row="6" column="1">
+               <widget class="QLineEdit" name="sofiaExtSipIpEdit">
+                <property name="text">
+                 <string>stun:stun.freeswitch.org</string>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="tab_4">
+          <attribute name="title">
+           <string>Codecs</string>
+          </attribute>
+          <layout class="QFormLayout" name="formLayout_7">
+           <item row="0" column="0">
+            <widget class="QLabel" name="label_21">
+             <property name="text">
+              <string>codec-prefs</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="1">
+            <widget class="QLineEdit" name="sofiaCodecPrefsEdit">
+             <property name="text">
+              <string>CELT@48000h,G7221@32000h,G7221@16000h,G722,PCMU,PCMA,GSM</string>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="0">
+            <widget class="QLabel" name="label_30">
+             <property name="text">
+              <string>inbound-codec-negotiation</string>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="1">
+            <widget class="QComboBox" name="sofiaInboundCodecNegotiationCombo">
+             <item>
+              <property name="text">
+               <string>generous</string>
+              </property>
+             </item>
+             <item>
+              <property name="text">
+               <string>greedy</string>
+              </property>
+             </item>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="tab_3">
+          <attribute name="title">
+           <string>Advanced</string>
+          </attribute>
+          <layout class="QVBoxLayout" name="verticalLayout_6">
+           <item>
+            <widget class="QGroupBox" name="groupBox_7">
+             <property name="title">
+              <string>Profile</string>
+             </property>
+             <layout class="QFormLayout" name="formLayout_8">
+              <item row="0" column="0">
+               <widget class="QLabel" name="label_17">
+                <property name="text">
+                 <string>rfc2833-pt</string>
+                </property>
+               </widget>
+              </item>
+              <item row="0" column="1">
+               <widget class="QLineEdit" name="sofiaRfc2833PtEdit">
+                <property name="text">
+                 <string>101</string>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="0">
+               <widget class="QLabel" name="label_5">
+                <property name="text">
+                 <string>debug</string>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="1">
+               <widget class="QSpinBox" name="sofiaDebugSpin"/>
+              </item>
+              <item row="2" column="0">
+               <widget class="QLabel" name="label_6">
+                <property name="text">
+                 <string>sip-trace</string>
+                </property>
+               </widget>
+              </item>
+              <item row="2" column="1">
+               <widget class="QComboBox" name="sofiaSipTraceCombo">
+                <item>
+                 <property name="text">
+                  <string>false</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>true</string>
+                 </property>
+                </item>
+               </widget>
+              </item>
+              <item row="3" column="0">
+               <widget class="QLabel" name="label_20">
+                <property name="text">
+                 <string>dtmf-duration</string>
+                </property>
+               </widget>
+              </item>
+              <item row="3" column="1">
+               <widget class="QSpinBox" name="sofiaDtmfDurationSpin">
+                <property name="maximum">
+                 <number>1000</number>
+                </property>
+                <property name="value">
+                 <number>100</number>
+                </property>
+               </widget>
+              </item>
+              <item row="4" column="0">
+               <widget class="QLabel" name="label_23">
+                <property name="text">
+                 <string>rtp-timer-name</string>
+                </property>
+               </widget>
+              </item>
+              <item row="4" column="1">
+               <widget class="QLineEdit" name="sofiaRtpTimerNameEdit">
+                <property name="text">
+                 <string>soft</string>
+                </property>
+               </widget>
+              </item>
+              <item row="5" column="0">
+               <widget class="QLabel" name="label_28">
+                <property name="text">
+                 <string>manage-presence</string>
+                </property>
+               </widget>
+              </item>
+              <item row="5" column="1">
+               <widget class="QComboBox" name="sofiaManagePresenceCombo">
+                <item>
+                 <property name="text">
+                  <string>false</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>true</string>
+                 </property>
+                </item>
+               </widget>
+              </item>
+              <item row="6" column="0">
+               <widget class="QLabel" name="label_29">
+                <property name="text">
+                 <string>max-proceeding</string>
+                </property>
+               </widget>
+              </item>
+              <item row="6" column="1">
+               <widget class="QSpinBox" name="sofiaMaxProceedingEdit">
+                <property name="value">
+                 <number>3</number>
+                </property>
+               </widget>
+              </item>
+              <item row="7" column="0">
+               <widget class="QLabel" name="label_31">
+                <property name="text">
+                 <string>nonce-ttl</string>
+                </property>
+               </widget>
+              </item>
+              <item row="7" column="1">
+               <widget class="QSpinBox" name="sofiaNonceTtlSpin">
+                <property name="value">
+                 <number>60</number>
+                </property>
+               </widget>
+              </item>
+              <item row="8" column="0">
+               <widget class="QLabel" name="label_36">
+                <property name="text">
+                 <string>rtp-timeout-sec</string>
+                </property>
+               </widget>
+              </item>
+              <item row="8" column="1">
+               <widget class="QSpinBox" name="sofiaRtpTimeoutSecSpin">
+                <property name="maximum">
+                 <number>1000</number>
+                </property>
+                <property name="value">
+                 <number>300</number>
+                </property>
+               </widget>
+              </item>
+              <item row="9" column="0">
+               <widget class="QLabel" name="label_37">
+                <property name="text">
+                 <string>rtp-hold-timeout-sec</string>
+                </property>
+               </widget>
+              </item>
+              <item row="9" column="1">
+               <widget class="QSpinBox" name="sofiaRtpHoldTimeoutSecSpin">
+                <property name="maximum">
+                 <number>5000</number>
+                </property>
+                <property name="value">
+                 <number>1800</number>
+                </property>
+               </widget>
+              </item>
+              <item row="10" column="0">
+               <widget class="QLabel" name="label_32">
+                <property name="text">
+                 <string>auth-calls</string>
+                </property>
+               </widget>
+              </item>
+              <item row="10" column="1">
+               <widget class="QComboBox" name="sofiaAuthCallsCombo">
+                <item>
+                 <property name="text">
+                  <string>false</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>true</string>
+                 </property>
+                </item>
+               </widget>
+              </item>
+              <item row="11" column="0">
+               <widget class="QLabel" name="label_33">
+                <property name="text">
+                 <string>auth-all-packets</string>
+                </property>
+               </widget>
+              </item>
+              <item row="11" column="1">
+               <widget class="QComboBox" name="sofiaAuthAllPacketsCombo">
+                <item>
+                 <property name="text">
+                  <string>false</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>true</string>
+                 </property>
+                </item>
+               </widget>
+              </item>
+              <item row="12" column="0">
+               <widget class="QLabel" name="label_38">
+                <property name="text">
+                 <string>disable-register</string>
+                </property>
+               </widget>
+              </item>
+              <item row="12" column="1">
+               <widget class="QComboBox" name="sofiaDisableRegisterCombo">
+                <item>
+                 <property name="text">
+                  <string>true</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>false</string>
+                 </property>
+                </item>
+               </widget>
+              </item>
+              <item row="13" column="0">
+               <widget class="QLabel" name="label_39">
+                <property name="text">
+                 <string>challenge-realm</string>
+                </property>
+               </widget>
+              </item>
+              <item row="13" column="1">
+               <widget class="QComboBox" name="sofiaChallengeRealmCombo">
+                <item>
+                 <property name="text">
+                  <string>auto_from</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>auto_to</string>
+                 </property>
+                </item>
+               </widget>
+              </item>
+             </layout>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="portaudioPage">
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <item>
+        <widget class="QGroupBox" name="groupBox_3">
+         <property name="title">
+          <string>Devices</string>
+         </property>
+         <layout class="QFormLayout" name="formLayout_3">
+          <item row="0" column="0">
+           <widget class="QLabel" name="label_7">
+            <property name="text">
+             <string>indev</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <widget class="QComboBox" name="PaIndevCombo"/>
+          </item>
+          <item row="1" column="0">
+           <widget class="QLabel" name="label_8">
+            <property name="text">
+             <string>outdev</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="1">
+           <layout class="QHBoxLayout" name="horizontalLayout_3">
+            <item>
+             <widget class="QComboBox" name="PaOutdevCombo"/>
+            </item>
+            <item>
+             <widget class="QPushButton" name="PaOutdevTestBtn">
+              <property name="enabled">
+               <bool>false</bool>
+              </property>
+              <property name="maximumSize">
+               <size>
+                <width>86</width>
+                <height>27</height>
+               </size>
+              </property>
+              <property name="text">
+               <string>Test</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+          <item row="2" column="0">
+           <widget class="QLabel" name="label_9">
+            <property name="text">
+             <string>rindgev</string>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="1">
+           <layout class="QHBoxLayout" name="horizontalLayout_2">
+            <item>
+             <widget class="QComboBox" name="PaRingdevCombo"/>
+            </item>
+            <item>
+             <widget class="QPushButton" name="PaRingdevTestBtn">
+              <property name="enabled">
+               <bool>true</bool>
+              </property>
+              <property name="maximumSize">
+               <size>
+                <width>86</width>
+                <height>27</height>
+               </size>
+              </property>
+              <property name="text">
+               <string>Test</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+          <item row="4" column="1">
+           <widget class="QPushButton" name="PaRefreshDevListBtn">
+            <property name="text">
+             <string>Refresh DevList</string>
+            </property>
+           </widget>
+          </item>
+          <item row="4" column="0">
+           <widget class="QPushButton" name="PaLoopTestBtn">
+            <property name="text">
+             <string>Loop Test</string>
+            </property>
+           </widget>
+          </item>
+          <item row="5" column="1">
+           <widget class="QLineEdit" name="PaSampleRateEdit">
+            <property name="text">
+             <string>16000</string>
+            </property>
+           </widget>
+          </item>
+          <item row="6" column="1">
+           <widget class="QLineEdit" name="PaCodecMSEdit">
+            <property name="text">
+             <string>10</string>
+            </property>
+           </widget>
+          </item>
+          <item row="5" column="0">
+           <widget class="QLabel" name="label_40">
+            <property name="text">
+             <string>Sample Rate</string>
+            </property>
+           </widget>
+          </item>
+          <item row="6" column="0">
+           <widget class="QLabel" name="label_41">
+            <property name="text">
+             <string>Codec MS</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </item>
+       <item>
+        <widget class="QGroupBox" name="groupBox_4">
+         <property name="title">
+          <string>Files</string>
+         </property>
+         <layout class="QFormLayout" name="formLayout_5">
+          <item row="0" column="0">
+           <widget class="QLabel" name="label_10">
+            <property name="text">
+             <string>ring-file</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <layout class="QHBoxLayout" name="horizontalLayout_4">
+            <item>
+             <widget class="QLineEdit" name="PaRingFileEdit">
+              <property name="text">
+               <string>tone_stream://%(2000,4000,440.0,480.0);loops=20</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="PaRingFileBtn">
+              <property name="text">
+               <string>Open</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+          <item row="1" column="0">
+           <widget class="QLabel" name="label_12">
+            <property name="text">
+             <string>ring-interval</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="1">
+           <widget class="QSpinBox" name="PaRingIntervalSpin">
+            <property name="value">
+             <number>5</number>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="0">
+           <widget class="QLabel" name="label_11">
+            <property name="text">
+             <string>hold-file</string>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="1">
+           <layout class="QHBoxLayout" name="horizontalLayout">
+            <item>
+             <widget class="QLineEdit" name="PaHoldFileEdit">
+              <property name="readOnly">
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="PaHoldFileBtn">
+              <property name="text">
+               <string>Open</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources>
+  <include location="../resources.qrc"/>
+ </resources>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>PrefDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>544</x>
+     <y>224</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>246</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>PrefDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>544</x>
+     <y>230</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>246</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>listSections</sender>
+   <signal>currentRowChanged(int)</signal>
+   <receiver>stackedWidget</receiver>
+   <slot>setCurrentIndex(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>180</x>
+     <y>83</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>524</x>
+     <y>102</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefportaudio.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefportaudio.cpp (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/preferences/prefportaudio.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefportaudio.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefportaudio.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,353 @@
+#include <QtGui>
+#include <fshost.h>
+#include "prefportaudio.h"
+
+PrefPortaudio::PrefPortaudio(Ui::PrefDialog *ui, QObject *parent) :
+        QObject(parent),
+        _ui(ui)
+{
+    _settings = new QSettings();
+    connect(_ui->PaRingFileBtn, SIGNAL(clicked()), this, SLOT(ringFileChoose()));
+    connect(_ui->PaHoldFileBtn, SIGNAL(clicked()), this, SLOT(holdFileChoose()));
+    connect(_ui->PaIndevCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(indevChangeDev(int)));
+    connect(_ui->PaOutdevCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(outdevChangeDev(int)));
+    connect(_ui->PaRingdevCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(ringdevChangeDev(int)));
+    connect(_ui->PaRingdevTestBtn, SIGNAL(clicked()), this, SLOT(ringdevTest()));
+    connect(_ui->PaLoopTestBtn, SIGNAL(clicked()), this, SLOT(loopTest()));
+    connect(_ui->PaRefreshDevListBtn, SIGNAL(clicked()), this, SLOT(refreshDevList()));
+}
+
+void PrefPortaudio::ringdevTest()
+{
+    QString result;
+    if (g_FSHost.sendCmd("pa", QString("play %1/.fscomm/sounds/test.wav 0").arg(QDir::homePath()).toAscii().constData(), &result) != SWITCH_STATUS_SUCCESS)
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error testing ringdev on mod_portaudio! %s\n",
+                          result.toAscii().constData());
+    }
+}
+
+void PrefPortaudio::loopTest()
+{
+    QString result;
+    _ui->PaLoopTestBtn->setEnabled(false);
+    if (g_FSHost.sendCmd("pa", "looptest", &result) != SWITCH_STATUS_SUCCESS)
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error running looptest on mod_portaudio! %s\n",
+                          result.toAscii().constData());
+    }
+    _ui->PaLoopTestBtn->setEnabled(true);
+}
+
+void PrefPortaudio::refreshDevList()
+{
+    QString result;
+    if (g_FSHost.sendCmd("pa", "rescan", &result) != SWITCH_STATUS_SUCCESS)
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error rescaning sound device on mod_portaudio! %s\n",
+                          result.toAscii().constData());
+    }
+    //clear combox
+    _ui->PaIndevCombo->clear();
+    _ui->PaOutdevCombo->clear();
+    _ui->PaRingdevCombo->clear();
+    getPaDevlist();
+}
+
+void PrefPortaudio::indevChangeDev(int index)
+{
+    QString result;
+    int dev = _ui->PaIndevCombo->itemData(index, Qt::UserRole).toInt();
+    if (g_FSHost.sendCmd("pa", QString("indev #%1").arg(dev).toAscii().constData(), &result) != SWITCH_STATUS_SUCCESS)
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting ringdev to #%d on mod_portaudio!\n", dev);
+        QMessageBox::critical(0, tr("Unable to change device."),
+                              tr("There was an error changing the ringdev.\nPlease report this bug."),
+                              QMessageBox::Ok);
+
+    }
+}
+
+void PrefPortaudio::ringdevChangeDev(int index)
+{
+    QString result;
+    int dev = _ui->PaRingdevCombo->itemData(index, Qt::UserRole).toInt();
+    if (g_FSHost.sendCmd("pa", QString("ringdev #%1").arg(dev).toAscii().constData(), &result) != SWITCH_STATUS_SUCCESS)
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting ringdev to #%d on mod_portaudio!\n", dev);
+        QMessageBox::critical(0, tr("Unable to change device."),
+                              tr("There was an error changing the ringdev.\nPlease report this bug."),
+                              QMessageBox::Ok);
+
+    }
+}
+
+void PrefPortaudio::outdevChangeDev(int index)
+{
+    QString result;
+    int dev = _ui->PaRingdevCombo->itemData(index, Qt::UserRole).toInt();
+    if (g_FSHost.sendCmd("pa", QString("outdev #%1").arg(dev).toAscii().constData(), &result) != SWITCH_STATUS_SUCCESS)
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting outdev to #%d on mod_portaudio!\n", dev);
+        QMessageBox::critical(0, tr("Unable to change device."),
+                              tr("There was an error changing the outdev.\nPlease report this bug."),
+                              QMessageBox::Ok);
+    }
+}
+
+void PrefPortaudio::holdFileChoose()
+{
+    QString fileName = QFileDialog::getOpenFileName(0,
+                                                    tr("Select file"),
+                                                    QDir::homePath(),
+                                                    NULL);
+    if (!fileName.isNull())
+        _ui->PaHoldFileEdit->setText(fileName);
+}
+
+void PrefPortaudio::ringFileChoose()
+{
+    QString fileName = QFileDialog::getOpenFileName(0,
+                                                    tr("Select file"),
+                                                    QDir::homePath(),
+                                                    NULL);
+    if (!fileName.isNull())
+        _ui->PaRingFileEdit->setText(fileName);
+}
+
+void PrefPortaudio::writeConfig()
+{
+    _settings->beginGroup("FreeSWITCH/conf");
+    _settings->beginGroup("portaudio.conf");
+
+    QString cid_name = _settings->value("cid-name").toString();
+    QString ncid_name = _ui->PaCallerIdNameEdit->text();
+
+    QString cid_num = _settings->value("cid-num").toString();
+    QString ncid_num = _ui->PaCallerIdNumEdit->text();
+
+    QString hold_file = _settings->value("hold-file").toString();
+    QString nhold_file =  _ui->PaHoldFileEdit->text();
+
+    QString ring_file = _settings->value("ring-file").toString();
+    QString nring_file = _ui->PaRingFileEdit->text();
+
+    int ring_interval = _settings->value("ring-interval").toInt();
+    int nring_interval = _ui->PaRingIntervalSpin->value();
+
+    QString sample_rate = _settings->value("sample-rate").toString();
+    QString nsample_rate = _ui->PaSampleRateEdit->text();
+
+    QString codec_ms = _settings->value("codec-ms").toString();
+    QString ncodec_ms = _ui->PaCodecMSEdit->text();
+
+    QString result;
+
+    if (cid_name != ncid_name ||
+        cid_num != ncid_num ||
+        hold_file != nhold_file ||
+        ring_file != nring_file ||
+        ring_interval != nring_interval ||
+        sample_rate != nsample_rate||
+        codec_ms != ncodec_ms)
+    {
+        if (g_FSHost.sendCmd("reload", "mod_portaudio", &result) == SWITCH_STATUS_SUCCESS)
+        {
+            _settings->setValue("cid-name", ncid_name);
+            _settings->setValue("cid-num", ncid_num);
+            _settings->setValue("ring-file", nring_file);
+            _settings->setValue("ring-interval", nring_interval);
+            _settings->setValue("hold-file", nhold_file);
+            _settings->setValue("sample-rate", nsample_rate);
+            _settings->setValue("codec-ms", ncodec_ms);
+        }
+        else
+        {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error while issuing reload command to mod_portaudio!\n");
+            QMessageBox::critical(0, tr("Unable to save settings"),
+                                  tr("There was an error saving your settings.\nPlease report this bug."),
+                                  QMessageBox::Ok);
+        }
+    }
+
+    int nindev = _ui->PaIndevCombo->itemData(_ui->PaIndevCombo->currentIndex(), Qt::UserRole).toInt();
+    int indev = _settings->value("indev").toInt();
+    int noutdev = _ui->PaOutdevCombo->itemData(_ui->PaOutdevCombo->currentIndex(), Qt::UserRole).toInt();
+    int outdev = _settings->value("outdev").toInt();
+    int nringdev = _ui->PaRingdevCombo->itemData(_ui->PaRingdevCombo->currentIndex(), Qt::UserRole).toInt();
+    int ringdev = _settings->value("ringdev").toInt();
+
+    if (nindev != indev)
+    {
+        if (g_FSHost.sendCmd("pa", QString("indev #%1").arg(nindev).toAscii().constData(), &result) == SWITCH_STATUS_SUCCESS)
+        {
+            _settings->setValue("indev", nindev);
+        }
+        else
+        {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting indev from #%d to #%d on mod_portaudio!\n",
+                              indev, nindev);
+            QMessageBox::critical(0, tr("Unable to save settings"),
+                                  tr("There was an error changing the indev.\nPlease report this bug."),
+                                  QMessageBox::Ok);
+        }
+    }
+
+    if (noutdev!= outdev)
+    {
+        _settings->setValue("outdev", noutdev);
+    }
+    if (nringdev != ringdev)
+    {
+        _settings->setValue("ringdev", nringdev);
+    }
+
+    _settings->endGroup();
+    _settings->endGroup();
+}
+
+void PrefPortaudio::readConfig()
+{
+    getPaDevlist();
+    _settings->beginGroup("FreeSWITCH/conf");
+
+    _settings->beginGroup("portaudio.conf");
+    _ui->PaCallerIdNameEdit->setText(_settings->value("cid-name").toString());
+    _ui->PaCallerIdNumEdit->setText(_settings->value("cid-num").toString());
+    _ui->PaHoldFileEdit->setText(_settings->value("hold-file").toString());
+    _ui->PaRingFileEdit->setText(_settings->value("ring-file").toString());
+    _ui->PaRingIntervalSpin->setValue(_settings->value("ring-interval").toInt());
+    _ui->PaSampleRateEdit->setText(_settings->value("sample-rate").toString());
+    _ui->PaCodecMSEdit->setText(_settings->value("codec-ms").toString());
+    _settings->endGroup();
+
+    _settings->endGroup();
+}
+
+void PrefPortaudio::getPaDevlist()
+{
+    QString result;
+    int errorLine, errorColumn;
+    QString errorMsg;
+
+    if (g_FSHost.sendCmd("pa", "devlist xml", &result) != SWITCH_STATUS_SUCCESS)
+    {
+        QMessageBox::critical(0, tr("PortAudio error" ),
+                              tr("Error querying audio devices."),
+                              QMessageBox::Ok);
+        return;
+    }
+
+    if (!_xmlPaDevList.setContent(result, &errorMsg, &errorLine, &errorColumn))
+    {
+        QMessageBox::critical(0, tr("PortAudio error" ),
+                              tr("Error parsing output xml from pa devlist.\n%1 (Line:%2, Col:%3).").arg(errorMsg,
+                                                                                                         errorLine,
+                                                                                                         errorColumn),
+                              QMessageBox::Ok);
+        return;
+    }
+    QDomElement root = _xmlPaDevList.documentElement();
+    if (root.tagName() != "xml")
+    {
+        QMessageBox::critical(0, tr("PortAudio error" ),
+                              tr("Error parsing output xml from pa devlist. Root tag is not <xml>."),
+                              QMessageBox::Ok);
+        return;
+    }
+    QDomElement devices = root.firstChildElement("devices");
+    if (devices.isNull())
+    {
+        QMessageBox::critical(0, tr("PortAudio error" ),
+                              tr("Error parsing output xml from pa devlist. There is no <devices> tag."),
+                              QMessageBox::Ok);
+        return;
+    }
+
+    QDomElement child = devices.firstChildElement();
+    if (child.isNull())
+    {
+        QMessageBox::critical(0, tr("PortAudio error" ),
+                              tr("Error parsing output xml from pa devlist. There is no <device> tag."),
+                              QMessageBox::Ok);
+        return;
+    }
+
+    while (!child.isNull())
+    {
+        if (child.tagName() == "device")
+        {
+            QString id, name, inputs, outputs;
+            id = child.attribute("id","-1");
+            name = child.attribute("name","Null");
+            inputs = child.attribute("inputs","0");
+            outputs = child.attribute("outputs","0");
+            if (inputs.toInt() != 0)
+                _ui->PaIndevCombo->addItem(name,id.toInt());
+            if (outputs.toInt() != 0)
+            {
+                _ui->PaOutdevCombo->addItem(name,id.toInt());
+                _ui->PaRingdevCombo->addItem(name,id.toInt());
+            }
+        }
+        child = child.nextSiblingElement();
+    }
+
+    QDomElement bindings = root.firstChildElement("bindings");
+    if (bindings.isNull())
+    {
+        QMessageBox::critical(0, tr("PortAudio error" ),
+                              tr("Error parsing output xml from pa devlist. There is no <bindings> tag."),
+                              QMessageBox::Ok);
+        return;
+    }
+
+    child = bindings.firstChildElement();
+    if (child.isNull())
+    {
+        QMessageBox::critical(0, tr("PortAudio error" ),
+                              tr("Error parsing output xml from pa devlist. There are no bindings."),
+                              QMessageBox::Ok);
+        return;
+    }
+
+    while (!child.isNull())
+    {
+        QString id = child.attribute("device","-1");
+        if (child.tagName() == "ring")
+        {
+            for(int itemId=0; itemId<_ui->PaRingdevCombo->count(); itemId++)
+            {
+                if (id == _ui->PaRingdevCombo->itemData(itemId,Qt::UserRole))
+                {
+                    //setCurrentIndex triggers currentIndexChanged signal, hmmm...
+                    _ui->PaRingdevCombo->setCurrentIndex(itemId);
+                    break;
+                }
+            }
+        }
+        else if (child.tagName() == "input")
+        {
+            for(int itemId=0; itemId<_ui->PaRingdevCombo->count(); itemId++)
+            {
+                if (id == _ui->PaIndevCombo->itemData(itemId,Qt::UserRole))
+                {
+                    _ui->PaIndevCombo->setCurrentIndex(itemId);
+                    break;
+                }
+            }
+        }
+        else if (child.tagName() == "output")
+            for(int itemId=0; itemId<_ui->PaOutdevCombo->count(); itemId++)
+            {
+                if (id == _ui->PaOutdevCombo->itemData(itemId,Qt::UserRole))
+                {
+                    _ui->PaOutdevCombo->setCurrentIndex(itemId);
+                    break;
+                }
+            }
+
+        child = child.nextSiblingElement();
+    }
+
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefportaudio.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefportaudio.h (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/preferences/prefportaudio.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefportaudio.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefportaudio.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,34 @@
+#ifndef PREFPORTAUDIO_H
+#define PREFPORTAUDIO_H
+
+#include <QObject>
+#include <QDomDocument>
+#include "ui_prefdialog.h"
+
+class QSettings;
+
+class PrefPortaudio : public QObject
+{
+Q_OBJECT
+public:
+    explicit PrefPortaudio(Ui::PrefDialog *ui, QObject *parent = 0);
+    void writeConfig();
+    void readConfig();
+
+private slots:
+    void ringFileChoose();
+    void holdFileChoose();
+    void indevChangeDev(int);
+    void outdevChangeDev(int);
+    void ringdevChangeDev(int);
+    void ringdevTest();
+    void loopTest();
+    void refreshDevList();
+private:
+    void getPaDevlist(void);
+    QSettings *_settings;
+    Ui::PrefDialog *_ui;
+    QDomDocument _xmlPaDevList;
+};
+
+#endif // PREFPORTAUDIO_H

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefsofia.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefsofia.cpp (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/preferences/prefsofia.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefsofia.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefsofia.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,64 @@
+#include <QtGui>
+#include <fshost.h>
+#include "prefsofia.h"
+
+PrefSofia::PrefSofia(Ui::PrefDialog *ui, QObject *parent) :
+        QObject(parent),
+        _ui(ui)
+{
+    _settings = new QSettings();
+}
+
+void PrefSofia::readConfig()
+{
+    int guess_mask;
+    char guess_ip[80];
+    switch_find_local_ip(guess_ip, sizeof(guess_ip), &guess_mask, AF_INET);
+    _ui->sofiaRtpIpEdit->setText(QString(guess_ip));
+    _ui->sofiaSipIpEdit->setText(QString(guess_ip));
+}
+
+void PrefSofia::writeConfig()
+{
+    _settings->beginGroup("FreeSWITCH/conf");
+    _settings->beginGroup("sofia.conf");
+
+    /* General Settings */
+    _settings->setValue("log-level", _ui->sofiaLogLevelSpin->value());
+    _settings->setValue("auto-restart", _ui->sofiaAutoRestartCombo->currentText());
+    _settings->setValue("debug-presence", _ui->sofiaDebugPresenceSpin->value());
+    _settings->setValue("rewrite-multicasted-fs-path", _ui->sofiaRewriteMulticastedFsPathCombo->currentText());
+
+    /* Profile settings */
+    _settings->setValue("user-agent-string", _ui->sofiaUserAgentStringEdit->text());
+    _settings->setValue("debug", _ui->sofiaDebugSpin->value());
+    _settings->setValue("sip-trace", _ui->sofiaSipTraceCombo->currentText());
+    _settings->setValue("context", _ui->sofiaContextEdit->text());
+    _settings->setValue("rfc2833-pt", _ui->sofiaRfc2833PtEdit->text());
+    _settings->setValue("sip-port", _ui->sofiaSipPortSpin->value());
+    _settings->setValue("dialplan", _ui->sofiaDialplanEdit->text());
+    _settings->setValue("dtmf-duration", _ui->sofiaDtmfDurationSpin->value());
+    _settings->setValue("codec-prefs", _ui->sofiaCodecPrefsEdit->text());
+    _settings->setValue("use-rtp-timer", _ui->sofiaUseRtpTimerCombo->currentText());
+    _settings->setValue("rtp-timer-name", _ui->sofiaRtpTimerNameEdit->text());
+    _settings->setValue("rtp-ip", _ui->sofiaRtpIpEdit->text());
+    _settings->setValue("sip-ip", _ui->sofiaSipIpEdit->text());
+    _settings->setValue("hold-music", _ui->sofiaHoldMusicEdit->text());
+    _settings->setValue("apply-nat-acl", _ui->sofiaApplyNatAclEdit->text());
+    _settings->setValue("manage-presence", _ui->sofiaManagePresenceCombo->currentText());
+    _settings->setValue("max-proceeding", _ui->sofiaMaxProceedingEdit->text());
+    _settings->setValue("inbound-codec-negotiation", _ui->sofiaInboundCodecNegotiationCombo->currentText());
+    _settings->setValue("nonce-ttl", _ui->sofiaNonceTtlSpin->value());
+    _settings->setValue("auth-calls", _ui->sofiaAuthCallsCombo->currentText());
+    _settings->setValue("auth-all-packets", _ui->sofiaAuthAllPacketsCombo->currentText());
+    _settings->setValue("ext-rtp-ip", _ui->sofiaExtRtpIpEdit->text());
+    _settings->setValue("ext-sip-ip", _ui->sofiaExtSipIpEdit->text());
+    _settings->setValue("rtp-timeout-sec", _ui->sofiaRtpTimeoutSecSpin->value());
+    _settings->setValue("rtp-hold-timeout-sec", _ui->sofiaRtpHoldTimeoutSecSpin->value());
+    _settings->setValue("disable-register", _ui->sofiaDisableRegisterCombo->currentText());
+    _settings->setValue("challenge-realm", _ui->sofiaChallengeRealmCombo->currentText());
+
+
+    _settings->endGroup();
+    _settings->endGroup();
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefsofia.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefsofia.h (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/preferences/prefsofia.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefsofia.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/preferences/prefsofia.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,23 @@
+#ifndef PREFSOFIA_H
+#define PREFSOFIA_H
+
+#include <QObject>
+#include "ui_prefdialog.h"
+
+class QSettings;
+
+class PrefSofia : public QObject
+{
+Q_OBJECT
+public:
+    explicit PrefSofia(Ui::PrefDialog *ui, QObject *parent = 0);
+    void writeConfig();
+    void readConfig();
+
+private:
+    QSettings *_settings;
+    Ui::PrefDialog *_ui;
+
+};
+
+#endif // PREFSOFIA_H

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/resources (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/resources)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/resources/pref_accounts.jpg

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/resources/pref_accounts.jpg (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/resources/pref_accounts.jpg)


(Binary files differ)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/resources/pref_audio.gif

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/resources/pref_audio.gif (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/resources/pref_audio.gif)


(Binary files differ)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/resources/pref_general.jpg

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/resources/pref_general.jpg (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/resources/pref_general.jpg)


(Binary files differ)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/resources/pref_sip.png

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/resources/pref_sip.png (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/resources/pref_sip.png)


(Binary files differ)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/resources/splash.png

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/resources/splash.png (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/resources/splash.png)


(Binary files differ)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/resources/test.wav

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/resources/test.wav (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/resources/test.wav)


(Binary files differ)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/resources.qrc

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/resources.qrc (from rev 16612, freeswitch/trunk/contrib/seven/fscomm/resources.qrc) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/resources.qrc	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/seven/fscomm/resources.qrc	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,20 @@
+<RCC>
+    <qresource prefix="/images">
+        <file alias="splash.png">resources/splash.png</file>
+        <file alias="pref_sip.png">resources/pref_sip.png</file>
+        <file alias="pref_audio.gif">resources/pref_audio.gif</file>
+        <file alias="pref_general.jpg">resources/pref_general.jpg</file>
+        <file alias="pref_accounts.jpg">resources/pref_accounts.jpg</file>
+    </qresource>
+    <qresource prefix="/confs">
+        <file alias="freeswitch.xml">conf/freeswitch.xml</file>
+        <file alias="example.xml">conf/accounts/example.xml</file>
+        <file alias="event_socket.conf.xml">conf/event_socket.conf.xml</file>
+        <file alias="portaudio.conf.xml">conf/portaudio.conf.xml</file>
+        <file alias="sofia.conf.xml">conf/sofia.conf.xml</file>
+        <file alias="account.conf.xml">conf/account.conf.xml</file>
+    </qresource>
+    <qresource prefix="/sounds">
+        <file alias="test.wav">resources/test.wav</file>
+    </qresource>
+</RCC>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/EventWatcher/EventWatcher.csproj (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/EventWatcher/EventWatcher.csproj	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/EventWatcher/EventWatcher.csproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,4 +1,4 @@
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -9,6 +9,11 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>EventWatcher</RootNamespace>
     <AssemblyName>EventWatcher</AssemblyName>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <UpgradeBackupLocation>
+    </UpgradeBackupLocation>
+    <OldToolsVersion>2.0</OldToolsVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Resources.Designer.cs (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Resources.Designer.cs	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Resources.Designer.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,7 +1,7 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
-//     Runtime Version:2.0.50727.312
+//     Runtime Version:2.0.50727.4016
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Settings.Designer.cs (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Settings.Designer.cs	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/EventWatcher/Properties/Settings.Designer.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,28 +1,24 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
-//     Runtime Version:2.0.50727.312
+//     Runtime Version:2.0.50727.4016
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.
 // </auto-generated>
 //------------------------------------------------------------------------------
 
-namespace EventWatcher.Properties
-{
-
-
+namespace EventWatcher.Properties {
+    
+    
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
-    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
-    {
-
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "9.0.0.0")]
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+        
         private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
-        public static Settings Default
-        {
-            get
-            {
+        
+        public static Settings Default {
+            get {
                 return defaultInstance;
             }
         }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/FreeSwitch.EventSocket.Test.csproj (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/FreeSwitch.EventSocket.Test.csproj	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/FreeSwitch.EventSocket.Test.csproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,4 +1,4 @@
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -9,6 +9,11 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>FreeSwitch.EventSocket.Test</RootNamespace>
     <AssemblyName>FreeSwitch.EventSocket.Test</AssemblyName>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <UpgradeBackupLocation>
+    </UpgradeBackupLocation>
+    <OldToolsVersion>2.0</OldToolsVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/ParserTest.cs (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/ParserTest.cs	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/ParserTest.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -4,7 +4,54 @@
 
 namespace FreeSwitch.EventSocket.Test
 {
-    class ParserTest
+    public class ParserTest
     {
+    	private const string Auth = "Content-Type: auth/request\n\n";
+
+    	private const string Messages =
+    		"Content-Type: event\nContent-Length:10\n\n1234567890\n\nContent-Type:event\nContent-Length:0\n\n";
+		private const string Messages2 =
+			"Content-Type:event\nContent-Length:0\n\nContent-Type: event\nContent-Length:10\n\n1234567890\n\n";
+
+		private const string Partial1 =
+			"Content-Type: event\nContent-Length:10\n\n12345";
+		private const string Partial2 =
+			"67890\n\nContent-Type:event\nContent-Length:0\n\n";
+
+		public void ParseAuth()
+		{
+			Parser parser = new Parser();
+			parser.Append(Auth);
+			PlainEventMsg msg = parser.ParseOne();
+
+		}
+
+		public void ParseMessages()
+		{
+			Parser parser = new Parser();
+			parser.Append(Messages);
+			var msg = parser.ParseOne();
+
+			msg = parser.ParseOne();
+		}
+
+		public void ParseMessages2()
+		{
+			Parser parser = new Parser();
+			parser.Append(Messages2);
+			var msg = parser.ParseOne();
+
+			msg = parser.ParseOne();
+		}
+
+		public void ParsePartials()
+		{
+			Parser parser = new Parser();
+			parser.Append(Partial1);
+			var msg = parser.ParseOne();
+			parser.Append(Partial2);
+			msg = parser.ParseOne();
+			msg = parser.ParseOne();
+		}
     }
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Program.cs (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Program.cs	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.Test/Program.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -9,6 +9,12 @@
     {
         static void Main(string[] args)
         {
+			ParserTest pt = new ParserTest();
+			pt.ParseMessages();
+			pt.ParseAuth();
+			pt.ParsePartials();
+			pt.ParseMessages2();
+
             /*EventManager mgr = new EventManager();
             mgr.Subscribe(Events.GetChannelEvents());
             mgr.Start("localhost");
@@ -20,12 +26,12 @@
         }
 
         private int _counter;
-        private EventParser _parser;
+        private Parser _parser;
         Random _rand = new Random((int)DateTime.Now.Ticks);
 
         public void Test()
         {
-            _parser = new EventParser();
+            _parser = new Parser();
             string text = File.ReadAllText("C:\\mymsgs.txt");
             Thread[] threads = new Thread[5];
             for (int i = 0; i < 5; ++i)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.sln (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.sln	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitch.EventSocket.sln	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 
-Microsoft Visual Studio Solution File, Format Version 9.00
-# Visual Studio 2005
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeSwitch.EventSocket", "FreeSwitchEventSocket\FreeSwitch.EventSocket.csproj", "{3F8895F6-F710-4323-B96A-4EFB6BC97E08}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FreeSwitch.EventSocket.Test", "FreeSwitch.EventSocket.Test\FreeSwitch.EventSocket.Test.csproj", "{3679225D-79A3-4B6C-BCA1-E2DC265E423A}"

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventManager.cs (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventManager.cs	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventManager.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -31,6 +31,11 @@
         private readonly object _logLocker = new object();
         private readonly LogWriterHandler _logWriter;
 
+    	/// <summary>
+    	/// Gets or sets display all missing event types.
+    	/// </summary>
+    	public bool DisplayMissingEventTypes { get; set; }
+
         /// <summary>
         /// FreeSWITCH password, default is "ClueCon".
         /// </summary>
@@ -129,7 +134,7 @@
                 eb.Parse(parameters);
                 EventReceived(eb);
             }
-            else
+			else if (DisplayMissingEventTypes)
                 _logWriter(LogPrio.Warning, "Failed to load '" + eventName + "'.");
         }
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventParser.cs (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventParser.cs	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventParser.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -79,25 +79,21 @@
                 _text.Append(_piecesToAppend.Dequeue());
             }
 
+			if (_text.Length == 0)
+				return null;
+
             PlainEventMsg plainEvent;
             lock (_text)
             {
-                int i = 0;
+            	int i = 0;
+				IgnoreLineBreaks(ref i);
+            	_text.Remove(0, i);
 
-                // find complete header
-                bool found = false;
-                for (; i < _text.Length - 1; ++i)
-                {
-                    if (_text[i] == '\n' && _text[i + 1] == '\n')
-                    {
-                        found = true;
-                        break;
-                    }
-                }
-                if (!found)
-                    return null;
+            	i = FindEmptyLine(i);
+				if (i == -1)
+					return null;
 
-                // extract header
+            	// extract header
                 char[] chars = new char[i];
                 _text.CopyTo(0, chars, 0, i);
                 string headers = new string(chars);
@@ -114,7 +110,7 @@
                     // this will eat that kind of header.
                     if (_text.Length >= BugWorkaround.Length + i)
                     {
-                        found = true;
+                        bool found = true;
                         for (int index = 0; index < BugWorkaround.Length; ++index)
                         {
                             if (_text[index + i] != BugWorkaround[index])
@@ -137,8 +133,24 @@
                         return null;
 
                     // extract body
-                    chars = new char[plainEvent.ContentLength];
-                    _text.CopyTo(i, chars, 0, plainEvent.ContentLength);
+
+					// since Freeswitch report false sizes sometimes,
+					// we need to go through all lines to find contents.
+					//
+					// If FreeSWITCH is actually doing something wrong and you can prove it, you should report it as a bug.
+					// More likely you are misunderstanding the protocol and confusing the events with more encapsulated events
+					// as a mistake. Dozens of other people have had that same mistake making an ESL client.
+					// You should look in libs/esl and try to get the swig wrapper on the esl lib working instead.
+
+                	int endOfBody = FindEmptyLine(i) + 2; // include the first and last \n
+					if (endOfBody-i != plainEvent.ContentLength)
+					{
+						Console.WriteLine("Invalid content length, actual length: " + (endOfBody - i) + ", reported length: " +
+						                  plainEvent.ContentLength);
+						plainEvent.ContentLength = endOfBody - i;
+					}
+					chars = new char[plainEvent.ContentLength];
+					_text.CopyTo(i, chars, 0, plainEvent.ContentLength);
                     plainEvent.Body = new string(chars);
 
                     // api/response is buggy for originate, no \n\n are appended at the end.
@@ -175,8 +187,18 @@
             return plainEvent;
         }
 
+    	private int FindEmptyLine(int i)
+    	{
+    		for (; i < _text.Length - 1; ++i)
+    		{
+    			if (_text[i] == '\n' && _text[i + 1] == '\n')
+    				return i;
+    		}
+    		return -1;
+    	}
 
-        public void Append(string text)
+
+    	public void Append(string text)
         {
             lock (_piecesToAppend)
                 _piecesToAppend.Enqueue(text);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventSocket.cs (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventSocket.cs	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/EventSocket.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -8,372 +8,395 @@
 
 namespace FreeSwitch.EventSocket
 {
-    public delegate void MessageHandler(PlainEventMsg msg);
+	public delegate void MessageHandler(PlainEventMsg msg);
 
-    public class EventSocket
-    {
-        #region Delegates
+	public class EventSocket
+	{
+		#region Delegates
 
-        public delegate void EventSocketHandler(EventSocket client);
+		public delegate void DataHandler(string data);
 
-        public delegate void DataHandler(string data);
+		public delegate void EventSocketHandler(EventSocket client);
 
-        #endregion
+		#endregion
 
-        private LogWriterHandler _logWriter;
-        private readonly Queue<CmdBase> _commands = new Queue<CmdBase>();
-        private bool _autoConnect = true;
-        private Events _events;
-        private string _hostName;
-        private readonly EventParser _parser = new EventParser();
-        public event DataHandler DataReceived;
-        private string _password = "ClueCon";
-        private int _port = 8021;
-        private readonly object _lockobj = new object();
-        private readonly byte[] _readBuffer = new byte[8192];
-        private Socket _socket;
-        private NetworkStream _stream;
-        private Timer _timer;
-        private bool _authed;
-        const int RetryTimeout = 5000;
-        private bool _parsing;
+		private const int RetryTimeout = 5000;
 
-        /// <summary>
-        /// Initializes a new instance of the <see cref="EventSocket"/> class.
-        /// </summary>
-        /// <param name="logWriter">The log writer.</param>
-        public EventSocket(LogWriterHandler logWriter)
-        {
-            LogWriter = logWriter ?? NullWriter.Write;
-            CreateSocket();
-        }
+		private readonly Queue<CmdBase> _commands = new Queue<CmdBase>();
+		private readonly object _lockobj = new object();
+		private readonly ManualResetEvent _parseEvent = new ManualResetEvent(false);
+		private readonly Parser _parser = new Parser();
+		private readonly Thread _parseThread;
+		private readonly byte[] _readBuffer = new byte[8192];
+		private bool _authed;
+		private bool _autoConnect = true;
+		private Events _events;
+		private string _hostName;
+		private bool _isRunning = true;
+		private LogWriterHandler _logWriter;
+		private bool _parsing;
+		private string _password = "ClueCon";
+		private int _port = 8021;
+		private Socket _socket;
+		private NetworkStream _stream;
+		private Timer _timer;
 
-        private void CreateSocket()
-        {
-            _socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
-            _socket.NoDelay = true;
-            _socket.ReceiveBufferSize = 65535;
-        }
+		/// <summary>
+		/// Initializes a new instance of the <see cref="EventSocket"/> class.
+		/// </summary>
+		/// <param name="logWriter">The log writer.</param>
+		public EventSocket(LogWriterHandler logWriter)
+		{
+			LogWriter = logWriter ?? NullWriter.Write;
+			CreateSocket();
+			_parseThread = new Thread(OnParseMessages);
+			_parseThread.IsBackground = true;
+			_parseThread.Start();
+		}
 
-        /// <summary>
-        /// Used to authenticate towards FreeSWITCH.
-        /// </summary>
-        /// <remarks>
-        /// Default is "ClueCon"
-        /// </remarks>
-        public string Password
-        {
-            get { return _password; }
-            set { _password = value; }
-        }
+		/// <summary>
+		/// Used to authenticate towards FreeSWITCH.
+		/// </summary>
+		/// <remarks>
+		/// Default is "ClueCon"
+		/// </remarks>
+		public string Password
+		{
+			get { return _password; }
+			set { _password = value; }
+		}
 
-        /// <summary>
-        /// Connect automatically again if socket is disconnected.
-        /// </summary>
-        public bool AutoConnect
-        {
-            get { return _autoConnect; }
-            set { _autoConnect = value; }
-        }
+		/// <summary>
+		/// Connect automatically again if socket is disconnected.
+		/// </summary>
+		public bool AutoConnect
+		{
+			get { return _autoConnect; }
+			set { _autoConnect = value; }
+		}
 
-        public LogWriterHandler LogWriter
-        {
-            get { return _logWriter; }
-            set { _logWriter = value ?? NullWriter.Write; }
-        }
+		public LogWriterHandler LogWriter
+		{
+			get { return _logWriter; }
+			set { _logWriter = value ?? NullWriter.Write; }
+		}
 
-        /// <summary>
-        /// A event have been received
-        /// </summary>
-        public event MessageHandler MessageReceived = delegate{};
+		public event DataHandler DataReceived;
 
-        /// <summary>
-        /// Socket got disconnected (due to remote peer)
-        /// </summary>
-        public event EventSocketHandler Disconnected = delegate{};
+		private void CreateSocket()
+		{
+			_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+			_socket.NoDelay = true;
+			_socket.ReceiveBufferSize = 65535;
+		}
 
-        /// <summary>
-        /// Socket is now connected
-        /// </summary>
-        public event EventSocketHandler Connected = delegate{};
+		public void Stop()
+		{
+			_isRunning = false;
+			_parseEvent.Set();
+			_autoConnect = false;
+			_parseThread.Join(1000);
+			_socket.Close();
+		}
 
-        /// <summary>
-        /// Connect to FreeSWITCH
-        /// </summary>
-        /// <param name="server">hostname/ipaddress colon port</param>
-        /// <example>
-        /// <code>eventSocket.Connect("localhost:1234");</code>
-        /// </example>
-        public void Connect(string server)
-        {
-            int pos = server.IndexOf(':');
-            if (pos == -1)
-                _hostName = server;
-            else
-            {
-                _port = int.Parse(server.Substring(pos + 1));
-                _hostName = server.Substring(0, pos);
-            }
+		private void OnParseMessages()
+		{
+			while (true)
+			{
+				_parseEvent.WaitOne();
+				_parseEvent.Reset();
+				if (!_isRunning)
+					break;
 
-            Connect();
-        }
+				try
+				{
+					ParseMessages();
+				}
+				catch (Exception err)
+				{
+					LogWriter(LogPrio.Warning,
+					          "Failed to parse event message." + Environment.NewLine + "Exception: " + err +
+					          Environment.NewLine + _parser.Text);
+					HandleDisconnect();
+				}
+			}
+		}
 
-        /// <summary>
-        /// Connect to the previously specified host.
-        /// </summary>
-        public void Connect()
-        {
-            if (_hostName == null)
-                throw new InvalidOperationException("Must call the other Connect method first to set hostname/port.");
+		/// <summary>
+		/// A event have been received
+		/// </summary>
+		public event MessageHandler MessageReceived = delegate { };
 
-            try
-            {
-                TryConnect();
-                LogWriter(LogPrio.Debug, "Connected to freeswitch.");
-            }
-            catch (SocketException err)
-            {
-                LogWriter(LogPrio.Debug, "Failed to connect to freeswitch, reason: " + err.Message);
-                HandleDisconnect();
-            }
-        }
+		/// <summary>
+		/// Socket got disconnected (due to remote peer)
+		/// </summary>
+		public event EventSocketHandler Disconnected = delegate { };
 
-        private void TryConnect()
-        {
-            lock (_lockobj)
-            {
-                _socket.Connect(_hostName, _port);
-                if (_stream == null)
-                    _stream = new NetworkStream(_socket, false);
+		/// <summary>
+		/// Socket is now connected
+		/// </summary>
+		public event EventSocketHandler Connected = delegate { };
 
-                Connected(this);
-                BeginRead();
+		/// <summary>
+		/// Connect to FreeSWITCH
+		/// </summary>
+		/// <param name="server">hostname/ipaddress colon port</param>
+		/// <example>
+		/// <code>eventSocket.Connect("localhost:1234");</code>
+		/// </example>
+		public void Connect(string server)
+		{
+			int pos = server.IndexOf(':');
+			if (pos == -1)
+				_hostName = server;
+			else
+			{
+				_port = int.Parse(server.Substring(pos + 1));
+				_hostName = server.Substring(0, pos);
+			}
 
-                if (_timer == null) return;
-                Timer tmr = _timer;
-                _timer = null;
-                tmr.Change(Timeout.Infinite, Timeout.Infinite);
-                tmr.Dispose();
-            }
-        }
+			Connect();
+		}
 
-        private void BeginRead()
-        {
-            _stream.BeginRead(_readBuffer, 0, _readBuffer.Length, OnReadCompleted, null);
-        }
+		/// <summary>
+		/// Connect to the previously specified host.
+		/// </summary>
+		public void Connect()
+		{
+			if (_hostName == null)
+				throw new InvalidOperationException("Must call the other Connect method first to set hostname/port.");
 
-        private void OnReadCompleted(IAsyncResult ar)
-        {
-            string inbuffer;
-            try
-            {
-                if (_stream == null)
-                    return; // closed socket.
+			try
+			{
+				TryConnect();
+				LogWriter(LogPrio.Debug, "Connected to freeswitch.");
+			}
+			catch (InvalidOperationException err)
+			{
+				LogWriter(LogPrio.Debug, "Failed to connect to freeswitch, reason: " + err.Message);
+				HandleDisconnect();
+			}
+			catch (SocketException err)
+			{
+				LogWriter(LogPrio.Debug, "Failed to connect to freeswitch, reason: " + err.Message);
+				HandleDisconnect();
+			}
+		}
 
-                int bytesRead = _stream.EndRead(ar);
-                if (bytesRead == 0)
-                {
-                    LogWriter(LogPrio.Error, "Got disconnected (0 bytes read).");
-                    HandleDisconnect();
-                    return;
-                }
-                inbuffer = Encoding.ASCII.GetString(_readBuffer, 0, bytesRead);
-                _parser.Append(inbuffer);
-                BeginRead();
-            }
-            catch (IOException err)
-            {
-                LogWriter(LogPrio.Debug, "IO exception during read: " + err.Message);
-                // Remote end disconnected.
-                HandleDisconnect();
-                return;
-            }
+		private void TryConnect()
+		{
+			lock (_lockobj)
+			{
+				_socket.Connect(_hostName, _port);
+				if (_stream == null)
+					_stream = new NetworkStream(_socket, false);
 
-            if (!string.IsNullOrEmpty(inbuffer))
-                DataReceived(inbuffer);
+				Connected(this);
+				BeginRead();
+			}
+		}
 
-            try
-            {
-                ParseMessages();
-            }
-            catch (InvalidDataException err)
-            {
-                LogWriter(LogPrio.Warning,
-                          "Failed to parse event message." + Environment.NewLine + "Exception: " + err +
-                          Environment.NewLine + _parser.Text);
-                HandleDisconnect();
-            }
-            catch (ArgumentException err)
-            {
-                LogWriter(LogPrio.Warning,
-                          "Failed to parse event message." + Environment.NewLine + "Exception: " + err +
-                          Environment.NewLine + _parser.Text);
-                HandleDisconnect();
-            }
-        }
+		private void BeginRead()
+		{
+			_stream.BeginRead(_readBuffer, 0, _readBuffer.Length, OnReadCompleted, null);
+		}
 
-        /// <summary>
-        /// Subscribe on the specified events.
-        /// </summary>
-        /// <param name="events">The events.</param>
-        public void Subscribe(Events events)
-        {
-            _events = events;
-            if (_socket.Connected && _authed)
-                RequestEvents();
-        }
+		private void OnReadCompleted(IAsyncResult ar)
+		{
+			try
+			{
+				ReceiveWrapper(ar);
+			}
+			catch (Exception err)
+			{
+				_logWriter(LogPrio.Error, err.ToString());
+			}
+		}
 
-        /// <summary>
-        /// 
-        /// </summary>
-        /// <param name="s"></param>
-        /// <exception cref="InvalidOperationException"></exception>
-        /// <exception cref="ObjectDisposedException"></exception>
-        private void Write(string s)
-        {
-            if (_socket == null)
-                return;
-            if (!_socket.Connected)
-            {
-                try
-                {
-                    TryConnect();
-                    LogWriter(LogPrio.Info, "We've connected again");
-                }
-                catch (SocketException)
-                {
-                    return;
-                }
-            }
+		private void ReceiveWrapper(IAsyncResult ar)
+		{
+			string inbuffer;
+			try
+			{
+				if (_stream == null)
+					return;
 
-            byte[] bytes = Encoding.ASCII.GetBytes(s);
-            _stream.Write(bytes, 0, bytes.Length);
-        }
+				int bytesRead = _stream.EndRead(ar);
+				if (bytesRead == 0)
+				{
+					LogWriter(LogPrio.Error, "Got disconnected (0 bytes read).");
+					HandleDisconnect();
+					return;
+				}
+				inbuffer = Encoding.ASCII.GetString(_readBuffer, 0, bytesRead);
+				BeginRead();
+			}
+			catch (Exception err)
+			{
+				LogWriter(LogPrio.Debug, "IO exception during read: " + err.Message);
+				// Remote end disconnected.
+				HandleDisconnect();
+				return;
+			}
 
-        static readonly object locker = new object();
-        private void ParseMessages()
-        {
-            
-            lock (locker)
-            {
-                if (_parsing)
-                    return;
-                _parsing = true;
-            }
+			_parser.Append(inbuffer);
+			if (!string.IsNullOrEmpty(inbuffer))
+				DataReceived(inbuffer);
 
-            try
-            {
-                PlainEventMsg msg = _parser.ParseOne();
-                while (msg != null)
-                {
-					LogWriter(LogPrio.Trace, "MessageType: " + msg.ContentType);
-					switch (msg.ContentType)
-                    {
-                        case "auth/request":
-                            {
-                                AuthCommand cmd = new AuthCommand(_password);
-                                cmd.ReplyReceived += OnAuthed;
-                                _commands.Enqueue(cmd);
-                                Write(cmd + "\n\n");
-                            }
-                            break;
-                        case "api/response":
-                        case "command/reply":
-                            if (_commands.Count > 0)
-                            {
-                                CmdBase cmd = _commands.Dequeue();
-                                cmd.HandleReply(cmd.CreateReply(msg.Body.Trim()));
-                            }
-                            else
-                                LogWriter(LogPrio.Debug, "Got command reply or api response, but no actual command/api: " + msg.Body);
-                            break;
-                        default:
-                            MessageReceived(msg);
-                            break;
-                    }
-                    msg = _parser.ParseOne();
-                }
-            }
-            finally
-            {
-                lock (locker)
-                    _parsing = false;
-            }
-        }
+			_parseEvent.Set();
+		}
 
-        private void OnAuthed(CmdBase command, CommandReply reply)
-        {
-            LogWriter(LogPrio.Trace, "We have not authenticated.");
-            _authed = true;
-            RequestEvents();
-        }
+		/// <summary>
+		/// Subscribe on the specified events.
+		/// </summary>
+		/// <param name="events">The events.</param>
+		public void Subscribe(Events events)
+		{
+			_events = events;
+			if (_socket.Connected && _authed)
+				RequestEvents();
+		}
 
-        private void HandleDisconnect()
-        {
-            _parser.Clear();
-            _authed = false;
-            _socket.Close();
-            CreateSocket();
-            if (_stream != null)
-            {
-                _stream.Dispose();
-                _stream = null;
-            }
+		/// <summary>
+		/// 
+		/// </summary>
+		/// <param name="s"></param>
+		/// <exception cref="InvalidOperationException"></exception>
+		/// <exception cref="ObjectDisposedException"></exception>
+		private void Write(string s)
+		{
+			if (_socket == null)
+				return;
+			if (!_socket.Connected)
+			{
+				if (_timer == null)
+					_timer = new Timer(OnTryConnect, null, RetryTimeout, RetryTimeout);
+				return;
+			}
 
-            Disconnected(this);
-            if (!AutoConnect || _timer != null) return;
-            LogWriter(LogPrio.Info, "Launching autoconnect timer.");
-            _timer = new Timer(TryConnect, this, RetryTimeout, RetryTimeout);
-        }
+			byte[] bytes = Encoding.ASCII.GetBytes(s);
+			_stream.Write(bytes, 0, bytes.Length);
+		}
 
-        private void RequestEvents()
-        {
-            if (_events.Count <= 0 && _authed)
-                return;
+		// Should ONLY be called from the parsing thread.
+		private void ParseMessages()
+		{
+			PlainEventMsg msg = _parser.ParseOne();
+			while (msg != null)
+			{
+				LogWriter(LogPrio.Trace, "MessageType: " + msg.ContentType);
+				switch (msg.ContentType)
+				{
+					case "auth/request":
+						{
+							var cmd = new AuthCommand(_password);
+							cmd.ReplyReceived += OnAuthed;
+							_commands.Enqueue(cmd);
+							Write(cmd + "\n\n");
+						}
+						break;
+					case "api/response":
+					case "command/reply":
+						if (_commands.Count > 0)
+						{
+							CmdBase cmd = _commands.Dequeue();
+							cmd.HandleReply(cmd.CreateReply(msg.Body.Trim()));
+						}
+						else
+							LogWriter(LogPrio.Debug, "Got command reply or api response, but no actual command/api: " + msg.Body);
+						break;
+					default:
+						MessageReceived(msg);
+						break;
+				}
+				msg = _parser.ParseOne();
+			}
+		}
 
-            Write("event plain " + GetEventString() + "\n\n");
-        }
+		private void OnAuthed(CmdBase command, CommandReply reply)
+		{
+			LogWriter(LogPrio.Trace, "We have not authenticated.");
+			_authed = true;
+			RequestEvents();
+		}
 
-        private string GetEventString()
-        {
-            string events = string.Empty;
-            for (int i = 0; i < _events.Count; ++i)
-                events += StringHelper.CamelCaseToUpperCase(_events[i].ToString()) + " ";
-            return events;
-        }
+		private void HandleDisconnect()
+		{
+			_parser.Clear();
+			_authed = false;
+			_socket.Close();
+			CreateSocket();
+			if (_stream != null)
+			{
+				_stream.Dispose();
+				_stream = null;
+			}
 
-        /// <summary>
-        /// Send a command to FreeSwitch.
-        /// Do you want a response? Then use the delegate in the Command class.
-        /// </summary>
-        /// <param name="command">Command to send.</param>
-        /// <exception cref="IOException">If socket is not connected.</exception>
-        /// <exception cref="InvalidOperationException"></exception>
-        /// <exception cref="ObjectDisposedException"></exception>
-        public void Send(CmdBase command)
-        {
-            if (!_socket.Connected)
-            {
-                LogWriter(LogPrio.Debug, "Tried to send command when we are not connected: " + command);
-                throw new IOException("Socket is not connected.");
-            }
+			Disconnected(this);
+			if (!AutoConnect || _timer != null)
+				return;
 
-            _commands.Enqueue(command);
+			LogWriter(LogPrio.Info, "Launching autoconnect timer.");
+			_timer = new Timer(OnTryConnect, this, RetryTimeout, RetryTimeout);
+		}
 
-            // All commands need replies.
-            Write(command + "\n\n");
-        }
+		private void OnTryConnect(object state)
+		{
+			try
+			{
+				TryConnect();
+				LogWriter(LogPrio.Info, "Connected again.");
+				if (_timer == null)
+					return;
 
-        private void TryConnect(object state)
-        {
-            EventSocket client = (EventSocket) state;
-            try
-            {
-                client.TryConnect();
-                LogWriter(LogPrio.Info, "Connected again.");
-            }
-            catch (SocketException)
-            {}
-        }
-    }
+				Timer tmr = _timer;
+				_timer = null;
+				tmr.Change(Timeout.Infinite, Timeout.Infinite);
+				tmr.Dispose();
+			}
+			catch (Exception err)
+			{
+				if (!(err is SocketException))
+					LogWriter(LogPrio.Error, "Unexpected exception in try connect: " + err);
+			}
+		}
+
+		private void RequestEvents()
+		{
+			if (_events.Count <= 0 && _authed)
+				return;
+
+			Write("event plain " + GetEventString() + "\n\n");
+		}
+
+		private string GetEventString()
+		{
+			string events = string.Empty;
+			for (int i = 0; i < _events.Count; ++i)
+				events += StringHelper.CamelCaseToUpperCase(_events[i].ToString()) + " ";
+			return events;
+		}
+
+		/// <summary>
+		/// Send a command to FreeSwitch.
+		/// Do you want a response? Then use the delegate in the Command class.
+		/// </summary>
+		/// <param name="command">Command to send.</param>
+		/// <exception cref="IOException">If socket is not connected.</exception>
+		/// <exception cref="InvalidOperationException"></exception>
+		/// <exception cref="ObjectDisposedException"></exception>
+		public void Send(CmdBase command)
+		{
+			if (!_socket.Connected)
+			{
+				LogWriter(LogPrio.Debug, "Tried to send command when we are not connected: " + command);
+				throw new IOException("Socket is not connected.");
+			}
+
+			_commands.Enqueue(command);
+
+			// All commands need replies.
+			Write(command + "\n\n");
+		}
+	}
 }
\ No newline at end of file

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventBase.cs (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventBase.cs	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Events/EventBase.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -134,7 +134,14 @@
                     m_coreId = value;
                     break;
                 case "event-date-local":
-                    m_dateLocal = DateTime.Parse(value);
+					try
+					{
+						m_dateLocal = DateTime.Parse(value);
+					}
+					catch(Exception err)
+					{
+						Console.WriteLine(err.ToString());
+					}
                     break;
                 case "event-date-gmt":
                     m_dateGMT = DateTime.Parse(value);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/FreeSwitch.EventSocket.csproj (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/FreeSwitch.EventSocket.csproj	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/FreeSwitch.EventSocket.csproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,8 +1,8 @@
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>8.0.50727</ProductVersion>
+    <ProductVersion>9.0.30729</ProductVersion>
     <SchemaVersion>2.0</SchemaVersion>
     <ProjectGuid>{3F8895F6-F710-4323-B96A-4EFB6BC97E08}</ProjectGuid>
     <OutputType>Library</OutputType>
@@ -13,6 +13,26 @@
     </StartupObject>
     <SignAssembly>true</SignAssembly>
     <AssemblyOriginatorKeyFile>EventSocket.pfx</AssemblyOriginatorKeyFile>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <UpgradeBackupLocation>
+    </UpgradeBackupLocation>
+    <OldToolsVersion>2.0</OldToolsVersion>
+    <PublishUrl>publish\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>
@@ -76,8 +96,8 @@
     <Compile Include="Ivr\IvrQueue.cs" />
     <Compile Include="Ivr\PrivateWaitDtmf.cs" />
     <Compile Include="LogWriterHandler.cs" />
+    <Compile Include="Parser.cs" />
     <Compile Include="PlainEventMsg.cs" />
-    <Compile Include="EventParser.cs" />
     <Compile Include="Events.cs" />
     <Compile Include="Events\EventApiCommand.cs" />
     <Compile Include="Events\EventBase.cs" />
@@ -114,6 +134,33 @@
   <ItemGroup>
     <None Include="EventSocket.pfx" />
   </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 2.0 %28x86%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.0">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.0 %28x86%29</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/PrivateWaitDtmf.cs (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/PrivateWaitDtmf.cs	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Ivr/PrivateWaitDtmf.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -47,9 +47,15 @@
 
         private void OnTimeout(object state)
         {
-            _timer.Dispose();
-            _timer = null;
-            _handler(this);
+            try
+            {
+                _timer.Dispose();
+                _timer = null;
+                _handler(this);
+            }
+            catch(Exception)
+            {
+            }
         }
 
         #region IDisposable Members

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Parser.cs (from rev 16612, freeswitch/trunk/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Parser.cs) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Parser.cs	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/Parser.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,161 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace FreeSwitch.EventSocket
+{
+	public class Parser
+	{
+		private readonly StringBuilder _text = new StringBuilder();
+		private readonly Queue<string> _piecesToAppend = new Queue<string>();
+
+		public string Text
+		{
+			get { return _text.ToString(); }
+		}
+
+		public void Append(string text)
+		{
+			lock (_piecesToAppend)
+				_piecesToAppend.Enqueue(text);
+		}
+
+		internal static void ParseHeaders(PlainEventMsg msg, string header)
+		{
+			StringParser parser = new StringParser(header);
+			string name = parser.Read(':', true);
+			while (name != string.Empty)
+			{
+				switch (name)
+				{
+					case "Content-Length":
+						msg.ContentLength = int.Parse(parser.ReadLine(true));
+						break;
+					case "Content-Type":
+						msg.ContentType = parser.ReadLine(true);
+						break;
+					case "Reply-Text":
+						msg.Body = parser.ReadLine(true);
+						break;
+				}
+
+				// empty line == end of header
+				if (parser.EOL)
+					break;
+
+				name = parser.Read(':', true);
+			}
+		}
+
+		public PlainEventMsg ParseOne()
+		{
+			AppendPieces();
+
+			int index = 0;
+			PlainEventMsg msg = FindHeaders(ref index);
+			if (msg == null)
+				return null;
+
+			// no body
+			if (msg.ContentLength <= 0)
+			{
+				_text.Remove(0, index);
+				return msg;
+			}
+
+			// too few bytes.
+			if (_text.Length-index < msg.ContentLength)
+				return null;
+
+			// ignore empty line between header and body.
+			IgnoreEmptyLines(ref index);
+
+			int start = index;
+			FindEmptyLine(ref index);
+
+			int size = index - start + 2; // include \n\n
+
+			// Validate size.
+			//
+			// Someone suggested that the sizes are correct and that 
+			// the events was wrapped. Well. I've checked if the
+			// specified position is a \n\n, and it's not.
+			//
+			// Don't force me to check source code of another implementation
+			//
+			if (size != msg.ContentLength)
+			{
+				// Check if the buffer contains header + body only,
+				// then use the reported size, despite that our check failed.
+				if (_text.Length == msg.ContentLength + start)
+					size = msg.ContentLength;
+				// buffer contains more than one message.
+				else if (_text.Length > msg.ContentLength+start)
+				{
+					// Check if the reported size ends with a \n,
+					// in that case we have a container event.
+					if (_text[msg.ContentLength + start - 1] == '\n')
+						size = msg.ContentLength;
+				}
+			}
+
+			char[] body = new char[size];
+			_text.CopyTo(start, body, 0, size);
+			msg.Body = new string(body);
+			_text.Remove(0, index);
+			return msg;
+		}
+
+		private PlainEventMsg FindHeaders(ref int index)
+		{
+			IgnoreEmptyLines(ref index);
+
+			int start = index;
+			FindEmptyLine(ref index);
+			if (start == index)
+				return null; //got no header.
+
+			char[] headerBuffer = new char[index - start];
+			_text.CopyTo(start, headerBuffer, 0, index - start);
+			
+			PlainEventMsg eventMsg = new PlainEventMsg();
+			ParseHeaders(eventMsg, new string(headerBuffer));
+			return eventMsg;
+		}
+
+
+		private void IgnoreEmptyLines(ref int index)
+		{
+			while (index < _text.Length && _text[index] == '\n')
+				++index;
+		}
+
+		private void FindEmptyLine(ref int index)
+		{
+			int pos = index;
+			while (index < _text.Length-1)
+			{
+				if (_text[index] == '\n' && _text[index + 1] == '\n')
+					return;
+				++index;
+			}
+
+			index = pos;
+		}
+
+		private void AppendPieces()
+		{
+			lock (_piecesToAppend)
+			{
+				while (_piecesToAppend.Count > 0)
+					_text.Append(_piecesToAppend.Dequeue());
+			}
+		}
+
+		public void Clear()
+		{
+			_piecesToAppend.Clear();
+			_text.Length = 0;
+		}
+	}
+}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceProbe.cs (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceProbe.cs	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/SipEvents/EventPresenceProbe.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,16 +1,52 @@
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace FreeSwitch.EventSocket.SipEvents
+namespace FreeSwitch.EventSocket
 {
-    class EventPresenceProbe : EventPresence
-    {
-        public override string ToString()
-        {
-            return "PresenceProbe." + base.ToString();
-        }
+	/// <summary>
+	/// 
+	/// </summary>
+	/// <example>
+	/// proto: sip
+/// login: sip%3Amod_sofia%4010.0.1.250%3A5060
+/// from: 1009%4010.0.1.250
+/// status: Available
+/// event_type: presence
+/// event_subtype: probe
+/// proto-specific-event-name: dialog
+/// Event-Name: PRESENCE_PROBE
+/// Core-UUID: 2130a7d1-c1f7-44cd-8fae-8ed5946f3cec
+/// FreeSWITCH-Hostname: localhost.localdomain
+/// FreeSWITCH-IPv4: 10.0.1.250
+/// FreeSWITCH-IPv6: 127.0.0.1
+/// Event-Date-Local: 2007-12-16%2022%3A31%3A16
+/// Event-Date-GMT: Mon,%2017%20Dec%202007%2004%3A31%3A16%20GMT
+/// Event-Date-timestamp: 1197865876565022
+/// Event-Calling-File: sofia_presence.c
+/// Event-Calling-Function: sofia_presence_sub_reg_callback
+	/// Event-Calling-Line-Number: 484
+	/// </example>
+	public class EventPresenceProbe : SipEvent
+	{
+		/// <summary>
+		/// Gets or sets user status.
+		/// </summary>
+		public string Status { get; set; }
 
-    }
+		/// <summary>
+		/// Gets or sets login module used.
+		/// </summary>
+		public string Login { get; set; }
 
+		public override bool ParseCommand(string name, string value)
+		{
+			switch (name)
+			{
+				case "status":
+					Status = value;
+					break;
+				case "login":
+					Login = value;
+					break;
+			}
+			return true;
+		}
+	}
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/StringParser.cs (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/StringParser.cs	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/FreeSwitchEventSocket/StringParser.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -188,19 +188,19 @@
             {
                 ++_pos; // skip delimiter
                 int endpos = TrimEnd(); // skip 
-                return _text.Substring(startpos, endpos - startpos);
+                return _text.Substring(startpos, endpos - startpos-1);
             }
         }
 
         private int TrimEnd()
         {
-            if (EOF)
-                return _pos;
+			if (EOF || !IsWS(_text[_pos]))
+				return _pos;
 
             int pos = _pos;
             while (IsWS(_text[pos]))
                 --pos;
-            return pos;
+            return pos+1;
         }
 
         private int FindWS(bool stopAtEOL)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/IvrSocket/IvrSocket.csproj (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/IvrSocket/IvrSocket.csproj	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/contrib/verifier/EventSocket/trunk/IvrSocket/IvrSocket.csproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,4 +1,4 @@
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@@ -9,6 +9,11 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>IvrSocket</RootNamespace>
     <AssemblyName>IvrSocket</AssemblyName>
+    <FileUpgradeFlags>
+    </FileUpgradeFlags>
+    <UpgradeBackupLocation>
+    </UpgradeBackupLocation>
+    <OldToolsVersion>2.0</OldToolsVersion>
   </PropertyGroup>
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
     <DebugSymbols>true</DebugSymbols>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/changelog (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/changelog	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/changelog	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,3 +1,17 @@
+freeswitch (1.0.4-1ubuntu2) karmic; urgency=low
+
+    * upgrade: Add more verbosity when building to make it easier to find build errors.
+    * upgrade: Remove the requirement for EXACTLY automake1.9 and change it to need atleast automake 1.9
+    * upgrade: Add the modules (directory, cluechoo, and valet_parking) to the build files. These are in the standard build, so they should be here too.
+
+ -- William King <quentusrex@gmail.com>  Fri, 18 Dec 2009 14:27:42 -0800
+
+freeswitch (1.0.4-1ubuntu1) karmic; urgency=low
+
+    * upgrade: Pulling out the sounds into separate source files for easier management.
+
+ -- William King <quentusrex@gmail.com>  Sun, 15 Nov 2009 16:38:13 -0800
+
 freeswitch (1.0.4-1) unstable; urgency=low
 
     * new

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/control (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/control	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/control	2010-02-12 00:54:22 UTC (rev 16614)
@@ -2,12 +2,12 @@
 Maintainer: Michal Bielicki <michal.bielicki@voiceworks.pl>
 Section: net
 Priority: extra
-Build-Depends: debhelper (>= 5), fakeroot, wget, automake1.9, autoconf, libtool, unixodbc-dev, libasound2-dev, libcurl3-openssl-dev|libcurl4-openssl-dev, libssl-dev, ncurses-dev, libogg-dev, libvorbis-dev, libperl-dev, libgdbm-dev, libdb-dev, libgnutls-dev, libtiff4-dev, python, libmemcache-dev, memcached, libx11-dev
+Build-Depends: debhelper (>= 5), fakeroot, wget, automake (>=1.9), autoconf, libtool, unixodbc-dev, libasound2-dev, libcurl3-openssl-dev|libcurl4-openssl-dev, libssl-dev, ncurses-dev, libogg-dev, libvorbis-dev, libperl-dev, libgdbm-dev, libdb-dev, libgnutls-dev, libtiff4-dev, python, libmemcache-dev, memcached, libx11-dev, uuid-dev
 Standards-Version: 3.7.3
 
 Package: freeswitch
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, libc6, unixodbc, libasound2, libcurl3, openssl, libncurses5, libvorbis0a
+Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, libc6, unixodbc, libasound2, libcurl3, openssl, libncurses5, libvorbis0a, libuuid1
 Recommends: freeswitch-lang-en
 Suggests: freeswitch-spidermonkey, freeswitch-lua, freeswitch-perl, freeswitch-sounds-music-8000, monit 
 Description: The FreeSWITCH open source telephony platform
@@ -110,56 +110,6 @@
  or a media server to host IVR applications using simple scripts or XML to
  control the callflow.
 
-Package: freeswitch-sounds-en-us-callie-8000
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
-Description: English language files for the FreeSWITCH(TM)
- FreeSWITCH is an open source telephony platform designed to facilitate the
- creation of voice and chat driven products scaling from a soft-phone up to
- a soft-switch.  It can be used as a simple switching engine, a media gateway
- or a media server to host IVR applications using simple scripts or XML to
- control the callflow.
-
-Package: freeswitch-sounds-music-8000
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
-Description: Music on hold files for the FreeSWITCH(TM) (8000)
- FreeSWITCH is an open source telephony platform designed to facilitate the
- creation of voice and chat driven products scaling from a soft-phone up to
- a soft-switch.  It can be used as a simple switching engine, a media gateway
- or a media server to host IVR applications using simple scripts or XML to
- control the callflow.
-
-Package: freeswitch-sounds-en-us-callie-16000
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
-Description: English language files for the FreeSWITCH(TM) (16000)
- FreeSWITCH is an open source telephony platform designed to facilitate the
- creation of voice and chat driven products scaling from a soft-phone up to
- a soft-switch.  It can be used as a simple switching engine, a media gateway
- or a media server to host IVR applications using simple scripts or XML to
- control the callflow.
-
-Package: freeswitch-sounds-en-us-callie-32000
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
-Description: English language files for the FreeSWITCH(TM) (32000)
- FreeSWITCH is an open source telephony platform designed to facilitate the
- creation of voice and chat driven products scaling from a soft-phone up to
- a soft-switch.  It can be used as a simple switching engine, a media gateway
- or a media server to host IVR applications using simple scripts or XML to
- control the callflow.
-
-Package: freeswitch-sounds-en-us-callie-48000
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
-Description: English language files for the FreeSWITCH(TM) (48000)
- FreeSWITCH is an open source telephony platform designed to facilitate the
- creation of voice and chat driven products scaling from a soft-phone up to
- a soft-switch.  It can be used as a simple switching engine, a media gateway
- or a media server to host IVR applications using simple scripts or XML to
- control the callflow.
-
 Package: freeswitch-lang-de
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
@@ -221,43 +171,3 @@
  a soft-switch.  It can be used as a simple switching engine, a media gateway
  or a media server to host IVR applications using simple scripts or XML to
  control the callflow.
-
-Package: freeswitch-sounds-ru-ru-elena-8000
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
-Description: Russian language files for the FreeSWITCH(TM)
- FreeSWITCH is an open source telephony platform designed to facilitate the
- creation of voice and chat driven products scaling from a soft-phone up to
- a soft-switch.  It can be used as a simple switching engine, a media gateway
- or a media server to host IVR applications using simple scripts or XML to
- control the callflow.
-
-Package: freeswitch-sounds-ru-ru-elena-16000
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
-Description: Russian language files for the FreeSWITCH(TM) (16000)
- FreeSWITCH is an open source telephony platform designed to facilitate the
- creation of voice and chat driven products scaling from a soft-phone up to
- a soft-switch.  It can be used as a simple switching engine, a media gateway
- or a media server to host IVR applications using simple scripts or XML to
- control the callflow.
-
-Package: freeswitch-sounds-ru-ru-elena-32000
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
-Description: Russian language files for the FreeSWITCH(TM) (32000)
- FreeSWITCH is an open source telephony platform designed to facilitate the
- creation of voice and chat driven products scaling from a soft-phone up to
- a soft-switch.  It can be used as a simple switching engine, a media gateway
- or a media server to host IVR applications using simple scripts or XML to
- control the callflow.
-
-Package: freeswitch-sounds-ru-ru-elena-48000
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch
-Description: Russian language files for the FreeSWITCH(TM) (48000)
- FreeSWITCH is an open source telephony platform designed to facilitate the
- creation of voice and chat driven products scaling from a soft-phone up to
- a soft-switch.  It can be used as a simple switching engine, a media gateway
- or a media server to host IVR applications using simple scripts or XML to
- control the callflow.

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/freeswitch-sounds-en-us-callie-16000.install

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/freeswitch-sounds-en-us-callie-32000.install

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/freeswitch-sounds-en-us-callie-48000.install

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/freeswitch-sounds-en-us-callie-8000.install

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/freeswitch-sounds-music-8000.install

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/freeswitch-sounds-ru-ru-elena-16000.install

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/freeswitch-sounds-ru-ru-elena-32000.install

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/freeswitch-sounds-ru-ru-elena-48000.install

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/freeswitch-sounds-ru-ru-elena-8000.install

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/freeswitch.conffiles (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/freeswitch.conffiles	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/freeswitch.conffiles	2010-02-12 00:54:22 UTC (rev 16614)
@@ -69,7 +69,6 @@
 /opt/freeswitch/conf/autoload_configs/event_socket.conf.xml
 /opt/freeswitch/conf/autoload_configs/modules.conf.xml
 /opt/freeswitch/conf/autoload_configs/dingaling.conf.xml
-/opt/freeswitch/conf/autoload_configs/iax.conf.xml
 /opt/freeswitch/conf/autoload_configs/post_load_modules.conf.xml
 /opt/freeswitch/conf/autoload_configs/pocketsphinx.conf.xml
 /opt/freeswitch/conf/autoload_configs/xml_cdr.conf.xml

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/freeswitch.install (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/freeswitch.install	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/freeswitch.install	2010-02-12 00:54:22 UTC (rev 16614)
@@ -41,10 +41,12 @@
 opt/freeswitch/mod/mod_speex.so*
 opt/freeswitch/mod/mod_dialplan*.so*
 opt/freeswitch/mod/mod_dingaling.so*
-opt/freeswitch/mod/mod_iax.so*
 opt/freeswitch/mod/mod_portaudio.so*
 opt/freeswitch/mod/mod_sofia.so*
 opt/freeswitch/mod/mod_openzap.so
+opt/freeswitch/mod/mod_directory.so*
+opt/freeswitch/mod/mod_valet_parking.so*
+opt/freeswitch/mod/mod_cluechoo.so*
 opt/freeswitch/mod/ozmod_analog_em.so*
 opt/freeswitch/mod/ozmod_analog.so*
 opt/freeswitch/mod/ozmod_isdn.so*
@@ -138,7 +140,6 @@
 opt/freeswitch/conf/autoload_configs/event_socket.conf.xml
 opt/freeswitch/conf/autoload_configs/modules.conf.xml
 opt/freeswitch/conf/autoload_configs/dingaling.conf.xml
-opt/freeswitch/conf/autoload_configs/iax.conf.xml
 opt/freeswitch/conf/autoload_configs/post_load_modules.conf.xml
 opt/freeswitch/conf/autoload_configs/pocketsphinx.conf.xml
 opt/freeswitch/conf/autoload_configs/xml_cdr.conf.xml

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/monit/freeswitch.monitrc (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/monit/freeswitch.monitrc	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/monit/freeswitch.monitrc	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,4 +1,4 @@
- check process freeswitch with pidfile /opt/freeswitch/log/freeswitch.pid
+ check process freeswitch with pidfile /opt/freeswitch/run/freeswitch.pid
    group voice
    start program = "/etc/init.d/freeswitch start"
    stop  program = "/etc/init.d/freeswitch stop"

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/rules (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/rules	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/rules	2010-02-12 00:54:22 UTC (rev 16614)
@@ -3,37 +3,36 @@
 # This file is public domain software, originally written by Joey Hess. 
 
 # Uncomment this to turn on verbose mode.
-# export DH_VERBOSE=1
+export DH_VERBOSE=1
 export DH_OPTIONS
 export DH_COMPAT=4
 export DEB_DH_INSTALL_SOURCEDIR=debian/tmp
 export PASSTHRU_CODEC_MODULES=codecs/mod_g729 codecs/mod_g723_1 codecs/mod_amr
-export SPIDERMONKEY_MODULES=languages/mod_spidermonkey languages/mod_spidermonkey_core_db languages/mod_spidermonkey_odbc \
-			    languages/mod_spidermonkey_socket languages/mod_spidermonkey_teletone
-export 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_fsv \
-			    applications/mod_fax applications/mod_cidlookup applications/mod_curl applications/mod_easyroute \
+# Modules listed by those built by default, then those that are added in this package
+export APPLICATIONS_MODULES=applications/mod_cluechoo applications/mod_commands applications/mod_conference applications/mod_dptools \
+                            applications/mod_enum applications/mod_esf applications/mod_expr applications/mod_fifo applications/mod_fsv \
+                            applications/mod_limit applications/mod_valet_parking applications/mod_voicemail applications/mod_rss \
+                            applications/mod_fax applications/mod_cidlookup applications/mod_curl applications/mod_easyroute \
 			    applications/mod_lcr applications/mod_memcache applications/mod_nibblebill applications/mod_snom \
-			    applications/mod_spy applications/mod_vmd 
+			    applications/mod_spy applications/mod_vmd applications/mod_directory
 export ASR_TTS_MODULES=asr_tts/mod_tts_commandline
 export CODECS_MODULES=codecs/mod_ilbc codecs/mod_h26x codecs/mod_speex codecs/mod_voipcodecs codecs/mod_siren codecs/mod_celt
 export DIALPLANS_MODULES=dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml
 export DIRECTORIES_MODULES=
 export DOTNET_MODULES=
-export ENDPOINTS_MODULES=endpoints/mod_dingaling endpoints/mod_iax endpoints/mod_portaudio endpoints/mod_sofia \
+export ENDPOINTS_MODULES=endpoints/mod_dingaling endpoints/mod_portaudio endpoints/mod_sofia \
 			 endpoints/mod_loopback ../../libs/openzap/mod_openzap endpoints/mod_skypiax
 export EVENT_HANDLERS_MODULES=event_handlers/mod_event_multicast event_handlers/mod_event_socket event_handlers/mod_cdr_csv
 export FORMATS_MODULES=formats/mod_local_stream formats/mod_native_file formats/mod_sndfile formats/mod_tone_stream formats/mod_shout
-export LANGUAGES_MODULES=languages/mod_perl languages/mod_lua
+export LANGUAGES_MODULES=languages/mod_spidermonkey languages/mod_perl languages/mod_lua
 export LOGGERS_MODULES=loggers/mod_console loggers/mod_logfile loggers/mod_syslog
 export SAY_MODULES=say/mod_say_en say/mod_say_it say/mod_say_de say/mod_say_fr say/mod_say_es say/mod_say_nl say/mod_say_ru
 export TIMERS_MODULES=
 export DISABLED_MODULES=applications/mod_soundtouch directories/mod_ldap languages/mod_java languages/mod_python \
-			languages/mod_spidermonkey_skel ast_tts/mod_cepstral asr_tts/mod_lumenvox endpoints/mod_wanpipe \
+			asr_tts/mod_cepstral asr_tts/mod_lumenvox endpoints/mod_wanpipe \
 			event_handlers/mod_event_test event_handlers/mod_radius_cdr event_handlers/mod_zeroconf
 export XML_INT_MODULES=xml_int/mod_xml_rpc  xml_int/mod_xml_curl xml_int/mod_xml_cdr
-export MYMODULES=$(PASSTHRU_CODEC_MODULES) $(SPIDERMONKEY_MODULES) $(APPLICATIONS_MODULES) $(ASR_TTS_MODULES) $(CODECS_MODULES) $(DIALPLANS_MODULES) $(DIRECTORIES_MODULES) $(DOTNET_MODULES) $(ENDPOINTS_MODULES) $(EVENT_HANDLERS_MODULES) $(FORMATS_MODULES) $(LANGUAGES_MODULES) $(LOGGERS_MODULES) $(SAY_MODULES) $(TIMERS_MODULES) $(XML_INT_MODULES)
+export MYMODULES=$(PASSTHRU_CODEC_MODULES) $(APPLICATIONS_MODULES) $(ASR_TTS_MODULES) $(CODECS_MODULES) $(DIALPLANS_MODULES) $(DIRECTORIES_MODULES) $(DOTNET_MODULES) $(ENDPOINTS_MODULES) $(EVENT_HANDLERS_MODULES) $(FORMATS_MODULES) $(LANGUAGES_MODULES) $(LOGGERS_MODULES) $(SAY_MODULES) $(TIMERS_MODULES) $(XML_INT_MODULES)
 export MODULES=$(MYMODULES)
 
 ifndef AUTOCONF
@@ -106,7 +105,7 @@
 	dh_clean -k 
 	dh_installdirs -A --sourcedir=debian/tmp
 
-	$(MAKE) DESTDIR=$(CURDIR)/debian/tmp install cd-sounds-install cd-sounds-ru-install moh-install
+	VERBOSE=1 $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
 
 
 # Build architecture-independent files here.

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds (from rev 16612, freeswitch/trunk/debian/sounds)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-en-us-callie)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-en-us-callie/debian)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/buildsounds.sh

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/buildsounds.sh (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-en-us-callie/debian/buildsounds.sh) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/buildsounds.sh	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/buildsounds.sh	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+sounds_location=$1
+for rate in 32000 16000 8000
+do 
+    for i in ascii base256 conference currency digits ivr misc phonetic-ascii time voicemail zrtp
+    do
+	mkdir -p $sounds_location/$i/$rate
+	for f in `find $sounds_location/$i/48000 -name \*.wav`
+	do
+	    echo "generating" $sounds_location/$i/$rate/`basename $f`
+	    sox $f -r $rate $sounds_location/$i/$rate/`basename $f`
+	done
+    done
+done

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/changelog

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/changelog (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-en-us-callie/debian/changelog) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/changelog	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/changelog	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,5 @@
+freeswitch-sounds-en-us-callie (1.0.12-0ubuntu1) jaunty; urgency=low
+
+  * Initial: This is the initial working build of the en-us-callie sounds
+
+ -- William King <quentusrex@gmail.com>  Sun, 20 Sep 2009 06:56:46 -0700

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/control

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/control (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-en-us-callie/debian/control) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/control	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/control	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,61 @@
+Source: freeswitch-sounds-en-us-callie
+Maintainer: Freeswitch Debian Team <debian@freeswitch.org>
+Section: net
+Priority: extra
+Build-Depends: debhelper (>= 5), fakeroot, sox
+Standards-Version: 3.7.3
+
+Package: freeswitch-sounds-en-us-callie-8000
+Architecture: all
+Conflicts: freeswitch-sounds-en-us-callie
+Description: English language sounds for the FreeSWITCH(TM) (8000)
+ FreeSWITCH is an open source telephony platform designed to facilitate the
+ creation of voice and chat driven products scaling from a soft-phone up to
+ a soft-switch.  It can be used as a simple switching engine, a media gateway
+ or a media server to host IVR applications using simple scripts or XML to
+ control the callflow.
+
+Package: freeswitch-sounds-en-us-callie-16000
+Architecture: all
+Conflicts: freeswitch-sounds-en-us-callie
+Description: English language sounds for the FreeSWITCH(TM) (16000)
+ FreeSWITCH is an open source telephony platform designed to facilitate the
+ creation of voice and chat driven products scaling from a soft-phone up to
+ a soft-switch.  It can be used as a simple switching engine, a media gateway
+ or a media server to host IVR applications using simple scripts or XML to
+ control the callflow.
+
+Package: freeswitch-sounds-en-us-callie-32000
+Architecture: all
+Conflicts: freeswitch-sounds-en-us-callie
+Description: English language sounds for FreeSWITCH(TM) (32000)
+ FreeSWITCH is an open source telephony platform designed to facilitate the
+ creation of voice and chat driven products scaling from a soft-phone up to
+ a soft-switch.  It can be used as a simple switching engine, a media gateway
+ or a media server to host IVR applications using simple scripts or XML to
+ control the callflow.
+
+Package: freeswitch-sounds-en-us-callie-48000
+Architecture: all
+Description: English language sounds for the FreeSWITCH(TM) (48000)
+ FreeSWITCH is an open source telephony platform designed to facilitate the
+ creation of voice and chat driven products scaling from a soft-phone up to
+ a soft-switch.  It can be used as a simple switching engine, a media gateway
+ or a media server to host IVR applications using simple scripts or XML to
+ control the callflow.
+
+Package: freeswitch-sounds-en-us-callie
+Architecture: all
+Depends: sox, freeswitch-sounds-en-us-callie-48000
+Conflicts: freeswitch-sounds-en-us-callie-omega, freeswitch-sounds-en-us-callie-8000, freeswitch-sounds-en-us-callie-16000, freeswitch-sounds-en-us-callie-32000
+Description: English language files for FreeSWITCH(TM)
+ This package generates the 8k, 16k, and 32k from the installed 48k
+ sounds. You can select which ones you want.
+
+Package: freeswitch-sounds-en-us-callie-omega
+Architecture: all
+Depends: freeswitch-sounds-en-us-callie-48000, freeswitch-sounds-en-us-callie-32000, freeswitch-sounds-en-us-callie-16000, freeswitch-sounds-en-us-callie-8000
+Conflicts: freeswitch-sounds-en-us-callie
+Description: English language files for FreeSWITCH(TM)
+ This package depends on the pregenerated 8khz, 16khz, 32khz, and 48khz sounds
+ which are downloaded from binary data files.

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/copyright

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/copyright (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-en-us-callie/debian/copyright) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/copyright	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/copyright	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1 @@
+These files are licensed under the terms of the creative commons Attribution 3.0 license: http://creativecommons.org/licenses/by-sa/3.0/

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/files

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/files (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-en-us-callie/debian/files) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/files	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/files	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,6 @@
+freeswitch-sounds-en-us-callie-8000_1.0.12-0ubuntu1_all.deb net extra
+freeswitch-sounds-en-us-callie-16000_1.0.12-0ubuntu1_all.deb net extra
+freeswitch-sounds-en-us-callie-32000_1.0.12-0ubuntu1_all.deb net extra
+freeswitch-sounds-en-us-callie-48000_1.0.12-0ubuntu1_all.deb net extra
+freeswitch-sounds-en-us-callie_1.0.12-0ubuntu1_all.deb net extra
+freeswitch-sounds-en-us-callie-omega_1.0.12-0ubuntu1_all.deb net extra

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-16000.install

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-16000.install (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-16000.install) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-16000.install	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-16000.install	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,2 @@
+opt/freeswitch/sounds/en/us/callie/*/16000/*
+

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-32000.install

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-32000.install (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-32000.install) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-32000.install	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-32000.install	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,2 @@
+opt/freeswitch/sounds/en/us/callie/*/32000/*
+

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-48000.install

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-48000.install (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-48000.install) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-48000.install	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-48000.install	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,2 @@
+opt/freeswitch/sounds/en/us/callie/*/48000/*
+

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-8000.install

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-8000.install (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-8000.install) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-8000.install	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/freeswitch-sounds-en-us-callie-8000.install	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,2 @@
+opt/freeswitch/sounds/en/us/callie/*/8000/*
+

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/rules

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/rules (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-en-us-callie/debian/rules) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/rules	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-en-us-callie/debian/rules	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,39 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# This file is public domain software, originally written by Joey Hess. 
+
+# Uncomment this to turn on verbose mode.
+ export DH_VERBOSE=1
+export DH_OPTIONS
+export DH_COMPAT=4
+export DEB_DH_INSTALL_SOURCEDIR=debian/tmp
+
+
+build:
+	dh_testdir
+	mkdir -p debian/tmp/opt/freeswitch/sounds
+	cp -a en debian/tmp/opt/freeswitch/sounds/
+	./debian/buildsounds.sh debian/tmp/opt/freeswitch/sounds/en/us/callie
+clean:
+	dh_testdir
+	dh_testroot
+	dh_clean -k 
+	rm -f build-stamp 
+	rm -Rf debian/tmp
+
+install:
+	dh_testdir
+	dh_testroot
+	dh_installdirs -A --sourcedir=debian/tmp
+	dh_install --sourcedir=debian/tmp
+
+# Build architecture-independent files here.
+binary-indep: build install
+	dh_compress
+	dh_installdeb
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep
+.PHONY: build clean binary-indep binary install 

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-music)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-music/debian)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/buildsounds.sh

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/buildsounds.sh (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-music/debian/buildsounds.sh) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/buildsounds.sh	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/buildsounds.sh	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+sounds_location=$1
+for rate in 32000 16000 8000
+do 
+    mkdir -p $sounds_location/$rate
+    for f in `find $sounds_location/48000 -name \*.wav`
+    do
+	echo "generating" $sounds_location/$rate/`basename $f`
+	sox $f -r $rate $sounds_location/$rate/`basename $f`
+    done
+done

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/changelog

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/changelog (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-music/debian/changelog) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/changelog	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/changelog	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,11 @@
+freeswitch-sounds-music (1.0.8-0ubuntu3) jaunty; urgency=low
+
+  * Fixed: empty binary files for some packages
+
+ -- William King <quentusrex@gmail.com>  Thu, 24 Sep 2009 15:54:17 -0700
+
+freeswitch-sounds-music (1.0.8-0ubuntu2) jaunty; urgency=low
+
+  * Initial: This is the initial working build of the music on hold
+
+ -- William King <quentusrex@gmail.com>  Sun, 20 Sep 2009 08:28:48 -0700

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/control

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/control (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-music/debian/control) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/control	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/control	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,61 @@
+Source: freeswitch-sounds-music
+Maintainer: Freeswitch Debian Team <debian@freeswitch.org>
+Section: net
+Priority: extra
+Build-Depends: debhelper (>= 5), fakeroot, sox
+Standards-Version: 3.7.3
+
+Package: freeswitch-sounds-music-8000
+Architecture: all
+Conflicts: freeswitch-sounds-music
+Description: music for FreeSWITCH(TM) (8000)
+ FreeSWITCH is an open source telephony platform designed to facilitate the
+ creation of voice and chat driven products scaling from a soft-phone up to
+ a soft-switch.  It can be used as a simple switching engine, a media gateway
+ or a media server to host IVR applications using simple scripts or XML to
+ control the callflow.
+
+Package: freeswitch-sounds-music-16000
+Architecture: all
+Conflicts: freeswitch-sounds-music
+Description: music for FreeSWITCH(TM) (16000)
+ FreeSWITCH is an open source telephony platform designed to facilitate the
+ creation of voice and chat driven products scaling from a soft-phone up to
+ a soft-switch.  It can be used as a simple switching engine, a media gateway
+ or a media server to host IVR applications using simple scripts or XML to
+ control the callflow.
+
+Package: freeswitch-sounds-music-32000
+Architecture: all
+Conflicts: freeswitch-sounds-music
+Description: music for FreeSWITCH(TM) (32000)
+ FreeSWITCH is an open source telephony platform designed to facilitate the
+ creation of voice and chat driven products scaling from a soft-phone up to
+ a soft-switch.  It can be used as a simple switching engine, a media gateway
+ or a media server to host IVR applications using simple scripts or XML to
+ control the callflow.
+
+Package: freeswitch-sounds-music-48000
+Architecture: all
+Description: music for FreeSWITCH(TM) (48000)
+ FreeSWITCH is an open source telephony platform designed to facilitate the
+ creation of voice and chat driven products scaling from a soft-phone up to
+ a soft-switch.  It can be used as a simple switching engine, a media gateway
+ or a media server to host IVR applications using simple scripts or XML to
+ control the callflow.
+
+Package: freeswitch-sounds-music
+Architecture: all
+Depends: sox, freeswitch-sounds-music-48000
+Conflicts: freeswitch-sounds-music-omega, freeswitch-sounds-music-8000, freeswitch-sounds-music-16000, freeswitch-sounds-music-32000
+Description: Music for FreeSWITCH(TM)
+ This package generates the 8k, 16k, and 32k from the installed 48k
+ sounds. You can select which ones you want.
+
+Package: freeswitch-sounds-music-omega
+Architecture: all
+Depends: freeswitch-sounds-music-48000, freeswitch-sounds-music-32000, freeswitch-sounds-music-16000, freeswitch-sounds-music-8000
+Conflicts: freeswitch-sounds-music
+Description: Music for FreeSWITCH(TM)
+ This package depends on the pregenerated 8khz, 16khz, 32khz, and 48khz sounds
+ which are downloaded from binary data files.

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/copyright

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/copyright (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-music/debian/copyright) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/copyright	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/copyright	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,13 @@
+MUSOPEN
+
+Musopen is an online music library of copyright free music (public domain music). 
+We want to give the world access to music, without the legal hassles so common today.
+There is a great deal of music that has expired copyrights, but almost no recordings
+of this music is in the public domain. We aim to record or obtain recordings that
+have no copyrights so that our visitors may listen, re-use, or in any way enjoy music.
+
+Put simply, our mission is to set music free.
+
+Musopen is a U.S. registered 501(c)(3) tax-deductible nonprofit charity.
+
+http://www.musopen.com

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/files

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/files (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-music/debian/files) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/files	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/files	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,6 @@
+freeswitch-sounds-music-8000_1.0.8-0ubuntu3_all.deb net extra
+freeswitch-sounds-music-16000_1.0.8-0ubuntu3_all.deb net extra
+freeswitch-sounds-music-32000_1.0.8-0ubuntu3_all.deb net extra
+freeswitch-sounds-music-48000_1.0.8-0ubuntu3_all.deb net extra
+freeswitch-sounds-music_1.0.8-0ubuntu3_all.deb net extra
+freeswitch-sounds-music-omega_1.0.8-0ubuntu3_all.deb net extra

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-16000.install

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-16000.install (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-16000.install) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-16000.install	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-16000.install	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,2 @@
+opt/freeswitch/sounds/music/16000/*
+

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-32000.install

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-32000.install (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-32000.install) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-32000.install	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-32000.install	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,2 @@
+opt/freeswitch/sounds/music/32000/*
+

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-48000.install

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-48000.install (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-48000.install) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-48000.install	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-48000.install	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,2 @@
+opt/freeswitch/sounds/music/48000/*
+

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-8000.install

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-8000.install (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-8000.install) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-8000.install	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/freeswitch-sounds-music-8000.install	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,2 @@
+opt/freeswitch/sounds/music/8000/*
+

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/rules

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/rules (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-music/debian/rules) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/rules	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-music/debian/rules	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,39 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# This file is public domain software, originally written by Joey Hess. 
+
+# Uncomment this to turn on verbose mode.
+ export DH_VERBOSE=1
+export DH_OPTIONS
+export DH_COMPAT=4
+export DEB_DH_INSTALL_SOURCEDIR=debian/tmp
+
+
+build:
+	dh_testdir
+	mkdir -p debian/tmp/opt/freeswitch/sounds
+	cp -a music debian/tmp/opt/freeswitch/sounds/
+	./debian/buildsounds.sh debian/tmp/opt/freeswitch/sounds/music	
+clean:
+	dh_testdir
+	dh_testroot
+	dh_clean -k 
+	rm -f build-stamp 
+	rm -Rf debian/tmp
+
+install:
+	dh_testdir
+	dh_testroot
+	dh_installdirs -A --sourcedir=debian/tmp
+	dh_install --sourcedir=debian/tmp
+
+# Build architecture-independent files here.
+binary-indep: build install
+	dh_compress
+	dh_installdeb
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep
+.PHONY: build clean binary-indep binary install 

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-ru-RU-elena)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-ru-RU-elena/debian)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/buildsounds.sh

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/buildsounds.sh (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/buildsounds.sh) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/buildsounds.sh	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/buildsounds.sh	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+sounds_location=$1
+for rate in 32000 16000 8000
+do 
+    for i in ascii base256 conference currency digits ivr misc phonetic-ascii time voicemail zrtp
+    do
+	mkdir -p $sounds_location/$i/$rate
+	for f in `find $sounds_location/$i/48000 -name \*.wav`
+	do
+	    echo "generating" $sounds_location/$i/$rate/`basename $f`
+	    sox $f -r $rate $sounds_location/$i/$rate/`basename $f`
+	done
+    done
+done

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/changelog

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/changelog (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/changelog) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/changelog	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/changelog	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,20 @@
+freeswitch-sounds-ru-ru-elena (1.0.12-0ubuntu3) jaunty; urgency=low
+
+  * Fixed: Empty binary package bug caused by the second ru folder being
+	capitalized. The sounds are in ru/RU/elena/*
+
+ -- William King <quentusrex@gmail.com>  Sun, 20 Sep 2009 08:21:58 -0700
+
+freeswitch-sounds-ru-ru-elena (1.0.12-0ubuntu2) jaunty; urgency=low
+
+  * Fixed: Fixed a copy/paste bug in the rules file which was trying to 
+	copy the en directory when it should have been copying the ru
+	directory.
+
+ -- William King <quentusrex@gmail.com>  Sun, 20 Sep 2009 07:59:20 -0700
+
+freeswitch-sounds-ru-ru-elena (1.0.12-0ubuntu1) jaunty; urgency=low
+
+  * Initial: This is the initial working build of the ru-ru-elena sounds
+
+ -- William King <quentusrex@gmail.com>  Sun, 20 Sep 2009 06:56:46 -0700

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/control

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/control (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/control) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/control	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/control	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,61 @@
+Source: freeswitch-sounds-ru-ru-elena
+Maintainer: Freeswitch Debian Team <debian@freeswitch.org>
+Section: net
+Priority: extra
+Build-Depends: debhelper (>= 5), fakeroot, sox
+Standards-Version: 3.7.3
+
+Package: freeswitch-sounds-ru-ru-elena-8000
+Architecture: all
+Conflicts: freeswitch-sounds-ru-ru-elena
+Description: English language sounds for the FreeSWITCH(TM) (8000)
+ FreeSWITCH is an open source telephony platform designed to facilitate the
+ creation of voice and chat driven products scaling from a soft-phone up to
+ a soft-switch.  It can be used as a simple switching engine, a media gateway
+ or a media server to host IVR applications using simple scripts or XML to
+ control the callflow.
+
+Package: freeswitch-sounds-ru-ru-elena-16000
+Architecture: all
+Conflicts: freeswitch-sounds-ru-ru-elena
+Description: English language sounds for the FreeSWITCH(TM) (16000)
+ FreeSWITCH is an open source telephony platform designed to facilitate the
+ creation of voice and chat driven products scaling from a soft-phone up to
+ a soft-switch.  It can be used as a simple switching engine, a media gateway
+ or a media server to host IVR applications using simple scripts or XML to
+ control the callflow.
+
+Package: freeswitch-sounds-ru-ru-elena-32000
+Architecture: all
+Conflicts: freeswitch-sounds-ru-ru-elena
+Description: English language sounds for FreeSWITCH(TM) (32000)
+ FreeSWITCH is an open source telephony platform designed to facilitate the
+ creation of voice and chat driven products scaling from a soft-phone up to
+ a soft-switch.  It can be used as a simple switching engine, a media gateway
+ or a media server to host IVR applications using simple scripts or XML to
+ control the callflow.
+
+Package: freeswitch-sounds-ru-ru-elena-48000
+Architecture: all
+Description: English language sounds for the FreeSWITCH(TM) (48000)
+ FreeSWITCH is an open source telephony platform designed to facilitate the
+ creation of voice and chat driven products scaling from a soft-phone up to
+ a soft-switch.  It can be used as a simple switching engine, a media gateway
+ or a media server to host IVR applications using simple scripts or XML to
+ control the callflow.
+
+Package: freeswitch-sounds-ru-ru-elena
+Architecture: all
+Depends: sox, freeswitch-sounds-ru-ru-elena-48000
+Conflicts: freeswitch-sounds-ru-ru-elena-omega, freeswitch-sounds-ru-ru-elena-8000, freeswitch-sounds-ru-ru-elena-16000, freeswitch-sounds-ru-ru-elena-32000
+Description: English language files for FreeSWITCH(TM)
+ This package generates the 8k, 16k, and 32k from the installed 48k
+ sounds. You can select which ones you want.
+
+Package: freeswitch-sounds-ru-ru-elena-omega
+Architecture: all
+Depends: freeswitch-sounds-ru-ru-elena-48000, freeswitch-sounds-ru-ru-elena-32000, freeswitch-sounds-ru-ru-elena-16000, freeswitch-sounds-ru-ru-elena-8000
+Conflicts: freeswitch-sounds-ru-ru-elena
+Description: English language files for FreeSWITCH(TM)
+ This package depends on the pregenerated 8khz, 16khz, 32khz, and 48khz sounds
+ which are downloaded from binary data files.

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/copyright

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/copyright (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/copyright) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/copyright	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/copyright	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1 @@
+These files are licensed under the terms of the creative commons Attribution 3.0 license: http://creativecommons.org/licenses/by-sa/3.0/

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/files

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/files (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/files) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/files	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/files	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,6 @@
+freeswitch-sounds-ru-ru-elena-8000_1.0.12-0ubuntu3_all.deb net extra
+freeswitch-sounds-ru-ru-elena-16000_1.0.12-0ubuntu3_all.deb net extra
+freeswitch-sounds-ru-ru-elena-32000_1.0.12-0ubuntu3_all.deb net extra
+freeswitch-sounds-ru-ru-elena-48000_1.0.12-0ubuntu3_all.deb net extra
+freeswitch-sounds-ru-ru-elena_1.0.12-0ubuntu3_all.deb net extra
+freeswitch-sounds-ru-ru-elena-omega_1.0.12-0ubuntu3_all.deb net extra

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-16000.install

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-16000.install (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-16000.install) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-16000.install	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-16000.install	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,2 @@
+opt/freeswitch/sounds/ru/RU/elena/*/16000/*
+

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-32000.install

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-32000.install (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-32000.install) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-32000.install	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-32000.install	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,2 @@
+opt/freeswitch/sounds/ru/RU/elena/*/32000/*
+

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-48000.install

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-48000.install (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-48000.install) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-48000.install	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-48000.install	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,2 @@
+opt/freeswitch/sounds/ru/RU/elena/*/48000/*
+

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-8000.install

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-8000.install (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-8000.install) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-8000.install	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/freeswitch-sounds-ru-ru-elena-8000.install	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,2 @@
+opt/freeswitch/sounds/ru/RU/elena/*/8000/*
+

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/rules

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/rules (from rev 16612, freeswitch/trunk/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/rules) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/rules	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/freeswitch-sounds-ru-RU-elena/debian/rules	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,39 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# This file is public domain software, originally written by Joey Hess. 
+
+# Uncomment this to turn on verbose mode.
+ export DH_VERBOSE=1
+export DH_OPTIONS
+export DH_COMPAT=4
+export DEB_DH_INSTALL_SOURCEDIR=debian/tmp
+
+
+build:
+	dh_testdir
+	mkdir -p debian/tmp/opt/freeswitch/sounds
+	cp -a ru debian/tmp/opt/freeswitch/sounds/
+	./debian/buildsounds.sh debian/tmp/opt/freeswitch/sounds/ru/RU/elena	
+clean:
+	dh_testdir
+	dh_testroot
+	dh_clean -k 
+	rm -f build-stamp 
+	rm -Rf debian/tmp
+
+install:
+	dh_testdir
+	dh_testroot
+	dh_installdirs -A --sourcedir=debian/tmp
+	dh_install --sourcedir=debian/tmp
+
+# Build architecture-independent files here.
+binary-indep: build install
+	dh_compress
+	dh_installdeb
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep
+.PHONY: build clean binary-indep binary install 

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/getsounds.sh

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/getsounds.sh (from rev 16612, freeswitch/trunk/debian/sounds/getsounds.sh) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/getsounds.sh	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/debian/sounds/getsounds.sh	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,30 @@
+#!/bin/bash
+sounds_en_us_callie="freeswitch-sounds-en-us-callie-48000-1.0.12.tar.gz"
+sounds_music="freeswitch-sounds-music-48000-1.0.8.tar.gz"
+sounds_ru_RU_elena="freeswitch-sounds-ru-RU-elena-48000-1.0.12.tar.gz"
+
+cd freeswitch-sounds-music
+if [ ! -f $sounds_music ]
+    then
+    wget http://files.freeswitch.org/$sounds_music
+fi
+tar zxvf $sounds_music
+cd ..
+
+
+cd freeswitch-sounds-en-us-callie
+if [ ! -f $sounds_en_us_callie ]
+    then
+    wget http://files.freeswitch.org/$sounds_en_us_callie
+fi
+tar zxvf $sounds_en_us_callie
+cd ..
+
+
+cd freeswitch-sounds-ru-RU-elena
+if [ ! -f $sounds_ru_RU_elena ]
+    then
+    wget http://files.freeswitch.org/$sounds_ru_RU_elena
+fi
+tar zxvf $sounds_ru_RU_elena
+cd ..
\ No newline at end of file

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/docs/ChangeLog (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/docs/ChangeLog	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/docs/ChangeLog	2010-02-12 00:54:22 UTC (rev 16614)
@@ -19,19 +19,56 @@
 	build: Update Debian build init script (FSBUILD-204/r:15417)
 	build: Fix Debian script broken in r15417 (FSSCRIPS-21/r:15443)
 	build: Add windows projects for Broadvoice only 2008 (r:15470)
+	build: debian: remove incorrect option (FSBUILD-208/r:15496)
+	build: fix automated libsrtp build (r:15523)
+	build: fix --srcdir for modules.conf (r:15526)
+	build: fix --srcdir for sounds_version.txt and swigall
+	build: fix uclibc cross compile issues (stolen from http://astlinux.svn.sourceforge.net/viewvc/astlinux/trunk/package/freeswitch/freeswitch-sqlite-make.patch?revision=2455) (r:15531)
+	build: add new broadvoice to windows solution and cleanup template (r:15562)
+	build: Add initial build support to windows (MODUNIMRCP-6/r:15610)
+	build: srcdir fixes for modmake.rules (FSBUILD-211/r:15644)
+	build: srcdir fixes for Makefile.am (FSBUILD-211/r:15645)
+	build: srcdir fixes for configure.in (FSBUILD-211/r:15646)
+	build: fix srcdir for libs/apr/configure.gnu (FSBUILD-211/r:15648)
+	build: fix calling of sub configure.gnu files during --srcdir build (FSBUILD-211/r:15661)
+	build: fix --srcdir make error (FSBUILD-211/r:15673)
+	build: Initial check in for Windows Inno Setup script (r:15681)
+	build: add --disbale-cpp configure argument to disable the c++ build for the core (r:15717)
+	build: pass configure args/vars to sub-configure commands run from module makefiles (r:15718)
+	build: try to not insert -std=c99 into cflags passed to libs that are not ansi compliant (r:15739)
+	build: add -Wdeclaration-after-statement for supported compilers (r:15762)
+	build: add changes for sounds download to allow independent version specific selection (r:15777)
+	build: move sounds out to their own packages as they do not change revisions with freeswitch (r:15809)
+	build: fix setting of BASE passed to module makefiles when doing --srcdir builds (FSBUILD-211/r:15814)
+	build: Numerous --srcdir fixes (FSBUILD-211/r:15849)
+	build: compile by default on osx 10.6 and add --enable-64 support (with previous patch) for osx 10.6 (r:15862)
+	build: add --enable-64 support for os x 10.4 and 10.5 (r:15874)
+	build: add missing modules to modules.conf (FSBUILD-214/r:15879)
+	build: fix mod_managed build on gcc 4.4 (r:15897)
+	build: Disable rpath checking in freeswitch.spec (FSBUILD-217/r:16037)
+	build: Remove libuuid from tree (r:16072)
+	build: Avoid building static version of modules (e.g. mod_enum.a) by adding the "-shared" libtool option. (r:16225)
 	config: improvements to French language handling (MODASRTTS-20/r:14911)
 	config: Add valet_parking to default config (r:15124)
 	config: Add valet macros (r:15156)
 	config: Fix dialplan 6000 - call park retrieval example (r:15292)
 	config: clarify the info as the word IP in the option isn't clearly saying you can put an IP in the options value (r:15302)
 	config: Convert lang/fr/vm/sounds.xml to utf8 and minor changes (MODASRTTS-22/r:15319)
+	config: Fix default group calling so that the order is followed (FSCONFIG-12/r:15492)
+	config: add commented uuid param to mod_logfile's default config (r:15537)
+	config: add descriptions for broadvoice codecs (FSCORE-497/r:15626)
+	config: Add core-db-dsn (commented) to switch.conf.xml (r:15756)
+	config: Block intercepts after call has been answered (FSCONFIG-16/r:15828)
+	config: Move erlang module's default config file to be with all the others (r:15881)
+	config: Add confirm-key & -macro, tts-engine & -voice, confirm-attempts attributes, extra comments to ivr.conf.xml (r:15929)
+	config: Allow specifying auth-scheme in config (r:16350/MDXMLINT-56)
 	core: Add per-call logging (r:14509)
 	core: Fix IVR menu timeout when caller presses no digits (DP-4/r:14548)
-	core: refactor node allocation and make a copy of userdata in case the session gets killed before the logger module gets the node (r:14555)
+	core: re-factor node allocation and make a copy of userdata in case the session gets killed before the logger module gets the node (r:14555)
 	core: don't expose node allocation functions outside of switch_log.c (r:14556)
 	core: Fix leak in xml ivr menus (FSCORE-421/r:14579)
 	core: add record_start and record_stop events (r:14591)
-	core: refactor mod_event_socket so it uses switch_log functions to duplicate and free log nodes while it uses them internally (fix bad ptr for userdata on event socket listeners) (r:14598)
+	core: re-factor mod_event_socket so it uses switch_log functions to duplicate and free log nodes while it uses them internally (fix bad ptr for userdata on event socket listeners) (r:14598)
 	core: add answersec answermsec and answerusec to time how long it took for a call to be answered (r:14620)
 	core: add recursive flags and workaround for nested broadcast in controlled situations (r:14644)
 	core: add origination_cancel_key variable for a dtmf key that can abort an originating call (r:14645)
@@ -50,7 +87,7 @@
 	core: fix Windows mem leak (FSCORE-440/r:14882)
 	core: tolerate offset dtmf payload (zoiper) (r:14883)
 	core: Add the ability to seperate the spool and the storage directories for voicemail (BOUNTY-9/r:14889)
-	core: Add min_dtmf_duration setting to FS core and modified default_dtmf_duration in rfc2833 queing function to not be used as min (FSCORE-442/r:14893)
+	core: Add min_dtmf_duration setting to FS core and modified default_dtmf_duration in rfc2833 queuing function to not be used as min (FSCORE-442/r:14893)
 	core: Remove crash protection (r:14919)
 	core: Move switch_util_quote_shell_arg to core functions (FSCORE-446:/r:14958)
 	core: add preprocess framework for agc ec etc, ALPHA, needs work (r:14960)
@@ -59,7 +96,7 @@
 	core: pita bypass media transfer fiasco fix (r:14983)
 	core: don't enforce existing file check on streams (r:15014)
 	core: re-INVITEs sent only after ~2 seconds (FSCORE-453/r:15021)
-	core: changing default behaviour ignore_early_media=true must be set together with ringback to generate local ringback on early media (r:15025)
+	core: changing default behavior ignore_early_media=true must be set together with ringback to generate local ringback on early media (r:15025)
 	core: improve behavior of leg_delay_start, leg_timeout, leg_progress_timeout (FSCORE-439/r:15027)
 	core: Fix spinning threads that receive 183 on bridge/originate with bypass_media set (FSCORE-452/r:15028)
 	core: Check handling of SIGINT (FSCORE-456/r:15051)
@@ -67,14 +104,14 @@
 	core: Enable auto update displays in more places (r:15110)
 	core: fix file handle mem leak (thanks pressuerman) (r:15114)
 	core: add CALL_UPDATE event (r:15119)
-	core: move accidental new behaviour behind new param originate_continue_on_timeout=true (r:15121)
+	core: move accidental new behavior behind new param originate_continue_on_timeout=true (r:15121)
 	core: fix att xfer to an app (r:15122)
 	core: Fix CODEC event has duplicate codec name and rate in lowercase (MODEVENT-59/r:15123)
 	core: add missing comma that causes buffer overflow in event socket (r:15128)
 	core: expand range of acceptable chars (MODENDP-249/r:15129)
 	core: Add 48k 30ms and 40ms codecs (r:15135)
 	core: Fix playback cannot play stereo .wav files (FSCORE-463/r:15139)
-	core: refactor some of the message parsing code to use fifo to reduce threading contention (r:15142)
+	core: re-factor some of the message parsing code to use fifo to reduce threading contention (r:15142)
 	core: send update after both sides are answered (r:15149)
 	core: fix playback_ms and record_ms to work right and add playback_seconds and record_seconds (r:15155)
 	core: delay update till after media has been confirmed to prevent SOA race in sip (r:15159)
@@ -82,7 +119,7 @@
 	core: add new macro to make sure we don't send bypass command too soon (r:15165)
 	core: Fix shutdown not working on Windows with fs_cli (FSCORE-435/r:15167)
 	core: Fix inbound calls with incompatible codecs can result in heap corruption and crash (FSCORE-467/r:15178)
-	core: prevent unsolicted ring_ready (r:15179)
+	core: prevent unsolicited ring_ready (r:15179)
 	core: make switch_core_sqldb_stop non-blocking (FSCORE-470/r:15183)
 	core: add SWITCH_MESSAGE_INDICATE_UUID_CHANGE to warn a session when the uuid has changed (r:15193)
 	core: Handle bypass_media_after_bridge with loopback (FSCORE-418/r:15195)
@@ -91,11 +128,11 @@
 	core: Fix thread runaway in switch_console_loop for Windows (FSCORE-472/r:15209)
 	core: change switch_strlen_zero to zstr (r:15211)
 	core: add ignore_display_updates variable to block display updates on that leg (r:15218)
-	core: refactor how record_answer_req=true works, add media_bug_answer_req=true variable and backport record_answer_req=true to use it (IRQ-00/r:15235)
+	core: re-factor how record_answer_req=true works, add media_bug_answer_req=true variable and backport record_answer_req=true to use it (IRQ-00/r:15235)
 	core: don't consider cng packets for rtp auto-adjust (r:15240)
 	core: add RECORD_READ_ONLY and RECORD_WRITE_ONLY chan vars to influence session_record (r:15257)
 	core: answer channel on record to ensure media (r:15265)
-	core: refactor ringback so it does not start early_media until it has to (r:15266)
+	core: re-factor ringback so it does not start early_media until it has to (r:15266)
 	core: add record_min_sec chan var (r:15271)
 	core: flush audio on reset of auto-adjust (r:15282)
 	core: filter out unwanted media on rtp (r:15284)
@@ -117,23 +154,106 @@
 	core: add <> var container to enterprise_originate syntax to set variables to pass to every thread (r:15469)
 	core: add cache_db handle api (odbc/sqlite abstraction) (r:15473)
 	core: caller/ee id cleanup (r:15474)
+	core: add support for running core-db over odbc (r:15487)
+	core: Properly count CNG packets (FSCORE-489/r:15493)
+	core: Fix segfault on exit (FSCORE-491/r:15499)
+	core: add append and truncate to audio file API (r:15503)
+	core: re-factor enterprise_originate (r:15565)
+	core: fix thread saftey issue in expiring media bugs (r:15587)
+	core: add debug-level to switch.conf.xml and tweak a few debugs (r:15595)
+	core: re-factor/abstract the core sql stuff more (r:15599)
+	core: don't hangup call on asr errors (FSCORE-493/r:15623)
+	core: fix db connection hijacking issue (r:15624)
+	core: send bridge/unbridge indication during eavesdrop (r:15638)
+	core: record the correct remote_media_ip and remote_media_port even when we autoadjust (FSCORE-500/r:15659)
+	core: improve chunked sql transaction submission (r:15672)
+	core: add switch_caller_extension_add_application_printf() (r:15688)
+	core: Fix switch_poll timeout that causes bad audio in Windows (FSCORE-501/r:15722)
+	core: add switch_core_vsprintf (r:15737)
+	core: allow recursive broadcasting (r:15757)
+	core: Add support for coma-delimited lists in a user's auth-acl param (MODENDP-224/r:15760)
+	core: allow listeners to pre-bind to subclasses before the main subscriber is loaded and fix off by one issue in unbinding event handler functions (r:15790)
+	core: don't mix ptimes in the codec string lists, just discard conflicting ones (r:15797)
+	core: Fix 'uuid_bridge' kills both channels if one of them is executing java app (FSCORE-508/r:15799)
+	core: add io mutex to cache db for optional mutex protection (r:15800)
+	core: add chan name to log lines (r:15835)
+	core: fix caller_profile race in hangup that may cause some missing cdr data in certain cases (r:15839)
+	core: add priority queue for events so important broadcasts like hold music can take precedence over event-lock (r:15865)
+	core: Adding switch_mprintf (broken out from sqlite)
+		Adding new %w to mprintf to auto escape both single quote and backslashes
+		Improve the tab completion a tad and fix some sqlite/odbc compat with new mprintf opts
+		Change the default stream writer to use switch_vmprintf so %q/%w can be used there too (r:15875)
+	core: Fix choppy inband DTMF generation from FS (FSCORE-510/r:15896)
+	core: fix record size causing mysql table create failure (FSCORE-512/r:15938)
+	core: fix x-fer for SIP phones (FSCORE-513/r:15944)
+	core: cleanup tab completion more and introduce new callback based expansion functions to do real time tab completion in some areas (r:15952)
+	core: fix build without SWITCH_HAVE_LIBEDIT on Windows and perhaps others (r:15953)
+	core: switch_ivr_parse_event(): allow execute-app-args to be specified in event body (FSCORE-514/r:15970)
+	core: return true/false from sql tester incase you want to do more stuff when the table had to be created (r:15981)
+	core: add fsctl flush_db_handles to expire any unused db handles (r:15982)
+	core: allow mod_say to use more than nine digits (MODAPP-380/r:15984)
+	core: reset audio level on mute/unmute (r:15991)
+	core: Add tab complete to windows (r:16000)
+	core: Fix playback during a record session causing invalid wav file (FSCORE-517/r:16003)
+	core: don't restart runtime functions when shutting down (r:16008)
+	core: Add tab complete to windows (ESL-24/r:16010)
+	core: switch_play_and_get_digits now returns SWITCH_FALSE if caller doesn't dial anything (DP-10/r:16011)
+	core: adding 12kHz and 24kHz (r:16026)
+	core: Fix  dialplain looping over and over again when group_confirm_file is missing (DP-11/r:16063)
+	core: trade some max call count for more accurate timing in full media situations, hint: use 30ms ptime for drastic reduction in resources (r:16081)
+	core: add core param for controling timer (r:16093)
+	core: Incorrect handling when rtp-timer-name=none causes medialess RTP sessions to never time out (FSRTP-10/r:16100)
+	core: add SOCKET_EVENT event (r:16135)
+	core: count runlevel to prevent dup calls to the core init routines (r:16140)
+	core: fix power of 10 in cps counter (r:16144)
+	core: add ;; delim to console (r:16166)
+	core: fix mitm for audio for passing sas with zrtp (r:16204)
+	core: setting jitter buffer keeps dtmf events from firing (FSCORE-523/r:16207)
+	core: don't segfault when -nonat is used and nat_map reinit is called (r:16253)
+	core: switch to conditional broadcast mode on slow kernels (r:16308)
+	core: add bridge_early_media=true variable to hear early media from first channel with early media as ringback, this is 1 way audio (r:16313)
+	core: fix progress_timeout sets incorrect originate_status (FSCORE-527/r:16314)
+	core: switch_ivr_originate: fix windows compiler warning (r:16320)
+	core: few new command line opts -vm for conditonal timer, -nocal to skip timer calibration and -nort to turn off clock_realtime fam of functions (r:16324)
+	core: fix failed_xml_cdr prefix is not respected (FSCORE-529/r:16401)
+	core: allow alias expansion from fs_cli (r:16416)
+	core: allow double escape in parser for \ (r:16440)
+	core: Add a -version flag to freeswitch binary (FSCORE-534/r:16482)
 	docs: Add large Doxygen update (thanks Muhammed Shahzad) (r:14973)
+	docs: update es phrase file (MODAPP-317/r:15575)
 	embedded_languages: Prevent unloading of embedded languages modules (also fixes MODLANG-121/r:14491)
 	embedded_languages: add session.hangupCause() (r:14912)
 	embedded_languages: add session.getState() (r:14924)
 	embedded_languages: Fix caller_profile old code forcing empty caller ID (FSCORE-450/r:15006)
+	libapr: add new apr functions/macros needed by unimrcp update (r:15542)
+	libbroadvoice: update to http://www.soft-switch.org/downloads/snapshots/voipcodecs/broadvoice-20091122.tar.gz (r:15602)
 	libdingaling: patch libdingaling to use next_tag instead of child (r:14624)
 	libesl: automatically load ESL.so in PHP (r:14707)
 	libesl: fix php swig generation (ESL-20/r:14750)
 	libesl: disable duplicate headers on request param events (r:14909)
 	libesl: c# wrapper for esl lib (r:14955)
 	libesl: add logger.pl a FS debug tool using ESL.pm (r:15377)
+	libesl: Add send_info example  (r:15613)
+	libesl: use event_clone type internally to not confuse people who think they are getting events in response to commands (r:15660)
+	libesl: hook new complete api up to FSAPI and export tab completion down to fs_cli (r:15956)
+	libesl: change execute and executeAsync to return the last event instead of status since it will almost always be 0 (r:15973)
+	libesl: add help banner on connection failure (ESL-25/r:16040)
+	libesl: add support for user level auth to esl and fs_cli (r:16161)
+	libesl: tcl example thanks Mark Mann (r:16307)
+	libiksemel: fix iksemel build against gnutls 2.x (FSBUILD-219/r:16019)
+	libjs: pass ldflags to dso builds for libjs and nspr (r:16549)
 	libportaudio: Dither code in mod_portaudio doesn't properly compile on 64 bit systems (r:15422)
 	libsofiasip: fix sofia build with new openssl (r:15426)
+	libsofiasip: make sofia not auto-respond to SUBSCRIBE refresh requests (r:16273)
 	libspandsp: update to spandsp snapshot 20091005 (r:15084)
 	libspandsp: update to spandsp-20091006 snapshot (r:15093)
+	libspandsp: fix spandsp build on 32 bit 10.6 OS X builds (LBCODEC-4,MODAPP-351/r:15631)
 	libstfu: add resize function (r:14871)
+	libunimrcp: Update to unimrcp 1297, remove API change (r:15615)
+	libunimrcp: unimrcp windows x64 build support and fix release builds (r:15621)
+	libuuid: inital addition of libuuid to tree (r:16021)
 	mod_alsa: update to new module api (r:14833)
+	mod_bv: remove non-working bv codecs pending working lib from steve and mod_bv unified with both codecs in one module. (r:15559)
 	mod_bv16: add support for BroadVoice16 codec (r:15464)
 	mod_bv16: add plc (r:15466)
 	mod_bv16: move bv16 so it doesn't use the same number as another codec in mod_voipcodecs (r:15468)
@@ -141,12 +261,15 @@
 	mod_bv32: add plc (r:15466)
 	mod_cdr_csv: try to rotate on failed write to cdr file (r:14948)
 	mod_celt: bring CELT up to the latest build we need more testers  (r:15278)
-	mod_cid_lookup: Fix segfault on no DSN (MODAPP-346/r:15019)
+	mod_celt: add CELT for Windows (r:16414)
+	mod_cidlookup: Fix segfault on no DSN (MODAPP-346/r:15019)
 	mod_cidlookup: add whitepages.com support (r:15023)
 	mod_cidlookup: add channel var / debug log for cidlookup src (r:15268)
 	mod_cidlookup: fix minor bugs, make whitepages work if regular url not set (oops), channel var set for area,	ignore "UNKNOWN" and "UNAVAILABLE" from API (r:15331)
 	mod_cidlookup: more cleanup, always try to get a location, add verbose option to api call, cache area and src so the cache is full rep of cid data (r:15333)
 	mod_cidlookup: proper fix for working in npanxx only mode (thanks for the heads up bkw) (r:15341)
+	mod_cidlookup: use new cached odbc api (r:15680)
+	mod_cidlookup: add shorter timeout + warn on slow responses (r:15683)
 	mod_commands: add host_lookup api call (r:14667)
 	mod_commands: add uuid_exists api call (r:14668)
 	mod_commands: add non-destructive regex substitution (MODAPP-319/r:14727)
@@ -156,16 +279,40 @@
 	mod_commands: Updating tab completion for show cli command (FSCORE-468/r:15180) 
 	mod_commands: add api hostname (r:15225)
 	mod_commands: add uuid_debug_audio <uuid> <read|write|both> <on|off> (r:15274)
+	mod_commands: add more autocomplete items (FSCORE-468/r:15506)
+	mod_commands: Fix group_call returns nothing if one endpoint on the group is not registered (MODAPP-368/r:15530)
+	mod_commands: fix parsing in time_test to prevent a few edge cases (r:15549)
+	mod_commands: add db_cache API - shows db cache status (FSCORE-503/r:15697)
+	mod_commands: add escape API to escape a string (r:15764)
+	mod_commands: add uuid_recv_dtmf (r:15840)
+	mod_commands: change name of 'key' field due to reserved name in sql (r:15842)
+	mod_commands: add console_complete_xml api (r:15967)
+	mod_commands: fix db_cache's auto-complete (r:15969)
+	mod_commands: add uuid_audio cli cmd (r:15989)
+	mod_commands: check for zstr(cmd) in escape_function (r:16029)
+	mod_commands: Fix group_call_function not loading group-dial-string and dial-string from user type pointer (MODAPP-335/r:16034)
+	mod_commands: add timer_test cli app (r:16079)
+	mod_commands: fsctl add shutdown now for debugging (r:16220)
+	mod_commands: add uuid_simplify and sip_auto_simplify (r:16420)
+	mod_commands: switch_channel_expand_variables value escape enhancement (MODAPP-354/r:16465)
 	mod_conference: Fix conference floor ownership being ceded too easily (MODAPP-323/r:14703)
 	mod_conference: Display callers' rates (r:14992)
 	mod_conference: Don't start conf auto record until a second party arrives (MODAPP-348/r:15029)
 	mod_conference: wait-mod doesn't loop moh-sound audio file (MODAPP-349/r:15171)
 	mod_conference: Return additional flags in xml_list (MODAPP-360/r:15275)
 	mod_conference: take pin from x header (MODAPP-333/r:15415)
+	mod_conference: add more mutexes to video thread (r:15551)
+	mod_conference: fix video thread (r:15590)
+	mod_conference: add mute on/mute off actions in addition to toggle mute action (MODAPP-370/r:15845)
+	mod_conference: add conference member data into the play-file-member-done event (r:15909)
+	mod_conference: add waste-bandwidth flag to conference (r:16110)
+	mod_conference: mix member play file data in with conference so you can hear the bg while hearing the member file (r:16408)
 	mod_console: Improved tab completions, and more description usage informations (LOGGER-2/r:15103) 
+	mod_curl: don't include response code in response data as it has its own var (MODAPP-369/r:15591)
 	mod_dialplan_xml: Fix anti-action not being supported for time-based conditions (DP-6/r:14901)
-	mod_dialplan_xml: add inline=true to actions to exec certian apps right away (also mod_dptools) (r:14906)
+	mod_dialplan_xml: add inline=true to actions to exec certain apps right away (also mod_dptools) (r:14906)
 	mod_dialplan_xml: Fix condition "week of year" calculation (DP-7/r:14968)
+	mod_dialplan_xml: Add holiday, week of year matching (Thanks Vagabond) (r:15721)
 	mod_dingaling: fix segfault on unload (MODENDP-243/r:14588)
 	mod_dingaling: Fix mod_dingaling does not reads profile information from configuration file at runtime till whole module is reloaded (LBDING-15/r:14917)
 	mod_directory: initial commit of real code (MODAPP-325/r:14981)
@@ -173,30 +320,46 @@
 	mod_distributor: Initial commit (r:15421)
 	mod_dptools: add optional level argument to info app to choose the log level it logs on (r:14643)
 	mod_dptools: jump to a specific offset with the playback by appending @@<samples> to the path (r:14752)
-	mod_dptools: make continue_on_fail trigger explicit matching and only do default behaviour when it's not set (r:14972)
+	mod_dptools: make continue_on_fail trigger explicit matching and only do default behavior when it's not set (r:14972)
 	mod_dptools: att_xfer sometimes doesn't detect B leg hanging up on PSTN - this is a patch to hangup B and initiate the transfer of A to C by pressing * (DP-8/r:15013)
 	mod_dptools: Add Campon feature. (r:15201)
 	mod_dptools: Add campon_stop_key and campon_announce_sound to tell the user how to force it to the end of the waiting period (r:15220)
 	mod_dptools: Remove attended transfer from reasons for continue_on_fail (FSCORE-367/r:15367) 
+	mod_dptools: add dp apps for setting audio level and muting (r:15993)
+	mod_dptools: make cn optional for mute 1 means absolute silence > 1 means generate cn level (r:15996)
 	mod_erlang_event: Add support for simply sending an arbitrary message to an arbitrary registered process at a node (r:14875)
 	mod_erlang_event: Deprecate new_pid message in favor of get_pid which has an extra element, the call's UUID (r:14877)
-	mod_erlang_event: optionally allow compatability with nodes running older OTP releases (R7 through current) (r:15189)
+	mod_erlang_event: optionally allow compatibility with nodes running older OTP releases (R7 through current) (r:15189)
 	mod_esf: Add ability to adjust multicast packet TTL with the config (MODAPP-338/r:14927)
 	mod_esf: fix compile error on windows (r:14934)
+	mod_event_multicast: clean up mod_event_multicast to use blocking recvfrom and better error checking (r:15791)
 	mod_event_socket: add unique-id check to sendevent to send and event to a session instead of the system (r:14874)
 	mod_event_socket: fix mem leak (MODEVENT-54/r:14891)
 	mod_event_socket: fix CHANNEL_HANGUP_COMPLETE missing under myevents (MODEVENT-56/r:15011)
 	mod_event_socket: fix event_sink race (r:15389)
+	mod_event_socket: fix expires seg in event_sink (r:15594)
+	mod_event_socket: only kill event socket on 100 consecutive errors (r:15671)
+	mod_event_socket: add userauth <user>@<domain>:<pass> to event_socket to auth against user directory uses esl-password esl-allowed-api esl-allowed-events and esl-allowed-log to control resource access (r:16160)
 	mod_fifo: fix mod_fifo not honoring member_timeout (MODAPP-322/r:14552)
 	mod_fifo: add fifo_position var (r:14806)
 	mod_fifo: add API: fifo_add_outbound to add outbound members to a FIFO (r:14809)
 	mod_fifo: allow to call outbound member on on-the-fly fifo, also add a settings params to delete or keep all dynamic fifo entry (MODAPP-332/r:14989) 
 	mod_fifo: skip setting callerid when it's already set (r:15071)
+	mod_fifo: convert mod_fifo to cache_db (r:15971)
+	mod_fifo: Small bug in odbc-dsn settings parsing (MODAPP-383/r:16018)
 	mod_h323: initial commit (r:15223)
 	mod_h323: fix faststart in progress handling (r:15352)
 	mod_h323: remove SWITCH_RTP_FLAG_AUTOADJ because its not work correctly and not do anything reliable in our cases (r:15374)
+	mod_h323: fix rtp timer initialisation.
+		implement alerting-indication option and channel variable.
+		implement progress-indication option and channel variable. (r:15905)
+	mod_h323: move faststart to callproceeding due to some broken hardware not understand correctly faststart in progress. (r:15906)
+	mod_h323: fix slow start handling (r:15935)
+	mod_h323: add PI handling in alerting (r:15936)
+	mod_h323: add PI handling in Call Proceeding (r:15397)
 	mod_fifo: gracefully fail on missing config file (r:15106)
 	mod_iax: avoiding buffer overflow in silly iax lib (r:14910)
+	mod_iax: move to unsupported (r:16460)
 	mod_lang: Change mod_lua so that it registers as a dialplan (MODLANG-140/r:15400)
 	mod_lcr: fix possible null string passed to switch_log_printf (r:14514)
 	mod_lcr: Add support for user_rates which are the (optional) end-user rates (MODAPP-340/r:15022)
@@ -205,8 +368,12 @@
 	mod_limit: add limit_ignore_transfer var (MODAPP-334/r:14830)
 	mod_limit: add limit_execute (like limit_hash_execute); allow -#s to act as counter only; add INFO level logs to limit similar to limit_hash (r:14870)
 	mod_limit: make limit work with neg count like limit_hash  (r:14920)
+	mod_limit: move mod_limit to cache_db and clean up vm legacy code (r:15677)
+	mod_limit: remove memcache version, it never worked right and is unworkable w/out a lot	of effort.  will revisit when pluggable limit implemented (r:15908)
+	mod_limit: mod_limit: use = instead of like (r:16020)
 	mod_local_stream: add chime-list to local_stream (r:14966)
 	mod_local_stream: Fix memory leak at mod_local_stream (MODFORM-36/r:15431)
+	mod_logfile: add uuid parameter to prefix log files by the call's uuid (r:15502)
 	mod_lua: add conjure-session code and make session available in API commands (r:14739)
 	mod_lua: make luarun use a new pool every call (r:14763)
 	mod_lua: fix seek function (MODLANG-124/r:14812)
@@ -219,15 +386,25 @@
 	mod_memcache: update to libmemcached 0.32 (r:14935)
 	mod_memcache: add --with-memcached=no to libmemcached configure (r:14938)
 	mod_opal: Added setting of outgoing number and display name from extension number so H.323/Q.931 fields are set correctly in ALERTING and CONNECT messages sent for incoming calls.(r:14900)
+	mod_opal: Fixed compile issues with latest Opal (r:15545)
 	mod_portaudio: fix compilation failure in mod_portaudio_stream (MODFORM-35/r:14531)
 	mod_portaudio: add context param (r:14737)
+	mod_portaudio: make the ringfile configurable via new API command 'pa ringfile' (r:15633)
+	mod_portaudio: fix mod_portaudio linux build with alsa (MODAPP-377/r:15899)
+	mod_portaudio: Set a new channel variable with the call_id (MODAPP-277/r:16115)
+	mod_portaudio: fix pa play bug (r:16188)
+	mod_portaudio: default to dialplan 'XML' instead of 'default' (r:16345)
+	mod_portaudio: Add event for audio device error and properly register/unregister custom event subclasses (MODENDP-282/r:16354)
 	mod_python: Fix segfault on multiple calls to Python (MODLANG-133/r:14847)
 	mod_python: Fix infinite recursion in python script causing crash (MODLANG-134/r:14898)
 	mod_python: fix memory leak (MODLANG-136/r:15432)
 	mod_radius_cdr: Fix Framed-IP-Address in start and stop having wrong IP (MODEVENT-52/r:15197)
 	mod_radius_cdr: Fix memory leak from large CPS test (MODEVENT-55/r:15198)
 	mod_say_es: Improve Spanish lang handling (MODAPP-317/r:15424)
-	mod_say_it: Fix italian pronunce in mod_say_it (MODAPP-362/r:15407)
+	mod_say_hu: add mod_say_hu to trunk from csecket branch (r:15622)
+	mod_say_it: Fix italian pronounce in mod_say_it (MODAPP-362/r:15407)
+	mod_say_it: fix hundred pronunciation (MODAPP-367/r:15500)
+	mod_say_th: add mod_say_th (MODLANG-144/r:15592)
 	mod_skel_codec: Add (thanks Moy) (MODCODEC-14/r:14959)
 	mod_skypiax: ubermegapatch, more stability, robustness, scalability. Memory leaks not yet investigated, we'll do next (r:14517)
 	mod_skypiax: more stability, no dangling channels, MODSKYPIAX-42, added 'sk list' statistics (thanks Seven Du) MODENDP-236 (r:14533)
@@ -239,6 +416,9 @@
 	mod_skypiax: added one more 'PROTOCOL 7' command, because windows was not getting it. Now CHATMESSAGES will probably work on windows too (r:15342)
 	mod_skypiax: added 'report_incoming_chatmessages' configuration file per_interface setting. To activate it, put its value to '1' or 'true', any other value will be 'false'. Defualts to 'true' (r:15343)
 	mod_skypiax: commented out 'XCloseDisplay' lines, seems to cause crashes... (r:15344)
+	mod_skypiax: no more pipes for audio samples exchange between threads.(r:15541)
+	mod_skypiax: do not add delay when a sleep() or play() are executed by a script after answer() and before sending audio. (MODSKYPIAX-29, MODSKYPIAX-58/r:15585) 
+	mod_skypiax: changed audio i/o tcp socket size and timing constant on linux, for better compatibility with virtual machines (r:16330)
 	mod_snipe_hunt: add mod_snipe_hunt to tree (r:14937)
 	mod_sofia: allow custom SIP X-headers in 180/183/200 messages (MODSOFIA-20/r:14482)
 	mod_sofia: use switch_mprintf to securely parse the user parameters for the SQL query for reboot in mod_sofia (MODENDP-233/r:14484)
@@ -280,11 +460,11 @@
 	mod_sofia: add pass-callee-id (defaults to true) disable by setting it to false if you encounter something too stupid to ignore X headers (r:15230)
 	mod_sofia: overcome ack via in nat (r:15277)
 	mod_sofia: windows compiler fixes and switch_mprintf overflow(32bit only) (r:15286)
-	mod_sofia: doing carot dialing to a location without a gateway will result in the host being null in some cases this will not allow that if you specify the full sip:dest@host it works fine but if you only specify the number then host will be null (r:15332)
+	mod_sofia: doing caret dialing to a location without a gateway will result in the host being null in some cases this will not allow that if you specify the full sip:dest@host it works fine but if you only specify the number then host will be null (r:15332)
 	mod_sofia: add distinct-to=true|false to be used with from-domain when you don't want to change the to (r:15334)
 	mod_sofia: make subscriptions time out, discard code that made them last forever (r:15364)
 	mod_sofia: reset handle on bad reg (r:15365)
-	mod_sofia: dont send blank update (r:15366)
+	mod_sofia: don't send blank update (r:15366)
 	mod_sofia: fix sql stmt for blf subs (r:15396)
 	mod_sofia: fix bug tolerating the other guy's bug (r:15401)
 	mod_sofia: experimental support for send-message-query-on-register=first-only (r:15405)
@@ -293,16 +473,73 @@
 	mod_sofia: avoiding initial segfault (MODENDP-265/r:15427)
 	mod_sofia: solve problem from MODENDP-258 with an alternate approach, and make send-message-query-on-register=first-only and sql-in-transactions=true the defaults (MODENDP-258/r:15441)
 	mod_sofia: lookup gateway by realm when not found by name (r:15475)
+	mod_sofia: if the phone is behind nat with us... don't consider nat processing fixes cases where things are EVIL like cisco 79xx (r:15486)
+	mod_sofia: Fix sofia statistics (MODSOFIA-38/r:15491)
+	mod_sofia: add content-disposition to SEND_INFO (r:15495)
+	mod_sofia: video improvements (r:15524)
+	mod_sofia: always check for callee update not just because of pai (r:15589)
+	mod_sofia: add ani and aniii to caller profile (MODSOFIA-34/r:15596)
+	mod_sofia: reset timestamp counter when we get new sdp etc because sonus likes to say ptime 20 and send 30ms timestamps in the 183 then once they say 200 ok with the same sdp they decide to actually send 20 for real this time (FSRTP-8/r:15597)
+	mod_sofia: convert sofia to use new core version of cache db handles (r:15600)
+	mod_sofia: Fix crash where client register request does not contain "nc" parameter (MODSOFIA-39/r:15609)
+	mod_sofia: Add ping hysteresis for SIP peer qualification (MODSOFIA-40/r:15628)
+	mod_sofia: add sip_profile_name go go with sip_gateway_name on outgoing calls (r:15629)
+	mod_sofia: fail2ban support in mod_sofia thanks jay binks. (MODSOFIA-41/r:15654)
+	mod_sofia: Revert part of MODSOFIA-41 r15654 that deals with phone reboot - breaks Aastra/Polycom (r:15656)
+	mod_sofia: Fix call not hanging up after hold (FSCORE-481/r:15657)
+	mod_sofia: add separate inbound/outound codec prefs params to sofia profile original codec-prefs sets both to the same value for back-compat (r:15658)
+	mod_sofia: reset the remote_media ip/port vars more often (r:15676)
+	mod_sofia: retry reg faster on dns timeouts (r:15763)
+	mod_sofia: huge sonus infection (FSRTP-8/r:15781)
+	mod_sofia: fix runaway ptime mismatch with xlite and bv (r:15788)
+	mod_sofia: set sip_copy_custom_headers=false to avoid custom sip headers to be copied on the b-leg (r:15789)
+	mod_sofia: send bye instead of cancel after invalid 200 OK (MODENDP-270/r:15808)
+	mod_sofia: don't set auto-nat on ipv6 profiles (r:15829)
+	mod_sofia: Fix att_xfer origination_cancel not working and b has no chance to talk with c in an A-B-C scenario (MODAPP-376/r:15838)
+	mod_sofia: add disable_q850_reason chan var to disable sending Reason header in sip BYE messages (MODSOFIA-44/r:15850)
+	mod_sofia: Fix UPDATE being sent to session creator without crypto (MODENDP-273/r:15851)
+	mod_sofia: add shutdown-on-fail param to sofia profiles (MODSOFIA-45/r:15854)
+	mod_sofia: fix send-message-query-on-register set to 'false' (MODSOFIA-42/r:15857)
+	mod_sofia: move NUTAG_MIN_SE to sofia_glue_do_invite so it only appears on requests. (MODSOFIA-47/r:15943)
+	mod_sofia: Fix redirect contacts not set correctly on 300 Mutliple Choices (SFSIP-190/r:15994)
+	mod_sofia: Add fix for silly endpoints who use G729a improperly (MODSOFIA-48/r:16004)
+	mod_sofia: Add ping hysteresis for SIP peer qualification (MODSOFIA-40/r:16039)
+	mod_sofia: Major presence update (r:16053)
+	mod_sofia: Fix sofia loglevel 9 (MODSOFIA-50/r:16058)
+	mod_sofia: don't segfault on notify message with no contact (r:16130)
+	mod_sofia: honor disabled soa flag in re-invite (r:16193)
+	mod_sofia: share and share alike, only nothing is alike in sip =/ (r:16194)
+	mod_sofia: Get sofia "auth-calls" parameter and directory "auth-acl" parameter to work through a proxy. (BOUNTY-12/r:16200)
+	mod_sofia: add command-line completion for sofia xmlstatus (MODSOFIA-52/r:16260)
+	mod_sofia: held-private now works (r:16295)
+	mod_sofia: add event header to gateway registration events (MODENDP-281/r:16319)
+	mod_sofia: fix PUBLISH/200 response sent without ETag (FSCORE-262/r:16388)
+	mod_sofia: set chanvars on both directions in sip and introduce sip_to_tag and sip_from_tag vars (r:16395)
+	mod_sofia: fix rpid and from correctly when auto-nat is enabled so polycom won't display the flipping URI and freak some poor souls out :P  (r:16473)
+	mod_sofia: sip is stupid MODSOFIA-51, the 202 has to have the correct contact or the phone comes back and subscribes to the contact and not the actual extension (MODSOFIA-51/r:16500)
+	mod_spidermonkey: allow inline javascript, use a ~ as first script character (r:15598)
+	mod_spidermonkey: fix mod_spidermonkey on OSX 10.6 (lets see if this breaks any other platforms) (r:15650)
+	mod_spidermonkey_core_db: Allow to bind value to parameters in prepared statements (MODLANG-139/r:15632)
 	mod_syslog: Enable mod_syslog to log to a specific facility (LOGGER-3/r:15162)
 	mod_syslog: mod_syslog does not respect facility setting, always logs to user.* (LOGGER-4/r:15447)
+	mod_syslog: fixed mod_syslog.c on solaris since there is no LOF_FTP and LOG_AUTHPRIV in solaris syslog (r:15606)
+	mod_syslog: add uuid logging support (r:16187)
 	mod_tts_commandline: Add new module (r:14827)
 	mod_tts_commandline: introduce the rate parameter, decrease useless verbosity (r:14885)
-	mod_tts_commandline: cut samples in half (suggested by anthm), ajust and clean log levels (r:14886)
+	mod_tts_commandline: cut samples in half (suggested by anthm), adjust and clean log levels (r:14886)
 	mod_tts_commandline: add config (r:14887)
 	mod_tts_commandline: quote shell args, create an unique tempfile (r:14931)
 	mod_tts_commandline: improve, update config file (MODASRTTS-21/r:14932)
 	mod_unimrcp: add support for file://, <speak, and <grammar (r:15236)
 	mod_unimrcp: fixed pizza demo bug, other misc ungoodness (r:15330)
+	mod_unimrcp: Add enable-profile-events param to mod_unimrcp (r:15528)
+	mod_unimrcp: Add enable-profile-events param to mod_unimrcp config (r:15529)
+	mod_unimrcp: Support UniMRCP 0.8.0 and new RTCP configuration params (r:15554)
+	mod_unimrcp: Update Nuance MRCP configuration to send RTCP BYE (r:15555)
+	mod_unimrcp: unimrcp - add windows 2008 project support - doesn't do anything yet (r:15569)
+	mod_unimrcp: support resampling for TTS (UniMRCP 0.8.0 only) (r:15570)
+	mod_unimrcp: update to new api in unimrcp r1297 (r:15616)
+	mod_unimrcp: fix for loquendo MRCPv2 - destroy session instead of removing channel (r:15736)
 	mod_valet_parking: add (r:15072)
 	mod_valet_parking: sense att xfer in valet (r:15126)
 	mod_valet_parking: add events and valet_info fsapi to valet parking (r:15136)
@@ -311,22 +548,32 @@
 	mod_valet_parking: enforce arg checking (r:15176)
 	mod_valet_parking: Add mod_valet_parking to the windows build (r:15185)
 	mod_vmd: fix glaring rwdeadlock in mod_vmd (r:14994)
+	mod_vmd: make MIN_TIME configurable via channel variables(MODAPP-372/r:15825)
 	mod_voicemail: fix operator-ext/operator-extension duplicate config declaration (r:14498)
 	mod_voicemail: allow profile to be specified sep from domain user@domain.com@myprofile (r:14756)
 	mod_voicemail: announce number of saved messages when there are no new messages (r:14964)
 	mod_voicemail: Add new api call to get user mailbox settings (MODAPP-325/r:14982) 
 	mod_voicemail: Add ability to skip greeting and instructions when leaving voicemail (MODAPP-331/r:14990)
 	mod_voicemail: Fix VM disk quota (MODAPP-353/r:15161)
-	mod_voipcodecs: move mod_voipcodecs to use spandsp instead of libvoipcodecs (windows build to follow) (r:15036)
 	mod_voicemail: add missing switch_event_destroy in profile config function (r:15262)
 	mod_voicemail: default samplerate to 0 instead of 8000 so that we record using the channel's native rate, thx bkw (r:15394)
 	mod_voicemail: prevent obscure divide by zero code path (r:15413)
 	mod_voicemail: create max timeouts feature like the one in ivr_menu (MODAPP-365/r:15471)
+	mod_voicemail: decrease sql queries for message counts (MODAPP-359/r:15636)
+	mod_voicemail: Fix r15636 so New are New, and Old are Old messages (r:15639)
+	mod_voicemail: mod_voicemail: Change so total_new_messages and total_saved_messages include the count of new/saved urgent messages (Issue caused by MODAPP-359) (r:15670)
+	mod_voicemail: Fix segfault (FSCORE-511/r:15876)
+	mod_voicemail: passing originator's account name to cc'd accounts or groups to let them see who forwarded it (BOUNTY-13/r:16270)
+	mod_voipcodecs: move mod_voipcodecs to use spandsp instead of libvoipcodecs (windows build to follow) (r:15036)	
 	mod_voipcodecs: move mod_voipcodecs to use spandsp instead of libvoipcodecs - windows (r:15088)
+	mod_voipcodecs: rearrange codecs so we don't have crazy overlap and remove G723-32 and move it up to dynamic cuz people have nothing better to do then write stupid RFC's (r:16251)
+	mod_xml_cdr: Allow specifying auth-scheme in config (MDXMLINT-56/r:16247)
 	mod_xml_curl: Fix crash when using use-dynamic-url (XML-10/r:14850)
 	mod_xml_curl: Allow choice between HTTP Basic and Digest authentication (r:15107)
+	mod_xml_curl: Don't use signals when a timeout is specified (XMLINT-13/r:15997)
 	mod_xml_rpc: Fix auth issue (XMLINT-54/r:14580)
 	phrases: Add Recursive phrases support (FSCORE-458/r:15101) 
+	scripts: Fix Freeswitch gentls_cert script so the remove option works (FSBUILD-216/r:15965)
 	support: add fscore_pb script for dumping core info directly to pastebin (r:14904)
 	switch_utils: add a host lookup func (r:14653)
 	mod_zeroconf: Move to unsupported (r:15429)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/docs/phrase/phrase_en.xml (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/docs/phrase/phrase_en.xml	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/docs/phrase/phrase_en.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -337,6 +337,31 @@
       <prompt phrase="Please stay on the line. You call will be answered momentarily." filename="ivr-stay_on_line_call_answered_momentarily.wav" attr="Needs_to_be_recorded!"/>
       <prompt phrase="Your call is being transferred." filename="ivr-call_being_transferred.wav" attr="Needs_to_be_recorded!"/>
       <prompt phrase="Please enjoy the music while your call is being transferred." filename="ivr-enjoy_music_while_transfer.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="You have a call from..." filename="ivr-call_from.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="This menu has no items. Please contact the administrator." filename="ivr-no_menu_items.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="For a directory, press..." filename="ivr-for_directory_press.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="Using your telephone keypad..." filename="ivr-using_telephone_keypad.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="Enter the first few letters of the person's last name." filename="ivr-enter_letters_last_name.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="Enter the first few letters of the person's first name." filename="ivr-enter_letters_first_name.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="Enter the first few letters of the person's first or last name." filename="ivr-enter_letters_first_or_last_name.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="If this is correct, press..." filename="ivr-if_correct_press.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="If not, press..." filename="ivr-if_not_press.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="When you are finished, press the pound or hash key." filename="ivr-finished_pound_hash_key.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="Do not disturb now activated." filename="ivr-dnd_activated.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="Do not disturb has been cancelled." filename="ivr-dnd_cancelled.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="" filename="ivr-.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="Welcome to your new voicemail. To listen to a tutorial and setup your voice mail box, press 1. To skip, press 2." filename="vm-tutorial_yes_no.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="" filename="vm-.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="" filename="vm-.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="" filename="vm-.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="" filename="vm-.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="" filename="vm-.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="" filename="vm-.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="" filename="vm-.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="" filename="vm-.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="" filename="vm-.wav" attr="Needs_to_be_recorded!"/>
+      <prompt phrase="" filename="vm-.wav" attr="Needs_to_be_recorded!"/>
+
     </ivr>
     <misc>
       <prompt phrase="This call has been secured" filename="call_secured.wav"/>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/docs/phrase/phrase_ru.xml (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/docs/phrase/phrase_ru.xml	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/docs/phrase/phrase_ru.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -494,6 +494,28 @@
 		<prompt phrase="Почтовый ящик переполнен. Пожалуйста перезвоните позже" filename="vm-mailbox_full.wav"/>
 <!--  That mailbox is full. Please try your call again later.  -->
 	</voicemail>
+	<directory>
+		<!-- The following phrases still need to be recorded -->
+    		<prompt phrase="Пожалуйста, введите первые буквы имени абонента" filename="dir-enter-person.wav"/> <!--Please enter the first few letters of the persons-->
+        	<prompt phrase="Фамилии" filename="dir-last_name.wav"/> <!--last name.-->
+                <prompt phrase="Искать по ..." filename="dir-to_search_by.wav"/><!--To search by-->
+                <prompt phrase="Имени" filename="dir-first_name.wav"/><!--first name.-->
+                <prompt phrase="По Вашему запросу ничего не найдено, попробуйте еще раз" filename="dir-no_match_entry.wav"/><!--Your search matched no results, try again.-->
+                <prompt phrase="результаты Вашего запроса" filename="dir-result_match.wav"/><!--results matched your search.-->
+                <prompt phrase="По Вашему запросу найдено слишком много вариантов, пожалуйста, попробуйте уточнить запрос" filename="dir-to_many_result.wav"/><!--Your search returned too many results, please try again.-->
+                <prompt phrase="нет больше вариантов" filename="dir-no_more_result.wav"/><!--No more results.-->
+                <prompt phrase="Номер варианта" filename="dir-result_number.wav"/><!--Result number.-->
+                <prompt phrase="добавочный номер" filename="dir-at_extension.wav"/><!--at extension-->
+                <prompt phrase="Для выбора этой записи" filename="dir-to_select_entry.wav"/><!--To select this entry-->
+                <prompt phrase="Для выбора следующей записи" filename="dir-for_next.wav"/><!--For the next entry-->
+                <prompt phrase="Для выбора предыдущей записи" filename="dir-for_prev.wav"/><!--For the previous entry-->
+                <prompt phrase="Для начала нового поиска" filename="dir-to_make_new_search.wav"/><!--To start a new search-->
+                <prompt phrase="Вам необходимо указать минимум ..." filename="dir-specify_mininum_first.wav"/><!--You need to specify a minimum of-->
+                <prompt phrase="букв имени абонента, попробуйте снова" filename="dir-letters_of_person_name.wav"/><!--letters of the person name, try again.-->
+                <prompt phrase="нажмите" filename="dir-press.wav"/> <!--press  vm-press.wav-->
+        </directory>
+                                                                                                      
+
 	<conference>
 		<prompt phrase="NULL" filename="conf-ack.wav" type="tone"/>
 <!--    -->
@@ -533,7 +555,7 @@
 <!-- Account number   -->
 		<prompt phrase="Соединение с вызывающим абонентом" filename="ivr-connect_to_caller.wav"/>
 <!--Connect to caller    -->
-		<prompt phrase="Если вам известен добавочный номер вызываемого абонента, пожалуйста введите его сейчас" filename="ivr-enter_ext_pound.wav"/>
+		<prompt phrase="Если Вам известен добавочный номер вызываемого абонента, пожалуйста введите его сейчас" filename="ivr-enter_ext_pound.wav"/>
 <!-- If you know your party's extension, please enter it now   -->
 		<prompt phrase="Пожалуйста, введите добавочный номер абонента завершив нажатием на клавишу решётка" filename="ivr-enter_ext.wav"/>
 <!-- Please enter an extension followed by the pound sign-->
@@ -621,13 +643,13 @@
 <!--You have dialed an invalid extension.    -->
 		<prompt phrase="Пожалйста, наберите добавочный номер и нажмите клавишу решетка" filename="ivr-please_enter_extension_followed_by_pound.wav"/>
 <!--Please enter your extension, followed by the pound sign.    -->
-		<prompt phrase="Пожалуйста введите ваш пинкод и нажмите клавишу решётка" filename="ivr-please_enter_pin_followed_by_pound.wav"/>
+		<prompt phrase="Пожалуйста введите Ваш пинкод и нажмите клавишу решётка" filename="ivr-please_enter_pin_followed_by_pound.wav"/>
 <!-- Please enter your pin number, followed by the pound sign.   -->
 		<prompt phrase="Ваш пин код или номер не верны" filename="ivr-pin_or_extension_is-invalid.wav"/>
 <!--  Your pin number or extension is invalid.  -->
-		<prompt phrase="Вы закрепляете этот телефон за вашей учётной записью" filename="ivr-you_are_about_to_provision_this_phone.wav"/>
+		<prompt phrase="Вы закрепляете этот телефон за Вашей учётной записью" filename="ivr-you_are_about_to_provision_this_phone.wav"/>
 <!-- You are about to provision this phone to your account...   -->
-		<prompt phrase="Пожалуйста повторите ваш пин код для подтверждения" filename="ivr-please_reenter_your_pin.wav"/>
+		<prompt phrase="Пожалуйста повторите Ваш пин код для подтверждения" filename="ivr-please_reenter_your_pin.wav"/>
 <!-- Please re-enter your pin number to confirm.   -->
 		<prompt phrase="Для регистрации на clueCon , пожалуйста нажмите .." filename="ivr-register_for_cluecon.wav"/>
 <!-- To register for ClueCon, please press...   -->
@@ -649,8 +671,26 @@
 <!--   Thank you, this phone will now reboot. -->
 		<prompt phrase="Спасибо. Ваше сообщение было записано." filename="ivr-recording_saved.wav"/> <!-- Thank you. Your recording has been saved. -->
 		<prompt phrase="Нажмите 1 что бы сохранить сообщение. Нажмите 2 что бы прослушать Ваше сообщение. Нажмите 3 что бы перезаписать" filename="ivr-save_review_record.wav"/><!-- Press 1 to save your recording. Press 2 to review your recording. Press 3 to re-record. -->
-	        <prompt phrase="Система не смогла сохранить ваше сообщение. Попробуйте позднее." filename="ivr-unable_save.wav"/><!-- The system is unable to save your sound file at this time. Please try again later. -->
-		
+	        <prompt phrase="Система не смогла сохранить Ваше сообщение. Попробуйте позднее." filename="ivr-unable_save_old.wav"/><!-- The system is unable to save your sound file at this time. Please try again later. -->
+    		
+    		<prompt phrase="Системе не удается сохранить Ваш звуковой файл в данный момент. Пожалуйста, попробуйте позже" filename="ivr-unable_save.wav" attr="Needs_to_be_recorded!"/><!--The system is unable to save your sound file at this time. Please try again later. -->
+        	<prompt phrase="Ваш номер ..." filename="ivr-you_are_number.wav" attr="Needs_to_be_recorded!"/><!-- "You are number-->
+                <prompt phrase="на линии" filename="ivr-in_line.wav" attr="Needs_to_be_recorded!"/><!-- "In line."-->
+                <prompt phrase="Спасибо Вам за ожидание" filename="ivr-thank_you_for_holding.wav" attr="Needs_to_be_recorded!"/><!--"Thank you for holding." -->
+                <prompt phrase="Ваше время ожидания составит примерно ..." filename="ivr-estimated_hold_time.wav" attr="Needs_to_be_recorded!"/><!--"Your estimated hold time is..." -->
+                <prompt phrase="Больше чем..." filename="ivr-more_than.wav" attr="Needs_to_be_recorded!"/><!--"More than..." -->
+                <prompt phrase="Меньше чем..." filename="ivr-less_than.wav" attr="Needs_to_be_recorded!"/><!-- "Less than..."-->
+                <prompt phrase="Начать запись" filename="ivr-begin_recording.wav " attr="Needs_to_be_recorded!"/><!--"Begin recording." -->
+                <prompt phrase="Переадресация звонков была отменена" filename="ivr-call_forwarding_has_been_cancelled.wav" attr="Needs_to_be_recorded!"/><!--"Call forwarding has been cancelled."  -->
+                <prompt phrase="Переадресация звонков была настроена" filename="ivr-call_forwarding_has_been_set.wav " attr="Needs_to_be_recorded!"/><!--"Call forwarding has been set." -->
+                <prompt phrase="Пожалуйста, введите номер телефона" filename="ivr-please_enter_the_phone_number.wav" attr="Needs_to_be_recorded!"/><!--"Please enter the phone number." -->
+                <prompt phrase="Пожалуйста, назовите свое имя и цель Вашего звонка" filename="ivr-please_state_your_name_and_reason_for_calling.wav " attr="Needs_to_be_recorded!"/><!--"Please state your name and the reason for your call." -->
+                <prompt phrase="Что бы принять звонок нажмите 1, чтобы отклонить звонок нажмите 2. Для отправки голосовой почты нажмите 3" filename="ivr-accept_reject_voicemail.wav" attr="Needs_to_be_recorded!"/><!--"To accept, press 1. To reject, press 2. To send to voicemail, press 3." -->
+                <prompt phrase="Входящий звонок" filename="ivr-incoming_call.wav" attr="Needs_to_be_recorded!"/><!--"Incoming call." -->
+                <prompt phrase="Спасибо за Ваш звонок" filename="ivr-thank_you_for_calling.wav" attr="Needs_to_be_recorded!"/><!--"Thank you for calling." -->
+                <prompt phrase="Пожалуйста, оставайтесь на линии. Ваш звонок будет принят немедленно" filename="ivr-stay_on_line_call_answered_momentarily.wav" attr="Needs_to_be_recorded!"/><!--"Please stay on the line. You call will be answered momentarily." -->
+                <prompt phrase="Ваш звонок был переведен" filename="ivr-call_being_transferred.wav" attr="Needs_to_be_recorded!"/><!--"Your call is being transferred." filename="ivr-call_being_transferred.wav" -->
+                <prompt phrase="Пожалуйста, наслаждайтесь музыкой, пока Ваш вонок переводится" filename="ivr-enjoy_music_while_transfer.wav" attr="Needs_to_be_recorded!"/> <!--"Please enjoy the music while your call is being transferred." -->
 	</ivr>
 	<misc>
 		<prompt phrase="Этот звонок шифруется" filename="call_secured.wav"/>
@@ -672,7 +712,7 @@
 		<prompt phrase="Произошла ошибка, пожалуйста обратитесь к администратору" filename="error.wav"/>
 <!-- An error has occurred please contact the administrator   -->
 	</misc>
-    	<zrtp>
+    	<base256>
       		<!-- base256 prompts for SAS -->
       		<prompt phrase="Algol" filename="Algol.wav"/>
       		<prompt phrase="Apollo" filename="Apollo.wav"/>
@@ -1186,10 +1226,12 @@
       		<prompt phrase="willow" filename="willow.wav"/>
       		<prompt phrase="woodlark" filename="woodlark.wav"/>
       		<prompt phrase="yesteryear" filename="yesteryear.wav"/>
+    	</base256>
+    	<zrtp>
       		<!-- Event prompts -->
       		<prompt phrase="Добро пожаловать в агента регистрации шифрования ZRTP" filename="zrtp-enroll_welcome.wav"/>
       		<!-- Welcome to the ZRTP security enrollment agent.   -->
-      		<prompt phrase="Вы должны выбрать строку аутентификации с партнером по разговору, Если она не совпадет, система сообщит вам разрывом линии." filename="zrtp-check_sas.wav"/>
+      		<prompt phrase="Вы должны выбрать строку аутентификации с партнером по разговору, Если она не совпадет, система сообщит Вам разрывом линии." filename="zrtp-check_sas.wav"/>
       		<!-- You must check the authentication string with your partner. If it doesn't match, it indicates the presence of a wire tapper.   -->
       		<prompt phrase="Только телефоны, прошедшие аутентификацию, могут быть сконфигурированы для доверия системе для обеспечения ZRTP шифрованных звонков, так что такой звонок не даст эффекта." filename="zrtp-enroll_not_sip_registered.wav"/>
       		<!-- Only phones that are authenticated can be configured to trust this system to relay ZRTP secured calls.  Your phone is not authenticated with this system, so this call will have no effect.  -->
@@ -1197,7 +1239,7 @@
       		<!-- Your phone indicates that it already trusts this system to relay ZRTP secured calls, so you do not need to do anything more. -->
       		<prompt phrase="Только телефоны, с поддержкой протокола ZRTP могут использовать такую функцию. Ваш телефон не поддерживает ZRTP протокол и звонок не даст эффекта ZRTP защиты." filename="zrtp-enroll_notzrtp.wav"/>
       		<!-- Only phones equipped with the ZRTP protocol can use this extension. Your phone is not a ZRTP-enable phone, so this call will have no effect.-->
-      		<prompt phrase="Система оборудована для проведения шифрованных ZRTP звонков. Вы должны решить, если вы хотите чтобы система была задействована для приема и возможно мониторинга ваших защищенных звонков. Вы можете повесить трубку после окончания разговора." filename="zrtp-enroll_confirmed.wav"/>
+      		<prompt phrase="Система оборудована для проведения шифрованных ZRTP звонков. Вы должны решить, если вы хотите чтобы система была задействована для приема и возможно мониторинга Ваших защищенных звонков. Вы можете повесить трубку после окончания разговора." filename="zrtp-enroll_confirmed.wav"/>
       		<!-- This system is equipped to handle ZRTP encrypted phone calls. You must decide if you want to allow this system to be in a position to intercept and possibly monitor your secure phone calls. You may hang up after you've done this. -->
       		<prompt phrase="Договоритесь с партнером по разговору о парольной фразе." filename="zrtp-is_secure.wav"/>
       		<!-- Verbally compare this authentication code with your partner.   -->
@@ -1218,6 +1260,18 @@
       		<prompt phrase="Шифрованный вызов." filename="zrtp-status_securing.wav"/>
       		<!-- Securing call.   -->
     	</zrtp>
+    	<users>
+    		<prompt phrase="Для отправки факса" filename="to_send_a_fax.wav"/>
+    		<prompt phrase="Абонент с номером ... не отвечает, пожалуйста..." filename="no_answer_please.wav"/>
+    		<prompt phrase="для соединения с секретарем." filename="to_connect_secretary.wav"/>
+    		<prompt phrase="чтобы оставить голосовое сообщение..." filename="to_leave_a_voice_message.wav"/>
+    		<prompt phrase="для звонка на мобильный сотрудника" filename="to_call_the_mobile_employee.wav"/>
+    		<prompt phrase="Извините, сейчас все линии заняты, пожалуйста, перезвоните позже" filename="sorry_call_back_later.wav"/>
+    		<prompt phrase="Извините сейчас мы не можем принять ваш звонок, пожалуйста, перезвоните через несколько минут" filename="sorry_call_back_later2.wav"/>
+    		<prompt phrase="Факс работает в автоматическом режиме " filename="auto_fax.wav"/>
+    		<prompt phrase="Нажмите старт, для принятия факса." filename="press_start_to_receive_a_fax.wav"/>
+    		<prompt phrase="Нажмите старт, для отправки факса." filename="press_start_to_send_a_fax.wav"/>
+    	</users>
   </ru>                                                                                                                                                                      
 </language>                                                                                                                                                                  
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/freeswitch.spec (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/freeswitch.spec	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/freeswitch.spec	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,3 +1,5 @@
+# disable rpath checking
+%define __arch_install_post /usr/lib/rpm/check-buildroot
 %define _prefix   /opt/freeswitch
 %define prefix    %{_prefix}
 %define sysconfdir	/opt/freeswitch/conf
@@ -13,7 +15,7 @@
 Packager:     	Michal Bielicki
 Vendor:       	http://www.freeswitch.org/
 Source0:      	http://files.freeswitch.org/%{name}-%{version}.tar.bz2
-Source1:	http://files.freeswitch.org/downloads/libs/celt-0.6.1.tar.gz
+Source1:	http://files.freeswitch.org/downloads/libs/celt-0.7.0.tar.gz
 Source2:	http://files.freeswitch.org/downloads/libs/flite-1.3.99-latest.tar.gz
 Source3:	http://files.freeswitch.org/downloads/libs/lame-3.97.tar.gz
 Source4:	http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz
@@ -22,15 +24,7 @@
 Source7:	http://files.freeswitch.org/downloads/libs/pocketsphinx-0.5.99-latest.tar.gz
 Source8:	http://files.freeswitch.org/downloads/libs/soundtouch-1.3.1.tar.gz
 Source9:	http://files.freeswitch.org/downloads/libs/sphinxbase-0.4.99-latest.tar.gz
-Source10:	http://files.freeswitch.org/freeswitch-sounds-music-8000-1.0.8.tar.gz
-Source11:	http://files.freeswitch.org/freeswitch-sounds-music-16000-1.0.8.tar.gz
-Source12:	http://files.freeswitch.org/freeswitch-sounds-music-32000-1.0.8.tar.gz
-Source13:	http://files.freeswitch.org/freeswitch-sounds-music-48000-1.0.8.tar.gz
-Source14:	http://files.freeswitch.org/freeswitch-sounds-en-us-callie-8000-1.0.12.tar.gz
-Source15:	http://files.freeswitch.org/freeswitch-sounds-en-us-callie-16000-1.0.12.tar.gz
-Source16:	http://files.freeswitch.org/freeswitch-sounds-en-us-callie-32000-1.0.12.tar.gz
-Source17:	http://files.freeswitch.org/freeswitch-sounds-en-us-callie-48000-1.0.12.tar.gz
-Source18:	http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz
+Source10:	http://files.freeswitch.org/downloads/libs/communicator_semi_6000_20080321.tar.gz
 Prefix:        %{prefix}
 
 #AutoReqProv:  no
@@ -63,6 +57,7 @@
 BuildRequires: alsa-lib-devel
 BuildRequires: which
 BuildRequires: zlib-devel
+BuildRequires: e2fsprogs-devel
 
 %if %{?suse_version:1}0
 %if 0%{?suse_version} > 910
@@ -83,7 +78,7 @@
 simple switching engine, a media gateway or a media server to host IVR applications using 
 simple scripts or XML to control the callflow. 
 
-We support various communication technologies such as SIP, H.323, IAX2 and GoogleTalk making 
+We support various communication technologies such as SIP, H.323 and GoogleTalk making 
 it easy to interface with other open source PBX systems such as sipX, OpenPBX, Bayonne, YATE or Asterisk.
 
 We also support both wide and narrow band codecs making it an ideal solution to bridge legacy 
@@ -208,78 +203,6 @@
 %description openzap
 OpenZAP
 
-%package moh
-Summary:        FreeSWITCH Music on hold files
-Group:          System/Libraries
-Requires:        %{name} = %{version}-%{release}
-
-%description moh
-8khz music on hold files for FreeSWITCH
-
-
-%package hd-moh
-Summary:        High Definition FreeSWITCH Music on hold files
-Group:          System/Libraries
-Requires:       %{name} = %{version}-%{release}
-
-%description hd-moh
-16khz High Definition FreeSWITCH Music on hold files
-
-
-%package uhd-moh
-Summary:        Ultra High Definition FreeSWITCH Music on hold files
-Group:          System/Libraries
-Requires:       %{name} = %{version}-%{release}
-
-%description uhd-moh
-32khz Ultra High Definition FreeSWITCH Music on hold files
-
-
-%package cd-moh
-Summary:        CD Quality FreeSWITCH Musci on hold files
-Group:          System/Libraries
-Requires:       %{name} = %{version}-%{release}
-
-%description cd-moh
-48khz CD Quality FreeSWITCH Music on hold files
-
-
-%package sounds-en-callie
-Summary:        English prompts for FreeSWITCH
-Group:          System/Libraries
-Requires:        %{name} = %{version}-%{release}
-
-%description sounds-en-callie
-8khz English prompts for FreeSWITCH
-
-
-%package hd-sounds-en-callie
-Summary:        High Density English prompts for FreeSWITCH
-Group:          System/Libraries
-Requires:        %{name} = %{version}-%{release}
-
-%description hd-sounds-en-callie 
-16khz High Density English prompts for FreeSWITCH
-
-
-%package uhd-sounds-en-callie
-Summary:        Ultra High Density English prompts for FreeSWITCH
-Group:          System/Libraries
-Requires:        %{name} = %{version}-%{release}
-
-%description uhd-sounds-en-callie
-32khz Ultra High Density English prompts for FreeSWITCH
-
-
-%package cd-sounds-en-callie
-Summary:        CD Quality English prompts for FreeSWITCH
-Group:          System/Libraries
-Requires:        %{name} = %{version}-%{release}
-
-%description cd-sounds-en-callie
-48khz CD Quality English prompts for FreeSWITCH
-
-
 %prep
 %setup -b0 -q
 cp %{SOURCE1} libs/
@@ -291,15 +214,7 @@
 cp %{SOURCE7} libs/
 cp %{SOURCE8} libs/
 cp %{SOURCE9} libs/
-cp %{SOURCE10} .
-cp %{SOURCE11} .
-cp %{SOURCE12} .
-cp %{SOURCE13} .
-cp %{SOURCE14} .
-cp %{SOURCE15} .
-cp %{SOURCE16} .
-cp %{SOURCE17} .
-cp %{SOURCE18} libs/
+cp %{SOURCE10} libs/
 
 
 %build
@@ -313,22 +228,21 @@
 %endif
 
 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/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"
+ENDPOINTS_MODULES="endpoints/mod_dingaling 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_MODULES="languages/mod_spidermonkey 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 languages/mod_yaml"
+DISABLED_MODULES="applications/mod_soundtouch asr_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"
+MYMODULES="$PASSTHRU_CODEC_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"
 
 export MODULES=$MYMODULES
 test ! -f  modules.conf || rm -f modules.conf
@@ -377,10 +291,6 @@
 
 %{__make} DESTDIR=$RPM_BUILD_ROOT install
 
-# Install Sound Files
-%{__make} DESTDIR=$RPM_BUILD_ROOT  cd-sounds-install
-%{__make} DESTDIR=$RPM_BUILD_ROOT  cd-moh-install
-
 # Create a log dir
 %{__mkdir} -p $RPM_BUILD_ROOT%{prefix}/log
 
@@ -438,6 +348,7 @@
 %endif
 %dir %attr(0750, freeswitch, daemon) %{prefix}/db
 %dir %attr(0750, freeswitch, daemon) %{prefix}/log
+%dir %attr(0750, freeswitch, daemon) %{prefix}/run
 %dir %attr(0750, freeswitch, daemon) %{prefix}/log/xml_cdr
 %dir %attr(0750, freeswitch, daemon) %{prefix}/htdocs
 %dir %attr(0750, freeswitch, daemon) %{prefix}/scripts
@@ -477,12 +388,12 @@
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/enum.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/event_multicast.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/event_socket.conf.xml
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/erlang_event.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cdr_csv.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/fax.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/fifo.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/shout.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/timezones.conf.xml
-%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/iax.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/ivr.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/java.conf.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/limit.conf.xml
@@ -517,6 +428,7 @@
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/dialplan/public/*.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/directory/*.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/directory/default/*
+%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/ivr_menus/*.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/*.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/internal/*.xml
 %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/sip_profiles/external/*.xml
@@ -560,7 +472,6 @@
 %{prefix}/mod/mod_dialplan_xml.so* 
 %{prefix}/mod/mod_dialplan_asterisk.so* 
 %{prefix}/mod/mod_dingaling.so* 
-%{prefix}/mod/mod_iax.so* 
 %{prefix}/mod/mod_portaudio.so* 
 %{prefix}/mod/mod_sofia.so* 
 %{prefix}/mod/mod_cdr_csv.so*
@@ -696,122 +607,9 @@
 %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
-%{prefix}/sounds/music/8000/*
-
-%files hd-moh
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/music/16000
-%{prefix}/sounds/music/16000/*
-
-%files uhd-moh
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/music/32000
-%{prefix}/sounds/music/32000/*
-
-%files cd-moh
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/music/48000
-%{prefix}/sounds/music/48000/*
-
-%files sounds-en-callie
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ascii/8000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/base256/8000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/conference/8000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/currency/8000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/digits/8000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ivr/8000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/misc/8000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/phonetic-ascii/8000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/time/8000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/voicemail/8000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/zrtp/8000
-%{prefix}/sounds/en/us/callie/ascii/8000/*
-%{prefix}/sounds/en/us/callie/base256/8000/*
-%{prefix}/sounds/en/us/callie/conference/8000/*
-%{prefix}/sounds/en/us/callie/currency/8000/*
-%{prefix}/sounds/en/us/callie/digits/8000/*
-%{prefix}/sounds/en/us/callie/ivr/8000/*
-%{prefix}/sounds/en/us/callie/misc/8000/*
-%{prefix}/sounds/en/us/callie/phonetic-ascii/8000/*
-%{prefix}/sounds/en/us/callie/time/8000/*
-%{prefix}/sounds/en/us/callie/voicemail/8000/*
-%{prefix}/sounds/en/us/callie/zrtp/8000/*
-
-%files hd-sounds-en-callie
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ascii/16000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/base256/16000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/conference/16000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/currency/16000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/digits/16000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ivr/16000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/misc/16000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/phonetic-ascii/16000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/time/16000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/voicemail/16000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/zrtp/16000
-%{prefix}/sounds/en/us/callie/ascii/16000/*
-%{prefix}/sounds/en/us/callie/base256/16000/*
-%{prefix}/sounds/en/us/callie/conference/16000/*
-%{prefix}/sounds/en/us/callie/currency/16000/*
-%{prefix}/sounds/en/us/callie/digits/16000/*
-%{prefix}/sounds/en/us/callie/ivr/16000/*
-%{prefix}/sounds/en/us/callie/misc/16000/*
-%{prefix}/sounds/en/us/callie/phonetic-ascii/16000/*
-%{prefix}/sounds/en/us/callie/time/16000/*
-%{prefix}/sounds/en/us/callie/voicemail/16000/*
-%{prefix}/sounds/en/us/callie/zrtp/16000/*
-
-
-%files uhd-sounds-en-callie
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ascii/32000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/base256/32000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/conference/32000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/currency/32000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/digits/32000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ivr/32000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/misc/32000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/phonetic-ascii/32000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/time/32000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/voicemail/32000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/zrtp/32000
-%{prefix}/sounds/en/us/callie/ascii/32000/*
-%{prefix}/sounds/en/us/callie/base256/32000/*
-%{prefix}/sounds/en/us/callie/conference/32000/*
-%{prefix}/sounds/en/us/callie/currency/32000/*
-%{prefix}/sounds/en/us/callie/digits/32000/*
-%{prefix}/sounds/en/us/callie/ivr/32000/*
-%{prefix}/sounds/en/us/callie/misc/32000/*
-%{prefix}/sounds/en/us/callie/phonetic-ascii/32000/*
-%{prefix}/sounds/en/us/callie/time/32000/*
-%{prefix}/sounds/en/us/callie/voicemail/32000/*
-%{prefix}/sounds/en/us/callie/zrtp/32000/*
-
-
-%files cd-sounds-en-callie
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ascii/48000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/base256/48000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/conference/48000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/currency/48000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/digits/48000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/ivr/48000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/misc/48000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/phonetic-ascii/48000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/time/48000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/voicemail/48000
-%dir %attr(0750, freeswitch, daemon) %{prefix}/sounds/en/us/callie/zrtp/48000
-%{prefix}/sounds/en/us/callie/ascii/48000/*
-%{prefix}/sounds/en/us/callie/base256/48000/*
-%{prefix}/sounds/en/us/callie/conference/48000/*
-%{prefix}/sounds/en/us/callie/currency/48000/*
-%{prefix}/sounds/en/us/callie/digits/48000/*
-%{prefix}/sounds/en/us/callie/ivr/48000/*
-%{prefix}/sounds/en/us/callie/misc/48000/*
-%{prefix}/sounds/en/us/callie/phonetic-ascii/48000/*
-%{prefix}/sounds/en/us/callie/time/48000/*
-%{prefix}/sounds/en/us/callie/voicemail/48000/*
-%{prefix}/sounds/en/us/callie/zrtp/48000/*
-
-
 %changelog
+* Wed Dec 02 2009 - michal.bielicki@seventhsignal.de
+- Soundfiles are moving into a separate spec
 * Wed Nov 25 2009 - brian@freeswitch.org
 - added mod_bv.so
 * Wed Nov 25 2009 - michal.bielicki@seventhsignal.de

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm (from rev 16612, freeswitch/trunk/fscomm)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/FSComm.2008.vcproj

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/FSComm.2008.vcproj (from rev 16612, freeswitch/trunk/fscomm/FSComm.2008.vcproj) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/FSComm.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/FSComm.2008.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,821 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="FSComm"
+	ProjectGUID="{7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}"
+	RootNamespace="FSComm"
+	Keyword="Qt4VSv1.0"
+	TargetFrameworkVersion="0"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="."
+			IntermediateDirectory="debug\"
+			ConfigurationType="1"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				WarningLevel="0"
+				DefaultCharType="0"
+				EnableErrorChecks="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalOptions="-Zm200 -w34100 -w34189 -w34100 -w34189"
+				Optimization="4"
+				AdditionalIncludeDirectories="$(QTDIR)\include\QtCore;$(QTDIR)\include\QtGui;$(QTDIR)\include;.;$(QTDIR)\include\ActiveQt;debug;&quot;$(QTDIR)\mkspecs\win32-msvc2008&quot;;..\src\include;$(QTDIR)\include\QtXml"
+				PreprocessorDefinitions="_WINDOWS,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,QT_DLL,QT_GUI_LIB,QT_CORE_LIB,QT_THREAD_SUPPORT"
+				GeneratePreprocessedFile="0"
+				ExceptionHandling="1"
+				RuntimeLibrary="3"
+				BufferSecurityCheck="false"
+				TreatWChar_tAsBuiltInType="false"
+				RuntimeTypeInfo="true"
+				AssemblerListingLocation=""
+				ObjectFile="$(IntDir)\"
+				ProgramDataBaseFileName="$(IntDir)\"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="_WINDOWS,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,QT_DLL,QT_GUI_LIB,QT_CORE_LIB,QT_THREAD_SUPPORT,_DEBUG"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				IgnoreImportLibrary="true"
+				AdditionalOptions="&quot;/MANIFESTDEPENDENCY:type=&apos;win32&apos; name=&apos;Microsoft.Windows.Common-Controls&apos; version=&apos;6.0.0.0&apos; publicKeyToken=&apos;6595b64144ccf1df&apos; language=&apos;*&apos; processorArchitecture=&apos;*&apos;&quot; &quot;/MANIFESTDEPENDENCY:type=&apos;win32&apos; name=&apos;Microsoft.Windows.Common-Controls&apos; version=&apos;6.0.0.0&apos; publicKeyToken=&apos;6595b64144ccf1df&apos; language=&apos;*&apos; processorArchitecture=&apos;*&apos;&quot;"
+				AdditionalDependencies="$(QTDIR)\lib\qtmaind.lib $(QTDIR)\lib\QtGuid4.lib $(QTDIR)\lib\QtCored4.lib $(QTDIR)\lib\QtXml4.lib"
+				OutputFile="debug\FSComm.exe"
+				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories="$(QTDIR)\lib"
+				GenerateDebugInformation="true"
+				ProgramDatabaseFile=""
+				SubSystem="2"
+				LinkTimeCodeGeneration="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="."
+			IntermediateDirectory="release\"
+			ConfigurationType="1"
+			UseOfMFC="0"
+			ATLMinimizesCRunTimeLibraryUsage="false"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				WarningLevel="0"
+				DefaultCharType="0"
+				EnableErrorChecks="1"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalOptions="-Zm200 -w34100 -w34189 -w34100 -w34189"
+				Optimization="2"
+				AdditionalIncludeDirectories="&quot;$(QTDIR)\include\QtCore&quot;;&quot;$(QTDIR)\include\QtGui&quot;;&quot;$(QTDIR)\include&quot;;.;&quot;$(QTDIR)\include\ActiveQt&quot;;release;&quot;$(QTDIR)\mkspecs\win32-msvc2008&quot;;..\src\include;&quot;$(QTDIR)\include\QtXml&quot;"
+				PreprocessorDefinitions="QT_NO_DEBUG,NDEBUG,_WINDOWS,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,QT_DLL,QT_NO_DEBUG,QT_GUI_LIB,QT_CORE_LIB,QT_THREAD_SUPPORT,NDEBUG"
+				GeneratePreprocessedFile="0"
+				ExceptionHandling="1"
+				RuntimeLibrary="2"
+				BufferSecurityCheck="false"
+				TreatWChar_tAsBuiltInType="false"
+				RuntimeTypeInfo="true"
+				AssemblerListingLocation=""
+				ObjectFile="$(IntDir)\"
+				ProgramDataBaseFileName="$(IntDir)\"
+				WarningLevel="3"
+				SuppressStartupBanner="true"
+				DebugInformationFormat="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+				PreprocessorDefinitions="QT_NO_DEBUG,NDEBUG,_WINDOWS,UNICODE,WIN32,QT_LARGEFILE_SUPPORT,QT_DLL,QT_NO_DEBUG,QT_GUI_LIB,QT_CORE_LIB,QT_THREAD_SUPPORT"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				IgnoreImportLibrary="true"
+				AdditionalOptions="&quot;/MANIFESTDEPENDENCY:type=&apos;win32&apos; name=&apos;Microsoft.Windows.Common-Controls&apos; version=&apos;6.0.0.0&apos; publicKeyToken=&apos;6595b64144ccf1df&apos; language=&apos;*&apos; processorArchitecture=&apos;*&apos;&quot; &quot;/MANIFESTDEPENDENCY:type=&apos;win32&apos; name=&apos;Microsoft.Windows.Common-Controls&apos; version=&apos;6.0.0.0&apos; publicKeyToken=&apos;6595b64144ccf1df&apos; language=&apos;*&apos; processorArchitecture=&apos;*&apos;&quot;"
+				AdditionalDependencies="$(QTDIR)\lib\qtmain.lib $(QTDIR)\lib\QtGui4.lib $(QTDIR)\lib\QtCore4.lib $(QTDIR)\lib\QtXml4.lib"
+				OutputFile="release\FSComm.exe"
+				LinkIncremental="1"
+				SuppressStartupBanner="true"
+				AdditionalLibraryDirectories="$(QTDIR)\lib"
+				GenerateDebugInformation="false"
+				ProgramDatabaseFile=""
+				SubSystem="2"
+				LinkTimeCodeGeneration="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath=".\account.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\preferences\accountdialog.cpp"
+				>
+			</File>
+			<File
+				RelativePath="call.cpp"
+				>
+			</File>
+			<File
+				RelativePath="fshost.cpp"
+				>
+			</File>
+			<File
+				RelativePath="main.cpp"
+				>
+			</File>
+			<File
+				RelativePath="mainwindow.cpp"
+				>
+			</File>
+			<File
+				RelativePath="mod_qsettings\mod_qsettings.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\preferences\prefaccounts.cpp"
+				>
+			</File>
+			<File
+				RelativePath="preferences\prefdialog.cpp"
+				>
+			</File>
+			<File
+				RelativePath="preferences\prefportaudio.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\preferences\prefsofia.cpp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath=".\account.h"
+				>
+			</File>
+			<File
+				RelativePath="preferences\accountdialog.h"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC accountdialog.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile debug\moc_accountdialog.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;debug&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\accountdialog.h -o debug\moc_accountdialog.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;accountdialog.h"
+						Outputs="debug\moc_accountdialog.cpp"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC accountdialog.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile release\moc_accountdialog.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;release&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\accountdialog.h -o release\moc_accountdialog.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;accountdialog.h"
+						Outputs="release\moc_accountdialog.cpp"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="call.h"
+				>
+			</File>
+			<File
+				RelativePath="fshost.h"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC fshost.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile debug\moc_fshost.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;debug&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 fshost.h -o debug\moc_fshost.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;fshost.h"
+						Outputs="debug\moc_fshost.cpp"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC fshost.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile release\moc_fshost.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;release&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 fshost.h -o release\moc_fshost.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;fshost.h"
+						Outputs="release\moc_fshost.cpp"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="mainwindow.h"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC mainwindow.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile debug\moc_mainwindow.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;debug&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 mainwindow.h -o debug\moc_mainwindow.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;mainwindow.h"
+						Outputs="debug\moc_mainwindow.cpp"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC mainwindow.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile release\moc_mainwindow.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;release&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 mainwindow.h -o release\moc_mainwindow.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;mainwindow.h"
+						Outputs="release\moc_mainwindow.cpp"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="mod_qsettings\mod_qsettings.h"
+				>
+			</File>
+			<File
+				RelativePath=".\preferences\prefaccounts.h"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC prefaccounts.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile debug\moc_prefaccounts.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;debug&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefaccounts.h -o debug\moc_prefaccounts.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;prefaccounts.h"
+						Outputs="debug\moc_prefaccounts.cpp"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC prefaccounts.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile release\moc_prefaccounts.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;release&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefaccounts.h -o release\moc_prefaccounts.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;prefaccounts.h"
+						Outputs="release\moc_prefaccounts.cpp"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="preferences\prefdialog.h"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC prefdialog.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile debug\moc_prefdialog.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;debug&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefdialog.h -o debug\moc_prefdialog.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;prefdialog.h"
+						Outputs="debug\moc_prefdialog.cpp"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC prefdialog.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile release\moc_prefdialog.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;release&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefdialog.h -o release\moc_prefdialog.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;prefdialog.h"
+						Outputs="release\moc_prefdialog.cpp"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="preferences\prefportaudio.h"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC prefportaudio.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile debug\moc_prefportaudio.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;debug&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefportaudio.h -o debug\moc_prefportaudio.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;prefportaudio.h"
+						Outputs="debug\moc_prefportaudio.cpp"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC prefportaudio.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile release\moc_prefportaudio.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;release&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefportaudio.h -o release\moc_prefportaudio.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;prefportaudio.h"
+						Outputs="release\moc_prefportaudio.cpp"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="preferences\prefsofia.h"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC prefsofia.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile debug\moc_prefsofia.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;debug&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefsofia.h -o debug\moc_prefsofia.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;prefsofia.h"
+						Outputs="debug\moc_prefsofia.cpp"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="MOC prefportaudio.h"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile release\moc_prefsofia.cpp&#x0D;&#x0A;$(QTDIR)\bin\moc.exe  -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I&quot;$(QTDIR)\include\QtCore&quot; -I&quot;$(QTDIR)\include\QtGui&quot; -I&quot;$(QTDIR)\include&quot; -I&quot;.&quot; -I&quot;$(QTDIR)\include\ActiveQt&quot; -I&quot;release&quot; -I&quot;.&quot; -I$(QTDIR)\mkspecs\win32-msvc2008 -D_MSC_VER=1500 -DWIN32 preferences\prefsofia.h -o release\moc_prefsofia.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;prefsofia.h"
+						Outputs="release\moc_prefsofia.cpp"
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="Generated Files"
+			Filter="moc;h;cpp"
+			UniqueIdentifier="{71ED8ED8-ACB9-4CE9-BBE1-E00B30144E11}"
+			>
+			<File
+				RelativePath="ui_accountdialog.h"
+				>
+			</File>
+			<File
+				RelativePath="ui_mainwindow.h"
+				>
+			</File>
+			<File
+				RelativePath="ui_prefdialog.h"
+				>
+			</File>
+			<Filter
+				Name="Debug"
+				>
+				<File
+					RelativePath="debug\moc_accountdialog.cpp"
+					>
+					<FileConfiguration
+						Name="Release|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="Debug\moc_fshost.cpp"
+					>
+					<FileConfiguration
+						Name="Release|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="debug\moc_mainwindow.cpp"
+					>
+					<FileConfiguration
+						Name="Release|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath=".\debug\moc_prefaccounts.cpp"
+					>
+					<FileConfiguration
+						Name="Release|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="Debug\moc_prefdialog.cpp"
+					>
+					<FileConfiguration
+						Name="Release|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="debug\moc_prefportaudio.cpp"
+					>
+					<FileConfiguration
+						Name="Release|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="debug\moc_prefsofia.cpp"
+					>
+					<FileConfiguration
+						Name="Release|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="debug\qrc_resources.cpp"
+					>
+					<FileConfiguration
+						Name="Release|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+				</File>
+			</Filter>
+			<Filter
+				Name="Release"
+				>
+				<File
+					RelativePath="release\moc_accountdialog.cpp"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="release\moc_fshost.cpp"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="release\moc_mainwindow.cpp"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath=".\release\moc_prefaccounts.cpp"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="release\moc_prefdialog.cpp"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="release\moc_prefportaudio.cpp"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="release\moc_prefsofia.cpp"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+				</File>
+				<File
+					RelativePath="release\qrc_resources.cpp"
+					>
+					<FileConfiguration
+						Name="Debug|Win32"
+						ExcludedFromBuild="true"
+						>
+						<Tool
+							Name="VCCLCompilerTool"
+						/>
+					</FileConfiguration>
+				</File>
+			</Filter>
+		</Filter>
+		<Filter
+			Name="Form Files"
+			Filter="ui"
+			UniqueIdentifier="{99349809-55BA-4b9d-BF79-8FDBB0286EB3}"
+			ParseFiles="false"
+			>
+			<File
+				RelativePath="preferences\accountdialog.ui"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="UIC accountdialog.ui"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile .\ui_accountdialog.h&#x0D;&#x0A;$(QTDIR)\bin\uic.exe preferences\accountdialog.ui -o ui_accountdialog.h&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;accountdialog.ui"
+						Outputs="ui_accountdialog.h"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="UIC accountdialog.ui"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile .\ui_accountdialog.h&#x0D;&#x0A;$(QTDIR)\bin\uic.exe preferences\accountdialog.ui -o ui_accountdialog.h&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;accountdialog.ui"
+						Outputs="ui_accountdialog.h"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="mainwindow.ui"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="UIC mainwindow.ui"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile .\ui_mainwindow.h&#x0D;&#x0A;$(QTDIR)\bin\uic.exe mainwindow.ui -o ui_mainwindow.h&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;mainwindow.ui"
+						Outputs="ui_mainwindow.h"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="UIC mainwindow.ui"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile .\ui_mainwindow.h&#x0D;&#x0A;$(QTDIR)\bin\uic.exe mainwindow.ui -o ui_mainwindow.h&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;mainwindow.ui"
+						Outputs="ui_mainwindow.h"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="preferences\prefdialog.ui"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="UIC prefdialog.ui"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile .\ui_prefdialog.h&#x0D;&#x0A;$(QTDIR)\bin\uic.exe preferences\prefdialog.ui -o ui_prefdialog.h&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;prefdialog.ui"
+						Outputs="ui_prefdialog.h"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="UIC prefdialog.ui"
+						CommandLine="Rem IncrediBuild_AllowRemote&#x0D;&#x0A;Rem IncrediBuild_OutputFile .\ui_prefdialog.h&#x0D;&#x0A;$(QTDIR)\bin\uic.exe preferences\prefdialog.ui -o ui_prefdialog.h&#x0D;&#x0A;"
+						AdditionalDependencies="Rem;prefdialog.ui"
+						Outputs="ui_prefdialog.h"
+					/>
+				</FileConfiguration>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="qrc;*"
+			UniqueIdentifier="{D9D6E242-F8AF-46E4-B9FD-80ECBC20BA3E}"
+			ParseFiles="false"
+			>
+			<File
+				RelativePath="conf\event_socket.conf.xml"
+				>
+			</File>
+			<File
+				RelativePath="conf\accounts\example.xml"
+				>
+			</File>
+			<File
+				RelativePath="conf\freeswitch.xml"
+				>
+			</File>
+			<File
+				RelativePath="conf\portaudio.conf.xml"
+				>
+			</File>
+			<File
+				RelativePath="resources\pref_audio.gif"
+				>
+			</File>
+			<File
+				RelativePath="resources\pref_sip.png"
+				>
+			</File>
+			<File
+				RelativePath="resources.qrc"
+				>
+				<FileConfiguration
+					Name="Debug|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="RCC resources.qrc"
+						CommandLine="$(QTDIR)\bin\rcc.exe -name resources resources.qrc -o debug\qrc_resources.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="$(QTDIR)\bin\rcc.exe;conf\accounts\example.xml;conf\event_socket.conf.xml;conf\freeswitch.xml;conf\portaudio.conf.xml;resources.qrc;resources\pref_audio.gif;resources\pref_sip.png;resources\splash.png"
+						Outputs="debug\qrc_resources.cpp"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release|Win32"
+					>
+					<Tool
+						Name="VCCustomBuildTool"
+						Description="RCC resources.qrc"
+						CommandLine="$(QTDIR)\bin\rcc.exe -name resources resources.qrc -o release\qrc_resources.cpp&#x0D;&#x0A;"
+						AdditionalDependencies="$(QTDIR)\bin\rcc.exe;conf\accounts\example.xml;conf\event_socket.conf.xml;conf\freeswitch.xml;conf\portaudio.conf.xml;resources.qrc;resources\pref_audio.gif;resources\pref_sip.png;resources\splash.png"
+						Outputs="release\qrc_resources.cpp"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
+				RelativePath="resources\splash.png"
+				>
+			</File>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/FSComm.pro

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/FSComm.pro (from rev 16612, freeswitch/trunk/fscomm/FSComm.pro) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/FSComm.pro	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/FSComm.pro	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,49 @@
+# #####################################
+# version check qt
+# #####################################
+contains(QT_VERSION, ^4\.[0-4]\..*) { 
+    message("Cannot build FsGui with Qt version $$QT_VERSION.")
+    error("Use at least Qt 4.5.")
+}
+QT += xml
+TARGET = fscomm
+macx:TARGET = FSComm
+TEMPLATE = app
+INCLUDEPATH = ../src/include \
+    ../libs/apr/include \
+    ../libs/libteletone/src
+LIBS = -L../.libs \
+    -lfreeswitch \
+    -lm
+!win32:!macx { 
+    # This is here to comply with the default freeswitch installation
+    QMAKE_LFLAGS += -Wl,-rpath,/usr/local/freeswitch/lib
+    LIBS += -lcrypt \
+        -lrt
+}
+SOURCES += main.cpp \
+    mainwindow.cpp \
+    fshost.cpp \
+    call.cpp \
+    mod_qsettings/mod_qsettings.cpp \
+    preferences/prefdialog.cpp \
+    preferences/prefportaudio.cpp \
+    preferences/prefsofia.cpp \
+    preferences/accountdialog.cpp \
+    preferences/prefaccounts.cpp \
+    account.cpp
+HEADERS += mainwindow.h \
+    fshost.h \
+    call.h \
+    mod_qsettings/mod_qsettings.h \
+    preferences/prefdialog.h \
+    preferences/prefportaudio.h \
+    preferences/prefsofia.h \
+    preferences/accountdialog.h \
+    preferences/prefaccounts.h \
+    account.h
+FORMS += mainwindow.ui \
+    preferences/prefdialog.ui \
+    preferences/accountdialog.ui
+RESOURCES += resources.qrc
+OTHER_FILES += conf/freeswitch.xml

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/account.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/account.cpp (from rev 16612, freeswitch/trunk/fscomm/account.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/account.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/account.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,31 @@
+#include <QtGui>
+#include "account.h"
+
+Account::Account(QString name) :
+    _name(name)
+{
+    _statusCode = QString();
+    _statusPhrase = QString();
+
+    QSettings settings;
+    settings.beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways");
+    foreach(QString g, settings.childGroups())
+    {
+        settings.beginGroup(g);
+        if(settings.value("gateway/attrs/name").toString() == name)
+        {
+            _uuid = g;
+            settings.endGroup();
+            break;
+        }
+        settings.endGroup();
+    }
+}
+
+QString Account::getStateName()
+{
+    if (_statusPhrase.isEmpty())
+        return fscomm_gw_state_names[_state];
+
+    return QString("%1 - %2").arg(fscomm_gw_state_names[_state], _statusPhrase);
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/account.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/account.h (from rev 16612, freeswitch/trunk/fscomm/account.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/account.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/account.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,51 @@
+#ifndef ACCOUNT_H
+#define ACCOUNT_H
+
+#include <QString>
+
+#define FSCOMM_GW_STATE_TRYING 0
+#define FSCOMM_GW_STATE_REGISTER 1
+#define FSCOMM_GW_STATE_REGED 2
+#define FSCOMM_GW_STATE_UNREGED 3
+#define FSCOMM_GW_STATE_UNREGISTER 4
+#define FSCOMM_GW_STATE_FAILED 5
+#define FSCOMM_GW_STATE_FAIL_WAIT 6
+#define FSCOMM_GW_STATE_EXPIRED 7
+#define FSCOMM_GW_STATE_NOREG 8
+#define FSCOMM_GW_STATE_NOAVAIL 9
+
+
+static QString fscomm_gw_state_names[] = {
+    QString("Trying"),
+    QString("Registering"),
+    QString("Registered"),
+    QString("Un-Registered"),
+    QString("Un-Registering"),
+    QString("Failed"),
+    QString("Failed"),
+    QString("Expired"),
+    QString("Not applicable"),
+    QString("Not available")
+};
+
+class Account {
+public:
+    explicit Account(QString name);
+    void setName(QString name) { _name = name; }
+    QString getName() { return _name; }
+    void setState(int state) { _state = state; }
+    int getState() { return _state; }
+    QString getStateName();
+    QString getUUID() { return _uuid; }
+    void setStausCode(QString code) { _statusCode = code; }
+    void setStatusPhrase(QString phrase) { _statusPhrase = phrase; }
+
+private:
+    QString _name;
+    int _state;
+    QString _uuid;
+    QString _statusCode;
+    QString _statusPhrase;
+};
+
+#endif // ACCOUNT_H

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/call.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/call.cpp (from rev 16612, freeswitch/trunk/fscomm/call.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/call.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/call.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,86 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita <jmesquita@freeswitch.org>
+ *
+ */
+
+#include "call.h"
+#include <QtGui>
+#include <fshost.h>
+
+Call::Call()
+{
+}
+
+Call::Call(int call_id, QString cid_name, QString cid_number, fscomm_call_direction_t direction, QString uuid) :
+        _call_id(call_id),
+        _cid_name(cid_name),
+        _cid_number(cid_number),
+        _direction(direction),
+        _uuid (uuid)
+{
+    _isActive = false;
+}
+
+switch_status_t Call::toggleRecord(bool startRecord)
+{
+    QDir conf_dir = QDir::home();
+    QString result;
+    switch_status_t status;
+
+    if (startRecord)
+    {
+        _recording_filename = QString("%1/.fscomm/recordings/%2_%3.wav").arg(
+                                         conf_dir.absolutePath(),
+                                         QDateTime::currentDateTime().toString("yyyyMMddhhmmss"),
+                                         _cid_number);
+        status = g_FSHost.sendCmd("uuid_record", QString("%1 start %2").arg(_uuid, _recording_filename).toAscii().data(),&result);
+    }
+    else
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Stopping call recording on call [%s]\n",
+                          _uuid.toAscii().data());
+        status = g_FSHost.sendCmd("uuid_record", QString("%1 stop %2").arg(_uuid, _recording_filename).toAscii().data(),&result);
+    }
+
+    return status;
+}
+
+void Call::sendDTMF(QString digit)
+{
+    QString result;
+    QString dtmf_string = QString("dtmf %1").arg(digit);
+    if (g_FSHost.sendCmd("pa", dtmf_string.toAscii(), &result) == SWITCH_STATUS_FALSE) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not send DTMF digit %s on call[%s]", digit.toAscii().data(), _uuid.toAscii().data());
+        QMessageBox::critical(0, QWidget::tr("DTMF Error"), QWidget::tr("There was an error sending DTMF, please report this bug."), QMessageBox::Ok);
+    }
+}
+
+QTime Call::getCurrentStateTime()
+{
+    int now = QDateTime::fromTime_t(_answered_epoch).secsTo(QDateTime::currentDateTime());
+    return QTime::fromString(QString::number(now), "s");
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/call.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/call.h (from rev 16612, freeswitch/trunk/fscomm/call.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/call.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/call.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,85 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita <jmesquita@freeswitch.org>
+ *
+ */
+#ifndef CALL_H
+#define CALL_H
+
+#include <QtCore>
+#include <QString>
+#include <switch.h>
+
+typedef enum {
+    FSCOMM_CALL_STATE_RINGING = 0,
+    FSCOMM_CALL_STATE_TRYING  = 1,
+    FSCOMM_CALL_STATE_ANSWERED = 2,
+    FSCOMM_CALL_STATE_FAILED = 3
+} fscomm_call_state_t;
+
+typedef enum {
+        FSCOMM_CALL_DIRECTION_INBOUND = 0,
+        FSCOMM_CALL_DIRECTION_OUTBOUND = 1
+} fscomm_call_direction_t;
+
+class Call {
+public:
+    Call();
+    Call(int call_id, QString cid_name, QString cid_number, fscomm_call_direction_t direction, QString uuid);
+    QString getCidName(void) { return _cid_name; }
+    QString getCidNumber(void) { return _cid_number; }
+    int getCallID(void) { return _call_id; }
+    QString getUUID(void) { return _uuid; }
+    void setbUUID(QString uuid) { _buuid = uuid; }
+    fscomm_call_direction_t getDirection() { return _direction; }
+    fscomm_call_state_t getState() { return _state; }
+    void setState(fscomm_call_state_t state) { _state = state; }
+    void setCause(QString cause) { _cause = cause; }
+    QString getCause() { return _cause; }
+    void setActive(bool isActive) { _isActive = isActive; }
+    bool isActive() { return _isActive == true; }
+    switch_status_t toggleRecord(bool);
+    void sendDTMF(QString digit);
+    void setAnsweredEpoch(qulonglong time) { _answered_epoch = time/1000000; }
+    QTime getCurrentStateTime();
+
+private:
+    int _call_id;
+    QString _cid_name;
+    QString _cid_number;
+    QString _cause;
+    fscomm_call_direction_t _direction;
+    QString _uuid;
+    QString _buuid;
+    bool _isActive;
+    QString _recording_filename;
+    fscomm_call_state_t _state;
+    qulonglong _answered_epoch;
+};
+
+Q_DECLARE_METATYPE(Call)
+
+#endif // CALL_H

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/conf (from rev 16612, freeswitch/trunk/fscomm/conf)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/conf/accounts (from rev 16612, freeswitch/trunk/fscomm/conf/accounts)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/conf/accounts/example.xml

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/conf/accounts/example.xml (from rev 16612, freeswitch/trunk/fscomm/conf/accounts/example.xml) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/conf/accounts/example.xml	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/conf/accounts/example.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,34 @@
+<include>
+  <!--<gateway name="default">-->
+  <!--/// account username *required* ///-->
+  <!--<param name="username" value="cluecon"/>-->
+  <!--/// auth realm: *optional* same as gateway name, if blank ///-->
+  <!--<param name="realm" value="asterlink.com"/>-->
+  <!--/// username to use in from: *optional* same as  username, if blank ///-->
+  <!--<param name="from-user" value="cluecon"/>-->
+  <!--/// domain to use in from: *optional* same as  realm, if blank ///-->
+  <!--<param name="from-domain" value="asterlink.com"/>-->
+  <!--/// account password *required* ///-->
+  <!--<param name="password" value="cluecon"/>-->
+  <!--/// extension for inbound calls: *optional* same as username, if blank ///-->
+  <!--<param name="extension" value="cluecon"/>-->
+  <!--/// proxy host: *optional* same as realm, if blank ///-->
+  <!--<param name="proxy" value="asterlink.com"/>-->
+  <!--/// send register to this proxy: *optional* same as proxy, if blank ///-->
+  <!--<param name="register-proxy" value="mysbc.com"/>-->
+  <!--/// expire in seconds: *optional* 3600, if blank ///-->
+  <!--<param name="expire-seconds" value="60"/>-->
+  <!--/// do not register ///-->
+  <!--<param name="register" value="false"/>-->
+  <!-- which transport to use for register -->
+  <!--<param name="register-transport" value="udp"/>-->
+  <!--How many seconds before a retry when a failure or timeout occurs -->
+  <!--<param name="retry-seconds" value="30"/>-->
+  <!--Use the callerid of an inbound call in the from field on outbound calls via this gateway -->
+  <!--<param name="caller-id-in-from" value="false"/>-->
+  <!--extra sip params to send in the contact-->
+  <!--<param name="contact-params" value="tport=tcp"/>-->
+  <!--send an options ping every x seconds, failure will unregister and/or mark it down-->
+  <!--<param name="ping" value="25"/>-->
+  <!--</gateway>-->
+</include>

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/conf/freeswitch.serial

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/conf/freeswitch.serial (from rev 16612, freeswitch/trunk/fscomm/conf/freeswitch.serial)


(Binary files differ)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/conf/freeswitch.xml

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/conf/freeswitch.xml (from rev 16612, freeswitch/trunk/fscomm/conf/freeswitch.xml) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/conf/freeswitch.xml	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/conf/freeswitch.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,309 @@
+<?xml version="1.0"?>
+<document type="freeswitch/xml">
+        <X-PRE-PROCESS cmd="set" data="auto_answer=false"/>
+        <X-PRE-PROCESS cmd="set" data="domain=$${local_ip_v4}"/>
+        <X-PRE-PROCESS cmd="set" data="hold_music=local_stream://moh"/>
+        <X-PRE-PROCESS cmd="set" data="codec_prefs=CELT@48000h,G7221@32000h,G7221@16000h,G722,PCMU,PCMA,GSM"/>
+        <X-PRE-PROCESS cmd="set" data="external_rtp_ip=stun:stun.freeswitch.org"/>
+        <X-PRE-PROCESS cmd="set" data="external_sip_ip=stun:stun.freeswitch.org"/>
+        <X-PRE-PROCESS cmd="set" data="console_loglevel=info"/>
+        <X-PRE-PROCESS cmd="set" data="us-ring=%(2000, 4000, 440.0, 480.0)"/>
+        <X-PRE-PROCESS cmd="set" data="bong-ring=v=-7;%(100,0,941.0,1477.0);v=-7;>=2;+=.1;%(1400,0,350,440)"/>
+        <X-PRE-PROCESS cmd="set" data="sit=%(274,0,913.8);%(274,0,1370.6);%(380,0,1776.7)"/>
+
+        <section name="configuration" description="Various Configuration">
+                <configuration name="cdr_csv.conf" description="CDR CSV Format">
+                        <settings>
+                                <param name="default-template" value="example"/>
+                                <param name="rotate-on-hup" value="true"/>
+                                <param name="legs" value="a"/>
+                        </settings>
+                        <templates>
+                                <template name="example">"${caller_id_name}","${caller_id_number}","${destination_number}","${context}","${start_stamp}","${answer_stamp}","${end_stamp}","${duration}","${billsec}","${hangup_cause}","${uuid}","${bleg_uuid}","${accountcode}","${read_codec}","${write_codec}"</template>
+                        </templates>
+                </configuration>
+
+                <configuration name="console.conf" description="Console Logger">
+                        <mappings>
+                                <map name="all" value="console,debug,info,notice,warning,err,crit,alert"/>
+                        </mappings>
+                        <settings>
+                                <param name="colorize" value="true"/>
+                                <param name="loglevel" value="$${console_loglevel}"/>
+                        </settings>
+                </configuration>
+
+                <configuration name="enum.conf" description="ENUM Module">
+                        <settings>
+                                <param name="default-root" value="e164.org"/>
+                                <param name="default-isn-root" value="freenum.org"/>
+                                <param name="query-timeout" value="10"/>
+                                <param name="auto-reload" value="true"/>
+                        </settings>
+                        <routes>
+                                <route service="E2U+SIP" regex="sip:(.*)" replace="sofia/softphone/$1"/>
+                        </routes>
+                </configuration>
+
+                <configuration name="qsettings.conf" description="configures our mod_qsettings">
+                        <bindings value="configuration" />
+                </configuration>
+
+                <configuration name="local_stream.conf" description="stream files from local dir">
+                        <directory name="moh/48000" path="$${base_dir}/sounds/music/48000">
+                                <param name="rate" value="48000"/>
+                                <param name="shuffle" value="true"/>
+                                <param name="channels" value="1"/>
+                                <param name="interval" value="10"/>
+                                <param name="timer-name" value="soft"/>
+                        </directory>
+                </configuration>
+
+                <configuration name="logfile.conf" description="File Logging">
+                        <settings>
+                                <param name="rotate-on-hup" value="true"/>
+                        </settings>
+                        <profiles>
+                                <profile name="default">
+                                        <settings>
+                                        </settings>
+                                        <mappings>
+                                                <map name="all" value="debug,info,notice,warning,err,crit,alert"/>
+                                        </mappings>
+                                </profile>
+                        </profiles>
+                </configuration>
+
+                <configuration name="modules.conf" description="Modules">
+                        <modules>
+                                <load module="mod_console"/>
+                                <load module="mod_logfile"/>
+                                <load module="mod_enum"/>
+                                <load module="mod_cdr_csv"/>
+                                <load module="mod_sofia"/>
+                                <load module="mod_loopback"/>
+                                <load module="mod_commands"/>
+                                <load module="mod_dptools"/>
+                                <load module="mod_dialplan_xml"/>
+                                <load module="mod_voipcodecs"/>
+                                <load module="mod_ilbc"/>
+                                <load module="mod_speex"/>
+                                <load module="mod_celt"/>
+                                <load module="mod_siren"/>
+                                <load module="mod_sndfile"/>
+                                <load module="mod_tone_stream"/>
+                                <load module="mod_local_stream"/>
+                                <load module="mod_portaudio"/>
+                                <load module="mod_event_socket"/>
+                        </modules>
+                </configuration>
+
+                <configuration name="portaudio.conf" description="Soundcard Endpoint">
+                  <settings>
+                    <param name="indev" value=""/>
+                    <!-- device to use for output -->
+                    <param name="outdev" value=""/>
+                    <!--<param name="ringdev" value=""/>-->
+                    <param name="ring-file" value="tone_stream://%(2000,4000,440.0,480.0);loops=20"/>
+                    <param name="ring-interval" value="5"/>
+                    <param name="hold-file" value="$${hold_music}"/>
+                    <!--<param name="timer-name" value="soft"/>-->
+                    <param name="dialplan" value="XML"/>
+                    <param name="cid-name" value="$${outbound_caller_name}"/>
+                    <param name="cid-num" value="$${outbound_caller_number}"/>
+                    <param name="sample-rate" value="48000"/>
+                    <param name="codec-ms" value="10"/>
+                  </settings>
+                </configuration>
+
+                <configuration name="event_socket.conf" description="Socket Client">
+                      <settings>
+                            <param name="nat-map" value="false"/>
+                            <param name="listen-ip" value="127.0.0.1"/>
+                            <param name="listen-port" value="8022"/>
+                            <param name="password" value="ClueCon"/>
+                      </settings>
+                </configuration>
+
+                <configuration name="post_load_modules.conf" description="Modules">
+                        <modules>
+                        </modules>
+                </configuration>
+
+                <configuration name="sofia.conf" description="sofia Endpoint">
+                        <global_settings>
+                                <param name="log-level" value="0"/>
+                                <param name="auto-restart" value="true"/>
+                                <param name="debug-presence" value="0"/>
+                        </global_settings>
+                        <profiles>
+                                <profile name="softphone">
+                                        <settings>
+                                                <!--<param name="media-option" value="bypass-media-after-att-xfer"/>-->
+                                                <param name="user-agent-string" value="FreeSWITCH/FSComm"/>
+                                                <!-- <param name="user-agent-string" value="FreeSWITCH Rocks!"/> -->
+                                                <param name="debug" value="0"/>
+                                                <param name="sip-trace" value="no"/>
+                                                <param name="context" value="public"/>
+                                                <param name="rfc2833-pt" value="101"/>
+                                                <!-- port to bind to for sip traffic -->
+                                                <param name="sip-port" value="12345"/>
+                                                <param name="dialplan" value="XML"/>
+                                                <param name="dtmf-duration" value="100"/>
+                                                <param name="codec-prefs" value="$${codec_prefs}"/>
+                                                <param name="use-rtp-timer" value="true"/>
+                                                <param name="rtp-timer-name" value="soft"/>
+                                                <!-- ip address to use for rtp, DO NOT USE HOSTNAMES ONLY IP ADDRESSES -->
+                                                <param name="rtp-ip" value="$${local_ip_v4}"/>
+                                                <!-- ip address to bind to, DO NOT USE HOSTNAMES ONLY IP ADDRESSES -->
+                                                <param name="sip-ip" value="$${local_ip_v4}"/>
+                                                <param name="hold-music" value="$${hold_music}"/>
+                                                <param name="apply-nat-acl" value="rfc1918"/>
+                                                <!--<param name="enable-timer" value="false"/>-->
+                                                <!--<param name="enable-100rel" value="true"/>-->
+                                                <!--<param name="minimum-session-expires" value="120"/>-->
+                                                <!--<param name="dtmf-type" value="info"/>-->
+                                                <param name="manage-presence" value="false"/>
+                                                <!--<param name="bitpacking" value="aal2"/> -->
+                                                <param name="max-proceeding" value="3"/>
+                                                <!--<param name="session-timeout" value="120"/>-->
+                                                <!--set to 'greedy' if you want your codec list to take precedence -->
+                                                <param name="inbound-codec-negotiation" value="generous"/>
+                                                <!-- if you want to send any special bind params of your own -->
+                                                <!--<param name="bind-params" value="transport=udp"/>-->
+                                                <!--Uncomment to let calls hit the dialplan *before* you decide if the codec is ok-->
+                                                <!--<param name="inbound-late-negotiation" value="true"/>-->
+                                                <!--<param name="accept-blind-reg" value="true"/> -->
+                                                <!--<param name="accept-blind-auth" value="true"/> -->
+                                                <!--<param name="suppress-cng" value="true"/> -->
+                                                <param name="nonce-ttl" value="60"/>
+                                                <!--<param name="NDLB-broken-auth-hash" value="true"/>-->
+                                                <!--<param name="NDLB-received-in-nat-reg-contact" value="true"/>-->
+                                                <param name="auth-calls" value="false"/>
+                                                <param name="auth-all-packets" value="false"/>
+                                                <param name="ext-rtp-ip" value="$${external_rtp_ip}"/>
+                                                <param name="ext-sip-ip" value="$${external_sip_ip}"/>
+                                                <!-- rtp inactivity timeout -->
+                                                <param name="rtp-timeout-sec" value="300"/>
+                                                <param name="rtp-hold-timeout-sec" value="1800"/>
+                                                <!-- VAD choose one (out is a good choice); -->
+                                                <!-- <param name="vad" value="in"/> -->
+                                                <!-- <param name="vad" value="out"/> -->
+                                                <!-- <param name="vad" value="both"/> -->
+                                                <param name="disable-register" value="true"/>
+                                                <!--<param name="NDLB-force-rport" value="true"/>-->
+                                                <param name="challenge-realm" value="auto_from"/>
+                                                <!--<param name="disable-rtp-auto-adjust" value="true"/>-->
+                                                <!--<param name="inbound-use-callid-as-uuid" value="true"/>-->
+                                                <!--<param name="outbound-use-uuid-as-callid" value="true"/>-->
+                                                <!--<param name="auto-rtp-bugs" data="clear"/>-->
+                                        </settings>
+                                </profile>
+                        </profiles>
+                </configuration>
+
+                <configuration name="switch.conf" description="Core Configuration">
+                        <cli-keybindings>
+                                <key name="1" value="help"/>
+                                <key name="2" value="status"/>
+                                <key name="3" value="pa answer"/>
+                                <key name="4" value="pa hangup"/>
+                                <key name="5" value="sofia status"/>
+                                <key name="6" value="reloadxml"/>
+                                <key name="7" value="console loglevel 0"/>
+                                <key name="8" value="console loglevel 7"/>
+                                <key name="9" value="sofia status profile softphone"/>
+                                <key name="10" value="fsctl pause"/>
+                                <key name="11" value="fsctl resume"/>
+                                <key name="12" value="version"/>
+                        </cli-keybindings>
+                        <settings>
+                                <param name="colorize-console" value="true"/>
+                                <param name="max-sessions" value="20"/>
+                                <param name="sessions-per-second" value="5"/>
+                                <param name="loglevel" value="debug"/>
+                                <param name="crash-protection" value="false"/>
+                                <param name="dump-cores" value="yes"/>
+                                <param name="rtp-start-port" value="16384"/>
+                                <param name="rtp-end-port" value="16484"/>
+                        </settings>
+                </configuration>
+        </section>
+
+        <section name="dialplan" description="Regex/XML Dialplan">
+                <context name="default">
+                        <extension name="codec_and_sip_uri">
+                                <condition field="destination_number" expression="^sip:(.*):(.*)$">
+                                        <action application="export" data="origination_caller_id_number=${fscomm_caller_id_num}"/>
+                                        <action application="export" data="origination_caller_id_name=${fscomm_caller_id_name}"/>
+                                        <action application="info"/>
+                                        <action application="bridge" data="{absolute_codec_string=$1}sofia/softphone/$2"/>
+                                </condition>
+                        </extension>
+                        <extension name="sip_uri">
+                                <condition field="destination_number" expression="^sip:(.*)$">
+                                        <action application="export" data="origination_caller_id_number=${fscomm_caller_id_num}"/>
+                                        <action application="export" data="origination_caller_id_name=${fscomm_caller_id_name}"/>
+                                        <action application="info"/>
+                                        <action application="bridge" data="sofia/softphone/$1"/>
+                                </condition>
+                        </extension>
+                        <extension name="codec_and_number">
+                                <condition field="destination_number" expression="^(.*):(.*)@(.*)$">
+                                        <action application="export" data="origination_caller_id_number=${fscomm_caller_id_num}"/>
+                                        <action application="export" data="origination_caller_id_name=${fscomm_caller_id_name}"/>
+                                        <action application="info"/>
+                                        <action application="bridge" data="{absolute_codec_string=$1}sofia/gateway/$3/$2"/>
+                                </condition>
+                        </extension>
+                        <extension name="number">
+                                <condition field="destination_number" expression="^(.*)@(.*)$">
+                                        <action application="export" data="origination_caller_id_number=${fscomm_caller_id_num}"/>
+                                        <action application="export" data="origination_caller_id_name=${fscomm_caller_id_name}"/>
+                                        <action application="info"/>
+                                        <action application="bridge" data="sofia/gateway/$2/$1"/>
+                                </condition>
+                        </extension>
+                        <extension name="number">
+                                <condition field="destination_number" expression="^(.*)$">
+                                 <!-- Default gateway is set by FSComm when default account is selected -->
+                                        <action application="export" data="origination_caller_id_number=${fscomm_caller_id_num}"/>
+                                        <action application="export" data="origination_caller_id_name=${fscomm_caller_id_name}"/>
+                                        <action application="info"/>
+                                        <action application="bridge" data="sofia/gateway/${default_gateway}/$1"/>
+                                </condition>
+                        </extension>
+                </context>
+                <context name="public">
+                        <extension name="public_extensions">
+                                <condition field="$${auto_answer}" expression="^true$"/>
+                                <condition field="destination_number" expression="^(.*)$">
+                                        <action application="export" data="origination_caller_id_number=${fscomm_caller_id_num}"/>
+                                        <action application="export" data="origination_caller_id_name=${fscomm_caller_id_name}"/>
+                                        <action application="info"/>
+                                        <action application="bridge" data="portaudio/auto_answer"/>
+                                </condition>
+                        </extension>
+                        <extension name="public_extensions">
+                                <condition field="${sip_to_params}" expression="intercom=true"/>
+                                <condition field="${alert_info}" expression="Ring;Answer"/>
+                                <condition field="destination_number" expression="^(.*)$">
+                                        <action application="export" data="origination_caller_id_number=${fscomm_caller_id_num}"/>
+                                        <action application="export" data="origination_caller_id_name=${fscomm_caller_id_name}"/>
+                                        <action application="info"/>
+                                        <action application="bridge" data="portaudio/auto_answer"/>
+                                </condition>
+                        </extension>
+                        <extension name="public_extensions">
+                                <condition field="destination_number" expression="^(.*)$">
+                                        <action application="export" data="origination_caller_id_number=${fscomm_caller_id_num}"/>
+                                        <action application="export" data="origination_caller_id_name=${fscomm_caller_id_name}"/>
+                                        <action application="info"/>
+                                        <action application="set" data="ringback=${us-ring}"/>
+                                        <action application="pre_answer"/>
+                                        <action application="bridge" data="portaudio"/>
+                                </condition>
+                        </extension>
+                </context>
+        </section>
+</document>

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/fshost.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/fshost.cpp (from rev 16612, freeswitch/trunk/fscomm/fshost.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/fshost.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/fshost.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,506 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita <jmesquita@freeswitch.org>
+ *
+ */
+
+#include <QtGui>
+#include "fshost.h"
+#include "mod_qsettings/mod_qsettings.h"
+
+/* Declare it globally */
+FSHost g_FSHost;
+
+FSHost::FSHost(QObject *parent) :
+    QThread(parent)
+{
+    /* Initialize libs & globals */
+    qDebug() << "Initializing globals..." << endl;
+    switch_core_setrlimits();
+    switch_core_set_globals();
+
+    qRegisterMetaType<QSharedPointer<Call> >("QSharedPointer<Call>");
+    qRegisterMetaType<QSharedPointer<Account> >("QSharedPointer<Account>");
+
+}
+
+void FSHost::createFolders()
+{
+    /* Create directory structure for softphone with default configs */
+    QDir conf_dir = QDir::home();
+    if (!conf_dir.exists(".fscomm"))
+        conf_dir.mkpath(".fscomm");
+    if (!conf_dir.exists(".fscomm/recordings"))
+        conf_dir.mkpath(".fscomm/recordings");
+    if (!conf_dir.exists(".fscomm/sounds")) {
+        conf_dir.mkpath(".fscomm/sounds");
+        QFile::copy(":/sounds/test.wav", QString("%1/.fscomm/sounds/test.wav").arg(QDir::homePath()));
+    }
+    if(!QFile::exists(QString("%1/.fscomm/conf/freeswitch.xml").arg(conf_dir.absolutePath()))) {
+        conf_dir.mkdir(".fscomm/conf");
+        QFile rootXML(":/confs/freeswitch.xml");
+        QString dest = QString("%1/.fscomm/conf/freeswitch.xml").arg(conf_dir.absolutePath());
+        rootXML.copy(dest);
+    }
+
+    /* Set all directories to the home user directory */
+    if (conf_dir.cd(".fscomm"))
+    {
+        SWITCH_GLOBAL_dirs.conf_dir = (char *) malloc(strlen(QString("%1/conf").arg(conf_dir.absolutePath()).toAscii().constData()) + 1);
+        if (!SWITCH_GLOBAL_dirs.conf_dir) {
+            emit coreLoadingError("Cannot allocate memory for conf_dir.");
+        }
+        strcpy(SWITCH_GLOBAL_dirs.conf_dir, QString("%1/conf").arg(conf_dir.absolutePath()).toAscii().constData());
+
+        SWITCH_GLOBAL_dirs.log_dir = (char *) malloc(strlen(QString("%1/log").arg(conf_dir.absolutePath()).toAscii().constData()) + 1);
+        if (!SWITCH_GLOBAL_dirs.log_dir) {
+            emit coreLoadingError("Cannot allocate memory for log_dir.");
+        }
+        strcpy(SWITCH_GLOBAL_dirs.log_dir, QString("%1/log").arg(conf_dir.absolutePath()).toAscii().constData());
+
+        SWITCH_GLOBAL_dirs.run_dir = (char *) malloc(strlen(QString("%1/run").arg(conf_dir.absolutePath()).toAscii().constData()) + 1);
+        if (!SWITCH_GLOBAL_dirs.run_dir) {
+            emit coreLoadingError("Cannot allocate memory for run_dir.");
+        }
+        strcpy(SWITCH_GLOBAL_dirs.run_dir, QString("%1/run").arg(conf_dir.absolutePath()).toAscii().constData());
+
+        SWITCH_GLOBAL_dirs.db_dir = (char *) malloc(strlen(QString("%1/db").arg(conf_dir.absolutePath()).toAscii().constData()) + 1);
+        if (!SWITCH_GLOBAL_dirs.db_dir) {
+            emit coreLoadingError("Cannot allocate memory for db_dir.");
+        }
+        strcpy(SWITCH_GLOBAL_dirs.db_dir, QString("%1/db").arg(conf_dir.absolutePath()).toAscii().constData());
+
+        SWITCH_GLOBAL_dirs.script_dir = (char *) malloc(strlen(QString("%1/script").arg(conf_dir.absolutePath()).toAscii().constData()) + 1);
+        if (!SWITCH_GLOBAL_dirs.script_dir) {
+            emit coreLoadingError("Cannot allocate memory for script_dir.");
+        }
+        strcpy(SWITCH_GLOBAL_dirs.script_dir, QString("%1/script").arg(conf_dir.absolutePath()).toAscii().constData());
+
+        SWITCH_GLOBAL_dirs.htdocs_dir = (char *) malloc(strlen(QString("%1/htdocs").arg(conf_dir.absolutePath()).toAscii().constData()) + 1);
+        if (!SWITCH_GLOBAL_dirs.htdocs_dir) {
+            emit coreLoadingError("Cannot allocate memory for htdocs_dir.");
+        }
+        strcpy(SWITCH_GLOBAL_dirs.htdocs_dir, QString("%1/htdocs").arg(conf_dir.absolutePath()).toAscii().constData());
+    }
+}
+
+void FSHost::run(void)
+{
+    switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT;
+    const char *err = NULL;
+    switch_bool_t console = SWITCH_FALSE;
+    switch_status_t destroy_status;
+
+    createFolders();
+
+    /* If you need to override configuration directories, you need to change them in the SWITCH_GLOBAL_dirs global structure */
+    qDebug() << "Initializing core..." << endl;
+    /* Initialize the core and load modules, that will startup FS completely */
+    if (switch_core_init(flags, console, &err) != SWITCH_STATUS_SUCCESS) {
+        fprintf(stderr, "Failed to initialize FreeSWITCH's core: %s\n", err);
+        emit coreLoadingError(err);
+    }
+
+    qDebug() << "Everything OK, Entering runtime loop ..." << endl;
+
+    if (switch_event_bind("FSHost", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, eventHandlerCallback, NULL) != SWITCH_STATUS_SUCCESS) {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
+    }
+
+    /* Load our QSettings module */
+    if (mod_qsettings_load() != SWITCH_STATUS_SUCCESS)
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't load mod_qsettings\n");
+    }
+
+    if (switch_core_init_and_modload(flags, console, &err) != SWITCH_STATUS_SUCCESS) {
+        fprintf(stderr, "Failed to initialize FreeSWITCH's core: %s\n", err);
+        emit coreLoadingError(err);
+    }
+
+    emit ready();
+    /* Go into the runtime loop. If the argument is true, this basically sets runtime.running = 1 and loops while that is set
+     * If its false, it initializes the libedit for the console, then does the same thing
+     */
+    switch_core_runtime_loop(!console);
+    fflush(stdout);
+
+
+    switch_event_unbind_callback(eventHandlerCallback);
+    /* When the runtime loop exits, its time to shutdown */
+    destroy_status = switch_core_destroy();
+    if (destroy_status == SWITCH_STATUS_SUCCESS)
+    {
+        qDebug() << "We have properly shutdown the core." << endl;
+    }
+}
+
+switch_status_t FSHost::processAlegEvent(switch_event_t * event, QString uuid)
+{
+    switch_status_t status = SWITCH_STATUS_SUCCESS;
+    QSharedPointer<Call> call = _active_calls.value(uuid);
+
+    if (call.isNull())
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "We don't have a call object for A leg on event %s.\n", switch_event_name(event->event_id));
+        qDebug() << _active_calls.keys();
+        printEventHeaders(event);
+        return SWITCH_STATUS_FALSE;
+    }
+
+    /* Inbound call */
+    if (call.data()->getDirection() == FSCOMM_CALL_DIRECTION_INBOUND)
+    {
+        switch(event->event_id) {
+        case SWITCH_EVENT_CHANNEL_ANSWER:
+            {
+                QString answeredEpoch = switch_event_get_header_nil(event, "Caller-Channel-Answered-Time");
+                call.data()->setAnsweredEpoch(answeredEpoch.toLong());
+                call.data()->setbUUID(switch_event_get_header_nil(event, "Other-Leg-Unique-ID"));
+                _bleg_uuids.insert(switch_event_get_header_nil(event, "Other-Leg-Unique-ID"), uuid);
+                call.data()->setState(FSCOMM_CALL_STATE_ANSWERED);
+                emit answered(call);
+                break;
+            }
+        case SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE:
+            {
+                emit hungup(_active_calls.take(uuid));
+                break;
+            }
+        case SWITCH_EVENT_CHANNEL_STATE:
+            {
+                qDebug() << QString("CHANNEL_STATE Answer-State: %1 | Channel-State: %2 | %3 | %4\n").arg(switch_event_get_header_nil(event, "Answer-State"),switch_event_get_header_nil(event, "Channel-State"), uuid.toAscii().constData(), switch_event_get_header_nil(event, "Other-Leg-Unique-ID"));
+                break;
+            }
+        default:
+            {
+                break;
+            }
+        }
+    }
+    /* Outbound call */
+    else
+    {
+        switch(event->event_id)
+        {
+        case SWITCH_EVENT_CHANNEL_BRIDGE:
+            {
+                _active_calls.value(uuid).data()->setbUUID(switch_event_get_header_nil(event, "Other-Leg-Unique-ID"));
+                _bleg_uuids.insert(switch_event_get_header_nil(event, "Other-Leg-Unique-ID"), uuid);
+                break;
+            }
+        case SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE:
+            {
+                if (call.data()->getState() == FSCOMM_CALL_STATE_TRYING)
+                {
+                    QString cause = switch_event_get_header_nil(event, "Hangup-Cause");
+                    call.data()->setState(FSCOMM_CALL_STATE_FAILED);
+                    call.data()->setCause(cause);
+                    emit callFailed(call);
+                    _active_calls.take(uuid);
+                }
+                break;
+            }
+        default:
+            qDebug() << QString("A leg: %1(%2)\n").arg(switch_event_name(event->event_id), switch_event_get_header_nil(event, "Event-Subclass"));
+            break;
+        }
+    }
+    return status;
+}
+
+switch_status_t FSHost::processBlegEvent(switch_event_t * event, QString buuid)
+{
+    QString uuid = _bleg_uuids.value(buuid);
+    switch_status_t status = SWITCH_STATUS_SUCCESS;
+    QSharedPointer<Call> call = _active_calls.value(uuid);
+
+    if (call.isNull())
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "We don't have a call object for B leg on event %s.\n", switch_event_name(event->event_id));
+        qDebug() << _active_calls.keys();
+        printEventHeaders(event);
+        return SWITCH_STATUS_FALSE;
+    }
+
+    /* Inbound call */
+    if (call.data()->getDirection() == FSCOMM_CALL_DIRECTION_INBOUND)
+    {
+        qDebug() << " Inbound call";
+    }
+    /* Outbound call */
+    else
+    {
+        switch(event->event_id)
+        {
+        case SWITCH_EVENT_CHANNEL_ANSWER:
+            {
+                /* When do we get here? */
+                QString answeredEpoch = switch_event_get_header_nil(event, "Caller-Channel-Answered-Time");
+                call.data()->setAnsweredEpoch(answeredEpoch.toULongLong());
+                emit answered(call);
+                break;
+            }
+        case SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE:
+            {
+                _active_calls.take(uuid);
+                emit hungup(call);
+                _bleg_uuids.take(buuid);
+                break;
+            }
+        case SWITCH_EVENT_CHANNEL_STATE:
+            {
+                if (QString(switch_event_get_header_nil(event, "Answer-State")) == "early")
+                {
+                    call.data()->setState(FSCOMM_CALL_STATE_RINGING);
+                    emit ringing(call);
+                }
+                else if (QString(switch_event_get_header_nil(event, "Answer-State")) == "answered")
+                {
+                    call.data()->setState(FSCOMM_CALL_STATE_ANSWERED);
+                    emit answered(call);
+                }
+                break;
+            }
+
+        default:
+            qDebug() << QString("B leg: %1(%2)\n").arg(switch_event_name(event->event_id), switch_event_get_header_nil(event, "Event-Subclass"));
+            break;
+        }
+    }
+    return status;
+}
+
+void FSHost::generalEventHandler(switch_event_t *event)
+{
+    /*printEventHeaders(event);*/
+    QString uuid = switch_event_get_header_nil(event, "Unique-ID");
+
+    if (_bleg_uuids.contains(uuid))
+    {
+        if (processBlegEvent(event, uuid) == SWITCH_STATUS_SUCCESS)
+        {
+            return;
+        }
+    }
+    if (_active_calls.contains(uuid))
+    {
+        if (processAlegEvent(event, uuid) == SWITCH_STATUS_SUCCESS)
+        {
+            return;
+        }
+    }
+
+    /* This is how we identify new calls, inbound and outbound */
+    switch(event->event_id) {
+    case SWITCH_EVENT_CUSTOM:
+        {
+            if (strcmp(event->subclass_name, "portaudio::ringing") == 0 && !_active_calls.contains(uuid))
+            {
+                Call *callPtr = new Call(atoi(switch_event_get_header_nil(event, "call_id")),
+                                      switch_event_get_header_nil(event, "Caller-Caller-ID-Name"),
+                                      switch_event_get_header_nil(event, "Caller-Caller-ID-Number"),
+                                      FSCOMM_CALL_DIRECTION_INBOUND,
+                                      uuid);
+                QSharedPointer<Call> call(callPtr);
+                _active_calls.insert(uuid, call);
+                call.data()->setState(FSCOMM_CALL_STATE_RINGING);
+                emit ringing(call);
+            }
+            else if (strcmp(event->subclass_name, "portaudio::makecall") == 0)
+            {
+                Call *callPtr = new Call(atoi(switch_event_get_header_nil(event, "call_id")),NULL,
+                                      switch_event_get_header_nil(event, "Caller-Destination-Number"),
+                                      FSCOMM_CALL_DIRECTION_OUTBOUND,
+                                      uuid);
+                QSharedPointer<Call> call(callPtr);
+                _active_calls.insert(uuid, call);
+                call.data()->setState(FSCOMM_CALL_STATE_TRYING);
+                emit newOutgoingCall(call);
+            }
+            else if (strcmp(event->subclass_name, "sofia::gateway_state") == 0)
+            {
+                QString state = switch_event_get_header_nil(event, "State");
+                QString gw = switch_event_get_header_nil(event, "Gateway");
+                QSharedPointer<Account> acc = _accounts.value(gw);
+                if (acc.isNull())
+                    return;
+
+                if (state == "TRYING") {
+                    acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
+                    acc.data()->setState(FSCOMM_GW_STATE_TRYING);
+                    emit accountStateChange(acc);
+                } else if (state == "REGISTER") {
+                    acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
+                    acc.data()->setState(FSCOMM_GW_STATE_REGISTER);
+                    emit accountStateChange(acc);
+                } else if (state == "REGED") {
+                    acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
+                    acc.data()->setState(FSCOMM_GW_STATE_REGED);
+                    emit accountStateChange(acc);
+                } else if (state == "UNREGED") {
+                    acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
+                    acc.data()->setState(FSCOMM_GW_STATE_UNREGED);
+                    emit accountStateChange(acc);
+                } else if (state == "UNREGISTER") {
+                    acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
+                    acc.data()->setState(FSCOMM_GW_STATE_UNREGISTER);
+                    emit accountStateChange(acc);
+                } else if (state =="FAILED") {
+                    acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
+                    acc.data()->setState(FSCOMM_GW_STATE_FAILED);
+                    emit accountStateChange(acc);
+                } else if (state == "FAIL_WAIT") {
+                    acc.data()->setState(FSCOMM_GW_STATE_FAIL_WAIT);
+                    emit accountStateChange(acc);
+                } else if (state == "EXPIRED") {
+                    acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
+                    acc.data()->setState(FSCOMM_GW_STATE_EXPIRED);
+                    emit accountStateChange(acc);
+                } else if (state == "NOREG") {
+                    acc.data()->setStatusPhrase(switch_event_get_header_nil(event, "Phrase"));
+                    acc.data()->setState(FSCOMM_GW_STATE_NOREG);
+                    emit accountStateChange(acc);
+                }
+            }
+            else if (strcmp(event->subclass_name, "sofia::gateway_add") == 0)
+            {
+                QString gw = switch_event_get_header_nil(event, "Gateway");
+                Account * accPtr = new Account(gw);
+                QSharedPointer<Account> acc = QSharedPointer<Account>(accPtr);
+                acc.data()->setState(FSCOMM_GW_STATE_NOAVAIL);
+                _accounts.insert(gw, acc);
+                emit newAccount(acc);
+            }
+            else if (strcmp(event->subclass_name, "sofia::gateway_delete") == 0)
+            {
+                QSharedPointer<Account> acc = _accounts.take(switch_event_get_header_nil(event, "Gateway"));
+                if (!acc.isNull())
+                    emit delAccount(acc);
+            }
+            else
+            {
+                printEventHeaders(event);
+            }
+            break;
+        }
+    default:
+        break;
+    }
+}
+
+void FSHost::accountReloadCmd(QSharedPointer<Account> acc)
+{
+    QString res;
+    QString arg = QString("profile softphone killgw %1").arg(acc.data()->getName());
+
+    connect(this, SIGNAL(delAccount(QSharedPointer<Account>)), this, SLOT(accountReloadSlot(QSharedPointer<Account>)));
+
+    if (g_FSHost.sendCmd("sofia", arg.toAscii().data() , &res) != SWITCH_STATUS_SUCCESS)
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not killgw %s from profile softphone.\n",
+                          acc.data()->getName().toAscii().data());
+    }
+    _reloading_Accounts.append(acc.data()->getName());
+}
+
+void FSHost::accountReloadSlot(QSharedPointer<Account> acc)
+{
+    if (_reloading_Accounts.contains(acc.data()->getName()))
+    {
+        _reloading_Accounts.takeAt(_reloading_Accounts.indexOf(acc.data()->getName(), 0));
+        QString res;
+        if (g_FSHost.sendCmd("sofia", "profile softphone rescan", &res) != SWITCH_STATUS_SUCCESS)
+        {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not rescan the softphone profile.\n");
+            return;
+        }
+        if (_reloading_Accounts.isEmpty())
+            disconnect(this, SLOT(accountReloadSlot(QSharedPointer<Account>)));
+    }
+}
+
+switch_status_t FSHost::sendCmd(const char *cmd, const char *args, QString *res)
+{
+    switch_status_t status = SWITCH_STATUS_FALSE;
+    switch_stream_handle_t stream = { 0 };
+    SWITCH_STANDARD_STREAM(stream);
+    qDebug() << "Sending command: " << cmd << args << endl;
+    status = switch_api_execute(cmd, args, NULL, &stream);
+    *res = switch_str_nil((char *) stream.data);
+    switch_safe_free(stream.data);
+
+    return status;
+}
+
+QSharedPointer<Account> FSHost::getAccountByUUID(QString uuid)
+{
+    foreach(QSharedPointer<Account> acc, _accounts.values())
+    {
+        if (acc.data()->getUUID() == uuid)
+            return acc;
+    }
+    return QSharedPointer<Account>();
+}
+
+QSharedPointer<Call> FSHost::getCurrentActiveCall()
+{
+    foreach(QSharedPointer<Call> call, _active_calls.values())
+    {
+        if (call.data()->isActive())
+            return call;
+    }
+    return QSharedPointer<Call>();
+}
+
+void FSHost::printEventHeaders(switch_event_t *event)
+{
+    switch_event_header_t *hp;
+    qDebug() << QString("Received event: %1(%2)\n").arg(switch_event_name(event->event_id), switch_event_get_header_nil(event, "Event-Subclass"));
+    for (hp = event->headers; hp; hp = hp->next) {
+        qDebug() << hp->name << "=" << hp->value;
+    }
+    qDebug() << "\n\n";
+}
+
+QSharedPointer<Account> FSHost::getAccountByName(QString accStr)
+{
+    foreach(QSharedPointer<Account> acc, _accounts.values())
+    {
+        if (acc.data()->getName() == accStr)
+            return acc;
+    }
+    return QSharedPointer<Account>();
+}
+
+QSharedPointer<Account> FSHost::getCurrentDefaultAccount()
+{
+    QSettings settings;
+    settings.beginGroup("FreeSWITCH/conf/globals");
+    QString accString = settings.value("default_gateway").toString();
+    settings.endGroup();
+    return getAccountByName(accString);
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/fshost.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/fshost.h (from rev 16612, freeswitch/trunk/fscomm/fshost.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/fshost.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/fshost.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,99 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita <jmesquita@freeswitch.org>
+ *
+ */
+#ifndef FSHOST_H
+#define FSHOST_H
+
+#include <QThread>
+#include <QHash>
+#include <QSharedPointer>
+#include <switch.h>
+#include "call.h"
+#include "account.h"
+
+class FSHost : public QThread
+{
+Q_OBJECT
+public:
+    explicit FSHost(QObject *parent = 0);
+    switch_status_t sendCmd(const char *cmd, const char *args, QString *res);
+    void generalEventHandler(switch_event_t *event);
+    QSharedPointer<Call> getCallByUUID(QString uuid) { return _active_calls.value(uuid); }
+    QSharedPointer<Call> getCurrentActiveCall();
+    QList<QSharedPointer<Account> > getAccounts() { return _accounts.values(); }
+    QSharedPointer<Account> getAccountByUUID(QString uuid);
+    QSharedPointer<Account> getCurrentDefaultAccount();
+    QSharedPointer<Account> getAccountByName(QString accStr);
+    void accountReloadCmd(QSharedPointer<Account> acc);
+
+protected:
+    void run(void);
+
+signals:
+    void coreLoadingError(QString);
+    void ready(void);
+    void ringing(QSharedPointer<Call>);
+    void answered(QSharedPointer<Call>);
+    void newOutgoingCall(QSharedPointer<Call>);
+    void callFailed(QSharedPointer<Call>);
+    void hungup(QSharedPointer<Call>);
+    void accountStateChange(QSharedPointer<Account>);
+    void newAccount(QSharedPointer<Account>);
+    void delAccount(QSharedPointer<Account>);
+
+private slots:
+    /* We need to wait for the gateway deletion before reloading it */
+    void accountReloadSlot(QSharedPointer<Account>);
+
+private:
+    switch_status_t processBlegEvent(switch_event_t *, QString);
+    switch_status_t processAlegEvent(switch_event_t *, QString);
+    void createFolders();
+    void printEventHeaders(switch_event_t *event);
+    QHash<QString, QSharedPointer<Call> > _active_calls;
+    QHash<QString, QSharedPointer<Account> > _accounts;
+    QHash<QString, QString> _bleg_uuids;
+    QList<QString> _reloading_Accounts;
+};
+
+extern FSHost g_FSHost;
+
+/*
+   Used to match callback from fs core. We dup the event and call the class
+   method callback to make use of the signal/slot infrastructure.
+*/
+static void eventHandlerCallback(switch_event_t *event)
+{
+    switch_event_t *clone = NULL;
+    if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) {
+        g_FSHost.generalEventHandler(clone);
+    }
+    switch_safe_free(clone);
+}
+
+#endif // FSHOST_H

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/main.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/main.cpp (from rev 16612, freeswitch/trunk/fscomm/main.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/main.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/main.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,51 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita <jmesquita@freeswitch.org>
+ *
+ */
+
+#include <QtGui/QApplication>
+#include <QSplashScreen>
+#include "mainwindow.h"
+
+int main(int argc, char *argv[])
+{
+    QApplication a(argc, argv);
+    QCoreApplication::setOrganizationName("FreeSWITCH");
+    QCoreApplication::setOrganizationDomain("freeswitch.org");
+    QCoreApplication::setApplicationName("FSComm");
+
+    QPixmap image(":/images/splash.png");
+    QSplashScreen *splash = new QSplashScreen(image);
+    splash->show();
+    splash->showMessage("Loading, please wait...", Qt::AlignRight|Qt::AlignBottom, Qt::blue);
+
+    QObject::connect(&g_FSHost, SIGNAL(ready()), splash, SLOT(close()));
+    MainWindow w;    
+    QObject::connect(&g_FSHost, SIGNAL(ready()), &w, SLOT(show()));
+    g_FSHost.start();
+    return a.exec();
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/mainwindow.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/mainwindow.cpp (from rev 16612, freeswitch/trunk/fscomm/mainwindow.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/mainwindow.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/mainwindow.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,572 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita <jmesquita@freeswitch.org>
+ *
+ */
+
+#include <QInputDialog>
+#include <QMessageBox>
+#include "mainwindow.h"
+#include "ui_mainwindow.h"
+#include <switch_version.h>
+
+MainWindow::MainWindow(QWidget *parent) :
+    QMainWindow(parent),
+    ui(new Ui::MainWindow),
+    preferences(NULL)
+{
+    ui->setupUi(this);
+
+    /* Setup the taskbar icon */
+    sysTray = new QSystemTrayIcon(QIcon(":/images/taskbar_icon"), this);
+    sysTray->setToolTip(tr("FSComm"));
+
+    /* Connect DTMF buttons */
+    dialpadMapper = new QSignalMapper(this);
+    connect(ui->dtmf0Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmf1Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmf2Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmf3Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmf4Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmf5Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmf6Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmf7Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmf8Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmf9Btn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmfABtn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmfBBtn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmfCBtn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmfDBtn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmfAstBtn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    connect(ui->dtmfPoundBtn, SIGNAL(clicked()), dialpadMapper, SLOT(map()));
+    dialpadMapper->setMapping(ui->dtmf0Btn, QString("0"));
+    dialpadMapper->setMapping(ui->dtmf1Btn, QString("1"));
+    dialpadMapper->setMapping(ui->dtmf2Btn, QString("2"));
+    dialpadMapper->setMapping(ui->dtmf3Btn, QString("3"));
+    dialpadMapper->setMapping(ui->dtmf4Btn, QString("4"));
+    dialpadMapper->setMapping(ui->dtmf5Btn, QString("5"));
+    dialpadMapper->setMapping(ui->dtmf6Btn, QString("6"));
+    dialpadMapper->setMapping(ui->dtmf7Btn, QString("7"));
+    dialpadMapper->setMapping(ui->dtmf8Btn, QString("8"));
+    dialpadMapper->setMapping(ui->dtmf9Btn, QString("9"));
+    dialpadMapper->setMapping(ui->dtmfABtn, QString("A"));
+    dialpadMapper->setMapping(ui->dtmfBBtn, QString("B"));
+    dialpadMapper->setMapping(ui->dtmfCBtn, QString("C"));
+    dialpadMapper->setMapping(ui->dtmfDBtn, QString("D"));
+    dialpadMapper->setMapping(ui->dtmfAstBtn, QString("*"));
+    dialpadMapper->setMapping(ui->dtmfPoundBtn, QString("#"));
+    connect(dialpadMapper, SIGNAL(mapped(QString)), this, SLOT(sendDTMF(QString)));
+
+    /* Connect events related to FreeSWITCH */
+    connect(&g_FSHost, SIGNAL(ready()),this, SLOT(fshostReady()));
+    connect(&g_FSHost, SIGNAL(ringing(QSharedPointer<Call>)), this, SLOT(ringing(QSharedPointer<Call>)));
+    connect(&g_FSHost, SIGNAL(answered(QSharedPointer<Call>)), this, SLOT(answered(QSharedPointer<Call>)));
+    connect(&g_FSHost, SIGNAL(hungup(QSharedPointer<Call>)), this, SLOT(hungup(QSharedPointer<Call>)));
+    connect(&g_FSHost, SIGNAL(newOutgoingCall(QSharedPointer<Call>)), this, SLOT(newOutgoingCall(QSharedPointer<Call>)));
+    connect(&g_FSHost, SIGNAL(callFailed(QSharedPointer<Call>)), this, SLOT(callFailed(QSharedPointer<Call>)));
+    connect(&g_FSHost, SIGNAL(accountStateChange(QSharedPointer<Account>)), this, SLOT(accountStateChanged(QSharedPointer<Account>)));
+    connect(&g_FSHost, SIGNAL(newAccount(QSharedPointer<Account>)), this, SLOT(accountAdd(QSharedPointer<Account>)));
+    connect(&g_FSHost, SIGNAL(delAccount(QSharedPointer<Account>)), this, SLOT(accountDel(QSharedPointer<Account>)));
+    /*connect(&g_FSHost, SIGNAL(coreLoadingError(QString)), this, SLOT(coreLoadingError(QString)));*/
+
+    /* Connect call commands */
+    connect(ui->newCallBtn, SIGNAL(clicked()), this, SLOT(makeCall()));
+    connect(ui->answerBtn, SIGNAL(clicked()), this, SLOT(paAnswer()));
+    connect(ui->hangupBtn, SIGNAL(clicked()), this, SLOT(paHangup()));
+    connect(ui->recoredCallBtn, SIGNAL(toggled(bool)), SLOT(recordCall(bool)));
+    connect(ui->tableCalls, SIGNAL(itemDoubleClicked(QTableWidgetItem*)), this, SLOT(callTableDoubleClick(QTableWidgetItem*)));
+    connect(ui->action_Preferences, SIGNAL(triggered()), this, SLOT(prefTriggered()));
+    connect(ui->action_Exit, SIGNAL(triggered()), this, SLOT(close()));
+    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(showAbout()));
+    connect(ui->actionSetDefaultAccount, SIGNAL(triggered(bool)), this, SLOT(setDefaultAccount()));
+    connect(sysTray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(sysTrayActivated(QSystemTrayIcon::ActivationReason)));
+
+    /* Set the context menus */
+    ui->tableAccounts->addAction(ui->actionSetDefaultAccount);
+
+    /* Set other properties */
+    ui->tableAccounts->horizontalHeader()->setStretchLastSection(true);
+
+    /* Set the call timer */
+    callTimer = new QTimer(this);
+    callTimer->setInterval(1000);
+    connect(callTimer, SIGNAL(timeout()), this, SLOT(updateCallTimers()));
+    callTimer->start();
+}
+
+MainWindow::~MainWindow()
+{
+    delete ui;
+    QString res;
+    g_FSHost.sendCmd("fsctl", "shutdown", &res);
+    g_FSHost.wait();
+}
+
+void MainWindow::updateCallTimers()
+{
+    for(int row=0; row<ui->tableCalls->rowCount(); row++)
+    {
+        QTableWidgetItem* item = ui->tableCalls->item(row, 2);
+        QSharedPointer<Call> call = g_FSHost.getCallByUUID(item->data(Qt::UserRole).toString());
+        QTime time = call.data()->getCurrentStateTime();
+        item->setText(time.toString("hh:mm:ss"));
+        item->setTextAlignment(Qt::AlignRight);
+    }
+}
+
+void MainWindow::setDefaultAccount()
+{
+    QString accName = ui->tableAccounts->item(ui->tableAccounts->selectedRanges()[0].topRow(), 0)->text();
+
+    if (accName.isEmpty())
+        return;
+
+    QSettings settings;
+    settings.beginGroup("FreeSWITCH/conf/globals");
+    switch_core_set_variable("default_gateway", accName.toAscii().data());
+    settings.setValue("default_gateway", accName);
+    settings.endGroup();
+}
+
+void MainWindow::prefTriggered()
+{
+    if (!preferences)
+        preferences = new PrefDialog();
+
+    preferences->raise();
+    preferences->show();
+    preferences->activateWindow();
+}
+
+void MainWindow::coreLoadingError(QString err)
+{
+    QMessageBox::warning(this, "Error Loading Core...", err, QMessageBox::Ok);
+    QApplication::exit(255);
+}
+
+void MainWindow::accountAdd(QSharedPointer<Account> acc)
+{
+    ui->tableAccounts->setRowCount(ui->tableAccounts->rowCount()+1);
+    QTableWidgetItem *gwField = new QTableWidgetItem(acc.data()->getName());
+    QTableWidgetItem *stField = new QTableWidgetItem(acc.data()->getStateName());
+    ui->tableAccounts->setItem(ui->tableAccounts->rowCount()-1,0,gwField);
+    ui->tableAccounts->setItem(ui->tableAccounts->rowCount()-1,1,stField);
+    ui->tableAccounts->resizeColumnsToContents();
+    ui->tableAccounts->resizeRowsToContents();
+    ui->tableAccounts->horizontalHeader()->setStretchLastSection(true);
+}
+
+void MainWindow::accountDel(QSharedPointer<Account> acc)
+{
+    foreach (QTableWidgetItem *i, ui->tableAccounts->findItems(acc.data()->getName(), Qt::MatchExactly))
+    {
+        if (i->text() == acc.data()->getName())
+        {
+            ui->tableAccounts->removeRow(i->row());
+            //ui->tableAccounts->setRowCount(ui->tableAccounts->rowCount()-1);
+            ui->tableAccounts->resizeColumnsToContents();
+            ui->tableAccounts->resizeRowsToContents();
+            ui->tableAccounts->horizontalHeader()->setStretchLastSection(true);
+            break;
+        }
+    }
+}
+
+void MainWindow::accountStateChanged(QSharedPointer<Account> acc)
+{
+    ui->statusBar->showMessage(tr("Account %1 is %2").arg(acc.data()->getName(), acc.data()->getStateName()));
+    foreach (QTableWidgetItem *i, ui->tableAccounts->findItems(acc.data()->getName(), Qt::MatchExactly))
+    {
+        if (i->text() == acc.data()->getName())
+        {
+            ui->tableAccounts->item(i->row(), 1)->setText(acc.data()->getStateName());
+            ui->tableAccounts->resizeColumnsToContents();
+            ui->tableAccounts->resizeRowsToContents();
+            ui->tableAccounts->horizontalHeader()->setStretchLastSection(true);
+            return;
+        }
+    }
+}
+
+void MainWindow::sendDTMF(QString dtmf)
+{
+    g_FSHost.getCurrentActiveCall().data()->sendDTMF(dtmf);
+}
+
+void MainWindow::callTableDoubleClick(QTableWidgetItem *item)
+{
+    QSharedPointer<Call> lastCall = g_FSHost.getCurrentActiveCall();
+    QSharedPointer<Call> call = g_FSHost.getCallByUUID(item->data(Qt::UserRole).toString());
+    QString switch_str = QString("switch %1").arg(call.data()->getCallID());
+    QString result;
+    if (g_FSHost.sendCmd("pa", switch_str.toAscii(), &result) == SWITCH_STATUS_FALSE) {
+        ui->textEdit->setText(QString("Error switching to call %1").arg(call.data()->getCallID()));
+        return;
+    }
+    ui->hangupBtn->setEnabled(true);
+    /* Last call was hungup and we are switching */
+    if (!lastCall.isNull())
+        lastCall.data()->setActive(false);
+    call.data()->setActive(true);
+}
+
+void MainWindow::makeCall()
+{
+    bool ok;
+    QString dialstring = QInputDialog::getText(this, tr("Make new call"),
+                                         tr("Number to dial:"), QLineEdit::Normal, NULL,&ok);
+
+    QSharedPointer<Account> acc = g_FSHost.getCurrentDefaultAccount();
+    if (!acc.isNull()) {
+        QSettings settings;
+        settings.beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways/");
+        settings.beginGroup(acc.data()->getUUID());
+        settings.beginGroup("gateway/global_vars");
+        QString cidName = settings.value("caller_id_name").toString();
+        QString cidNum = settings.value("caller_id_num").toString();
+        settings.endGroup();
+        settings.endGroup();
+        settings.endGroup();
+
+        if (cidName.isEmpty()) {
+            settings.beginGroup("FreeSWITCH/conf/portaudio.conf/settings/params");
+            cidName = settings.value("cid-name").toString();
+            settings.endGroup();
+        }
+        if (cidNum.isEmpty()) {
+            settings.beginGroup("FreeSWITCH/conf/portaudio.conf/settings/params");
+            cidNum = settings.value("cid-num").toString();
+            settings.endGroup();
+        }
+
+        /* Set the vars for this call */
+        switch_core_set_variable("fscomm_caller_id_name", cidName.toAscii().data());
+        switch_core_set_variable("fscomm_caller_id_num", cidNum.toAscii().data());
+
+        qDebug() << "Name:" << cidName << "Num:" << cidNum;
+    }
+
+    if (ok && !dialstring.isEmpty())
+    {
+        paCall(dialstring);
+    }
+}
+
+void MainWindow::fshostReady()
+{
+    ui->statusBar->showMessage("Ready");
+    ui->newCallBtn->setEnabled(true);
+    ui->textEdit->setEnabled(true);
+    ui->textEdit->setText("Ready to dial and receive calls!");
+    sysTray->show();
+    sysTray->showMessage(tr("Status"), tr("FSComm has initialized!"), QSystemTrayIcon::Information, 5000);
+}
+
+void MainWindow::paAnswer()
+{
+    QString result;
+    if (g_FSHost.sendCmd("pa", "answer", &result) == SWITCH_STATUS_FALSE) {
+        ui->textEdit->setText("Error sending that command");
+    }
+
+    ui->textEdit->setText("Talking...");
+    ui->hangupBtn->setEnabled(true);
+    ui->answerBtn->setEnabled(false);
+}
+
+void MainWindow::paCall(QString dialstring)
+{
+    QString result;
+
+    QString callstring = QString("call %1").arg(dialstring);
+
+    if (g_FSHost.sendCmd("pa", callstring.toAscii(), &result) == SWITCH_STATUS_FALSE) {
+        ui->textEdit->setText("Error sending that command");
+    }
+
+    ui->hangupBtn->setEnabled(true);
+}
+
+void MainWindow::paHangup()
+{
+    QString result;
+    if (g_FSHost.sendCmd("pa", "hangup", &result) == SWITCH_STATUS_FALSE) {
+        ui->textEdit->setText("Error sending that command");
+    }
+
+    ui->textEdit->setText("Click to dial number...");
+    ui->statusBar->showMessage("Call hungup");
+    ui->hangupBtn->setEnabled(false);
+}
+
+void MainWindow::recordCall(bool pressed)
+{
+    QSharedPointer<Call> call = g_FSHost.getCurrentActiveCall();
+
+    if (call.isNull())
+    {
+        QMessageBox::warning(this,tr("Record call"),
+                             tr("<p>FSComm reports that there are no active calls to be recorded."
+                                "<p>Please report this bug."),
+                             QMessageBox::Ok);
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not record call because there is not current active call!.\n");
+        return;
+    }
+
+    if (call.data()->toggleRecord(pressed) != SWITCH_STATUS_SUCCESS)
+    {
+        QMessageBox::warning(this,tr("Record call"),
+                             tr("<p>Could not get active call to start/stop recording."
+                                "<p>Please report this bug."),
+                             QMessageBox::Ok);
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not record call [%s].\n", call.data()->getUUID().toAscii().data());
+        return;
+    }
+}
+
+void MainWindow::newOutgoingCall(QSharedPointer<Call> call)
+{
+    ui->textEdit->setText(QString("Calling %1 (%2)").arg(call.data()->getCidName(), call.data()->getCidNumber()));
+
+    ui->tableCalls->setRowCount(ui->tableCalls->rowCount()+1);
+    QTableWidgetItem *item0 = new QTableWidgetItem(QString("%1 (%2)").arg(call.data()->getCidName(), call.data()->getCidNumber()));
+    item0->setData(Qt::UserRole, call.data()->getUUID());
+    ui->tableCalls->setItem(ui->tableCalls->rowCount()-1,0,item0);
+
+    QTableWidgetItem *item1 = new QTableWidgetItem(tr("Dialing..."));
+    item1->setData(Qt::UserRole, call.data()->getUUID());
+    ui->tableCalls->setItem(ui->tableCalls->rowCount()-1,1,item1);
+
+    QTableWidgetItem *item2 = new QTableWidgetItem("00:00:00");
+    item2->setData(Qt::UserRole, call.data()->getUUID());
+    ui->tableCalls->setItem(ui->tableCalls->rowCount()-1,2,item2);
+
+    ui->tableCalls->resizeColumnsToContents();
+    ui->tableCalls->resizeRowsToContents();
+    ui->tableCalls->horizontalHeader()->setStretchLastSection(true);
+
+    ui->hangupBtn->setEnabled(true);
+    call.data()->setActive(true);
+}
+
+void MainWindow::ringing(QSharedPointer<Call> call)
+{
+
+    for (int i=0; i<ui->tableCalls->rowCount(); i++)
+    {
+        QTableWidgetItem *item = ui->tableCalls->item(i, 1);
+        if (item->data(Qt::UserRole).toString() == call.data()->getUUID())
+        {
+            item->setText(tr("Ringing"));
+            ui->textEdit->setText(QString("Call from %1 (%2)").arg(call.data()->getCidName(), call.data()->getCidNumber()));
+            return;
+        }
+    }
+
+    ui->textEdit->setText(QString("Call from %1 (%2)").arg(call.data()->getCidName(), call.data()->getCidNumber()));
+
+    ui->tableCalls->setRowCount(ui->tableCalls->rowCount()+1);
+    QTableWidgetItem *item0 = new QTableWidgetItem(QString("%1 (%2)").arg(call.data()->getCidName(), call.data()->getCidNumber()));
+    item0->setData(Qt::UserRole, call.data()->getUUID());
+    ui->tableCalls->setItem(ui->tableCalls->rowCount()-1,0,item0);
+
+    QTableWidgetItem *item1 = new QTableWidgetItem(tr("Ringing"));
+    item1->setData(Qt::UserRole, call.data()->getUUID());
+    ui->tableCalls->setItem(ui->tableCalls->rowCount()-1,1,item1);
+
+    QTableWidgetItem *item2 = new QTableWidgetItem("00:00:00");
+    item2->setData(Qt::UserRole, call.data()->getUUID());
+    ui->tableCalls->setItem(ui->tableCalls->rowCount()-1,2,item2);
+
+    ui->tableCalls->resizeColumnsToContents();
+    ui->tableCalls->resizeRowsToContents();
+    ui->tableCalls->horizontalHeader()->setStretchLastSection(true);
+
+    ui->answerBtn->setEnabled(true);
+    call.data()->setActive(true);
+}
+
+void MainWindow::answered(QSharedPointer<Call> call)
+{
+    for (int i=0; i<ui->tableCalls->rowCount(); i++)
+    {
+        QTableWidgetItem *item = ui->tableCalls->item(i, 1);
+        if (item->data(Qt::UserRole).toString() == call.data()->getUUID())
+        {
+            item->setText(tr("Answered"));
+            ui->tableCalls->resizeColumnsToContents();
+            ui->tableCalls->resizeRowsToContents();
+            ui->tableCalls->horizontalHeader()->setStretchLastSection(true);
+            break;
+        }
+    }
+    ui->recoredCallBtn->setEnabled(true);
+    ui->recoredCallBtn->setChecked(false);
+    ui->dtmf0Btn->setEnabled(true);
+    ui->dtmf1Btn->setEnabled(true);
+    ui->dtmf2Btn->setEnabled(true);
+    ui->dtmf3Btn->setEnabled(true);
+    ui->dtmf4Btn->setEnabled(true);
+    ui->dtmf5Btn->setEnabled(true);
+    ui->dtmf6Btn->setEnabled(true);
+    ui->dtmf7Btn->setEnabled(true);
+    ui->dtmf8Btn->setEnabled(true);
+    ui->dtmf9Btn->setEnabled(true);
+    ui->dtmfABtn->setEnabled(true);
+    ui->dtmfBBtn->setEnabled(true);
+    ui->dtmfCBtn->setEnabled(true);
+    ui->dtmfDBtn->setEnabled(true);
+    ui->dtmfAstBtn->setEnabled(true);
+    ui->dtmfPoundBtn->setEnabled(true);
+}
+
+void MainWindow::callFailed(QSharedPointer<Call> call)
+{
+    for (int i=0; i<ui->tableCalls->rowCount(); i++)
+    {
+        QTableWidgetItem *item = ui->tableCalls->item(i, 1);
+        if (item->data(Qt::UserRole).toString() == call.data()->getUUID())
+        {
+            ui->tableCalls->removeRow(i);
+            ui->tableCalls->resizeColumnsToContents();
+            ui->tableCalls->resizeRowsToContents();
+            ui->tableCalls->horizontalHeader()->setStretchLastSection(true);
+            break;
+        }
+    }
+    ui->textEdit->setText(tr("Call with %1 (%2) failed with reason %3.").arg(call.data()->getCidName(),
+                                                                             call.data()->getCidNumber(),
+                                                                             call.data()->getCause()));
+    call.data()->setActive(false);
+    /* TODO: Will cause problems if 2 calls are received at the same time */
+    ui->recoredCallBtn->setEnabled(false);
+    ui->recoredCallBtn->setChecked(false);
+    ui->answerBtn->setEnabled(false);
+    ui->hangupBtn->setEnabled(false);
+    ui->dtmf0Btn->setEnabled(false);
+    ui->dtmf1Btn->setEnabled(false);
+    ui->dtmf2Btn->setEnabled(false);
+    ui->dtmf3Btn->setEnabled(false);
+    ui->dtmf4Btn->setEnabled(false);
+    ui->dtmf5Btn->setEnabled(false);
+    ui->dtmf6Btn->setEnabled(false);
+    ui->dtmf7Btn->setEnabled(false);
+    ui->dtmf8Btn->setEnabled(false);
+    ui->dtmf9Btn->setEnabled(false);
+    ui->dtmfABtn->setEnabled(false);
+    ui->dtmfBBtn->setEnabled(false);
+    ui->dtmfCBtn->setEnabled(false);
+    ui->dtmfDBtn->setEnabled(false);
+    ui->dtmfAstBtn->setEnabled(false);
+    ui->dtmfPoundBtn->setEnabled(false);
+
+}
+
+void MainWindow::hungup(QSharedPointer<Call> call)
+{
+    for (int i=0; i<ui->tableCalls->rowCount(); i++)
+    {
+        QTableWidgetItem *item = ui->tableCalls->item(i, 1);
+        if (item->data(Qt::UserRole).toString() == call.data()->getUUID())
+        {
+            ui->tableCalls->removeRow(i);
+            ui->tableCalls->resizeColumnsToContents();
+            ui->tableCalls->resizeRowsToContents();
+            ui->tableCalls->horizontalHeader()->setStretchLastSection(true);
+            break;
+        }
+    }
+    call.data()->setActive(false);
+    ui->textEdit->setText(tr("Call with %1 (%2) hungup.").arg(call.data()->getCidName(), call.data()->getCidNumber()));
+    /* TODO: Will cause problems if 2 calls are received at the same time */
+    ui->recoredCallBtn->setEnabled(false);
+    ui->recoredCallBtn->setChecked(false);
+    ui->answerBtn->setEnabled(false);
+    ui->hangupBtn->setEnabled(false);
+    ui->dtmf0Btn->setEnabled(false);
+    ui->dtmf1Btn->setEnabled(false);
+    ui->dtmf2Btn->setEnabled(false);
+    ui->dtmf3Btn->setEnabled(false);
+    ui->dtmf4Btn->setEnabled(false);
+    ui->dtmf5Btn->setEnabled(false);
+    ui->dtmf6Btn->setEnabled(false);
+    ui->dtmf7Btn->setEnabled(false);
+    ui->dtmf8Btn->setEnabled(false);
+    ui->dtmf9Btn->setEnabled(false);
+    ui->dtmfABtn->setEnabled(false);
+    ui->dtmfBBtn->setEnabled(false);
+    ui->dtmfCBtn->setEnabled(false);
+    ui->dtmfDBtn->setEnabled(false);
+    ui->dtmfAstBtn->setEnabled(false);
+    ui->dtmfPoundBtn->setEnabled(false);
+}
+
+void MainWindow::changeEvent(QEvent *e)
+{
+    QMainWindow::changeEvent(e);
+    switch (e->type()) {
+    case QEvent::LanguageChange:
+        ui->retranslateUi(this);
+        break;
+    default:
+        break;
+    }
+}
+
+void MainWindow::showAbout()
+{
+    QString result;
+    g_FSHost.sendCmd("version", "", &result);
+
+    QMessageBox::about(this, tr("About FSComm"),
+                       tr("<h2>FSComm</h2>"
+                          "<p>Author: Jo&atilde;o Mesquita &lt;jmesquita@freeswitch.org>"
+                          "<p>FsComm is a softphone based on libfreeswitch."
+                          "<p>The FreeSWITCH&trade; images and name are trademark of"
+                          " Anthony Minessale II, primary author of FreeSWITCH&trade;."
+                          "<p>Compiled FSComm version: %1"
+                          "<p>%2").arg(SWITCH_VERSION_FULL, result));
+}
+
+void MainWindow::sysTrayActivated(QSystemTrayIcon::ActivationReason reason)
+{
+    switch(reason)
+    {
+    case QSystemTrayIcon::Trigger:
+        {
+            if (this->isVisible())
+                this->hide();
+            else {
+                this->show();
+                this->activateWindow();
+                this->raise();
+            }
+            break;
+        }
+    default:
+        break;
+    }
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/mainwindow.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/mainwindow.h (from rev 16612, freeswitch/trunk/fscomm/mainwindow.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/mainwindow.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/mainwindow.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,92 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita <jmesquita@freeswitch.org>
+ *
+ */
+
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+#include <QTableWidgetItem>
+#include <QSignalMapper>
+#include <QSystemTrayIcon>
+#include <switch.h>
+#include <fshost.h>
+#include <call.h>
+#include <account.h>
+#include "preferences/prefdialog.h"
+
+namespace Ui {
+    class MainWindow;
+}
+
+class MainWindow : public QMainWindow {
+    Q_OBJECT
+public:
+    MainWindow(QWidget *parent = 0);
+    ~MainWindow();
+
+protected:
+    void changeEvent(QEvent *e);
+
+signals:
+    void dtmfDialed(QString);
+
+private slots:
+    void showAbout();
+    void prefTriggered();
+    void coreLoadingError(QString);
+    void sendDTMF(QString);
+    void callTableDoubleClick(QTableWidgetItem*);
+    void makeCall();
+    void fshostReady();
+    void paAnswer();
+    void paCall(QString);
+    void paHangup();
+    void newOutgoingCall(QSharedPointer<Call>);
+    void ringing(QSharedPointer<Call>);
+    void answered(QSharedPointer<Call>);
+    void hungup(QSharedPointer<Call>);
+    void callFailed(QSharedPointer<Call>);
+    void recordCall(bool);
+    void setDefaultAccount();
+    void accountAdd(QSharedPointer<Account>);
+    void accountDel(QSharedPointer<Account>);
+    void accountStateChanged(QSharedPointer<Account>);
+    void sysTrayActivated(QSystemTrayIcon::ActivationReason reason);
+    void updateCallTimers();
+
+private:
+    Ui::MainWindow *ui;
+    QSignalMapper *dialpadMapper;
+    PrefDialog *preferences;
+    QSystemTrayIcon *sysTray;
+    QTimer *callTimer;
+};
+
+#endif // MAINWINDOW_H

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/mainwindow.ui

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/mainwindow.ui (from rev 16612, freeswitch/trunk/fscomm/mainwindow.ui) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/mainwindow.ui	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/mainwindow.ui	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,417 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MainWindow</class>
+ <widget class="QMainWindow" name="MainWindow">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>716</width>
+    <height>541</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>FSComm - A FreeSWITCH Communicator</string>
+  </property>
+  <widget class="QWidget" name="centralWidget">
+   <layout class="QHBoxLayout" name="horizontalLayout_4">
+    <item>
+     <layout class="QVBoxLayout" name="verticalLayout_2">
+      <item>
+       <widget class="QTextEdit" name="textEdit">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+        <property name="readOnly">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout">
+        <item>
+         <widget class="QPushButton" name="newCallBtn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>New Call</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="recoredCallBtn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>Record</string>
+          </property>
+          <property name="checkable">
+           <bool>true</bool>
+          </property>
+          <property name="checked">
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QGridLayout" name="gridLayout_2">
+        <item row="0" column="0">
+         <widget class="QPushButton" name="answerBtn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>Answer</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="1">
+         <widget class="QPushButton" name="hangupBtn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>Hangup</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QGridLayout" name="gridLayout">
+        <item row="0" column="0">
+         <widget class="QPushButton" name="dtmf1Btn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>1</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="1">
+         <widget class="QPushButton" name="dtmf2Btn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>2</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="2">
+         <widget class="QPushButton" name="dtmf3Btn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>3</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="0">
+         <widget class="QPushButton" name="dtmf4Btn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>4</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="1">
+         <widget class="QPushButton" name="dtmf5Btn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>5</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="2">
+         <widget class="QPushButton" name="dtmf6Btn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>6</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="0">
+         <widget class="QPushButton" name="dtmf7Btn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>7</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="1">
+         <widget class="QPushButton" name="dtmf8Btn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>8</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="2">
+         <widget class="QPushButton" name="dtmf9Btn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>9</string>
+          </property>
+         </widget>
+        </item>
+        <item row="3" column="0">
+         <widget class="QPushButton" name="dtmfAstBtn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>*</string>
+          </property>
+         </widget>
+        </item>
+        <item row="3" column="1">
+         <widget class="QPushButton" name="dtmf0Btn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>0</string>
+          </property>
+         </widget>
+        </item>
+        <item row="3" column="2">
+         <widget class="QPushButton" name="dtmfPoundBtn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>#</string>
+          </property>
+         </widget>
+        </item>
+        <item row="0" column="3">
+         <widget class="QPushButton" name="dtmfABtn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>A</string>
+          </property>
+         </widget>
+        </item>
+        <item row="1" column="3">
+         <widget class="QPushButton" name="dtmfBBtn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>B</string>
+          </property>
+         </widget>
+        </item>
+        <item row="3" column="3">
+         <widget class="QPushButton" name="dtmfDBtn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>D</string>
+          </property>
+         </widget>
+        </item>
+        <item row="2" column="3">
+         <widget class="QPushButton" name="dtmfCBtn">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+          <property name="text">
+           <string>C</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </item>
+    <item>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <widget class="QGroupBox" name="groupBox">
+        <property name="title">
+         <string>Active Calls</string>
+        </property>
+        <layout class="QHBoxLayout" name="horizontalLayout_3">
+         <item>
+          <widget class="QTableWidget" name="tableCalls">
+           <property name="editTriggers">
+            <set>QAbstractItemView::NoEditTriggers</set>
+           </property>
+           <property name="selectionMode">
+            <enum>QAbstractItemView::SingleSelection</enum>
+           </property>
+           <property name="selectionBehavior">
+            <enum>QAbstractItemView::SelectRows</enum>
+           </property>
+           <property name="showGrid">
+            <bool>false</bool>
+           </property>
+           <column>
+            <property name="text">
+             <string>To/From</string>
+            </property>
+           </column>
+           <column>
+            <property name="text">
+             <string>Status</string>
+            </property>
+           </column>
+           <column>
+            <property name="text">
+             <string>Time</string>
+            </property>
+           </column>
+          </widget>
+         </item>
+        </layout>
+       </widget>
+      </item>
+      <item>
+       <widget class="QGroupBox" name="groupBox_2">
+        <property name="title">
+         <string>Active Accounts</string>
+        </property>
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <item>
+          <widget class="QTableWidget" name="tableAccounts">
+           <property name="contextMenuPolicy">
+            <enum>Qt::ActionsContextMenu</enum>
+           </property>
+           <property name="editTriggers">
+            <set>QAbstractItemView::NoEditTriggers</set>
+           </property>
+           <property name="alternatingRowColors">
+            <bool>false</bool>
+           </property>
+           <property name="selectionMode">
+            <enum>QAbstractItemView::SingleSelection</enum>
+           </property>
+           <property name="selectionBehavior">
+            <enum>QAbstractItemView::SelectRows</enum>
+           </property>
+           <property name="showGrid">
+            <bool>false</bool>
+           </property>
+           <property name="cornerButtonEnabled">
+            <bool>true</bool>
+           </property>
+           <property name="rowCount">
+            <number>0</number>
+           </property>
+           <attribute name="horizontalHeaderVisible">
+            <bool>true</bool>
+           </attribute>
+           <attribute name="horizontalHeaderCascadingSectionResizes">
+            <bool>false</bool>
+           </attribute>
+           <attribute name="verticalHeaderVisible">
+            <bool>false</bool>
+           </attribute>
+           <attribute name="verticalHeaderHighlightSections">
+            <bool>false</bool>
+           </attribute>
+           <column>
+            <property name="text">
+             <string>Account</string>
+            </property>
+           </column>
+           <column>
+            <property name="text">
+             <string>Status</string>
+            </property>
+           </column>
+          </widget>
+         </item>
+        </layout>
+       </widget>
+      </item>
+     </layout>
+    </item>
+   </layout>
+  </widget>
+  <widget class="QMenuBar" name="menuBar">
+   <property name="geometry">
+    <rect>
+     <x>0</x>
+     <y>0</y>
+     <width>716</width>
+     <height>24</height>
+    </rect>
+   </property>
+   <widget class="QMenu" name="menu_File">
+    <property name="title">
+     <string>&amp;File</string>
+    </property>
+    <addaction name="action_Preferences"/>
+    <addaction name="separator"/>
+    <addaction name="action_Exit"/>
+   </widget>
+   <widget class="QMenu" name="menuHelp">
+    <property name="title">
+     <string>Help</string>
+    </property>
+    <addaction name="actionAbout"/>
+   </widget>
+   <addaction name="menu_File"/>
+   <addaction name="menuHelp"/>
+  </widget>
+  <widget class="QToolBar" name="mainToolBar">
+   <attribute name="toolBarArea">
+    <enum>TopToolBarArea</enum>
+   </attribute>
+   <attribute name="toolBarBreak">
+    <bool>false</bool>
+   </attribute>
+  </widget>
+  <widget class="QStatusBar" name="statusBar"/>
+  <action name="action_Preferences">
+   <property name="text">
+    <string>&amp;Preferences</string>
+   </property>
+  </action>
+  <action name="action_Exit">
+   <property name="text">
+    <string>&amp;Exit</string>
+   </property>
+  </action>
+  <action name="actionAbout">
+   <property name="text">
+    <string>About</string>
+   </property>
+  </action>
+  <action name="actionSetDefaultAccount">
+   <property name="text">
+    <string>Set Default Account</string>
+   </property>
+   <property name="toolTip">
+    <string>Set the default account for dialing out.</string>
+   </property>
+  </action>
+ </widget>
+ <layoutdefault spacing="6" margin="11"/>
+ <resources/>
+ <connections/>
+</ui>

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/mod_qsettings (from rev 16612, freeswitch/trunk/fscomm/mod_qsettings)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/mod_qsettings/mod_qsettings.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/mod_qsettings/mod_qsettings.cpp (from rev 16612, freeswitch/trunk/fscomm/mod_qsettings/mod_qsettings.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/mod_qsettings/mod_qsettings.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/mod_qsettings/mod_qsettings.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,293 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Joao Mesquita <jmesquita@freeswitch.org>
+ *
+ *
+ * Description:
+ * Module to load configurations from Qt preference system QSettings
+ *
+ */
+#include <QString>
+#include <QtGui>
+#include <QDir>
+#include <QXmlStreamWriter>
+#include "mod_qsettings/mod_qsettings.h"
+
+switch_xml_t XMLBinding::getConfigXML(QString tmpl)
+{
+    _settings->beginGroup("FreeSWITCH/conf");
+    if (!_settings->childGroups().contains(tmpl))
+    {
+        _settings->endGroup();
+        return NULL;
+    }
+    _settings->beginGroup(tmpl);
+
+    QByteArray *finalXML = new QByteArray();
+    QXmlStreamWriter streamWriter(finalXML);
+
+    streamWriter.setAutoFormatting(true);
+    streamWriter.writeStartElement("document");
+    streamWriter.writeAttribute("type", "freeswitch/xml");
+
+    streamWriter.writeStartElement("section");
+    streamWriter.writeAttribute("name", "configuration");
+
+    streamWriter.writeStartElement("configuration");
+    streamWriter.writeAttribute("name", tmpl);
+    streamWriter.writeAttribute("description", "Configuration generated by QSettings");
+
+    foreach (QString group, _settings->childGroups())
+    {
+        parseGroup(&streamWriter, group);
+    }
+
+    streamWriter.writeEndElement();
+    streamWriter.writeEndElement();
+    streamWriter.writeEndElement();
+
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Config for %s requested. Providing the following XML:\n%s\n",
+                      tmpl.toAscii().constData(), finalXML->data());
+
+    _settings->endGroup();
+    _settings->endGroup();
+
+    return switch_xml_parse_str(finalXML->data(), strlen(finalXML->data()));
+}
+
+void XMLBinding::parseGroup(QXmlStreamWriter *streamWriter, QString group)
+{
+    if (group == "attrs")
+    {
+        _settings->beginGroup(group);
+        foreach (QString k, _settings->childKeys())
+        {
+            streamWriter->writeAttribute(k, _settings->value(k).toString());
+        }
+        _settings->endGroup();
+        return;
+    }
+
+    if (group == "params" || group == "customParams")
+    {
+        _settings->beginGroup(group);
+        foreach(QString param, _settings->childKeys())
+        {
+            streamWriter->writeStartElement("param");
+            streamWriter->writeAttribute("name", param);
+            streamWriter->writeAttribute("value", _settings->value(param).toString());
+            streamWriter->writeEndElement();
+        }
+        _settings->endGroup();
+        return;
+    }
+
+    if (group == "gateways")
+    {
+        streamWriter->writeStartElement(group);
+        _settings->beginGroup(group);
+        foreach (QString gw, _settings->childGroups())
+        {
+            _settings->beginGroup(gw);
+            foreach(QString g, _settings->childGroups())
+            {
+                parseGroup(streamWriter, g);
+            }
+            _settings->endGroup();
+        }
+        _settings->endGroup();
+        streamWriter->writeEndElement();
+        return;
+    }
+
+    _settings->beginGroup(group);
+    streamWriter->writeStartElement(group);
+
+    foreach (QString group2, _settings->childGroups())
+    {
+        parseGroup(streamWriter, group2);
+    }
+
+    streamWriter->writeEndElement();
+    _settings->endGroup();
+}
+
+static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
+                                  void *user_data)
+{
+    XMLBinding *binding = (XMLBinding *) user_data;
+
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "We are being requested -> section: %s | tag_name: %s | key_name: %s | key_value: %s!\n",
+                      section, tag_name, key_name, key_value);
+    if (!binding) {
+        return NULL;
+    }
+
+    return binding->getConfigXML(key_value);
+}
+
+static switch_status_t do_config(void)
+{
+    char *cf = "qsettings.conf";
+    switch_xml_t cfg, xml, bindings_tag;
+    XMLBinding *binding = 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);
+        return SWITCH_STATUS_TERM;
+    }
+
+    if (!(bindings_tag = switch_xml_child(cfg, "bindings"))) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing <bindings> tag!\n");
+        switch_xml_free(xml);
+        return SWITCH_STATUS_FALSE;
+    }
+
+    QString bind_mask = switch_xml_attr_soft(bindings_tag, "value");
+    if (!bind_mask.isEmpty())
+    {
+        binding = new XMLBinding(bind_mask);
+    }
+
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding XML Fetch Function [%s]\n",
+                      binding->getBinding().isEmpty() ? "all" : binding->getBinding().toAscii().constData());
+    switch_xml_bind_search_function(xml_url_fetch, switch_xml_parse_section_string(binding->getBinding().toAscii().constData()), binding);
+    binding = NULL;
+
+    switch_xml_free(xml);
+
+    QSettings settings;
+    settings.beginGroup("FreeSWITCH/conf");
+    if (settings.childGroups().isEmpty())
+    {
+        setQSettingsDefaults();
+    }
+    settings.endGroup();
+    setGlobals();
+
+    return SWITCH_STATUS_SUCCESS;
+}
+
+void setQSettingsDefaults()
+{
+    QSettings settings;
+    settings.beginGroup("FreeSWITCH/conf");
+
+    /* Globals config */
+    /* Sofia config */
+    settings.beginGroup("sofia.conf");
+
+    /* General Settings */
+    settings.beginGroup("global_settings/params");
+    settings.setValue("log-level", 0);
+    settings.setValue("auto-restart", "true");
+    settings.setValue("debug-presence", 0);
+    settings.endGroup();
+
+    /* Profile settings */
+    settings.beginGroup("profiles");
+    settings.beginGroup("profile");
+
+    settings.beginGroup("attrs");
+    settings.setValue("name", "softphone");
+    settings.endGroup();
+
+    settings.beginGroup("settings/params");
+    settings.setValue("user-agent-string", "FreeSWITCH/FSComm");
+    settings.setValue("debug", 0);
+    settings.setValue("sip-trace", "no");
+    settings.setValue("context", "public");
+    settings.setValue("rfc2833-pt", 101);
+    settings.setValue("sip-port", 12345);
+    settings.setValue("dialplan", "XML");
+    settings.setValue("dtmf-duration", 100);
+    settings.setValue("codec-prefs", "CELT@48000h,G7221@32000h,G7221@16000h,G722,PCMU,PCMA,GSM");
+    settings.setValue("use-rtp-timer", "true");
+    settings.setValue("rtp-timer-name", "soft");
+    settings.setValue("rtp-ip", "auto");
+    settings.setValue("sip-ip", "auto");
+    settings.setValue("hold-music", "local_stream://moh");
+    settings.setValue("apply-nat-acl", "rfc1918");
+    settings.setValue("manage-presence", "false");
+    settings.setValue("max-proceeding", 3);
+    settings.setValue("inbound-codec-negotiation", "generous");
+    settings.setValue("nonce-ttl", 60);
+    settings.setValue("auth-calls", "false");
+    settings.setValue("auth-all-packets", "false");
+    settings.setValue("ext-rtp-ip", "stun:stun.freeswitch.org");
+    settings.setValue("ext-sip-ip", "stun:stun.freeswitch.org");
+    settings.setValue("rtp-timeout-sec", 300);
+    settings.setValue("rtp-hold-timeout-sec", 1800);
+    settings.setValue("disable-register", "true");
+    settings.setValue("challenge-realm", "auto_from");
+    settings.endGroup();
+
+    settings.endGroup();
+    settings.endGroup();
+    settings.endGroup();
+
+    /* PortAudio config */
+    settings.beginGroup("portaudio.conf/settings/params");
+    settings.setValue("cid-name", "FSComm");
+    settings.setValue("cid-num", "00000000");
+    settings.setValue("ring-file", "tone_stream://%(2000,4000,440.0,480.0);loops=20");
+    settings.setValue("dialplan", "XML");
+    settings.setValue("ring-interval", 5);
+    settings.setValue("hold-file", "local_stream://moh");
+    settings.setValue("sample-rate", 48000);
+    settings.setValue("codec-ms", 10);
+    settings.setValue("indev", "");
+    settings.setValue("outdev", "");
+    settings.setValue("ringdev", "");
+    settings.endGroup();
+
+    /* Finish configs */
+    settings.endGroup();
+}
+
+void setGlobals()
+{
+    QSettings settings;
+    settings.beginGroup("FreeSWITCH/conf/globals");
+    foreach (QString k, settings.childKeys())
+    {
+        switch_core_set_variable(k.toAscii().data(), settings.value(k).toByteArray().data());
+    }
+    settings.endGroup();
+}
+
+switch_status_t mod_qsettings_load(void)
+{
+
+    if (do_config() == SWITCH_STATUS_SUCCESS) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Sucessfully configured.\n");
+    } else {
+        return SWITCH_STATUS_FALSE;
+    }
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "We loaded mod_qsettings.\n");
+
+    return SWITCH_STATUS_SUCCESS;
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/mod_qsettings/mod_qsettings.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/mod_qsettings/mod_qsettings.h (from rev 16612, freeswitch/trunk/fscomm/mod_qsettings/mod_qsettings.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/mod_qsettings/mod_qsettings.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/mod_qsettings/mod_qsettings.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,55 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Joao Mesquita <jmesquita@freeswitch.org>
+ *
+ */
+
+#ifndef MOD_QSETTINGS_H
+#define MOD_QSETTINGS_H
+
+#include <QString>
+#include <QSettings>
+#include <switch.h>
+
+class QXmlStreamWriter;
+
+class XMLBinding
+{
+public:
+    XMLBinding(QString binding) : _binding(binding), _settings(new QSettings) {}
+    QString getBinding(void) { return _binding; }
+    switch_xml_t getConfigXML(QString);
+private:
+    void parseGroup(QXmlStreamWriter *,QString);
+    QString _binding;
+    QSettings* _settings;
+};
+
+switch_status_t mod_qsettings_load(void);
+void setQSettingsDefaults(void);
+void setGlobals(void);
+
+#endif // MOD_QSETTINGS_H

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences (from rev 16612, freeswitch/trunk/fscomm/preferences)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/accountdialog.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/accountdialog.cpp (from rev 16612, freeswitch/trunk/fscomm/preferences/accountdialog.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/accountdialog.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/accountdialog.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,212 @@
+#include <QSettings>
+#include <QtGui>
+#include "accountdialog.h"
+#include "ui_accountdialog.h"
+#include "fshost.h"
+
+AccountDialog::AccountDialog(QString accId, QWidget *parent) :
+    QDialog(parent),
+    _accId(accId),
+    ui(new Ui::AccountDialog)
+{    
+    ui->setupUi(this);
+    _settings = new QSettings;
+    connect(this, SIGNAL(accepted()), this, SLOT(writeConfig()));
+    connect(ui->sofiaExtraParamAddBtn, SIGNAL(clicked()), this, SLOT(addExtraParam()));
+    connect(ui->sofiaExtraParamRemBtn, SIGNAL(clicked()), this, SLOT(remExtraParam()));
+    connect(ui->clidSettingsCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(clidSettingsComboChanged(int)));
+    connect(ui->codecSettingsCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(codecSettingsComboChanged(int)));
+
+    ui->sofiaExtraParamTable->horizontalHeader()->setStretchLastSection(true);
+    ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->codecPage));
+    ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->clidPage));
+}
+
+AccountDialog::~AccountDialog()
+{
+    delete ui;
+}
+
+void AccountDialog::codecSettingsComboChanged(int index)
+{
+    if (index == 0)
+        ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->codecPage));
+    else
+        ui->tabWidget->insertTab(1,ui->codecPage,tr("Codecs"));
+
+}
+
+void AccountDialog::clidSettingsComboChanged(int index)
+{
+    if (index == 0)
+        ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->clidPage));
+    else
+        ui->tabWidget->insertTab(1,ui->clidPage,tr("Caller ID"));
+}
+
+void AccountDialog::remExtraParam()
+{
+    QList<QTableWidgetSelectionRange> sel = ui->sofiaExtraParamTable->selectedRanges();
+
+    foreach(QTableWidgetSelectionRange range, sel)
+    {
+        int offset =0;
+        for(int row = range.topRow(); row<=range.bottomRow(); row++)
+        {
+            ui->sofiaExtraParamTable->removeRow(row-offset);
+            offset++;
+        }
+    }
+}
+
+void AccountDialog::addExtraParam()
+{
+    bool ok;
+    QString paramName = QInputDialog::getText(this, tr("Add parameter."),
+                                         tr("New parameter name:"), QLineEdit::Normal,
+                                         NULL, &ok);
+    if (!ok)
+        return;
+    QString paramVal = QInputDialog::getText(this, tr("Add parameter."),
+                                         tr("New parameter value:"), QLineEdit::Normal,
+                                         NULL, &ok);
+    if (!ok)
+        return;
+
+    QTableWidgetItem* paramNameItem = new QTableWidgetItem(paramName);
+    QTableWidgetItem* paramValItem = new QTableWidgetItem(paramVal);
+    ui->sofiaExtraParamTable->setRowCount(ui->sofiaExtraParamTable->rowCount()+1);
+    ui->sofiaExtraParamTable->setItem(ui->sofiaExtraParamTable->rowCount()-1,0,paramNameItem);
+    ui->sofiaExtraParamTable->setItem(ui->sofiaExtraParamTable->rowCount()-1,1,paramValItem);
+    ui->sofiaExtraParamTable->resizeColumnsToContents();
+    ui->sofiaExtraParamTable->resizeRowsToContents();
+    ui->sofiaExtraParamTable->horizontalHeader()->setStretchLastSection(true);
+}
+
+void AccountDialog::readConfig()
+{
+    _settings->beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways");
+    _settings->beginGroup(_accId);
+
+    _settings->beginGroup("gateway/attrs");
+    ui->sofiaGwNameEdit->setText(_settings->value("name").toString());
+    _settings->endGroup();
+
+    _settings->beginGroup("gateway/params");
+    ui->sofiaGwUsernameEdit->setText(_settings->value("username").toString());
+    ui->sofiaGwRealmEdit->setText(_settings->value("realm").toString());
+    ui->sofiaGwPasswordEdit->setText(_settings->value("password").toString());
+    ui->sofiaGwExpireSecondsSpin->setValue(_settings->value("expire-seconds").toInt());
+    ui->sofiaGwRegisterCombo->setCurrentIndex(ui->sofiaGwRegisterCombo->findText(_settings->value("register").toString(),
+                                                                                 Qt::MatchExactly));
+    ui->sofiaGwRegisterTransportCombo->setCurrentIndex(ui->sofiaGwRegisterTransportCombo->findText(_settings->value("register-transport").toString(),
+                                                                                                   Qt::MatchExactly));
+    ui->sofiaGwRetrySecondsSpin->setValue(_settings->value("retry-seconds").toInt());
+    _settings->endGroup();
+
+    _settings->beginGroup("gateway/customParams");
+    int row = 0;
+    ui->sofiaExtraParamTable->clearContents();
+    foreach(QString k, _settings->childKeys())
+    {
+        row++;
+        ui->sofiaExtraParamTable->setRowCount(row);
+        QTableWidgetItem *varName = new QTableWidgetItem(k);
+        QTableWidgetItem *varVal = new QTableWidgetItem(_settings->value(k).toString());
+        ui->sofiaExtraParamTable->setItem(row-1, 0,varName);
+        ui->sofiaExtraParamTable->setItem(row-1, 1,varVal);
+    }
+    _settings->endGroup();
+
+    _settings->endGroup();
+    _settings->endGroup();
+
+    ui->sofiaExtraParamTable->resizeColumnsToContents();
+    ui->sofiaExtraParamTable->resizeRowsToContents();
+    ui->sofiaExtraParamTable->horizontalHeader()->setStretchLastSection(true);
+}
+
+void AccountDialog::writeConfig()
+{
+    QSharedPointer<Account> acc = g_FSHost.getAccountByUUID(_accId);
+    if (!acc.isNull())
+    {
+        g_FSHost.accountReloadCmd(acc);
+    }
+
+    _settings->beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways");
+
+    _settings->beginGroup(_accId);
+
+    _settings->beginGroup("gateway/global_vars");
+    if (ui->clidSettingsCombo->currentIndex() == 0)
+    {
+        _settings->remove("caller_id_name");
+        _settings->remove("caller_id_num");
+    } else {
+        _settings->setValue("caller_id_name", ui->sofiaCallerIDName->text());
+        _settings->setValue("caller_id_num", ui->sofiaCallerIDNum->text());
+    }
+    _settings->endGroup();
+    
+    _settings->beginGroup("gateway/attrs");
+    _settings->setValue("name", ui->sofiaGwNameEdit->text());
+    _settings->endGroup();
+
+
+    _settings->beginGroup("gateway/params");
+    _settings->setValue("username", ui->sofiaGwUsernameEdit->text());
+    _settings->setValue("realm", ui->sofiaGwRealmEdit->text());
+    _settings->setValue("password", ui->sofiaGwPasswordEdit->text());
+    _settings->setValue("expire-seconds", ui->sofiaGwExpireSecondsSpin->value());
+    _settings->setValue("register", ui->sofiaGwRegisterCombo->currentText());
+    _settings->setValue("register-transport", ui->sofiaGwRegisterTransportCombo->currentText());
+    _settings->setValue("retry-seconds", ui->sofiaGwRetrySecondsSpin->value());    
+    _settings->endGroup();
+
+    _settings->beginGroup("gateway/customParams");
+    for (int i = 0; i< ui->sofiaExtraParamTable->rowCount(); i++)
+    {
+        _settings->setValue(ui->sofiaExtraParamTable->item(i, 0)->text(),
+                            ui->sofiaExtraParamTable->item(i, 1)->text());
+    }
+    _settings->endGroup();
+
+    _settings->endGroup();
+
+    _settings->endGroup();
+
+    emit gwAdded(_accId);
+}
+
+void AccountDialog::clear()
+{
+    ui->sofiaExtraParamTable->clearContents();
+    ui->sofiaExtraParamTable->setRowCount(0);
+
+    ui->sofiaGwNameEdit->clear();
+    ui->sofiaGwUsernameEdit->clear();
+    ui->sofiaGwRealmEdit->clear();
+    ui->sofiaGwPasswordEdit->clear();
+    ui->sofiaGwExpireSecondsSpin->setValue(60);
+    ui->sofiaGwRegisterCombo->setCurrentIndex(0);
+    ui->sofiaGwRegisterTransportCombo->setCurrentIndex(0);
+    ui->sofiaGwRetrySecondsSpin->setValue(30);
+}
+
+void AccountDialog::setAccId(QString accId)
+{
+    _accId = accId;
+}
+
+void AccountDialog::changeEvent(QEvent *e)
+{
+    QDialog::changeEvent(e);
+    switch (e->type()) {
+    case QEvent::LanguageChange:
+        ui->retranslateUi(this);
+        break;
+    default:
+        break;
+    }
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/accountdialog.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/accountdialog.h (from rev 16612, freeswitch/trunk/fscomm/preferences/accountdialog.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/accountdialog.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/accountdialog.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,40 @@
+#ifndef ACCOUNTDIALOG_H
+#define ACCOUNTDIALOG_H
+
+#include <QDialog>
+
+namespace Ui {
+    class AccountDialog;
+}
+
+class QSettings;
+
+class AccountDialog : public QDialog {
+    Q_OBJECT
+public:
+    AccountDialog(QString accId, QWidget *parent = 0);
+    ~AccountDialog();
+    void clear();
+    void setAccId(QString);
+    void readConfig();
+
+signals:
+    void gwAdded(QString);
+
+private slots:
+    void writeConfig();
+    void addExtraParam();
+    void remExtraParam();
+    void codecSettingsComboChanged(int);
+    void clidSettingsComboChanged(int);
+
+protected:
+    void changeEvent(QEvent *e);
+
+private:
+    QString _accId;
+    Ui::AccountDialog *ui;
+    QSettings *_settings;
+};
+
+#endif // ACCOUNTDIALOG_H

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/accountdialog.ui

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/accountdialog.ui (from rev 16612, freeswitch/trunk/fscomm/preferences/accountdialog.ui) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/accountdialog.ui	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/accountdialog.ui	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,348 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>AccountDialog</class>
+ <widget class="QDialog" name="AccountDialog">
+  <property name="windowModality">
+   <enum>Qt::WindowModal</enum>
+  </property>
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>389</width>
+    <height>427</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Account</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QTabWidget" name="tabWidget">
+     <property name="currentIndex">
+      <number>0</number>
+     </property>
+     <widget class="QWidget" name="tab">
+      <attribute name="title">
+       <string>Basic</string>
+      </attribute>
+      <layout class="QFormLayout" name="formLayout">
+       <property name="fieldGrowthPolicy">
+        <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+       </property>
+       <item row="0" column="0">
+        <widget class="QLabel" name="label">
+         <property name="text">
+          <string>Account Name</string>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="1">
+        <widget class="QLineEdit" name="sofiaGwNameEdit"/>
+       </item>
+       <item row="1" column="0">
+        <widget class="QLabel" name="label_2">
+         <property name="text">
+          <string>Usernane</string>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="1">
+        <widget class="QLineEdit" name="sofiaGwUsernameEdit"/>
+       </item>
+       <item row="2" column="0">
+        <widget class="QLabel" name="label_3">
+         <property name="text">
+          <string>Domain</string>
+         </property>
+        </widget>
+       </item>
+       <item row="2" column="1">
+        <widget class="QLineEdit" name="sofiaGwRealmEdit"/>
+       </item>
+       <item row="3" column="0">
+        <widget class="QLabel" name="label_6">
+         <property name="text">
+          <string>Password</string>
+         </property>
+        </widget>
+       </item>
+       <item row="3" column="1">
+        <widget class="QLineEdit" name="sofiaGwPasswordEdit">
+         <property name="toolTip">
+          <string>Account password </string>
+         </property>
+         <property name="echoMode">
+          <enum>QLineEdit::Password</enum>
+         </property>
+        </widget>
+       </item>
+       <item row="4" column="0">
+        <widget class="QLabel" name="label_10">
+         <property name="text">
+          <string>Expire</string>
+         </property>
+        </widget>
+       </item>
+       <item row="4" column="1">
+        <widget class="QSpinBox" name="sofiaGwExpireSecondsSpin">
+         <property name="toolTip">
+          <string>Seconds before account expires</string>
+         </property>
+         <property name="value">
+          <number>60</number>
+         </property>
+        </widget>
+       </item>
+       <item row="5" column="0">
+        <widget class="QLabel" name="label_11">
+         <property name="text">
+          <string>Register</string>
+         </property>
+        </widget>
+       </item>
+       <item row="5" column="1">
+        <widget class="QComboBox" name="sofiaGwRegisterCombo">
+         <property name="toolTip">
+          <string>Account must register or must not register</string>
+         </property>
+         <item>
+          <property name="text">
+           <string>true</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>false</string>
+          </property>
+         </item>
+        </widget>
+       </item>
+       <item row="6" column="0">
+        <widget class="QLabel" name="label_12">
+         <property name="text">
+          <string>Transport</string>
+         </property>
+        </widget>
+       </item>
+       <item row="6" column="1">
+        <widget class="QComboBox" name="sofiaGwRegisterTransportCombo">
+         <property name="toolTip">
+          <string>What transport to use for this account</string>
+         </property>
+         <item>
+          <property name="text">
+           <string>udp</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>tcp</string>
+          </property>
+         </item>
+        </widget>
+       </item>
+       <item row="7" column="0">
+        <widget class="QLabel" name="label_13">
+         <property name="text">
+          <string>Retry</string>
+         </property>
+        </widget>
+       </item>
+       <item row="7" column="1">
+        <widget class="QSpinBox" name="sofiaGwRetrySecondsSpin">
+         <property name="toolTip">
+          <string>How many seconds to retry registration</string>
+         </property>
+         <property name="value">
+          <number>30</number>
+         </property>
+        </widget>
+       </item>
+       <item row="8" column="0">
+        <widget class="QLabel" name="label_4">
+         <property name="text">
+          <string>Codec Settings</string>
+         </property>
+        </widget>
+       </item>
+       <item row="9" column="0">
+        <widget class="QLabel" name="label_5">
+         <property name="text">
+          <string>CallerID Settings</string>
+         </property>
+        </widget>
+       </item>
+       <item row="8" column="1">
+        <widget class="QComboBox" name="codecSettingsCombo">
+         <property name="enabled">
+          <bool>false</bool>
+         </property>
+         <item>
+          <property name="text">
+           <string>Global</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Custom</string>
+          </property>
+         </item>
+        </widget>
+       </item>
+       <item row="9" column="1">
+        <widget class="QComboBox" name="clidSettingsCombo">
+         <property name="enabled">
+          <bool>true</bool>
+         </property>
+         <item>
+          <property name="text">
+           <string>Global</string>
+          </property>
+         </item>
+         <item>
+          <property name="text">
+           <string>Custom</string>
+          </property>
+         </item>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="codecPage">
+      <attribute name="title">
+       <string>Codecs</string>
+      </attribute>
+     </widget>
+     <widget class="QWidget" name="clidPage">
+      <attribute name="title">
+       <string>CallerID</string>
+      </attribute>
+      <layout class="QFormLayout" name="formLayout_2">
+       <item row="0" column="0">
+        <widget class="QLabel" name="label_15">
+         <property name="text">
+          <string>CallerID Name:</string>
+         </property>
+        </widget>
+       </item>
+       <item row="0" column="1">
+        <widget class="QLineEdit" name="sofiaCallerIDName"/>
+       </item>
+       <item row="1" column="0">
+        <widget class="QLabel" name="label_14">
+         <property name="text">
+          <string>CallerID Number:</string>
+         </property>
+        </widget>
+       </item>
+       <item row="1" column="1">
+        <widget class="QLineEdit" name="sofiaCallerIDNum"/>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="tab_2">
+      <attribute name="title">
+       <string>Advanced</string>
+      </attribute>
+      <layout class="QHBoxLayout" name="horizontalLayout">
+       <item>
+        <widget class="QTableWidget" name="sofiaExtraParamTable">
+         <property name="selectionBehavior">
+          <enum>QAbstractItemView::SelectRows</enum>
+         </property>
+         <column>
+          <property name="text">
+           <string>Param Name</string>
+          </property>
+         </column>
+         <column>
+          <property name="text">
+           <string>Param Value</string>
+          </property>
+         </column>
+        </widget>
+       </item>
+       <item>
+        <layout class="QVBoxLayout" name="verticalLayout_2">
+         <item>
+          <widget class="QPushButton" name="sofiaExtraParamAddBtn">
+           <property name="text">
+            <string>+</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="sofiaExtraParamRemBtn">
+           <property name="text">
+            <string>-</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="verticalSpacer">
+           <property name="orientation">
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>20</width>
+             <height>40</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+    </widget>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>AccountDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>266</x>
+     <y>417</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>AccountDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>334</x>
+     <y>417</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefaccounts.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefaccounts.cpp (from rev 16612, freeswitch/trunk/fscomm/preferences/prefaccounts.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefaccounts.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefaccounts.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,168 @@
+#include <QtGui>
+#include "prefaccounts.h"
+#include "accountdialog.h"
+#include "fshost.h"
+
+PrefAccounts::PrefAccounts(Ui::PrefDialog *ui) :
+        _ui(ui)
+{
+    _settings = new QSettings();
+    _accDlg = NULL;
+    connect(_ui->sofiaGwAddBtn, SIGNAL(clicked()), this, SLOT(addAccountBtnClicked()));
+    connect(_ui->sofiaGwRemBtn, SIGNAL(clicked()), this, SLOT(remAccountBtnClicked()));
+    connect(_ui->sofiaGwEditBtn, SIGNAL(clicked()), this, SLOT(editAccountBtnClicked()));
+
+    _ui->accountsTable->horizontalHeader()->setStretchLastSection(true);
+}
+
+void PrefAccounts::addAccountBtnClicked()
+{
+    if (!_accDlg)
+    {
+        QString uuid;
+        if (g_FSHost.sendCmd("create_uuid", "", &uuid) != SWITCH_STATUS_SUCCESS)
+        {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not create UUID for account. Reason: %s\n", uuid.toAscii().constData());
+            return;
+        }
+        _accDlg = new AccountDialog(uuid);
+        connect(_accDlg, SIGNAL(gwAdded(QString)), this, SLOT(readConfig()));
+    }
+    else
+    {
+        QString uuid;
+        if (g_FSHost.sendCmd("create_uuid", "", &uuid) != SWITCH_STATUS_SUCCESS)
+        {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not create UUID for account. Reason: %s\n", uuid.toAscii().constData());
+            return;
+        }
+        _accDlg->setAccId(uuid);
+        _accDlg->clear();
+    }
+
+    _accDlg->show();
+    _accDlg->raise();
+    _accDlg->activateWindow();
+}
+
+void PrefAccounts::editAccountBtnClicked()
+{
+    QList<QTableWidgetSelectionRange> selList = _ui->accountsTable->selectedRanges();
+
+    if (selList.isEmpty())
+        return;
+    QTableWidgetSelectionRange range = selList[0];
+
+    QString uuid = _ui->accountsTable->item(range.topRow(),0)->data(Qt::UserRole).toString();
+
+    if (!_accDlg)
+    {
+        _accDlg = new AccountDialog(uuid);
+        connect(_accDlg, SIGNAL(gwAdded(QString)), this, SLOT(readConfig()));
+    }
+    else
+    {
+        _accDlg->setAccId(uuid);
+    }
+
+    _accDlg->readConfig();
+
+    _accDlg->show();
+    _accDlg->raise();
+    _accDlg->activateWindow();
+}
+
+void PrefAccounts::remAccountBtnClicked()
+{
+    QList<QTableWidgetSelectionRange> sel = _ui->accountsTable->selectedRanges();
+    int offset =0;
+
+    foreach(QTableWidgetSelectionRange range, sel)
+    {
+        for(int row = range.topRow(); row<=range.bottomRow(); row++)
+        {
+            QTableWidgetItem *item = _ui->accountsTable->item(row-offset,0);
+
+            _settings->beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways");
+            _settings->remove(item->data(Qt::UserRole).toString());
+            _settings->endGroup();
+            /* Fire event to remove account */
+            switch_event_t *event;
+            if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FSCOMM_EVENT_ACC_REMOVED) == SWITCH_STATUS_SUCCESS) {
+                QSharedPointer<Account> acc = g_FSHost.getAccountByUUID(item->data(Qt::UserRole).toString());
+                if (!acc.isNull())
+                {
+                    QString res;
+                    QString arg = QString("profile softphone killgw %1").arg(acc.data()->getName());
+
+                    if (g_FSHost.sendCmd("sofia", arg.toAscii().data() , &res) != SWITCH_STATUS_SUCCESS)
+                    {
+                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not killgw %s from profile softphone.\n",
+                                          acc.data()->getName().toAscii().data());
+                    }
+                }
+            }
+            _ui->accountsTable->removeRow(row-offset);
+            offset++;
+        }
+    }
+
+    if (offset > 0)
+        readConfig(false);
+}
+
+void PrefAccounts::writeConfig()
+{
+    return;
+}
+
+void PrefAccounts::readConfig(bool reload)
+{
+
+    _ui->accountsTable->clearContents();
+    _ui->accountsTable->setRowCount(0);
+
+    _settings->beginGroup("FreeSWITCH/conf/sofia.conf/profiles/profile/gateways");
+    
+    foreach(QString accId, _settings->childGroups())
+    {
+        _settings->beginGroup(accId);
+        _settings->beginGroup("gateway/attrs");
+        QTableWidgetItem *item0 = new QTableWidgetItem(_settings->value("name").toString());
+        item0->setData(Qt::UserRole, accId);
+        _settings->endGroup();
+        _settings->beginGroup("gateway/params");
+        QTableWidgetItem *item1 = new QTableWidgetItem(_settings->value("username").toString());
+        item1->setData(Qt::UserRole, accId);
+        _settings->endGroup();
+        _settings->endGroup();
+        _ui->accountsTable->setRowCount(_ui->accountsTable->rowCount()+1);
+        _ui->accountsTable->setItem(_ui->accountsTable->rowCount()-1, 0, item0);
+        _ui->accountsTable->setItem(_ui->accountsTable->rowCount()-1, 1, item1);
+    }
+    _ui->accountsTable->resizeRowsToContents();
+    _ui->accountsTable->resizeColumnsToContents();
+    _ui->accountsTable->horizontalHeader()->setStretchLastSection(true);
+
+    _settings->endGroup();
+
+    if (reload)
+    {
+        QString res;
+        if (g_FSHost.sendCmd("sofia", "profile softphone rescan", &res) != SWITCH_STATUS_SUCCESS)
+        {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not rescan the softphone profile.\n");
+            return;
+        }
+    }
+
+    if (_ui->accountsTable->rowCount() == 1)
+    {
+        QString default_gateway = _settings->value(QString("/FreeSWITCH/conf/sofia.conf/profiles/profile/gateways/%1/gateway/attrs/name").arg(_ui->accountsTable->item(0,0)->data(Qt::UserRole).toString())).toString();
+        _settings->beginGroup("FreeSWITCH/conf/globals");
+        _settings->setValue("default_gateway", default_gateway);
+        _settings->endGroup();
+        switch_core_set_variable("default_gateway", default_gateway.toAscii().data());
+    }
+
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefaccounts.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefaccounts.h (from rev 16612, freeswitch/trunk/fscomm/preferences/prefaccounts.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefaccounts.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefaccounts.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,32 @@
+#ifndef PREFACCOUNTS_H
+#define PREFACCOUNTS_H
+
+#include <QObject>
+#include "ui_prefdialog.h"
+
+#define FSCOMM_EVENT_ACC_REMOVED "fscomm::acc_removed"
+
+class QSettings;
+class AccountDialog;
+
+class PrefAccounts : public QObject {
+    Q_OBJECT
+public:
+    explicit PrefAccounts(Ui::PrefDialog *ui);
+    void writeConfig();
+
+public slots:
+    void readConfig(bool reload=true);
+
+private slots:
+    void addAccountBtnClicked();
+    void editAccountBtnClicked();
+    void remAccountBtnClicked();
+
+private:
+    Ui::PrefDialog *_ui;
+    AccountDialog *_accDlg;
+    QSettings *_settings;
+};
+
+#endif // PREFACCOUNTS_H

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefdialog.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefdialog.cpp (from rev 16612, freeswitch/trunk/fscomm/preferences/prefdialog.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefdialog.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefdialog.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,51 @@
+#include <QtGui>
+#include "prefdialog.h"
+#include "ui_prefdialog.h"
+#include "prefportaudio.h"
+#include "prefsofia.h"
+#include "prefaccounts.h"
+
+PrefDialog::PrefDialog(QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::PrefDialog)
+{
+    ui->setupUi(this);
+    _settings = new QSettings();
+    connect(this, SIGNAL(accepted()), this, SLOT(writeConfig()));
+
+    _pref_accounts = new PrefAccounts(ui);
+    _mod_portaudio = new PrefPortaudio(ui, this);
+    _mod_sofia = new PrefSofia(ui, this);
+    readConfig();
+}
+
+PrefDialog::~PrefDialog()
+{
+    delete ui;
+}
+
+void PrefDialog::writeConfig()
+{    
+    _mod_portaudio->writeConfig();
+    _mod_sofia->writeConfig();
+
+}
+
+void PrefDialog::changeEvent(QEvent *e)
+{
+    QDialog::changeEvent(e);
+    switch (e->type()) {
+    case QEvent::LanguageChange:
+        ui->retranslateUi(this);
+        break;
+    default:
+        break;
+    }
+}
+
+void PrefDialog::readConfig()
+{
+    _pref_accounts->readConfig();
+    _mod_portaudio->readConfig();
+    _mod_sofia->readConfig();
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefdialog.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefdialog.h (from rev 16612, freeswitch/trunk/fscomm/preferences/prefdialog.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefdialog.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefdialog.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,39 @@
+#ifndef PREFDIALOG_H
+#define PREFDIALOG_H
+
+#include <QDialog>
+#include <QDomDocument>
+#include <QSettings>
+#include <fshost.h>
+
+class PrefPortaudio;
+class PrefSofia;
+class PrefAccounts;
+
+namespace Ui {
+    class PrefDialog;
+}
+
+class PrefDialog : public QDialog {
+    Q_OBJECT
+public:
+    PrefDialog(QWidget *parent = 0);
+    ~PrefDialog();
+
+protected:
+    void changeEvent(QEvent *e);
+
+private slots:
+    void writeConfig();
+
+private:
+    void readConfig();
+    QSettings *_settings;
+    PrefAccounts *_pref_accounts;
+    Ui::PrefDialog *ui;
+    PrefPortaudio *_mod_portaudio;
+    PrefSofia *_mod_sofia;
+};
+
+
+#endif // PREFDIALOG_H

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefdialog.ui

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefdialog.ui (from rev 16612, freeswitch/trunk/fscomm/preferences/prefdialog.ui) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefdialog.ui	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefdialog.ui	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,1074 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>PrefDialog</class>
+ <widget class="QDialog" name="PrefDialog">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>839</width>
+    <height>613</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Preferences</string>
+  </property>
+  <layout class="QGridLayout" name="gridLayout">
+   <item row="0" column="0">
+    <widget class="QListWidget" name="listSections">
+     <property name="minimumSize">
+      <size>
+       <width>120</width>
+       <height>0</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>120</width>
+       <height>16777215</height>
+      </size>
+     </property>
+     <property name="showDropIndicator" stdset="0">
+      <bool>false</bool>
+     </property>
+     <property name="dragDropMode">
+      <enum>QAbstractItemView::NoDragDrop</enum>
+     </property>
+     <property name="iconSize">
+      <size>
+       <width>96</width>
+       <height>84</height>
+      </size>
+     </property>
+     <property name="movement">
+      <enum>QListView::Static</enum>
+     </property>
+     <property name="flow">
+      <enum>QListView::LeftToRight</enum>
+     </property>
+     <property name="isWrapping" stdset="0">
+      <bool>true</bool>
+     </property>
+     <property name="spacing">
+      <number>12</number>
+     </property>
+     <property name="viewMode">
+      <enum>QListView::IconMode</enum>
+     </property>
+     <item>
+      <property name="text">
+       <string>General</string>
+      </property>
+      <property name="icon">
+       <iconset resource="../resources.qrc">
+        <normaloff>:/images/pref_general.jpg</normaloff>:/images/pref_general.jpg</iconset>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>Accounts</string>
+      </property>
+      <property name="icon">
+       <iconset resource="../resources.qrc">
+        <normaloff>:/images/pref_accounts.jpg</normaloff>:/images/pref_accounts.jpg</iconset>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>Sofia</string>
+      </property>
+      <property name="icon">
+       <iconset resource="../resources.qrc">
+        <normaloff>:/images/pref_sip.png</normaloff>:/images/pref_sip.png</iconset>
+      </property>
+     </item>
+     <item>
+      <property name="text">
+       <string>PortAudio</string>
+      </property>
+      <property name="icon">
+       <iconset resource="../resources.qrc">
+        <normaloff>:/images/pref_audio.gif</normaloff>:/images/pref_audio.gif</iconset>
+      </property>
+     </item>
+    </widget>
+   </item>
+   <item row="0" column="1">
+    <widget class="QStackedWidget" name="stackedWidget">
+     <property name="currentIndex">
+      <number>0</number>
+     </property>
+     <widget class="QWidget" name="generalPage">
+      <layout class="QVBoxLayout" name="verticalLayout_3">
+       <item>
+        <widget class="QGroupBox" name="groupBox_5">
+         <property name="title">
+          <string>User Information</string>
+         </property>
+         <layout class="QFormLayout" name="formLayout_4">
+          <item row="0" column="0">
+           <widget class="QLabel" name="label_13">
+            <property name="text">
+             <string>CallerID Name:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <widget class="QLineEdit" name="PaCallerIdNameEdit"/>
+          </item>
+          <item row="1" column="0">
+           <widget class="QLabel" name="label_14">
+            <property name="text">
+             <string>CallerID Number:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="1">
+           <widget class="QLineEdit" name="PaCallerIdNumEdit"/>
+          </item>
+         </layout>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="accountsPage">
+      <layout class="QHBoxLayout" name="horizontalLayout_5">
+       <item>
+        <widget class="QTableWidget" name="accountsTable">
+         <property name="editTriggers">
+          <set>QAbstractItemView::NoEditTriggers</set>
+         </property>
+         <property name="selectionBehavior">
+          <enum>QAbstractItemView::SelectRows</enum>
+         </property>
+         <column>
+          <property name="text">
+           <string>Name</string>
+          </property>
+         </column>
+         <column>
+          <property name="text">
+           <string>Username</string>
+          </property>
+         </column>
+        </widget>
+       </item>
+       <item>
+        <layout class="QVBoxLayout" name="verticalLayout_7">
+         <item>
+          <widget class="QPushButton" name="sofiaGwAddBtn">
+           <property name="text">
+            <string>Add</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="sofiaGwRemBtn">
+           <property name="text">
+            <string>Remove</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="sofiaGwEditBtn">
+           <property name="enabled">
+            <bool>true</bool>
+           </property>
+           <property name="text">
+            <string>Edit</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="verticalSpacer">
+           <property name="orientation">
+            <enum>Qt::Vertical</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>20</width>
+             <height>40</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="sofiaPage">
+      <layout class="QVBoxLayout" name="verticalLayout_2">
+       <item>
+        <widget class="QTabWidget" name="tabWidget">
+         <property name="currentIndex">
+          <number>0</number>
+         </property>
+         <widget class="QWidget" name="tab">
+          <attribute name="title">
+           <string>General</string>
+          </attribute>
+          <layout class="QVBoxLayout" name="verticalLayout_5">
+           <item>
+            <widget class="QGroupBox" name="groupBox">
+             <property name="title">
+              <string>Global</string>
+             </property>
+             <layout class="QFormLayout" name="formLayout">
+              <property name="fieldGrowthPolicy">
+               <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+              </property>
+              <item row="0" column="0">
+               <widget class="QLabel" name="label">
+                <property name="text">
+                 <string>log-level</string>
+                </property>
+               </widget>
+              </item>
+              <item row="0" column="1">
+               <widget class="QSpinBox" name="sofiaLogLevelSpin"/>
+              </item>
+              <item row="1" column="0">
+               <widget class="QLabel" name="label_2">
+                <property name="text">
+                 <string>auto-restart</string>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="1">
+               <widget class="QComboBox" name="sofiaAutoRestartCombo">
+                <item>
+                 <property name="text">
+                  <string>true</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>false</string>
+                 </property>
+                </item>
+               </widget>
+              </item>
+              <item row="2" column="0">
+               <widget class="QLabel" name="label_3">
+                <property name="text">
+                 <string>debug-presence</string>
+                </property>
+               </widget>
+              </item>
+              <item row="2" column="1">
+               <widget class="QSpinBox" name="sofiaDebugPresenceSpin"/>
+              </item>
+              <item row="3" column="0">
+               <widget class="QLabel" name="label_15">
+                <property name="text">
+                 <string>rewrite-multicasted-fs-path</string>
+                </property>
+               </widget>
+              </item>
+              <item row="3" column="1">
+               <widget class="QComboBox" name="sofiaRewriteMulticastedFsPathCombo">
+                <item>
+                 <property name="text">
+                  <string>false</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>true</string>
+                 </property>
+                </item>
+               </widget>
+              </item>
+             </layout>
+            </widget>
+           </item>
+           <item>
+            <widget class="QGroupBox" name="groupBox_6">
+             <property name="sizePolicy">
+              <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+               <horstretch>0</horstretch>
+               <verstretch>0</verstretch>
+              </sizepolicy>
+             </property>
+             <property name="title">
+              <string>Profile</string>
+             </property>
+             <layout class="QFormLayout" name="formLayout_6">
+              <item row="0" column="0">
+               <widget class="QLabel" name="label_4">
+                <property name="text">
+                 <string>user-agent-string</string>
+                </property>
+               </widget>
+              </item>
+              <item row="0" column="1">
+               <widget class="QLineEdit" name="sofiaUserAgentStringEdit">
+                <property name="text">
+                 <string>FreeSWITCH/FSComm</string>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="0">
+               <widget class="QLabel" name="label_26">
+                <property name="text">
+                 <string>hold-music</string>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="1">
+               <widget class="QLineEdit" name="sofiaHoldMusicEdit">
+                <property name="text">
+                 <string>localstream://moh</string>
+                </property>
+               </widget>
+              </item>
+              <item row="2" column="0">
+               <widget class="QLabel" name="label_16">
+                <property name="text">
+                 <string>context</string>
+                </property>
+               </widget>
+              </item>
+              <item row="2" column="1">
+               <widget class="QLineEdit" name="sofiaContextEdit">
+                <property name="text">
+                 <string>public</string>
+                </property>
+               </widget>
+              </item>
+              <item row="3" column="0">
+               <widget class="QLabel" name="label_19">
+                <property name="text">
+                 <string>dialplan</string>
+                </property>
+               </widget>
+              </item>
+              <item row="3" column="1">
+               <widget class="QLineEdit" name="sofiaDialplanEdit">
+                <property name="text">
+                 <string>XML</string>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="tab_2">
+          <attribute name="title">
+           <string>Network</string>
+          </attribute>
+          <layout class="QVBoxLayout" name="verticalLayout_4">
+           <item>
+            <widget class="QGroupBox" name="groupBox_2">
+             <property name="title">
+              <string>Softphone Profile</string>
+             </property>
+             <layout class="QFormLayout" name="formLayout_2">
+              <property name="fieldGrowthPolicy">
+               <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
+              </property>
+              <item row="0" column="0">
+               <widget class="QLabel" name="label_18">
+                <property name="text">
+                 <string>sip-port</string>
+                </property>
+               </widget>
+              </item>
+              <item row="0" column="1">
+               <widget class="QSpinBox" name="sofiaSipPortSpin">
+                <property name="minimum">
+                 <number>1</number>
+                </property>
+                <property name="maximum">
+                 <number>65535</number>
+                </property>
+                <property name="value">
+                 <number>12345</number>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="0">
+               <widget class="QLabel" name="label_22">
+                <property name="text">
+                 <string>use-rtp-timer</string>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="1">
+               <widget class="QComboBox" name="sofiaUseRtpTimerCombo">
+                <item>
+                 <property name="text">
+                  <string>true</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>false</string>
+                 </property>
+                </item>
+               </widget>
+              </item>
+              <item row="2" column="0">
+               <widget class="QLabel" name="label_24">
+                <property name="text">
+                 <string>rtp-ip</string>
+                </property>
+               </widget>
+              </item>
+              <item row="2" column="1">
+               <widget class="QLineEdit" name="sofiaRtpIpEdit">
+                <property name="text">
+                 <string>auto</string>
+                </property>
+               </widget>
+              </item>
+              <item row="3" column="0">
+               <widget class="QLabel" name="label_25">
+                <property name="text">
+                 <string>sip-ip</string>
+                </property>
+               </widget>
+              </item>
+              <item row="3" column="1">
+               <widget class="QLineEdit" name="sofiaSipIpEdit">
+                <property name="text">
+                 <string>auto</string>
+                </property>
+               </widget>
+              </item>
+              <item row="4" column="0">
+               <widget class="QLabel" name="label_27">
+                <property name="text">
+                 <string>apply-nat-acl</string>
+                </property>
+               </widget>
+              </item>
+              <item row="4" column="1">
+               <widget class="QLineEdit" name="sofiaApplyNatAclEdit">
+                <property name="text">
+                 <string>rfc1918</string>
+                </property>
+               </widget>
+              </item>
+              <item row="5" column="0">
+               <widget class="QLabel" name="label_34">
+                <property name="text">
+                 <string>ext-rtp-ip</string>
+                </property>
+               </widget>
+              </item>
+              <item row="5" column="1">
+               <widget class="QLineEdit" name="sofiaExtRtpIpEdit">
+                <property name="text">
+                 <string>stun:stun.freeswitch.org</string>
+                </property>
+               </widget>
+              </item>
+              <item row="6" column="0">
+               <widget class="QLabel" name="label_35">
+                <property name="text">
+                 <string>ext-sip-ip</string>
+                </property>
+               </widget>
+              </item>
+              <item row="6" column="1">
+               <widget class="QLineEdit" name="sofiaExtSipIpEdit">
+                <property name="text">
+                 <string>stun:stun.freeswitch.org</string>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="tab_4">
+          <attribute name="title">
+           <string>Codecs</string>
+          </attribute>
+          <layout class="QFormLayout" name="formLayout_7">
+           <item row="0" column="0">
+            <widget class="QLabel" name="label_21">
+             <property name="text">
+              <string>codec-prefs</string>
+             </property>
+            </widget>
+           </item>
+           <item row="0" column="1">
+            <widget class="QLineEdit" name="sofiaCodecPrefsEdit">
+             <property name="text">
+              <string>CELT@48000h,G7221@32000h,G7221@16000h,G722,PCMU,PCMA,GSM</string>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="0">
+            <widget class="QLabel" name="label_30">
+             <property name="text">
+              <string>inbound-codec-negotiation</string>
+             </property>
+            </widget>
+           </item>
+           <item row="1" column="1">
+            <widget class="QComboBox" name="sofiaInboundCodecNegotiationCombo">
+             <item>
+              <property name="text">
+               <string>generous</string>
+              </property>
+             </item>
+             <item>
+              <property name="text">
+               <string>greedy</string>
+              </property>
+             </item>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+         <widget class="QWidget" name="tab_3">
+          <attribute name="title">
+           <string>Advanced</string>
+          </attribute>
+          <layout class="QVBoxLayout" name="verticalLayout_6">
+           <item>
+            <widget class="QGroupBox" name="groupBox_7">
+             <property name="title">
+              <string>Profile</string>
+             </property>
+             <layout class="QFormLayout" name="formLayout_8">
+              <item row="0" column="0">
+               <widget class="QLabel" name="label_17">
+                <property name="text">
+                 <string>rfc2833-pt</string>
+                </property>
+               </widget>
+              </item>
+              <item row="0" column="1">
+               <widget class="QLineEdit" name="sofiaRfc2833PtEdit">
+                <property name="text">
+                 <string>101</string>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="0">
+               <widget class="QLabel" name="label_5">
+                <property name="text">
+                 <string>debug</string>
+                </property>
+               </widget>
+              </item>
+              <item row="1" column="1">
+               <widget class="QSpinBox" name="sofiaDebugSpin"/>
+              </item>
+              <item row="2" column="0">
+               <widget class="QLabel" name="label_6">
+                <property name="text">
+                 <string>sip-trace</string>
+                </property>
+               </widget>
+              </item>
+              <item row="2" column="1">
+               <widget class="QComboBox" name="sofiaSipTraceCombo">
+                <item>
+                 <property name="text">
+                  <string>false</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>true</string>
+                 </property>
+                </item>
+               </widget>
+              </item>
+              <item row="3" column="0">
+               <widget class="QLabel" name="label_20">
+                <property name="text">
+                 <string>dtmf-duration</string>
+                </property>
+               </widget>
+              </item>
+              <item row="3" column="1">
+               <widget class="QSpinBox" name="sofiaDtmfDurationSpin">
+                <property name="maximum">
+                 <number>1000</number>
+                </property>
+                <property name="value">
+                 <number>100</number>
+                </property>
+               </widget>
+              </item>
+              <item row="4" column="0">
+               <widget class="QLabel" name="label_23">
+                <property name="text">
+                 <string>rtp-timer-name</string>
+                </property>
+               </widget>
+              </item>
+              <item row="4" column="1">
+               <widget class="QLineEdit" name="sofiaRtpTimerNameEdit">
+                <property name="text">
+                 <string>soft</string>
+                </property>
+               </widget>
+              </item>
+              <item row="5" column="0">
+               <widget class="QLabel" name="label_28">
+                <property name="text">
+                 <string>manage-presence</string>
+                </property>
+               </widget>
+              </item>
+              <item row="5" column="1">
+               <widget class="QComboBox" name="sofiaManagePresenceCombo">
+                <item>
+                 <property name="text">
+                  <string>false</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>true</string>
+                 </property>
+                </item>
+               </widget>
+              </item>
+              <item row="6" column="0">
+               <widget class="QLabel" name="label_29">
+                <property name="text">
+                 <string>max-proceeding</string>
+                </property>
+               </widget>
+              </item>
+              <item row="6" column="1">
+               <widget class="QSpinBox" name="sofiaMaxProceedingEdit">
+                <property name="value">
+                 <number>3</number>
+                </property>
+               </widget>
+              </item>
+              <item row="7" column="0">
+               <widget class="QLabel" name="label_31">
+                <property name="text">
+                 <string>nonce-ttl</string>
+                </property>
+               </widget>
+              </item>
+              <item row="7" column="1">
+               <widget class="QSpinBox" name="sofiaNonceTtlSpin">
+                <property name="value">
+                 <number>60</number>
+                </property>
+               </widget>
+              </item>
+              <item row="8" column="0">
+               <widget class="QLabel" name="label_36">
+                <property name="text">
+                 <string>rtp-timeout-sec</string>
+                </property>
+               </widget>
+              </item>
+              <item row="8" column="1">
+               <widget class="QSpinBox" name="sofiaRtpTimeoutSecSpin">
+                <property name="maximum">
+                 <number>1000</number>
+                </property>
+                <property name="value">
+                 <number>300</number>
+                </property>
+               </widget>
+              </item>
+              <item row="9" column="0">
+               <widget class="QLabel" name="label_37">
+                <property name="text">
+                 <string>rtp-hold-timeout-sec</string>
+                </property>
+               </widget>
+              </item>
+              <item row="9" column="1">
+               <widget class="QSpinBox" name="sofiaRtpHoldTimeoutSecSpin">
+                <property name="maximum">
+                 <number>5000</number>
+                </property>
+                <property name="value">
+                 <number>1800</number>
+                </property>
+               </widget>
+              </item>
+              <item row="10" column="0">
+               <widget class="QLabel" name="label_32">
+                <property name="text">
+                 <string>auth-calls</string>
+                </property>
+               </widget>
+              </item>
+              <item row="10" column="1">
+               <widget class="QComboBox" name="sofiaAuthCallsCombo">
+                <item>
+                 <property name="text">
+                  <string>false</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>true</string>
+                 </property>
+                </item>
+               </widget>
+              </item>
+              <item row="11" column="0">
+               <widget class="QLabel" name="label_33">
+                <property name="text">
+                 <string>auth-all-packets</string>
+                </property>
+               </widget>
+              </item>
+              <item row="11" column="1">
+               <widget class="QComboBox" name="sofiaAuthAllPacketsCombo">
+                <item>
+                 <property name="text">
+                  <string>false</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>true</string>
+                 </property>
+                </item>
+               </widget>
+              </item>
+              <item row="12" column="0">
+               <widget class="QLabel" name="label_38">
+                <property name="text">
+                 <string>disable-register</string>
+                </property>
+               </widget>
+              </item>
+              <item row="12" column="1">
+               <widget class="QComboBox" name="sofiaDisableRegisterCombo">
+                <item>
+                 <property name="text">
+                  <string>true</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>false</string>
+                 </property>
+                </item>
+               </widget>
+              </item>
+              <item row="13" column="0">
+               <widget class="QLabel" name="label_39">
+                <property name="text">
+                 <string>challenge-realm</string>
+                </property>
+               </widget>
+              </item>
+              <item row="13" column="1">
+               <widget class="QComboBox" name="sofiaChallengeRealmCombo">
+                <item>
+                 <property name="text">
+                  <string>auto_from</string>
+                 </property>
+                </item>
+                <item>
+                 <property name="text">
+                  <string>auto_to</string>
+                 </property>
+                </item>
+               </widget>
+              </item>
+             </layout>
+            </widget>
+           </item>
+          </layout>
+         </widget>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="portaudioPage">
+      <layout class="QVBoxLayout" name="verticalLayout">
+       <item>
+        <widget class="QGroupBox" name="groupBox_3">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="title">
+          <string>Devices</string>
+         </property>
+         <layout class="QFormLayout" name="formLayout_3">
+          <item row="0" column="0">
+           <widget class="QLabel" name="label_7">
+            <property name="text">
+             <string>indev</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <widget class="QComboBox" name="PaIndevCombo"/>
+          </item>
+          <item row="1" column="0">
+           <widget class="QLabel" name="label_8">
+            <property name="text">
+             <string>outdev</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="1">
+           <layout class="QHBoxLayout" name="horizontalLayout_3">
+            <item>
+             <widget class="QComboBox" name="PaOutdevCombo"/>
+            </item>
+            <item>
+             <widget class="QPushButton" name="PaOutdevTestBtn">
+              <property name="enabled">
+               <bool>false</bool>
+              </property>
+              <property name="maximumSize">
+               <size>
+                <width>86</width>
+                <height>27</height>
+               </size>
+              </property>
+              <property name="text">
+               <string>Test</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+          <item row="2" column="0">
+           <widget class="QLabel" name="label_9">
+            <property name="text">
+             <string>rindgev</string>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="1">
+           <layout class="QHBoxLayout" name="horizontalLayout_2">
+            <item>
+             <widget class="QComboBox" name="PaRingdevCombo"/>
+            </item>
+            <item>
+             <widget class="QPushButton" name="PaRingdevTestBtn">
+              <property name="enabled">
+               <bool>true</bool>
+              </property>
+              <property name="maximumSize">
+               <size>
+                <width>86</width>
+                <height>27</height>
+               </size>
+              </property>
+              <property name="text">
+               <string>Test</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+          <item row="3" column="1">
+           <layout class="QHBoxLayout" name="horizontalLayout_6">
+            <item>
+             <widget class="QPushButton" name="PaLoopTestBtn">
+              <property name="text">
+               <string>Loop Test</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="PaRefreshDevListBtn">
+              <property name="text">
+               <string>Refresh DevList</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+          <item row="4" column="0">
+           <widget class="QLabel" name="label_40">
+            <property name="text">
+             <string>Sample Rate</string>
+            </property>
+           </widget>
+          </item>
+          <item row="4" column="1">
+           <widget class="QLineEdit" name="PaSampleRateEdit">
+            <property name="text">
+             <string>16000</string>
+            </property>
+           </widget>
+          </item>
+          <item row="5" column="0">
+           <widget class="QLabel" name="label_41">
+            <property name="text">
+             <string>Codec MS</string>
+            </property>
+           </widget>
+          </item>
+          <item row="5" column="1">
+           <widget class="QLineEdit" name="PaCodecMSEdit">
+            <property name="text">
+             <string>10</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </item>
+       <item>
+        <widget class="QGroupBox" name="groupBox_4">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="title">
+          <string>Files</string>
+         </property>
+         <layout class="QFormLayout" name="formLayout_5">
+          <item row="0" column="0">
+           <widget class="QLabel" name="label_10">
+            <property name="text">
+             <string>ring-file</string>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <layout class="QHBoxLayout" name="horizontalLayout_4">
+            <item>
+             <widget class="QLineEdit" name="PaRingFileEdit">
+              <property name="text">
+               <string>tone_stream://%(2000,4000,440.0,480.0);loops=20</string>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="PaRingFileBtn">
+              <property name="text">
+               <string>Open</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+          <item row="1" column="0">
+           <widget class="QLabel" name="label_12">
+            <property name="text">
+             <string>ring-interval</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="1">
+           <widget class="QSpinBox" name="PaRingIntervalSpin">
+            <property name="value">
+             <number>5</number>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="0">
+           <widget class="QLabel" name="label_11">
+            <property name="text">
+             <string>hold-file</string>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="1">
+           <layout class="QHBoxLayout" name="horizontalLayout">
+            <item>
+             <widget class="QLineEdit" name="PaHoldFileEdit">
+              <property name="readOnly">
+               <bool>true</bool>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <widget class="QPushButton" name="PaHoldFileBtn">
+              <property name="text">
+               <string>Open</string>
+              </property>
+             </widget>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+    </widget>
+   </item>
+   <item row="1" column="1">
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources>
+  <include location="../resources.qrc"/>
+ </resources>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>PrefDialog</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>544</x>
+     <y>224</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>246</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>PrefDialog</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>544</x>
+     <y>230</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>246</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>listSections</sender>
+   <signal>currentRowChanged(int)</signal>
+   <receiver>stackedWidget</receiver>
+   <slot>setCurrentIndex(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>180</x>
+     <y>83</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>524</x>
+     <y>102</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefportaudio.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefportaudio.cpp (from rev 16612, freeswitch/trunk/fscomm/preferences/prefportaudio.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefportaudio.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefportaudio.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,353 @@
+#include <QtGui>
+#include <fshost.h>
+#include "prefportaudio.h"
+
+PrefPortaudio::PrefPortaudio(Ui::PrefDialog *ui, QObject *parent) :
+        QObject(parent),
+        _ui(ui)
+{
+    _settings = new QSettings();
+    connect(_ui->PaRingFileBtn, SIGNAL(clicked()), this, SLOT(ringFileChoose()));
+    connect(_ui->PaHoldFileBtn, SIGNAL(clicked()), this, SLOT(holdFileChoose()));
+    connect(_ui->PaIndevCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(indevChangeDev(int)));
+    connect(_ui->PaOutdevCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(outdevChangeDev(int)));
+    connect(_ui->PaRingdevCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(ringdevChangeDev(int)));
+    connect(_ui->PaRingdevTestBtn, SIGNAL(clicked()), this, SLOT(ringdevTest()));
+    connect(_ui->PaLoopTestBtn, SIGNAL(clicked()), this, SLOT(loopTest()));
+    connect(_ui->PaRefreshDevListBtn, SIGNAL(clicked()), this, SLOT(refreshDevList()));
+}
+
+void PrefPortaudio::ringdevTest()
+{
+    QString result;
+    if (g_FSHost.sendCmd("pa", QString("play %1/.fscomm/sounds/test.wav 0").arg(QDir::homePath()).toAscii().constData(), &result) != SWITCH_STATUS_SUCCESS)
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error testing ringdev on mod_portaudio! %s\n",
+                          result.toAscii().constData());
+    }
+}
+
+void PrefPortaudio::loopTest()
+{
+    QString result;
+    _ui->PaLoopTestBtn->setEnabled(false);
+    if (g_FSHost.sendCmd("pa", "looptest", &result) != SWITCH_STATUS_SUCCESS)
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error running looptest on mod_portaudio! %s\n",
+                          result.toAscii().constData());
+    }
+    _ui->PaLoopTestBtn->setEnabled(true);
+}
+
+void PrefPortaudio::refreshDevList()
+{
+    QString result;
+    if (g_FSHost.sendCmd("pa", "rescan", &result) != SWITCH_STATUS_SUCCESS)
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error rescaning sound device on mod_portaudio! %s\n",
+                          result.toAscii().constData());
+    }
+    //clear combox
+    _ui->PaIndevCombo->clear();
+    _ui->PaOutdevCombo->clear();
+    _ui->PaRingdevCombo->clear();
+    getPaDevlist();
+}
+
+void PrefPortaudio::indevChangeDev(int index)
+{
+    QString result;
+    int dev = _ui->PaIndevCombo->itemData(index, Qt::UserRole).toInt();
+    if (g_FSHost.sendCmd("pa", QString("indev #%1").arg(dev).toAscii().constData(), &result) != SWITCH_STATUS_SUCCESS)
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting ringdev to #%d on mod_portaudio!\n", dev);
+        QMessageBox::critical(0, tr("Unable to change device."),
+                              tr("There was an error changing the ringdev.\nPlease report this bug."),
+                              QMessageBox::Ok);
+
+    }
+}
+
+void PrefPortaudio::ringdevChangeDev(int index)
+{
+    QString result;
+    int dev = _ui->PaRingdevCombo->itemData(index, Qt::UserRole).toInt();
+    if (g_FSHost.sendCmd("pa", QString("ringdev #%1").arg(dev).toAscii().constData(), &result) != SWITCH_STATUS_SUCCESS)
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting ringdev to #%d on mod_portaudio!\n", dev);
+        QMessageBox::critical(0, tr("Unable to change device."),
+                              tr("There was an error changing the ringdev.\nPlease report this bug."),
+                              QMessageBox::Ok);
+
+    }
+}
+
+void PrefPortaudio::outdevChangeDev(int index)
+{
+    QString result;
+    int dev = _ui->PaRingdevCombo->itemData(index, Qt::UserRole).toInt();
+    if (g_FSHost.sendCmd("pa", QString("outdev #%1").arg(dev).toAscii().constData(), &result) != SWITCH_STATUS_SUCCESS)
+    {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting outdev to #%d on mod_portaudio!\n", dev);
+        QMessageBox::critical(0, tr("Unable to change device."),
+                              tr("There was an error changing the outdev.\nPlease report this bug."),
+                              QMessageBox::Ok);
+    }
+}
+
+void PrefPortaudio::holdFileChoose()
+{
+    QString fileName = QFileDialog::getOpenFileName(0,
+                                                    tr("Select file"),
+                                                    QDir::homePath(),
+                                                    NULL);
+    if (!fileName.isNull())
+        _ui->PaHoldFileEdit->setText(fileName);
+}
+
+void PrefPortaudio::ringFileChoose()
+{
+    QString fileName = QFileDialog::getOpenFileName(0,
+                                                    tr("Select file"),
+                                                    QDir::homePath(),
+                                                    NULL);
+    if (!fileName.isNull())
+        _ui->PaRingFileEdit->setText(fileName);
+}
+
+void PrefPortaudio::writeConfig()
+{
+    _settings->beginGroup("FreeSWITCH/conf");
+    _settings->beginGroup("portaudio.conf/settings/params");
+
+    QString cid_name = _settings->value("cid-name").toString();
+    QString ncid_name = _ui->PaCallerIdNameEdit->text();
+
+    QString cid_num = _settings->value("cid-num").toString();
+    QString ncid_num = _ui->PaCallerIdNumEdit->text();
+
+    QString hold_file = _settings->value("hold-file").toString();
+    QString nhold_file =  _ui->PaHoldFileEdit->text();
+
+    QString ring_file = _settings->value("ring-file").toString();
+    QString nring_file = _ui->PaRingFileEdit->text();
+
+    int ring_interval = _settings->value("ring-interval").toInt();
+    int nring_interval = _ui->PaRingIntervalSpin->value();
+
+    QString sample_rate = _settings->value("sample-rate").toString();
+    QString nsample_rate = _ui->PaSampleRateEdit->text();
+
+    QString codec_ms = _settings->value("codec-ms").toString();
+    QString ncodec_ms = _ui->PaCodecMSEdit->text();
+
+    QString result;
+
+    if (cid_name != ncid_name ||
+        cid_num != ncid_num ||
+        hold_file != nhold_file ||
+        ring_file != nring_file ||
+        ring_interval != nring_interval ||
+        sample_rate != nsample_rate||
+        codec_ms != ncodec_ms)
+    {
+        if (g_FSHost.sendCmd("reload", "mod_portaudio", &result) == SWITCH_STATUS_SUCCESS)
+        {
+            _settings->setValue("cid-name", ncid_name);
+            _settings->setValue("cid-num", ncid_num);
+            _settings->setValue("ring-file", nring_file);
+            _settings->setValue("ring-interval", nring_interval);
+            _settings->setValue("hold-file", nhold_file);
+            _settings->setValue("sample-rate", nsample_rate);
+            _settings->setValue("codec-ms", ncodec_ms);
+        }
+        else
+        {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error while issuing reload command to mod_portaudio!\n");
+            QMessageBox::critical(0, tr("Unable to save settings"),
+                                  tr("There was an error saving your settings.\nPlease report this bug."),
+                                  QMessageBox::Ok);
+        }
+    }
+
+    int nindev = _ui->PaIndevCombo->itemData(_ui->PaIndevCombo->currentIndex(), Qt::UserRole).toInt();
+    int indev = _settings->value("indev").toInt();
+    int noutdev = _ui->PaOutdevCombo->itemData(_ui->PaOutdevCombo->currentIndex(), Qt::UserRole).toInt();
+    int outdev = _settings->value("outdev").toInt();
+    int nringdev = _ui->PaRingdevCombo->itemData(_ui->PaRingdevCombo->currentIndex(), Qt::UserRole).toInt();
+    int ringdev = _settings->value("ringdev").toInt();
+
+    if (nindev != indev)
+    {
+        if (g_FSHost.sendCmd("pa", QString("indev #%1").arg(nindev).toAscii().constData(), &result) == SWITCH_STATUS_SUCCESS)
+        {
+            _settings->setValue("indev", nindev);
+        }
+        else
+        {
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error setting indev from #%d to #%d on mod_portaudio!\n",
+                              indev, nindev);
+            QMessageBox::critical(0, tr("Unable to save settings"),
+                                  tr("There was an error changing the indev.\nPlease report this bug."),
+                                  QMessageBox::Ok);
+        }
+    }
+
+    if (noutdev!= outdev)
+    {
+        _settings->setValue("outdev", noutdev);
+    }
+    if (nringdev != ringdev)
+    {
+        _settings->setValue("ringdev", nringdev);
+    }
+
+    _settings->endGroup();
+    _settings->endGroup();
+}
+
+void PrefPortaudio::readConfig()
+{
+    getPaDevlist();
+    _settings->beginGroup("FreeSWITCH/conf");
+
+    _settings->beginGroup("portaudio.conf/settings/params");
+    _ui->PaCallerIdNameEdit->setText(_settings->value("cid-name").toString());
+    _ui->PaCallerIdNumEdit->setText(_settings->value("cid-num").toString());
+    _ui->PaHoldFileEdit->setText(_settings->value("hold-file").toString());
+    _ui->PaRingFileEdit->setText(_settings->value("ring-file").toString());
+    _ui->PaRingIntervalSpin->setValue(_settings->value("ring-interval").toInt());
+    _ui->PaSampleRateEdit->setText(_settings->value("sample-rate").toString());
+    _ui->PaCodecMSEdit->setText(_settings->value("codec-ms").toString());
+    _settings->endGroup();
+
+    _settings->endGroup();
+}
+
+void PrefPortaudio::getPaDevlist()
+{
+    QString result;
+    int errorLine, errorColumn;
+    QString errorMsg;
+
+    if (g_FSHost.sendCmd("pa", "devlist xml", &result) != SWITCH_STATUS_SUCCESS)
+    {
+        QMessageBox::critical(0, tr("PortAudio error" ),
+                              tr("Error querying audio devices."),
+                              QMessageBox::Ok);
+        return;
+    }
+
+    if (!_xmlPaDevList.setContent(result, &errorMsg, &errorLine, &errorColumn))
+    {
+        QMessageBox::critical(0, tr("PortAudio error" ),
+                              tr("Error parsing output xml from pa devlist.\n%1 (Line:%2, Col:%3).").arg(errorMsg,
+                                                                                                         errorLine,
+                                                                                                         errorColumn),
+                              QMessageBox::Ok);
+        return;
+    }
+    QDomElement root = _xmlPaDevList.documentElement();
+    if (root.tagName() != "xml")
+    {
+        QMessageBox::critical(0, tr("PortAudio error" ),
+                              tr("Error parsing output xml from pa devlist. Root tag is not <xml>."),
+                              QMessageBox::Ok);
+        return;
+    }
+    QDomElement devices = root.firstChildElement("devices");
+    if (devices.isNull())
+    {
+        QMessageBox::critical(0, tr("PortAudio error" ),
+                              tr("Error parsing output xml from pa devlist. There is no <devices> tag."),
+                              QMessageBox::Ok);
+        return;
+    }
+
+    QDomElement child = devices.firstChildElement();
+    if (child.isNull())
+    {
+        QMessageBox::critical(0, tr("PortAudio error" ),
+                              tr("Error parsing output xml from pa devlist. There is no <device> tag."),
+                              QMessageBox::Ok);
+        return;
+    }
+
+    while (!child.isNull())
+    {
+        if (child.tagName() == "device")
+        {
+            QString id, name, inputs, outputs;
+            id = child.attribute("id","-1");
+            name = child.attribute("name","Null");
+            inputs = child.attribute("inputs","0");
+            outputs = child.attribute("outputs","0");
+            if (inputs.toInt() != 0)
+                _ui->PaIndevCombo->addItem(name,id.toInt());
+            if (outputs.toInt() != 0)
+            {
+                _ui->PaOutdevCombo->addItem(name,id.toInt());
+                _ui->PaRingdevCombo->addItem(name,id.toInt());
+            }
+        }
+        child = child.nextSiblingElement();
+    }
+
+    QDomElement bindings = root.firstChildElement("bindings");
+    if (bindings.isNull())
+    {
+        QMessageBox::critical(0, tr("PortAudio error" ),
+                              tr("Error parsing output xml from pa devlist. There is no <bindings> tag."),
+                              QMessageBox::Ok);
+        return;
+    }
+
+    child = bindings.firstChildElement();
+    if (child.isNull())
+    {
+        QMessageBox::critical(0, tr("PortAudio error" ),
+                              tr("Error parsing output xml from pa devlist. There are no bindings."),
+                              QMessageBox::Ok);
+        return;
+    }
+
+    while (!child.isNull())
+    {
+        QString id = child.attribute("device","-1");
+        if (child.tagName() == "ring")
+        {
+            for(int itemId=0; itemId<_ui->PaRingdevCombo->count(); itemId++)
+            {
+                if (id == _ui->PaRingdevCombo->itemData(itemId,Qt::UserRole))
+                {
+                    //setCurrentIndex triggers currentIndexChanged signal, hmmm...
+                    _ui->PaRingdevCombo->setCurrentIndex(itemId);
+                    break;
+                }
+            }
+        }
+        else if (child.tagName() == "input")
+        {
+            for(int itemId=0; itemId<_ui->PaRingdevCombo->count(); itemId++)
+            {
+                if (id == _ui->PaIndevCombo->itemData(itemId,Qt::UserRole))
+                {
+                    _ui->PaIndevCombo->setCurrentIndex(itemId);
+                    break;
+                }
+            }
+        }
+        else if (child.tagName() == "output")
+            for(int itemId=0; itemId<_ui->PaOutdevCombo->count(); itemId++)
+            {
+                if (id == _ui->PaOutdevCombo->itemData(itemId,Qt::UserRole))
+                {
+                    _ui->PaOutdevCombo->setCurrentIndex(itemId);
+                    break;
+                }
+            }
+
+        child = child.nextSiblingElement();
+    }
+
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefportaudio.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefportaudio.h (from rev 16612, freeswitch/trunk/fscomm/preferences/prefportaudio.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefportaudio.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefportaudio.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,34 @@
+#ifndef PREFPORTAUDIO_H
+#define PREFPORTAUDIO_H
+
+#include <QObject>
+#include <QDomDocument>
+#include "ui_prefdialog.h"
+
+class QSettings;
+
+class PrefPortaudio : public QObject
+{
+Q_OBJECT
+public:
+    explicit PrefPortaudio(Ui::PrefDialog *ui, QObject *parent = 0);
+    void writeConfig();
+    void readConfig();
+
+private slots:
+    void ringFileChoose();
+    void holdFileChoose();
+    void indevChangeDev(int);
+    void outdevChangeDev(int);
+    void ringdevChangeDev(int);
+    void ringdevTest();
+    void loopTest();
+    void refreshDevList();
+private:
+    void getPaDevlist(void);
+    QSettings *_settings;
+    Ui::PrefDialog *_ui;
+    QDomDocument _xmlPaDevList;
+};
+
+#endif // PREFPORTAUDIO_H

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefsofia.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefsofia.cpp (from rev 16612, freeswitch/trunk/fscomm/preferences/prefsofia.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefsofia.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefsofia.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,129 @@
+#include <QtGui>
+#include <fshost.h>
+#include "prefsofia.h"
+
+PrefSofia::PrefSofia(Ui::PrefDialog *ui, QObject *parent) :
+        QObject(parent),
+        _ui(ui)
+{
+}
+
+void PrefSofia::readConfig()
+{
+    QSettings settings;
+    int guess_mask;
+    char guess_ip[80];
+    switch_find_local_ip(guess_ip, sizeof(guess_ip), &guess_mask, AF_INET);
+    _ui->sofiaRtpIpEdit->setText(QString(guess_ip));
+    _ui->sofiaSipIpEdit->setText(QString(guess_ip));
+
+    settings.beginGroup("FreeSWITCH/conf");
+    settings.beginGroup("sofia.conf");
+
+    /* General Settings */
+    settings.beginGroup("global_settings/params");
+    _ui->sofiaLogLevelSpin->setValue(settings.value("log-level").toInt());
+    _ui->sofiaAutoRestartCombo->setCurrentIndex(_ui->sofiaAutoRestartCombo->findText(settings.value("auto-restart").toString()));
+    _ui->sofiaDebugPresenceSpin->setValue(settings.value("debug-presence").toInt());
+    _ui->sofiaRewriteMulticastedFsPathCombo->setCurrentIndex(_ui->sofiaRewriteMulticastedFsPathCombo->findText(settings.value("rewrite-multicasted-fs-path").toString()));
+    settings.endGroup();
+
+    /* Profile settings */
+    settings.beginGroup("profiles");
+    settings.beginGroup("profile");
+
+
+    settings.beginGroup("settings/params");
+    _ui->sofiaUserAgentStringEdit->setText(settings.value("user-agent-string").toString());
+    _ui->sofiaDebugSpin->setValue(settings.value("debug").toInt());
+    _ui->sofiaSipTraceCombo->setCurrentIndex(_ui->sofiaSipTraceCombo->findText(settings.value("sip-trace").toString()));
+    _ui->sofiaContextEdit->setText(settings.value("context").toString());
+    _ui->sofiaRfc2833PtEdit->setText(settings.value("rfc2833-pt").toString());
+    _ui->sofiaSipPortSpin->setValue(settings.value("sip-port").toInt());
+    _ui->sofiaDialplanEdit->setText(settings.value("dialplan").toString());
+    _ui->sofiaDtmfDurationSpin->setValue(settings.value("dtmf-duration").toInt());
+    _ui->sofiaCodecPrefsEdit->setText(settings.value("codec-prefs").toString());
+    _ui->sofiaUseRtpTimerCombo->setCurrentIndex(_ui->sofiaUseRtpTimerCombo->findText(settings.value("use-rtp-timer").toString()));
+    _ui->sofiaRtpTimerNameEdit->setText(settings.value("rtp-timer-name").toString());
+    _ui->sofiaRtpIpEdit->setText(settings.value("rtp-ip").toString());
+    _ui->sofiaSipIpEdit->setText(settings.value("sip-ip").toString());
+    _ui->sofiaHoldMusicEdit->setText(settings.value("hold-music").toString());
+    _ui->sofiaApplyNatAclEdit->setText(settings.value("apply-nat-acl").toString());
+    _ui->sofiaManagePresenceCombo->setCurrentIndex(_ui->sofiaManagePresenceCombo->findText(settings.value("manage-presence").toString()));
+    _ui->sofiaMaxProceedingEdit->setValue(settings.value("max-proceeding").toInt());
+    _ui->sofiaInboundCodecNegotiationCombo->setCurrentIndex(_ui->sofiaInboundCodecNegotiationCombo->findText(settings.value("inbound-codec-negotiation").toString()));
+    _ui->sofiaNonceTtlSpin->setValue(settings.value("nonce-ttl").toInt());
+    _ui->sofiaAuthCallsCombo->setCurrentIndex(_ui->sofiaAuthCallsCombo->findText(settings.value("auth-calls").toString()));
+    _ui->sofiaAuthAllPacketsCombo->setCurrentIndex(_ui->sofiaAuthAllPacketsCombo->findText(settings.value("auth-all-packets").toString()));
+    _ui->sofiaExtRtpIpEdit->setText(settings.value("ext-rtp-ip").toString());
+    _ui->sofiaExtSipIpEdit->setText(settings.value("ext-sip-ip").toString());
+    _ui->sofiaRtpTimeoutSecSpin->setValue(settings.value("rtp-timeout-sec").toInt());
+    _ui->sofiaRtpHoldTimeoutSecSpin->setValue(settings.value("rtp-hold-timeout-sec").toInt());
+    _ui->sofiaDisableRegisterCombo->setCurrentIndex(_ui->sofiaDisableRegisterCombo->findText(settings.value("disable-register").toString()));
+    _ui->sofiaChallengeRealmCombo->setCurrentIndex(_ui->sofiaChallengeRealmCombo->findText(settings.value("challenge-realm").toString()));
+    settings.endGroup();
+
+    settings.endGroup();
+    settings.endGroup();
+    settings.endGroup();
+    settings.endGroup();
+
+}
+
+void PrefSofia::writeConfig()
+{
+    QSettings settings;
+    settings.beginGroup("FreeSWITCH/conf");
+    settings.beginGroup("sofia.conf");
+
+    /* General Settings */
+    settings.beginGroup("global_settings/params");
+    settings.setValue("log-level", _ui->sofiaLogLevelSpin->value());
+    settings.setValue("auto-restart", _ui->sofiaAutoRestartCombo->currentText());
+    settings.setValue("debug-presence", _ui->sofiaDebugPresenceSpin->value());
+    settings.setValue("rewrite-multicasted-fs-path", _ui->sofiaRewriteMulticastedFsPathCombo->currentText());
+    settings.endGroup();
+
+    /* Profile settings */
+    settings.beginGroup("profiles");
+    settings.beginGroup("profile");
+
+    settings.beginGroup("attrs");
+    settings.setValue("name", "softphone");
+    settings.endGroup();
+
+    settings.beginGroup("settings/params");
+    settings.setValue("user-agent-string", _ui->sofiaUserAgentStringEdit->text());
+    settings.setValue("debug", _ui->sofiaDebugSpin->value());
+    settings.setValue("sip-trace", _ui->sofiaSipTraceCombo->currentText());
+    settings.setValue("context", _ui->sofiaContextEdit->text());
+    settings.setValue("rfc2833-pt", _ui->sofiaRfc2833PtEdit->text());
+    settings.setValue("sip-port", _ui->sofiaSipPortSpin->value());
+    settings.setValue("dialplan", _ui->sofiaDialplanEdit->text());
+    settings.setValue("dtmf-duration", _ui->sofiaDtmfDurationSpin->value());
+    settings.setValue("codec-prefs", _ui->sofiaCodecPrefsEdit->text());
+    settings.setValue("use-rtp-timer", _ui->sofiaUseRtpTimerCombo->currentText());
+    settings.setValue("rtp-timer-name", _ui->sofiaRtpTimerNameEdit->text());
+    settings.setValue("rtp-ip", _ui->sofiaRtpIpEdit->text());
+    settings.setValue("sip-ip", _ui->sofiaSipIpEdit->text());
+    settings.setValue("hold-music", _ui->sofiaHoldMusicEdit->text());
+    settings.setValue("apply-nat-acl", _ui->sofiaApplyNatAclEdit->text());
+    settings.setValue("manage-presence", _ui->sofiaManagePresenceCombo->currentText());
+    settings.setValue("max-proceeding", _ui->sofiaMaxProceedingEdit->text());
+    settings.setValue("inbound-codec-negotiation", _ui->sofiaInboundCodecNegotiationCombo->currentText());
+    settings.setValue("nonce-ttl", _ui->sofiaNonceTtlSpin->value());
+    settings.setValue("auth-calls", _ui->sofiaAuthCallsCombo->currentText());
+    settings.setValue("auth-all-packets", _ui->sofiaAuthAllPacketsCombo->currentText());
+    settings.setValue("ext-rtp-ip", _ui->sofiaExtRtpIpEdit->text());
+    settings.setValue("ext-sip-ip", _ui->sofiaExtSipIpEdit->text());
+    settings.setValue("rtp-timeout-sec", _ui->sofiaRtpTimeoutSecSpin->value());
+    settings.setValue("rtp-hold-timeout-sec", _ui->sofiaRtpHoldTimeoutSecSpin->value());
+    settings.setValue("disable-register", _ui->sofiaDisableRegisterCombo->currentText());
+    settings.setValue("challenge-realm", _ui->sofiaChallengeRealmCombo->currentText());
+    settings.endGroup();
+
+    settings.endGroup();
+    settings.endGroup();
+    settings.endGroup();
+    settings.endGroup();
+}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefsofia.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefsofia.h (from rev 16612, freeswitch/trunk/fscomm/preferences/prefsofia.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefsofia.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/preferences/prefsofia.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,20 @@
+#ifndef PREFSOFIA_H
+#define PREFSOFIA_H
+
+#include <QObject>
+#include "ui_prefdialog.h"
+
+class PrefSofia : public QObject
+{
+Q_OBJECT
+public:
+    explicit PrefSofia(Ui::PrefDialog *ui, QObject *parent = 0);
+    void writeConfig();
+    void readConfig();
+
+private:
+    Ui::PrefDialog *_ui;
+
+};
+
+#endif // PREFSOFIA_H

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/resources (from rev 16612, freeswitch/trunk/fscomm/resources)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/resources/pref_accounts.jpg

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/resources/pref_accounts.jpg (from rev 16612, freeswitch/trunk/fscomm/resources/pref_accounts.jpg)


(Binary files differ)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/resources/pref_audio.gif

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/resources/pref_audio.gif (from rev 16612, freeswitch/trunk/fscomm/resources/pref_audio.gif)


(Binary files differ)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/resources/pref_general.jpg

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/resources/pref_general.jpg (from rev 16612, freeswitch/trunk/fscomm/resources/pref_general.jpg)


(Binary files differ)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/resources/pref_sip.png

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/resources/pref_sip.png (from rev 16612, freeswitch/trunk/fscomm/resources/pref_sip.png)


(Binary files differ)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/resources/splash.png

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/resources/splash.png (from rev 16612, freeswitch/trunk/fscomm/resources/splash.png)


(Binary files differ)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/resources/taskbar_icon.png

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/resources/taskbar_icon.png (from rev 16612, freeswitch/trunk/fscomm/resources/taskbar_icon.png)


(Binary files differ)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/resources/test.wav

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/resources/test.wav (from rev 16612, freeswitch/trunk/fscomm/resources/test.wav)


(Binary files differ)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/resources.qrc

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/resources.qrc (from rev 16612, freeswitch/trunk/fscomm/resources.qrc) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/resources.qrc	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/fscomm/resources.qrc	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,16 @@
+<RCC>
+    <qresource prefix="/images">
+        <file alias="splash.png">resources/splash.png</file>
+        <file alias="pref_sip.png">resources/pref_sip.png</file>
+        <file alias="pref_audio.gif">resources/pref_audio.gif</file>
+        <file alias="pref_general.jpg">resources/pref_general.jpg</file>
+        <file alias="pref_accounts.jpg">resources/pref_accounts.jpg</file>
+        <file alias="taskbar_icon.png">resources/taskbar_icon.png</file>
+    </qresource>
+    <qresource prefix="/confs">
+        <file alias="freeswitch.xml">conf/freeswitch.xml</file>
+    </qresource>
+    <qresource prefix="/sounds">
+        <file alias="test.wav">resources/test.wav</file>
+    </qresource>
+</RCC>

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs


Name: svn:ignore
   - libpri*
wanpipe*
*.zip
*.tar
*.tar.gz
*.tgz
apr-iconv
apr-util
curl
howl
iksemel
include
js
libetpan
libeXosip2
libresample
libsndfile
openldap
osip
pcre
PortAudio
speex
sqlite
xmlrpc
apr
libeXosip2-2.2.3
libosip2-2.2.2
libosip2-2.2.3
apr-1.2.6
pcre-6.4
pcre-6.7
apr-util-1.2.6
libeXosip2-2.2.3-pre1
iksemel-1.2
xmlrpc-c-1.03.14
libsndfile-1.0.12
libresample-0.1.3
curl-7.15.2
sqlite-3.3.5
portaudio
libetpan-0.45
howl-1.0.0
openldap-2.3.19
speex-1.1.11.1
mozilla
apr-1.2.7
apr-util-1.2.7
apr-iconv-1.1.1
js20051231
mono-1.1.13.8
php-5.1.6
portaudio_v18_1
pthreads-w32-2-7-0-release
sofia-sip
libeXosip2-2.2.2
libsndfile-1.0.16
nspr-4.6.1.winnt5.release
sqlite-source-3_3_6
VSDependancies
nspr-4.6.1.winnt5.debug
libg729
zlib-1.2.3
speex-1.1.12
sqlite-3.3.6
sofia-sip-1.12.1
sofia-sip-1.12.1
libresample
libsangoma
sqlite-3.2.8
sofia-sip-1*
ruby-1*
Python-2*
resip.build.sh
jitterbuffer
pjproject*
sipsak*
jrtplib*
iovm
sipXtackLib
sipx
cppunit-1*
resiprocate*
sipXportLib
new
unixODBC*
libshout*
lame*
glib-2.12.3
pkg-config-0.21
gettext-0.15
mono-1.2.3.1
sphinxbase-0.4.99
pocketsphinx-0.5.99
iax
flite-1.3.9
Communicator_semi_40.cd_semi_6000
en
lib
music
sounds
libogg-1.1.3
flite-1.3.99
mpg123
tiff
tiff-3.8.2
celt-0.5.1
openzap
stuff
celt-0.7.0
voipcodecs
libbv32-0.1
libbv16-0.1
freeradius-client-1.1.6
openzap
libevrc
json-c-0.8
._libg729
SILK_SDK
broadvoice-0.0.1
   + libpri*
wanpipe*
*.zip
*.tar
*.tar.gz
*.tgz
apr-iconv
apr-util
curl
howl
iksemel
include
js
libetpan
libeXosip2
libresample
libsndfile
openldap
osip
pcre
PortAudio
speex
sqlite
xmlrpc
apr
libeXosip2-2.2.3
libosip2-2.2.2
libosip2-2.2.3
apr-1.2.6
pcre-6.4
pcre-6.7
apr-util-1.2.6
libeXosip2-2.2.3-pre1
iksemel-1.2
xmlrpc-c-1.03.14
libsndfile-1.0.12
libresample-0.1.3
curl-7.15.2
sqlite-3.3.5
portaudio
libetpan-0.45
howl-1.0.0
openldap-2.3.19
speex-1.1.11.1
mozilla
apr-1.2.7
apr-util-1.2.7
apr-iconv-1.1.1
js20051231
mono-1.1.13.8
php-5.1.6
portaudio_v18_1
pthreads-w32-2-7-0-release
sofia-sip
libeXosip2-2.2.2
libsndfile-1.0.16
nspr-4.6.1.winnt5.release
sqlite-source-3_3_6
VSDependancies
nspr-4.6.1.winnt5.debug
libg729
zlib-1.2.3
speex-1.1.12
sqlite-3.3.6
sofia-sip-1.12.1
sofia-sip-1.12.1
libresample
libsangoma
sqlite-3.2.8
sofia-sip-1*
ruby-1*
Python-2*
resip.build.sh
jitterbuffer
pjproject*
sipsak*
jrtplib*
iovm
sipXtackLib
sipx
cppunit-1*
resiprocate*
sipXportLib
new
unixODBC*
libshout*
lame*
glib-2.12.3
pkg-config-0.21
gettext-0.15
mono-1.2.3.1
sphinxbase-0.4.99
pocketsphinx-0.5.99
iax
flite-1.3.9
Communicator_semi_40.cd_semi_6000
en
lib
music
sounds
libogg-1.1.3
flite-1.3.99
mpg123
tiff
tiff-3.8.2
celt-0.5.1
openzap
stuff
celt-0.7.0
voipcodecs
libbv32-0.1
libbv16-0.1
freeradius-client-1.1.6
openzap
libevrc
json-c-0.8
._libg729
SILK_SDK
broadvoice-0.0.1
libmemcached-0.32
openzap
celt-0.7.0-1
openzap
g729

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/apr


Name: svn:ignore
   - apr-1-config
exports.c
config.log
.complete
.libs
Makefile
config.nice
apr.pc
config.status
.make.dirs
apr-config.out
export_vars.c
libtool
apr.exp
configure
autom4te.cache
aclocal.m4
configure.lineno
   + apr-1-config
exports.c
config.log
.complete
.libs
Makefile
config.nice
apr.pc
config.status
.make.dirs
apr-config.out
export_vars.c
libtool
apr.exp
configure
autom4te.cache
aclocal.m4
configure.lineno
a.out.dSYM

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/apr/configure.in (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/apr/configure.in	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/apr/configure.in	2010-02-12 00:54:22 UTC (rev 16614)
@@ -20,6 +20,10 @@
 sinclude(build/libtool.m4)
 sinclude(build/ltsugar.m4)
 
+CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
+
 dnl Hard-coded inclusion at the tail end of apr_private.h:
 AH_BOTTOM([
 /* switch this on if we have a BeOS version below BONE */

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/apr-util/.update (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/apr-util/.update	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/apr-util/.update	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1 +1 @@
-Wed May 13 10:54:08 CDT 2009
+Mon Dec 28 14:55:57 EST 2009

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/apr-util/configure.in (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/apr-util/configure.in	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/apr-util/configure.in	2010-02-12 00:54:22 UTC (rev 16614)
@@ -20,6 +20,10 @@
 dnl 
 APR_CONFIG_NICE(config.nice)
 
+CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
+
 dnl # Some initial steps for configuration.  We setup the default directory
 dnl # and which files are to be configured.
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/apr-util/crypto/getuuid.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/apr-util/crypto/getuuid.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/apr-util/crypto/getuuid.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -201,7 +201,7 @@
     d[7] = (unsigned char)(timestamp >> 48);
     d[6] = (unsigned char)(((timestamp >> 56) & 0x0F) | 0x10);
     /* clock_seq_hi_and_reserved, uint8 */
-    d[8] = (unsigned char)(((uuid_state_seqnum >> 8) & 0x3F) | 0x80);
+    d[8] = (unsigned char)(((++uuid_state_seqnum >> 8) & 0x3F) | 0x80);
     /* clock_seq_low, uint8 */
     d[9] = (unsigned char)uuid_state_seqnum;
     /* node, byte[6] */

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/broadvoice


Name: svn:ignore
   - configure
Makefile.in
config.log
config.status
config-h.in
autom4te.cache
libtool
aclocal.m4
Makefile
broadvoice.pc
   + configure
Makefile.in
config.log
config.status
config-h.in
autom4te.cache
libtool
aclocal.m4
Makefile
broadvoice.pc
a.out.dSYM

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/broadvoice/configure.ac (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/broadvoice/configure.ac	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/broadvoice/configure.ac	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,6 +22,10 @@
 
 AC_INIT
 
+CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
+
 m4_include(config/ax_compiler_vendor.m4)
 m4_include(config/ax_check_real_file.m4)
 m4_include(config/ax_fixed_point_machine.m4)
@@ -372,18 +376,8 @@
 
 AC_CONFIG_FILES([Makefile
                  doc/Makefile
-                 test-data/Makefile
-                 test-data/local/Makefile
-                 test-data/broadcom/Makefile
-                 test-data/broadcom/fixed/Makefile
-                 test-data/broadcom/floating/Makefile
-                 test-data/broadcom/fixed/bv16/Makefile
-                 test-data/broadcom/fixed/bv32/Makefile
-                 test-data/broadcom/floating/bv16/Makefile
-                 test-data/broadcom/floating/bv32/Makefile
                  src/Makefile
                  src/broadvoice.h
-                 tests/Makefile
                  broadvoice.pc
                  broadvoice.spec])
 

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/broadvoice/test-data/readme.txt (from rev 16612, freeswitch/trunk/libs/broadvoice/test-data/readme.txt) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/broadvoice/test-data/readme.txt	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/broadvoice/test-data/readme.txt	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1 @@
+Test data is located at http://files.freeswitch.org/broadvoice/test-data.tar.gz

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/broadvoice/tests


Name: svn:ignore
   - Makefile.in
.deps
Makefile
bv32_tests
bv16_tests
broadvoice_tests
   + Makefile.in
.deps
Makefile
bv32_tests
bv16_tests
broadvoice_tests
regression_tests.sh

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/broadvoice/tests/bv16_fixed_tests.sh (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/broadvoice/tests/bv16_fixed_tests.sh	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/broadvoice/tests/bv16_fixed_tests.sh	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 TESTDATADIR=../test-data/broadcom/fixed/bv16
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/broadvoice/tests/bv16_floating_tests.sh (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/broadvoice/tests/bv16_floating_tests.sh	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/broadvoice/tests/bv16_floating_tests.sh	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 TESTDATADIR=../test-data/broadcom/floating/bv16
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/broadvoice/tests/bv32_fixed_tests.sh (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/broadvoice/tests/bv32_fixed_tests.sh	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/broadvoice/tests/bv32_fixed_tests.sh	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 TESTDATADIR=../test-data/broadcom/fixed/bv32
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/broadvoice/tests/bv32_floating_tests.sh (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/broadvoice/tests/bv32_floating_tests.sh	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/broadvoice/tests/bv32_floating_tests.sh	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 TESTDATADIR=../test-data/broadcom/floating/bv32
 

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/curl


Name: svn:ignore
   - autom4te.cache
Makefile.in
configure
config.log
.complete
libcurl.pc
config.status
libtool
curl-config
Makefile
depcomp
compile
config.guess
ltmain.sh
config.sub
missing
aclocal.m4
install-sh
docs
tests
configure.lineno
   + autom4te.cache
Makefile.in
configure
config.log
.complete
libcurl.pc
config.status
libtool
curl-config
Makefile
depcomp
compile
config.guess
ltmain.sh
config.sub
missing
aclocal.m4
install-sh
docs
tests
configure.lineno
a.out.dSYM

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/curl/configure.ac (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/curl/configure.ac	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/curl/configure.ac	2010-02-12 00:54:22 UTC (rev 16614)
@@ -27,6 +27,10 @@
 dnl We don't know the version number "staticly" so we use a dash here
 AC_INIT(curl, [-], [a suitable curl mailing list => http://curl.haxx.se/mail/])
 
+CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
+
 dnl configure script copyright
 AC_COPYRIGHT([Copyright (c) 1998 - 2006 Daniel Stenberg, <daniel@haxx.se>
 This configure script may be copied, distributed and modified under the 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/ESL.i (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/ESL.i	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/ESL.i	2010-02-12 00:54:22 UTC (rev 16614)
@@ -19,6 +19,43 @@
 %newobject ESLconnection::filter;
 %newobject ESLconnection::recvEvent;
 %newobject ESLconnection::recvEventTimed;
+%newobject ESLconnection::execute;
+%newobject ESLconnection::executeAsync;
 #endif
 
+
+#ifdef SWIGCSHARP
+//fix C# keyword event
+%rename (Event) ESLevent::event;  
+// Rename some things to make them more .NET-like
+%rename (SerializedString) ESLevent::serialized_string;
+%rename (Mine) ESLevent::mine;
+%rename (Serialize) ESLevent::serialize;
+%rename (SetPriority) ESLevent::setPriority;
+%rename (GetHeader) ESLevent::getHeader;
+%rename (GetBody) ESLevent::getBody;
+%rename (AddBody) ESLevent::addBody;
+%rename (AddHeader) ESLevent::addHeader;
+%rename (DelHeader) ESLevent::delHeader;
+%rename (FirstHeader) ESLevent::firstHeader;
+%rename (NextHeader) ESLevent::nextHeader;
+%rename (SocketDescriptor) ESLconnection::socketDescriptor;
+%rename (Connected) ESLconnection::connected;
+%rename (GetInfo) ESLconnection::getInfo;
+%rename (Send) ESLconnection::send;
+%rename (SendRecv) ESLconnection::sendRecv;
+%rename (Api) ESLconnection::api;
+%rename (Bgapi) ESLconnection::bgapi;
+%rename (SendEvent) ESLconnection::sendEvent;
+%rename (RecvEvent) ESLconnection::recvEvent;
+%rename (RecvEventTimed) ESLconnection::recvEventTimed;
+%rename (Filter) ESLconnection::filter;
+%rename (Events) ESLconnection::events;
+%rename (Execute) ESLconnection::execute;
+%rename (ExecuteAsync) ESLconnection::executeAsync;
+%rename (SetAsyncExecute) ESLconnection::setAsyncExecute;
+%rename (SetEventLock) ESLconnection::setEventLock;
+%rename (Disconnect) ESLconnection::disconnect;
+#endif
+
 %include "esl_oop.h"

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -80,6 +80,9 @@
 pymod: $(MYLIB)
 	$(MAKE) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C python
 
+tclmod: $(MYLIB)
+	$(MAKE) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C tcl
+
 rubymod: $(MYLIB)
 	$(MAKE) MYLIB="../$(MYLIB)" SOLINK="$(SOLINK)" CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CXX_CFLAGS="$(CXX_CFLAGS)" -C ruby
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/fs_cli.2008.vcproj (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/fs_cli.2008.vcproj	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/fs_cli.2008.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -55,7 +55,6 @@
 				WarnAsError="true"
 				DebugInformationFormat="3"
 				DisableSpecificWarnings="4100;6053;4706"
-				EnablePREfast="true"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"
@@ -138,7 +137,6 @@
 				WarnAsError="true"
 				DebugInformationFormat="3"
 				DisableSpecificWarnings="4100;6053;4706"
-				EnablePREfast="true"
 			/>
 			<Tool
 				Name="VCManagedResourceCompilerTool"

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/fs_cli.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/fs_cli.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/fs_cli.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -7,12 +7,39 @@
 #include <esl.h>
 #include <signal.h>
 
+#define CMD_BUFLEN 1024
+
 #ifdef WIN32
 #define strdup(src) _strdup(src)
 #define usleep(time) Sleep(time/1000)
 #define fileno _fileno
 #define read _read
 #include <io.h>
+
+#define CC_NORM         0
+#define CC_NEWLINE      1
+#define CC_EOF          2
+#define CC_ARGHACK      3
+#define CC_REFRESH      4
+#define CC_CURSOR       5
+#define CC_ERROR        6
+#define CC_FATAL        7
+#define CC_REDISPLAY    8
+#define CC_REFRESH_BEEP 9
+
+#define HISTLEN 10
+#define KEY_UP 1
+#define KEY_DOWN 2
+#define KEY_TAB 3
+#define CLEAR_OP 4
+#define DELETE_REFRESH_OP 5
+#define KEY_LEFT 6
+#define KEY_RIGHT 7
+#define KEY_INSERT 8
+#define PROMPT_OP 9
+
+static int console_bufferInput (char* buf, int len, char *cmd, int key);
+static unsigned char esl_console_complete(const char *buffer, const char *cursor);
 #else
 #include <sys/select.h>
 #include <unistd.h>
@@ -30,6 +57,7 @@
 	char name[128];
 	char host[128];
 	esl_port_t port;
+	char user[256];
 	char pass[128];
 	int debug;
 	const char *console_fnkeys[12];
@@ -50,18 +78,6 @@
 static int thread_running = 0;
 
 
-#ifdef HAVE_EDITLINE
-static char *prompt(EditLine * e)
-{
-    return prompt_str;
-}
-
-static EditLine *el;
-static History *myhistory;
-static HistEvent ev;
-
-
-
 /*
  * If a fnkey is configured then process the command
  */
@@ -89,6 +105,16 @@
 	return CC_REDISPLAY;
 }
 
+#ifdef HAVE_EDITLINE
+static char *prompt(EditLine * e)
+{
+    return prompt_str;
+}
+
+static EditLine *el;
+static History *myhistory;
+static HistEvent ev;
+
 static unsigned char console_f1key(EditLine * el, int ch)
 {
 	return console_fnkey_pressed(1);
@@ -155,8 +181,355 @@
 		return CC_REDISPLAY;
 	}
 }
+#else
+#ifdef _MSC_VER
+char history[HISTLEN][CMD_BUFLEN+1];
+int iHistory = 0;
+int iHistorySel = 0;
 
+static int console_history (char *cmd, int direction)
+{
+	int i;
+	static int first;
+
+	if (direction == 0) {
+		first = 1;
+		if (iHistory < HISTLEN) {
+			if (iHistory && strcmp(history[iHistory-1], cmd)) {
+				iHistorySel = iHistory;
+				strcpy(history[iHistory++], cmd);
+			}
+			else if (iHistory == 0) {
+				iHistorySel = iHistory;
+				strcpy(history[iHistory++], cmd);
+			}
+		}
+		else {
+			iHistory = HISTLEN-1;
+			for (i = 0; i < HISTLEN-1; i++)
+			{
+				strcpy(history[i], history[i+1]);
+			}
+			iHistorySel = iHistory;
+			strcpy(history[iHistory++], cmd);
+		}
+	}
+	else {
+		if (!first) {
+			iHistorySel += direction;
+		}
+		first = 0;
+		if (iHistorySel < 0) {
+			iHistorySel = 0;
+		}
+		if (iHistory && iHistorySel >= iHistory) {
+			iHistorySel = iHistory-1;
+		}
+		strcpy(cmd, history[iHistorySel]);
+	}
+	return (0);
+}
+
+static int console_bufferInput (char* addchars, int len, char *cmd, int key)
+{
+    static int iCmdBuffer = 0;
+	static int iCmdCursor = 0;
+    static int ignoreNext = 0;
+	static int insertMode = 1;
+	static COORD orgPosition;
+	static char prompt [80];
+    int iBuf;
+	int i;
+
+	HANDLE hOut;
+	CONSOLE_SCREEN_BUFFER_INFO info;
+	COORD position;
+	hOut = GetStdHandle(STD_OUTPUT_HANDLE);
+	GetConsoleScreenBufferInfo(hOut, &info);
+	position = info.dwCursorPosition;
+	if (iCmdCursor == 0) {
+		orgPosition = position;
+	}
+
+	if (key == PROMPT_OP) {
+		if (strlen(cmd) < sizeof(prompt)) {
+			strcpy(prompt, cmd);
+		}
+		return 0;
+	}
+
+	if (key == KEY_TAB) {
+		esl_console_complete(cmd, cmd+iCmdBuffer);
+		return 0;
+	}
+	if (key == KEY_UP || key == KEY_DOWN || key == CLEAR_OP) {
+		SetConsoleCursorPosition(hOut, orgPosition);
+		for (i = 0; i < (int)strlen(cmd); i++) {
+			printf(" ");
+		}
+		SetConsoleCursorPosition(hOut, orgPosition);
+		iCmdBuffer = 0;
+		iCmdCursor = 0;
+		memset(cmd, 0, CMD_BUFLEN);
+	}
+	if (key == DELETE_REFRESH_OP) {
+		int l = len < (int)strlen(cmd) ? len : (int)strlen(cmd);
+		for (i = 0; i < l; i++) {
+			cmd[--iCmdBuffer] = 0;
+		}
+		iCmdCursor = (int)strlen(cmd);
+		printf("%s", prompt);
+		GetConsoleScreenBufferInfo(hOut, &info);
+		orgPosition = info.dwCursorPosition;
+		printf("%s", cmd);
+		return 0;
+	}
+
+	if (key == KEY_LEFT) {
+		if (iCmdCursor) {
+			if (position.X == 0) {
+				position.Y -= 1;
+				position.X = info.dwSize.X-1;
+			}
+			else {
+				position.X -= 1;
+			}
+
+			SetConsoleCursorPosition(hOut, position);
+			iCmdCursor--;
+		}
+	}
+	if (key == KEY_RIGHT) {
+		if (iCmdCursor < (int)strlen(cmd)) {
+			if (position.X == info.dwSize.X-1) {
+				position.Y += 1;
+				position.X = 0;
+			}
+			else {
+				position.X += 1;
+			}
+
+			SetConsoleCursorPosition(hOut, position);
+			iCmdCursor++;
+		}
+	}
+	if (key == KEY_INSERT) {
+		insertMode = !insertMode;
+	}
+    for (iBuf = 0; iBuf < len; iBuf++) {
+		switch (addchars[iBuf]) {
+			case '\r':
+			case '\n':
+				if (ignoreNext) {
+					ignoreNext = 0;
+				}
+				else {
+					int ret = iCmdBuffer;
+					if (iCmdBuffer == 0) {
+						strcpy(cmd, "Empty");
+						ret = (int)strlen(cmd);
+					}
+					else {
+						console_history(cmd, 0);
+						cmd[iCmdBuffer] = 0;
+					}
+					iCmdBuffer = 0;
+					iCmdCursor = 0;
+					printf("\n");
+					return (ret);
+				}
+				break;
+			case '\b':
+				if (iCmdCursor) {
+					if (position.X == 0) {
+						position.Y -= 1;
+						position.X = info.dwSize.X-1;
+						SetConsoleCursorPosition(hOut, position);
+					}
+					else {
+						position.X -= 1;
+						SetConsoleCursorPosition(hOut, position);
+					}
+					printf(" ");
+					if (iCmdCursor < iCmdBuffer) {
+							int pos;
+							iCmdCursor--;
+							for (pos = iCmdCursor; pos < iCmdBuffer; pos++) {
+								cmd[pos] = cmd[pos+1];
+							}
+							cmd[pos] = 0;
+							iCmdBuffer--;
+
+							SetConsoleCursorPosition(hOut, position);
+							for (pos = iCmdCursor; pos < iCmdBuffer; pos++) {
+								printf("%c", cmd[pos]);
+							}
+							printf(" ");
+							SetConsoleCursorPosition(hOut, position);
+					}
+					else {
+						SetConsoleCursorPosition(hOut, position);
+						iCmdBuffer--;
+						iCmdCursor--;
+						cmd[iCmdBuffer] = 0;
+					}
+				}
+				break;
+			default:
+				if (!ignoreNext) {
+					if (iCmdCursor < iCmdBuffer) {
+						int pos;
+
+						if (position.X == info.dwSize.X-1) {
+							position.Y += 1;
+							position.X = 0;
+						}
+						else {
+							position.X += 1;
+						}
+
+						if (insertMode) {
+							for (pos = iCmdBuffer-1; pos >= iCmdCursor; pos--) {
+								cmd[pos+1] = cmd[pos];
+							}
+						}
+						iCmdBuffer++;
+						cmd[iCmdCursor++] = addchars[iBuf];
+						printf("%c", addchars[iBuf]);
+						for (pos = iCmdCursor; pos < iCmdBuffer; pos++) {
+							GetConsoleScreenBufferInfo(hOut, &info);
+							if (info.dwCursorPosition.X == info.dwSize.X-1 && info.dwCursorPosition.Y == info.dwSize.Y-1) {
+								orgPosition.Y -= 1;
+								position.Y -= 1;
+							}
+							printf("%c", cmd[pos]);
+						}
+						SetConsoleCursorPosition(hOut, position);
+					}
+					else {
+						if (position.X == info.dwSize.X-1 && position.Y == info.dwSize.Y-1) {
+							orgPosition.Y -= 1;
+						}
+						cmd[iCmdBuffer++] = addchars[iBuf];
+						iCmdCursor++;
+						printf("%c", addchars[iBuf]);
+					}
+				}
+		}
+		if (iCmdBuffer == CMD_BUFLEN) {
+			printf("Read Console... BUFFER OVERRUN\n");
+			iCmdBuffer = 0;
+			ignoreNext = 1;
+		}
+    }
+    return (0);
+}
+
+
+static BOOL console_readConsole(HANDLE conIn, char* buf, int len, int* pRed, int *key)
+{
+    DWORD recordIndex, bufferIndex, toRead, red;
+    PINPUT_RECORD pInput;
+
+    GetNumberOfConsoleInputEvents(conIn, &toRead);
+	if (len < (int)toRead) {
+		toRead = len;
+	}
+	if (toRead == 0) {
+		return(FALSE);
+	}
+
+	if ((pInput = (PINPUT_RECORD) malloc(toRead * sizeof(INPUT_RECORD))) == NULL) {
+		return (FALSE);
+	}
+	*key = 0;
+    ReadConsoleInput(conIn, pInput, toRead, &red);
+
+    for (recordIndex = bufferIndex = 0; recordIndex < red; recordIndex++) {
+        KEY_EVENT_RECORD keyEvent = pInput[recordIndex].Event.KeyEvent;
+    	if (pInput[recordIndex].EventType == KEY_EVENT && keyEvent.bKeyDown) {
+			if (keyEvent.wVirtualKeyCode == 38 && keyEvent.wVirtualScanCode == 72) {
+				buf[0] = 0;
+				console_history(buf, -1);
+				*key = KEY_UP;
+				bufferIndex += (DWORD)strlen(buf);
+			}
+			if (keyEvent.wVirtualKeyCode == 40 && keyEvent.wVirtualScanCode == 80) {
+				buf[0] = 0;
+				console_history(buf, 1);
+				*key = KEY_DOWN;
+				bufferIndex += (DWORD)strlen(buf);
+			}
+			if (keyEvent.wVirtualKeyCode == 112 && keyEvent.wVirtualScanCode == 59) {
+				console_fnkey_pressed(1);
+			}
+			if (keyEvent.wVirtualKeyCode == 113 && keyEvent.wVirtualScanCode == 60) {
+				console_fnkey_pressed(2);
+			}
+			if (keyEvent.wVirtualKeyCode == 114 && keyEvent.wVirtualScanCode == 61) {
+				console_fnkey_pressed(3);
+			}
+			if (keyEvent.wVirtualKeyCode == 115 && keyEvent.wVirtualScanCode == 62) {
+				console_fnkey_pressed(4);
+			}
+			if (keyEvent.wVirtualKeyCode == 116 && keyEvent.wVirtualScanCode == 63) {
+				console_fnkey_pressed(5);
+			}
+			if (keyEvent.wVirtualKeyCode == 117 && keyEvent.wVirtualScanCode == 64) {
+				console_fnkey_pressed(6);
+			}
+			if (keyEvent.wVirtualKeyCode == 118 && keyEvent.wVirtualScanCode == 65) {
+				console_fnkey_pressed(7);
+			}
+			if (keyEvent.wVirtualKeyCode == 119 && keyEvent.wVirtualScanCode == 66) {
+				console_fnkey_pressed(8);
+			}
+			if (keyEvent.wVirtualKeyCode == 120 && keyEvent.wVirtualScanCode == 67) {
+				console_fnkey_pressed(9);
+			}
+			if (keyEvent.wVirtualKeyCode == 121 && keyEvent.wVirtualScanCode == 68) {
+				console_fnkey_pressed(10);
+			}
+			if (keyEvent.wVirtualKeyCode == 122 && keyEvent.wVirtualScanCode == 87) {
+				console_fnkey_pressed(11);
+			}
+			if (keyEvent.wVirtualKeyCode == 123 && keyEvent.wVirtualScanCode == 88) {
+				console_fnkey_pressed(12);
+			}
+			if (keyEvent.uChar.AsciiChar == 9) {
+				*key = KEY_TAB;
+				break;
+			}
+			if (keyEvent.uChar.AsciiChar == 27) {
+				*key = CLEAR_OP;
+				break;
+			}
+			if (keyEvent.wVirtualKeyCode == 37 && keyEvent.wVirtualScanCode == 75) {
+				*key = KEY_LEFT;
+			}
+			if (keyEvent.wVirtualKeyCode == 39 && keyEvent.wVirtualScanCode == 77) {
+				*key = KEY_RIGHT;
+			}
+			if (keyEvent.wVirtualKeyCode == 45 && keyEvent.wVirtualScanCode == 82) {
+				*key = KEY_INSERT;
+			}
+    	    while (keyEvent.wRepeatCount && keyEvent.uChar.AsciiChar) {
+    			buf[bufferIndex] = keyEvent.uChar.AsciiChar;
+				if (buf[bufferIndex] == '\r') {
+    				buf[bufferIndex] = '\n';
+				}
+    			bufferIndex++;
+    			keyEvent.wRepeatCount--;
+    	    }
+    	}
+    }
+
+    free(pInput);
+    *pRed = bufferIndex;
+    return (TRUE);
+}
 #endif
+#endif
 
 static void handle_SIGINT(int sig)
 {
@@ -187,6 +560,7 @@
 	printf("  -?,-h --help                    Usage Information\n");
 	printf("  -H, --host=hostname             Host to connect\n");
 	printf("  -P, --port=port                 Port to connect (1 - 65535)\n");
+	printf("  -u, --user=user@domain          user@domain\n");
 	printf("  -p, --password=password         Password\n");
 	printf("  -x, --execute=command           Execute Command and Exit\n");
 	printf("  -l, --loglevel=command          Log Level\n");
@@ -327,12 +701,20 @@
 		printf("Unknown command [%s]\n", cmd);
 	} else {
 		char cmd_str[1024] = "";
-
-		snprintf(cmd_str, sizeof(cmd_str), "api %s\n\n", cmd);
-		esl_send_recv(handle, cmd_str);
-		if (handle->last_sr_event && handle->last_sr_event->body) {
-			printf("%s\n", handle->last_sr_event->body);
+		const char *err = NULL;
+		
+		snprintf(cmd_str, sizeof(cmd_str), "api %s\nconsole_execute: true\n\n", cmd);
+		if (esl_send_recv(handle, cmd_str)) {
+			printf("Socket interrupted, bye!\n");
+			return 1;
 		}
+		if (handle->last_sr_event) {
+			if (handle->last_sr_event->body) {
+				printf("%s\n", handle->last_sr_event->body);
+			} else if ((err = esl_event_get_header(handle->last_sr_event, "reply-text")) && !strncasecmp(err, "-err", 3)) {
+				printf("Error: %s!\n", err + 4);
+			}
+		}
 	}
 	
  end:
@@ -356,10 +738,11 @@
 }
 
 #ifndef HAVE_EDITLINE
-static char command_buf[2048] = "";
+static char command_buf[CMD_BUFLEN+1] = "";
 
 static const char *basic_gets(int *cnt)
 {
+#ifndef _MSC_VER
 	int x = 0;
 
 	printf("%s", prompt_str);
@@ -382,9 +765,29 @@
 	}
 
 	*cnt = x;
+#else
+	int read, key;
+	char keys[80];
+	HANDLE stdinHandle = GetStdHandle(STD_INPUT_HANDLE);
 
+	console_bufferInput (0, 0, prompt_str, PROMPT_OP);
+	printf("%s", prompt_str);
+
+	*cnt = 0;
+	memset(&command_buf, 0, sizeof(command_buf));
+
+	while (!*cnt) {
+		if (console_readConsole(stdinHandle, keys, (int)sizeof(keys), &read, &key)) {
+			*cnt = console_bufferInput(keys, read, command_buf, key);
+			if (!strcmp(command_buf, "Empty")) {
+				command_buf[0] = 0;
+			}
+		}
+		Sleep(20);
+	}
+
 	return command_buf;
-
+#endif
 }
 #endif
 
@@ -394,17 +797,18 @@
 	fprintf(stream,
 			
 
-			"           _____ ____     ____ _     ___            \n"
-			"          |  ___/ ___|   / ___| |   |_ _|           \n"
-			"          | |_  \\___ \\  | |   | |    | |            \n"
-			"          |  _|  ___) | | |___| |___ | |            \n"
-			"          |_|   |____/   \\____|_____|___|           \n"
+			"            _____ ____     ____ _     ___            \n"
+			"           |  ___/ ___|   / ___| |   |_ _|           \n"
+			"           | |_  \\___ \\  | |   | |    | |            \n"
+			"           |  _|  ___) | | |___| |___ | |            \n"
+			"           |_|   |____/   \\____|_____|___|           \n"
 			"\n"
-			"*****************************************************\n"
-			"* Anthony Minessale II, Ken Rice, Michael Jerris    *\n"
-			"* FreeSWITCH (http://www.freeswitch.org)            *\n"
-			"* Brought to you by ClueCon http://www.cluecon.com/ *\n"
-			"*****************************************************\n"
+			"*******************************************************\n"
+			"* Anthony Minessale II, Ken Rice, Michael Jerris      *\n"
+			"* FreeSWITCH (http://www.freeswitch.org)              *\n"
+			"* Paypal Donations Appreciated: paypal@freeswitch.org *\n" 
+			"* Brought to you by ClueCon http://www.cluecon.com/   *\n"
+			"*******************************************************\n"
 			"\n"
                         "Type /help <enter> to see a list of commands\n\n\n"
 			);
@@ -427,7 +831,118 @@
 	profile->console_fnkeys[11] = "version";
 }
 
+#define end_of_p(_s) (*_s == '\0' ? _s : _s + strlen(_s) - 1)
 
+static unsigned char esl_console_complete(const char *buffer, const char *cursor)
+{
+	char cmd_str[2048] = "";
+	unsigned char ret = CC_REDISPLAY;
+	char *dup = strdup(buffer);
+	char *buf = dup;
+	int pos = 0, sc = 0;
+	char *p;
+
+	if (!esl_strlen_zero(cursor) && !esl_strlen_zero(buffer)) {
+		pos = (int)(cursor - buffer);
+	}
+	if (pos > 0) {
+		*(buf + pos) = '\0';
+	}
+
+	if ((p = strchr(buf, '\r')) || (p = strchr(buf, '\n'))) {
+		*p = '\0';
+	}
+
+	while (*buf == ' ') {
+		buf++;
+		sc++;
+	}
+
+#ifdef HAVE_EDITLINE
+	if (!*buf && sc) {
+		el_deletestr(el, sc);
+	}
+#endif
+
+	sc = 0;
+
+	p = end_of_p(buf);
+	while(p >= buf && *p == ' ') {
+		sc++;
+		p--;
+	}
+
+#ifdef HAVE_EDITLINE
+	if (sc > 1) {
+		el_deletestr(el, sc - 1);
+		*(p + 2) = '\0';
+	}
+#endif
+	
+
+	if (*cursor) {
+		snprintf(cmd_str, sizeof(cmd_str), "api console_complete c=%ld;%s\n\n", (long)pos, buf);
+	} else {
+		snprintf(cmd_str, sizeof(cmd_str), "api console_complete %s\n\n", buf);
+	}
+
+	esl_send_recv(global_handle, cmd_str);
+
+
+	if (global_handle->last_sr_event && global_handle->last_sr_event->body) {
+		char *r = global_handle->last_sr_event->body;
+		char *w, *p1;
+		
+		if (r) {
+			if ((w = strstr(r, "\n\nwrite="))) {
+				int len = 0;
+				*w = '\0';
+				w += 8;
+
+				len = atoi(w);
+
+				if ((p1= strchr(w, ':'))) {
+					w = p1+ 1;
+				}
+				
+				printf("%s\n\n\n", r);
+
+#ifdef HAVE_EDITLINE
+				el_deletestr(el, len);
+				el_insertstr(el, w);
+#else
+#ifdef _MSC_VER
+				console_bufferInput(0, len, (char*)buffer, DELETE_REFRESH_OP);
+				console_bufferInput(w, (int)strlen(w), (char*)buffer, 0);
+#endif
+#endif
+				
+			} else {
+				printf("%s\n", r);
+#ifdef _MSC_VER
+				console_bufferInput(0, 0, (char*)buffer, DELETE_REFRESH_OP);
+#endif
+			}
+		}
+
+		fflush(stdout);
+	}	
+
+	esl_safe_free(dup);
+
+	return ret;
+}
+
+#ifdef HAVE_EDITLINE
+static unsigned char complete(EditLine * el, int ch)
+{
+	const LineInfo *lf = el_line(el);
+
+	return esl_console_complete(lf->buffer, lf->cursor);
+}
+#endif
+
+
 int main(int argc, char *argv[])
 {
 	esl_handle_t handle = {{0}};
@@ -454,6 +969,7 @@
 		{"help", 0, 0, 'h'},
 		{"host", 1, 0, 'H'},
 		{"port", 1, 0, 'P'},
+		{"user", 1, 0, 'u'},
 		{"password", 1, 0, 'p'},
 		{"debug", 1, 0, 'd'},
 		{"execute", 1, 0, 'x'},
@@ -464,8 +980,10 @@
 
 	char temp_host[128];
 	int argv_host = 0;
+	char temp_user[256];
 	char temp_pass[128];
 	int argv_pass = 0 ;
+	int argv_user = 0 ;
 	int temp_port = 0;
 	int argv_port = 0;
 	int temp_log = -1;
@@ -496,7 +1014,7 @@
 	
 	for(;;) {
 		int option_index = 0;
-		opt = getopt_long(argc, argv, "H:U:P:S:p:d:x:l:qh?", options, &option_index);
+		opt = getopt_long(argc, argv, "H:U:P:S:u:p:d:x:l:qh?", options, &option_index);
 		if (opt == -1) break;
 		switch (opt)
 		{
@@ -513,6 +1031,10 @@
 					argv_error = 1;
 				}
 				break;
+			case 'u':
+				esl_set_string(temp_user, optarg);
+				argv_user = 1;
+				break;
 			case 'p':
 				esl_set_string(temp_pass, optarg);
 				argv_pass = 1;
@@ -574,6 +1096,8 @@
 			
 			if (!strcasecmp(var, "host")) {
 				esl_set_string(profiles[pcount-1].host, val);
+			} else if (!strcasecmp(var, "user")) {
+				esl_set_string(profiles[pcount-1].user, val);
 			} else if (!strcasecmp(var, "password")) {
 				esl_set_string(profiles[pcount-1].pass, val);
 			} else if (!strcasecmp(var, "port")) {
@@ -626,6 +1150,11 @@
 	if (argv_port) {
 		profile->port = (esl_port_t)temp_port;
 	}
+
+	if (argv_user) {
+		esl_set_string(profile->user, temp_user);
+	}
+
 	if (argv_pass) {
 		esl_set_string(profile->pass, temp_pass);
 	}
@@ -647,19 +1176,27 @@
 		snprintf(prompt_str, sizeof(prompt_str), "freeswitch@%s> ", profile->name);
 	}
 
-	if (esl_connect(&handle, profile->host, profile->port, profile->pass)) {
+	if (esl_connect(&handle, profile->host, profile->port, profile->user, profile->pass)) {
 		esl_global_set_default_logger(7);
 		esl_log(ESL_LOG_ERROR, "Error Connecting [%s]\n", handle.err);
+		if (!argv_exec) usage(argv[0]);
 		return -1;
 	}
 
 
 	if (argv_exec){
+		const char *err = NULL;
+
 		snprintf(cmd_str, sizeof(cmd_str), "api %s\n\n", argv_command);
 		esl_send_recv(&handle, cmd_str);
-		if (handle.last_sr_event && handle.last_sr_event->body) {
-			printf("%s\n", handle.last_sr_event->body);
+		if (handle.last_sr_event) {
+			if (handle.last_sr_event->body) {
+				printf("%s\n", handle.last_sr_event->body);
+			} else if ((err = esl_event_get_header(handle.last_sr_event, "reply-text")) && !strncasecmp(err, "-err", 3)) {
+				printf("Error: %s!\n", err + 4);
+			}
 		}
+
 		esl_disconnect(&handle);
 		return 0;
 	} 
@@ -673,6 +1210,7 @@
 	el = el_init(__FILE__, stdout, stdout, stdout);
 	el_set(el, EL_PROMPT, &prompt);
 	el_set(el, EL_EDITOR, "emacs");
+
 	myhistory = history_init();
 
 	el_set(el, EL_ADDFN, "f1-key", "F1 KEY PRESS", console_f1key);
@@ -711,6 +1249,9 @@
 
 	el_set(el, EL_BIND, "\004", "EOF-key", NULL);
 
+	el_set(el, EL_ADDFN, "ed-complete", "Complete argument", complete);
+	el_set(el, EL_BIND, "^I", "ed-complete", NULL);
+
 	if (myhistory == 0) {
 		esl_log(ESL_LOG_ERROR, "history could not be initialized\n");
 		goto done;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/java/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/java/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/java/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -10,7 +10,10 @@
 esl_wrap.o: esl_wrap.cpp
 	$(CXX) $(CXX_CFLAGS) $(LOCAL_CFLAGS) $(CXXFLAGS) $(GCC_WARNING_JUNK) $(PERL_INC) -c esl_wrap.cpp -o esl_wrap.o
 
-esl.jar: esl_wrap.o
+libesljni.so: esl_wrap.o
+	$(CXX) $(SOLINK) -o libesljni.so esl_wrap.o $(MYLIB)
+
+esl.jar: libesljni.so
 	mkdir -p classes
 	javac -sourcepath org -d classes $(CLASSES)
 	jar cf esl.jar -C classes org

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/java/esl_wrap.cpp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/java/esl_wrap.cpp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/java/esl_wrap.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -574,11 +574,12 @@
 }
 
 
-SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_new_1ESLconnection_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2, jstring jarg3) {
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_new_1ESLconnection_1_1SWIG_10(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2, jstring jarg3, jstring jarg4) {
   jlong jresult = 0 ;
   char *arg1 = (char *) 0 ;
   char *arg2 = (char *) 0 ;
   char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
   ESLconnection *result = 0 ;
   
   (void)jenv;
@@ -598,6 +599,45 @@
     arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
     if (!arg3) return 0;
   }
+  arg4 = 0;
+  if (jarg4) {
+    arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
+    if (!arg4) return 0;
+  }
+  result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
+  *(ESLconnection **)&jresult = result; 
+  if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
+  if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
+  if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
+  if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
+  return jresult;
+}
+
+
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_new_1ESLconnection_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jstring jarg1, jstring jarg2, jstring jarg3) {
+  jlong jresult = 0 ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  ESLconnection *result = 0 ;
+  
+  (void)jenv;
+  (void)jcls;
+  arg1 = 0;
+  if (jarg1) {
+    arg1 = (char *)jenv->GetStringUTFChars(jarg1, 0);
+    if (!arg1) return 0;
+  }
+  arg2 = 0;
+  if (jarg2) {
+    arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
+    if (!arg2) return 0;
+  }
+  arg3 = 0;
+  if (jarg3) {
+    arg3 = (char *)jenv->GetStringUTFChars(jarg3, 0);
+    if (!arg3) return 0;
+  }
   result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3);
   *(ESLconnection **)&jresult = result; 
   if (arg1) jenv->ReleaseStringUTFChars(jarg1, (const char *)arg1);
@@ -607,7 +647,7 @@
 }
 
 
-SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_new_1ESLconnection_1_1SWIG_11(JNIEnv *jenv, jclass jcls, jint jarg1) {
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_new_1ESLconnection_1_1SWIG_12(JNIEnv *jenv, jclass jcls, jint jarg1) {
   jlong jresult = 0 ;
   int arg1 ;
   ESLconnection *result = 0 ;
@@ -887,13 +927,13 @@
 }
 
 
-SWIGEXPORT jint JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1execute(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4) {
-  jint jresult = 0 ;
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1execute(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4) {
+  jlong jresult = 0 ;
   ESLconnection *arg1 = (ESLconnection *) 0 ;
   char *arg2 = (char *) 0 ;
   char *arg3 = (char *) NULL ;
   char *arg4 = (char *) NULL ;
-  int result;
+  ESLevent *result = 0 ;
   
   (void)jenv;
   (void)jcls;
@@ -914,8 +954,8 @@
     arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
     if (!arg4) return 0;
   }
-  result = (int)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
-  jresult = (jint)result; 
+  result = (ESLevent *)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  *(ESLevent **)&jresult = result; 
   if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
   if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
   if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);
@@ -923,13 +963,13 @@
 }
 
 
-SWIGEXPORT jint JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1executeAsync(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4) {
-  jint jresult = 0 ;
+SWIGEXPORT jlong JNICALL Java_org_freeswitch_esl_eslJNI_ESLconnection_1executeAsync(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2, jstring jarg3, jstring jarg4) {
+  jlong jresult = 0 ;
   ESLconnection *arg1 = (ESLconnection *) 0 ;
   char *arg2 = (char *) 0 ;
   char *arg3 = (char *) NULL ;
   char *arg4 = (char *) NULL ;
-  int result;
+  ESLevent *result = 0 ;
   
   (void)jenv;
   (void)jcls;
@@ -950,8 +990,8 @@
     arg4 = (char *)jenv->GetStringUTFChars(jarg4, 0);
     if (!arg4) return 0;
   }
-  result = (int)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
-  jresult = (jint)result; 
+  result = (ESLevent *)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  *(ESLevent **)&jresult = result; 
   if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
   if (arg3) jenv->ReleaseStringUTFChars(jarg3, (const char *)arg3);
   if (arg4) jenv->ReleaseStringUTFChars(jarg4, (const char *)arg4);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/java/org/freeswitch/esl/ESLconnection.java (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/java/org/freeswitch/esl/ESLconnection.java	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/java/org/freeswitch/esl/ESLconnection.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -33,12 +33,16 @@
     swigCPtr = 0;
   }
 
+  public ESLconnection(String host, String port, String user, String password) {
+    this(eslJNI.new_ESLconnection__SWIG_0(host, port, user, password), true);
+  }
+
   public ESLconnection(String host, String port, String password) {
-    this(eslJNI.new_ESLconnection__SWIG_0(host, port, password), true);
+    this(eslJNI.new_ESLconnection__SWIG_1(host, port, password), true);
   }
 
   public ESLconnection(int socket) {
-    this(eslJNI.new_ESLconnection__SWIG_1(socket), true);
+    this(eslJNI.new_ESLconnection__SWIG_2(socket), true);
   }
 
   public int socketDescriptor() {
@@ -96,12 +100,14 @@
     return eslJNI.ESLconnection_events(swigCPtr, this, etype, value);
   }
 
-  public int execute(String app, String arg, String uuid) {
-    return eslJNI.ESLconnection_execute(swigCPtr, this, app, arg, uuid);
+  public ESLevent execute(String app, String arg, String uuid) {
+    long cPtr = eslJNI.ESLconnection_execute(swigCPtr, this, app, arg, uuid);
+    return (cPtr == 0) ? null : new ESLevent(cPtr, true);
   }
 
-  public int executeAsync(String app, String arg, String uuid) {
-    return eslJNI.ESLconnection_executeAsync(swigCPtr, this, app, arg, uuid);
+  public ESLevent executeAsync(String app, String arg, String uuid) {
+    long cPtr = eslJNI.ESLconnection_executeAsync(swigCPtr, this, app, arg, uuid);
+    return (cPtr == 0) ? null : new ESLevent(cPtr, true);
   }
 
   public int setAsyncExecute(String val) {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/java/org/freeswitch/esl/eslJNI.java (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/java/org/freeswitch/esl/eslJNI.java	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/java/org/freeswitch/esl/eslJNI.java	2010-02-12 00:54:22 UTC (rev 16614)
@@ -29,8 +29,9 @@
   public final static native boolean ESLevent_delHeader(long jarg1, ESLevent jarg1_, String jarg2);
   public final static native String ESLevent_firstHeader(long jarg1, ESLevent jarg1_);
   public final static native String ESLevent_nextHeader(long jarg1, ESLevent jarg1_);
-  public final static native long new_ESLconnection__SWIG_0(String jarg1, String jarg2, String jarg3);
-  public final static native long new_ESLconnection__SWIG_1(int jarg1);
+  public final static native long new_ESLconnection__SWIG_0(String jarg1, String jarg2, String jarg3, String jarg4);
+  public final static native long new_ESLconnection__SWIG_1(String jarg1, String jarg2, String jarg3);
+  public final static native long new_ESLconnection__SWIG_2(int jarg1);
   public final static native void delete_ESLconnection(long jarg1);
   public final static native int ESLconnection_socketDescriptor(long jarg1, ESLconnection jarg1_);
   public final static native int ESLconnection_connected(long jarg1, ESLconnection jarg1_);
@@ -44,8 +45,8 @@
   public final static native long ESLconnection_recvEventTimed(long jarg1, ESLconnection jarg1_, int jarg2);
   public final static native long ESLconnection_filter(long jarg1, ESLconnection jarg1_, String jarg2, String jarg3);
   public final static native int ESLconnection_events(long jarg1, ESLconnection jarg1_, String jarg2, String jarg3);
-  public final static native int ESLconnection_execute(long jarg1, ESLconnection jarg1_, String jarg2, String jarg3, String jarg4);
-  public final static native int ESLconnection_executeAsync(long jarg1, ESLconnection jarg1_, String jarg2, String jarg3, String jarg4);
+  public final static native long ESLconnection_execute(long jarg1, ESLconnection jarg1_, String jarg2, String jarg3, String jarg4);
+  public final static native long ESLconnection_executeAsync(long jarg1, ESLconnection jarg1_, String jarg2, String jarg3, String jarg4);
   public final static native int ESLconnection_setAsyncExecute(long jarg1, ESLconnection jarg1_, String jarg2);
   public final static native int ESLconnection_setEventLock(long jarg1, ESLconnection jarg1_, String jarg2);
   public final static native int ESLconnection_disconnect(long jarg1, ESLconnection jarg1_);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/lua/esl_wrap.cpp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/lua/esl_wrap.cpp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/lua/esl_wrap.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -2166,8 +2166,38 @@
   char *arg1 = (char *) 0 ;
   char *arg2 = (char *) 0 ;
   char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
   ESLconnection *result = 0 ;
   
+  SWIG_check_num_args("ESLconnection",4,4)
+  if(!lua_isstring(L,1)) SWIG_fail_arg("ESLconnection",1,"char const *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("ESLconnection",2,"char const *");
+  if(!lua_isstring(L,3)) SWIG_fail_arg("ESLconnection",3,"char const *");
+  if(!lua_isstring(L,4)) SWIG_fail_arg("ESLconnection",4,"char const *");
+  arg1 = (char *)lua_tostring(L, 1);
+  arg2 = (char *)lua_tostring(L, 2);
+  arg3 = (char *)lua_tostring(L, 3);
+  arg4 = (char *)lua_tostring(L, 4);
+  result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
+  SWIG_arg=0;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLconnection,1); SWIG_arg++; 
+  return SWIG_arg;
+  
+  if(0) SWIG_fail;
+  
+fail:
+  lua_error(L);
+  return SWIG_arg;
+}
+
+
+static int _wrap_new_ESLconnection__SWIG_1(lua_State* L) {
+  int SWIG_arg = -1;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  ESLconnection *result = 0 ;
+  
   SWIG_check_num_args("ESLconnection",3,3)
   if(!lua_isstring(L,1)) SWIG_fail_arg("ESLconnection",1,"char const *");
   if(!lua_isstring(L,2)) SWIG_fail_arg("ESLconnection",2,"char const *");
@@ -2188,7 +2218,7 @@
 }
 
 
-static int _wrap_new_ESLconnection__SWIG_1(lua_State* L) {
+static int _wrap_new_ESLconnection__SWIG_2(lua_State* L) {
   int SWIG_arg = -1;
   int arg1 ;
   ESLconnection *result = 0 ;
@@ -2211,8 +2241,8 @@
 
 static int _wrap_new_ESLconnection(lua_State* L) {
   int argc;
-  int argv[4]={
-    1,2,3,4
+  int argv[5]={
+    1,2,3,4,5
   };
   
   argc = lua_gettop(L);
@@ -2222,7 +2252,7 @@
       _v = lua_isnumber(L,argv[0]);
     }
     if (_v) {
-      return _wrap_new_ESLconnection__SWIG_1(L);
+      return _wrap_new_ESLconnection__SWIG_2(L);
     }
   }
   if (argc == 3) {
@@ -2239,11 +2269,35 @@
           _v = lua_isstring(L,argv[2]);
         }
         if (_v) {
-          return _wrap_new_ESLconnection__SWIG_0(L);
+          return _wrap_new_ESLconnection__SWIG_1(L);
         }
       }
     }
   }
+  if (argc == 4) {
+    int _v;
+    {
+      _v = lua_isstring(L,argv[0]);
+    }
+    if (_v) {
+      {
+        _v = lua_isstring(L,argv[1]);
+      }
+      if (_v) {
+        {
+          _v = lua_isstring(L,argv[2]);
+        }
+        if (_v) {
+          {
+            _v = lua_isstring(L,argv[3]);
+          }
+          if (_v) {
+            return _wrap_new_ESLconnection__SWIG_0(L);
+          }
+        }
+      }
+    }
+  }
   
   lua_pushstring(L,"No matching function for overloaded 'new_ESLconnection'");
   lua_error(L);return 0;
@@ -2625,7 +2679,7 @@
   char *arg2 = (char *) 0 ;
   char *arg3 = (char *) NULL ;
   char *arg4 = (char *) NULL ;
-  int result;
+  ESLevent *result = 0 ;
   
   SWIG_check_num_args("execute",2,4)
   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("execute",1,"ESLconnection *");
@@ -2644,9 +2698,9 @@
   if(lua_gettop(L)>=4){
     arg4 = (char *)lua_tostring(L, 4);
   }
-  result = (int)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  result = (ESLevent *)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
   SWIG_arg=0;
-  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++; 
   return SWIG_arg;
   
   if(0) SWIG_fail;
@@ -2663,7 +2717,7 @@
   char *arg2 = (char *) 0 ;
   char *arg3 = (char *) NULL ;
   char *arg4 = (char *) NULL ;
-  int result;
+  ESLevent *result = 0 ;
   
   SWIG_check_num_args("executeAsync",2,4)
   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("executeAsync",1,"ESLconnection *");
@@ -2682,9 +2736,9 @@
   if(lua_gettop(L)>=4){
     arg4 = (char *)lua_tostring(L, 4);
   }
-  result = (int)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  result = (ESLevent *)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
   SWIG_arg=0;
-  lua_pushnumber(L, (lua_Number) result); SWIG_arg++;
+  SWIG_NewPointerObj(L,result,SWIGTYPE_p_ESLevent,1); SWIG_arg++; 
   return SWIG_arg;
   
   if(0) SWIG_fail;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ESL.cs (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ESL.cs	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ESL.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,18 +1,18 @@
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-
-using System;
-using System.Runtime.InteropServices;
-
-public class ESL {
-  public static void eslSetLogLevel(int level) {
-    ESLPINVOKE.eslSetLogLevel(level);
-  }
-
-}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.40
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+
+using System;
+using System.Runtime.InteropServices;
+
+public class ESL {
+  public static void eslSetLogLevel(int level) {
+    ESLPINVOKE.eslSetLogLevel(level);
+  }
+
+}

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ESL.vcproj (from rev 16612, freeswitch/trunk/libs/esl/managed/ESL.vcproj) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ESL.vcproj	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ESL.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,216 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="ESL"
+	ProjectGUID="{FEA2D0AE-6713-4E41-A473-A143849BC7FF}"
+	RootNamespace="ESL"
+	Keyword="ManagedCProj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="2"
+			ManagedExtensions="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\src\include"
+				PreprocessorDefinitions="WIN32;_DEBUG"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="4"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="esl.lib Ws2_32.lib"
+				LinkIncremental="2"
+				AdditionalLibraryDirectories="&quot;..\..\..\$(ConfigurationName)\&quot;"
+				GenerateDebugInformation="true"
+				AssemblyDebug="1"
+				TargetMachine="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="2"
+			CharacterSet="1"
+			ManagedExtensions="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="..\src\include"
+				PreprocessorDefinitions="WIN32;NDEBUG"
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalDependencies="esl.lib Ws2_32.lib"
+				LinkIncremental="1"
+				AdditionalLibraryDirectories="&quot;..\..\..\$(ConfigurationName)\&quot;"
+				GenerateDebugInformation="true"
+				TargetMachine="1"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+		<AssemblyReference
+			RelativePath="System.dll"
+			AssemblyName="System, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
+			MinFrameworkVersion="131072"
+		/>
+		<AssemblyReference
+			RelativePath="System.Data.dll"
+			AssemblyName="System.Data, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=x86"
+			MinFrameworkVersion="131072"
+		/>
+		<AssemblyReference
+			RelativePath="System.XML.dll"
+			AssemblyName="System.Xml, Version=2.0.0.0, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"
+			MinFrameworkVersion="131072"
+		/>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\src\esl_oop.cpp"
+				>
+			</File>
+			<File
+				RelativePath=".\esl_wrap.cpp"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+			<File
+				RelativePath="..\src\include\esl_oop.h"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ESLPINVOKE.cs (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ESLPINVOKE.cs	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ESLPINVOKE.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,309 +1,312 @@
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-
-using System;
-using System.Runtime.InteropServices;
-
-class ESLPINVOKE {
-
-  protected class SWIGExceptionHelper {
-
-    public delegate void ExceptionDelegate(string message);
-    public delegate void ExceptionArgumentDelegate(string message, string paramName);
-
-    static ExceptionDelegate applicationDelegate = new ExceptionDelegate(SetPendingApplicationException);
-    static ExceptionDelegate arithmeticDelegate = new ExceptionDelegate(SetPendingArithmeticException);
-    static ExceptionDelegate divideByZeroDelegate = new ExceptionDelegate(SetPendingDivideByZeroException);
-    static ExceptionDelegate indexOutOfRangeDelegate = new ExceptionDelegate(SetPendingIndexOutOfRangeException);
-    static ExceptionDelegate invalidCastDelegate = new ExceptionDelegate(SetPendingInvalidCastException);
-    static ExceptionDelegate invalidOperationDelegate = new ExceptionDelegate(SetPendingInvalidOperationException);
-    static ExceptionDelegate ioDelegate = new ExceptionDelegate(SetPendingIOException);
-    static ExceptionDelegate nullReferenceDelegate = new ExceptionDelegate(SetPendingNullReferenceException);
-    static ExceptionDelegate outOfMemoryDelegate = new ExceptionDelegate(SetPendingOutOfMemoryException);
-    static ExceptionDelegate overflowDelegate = new ExceptionDelegate(SetPendingOverflowException);
-    static ExceptionDelegate systemDelegate = new ExceptionDelegate(SetPendingSystemException);
-
-    static ExceptionArgumentDelegate argumentDelegate = new ExceptionArgumentDelegate(SetPendingArgumentException);
-    static ExceptionArgumentDelegate argumentNullDelegate = new ExceptionArgumentDelegate(SetPendingArgumentNullException);
-    static ExceptionArgumentDelegate argumentOutOfRangeDelegate = new ExceptionArgumentDelegate(SetPendingArgumentOutOfRangeException);
-
-    [DllImport("ESL", EntryPoint="SWIGRegisterExceptionCallbacks_ESL")]
-    public static extern void SWIGRegisterExceptionCallbacks_ESL(
-                                ExceptionDelegate applicationDelegate,
-                                ExceptionDelegate arithmeticDelegate,
-                                ExceptionDelegate divideByZeroDelegate, 
-                                ExceptionDelegate indexOutOfRangeDelegate, 
-                                ExceptionDelegate invalidCastDelegate,
-                                ExceptionDelegate invalidOperationDelegate,
-                                ExceptionDelegate ioDelegate,
-                                ExceptionDelegate nullReferenceDelegate,
-                                ExceptionDelegate outOfMemoryDelegate, 
-                                ExceptionDelegate overflowDelegate, 
-                                ExceptionDelegate systemExceptionDelegate);
-
-    [DllImport("ESL", EntryPoint="SWIGRegisterExceptionArgumentCallbacks_ESL")]
-    public static extern void SWIGRegisterExceptionCallbacksArgument_ESL(
-                                ExceptionArgumentDelegate argumentDelegate,
-                                ExceptionArgumentDelegate argumentNullDelegate,
-                                ExceptionArgumentDelegate argumentOutOfRangeDelegate);
-
-    static void SetPendingApplicationException(string message) {
-      SWIGPendingException.Set(new System.ApplicationException(message, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingArithmeticException(string message) {
-      SWIGPendingException.Set(new System.ArithmeticException(message, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingDivideByZeroException(string message) {
-      SWIGPendingException.Set(new System.DivideByZeroException(message, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingIndexOutOfRangeException(string message) {
-      SWIGPendingException.Set(new System.IndexOutOfRangeException(message, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingInvalidCastException(string message) {
-      SWIGPendingException.Set(new System.InvalidCastException(message, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingInvalidOperationException(string message) {
-      SWIGPendingException.Set(new System.InvalidOperationException(message, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingIOException(string message) {
-      SWIGPendingException.Set(new System.IO.IOException(message, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingNullReferenceException(string message) {
-      SWIGPendingException.Set(new System.NullReferenceException(message, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingOutOfMemoryException(string message) {
-      SWIGPendingException.Set(new System.OutOfMemoryException(message, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingOverflowException(string message) {
-      SWIGPendingException.Set(new System.OverflowException(message, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingSystemException(string message) {
-      SWIGPendingException.Set(new System.SystemException(message, SWIGPendingException.Retrieve()));
-    }
-
-    static void SetPendingArgumentException(string message, string paramName) {
-      SWIGPendingException.Set(new System.ArgumentException(message, paramName, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingArgumentNullException(string message, string paramName) {
-      Exception e = SWIGPendingException.Retrieve();
-      if (e != null) message = message + " Inner Exception: " + e.Message;
-      SWIGPendingException.Set(new System.ArgumentNullException(paramName, message));
-    }
-    static void SetPendingArgumentOutOfRangeException(string message, string paramName) {
-      Exception e = SWIGPendingException.Retrieve();
-      if (e != null) message = message + " Inner Exception: " + e.Message;
-      SWIGPendingException.Set(new System.ArgumentOutOfRangeException(paramName, message));
-    }
-
-    static SWIGExceptionHelper() {
-      SWIGRegisterExceptionCallbacks_ESL(
-                                applicationDelegate,
-                                arithmeticDelegate,
-                                divideByZeroDelegate,
-                                indexOutOfRangeDelegate,
-                                invalidCastDelegate,
-                                invalidOperationDelegate,
-                                ioDelegate,
-                                nullReferenceDelegate,
-                                outOfMemoryDelegate,
-                                overflowDelegate,
-                                systemDelegate);
-
-      SWIGRegisterExceptionCallbacksArgument_ESL(
-                                argumentDelegate,
-                                argumentNullDelegate,
-                                argumentOutOfRangeDelegate);
-    }
-  }
-
-  protected static SWIGExceptionHelper swigExceptionHelper = new SWIGExceptionHelper();
-
-  public class SWIGPendingException {
-    [ThreadStatic]
-    private static Exception pendingException = null;
-    private static int numExceptionsPending = 0;
-
-    public static bool Pending {
-      get {
-        bool pending = false;
-        if (numExceptionsPending > 0)
-          if (pendingException != null)
-            pending = true;
-        return pending;
-      } 
-    }
-
-    public static void Set(Exception e) {
-      if (pendingException != null)
-        throw new ApplicationException("FATAL: An earlier pending exception from unmanaged code was missed and thus not thrown (" + pendingException.ToString() + ")", e);
-      pendingException = e;
-      lock(typeof(ESLPINVOKE)) {
-        numExceptionsPending++;
-      }
-    }
-
-    public static Exception Retrieve() {
-      Exception e = null;
-      if (numExceptionsPending > 0) {
-        if (pendingException != null) {
-          e = pendingException;
-          pendingException = null;
-          lock(typeof(ESLPINVOKE)) {
-            numExceptionsPending--;
-          }
-        }
-      }
-      return e;
-    }
-  }
-
-
-  protected class SWIGStringHelper {
-
-    public delegate string SWIGStringDelegate(string message);
-    static SWIGStringDelegate stringDelegate = new SWIGStringDelegate(CreateString);
-
-    [DllImport("ESL", EntryPoint="SWIGRegisterStringCallback_ESL")]
-    public static extern void SWIGRegisterStringCallback_ESL(SWIGStringDelegate stringDelegate);
-
-    static string CreateString(string cString) {
-      return cString;
-    }
-
-    static SWIGStringHelper() {
-      SWIGRegisterStringCallback_ESL(stringDelegate);
-    }
-  }
-
-  static protected SWIGStringHelper swigStringHelper = new SWIGStringHelper();
-
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLevent_event_set")]
-  public static extern void ESLevent_event_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLevent_event_get")]
-  public static extern IntPtr ESLevent_event_get(HandleRef jarg1);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLevent_serialized_string_set")]
-  public static extern void ESLevent_serialized_string_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLevent_serialized_string_get")]
-  public static extern string ESLevent_serialized_string_get(HandleRef jarg1);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLevent_mine_set")]
-  public static extern void ESLevent_mine_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLevent_mine_get")]
-  public static extern int ESLevent_mine_get(HandleRef jarg1);
-
-  [DllImport("ESL", EntryPoint="CSharp_new_ESLevent__SWIG_0")]
-  public static extern IntPtr new_ESLevent__SWIG_0(string jarg1, string jarg2);
-
-  [DllImport("ESL", EntryPoint="CSharp_new_ESLevent__SWIG_1")]
-  public static extern IntPtr new_ESLevent__SWIG_1(HandleRef jarg1, int jarg2);
-
-  [DllImport("ESL", EntryPoint="CSharp_new_ESLevent__SWIG_2")]
-  public static extern IntPtr new_ESLevent__SWIG_2(HandleRef jarg1);
-
-  [DllImport("ESL", EntryPoint="CSharp_delete_ESLevent")]
-  public static extern void delete_ESLevent(HandleRef jarg1);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLevent_serialize")]
-  public static extern string ESLevent_serialize(HandleRef jarg1, string jarg2);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLevent_setPriority")]
-  public static extern bool ESLevent_setPriority(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLevent_getHeader")]
-  public static extern string ESLevent_getHeader(HandleRef jarg1, string jarg2);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLevent_getBody")]
-  public static extern string ESLevent_getBody(HandleRef jarg1);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLevent_getType")]
-  public static extern string ESLevent_getType(HandleRef jarg1);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLevent_addBody")]
-  public static extern bool ESLevent_addBody(HandleRef jarg1, string jarg2);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLevent_addHeader")]
-  public static extern bool ESLevent_addHeader(HandleRef jarg1, string jarg2, string jarg3);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLevent_delHeader")]
-  public static extern bool ESLevent_delHeader(HandleRef jarg1, string jarg2);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLevent_firstHeader")]
-  public static extern string ESLevent_firstHeader(HandleRef jarg1);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLevent_nextHeader")]
-  public static extern string ESLevent_nextHeader(HandleRef jarg1);
-
-  [DllImport("ESL", EntryPoint="CSharp_new_ESLconnection__SWIG_0")]
-  public static extern IntPtr new_ESLconnection__SWIG_0(string jarg1, string jarg2, string jarg3);
-
-  [DllImport("ESL", EntryPoint="CSharp_new_ESLconnection__SWIG_1")]
-  public static extern IntPtr new_ESLconnection__SWIG_1(int jarg1);
-
-  [DllImport("ESL", EntryPoint="CSharp_delete_ESLconnection")]
-  public static extern void delete_ESLconnection(HandleRef jarg1);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_socketDescriptor")]
-  public static extern int ESLconnection_socketDescriptor(HandleRef jarg1);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_connected")]
-  public static extern int ESLconnection_connected(HandleRef jarg1);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_getInfo")]
-  public static extern IntPtr ESLconnection_getInfo(HandleRef jarg1);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_send")]
-  public static extern int ESLconnection_send(HandleRef jarg1, string jarg2);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_sendRecv")]
-  public static extern IntPtr ESLconnection_sendRecv(HandleRef jarg1, string jarg2);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_api")]
-  public static extern IntPtr ESLconnection_api(HandleRef jarg1, string jarg2, string jarg3);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_bgapi")]
-  public static extern IntPtr ESLconnection_bgapi(HandleRef jarg1, string jarg2, string jarg3);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_sendEvent")]
-  public static extern int ESLconnection_sendEvent(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_recvEvent")]
-  public static extern IntPtr ESLconnection_recvEvent(HandleRef jarg1);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_recvEventTimed")]
-  public static extern IntPtr ESLconnection_recvEventTimed(HandleRef jarg1, int jarg2);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_filter")]
-  public static extern IntPtr ESLconnection_filter(HandleRef jarg1, string jarg2, string jarg3);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_events")]
-  public static extern int ESLconnection_events(HandleRef jarg1, string jarg2, string jarg3);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_execute")]
-  public static extern int ESLconnection_execute(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_executeAsync")]
-  public static extern int ESLconnection_executeAsync(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_setAsyncExecute")]
-  public static extern int ESLconnection_setAsyncExecute(HandleRef jarg1, string jarg2);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_setEventLock")]
-  public static extern int ESLconnection_setEventLock(HandleRef jarg1, string jarg2);
-
-  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_disconnect")]
-  public static extern int ESLconnection_disconnect(HandleRef jarg1);
-
-  [DllImport("ESL", EntryPoint="CSharp_eslSetLogLevel")]
-  public static extern void eslSetLogLevel(int jarg1);
-}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.40
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+
+using System;
+using System.Runtime.InteropServices;
+
+class ESLPINVOKE {
+
+  protected class SWIGExceptionHelper {
+
+    public delegate void ExceptionDelegate(string message);
+    public delegate void ExceptionArgumentDelegate(string message, string paramName);
+
+    static ExceptionDelegate applicationDelegate = new ExceptionDelegate(SetPendingApplicationException);
+    static ExceptionDelegate arithmeticDelegate = new ExceptionDelegate(SetPendingArithmeticException);
+    static ExceptionDelegate divideByZeroDelegate = new ExceptionDelegate(SetPendingDivideByZeroException);
+    static ExceptionDelegate indexOutOfRangeDelegate = new ExceptionDelegate(SetPendingIndexOutOfRangeException);
+    static ExceptionDelegate invalidCastDelegate = new ExceptionDelegate(SetPendingInvalidCastException);
+    static ExceptionDelegate invalidOperationDelegate = new ExceptionDelegate(SetPendingInvalidOperationException);
+    static ExceptionDelegate ioDelegate = new ExceptionDelegate(SetPendingIOException);
+    static ExceptionDelegate nullReferenceDelegate = new ExceptionDelegate(SetPendingNullReferenceException);
+    static ExceptionDelegate outOfMemoryDelegate = new ExceptionDelegate(SetPendingOutOfMemoryException);
+    static ExceptionDelegate overflowDelegate = new ExceptionDelegate(SetPendingOverflowException);
+    static ExceptionDelegate systemDelegate = new ExceptionDelegate(SetPendingSystemException);
+
+    static ExceptionArgumentDelegate argumentDelegate = new ExceptionArgumentDelegate(SetPendingArgumentException);
+    static ExceptionArgumentDelegate argumentNullDelegate = new ExceptionArgumentDelegate(SetPendingArgumentNullException);
+    static ExceptionArgumentDelegate argumentOutOfRangeDelegate = new ExceptionArgumentDelegate(SetPendingArgumentOutOfRangeException);
+
+    [DllImport("ESL", EntryPoint="SWIGRegisterExceptionCallbacks_ESL")]
+    public static extern void SWIGRegisterExceptionCallbacks_ESL(
+                                ExceptionDelegate applicationDelegate,
+                                ExceptionDelegate arithmeticDelegate,
+                                ExceptionDelegate divideByZeroDelegate, 
+                                ExceptionDelegate indexOutOfRangeDelegate, 
+                                ExceptionDelegate invalidCastDelegate,
+                                ExceptionDelegate invalidOperationDelegate,
+                                ExceptionDelegate ioDelegate,
+                                ExceptionDelegate nullReferenceDelegate,
+                                ExceptionDelegate outOfMemoryDelegate, 
+                                ExceptionDelegate overflowDelegate, 
+                                ExceptionDelegate systemExceptionDelegate);
+
+    [DllImport("ESL", EntryPoint="SWIGRegisterExceptionArgumentCallbacks_ESL")]
+    public static extern void SWIGRegisterExceptionCallbacksArgument_ESL(
+                                ExceptionArgumentDelegate argumentDelegate,
+                                ExceptionArgumentDelegate argumentNullDelegate,
+                                ExceptionArgumentDelegate argumentOutOfRangeDelegate);
+
+    static void SetPendingApplicationException(string message) {
+      SWIGPendingException.Set(new System.ApplicationException(message, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingArithmeticException(string message) {
+      SWIGPendingException.Set(new System.ArithmeticException(message, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingDivideByZeroException(string message) {
+      SWIGPendingException.Set(new System.DivideByZeroException(message, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingIndexOutOfRangeException(string message) {
+      SWIGPendingException.Set(new System.IndexOutOfRangeException(message, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingInvalidCastException(string message) {
+      SWIGPendingException.Set(new System.InvalidCastException(message, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingInvalidOperationException(string message) {
+      SWIGPendingException.Set(new System.InvalidOperationException(message, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingIOException(string message) {
+      SWIGPendingException.Set(new System.IO.IOException(message, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingNullReferenceException(string message) {
+      SWIGPendingException.Set(new System.NullReferenceException(message, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingOutOfMemoryException(string message) {
+      SWIGPendingException.Set(new System.OutOfMemoryException(message, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingOverflowException(string message) {
+      SWIGPendingException.Set(new System.OverflowException(message, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingSystemException(string message) {
+      SWIGPendingException.Set(new System.SystemException(message, SWIGPendingException.Retrieve()));
+    }
+
+    static void SetPendingArgumentException(string message, string paramName) {
+      SWIGPendingException.Set(new System.ArgumentException(message, paramName, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingArgumentNullException(string message, string paramName) {
+      Exception e = SWIGPendingException.Retrieve();
+      if (e != null) message = message + " Inner Exception: " + e.Message;
+      SWIGPendingException.Set(new System.ArgumentNullException(paramName, message));
+    }
+    static void SetPendingArgumentOutOfRangeException(string message, string paramName) {
+      Exception e = SWIGPendingException.Retrieve();
+      if (e != null) message = message + " Inner Exception: " + e.Message;
+      SWIGPendingException.Set(new System.ArgumentOutOfRangeException(paramName, message));
+    }
+
+    static SWIGExceptionHelper() {
+      SWIGRegisterExceptionCallbacks_ESL(
+                                applicationDelegate,
+                                arithmeticDelegate,
+                                divideByZeroDelegate,
+                                indexOutOfRangeDelegate,
+                                invalidCastDelegate,
+                                invalidOperationDelegate,
+                                ioDelegate,
+                                nullReferenceDelegate,
+                                outOfMemoryDelegate,
+                                overflowDelegate,
+                                systemDelegate);
+
+      SWIGRegisterExceptionCallbacksArgument_ESL(
+                                argumentDelegate,
+                                argumentNullDelegate,
+                                argumentOutOfRangeDelegate);
+    }
+  }
+
+  protected static SWIGExceptionHelper swigExceptionHelper = new SWIGExceptionHelper();
+
+  public class SWIGPendingException {
+    [ThreadStatic]
+    private static Exception pendingException = null;
+    private static int numExceptionsPending = 0;
+
+    public static bool Pending {
+      get {
+        bool pending = false;
+        if (numExceptionsPending > 0)
+          if (pendingException != null)
+            pending = true;
+        return pending;
+      } 
+    }
+
+    public static void Set(Exception e) {
+      if (pendingException != null)
+        throw new ApplicationException("FATAL: An earlier pending exception from unmanaged code was missed and thus not thrown (" + pendingException.ToString() + ")", e);
+      pendingException = e;
+      lock(typeof(ESLPINVOKE)) {
+        numExceptionsPending++;
+      }
+    }
+
+    public static Exception Retrieve() {
+      Exception e = null;
+      if (numExceptionsPending > 0) {
+        if (pendingException != null) {
+          e = pendingException;
+          pendingException = null;
+          lock(typeof(ESLPINVOKE)) {
+            numExceptionsPending--;
+          }
+        }
+      }
+      return e;
+    }
+  }
+
+
+  protected class SWIGStringHelper {
+
+    public delegate string SWIGStringDelegate(string message);
+    static SWIGStringDelegate stringDelegate = new SWIGStringDelegate(CreateString);
+
+    [DllImport("ESL", EntryPoint="SWIGRegisterStringCallback_ESL")]
+    public static extern void SWIGRegisterStringCallback_ESL(SWIGStringDelegate stringDelegate);
+
+    static string CreateString(string cString) {
+      return cString;
+    }
+
+    static SWIGStringHelper() {
+      SWIGRegisterStringCallback_ESL(stringDelegate);
+    }
+  }
+
+  static protected SWIGStringHelper swigStringHelper = new SWIGStringHelper();
+
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLevent_Event_set")]
+  public static extern void ESLevent_Event_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLevent_Event_get")]
+  public static extern IntPtr ESLevent_Event_get(HandleRef jarg1);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLevent_SerializedString_set")]
+  public static extern void ESLevent_SerializedString_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLevent_SerializedString_get")]
+  public static extern string ESLevent_SerializedString_get(HandleRef jarg1);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLevent_Mine_set")]
+  public static extern void ESLevent_Mine_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLevent_Mine_get")]
+  public static extern int ESLevent_Mine_get(HandleRef jarg1);
+
+  [DllImport("ESL", EntryPoint="CSharp_new_ESLevent__SWIG_0")]
+  public static extern IntPtr new_ESLevent__SWIG_0(string jarg1, string jarg2);
+
+  [DllImport("ESL", EntryPoint="CSharp_new_ESLevent__SWIG_1")]
+  public static extern IntPtr new_ESLevent__SWIG_1(HandleRef jarg1, int jarg2);
+
+  [DllImport("ESL", EntryPoint="CSharp_new_ESLevent__SWIG_2")]
+  public static extern IntPtr new_ESLevent__SWIG_2(HandleRef jarg1);
+
+  [DllImport("ESL", EntryPoint="CSharp_delete_ESLevent")]
+  public static extern void delete_ESLevent(HandleRef jarg1);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLevent_Serialize")]
+  public static extern string ESLevent_Serialize(HandleRef jarg1, string jarg2);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLevent_SetPriority")]
+  public static extern bool ESLevent_SetPriority(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLevent_GetHeader")]
+  public static extern string ESLevent_GetHeader(HandleRef jarg1, string jarg2);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLevent_GetBody")]
+  public static extern string ESLevent_GetBody(HandleRef jarg1);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLevent_getType")]
+  public static extern string ESLevent_getType(HandleRef jarg1);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLevent_AddBody")]
+  public static extern bool ESLevent_AddBody(HandleRef jarg1, string jarg2);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLevent_AddHeader")]
+  public static extern bool ESLevent_AddHeader(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLevent_DelHeader")]
+  public static extern bool ESLevent_DelHeader(HandleRef jarg1, string jarg2);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLevent_FirstHeader")]
+  public static extern string ESLevent_FirstHeader(HandleRef jarg1);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLevent_NextHeader")]
+  public static extern string ESLevent_NextHeader(HandleRef jarg1);
+
+  [DllImport("ESL", EntryPoint="CSharp_new_ESLconnection__SWIG_0")]
+  public static extern IntPtr new_ESLconnection__SWIG_0(string jarg1, string jarg2, string jarg3, string jarg4);
+
+  [DllImport("ESL", EntryPoint="CSharp_new_ESLconnection__SWIG_1")]
+  public static extern IntPtr new_ESLconnection__SWIG_1(string jarg1, string jarg2, string jarg3);
+
+  [DllImport("ESL", EntryPoint="CSharp_new_ESLconnection__SWIG_2")]
+  public static extern IntPtr new_ESLconnection__SWIG_2(int jarg1);
+
+  [DllImport("ESL", EntryPoint="CSharp_delete_ESLconnection")]
+  public static extern void delete_ESLconnection(HandleRef jarg1);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_SocketDescriptor")]
+  public static extern int ESLconnection_SocketDescriptor(HandleRef jarg1);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_Connected")]
+  public static extern int ESLconnection_Connected(HandleRef jarg1);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_GetInfo")]
+  public static extern IntPtr ESLconnection_GetInfo(HandleRef jarg1);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_Send")]
+  public static extern int ESLconnection_Send(HandleRef jarg1, string jarg2);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_SendRecv")]
+  public static extern IntPtr ESLconnection_SendRecv(HandleRef jarg1, string jarg2);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_Api")]
+  public static extern IntPtr ESLconnection_Api(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_Bgapi")]
+  public static extern IntPtr ESLconnection_Bgapi(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_SendEvent")]
+  public static extern int ESLconnection_SendEvent(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_RecvEvent")]
+  public static extern IntPtr ESLconnection_RecvEvent(HandleRef jarg1);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_RecvEventTimed")]
+  public static extern IntPtr ESLconnection_RecvEventTimed(HandleRef jarg1, int jarg2);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_Filter")]
+  public static extern IntPtr ESLconnection_Filter(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_Events")]
+  public static extern int ESLconnection_Events(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_Execute")]
+  public static extern IntPtr ESLconnection_Execute(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_ExecuteAsync")]
+  public static extern IntPtr ESLconnection_ExecuteAsync(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_SetAsyncExecute")]
+  public static extern int ESLconnection_SetAsyncExecute(HandleRef jarg1, string jarg2);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_SetEventLock")]
+  public static extern int ESLconnection_SetEventLock(HandleRef jarg1, string jarg2);
+
+  [DllImport("ESL", EntryPoint="CSharp_ESLconnection_Disconnect")]
+  public static extern int ESLconnection_Disconnect(HandleRef jarg1);
+
+  [DllImport("ESL", EntryPoint="CSharp_eslSetLogLevel")]
+  public static extern void eslSetLogLevel(int jarg1);
+}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ESLconnection.cs (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ESLconnection.cs	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ESLconnection.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,139 +1,146 @@
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-
-using System;
-using System.Runtime.InteropServices;
-
-public class ESLconnection : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal ESLconnection(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(ESLconnection obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~ESLconnection() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        ESLPINVOKE.delete_ESLconnection(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public ESLconnection(string host, string port, string password) : this(ESLPINVOKE.new_ESLconnection__SWIG_0(host, port, password), true) {
-  }
-
-  public ESLconnection(int socket) : this(ESLPINVOKE.new_ESLconnection__SWIG_1(socket), true) {
-  }
-
-  public int socketDescriptor() {
-    int ret = ESLPINVOKE.ESLconnection_socketDescriptor(swigCPtr);
-    return ret;
-  }
-
-  public int connected() {
-    int ret = ESLPINVOKE.ESLconnection_connected(swigCPtr);
-    return ret;
-  }
-
-  public ESLevent getInfo() {
-    IntPtr cPtr = ESLPINVOKE.ESLconnection_getInfo(swigCPtr);
-    ESLevent ret = (cPtr == IntPtr.Zero) ? null : new ESLevent(cPtr, true);
-    return ret;
-  }
-
-  public int send(string cmd) {
-    int ret = ESLPINVOKE.ESLconnection_send(swigCPtr, cmd);
-    return ret;
-  }
-
-  public ESLevent sendRecv(string cmd) {
-    IntPtr cPtr = ESLPINVOKE.ESLconnection_sendRecv(swigCPtr, cmd);
-    ESLevent ret = (cPtr == IntPtr.Zero) ? null : new ESLevent(cPtr, true);
-    return ret;
-  }
-
-  public ESLevent api(string cmd, string arg) {
-    IntPtr cPtr = ESLPINVOKE.ESLconnection_api(swigCPtr, cmd, arg);
-    ESLevent ret = (cPtr == IntPtr.Zero) ? null : new ESLevent(cPtr, true);
-    return ret;
-  }
-
-  public ESLevent bgapi(string cmd, string arg) {
-    IntPtr cPtr = ESLPINVOKE.ESLconnection_bgapi(swigCPtr, cmd, arg);
-    ESLevent ret = (cPtr == IntPtr.Zero) ? null : new ESLevent(cPtr, true);
-    return ret;
-  }
-
-  public int sendEvent(ESLevent send_me) {
-    int ret = ESLPINVOKE.ESLconnection_sendEvent(swigCPtr, ESLevent.getCPtr(send_me));
-    return ret;
-  }
-
-  public ESLevent recvEvent() {
-    IntPtr cPtr = ESLPINVOKE.ESLconnection_recvEvent(swigCPtr);
-    ESLevent ret = (cPtr == IntPtr.Zero) ? null : new ESLevent(cPtr, true);
-    return ret;
-  }
-
-  public ESLevent recvEventTimed(int ms) {
-    IntPtr cPtr = ESLPINVOKE.ESLconnection_recvEventTimed(swigCPtr, ms);
-    ESLevent ret = (cPtr == IntPtr.Zero) ? null : new ESLevent(cPtr, true);
-    return ret;
-  }
-
-  public ESLevent filter(string header, string value) {
-    IntPtr cPtr = ESLPINVOKE.ESLconnection_filter(swigCPtr, header, value);
-    ESLevent ret = (cPtr == IntPtr.Zero) ? null : new ESLevent(cPtr, true);
-    return ret;
-  }
-
-  public int events(string etype, string value) {
-    int ret = ESLPINVOKE.ESLconnection_events(swigCPtr, etype, value);
-    return ret;
-  }
-
-  public int execute(string app, string arg, string uuid) {
-    int ret = ESLPINVOKE.ESLconnection_execute(swigCPtr, app, arg, uuid);
-    return ret;
-  }
-
-  public int executeAsync(string app, string arg, string uuid) {
-    int ret = ESLPINVOKE.ESLconnection_executeAsync(swigCPtr, app, arg, uuid);
-    return ret;
-  }
-
-  public int setAsyncExecute(string val) {
-    int ret = ESLPINVOKE.ESLconnection_setAsyncExecute(swigCPtr, val);
-    return ret;
-  }
-
-  public int setEventLock(string val) {
-    int ret = ESLPINVOKE.ESLconnection_setEventLock(swigCPtr, val);
-    return ret;
-  }
-
-  public int disconnect() {
-    int ret = ESLPINVOKE.ESLconnection_disconnect(swigCPtr);
-    return ret;
-  }
-
-}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.40
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+
+using System;
+using System.Runtime.InteropServices;
+
+public class ESLconnection : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal ESLconnection(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(ESLconnection obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~ESLconnection() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if (swigCPtr.Handle != IntPtr.Zero) {
+        if (swigCMemOwn) {
+          swigCMemOwn = false;
+          ESLPINVOKE.delete_ESLconnection(swigCPtr);
+        }
+        swigCPtr = new HandleRef(null, IntPtr.Zero);
+      }
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public ESLconnection(string host, string port, string user, string password) : this(ESLPINVOKE.new_ESLconnection__SWIG_0(host, port, user, password), true) {
+  }
+
+  public ESLconnection(string host, string port, string password) : this(ESLPINVOKE.new_ESLconnection__SWIG_1(host, port, password), true) {
+  }
+
+  public ESLconnection(int socket) : this(ESLPINVOKE.new_ESLconnection__SWIG_2(socket), true) {
+  }
+
+  public int SocketDescriptor() {
+    int ret = ESLPINVOKE.ESLconnection_SocketDescriptor(swigCPtr);
+    return ret;
+  }
+
+  public int Connected() {
+    int ret = ESLPINVOKE.ESLconnection_Connected(swigCPtr);
+    return ret;
+  }
+
+  public ESLevent GetInfo() {
+    IntPtr cPtr = ESLPINVOKE.ESLconnection_GetInfo(swigCPtr);
+    ESLevent ret = (cPtr == IntPtr.Zero) ? null : new ESLevent(cPtr, true);
+    return ret;
+  }
+
+  public int Send(string cmd) {
+    int ret = ESLPINVOKE.ESLconnection_Send(swigCPtr, cmd);
+    return ret;
+  }
+
+  public ESLevent SendRecv(string cmd) {
+    IntPtr cPtr = ESLPINVOKE.ESLconnection_SendRecv(swigCPtr, cmd);
+    ESLevent ret = (cPtr == IntPtr.Zero) ? null : new ESLevent(cPtr, true);
+    return ret;
+  }
+
+  public ESLevent Api(string cmd, string arg) {
+    IntPtr cPtr = ESLPINVOKE.ESLconnection_Api(swigCPtr, cmd, arg);
+    ESLevent ret = (cPtr == IntPtr.Zero) ? null : new ESLevent(cPtr, true);
+    return ret;
+  }
+
+  public ESLevent Bgapi(string cmd, string arg) {
+    IntPtr cPtr = ESLPINVOKE.ESLconnection_Bgapi(swigCPtr, cmd, arg);
+    ESLevent ret = (cPtr == IntPtr.Zero) ? null : new ESLevent(cPtr, true);
+    return ret;
+  }
+
+  public int SendEvent(ESLevent send_me) {
+    int ret = ESLPINVOKE.ESLconnection_SendEvent(swigCPtr, ESLevent.getCPtr(send_me));
+    return ret;
+  }
+
+  public ESLevent RecvEvent() {
+    IntPtr cPtr = ESLPINVOKE.ESLconnection_RecvEvent(swigCPtr);
+    ESLevent ret = (cPtr == IntPtr.Zero) ? null : new ESLevent(cPtr, true);
+    return ret;
+  }
+
+  public ESLevent RecvEventTimed(int ms) {
+    IntPtr cPtr = ESLPINVOKE.ESLconnection_RecvEventTimed(swigCPtr, ms);
+    ESLevent ret = (cPtr == IntPtr.Zero) ? null : new ESLevent(cPtr, true);
+    return ret;
+  }
+
+  public ESLevent Filter(string header, string value) {
+    IntPtr cPtr = ESLPINVOKE.ESLconnection_Filter(swigCPtr, header, value);
+    ESLevent ret = (cPtr == IntPtr.Zero) ? null : new ESLevent(cPtr, true);
+    return ret;
+  }
+
+  public int Events(string etype, string value) {
+    int ret = ESLPINVOKE.ESLconnection_Events(swigCPtr, etype, value);
+    return ret;
+  }
+
+  public ESLevent Execute(string app, string arg, string uuid) {
+    IntPtr cPtr = ESLPINVOKE.ESLconnection_Execute(swigCPtr, app, arg, uuid);
+    ESLevent ret = (cPtr == IntPtr.Zero) ? null : new ESLevent(cPtr, true);
+    return ret;
+  }
+
+  public ESLevent ExecuteAsync(string app, string arg, string uuid) {
+    IntPtr cPtr = ESLPINVOKE.ESLconnection_ExecuteAsync(swigCPtr, app, arg, uuid);
+    ESLevent ret = (cPtr == IntPtr.Zero) ? null : new ESLevent(cPtr, true);
+    return ret;
+  }
+
+  public int SetAsyncExecute(string val) {
+    int ret = ESLPINVOKE.ESLconnection_SetAsyncExecute(swigCPtr, val);
+    return ret;
+  }
+
+  public int SetEventLock(string val) {
+    int ret = ESLPINVOKE.ESLconnection_SetEventLock(swigCPtr, val);
+    return ret;
+  }
+
+  public int Disconnect() {
+    int ret = ESLPINVOKE.ESLconnection_Disconnect(swigCPtr);
+    return ret;
+  }
+
+}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ESLevent.cs (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ESLevent.cs	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ESLevent.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,132 +1,134 @@
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-
-using System;
-using System.Runtime.InteropServices;
-
-public class ESLevent : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal ESLevent(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(ESLevent obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~ESLevent() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        ESLPINVOKE.delete_ESLevent(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_esl_event_t event {
-    set {
-      ESLPINVOKE.ESLevent_event_set(swigCPtr, SWIGTYPE_p_esl_event_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = ESLPINVOKE.ESLevent_event_get(swigCPtr);
-      SWIGTYPE_p_esl_event_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_esl_event_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public string serialized_string {
-    set {
-      ESLPINVOKE.ESLevent_serialized_string_set(swigCPtr, value);
-    } 
-    get {
-      string ret = ESLPINVOKE.ESLevent_serialized_string_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int mine {
-    set {
-      ESLPINVOKE.ESLevent_mine_set(swigCPtr, value);
-    } 
-    get {
-      int ret = ESLPINVOKE.ESLevent_mine_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public ESLevent(string type, string subclass_name) : this(ESLPINVOKE.new_ESLevent__SWIG_0(type, subclass_name), true) {
-  }
-
-  public ESLevent(SWIGTYPE_p_esl_event_t wrap_me, int free_me) : this(ESLPINVOKE.new_ESLevent__SWIG_1(SWIGTYPE_p_esl_event_t.getCPtr(wrap_me), free_me), true) {
-  }
-
-  public ESLevent(ESLevent me) : this(ESLPINVOKE.new_ESLevent__SWIG_2(ESLevent.getCPtr(me)), true) {
-  }
-
-  public string serialize(string format) {
-    string ret = ESLPINVOKE.ESLevent_serialize(swigCPtr, format);
-    return ret;
-  }
-
-  public bool setPriority(SWIGTYPE_p_esl_priority_t priority) {
-    bool ret = ESLPINVOKE.ESLevent_setPriority(swigCPtr, SWIGTYPE_p_esl_priority_t.getCPtr(priority));
-    if (ESLPINVOKE.SWIGPendingException.Pending) throw ESLPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public string getHeader(string header_name) {
-    string ret = ESLPINVOKE.ESLevent_getHeader(swigCPtr, header_name);
-    return ret;
-  }
-
-  public string getBody() {
-    string ret = ESLPINVOKE.ESLevent_getBody(swigCPtr);
-    return ret;
-  }
-
-  public string getType() {
-    string ret = ESLPINVOKE.ESLevent_getType(swigCPtr);
-    return ret;
-  }
-
-  public bool addBody(string value) {
-    bool ret = ESLPINVOKE.ESLevent_addBody(swigCPtr, value);
-    return ret;
-  }
-
-  public bool addHeader(string header_name, string value) {
-    bool ret = ESLPINVOKE.ESLevent_addHeader(swigCPtr, header_name, value);
-    return ret;
-  }
-
-  public bool delHeader(string header_name) {
-    bool ret = ESLPINVOKE.ESLevent_delHeader(swigCPtr, header_name);
-    return ret;
-  }
-
-  public string firstHeader() {
-    string ret = ESLPINVOKE.ESLevent_firstHeader(swigCPtr);
-    return ret;
-  }
-
-  public string nextHeader() {
-    string ret = ESLPINVOKE.ESLevent_nextHeader(swigCPtr);
-    return ret;
-  }
-
-}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.40
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+
+using System;
+using System.Runtime.InteropServices;
+
+public class ESLevent : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal ESLevent(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(ESLevent obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~ESLevent() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if (swigCPtr.Handle != IntPtr.Zero) {
+        if (swigCMemOwn) {
+          swigCMemOwn = false;
+          ESLPINVOKE.delete_ESLevent(swigCPtr);
+        }
+        swigCPtr = new HandleRef(null, IntPtr.Zero);
+      }
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_esl_event_t Event {
+    set {
+      ESLPINVOKE.ESLevent_Event_set(swigCPtr, SWIGTYPE_p_esl_event_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = ESLPINVOKE.ESLevent_Event_get(swigCPtr);
+      SWIGTYPE_p_esl_event_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_esl_event_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public string SerializedString {
+    set {
+      ESLPINVOKE.ESLevent_SerializedString_set(swigCPtr, value);
+    } 
+    get {
+      string ret = ESLPINVOKE.ESLevent_SerializedString_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int Mine {
+    set {
+      ESLPINVOKE.ESLevent_Mine_set(swigCPtr, value);
+    } 
+    get {
+      int ret = ESLPINVOKE.ESLevent_Mine_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public ESLevent(string type, string subclass_name) : this(ESLPINVOKE.new_ESLevent__SWIG_0(type, subclass_name), true) {
+  }
+
+  public ESLevent(SWIGTYPE_p_esl_event_t wrap_me, int free_me) : this(ESLPINVOKE.new_ESLevent__SWIG_1(SWIGTYPE_p_esl_event_t.getCPtr(wrap_me), free_me), true) {
+  }
+
+  public ESLevent(ESLevent me) : this(ESLPINVOKE.new_ESLevent__SWIG_2(ESLevent.getCPtr(me)), true) {
+  }
+
+  public string Serialize(string format) {
+    string ret = ESLPINVOKE.ESLevent_Serialize(swigCPtr, format);
+    return ret;
+  }
+
+  public bool SetPriority(SWIGTYPE_p_esl_priority_t priority) {
+    bool ret = ESLPINVOKE.ESLevent_SetPriority(swigCPtr, SWIGTYPE_p_esl_priority_t.getCPtr(priority));
+    if (ESLPINVOKE.SWIGPendingException.Pending) throw ESLPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public string GetHeader(string header_name) {
+    string ret = ESLPINVOKE.ESLevent_GetHeader(swigCPtr, header_name);
+    return ret;
+  }
+
+  public string GetBody() {
+    string ret = ESLPINVOKE.ESLevent_GetBody(swigCPtr);
+    return ret;
+  }
+
+  public string getType() {
+    string ret = ESLPINVOKE.ESLevent_getType(swigCPtr);
+    return ret;
+  }
+
+  public bool AddBody(string value) {
+    bool ret = ESLPINVOKE.ESLevent_AddBody(swigCPtr, value);
+    return ret;
+  }
+
+  public bool AddHeader(string header_name, string value) {
+    bool ret = ESLPINVOKE.ESLevent_AddHeader(swigCPtr, header_name, value);
+    return ret;
+  }
+
+  public bool DelHeader(string header_name) {
+    bool ret = ESLPINVOKE.ESLevent_DelHeader(swigCPtr, header_name);
+    return ret;
+  }
+
+  public string FirstHeader() {
+    string ret = ESLPINVOKE.ESLevent_FirstHeader(swigCPtr);
+    return ret;
+  }
+
+  public string NextHeader() {
+    string ret = ESLPINVOKE.ESLevent_NextHeader(swigCPtr);
+    return ret;
+  }
+
+}

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ManagedEsl.csproj (from rev 16612, freeswitch/trunk/libs/esl/managed/ManagedEsl.csproj) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ManagedEsl.csproj	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ManagedEsl.csproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.30729</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{DEE5837B-E01D-4223-B351-EDF9418F3F8E}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>ManagedEsl</RootNamespace>
+    <AssemblyName>ManagedEsl</AssemblyName>
+    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <TargetFrameworkSubset>
+    </TargetFrameworkSubset>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="ESL.cs" />
+    <Compile Include="ESLconnection.cs" />
+    <Compile Include="ESLevent.cs" />
+    <Compile Include="ESLPINVOKE.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="SWIGTYPE_p_esl_event_t.cs" />
+    <Compile Include="SWIGTYPE_p_esl_priority_t.cs" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ManagedEslTest (from rev 16612, freeswitch/trunk/libs/esl/managed/ManagedEslTest)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ManagedEslTest/ManagedEslTest.csproj

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ManagedEslTest/ManagedEslTest.csproj (from rev 16612, freeswitch/trunk/libs/esl/managed/ManagedEslTest/ManagedEslTest.csproj) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ManagedEslTest/ManagedEslTest.csproj	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ManagedEslTest/ManagedEslTest.csproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>9.0.30729</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{2321D01A-D64B-4461-9837-FACF38652212}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>ManagedEslTest</RootNamespace>
+    <AssemblyName>ManagedEslTest</AssemblyName>
+    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <TargetFrameworkSubset>
+    </TargetFrameworkSubset>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>..\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>..\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\ManagedEsl.csproj">
+      <Project>{DEE5837B-E01D-4223-B351-EDF9418F3F8E}</Project>
+      <Name>ManagedEsl</Name>
+      <Private>True</Private>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ManagedEslTest/Program.cs

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ManagedEslTest/Program.cs (from rev 16612, freeswitch/trunk/libs/esl/managed/ManagedEslTest/Program.cs) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ManagedEslTest/Program.cs	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ManagedEslTest/Program.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,201 @@
+/*
+ * C# ESL managed examples 
+ * 
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ * 
+ * Contributor: 
+ * Diego Toro <dftoro@yahoo.com>
+ */
+
+using System;
+using System.Net;
+using System.Net.Sockets;
+using System.Threading;
+
+namespace ManagedEslTest
+{
+  [Flags]
+  public enum enLogLevel
+  {
+    EMERG = 0,
+    ALERT,
+    CRIT,
+    ERROR,
+    WARNING,
+    NOTICE,
+    INFO,
+    DEBUG
+  }
+
+
+  class Program
+  {
+    public static readonly int ESL_SUCCESS = 1;
+
+    static void Main(string[] args)
+    {
+      /*
+       * The next lines are usefull to view simples C# examples about how ESL managed works.  
+       * Active only a mode uncomment it: inbound, outbound sync or outbound async. 
+       * If you active two o more on this application you may have problems.
+       * Remember modify your dialplan for testing outbound modes (see OutboundModeSync and OutboundModeAsync members)
+       */
+      ThreadPool.QueueUserWorkItem(new WaitCallback(InboundMode));
+      //ThreadPool.QueueUserWorkItem(new WaitCallback(OutboundModeSync));
+      //ThreadPool.QueueUserWorkItem(new WaitCallback(OutboundModeAsync));
+
+      Console.ReadLine();
+    }
+
+    /// <summary>
+    /// Example using event socket in "Inbound" mode
+    /// </summary>
+    /// <param name="stateInfo">Object state info</param>
+    static void InboundMode(Object stateInfo)
+    {
+      //Initializes a new instance of ESLconnection, and connects to the host $host on the port $port, and supplies $password to freeswitch
+      ESLconnection eslConnection = new ESLconnection("localhost", "8021", "ClueCon");
+
+      if (eslConnection.Connected() != ESL_SUCCESS)
+      {
+        Console.WriteLine("Error connecting to FreeSwitch");
+        return;
+      }
+
+      //Set log level
+      //ESL.eslSetLogLevel((int)enLogLevel.DEBUG);
+
+      // Subscribe to all events 
+      ESLevent eslEvent = eslConnection.SendRecv("event plain ALL");
+
+      if (eslEvent == null)
+      {
+        Console.WriteLine("Error subscribing to all events");
+        return;
+      }
+
+      //Turns an event into colon-separated 'name: value' pairs. The format parameter isn't used
+      Console.WriteLine(eslEvent.Serialize(String.Empty));
+
+      // Grab Events until process is killed
+      while (eslConnection.Connected() == ESL_SUCCESS)
+      {
+        eslEvent = eslConnection.RecvEvent();
+        Console.WriteLine(eslEvent.Serialize(String.Empty));
+      }
+    }
+
+    /// <summary>
+    /// Example using event socket in "Outbound" mode synchronic
+    /// </summary>
+    /// <param name="stateInfo">Object state info</param>
+    static void OutboundModeSync(Object stateInfo)
+    {
+      /* add next line to a dialplan
+      <action application="socket" data="localhost:8022 sync full"/> 
+      */
+      TcpListener tcpListener = new TcpListener(IPAddress.Parse("127.0.0.1"), 8022);
+
+      try
+      {
+        tcpListener.Start();
+
+        Console.WriteLine("OutboundModeSync, waiting for a connection...");
+
+        while (true)
+        {
+          Socket sckClient = tcpListener.AcceptSocket();
+
+          //Initializes a new instance of ESLconnection, and connects to the host $host on the port $port, and supplies $password to freeswitch
+          ESLconnection eslConnection = new ESLconnection(sckClient.Handle.ToInt32());
+
+          Console.WriteLine("Execute(\"answer\")");
+          eslConnection.Execute("answer", String.Empty, String.Empty);
+          Console.WriteLine("Execute(\"playback\")");
+          eslConnection.Execute("playback", "music/8000/suite-espanola-op-47-leyenda.wav", String.Empty);
+          Console.WriteLine("Execute(\"hangup\")");
+          eslConnection.Execute("hangup", String.Empty, String.Empty);
+        }
+      }
+      catch (Exception ex)
+      {
+        Console.WriteLine(ex);
+      }
+      finally
+      {
+        tcpListener.Stop();
+      }
+    }
+
+    /// <summary>
+    /// Example using event socket in "Outbound" mode asynchronic
+    /// </summary>
+    /// <param name="stateInfo">Object state info</param>
+    static void OutboundModeAsync(Object stateInfo)
+    {
+      /* add next line to a dialplan
+       <action application="socket" data="localhost:8022 async full" />
+      */
+      TcpListener tcpListener = new TcpListener(IPAddress.Parse("127.0.0.1"), 8022);
+
+      try
+      {
+        tcpListener.Start();
+
+        Console.WriteLine("OutboundModeAsync, waiting for connections...");
+
+        while (true)
+        {
+          tcpListener.BeginAcceptSocket((asyncCallback) =>
+         {
+           TcpListener tcpListened = (TcpListener)asyncCallback.AsyncState;
+
+           Socket sckClient = tcpListened.EndAcceptSocket(asyncCallback);
+
+           //Initializes a new instance of ESLconnection, and connects to the host $host on the port $port, and supplies $password to freeswitch
+           ESLconnection eslConnection = new ESLconnection(sckClient.Handle.ToInt32());
+
+           ESLevent eslEvent = eslConnection.GetInfo();
+           string strUuid = eslEvent.GetHeader("UNIQUE-ID");
+
+           eslConnection.SendRecv("myevents");
+           eslConnection.SendRecv("divert_events on");
+
+           eslConnection.Execute("answer", String.Empty, String.Empty);
+           eslConnection.Execute("playback", "music/8000/suite-espanola-op-47-leyenda.wav", String.Empty);
+
+           while (eslConnection.Connected() == ESL_SUCCESS)
+           {
+             eslEvent = eslConnection.RecvEvent();
+             Console.WriteLine(eslEvent.Serialize(String.Empty));
+           }
+
+           sckClient.Close();
+           Console.WriteLine("Connection closed uuid:{0}", strUuid);
+
+         }, tcpListener);
+
+          Thread.Sleep(50);
+        }
+      }
+      catch (Exception ex)
+      {
+        Console.WriteLine(ex);
+      }
+      finally
+      {
+        tcpListener.Stop();
+      }
+    }
+  }
+}

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ManagedEslTest/Properties (from rev 16612, freeswitch/trunk/libs/esl/managed/ManagedEslTest/Properties)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ManagedEslTest/Properties/AssemblyInfo.cs

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ManagedEslTest/Properties/AssemblyInfo.cs (from rev 16612, freeswitch/trunk/libs/esl/managed/ManagedEslTest/Properties/AssemblyInfo.cs) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ManagedEslTest/Properties/AssemblyInfo.cs	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/ManagedEslTest/Properties/AssemblyInfo.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("ManagedEslTest")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ManagedEslTest")]
+[assembly: AssemblyCopyright("Copyright ©  2010")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("a5c8de92-fc6b-4fb5-840a-89d531bb64ec")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/Properties (from rev 16612, freeswitch/trunk/libs/esl/managed/Properties)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/Properties/AssemblyInfo.cs

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/Properties/AssemblyInfo.cs (from rev 16612, freeswitch/trunk/libs/esl/managed/Properties/AssemblyInfo.cs) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/Properties/AssemblyInfo.cs	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/Properties/AssemblyInfo.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("ManagedEsl")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("ManagedEsl")]
+[assembly: AssemblyCopyright("Copyright ©  2010")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("aae64db9-9847-4c9e-9d83-a5a6e8fb8a09")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers 
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/SWIGTYPE_p_esl_event_t.cs (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/SWIGTYPE_p_esl_event_t.cs	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/SWIGTYPE_p_esl_event_t.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,27 +1,27 @@
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_esl_event_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_esl_event_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_esl_event_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_esl_event_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.40
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_esl_event_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_esl_event_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_esl_event_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_esl_event_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/SWIGTYPE_p_esl_priority_t.cs (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/SWIGTYPE_p_esl_priority_t.cs	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/SWIGTYPE_p_esl_priority_t.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,27 +1,27 @@
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_esl_priority_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_esl_priority_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_esl_priority_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_esl_priority_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.40
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_esl_priority_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_esl_priority_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_esl_priority_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_esl_priority_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/esl_wrap.cpp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/esl_wrap.cpp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/esl_wrap.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,837 +1,862 @@
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- * 
- * This file is not intended to be easily readable and contains a number of 
- * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG 
- * interface file instead. 
- * ----------------------------------------------------------------------------- */
-
-
-#ifdef __cplusplus
-template<typename T> class SwigValueWrapper {
-    T *tt;
-public:
-    SwigValueWrapper() : tt(0) { }
-    SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
-    SwigValueWrapper(const T& t) : tt(new T(t)) { }
-    ~SwigValueWrapper() { delete tt; } 
-    SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
-    operator T&() const { return *tt; }
-    T *operator&() { return tt; }
-private:
-    SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
-};
-
-template <typename T> T SwigValueInit() {
-  return T();
-}
-#endif
-
-/* -----------------------------------------------------------------------------
- *  This section contains generic SWIG labels for method/variable
- *  declarations/attributes, and other compiler dependent labels.
- * ----------------------------------------------------------------------------- */
-
-/* template workaround for compilers that cannot correctly implement the C++ standard */
-#ifndef SWIGTEMPLATEDISAMBIGUATOR
-# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
-#  define SWIGTEMPLATEDISAMBIGUATOR template
-# elif defined(__HP_aCC)
-/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
-/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
-#  define SWIGTEMPLATEDISAMBIGUATOR template
-# else
-#  define SWIGTEMPLATEDISAMBIGUATOR
-# endif
-#endif
-
-/* inline attribute */
-#ifndef SWIGINLINE
-# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
-#   define SWIGINLINE inline
-# else
-#   define SWIGINLINE
-# endif
-#endif
-
-/* attribute recognised by some compilers to avoid 'unused' warnings */
-#ifndef SWIGUNUSED
-# if defined(__GNUC__)
-#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__)) 
-#   else
-#     define SWIGUNUSED
-#   endif
-# elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__)) 
-# else
-#   define SWIGUNUSED 
-# endif
-#endif
-
-#ifndef SWIGUNUSEDPARM
-# ifdef __cplusplus
-#   define SWIGUNUSEDPARM(p)
-# else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
-# endif
-#endif
-
-/* internal SWIG method */
-#ifndef SWIGINTERN
-# define SWIGINTERN static SWIGUNUSED
-#endif
-
-/* internal inline SWIG method */
-#ifndef SWIGINTERNINLINE
-# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
-#endif
-
-/* exporting methods */
-#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
-#  ifndef GCC_HASCLASSVISIBILITY
-#    define GCC_HASCLASSVISIBILITY
-#  endif
-#endif
-
-#ifndef SWIGEXPORT
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-#   if defined(STATIC_LINKED)
-#     define SWIGEXPORT
-#   else
-#     define SWIGEXPORT __declspec(dllexport)
-#   endif
-# else
-#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
-#     define SWIGEXPORT __attribute__ ((visibility("default")))
-#   else
-#     define SWIGEXPORT
-#   endif
-# endif
-#endif
-
-/* calling conventions for Windows */
-#ifndef SWIGSTDCALL
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-#   define SWIGSTDCALL __stdcall
-# else
-#   define SWIGSTDCALL
-# endif 
-#endif
-
-/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
-#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
-# define _CRT_SECURE_NO_DEPRECATE
-#endif
-
-/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
-#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
-# define _SCL_SECURE_NO_DEPRECATE
-#endif
-
-
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-
-/* Support for throwing C# exceptions from C/C++. There are two types: 
- * Exceptions that take a message and ArgumentExceptions that take a message and a parameter name. */
-typedef enum {
-  SWIG_CSharpApplicationException,
-  SWIG_CSharpArithmeticException,
-  SWIG_CSharpDivideByZeroException,
-  SWIG_CSharpIndexOutOfRangeException,
-  SWIG_CSharpInvalidCastException,
-  SWIG_CSharpInvalidOperationException,
-  SWIG_CSharpIOException,
-  SWIG_CSharpNullReferenceException,
-  SWIG_CSharpOutOfMemoryException,
-  SWIG_CSharpOverflowException,
-  SWIG_CSharpSystemException
-} SWIG_CSharpExceptionCodes;
-
-typedef enum {
-  SWIG_CSharpArgumentException,
-  SWIG_CSharpArgumentNullException,
-  SWIG_CSharpArgumentOutOfRangeException
-} SWIG_CSharpExceptionArgumentCodes;
-
-typedef void (SWIGSTDCALL* SWIG_CSharpExceptionCallback_t)(const char *);
-typedef void (SWIGSTDCALL* SWIG_CSharpExceptionArgumentCallback_t)(const char *, const char *);
-
-typedef struct {
-  SWIG_CSharpExceptionCodes code;
-  SWIG_CSharpExceptionCallback_t callback;
-} SWIG_CSharpException_t;
-
-typedef struct {
-  SWIG_CSharpExceptionArgumentCodes code;
-  SWIG_CSharpExceptionArgumentCallback_t callback;
-} SWIG_CSharpExceptionArgument_t;
-
-static SWIG_CSharpException_t SWIG_csharp_exceptions[] = {
-  { SWIG_CSharpApplicationException, NULL },
-  { SWIG_CSharpArithmeticException, NULL },
-  { SWIG_CSharpDivideByZeroException, NULL },
-  { SWIG_CSharpIndexOutOfRangeException, NULL },
-  { SWIG_CSharpInvalidCastException, NULL },
-  { SWIG_CSharpInvalidOperationException, NULL },
-  { SWIG_CSharpIOException, NULL },
-  { SWIG_CSharpNullReferenceException, NULL },
-  { SWIG_CSharpOutOfMemoryException, NULL },
-  { SWIG_CSharpOverflowException, NULL },
-  { SWIG_CSharpSystemException, NULL }
-};
-
-static SWIG_CSharpExceptionArgument_t SWIG_csharp_exceptions_argument[] = {
-  { SWIG_CSharpArgumentException, NULL },
-  { SWIG_CSharpArgumentNullException, NULL },
-  { SWIG_CSharpArgumentOutOfRangeException, NULL },
-};
-
-static void SWIGUNUSED SWIG_CSharpSetPendingException(SWIG_CSharpExceptionCodes code, const char *msg) {
-  SWIG_CSharpExceptionCallback_t callback = SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback;
-  if (code >=0 && (size_t)code < sizeof(SWIG_csharp_exceptions)/sizeof(SWIG_CSharpException_t)) {
-    callback = SWIG_csharp_exceptions[code].callback;
-  }
-  callback(msg);
-}
-
-static void SWIGUNUSED SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpExceptionArgumentCodes code, const char *msg, const char *param_name) {
-  SWIG_CSharpExceptionArgumentCallback_t callback = SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback;
-  if (code >=0 && (size_t)code < sizeof(SWIG_csharp_exceptions_argument)/sizeof(SWIG_CSharpExceptionArgument_t)) {
-    callback = SWIG_csharp_exceptions_argument[code].callback;
-  }
-  callback(msg, param_name);
-}
-
-
-#ifdef __cplusplus
-extern "C" 
-#endif
-SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionCallbacks_ESL(
-                                                SWIG_CSharpExceptionCallback_t applicationCallback,
-                                                SWIG_CSharpExceptionCallback_t arithmeticCallback,
-                                                SWIG_CSharpExceptionCallback_t divideByZeroCallback, 
-                                                SWIG_CSharpExceptionCallback_t indexOutOfRangeCallback, 
-                                                SWIG_CSharpExceptionCallback_t invalidCastCallback,
-                                                SWIG_CSharpExceptionCallback_t invalidOperationCallback,
-                                                SWIG_CSharpExceptionCallback_t ioCallback,
-                                                SWIG_CSharpExceptionCallback_t nullReferenceCallback,
-                                                SWIG_CSharpExceptionCallback_t outOfMemoryCallback, 
-                                                SWIG_CSharpExceptionCallback_t overflowCallback, 
-                                                SWIG_CSharpExceptionCallback_t systemCallback) {
-  SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback = applicationCallback;
-  SWIG_csharp_exceptions[SWIG_CSharpArithmeticException].callback = arithmeticCallback;
-  SWIG_csharp_exceptions[SWIG_CSharpDivideByZeroException].callback = divideByZeroCallback;
-  SWIG_csharp_exceptions[SWIG_CSharpIndexOutOfRangeException].callback = indexOutOfRangeCallback;
-  SWIG_csharp_exceptions[SWIG_CSharpInvalidCastException].callback = invalidCastCallback;
-  SWIG_csharp_exceptions[SWIG_CSharpInvalidOperationException].callback = invalidOperationCallback;
-  SWIG_csharp_exceptions[SWIG_CSharpIOException].callback = ioCallback;
-  SWIG_csharp_exceptions[SWIG_CSharpNullReferenceException].callback = nullReferenceCallback;
-  SWIG_csharp_exceptions[SWIG_CSharpOutOfMemoryException].callback = outOfMemoryCallback;
-  SWIG_csharp_exceptions[SWIG_CSharpOverflowException].callback = overflowCallback;
-  SWIG_csharp_exceptions[SWIG_CSharpSystemException].callback = systemCallback;
-}
-
-#ifdef __cplusplus
-extern "C" 
-#endif
-SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_ESL(
-                                                SWIG_CSharpExceptionArgumentCallback_t argumentCallback,
-                                                SWIG_CSharpExceptionArgumentCallback_t argumentNullCallback,
-                                                SWIG_CSharpExceptionArgumentCallback_t argumentOutOfRangeCallback) {
-  SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback = argumentCallback;
-  SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentNullException].callback = argumentNullCallback;
-  SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentOutOfRangeException].callback = argumentOutOfRangeCallback;
-}
-
-
-/* Callback for returning strings to C# without leaking memory */
-typedef char * (SWIGSTDCALL* SWIG_CSharpStringHelperCallback)(const char *);
-static SWIG_CSharpStringHelperCallback SWIG_csharp_string_callback = NULL;
-
-
-#ifdef __cplusplus
-extern "C" 
-#endif
-SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_ESL(SWIG_CSharpStringHelperCallback callback) {
-  SWIG_csharp_string_callback = callback;
-}
-
-
-/* Contract support */
-
-#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } else
-
-
-#include "esl.h"
-#include "esl_oop.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-SWIGEXPORT void SWIGSTDCALL CSharp_ESLevent_event_set(void * jarg1, void * jarg2) {
-  ESLevent *arg1 = (ESLevent *) 0 ;
-  esl_event_t *arg2 = (esl_event_t *) 0 ;
-  
-  arg1 = (ESLevent *)jarg1; 
-  arg2 = (esl_event_t *)jarg2; 
-  if (arg1) (arg1)->event = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_ESLevent_event_get(void * jarg1) {
-  void * jresult ;
-  ESLevent *arg1 = (ESLevent *) 0 ;
-  esl_event_t *result = 0 ;
-  
-  arg1 = (ESLevent *)jarg1; 
-  result = (esl_event_t *) ((arg1)->event);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_ESLevent_serialized_string_set(void * jarg1, char * jarg2) {
-  ESLevent *arg1 = (ESLevent *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (ESLevent *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->serialized_string) delete [] arg1->serialized_string;
-    if (arg2) {
-      arg1->serialized_string = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->serialized_string, (const char *)arg2);
-    } else {
-      arg1->serialized_string = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_ESLevent_serialized_string_get(void * jarg1) {
-  char * jresult ;
-  ESLevent *arg1 = (ESLevent *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (ESLevent *)jarg1; 
-  result = (char *) ((arg1)->serialized_string);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_ESLevent_mine_set(void * jarg1, int jarg2) {
-  ESLevent *arg1 = (ESLevent *) 0 ;
-  int arg2 ;
-  
-  arg1 = (ESLevent *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->mine = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_ESLevent_mine_get(void * jarg1) {
-  int jresult ;
-  ESLevent *arg1 = (ESLevent *) 0 ;
-  int result;
-  
-  arg1 = (ESLevent *)jarg1; 
-  result = (int) ((arg1)->mine);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_ESLevent__SWIG_0(char * jarg1, char * jarg2) {
-  void * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) NULL ;
-  ESLevent *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (ESLevent *)new ESLevent((char const *)arg1,(char const *)arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_ESLevent__SWIG_1(void * jarg1, int jarg2) {
-  void * jresult ;
-  esl_event_t *arg1 = (esl_event_t *) 0 ;
-  int arg2 = (int) 0 ;
-  ESLevent *result = 0 ;
-  
-  arg1 = (esl_event_t *)jarg1; 
-  arg2 = (int)jarg2; 
-  result = (ESLevent *)new ESLevent(arg1,arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_ESLevent__SWIG_2(void * jarg1) {
-  void * jresult ;
-  ESLevent *arg1 = (ESLevent *) 0 ;
-  ESLevent *result = 0 ;
-  
-  arg1 = (ESLevent *)jarg1; 
-  result = (ESLevent *)new ESLevent(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_ESLevent(void * jarg1) {
-  ESLevent *arg1 = (ESLevent *) 0 ;
-  
-  arg1 = (ESLevent *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_ESLevent_serialize(void * jarg1, char * jarg2) {
-  char * jresult ;
-  ESLevent *arg1 = (ESLevent *) 0 ;
-  char *arg2 = (char *) NULL ;
-  char *result = 0 ;
-  
-  arg1 = (ESLevent *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (char *)(arg1)->serialize((char const *)arg2);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_ESLevent_setPriority(void * jarg1, void * jarg2) {
-  unsigned int jresult ;
-  ESLevent *arg1 = (ESLevent *) 0 ;
-  esl_priority_t arg2 = (esl_priority_t) ESL_PRIORITY_NORMAL ;
-  bool result;
-  esl_priority_t *argp2 ;
-  
-  arg1 = (ESLevent *)jarg1; 
-  argp2 = (esl_priority_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null esl_priority_t", 0);
-    return 0;
-  }
-  arg2 = *argp2; 
-  result = (bool)(arg1)->setPriority(arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_ESLevent_getHeader(void * jarg1, char * jarg2) {
-  char * jresult ;
-  ESLevent *arg1 = (ESLevent *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (ESLevent *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (char *)(arg1)->getHeader((char const *)arg2);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_ESLevent_getBody(void * jarg1) {
-  char * jresult ;
-  ESLevent *arg1 = (ESLevent *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (ESLevent *)jarg1; 
-  result = (char *)(arg1)->getBody();
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_ESLevent_getType(void * jarg1) {
-  char * jresult ;
-  ESLevent *arg1 = (ESLevent *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (ESLevent *)jarg1; 
-  result = (char *)(arg1)->getType();
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_ESLevent_addBody(void * jarg1, char * jarg2) {
-  unsigned int jresult ;
-  ESLevent *arg1 = (ESLevent *) 0 ;
-  char *arg2 = (char *) 0 ;
-  bool result;
-  
-  arg1 = (ESLevent *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (bool)(arg1)->addBody((char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_ESLevent_addHeader(void * jarg1, char * jarg2, char * jarg3) {
-  unsigned int jresult ;
-  ESLevent *arg1 = (ESLevent *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  bool result;
-  
-  arg1 = (ESLevent *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_ESLevent_delHeader(void * jarg1, char * jarg2) {
-  unsigned int jresult ;
-  ESLevent *arg1 = (ESLevent *) 0 ;
-  char *arg2 = (char *) 0 ;
-  bool result;
-  
-  arg1 = (ESLevent *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (bool)(arg1)->delHeader((char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_ESLevent_firstHeader(void * jarg1) {
-  char * jresult ;
-  ESLevent *arg1 = (ESLevent *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (ESLevent *)jarg1; 
-  result = (char *)(arg1)->firstHeader();
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_ESLevent_nextHeader(void * jarg1) {
-  char * jresult ;
-  ESLevent *arg1 = (ESLevent *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (ESLevent *)jarg1; 
-  result = (char *)(arg1)->nextHeader();
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_ESLconnection__SWIG_0(char * jarg1, char * jarg2, char * jarg3) {
-  void * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  ESLconnection *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_ESLconnection__SWIG_1(int jarg1) {
-  void * jresult ;
-  int arg1 ;
-  ESLconnection *result = 0 ;
-  
-  arg1 = (int)jarg1; 
-  result = (ESLconnection *)new ESLconnection(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_ESLconnection(void * jarg1) {
-  ESLconnection *arg1 = (ESLconnection *) 0 ;
-  
-  arg1 = (ESLconnection *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_ESLconnection_socketDescriptor(void * jarg1) {
-  int jresult ;
-  ESLconnection *arg1 = (ESLconnection *) 0 ;
-  int result;
-  
-  arg1 = (ESLconnection *)jarg1; 
-  result = (int)(arg1)->socketDescriptor();
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_ESLconnection_connected(void * jarg1) {
-  int jresult ;
-  ESLconnection *arg1 = (ESLconnection *) 0 ;
-  int result;
-  
-  arg1 = (ESLconnection *)jarg1; 
-  result = (int)(arg1)->connected();
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_ESLconnection_getInfo(void * jarg1) {
-  void * jresult ;
-  ESLconnection *arg1 = (ESLconnection *) 0 ;
-  ESLevent *result = 0 ;
-  
-  arg1 = (ESLconnection *)jarg1; 
-  result = (ESLevent *)(arg1)->getInfo();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_ESLconnection_send(void * jarg1, char * jarg2) {
-  int jresult ;
-  ESLconnection *arg1 = (ESLconnection *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int result;
-  
-  arg1 = (ESLconnection *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (int)(arg1)->send((char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_ESLconnection_sendRecv(void * jarg1, char * jarg2) {
-  void * jresult ;
-  ESLconnection *arg1 = (ESLconnection *) 0 ;
-  char *arg2 = (char *) 0 ;
-  ESLevent *result = 0 ;
-  
-  arg1 = (ESLconnection *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (ESLevent *)(arg1)->sendRecv((char const *)arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_ESLconnection_api(void * jarg1, char * jarg2, char * jarg3) {
-  void * jresult ;
-  ESLconnection *arg1 = (ESLconnection *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) NULL ;
-  ESLevent *result = 0 ;
-  
-  arg1 = (ESLconnection *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_ESLconnection_bgapi(void * jarg1, char * jarg2, char * jarg3) {
-  void * jresult ;
-  ESLconnection *arg1 = (ESLconnection *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) NULL ;
-  ESLevent *result = 0 ;
-  
-  arg1 = (ESLconnection *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_ESLconnection_sendEvent(void * jarg1, void * jarg2) {
-  int jresult ;
-  ESLconnection *arg1 = (ESLconnection *) 0 ;
-  ESLevent *arg2 = (ESLevent *) 0 ;
-  int result;
-  
-  arg1 = (ESLconnection *)jarg1; 
-  arg2 = (ESLevent *)jarg2; 
-  result = (int)(arg1)->sendEvent(arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_ESLconnection_recvEvent(void * jarg1) {
-  void * jresult ;
-  ESLconnection *arg1 = (ESLconnection *) 0 ;
-  ESLevent *result = 0 ;
-  
-  arg1 = (ESLconnection *)jarg1; 
-  result = (ESLevent *)(arg1)->recvEvent();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_ESLconnection_recvEventTimed(void * jarg1, int jarg2) {
-  void * jresult ;
-  ESLconnection *arg1 = (ESLconnection *) 0 ;
-  int arg2 ;
-  ESLevent *result = 0 ;
-  
-  arg1 = (ESLconnection *)jarg1; 
-  arg2 = (int)jarg2; 
-  result = (ESLevent *)(arg1)->recvEventTimed(arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_ESLconnection_filter(void * jarg1, char * jarg2, char * jarg3) {
-  void * jresult ;
-  ESLconnection *arg1 = (ESLconnection *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  ESLevent *result = 0 ;
-  
-  arg1 = (ESLconnection *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (ESLevent *)(arg1)->filter((char const *)arg2,(char const *)arg3);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_ESLconnection_events(void * jarg1, char * jarg2, char * jarg3) {
-  int jresult ;
-  ESLconnection *arg1 = (ESLconnection *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int result;
-  
-  arg1 = (ESLconnection *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (int)(arg1)->events((char const *)arg2,(char const *)arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_ESLconnection_execute(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
-  int jresult ;
-  ESLconnection *arg1 = (ESLconnection *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) NULL ;
-  char *arg4 = (char *) NULL ;
-  int result;
-  
-  arg1 = (ESLconnection *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  result = (int)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_ESLconnection_executeAsync(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
-  int jresult ;
-  ESLconnection *arg1 = (ESLconnection *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) NULL ;
-  char *arg4 = (char *) NULL ;
-  int result;
-  
-  arg1 = (ESLconnection *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  result = (int)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_ESLconnection_setAsyncExecute(void * jarg1, char * jarg2) {
-  int jresult ;
-  ESLconnection *arg1 = (ESLconnection *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int result;
-  
-  arg1 = (ESLconnection *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (int)(arg1)->setAsyncExecute((char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_ESLconnection_setEventLock(void * jarg1, char * jarg2) {
-  int jresult ;
-  ESLconnection *arg1 = (ESLconnection *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int result;
-  
-  arg1 = (ESLconnection *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (int)(arg1)->setEventLock((char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_ESLconnection_disconnect(void * jarg1) {
-  int jresult ;
-  ESLconnection *arg1 = (ESLconnection *) 0 ;
-  int result;
-  
-  arg1 = (ESLconnection *)jarg1; 
-  result = (int)(arg1)->disconnect();
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_eslSetLogLevel(int jarg1) {
-  int arg1 ;
-  
-  arg1 = (int)jarg1; 
-  eslSetLogLevel(arg1);
-}
-
-
-#ifdef __cplusplus
-}
-#endif
-
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.40
+ * 
+ * This file is not intended to be easily readable and contains a number of 
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG 
+ * interface file instead. 
+ * ----------------------------------------------------------------------------- */
+
+#define SWIGCSHARP
+
+
+#ifdef __cplusplus
+/* SwigValueWrapper is described in swig.swg */
+template<typename T> class SwigValueWrapper {
+  struct SwigMovePointer {
+    T *ptr;
+    SwigMovePointer(T *p) : ptr(p) { }
+    ~SwigMovePointer() { delete ptr; }
+    SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
+  } pointer;
+  SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+  SwigValueWrapper(const SwigValueWrapper<T>& rhs);
+public:
+  SwigValueWrapper() : pointer(0) { }
+  SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
+  operator T&() const { return *pointer.ptr; }
+  T *operator&() { return pointer.ptr; }
+};
+
+template <typename T> T SwigValueInit() {
+  return T();
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
+# else
+#   define SWIGUNUSED 
+# endif
+#endif
+
+#ifndef SWIG_MSC_UNSUPPRESS_4505
+# if defined(_MSC_VER)
+#   pragma warning(disable : 4505) /* unreferenced local function has been removed */
+# endif 
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif 
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+
+/* Support for throwing C# exceptions from C/C++. There are two types: 
+ * Exceptions that take a message and ArgumentExceptions that take a message and a parameter name. */
+typedef enum {
+  SWIG_CSharpApplicationException,
+  SWIG_CSharpArithmeticException,
+  SWIG_CSharpDivideByZeroException,
+  SWIG_CSharpIndexOutOfRangeException,
+  SWIG_CSharpInvalidCastException,
+  SWIG_CSharpInvalidOperationException,
+  SWIG_CSharpIOException,
+  SWIG_CSharpNullReferenceException,
+  SWIG_CSharpOutOfMemoryException,
+  SWIG_CSharpOverflowException,
+  SWIG_CSharpSystemException
+} SWIG_CSharpExceptionCodes;
+
+typedef enum {
+  SWIG_CSharpArgumentException,
+  SWIG_CSharpArgumentNullException,
+  SWIG_CSharpArgumentOutOfRangeException
+} SWIG_CSharpExceptionArgumentCodes;
+
+typedef void (SWIGSTDCALL* SWIG_CSharpExceptionCallback_t)(const char *);
+typedef void (SWIGSTDCALL* SWIG_CSharpExceptionArgumentCallback_t)(const char *, const char *);
+
+typedef struct {
+  SWIG_CSharpExceptionCodes code;
+  SWIG_CSharpExceptionCallback_t callback;
+} SWIG_CSharpException_t;
+
+typedef struct {
+  SWIG_CSharpExceptionArgumentCodes code;
+  SWIG_CSharpExceptionArgumentCallback_t callback;
+} SWIG_CSharpExceptionArgument_t;
+
+static SWIG_CSharpException_t SWIG_csharp_exceptions[] = {
+  { SWIG_CSharpApplicationException, NULL },
+  { SWIG_CSharpArithmeticException, NULL },
+  { SWIG_CSharpDivideByZeroException, NULL },
+  { SWIG_CSharpIndexOutOfRangeException, NULL },
+  { SWIG_CSharpInvalidCastException, NULL },
+  { SWIG_CSharpInvalidOperationException, NULL },
+  { SWIG_CSharpIOException, NULL },
+  { SWIG_CSharpNullReferenceException, NULL },
+  { SWIG_CSharpOutOfMemoryException, NULL },
+  { SWIG_CSharpOverflowException, NULL },
+  { SWIG_CSharpSystemException, NULL }
+};
+
+static SWIG_CSharpExceptionArgument_t SWIG_csharp_exceptions_argument[] = {
+  { SWIG_CSharpArgumentException, NULL },
+  { SWIG_CSharpArgumentNullException, NULL },
+  { SWIG_CSharpArgumentOutOfRangeException, NULL }
+};
+
+static void SWIGUNUSED SWIG_CSharpSetPendingException(SWIG_CSharpExceptionCodes code, const char *msg) {
+  SWIG_CSharpExceptionCallback_t callback = SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback;
+  if ((size_t)code < sizeof(SWIG_csharp_exceptions)/sizeof(SWIG_CSharpException_t)) {
+    callback = SWIG_csharp_exceptions[code].callback;
+  }
+  callback(msg);
+}
+
+static void SWIGUNUSED SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpExceptionArgumentCodes code, const char *msg, const char *param_name) {
+  SWIG_CSharpExceptionArgumentCallback_t callback = SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback;
+  if ((size_t)code < sizeof(SWIG_csharp_exceptions_argument)/sizeof(SWIG_CSharpExceptionArgument_t)) {
+    callback = SWIG_csharp_exceptions_argument[code].callback;
+  }
+  callback(msg, param_name);
+}
+
+
+#ifdef __cplusplus
+extern "C" 
+#endif
+SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionCallbacks_ESL(
+                                                SWIG_CSharpExceptionCallback_t applicationCallback,
+                                                SWIG_CSharpExceptionCallback_t arithmeticCallback,
+                                                SWIG_CSharpExceptionCallback_t divideByZeroCallback, 
+                                                SWIG_CSharpExceptionCallback_t indexOutOfRangeCallback, 
+                                                SWIG_CSharpExceptionCallback_t invalidCastCallback,
+                                                SWIG_CSharpExceptionCallback_t invalidOperationCallback,
+                                                SWIG_CSharpExceptionCallback_t ioCallback,
+                                                SWIG_CSharpExceptionCallback_t nullReferenceCallback,
+                                                SWIG_CSharpExceptionCallback_t outOfMemoryCallback, 
+                                                SWIG_CSharpExceptionCallback_t overflowCallback, 
+                                                SWIG_CSharpExceptionCallback_t systemCallback) {
+  SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback = applicationCallback;
+  SWIG_csharp_exceptions[SWIG_CSharpArithmeticException].callback = arithmeticCallback;
+  SWIG_csharp_exceptions[SWIG_CSharpDivideByZeroException].callback = divideByZeroCallback;
+  SWIG_csharp_exceptions[SWIG_CSharpIndexOutOfRangeException].callback = indexOutOfRangeCallback;
+  SWIG_csharp_exceptions[SWIG_CSharpInvalidCastException].callback = invalidCastCallback;
+  SWIG_csharp_exceptions[SWIG_CSharpInvalidOperationException].callback = invalidOperationCallback;
+  SWIG_csharp_exceptions[SWIG_CSharpIOException].callback = ioCallback;
+  SWIG_csharp_exceptions[SWIG_CSharpNullReferenceException].callback = nullReferenceCallback;
+  SWIG_csharp_exceptions[SWIG_CSharpOutOfMemoryException].callback = outOfMemoryCallback;
+  SWIG_csharp_exceptions[SWIG_CSharpOverflowException].callback = overflowCallback;
+  SWIG_csharp_exceptions[SWIG_CSharpSystemException].callback = systemCallback;
+}
+
+#ifdef __cplusplus
+extern "C" 
+#endif
+SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_ESL(
+                                                SWIG_CSharpExceptionArgumentCallback_t argumentCallback,
+                                                SWIG_CSharpExceptionArgumentCallback_t argumentNullCallback,
+                                                SWIG_CSharpExceptionArgumentCallback_t argumentOutOfRangeCallback) {
+  SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback = argumentCallback;
+  SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentNullException].callback = argumentNullCallback;
+  SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentOutOfRangeException].callback = argumentOutOfRangeCallback;
+}
+
+
+/* Callback for returning strings to C# without leaking memory */
+typedef char * (SWIGSTDCALL* SWIG_CSharpStringHelperCallback)(const char *);
+static SWIG_CSharpStringHelperCallback SWIG_csharp_string_callback = NULL;
+
+
+#ifdef __cplusplus
+extern "C" 
+#endif
+SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_ESL(SWIG_CSharpStringHelperCallback callback) {
+  SWIG_csharp_string_callback = callback;
+}
+
+
+/* Contract support */
+
+#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } else
+
+
+#include "esl.h"
+#include "esl_oop.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SWIGEXPORT void SWIGSTDCALL CSharp_ESLevent_Event_set(void * jarg1, void * jarg2) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  esl_event_t *arg2 = (esl_event_t *) 0 ;
+  
+  arg1 = (ESLevent *)jarg1; 
+  arg2 = (esl_event_t *)jarg2; 
+  if (arg1) (arg1)->event = arg2;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_ESLevent_Event_get(void * jarg1) {
+  void * jresult ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  esl_event_t *result = 0 ;
+  
+  arg1 = (ESLevent *)jarg1; 
+  result = (esl_event_t *) ((arg1)->event);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_ESLevent_SerializedString_set(void * jarg1, char * jarg2) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (ESLevent *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->serialized_string) delete [] arg1->serialized_string;
+    if (arg2) {
+      arg1->serialized_string = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->serialized_string, (const char *)arg2);
+    } else {
+      arg1->serialized_string = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_ESLevent_SerializedString_get(void * jarg1) {
+  char * jresult ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (ESLevent *)jarg1; 
+  result = (char *) ((arg1)->serialized_string);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_ESLevent_Mine_set(void * jarg1, int jarg2) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  int arg2 ;
+  
+  arg1 = (ESLevent *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->mine = arg2;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_ESLevent_Mine_get(void * jarg1) {
+  int jresult ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  int result;
+  
+  arg1 = (ESLevent *)jarg1; 
+  result = (int) ((arg1)->mine);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_ESLevent__SWIG_0(char * jarg1, char * jarg2) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (ESLevent *)new ESLevent((char const *)arg1,(char const *)arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_ESLevent__SWIG_1(void * jarg1, int jarg2) {
+  void * jresult ;
+  esl_event_t *arg1 = (esl_event_t *) 0 ;
+  int arg2 = (int) 0 ;
+  ESLevent *result = 0 ;
+  
+  arg1 = (esl_event_t *)jarg1; 
+  arg2 = (int)jarg2; 
+  result = (ESLevent *)new ESLevent(arg1,arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_ESLevent__SWIG_2(void * jarg1) {
+  void * jresult ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  ESLevent *result = 0 ;
+  
+  arg1 = (ESLevent *)jarg1; 
+  result = (ESLevent *)new ESLevent(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_ESLevent(void * jarg1) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  
+  arg1 = (ESLevent *)jarg1; 
+  delete arg1;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_ESLevent_Serialize(void * jarg1, char * jarg2) {
+  char * jresult ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) NULL ;
+  char *result = 0 ;
+  
+  arg1 = (ESLevent *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (char *)(arg1)->serialize((char const *)arg2);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_ESLevent_SetPriority(void * jarg1, void * jarg2) {
+  unsigned int jresult ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  esl_priority_t arg2 = (esl_priority_t) ESL_PRIORITY_NORMAL ;
+  esl_priority_t *argp2 ;
+  bool result;
+  
+  arg1 = (ESLevent *)jarg1; 
+  argp2 = (esl_priority_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null esl_priority_t", 0);
+    return 0;
+  }
+  arg2 = *argp2; 
+  result = (bool)(arg1)->setPriority(arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_ESLevent_GetHeader(void * jarg1, char * jarg2) {
+  char * jresult ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (ESLevent *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (char *)(arg1)->getHeader((char const *)arg2);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_ESLevent_GetBody(void * jarg1) {
+  char * jresult ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (ESLevent *)jarg1; 
+  result = (char *)(arg1)->getBody();
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_ESLevent_getType(void * jarg1) {
+  char * jresult ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (ESLevent *)jarg1; 
+  result = (char *)(arg1)->getType();
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_ESLevent_AddBody(void * jarg1, char * jarg2) {
+  unsigned int jresult ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  bool result;
+  
+  arg1 = (ESLevent *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (bool)(arg1)->addBody((char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_ESLevent_AddHeader(void * jarg1, char * jarg2, char * jarg3) {
+  unsigned int jresult ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  bool result;
+  
+  arg1 = (ESLevent *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_ESLevent_DelHeader(void * jarg1, char * jarg2) {
+  unsigned int jresult ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  bool result;
+  
+  arg1 = (ESLevent *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (bool)(arg1)->delHeader((char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_ESLevent_FirstHeader(void * jarg1) {
+  char * jresult ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (ESLevent *)jarg1; 
+  result = (char *)(arg1)->firstHeader();
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_ESLevent_NextHeader(void * jarg1) {
+  char * jresult ;
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (ESLevent *)jarg1; 
+  result = (char *)(arg1)->nextHeader();
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_ESLconnection__SWIG_0(char * jarg1, char * jarg2, char * jarg3, char * jarg4) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  ESLconnection *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_ESLconnection__SWIG_1(char * jarg1, char * jarg2, char * jarg3) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  ESLconnection *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_ESLconnection__SWIG_2(int jarg1) {
+  void * jresult ;
+  int arg1 ;
+  ESLconnection *result = 0 ;
+  
+  arg1 = (int)jarg1; 
+  result = (ESLconnection *)new ESLconnection(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_ESLconnection(void * jarg1) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  
+  arg1 = (ESLconnection *)jarg1; 
+  delete arg1;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_ESLconnection_SocketDescriptor(void * jarg1) {
+  int jresult ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int result;
+  
+  arg1 = (ESLconnection *)jarg1; 
+  result = (int)(arg1)->socketDescriptor();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_ESLconnection_Connected(void * jarg1) {
+  int jresult ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int result;
+  
+  arg1 = (ESLconnection *)jarg1; 
+  result = (int)(arg1)->connected();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_ESLconnection_GetInfo(void * jarg1) {
+  void * jresult ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  ESLevent *result = 0 ;
+  
+  arg1 = (ESLconnection *)jarg1; 
+  result = (ESLevent *)(arg1)->getInfo();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_ESLconnection_Send(void * jarg1, char * jarg2) {
+  int jresult ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  
+  arg1 = (ESLconnection *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (int)(arg1)->send((char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_ESLconnection_SendRecv(void * jarg1, char * jarg2) {
+  void * jresult ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  ESLevent *result = 0 ;
+  
+  arg1 = (ESLconnection *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (ESLevent *)(arg1)->sendRecv((char const *)arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_ESLconnection_Api(void * jarg1, char * jarg2, char * jarg3) {
+  void * jresult ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  
+  arg1 = (ESLconnection *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_ESLconnection_Bgapi(void * jarg1, char * jarg2, char * jarg3) {
+  void * jresult ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  
+  arg1 = (ESLconnection *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_ESLconnection_SendEvent(void * jarg1, void * jarg2) {
+  int jresult ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  ESLevent *arg2 = (ESLevent *) 0 ;
+  int result;
+  
+  arg1 = (ESLconnection *)jarg1; 
+  arg2 = (ESLevent *)jarg2; 
+  result = (int)(arg1)->sendEvent(arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_ESLconnection_RecvEvent(void * jarg1) {
+  void * jresult ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  ESLevent *result = 0 ;
+  
+  arg1 = (ESLconnection *)jarg1; 
+  result = (ESLevent *)(arg1)->recvEvent();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_ESLconnection_RecvEventTimed(void * jarg1, int jarg2) {
+  void * jresult ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int arg2 ;
+  ESLevent *result = 0 ;
+  
+  arg1 = (ESLconnection *)jarg1; 
+  arg2 = (int)jarg2; 
+  result = (ESLevent *)(arg1)->recvEventTimed(arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_ESLconnection_Filter(void * jarg1, char * jarg2, char * jarg3) {
+  void * jresult ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  ESLevent *result = 0 ;
+  
+  arg1 = (ESLconnection *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (ESLevent *)(arg1)->filter((char const *)arg2,(char const *)arg3);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_ESLconnection_Events(void * jarg1, char * jarg2, char * jarg3) {
+  int jresult ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int result;
+  
+  arg1 = (ESLconnection *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (int)(arg1)->events((char const *)arg2,(char const *)arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_ESLconnection_Execute(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
+  void * jresult ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  char *arg4 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  
+  arg1 = (ESLconnection *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  result = (ESLevent *)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_ESLconnection_ExecuteAsync(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
+  void * jresult ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  char *arg4 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  
+  arg1 = (ESLconnection *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  result = (ESLevent *)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_ESLconnection_SetAsyncExecute(void * jarg1, char * jarg2) {
+  int jresult ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  
+  arg1 = (ESLconnection *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (int)(arg1)->setAsyncExecute((char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_ESLconnection_SetEventLock(void * jarg1, char * jarg2) {
+  int jresult ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  
+  arg1 = (ESLconnection *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (int)(arg1)->setEventLock((char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_ESLconnection_Disconnect(void * jarg1) {
+  int jresult ;
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int result;
+  
+  arg1 = (ESLconnection *)jarg1; 
+  result = (int)(arg1)->disconnect();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_eslSetLogLevel(int jarg1) {
+  int arg1 ;
+  
+  arg1 = (int)jarg1; 
+  eslSetLogLevel(arg1);
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/managed_esl.2008.sln (from rev 16612, freeswitch/trunk/libs/esl/managed/managed_esl.2008.sln) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/managed_esl.2008.sln	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/managed/managed_esl.2008.sln	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,60 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ESL", "ESL.vcproj", "{FEA2D0AE-6713-4E41-A473-A143849BC7FF}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ManagedEsl", "ManagedEsl.csproj", "{DEE5837B-E01D-4223-B351-EDF9418F3F8E}"
+	ProjectSection(ProjectDependencies) = postProject
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF} = {FEA2D0AE-6713-4E41-A473-A143849BC7FF}
+	EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ManagedEslTest", "ManagedEslTest\ManagedEslTest.csproj", "{2321D01A-D64B-4461-9837-FACF38652212}"
+	ProjectSection(ProjectDependencies) = postProject
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF} = {FEA2D0AE-6713-4E41-A473-A143849BC7FF}
+	EndProjectSection
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Debug|Mixed Platforms = Debug|Mixed Platforms
+		Debug|Win32 = Debug|Win32
+		Release|Any CPU = Release|Any CPU
+		Release|Mixed Platforms = Release|Mixed Platforms
+		Release|Win32 = Release|Win32
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Debug|Any CPU.ActiveCfg = Debug|Win32
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Debug|Mixed Platforms.Build.0 = Debug|Win32
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Debug|Win32.ActiveCfg = Debug|Win32
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Debug|Win32.Build.0 = Debug|Win32
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Release|Any CPU.ActiveCfg = Release|Win32
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Release|Mixed Platforms.ActiveCfg = Release|Win32
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Release|Mixed Platforms.Build.0 = Release|Win32
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Release|Win32.ActiveCfg = Release|Win32
+		{FEA2D0AE-6713-4E41-A473-A143849BC7FF}.Release|Win32.Build.0 = Release|Win32
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Debug|Win32.ActiveCfg = Debug|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Release|Any CPU.Build.0 = Release|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+		{DEE5837B-E01D-4223-B351-EDF9418F3F8E}.Release|Win32.ActiveCfg = Release|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Debug|Win32.ActiveCfg = Debug|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Release|Any CPU.Build.0 = Release|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+		{2321D01A-D64B-4461-9837-FACF38652212}.Release|Win32.ActiveCfg = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+EndGlobal

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/perl/esl_wrap.cpp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/perl/esl_wrap.cpp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/perl/esl_wrap.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -2565,6 +2565,7 @@
     char *arg1 = (char *) 0 ;
     char *arg2 = (char *) 0 ;
     char *arg3 = (char *) 0 ;
+    char *arg4 = (char *) 0 ;
     ESLconnection *result = 0 ;
     int res1 ;
     char *buf1 = 0 ;
@@ -2575,9 +2576,70 @@
     int res3 ;
     char *buf3 = 0 ;
     int alloc3 = 0 ;
+    int res4 ;
+    char *buf4 = 0 ;
+    int alloc4 = 0 ;
     int argvi = 0;
     dXSARGS;
     
+    if ((items < 4) || (items > 4)) {
+      SWIG_croak("Usage: new_ESLconnection(host,port,user,password);");
+    }
+    res1 = SWIG_AsCharPtrAndSize(ST(0), &buf1, NULL, &alloc1);
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "char const *""'");
+    }
+    arg1 = reinterpret_cast< char * >(buf1);
+    res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLconnection" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+    res3 = SWIG_AsCharPtrAndSize(ST(2), &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_ESLconnection" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+    res4 = SWIG_AsCharPtrAndSize(ST(3), &buf4, NULL, &alloc4);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_ESLconnection" "', argument " "4"" of type '" "char const *""'");
+    }
+    arg4 = reinterpret_cast< char * >(buf4);
+    result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    XSRETURN(argvi);
+  fail:
+    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+    if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+    if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+    if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+    SWIG_croak_null();
+  }
+}
+
+
+XS(_wrap_new_ESLconnection__SWIG_1) {
+  {
+    char *arg1 = (char *) 0 ;
+    char *arg2 = (char *) 0 ;
+    char *arg3 = (char *) 0 ;
+    ESLconnection *result = 0 ;
+    int res1 ;
+    char *buf1 = 0 ;
+    int alloc1 = 0 ;
+    int res2 ;
+    char *buf2 = 0 ;
+    int alloc2 = 0 ;
+    int res3 ;
+    char *buf3 = 0 ;
+    int alloc3 = 0 ;
+    int argvi = 0;
+    dXSARGS;
+    
     if ((items < 3) || (items > 3)) {
       SWIG_croak("Usage: new_ESLconnection(host,port,password);");
     }
@@ -2611,7 +2673,7 @@
 }
 
 
-XS(_wrap_new_ESLconnection__SWIG_1) {
+XS(_wrap_new_ESLconnection__SWIG_2) {
   {
     int arg1 ;
     ESLconnection *result = 0 ;
@@ -2703,11 +2765,57 @@
     }
   check_2:
     
+    if (items == 4) {
+      SWIG_TypeRank _ranki = 0;
+      SWIG_TypeRank _rankm = 0;
+      SWIG_TypeRank _pi = 1;
+      int _v = 0;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(0), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(1), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(2), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      {
+        int res = SWIG_AsCharPtrAndSize(ST(3), 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+      }
+      if (!_v) goto check_3;
+      _ranki += _v*_pi;
+      _rankm += _pi;
+      _pi *= SWIG_MAXCASTRANK;
+      if (!_index || (_ranki < _rank)) {
+        _rank = _ranki; _index = 3;
+        if (_rank == _rankm) goto dispatch;
+      }
+    }
+  check_3:
+    
   dispatch:
     switch(_index) {
     case 1:
+      ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_ESLconnection__SWIG_2); return;
+    case 2:
       ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_ESLconnection__SWIG_1); return;
-    case 2:
+    case 3:
       ++PL_markstack_ptr; SWIG_CALLXS(_wrap_new_ESLconnection__SWIG_0); return;
     }
   }
@@ -3221,7 +3329,7 @@
     char *arg2 = (char *) 0 ;
     char *arg3 = (char *) NULL ;
     char *arg4 = (char *) NULL ;
-    int result;
+    ESLevent *result = 0 ;
     void *argp1 = 0 ;
     int res1 = 0 ;
     int res2 ;
@@ -3263,8 +3371,8 @@
       }
       arg4 = reinterpret_cast< char * >(buf4);
     }
-    result = (int)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
-    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    result = (ESLevent *)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
     
     if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
     if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
@@ -3286,7 +3394,7 @@
     char *arg2 = (char *) 0 ;
     char *arg3 = (char *) NULL ;
     char *arg4 = (char *) NULL ;
-    int result;
+    ESLevent *result = 0 ;
     void *argp1 = 0 ;
     int res1 = 0 ;
     int res2 ;
@@ -3328,8 +3436,8 @@
       }
       arg4 = reinterpret_cast< char * >(buf4);
     }
-    result = (int)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
-    ST(argvi) = SWIG_From_int  SWIG_PERL_CALL_ARGS_1(static_cast< int >(result)); argvi++ ;
+    result = (ESLevent *)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
+    ST(argvi) = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_OWNER | SWIG_SHADOW); argvi++ ;
     
     if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
     if (alloc3 == SWIG_NEWOBJ) delete[] buf3;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/php/ESL.php (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/php/ESL.php	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/php/ESL.php	2010-02-12 00:54:22 UTC (rev 16614)
@@ -112,11 +112,12 @@
 class ESLconnection {
 	public $_cPtr=null;
 
-	function __construct($host_or_socket,$port=null,$password=null) {
+	function __construct($host_or_socket,$port=null,$user_or_password=null,$password=null) {
 		switch (func_num_args()) {
 		case 1: $r=new_ESLconnection($host_or_socket); break;
 		case 2: $r=new_ESLconnection($host_or_socket,$port); break;
-		default: $r=new_ESLconnection($host_or_socket,$port,$password);
+		case 3: $r=new_ESLconnection($host_or_socket,$port,$user_or_password); break;
+		default: $r=new_ESLconnection($host_or_socket,$port,$user_or_password,$password);
 		}
 		$this->_cPtr=$r;
 	}
@@ -188,7 +189,7 @@
 		case 2: $r=ESLconnection_execute($this->_cPtr,$app,$arg); break;
 		default: $r=ESLconnection_execute($this->_cPtr,$app,$arg,$uuid);
 		}
-		return $r;
+		return is_resource($r) ? new ESLevent($r) : $r;
 	}
 
 	function executeAsync($app,$arg=null,$uuid=null) {
@@ -197,7 +198,7 @@
 		case 2: $r=ESLconnection_executeAsync($this->_cPtr,$app,$arg); break;
 		default: $r=ESLconnection_executeAsync($this->_cPtr,$app,$arg,$uuid);
 		}
-		return $r;
+		return is_resource($r) ? new ESLevent($r) : $r;
 	}
 
 	function setAsyncExecute($val) {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/php/esl_wrap.cpp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/php/esl_wrap.cpp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/php/esl_wrap.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1091,7 +1091,7 @@
   }
   if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[1]);
   arg2 = (char *) Z_STRVAL_PP(args[1]);
   /*@SWIG@*/;
@@ -1159,7 +1159,7 @@
   }
   if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/
   convert_to_long_ex(args[1]);
   arg2 = (int) Z_LVAL_PP(args[1]);
   /*@SWIG@*/;
@@ -1213,13 +1213,13 @@
   WRONG_PARAM_COUNT;
   
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[0]);
   arg1 = (char *) Z_STRVAL_PP(args[0]);
   /*@SWIG@*/;
   
   if(arg_count > 1) {
-    /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+    /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
     convert_to_string_ex(args[1]);
     arg2 = (char *) Z_STRVAL_PP(args[1]);
     /*@SWIG@*/;
@@ -1254,7 +1254,7 @@
     }
   }
   if(arg_count > 1) {
-    /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/
+    /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/
     convert_to_long_ex(args[1]);
     arg2 = (int) Z_LVAL_PP(args[1]);
     /*@SWIG@*/;
@@ -1384,7 +1384,7 @@
   }
   if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
   if(arg_count > 1) {
-    /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+    /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
     convert_to_string_ex(args[1]);
     arg2 = (char *) Z_STRVAL_PP(args[1]);
     /*@SWIG@*/;
@@ -1460,7 +1460,7 @@
   }
   if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[1]);
   arg2 = (char *) Z_STRVAL_PP(args[1]);
   /*@SWIG@*/;
@@ -1557,7 +1557,7 @@
   }
   if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[1]);
   arg2 = (char *) Z_STRVAL_PP(args[1]);
   /*@SWIG@*/;
@@ -1591,13 +1591,13 @@
   }
   if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[1]);
   arg2 = (char *) Z_STRVAL_PP(args[1]);
   /*@SWIG@*/;
   
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[2]);
   arg3 = (char *) Z_STRVAL_PP(args[2]);
   /*@SWIG@*/;
@@ -1630,7 +1630,7 @@
   }
   if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[1]);
   arg2 = (char *) Z_STRVAL_PP(args[1]);
   /*@SWIG@*/;
@@ -1709,7 +1709,54 @@
   char *arg1 = (char *) 0 ;
   char *arg2 = (char *) 0 ;
   char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
   ESLconnection *result = 0 ;
+  zval **args[4];
+  
+  SWIG_ResetError();
+  if(ZEND_NUM_ARGS() != 4 || zend_get_parameters_array_ex(4, args) != SUCCESS) {
+    WRONG_PARAM_COUNT;
+  }
+  
+  
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[0]);
+  arg1 = (char *) Z_STRVAL_PP(args[0]);
+  /*@SWIG@*/;
+  
+  
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[1]);
+  arg2 = (char *) Z_STRVAL_PP(args[1]);
+  /*@SWIG@*/;
+  
+  
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[2]);
+  arg3 = (char *) Z_STRVAL_PP(args[2]);
+  /*@SWIG@*/;
+  
+  
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  convert_to_string_ex(args[3]);
+  arg4 = (char *) Z_STRVAL_PP(args[3]);
+  /*@SWIG@*/;
+  
+  result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
+  {
+    SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLconnection, 1);
+  }
+  return;
+fail:
+  zend_error(SWIG_ErrorCode(),SWIG_ErrorMsg());
+}
+
+
+ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_1) {
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  ESLconnection *result = 0 ;
   zval **args[3];
   
   SWIG_ResetError();
@@ -1718,19 +1765,19 @@
   }
   
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[0]);
   arg1 = (char *) Z_STRVAL_PP(args[0]);
   /*@SWIG@*/;
   
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[1]);
   arg2 = (char *) Z_STRVAL_PP(args[1]);
   /*@SWIG@*/;
   
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[2]);
   arg3 = (char *) Z_STRVAL_PP(args[2]);
   /*@SWIG@*/;
@@ -1745,7 +1792,7 @@
 }
 
 
-ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_1) {
+ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_2) {
   int arg1 ;
   ESLconnection *result = 0 ;
   zval **args[1];
@@ -1756,7 +1803,7 @@
   }
   
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/
   convert_to_long_ex(args[0]);
   arg1 = (int) Z_LVAL_PP(args[0]);
   /*@SWIG@*/;
@@ -1773,7 +1820,7 @@
 
 ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection) {
   int argc;
-  zval **argv[3];
+  zval **argv[4];
   
   argc = ZEND_NUM_ARGS();
   zend_get_parameters_array_ex(argc,argv);
@@ -1781,7 +1828,7 @@
     int _v;
     _v = (Z_TYPE_PP(argv[0]) == IS_LONG); 
     if (_v) {
-      return _wrap_new_ESLconnection__SWIG_1(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+      return _wrap_new_ESLconnection__SWIG_2(INTERNAL_FUNCTION_PARAM_PASSTHRU);
     }
   }
   if (argc == 3) {
@@ -1792,11 +1839,27 @@
       if (_v) {
         _v = (Z_TYPE_PP(argv[2]) == IS_STRING); 
         if (_v) {
-          return _wrap_new_ESLconnection__SWIG_0(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+          return _wrap_new_ESLconnection__SWIG_1(INTERNAL_FUNCTION_PARAM_PASSTHRU);
         }
       }
     }
   }
+  if (argc == 4) {
+    int _v;
+    _v = (Z_TYPE_PP(argv[0]) == IS_STRING); 
+    if (_v) {
+      _v = (Z_TYPE_PP(argv[1]) == IS_STRING); 
+      if (_v) {
+        _v = (Z_TYPE_PP(argv[2]) == IS_STRING); 
+        if (_v) {
+          _v = (Z_TYPE_PP(argv[3]) == IS_STRING); 
+          if (_v) {
+            return _wrap_new_ESLconnection__SWIG_0(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+          }
+        }
+      }
+    }
+  }
   
   SWIG_ErrorCode() = E_ERROR;
   SWIG_ErrorMsg() = "No matching function for overloaded 'new_ESLconnection'";
@@ -1917,7 +1980,7 @@
   }
   if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[1]);
   arg2 = (char *) Z_STRVAL_PP(args[1]);
   /*@SWIG@*/;
@@ -1950,7 +2013,7 @@
   }
   if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[1]);
   arg2 = (char *) Z_STRVAL_PP(args[1]);
   /*@SWIG@*/;
@@ -1986,13 +2049,13 @@
   }
   if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[1]);
   arg2 = (char *) Z_STRVAL_PP(args[1]);
   /*@SWIG@*/;
   
   if(arg_count > 2) {
-    /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+    /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
     convert_to_string_ex(args[2]);
     arg3 = (char *) Z_STRVAL_PP(args[2]);
     /*@SWIG@*/;
@@ -2029,13 +2092,13 @@
   }
   if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[1]);
   arg2 = (char *) Z_STRVAL_PP(args[1]);
   /*@SWIG@*/;
   
   if(arg_count > 2) {
-    /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+    /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
     convert_to_string_ex(args[2]);
     arg3 = (char *) Z_STRVAL_PP(args[2]);
     /*@SWIG@*/;
@@ -2127,7 +2190,7 @@
   }
   if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/
   convert_to_long_ex(args[1]);
   arg2 = (int) Z_LVAL_PP(args[1]);
   /*@SWIG@*/;
@@ -2161,13 +2224,13 @@
   }
   if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[1]);
   arg2 = (char *) Z_STRVAL_PP(args[1]);
   /*@SWIG@*/;
   
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[2]);
   arg3 = (char *) Z_STRVAL_PP(args[2]);
   /*@SWIG@*/;
@@ -2201,13 +2264,13 @@
   }
   if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[1]);
   arg2 = (char *) Z_STRVAL_PP(args[1]);
   /*@SWIG@*/;
   
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[2]);
   arg3 = (char *) Z_STRVAL_PP(args[2]);
   /*@SWIG@*/;
@@ -2227,7 +2290,7 @@
   char *arg2 = (char *) 0 ;
   char *arg3 = (char *) NULL ;
   char *arg4 = (char *) NULL ;
-  int result;
+  ESLevent *result = 0 ;
   zval **args[4];
   int arg_count;
   
@@ -2244,28 +2307,28 @@
   }
   if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[1]);
   arg2 = (char *) Z_STRVAL_PP(args[1]);
   /*@SWIG@*/;
   
   if(arg_count > 2) {
-    /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+    /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
     convert_to_string_ex(args[2]);
     arg3 = (char *) Z_STRVAL_PP(args[2]);
     /*@SWIG@*/;
     
   }
   if(arg_count > 3) {
-    /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+    /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
     convert_to_string_ex(args[3]);
     arg4 = (char *) Z_STRVAL_PP(args[3]);
     /*@SWIG@*/;
     
   }
-  result = (int)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  result = (ESLevent *)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
   {
-    ZVAL_LONG(return_value,result);
+    SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 0);
   }
   return;
 fail:
@@ -2278,7 +2341,7 @@
   char *arg2 = (char *) 0 ;
   char *arg3 = (char *) NULL ;
   char *arg4 = (char *) NULL ;
-  int result;
+  ESLevent *result = 0 ;
   zval **args[4];
   int arg_count;
   
@@ -2295,28 +2358,28 @@
   }
   if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[1]);
   arg2 = (char *) Z_STRVAL_PP(args[1]);
   /*@SWIG@*/;
   
   if(arg_count > 2) {
-    /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+    /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
     convert_to_string_ex(args[2]);
     arg3 = (char *) Z_STRVAL_PP(args[2]);
     /*@SWIG@*/;
     
   }
   if(arg_count > 3) {
-    /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+    /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
     convert_to_string_ex(args[3]);
     arg4 = (char *) Z_STRVAL_PP(args[3]);
     /*@SWIG@*/;
     
   }
-  result = (int)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  result = (ESLevent *)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
   {
-    ZVAL_LONG(return_value,result);
+    SWIG_SetPointerZval(return_value, (void *)result, SWIGTYPE_p_ESLevent, 0);
   }
   return;
 fail:
@@ -2342,7 +2405,7 @@
   }
   if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[1]);
   arg2 = (char *) Z_STRVAL_PP(args[1]);
   /*@SWIG@*/;
@@ -2375,7 +2438,7 @@
   }
   if(!arg1) SWIG_PHP_Error(E_ERROR, "this pointer is NULL");
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,26,CONVERT_STRING_IN@*/
   convert_to_string_ex(args[1]);
   arg2 = (char *) Z_STRVAL_PP(args[1]);
   /*@SWIG@*/;
@@ -2426,7 +2489,7 @@
   }
   
   
-  /*@SWIG:/usr/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/
+  /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/
   convert_to_long_ex(args[0]);
   arg1 = (int) Z_LVAL_PP(args[0]);
   /*@SWIG@*/;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/python/esl_wrap.cpp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/python/esl_wrap.cpp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/python/esl_wrap.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -3525,6 +3525,7 @@
   char *arg1 = (char *) 0 ;
   char *arg2 = (char *) 0 ;
   char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
   ESLconnection *result = 0 ;
   int res1 ;
   char *buf1 = 0 ;
@@ -3535,10 +3536,70 @@
   int res3 ;
   char *buf3 = 0 ;
   int alloc3 = 0 ;
+  int res4 ;
+  char *buf4 = 0 ;
+  int alloc4 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
+  PyObject * obj3 = 0 ;
   
+  if (!PyArg_ParseTuple(args,(char *)"OOOO:new_ESLconnection",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+  res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "char const *""'");
+  }
+  arg1 = reinterpret_cast< char * >(buf1);
+  res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLconnection" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(obj2, &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_ESLconnection" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  res4 = SWIG_AsCharPtrAndSize(obj3, &buf4, NULL, &alloc4);
+  if (!SWIG_IsOK(res4)) {
+    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_ESLconnection" "', argument " "4"" of type '" "char const *""'");
+  }
+  arg4 = reinterpret_cast< char * >(buf4);
+  result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection, SWIG_POINTER_NEW |  0 );
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return resultobj;
+fail:
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return NULL;
+}
+
+
+SWIGINTERN PyObject *_wrap_new_ESLconnection__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+  PyObject *resultobj = 0;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  ESLconnection *result = 0 ;
+  int res1 ;
+  char *buf1 = 0 ;
+  int alloc1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  PyObject * obj2 = 0 ;
+  
   if (!PyArg_ParseTuple(args,(char *)"OOO:new_ESLconnection",&obj0,&obj1,&obj2)) SWIG_fail;
   res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1);
   if (!SWIG_IsOK(res1)) {
@@ -3569,7 +3630,7 @@
 }
 
 
-SWIGINTERN PyObject *_wrap_new_ESLconnection__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
+SWIGINTERN PyObject *_wrap_new_ESLconnection__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   int arg1 ;
   ESLconnection *result = 0 ;
@@ -3593,12 +3654,12 @@
 
 SWIGINTERN PyObject *_wrap_new_ESLconnection(PyObject *self, PyObject *args) {
   int argc;
-  PyObject *argv[4];
+  PyObject *argv[5];
   int ii;
   
   if (!PyTuple_Check(args)) SWIG_fail;
   argc = (int)PyObject_Length(args);
-  for (ii = 0; (ii < argc) && (ii < 3); ii++) {
+  for (ii = 0; (ii < argc) && (ii < 4); ii++) {
     argv[ii] = PyTuple_GET_ITEM(args,ii);
   }
   if (argc == 1) {
@@ -3608,7 +3669,7 @@
       _v = SWIG_CheckState(res);
     }
     if (_v) {
-      return _wrap_new_ESLconnection__SWIG_1(self, args);
+      return _wrap_new_ESLconnection__SWIG_2(self, args);
     }
   }
   if (argc == 3) {
@@ -3622,15 +3683,36 @@
         int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
         _v = SWIG_CheckState(res);
         if (_v) {
-          return _wrap_new_ESLconnection__SWIG_0(self, args);
+          return _wrap_new_ESLconnection__SWIG_1(self, args);
         }
       }
     }
   }
+  if (argc == 4) {
+    int _v;
+    int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+        if (_v) {
+          int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0);
+          _v = SWIG_CheckState(res);
+          if (_v) {
+            return _wrap_new_ESLconnection__SWIG_0(self, args);
+          }
+        }
+      }
+    }
+  }
   
 fail:
   SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'new_ESLconnection'.\n"
     "  Possible C/C++ prototypes are:\n"
+    "    ESLconnection(char const *,char const *,char const *,char const *)\n"
     "    ESLconnection(char const *,char const *,char const *)\n"
     "    ESLconnection(int)\n");
   return NULL;
@@ -4071,7 +4153,7 @@
   char *arg2 = (char *) 0 ;
   char *arg3 = (char *) NULL ;
   char *arg4 = (char *) NULL ;
-  int result;
+  ESLevent *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 ;
@@ -4113,8 +4195,8 @@
     }
     arg4 = reinterpret_cast< char * >(buf4);
   }
-  result = (int)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
-  resultobj = SWIG_From_int(static_cast< int >(result));
+  result = (ESLevent *)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN |  0 );
   if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
   if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
   if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
@@ -4133,7 +4215,7 @@
   char *arg2 = (char *) 0 ;
   char *arg3 = (char *) NULL ;
   char *arg4 = (char *) NULL ;
-  int result;
+  ESLevent *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 ;
@@ -4175,8 +4257,8 @@
     }
     arg4 = reinterpret_cast< char * >(buf4);
   }
-  result = (int)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
-  resultobj = SWIG_From_int(static_cast< int >(result));
+  result = (ESLevent *)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN |  0 );
   if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
   if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
   if (alloc4 == SWIG_NEWOBJ) delete[] buf4;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/python/single_command.py (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/python/single_command.py	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/python/single_command.py	2010-02-12 00:54:22 UTC (rev 16614)
@@ -25,9 +25,9 @@
 		con = ESLconnection(options.server, options.port, options.auth)
 	#are we connected?
 
-		if con.connected:
+		if con.connected():
 			#run command
-			e=con.sendRecv("api "+  options.command)
+			e = con.api(options.command)
 			print e.getBody()
 
 		else:

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/ruby/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/ruby/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/ruby/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 ## no idea how to simply ask ruby which one to use
 LOCAL_CFLAGS=-I$(shell ruby -e 'require "rbconfig"; puts RbConfig::CONFIG["topdir"]')
-LOCAL_LDFLAGS=$(shell ruby -e 'require "rbconfig"; puts RbConfig::CONFIG["LIBRUBYARG"]')
+LOCAL_LDFLAGS=$(shell ruby -e 'require "rbconfig"; puts RbConfig::CONFIG["LIBS"]')
 
 all: ESL.so
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/ruby/esl_wrap.cpp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/ruby/esl_wrap.cpp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/ruby/esl_wrap.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1902,7 +1902,7 @@
 } 
 
 
-/*@SWIG:/usr/share/swig/1.3.35/ruby/rubyprimtypes.swg,23,%ruby_aux_method@*/
+/*@SWIG:/usr/local/share/swig/1.3.35/ruby/rubyprimtypes.swg,23,%ruby_aux_method@*/
 SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
 {
   VALUE obj = args[0];
@@ -2646,6 +2646,7 @@
   char *arg1 = (char *) 0 ;
   char *arg2 = (char *) 0 ;
   char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
   ESLconnection *result = 0 ;
   int res1 ;
   char *buf1 = 0 ;
@@ -2656,7 +2657,65 @@
   int res3 ;
   char *buf3 = 0 ;
   int alloc3 = 0 ;
+  int res4 ;
+  char *buf4 = 0 ;
+  int alloc4 = 0 ;
   
+  if ((argc < 4) || (argc > 4)) {
+    rb_raise(rb_eArgError, "wrong # of arguments(%d for 4)",argc); SWIG_fail;
+  }
+  res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","ESLconnection", 1, argv[0] ));
+  }
+  arg1 = reinterpret_cast< char * >(buf1);
+  res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","ESLconnection", 2, argv[1] ));
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(argv[2], &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), Ruby_Format_TypeError( "", "char const *","ESLconnection", 3, argv[2] ));
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  res4 = SWIG_AsCharPtrAndSize(argv[3], &buf4, NULL, &alloc4);
+  if (!SWIG_IsOK(res4)) {
+    SWIG_exception_fail(SWIG_ArgError(res4), Ruby_Format_TypeError( "", "char const *","ESLconnection", 4, argv[3] ));
+  }
+  arg4 = reinterpret_cast< char * >(buf4);
+  result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);DATA_PTR(self) = result;
+  
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return self;
+fail:
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return Qnil;
+}
+
+
+SWIGINTERN VALUE
+_wrap_new_ESLconnection__SWIG_1(int argc, VALUE *argv, VALUE self) {
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  ESLconnection *result = 0 ;
+  int res1 ;
+  char *buf1 = 0 ;
+  int alloc1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  
   if ((argc < 3) || (argc > 3)) {
     rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
   }
@@ -2707,7 +2766,7 @@
   
 
 SWIGINTERN VALUE
-_wrap_new_ESLconnection__SWIG_1(int argc, VALUE *argv, VALUE self) {
+_wrap_new_ESLconnection__SWIG_2(int argc, VALUE *argv, VALUE self) {
   int arg1 ;
   ESLconnection *result = 0 ;
   int val1 ;
@@ -2731,11 +2790,11 @@
 
 SWIGINTERN VALUE _wrap_new_ESLconnection(int nargs, VALUE *args, VALUE self) {
   int argc;
-  VALUE argv[3];
+  VALUE argv[4];
   int ii;
   
   argc = nargs;
-  if (argc > 3) SWIG_fail;
+  if (argc > 4) SWIG_fail;
   for (ii = 0; (ii < argc); ++ii) {
     argv[ii] = args[ii];
   }
@@ -2746,7 +2805,7 @@
       _v = SWIG_CheckState(res);
     }
     if (_v) {
-      return _wrap_new_ESLconnection__SWIG_1(nargs, args, self);
+      return _wrap_new_ESLconnection__SWIG_2(nargs, args, self);
     }
   }
   if (argc == 3) {
@@ -2760,14 +2819,35 @@
         int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
         _v = SWIG_CheckState(res);
         if (_v) {
-          return _wrap_new_ESLconnection__SWIG_0(nargs, args, self);
+          return _wrap_new_ESLconnection__SWIG_1(nargs, args, self);
         }
       }
     }
   }
+  if (argc == 4) {
+    int _v;
+    int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+        if (_v) {
+          int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0);
+          _v = SWIG_CheckState(res);
+          if (_v) {
+            return _wrap_new_ESLconnection__SWIG_0(nargs, args, self);
+          }
+        }
+      }
+    }
+  }
   
 fail:
-  Ruby_Format_OverloadedError( argc, 3, "ESLconnection.new", 
+  Ruby_Format_OverloadedError( argc, 4, "ESLconnection.new", 
+    "    ESLconnection.new(char const *host, char const *port, char const *user, char const *password)\n"
     "    ESLconnection.new(char const *host, char const *port, char const *password)\n"
     "    ESLconnection.new(int socket)\n");
   
@@ -3204,7 +3284,7 @@
   char *arg2 = (char *) 0 ;
   char *arg3 = (char *) NULL ;
   char *arg4 = (char *) NULL ;
-  int result;
+  ESLevent *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 ;
@@ -3245,8 +3325,8 @@
     }
     arg4 = reinterpret_cast< char * >(buf4);
   }
-  result = (int)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
-  vresult = SWIG_From_int(static_cast< int >(result));
+  result = (ESLevent *)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN |  0 );
   if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
   if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
   if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
@@ -3265,7 +3345,7 @@
   char *arg2 = (char *) 0 ;
   char *arg3 = (char *) NULL ;
   char *arg4 = (char *) NULL ;
-  int result;
+  ESLevent *result = 0 ;
   void *argp1 = 0 ;
   int res1 = 0 ;
   int res2 ;
@@ -3306,8 +3386,8 @@
     }
     arg4 = reinterpret_cast< char * >(buf4);
   }
-  result = (int)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
-  vresult = SWIG_From_int(static_cast< int >(result));
+  result = (ESLevent *)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent, SWIG_POINTER_OWN |  0 );
   if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
   if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
   if (alloc4 == SWIG_NEWOBJ) delete[] buf4;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/src/esl.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/src/esl.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/src/esl.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -580,7 +580,7 @@
 
 }
 
-ESL_DECLARE(esl_status_t) esl_connect(esl_handle_t *handle, const char *host, esl_port_t port, const char *password)
+ESL_DECLARE(esl_status_t) esl_connect(esl_handle_t *handle, const char *host, esl_port_t port, const char *user, const char *password)
 {
 
 	struct hostent *result;
@@ -651,7 +651,12 @@
 		goto fail;
 	}
 
-	snprintf(sendbuf, sizeof(sendbuf), "auth %s\n\n", password);
+	if (esl_strlen_zero(user)) {
+		snprintf(sendbuf, sizeof(sendbuf), "auth %s\n\n", password);
+	} else {
+		snprintf(sendbuf, sizeof(sendbuf), "userauth %s:%s\n\n", user,  password);
+	}
+
 	esl_send(handle, sendbuf);
 
 	
@@ -834,6 +839,9 @@
 				
 				if (!revent) {
 					esl_event_create(&revent, ESL_EVENT_CLONE);
+					revent->event_id = ESL_EVENT_SOCKET_DATA;
+					esl_event_add_header_string(revent, ESL_STACK_BOTTOM, "Event-Name", "SOCKET_DATA");
+
 				}
 				
 				hname = beg;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/src/esl_event.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/src/esl_event.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/src/esl_event.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -129,6 +129,8 @@
 	"RECORD_START",
 	"RECORD_STOP",
 	"CALL_UPDATE",
+	"FAILURE",
+	"SOCKET_DATA",
 	"ALL"
 };
 
@@ -252,7 +254,7 @@
 	return (event ? event->body : NULL);
 }
 
-ESL_DECLARE(esl_status_t) esl_event_del_header(esl_event_t *event, const char *header_name)
+ESL_DECLARE(esl_status_t) esl_event_del_header_val(esl_event_t *event, const char *header_name, const char *val)
 {
 	esl_event_header_t *hp, *lp = NULL, *tp;
 	esl_status_t status = ESL_FAIL;
@@ -269,7 +271,7 @@
 		esl_assert(x < 1000);
 		hash = esl_ci_hashfunc_default(header_name, &hlen);
 
-		if (hp->name && (!hp->hash || hash == hp->hash) && !strcasecmp(header_name, hp->name)) {
+		if (hp->name && (!hp->hash || hash == hp->hash) && !strcasecmp(header_name, hp->name) && (esl_strlen_zero(val) || !strcmp(hp->value, val))) {
 			if (lp) {
 				lp->next = hp->next;
 			} else {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/src/esl_oop.cpp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/src/esl_oop.cpp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/src/esl_oop.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -14,10 +14,18 @@
 	connection_construct_common();
 	int x_port = atoi(port);
 
-	esl_connect(&handle, host, x_port, password);
+	esl_connect(&handle, host, x_port, NULL, password);
 }
 
+ESLconnection::ESLconnection(const char *host, const char *port, const char *user, const char *password)
+{
+	connection_construct_common();
+	int x_port = atoi(port);
 
+	esl_connect(&handle, host, x_port, user, password);
+}
+
+
 ESLconnection::ESLconnection(int socket)
 {
 	connection_construct_common();
@@ -148,13 +156,19 @@
 	return handle.event_lock;
 }
 
-int ESLconnection::execute(const char *app, const char *arg, const char *uuid)
+ESLevent *ESLconnection::execute(const char *app, const char *arg, const char *uuid)
 {
-	return esl_execute(&handle, app, arg, uuid);
+	if (esl_execute(&handle, app, arg, uuid) == ESL_SUCCESS) {
+		esl_event_t *event;
+		esl_event_dup(&event, handle.last_sr_event);
+		return new ESLevent(event, 1);
+	}
+
+	return NULL;
 }
 
 
-int ESLconnection::executeAsync(const char *app, const char *arg, const char *uuid)
+ESLevent *ESLconnection::executeAsync(const char *app, const char *arg, const char *uuid)
 {
 	int async = handle.async_execute;
 	int r;
@@ -163,7 +177,13 @@
 	r = esl_execute(&handle, app, arg, uuid);
 	handle.async_execute = async;
 
-	return r;
+	if (r == ESL_SUCCESS) {
+		esl_event_t *event;
+		esl_event_dup(&event, handle.last_sr_event);
+		return new ESLevent(event, 1);
+	}
+
+	return NULL;
 }
 
 int ESLconnection::sendEvent(ESLevent *send_me)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/src/include/esl.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/src/include/esl.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/src/include/esl.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -379,9 +379,10 @@
     \param handle Handle to connect
     \param host Host to be connected
     \param port Port to be connected
+    \param password FreeSWITCH server username (optional)
     \param password FreeSWITCH server password
 */
-ESL_DECLARE(esl_status_t) esl_connect(esl_handle_t *handle, const char *host, esl_port_t port, const char *password);
+ESL_DECLARE(esl_status_t) esl_connect(esl_handle_t *handle, const char *host, esl_port_t port, const char *user, const char *password);
 /*!
     \brief Disconnect a handle
     \param handle Handle to be disconnected

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/src/include/esl_event.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/src/include/esl_event.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/src/include/esl_event.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -117,6 +117,8 @@
 	ESL_EVENT_RECORD_START,
 	ESL_EVENT_RECORD_STOP,
 	ESL_EVENT_CALL_UPDATE,
+	ESL_EVENT_FAILURE,
+	ESL_EVENT_SOCKET_DATA,
 	ESL_EVENT_ALL
 } esl_event_types_t;
 
@@ -224,7 +226,8 @@
 */
 ESL_DECLARE(esl_status_t) esl_event_add_header_string(esl_event_t *event, esl_stack_t stack, const char *header_name, const char *data);
 
-ESL_DECLARE(esl_status_t) esl_event_del_header(esl_event_t *event, const char *header_name);
+ESL_DECLARE(esl_status_t) esl_event_del_header_val(esl_event_t *event, const char *header_name, const char *var);
+#define esl_event_del_header(_e, _h) esl_event_del_header_val(_e, _h, NULL)
 
 /*!
   \brief Destroy an event

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/src/include/esl_oop.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/src/include/esl_oop.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/src/include/esl_oop.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -72,6 +72,7 @@
  private:
 	esl_handle_t handle;
  public:
+	ESLconnection(const char *host, const char *port, const char *user, const char *password);
 	ESLconnection(const char *host, const char *port, const char *password);
 	ESLconnection(int socket);
 	virtual ~ESLconnection();
@@ -87,8 +88,8 @@
 	ESLevent *recvEventTimed(int ms);
 	ESLevent *filter(const char *header, const char *value);
 	int events(const char *etype, const char *value);
-	int execute(const char *app, const char *arg = NULL, const char *uuid = NULL);
-	int executeAsync(const char *app, const char *arg = NULL, const char *uuid = NULL);
+	ESLevent *execute(const char *app, const char *arg = NULL, const char *uuid = NULL);
+	ESLevent *executeAsync(const char *app, const char *arg = NULL, const char *uuid = NULL);
 	int setAsyncExecute(const char *val);
 	int setEventLock(const char *val);
 	int disconnect(void);

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/tcl (from rev 16612, freeswitch/trunk/libs/esl/tcl)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/tcl/Makefile

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/tcl/Makefile (from rev 16612, freeswitch/trunk/libs/esl/tcl/Makefile) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/tcl/Makefile	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/tcl/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,23 @@
+LOCAL_CFLAGS=
+LOCAL_LDFLAGS=-ltcl
+WRAP_GCC_WARNING_SILENCE=-Wno-unused-function
+
+all: ESL.so
+
+esl_wrap.cpp:
+	swig -module ESL -tcl -c++ -DMULTIPLICITY -I../src/include -o esl_wrap.cpp ../ESL.i
+
+esl_wrap.o: esl_wrap.cpp
+	$(CXX) $(CXX_CFLAGS) $(CXXFLAGS) $(LOCAL_CFLAGS) $(WRAP_GCC_WARNING_SILENCE) -c esl_wrap.cpp -o esl_wrap.o
+
+ESL.so: esl_wrap.o
+	$(CXX) $(SOLINK) esl_wrap.o $(MYLIB) $(LOCAL_LDFLAGS) -o ESL.so -L. $(LIBS)
+
+clean:
+	rm -f *.o *.so *~
+
+swigclean:
+	rm -f esl_wrap.* ESL.so
+
+reswig:	swigclean esl_wrap.cpp
+

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/tcl/esl_wrap.cpp

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/tcl/esl_wrap.cpp (from rev 16612, freeswitch/trunk/libs/esl/tcl/esl_wrap.cpp) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/tcl/esl_wrap.cpp	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/tcl/esl_wrap.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,3646 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ * 
+ * This file is not intended to be easily readable and contains a number of 
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG 
+ * interface file instead. 
+ * ----------------------------------------------------------------------------- */
+
+
+#ifdef __cplusplus
+template<typename T> class SwigValueWrapper {
+    T *tt;
+public:
+    SwigValueWrapper() : tt(0) { }
+    SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
+    SwigValueWrapper(const T& t) : tt(new T(t)) { }
+    ~SwigValueWrapper() { delete tt; } 
+    SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
+    operator T&() const { return *tt; }
+    T *operator&() { return tt; }
+private:
+    SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+};
+
+template <typename T> T SwigValueInit() {
+  return T();
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
+# else
+#   define SWIGUNUSED 
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif 
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+
+#include <stdio.h>
+#include <tcl.h>
+#include <errno.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <ctype.h>
+
+/* -----------------------------------------------------------------------------
+ * swigrun.swg
+ *
+ * This file contains generic CAPI SWIG runtime support for pointer
+ * type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* This should only be incremented when either the layout of swig_type_info changes,
+   or for whatever reason, the runtime changes incompatibly */
+#define SWIG_RUNTIME_VERSION "4"
+
+/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
+#ifdef SWIG_TYPE_TABLE
+# define SWIG_QUOTE_STRING(x) #x
+# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
+# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
+#else
+# define SWIG_TYPE_TABLE_NAME
+#endif
+
+/*
+  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
+  creating a static or dynamic library from the swig runtime code.
+  In 99.9% of the cases, swig just needs to declare them as 'static'.
+  
+  But only do this if is strictly necessary, ie, if you have problems
+  with your compiler or so.
+*/
+
+#ifndef SWIGRUNTIME
+# define SWIGRUNTIME SWIGINTERN
+#endif
+
+#ifndef SWIGRUNTIMEINLINE
+# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
+#endif
+
+/*  Generic buffer size */
+#ifndef SWIG_BUFFER_SIZE
+# define SWIG_BUFFER_SIZE 1024
+#endif
+
+/* Flags for pointer conversions */
+#define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
+
+/* Flags for new pointer objects */
+#define SWIG_POINTER_OWN           0x1
+
+
+/* 
+   Flags/methods for returning states.
+   
+   The swig conversion methods, as ConvertPtr, return and integer 
+   that tells if the conversion was successful or not. And if not,
+   an error code can be returned (see swigerrors.swg for the codes).
+   
+   Use the following macros/flags to set or process the returning
+   states.
+   
+   In old swig versions, you usually write code as:
+
+     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
+       // success code
+     } else {
+       //fail code
+     }
+
+   Now you can be more explicit as:
+
+    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+    } else {
+      // fail code
+    }
+
+   that seems to be the same, but now you can also do
+
+    Type *ptr;
+    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
+    if (SWIG_IsOK(res)) {
+      // success code
+      if (SWIG_IsNewObj(res) {
+        ...
+	delete *ptr;
+      } else {
+        ...
+      }
+    } else {
+      // fail code
+    }
+    
+   I.e., now SWIG_ConvertPtr can return new objects and you can
+   identify the case and take care of the deallocation. Of course that
+   requires also to SWIG_ConvertPtr to return new result values, as
+
+      int SWIG_ConvertPtr(obj, ptr,...) {         
+        if (<obj is ok>) {			       
+          if (<need new object>) {		       
+            *ptr = <ptr to new allocated object>; 
+            return SWIG_NEWOBJ;		       
+          } else {				       
+            *ptr = <ptr to old object>;	       
+            return SWIG_OLDOBJ;		       
+          } 				       
+        } else {				       
+          return SWIG_BADOBJ;		       
+        }					       
+      }
+
+   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
+   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
+   swig errors code.
+
+   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
+   allows to return the 'cast rank', for example, if you have this
+
+       int food(double)
+       int fooi(int);
+
+   and you call
+ 
+      food(1)   // cast rank '1'  (1 -> 1.0)
+      fooi(1)   // cast rank '0'
+
+   just use the SWIG_AddCast()/SWIG_CheckState()
+
+
+ */
+#define SWIG_OK                    (0) 
+#define SWIG_ERROR                 (-1)
+#define SWIG_IsOK(r)               (r >= 0)
+#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
+
+/* The CastRankLimit says how many bits are used for the cast rank */
+#define SWIG_CASTRANKLIMIT         (1 << 8)
+/* The NewMask denotes the object was created (using new/malloc) */
+#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
+/* The TmpMask is for in/out typemaps that use temporal objects */
+#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
+/* Simple returning values */
+#define SWIG_BADOBJ                (SWIG_ERROR)
+#define SWIG_OLDOBJ                (SWIG_OK)
+#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
+#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
+/* Check, add and del mask methods */
+#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
+#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
+#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
+#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
+#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
+#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
+
+
+/* Cast-Rank Mode */
+#if defined(SWIG_CASTRANK_MODE)
+#  ifndef SWIG_TypeRank
+#    define SWIG_TypeRank             unsigned long
+#  endif
+#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
+#    define SWIG_MAXCASTRANK          (2)
+#  endif
+#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
+#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
+SWIGINTERNINLINE int SWIG_AddCast(int r) { 
+  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
+}
+SWIGINTERNINLINE int SWIG_CheckState(int r) { 
+  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
+}
+#else /* no cast-rank mode */
+#  define SWIG_AddCast
+#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
+#endif
+
+
+
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void *(*swig_converter_func)(void *, int *);
+typedef struct swig_type_info *(*swig_dycast_func)(void **);
+
+/* Structure to store information on one type */
+typedef struct swig_type_info {
+  const char             *name;			/* mangled name of this type */
+  const char             *str;			/* human readable name of this type */
+  swig_dycast_func        dcast;		/* dynamic cast function down a hierarchy */
+  struct swig_cast_info  *cast;			/* linked list of types that can cast into this type */
+  void                   *clientdata;		/* language specific type data */
+  int                    owndata;		/* flag if the structure owns the clientdata */
+} swig_type_info;
+
+/* Structure to store a type and conversion function used for casting */
+typedef struct swig_cast_info {
+  swig_type_info         *type;			/* pointer to type that is equivalent to this type */
+  swig_converter_func     converter;		/* function to cast the void pointers */
+  struct swig_cast_info  *next;			/* pointer to next cast in linked list */
+  struct swig_cast_info  *prev;			/* pointer to the previous cast */
+} swig_cast_info;
+
+/* Structure used to store module information
+ * Each module generates one structure like this, and the runtime collects
+ * all of these structures and stores them in a circularly linked list.*/
+typedef struct swig_module_info {
+  swig_type_info         **types;		/* Array of pointers to swig_type_info structures that are in this module */
+  size_t                 size;		        /* Number of types in this module */
+  struct swig_module_info *next;		/* Pointer to next element in circularly linked list */
+  swig_type_info         **type_initial;	/* Array of initially generated type structures */
+  swig_cast_info         **cast_initial;	/* Array of initially generated casting structures */
+  void                    *clientdata;		/* Language specific module data */
+} swig_module_info;
+
+/* 
+  Compare two type names skipping the space characters, therefore
+  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
+
+  Return 0 when the two name types are equivalent, as in
+  strncmp, but skipping ' '.
+*/
+SWIGRUNTIME int
+SWIG_TypeNameComp(const char *f1, const char *l1,
+		  const char *f2, const char *l2) {
+  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
+    while ((*f1 == ' ') && (f1 != l1)) ++f1;
+    while ((*f2 == ' ') && (f2 != l2)) ++f2;
+    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
+  }
+  return (int)((l1 - f1) - (l2 - f2));
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if not equal, 1 if equal
+*/
+SWIGRUNTIME int
+SWIG_TypeEquiv(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+/*
+  Check type equivalence in a name list like <name1>|<name2>|...
+  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
+*/
+SWIGRUNTIME int
+SWIG_TypeCompare(const char *nb, const char *tb) {
+  int equiv = 0;
+  const char* te = tb + strlen(tb);
+  const char* ne = nb;
+  while (!equiv && *ne) {
+    for (nb = ne; *ne; ++ne) {
+      if (*ne == '|') break;
+    }
+    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
+    if (*ne) ++ne;
+  }
+  return equiv;
+}
+
+
+/* think of this as a c++ template<> or a scheme macro */
+#define SWIG_TypeCheck_Template(comparison, ty)         \
+  if (ty) {                                             \
+    swig_cast_info *iter = ty->cast;                    \
+    while (iter) {                                      \
+      if (comparison) {                                 \
+        if (iter == ty->cast) return iter;              \
+        /* Move iter to the top of the linked list */   \
+        iter->prev->next = iter->next;                  \
+        if (iter->next)                                 \
+          iter->next->prev = iter->prev;                \
+        iter->next = ty->cast;                          \
+        iter->prev = 0;                                 \
+        if (ty->cast) ty->cast->prev = iter;            \
+        ty->cast = iter;                                \
+        return iter;                                    \
+      }                                                 \
+      iter = iter->next;                                \
+    }                                                   \
+  }                                                     \
+  return 0
+
+/*
+  Check the typename
+*/
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheck(const char *c, swig_type_info *ty) {
+  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
+}
+
+/* Same as previous function, except strcmp is replaced with a pointer comparison */
+SWIGRUNTIME swig_cast_info *
+SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
+  SWIG_TypeCheck_Template(iter->type == from, into);
+}
+
+/*
+  Cast a pointer up an inheritance hierarchy
+*/
+SWIGRUNTIMEINLINE void *
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
+}
+
+/* 
+   Dynamic pointer casting. Down an inheritance hierarchy
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
+  swig_type_info *lastty = ty;
+  if (!ty || !ty->dcast) return ty;
+  while (ty && (ty->dcast)) {
+    ty = (*ty->dcast)(ptr);
+    if (ty) lastty = ty;
+  }
+  return lastty;
+}
+
+/*
+  Return the name associated with this type
+*/
+SWIGRUNTIMEINLINE const char *
+SWIG_TypeName(const swig_type_info *ty) {
+  return ty->name;
+}
+
+/*
+  Return the pretty name associated with this type,
+  that is an unmangled type name in a form presentable to the user.
+*/
+SWIGRUNTIME const char *
+SWIG_TypePrettyName(const swig_type_info *type) {
+  /* The "str" field contains the equivalent pretty names of the
+     type, separated by vertical-bar characters.  We choose
+     to print the last name, as it is often (?) the most
+     specific. */
+  if (!type) return NULL;
+  if (type->str != NULL) {
+    const char *last_name = type->str;
+    const char *s;
+    for (s = type->str; *s; s++)
+      if (*s == '|') last_name = s+1;
+    return last_name;
+  }
+  else
+    return type->name;
+}
+
+/* 
+   Set the clientdata field for a type
+*/
+SWIGRUNTIME void
+SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
+  swig_cast_info *cast = ti->cast;
+  /* if (ti->clientdata == clientdata) return; */
+  ti->clientdata = clientdata;
+  
+  while (cast) {
+    if (!cast->converter) {
+      swig_type_info *tc = cast->type;
+      if (!tc->clientdata) {
+	SWIG_TypeClientData(tc, clientdata);
+      }
+    }    
+    cast = cast->next;
+  }
+}
+SWIGRUNTIME void
+SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
+  SWIG_TypeClientData(ti, clientdata);
+  ti->owndata = 1;
+}
+  
+/*
+  Search for a swig_type_info structure only by mangled name
+  Search is a O(log #types)
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_MangledTypeQueryModule(swig_module_info *start, 
+                            swig_module_info *end, 
+		            const char *name) {
+  swig_module_info *iter = start;
+  do {
+    if (iter->size) {
+      register size_t l = 0;
+      register size_t r = iter->size - 1;
+      do {
+	/* since l+r >= 0, we can (>> 1) instead (/ 2) */
+	register size_t i = (l + r) >> 1; 
+	const char *iname = iter->types[i]->name;
+	if (iname) {
+	  register int compare = strcmp(name, iname);
+	  if (compare == 0) {	    
+	    return iter->types[i];
+	  } else if (compare < 0) {
+	    if (i) {
+	      r = i - 1;
+	    } else {
+	      break;
+	    }
+	  } else if (compare > 0) {
+	    l = i + 1;
+	  }
+	} else {
+	  break; /* should never happen */
+	}
+      } while (l <= r);
+    }
+    iter = iter->next;
+  } while (iter != end);
+  return 0;
+}
+
+/*
+  Search for a swig_type_info structure for either a mangled name or a human readable name.
+  It first searches the mangled names of the types, which is a O(log #types)
+  If a type is not found it then searches the human readable names, which is O(#types).
+  
+  We start searching at module start, and finish searching when start == end.  
+  Note: if start == end at the beginning of the function, we go all the way around
+  the circular list.
+*/
+SWIGRUNTIME swig_type_info *
+SWIG_TypeQueryModule(swig_module_info *start, 
+                     swig_module_info *end, 
+		     const char *name) {
+  /* STEP 1: Search the name field using binary search */
+  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
+  if (ret) {
+    return ret;
+  } else {
+    /* STEP 2: If the type hasn't been found, do a complete search
+       of the str field (the human readable name) */
+    swig_module_info *iter = start;
+    do {
+      register size_t i = 0;
+      for (; i < iter->size; ++i) {
+	if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
+	  return iter->types[i];
+      }
+      iter = iter->next;
+    } while (iter != end);
+  }
+  
+  /* neither found a match */
+  return 0;
+}
+
+/* 
+   Pack binary data into a string
+*/
+SWIGRUNTIME char *
+SWIG_PackData(char *c, void *ptr, size_t sz) {
+  static const char hex[17] = "0123456789abcdef";
+  register const unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu =  u + sz;
+  for (; u != eu; ++u) {
+    register unsigned char uu = *u;
+    *(c++) = hex[(uu & 0xf0) >> 4];
+    *(c++) = hex[uu & 0xf];
+  }
+  return c;
+}
+
+/* 
+   Unpack binary data from a string
+*/
+SWIGRUNTIME const char *
+SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
+  register unsigned char *u = (unsigned char *) ptr;
+  register const unsigned char *eu = u + sz;
+  for (; u != eu; ++u) {
+    register char d = *(c++);
+    register unsigned char uu;
+    if ((d >= '0') && (d <= '9'))
+      uu = ((d - '0') << 4);
+    else if ((d >= 'a') && (d <= 'f'))
+      uu = ((d - ('a'-10)) << 4);
+    else 
+      return (char *) 0;
+    d = *(c++);
+    if ((d >= '0') && (d <= '9'))
+      uu |= (d - '0');
+    else if ((d >= 'a') && (d <= 'f'))
+      uu |= (d - ('a'-10));
+    else 
+      return (char *) 0;
+    *u = uu;
+  }
+  return c;
+}
+
+/* 
+   Pack 'void *' into a string buffer.
+*/
+SWIGRUNTIME char *
+SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
+  char *r = buff;
+  if ((2*sizeof(void *) + 2) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,&ptr,sizeof(void *));
+  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
+  strcpy(r,name);
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      *ptr = (void *) 0;
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sizeof(void *));
+}
+
+SWIGRUNTIME char *
+SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
+  char *r = buff;
+  size_t lname = (name ? strlen(name) : 0);
+  if ((2*sz + 2 + lname) > bsz) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  if (lname) {
+    strncpy(r,name,lname+1);
+  } else {
+    *r = 0;
+  }
+  return buff;
+}
+
+SWIGRUNTIME const char *
+SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
+  if (*c != '_') {
+    if (strcmp(c,"NULL") == 0) {
+      memset(ptr,0,sz);
+      return name;
+    } else {
+      return 0;
+    }
+  }
+  return SWIG_UnpackData(++c,ptr,sz);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+/*  Errors in SWIG */
+#define  SWIG_UnknownError    	   -1 
+#define  SWIG_IOError        	   -2 
+#define  SWIG_RuntimeError   	   -3 
+#define  SWIG_IndexError     	   -4 
+#define  SWIG_TypeError      	   -5 
+#define  SWIG_DivisionByZero 	   -6 
+#define  SWIG_OverflowError  	   -7 
+#define  SWIG_SyntaxError    	   -8 
+#define  SWIG_ValueError     	   -9 
+#define  SWIG_SystemError    	   -10
+#define  SWIG_AttributeError 	   -11
+#define  SWIG_MemoryError    	   -12 
+#define  SWIG_NullReferenceError   -13
+
+
+
+/* -----------------------------------------------------------------------------
+ * error manipulation
+ * ----------------------------------------------------------------------------- */
+
+SWIGINTERN const char*
+SWIG_Tcl_ErrorType(int code) {
+  const char* type = 0;
+  switch(code) {
+  case SWIG_MemoryError:
+    type = "MemoryError";
+    break;
+  case SWIG_IOError:
+    type = "IOError";
+    break;
+  case SWIG_RuntimeError:
+    type = "RuntimeError";
+    break;
+  case SWIG_IndexError:
+    type = "IndexError";
+    break;
+  case SWIG_TypeError:
+    type = "TypeError";
+    break;
+  case SWIG_DivisionByZero:
+    type = "ZeroDivisionError";
+    break;
+  case SWIG_OverflowError:
+    type = "OverflowError";
+    break;
+  case SWIG_SyntaxError:
+    type = "SyntaxError";
+    break;
+  case SWIG_ValueError:
+    type = "ValueError";
+    break;
+  case SWIG_SystemError:
+    type = "SystemError";
+    break;
+  case SWIG_AttributeError:
+    type = "AttributeError";
+    break;
+  default:
+    type = "RuntimeError";
+  }
+  return type;
+}
+
+
+SWIGINTERN void
+SWIG_Tcl_SetErrorObj(Tcl_Interp *interp, const char *ctype, Tcl_Obj *obj)
+{
+  Tcl_ResetResult(interp);
+  Tcl_SetObjResult(interp, obj);
+  Tcl_SetErrorCode(interp, "SWIG", ctype, NULL);
+}
+
+SWIGINTERN void
+SWIG_Tcl_SetErrorMsg(Tcl_Interp *interp, const char *ctype, const char *mesg)
+{
+  Tcl_ResetResult(interp);
+  Tcl_SetErrorCode(interp, "SWIG", ctype, NULL);
+  Tcl_AppendResult(interp, ctype, " ", mesg, NULL);
+  /*
+  Tcl_AddErrorInfo(interp, ctype);
+  Tcl_AddErrorInfo(interp, " ");
+  Tcl_AddErrorInfo(interp, mesg);
+  */
+}
+
+SWIGINTERNINLINE void
+SWIG_Tcl_AddErrorMsg(Tcl_Interp *interp, const char* mesg)
+{
+  Tcl_AddErrorInfo(interp, mesg);
+}
+
+
+
+/* -----------------------------------------------------------------------------
+ * SWIG API. Portion that goes into the runtime
+ * ----------------------------------------------------------------------------- */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* -----------------------------------------------------------------------------
+ * Constant declarations
+ * ----------------------------------------------------------------------------- */
+
+/* Constant Types */
+#define SWIG_TCL_POINTER 4
+#define SWIG_TCL_BINARY  5
+
+/* Constant information structure */
+typedef struct swig_const_info {
+    int type;
+    char *name;
+    long lvalue;
+    double dvalue;
+    void   *pvalue;
+    swig_type_info **ptype;
+} swig_const_info;
+
+typedef int   (*swig_wrapper)(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST []);
+typedef int   (*swig_wrapper_func)(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST []);
+typedef char *(*swig_variable_func)(ClientData, Tcl_Interp *, char *, char *, int);
+typedef void  (*swig_delete_func)(ClientData);
+
+typedef struct swig_method {
+  const char     *name;
+  swig_wrapper   method;
+} swig_method;
+
+typedef struct swig_attribute {
+  const char     *name;
+  swig_wrapper   getmethod;
+  swig_wrapper   setmethod;
+} swig_attribute;
+
+typedef struct swig_class {
+  const char         *name;
+  swig_type_info   **type;
+  swig_wrapper       constructor;
+  void              (*destructor)(void *);
+  swig_method        *methods;
+  swig_attribute     *attributes;
+  struct swig_class **bases;
+  const char              **base_names;
+  swig_module_info   *module;
+} swig_class;
+
+typedef struct swig_instance {
+  Tcl_Obj       *thisptr;
+  void          *thisvalue;
+  swig_class   *classptr;
+  int            destroy;
+  Tcl_Command    cmdtok;
+} swig_instance;
+
+/* Structure for command table */
+typedef struct {
+  const char *name;
+  int       (*wrapper)(ClientData, Tcl_Interp *, int, Tcl_Obj *CONST []);
+  ClientData  clientdata;
+} swig_command_info;
+
+/* Structure for variable linking table */
+typedef struct {
+  const char *name;
+  void *addr;
+  char * (*get)(ClientData, Tcl_Interp *, char *, char *, int);
+  char * (*set)(ClientData, Tcl_Interp *, char *, char *, int);
+} swig_var_info;
+
+
+/* -----------------------------------------------------------------------------*
+ *  Install a constant object 
+ * -----------------------------------------------------------------------------*/
+
+static Tcl_HashTable   swigconstTable;
+static int             swigconstTableinit = 0;
+
+SWIGINTERN void
+SWIG_Tcl_SetConstantObj(Tcl_Interp *interp, const char* name, Tcl_Obj *obj) {
+  int newobj;
+  Tcl_ObjSetVar2(interp,Tcl_NewStringObj(name,-1), NULL, obj, TCL_GLOBAL_ONLY);
+  Tcl_SetHashValue(Tcl_CreateHashEntry(&swigconstTable, name, &newobj), (ClientData) obj);
+}
+
+SWIGINTERN Tcl_Obj *
+SWIG_Tcl_GetConstantObj(const char *key) {
+  Tcl_HashEntry *entryPtr;
+  if (!swigconstTableinit) return 0;
+  entryPtr = Tcl_FindHashEntry(&swigconstTable, key);
+  if (entryPtr) {
+    return (Tcl_Obj *) Tcl_GetHashValue(entryPtr);
+  }
+  return 0;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
+/* -----------------------------------------------------------------------------
+ * See the LICENSE file for information on copyright, usage and redistribution
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
+ *
+ * tclrun.swg
+ *
+ * This file contains the runtime support for Tcl modules and includes
+ * code for managing global variables and pointer type checking.
+ * ----------------------------------------------------------------------------- */
+
+/* Common SWIG API */
+
+/* for raw pointers */
+#define SWIG_ConvertPtr(oc, ptr, ty, flags)             SWIG_Tcl_ConvertPtr(interp, oc, ptr, ty, flags)
+#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Tcl_NewPointerObj(ptr, type, flags)
+
+/* for raw packed data */
+#define SWIG_ConvertPacked(obj, ptr, sz, ty)            SWIG_Tcl_ConvertPacked(interp, obj, ptr, sz, ty)
+#define SWIG_NewPackedObj(ptr, sz, type)                SWIG_Tcl_NewPackedObj(ptr, sz, type)
+
+/* for class or struct pointers */
+#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_Tcl_ConvertPtr(interp, obj, pptr, type, flags)
+#define SWIG_NewInstanceObj(thisvalue, type, flags)     SWIG_Tcl_NewInstanceObj(interp, thisvalue, type, flags)
+
+/* for C or C++ function pointers */
+#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_Tcl_ConvertPtr(interp, obj, pptr, type, 0)
+#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_Tcl_NewPointerObj(ptr, type, 0)
+
+/* for C++ member pointers, ie, member methods */
+#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_Tcl_ConvertPacked(interp,obj, ptr, sz, ty)
+#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_Tcl_NewPackedObj(ptr, sz, type)
+
+
+/* Runtime API */
+
+#define SWIG_GetModule(clientdata)                      SWIG_Tcl_GetModule((Tcl_Interp *) (clientdata))	     
+#define SWIG_SetModule(clientdata, pointer)          	SWIG_Tcl_SetModule((Tcl_Interp *) (clientdata), pointer)
+
+
+/* Error manipulation */
+
+#define SWIG_ErrorType(code)                            SWIG_Tcl_ErrorType(code)                                      
+#define SWIG_Error(code, msg)            		SWIG_Tcl_SetErrorMsg(interp, SWIG_Tcl_ErrorType(code), msg)
+#define SWIG_fail                        		goto fail						    
+
+
+/* Tcl-specific SWIG API */
+
+#define SWIG_Acquire(ptr)                               SWIG_Tcl_Acquire(ptr)                                     
+#define SWIG_MethodCommand                           	SWIG_Tcl_MethodCommand				       
+#define SWIG_Disown(ptr)                             	SWIG_Tcl_Disown(ptr)				       
+#define SWIG_ConvertPtrFromString(c, ptr, ty, flags) 	SWIG_Tcl_ConvertPtrFromString(interp, c, ptr, ty, flags)  
+#define SWIG_MakePtr(c, ptr, ty, flags)              	SWIG_Tcl_MakePtr(c, ptr, ty, flags)		       
+#define SWIG_PointerTypeFromString(c)                	SWIG_Tcl_PointerTypeFromString(c)			       
+#define SWIG_GetArgs                                 	SWIG_Tcl_GetArgs					       
+#define SWIG_GetConstantObj(key)                     	SWIG_Tcl_GetConstantObj(key)			       
+#define SWIG_ObjectConstructor                       	SWIG_Tcl_ObjectConstructor				       
+#define SWIG_Thisown(ptr)                            	SWIG_Tcl_Thisown(ptr)				       
+#define SWIG_ObjectDelete                            	SWIG_Tcl_ObjectDelete				       
+
+
+#define SWIG_TCL_DECL_ARGS_2(arg1, arg2)                (Tcl_Interp *interp SWIGUNUSED, arg1, arg2)
+#define SWIG_TCL_CALL_ARGS_2(arg1, arg2)                (interp, arg1, arg2)
+/* -----------------------------------------------------------------------------
+ * pointers/data manipulation
+ * ----------------------------------------------------------------------------- */
+
+/* For backward compatibility only */
+#define SWIG_POINTER_EXCEPTION  0
+#define SWIG_GetConstant        SWIG_GetConstantObj
+#define SWIG_Tcl_GetConstant    SWIG_Tcl_GetConstantObj
+
+#include "assert.h"
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* cc-mode */
+#endif
+#endif
+
+/* Object support */
+
+SWIGRUNTIME Tcl_HashTable*
+SWIG_Tcl_ObjectTable(void) {
+  static Tcl_HashTable  swigobjectTable;
+  static int            swigobjectTableinit = 0;
+  if (!swigobjectTableinit) {
+    Tcl_InitHashTable(&swigobjectTable, TCL_ONE_WORD_KEYS);
+    swigobjectTableinit = 1;
+  }
+  return &swigobjectTable;
+}
+
+/* Acquire ownership of a pointer */
+SWIGRUNTIME void
+SWIG_Tcl_Acquire(void *ptr) {
+  int newobj;
+  Tcl_CreateHashEntry(SWIG_Tcl_ObjectTable(), (char *) ptr, &newobj);
+}
+
+SWIGRUNTIME int
+SWIG_Tcl_Thisown(void *ptr) {
+  if (Tcl_FindHashEntry(SWIG_Tcl_ObjectTable(), (char *) ptr)) {
+    return 1;
+  }
+  return 0;
+}
+
+/* Disown a pointer.  Returns 1 if we owned it to begin with */
+SWIGRUNTIME int
+SWIG_Tcl_Disown(void *ptr) {
+  Tcl_HashEntry *entryPtr = Tcl_FindHashEntry(SWIG_Tcl_ObjectTable(), (char *) ptr);
+  if (entryPtr) {
+    Tcl_DeleteHashEntry(entryPtr);
+    return 1;
+  }
+  return 0;
+}
+
+/* Convert a pointer value */
+SWIGRUNTIME int
+SWIG_Tcl_ConvertPtrFromString(Tcl_Interp *interp, const char *c, void **ptr, swig_type_info *ty, int flags) {
+  swig_cast_info *tc;
+  /* Pointer values must start with leading underscore */
+  while (*c != '_') {
+    *ptr = (void *) 0;
+    if (strcmp(c,"NULL") == 0) return SWIG_OK;
+
+    /* Empty string: not a pointer */
+    if (*c == 0) return SWIG_ERROR; 
+
+    /* Hmmm. It could be an object name. */
+
+    /* Check if this is a command at all. Prevents <c> cget -this         */
+    /* from being called when c is not a command, firing the unknown proc */
+    if (Tcl_VarEval(interp,"info commands ", c, (char *) NULL) == TCL_OK) {
+      Tcl_Obj *result = Tcl_GetObjResult(interp);
+      if (*(Tcl_GetStringFromObj(result, NULL)) == 0) {
+        /* It's not a command, so it can't be a pointer */
+        Tcl_ResetResult(interp);
+        return SWIG_ERROR;
+      }
+    } else {
+      /* This will only fail if the argument is multiple words. */
+      /* Multiple words are also not commands.                  */
+      Tcl_ResetResult(interp);
+      return SWIG_ERROR;
+    }
+
+    /* Check if this is really a SWIG pointer */
+    if (Tcl_VarEval(interp,c," cget -this", (char *) NULL) != TCL_OK) {
+      Tcl_ResetResult(interp);
+      return SWIG_ERROR;
+    }
+
+    c = Tcl_GetStringFromObj(Tcl_GetObjResult(interp), NULL);
+  }
+
+  c++;
+  c = SWIG_UnpackData(c,ptr,sizeof(void *));
+  if (ty) {
+    tc = c ? SWIG_TypeCheck(c,ty) : 0;
+    if (!tc) {
+      return SWIG_ERROR;
+    }
+    if (flags & SWIG_POINTER_DISOWN) {
+      SWIG_Disown((void *) *ptr);
+    }
+    {
+      int newmemory = 0;
+      *ptr = SWIG_TypeCast(tc,(void *) *ptr,&newmemory);
+      assert(!newmemory); /* newmemory handling not yet implemented */
+    }
+  }
+  return SWIG_OK;
+}
+
+/* Convert a pointer value */
+SWIGRUNTIMEINLINE int
+SWIG_Tcl_ConvertPtr(Tcl_Interp *interp, Tcl_Obj *oc, void **ptr, swig_type_info *ty, int flags) {
+  return SWIG_Tcl_ConvertPtrFromString(interp, Tcl_GetStringFromObj(oc,NULL), ptr, ty, flags);
+}
+
+/* Convert a pointer value */
+SWIGRUNTIME char *
+SWIG_Tcl_PointerTypeFromString(char *c) {
+  char d;
+  /* Pointer values must start with leading underscore. NULL has no type */
+  if (*c != '_') {
+    return 0;
+  }
+  c++;
+  /* Extract hex value from pointer */
+  while ((d = *c)) {
+    if (!(((d >= '0') && (d <= '9')) || ((d >= 'a') && (d <= 'f')))) break;
+    c++;
+  }
+  return c;
+}
+
+/* Convert a packed value value */
+SWIGRUNTIME int
+SWIG_Tcl_ConvertPacked(Tcl_Interp *SWIGUNUSEDPARM(interp) , Tcl_Obj *obj, void *ptr, int sz, swig_type_info *ty) {
+  swig_cast_info *tc;
+  const char  *c;
+
+  if (!obj) goto type_error;
+  c = Tcl_GetStringFromObj(obj,NULL);
+  /* Pointer values must start with leading underscore */
+  if (*c != '_') goto type_error;
+  c++;
+  c = SWIG_UnpackData(c,ptr,sz);
+  if (ty) {
+    tc = SWIG_TypeCheck(c,ty);
+    if (!tc) goto type_error;
+  }
+  return SWIG_OK;
+
+ type_error:
+
+  return SWIG_ERROR;
+}
+
+
+/* Take a pointer and convert it to a string */
+SWIGRUNTIME void
+SWIG_Tcl_MakePtr(char *c, void *ptr, swig_type_info *ty, int flags) {
+  if (ptr) {
+    *(c++) = '_';
+    c = SWIG_PackData(c,&ptr,sizeof(void *));
+    strcpy(c,ty->name);
+  } else {
+    strcpy(c,(char *)"NULL");
+  }
+  flags = 0;
+}
+
+/* Create a new pointer object */
+SWIGRUNTIMEINLINE Tcl_Obj *
+SWIG_Tcl_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
+  Tcl_Obj *robj;
+  char result[SWIG_BUFFER_SIZE];
+  SWIG_MakePtr(result,ptr,type,flags);
+  robj = Tcl_NewStringObj(result,-1);
+  return robj;
+}
+
+SWIGRUNTIME Tcl_Obj *
+SWIG_Tcl_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
+  char result[1024];
+  char *r = result;
+  if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
+  *(r++) = '_';
+  r = SWIG_PackData(r,ptr,sz);
+  strcpy(r,type->name);
+  return Tcl_NewStringObj(result,-1);
+}
+
+/* -----------------------------------------------------------------------------*
+ *  Get type list 
+ * -----------------------------------------------------------------------------*/
+
+SWIGRUNTIME swig_module_info * 
+SWIG_Tcl_GetModule(Tcl_Interp *interp) {
+  const char *data;
+  swig_module_info *ret = 0;
+  
+  /* first check if pointer already created */
+  data = Tcl_GetVar(interp, (char *)"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, TCL_GLOBAL_ONLY);
+  if (data) {
+    SWIG_UnpackData(data, &ret, sizeof(swig_type_info **));
+  }
+
+  return ret;
+}
+
+SWIGRUNTIME void
+SWIG_Tcl_SetModule(Tcl_Interp *interp, swig_module_info *module) {
+  char buf[SWIG_BUFFER_SIZE];
+  char *data;
+
+  /* create a new pointer */
+  data = SWIG_PackData(buf, &module, sizeof(swig_type_info **));
+  *data = 0;
+  Tcl_SetVar(interp, (char *)"swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, buf, 0);
+}
+
+/* -----------------------------------------------------------------------------*
+ *  Object auxiliars
+ * -----------------------------------------------------------------------------*/
+
+
+SWIGRUNTIME void
+SWIG_Tcl_ObjectDelete(ClientData clientData) {
+  swig_instance *si = (swig_instance *) clientData;
+  if ((si) && (si->destroy) && (SWIG_Disown(si->thisvalue))) {
+    if (si->classptr->destructor) {
+      (si->classptr->destructor)(si->thisvalue);
+    }
+  }
+  Tcl_DecrRefCount(si->thisptr);
+  free(si);
+}
+
+/* Function to invoke object methods given an instance */
+SWIGRUNTIME int
+SWIG_Tcl_MethodCommand(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST _objv[]) {
+  char *method,   *attrname;
+  swig_instance   *inst = (swig_instance *) clientData;
+  swig_method     *meth;
+  swig_attribute  *attr;
+  Tcl_Obj         *oldarg;
+  Tcl_Obj         **objv;
+  int              rcode;
+  swig_class      *cls;
+  swig_class      *cls_stack[64];
+  int              cls_stack_bi[64];
+  int              cls_stack_top = 0;
+  int              numconf = 2;
+  int              bi;
+
+  objv = (Tcl_Obj **) _objv;
+  if (objc < 2) {
+    Tcl_SetResult(interp, (char *) "wrong # args.", TCL_STATIC);
+    return TCL_ERROR;
+  }
+  method = Tcl_GetStringFromObj(objv[1],NULL);
+  if (strcmp(method,"-acquire") == 0) {
+    inst->destroy = 1;
+    SWIG_Acquire(inst->thisvalue);
+    return TCL_OK;
+  }
+  if (strcmp(method,"-disown") == 0) {
+    if (inst->destroy) {
+      SWIG_Disown(inst->thisvalue);
+    }
+    inst->destroy = 0;
+    return TCL_OK;
+  }
+  if (strcmp(method,"-delete") == 0) {
+    Tcl_DeleteCommandFromToken(interp,inst->cmdtok);
+    return TCL_OK;
+  }
+  cls_stack[cls_stack_top] = inst->classptr;
+  cls_stack_bi[cls_stack_top] = -1;
+  cls = inst->classptr;
+  while (1) {
+    bi = cls_stack_bi[cls_stack_top];
+    cls = cls_stack[cls_stack_top];
+    if (bi != -1) {
+      if (!cls->bases[bi] && cls->base_names[bi]) {
+        /* lookup and cache the base class */
+	swig_type_info *info = SWIG_TypeQueryModule(cls->module, cls->module, cls->base_names[bi]);
+	if (info) cls->bases[bi] = (swig_class *) info->clientdata;
+      }
+      cls = cls->bases[bi];
+      if (cls) {
+        cls_stack_bi[cls_stack_top]++;
+        cls_stack_top++;
+        cls_stack[cls_stack_top] = cls;
+        cls_stack_bi[cls_stack_top] = -1;
+        continue;
+      }
+    }
+    if (!cls) {
+      cls_stack_top--;
+      if (cls_stack_top < 0) break;
+      else continue;
+    }
+    cls_stack_bi[cls_stack_top]++;
+
+    meth = cls->methods;
+    /* Check for methods */
+    while (meth && meth->name) {
+      if (strcmp(meth->name,method) == 0) {
+        oldarg = objv[1];
+        objv[1] = inst->thisptr;
+        Tcl_IncrRefCount(inst->thisptr);
+        rcode = (*meth->method)(clientData,interp,objc,objv);
+        objv[1] = oldarg;
+        Tcl_DecrRefCount(inst->thisptr);
+        return rcode;
+      }
+      meth++;
+    }
+    /* Check class methods for a match */
+    if (strcmp(method,"cget") == 0) {
+      if (objc < 3) {
+        Tcl_SetResult(interp, (char *) "wrong # args.", TCL_STATIC);
+        return TCL_ERROR;
+      }
+      attrname = Tcl_GetStringFromObj(objv[2],NULL);
+      attr = cls->attributes;
+      while (attr && attr->name) {
+        if ((strcmp(attr->name, attrname) == 0) && (attr->getmethod)) {
+          oldarg = objv[1];
+          objv[1] = inst->thisptr;
+          Tcl_IncrRefCount(inst->thisptr);
+          rcode = (*attr->getmethod)(clientData,interp,2, objv);
+          objv[1] = oldarg;
+          Tcl_DecrRefCount(inst->thisptr);
+          return rcode;
+        }
+        attr++;
+      }
+      if (strcmp(attrname, "-this") == 0) {
+        Tcl_SetObjResult(interp, Tcl_DuplicateObj(inst->thisptr));
+        return TCL_OK;
+      }
+      if (strcmp(attrname, "-thisown") == 0) {
+        if (SWIG_Thisown(inst->thisvalue)) {
+          Tcl_SetResult(interp,(char*)"1",TCL_STATIC);
+        } else {
+          Tcl_SetResult(interp,(char*)"0",TCL_STATIC);
+        }
+        return TCL_OK;
+      }
+    } else if (strcmp(method, "configure") == 0) {
+      int i;
+      if (objc < 4) {
+        Tcl_SetResult(interp, (char *) "wrong # args.", TCL_STATIC);
+        return TCL_ERROR;
+      }
+      i = 2;
+      while (i < objc) {
+        attrname = Tcl_GetStringFromObj(objv[i],NULL);
+        attr = cls->attributes;
+        while (attr && attr->name) {
+          if ((strcmp(attr->name, attrname) == 0) && (attr->setmethod)) {
+            oldarg = objv[i];
+            objv[i] = inst->thisptr;
+            Tcl_IncrRefCount(inst->thisptr);
+            rcode = (*attr->setmethod)(clientData,interp,3, &objv[i-1]);
+            objv[i] = oldarg;
+            Tcl_DecrRefCount(inst->thisptr);
+            if (rcode != TCL_OK) return rcode;
+            numconf += 2;
+          }
+          attr++;
+        }
+        i+=2;
+      }
+    }
+  }
+  if (strcmp(method,"configure") == 0) {
+    if (numconf >= objc) {
+      return TCL_OK;
+    } else {
+      Tcl_SetResult(interp,(char *) "Invalid attribute name.", TCL_STATIC);
+      return TCL_ERROR;
+    }
+  }
+  if (strcmp(method,"cget") == 0) {
+    Tcl_SetResult(interp,(char *) "Invalid attribute name.", TCL_STATIC);
+    return TCL_ERROR;
+  }
+  Tcl_SetResult(interp, (char *) "Invalid method. Must be one of: configure cget -acquire -disown -delete", TCL_STATIC);
+  cls = inst->classptr;
+  bi = 0;
+  while (cls) {
+    meth = cls->methods;
+    while (meth && meth->name) {
+      char *cr = (char *) Tcl_GetStringResult(interp);
+      size_t meth_len = strlen(meth->name);
+      char* where = strchr(cr,':');
+      while(where) {
+        where = strstr(where, meth->name);
+        if(where) {
+          if(where[-1] == ' ' && (where[meth_len] == ' ' || where[meth_len]==0)) {
+            break;
+          } else {
+            where++;
+          }
+        }
+      }
+
+      if (!where)
+        Tcl_AppendElement(interp, (char *) meth->name);
+      meth++;
+    }
+    cls = inst->classptr->bases[bi++];
+  }
+  return TCL_ERROR;
+}
+
+/* This function takes the current result and turns it into an object command */
+SWIGRUNTIME Tcl_Obj *
+SWIG_Tcl_NewInstanceObj(Tcl_Interp *interp, void *thisvalue, swig_type_info *type, int flags) {
+  Tcl_Obj *robj = SWIG_NewPointerObj(thisvalue, type,0);
+  /* Check to see if this pointer belongs to a class or not */
+  if ((type->clientdata) && (interp)) {
+    Tcl_CmdInfo    ci;
+    char          *name;
+    name = Tcl_GetStringFromObj(robj,NULL);
+    if (!Tcl_GetCommandInfo(interp,name, &ci) || (flags)) {
+      swig_instance *newinst = (swig_instance *) malloc(sizeof(swig_instance));
+      newinst->thisptr = Tcl_DuplicateObj(robj);
+      Tcl_IncrRefCount(newinst->thisptr);
+      newinst->thisvalue = thisvalue;
+      newinst->classptr = (swig_class *) type->clientdata;
+      newinst->destroy = flags;
+      newinst->cmdtok = Tcl_CreateObjCommand(interp, Tcl_GetStringFromObj(robj,NULL), (swig_wrapper_func) SWIG_MethodCommand, (ClientData) newinst, (swig_delete_func) SWIG_ObjectDelete);
+      if (flags) {
+        SWIG_Acquire(thisvalue);
+      }
+    }
+  }
+  return robj;
+}
+
+/* Function to create objects */
+SWIGRUNTIME int
+SWIG_Tcl_ObjectConstructor(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  Tcl_Obj          *newObj = 0;
+  void             *thisvalue = 0;
+  swig_instance   *newinst = 0;
+  swig_class      *classptr = (swig_class *) clientData;
+  swig_wrapper     cons = 0;
+  char             *name = 0;
+  int               firstarg = 0;
+  int               thisarg = 0;
+  int               destroy = 1;
+
+  if (!classptr) {
+    Tcl_SetResult(interp, (char *) "swig: internal runtime error. No class object defined.", TCL_STATIC);
+    return TCL_ERROR;
+  }
+  cons = classptr->constructor;
+  if (objc > 1) {
+    char *s = Tcl_GetStringFromObj(objv[1],NULL);
+    if (strcmp(s,"-this") == 0) {
+      thisarg = 2;
+      cons = 0;
+    } else if (strcmp(s,"-args") == 0) {
+      firstarg = 1;
+    } else if (objc == 2) {
+      firstarg = 1;
+      name = s;
+    } else if (objc >= 3) {
+      char *s1;
+      name = s;
+      s1 = Tcl_GetStringFromObj(objv[2],NULL);
+      if (strcmp(s1,"-this") == 0) {
+	thisarg = 3;
+	cons = 0;
+      } else {
+	firstarg = 1;
+      }
+    }
+  }
+  if (cons) {
+    int result;
+    result = (*cons)(0, interp, objc-firstarg, &objv[firstarg]);
+    if (result != TCL_OK) {
+      return result;
+    }
+    newObj = Tcl_DuplicateObj(Tcl_GetObjResult(interp));
+    if (!name) name = Tcl_GetStringFromObj(newObj,NULL);
+  } else if (thisarg > 0) {
+    if (thisarg < objc) {
+      destroy = 0;
+      newObj = Tcl_DuplicateObj(objv[thisarg]);
+      if (!name) name = Tcl_GetStringFromObj(newObj,NULL);
+    } else {
+      Tcl_SetResult(interp, (char *) "wrong # args.", TCL_STATIC);
+      return TCL_ERROR;
+    }
+  } else {
+    Tcl_SetResult(interp, (char *) "No constructor available.", TCL_STATIC);
+    return TCL_ERROR;
+  }
+  if (SWIG_Tcl_ConvertPtr(interp,newObj, (void **) &thisvalue, *(classptr->type), 0) != SWIG_OK) {
+    Tcl_DecrRefCount(newObj);
+    return TCL_ERROR;
+  }
+  newinst = (swig_instance *) malloc(sizeof(swig_instance));
+  newinst->thisptr = newObj;
+  Tcl_IncrRefCount(newObj);
+  newinst->thisvalue = thisvalue;
+  newinst->classptr = classptr;
+  newinst->destroy = destroy;
+  if (destroy) {
+    SWIG_Acquire(thisvalue);
+  }
+  newinst->cmdtok = Tcl_CreateObjCommand(interp,name, (swig_wrapper) SWIG_MethodCommand, (ClientData) newinst, (swig_delete_func) SWIG_ObjectDelete);
+  return TCL_OK;
+}
+
+/* -----------------------------------------------------------------------------*
+ *   Get arguments 
+ * -----------------------------------------------------------------------------*/
+SWIGRUNTIME int
+SWIG_Tcl_GetArgs(Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[], const char *fmt, ...) {
+  int        argno = 0, opt = 0;
+  long       tempi;
+  double     tempd;
+  const char *c;
+  va_list    ap;
+  void      *vptr;
+  Tcl_Obj   *obj = 0;
+  swig_type_info *ty;
+
+  va_start(ap,fmt);
+  for (c = fmt; (*c && (*c != ':') && (*c != ';')); c++,argno++) {
+    if (*c == '|') {
+      opt = 1;
+      c++;
+    }
+    if (argno >= (objc-1)) {
+      if (!opt) {
+        Tcl_SetResult(interp, (char *) "Wrong number of arguments ", TCL_STATIC);
+        goto argerror;
+      } else {
+        va_end(ap);
+        return TCL_OK;
+      }
+    }
+
+    vptr = va_arg(ap,void *);
+    if (vptr) {
+      if (isupper(*c)) {
+        obj = SWIG_Tcl_GetConstantObj(Tcl_GetStringFromObj(objv[argno+1],0));
+        if (!obj) obj = objv[argno+1];
+      } else {
+        obj = objv[argno+1];
+      }
+      switch(*c) {
+      case 'i': case 'I':
+      case 'l': case 'L':
+      case 'h': case 'H':
+      case 'b': case 'B':
+        if (Tcl_GetLongFromObj(interp,obj,&tempi) != TCL_OK) goto argerror;
+        if ((*c == 'i') || (*c == 'I')) *((int *)vptr) = (int)tempi;
+        else if ((*c == 'l') || (*c == 'L')) *((long *)vptr) = (long)tempi;
+        else if ((*c == 'h') || (*c == 'H')) *((short*)vptr) = (short)tempi;
+        else if ((*c == 'b') || (*c == 'B')) *((unsigned char *)vptr) = (unsigned char)tempi;
+        break;
+      case 'f': case 'F':
+      case 'd': case 'D':
+        if (Tcl_GetDoubleFromObj(interp,obj,&tempd) != TCL_OK) goto argerror;
+        if ((*c == 'f') || (*c == 'F')) *((float *) vptr) = (float)tempd;
+        else if ((*c == 'd') || (*c == 'D')) *((double*) vptr) = tempd;
+        break;
+      case 's': case 'S':
+        if (*(c+1) == '#') {
+          int *vlptr = (int *) va_arg(ap, void *);
+          *((char **) vptr) = Tcl_GetStringFromObj(obj, vlptr);
+          c++;
+        } else {
+          *((char **)vptr) = Tcl_GetStringFromObj(obj,NULL);
+        }
+        break;
+      case 'c': case 'C':
+        *((char *)vptr) = *(Tcl_GetStringFromObj(obj,NULL));
+        break;
+      case 'p': case 'P':
+        ty = (swig_type_info *) va_arg(ap, void *);
+        if (SWIG_Tcl_ConvertPtr(interp, obj, (void **) vptr, ty, 0) != SWIG_OK) goto argerror;
+        break;
+      case 'o': case 'O':
+        *((Tcl_Obj **)vptr) = objv[argno+1];
+        break;
+      default:
+        break;
+      }
+    }
+  }
+
+  if ((*c != ';') && ((objc-1) > argno)) {
+    Tcl_SetResult(interp, (char *) "Wrong # args.", TCL_STATIC);
+    goto argerror;
+  }
+  va_end(ap);
+  return TCL_OK;
+
+ argerror:
+  {
+    char temp[32];
+    sprintf(temp,"%d", argno+1);
+    c = strchr(fmt,':');
+    if (!c) c = strchr(fmt,';');
+    if (!c) c = (char *)"";
+    Tcl_AppendResult(interp,c," argument ", temp, NULL);
+    va_end(ap);
+    return TCL_ERROR;
+  }
+}
+
+#ifdef __cplusplus
+#if 0
+{ /* cc-mode */
+#endif
+}
+#endif
+
+
+
+#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
+
+#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
+
+
+
+/* -------- TYPES TABLE (BEGIN) -------- */
+
+#define SWIGTYPE_p_ESLconnection swig_types[0]
+#define SWIGTYPE_p_ESLevent swig_types[1]
+#define SWIGTYPE_p_char swig_types[2]
+#define SWIGTYPE_p_esl_event_t swig_types[3]
+#define SWIGTYPE_p_esl_priority_t swig_types[4]
+static swig_type_info *swig_types[6];
+static swig_module_info swig_module = {swig_types, 5, 0, 0, 0, 0};
+#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
+#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
+
+/* -------- TYPES TABLE (END) -------- */
+
+#define SWIG_init    Esl_Init
+#define SWIG_name    "esl"
+#define SWIG_prefix  ""
+#define SWIG_version "0.0"
+
+#define SWIGVERSION 0x010335 
+#define SWIG_VERSION SWIGVERSION
+
+
+#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a)) 
+#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a)) 
+
+
+#include <stdexcept>
+
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+#ifdef MAC_TCL
+#pragma export on
+#endif
+SWIGEXPORT int SWIG_init(Tcl_Interp *);
+#ifdef MAC_TCL
+#pragma export off
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+
+
+#include "esl.h"
+#include "esl_oop.h"
+
+
+SWIGINTERN int
+SWIG_AsCharPtrAndSize(Tcl_Obj *obj, char** cptr, size_t* psize, int *alloc)
+{ 
+  int len = 0;
+  char *cstr = Tcl_GetStringFromObj(obj, &len);
+  if (cstr) {
+    if (cptr)  *cptr = cstr;
+    if (psize) *psize = len + 1;
+    if (alloc) *alloc = SWIG_OLDOBJ;
+    return SWIG_OK;
+  }
+  return SWIG_TypeError;
+}
+
+
+
+
+
+#include <limits.h>
+#if !defined(SWIG_NO_LLONG_MAX)
+# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
+#   define LLONG_MAX __LONG_LONG_MAX__
+#   define LLONG_MIN (-LLONG_MAX - 1LL)
+#   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
+# endif
+#endif
+
+
+SWIGINTERNINLINE Tcl_Obj *
+SWIG_FromCharPtrAndSize(const char* carray, size_t size)
+{
+  return (size < INT_MAX) ? Tcl_NewStringObj(carray, static_cast< int >(size)) : NULL;
+}
+
+
+SWIGINTERNINLINE Tcl_Obj * 
+SWIG_FromCharPtr(const char *cptr)
+{ 
+  return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_long SWIG_TCL_DECL_ARGS_2(Tcl_Obj *obj, long* val)
+{
+  long v;
+  if (Tcl_GetLongFromObj(0,obj, &v) == TCL_OK) {
+    if (val) *val = (long) v;
+    return SWIG_OK;
+  }
+  return SWIG_TypeError;
+}
+
+
+SWIGINTERN int
+SWIG_AsVal_int SWIG_TCL_DECL_ARGS_2(Tcl_Obj * obj, int *val)
+{
+  long v;
+  int res = SWIG_AsVal_long SWIG_TCL_CALL_ARGS_2(obj, &v);
+  if (SWIG_IsOK(res)) {
+    if ((v < INT_MIN || v > INT_MAX)) {
+      return SWIG_OverflowError;
+    } else {
+      if (val) *val = static_cast< int >(v);
+    }
+  }  
+  return res;
+}
+
+
+SWIGINTERNINLINE Tcl_Obj* 
+SWIG_From_long  (long value)
+{
+  if (((long) INT_MIN <= value) && (value <= (long) INT_MAX)) {
+    return Tcl_NewIntObj(static_cast< int >(value));
+  } else {
+    return Tcl_NewLongObj(value);
+  }
+}
+
+
+SWIGINTERNINLINE Tcl_Obj *
+SWIG_From_int  (int value)
+{    
+  return SWIG_From_long  (value);
+}
+
+
+  #define SWIG_From_bool   Tcl_NewBooleanObj 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+SWIGINTERN int
+_wrap_ESLevent_event_set(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  esl_event_t *arg2 = (esl_event_t *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"oo:ESLevent_event_set self event ",(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_event_set" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  res2 = SWIG_ConvertPtr(objv[2], &argp2,SWIGTYPE_p_esl_event_t, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_event_set" "', argument " "2"" of type '" "esl_event_t *""'"); 
+  }
+  arg2 = reinterpret_cast< esl_event_t * >(argp2);
+  if (arg1) (arg1)->event = arg2;
+  
+  
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLevent_event_get(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  esl_event_t *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"o:ESLevent_event_get self ",(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_event_get" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (esl_event_t *) ((arg1)->event);
+  Tcl_SetObjResult(interp, SWIG_NewInstanceObj( SWIG_as_voidptr(result), SWIGTYPE_p_esl_event_t,0));
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLevent_serialized_string_set(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"oo:ESLevent_serialized_string_set self serialized_string ",(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_serialized_string_set" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(objv[2], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_serialized_string_set" "', argument " "2"" of type '" "char *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (arg1->serialized_string) delete[] arg1->serialized_string;
+  if (arg2) {
+    size_t size = strlen(reinterpret_cast< const char * >(arg2)) + 1;
+    arg1->serialized_string = (char *)reinterpret_cast< char* >(memcpy((new char[size]), reinterpret_cast< const char * >(arg2), sizeof(char)*(size)));
+  } else {
+    arg1->serialized_string = 0;
+  }
+  
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return TCL_OK;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLevent_serialized_string_get(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"o:ESLevent_serialized_string_get self ",(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_serialized_string_get" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (char *) ((arg1)->serialized_string);
+  Tcl_SetObjResult(interp,SWIG_FromCharPtr((const char *)result));
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLevent_mine_set(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  int arg2 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"oo:ESLevent_mine_set self mine ",(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_mine_set" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  ecode2 = SWIG_AsVal_int SWIG_TCL_CALL_ARGS_2(objv[2], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ESLevent_mine_set" "', argument " "2"" of type '" "int""'");
+  } 
+  arg2 = static_cast< int >(val2);
+  if (arg1) (arg1)->mine = arg2;
+  
+  
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLevent_mine_get(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"o:ESLevent_mine_get self ",(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_mine_get" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (int) ((arg1)->mine);
+  Tcl_SetObjResult(interp,SWIG_From_int(static_cast< int >(result)));
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_new_ESLevent__SWIG_0(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  int res1 ;
+  char *buf1 = 0 ;
+  int alloc1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"o|o:new_ESLevent type ?subclass_name? ",(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_AsCharPtrAndSize(objv[1], &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLevent" "', argument " "1"" of type '" "char const *""'");
+  }
+  arg1 = reinterpret_cast< char * >(buf1);
+  if (objc > 2) {
+    res2 = SWIG_AsCharPtrAndSize(objv[2], &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLevent" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+  }
+  result = (ESLevent *)new ESLevent((char const *)arg1,(char const *)arg2);
+  Tcl_SetObjResult(interp, SWIG_NewInstanceObj( SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent,0));
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return TCL_OK;
+fail:
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_new_ESLevent__SWIG_1(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  esl_event_t *arg1 = (esl_event_t *) 0 ;
+  int arg2 = (int) 0 ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"o|o:new_ESLevent wrap_me ?free_me? ",(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_esl_event_t, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLevent" "', argument " "1"" of type '" "esl_event_t *""'"); 
+  }
+  arg1 = reinterpret_cast< esl_event_t * >(argp1);
+  if (objc > 2) {
+    ecode2 = SWIG_AsVal_int SWIG_TCL_CALL_ARGS_2(objv[2], &val2);
+    if (!SWIG_IsOK(ecode2)) {
+      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_ESLevent" "', argument " "2"" of type '" "int""'");
+    } 
+    arg2 = static_cast< int >(val2);
+  }
+  result = (ESLevent *)new ESLevent(arg1,arg2);
+  Tcl_SetObjResult(interp, SWIG_NewInstanceObj( SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent,0));
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_new_ESLevent__SWIG_2(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"o:new_ESLevent me ",(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLevent" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (ESLevent *)new ESLevent(arg1);
+  Tcl_SetObjResult(interp, SWIG_NewInstanceObj( SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent,0));
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_new_ESLevent(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  Tcl_Obj *CONST *argv = objv+1;
+  int argc = objc-1;
+  if ((argc >= 1) && (argc <= 2)) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_esl_event_t, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      if (argc <= 1) {
+        return _wrap_new_ESLevent__SWIG_1(clientData, interp, objc, argv - 1);
+      }
+      {
+        int res = SWIG_AsVal_int SWIG_TCL_CALL_ARGS_2(argv[1], NULL);
+        _v = SWIG_CheckState(res);
+      }
+      if (_v) {
+        return _wrap_new_ESLevent__SWIG_1(clientData, interp, objc, argv - 1);
+      }
+    }
+  }
+  if (argc == 1) {
+    int _v;
+    void *vptr = 0;
+    int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_ESLevent, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      return _wrap_new_ESLevent__SWIG_2(clientData, interp, objc, argv - 1);
+    }
+  }
+  if ((argc >= 1) && (argc <= 2)) {
+    int _v;
+    int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      if (argc <= 1) {
+        return _wrap_new_ESLevent__SWIG_0(clientData, interp, objc, argv - 1);
+      }
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        return _wrap_new_ESLevent__SWIG_0(clientData, interp, objc, argv - 1);
+      }
+    }
+  }
+  
+  Tcl_SetResult(interp,(char *) "No matching function for overloaded 'new_ESLevent'", TCL_STATIC);
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_delete_ESLevent(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"o:delete_ESLevent self ",(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLevent, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ESLevent" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  delete arg1;
+  
+  
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLevent_serialize(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) NULL ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"o|o:ESLevent_serialize self ?format? ",(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_serialize" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  if (objc > 2) {
+    res2 = SWIG_AsCharPtrAndSize(objv[2], &buf2, NULL, &alloc2);
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_serialize" "', argument " "2"" of type '" "char const *""'");
+    }
+    arg2 = reinterpret_cast< char * >(buf2);
+  }
+  result = (char *)(arg1)->serialize((char const *)arg2);
+  Tcl_SetObjResult(interp,SWIG_FromCharPtr((const char *)result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return TCL_OK;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLevent_setPriority(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  esl_priority_t arg2 = (esl_priority_t) ESL_PRIORITY_NORMAL ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 ;
+  int res2 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"o|o:ESLevent_setPriority self ?priority? ",(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_setPriority" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  if (objc > 2) {
+    {
+      res2 = SWIG_ConvertPtr(objv[2], &argp2, SWIGTYPE_p_esl_priority_t,  0 );
+      if (!SWIG_IsOK(res2)) {
+        SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_setPriority" "', argument " "2"" of type '" "esl_priority_t""'"); 
+      }  
+      if (!argp2) {
+        SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "ESLevent_setPriority" "', argument " "2"" of type '" "esl_priority_t""'");
+      } else {
+        arg2 = *(reinterpret_cast< esl_priority_t * >(argp2));
+      }
+    }
+  }
+  result = (bool)(arg1)->setPriority(arg2);
+  Tcl_SetObjResult(interp,SWIG_From_bool(static_cast< bool >(result)));
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLevent_getHeader(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"oo:ESLevent_getHeader self header_name ",(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_getHeader" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(objv[2], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_getHeader" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (char *)(arg1)->getHeader((char const *)arg2);
+  Tcl_SetObjResult(interp,SWIG_FromCharPtr((const char *)result));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return TCL_OK;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLevent_getBody(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"o:ESLevent_getBody self ",(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_getBody" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (char *)(arg1)->getBody();
+  Tcl_SetObjResult(interp,SWIG_FromCharPtr((const char *)result));
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLevent_getType(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"o:ESLevent_getType self ",(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_getType" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (char *)(arg1)->getType();
+  Tcl_SetObjResult(interp,SWIG_FromCharPtr((const char *)result));
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLevent_addBody(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"oo:ESLevent_addBody self value ",(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_addBody" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(objv[2], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_addBody" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (bool)(arg1)->addBody((char const *)arg2);
+  Tcl_SetObjResult(interp,SWIG_From_bool(static_cast< bool >(result)));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return TCL_OK;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLevent_addHeader(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"ooo:ESLevent_addHeader self header_name value ",(void *)0,(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_addHeader" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(objv[2], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_addHeader" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(objv[3], &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLevent_addHeader" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
+  Tcl_SetObjResult(interp,SWIG_From_bool(static_cast< bool >(result)));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return TCL_OK;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLevent_delHeader(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *arg2 = (char *) 0 ;
+  bool result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"oo:ESLevent_delHeader self header_name ",(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_delHeader" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(objv[2], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLevent_delHeader" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (bool)(arg1)->delHeader((char const *)arg2);
+  Tcl_SetObjResult(interp,SWIG_From_bool(static_cast< bool >(result)));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return TCL_OK;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLevent_firstHeader(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"o:ESLevent_firstHeader self ",(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_firstHeader" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (char *)(arg1)->firstHeader();
+  Tcl_SetObjResult(interp,SWIG_FromCharPtr((const char *)result));
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLevent_nextHeader(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLevent *arg1 = (ESLevent *) 0 ;
+  char *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"o:ESLevent_nextHeader self ",(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLevent_nextHeader" "', argument " "1"" of type '" "ESLevent *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLevent * >(argp1);
+  result = (char *)(arg1)->nextHeader();
+  Tcl_SetObjResult(interp,SWIG_FromCharPtr((const char *)result));
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN void swig_delete_ESLevent(void *obj) {
+ESLevent *arg1 = (ESLevent *) obj;
+delete arg1;
+}
+static swig_method swig_ESLevent_methods[] = {
+    {"serialize", _wrap_ESLevent_serialize}, 
+    {"setPriority", _wrap_ESLevent_setPriority}, 
+    {"getHeader", _wrap_ESLevent_getHeader}, 
+    {"getBody", _wrap_ESLevent_getBody}, 
+    {"getType", _wrap_ESLevent_getType}, 
+    {"addBody", _wrap_ESLevent_addBody}, 
+    {"addHeader", _wrap_ESLevent_addHeader}, 
+    {"delHeader", _wrap_ESLevent_delHeader}, 
+    {"firstHeader", _wrap_ESLevent_firstHeader}, 
+    {"nextHeader", _wrap_ESLevent_nextHeader}, 
+    {0,0}
+};
+static swig_attribute swig_ESLevent_attributes[] = {
+    { "-event",_wrap_ESLevent_event_get, _wrap_ESLevent_event_set},
+    { "-serialized_string",_wrap_ESLevent_serialized_string_get, _wrap_ESLevent_serialized_string_set},
+    { "-mine",_wrap_ESLevent_mine_get, _wrap_ESLevent_mine_set},
+    {0,0,0}
+};
+static swig_class *swig_ESLevent_bases[] = {0};
+static const char * swig_ESLevent_base_names[] = {0};
+static swig_class _wrap_class_ESLevent = { "ESLevent", &SWIGTYPE_p_ESLevent,_wrap_new_ESLevent, swig_delete_ESLevent, swig_ESLevent_methods, swig_ESLevent_attributes, swig_ESLevent_bases,swig_ESLevent_base_names, &swig_module };
+SWIGINTERN int
+_wrap_new_ESLconnection__SWIG_0(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  ESLconnection *result = 0 ;
+  int res1 ;
+  char *buf1 = 0 ;
+  int alloc1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  int res4 ;
+  char *buf4 = 0 ;
+  int alloc4 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"oooo:new_ESLconnection host port user password ",(void *)0,(void *)0,(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_AsCharPtrAndSize(objv[1], &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "char const *""'");
+  }
+  arg1 = reinterpret_cast< char * >(buf1);
+  res2 = SWIG_AsCharPtrAndSize(objv[2], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLconnection" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(objv[3], &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_ESLconnection" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  res4 = SWIG_AsCharPtrAndSize(objv[4], &buf4, NULL, &alloc4);
+  if (!SWIG_IsOK(res4)) {
+    SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "new_ESLconnection" "', argument " "4"" of type '" "char const *""'");
+  }
+  arg4 = reinterpret_cast< char * >(buf4);
+  result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
+  Tcl_SetObjResult(interp, SWIG_NewInstanceObj( SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection,0));
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return TCL_OK;
+fail:
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_new_ESLconnection__SWIG_1(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  ESLconnection *result = 0 ;
+  int res1 ;
+  char *buf1 = 0 ;
+  int alloc1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"ooo:new_ESLconnection host port password ",(void *)0,(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_AsCharPtrAndSize(objv[1], &buf1, NULL, &alloc1);
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "char const *""'");
+  }
+  arg1 = reinterpret_cast< char * >(buf1);
+  res2 = SWIG_AsCharPtrAndSize(objv[2], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_ESLconnection" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(objv[3], &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "new_ESLconnection" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  result = (ESLconnection *)new ESLconnection((char const *)arg1,(char const *)arg2,(char const *)arg3);
+  Tcl_SetObjResult(interp, SWIG_NewInstanceObj( SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection,0));
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return TCL_OK;
+fail:
+  if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_new_ESLconnection__SWIG_2(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  int arg1 ;
+  ESLconnection *result = 0 ;
+  int val1 ;
+  int ecode1 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"o:new_ESLconnection socket ",(void *)0) == TCL_ERROR) SWIG_fail;
+  ecode1 = SWIG_AsVal_int SWIG_TCL_CALL_ARGS_2(objv[1], &val1);
+  if (!SWIG_IsOK(ecode1)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_ESLconnection" "', argument " "1"" of type '" "int""'");
+  } 
+  arg1 = static_cast< int >(val1);
+  result = (ESLconnection *)new ESLconnection(arg1);
+  Tcl_SetObjResult(interp, SWIG_NewInstanceObj( SWIG_as_voidptr(result), SWIGTYPE_p_ESLconnection,0));
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_new_ESLconnection(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  Tcl_Obj *CONST *argv = objv+1;
+  int argc = objc-1;
+  if (argc == 1) {
+    int _v;
+    {
+      int res = SWIG_AsVal_int SWIG_TCL_CALL_ARGS_2(argv[0], NULL);
+      _v = SWIG_CheckState(res);
+    }
+    if (_v) {
+      return _wrap_new_ESLconnection__SWIG_2(clientData, interp, objc, argv - 1);
+    }
+  }
+  if (argc == 3) {
+    int _v;
+    int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+        if (_v) {
+          return _wrap_new_ESLconnection__SWIG_1(clientData, interp, objc, argv - 1);
+        }
+      }
+    }
+  }
+  if (argc == 4) {
+    int _v;
+    int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
+    _v = SWIG_CheckState(res);
+    if (_v) {
+      int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
+      _v = SWIG_CheckState(res);
+      if (_v) {
+        int res = SWIG_AsCharPtrAndSize(argv[2], 0, NULL, 0);
+        _v = SWIG_CheckState(res);
+        if (_v) {
+          int res = SWIG_AsCharPtrAndSize(argv[3], 0, NULL, 0);
+          _v = SWIG_CheckState(res);
+          if (_v) {
+            return _wrap_new_ESLconnection__SWIG_0(clientData, interp, objc, argv - 1);
+          }
+        }
+      }
+    }
+  }
+  
+  Tcl_SetResult(interp,(char *) "No matching function for overloaded 'new_ESLconnection'", TCL_STATIC);
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_delete_ESLconnection(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"o:delete_ESLconnection self ",(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLconnection, SWIG_POINTER_DISOWN |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_ESLconnection" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  delete arg1;
+  
+  
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLconnection_socketDescriptor(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"o:ESLconnection_socketDescriptor self ",(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_socketDescriptor" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  result = (int)(arg1)->socketDescriptor();
+  Tcl_SetObjResult(interp,SWIG_From_int(static_cast< int >(result)));
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLconnection_connected(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"o:ESLconnection_connected self ",(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_connected" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  result = (int)(arg1)->connected();
+  Tcl_SetObjResult(interp,SWIG_From_int(static_cast< int >(result)));
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLconnection_getInfo(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"o:ESLconnection_getInfo self ",(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_getInfo" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  result = (ESLevent *)(arg1)->getInfo();
+  Tcl_SetObjResult(interp, SWIG_NewInstanceObj( SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent,0));
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLconnection_send(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"oo:ESLconnection_send self cmd ",(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_send" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(objv[2], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_send" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (int)(arg1)->send((char const *)arg2);
+  Tcl_SetObjResult(interp,SWIG_From_int(static_cast< int >(result)));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return TCL_OK;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLconnection_sendRecv(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"oo:ESLconnection_sendRecv self cmd ",(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_sendRecv" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(objv[2], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_sendRecv" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (ESLevent *)(arg1)->sendRecv((char const *)arg2);
+  Tcl_SetObjResult(interp, SWIG_NewInstanceObj( SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent,0));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return TCL_OK;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLconnection_api(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"oo|o:ESLconnection_api self cmd ?arg? ",(void *)0,(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_api" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(objv[2], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_api" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (objc > 3) {
+    res3 = SWIG_AsCharPtrAndSize(objv[3], &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_api" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+  }
+  result = (ESLevent *)(arg1)->api((char const *)arg2,(char const *)arg3);
+  Tcl_SetObjResult(interp, SWIG_NewInstanceObj( SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent,0));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return TCL_OK;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLconnection_bgapi(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"oo|o:ESLconnection_bgapi self cmd ?arg? ",(void *)0,(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_bgapi" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(objv[2], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_bgapi" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (objc > 3) {
+    res3 = SWIG_AsCharPtrAndSize(objv[3], &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_bgapi" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+  }
+  result = (ESLevent *)(arg1)->bgapi((char const *)arg2,(char const *)arg3);
+  Tcl_SetObjResult(interp, SWIG_NewInstanceObj( SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent,0));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return TCL_OK;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLconnection_sendEvent(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  ESLevent *arg2 = (ESLevent *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"oo:ESLconnection_sendEvent self send_me ",(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_sendEvent" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_ConvertPtr(objv[2], &argp2,SWIGTYPE_p_ESLevent, 0 |  0 );
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_sendEvent" "', argument " "2"" of type '" "ESLevent *""'"); 
+  }
+  arg2 = reinterpret_cast< ESLevent * >(argp2);
+  result = (int)(arg1)->sendEvent(arg2);
+  Tcl_SetObjResult(interp,SWIG_From_int(static_cast< int >(result)));
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLconnection_recvEvent(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"o:ESLconnection_recvEvent self ",(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_recvEvent" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  result = (ESLevent *)(arg1)->recvEvent();
+  Tcl_SetObjResult(interp, SWIG_NewInstanceObj( SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent,0));
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLconnection_recvEventTimed(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int arg2 ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int val2 ;
+  int ecode2 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"oo:ESLconnection_recvEventTimed self ms ",(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_recvEventTimed" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  ecode2 = SWIG_AsVal_int SWIG_TCL_CALL_ARGS_2(objv[2], &val2);
+  if (!SWIG_IsOK(ecode2)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "ESLconnection_recvEventTimed" "', argument " "2"" of type '" "int""'");
+  } 
+  arg2 = static_cast< int >(val2);
+  result = (ESLevent *)(arg1)->recvEventTimed(arg2);
+  Tcl_SetObjResult(interp, SWIG_NewInstanceObj( SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent,0));
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLconnection_filter(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"ooo:ESLconnection_filter self header value ",(void *)0,(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_filter" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(objv[2], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_filter" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(objv[3], &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_filter" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  result = (ESLevent *)(arg1)->filter((char const *)arg2,(char const *)arg3);
+  Tcl_SetObjResult(interp, SWIG_NewInstanceObj( SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent,0));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return TCL_OK;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLconnection_events(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"ooo:ESLconnection_events self etype value ",(void *)0,(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_events" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(objv[2], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_events" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  res3 = SWIG_AsCharPtrAndSize(objv[3], &buf3, NULL, &alloc3);
+  if (!SWIG_IsOK(res3)) {
+    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_events" "', argument " "3"" of type '" "char const *""'");
+  }
+  arg3 = reinterpret_cast< char * >(buf3);
+  result = (int)(arg1)->events((char const *)arg2,(char const *)arg3);
+  Tcl_SetObjResult(interp,SWIG_From_int(static_cast< int >(result)));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return TCL_OK;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLconnection_execute(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  char *arg4 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  int res4 ;
+  char *buf4 = 0 ;
+  int alloc4 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"oo|oo:ESLconnection_execute self app ?arg? ?uuid? ",(void *)0,(void *)0,(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_execute" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(objv[2], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_execute" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (objc > 3) {
+    res3 = SWIG_AsCharPtrAndSize(objv[3], &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_execute" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+  }
+  if (objc > 4) {
+    res4 = SWIG_AsCharPtrAndSize(objv[4], &buf4, NULL, &alloc4);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ESLconnection_execute" "', argument " "4"" of type '" "char const *""'");
+    }
+    arg4 = reinterpret_cast< char * >(buf4);
+  }
+  result = (ESLevent *)(arg1)->execute((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  Tcl_SetObjResult(interp, SWIG_NewInstanceObj( SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent,0));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return TCL_OK;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLconnection_executeAsync(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  char *arg4 = (char *) NULL ;
+  ESLevent *result = 0 ;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  int res4 ;
+  char *buf4 = 0 ;
+  int alloc4 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"oo|oo:ESLconnection_executeAsync self app ?arg? ?uuid? ",(void *)0,(void *)0,(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_executeAsync" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(objv[2], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_executeAsync" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  if (objc > 3) {
+    res3 = SWIG_AsCharPtrAndSize(objv[3], &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "ESLconnection_executeAsync" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = reinterpret_cast< char * >(buf3);
+  }
+  if (objc > 4) {
+    res4 = SWIG_AsCharPtrAndSize(objv[4], &buf4, NULL, &alloc4);
+    if (!SWIG_IsOK(res4)) {
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "ESLconnection_executeAsync" "', argument " "4"" of type '" "char const *""'");
+    }
+    arg4 = reinterpret_cast< char * >(buf4);
+  }
+  result = (ESLevent *)(arg1)->executeAsync((char const *)arg2,(char const *)arg3,(char const *)arg4);
+  Tcl_SetObjResult(interp, SWIG_NewInstanceObj( SWIG_as_voidptr(result), SWIGTYPE_p_ESLevent,0));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return TCL_OK;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  if (alloc3 == SWIG_NEWOBJ) delete[] buf3;
+  if (alloc4 == SWIG_NEWOBJ) delete[] buf4;
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLconnection_setAsyncExecute(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"oo:ESLconnection_setAsyncExecute self val ",(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_setAsyncExecute" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(objv[2], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setAsyncExecute" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (int)(arg1)->setAsyncExecute((char const *)arg2);
+  Tcl_SetObjResult(interp,SWIG_From_int(static_cast< int >(result)));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return TCL_OK;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLconnection_setEventLock(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  int res2 ;
+  char *buf2 = 0 ;
+  int alloc2 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"oo:ESLconnection_setEventLock self val ",(void *)0,(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_setEventLock" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  res2 = SWIG_AsCharPtrAndSize(objv[2], &buf2, NULL, &alloc2);
+  if (!SWIG_IsOK(res2)) {
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "ESLconnection_setEventLock" "', argument " "2"" of type '" "char const *""'");
+  }
+  arg2 = reinterpret_cast< char * >(buf2);
+  result = (int)(arg1)->setEventLock((char const *)arg2);
+  Tcl_SetObjResult(interp,SWIG_From_int(static_cast< int >(result)));
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return TCL_OK;
+fail:
+  if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN int
+_wrap_ESLconnection_disconnect(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  ESLconnection *arg1 = (ESLconnection *) 0 ;
+  int result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"o:ESLconnection_disconnect self ",(void *)0) == TCL_ERROR) SWIG_fail;
+  res1 = SWIG_ConvertPtr(objv[1], &argp1,SWIGTYPE_p_ESLconnection, 0 |  0 );
+  if (!SWIG_IsOK(res1)) {
+    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "ESLconnection_disconnect" "', argument " "1"" of type '" "ESLconnection *""'"); 
+  }
+  arg1 = reinterpret_cast< ESLconnection * >(argp1);
+  result = (int)(arg1)->disconnect();
+  Tcl_SetObjResult(interp,SWIG_From_int(static_cast< int >(result)));
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+SWIGINTERN void swig_delete_ESLconnection(void *obj) {
+ESLconnection *arg1 = (ESLconnection *) obj;
+delete arg1;
+}
+static swig_method swig_ESLconnection_methods[] = {
+    {"socketDescriptor", _wrap_ESLconnection_socketDescriptor}, 
+    {"connected", _wrap_ESLconnection_connected}, 
+    {"getInfo", _wrap_ESLconnection_getInfo}, 
+    {"send", _wrap_ESLconnection_send}, 
+    {"sendRecv", _wrap_ESLconnection_sendRecv}, 
+    {"api", _wrap_ESLconnection_api}, 
+    {"bgapi", _wrap_ESLconnection_bgapi}, 
+    {"sendEvent", _wrap_ESLconnection_sendEvent}, 
+    {"recvEvent", _wrap_ESLconnection_recvEvent}, 
+    {"recvEventTimed", _wrap_ESLconnection_recvEventTimed}, 
+    {"filter", _wrap_ESLconnection_filter}, 
+    {"events", _wrap_ESLconnection_events}, 
+    {"execute", _wrap_ESLconnection_execute}, 
+    {"executeAsync", _wrap_ESLconnection_executeAsync}, 
+    {"setAsyncExecute", _wrap_ESLconnection_setAsyncExecute}, 
+    {"setEventLock", _wrap_ESLconnection_setEventLock}, 
+    {"disconnect", _wrap_ESLconnection_disconnect}, 
+    {0,0}
+};
+static swig_attribute swig_ESLconnection_attributes[] = {
+    {0,0,0}
+};
+static swig_class *swig_ESLconnection_bases[] = {0};
+static const char * swig_ESLconnection_base_names[] = {0};
+static swig_class _wrap_class_ESLconnection = { "ESLconnection", &SWIGTYPE_p_ESLconnection,_wrap_new_ESLconnection, swig_delete_ESLconnection, swig_ESLconnection_methods, swig_ESLconnection_attributes, swig_ESLconnection_bases,swig_ESLconnection_base_names, &swig_module };
+SWIGINTERN int
+_wrap_eslSetLogLevel(ClientData clientData SWIGUNUSED, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
+  int arg1 ;
+  int val1 ;
+  int ecode1 = 0 ;
+  
+  if (SWIG_GetArgs(interp, objc, objv,"o:eslSetLogLevel level ",(void *)0) == TCL_ERROR) SWIG_fail;
+  ecode1 = SWIG_AsVal_int SWIG_TCL_CALL_ARGS_2(objv[1], &val1);
+  if (!SWIG_IsOK(ecode1)) {
+    SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "eslSetLogLevel" "', argument " "1"" of type '" "int""'");
+  } 
+  arg1 = static_cast< int >(val1);
+  eslSetLogLevel(arg1);
+  
+  return TCL_OK;
+fail:
+  return TCL_ERROR;
+}
+
+
+
+static swig_command_info swig_commands[] = {
+    { SWIG_prefix "ESLevent_event_set", (swig_wrapper_func) _wrap_ESLevent_event_set, NULL},
+    { SWIG_prefix "ESLevent_event_get", (swig_wrapper_func) _wrap_ESLevent_event_get, NULL},
+    { SWIG_prefix "ESLevent_serialized_string_set", (swig_wrapper_func) _wrap_ESLevent_serialized_string_set, NULL},
+    { SWIG_prefix "ESLevent_serialized_string_get", (swig_wrapper_func) _wrap_ESLevent_serialized_string_get, NULL},
+    { SWIG_prefix "ESLevent_mine_set", (swig_wrapper_func) _wrap_ESLevent_mine_set, NULL},
+    { SWIG_prefix "ESLevent_mine_get", (swig_wrapper_func) _wrap_ESLevent_mine_get, NULL},
+    { SWIG_prefix "new_ESLevent", (swig_wrapper_func) _wrap_new_ESLevent, NULL},
+    { SWIG_prefix "delete_ESLevent", (swig_wrapper_func) _wrap_delete_ESLevent, NULL},
+    { SWIG_prefix "ESLevent_serialize", (swig_wrapper_func) _wrap_ESLevent_serialize, NULL},
+    { SWIG_prefix "ESLevent_setPriority", (swig_wrapper_func) _wrap_ESLevent_setPriority, NULL},
+    { SWIG_prefix "ESLevent_getHeader", (swig_wrapper_func) _wrap_ESLevent_getHeader, NULL},
+    { SWIG_prefix "ESLevent_getBody", (swig_wrapper_func) _wrap_ESLevent_getBody, NULL},
+    { SWIG_prefix "ESLevent_getType", (swig_wrapper_func) _wrap_ESLevent_getType, NULL},
+    { SWIG_prefix "ESLevent_addBody", (swig_wrapper_func) _wrap_ESLevent_addBody, NULL},
+    { SWIG_prefix "ESLevent_addHeader", (swig_wrapper_func) _wrap_ESLevent_addHeader, NULL},
+    { SWIG_prefix "ESLevent_delHeader", (swig_wrapper_func) _wrap_ESLevent_delHeader, NULL},
+    { SWIG_prefix "ESLevent_firstHeader", (swig_wrapper_func) _wrap_ESLevent_firstHeader, NULL},
+    { SWIG_prefix "ESLevent_nextHeader", (swig_wrapper_func) _wrap_ESLevent_nextHeader, NULL},
+    { SWIG_prefix "ESLevent", (swig_wrapper_func) SWIG_ObjectConstructor, (ClientData)&_wrap_class_ESLevent},
+    { SWIG_prefix "new_ESLconnection", (swig_wrapper_func) _wrap_new_ESLconnection, NULL},
+    { SWIG_prefix "delete_ESLconnection", (swig_wrapper_func) _wrap_delete_ESLconnection, NULL},
+    { SWIG_prefix "ESLconnection_socketDescriptor", (swig_wrapper_func) _wrap_ESLconnection_socketDescriptor, NULL},
+    { SWIG_prefix "ESLconnection_connected", (swig_wrapper_func) _wrap_ESLconnection_connected, NULL},
+    { SWIG_prefix "ESLconnection_getInfo", (swig_wrapper_func) _wrap_ESLconnection_getInfo, NULL},
+    { SWIG_prefix "ESLconnection_send", (swig_wrapper_func) _wrap_ESLconnection_send, NULL},
+    { SWIG_prefix "ESLconnection_sendRecv", (swig_wrapper_func) _wrap_ESLconnection_sendRecv, NULL},
+    { SWIG_prefix "ESLconnection_api", (swig_wrapper_func) _wrap_ESLconnection_api, NULL},
+    { SWIG_prefix "ESLconnection_bgapi", (swig_wrapper_func) _wrap_ESLconnection_bgapi, NULL},
+    { SWIG_prefix "ESLconnection_sendEvent", (swig_wrapper_func) _wrap_ESLconnection_sendEvent, NULL},
+    { SWIG_prefix "ESLconnection_recvEvent", (swig_wrapper_func) _wrap_ESLconnection_recvEvent, NULL},
+    { SWIG_prefix "ESLconnection_recvEventTimed", (swig_wrapper_func) _wrap_ESLconnection_recvEventTimed, NULL},
+    { SWIG_prefix "ESLconnection_filter", (swig_wrapper_func) _wrap_ESLconnection_filter, NULL},
+    { SWIG_prefix "ESLconnection_events", (swig_wrapper_func) _wrap_ESLconnection_events, NULL},
+    { SWIG_prefix "ESLconnection_execute", (swig_wrapper_func) _wrap_ESLconnection_execute, NULL},
+    { SWIG_prefix "ESLconnection_executeAsync", (swig_wrapper_func) _wrap_ESLconnection_executeAsync, NULL},
+    { SWIG_prefix "ESLconnection_setAsyncExecute", (swig_wrapper_func) _wrap_ESLconnection_setAsyncExecute, NULL},
+    { SWIG_prefix "ESLconnection_setEventLock", (swig_wrapper_func) _wrap_ESLconnection_setEventLock, NULL},
+    { SWIG_prefix "ESLconnection_disconnect", (swig_wrapper_func) _wrap_ESLconnection_disconnect, NULL},
+    { SWIG_prefix "ESLconnection", (swig_wrapper_func) SWIG_ObjectConstructor, (ClientData)&_wrap_class_ESLconnection},
+    { SWIG_prefix "eslSetLogLevel", (swig_wrapper_func) _wrap_eslSetLogLevel, NULL},
+    {0, 0, 0}
+};
+
+static swig_var_info swig_variables[] = {
+    {0,0,0,0}
+};
+
+static swig_const_info swig_constants[] = {
+    {0,0,0,0,0,0}
+};
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
+
+static swig_type_info _swigt__p_ESLconnection = {"_p_ESLconnection", "ESLconnection *", 0, 0, (void*)&_wrap_class_ESLconnection, 0};
+static swig_type_info _swigt__p_ESLevent = {"_p_ESLevent", "ESLevent *", 0, 0, (void*)&_wrap_class_ESLevent, 0};
+static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_esl_event_t = {"_p_esl_event_t", "esl_event_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_esl_priority_t = {"_p_esl_priority_t", "esl_priority_t *", 0, 0, (void*)0, 0};
+
+static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_ESLconnection,
+  &_swigt__p_ESLevent,
+  &_swigt__p_char,
+  &_swigt__p_esl_event_t,
+  &_swigt__p_esl_priority_t,
+};
+
+static swig_cast_info _swigc__p_ESLconnection[] = {  {&_swigt__p_ESLconnection, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_ESLevent[] = {  {&_swigt__p_ESLevent, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_esl_event_t[] = {  {&_swigt__p_esl_event_t, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_esl_priority_t[] = {  {&_swigt__p_esl_priority_t, 0, 0, 0},{0, 0, 0, 0}};
+
+static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_ESLconnection,
+  _swigc__p_ESLevent,
+  _swigc__p_char,
+  _swigc__p_esl_event_t,
+  _swigc__p_esl_priority_t,
+};
+
+
+/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
+
+#ifdef __cplusplus
+}
+#endif
+/* -----------------------------------------------------------------------------
+ * Type initialization:
+ * This problem is tough by the requirement that no dynamic 
+ * memory is used. Also, since swig_type_info structures store pointers to 
+ * swig_cast_info structures and swig_cast_info structures store pointers back
+ * to swig_type_info structures, we need some lookup code at initialization. 
+ * The idea is that swig generates all the structures that are needed. 
+ * The runtime then collects these partially filled structures. 
+ * The SWIG_InitializeModule function takes these initial arrays out of 
+ * swig_module, and does all the lookup, filling in the swig_module.types
+ * array with the correct data and linking the correct swig_cast_info
+ * structures together.
+ *
+ * The generated swig_type_info structures are assigned staticly to an initial 
+ * array. We just loop through that array, and handle each type individually.
+ * First we lookup if this type has been already loaded, and if so, use the
+ * loaded structure instead of the generated one. Then we have to fill in the
+ * cast linked list. The cast data is initially stored in something like a
+ * two-dimensional array. Each row corresponds to a type (there are the same
+ * number of rows as there are in the swig_type_initial array). Each entry in
+ * a column is one of the swig_cast_info structures for that type.
+ * The cast_initial array is actually an array of arrays, because each row has
+ * a variable number of columns. So to actually build the cast linked list,
+ * we find the array of casts associated with the type, and loop through it 
+ * adding the casts to the list. The one last trick we need to do is making
+ * sure the type pointer in the swig_cast_info struct is correct.
+ *
+ * First off, we lookup the cast->type name to see if it is already loaded. 
+ * There are three cases to handle:
+ *  1) If the cast->type has already been loaded AND the type we are adding
+ *     casting info to has not been loaded (it is in this module), THEN we
+ *     replace the cast->type pointer with the type pointer that has already
+ *     been loaded.
+ *  2) If BOTH types (the one we are adding casting info to, and the 
+ *     cast->type) are loaded, THEN the cast info has already been loaded by
+ *     the previous module so we just ignore it.
+ *  3) Finally, if cast->type has not already been loaded, then we add that
+ *     swig_cast_info to the linked list (because the cast->type) pointer will
+ *     be correct.
+ * ----------------------------------------------------------------------------- */
+
+#ifdef __cplusplus
+extern "C" {
+#if 0
+} /* c-mode */
+#endif
+#endif
+
+#if 0
+#define SWIGRUNTIME_DEBUG
+#endif
+
+
+SWIGRUNTIME void
+SWIG_InitializeModule(void *clientdata) {
+  size_t i;
+  swig_module_info *module_head, *iter;
+  int found, init;
+  
+  clientdata = clientdata;
+  
+  /* check to see if the circular list has been setup, if not, set it up */
+  if (swig_module.next==0) {
+    /* Initialize the swig_module */
+    swig_module.type_initial = swig_type_initial;
+    swig_module.cast_initial = swig_cast_initial;
+    swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
+  }
+  
+  /* Try and load any already created modules */
+  module_head = SWIG_GetModule(clientdata);
+  if (!module_head) {
+    /* This is the first module loaded for this interpreter */
+    /* so set the swig module into the interpreter */
+    SWIG_SetModule(clientdata, &swig_module);
+    module_head = &swig_module;
+  } else {
+    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
+    found=0;
+    iter=module_head;
+    do {
+      if (iter==&swig_module) {
+        found=1;
+        break;
+      }
+      iter=iter->next;
+    } while (iter!= module_head);
+    
+    /* if the is found in the list, then all is done and we may leave */
+    if (found) return;
+    /* otherwise we must add out module into the list */
+    swig_module.next = module_head->next;
+    module_head->next = &swig_module;
+  }
+  
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
+  /* Now work on filling in swig_module.types */
+#ifdef SWIGRUNTIME_DEBUG
+  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
+#endif
+  for (i = 0; i < swig_module.size; ++i) {
+    swig_type_info *type = 0;
+    swig_type_info *ret;
+    swig_cast_info *cast;
+    
+#ifdef SWIGRUNTIME_DEBUG
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+#endif
+    
+    /* if there is another module already loaded */
+    if (swig_module.next != &swig_module) {
+      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
+    }
+    if (type) {
+      /* Overwrite clientdata field */
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: found type %s\n", type->name);
+#endif
+      if (swig_module.type_initial[i]->clientdata) {
+        type->clientdata = swig_module.type_initial[i]->clientdata;
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
+#endif
+      }
+    } else {
+      type = swig_module.type_initial[i];
+    }
+    
+    /* Insert casting types */
+    cast = swig_module.cast_initial[i];
+    while (cast->type) {
+      /* Don't need to add information already in the list */
+      ret = 0;
+#ifdef SWIGRUNTIME_DEBUG
+      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
+#endif
+      if (swig_module.next != &swig_module) {
+        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
+#ifdef SWIGRUNTIME_DEBUG
+        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
+#endif
+      }
+      if (ret) {
+        if (type == swig_module.type_initial[i]) {
+#ifdef SWIGRUNTIME_DEBUG
+          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
+#endif
+          cast->type = ret;
+          ret = 0;
+        } else {
+          /* Check for casting already in the list */
+          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
+#ifdef SWIGRUNTIME_DEBUG
+          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
+#endif
+          if (!ocast) ret = 0;
+        }
+      }
+      
+      if (!ret) {
+#ifdef SWIGRUNTIME_DEBUG
+        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
+#endif
+        if (type->cast) {
+          type->cast->prev = cast;
+          cast->next = type->cast;
+        }
+        type->cast = cast;
+      }
+      cast++;
+    }
+    /* Set entry in modules->types array equal to the type */
+    swig_module.types[i] = type;
+  }
+  swig_module.types[i] = 0;
+  
+#ifdef SWIGRUNTIME_DEBUG
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+  for (i = 0; i < swig_module.size; ++i) {
+    int j = 0;
+    swig_cast_info *cast = swig_module.cast_initial[i];
+    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
+    while (cast->type) {
+      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
+      cast++;
+      ++j;
+    }
+    printf("---- Total casts: %d\n",j);
+  }
+  printf("**** SWIG_InitializeModule: Cast List ******\n");
+#endif
+}
+
+/* This function will propagate the clientdata field of type to
+* any new swig_type_info structures that have been added into the list
+* of equivalent types.  It is like calling
+* SWIG_TypeClientData(type, clientdata) a second time.
+*/
+SWIGRUNTIME void
+SWIG_PropagateClientData(void) {
+  size_t i;
+  swig_cast_info *equiv;
+  static int init_run = 0;
+  
+  if (init_run) return;
+  init_run = 1;
+  
+  for (i = 0; i < swig_module.size; i++) {
+    if (swig_module.types[i]->clientdata) {
+      equiv = swig_module.types[i]->cast;
+      while (equiv) {
+        if (!equiv->converter) {
+          if (equiv->type && !equiv->type->clientdata)
+          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
+        }
+        equiv = equiv->next;
+      }
+    }
+  }
+}
+
+#ifdef __cplusplus
+#if 0
+{
+  /* c-mode */
+#endif
+}
+#endif
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+  
+  /* -----------------------------------------------------------------------------
+   * constants/methods manipulation
+   * ----------------------------------------------------------------------------- */
+  
+  /* Install Constants */
+  
+  SWIGINTERN void
+  SWIG_Tcl_InstallConstants(Tcl_Interp *interp, swig_const_info constants[]) {
+    int i;
+    Tcl_Obj *obj;
+    
+    if (!swigconstTableinit) {
+      Tcl_InitHashTable(&swigconstTable, TCL_STRING_KEYS);
+      swigconstTableinit = 1;
+    }
+    for (i = 0; constants[i].type; i++) {
+      switch(constants[i].type) {
+      case SWIG_TCL_POINTER:
+        obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
+        break;
+      case SWIG_TCL_BINARY:
+        obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
+        break;
+      default:
+        obj = 0;
+        break;
+      }
+      if (obj) {
+        SWIG_Tcl_SetConstantObj(interp, constants[i].name, obj);
+      }
+    }
+  }
+  
+#ifdef __cplusplus
+}
+#endif
+
+/* -----------------------------------------------------------------------------*
+ *  Partial Init method
+ * -----------------------------------------------------------------------------*/
+
+SWIGEXPORT int SWIG_init(Tcl_Interp *interp) {
+  int i;
+  if (interp == 0) return TCL_ERROR;
+#ifdef USE_TCL_STUBS
+  if (Tcl_InitStubs(interp, (char*)"8.1", 0) == NULL) {
+    return TCL_ERROR;
+  }
+#endif  
+  Tcl_PkgProvide(interp, (char*)SWIG_name, (char*)SWIG_version);
+  
+#ifdef SWIG_namespace
+  Tcl_Eval(interp, "namespace eval " SWIG_namespace " { }");
+#endif
+  
+  SWIG_InitializeModule((void *) interp);
+  SWIG_PropagateClientData();
+  
+  for (i = 0; swig_commands[i].name; i++) {
+    Tcl_CreateObjCommand(interp, (char *) swig_commands[i].name, (swig_wrapper_func) swig_commands[i].wrapper,
+      swig_commands[i].clientdata, NULL);
+  }
+  for (i = 0; swig_variables[i].name; i++) {
+    Tcl_SetVar(interp, (char *) swig_variables[i].name, (char *) "", TCL_GLOBAL_ONLY);
+    Tcl_TraceVar(interp, (char *) swig_variables[i].name, TCL_TRACE_READS | TCL_GLOBAL_ONLY, 
+      (Tcl_VarTraceProc *) swig_variables[i].get, (ClientData) swig_variables[i].addr);
+    Tcl_TraceVar(interp, (char *) swig_variables[i].name, TCL_TRACE_WRITES | TCL_GLOBAL_ONLY, 
+      (Tcl_VarTraceProc *) swig_variables[i].set, (ClientData) swig_variables[i].addr);
+  }
+  
+  SWIG_Tcl_InstallConstants(interp, swig_constants);
+  
+  
+  return TCL_OK;
+}
+SWIGEXPORT int Esl_SafeInit(Tcl_Interp *interp) {
+  return SWIG_init(interp);
+}
+

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/tcl/pkgIndex.tcl

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/tcl/pkgIndex.tcl (from rev 16612, freeswitch/trunk/libs/esl/tcl/pkgIndex.tcl) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/tcl/pkgIndex.tcl	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/tcl/pkgIndex.tcl	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,11 @@
+# Tcl package index file, version 1.1
+# This file is generated by the "pkg_mkIndex" command
+# and sourced either when an application starts up or
+# by a "package unknown" script.  It invokes the
+# "package ifneeded" command to set up package-related
+# information so that packages will be loaded automatically
+# in response to "package require" commands.  When this
+# script is sourced, the variable $dir must contain the
+# full path name of this file's directory.
+
+package ifneeded esl 0.0 [list load [file join $dir ESL.so]]

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/tcl/single_command.tcl

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/tcl/single_command.tcl (from rev 16612, freeswitch/trunk/libs/esl/tcl/single_command.tcl) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/tcl/single_command.tcl	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/tcl/single_command.tcl	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,22 @@
+lappend auto_path .
+package require esl
+
+if { $argc < 1 } {
+	puts "Usage:   tclsh $argv0 command arg(s)"
+	puts "Example: tclsh $argv0 status"
+	exit
+}
+
+#
+# Open connection to FreeSWITCH ESL
+#   (FreeSWITCH must be running for this to work)
+#
+ESLconnection esl {127.0.0.1} 8021 {ClueCon}
+
+#
+# Send request               (given as args to sendRecv)
+# Get answer from FreeSWITCH (return value from sendRecv)
+# Translate reponse to text  (getBody command)
+# Print it                   (puts)
+#
+puts [ESLevent_getBody [esl sendRecv {api status}]]

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/testclient.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/testclient.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/esl/testclient.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -7,7 +7,7 @@
 {
 	esl_handle_t handle = {{0}};
 
-	esl_connect(&handle, "localhost", 8021, "ClueCon");
+	esl_connect(&handle, "localhost", 8021, NULL, "ClueCon");
 
 	esl_send_recv(&handle, "api status\n\n");
 

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/iksemel


Name: svn:ignore
   - Makefile.in
configure
config.log
.complete
iksemel.pc
Makefile
config.status
libtool
autom4te.cache
aclocal.m4
depcomp
compile
config.guess
config.sub
missing
install-sh
configure.lineno
   + Makefile.in
configure
config.log
.complete
iksemel.pc
Makefile
config.status
libtool
autom4te.cache
aclocal.m4
depcomp
compile
config.guess
config.sub
missing
install-sh
configure.lineno
a.out.dSYM

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/iksemel/build/libgnutls.m4 (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/iksemel/build/libgnutls.m4	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/iksemel/build/libgnutls.m4	2010-02-12 00:54:22 UTC (rev 16614)
@@ -24,17 +24,25 @@
   fi
 
   AC_PATH_PROG(LIBGNUTLS_CONFIG, libgnutls-config, no)
-  min_libgnutls_version=ifelse([$1], ,0.1.0,$1)
-  AC_MSG_CHECKING(for libgnutls - version >= $min_libgnutls_version)
+  AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
   no_libgnutls=""
-  if test "$LIBGNUTLS_CONFIG" = "no" ; then
-    no_libgnutls=yes
-  else
+  if test "$LIBGNUTLS_CONFIG" != "no"; then
     LIBGNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --cflags`
     LIBGNUTLS_LIBS="`$LIBGNUTLS_CONFIG $libgnutls_config_args --libs` -lpthread"
     libgnutls_config_version=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version`
+  elif test "$PKG_CONFIG" != "no"; then
+    LIBGNUTLS_CFLAGS=`$PKG_CONFIG --cflags gnutls`
+    LIBGNUTLS_LIBS="`$PKG_CONFIG --libs gnutls` -lpthread"
+    libgnutls_config_version=`$PKG_CONFIG --modversion gnutls`
+  else
+    no_libgnutls=yes
+  fi
 
+  min_libgnutls_version=ifelse([$1], ,0.1.0,$1)
+  AC_MSG_CHECKING(for libgnutls - version >= $min_libgnutls_version)
 
+  if test x"$no_libgnutls" = x""; then
+
       ac_save_CFLAGS="$CFLAGS"
       ac_save_LIBS="$LIBS"
       CFLAGS="$CFLAGS $LIBGNUTLS_CFLAGS"

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/iksemel/configure.ac (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/iksemel/configure.ac	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/iksemel/configure.ac	2010-02-12 00:54:22 UTC (rev 16614)
@@ -6,6 +6,10 @@
 AM_INIT_AUTOMAKE(iksemel,1.3)
 AC_CONFIG_HEADERS(include/config.h)
 
+CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
+
 AC_CANONICAL_HOST
 
 dnl Checks for programs

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/ilbc


Name: svn:ignore
   - Release
*.user
Debug
configure
Makefile.in
config.log
Makefile
config.status
autom4te.cache
libtool
aclocal.m4
x64
config-h.in
configure.lineno
   + Release
*.user
Debug
configure
Makefile.in
config.log
Makefile
config.status
autom4te.cache
libtool
aclocal.m4
x64
config-h.in
configure.lineno
a.out.dSYM

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/ilbc/configure.ac (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/ilbc/configure.ac	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/ilbc/configure.ac	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,6 +22,10 @@
 
 AC_INIT
 
+CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
+
 AC_DEFUN([AX_COMPILER_VENDOR],
 [
 AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor,

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/js


Name: svn:ignore
   - config.h.in
configure
config.log
.complete
js-config.sh
config.h
jscpucfg
.libs
js
Makefile
config.status
libtool
js.pc
autom4te.cache
config.guess
ltmain.sh
config.sub
aclocal.m4
install-sh
missing
configure.lineno
   + config.h.in
configure
config.log
.complete
js-config.sh
config.h
jscpucfg
.libs
js
Makefile
config.status
libtool
js.pc
autom4te.cache
config.guess
ltmain.sh
config.sub
aclocal.m4
install-sh
missing
configure.lineno
a.out.dSYM

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/js/.update (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/js/.update	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/js/.update	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1 +1 @@
-Wed Nov 28 21:37:06 EST 2007
+Tue Jan 19 13:09:35 EST 2010

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/js/Makefile.in (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/js/Makefile.in	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/js/Makefile.in	2010-02-12 00:54:22 UTC (rev 16614)
@@ -165,6 +165,8 @@
 src/perlconnect/jsperl.o: src/perlconnect/jsperl.c
 	$(CC) $(CPPFLAGS) $(CLI_CPPFLAGS) $(CFLAGS) $(CLI_CFLAGS) -o $@ -c $<
 
+src/js.c: src/jstypes.h
+src/jstypes.h: src/jsautocfg.h
 $(LIB_OBJS): src/jsautocfg.h
 src/jsautocfg.h: jscpucfg
 	-rm -f $@ src/jsautocfg.h

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/js/configure.ac (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/js/configure.ac	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/js/configure.ac	2010-02-12 00:54:22 UTC (rev 16614)
@@ -33,6 +33,10 @@
     "Configuring %BOSSP js%b (Mozilla JavaScript Engine), version %B${JS_VERSION}%b"
 AC_SUBST(JS_VERSION)
 
+CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
+
 AC_CANONICAL_BUILD
 AC_CANONICAL_HOST
 
@@ -40,6 +44,7 @@
 AC_PROG_CC
 AC_CHECK_DEBUGGING
 AC_CHECK_VA_COPY
+AC_PROG_LIBTOOL
 
 OLD_CFLAGS="$CFLAGS"
 CFLAGS=""
@@ -225,8 +230,6 @@
 
 with_tags=""
 
-AC_PROG_LIBTOOL
-
 AC_CONFIG_HEADERS(config.h)
 AC_CONFIG_FILES([Makefile js.pc js-config.sh src/perlconnect/Makefile.PL])
 AC_OUTPUT

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/js/nsprpub/configure.in (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/js/nsprpub/configure.in	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/js/nsprpub/configure.in	2010-02-12 00:54:22 UTC (rev 16614)
@@ -38,6 +38,10 @@
 AC_PREREQ(2.59)
 AC_INIT(config/libc_r.h)
 
+CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
+
 AC_CONFIG_AUX_DIR(build/autoconf)
 AC_CANONICAL_SYSTEM
 

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/libdingaling


Name: svn:ignore
   - Debug
Release
*.ncb
*.user
*.bak
config.log
.complete
.libs
.deps
Makefile
config.status
libtool
autom4te.cache
aclocal.m4
configure
Makefile.in
debug
x64
configure.lineno
   + Debug
Release
*.ncb
*.user
*.bak
config.log
.complete
.libs
.deps
Makefile
config.status
libtool
autom4te.cache
aclocal.m4
configure
Makefile.in
debug
x64
configure.lineno
a.out.dSYM

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/libdingaling/configure.in (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/libdingaling/configure.in	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/libdingaling/configure.in	2010-02-12 00:54:22 UTC (rev 16614)
@@ -8,6 +8,10 @@
 AC_CONFIG_SRCDIR([src])
 AC_CONFIG_HEADERS([src/config.h])
 
+CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
+
 #Set default language
 AC_LANG_C
 # Checks for programs.

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/libedit


Name: svn:ignore
   - configure
Makefile.in
config.log
depcomp
config.guess
config.h
ltmain.sh
config.sub
Makefile
libedit.pc
config.status
stamp-h1
libtool
missing
aclocal.m4
install-sh
config.h.in
autom4te.cache
configure.lineno
   + configure
Makefile.in
config.log
depcomp
config.guess
config.h
ltmain.sh
config.sub
Makefile
libedit.pc
config.status
stamp-h1
libtool
missing
aclocal.m4
install-sh
config.h.in
autom4te.cache
configure.lineno
a.out.dSYM

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/libedit/configure.ac (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/libedit/configure.ac	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/libedit/configure.ac	2010-02-12 00:54:22 UTC (rev 16614)
@@ -5,6 +5,10 @@
 AC_CONFIG_SRCDIR([src/strlcat.c])
 AC_CONFIG_HEADERS([config.h])
 
+CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
+
 AM_INIT_AUTOMAKE
 AC_PROG_LIBTOOL
 

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/libg722_1


Name: svn:ignore
   - config.log
config.status
g722_1.spec
libtool
Makefile
autom4te.cache
configure
Makefile.in
config-h.in
aclocal.m4
   + config.log
config.status
g722_1.spec
libtool
Makefile
autom4te.cache
configure
Makefile.in
config-h.in
aclocal.m4
a.out.dSYM

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/libg722_1/configure.ac (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/libg722_1/configure.ac	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/libg722_1/configure.ac	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,6 +22,10 @@
 
 AC_INIT
 
+CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
+
 m4_include(config/ax_compiler_vendor.m4)
 m4_include(config/ax_check_real_file.m4)
 m4_include(config/ax_fixed_point_machine.m4)

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/libsndfile


Name: svn:ignore
   - Makefile.in
configure
autom4te.cache
sndfile.pc
config.log
.complete
Makefile
config.status
libsndfile.spec
libtool
depcomp
compile
config.guess
ltmain.sh
config.sub
missing
aclocal.m4
install-sh
configure.lineno
   + Makefile.in
configure
autom4te.cache
sndfile.pc
config.log
.complete
Makefile
config.status
libsndfile.spec
libtool
depcomp
compile
config.guess
ltmain.sh
config.sub
missing
aclocal.m4
install-sh
configure.lineno
a.out.dSYM

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/libsndfile/M4


Name: svn:ignore
   - Makefile.in
Makefile
libtool.m4
   + Makefile.in
Makefile
libtool.m4
ltsugar.m4
ltversion.m4
ltoptions.m4

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/libsndfile/configure.ac (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/libsndfile/configure.ac	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/libsndfile/configure.ac	2010-02-12 00:54:22 UTC (rev 16614)
@@ -8,6 +8,10 @@
 # Put config stuff in Cfg.
 AC_CONFIG_AUX_DIR(Cfg)
 
+CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
+
 AC_CONFIG_SRCDIR([src/sndfile.c])
 AC_CANONICAL_TARGET([])
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/miniupnpc/miniwget.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/miniupnpc/miniwget.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/miniupnpc/miniwget.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -24,6 +24,7 @@
 #include <netdb.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
+#include <fcntl.h>
 #define closesocket close
 #endif
 #if defined(__sun) || defined(sun)
@@ -40,9 +41,17 @@
 		  int * size, char * addr_str, int addr_str_len)
 {
 	char buf[2048];
-    int s;
+#ifdef WIN32
+	SOCKET s;
+#else
+	int s;
+#endif
+	int fd_flags;
 	struct sockaddr_in dest;
 	struct hostent *hp;
+
+	fd_flags = 0;
+
 	*size = 0;
 	hp = gethostbyname(host);
 	if(hp==NULL)
@@ -61,13 +70,61 @@
 	}
 	dest.sin_family = AF_INET;
 	dest.sin_port = htons(port);
-	if(connect(s, (struct sockaddr *)&dest, sizeof(struct sockaddr_in))<0)
+
+
+
 	{
-		perror("connect");
-		closesocket(s);
-		return NULL;
+#ifdef WIN32
+		u_long arg = 1;
+		if (ioctlsocket((SOCKET) s, FIONBIO, &arg) == SOCKET_ERROR) {
+			return NULL;
+		}
+
+#else
+		fd_flags = fcntl(s, F_GETFL, 0);
+
+		if (fcntl(s, F_SETFL, fd_flags | O_NONBLOCK)) {
+			return NULL;
+		}
+
+#endif
+
 	}
 
+	connect(s, (struct sockaddr *)&dest, sizeof(struct sockaddr_in));
+
+	{
+		fd_set wfds;
+		struct timeval tv = { 2, 0 };
+		int r;
+
+		FD_ZERO(&wfds);
+        FD_SET(s, &wfds);
+
+        r = select(s + 1, NULL, &wfds, NULL, &tv);
+		
+		if (r <= 0) {
+			return NULL;
+		}
+
+		if (!FD_ISSET(s, &wfds)) {
+			return NULL;
+		}
+
+	}
+
+#ifdef WIN32
+	{
+		u_long arg = 0;
+		if (ioctlsocket((SOCKET) s, FIONBIO, &arg) == SOCKET_ERROR) {
+			return NULL;
+		}
+	}
+#else
+	fcntl(s, F_SETFL, fd_flags);
+#endif
+
+
 	/* get address for caller ! */
 	if(addr_str)
 	{
@@ -201,8 +258,9 @@
 	/* protocol://host:port/chemin */
 	char hostname[MAXHOSTNAMELEN+1];
 	*size = 0;
-	if(!parseURL(url, hostname, &port, &path))
+	if(!parseURL(url, hostname, &port, &path)) {
 		return NULL;
+	}
 	return miniwget2(url, hostname, port, path, size, 0, 0);
 }
 

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/pcre


Name: svn:ignore
   - autom4te.cache
*.bak
configure
pcre-config
pcregrep
pcre_stringpiece.h
pcrecpparg.h
config.status
config.log
libpcre.pc
pcre_stringpiece_unittest
pcretest
config.h
pcrecpp_unittest
pcre_chartables.c
Makefile
dftables
libtool
.complete
.libs
pcre_scanner_unittest
ltmain.sh
config.guess
aclocal.m4
config.sub
install-sh
missing
Makefile.in
.deps
config.h.in
libpcrecpp.pc
stamp-h1
configure.lineno
   + autom4te.cache
*.bak
configure
pcre-config
pcregrep
pcre_stringpiece.h
pcrecpparg.h
config.status
config.log
libpcre.pc
pcre_stringpiece_unittest
pcretest
config.h
pcrecpp_unittest
pcre_chartables.c
Makefile
dftables
libtool
.complete
.libs
pcre_scanner_unittest
ltmain.sh
config.guess
aclocal.m4
config.sub
install-sh
missing
Makefile.in
.deps
config.h.in
libpcrecpp.pc
stamp-h1
configure.lineno
a.out.dSYM

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/pcre/configure.ac (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/pcre/configure.ac	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/pcre/configure.ac	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,6 +22,10 @@
 AM_INIT_AUTOMAKE([dist-bzip2 dist-zip])
 AC_CONFIG_HEADERS(config.h)
 
+CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
+
 # The default CFLAGS and CXXFLAGS in Autoconf are "-g -O2" for gcc and just
 # "-g" for any other compiler. There doesn't seem to be a standard way of
 # getting rid of the -g (which I don't think is needed for a production

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/portaudio


Name: svn:ignore
   - config.log
.complete
portaudio-2.0.pc
lib
bin
Makefile
config.status
lib-stamp
bin-stamp
libtool
autom4te.cache
configure
config.guess
config.sub
ltmain.sh
aclocal.m4
install-sh
depcomp
missing
configure.lineno
   + config.log
.complete
portaudio-2.0.pc
lib
bin
Makefile
config.status
lib-stamp
bin-stamp
libtool
autom4te.cache
configure
config.guess
config.sub
ltmain.sh
aclocal.m4
install-sh
depcomp
missing
configure.lineno
a.out.dSYM

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/portaudio/configure.in (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/portaudio/configure.in	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/portaudio/configure.in	2010-02-12 00:54:22 UTC (rev 16614)
@@ -11,6 +11,10 @@
 dnl from the right directory
 AC_INIT([include/portaudio.h])
 
+CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
+
 dnl Specify options
 
 AC_ARG_WITH(alsa, 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/.update (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/.update	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/.update	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1 +1 @@
-Mon Sep 21 14:27:58 CDT 2009
+Wed Jan 13 09:48:12 CST 2010

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/configure.ac (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/configure.ac	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/configure.ac	2010-02-12 00:54:22 UTC (rev 16614)
@@ -12,6 +12,11 @@
 
 dnl update both the version for AC_INIT and the LIBSOFIA_SIP_UA_MAJOR_MINOR
 AC_INIT([sofia-sip], [1.12.10devel])
+
+CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
+
 AC_CONFIG_SRCDIR([libsofia-sip-ua/sip/sofia-sip/sip.h])
 AC_CONFIG_MACRO_DIR([m4])
 AC_SUBST(VER_LIBSOFIA_SIP_UA_MAJOR_MINOR, [1.12])

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/nua/nua_notifier.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -257,10 +257,10 @@
   }
   else {
     /* Refresh existing subscription */
-    if (su_strmatch(event, "refer"))
+	  if (su_strmatch(event, "refer")){
       expires = NH_PGET(nh, refer_expires);
 
-    SR_STATUS1(sr, SIP_200_OK);
+	  SR_STATUS1(sr, SIP_200_OK);}
   }
 
   nu = nua_dialog_usage_private(du);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1034,7 +1034,7 @@
   tpn = tport_name(nr->nr_tport);
 
   SU_DEBUG_5(("nua_register(%p): tport to %s/%s:%s%s%s closed %s\n",
-	      du->du_dialog->ds_owner,
+		  (void *)du->du_dialog->ds_owner,
 	      tpn->tpn_proto, tpn->tpn_host, tpn->tpn_port,
 	      tpn->tpn_comp ? ";comp=" : "",
 	      tpn->tpn_comp ? tpn->tpn_comp : "",

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -3935,7 +3935,7 @@
 
   retval = nua_base_server_report(sr, tags);
 
-  assert(2 <= retval && retval < 4);
+  //assert(2 <= retval && retval < 4);
 
 #if 0
   if (ss) {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/nua/nua_stack.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -671,7 +671,7 @@
  */
 void nua_destroy_event(nua_saved_event_t saved[1])
 {
-  if (saved) su_msg_destroy(saved);
+  if (saved && saved[0]) su_msg_destroy(saved);
 }
 
 /** @internal Move signal. */

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/sdp/sdp.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/sdp/sdp.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/sdp/sdp.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -63,7 +63,7 @@
 
 
 #define STRUCT_DUP(p, dst, src) \
-  ASSERT_STRUCT_ALIGN(p); assert(*(int*)(src) >= (int)sizeof(*src));	\
+  ASSERT_STRUCT_ALIGN(p); \
   ((*(int*)(src) >= (int)sizeof(*src)					\
     ? (dst = memcpy((p), (src), sizeof(*src)))				\
     : (dst = memcpy((p), (src), *(int*)(src))),				\

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/sresolv/sres_sip.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -404,7 +404,7 @@
   sres_resolver_t *sres = srs->srs_resolver;
   struct srs_step *step;
 
-  SU_DEBUG_5(("srs(%p): destroyed\n", _srs));
+  SU_DEBUG_5(("srs(%p): destroyed\n", (void *) (_srs)));
 
   srs->srs_resolver = NULL;
 
@@ -565,7 +565,7 @@
   if (step->sp_otype != sres_type_srv)
     return;
 
-  SU_DEBUG_5(("srs(%p): graylisting %s:%u;transport=%s\n", target, step->sp_port, proto));
+  SU_DEBUG_5(("srs(%p): graylisting %s:%u;transport=%s\n", (void *) target, step->sp_port, proto));
 
   for (step = srs->srs_send; step; step = step->sp_next)
     if (step->sp_otype == sres_type_srv && step->sp_priority > maxprio)
@@ -1647,7 +1647,7 @@
     }
 
     SU_DEBUG_5(("srs(%p): %s result %s%s%s:%u;transport=%s\n",
-		srs, duplicate ? "duplicate" : "returning",
+				(void *)srs, duplicate ? "duplicate" : "returning",
 		lb , numeric, rb, port,
 		sres_sip_transport_name(result->ai_protocol)));
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/tport/tport.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/tport/tport.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/tport/tport.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -2252,7 +2252,7 @@
   if (tport_is_closed(self)) {
     if (self->tp_refs == 0) {
       SU_DEBUG_7(("tport(%p): set timer at %u ms because %s\n",
-		  self, 0, "zap"));
+				  (void *)self, 0, "zap"));
       su_timer_set_interval(self->tp_timer, timer, self, 0);
     }
     else
@@ -2601,7 +2601,7 @@
   /* Alloc a new transport object, then register socket events with it */
   if ((self = tport_alloc_secondary(pri, s, 1, &reason)) == NULL) {
     SU_DEBUG_3(("%s(%p): incoming secondary on "TPN_FORMAT
-                " failed. reason = %s\n", __func__, pri, 
+                " failed. reason = %s\n", __func__, (void *)pri, 
                 TPN_ARGS(pri->pri_primary->tp_name), reason));
     return 0;
   }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/tport/tport_tls.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -494,7 +494,7 @@
   cert = SSL_get_peer_certificate(tls->con);
   if (!cert) {
     SU_DEBUG_7(("%s(%p): Peer did not provide X.509 Certificate.\n", 
-                 __func__, self));
+				__func__, (void *) self));
     if (self->tp_accepted && tls->verify_incoming)
       return X509_V_ERR_CERT_UNTRUSTED;
     else if (!self->tp_accepted && tls->verify_outgoing)
@@ -513,7 +513,11 @@
   for (i = 0; i < extcount; i++) {
     X509_EXTENSION *ext;
     char const *name;
+#if OPENSSL_VERSION_NUMBER >  0x10000000L
+    const X509V3_EXT_METHOD *vp;
+#else
     X509V3_EXT_METHOD *vp;
+#endif
     STACK_OF(CONF_VALUE) *values;
     CONF_VALUE *value;
     void *d2i;
@@ -572,10 +576,10 @@
     int i, len = su_strlst_len(tls->subjects);
     for (i=0; i < len; i++)
       SU_DEBUG_7(("%s(%p): Peer Certificate Subject %i: %s\n", \
-	      __func__, self, i, su_strlst_item(tls->subjects, i)));
+				  __func__, (void *)self, i, su_strlst_item(tls->subjects, i)));
     if (i == 0)
       SU_DEBUG_7(("%s(%p): Peer Certificate provided no usable subjects.\n",
-                   __func__, self));
+				  __func__, (void *)self));
   }
 
   /* Verify incoming connections */
@@ -599,7 +603,7 @@
 	  return X509_V_OK;
       }
       SU_DEBUG_3(("%s(%p): Peer Subject Mismatch (incoming connection)\n", \
-                   __func__, self));
+				  __func__, (void *)self));
 
       return X509_V_ERR_CERT_UNTRUSTED;
     }
@@ -617,7 +621,7 @@
       if (tport_subject_search(subject, tls->subjects))
         return X509_V_OK; /* Subject match found in verified certificate chain */
       SU_DEBUG_3(("%s(%p): Peer Subject Mismatch (%s)\n", \
-                   __func__, self, subject));
+				  __func__, (void *)self, subject));
 
       return X509_V_ERR_CERT_UNTRUSTED;
     }
@@ -856,7 +860,7 @@
 
   if ((tls = tlstp->tlstp_context) == NULL) {
     SU_DEBUG_3(("%s(%p): Error: no TLS context data for connected socket.\n",
-                __func__, tlstp));
+                __func__, (void *)tlstp));
     tport_close(self);
     tport_set_secondary_timer(self);
     return 0;
@@ -922,7 +926,7 @@
 	  char errbuf[64];
 	  ERR_error_string_n(status, errbuf, 64);
           SU_DEBUG_3(("%s(%p): TLS setup failed (%s)\n",
-	            __func__, self, errbuf));
+					  __func__, (void *)self, errbuf));
         }
         break;
     }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_sctp.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_sctp.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_sctp.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -325,4 +325,7 @@
   tport_base_timer(self, now);
 }
 
+#else
+/* ISO c99 forbids empty source file */
+void *sofia_tport_type_sctp_dummy;
 #endif

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_tls.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -575,7 +575,7 @@
   /* Alloc a new transport object, then register socket events with it */
   if ((self = tport_alloc_secondary(pri, s, 1, &reason)) == NULL) {
     SU_DEBUG_3(("%s(%p): incoming secondary on "TPN_FORMAT
-                " failed. reason = %s\n", __func__, pri,
+                " failed. reason = %s\n", __func__, (void *)pri,
                 TPN_ARGS(pri->pri_primary->tp_name), reason));
     return 0;
   }
@@ -594,7 +594,7 @@
       self->tp_is_connected = 0;
 
       SU_DEBUG_5(("%s(%p): new connection from " TPN_FORMAT "\n",
-		  __func__,  (void *)self, TPN_ARGS(self->tp_name)));
+		  __func__, (void *)self, TPN_ARGS(self->tp_name)));
 
       /* Return succesfully */
       return 0;

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp


Name: svn:ignore
   - configure
Makefile.in
config.log
Makefile
config.status
libtool
autom4te.cache
aclocal.m4
Debug
*.user
Release
spandsp.pc
config-h.in
   + configure
Makefile.in
config.log
Makefile
config.status
libtool
autom4te.cache
aclocal.m4
Debug
*.user
Release
spandsp.pc
config-h.in
a.out.dSYM

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/.update (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/.update	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/.update	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1 +1 @@
-Mon Oct  5 12:03:35 CDT 2009
+Mon Dec 28 20:58:04 EST 2009

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/configure.ac (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/configure.ac	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/configure.ac	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,6 +22,10 @@
 
 AC_INIT
 
+CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
+
 m4_include(config/ax_compiler_vendor.m4)
 m4_include(config/ax_check_real_file.m4)
 m4_include(config/ax_fixed_point_machine.m4)
@@ -434,13 +438,15 @@
 
 if test "$enable_builtin_tiff" = "yes" ; then
   abs_tiffdir="`cd $srcdir/../tiff-3.8.2/ && pwd`"
+  spandsp_builddir="`pwd`"
+  abs_tiffbuilddir="`cd $spandsp_builddir/../tiff-3.8.2/ && pwd`"
   save_CFLAGS=$CFLAGS
   CFLAGS="$CFLAGS -I$abs_tiffdir/libtiff"
   AC_CHECK_HEADERS([tiffio.h])
   CFLAGS="$save_CFLAGS"
   COMP_VENDOR_CFLAGS="-I$abs_tiffdir/libtiff $COMP_VENDOR_CFLAGS"
   COMP_VENDOR_LDFLAGS="-L$abs_tiffdir/libtiff $COMP_VENDOR_LDFLAGS"
-  LIBS="$LIBS $abs_tiffdir/libtiff/libtiff.la"
+  LIBS="$LIBS $abs_tiffbuilddir/libtiff/libtiff.la"
   AC_DEFINE([HAVE_LIBTIFF], [1], [Define to 1 if you have the `tiff' library (-ltiff).])
 else
   AC_CHECK_HEADERS([tiffio.h])

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/spandsp-sim/spandsp/line_model.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/spandsp-sim/spandsp/line_model.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/spandsp-sim/spandsp/line_model.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: line_model.h,v 1.7 2009/09/23 16:02:59 steveu Exp $
+ * $Id: line_model.h,v 1.7.4.1 2009/12/19 10:16:44 steveu Exp $
  */
 
 /*! \file */
@@ -70,7 +70,7 @@
     codec_munge_state_t *munge;
 
     /*! The coefficients for the near end analogue section simulation filter */
-    float *near_filter;
+    const float *near_filter;
     /*! The number of coefficients for the near end analogue section simulation filter */
     int near_filter_len;
     /*! Last transmitted samples (ring buffer, used by the line filter) */
@@ -88,7 +88,7 @@
     int16_t bulk_delay_buf[8000];
 
     /*! The coefficients for the far end analogue section simulation filter */
-    float *far_filter;
+    const float *far_filter;
     /*! The number of coefficients for the far end analogue section simulation filter */
     int far_filter_len;
     /*! Last transmitted samples (ring buffer, used by the line filter) */

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/Makefile.am (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/Makefile.am	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/Makefile.am	2010-02-12 00:54:22 UTC (rev 16614)
@@ -16,13 +16,37 @@
 ## License along with this program; if not, write to the Free Software
 ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 ##
-## $Id: Makefile.am,v 1.137 2009/09/22 14:52:31 steveu Exp $
+## $Id: Makefile.am,v 1.138.4.3 2009/12/19 10:30:10 steveu Exp $
 
 AM_CFLAGS = $(COMP_VENDOR_CFLAGS)
 AM_LDFLAGS = $(COMP_VENDOR_LDFLAGS)
 
 MAINTAINERCLEANFILES = Makefile.in
 
+DISTCLEANFILES = $(srcdir)/at_interpreter_dictionary.h \
+                 $(srcdir)/v17_v32bis_rx_fixed_rrc.h \
+                 $(srcdir)/v17_v32bis_rx_floating_rrc.h \
+                 $(srcdir)/v17_v32bis_tx_fixed_rrc.h \
+                 $(srcdir)/v17_v32bis_tx_floating_rrc.h \
+                 $(srcdir)/v22bis_rx_1200_fixed_rrc.h \
+                 $(srcdir)/v22bis_rx_2400_fixed_rrc.h \
+                 $(srcdir)/v22bis_rx_1200_floating_rrc.h \
+                 $(srcdir)/v22bis_rx_2400_floating_rrc.h \
+                 $(srcdir)/v22bis_tx_fixed_rrc.h \
+                 $(srcdir)/v22bis_tx_floating_rrc.h \
+                 $(srcdir)/v27ter_rx_2400_fixed_rrc.h \
+                 $(srcdir)/v27ter_rx_4800_fixed_rrc.h \
+                 $(srcdir)/v27ter_rx_2400_floating_rrc.h \
+                 $(srcdir)/v27ter_rx_4800_floating_rrc.h \
+                 $(srcdir)/v27ter_tx_2400_fixed_rrc.h \
+                 $(srcdir)/v27ter_tx_4800_fixed_rrc.h \
+                 $(srcdir)/v27ter_tx_2400_floating_rrc.h \
+                 $(srcdir)/v27ter_tx_4800_floating_rrc.h \
+                 $(srcdir)/v29rx_fixed_rrc.h \
+                 $(srcdir)/v29rx_floating_rrc.h \
+                 $(srcdir)/v29tx_fixed_rrc.h \
+                 $(srcdir)/v29tx_floating_rrc.h
+
 EXTRA_DIST = floating_fudge.h \
              libspandsp.dsp \
              libspandsp.2005.sln \
@@ -31,6 +55,9 @@
              libspandsp.2008.vcproj \
              libtiff.2005.vcproj \
              libtiff.2008.vcproj \
+             filter_tools.c \
+	         make_at_dictionary.c \
+	         make_modem_filter.c \
              msvc/config.h \
              msvc/Download_TIFF.2005.vcproj \
              msvc/Download_TIFF.2008.vcproj \
@@ -111,7 +138,8 @@
                         super_tone_rx.c \
                         super_tone_tx.c \
                         swept_tone.c \
-                        t4.c \
+                        t4_rx.c \
+                        t4_tx.c \
                         t30.c \
                         t30_api.c \
                         t30_logging.c \
@@ -190,7 +218,8 @@
                          spandsp/super_tone_rx.h \
                          spandsp/super_tone_tx.h \
                          spandsp/swept_tone.h \
-                         spandsp/t4.h \
+                         spandsp/t4_rx.h \
+                         spandsp/t4_tx.h \
                          spandsp/t30.h \
                          spandsp/t30_api.h \
                          spandsp/t30_fcf.h \
@@ -252,12 +281,14 @@
                          spandsp/private/super_tone_tx.h \
                          spandsp/private/swept_tone.h \
                          spandsp/private/t30.h \
+                         spandsp/private/t30_dis_dtc_dcs_bits.h \
                          spandsp/private/t31.h \
                          spandsp/private/t38_core.h \
                          spandsp/private/t38_gateway.h \
                          spandsp/private/t38_non_ecm_buffer.h \
                          spandsp/private/t38_terminal.h \
-                         spandsp/private/t4.h \
+                         spandsp/private/t4_rx.h \
+                         spandsp/private/t4_tx.h \
                          spandsp/private/time_scale.h \
                          spandsp/private/tone_detect.h \
                          spandsp/private/tone_generate.h \
@@ -282,16 +313,16 @@
                         lpc10_encdecs.h \
                         mmx_sse_decs.h \
                         t30_local.h \
-                        t4_states.h \
+                        t4_t6_decode_states.h \
                         v17_v32bis_rx_constellation_maps.h \
                         v17_v32bis_tx_constellation_maps.h \
                         v29tx_constellation_maps.h
 
-noinst_PROGRAMS = make_at_dictionary \
-                  make_modem_filter
+make_at_dictionary$(EXEEXT): $(top_srcdir)/src/make_at_dictionary.c
+	$(CC_FOR_BUILD) -o make_at_dictionary$(EXEEXT) $(top_srcdir)/src/make_at_dictionary.c  -DHAVE_CONFIG_H -I$(top_builddir)/src
 
-make_modem_filter_SOURCES = make_modem_filter.c \
-                            filter_tools.c
+make_modem_filter$(EXEEXT): $(top_srcdir)/src/make_modem_filter.c $(top_srcdir)/src/filter_tools.c
+	$(CC_FOR_BUILD) -o make_modem_filter$(EXEEXT) $(top_srcdir)/src/make_modem_filter.c $(top_srcdir)/src/filter_tools.c -DHAVE_CONFIG_H -I$(top_builddir)/src -lm
 
 # We need to run make_at_dictionary, so it generates the
 # at_interpreter_dictionary.h file
@@ -489,13 +520,10 @@
 	     -e "s/\@INSERT_MATH_HEADER\@/#include <math.h>/" $(srcdir)/spandsp.h.in > $(srcdir)/msvc/spandsp.h
 
 spandsp/version.h:
+	mkdir -p $(@D)
 	NOWDATE=`date --utc +"%Y%m%d"` ; \
 	NOWTIME=`date --utc +"%H%M%S"` ; \
 	sed 's/$$SPANDSP_RELEASE_DATE/'$$NOWDATE'/;s/$$SPANDSP_RELEASE_TIME/'$$NOWTIME'/' \
-		<spandsp/version.h.in >spandsp/version.h
+		<$(srcdir)/spandsp/version.h.in >$@
 
-dist-hook:
-	NOWDATE=`date --utc +"%Y%m%d"` ; \
-	NOWTIME=`date --utc +"%H%M%S"` ; \
-	sed 's/$$SPANDSP_RELEASE_DATE/'$$NOWDATE'/;s/$$SPANDSP_RELEASE_TIME/'$$NOWTIME'/' \
-		<spandsp/version.h.in >spandsp/version.h
+dist-hook: spandsp/version.h

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/adsi.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/adsi.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/adsi.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -23,7 +23,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: adsi.c,v 1.76 2009/04/12 09:12:10 steveu Exp $
+ * $Id: adsi.c,v 1.77 2009/11/02 13:25:20 steveu Exp $
  */
 
 /*! \file */
@@ -431,12 +431,12 @@
     switch (standard)
     {
     case ADSI_STANDARD_CLASS:
-        fsk_rx_init(&(s->fskrx), &preset_fsk_specs[FSK_BELL202], FALSE, adsi_rx_put_bit, s);
+        fsk_rx_init(&(s->fskrx), &preset_fsk_specs[FSK_BELL202], FSK_FRAME_MODE_ASYNC, adsi_rx_put_bit, s);
         break;
     case ADSI_STANDARD_CLIP:
     case ADSI_STANDARD_ACLIP:
     case ADSI_STANDARD_JCLIP:
-        fsk_rx_init(&(s->fskrx), &preset_fsk_specs[FSK_V23CH1], FALSE, adsi_rx_put_bit, s);
+        fsk_rx_init(&(s->fskrx), &preset_fsk_specs[FSK_V23CH1], FSK_FRAME_MODE_ASYNC, adsi_rx_put_bit, s);
         break;
     case ADSI_STANDARD_CLIP_DTMF:
         dtmf_rx_init(&(s->dtmfrx), adsi_rx_dtmf, s);
@@ -444,7 +444,7 @@
     case ADSI_STANDARD_TDD:
         /* TDD uses 5 bit data, no parity and 1.5 stop bits. We scan for the first stop bit, and
            ride over the fraction. */
-        fsk_rx_init(&(s->fskrx), &preset_fsk_specs[FSK_WEITBRECHT], 7, adsi_tdd_put_async_byte, s);
+        fsk_rx_init(&(s->fskrx), &preset_fsk_specs[FSK_WEITBRECHT], FSK_FRAME_MODE_5N1_FRAMES, adsi_tdd_put_async_byte, s);
         break;
     }
     s->standard = standard;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/at_interpreter.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/at_interpreter.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/at_interpreter.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -25,7 +25,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: at_interpreter.c,v 1.41 2009/10/03 04:37:25 steveu Exp $
+ * $Id: at_interpreter.c,v 1.42.4.1 2009/12/23 14:18:32 steveu Exp $
  */
 
 /*! \file */
@@ -64,8 +64,6 @@
 #include "spandsp/private/logging.h"
 #include "spandsp/private/at_interpreter.h"
 
-#define ms_to_samples(t)        (((t)*SAMPLE_RATE)/1000)
-
 #define MANUFACTURER            "www.soft-switch.org"
 #define SERIAL_NUMBER           "42"
 #define GLOBAL_OBJECT_IDENTITY  "42"
@@ -3358,9 +3356,30 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+static const char *at_cmd_plus_F34(at_state_t *s, const char *t)
+{
+    static const int maxes[5] =
+    {
+        14, 14, 2, 14, 14
+    };
+    int *locations[5];
+    int i;
+
+    /* T.31 B.6.1 - Initial V.34 rate controls for FAX */
+    /* Syntax: +F34=[<maxp>][,[<minp>][,<prefc>][,<maxp2>][,<minp2]] */
+    /* TODO */
+    t += 4;
+    for (i = 0;  i < 5;  i++)
+        locations[i] = NULL;
+    if (!parse_n_out(s, &t, locations, maxes, 5, "+F34:", "(0-14),(0-14),(0-2),(0-14),(0-14)"))
+        return NULL;
+    return t;
+}
+/*- End of function --------------------------------------------------------*/
+
 static const char *at_cmd_plus_FAA(at_state_t *s, const char *t)
 {
-    /* T.32 8.5.2.5 - Adaptive Answer parameter */
+    /* T.32 8.5.2.5 - Adaptive answer parameter */
     /* TODO */
     t += 4;
     return t;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/bell_r2_mf.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/bell_r2_mf.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/bell_r2_mf.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: bell_r2_mf.c,v 1.39 2009/04/11 18:11:19 steveu Exp $
+ * $Id: bell_r2_mf.c,v 1.39.4.1 2009/12/23 14:23:48 steveu Exp $
  */
 
 /*! \file */
@@ -65,8 +65,6 @@
 #define M_PI 3.14159265358979323846264338327
 #endif
 
-#define ms_to_samples(t)            (((t)*SAMPLE_RATE)/1000)
-
 /*!
     MF tone descriptor.
 */

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/bitstream.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/bitstream.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/bitstream.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: bitstream.c,v 1.18 2009/02/10 13:06:46 steveu Exp $
+ * $Id: bitstream.c,v 1.18.4.1 2009/12/28 12:20:46 steveu Exp $
  */
 
 /*! \file */
@@ -44,33 +44,48 @@
 SPAN_DECLARE(void) bitstream_put(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits)
 {
     value &= ((1 << bits) - 1);
-    if (s->residue + bits <= 32)
+    if (s->lsb_first)
     {
-        s->bitstream |= (value << s->residue);
-        s->residue += bits;
+        if (s->residue + bits <= 32)
+        {
+            s->bitstream |= (value << s->residue);
+            s->residue += bits;
+        }
+        while (s->residue >= 8)
+        {
+            s->residue -= 8;
+            *(*c)++ = (uint8_t) (s->bitstream & 0xFF);
+            s->bitstream >>= 8;
+        }
     }
-    while (s->residue >= 8)
+    else
     {
-        s->residue -= 8;
-        *(*c)++ = (uint8_t) (s->bitstream & 0xFF);
-        s->bitstream >>= 8;
+        if (s->residue + bits <= 32)
+        {
+            s->bitstream = (s->bitstream << bits) | value;
+            s->residue += bits;
+        }
+        while (s->residue >= 8)
+        {
+            s->residue -= 8;
+            *(*c)++ = (uint8_t) ((s->bitstream >> s->residue) & 0xFF);
+        }
     }
 }
 /*- End of function --------------------------------------------------------*/
 
-SPAN_DECLARE(void) bitstream_put2(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits)
+SPAN_DECLARE(void) bitstream_flush(bitstream_state_t *s, uint8_t **c)
 {
-    value &= ((1 << bits) - 1);
-    if (s->residue + bits <= 32)
+    if (s->residue > 0)
     {
-        s->bitstream = (s->bitstream << bits) | value;
-        s->residue += bits;
+        s->bitstream &= ((1 << s->residue) - 1);
+        if (s->lsb_first)
+            *(*c)++ = (uint8_t) s->bitstream;
+        else
+            *(*c)++ = (uint8_t) (s->bitstream << (8 - s->residue));
+        s->residue = 0;
     }
-    while (s->residue >= 8)
-    {
-        s->residue -= 8;
-        *(*c)++ = (uint8_t) ((s->bitstream >> s->residue) & 0xFF);
-    }
+    s->bitstream = 0;
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -78,55 +93,33 @@
 {
     uint32_t x;
 
-    while (s->residue < bits)
+    if (s->lsb_first)
     {
-        s->bitstream |= (((uint32_t) *(*c)++) << s->residue);
-        s->residue += 8;
+        while (s->residue < bits)
+        {
+            s->bitstream |= (((uint32_t) *(*c)++) << s->residue);
+            s->residue += 8;
+        }
+        s->residue -= bits;
+        x = s->bitstream & ((1 << bits) - 1);
+        s->bitstream >>= bits;
     }
-    s->residue -= bits;
-    x = s->bitstream & ((1 << bits) - 1);
-    s->bitstream >>= bits;
-    return x;
-}
-/*- End of function --------------------------------------------------------*/
-
-SPAN_DECLARE(uint32_t) bitstream_get2(bitstream_state_t *s, const uint8_t **c, int bits)
-{
-    uint32_t x;
-
-    while (s->residue < bits)
+    else
     {
-        s->bitstream = (s->bitstream << 8) | ((uint32_t) *(*c)++);
-        s->residue += 8;
+        while (s->residue < bits)
+        {
+            s->bitstream = (s->bitstream << 8) | ((uint32_t) *(*c)++);
+            s->residue += 8;
+        }
+        s->residue -= bits;
+        x = (s->bitstream >> s->residue) & ((1 << bits) - 1);
     }
-    s->residue -= bits;
-    x = (s->bitstream >> s->residue) & ((1 << bits) - 1);
     return x;
 }
 /*- End of function --------------------------------------------------------*/
 
-SPAN_DECLARE(void) bitstream_flush(bitstream_state_t *s, uint8_t **c)
+SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s, int lsb_first)
 {
-    if (s->residue > 0)
-    {
-        *(*c)++ = (uint8_t) ((s->bitstream << (8 - s->residue)) & 0xFF);
-        s->residue = 0;
-    }
-}
-/*- End of function --------------------------------------------------------*/
-
-SPAN_DECLARE(void) bitstream_flush2(bitstream_state_t *s, uint8_t **c)
-{
-    if (s->residue > 0)
-    {
-        *(*c)++ = (uint8_t) ((s->bitstream << (8 - s->residue)) & 0xFF);
-        s->residue = 0;
-    }
-}
-/*- End of function --------------------------------------------------------*/
-
-SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s)
-{
     if (s == NULL)
     {
         if ((s = (bitstream_state_t *) malloc(sizeof(*s))) == NULL)
@@ -134,6 +127,7 @@
     }
     s->bitstream = 0;
     s->residue = 0;
+    s->lsb_first = lsb_first;
     return s;
 }
 /*- End of function --------------------------------------------------------*/

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/fax.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/fax.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/fax.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -23,7 +23,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: fax.c,v 1.94 2009/09/04 14:38:46 steveu Exp $
+ * $Id: fax.c,v 1.96.4.1 2009/12/19 10:44:10 steveu Exp $
  */
 
 /*! \file */
@@ -71,7 +71,8 @@
 #include "spandsp/v17rx.h"
 #include "spandsp/super_tone_rx.h"
 #include "spandsp/modem_connect_tones.h"
-#include "spandsp/t4.h"
+#include "spandsp/t4_rx.h"
+#include "spandsp/t4_tx.h"
 
 #include "spandsp/t30_fcf.h"
 #include "spandsp/t35.h"
@@ -94,7 +95,8 @@
 #include "spandsp/private/modem_connect_tones.h"
 #include "spandsp/private/hdlc.h"
 #include "spandsp/private/fax_modems.h"
-#include "spandsp/private/t4.h"
+#include "spandsp/private/t4_rx.h"
+#include "spandsp/private/t4_tx.h"
 #include "spandsp/private/t30.h"
 #include "spandsp/private/fax.h"
 
@@ -110,12 +112,12 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static void tone_detected(void *user_data, int on, int level, int delay)
+static void tone_detected(void *user_data, int tone, int level, int delay)
 {
     t30_state_t *s;
 
     s = (t30_state_t *) user_data;
-    span_log(&s->logging, SPAN_LOG_FLOW, "FAX tone declared %s (%ddBm0)\n", (on)  ?  "on"  :  "off", level);
+    span_log(&s->logging, SPAN_LOG_FLOW, "%s detected (%ddBm0)\n", modem_connect_tone_to_str(tone), level);
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -423,7 +425,7 @@
     switch (type)
     {
     case T30_MODEM_V21:
-        fsk_rx_init(&t->v21_rx, &preset_fsk_specs[FSK_V21CH2], TRUE, (put_bit_func_t) hdlc_rx_put_bit, put_bit_user_data);
+        fsk_rx_init(&t->v21_rx, &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) hdlc_rx_put_bit, put_bit_user_data);
         fsk_rx_signal_cutoff(&t->v21_rx, -45.5f);
         set_rx_handler(s, (span_rx_handler_t *) &fsk_rx, (span_rx_fillin_handler_t *) &fsk_rx_fillin, &t->v21_rx);
         break;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/fax_modems.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/fax_modems.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/fax_modems.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: fax_modems.c,v 1.7 2009/10/05 16:33:25 steveu Exp $
+ * $Id: fax_modems.c,v 1.8 2009/11/02 13:25:20 steveu Exp $
  */
 
 /*! \file */
@@ -45,6 +45,9 @@
 #include <assert.h>
 #include <fcntl.h>
 #include <time.h>
+#if defined(LOG_FAX_AUDIO)
+#include <unistd.h>
+#endif
 
 #include "spandsp/telephony.h"
 #include "spandsp/logging.h"
@@ -280,7 +283,7 @@
 
     hdlc_rx_init(&s->hdlc_rx, FALSE, FALSE, HDLC_FRAMING_OK_THRESHOLD, hdlc_accept, user_data);
     hdlc_tx_init(&s->hdlc_tx, FALSE, 2, FALSE, hdlc_tx_underflow, user_data);
-    fsk_rx_init(&s->v21_rx, &preset_fsk_specs[FSK_V21CH2], TRUE, (put_bit_func_t) hdlc_rx_put_bit, &s->hdlc_rx);
+    fsk_rx_init(&s->v21_rx, &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) hdlc_rx_put_bit, &s->hdlc_rx);
     fsk_rx_signal_cutoff(&s->v21_rx, -39.09f);
     fsk_tx_init(&s->v21_tx, &preset_fsk_specs[FSK_V21CH2], (get_bit_func_t) hdlc_tx_get_bit, &s->hdlc_tx);
     v17_rx_init(&s->v17_rx, 14400, non_ecm_put_bit, user_data);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/fsk.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/fsk.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/fsk.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: fsk.c,v 1.59 2009/06/02 16:03:56 steveu Exp $
+ * $Id: fsk.c,v 1.60 2009/11/02 13:25:20 steveu Exp $
  */
 
 /*! \file */
@@ -128,6 +128,22 @@
     }
 };
 
+SPAN_DECLARE(int) fsk_tx_restart(fsk_tx_state_t *s, const fsk_spec_t *spec)
+{
+    s->baud_rate = spec->baud_rate;
+    s->phase_rates[0] = dds_phase_rate((float) spec->freq_zero);
+    s->phase_rates[1] = dds_phase_rate((float) spec->freq_one);
+    s->scaling = dds_scaling_dbm0((float) spec->tx_level);
+    /* Initialise fractional sample baud generation. */
+    s->phase_acc = 0;
+    s->baud_frac = 0;
+    s->current_phase_rate = s->phase_rates[1];
+    
+    s->shutdown = FALSE;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
 SPAN_DECLARE(fsk_tx_state_t *) fsk_tx_init(fsk_tx_state_t *s,
                                            const fsk_spec_t *spec,
                                            get_bit_func_t get_bit,
@@ -138,20 +154,11 @@
         if ((s = (fsk_tx_state_t *) malloc(sizeof(*s))) == NULL)
             return NULL;
     }
+    memset(s, 0, sizeof(*s));
 
-    s->baud_rate = spec->baud_rate;
     s->get_bit = get_bit;
     s->get_bit_user_data = user_data;
-
-    s->phase_rates[0] = dds_phase_rate((float) spec->freq_zero);
-    s->phase_rates[1] = dds_phase_rate((float) spec->freq_one);
-    s->scaling = dds_scaling_dbm0((float) spec->tx_level);
-    /* Initialise fractional sample baud generation. */
-    s->phase_acc = 0;
-    s->baud_frac = 0;
-    s->current_phase_rate = s->phase_rates[1];
-    
-    s->shutdown = FALSE;
+    fsk_tx_restart(s, spec);
     return s;
 }
 /*- End of function --------------------------------------------------------*/
@@ -250,26 +257,13 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-SPAN_DECLARE(fsk_rx_state_t *) fsk_rx_init(fsk_rx_state_t *s,
-                                           const fsk_spec_t *spec,
-                                           int framing_mode,
-                                           put_bit_func_t put_bit,
-                                           void *user_data)
+SPAN_DECLARE(int) fsk_rx_restart(fsk_rx_state_t *s, const fsk_spec_t *spec, int framing_mode)
 {
     int chop;
 
-    if (s == NULL)
-    {
-        if ((s = (fsk_rx_state_t *) malloc(sizeof(*s))) == NULL)
-            return NULL;
-    }
-
-    memset(s, 0, sizeof(*s));
     s->baud_rate = spec->baud_rate;
     s->framing_mode = framing_mode;
     fsk_rx_signal_cutoff(s, (float) spec->min_level);
-    s->put_bit = put_bit;
-    s->put_bit_user_data = user_data;
 
     /* Detect by correlating against the tones we want, over a period
        of one baud. The correlation must be quadrature. */
@@ -307,6 +301,26 @@
     /* Initialise a power detector, so sense when a signal is present. */
     power_meter_init(&(s->power), 4);
     s->signal_present = 0;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(fsk_rx_state_t *) fsk_rx_init(fsk_rx_state_t *s,
+                                           const fsk_spec_t *spec,
+                                           int framing_mode,
+                                           put_bit_func_t put_bit,
+                                           void *user_data)
+{
+    if (s == NULL)
+    {
+        if ((s = (fsk_rx_state_t *) malloc(sizeof(*s))) == NULL)
+            return NULL;
+    }
+    memset(s, 0, sizeof(*s));
+
+    s->put_bit = put_bit;
+    s->put_bit_user_data = user_data;
+    fsk_rx_restart(s, spec, framing_mode);
     return s;
 }
 /*- End of function --------------------------------------------------------*/
@@ -421,7 +435,7 @@
         baudstate = (sum[0] < sum[1]);
         switch (s->framing_mode)
         {
-        case 1:
+        case FSK_FRAME_MODE_SYNC:
             /* Synchronous serial operation - e.g. for HDLC */
             if (s->last_bit != baudstate)
             {
@@ -442,7 +456,7 @@
                 s->put_bit(s->put_bit_user_data, baudstate);
             }
             break;
-        case 0:
+        case FSK_FRAME_MODE_ASYNC:
             /* Fully asynchronous mode */
             if (s->last_bit != baudstate)
             {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/g726.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/g726.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/g726.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -48,7 +48,7 @@
  * 2550 Garcia Avenue
  * Mountain View, California  94043
  *
- * $Id: g726.c,v 1.28 2009/02/10 13:06:46 steveu Exp $
+ * $Id: g726.c,v 1.28.4.1 2009/12/28 12:20:46 steveu Exp $
  */
 
 /*! \file */
@@ -1052,7 +1052,7 @@
         s->bits_per_sample = 5;
         break;
     }
-    bitstream_init(&s->bs);
+    bitstream_init(&s->bs, (s->packing != G726_PACKING_LEFT));
     return s;
 }
 /*- End of function --------------------------------------------------------*/

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/gsm0610_rpe.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/gsm0610_rpe.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/gsm0610_rpe.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -25,7 +25,7 @@
  * This code is based on the widely used GSM 06.10 code available from
  * http://kbs.cs.tu-berlin.de/~jutta/toast.html
  *
- * $Id: gsm0610_rpe.c,v 1.25 2009/02/03 16:28:39 steveu Exp $
+ * $Id: gsm0610_rpe.c,v 1.25.4.2 2009/12/28 11:54:58 steveu Exp $
  */
 
 /*! \file */
@@ -45,6 +45,8 @@
 #include "floating_fudge.h"
 #include <stdlib.h>
 
+#include "mmx_sse_decs.h"
+
 #include "spandsp/telephony.h"
 #include "spandsp/fast_convert.h"
 #include "spandsp/bitstream.h"
@@ -55,26 +57,17 @@
 
 /* 4.2.13 .. 4.2.17  RPE ENCODING SECTION */
 
-#if defined(__GNUC__)  &&  defined(__i386__)
-#define SPANDSP_USE_I386_ASM
-#if (defined(__APPLE__) || defined(macintosh)) && defined(__MAC_OS_X_VERSION_MIN_REQUIRED)
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060
-#undef SPANDSP_USE_I386_ASM
-#endif
-#endif
-#endif
-
 /* 4.2.13 */
-static void weighting_filter(const int16_t *e,     // signal [-5..0.39.44] IN
-                             int16_t x[40])
+static void weighting_filter(int16_t x[40],
+                             const int16_t *e)      // signal [-5..0.39.44] IN)
 {
-#if defined(SPANDSP_USE_I386_ASM)
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_MMX)  &&  defined(__x86_64__)
     /* Table 4.4   Coefficients of the weighting filter */
     /* This must be padded to a multiple of 4 for MMX to work */
     static const union
     {
         int16_t gsm_H[12];
-        uint64_t x[3];
+        __m64 x[3];
     } gsm_H =
     {
         {
@@ -85,15 +78,71 @@
 
     __asm__ __volatile__(
         " emms;\n"
+        " addq $-10,%%rcx;\n"
+        " leaq %[gsm_H],%%rax;\n"
+        " movq (%%rax),%%mm1;\n"
+        " movq 8(%%rax),%%mm2;\n"
+        " movq 16(%%rax),%%mm3;\n"
+        " movq $0x1000,%%rax;\n"
+        " movq %%rax,%%mm5;\n"              /* For rounding */
+        " xorq %%rsi,%%rsi;\n"
+        " .p2align 2;\n"
+        "1:\n"
+        " movq (%%rcx,%%rsi,2),%%mm0;\n"
+        " pmaddwd %%mm1,%%mm0;\n"
+ 
+        " movq 8(%%rcx,%%rsi,2),%%mm4;\n"
+        " pmaddwd %%mm2,%%mm4;\n"
+        " paddd %%mm4,%%mm0;\n"
+
+        " movq 16(%%rcx,%%rsi,2),%%mm4;\n"
+        " pmaddwd %%mm3,%%mm4;\n"
+        " paddd %%mm4,%%mm0;\n"
+
+        " movq %%mm0,%%mm4;\n"
+        " punpckhdq %%mm0,%%mm4;\n"         /* mm4 has high int32 of mm0 dup'd */
+        " paddd %%mm4,%%mm0;\n"
+
+        " paddd %%mm5,%%mm0;\n"             /* Add for roundoff */
+        " psrad $13,%%mm0;\n"
+        " packssdw %%mm0,%%mm0;\n"        
+        " movd %%mm0,%%eax;\n"              /* eax has result */
+        " movw %%ax,(%%rdi,%%rsi,2);\n"
+        " incq %%rsi;\n"
+        " cmpq $39,%%rsi;\n"
+        " jle 1b;\n"
+        " emms;\n"
+        :
+        : "c" (e), "D" (x), [gsm_H] "X" (gsm_H)
+        : "rax", "rdx", "rsi", "memory"
+    );
+#elif defined(__GNUC__)  &&  defined(SPANDSP_USE_MMX)  &&  defined(__i386__)
+    /* Table 4.4   Coefficients of the weighting filter */
+    /* This must be padded to a multiple of 4 for MMX to work */
+    static const union
+    {
+        int16_t gsm_H[12];
+        __m64 x[3];
+    } gsm_H =
+    {
+        {
+            -134, -374, 0, 2054, 5741, 8192, 5741, 2054, 0, -374, -134, 0
+        }
+
+    };
+
+    __asm__ __volatile__(
+        " emms;\n"
         " addl $-10,%%ecx;\n"
+        " leal %[gsm_H],%%eax;\n"
+        " movq (%%eax),%%mm1;\n"
+        " movq 8(%%eax),%%mm2;\n"
+        " movq 16(%%eax),%%mm3;\n"
         " movl $0x1000,%%eax;\n"
-        " movd %%eax,%%mm5;\n"              /* for rounding */
-        " movq %[gsm_H],%%mm1;\n"
-        " movq %[gsm_H8],%%mm2;\n"
-        " movq %[gsm_H16],%%mm3;\n"
+        " movd %%eax,%%mm5;\n"              /* For rounding */
         " xorl %%esi,%%esi;\n"
         " .p2align 2;\n"
-        "1:;\n"
+        "1:\n"
         " movq (%%ecx,%%esi,2),%%mm0;\n"
         " pmaddwd %%mm1,%%mm0;\n"
  
@@ -119,8 +168,8 @@
         " jle 1b;\n"
         " emms;\n"
         :
-        : "c" (e), "D" (x), [gsm_H] "X" (gsm_H.x[0]), [gsm_H8] "X" (gsm_H.x[1]), [gsm_H16] "X" (gsm_H.x[2])
-        : "eax", "edx", "esi"
+        : "c" (e), "D" (x), [gsm_H] "X" (gsm_H)
+        : "eax", "edx", "esi", "memory"
     );
 #else
     int32_t L_result;
@@ -163,13 +212,13 @@
         */
         L_result += STEP( 0,  -134);
         L_result += STEP( 1,  -374);
-              // += STEP( 2,  0   );
+              /* += STEP( 2,  0   ); */
         L_result += STEP( 3,  2054);
         L_result += STEP( 4,  5741);
         L_result += STEP( 5,  8192);
         L_result += STEP( 6,  5741);
         L_result += STEP( 7,  2054);
-              // += STEP( 8,  0   );
+              /* += STEP( 8,  0   ); */
         L_result += STEP( 9,  -374);
         L_result += STEP(10,  -134);
 
@@ -523,7 +572,7 @@
     int16_t mant;
     int16_t exp;
 
-    weighting_filter(e, x);
+    weighting_filter(x, e);
     rpe_grid_selection(x, xM, Mc);
 
     apcm_quantization(xM, xMc, &mant, &exp, xmaxc);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/libspandsp.2005.vcproj (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/libspandsp.2005.vcproj	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/libspandsp.2005.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -143,7 +143,8 @@
 <File RelativePath="super_tone_rx.c"></File>
 <File RelativePath="super_tone_tx.c"></File>
 <File RelativePath="swept_tone.c"></File>
-<File RelativePath="t4.c"></File>
+<File RelativePath="t4_rx.c"></File>
+<File RelativePath="t4_tx.c"></File>
 <File RelativePath="t30.c"></File>
 <File RelativePath="t30_api.c"></File>
 <File RelativePath="t30_logging.c"></File>
@@ -221,7 +222,8 @@
 <File RelativePath="spandsp/super_tone_rx.h"></File>
 <File RelativePath="spandsp/super_tone_tx.h"></File>
 <File RelativePath="spandsp/swept_tone.h"></File>
-<File RelativePath="spandsp/t4.h"></File>
+<File RelativePath="spandsp/t4_rx.h"></File>
+<File RelativePath="spandsp/t4_tx.h"></File>
 <File RelativePath="spandsp/t30.h"></File>
 <File RelativePath="spandsp/t30_api.h"></File>
 <File RelativePath="spandsp/t30_fcf.h"></File>
@@ -283,12 +285,14 @@
 <File RelativePath="spandsp/private/super_tone_tx.h"></File>
 <File RelativePath="spandsp/private/swept_tone.h"></File>
 <File RelativePath="spandsp/private/t30.h"></File>
+<File RelativePath="spandsp/private/t30_dis_dtc_dcs_bits.h"></File>
 <File RelativePath="spandsp/private/t31.h"></File>
 <File RelativePath="spandsp/private/t38_core.h"></File>
 <File RelativePath="spandsp/private/t38_gateway.h"></File>
 <File RelativePath="spandsp/private/t38_non_ecm_buffer.h"></File>
 <File RelativePath="spandsp/private/t38_terminal.h"></File>
-<File RelativePath="spandsp/private/t4.h"></File>
+<File RelativePath="spandsp/private/t4_rx.h"></File>
+<File RelativePath="spandsp/private/t4_tx.h"></File>
 <File RelativePath="spandsp/private/time_scale.h"></File>
 <File RelativePath="spandsp/private/tone_detect.h"></File>
 <File RelativePath="spandsp/private/tone_generate.h"></File>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/libspandsp.2008.vcproj (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/libspandsp.2008.vcproj	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/libspandsp.2008.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -213,7 +213,8 @@
 <File RelativePath="super_tone_rx.c"></File>
 <File RelativePath="super_tone_tx.c"></File>
 <File RelativePath="swept_tone.c"></File>
-<File RelativePath="t4.c"></File>
+<File RelativePath="t4_rx.c"></File>
+<File RelativePath="t4_tx.c"></File>
 <File RelativePath="t30.c"></File>
 <File RelativePath="t30_api.c"></File>
 <File RelativePath="t30_logging.c"></File>
@@ -291,7 +292,8 @@
 <File RelativePath="spandsp/super_tone_rx.h"></File>
 <File RelativePath="spandsp/super_tone_tx.h"></File>
 <File RelativePath="spandsp/swept_tone.h"></File>
-<File RelativePath="spandsp/t4.h"></File>
+<File RelativePath="spandsp/t4_rx.h"></File>
+<File RelativePath="spandsp/t4_tx.h"></File>
 <File RelativePath="spandsp/t30.h"></File>
 <File RelativePath="spandsp/t30_api.h"></File>
 <File RelativePath="spandsp/t30_fcf.h"></File>
@@ -353,12 +355,14 @@
 <File RelativePath="spandsp/private/super_tone_tx.h"></File>
 <File RelativePath="spandsp/private/swept_tone.h"></File>
 <File RelativePath="spandsp/private/t30.h"></File>
+<File RelativePath="spandsp/private/t30_dis_dtc_dcs_bits.h"></File>
 <File RelativePath="spandsp/private/t31.h"></File>
 <File RelativePath="spandsp/private/t38_core.h"></File>
 <File RelativePath="spandsp/private/t38_gateway.h"></File>
 <File RelativePath="spandsp/private/t38_non_ecm_buffer.h"></File>
 <File RelativePath="spandsp/private/t38_terminal.h"></File>
-<File RelativePath="spandsp/private/t4.h"></File>
+<File RelativePath="spandsp/private/t4_rx.h"></File>
+<File RelativePath="spandsp/private/t4_tx.h"></File>
 <File RelativePath="spandsp/private/time_scale.h"></File>
 <File RelativePath="spandsp/private/tone_detect.h"></File>
 <File RelativePath="spandsp/private/tone_generate.h"></File>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/libspandsp.dsp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/libspandsp.dsp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/libspandsp.dsp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -297,10 +297,14 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\t4.c
+SOURCE=.\t4_rx.c
 # End Source File
 # Begin Source File
 
+SOURCE=.\t4_tx.c
+# End Source File
+# Begin Source File
+
 SOURCE=.\t30.c
 # End Source File
 # Begin Source File
@@ -607,10 +611,14 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\spandsp/t4.h
+SOURCE=.\spandsp/t4_rx.h
 # End Source File
 # Begin Source File
 
+SOURCE=.\spandsp/t4_tx.h
+# End Source File
+# Begin Source File
+
 SOURCE=.\spandsp/t30.h
 # End Source File
 # Begin Source File
@@ -855,6 +863,10 @@
 # End Source File
 # Begin Source File
 
+SOURCE=.\spandsp/private/t30_dis_dtc_dcs_bits.h
+# End Source File
+# Begin Source File
+
 SOURCE=.\spandsp/private/t31.h
 # End Source File
 # Begin Source File
@@ -875,10 +887,14 @@
 # End Source File
 # Begin Source File
 
-SOURCE=.\spandsp/private/t4.h
+SOURCE=.\spandsp/private/t4_rx.h
 # End Source File
 # Begin Source File
 
+SOURCE=.\spandsp/private/t4_tx.h
+# End Source File
+# Begin Source File
+
 SOURCE=.\spandsp/private/time_scale.h
 # End Source File
 # Begin Source File

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/lpc10_decode.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/lpc10_decode.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/lpc10_decode.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -26,7 +26,7 @@
  * implementation of the LPC-10 2400 bps Voice Coder. They do not
  * exert copyright claims on their code, and it may be freely used.
  *
- * $Id: lpc10_decode.c,v 1.27 2009/02/10 13:06:46 steveu Exp $
+ * $Id: lpc10_decode.c,v 1.27.4.1 2009/12/24 17:00:19 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
@@ -446,8 +446,7 @@
                         xxy = expf(xxy);
                         rci[j + *nout*rci_dim1 + 1] = (xxy - 1.0f)/(xxy + 1.0f);
                     }
-                    rmsi[*nout - 1] = logf(s->rmso) + prop*(logf(*rms) - logf(s->rmso));
-                    rmsi[*nout - 1] = expf(rmsi[*nout - 1]);
+                    rmsi[*nout - 1] = expf(logf(s->rmso) + prop*(logf(*rms) - logf(s->rmso)));
                 }
             }
             if (vflag != 1)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/make_at_dictionary.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/make_at_dictionary.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/make_at_dictionary.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -23,7 +23,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: make_at_dictionary.c,v 1.5 2009/10/05 16:36:42 steveu Exp $
+ * $Id: make_at_dictionary.c,v 1.6 2009/10/09 14:53:57 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
@@ -231,6 +231,7 @@
     "+ESR",     /* V.250 6.5.3 - Selective repeat */ 
     "+ETBM",    /* V.250 6.5.6 - Call termination buffer management */ 
     "+EWIND",   /* V.250 6.5.7 - Window size */ 
+    "+F34",     /* T.31 B.6.1 - Initial V.34 rate controls for FAX */
     "+FAA",     /* T.32 8.5.2.5 - Adaptive Answer parameter */
     "+FAP",     /* T.32 8.5.1.12 - Addressing and polling capabilities parameter */
     "+FAR",     /* T.31 8.5.1 - Adaptive reception control */ 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/make_modem_filter.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/make_modem_filter.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/make_modem_filter.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -23,7 +23,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: make_modem_filter.c,v 1.17 2009/10/03 04:37:25 steveu Exp $
+ * $Id: make_modem_filter.c,v 1.17.4.1 2009/12/28 12:20:46 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
@@ -356,7 +356,7 @@
             break;
         }
     }
-    if (strcmp(modem, "V.17") == 0)
+    if (strcmp(modem, "V.17") == 0  ||  strcmp(modem, "V.32bis") == 0)
     {
         /* This applies to V.32bis as well as V.17 */
         rx_coeff_sets = 192;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/modem_connect_tones.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/modem_connect_tones.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/modem_connect_tones.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -23,11 +23,23 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: modem_connect_tones.c,v 1.37 2009/06/02 16:03:56 steveu Exp $
+ * $Id: modem_connect_tones.c,v 1.41 2009/11/06 19:21:33 steveu Exp $
  */
  
 /*! \file */
 
+/* CNG is 0.5s+-15% of 1100+-38Hz, 3s+-15% off, repeating.
+
+   CED is 0.2s silence, 3.3+-0.7s of 2100+-15Hz, and 75+-20ms of silence.
+   
+   ANS is 3.3+-0.7s of 2100+-15Hz.
+   
+   ANS/ is 3.3+-0.7s of 2100+-15Hz, with phase reversals (180+-10 degrees, hopping in <1ms) every 450+-25ms.
+
+   ANSam/ is 2100+-1Hz, with phase reversals (180+-10 degrees, hopping in <1ms) every 450+-25ms, and AM with a sinewave of 15+-0.1Hz. 
+   The modulated envelope ranges in amplitude between (0.8+-0.01) and (1.2+-0.01) times its average
+   amplitude. It lasts up to 5s, but will be stopped early if the V.8 protocol proceeds. */
+
 #if defined(HAVE_CONFIG_H)
 #include "config.h"
 #endif
@@ -158,9 +170,9 @@
     case MODEM_CONNECT_TONES_ANSAM:
         if (s->duration_timer < len)
             len = s->duration_timer;
-        if (s->duration_timer > ms_to_samples(3300))
+        if (s->duration_timer > ms_to_samples(5000))
         {
-            if ((i = s->duration_timer - ms_to_samples(3300)) > len)
+            if ((i = s->duration_timer - ms_to_samples(5000)) > len)
                 i = len;
             memset(amp, 0, sizeof(int16_t)*i);
         }
@@ -174,9 +186,9 @@
     case MODEM_CONNECT_TONES_ANSAM_PR:
         if (s->duration_timer < len)
             len = s->duration_timer;
-        if (s->duration_timer > ms_to_samples(3300))
+        if (s->duration_timer > ms_to_samples(5000))
         {
-            if ((i = s->duration_timer - ms_to_samples(3300)) > len)
+            if ((i = s->duration_timer - ms_to_samples(5000)) > len)
                 i = len;
             memset(amp, 0, sizeof(int16_t)*i);
         }
@@ -221,28 +233,48 @@
         s->tone_phase = 0;
         s->mod_phase = 0;
         s->mod_level = 0;
+        s->hop_timer = 0;
         break;
     case MODEM_CONNECT_TONES_ANS:
     case MODEM_CONNECT_TONES_ANSAM:
         /* 0.2s of silence, then 2.6s to 4s of 2100Hz+-15Hz tone, then 75ms of silence. */
         s->tone_phase_rate = dds_phase_rate(2100.0);
         s->level = dds_scaling_dbm0(-11);
-        s->duration_timer = ms_to_samples(200 + 2600);
-        s->mod_phase_rate = dds_phase_rate(15.0);
+        if (s->tone_type == MODEM_CONNECT_TONES_ANSAM)
+        {
+            s->mod_phase_rate = dds_phase_rate(15.0);
+            s->mod_level = s->level/5;
+            s->duration_timer = ms_to_samples(200 + 5000);
+        }
+        else
+        {
+            s->mod_phase_rate = 0;
+            s->mod_level = 0;
+            s->duration_timer = ms_to_samples(200 + 2600);
+        }
         s->tone_phase = 0;
         s->mod_phase = 0;
-        s->mod_level = (s->tone_type == MODEM_CONNECT_TONES_ANSAM)  ?  s->level/5  :  0;
+        s->hop_timer = 0;
         break;
     case MODEM_CONNECT_TONES_ANS_PR:
     case MODEM_CONNECT_TONES_ANSAM_PR:
         s->tone_phase_rate = dds_phase_rate(2100.0);
         s->level = dds_scaling_dbm0(-12);
-        s->duration_timer = ms_to_samples(200 + 3300);
-        s->mod_phase_rate = dds_phase_rate(15.0);
+        if (s->tone_type == MODEM_CONNECT_TONES_ANSAM_PR)
+        {
+            s->mod_phase_rate = dds_phase_rate(15.0);
+            s->mod_level = s->level/5;
+            s->duration_timer = ms_to_samples(200 + 5000);
+        }
+        else
+        {
+            s->mod_phase_rate = 0;
+            s->mod_level = 0;
+            s->duration_timer = ms_to_samples(200 + 3300);
+        }
         s->tone_phase = 0;
         s->mod_phase = 0;
         s->hop_timer = ms_to_samples(450);
-        s->mod_level = (s->tone_type == MODEM_CONNECT_TONES_ANSAM_PR)  ?  s->level/5  :  0;
         break;
     default:
         if (alloced)
@@ -362,19 +394,20 @@
     int16_t notched;
     float v1;
     float famp;
-    
+    float filtered;
+
     switch (s->tone_type)
     {
     case MODEM_CONNECT_TONES_FAX_CNG:
         for (i = 0;  i < len;  i++)
         {
+            famp = amp[i];
             /* A Cauer notch at 1100Hz, spread just wide enough to meet our detection bandwidth
                criteria. */
-            famp = amp[i];
-            v1 = 0.792928f*famp + 1.0018744927985f*s->z1 - 0.54196833412465f*s->z2;
-            famp = v1 - 1.2994747954630f*s->z1 + s->z2;
-            s->z2 = s->z1;
-            s->z1 = v1;
+            v1 = 0.792928f*famp + 1.0018744927985f*s->znotch_1 - 0.54196833412465f*s->znotch_2;
+            famp = v1 - 1.2994747954630f*s->znotch_1 + s->znotch_2;
+            s->znotch_2 = s->znotch_1;
+            s->znotch_1 = v1;
             notched = (int16_t) lfastrintf(famp);
 
             /* Estimate the overall energy in the channel, and the energy in
@@ -413,22 +446,29 @@
     case MODEM_CONNECT_TONES_ANS:
         for (i = 0;  i < len;  i++)
         {
+            famp = amp[i];
+            /* A Cauer bandpass at 15Hz, with which we demodulate the AM signal. */
+            v1 = fabs(famp) + 1.996667f*s->z15hz_1 - 0.9968004f*s->z15hz_2;
+            filtered = 0.001599787f*(v1 - s->z15hz_2);
+            s->z15hz_2 = s->z15hz_1;
+            s->z15hz_1 = v1;
+            s->am_level += abs(lfastrintf(filtered)) - (s->am_level >> 8);
+            //printf("%9.1f %10.4f %9d %9d\n", famp, filtered, s->am_level, s->channel_level);
             /* A Cauer notch at 2100Hz, spread just wide enough to meet our detection bandwidth
                criteria. */
             /* This is actually centred at 2095Hz, but gets the balance we want, due
                to the asymmetric walls of the notch */
-            famp = amp[i];
-            v1 = 0.76000f*famp - 0.1183852f*s->z1 - 0.5104039f*s->z2;
-            famp = v1 + 0.1567596f*s->z1 + s->z2;
-            s->z2 = s->z1;
-            s->z1 = v1;
+            v1 = 0.76000f*famp - 0.1183852f*s->znotch_1 - 0.5104039f*s->znotch_2;
+            famp = v1 + 0.1567596f*s->znotch_1 + s->znotch_2;
+            s->znotch_2 = s->znotch_1;
+            s->znotch_1 = v1;
             notched = (int16_t) lfastrintf(famp);
             /* Estimate the overall energy in the channel, and the energy in
                the notch (i.e. overall channel energy - tone energy => noise).
                Use abs instead of multiply for speed (is it really faster?).
                Damp the overall energy a little more for a stable result.
                Damp the notch energy a little less, so we don't damp out the
-               blip every time the phase reverses */
+               blip every time the phase reverses. */
             s->channel_level += ((abs(amp[i]) - s->channel_level) >> 5);
             s->notch_level += ((abs(notched) - s->notch_level) >> 4);
             /* This should cut off at about -43dBm0 */
@@ -455,7 +495,11 @@
                     if (s->tone_cycle_duration >= ms_to_samples(450 - 25))
                     {
                         if (++s->good_cycles == 3)
-                            report_tone_state(s, MODEM_CONNECT_TONES_ANS_PR, lfastrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f));
+                        {
+                            report_tone_state(s,
+                                              (s->am_level*15/256 > s->channel_level)  ?  MODEM_CONNECT_TONES_ANSAM_PR  :  MODEM_CONNECT_TONES_ANS_PR,
+                                              lfastrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f));
+                        }
                     }
                     else
                     {
@@ -466,17 +510,21 @@
                 }
                 else
                 {
-                    if (s->tone_cycle_duration >= ms_to_samples(550))
+                    if (s->tone_cycle_duration >= ms_to_samples(450 + 100))
                     {
                         if (s->tone_present == MODEM_CONNECT_TONES_NONE)
-                            report_tone_state(s, MODEM_CONNECT_TONES_ANS, lfastrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f));
+                        {
+                            report_tone_state(s,
+                                              (s->am_level*15/256 > s->channel_level)  ?  MODEM_CONNECT_TONES_ANSAM  :  MODEM_CONNECT_TONES_ANS,
+                                              lfastrintf(log10f(s->channel_level/32768.0f)*20.0f + DBM0_MAX_POWER + 0.8f));
+                        }
                         s->good_cycles = 0;
-                        s->tone_cycle_duration = ms_to_samples(550);
+                        s->tone_cycle_duration = ms_to_samples(450 + 100);
                     }
                 }
                 s->tone_on = TRUE;
             }
-            else
+            else if (s->notch_level*5 > s->channel_level)
             {
                 if (s->tone_present == MODEM_CONNECT_TONES_ANS)
                 {
@@ -528,7 +576,7 @@
     {
     case MODEM_CONNECT_TONES_FAX_PREAMBLE:
     case MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE:
-        fsk_rx_init(&(s->v21rx), &preset_fsk_specs[FSK_V21CH2], TRUE, v21_put_bit, s);
+        fsk_rx_init(&(s->v21rx), &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, v21_put_bit, s);
         fsk_rx_signal_cutoff(&(s->v21rx), -45.5f);
         break;
     case MODEM_CONNECT_TONES_ANS_PR:
@@ -540,6 +588,7 @@
     }
     s->channel_level = 0;
     s->notch_level = 0;
+    s->am_level = 0;
     s->tone_present = MODEM_CONNECT_TONES_NONE;
     s->tone_cycle_duration = 0;
     s->good_cycles = 0;
@@ -547,8 +596,10 @@
     s->tone_on = FALSE;
     s->tone_callback = tone_callback;
     s->callback_data = user_data;
-    s->z1 = 0.0f;
-    s->z2 = 0.0f;
+    s->znotch_1 = 0.0f;
+    s->znotch_2 = 0.0f;
+    s->z15hz_1 = 0.0f;
+    s->z15hz_2 = 0.0f;
     s->num_bits = 0;
     s->flags_seen = 0;
     s->framing_ok_announced = FALSE;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/msvc/spandsp.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/msvc/spandsp.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/msvc/spandsp.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: spandsp.h.in,v 1.19 2009/09/22 13:11:04 steveu Exp $
+ * $Id: spandsp.h.in,v 1.19.4.1 2009/12/19 09:47:56 steveu Exp $
  */
 
 /*! \file */
@@ -99,7 +99,8 @@
 #include <spandsp/v18.h>
 #include <spandsp/v42.h>
 #include <spandsp/v42bis.h>
-#include <spandsp/t4.h>
+#include <spandsp/t4_rx.h>
+#include <spandsp/t4_tx.h>
 #include <spandsp/t30.h>
 #include <spandsp/t30_api.h>
 #include <spandsp/t30_fcf.h>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/plc.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/plc.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/plc.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: plc.c,v 1.27 2009/02/10 13:06:46 steveu Exp $
+ * $Id: plc.c,v 1.27.4.1 2009/12/23 14:23:49 steveu Exp $
  */
 
 /*! \file */
@@ -52,8 +52,6 @@
 /* We do a straight line fade to zero volume in 50ms when we are filling in for missing data. */
 #define ATTENUATION_INCREMENT       0.0025f     /* Attenuation per sample */
 
-#define ms_to_samples(t)            (((t)*SAMPLE_RATE)/1000)
-
 static void save_history(plc_state_t *s, int16_t *buf, int len)
 {
     if (len >= PLC_HISTORY_LEN)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/bitstream.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/bitstream.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/bitstream.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: bitstream.h,v 1.14 2009/02/10 13:06:47 steveu Exp $
+ * $Id: bitstream.h,v 1.14.4.1 2009/12/28 12:20:47 steveu Exp $
  */
 
 /*! \file */
@@ -39,7 +39,6 @@
 /*! Bitstream handler state */
 typedef struct bitstream_state_s bitstream_state_t;
 
-
 #if defined(__cplusplus)
 extern "C"
 {
@@ -52,8 +51,6 @@
     \param bits The number of bits of value to be pushed. 1 to 25 bits is valid. */
 SPAN_DECLARE(void) bitstream_put(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits);
 
-SPAN_DECLARE(void) bitstream_put2(bitstream_state_t *s, uint8_t **c, uint32_t value, int bits);
-
 /*! \brief Get a chunk of bits from the input buffer.
     \param s A pointer to the bitstream context.
     \param c A pointer to the bitstream input buffer.
@@ -61,19 +58,16 @@
     \return The value retrieved from the input buffer. */
 SPAN_DECLARE(uint32_t) bitstream_get(bitstream_state_t *s, const uint8_t **c, int bits);
 
-SPAN_DECLARE(uint32_t) bitstream_get2(bitstream_state_t *s, const uint8_t **c, int bits);
-
 /*! \brief Flush any residual bit to the output buffer.
     \param s A pointer to the bitstream context.
     \param c A pointer to the bitstream output buffer. */
 SPAN_DECLARE(void) bitstream_flush(bitstream_state_t *s, uint8_t **c);
 
-SPAN_DECLARE(void) bitstream_flush2(bitstream_state_t *s, uint8_t **c);
-
 /*! \brief Initialise a bitstream context.
     \param s A pointer to the bitstream context.
+    \param lsb_first TRUE if the bit stream is LSB first, else its MSB first.
     \return A pointer to the bitstream context. */
-SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s);
+SPAN_DECLARE(bitstream_state_t *) bitstream_init(bitstream_state_t *s, int direction);
 
 SPAN_DECLARE(int) bitstream_release(bitstream_state_t *s);
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/expose.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/expose.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/expose.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -23,7 +23,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: expose.h,v 1.14 2009/09/22 13:11:04 steveu Exp $
+ * $Id: expose.h,v 1.14.4.1 2009/12/19 09:47:56 steveu Exp $
  */
 
 /*! \file */
@@ -71,7 +71,8 @@
 #include <spandsp/private/modem_connect_tones.h>
 #include <spandsp/private/at_interpreter.h>
 #include <spandsp/private/fax_modems.h>
-#include <spandsp/private/t4.h>
+#include <spandsp/private/t4_rx.h>
+#include <spandsp/private/t4_tx.h>
 #include <spandsp/private/t30.h>
 #include <spandsp/private/fax.h>
 #include <spandsp/private/t38_core.h>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/fsk.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/fsk.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/fsk.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: fsk.h,v 1.40 2009/06/02 16:03:56 steveu Exp $
+ * $Id: fsk.h,v 1.41 2009/11/02 13:25:20 steveu Exp $
  */
 
 /*! \file */
@@ -115,6 +115,15 @@
     FSK_WEITBRECHT50    /* 50 baud version, used for TDD (Telecom Device for the Deaf) */
 };
 
+enum
+{
+    FSK_FRAME_MODE_ASYNC = 0,
+    FSK_FRAME_MODE_SYNC = 1,
+    FSK_FRAME_MODE_5N1_FRAMES = 7,      /* 5 bits of data + start bit + stop bit */
+    FSK_FRAME_MODE_7N1_FRAMES = 9,      /* 7 bits of data + start bit + stop bit */
+    FSK_FRAME_MODE_8N1_FRAMES = 10      /* 8 bits of data + start bit + stop bit */
+};
+
 SPAN_DECLARE_DATA extern const fsk_spec_t preset_fsk_specs[];
 
 /*!
@@ -149,6 +158,8 @@
                                            get_bit_func_t get_bit,
                                            void *user_data);
 
+SPAN_DECLARE(int) fsk_tx_restart(fsk_tx_state_t *s, const fsk_spec_t *spec);
+    
 SPAN_DECLARE(int) fsk_tx_release(fsk_tx_state_t *s);
 
 SPAN_DECLARE(int) fsk_tx_free(fsk_tx_state_t *s);
@@ -203,6 +214,8 @@
                                            put_bit_func_t put_bit,
                                            void *user_data);
 
+SPAN_DECLARE(int) fsk_rx_restart(fsk_rx_state_t *s, const fsk_spec_t *spec, int framing_mode);
+
 SPAN_DECLARE(int) fsk_rx_release(fsk_rx_state_t *s);
 
 SPAN_DECLARE(int) fsk_rx_free(fsk_rx_state_t *s);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/bitstream.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/bitstream.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/bitstream.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: bitstream.h,v 1.1 2008/11/30 12:45:09 steveu Exp $
+ * $Id: bitstream.h,v 1.1.4.1 2009/12/28 12:20:47 steveu Exp $
  */
 
 #if !defined(_SPANDSP_PRIVATE_BITSTREAM_H_)
@@ -35,6 +35,8 @@
     uint32_t bitstream;
     /*! The residual bits in bitstream. */
     int residue;
+    /*! TRUE if the stream is LSB first, else MSB first */
+    int lsb_first;
 };
 
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/modem_connect_tones.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/modem_connect_tones.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/modem_connect_tones.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -24,7 +24,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: modem_connect_tones.h,v 1.2 2009/01/29 18:30:14 steveu Exp $
+ * $Id: modem_connect_tones.h,v 1.3 2009/11/02 13:25:20 steveu Exp $
  */
  
 /*! \file */
@@ -66,12 +66,17 @@
     void *callback_data;
 
     /*! \brief The notch filter state. */
-    float z1;
-    float z2;
+    float znotch_1;
+    float znotch_2;
+    /*! \brief The 15Hz AM  filter state. */
+    float z15hz_1;
+    float z15hz_2;
     /*! \brief The in notch power estimate */
-    int notch_level;
+    int32_t notch_level;
     /*! \brief The total channel power estimate */
-    int channel_level;
+    int32_t channel_level;
+    /*! \brief The 15Hz AM power estimate */
+    int32_t am_level;
     /*! \brief Sample counter for the small chunks of samples, after which a test is conducted. */
     int chunk_remainder;
     /*! \brief TRUE is the tone is currently confirmed present in the audio. */

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/t30.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/t30.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/t30.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t30.h,v 1.5 2009/09/20 13:42:29 steveu Exp $
+ * $Id: t30.h,v 1.5.4.1 2009/12/19 09:47:56 steveu Exp $
  */
 
 /*! \file */
@@ -253,7 +253,7 @@
     int tx_stop_page;
     /*! \brief The current completion status. */
     int current_status;
-    /*! \brief Internet Aware FAX mode bit mask. */
+    /*! \brief Internet aware FAX mode bit mask. */
     int iaf;
     /*! \brief A bit mask of the currently supported modem types. */
     int supported_modems;

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/t30_dis_dtc_dcs_bits.h (from rev 16612, freeswitch/trunk/libs/spandsp/src/spandsp/private/t30_dis_dtc_dcs_bits.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/t30_dis_dtc_dcs_bits.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/t30_dis_dtc_dcs_bits.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,387 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * t30_dis_dtc_dcs_bits.h - ITU T.30 fax control bits definitions
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2009 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: t30_dis_dtc_dcs_bits.h,v 1.1.4.1 2009/12/19 09:47:57 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_SPANDSP_PRIVATE_T30_DIS_DTC_DCS_BITS_H_)
+#define _SPANDSP_PRIVATE_T30_DIS_DTC_DCS_BITS_H_
+
+/* Indicates that the terminal has the Simple mode capability defined in ITU-T Rec. T.37.
+   Internet address signals CIA, TSA or CSA can be sent and received. The recipient terminal
+   may process or ignore this signal. */
+#define T30_DIS_BIT_T37                                     1
+#define T30_DCS_BIT_T37                                     1
+
+/* Indicates that the terminal has the capability to communicate using ITU-T Rec. T.38.
+   Internet address signals CIA, TSA or CSA can be sent and received. The recipient terminal
+   may process or ignore this signal. */
+#define T30_DIS_BIT_T38                                     3
+#define T30_DCS_BIT_T38                                     3
+
+/* Bit 4 set to "1" indicates 3rd Generation Mobile Network Access to the GSTN Connection.
+   Bit 4 set to "0" conveys no information about the type of connection. */
+#define T30_DIS_BIT_3G_MOBILE                               4
+#define T30_DCS_BIT_3G_MOBILE                               4
+
+/* When ISDN mode is used, in DIS/DTC bit 6 shall be set to "0". */
+#define T30_DIS_BIT_V8_CAPABILITY                           6
+
+/* When ISDN mode is used, in DIS/DTC bit 7 shall be set to "0". */
+#define T30_DIS_BIT_64_OCTET_ECM_FRAMES_PREFERRED           7
+
+/* Bit 9 indicates that there is a facsimile document ready to be polled from the answering
+   terrminal. It is not an indication of a capability. */
+#define T30_DIS_BIT_READY_TO_TRANSMIT_FAX_DOCUMENT          9
+
+/* In DIS/DTC bit 10 indicates that the answering terminal has receiving capabilities.
+   In DCS it is a command to the receiving terminal to set itself in the receive mode. */
+#define T30_DIS_BIT_READY_TO_RECEIVE_FAX_DOCUMENT           10
+#define T30_DCS_BIT_RECEIVE_FAX_DOCUMENT                    10
+
+/* Bits 11, 12, 13, 14 - modem type */
+
+#define T30_DIS_BIT_200_200_CAPABLE                         15
+#define T30_DCS_BIT_200_200                                 15
+
+#define T30_DIS_BIT_2D_CAPABLE                              16
+#define T30_DCS_BIT_2D_CODING                               16
+
+/* Standard facsimile terminals conforming to ITU-T Rec. T.4 must have the following capability:
+   Paper length = 297 mm. */
+
+/* Bits 17, 18 - recording width */
+
+/* Bits 19, 20 - paper length */
+
+/* Bits 21, 22, 23 - min scan line time */
+
+/* When ISDN mode is used, in DIS/DTC bits 21 to 23 shall be set to "1". */
+
+#define T30_DIS_BIT_UNCOMPRESSED_CAPABLE                    26
+#define T30_DCS_BIT_UNCOMPRESSED_MODE                       26
+
+/* When ISDN mode is used, in DIS/DTC bit 27 shall be set to "1". */
+#define T30_DIS_BIT_ECM_CAPABLE                             27
+#define T30_DCS_BIT_ECM                                     27
+
+/* The value of bit 28 in the DCS command is only valid when ECM is selected. */
+#define T30_DCS_BIT_64_OCTET_ECM_FRAMES                     28
+
+/* The value of bit 31 in the DCS command is only valid when ECM is selected. */
+#define T30_DIS_BIT_T6_CAPABLE                              31
+#define T30_DCS_BIT_T6_MODE                                 31
+
+#define T30_DIS_BIT_FNV_CAPABLE                             33
+#define T30_DCS_BIT_FNV_CAPABLE                             33
+
+#define T30_DIS_BIT_MULTIPLE_SELECTIVE_POLLING_CAPABLE      34
+
+#define T30_DIS_BIT_POLLED_SUBADDRESSING_CAPABLE            35
+
+#define T30_DIS_BIT_T43_CAPABLE                             36
+#define T30_DCS_BIT_T43_CODING                              36
+
+#define T30_DIS_BIT_PLANE_INTERLEAVE_CAPABLE                37
+#define T30_DCS_BIT_PLANE_INTERLEAVE                        37
+
+#define T30_DIS_BIT_G726_CAPABLE                            38
+#define T30_DCS_BIT_G726                                    38
+
+#define T30_DIS_BIT_200_400_CAPABLE                         41
+#define T30_DCS_BIT_200_400                                 41
+
+#define T30_DIS_BIT_300_300_CAPABLE                         42
+#define T30_DCS_BIT_300_300                                 42
+
+#define T30_DIS_BIT_400_400_CAPABLE                         43
+#define T30_DCS_BIT_400_400                                 43
+
+/* Bits 44 and 45 are used only in conjunction with bits 15 and 43. Bit 44 in DCS, when used,
+   shall correctly indicate the resolution of the transmitted document, which means that bit 44 in DCS may
+   not always match the indication of bits 44 and 45 in DIS/DTC. Cross selection will cause the distortion
+   and reduction of reproducible area.
+   If a receiver indicates in DIS that it prefers to receive metric-based information, but the transmitter has
+   only the equivalent inch-based information (or vice versa), then communication shall still take place.
+   Bits 44 and 45 do not require the provision of any additional features on the terminal to
+   indicate to the sending or receiving user whether the information was transmitted or received on a metric-metric,
+   inch-inch, metric-inch, inch-metric basis. */
+
+#define T30_DIS_BIT_INCH_RESOLUTION_PREFERRED               44
+#define T30_DCS_BIT_INCH_RESOLUTION                         44
+
+#define T30_DIS_BIT_METRIC_RESOLUTION_PREFERRED             45
+
+#define T30_DIS_BIT_MIN_SCAN_TIME_HALVES                    46
+
+#define T30_DIS_BIT_SELECTIVE_POLLING_CAPABLE               47
+
+#define T30_DIS_BIT_SUBADDRESSING_CAPABLE                   49
+#define T30_DCS_BIT_SUBADDRESS_TRANSMISSION                 49
+
+#define T30_DIS_BIT_PASSWORD                                50
+#define T30_DCS_BIT_SENDER_ID_TRANSMISSION                  50
+
+/* Bit 51 indicates that there is a data file ready to be polled from the answering terminal. It is
+   not an indication of a capability. This bit is used in conjunction with bits 53, 54, 55 and 57. */
+#define T30_DIS_BIT_READY_TO_TRANSMIT_DATA_FILE             51
+
+/* The binary file transfer protocol is described in ITU-T Rec. T.434.  */
+#define T30_DIS_BIT_BFT_CAPABLE                             53
+#define T30_DCS_BIT_BFT                                     53
+
+#define T30_DIS_BIT_DTM_CAPABLE                             54
+#define T30_DCS_BIT_DTM                                     54
+
+#define T30_DIS_BIT_EDI_CAPABLE                             55
+#define T30_DCS_BIT_EDI                                     55
+
+#define T30_DIS_BIT_BTM_CAPABLE                             57
+#define T30_DCS_BIT_BTM                                     57
+
+/* Bit 59 indicates that there is a character-coded or mixed-mode document ready to be polled
+   from the answering terminal. It is not an indication of a capability. This bit is used in
+   conjunction with bits 60, 62 and 65. */
+#define T30_DIS_BIT_READY_TO_TRANSMIT_MIXED_MODE_DOCUMENT   59
+
+#define T30_DIS_BIT_CHARACTER_MODE                          60
+#define T30_DCS_BIT_CHARACTER_MODE                          60
+
+#define T30_DIS_BIT_MIXED_MODE                              62
+#define T30_DCS_BIT_MIXED_MODE                              62
+
+#define T30_DIS_BIT_PROCESSABLE_MODE_26                     65
+
+#define T30_DIS_BIT_DIGITAL_NETWORK_CAPABLE                 66
+#define T30_DCS_BIT_DIGITAL_NETWORK_CAPABLE                 66
+
+#define T30_DIS_BIT_DUPLEX_CAPABLE                          67
+#define T30_DCS_BIT_DUPLEX_CAPABLE                          67
+
+#define T30_DIS_BIT_T81_CAPABLE                             68
+#define T30_DCS_BIT_FULL_COLOUR_MODEX                       68
+
+#define T30_DIS_BIT_FULL_COLOUR_CAPABLE                     69
+#define T30_DCS_BIT_FULL_COLOUR_MODE                        69
+
+/* In a DIS/DTC frame, setting bit 71 to "0" indicates that the called terminal can only accept
+   image data which has been digitized to 8 bits/pel/component for JPEG mode. This is also true for T.43
+   mode if bit 36 is also set to "1". Setting bit 71 to "1" indicates that the called terminal can also accept
+   image data that are digitized to 12 bits/pel/component for JPEG mode. This is also true for T.43 mode if
+   bit 36 is also set to "1". In a DCS frame, setting bit 71 to "0" indicates that the calling terminal's image
+   data are digitized to 8 bits/pel/component for JPEG mode. This is also true for T.43 mode if bit 36 is also
+   set to "1". Setting bit 71 to "1" indicates that the calling terminal transmits image data which has been
+   digitized to 12 bits/pel/component for JPEG mode. This is also true for T.43 mode if bit 36 is also set
+   to "1". */
+#define T30_DIS_BIT_12BIT_CAPABLE                           71
+#define T30_DCS_BIT_12BIT_COMPONENT                         71
+
+#define T30_DIS_BIT_NO_SUBSAMPLING                          73
+#define T30_DCS_BIT_NO_SUBSAMPLING                          73
+
+#define T30_DIS_BIT_CUSTOM_ILLUMINANT                       74
+#define T30_DCS_BIT_CUSTOM_ILLUMINANT                       74
+
+#define T30_DIS_BIT_CUSTOM_GAMUT_RANGE                      75
+#define T30_DCS_BIT_CUSTOM_GAMUT_RANGE                      75
+
+#define T30_DIS_BIT_NORTH_AMERICAN_LETTER_CAPABLE           76
+#define T30_DCS_BIT_NORTH_AMERICAN_LETTER                   76
+
+#define T30_DIS_BIT_NORTH_AMERICAN_LEGAL_CAPABLE            77
+#define T30_DCS_BIT_NORTH_AMERICAN_LEGAL                    77
+
+#define T30_DIS_BIT_T85_CAPABLE                             78
+#define T30_DCS_BIT_T85_MODE                                78
+
+#define T30_DIS_BIT_T85_L0_CAPABLE                          79
+#define T30_DCS_BIT_T85_L0_MODE                             79
+
+/* In a DIS/DTC frame, setting bit 97 to "0" indicates that the called terminal does not have the
+   capability to accept 300 pels/25.4 mm x 300 lines/25.4 mm or 400 pels/25.4 mm x 400 lines/25.4 mm
+   resolutions for colour/gray-scale images or T.44 Mixed Raster Content (MRC) mask layer.
+   
+   Setting bit 97 to "1" indicates that the called terminal does have the capability to accept
+   300 pels/25.4 mm x 300 lines/25.4 mm or 400 pels/25.4 mm x 400 lines/25.4 mm resolutions for
+   colour/gray-scale images and MRC mask layer. Bit 97 is valid only when bits 68 and 42 or 43
+   (300 pels/25.4 mm x 300 lines/25.4 mm or 400 pels/25.4 mm x 400 lines/25.4 mm) are set to "1".
+   
+   In a DCS frame, setting bit 97 to "0" indicates that the calling terminal does not use
+   300 pels/25.4 mm x 300 lines/25.4 mm or 400 pels/25.4 mm x 400 lines/25.4 mm resolutions
+   for colour/gray-scale images and mask layer.
+   
+   Setting bit 97 to "1" indicates that the calling terminal uses 300 pels/25.4 mm x 300 lines/25.4 mm
+   or 400 pels/25.4 mm x 400 lines/25.4 mm resolutions for colour/gray-scale images and MRC mask layer.
+   Bit 97 is valid only when bits 68 and 42 or 43 (300 pels/25.4 mm x 300 lines/25.4 mm and
+   400 pels/25.4 mm x 400 lines/25.4 mm) are set to "1".
+
+   In a DIS/DTC frame, combinations of bit 42, bit 43 and bit 97 indicate that the called terminal
+   has higher resolution capabilities as follows:
+
+            Resolution capabilities (pels/25.4 mm)
+    DIS/DTC     Monochrome              Colour/gray-scale
+    42 43 97    300 x 300   400 x 400   300 x 300   400 x 400
+     0  0  0    no          no          no          no
+     1  0  0    yes         no          no          no
+     0  1  0    no          yes         no          no
+     1  1  0    yes         yes         no          no
+     0  0  1    (invalid)
+     1  0  1    yes         no          yes         no
+     0  1  1    no          yes         no          yes
+     1  1  1    yes         yes         yes         yes
+        "yes" means that the called terminal has the corresponding capability.
+        "no" means that the called terminal does not have the corresponding capability. */
+#define T30_DIS_BIT_COLOUR_GREY_300_300_400_400_CAPABLE     97
+#define T30_DCS_BIT_COLOUR_GREY_300_300_400_400             97
+
+/* In a DIS/DTC frame, setting bit 98 to "0" indicates that the called terminal does not have the
+   capability to accept 100 pels/25.4 mm x 100 lines/25.4 mm spatial resolution for colour or gray-scale
+   images. Setting bit 98 to "1" indicates that the called terminal does have the capability to accept
+   100 pels/25.4 mm  x 100 lines/25.4 mm spatial resolution for colour or gray-scale images. Bit 98 is valid
+   only when bit 68 is set to "1". In a DCS frame, setting bit 98 to "0" indicates that the calling terminal does
+   not use 100 pels/25.4 mm  x 100 lines/25.4 mm spatial resolution for colour or gray-scale images. Setting
+   bit 98 to "1" indicates that the calling terminal uses 100 pels/25.4 mm x 100 lines/25.4 mm spatial
+   resolution for colour or gray-scale images. */
+#define T30_DIS_BIT_COLOUR_GREY_100_100_CAPABLE             98
+#define T30_DCS_BIT_COLOUR_GREY_100_100                     98
+
+/* To provide an error recovery mechanism, when PWD/SEP/SUB/SID/PSA/IRA/ISP frames are sent with DCS or DTC,
+    bits 49, 102 and 50 in DCS or bits 47, 101, 50 and 35 in DTC shall be set to "1" with the following
+    meaning:
+    Bit DIS                                             DTC                                                 DCS
+    35  Polled SubAddress capability                    Polled SubAddress transmission                      Not allowed \x96 set to "0"
+    47  Selective polling capability                    Selective polling transmission                      Not allowed \x96 set to "0"
+    49  Subaddressing capability                        Not allowed (Set to "0")                            Subaddressing transmission
+    50  Password                                        Password transmission                               Sender Identification transmission
+    101 Internet Selective Polling Address capability   Internet Selective Polling Address transmission     Not allowed \x96 set to "0"
+    102 Internet Routing Address capability             Not allowed (Set to "0")                            Internet Routing Address transmission
+
+   Terminals conforming to the 1993 version of T.30 may set the above bits to "0" even though PWD/SEP/SUB
+   frames are transmitted. */
+#define T30_DIS_BIT_INTERNET_SELECTIVE_POLLING_ADDRESS      101
+
+#define T30_DIS_BIT_INTERNET_ROUTING_ADDRESS                102
+#define T30_DCS_BIT_INTERNET_ROUTING_ADDRESS_TRANSMISSION   102
+
+#define T30_DIS_BIT_600_600_CAPABLE                         105
+#define T30_DCS_BIT_600_600                                 105
+
+#define T30_DIS_BIT_1200_1200_CAPABLE                       106
+#define T30_DCS_BIT_1200_1200                               106
+
+#define T30_DIS_BIT_300_600_CAPABLE                         107
+#define T30_DCS_BIT_300_600                                 107
+
+#define T30_DIS_BIT_400_800_CAPABLE                         108
+#define T30_DCS_BIT_400_800                                 108
+
+#define T30_DIS_BIT_600_1200_CAPABLE                        109
+#define T30_DCS_BIT_600_1200                                109
+
+#define T30_DIS_BIT_COLOUR_GREY_600_600_CAPABLE             110
+#define T30_DCS_BIT_COLOUR_GREY_600_600                     110
+
+#define T30_DIS_BIT_COLOUR_GREY_1200_1200_CAPABLE           111
+#define T30_DCS_BIT_COLOUR_GREY_1200_1200                   111
+
+#define T30_DIS_BIT_ALTERNATE_DOUBLE_SIDED_CAPABLE          113
+#define T30_DCS_BIT_ALTERNATE_DOUBLE_SIDED_CAPABLE          113
+
+#define T30_DIS_BIT_CONTINUOUS_DOUBLE_SIDED_CAPABLE         114
+#define T30_DCS_BIT_CONTINUOUS_DOUBLE_SIDED_CAPABLE         114
+
+#define T30_DIS_BIT_BLACK_AND_WHITE_MRC                     115
+
+#define T30_DIS_BIT_T45_CAPABLE                             116
+#define T30_DCS_BIT_T45_MODE                                116
+
+/* This bit defines the available colour space, when bit 92, 93 or 94 is set to "1".
+   Available colour space for all combinations of bits 92, 93, 94 and 119 are shown in the following table.
+   It should be noted that terminals which conform to the 2003 and earlier versions of this Recommendation
+   will send LAB with "1" in bit 92, 93 or 94 even if bit 119 is set to "1".
+
+        Available colour space for DIS/DTC bits 92, 93, 94 and 119
+
+    92 93 94 119    Mode of T.44        Available colour space
+     0  0  0  x     Not available       -
+     1  0  0  0     Mode 1              LAB only
+     1  0  0  1     Mode 1              YCC only
+     x  1  x  0     Mode 2 or higher    LAB only
+     x  x  1  0     Mode 2 or higher    LAB only
+     x  1  x  1     Mode 2 or higher    LAB and YCC
+     x  x  1  1     Mode 2 or higher    LAB and YCC
+
+        Colour space for DCS bits 92, 93, 94 and 119
+
+    92 93 94 119    Mode of T.44        Colour space
+     0  0  0  x*    Not available       -
+     1  0  0  0     Mode 1              LAB
+     1  0  0  1     Mode 1              YCC
+     x  1  x  0     Mode 2 or higher    LAB
+     x  x  1  0     Mode 2 or higher    LAB
+     x  1  x  1     Mode 2 or higher    YCC or mixing of YCC and LAB
+     x  x  1  1     Mode 2 or higher    YCC or mixing of YCC and LAB */
+#define T30_DIS_BIT_T44_COLOUR_SPACE                        119
+#define T30_DCS_BIT_T44_COLOUR_SPACE                        119
+
+/* Can only be set in the communication through the T.38 gateway, to cope with delay of network.
+   T.x timer (12+-1s) should be used after emitting RNR or TNR. However, after receiving
+   PPS signal in ECM mode, T.5 timer should be used. */
+#define T30_DIS_BIT_T38_FLOW_CONTROL_CAPABLE                121
+#define T30_DCS_BIT_T38_FLOW_CONTROL_CAPABLE                121
+
+/* For resolutions greater than 200 lines/25.4 mm, 4.2.1.1/T.4 specifies the use of specific K
+   factors for each standardized vertical resolution. To ensure backward compatibility with earlier
+   versions of ITU-T Rec. T.4, bit 122 indicates when such K factors are being used. */
+#define T30_DIS_BIT_K_GREATER_THAN_4                        122
+
+/* This bit should be set to "1" if the fax device is an Internet-Aware Fax Device as defined in
+   ITU-T Rec. T.38 and if it is not affected by the data signal rate indicated by the DIS and DTC
+   signals when communicating with another Internet-Aware Fax Device operating in T.38 mode. This
+   bit shall not be used in GSTN mode. */
+#define T30_DIS_BIT_T38_FAX_CAPABLE                         123
+/* This bit should be set to "1" if the fax device elects to operate in an Internet-Aware Fax mode
+   as defined in ITU-T Rec. T.38 in response to a device which has set the related DIS bit to "1".
+   When this bit is set to "1", the data signal rate of the modem (bits 11-14) should be set to "0". */
+#define T30_DCS_BIT_T38_FAX_MODE                            123
+
+/* When either bit of 31, 36, 38, 51, 53, 54, 55, 57, 59, 60, 62, 65, 68, 78, 79, 115, 116 and 127 is
+   set to "1", ECM must be used. If the value of bit field 92 to 94 is non-zero, then ECM must be used.
+
+   Annex K describes the optional continuous-tone colour and gray scale images mode
+   (sYCC-JPEG mode) protocol. When bit 127 in DIS/DTC frame is set to "1", the called terminal has the
+   capability to accept sYCC-JPEG mode. This is defined with complete independent in the colour space
+   CIELAB. In addition, when bit 127 in DCS frame is set to "1", ECM must be used and bits 15, 17, 18,
+   19, 20, 41, 42, 43, 45, 46, 68, 69, 71, 73, 74, 75, 76, 77, 97, 98, 105, 106, 107, 108,
+   109, 110 and 111 in DCS frame are "Don't care", and should be set to "0". In the case of
+   transmission of multiple images, a post message signal PPS-MPS between pages, PPS-NULL between
+   partial pages and PPS-EOP following the last page should be sent from the calling terminal to the
+   called terminal. */
+#define T30_DIS_BIT_SYCC_T81_CAPABLE                        127
+#define T30_DCS_BIT_SYCC_T81_MODE                           127
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/t38_gateway.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/t38_gateway.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/t38_gateway.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_gateway.h,v 1.4 2009/05/16 03:34:45 steveu Exp $
+ * $Id: t38_gateway.h,v 1.5 2009/11/07 08:58:58 steveu Exp $
  */
 
 /*! \file */
@@ -163,8 +163,8 @@
     int ecm_mode;
     /*! \brief The current bit rate for the fast modem. */
     int fast_bit_rate;
-    /*! \brief The current fast modem type. */
-    int fast_modem;
+    /*! \brief The current fast receive modem type. */
+    int fast_rx_modem;
     /*! \brief The type of fast receive modem currently active, which may be T38_NONE */
     int fast_rx_active;
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/t38_non_ecm_buffer.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/t38_non_ecm_buffer.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/t38_non_ecm_buffer.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -23,7 +23,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_non_ecm_buffer.h,v 1.2 2008/10/13 14:19:18 steveu Exp $
+ * $Id: t38_non_ecm_buffer.h,v 1.2.4.1 2009/12/19 06:43:28 steveu Exp $
  */
 
 #if !defined(_SPANDSP_PRIVATE_T38_NON_ECM_BUFFER_H_)
@@ -36,7 +36,7 @@
 {
     /*! \brief Minimum number of bits per row, used when fill bits are being deleted on the
                link, and restored at the emitting gateway. */
-    int min_row_bits;
+    int min_bits_per_row;
 
     /*! \brief non-ECM modem transmit data buffer. */
     uint8_t data[T38_NON_ECM_TX_BUF_LEN];
@@ -55,8 +55,8 @@
     /*! \brief The non-ECM flow control fill octet (0xFF before the first data, and 0x00
                once data has started). */
     uint8_t flow_control_fill_octet;
-    /*! \brief TRUE if we are in the initial all ones part of non-ECM transmission. */
-    int at_initial_all_ones;
+    /*! \brief A code for the phase of input buffering, from initial all ones to completion. */
+    int input_phase;
     /*! \brief TRUE is the end of non-ECM data indication has been received. */
     int data_finished;
     /*! \brief The current octet being transmitted from the buffer. */

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/t4_rx.h (from rev 16612, freeswitch/trunk/libs/spandsp/src/spandsp/private/t4_rx.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/t4_rx.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/t4_rx.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,131 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/t4_rx.h - definitions for T.4 FAX receive processing
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2003 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: t4_rx.h,v 1.6.2.8 2009/12/21 17:18:40 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_T4_RX_H_)
+#define _SPANDSP_PRIVATE_T4_RX_H_
+
+/*!
+    TIFF specific state information to go with T.4 compression or decompression handling.
+*/
+typedef struct
+{
+    /*! \brief The current file name. */
+    const char *file;
+    /*! \brief The libtiff context for the current TIFF file */
+    TIFF *tiff_file;
+
+    /*! \brief The number of pages in the current image file. */
+    int pages_in_file;
+
+    /*! \brief The compression type for output to the TIFF file. */
+    int32_t output_compression;
+    /*! \brief The TIFF photometric setting for the current page. */
+    uint16_t photo_metric;
+    /*! \brief The TIFF fill order setting for the current page. */
+    uint16_t fill_order;
+    /*! \brief The TIFF G3 FAX options. */
+    int32_t output_t4_options;
+
+    /* "Background" information about the FAX, which can be stored in the image file. */
+    /*! \brief The vendor of the machine which produced the file. */ 
+    const char *vendor;
+    /*! \brief The model of machine which produced the file. */ 
+    const char *model;
+    /*! \brief The local ident string. */ 
+    const char *local_ident;
+    /*! \brief The remote end's ident string. */ 
+    const char *far_ident;
+    /*! \brief The FAX sub-address. */ 
+    const char *sub_address;
+    /*! \brief The FAX DCS information, as an ASCII string. */ 
+    const char *dcs;
+
+    /*! \brief The first page to transfer. -1 to start at the beginning of the file. */
+    int start_page;
+    /*! \brief The last page to transfer. -1 to continue to the end of the file. */
+    int stop_page;
+} t4_tiff_state_t;
+
+typedef struct t4_t6_decode_state_s t4_t6_decode_state_t;
+
+/*!
+    T.4 1D, T4 2D and T6 decompressor state.
+*/
+struct t4_t6_decode_state_s
+{
+    /*! \brief Callback function to write a row of pixels to the image destination. */
+    t4_row_write_handler_t row_write_handler;
+    /*! \brief Opaque pointer passed to row_write_handler. */
+    void *row_write_user_data;
+
+    /*! \brief Incoming bit buffer for decompression. */
+    uint32_t rx_bitstream;
+    /*! \brief The number of bits currently in rx_bitstream. */
+    int rx_bits;
+    /*! \brief The number of bits to be skipped before trying to match the next code word. */
+    int rx_skip_bits;
+
+    /*! \brief This variable is used to count the consecutive EOLS we have seen. If it
+               reaches six, this is the end of the image. It is initially set to -1 for
+               1D and 2D decoding, as an indicator that we must wait for the first EOL,
+               before decoding any image data. */
+    int consecutive_eols;
+
+    /*! \brief The reference or starting changing element on the coding line. At the
+               start of the coding line, a0 is set on an imaginary white changing element
+               situated just before the first element on the line. During the coding of
+               the coding line, the position of a0 is defined by the previous coding mode.
+               (See T.4/4.2.1.3.2.). */
+    int a0;
+    /*! \brief The first changing element on the reference line to the right of a0 and of
+               opposite colour to a0. */
+    int b1;
+    /*! \brief The length of the in-progress run of black or white. */
+    int run_length;
+    /*! \brief 2D horizontal mode control. */
+    int black_white;
+    /*! \brief TRUE if the current run is black */
+    int its_black;
+
+    /*! \brief The current step into the current row run-lengths buffer. */
+    int a_cursor;
+    /*! \brief The current step into the reference row run-lengths buffer. */
+    int b_cursor;
+
+    /*! \brief A pointer into the image buffer indicating where the last row begins */
+    int last_row_starts_at;
+
+    /*! \brief The current number of consecutive bad rows. */
+    int curr_bad_row_run;
+    /*! \brief The longest run of consecutive bad rows seen in the current page. */
+    int longest_bad_row_run;
+    /*! \brief The total number of bad rows in the current page. */
+    int bad_rows;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/t4_tx.h (from rev 16612, freeswitch/trunk/libs/spandsp/src/spandsp/private/t4_tx.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/t4_tx.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/t4_tx.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,142 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * private/t4_tx.h - definitions for T.4 FAX transmit processing
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2003 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: t4_tx.h,v 1.7.2.4 2009/12/21 17:18:40 steveu Exp $
+ */
+
+#if !defined(_SPANDSP_PRIVATE_T4_TX_H_)
+#define _SPANDSP_PRIVATE_T4_TX_H_
+
+typedef struct t4_t6_encode_state_s t4_t6_encode_state_t;
+
+/*!
+    T.4 1D, T4 2D and T6 compressor state.
+*/
+struct t4_t6_encode_state_s
+{
+    /*! \brief The minimum number of encoded bits per row. This is a timing thing
+               for hardware FAX machines. */
+    int min_bits_per_row;
+    /*! \brief The current maximum contiguous rows that may be 2D encoded. */
+    int max_rows_to_next_1d_row;
+
+    /*! \brief The text which will be used in FAX page header. No text results
+               in no header line. */
+    const char *header_info;
+
+    /*! \brief Number of rows left that can be 2D encoded, before a 1D encoded row
+               must be used. */
+    int rows_to_next_1d_row;
+
+    /*! \brief The number of runs currently in the reference row. */
+    int ref_steps;
+
+    /*! \brief Pointer to the byte containing the next image bit to transmit. */
+    int bit_pos;
+    /*! \brief Pointer to the bit within the byte containing the next image bit to transmit. */
+    int bit_ptr;
+
+    /*! \brief Callback function to read a row of pixels from the image source. */
+    t4_row_read_handler_t row_read_handler;
+    /*! \brief Opaque pointer passed to row_read_handler. */
+    void *row_read_user_data;
+};
+
+/*!
+    T.4 FAX compression/decompression descriptor. This defines the working state
+    for a single instance of a T.4 FAX compression or decompression channel.
+*/
+struct t4_state_s
+{
+    /*! \brief The same structure is used for T.4 transmit and receive. This variable
+               records which mode is in progress. */
+    int rx;
+
+    /*! \brief The type of compression used between the FAX machines. */
+    int line_encoding;
+
+    /*! \brief The time at which handling of the current page began. */
+    time_t page_start_time;
+
+    /*! \brief The size of the compressed image on the line side, in bits. */
+    int line_image_size;
+
+    /*! \brief The current number of bytes per row of uncompressed image data. */
+    int bytes_per_row;
+    /*! \brief The size of the image in the image buffer, in bytes. */
+    int image_size;
+    /*! \brief The current size of the image buffer. */
+    int image_buffer_size;
+    /*! \brief A point to the image buffer. */
+    uint8_t *image_buffer;
+
+    /*! \brief The number of pages transferred to date. */
+    int current_page;
+    /*! \brief Column-to-column (X) resolution in pixels per metre. */
+    int x_resolution;
+    /*! \brief Row-to-row (Y) resolution in pixels per metre. */
+    int y_resolution;
+    /*! \brief Width of the current page, in pixels. */
+    int image_width;
+    /*! \brief Length of the current page, in pixels. */
+    int image_length;
+    /*! \brief Current pixel row number. */
+    int row;
+
+    /*! \brief This variable is set if we are treating the current row as a 2D encoded
+               one. */
+    int row_is_2d;
+    /*! \brief The current length of the current row. */
+    int row_len;
+
+    /*! \brief Black and white run-lengths for the current row. */
+    uint32_t *cur_runs;
+    /*! \brief Black and white run-lengths for the reference row. */
+    uint32_t *ref_runs;
+    /*! \brief Pointer to the buffer for the current pixel row. */
+    uint8_t *row_buf;
+
+    /*! \brief Encoded data bits buffer. */
+    uint32_t tx_bitstream;
+    /*! \brief The number of bits currently in tx_bitstream. */
+    int tx_bits;
+
+    /*! \brief The current number of bits in the current encoded row. */
+    int row_bits;
+    /*! \brief The minimum bits in any row of the current page. For monitoring only. */
+    int min_row_bits;
+    /*! \brief The maximum bits in any row of the current page. For monitoring only. */
+    int max_row_bits;
+
+    /*! \brief Error and flow logging control */
+    logging_state_t logging;
+
+    /*! \brief All TIFF file specific state information for the T.4 context. */
+    t4_tiff_state_t tiff;
+    t4_t6_decode_state_t t4_t6_rx;
+    t4_t6_encode_state_t t4_t6_tx;
+};
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/v17rx.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/v17rx.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/v17rx.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v17rx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $
+ * $Id: v17rx.h,v 1.2.4.1 2009/12/24 16:52:30 steveu Exp $
  */
 
 #if !defined(_SPANDSP_PRIVATE_V17RX_H_)
@@ -84,7 +84,10 @@
     /*! \brief The state of the differential decoder */
     int diff;
     /*! \brief The register for the data scrambler. */
-    unsigned int scramble_reg;
+    uint32_t scramble_reg;
+    /*! \brief Scrambler tap */
+    //int scrambler_tap;
+
     /*! \brief TRUE if the short training sequence is to be used. */
     int short_train;
     /*! \brief The section of the training data we are currently in. */

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/v17tx.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/v17tx.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/v17tx.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v17tx.h,v 1.2 2009/07/09 13:52:09 steveu Exp $
+ * $Id: v17tx.h,v 1.2.4.1 2009/12/24 16:52:30 steveu Exp $
  */
 
 /*! \file */
@@ -71,9 +71,13 @@
     int diff;
     /*! \brief The current state of the convolutional encoder. */
     int convolution;
+    /*! \brief The code number for the current position in the constellation. */
+    int constellation_state;
 
     /*! \brief The register for the data scrambler. */
-    unsigned int scramble_reg;
+    uint32_t scramble_reg;
+    /*! \brief Scrambler tap */
+    //int scrambler_tap;
     /*! \brief TRUE if transmitting the training sequence. FALSE if transmitting user data. */
     int in_training;
     /*! \brief TRUE if the short training sequence is to be used. */
@@ -87,8 +91,6 @@
     int32_t carrier_phase_rate;
     /*! \brief The current fractional phase of the baud timing. */
     int baud_phase;
-    /*! \brief The code number for the current position in the constellation. */
-    int constellation_state;
     
     /*! \brief A pointer to the constellation currently in use. */
 #if defined(SPANDSP_USE_FIXED_POINT)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/v18.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/v18.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/v18.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v18.h,v 1.4 2009/04/11 15:16:14 steveu Exp $
+ * $Id: v18.h,v 1.5 2009/11/04 15:52:06 steveu Exp $
  */
  
 #if !defined(_SPANDSP_PRIVATE_V18_H_)
@@ -31,7 +31,7 @@
 struct v18_state_s
 {
     /*! \brief TRUE if we are the calling modem */
-    int caller;
+    int calling_party;
     int mode;
     put_msg_func_t put_msg;
     void *user_data;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/v22bis.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/v22bis.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/v22bis.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v22bis.h,v 1.11 2009/07/09 13:52:09 steveu Exp $
+ * $Id: v22bis.h,v 1.12 2009/11/04 15:52:06 steveu Exp $
  */
 
 #if !defined(_SPANDSP_PRIVATE_V22BIS_H_)
@@ -76,7 +76,7 @@
     /*! \brief The maximum permitted bit rate of the modem. Valid values are 1200 and 2400. */
     int bit_rate;
     /*! \brief TRUE is this is the calling side modem. */
-    int caller;
+    int calling_party;
     /*! \brief The callback function used to get the next bit to be transmitted. */
     get_bit_func_t get_bit;
     /*! \brief A user specified opaque pointer passed to the get_bit callback routine. */

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/v42.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/v42.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/v42.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v42.h,v 1.1 2008/11/15 14:43:08 steveu Exp $
+ * $Id: v42.h,v 1.2 2009/11/04 15:52:06 steveu Exp $
  */
 
 #if !defined(_SPANDSP_PRIVATE_V42_H_)
@@ -92,7 +92,7 @@
 struct v42_state_s
 {
     /*! TRUE if we are the calling party, otherwise FALSE */
-    int caller;
+    int calling_party;
     /*! TRUE if we should detect whether the far end is V.42 capable. FALSE if we go
         directly to protocol establishment */
     int detect;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/v8.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/v8.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/private/v8.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v8.h,v 1.1 2008/10/13 13:14:01 steveu Exp $
+ * $Id: v8.h,v 1.3.4.1 2009/12/28 12:20:47 steveu Exp $
  */
  
 #if !defined(_SPANDSP_PRIVATE_V8_H_)
@@ -31,9 +31,15 @@
 struct v8_state_s
 {
     /*! \brief TRUE if we are the calling modem */
-    int caller;
-    /*! \brief The current state of the V8 protocol */
+    int calling_party;
+
+    v8_result_handler_t *result_handler;
+    void *result_handler_user_data;
+
+    /*! \brief The current state of the V.8 protocol */
     int state;
+    int fsk_tx_on;
+    int modem_connect_tone_tx_on;
     int negotiation_timer;
     int ci_timer;
     int ci_count;
@@ -43,24 +49,14 @@
     modem_connect_tones_tx_state_t ansam_tx;
     modem_connect_tones_rx_state_t ansam_rx;
 
-    v8_result_handler_t *result_handler;
-    void *result_handler_user_data;
-
     /*! \brief Modulation schemes available at this end. */
-    int available_modulations;
-    int common_modulations;
-    int negotiated_modulation;
-    int far_end_modulations;
-    
-    int call_function;
-    int protocol;
-    int pstn_access;
-    int nsf_seen;
-    int pcm_modem_availability;
-    int t66_seen;
+    unsigned int far_end_modulations;
 
-    /* V8 data parsing */
-    unsigned int bit_stream;
+    v8_parms_t parms;
+    v8_parms_t result;
+
+    /* V.8 data parsing */
+    uint32_t bit_stream;
     int bit_cnt;
     /* Indicates the type of message coming up */
     int preamble_type;
@@ -70,7 +66,7 @@
     /*! \brief a reference copy of the last CM or JM message, used when
                testing for matches. */
     uint8_t cm_jm_data[64];
-    int cm_jm_count;
+    int cm_jm_len;
     int got_cm_jm;
     int got_cj;
     int zero_byte_count;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/t30.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/t30.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/t30.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t30.h,v 1.126 2009/09/21 15:52:39 steveu Exp $
+ * $Id: t30.h,v 1.126.4.1 2009/12/19 09:47:56 steveu Exp $
  */
 
 /*! \file */
@@ -347,7 +347,7 @@
     T30_SUPPORT_V17 = 0x04,
     /*! Support the V.34 modem (up to 33,600bps) for image transfer. */
     T30_SUPPORT_V34 = 0x08,
-    /*! Support the Internet Aware FAX mode (no bit rate limit) for image transfer. */
+    /*! Support the Internet aware FAX mode (no bit rate limit) for image transfer. */
     T30_SUPPORT_IAF = 0x10
 };
 
@@ -361,16 +361,18 @@
     T30_SUPPORT_T4_2D_COMPRESSION = 0x04,
     /*! T.6 2D compression */
     T30_SUPPORT_T6_COMPRESSION = 0x08,
-    /*! T.85 monochrome JBIG coding */
+    /*! T.85 monochrome JBIG compression */
     T30_SUPPORT_T85_COMPRESSION = 0x10,
-    /*! T.43 colour JBIG coding */
+    /*! T.43 colour JBIG compression */
     T30_SUPPORT_T43_COMPRESSION = 0x20,
     /*! T.45 run length colour compression */
     T30_SUPPORT_T45_COMPRESSION = 0x40,
-    /*! T.81 + T.30 Annex E colour JPEG coding */
+    /*! T.81 + T.30 Annex E colour JPEG compression */
     T30_SUPPORT_T81_COMPRESSION = 0x80,
-    /*! T.81 + T.30 Annex K colour sYCC-JPEG coding */
-    T30_SUPPORT_SYCC_T81_COMPRESSION = 0x100
+    /*! T.81 + T.30 Annex K colour sYCC-JPEG compression */
+    T30_SUPPORT_SYCC_T81_COMPRESSION = 0x100,
+    /*! T.88 monochrome JBIG2 compression */
+    T30_SUPPORT_T88_COMPRESSION = 0x200
 };
 
 enum

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/t30_fcf.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/t30_fcf.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/t30_fcf.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,7 +1,7 @@
 /*
  * SpanDSP - a series of DSP components for telephony
  *
- * fcf.h - ITU T.30 fax control field definitions
+ * t30_fcf.h - ITU T.30 fax control field definitions
  *
  * Written by Steve Underwood <steveu@coppice.org>
  *
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t30_fcf.h,v 1.17 2008/08/03 03:44:00 steveu Exp $
+ * $Id: t30_fcf.h,v 1.18 2009/10/08 15:14:31 steveu Exp $
  */
 
 /*! \file */

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/t38_non_ecm_buffer.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/t38_non_ecm_buffer.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/t38_non_ecm_buffer.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -23,7 +23,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_non_ecm_buffer.h,v 1.7 2009/02/10 13:06:47 steveu Exp $
+ * $Id: t38_non_ecm_buffer.h,v 1.7.4.1 2009/12/19 06:43:28 steveu Exp $
  */
 
 /*! \file */
@@ -35,9 +35,38 @@
 \section t38_non_ecm_buffer_page_sec_1 What does it do?
 
 The T.38 rate adapting non-ECM image data buffer is used to buffer TCF and non-ECM
-FAX image data being gatewayed from a T.38 linke to an analogue FAX modem link.
+FAX image data being gatewayed from a T.38 link to an analogue FAX modem link.
 
+As well as rate adapting, the buffer has the ability to impose a minimum on the number
+of bits per row of image data. This allows any row padding zeros to be stripped from
+the data stream, to minimise the data sent as T.38 packets, and be reinserted before
+the data is sent to its final destination. Not all T.38 implementations support this
+feature, so it's use must be negotiated.
+
 \section t38_non_ecm_buffer_page_sec_2 How does it work?
+
+When inserting padding bits, whether to ensure a minimum row time or for flow control,
+it is important the right value is inserted at the right point in the data sequence.
+If we are in the optional initial period of all ones, we can insert a byte of extra
+ones at any time. Once we pass that initial stage, TCF and image data need separate
+handling.
+
+TCF data is all zeros. Once the period of all zeros has begun it is OK to insert
+additional bytes of zeros at any point.
+
+Image data consists of rows, separated by EOL (end of line) markers. Inserting
+zeros at arbitrary times would corrupt the image. However, it is OK to insert a
+considerable number of extra zeros just before an EOL. Therefore we track where the
+EOL markers occur as we fill the buffer. As we empty the buffer stop outputting real
+data, and start outputting bytes of zero, if we reach this last EOL marker location.
+The EOL marker is 11 zeros following by 1 (1D mode) or 2 (2D mode) ones. Therefore, it
+always spills across 2 bytes in the buffer, and there is always a point where we can
+insert our extra zeros between bytes.
+
+Padding between the group of successive EOL markers which for the RTC (return to control)
+marker that ends an image causes some FAX machines not to recognise them as an RTC condition.
+Therefore, our padding applies special protection so padding never occurs between two
+successive EOL markers, with no pixel data between them.
 */
 
 /*! The buffer length much be a power of two. The chosen length is big enough for

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/t4_rx.h (from rev 16612, freeswitch/trunk/libs/spandsp/src/spandsp/t4_rx.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/t4_rx.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/t4_rx.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,344 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * t4_rx.h - definitions for T.4 FAX receive processing
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2003 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: t4_rx.h,v 1.3.2.3 2009/12/21 17:18:40 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_SPANDSP_T4_RX_H_)
+#define _SPANDSP_T4_RX_H_
+
+/*! \page t4_page T.4 image compression and decompression
+
+\section t4_page_sec_1 What does it do?
+The T.4 image compression and decompression routines implement the 1D and 2D
+encoding methods defined in ITU specification T.4. They also implement the pure
+2D encoding method defined in T.6. These are image compression algorithms used
+for FAX transmission.
+
+\section t4_page_sec_1 How does it work?
+*/
+
+typedef int (*t4_row_write_handler_t)(void *user_data, const uint8_t buf[], size_t len);
+
+/*! Supported compression modes. */
+typedef enum
+{
+    /*! No compression */
+    T4_COMPRESSION_NONE = 0,
+    /*! T.1 1D compression */
+    T4_COMPRESSION_ITU_T4_1D = 1,
+    /*! T.4 2D compression */
+    T4_COMPRESSION_ITU_T4_2D = 2,
+    /*! T.6 2D compression */
+    T4_COMPRESSION_ITU_T6 = 3,
+    /*! T.85 monochrome JBIG coding */
+    T4_COMPRESSION_ITU_T85 = 4,
+    /*! T.43 colour JBIG coding */
+    T4_COMPRESSION_ITU_T43 = 5,
+    /*! T.45 run length colour compression */
+    T4_COMPRESSION_ITU_T45 = 6,
+    /*! T.81 + T.30 Annex E colour JPEG coding */
+    T4_COMPRESSION_ITU_T81 = 7,
+    /*! T.81 + T.30 Annex K colour sYCC-JPEG coding */
+    T4_COMPRESSION_ITU_SYCC_T81 = 8
+} t4_image_compression_t;
+
+/*! Supported X resolutions, in pixels per metre. */
+typedef enum
+{
+    T4_X_RESOLUTION_R4 = 4016,
+    T4_X_RESOLUTION_R8 = 8031,
+    T4_X_RESOLUTION_300 = 11811,
+    T4_X_RESOLUTION_R16 = 16063,
+    T4_X_RESOLUTION_600 = 23622,
+    T4_X_RESOLUTION_800 = 31496,
+    T4_X_RESOLUTION_1200 = 47244
+} t4_image_x_resolution_t;
+
+/*! Supported Y resolutions, in pixels per metre. */
+typedef enum
+{
+    T4_Y_RESOLUTION_STANDARD = 3850,
+    T4_Y_RESOLUTION_FINE = 7700,
+    T4_Y_RESOLUTION_300 = 11811,
+    T4_Y_RESOLUTION_SUPERFINE = 15400,  /* 400 is 15748 */
+    T4_Y_RESOLUTION_600 = 23622,
+    T4_Y_RESOLUTION_800 = 31496,
+    T4_Y_RESOLUTION_1200 = 47244
+} t4_image_y_resolution_t;
+
+/*!
+    Exact widths in PELs for the difference resolutions, and page widths.
+    Note:
+        The A4 widths also apply to North American letter and legal.
+        The R4 resolution widths are not supported in recent versions of T.30
+        Only images of exactly these widths are acceptable for FAX transmisson.
+
+    R4    864 pels/215mm for ISO A4, North American Letter and Legal
+    R4   1024 pels/255mm for ISO B4
+    R4   1216 pels/303mm for ISO A3
+    R8   1728 pels/215mm for ISO A4, North American Letter and Legal
+    R8   2048 pels/255mm for ISO B4
+    R8   2432 pels/303mm for ISO A3
+    R16  3456 pels/215mm for ISO A4, North American Letter and Legal
+    R16  4096 pels/255mm for ISO B4
+    R16  4864 pels/303mm for ISO A3
+*/
+typedef enum
+{
+    T4_WIDTH_R4_A4 = 864,
+    T4_WIDTH_R4_B4 = 1024,
+    T4_WIDTH_R4_A3 = 1216,
+    T4_WIDTH_R8_A4 = 1728,
+    T4_WIDTH_R8_B4 = 2048,
+    T4_WIDTH_R8_A3 = 2432,
+    T4_WIDTH_300_A4 = 2592,
+    T4_WIDTH_300_B4 = 3072,
+    T4_WIDTH_300_A3 = 3648,
+    T4_WIDTH_R16_A4 = 3456,
+    T4_WIDTH_R16_B4 = 4096,
+    T4_WIDTH_R16_A3 = 4864,
+    T4_WIDTH_600_A4 = 5184,
+    T4_WIDTH_600_B4 = 6144,
+    T4_WIDTH_600_A3 = 7296,
+    T4_WIDTH_1200_A4 = 10368,
+    T4_WIDTH_1200_B4 = 12288,
+    T4_WIDTH_1200_A3 = 14592
+} t4_image_width_t;
+
+/*!
+    Length of the various supported paper sizes, in pixels at the various Y resolutions.
+    Paper sizes are
+        A4 (215mm x 297mm)
+        B4 (255mm x 364mm)
+        A3 (303mm x 418.56mm)
+        North American Letter (215.9mm x 279.4mm)
+        North American Legal (215.9mm x 355.6mm)
+        Unlimited
+
+    T.4 does not accurately define the maximum number of scan lines in a page. A wide
+    variety of maximum row counts are used in the real world. It is important not to
+    set our sending limit too high, or a receiving machine might split pages. It is
+    important not to set it too low, or we might clip pages.
+
+    Values seen for standard resolution A4 pages include 1037, 1045, 1109, 1126 and 1143.
+    1109 seems the most-popular.  At fine res 2150, 2196, 2200, 2237, 2252-2262, 2264,
+    2286, and 2394 are used. 2255 seems the most popular. We try to use balanced choices
+    here.
+*/
+typedef enum
+{
+    /* A4 is 297mm long */
+    T4_LENGTH_STANDARD_A4 = 1143,
+    T4_LENGTH_FINE_A4 = 2286,
+    T4_LENGTH_300_A4 = 4665,
+    T4_LENGTH_SUPERFINE_A4 = 4573,
+    T4_LENGTH_600_A4 = 6998,
+    T4_LENGTH_800_A4 = 9330,
+    T4_LENGTH_1200_A4 = 13996,
+    /* B4 is 364mm long */
+    T4_LENGTH_STANDARD_B4 = 1401,
+    T4_LENGTH_FINE_B4 = 2802,
+    T4_LENGTH_300_B4 = 0,
+    T4_LENGTH_SUPERFINE_B4 = 5605,
+    T4_LENGTH_600_B4 = 0,
+    T4_LENGTH_800_B4 = 0,
+    T4_LENGTH_1200_B4 = 0,
+    /* North American letter is 279.4mm long */
+    T4_LENGTH_STANDARD_US_LETTER = 1075,
+    T4_LENGTH_FINE_US_LETTER = 2151,
+    T4_LENGTH_300_US_LETTER = 0,
+    T4_LENGTH_SUPERFINE_US_LETTER = 4302,
+    T4_LENGTH_600_US_LETTER = 0,
+    T4_LENGTH_800_US_LETTER = 0,
+    T4_LENGTH_1200_US_LETTER = 0,
+    /* North American legal is 355.6mm long */
+    T4_LENGTH_STANDARD_US_LEGAL = 1369,
+    T4_LENGTH_FINE_US_LEGAL = 2738,
+    T4_LENGTH_300_US_LEGAL = 0,
+    T4_LENGTH_SUPERFINE_US_LEGAL = 5476,
+    T4_LENGTH_600_US_LEGAL = 0,
+    T4_LENGTH_800_US_LEGAL = 0,
+    T4_LENGTH_1200_US_LEGAL = 0
+} t4_image_length_t;
+
+/*!
+    T.4 FAX compression/decompression descriptor. This defines the working state
+    for a single instance of a T.4 FAX compression or decompression channel.
+*/
+typedef struct t4_state_s t4_state_t;
+
+/*!
+    T.4 FAX compression/decompression statistics.
+*/
+typedef struct
+{
+    /*! \brief The number of pages transferred so far. */
+    int pages_transferred;
+    /*! \brief The number of pages in the file (<0 if unknown). */
+    int pages_in_file;
+    /*! \brief The number of horizontal pixels in the most recent page. */
+    int width;
+    /*! \brief The number of vertical pixels in the most recent page. */
+    int length;
+    /*! \brief The number of bad pixel rows in the most recent page. */
+    int bad_rows;
+    /*! \brief The largest number of bad pixel rows in a block in the most recent page. */
+    int longest_bad_row_run;
+    /*! \brief The horizontal resolution of the page in pixels per metre */
+    int x_resolution;
+    /*! \brief The vertical resolution of the page in pixels per metre */
+    int y_resolution;
+    /*! \brief The type of compression used between the FAX machines */
+    int encoding;
+    /*! \brief The size of the image on the line, in bytes */
+    int line_image_size;
+} t4_stats_t;
+    
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/*! \brief Prepare for reception of a document.
+    \param s The T.4 context.
+    \param file The name of the file to be received.
+    \param output_encoding The output encoding.
+    \return A pointer to the context, or NULL if there was a problem. */
+SPAN_DECLARE(t4_state_t *) t4_rx_init(t4_state_t *s, const char *file, int output_encoding);
+
+/*! \brief Prepare to receive the next page of the current document.
+    \param s The T.4 context.
+    \return zero for success, -1 for failure. */
+SPAN_DECLARE(int) t4_rx_start_page(t4_state_t *s);
+
+/*! \brief Put a bit of the current document page.
+    \param s The T.4 context.
+    \param bit The data bit.
+    \return TRUE when the bit ends the document page, otherwise FALSE. */
+SPAN_DECLARE(int) t4_rx_put_bit(t4_state_t *s, int bit);
+
+/*! \brief Put a byte of the current document page.
+    \param s The T.4 context.
+    \param byte The data byte.
+    \return TRUE when the byte ends the document page, otherwise FALSE. */
+SPAN_DECLARE(int) t4_rx_put_byte(t4_state_t *s, uint8_t byte);
+
+/*! \brief Put a byte of the current document page.
+    \param s The T.4 context.
+    \param buf The buffer containing the chunk.
+    \param len The length of the chunk.
+    \return TRUE when the byte ends the document page, otherwise FALSE. */
+SPAN_DECLARE(int) t4_rx_put_chunk(t4_state_t *s, const uint8_t buf[], int len);
+
+/*! \brief Complete the reception of a page.
+    \param s The T.4 receive context.
+    \return 0 for success, otherwise -1. */
+SPAN_DECLARE(int) t4_rx_end_page(t4_state_t *s);
+
+/*! \brief End reception of a document. Tidy up and close the file.
+           This should be used to end T.4 reception started with
+           t4_rx_init.
+    \param s The T.4 receive context.
+    \return 0 for success, otherwise -1. */
+SPAN_DECLARE(int) t4_rx_release(t4_state_t *s);
+
+/*! \brief End reception of a document. Tidy up, close the file and
+           free the context. This should be used to end T.4 reception
+           started with t4_rx_init.
+    \param s The T.4 receive context.
+    \return 0 for success, otherwise -1. */
+SPAN_DECLARE(int) t4_rx_free(t4_state_t *s);
+
+/*! \brief Set the row write handler for a T.4 receive context.
+    \param s The T.4 receive context.
+    \param handler A pointer to the handler routine.
+    \param user_data An opaque pointer passed to the handler routine.
+    \return 0 for success, otherwise -1. */
+SPAN_DECLARE(int) t4_rx_set_row_write_handler(t4_state_t *s, t4_row_write_handler_t handler, void *user_data);
+
+/*! \brief Set the encoding for the received data.
+    \param s The T.4 context.
+    \param encoding The encoding. */
+SPAN_DECLARE(void) t4_rx_set_rx_encoding(t4_state_t *s, int encoding);
+
+/*! \brief Set the expected width of the received image, in pixel columns.
+    \param s The T.4 context.
+    \param width The number of pixels across the image. */
+SPAN_DECLARE(void) t4_rx_set_image_width(t4_state_t *s, int width);
+
+/*! \brief Set the row-to-row (y) resolution to expect for a received image.
+    \param s The T.4 context.
+    \param resolution The resolution, in pixels per metre. */
+SPAN_DECLARE(void) t4_rx_set_y_resolution(t4_state_t *s, int resolution);
+
+/*! \brief Set the column-to-column (x) resolution to expect for a received image.
+    \param s The T.4 context.
+    \param resolution The resolution, in pixels per metre. */
+SPAN_DECLARE(void) t4_rx_set_x_resolution(t4_state_t *s, int resolution);
+
+/*! \brief Set the DCS information of the fax, for inclusion in the file.
+    \param s The T.4 context.
+    \param dcs The DCS information, formatted as an ASCII string. */
+SPAN_DECLARE(void) t4_rx_set_dcs(t4_state_t *s, const char *dcs);
+
+/*! \brief Set the sub-address of the fax, for inclusion in the file.
+    \param s The T.4 context.
+    \param sub_address The sub-address string. */
+SPAN_DECLARE(void) t4_rx_set_sub_address(t4_state_t *s, const char *sub_address);
+
+/*! \brief Set the identity of the remote machine, for inclusion in the file.
+    \param s The T.4 context.
+    \param ident The identity string. */
+SPAN_DECLARE(void) t4_rx_set_far_ident(t4_state_t *s, const char *ident);
+
+/*! \brief Set the vendor of the remote machine, for inclusion in the file.
+    \param s The T.4 context.
+    \param vendor The vendor string, or NULL. */
+SPAN_DECLARE(void) t4_rx_set_vendor(t4_state_t *s, const char *vendor);
+
+/*! \brief Set the model of the remote machine, for inclusion in the file.
+    \param s The T.4 context.
+    \param model The model string, or NULL. */
+SPAN_DECLARE(void) t4_rx_set_model(t4_state_t *s, const char *model);
+
+/*! Get the current image transfer statistics. 
+    \brief Get the current transfer statistics.
+    \param s The T.4 context.
+    \param t A pointer to a statistics structure. */
+SPAN_DECLARE(void) t4_get_transfer_statistics(t4_state_t *s, t4_stats_t *t);
+
+/*! Get the short text name of an encoding format. 
+    \brief Get the short text name of an encoding format.
+    \param encoding The encoding type.
+    \return A pointer to the string. */
+SPAN_DECLARE(const char *) t4_encoding_to_str(int encoding);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/t4_tx.h (from rev 16612, freeswitch/trunk/libs/spandsp/src/spandsp/t4_tx.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/t4_tx.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/t4_tx.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,179 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * t4_tx.h - definitions for T.4 FAX transmit processing
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2003 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: t4_tx.h,v 1.2.2.3 2009/12/21 17:18:40 steveu Exp $
+ */
+
+/*! \file */
+
+#if !defined(_SPANDSP_T4_TX_H_)
+#define _SPANDSP_T4_TX_H_
+
+typedef int (*t4_row_read_handler_t)(void *user_data, uint8_t buf[], size_t len);
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/*! \brief Prepare for transmission of a document.
+    \param s The T.4 context.
+    \param file The name of the file to be sent.
+    \param start_page The first page to send. -1 for no restriction.
+    \param stop_page The last page to send. -1 for no restriction.
+    \return A pointer to the context, or NULL if there was a problem. */
+SPAN_DECLARE(t4_state_t *) t4_tx_init(t4_state_t *s, const char *file, int start_page, int stop_page);
+
+/*! \brief Prepare to send the next page of the current document.
+    \param s The T.4 context.
+    \return zero for success, -1 for failure. */
+SPAN_DECLARE(int) t4_tx_start_page(t4_state_t *s);
+
+/*! \brief Prepare the current page for a resend.
+    \param s The T.4 context.
+    \return zero for success, -1 for failure. */
+SPAN_DECLARE(int) t4_tx_restart_page(t4_state_t *s);
+
+/*! \brief Check for the existance of the next page, and whether its format is like the
+    current one. This information can be needed before it is determined that the current
+    page is finished with.
+    \param s The T.4 context.
+    \return 0 for next page found with the same format as the current page.
+            1 for next page found with different format from the current page.
+            -1 for no page found, or file failure. */
+SPAN_DECLARE(int) t4_tx_next_page_has_different_format(t4_state_t *s);
+
+/*! \brief Complete the sending of a page.
+    \param s The T.4 context.
+    \return zero for success, -1 for failure. */
+SPAN_DECLARE(int) t4_tx_end_page(t4_state_t *s);
+
+/*! \brief Return the next bit of the current document page, without actually
+           moving forward in the buffer. The document will be padded for the
+           current minimum scan line time.
+    \param s The T.4 context.
+    \return The next bit (i.e. 0 or 1). For the last bit of data, bit 1 is
+            set (i.e. the returned value is 2 or 3). */
+SPAN_DECLARE(int) t4_tx_check_bit(t4_state_t *s);
+
+/*! \brief Get the next bit of the current document page. The document will
+           be padded for the current minimum scan line time.
+    \param s The T.4 context.
+    \return The next bit (i.e. 0 or 1). For the last bit of data, bit 1 is
+            set (i.e. the returned value is 2 or 3). */
+SPAN_DECLARE(int) t4_tx_get_bit(t4_state_t *s);
+
+/*! \brief Get the next byte of the current document page. The document will
+           be padded for the current minimum scan line time.
+    \param s The T.4 context.
+    \return The next byte. For the last byte of data, bit 8 is
+            set. In this case, one or more bits of the byte may be padded with
+            zeros, to complete the byte. */
+SPAN_DECLARE(int) t4_tx_get_byte(t4_state_t *s);
+
+/*! \brief Get the next chunk of the current document page. The document will
+           be padded for the current minimum scan line time.
+    \param s The T.4 context.
+    \param buf The buffer into which the chunk is to written.
+    \param max_len The maximum length of the chunk.
+    \return The actual length of the chunk. If this is less than max_len it 
+            indicates that the end of the document has been reached. */
+SPAN_DECLARE(int) t4_tx_get_chunk(t4_state_t *s, uint8_t buf[], int max_len);
+
+/*! \brief End the transmission of a document. Tidy up and close the file.
+           This should be used to end T.4 transmission started with t4_tx_init.
+    \param s The T.4 context.
+    \return 0 for success, otherwise -1. */
+SPAN_DECLARE(int) t4_tx_release(t4_state_t *s);
+
+/*! \brief End the transmission of a document. Tidy up, close the file and
+           free the context. This should be used to end T.4 transmission
+           started with t4_tx_init.
+    \param s The T.4 context.
+    \return 0 for success, otherwise -1. */
+SPAN_DECLARE(int) t4_tx_free(t4_state_t *s);
+
+/*! \brief Set the encoding for the encoded data.
+    \param s The T.4 context.
+    \param encoding The encoding. */
+SPAN_DECLARE(void) t4_tx_set_tx_encoding(t4_state_t *s, int encoding);
+
+/*! \brief Set the minimum number of encoded bits per row. This allows the
+           makes the encoding process to be set to comply with the minimum row
+           time specified by a remote receiving machine.
+    \param s The T.4 context.
+    \param bits The minimum number of bits per row. */
+SPAN_DECLARE(void) t4_tx_set_min_row_bits(t4_state_t *s, int bits);
+
+/*! \brief Set the identity of the local machine, for inclusion in page headers.
+    \param s The T.4 context.
+    \param ident The identity string. */
+SPAN_DECLARE(void) t4_tx_set_local_ident(t4_state_t *s, const char *ident);
+
+/*! Set the info field, included in the header line included in each page of an encoded
+    FAX. This is a string of up to 50 characters. Other information (date, local ident, etc.)
+    are automatically included in the header. If the header info is set to NULL or a zero
+    length string, no header lines will be added to the encoded FAX.
+    \brief Set the header info.
+    \param s The T.4 context.
+    \param info A string, of up to 50 bytes, which will form the info field. */
+SPAN_DECLARE(void) t4_tx_set_header_info(t4_state_t *s, const char *info);
+
+/*! \brief Set the row read handler for a T.4 transmit context.
+    \param s The T.4 transmit context.
+    \param handler A pointer to the handler routine.
+    \param user_data An opaque pointer passed to the handler routine.
+    \return 0 for success, otherwise -1. */
+SPAN_DECLARE(int) t4_tx_set_row_read_handler(t4_state_t *s, t4_row_read_handler_t handler, void *user_data);
+
+/*! \brief Get the row-to-row (y) resolution of the current page.
+    \param s The T.4 context.
+    \return The resolution, in pixels per metre. */
+SPAN_DECLARE(int) t4_tx_get_y_resolution(t4_state_t *s);
+
+/*! \brief Get the column-to-column (x) resolution of the current page.
+    \param s The T.4 context.
+    \return The resolution, in pixels per metre. */
+SPAN_DECLARE(int) t4_tx_get_x_resolution(t4_state_t *s);
+
+/*! \brief Get the width of the current page, in pixel columns.
+    \param s The T.4 context.
+    \return The number of columns. */
+SPAN_DECLARE(int) t4_tx_get_image_width(t4_state_t *s);
+
+/*! \brief Get the number of pages in the file.
+    \param s The T.4 context.
+    \return The number of pages, or -1 if there is an error. */
+SPAN_DECLARE(int) t4_tx_get_pages_in_file(t4_state_t *s);
+
+/*! \brief Get the currnet page number in the file.
+    \param s The T.4 context.
+    \return The page number, or -1 if there is an error. */
+SPAN_DECLARE(int) t4_tx_get_current_page_in_file(t4_state_t *s);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif
+/*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/telephony.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/telephony.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/telephony.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: telephony.h,v 1.18 2009/03/23 14:17:42 steveu Exp $
+ * $Id: telephony.h,v 1.18.4.2 2009/12/21 18:38:06 steveu Exp $
  */
 
 #if !defined(_SPANDSP_TELEPHONY_H_)
@@ -69,8 +69,8 @@
 /*! \brief A handler for transmit, where the buffer will be filled. */
 typedef int (span_tx_handler_t)(void *s, int16_t amp[], int max_len);
 
-#define ms_to_samples(t)            (((t)*SAMPLE_RATE)/1000)
-#define us_to_samples(t)            (((t)*SAMPLE_RATE)/1000000)
+#define ms_to_samples(t)            ((t)*(SAMPLE_RATE/1000))
+#define us_to_samples(t)            ((t)/(1000000/SAMPLE_RATE))
 
 #if !defined(FALSE)
 #define FALSE 0

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/v17tx.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/v17tx.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/v17tx.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v17tx.h,v 1.43 2009/07/09 13:52:09 steveu Exp $
+ * $Id: v17tx.h,v 1.43.4.1 2009/12/24 16:52:30 steveu Exp $
  */
 
 /*! \file */
@@ -102,12 +102,12 @@
     use of the context, to initialise its contents.
     \brief Initialise a V.17 modem transmit context.
     \param s The modem context.
-    \param rate The bit rate of the modem. Valid values are 7200, 9600, 12000 and 14400.
+    \param bit_rate The bit rate of the modem. Valid values are 7200, 9600, 12000 and 14400.
     \param tep TRUE is the optional TEP tone is to be transmitted.
     \param get_bit The callback routine used to get the data to be transmitted.
     \param user_data An opaque pointer.
     \return A pointer to the modem context, or NULL if there was a problem. */
-SPAN_DECLARE(v17_tx_state_t *) v17_tx_init(v17_tx_state_t *s, int rate, int tep, get_bit_func_t get_bit, void *user_data);
+SPAN_DECLARE(v17_tx_state_t *) v17_tx_init(v17_tx_state_t *s, int bit_rate, int tep, get_bit_func_t get_bit, void *user_data);
 
 /*! Reinitialise an existing V.17 modem transmit context, so it may be reused.
     \brief Reinitialise an existing V.17 modem transmit context.

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/v18.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/v18.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/v18.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v18.h,v 1.5 2009/06/02 16:03:56 steveu Exp $
+ * $Id: v18.h,v 1.6 2009/11/04 15:52:06 steveu Exp $
  */
  
 /*! \file */
@@ -69,14 +69,14 @@
 /*! Initialise a V.18 context.
     \brief Initialise a V.18 context.
     \param s The V.18 context.
-    \param caller TRUE if caller mode, else answerer mode.
+    \param calling_party TRUE if caller mode, else answerer mode.
     \param mode Mode of operation.
     \param put_msg A callback routine called to deliver the received text
            to the application.
     \param user_data An opaque pointer for the callback routine.
     \return A pointer to the V.18 context, or NULL if there was a problem. */
 SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s,
-                                     int caller,
+                                     int calling_party,
                                      int mode,
                                      put_msg_func_t put_msg,
                                      void *user_data);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/v22bis.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/v22bis.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/v22bis.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v22bis.h,v 1.45 2009/07/09 13:52:09 steveu Exp $
+ * $Id: v22bis.h,v 1.46 2009/11/04 15:52:06 steveu Exp $
  */
 
 /*! \file */
@@ -164,7 +164,7 @@
     \param s The modem context.
     \param bit_rate The bit rate of the modem. Valid values are 1200 and 2400.
     \param guard The guard tone option. 0 = none, 1 = 550Hz, 2 = 1800Hz.
-    \param caller TRUE if this is the calling modem.
+    \param calling_party TRUE if this is the calling modem.
     \param get_bit The callback routine used to get the data to be transmitted.
     \param put_bit The callback routine used to get the data to be transmitted.
     \param user_data An opaque pointer, passed in calls to the get and put routines.
@@ -172,7 +172,7 @@
 SPAN_DECLARE(v22bis_state_t *) v22bis_init(v22bis_state_t *s,
                                            int bit_rate,
                                            int guard,
-                                           int caller,
+                                           int calling_party,
                                            get_bit_func_t get_bit,
                                            void *get_bit_user_data,
                                            put_bit_func_t put_bit,

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/v42.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/v42.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/v42.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v42.h,v 1.30 2009/02/10 13:06:47 steveu Exp $
+ * $Id: v42.h,v 1.31 2009/11/04 15:52:06 steveu Exp $
  */
 
 /*! \page v42_page V.42 modem error correction
@@ -130,12 +130,12 @@
 
 /*! Initialise a V.42 context.
     \param s The V.42 context.
-    \param caller TRUE if caller mode, else answerer mode.
+    \param calling_party TRUE if caller mode, else answerer mode.
     \param frame_handler A callback function to handle received frames of data.
     \param user_data An opaque pointer passed to the frame handler routine.
     \return ???
 */
-SPAN_DECLARE(v42_state_t *) v42_init(v42_state_t *s, int caller, int detect, v42_frame_handler_t frame_handler, void *user_data);
+SPAN_DECLARE(v42_state_t *) v42_init(v42_state_t *s, int calling_party, int detect, v42_frame_handler_t frame_handler, void *user_data);
 
 /*! Restart a V.42 context.
     \param s The V.42 context.

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/v8.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/v8.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/v8.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v8.h,v 1.28 2009/06/02 16:03:56 steveu Exp $
+ * $Id: v8.h,v 1.31.4.1 2009/12/28 12:20:47 steveu Exp $
  */
  
 /*! \file */
@@ -43,20 +43,20 @@
 #if !defined(_SPANDSP_V8_H_)
 #define _SPANDSP_V8_H_
 
-typedef struct v8_result_s v8_result_t;
+typedef struct v8_parms_s v8_parms_t;
 
-typedef void (v8_result_handler_t)(void *user_data, v8_result_t *result);
+typedef void (v8_result_handler_t)(void *user_data, v8_parms_t *result);
 
 enum v8_call_function_e
 {
     V8_CALL_TBS = 0,
-    V8_CALL_H324,
-    V8_CALL_V18,
-    V8_CALL_T101,
-    V8_CALL_T30_TX,
-    V8_CALL_T30_RX,
-    V8_CALL_V_SERIES,
-    V8_CALL_FUNCTION_EXTENSION
+    V8_CALL_H324 = 1,
+    V8_CALL_V18 = 2,
+    V8_CALL_T101 = 3,
+    V8_CALL_T30_TX = 4,
+    V8_CALL_T30_RX = 5,
+    V8_CALL_V_SERIES = 6,
+    V8_CALL_FUNCTION_EXTENSION = 7
 };
 
 enum v8_modulation_e
@@ -88,30 +88,30 @@
 
 enum v8_pstn_access_e
 {
-    V8_PSTN_ACCESS_CALL_DCE_CELLULAR = 0x20,
-    V8_PSTN_ACCESS_ANSWER_DCE_CELLULAR = 0x40,
-    V8_PSTN_ACCESS_DCE_ON_DIGTIAL = 0x80
+    V8_PSTN_ACCESS_CALL_DCE_CELLULAR = 0x01,
+    V8_PSTN_ACCESS_ANSWER_DCE_CELLULAR = 0x02,
+    V8_PSTN_ACCESS_DCE_ON_DIGITAL = 0x04
 };
 
 enum v8_pcm_modem_availability_e
 {
-    V8_PSTN_PCM_MODEM_V90_V92_ANALOGUE = 0x20,
-    V8_PSTN_PCM_MODEM_V90_V92_DIGITAL = 0x40,
-    V8_PSTN_PCM_MODEM_V91 = 0x80
+    V8_PSTN_PCM_MODEM_V90_V92_ANALOGUE = 0x01,
+    V8_PSTN_PCM_MODEM_V90_V92_DIGITAL = 0x02,
+    V8_PSTN_PCM_MODEM_V91 = 0x04
 };
 
 typedef struct v8_state_s v8_state_t;
 
-struct v8_result_s
+struct v8_parms_s
 {
+    int modem_connect_tone;
     int call_function;
-    int available_modulations;
-    int negotiated_modulation;
+    unsigned int modulations;
     int protocol;
     int pstn_access;
-    int nsf_seen;
     int pcm_modem_availability;
-    int t66_seen;
+    int nsf;
+    int t66;
 };
 
 #if defined(__cplusplus)
@@ -119,18 +119,21 @@
 {
 #endif
 
+SPAN_DECLARE(int) v8_restart(v8_state_t *s,
+                             int calling_party,
+                             v8_parms_t *parms);
+
 /*! Initialise a V.8 context.
     \brief Initialise a V.8 context.
     \param s The V.8 context.
-    \param caller TRUE if caller mode, else answerer mode.
-    \param available_modulations A bitwise list of the modulation schemes to be
-           advertised as available here.
+    \param calling_party TRUE if caller mode, else answerer mode.
+    \param parms The allowed parameters for the call.
     \param result_handler The callback routine used to handle the results of negotiation.
     \param user_data An opaque pointer passed to the result_handler routine.
     \return A pointer to the V.8 context, or NULL if there was a problem. */
 SPAN_DECLARE(v8_state_t *) v8_init(v8_state_t *s,
-                                   int caller,
-                                   int available_modulations,
+                                   int calling_party,
+                                   v8_parms_t *parms,
                                    v8_result_handler_t *result_handler,
                                    void *user_data);
 
@@ -175,7 +178,9 @@
 SPAN_DECLARE(const char *) v8_modulation_to_str(int modulation_scheme);
 SPAN_DECLARE(const char *) v8_protocol_to_str(int protocol);
 SPAN_DECLARE(const char *) v8_pstn_access_to_str(int pstn_access);
+SPAN_DECLARE(const char *) v8_nsf_to_str(int nsf);
 SPAN_DECLARE(const char *) v8_pcm_modem_availability_to_str(int pcm_modem_availability);
+SPAN_DECLARE(const char *) v8_t66_to_str(int t66);
 
 #if defined(__cplusplus)
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/version.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/version.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/version.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -10,19 +10,19 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
  *
  * 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.
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: version.h.in,v 1.3 2009/03/01 12:39:02 steveu Exp $
+ * $Id: version.h.in,v 1.3.4.1 2009/12/19 09:47:56 steveu Exp $
  */
 
 #if !defined(_SPANDSP_VERSION_H_)
@@ -30,9 +30,9 @@
 
 /* The date and time of the version are in UTC form. */
 
-#define SPANDSP_RELEASE_DATE            20091005
-#define SPANDSP_RELEASE_TIME            163835
-#define SPANDSP_RELEASE_DATETIME_STRING "20091005 163835"
+#define SPANDSP_RELEASE_DATE            20091228
+#define SPANDSP_RELEASE_TIME            123351
+#define SPANDSP_RELEASE_DATETIME_STRING "20091228 123351"
 
 #endif
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/version.h.in (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/version.h.in	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp/version.h.in	2010-02-12 00:54:22 UTC (rev 16614)
@@ -10,19 +10,19 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
  *
  * 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.
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: version.h.in,v 1.3 2009/03/01 12:39:02 steveu Exp $
+ * $Id: version.h.in,v 1.3.4.1 2009/12/19 09:47:56 steveu Exp $
  */
 
 #if !defined(_SPANDSP_VERSION_H_)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp.h.in (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp.h.in	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/spandsp.h.in	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: spandsp.h.in,v 1.19 2009/09/22 13:11:04 steveu Exp $
+ * $Id: spandsp.h.in,v 1.19.4.1 2009/12/19 09:47:56 steveu Exp $
  */
 
 /*! \file */
@@ -96,7 +96,8 @@
 #include <spandsp/v18.h>
 #include <spandsp/v42.h>
 #include <spandsp/v42bis.h>
-#include <spandsp/t4.h>
+#include <spandsp/t4_rx.h>
+#include <spandsp/t4_tx.h>
 #include <spandsp/t30.h>
 #include <spandsp/t30_api.h>
 #include <spandsp/t30_fcf.h>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/super_tone_rx.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/super_tone_rx.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/super_tone_rx.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: super_tone_rx.c,v 1.33 2009/02/10 13:06:46 steveu Exp $
+ * $Id: super_tone_rx.c,v 1.33.4.1 2009/12/19 09:47:56 steveu Exp $
  */
 
 /*! \file */
@@ -218,8 +218,23 @@
 
 SPAN_DECLARE(int) super_tone_rx_free_descriptor(super_tone_rx_descriptor_t *desc)
 {
+    int i;
+
     if (desc)
+    {
+        for (i = 0; i < desc->tones; i++)
+        {
+            if (desc->tone_list[i])
+                free(desc->tone_list[i]);
+        }
+        if (desc->tone_list)
+            free(desc->tone_list);
+        if (desc->tone_segs)
+            free(desc->tone_segs);
+        if (desc->desc)
+            free(desc->desc);
         free(desc);
+    }
     return 0;
 }
 /*- End of function --------------------------------------------------------*/

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t30.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t30.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t30.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t30.c,v 1.303 2009/09/21 15:51:18 steveu Exp $
+ * $Id: t30.c,v 1.305.4.4 2009/12/23 14:23:49 steveu Exp $
  */
 
 /*! \file */
@@ -60,7 +60,8 @@
 #include "spandsp/v29tx.h"
 #include "spandsp/v27ter_rx.h"
 #include "spandsp/v27ter_tx.h"
-#include "spandsp/t4.h"
+#include "spandsp/t4_rx.h"
+#include "spandsp/t4_tx.h"
 #include "spandsp/t30_fcf.h"
 #include "spandsp/t35.h"
 #include "spandsp/t30.h"
@@ -68,8 +69,10 @@
 #include "spandsp/t30_logging.h"
 
 #include "spandsp/private/logging.h"
-#include "spandsp/private/t4.h"
+#include "spandsp/private/t4_rx.h"
+#include "spandsp/private/t4_tx.h"
 #include "spandsp/private/t30.h"
+#include "spandsp/private/t30_dis_dtc_dcs_bits.h"
 
 #include "t30_local.h"
 
@@ -81,9 +84,6 @@
     terminal could keep you retrying all day. Its a backstop protection. */
 #define MAX_RESPONSE_TRIES  6
 
-/*! Conversion between milliseconds and audio samples. */
-#define ms_to_samples(t)    (((t)*SAMPLE_RATE)/1000)
-
 /* T.30 defines the following call phases:
    Phase A: Call set-up.
        Exchange of CNG, CED and the called terminal identification.
@@ -215,108 +215,108 @@
 /* All timers specified in milliseconds */
 
 /*! Time-out T0 defines the amount of time an automatic calling terminal waits for the called terminal
-to answer the call.
-T0 begins after the dialling of the number is completed and is reset:
-a) when T0 times out; or
-b) when timer T1 is started; or
-c) if the terminal is capable of detecting any condition which indicates that the call will not be
-   successful, when such a condition is detected.
-The recommended value of T0 is 60+-5s. However, when it is anticipated that a long call set-up
-time may be encountered, an alternative value of up to 120s may be used.
-NOTE - National regulations may require the use of other values for T0. */
+    to answer the call.
+    T0 begins after the dialling of the number is completed and is reset:
+    a) when T0 times out; or
+    b) when timer T1 is started; or
+    c) if the terminal is capable of detecting any condition which indicates that the call will not be
+       successful, when such a condition is detected.
+    The recommended value of T0 is 60+-5s. However, when it is anticipated that a long call set-up
+    time may be encountered, an alternative value of up to 120s may be used.
+    NOTE - National regulations may require the use of other values for T0. */
 #define DEFAULT_TIMER_T0                60000
 
 /*! Time-out T1 defines the amount of time two terminals will continue to attempt to identify each
-other. T1 is 35+-5s, begins upon entering phase B, and is reset upon detecting a valid signal or
-when T1 times out.
-For operating methods 3 and 4 (see 3.1), the calling terminal starts time-out T1 upon reception of
-the V.21 modulation scheme.
-For operating method 4 bis a (see 3.1), the calling terminal starts time-out T1 upon starting
-transmission using the V.21 modulation scheme.
-Annex A says T1 is also the timeout to be used for the receipt of the first HDLC frame after the
-start of high speed flags in ECM mode. This seems a strange reuse of the T1 name, so we distinguish
-it here by calling it T1A. */
+    other. T1 is 35+-5s, begins upon entering phase B, and is reset upon detecting a valid signal or
+    when T1 times out.
+    For operating methods 3 and 4 (see 3.1), the calling terminal starts time-out T1 upon reception of
+    the V.21 modulation scheme.
+    For operating method 4 bis a (see 3.1), the calling terminal starts time-out T1 upon starting
+    transmission using the V.21 modulation scheme.
+    Annex A says T1 is also the timeout to be used for the receipt of the first HDLC frame after the
+    start of high speed flags in ECM mode. This seems a strange reuse of the T1 name, so we distinguish
+    it here by calling it T1A. */
 #define DEFAULT_TIMER_T1                35000
 #define DEFAULT_TIMER_T1A               35000
 
 /*! Time-out T2 makes use of the tight control between commands and responses to detect the loss of
-command/response synchronization. T2 is 6+-1s, and begins when initiating a command search
-(e.g., the first entrance into the "command received" subroutine, reference flow diagram in section 5.2).
-T2 is reset when an HDLC flag is received or when T2 times out. */
+    command/response synchronization. T2 is 6+-1s, and begins when initiating a command search
+    (e.g., the first entrance into the "command received" subroutine, reference flow diagram in section 5.2).
+    T2 is reset when an HDLC flag is received or when T2 times out. */
 #define DEFAULT_TIMER_T2                7000
 
 /*! Once HDLC flags begin, T2 is reset, and a 3s timer begins. This timer is unnamed in T.30. Here we
-term it T2A. No tolerance is specified for this timer. T2A specifies the maximum time to wait for the
-end of a frame, after the initial flag has been seen. */
+    term it T2A. No tolerance is specified for this timer. T2A specifies the maximum time to wait for the
+    end of a frame, after the initial flag has been seen. */
 #define DEFAULT_TIMER_T2A               3000
 
 /*! If the HDLC carrier falls during reception, we need to apply a minimum time before continuing. If we
-   don't, there are circumstances where we could continue and reply before the incoming signals have
-   really finished. E.g. if a bad DCS is received in a DCS-TCF sequence, we need wait for the TCF
-   carrier to pass, before continuing. This timer is specified as 200ms, but no tolerance is specified.
-   It is unnamed in T.30. Here we term it T2B */
+    don't, there are circumstances where we could continue and reply before the incoming signals have
+    really finished. E.g. if a bad DCS is received in a DCS-TCF sequence, we need wait for the TCF
+    carrier to pass, before continuing. This timer is specified as 200ms, but no tolerance is specified.
+    It is unnamed in T.30. Here we term it T2B */
 #define DEFAULT_TIMER_T2B               200
 
 /*! Time-out T3 defines the amount of time a terminal will attempt to alert the local operator in
-response to a procedural interrupt. Failing to achieve operator intervention, the terminal will
-discontinue this attempt and shall issue other commands or responses. T3 is 10+-5s, begins on the
-first detection of a procedural interrupt command/response signal (i.e., PIN/PIP or PRI-Q) and is
-reset when T3 times out or when the operator initiates a line request. */
+    response to a procedural interrupt. Failing to achieve operator intervention, the terminal will
+    discontinue this attempt and shall issue other commands or responses. T3 is 10+-5s, begins on the
+    first detection of a procedural interrupt command/response signal (i.e., PIN/PIP or PRI-Q) and is
+    reset when T3 times out or when the operator initiates a line request. */
 #define DEFAULT_TIMER_T3                15000
 
 /*! Time-out T4 defines the amount of time a terminal will wait for flags to begin, when waiting for a
-response from a remote terminal. T2 is 3s +-15%, and begins when initiating a response search
-(e.g., the first entrance into the "response received" subroutine, reference flow diagram in section 5.2).
-T4 is reset when an HDLC flag is received or when T4 times out.
-NOTE - For manual FAX units, the value of timer T4 may be either 3.0s +-15% or 4.5s +-15%.
-If the value of 4.5s is used, then after detection of a valid response to the first DIS, it may
-be reduced to 3.0s +-15%. T4 = 3.0s +-15% for automatic units. */
+    response from a remote terminal. T2 is 3s +-15%, and begins when initiating a response search
+    (e.g., the first entrance into the "response received" subroutine, reference flow diagram in section 5.2).
+    T4 is reset when an HDLC flag is received or when T4 times out.
+    NOTE - For manual FAX units, the value of timer T4 may be either 3.0s +-15% or 4.5s +-15%.
+    If the value of 4.5s is used, then after detection of a valid response to the first DIS, it may
+    be reduced to 3.0s +-15%. T4 = 3.0s +-15% for automatic units. */
 #define DEFAULT_TIMER_T4                3450
 
 /*! Once HDLC flags begin, T4 is reset, and a 3s timer begins. This timer is unnamed in T.30. Here we
-term it T4A. No tolerance is specified for this timer. T4A specifies the maximum time to wait for the
-end of a frame, after the initial flag has been seen. Note that a different timer is used for the fast
-HDLC in ECM mode, to provide time for physical paper handling. */
+    term it T4A. No tolerance is specified for this timer. T4A specifies the maximum time to wait for the
+    end of a frame, after the initial flag has been seen. Note that a different timer is used for the fast
+    HDLC in ECM mode, to provide time for physical paper handling. */
 #define DEFAULT_TIMER_T4A               3000
 
 /*! If the HDLC carrier falls during reception, we need to apply a minimum time before continuing. if we
-   don't, there are circumstances where we could continue and reply before the incoming signals have
-   really finished. E.g. if a bad DCS is received in a DCS-TCF sequence, we need wait for the TCF
-   carrier to pass, before continuing. This timer is specified as 200ms, but no tolerance is specified.
-   It is unnamed in T.30. Here we term it T4B */
+    don't, there are circumstances where we could continue and reply before the incoming signals have
+    really finished. E.g. if a bad DCS is received in a DCS-TCF sequence, we need wait for the TCF
+    carrier to pass, before continuing. This timer is specified as 200ms, but no tolerance is specified.
+    It is unnamed in T.30. Here we term it T4B */
 #define DEFAULT_TIMER_T4B               200
 
 /*! Time-out T5 is defined for the optional T.4 error correction mode. Time-out T5 defines the amount
-of time waiting for clearance of the busy condition of the receiving terminal. T5 is 60+-5s and
-begins on the first detection of the RNR response. T5 is reset when T5 times out or the MCF or PIP
-response is received or when the ERR or PIN response is received in the flow control process after
-transmitting the EOR command. If the timer T5 has expired, the DCN command is transmitted for
-call release. */
+    of time waiting for clearance of the busy condition of the receiving terminal. T5 is 60+-5s and
+    begins on the first detection of the RNR response. T5 is reset when T5 times out or the MCF or PIP
+    response is received or when the ERR or PIN response is received in the flow control process after
+    transmitting the EOR command. If the timer T5 has expired, the DCN command is transmitted for
+    call release. */
 #define DEFAULT_TIMER_T5                65000
 
 /*! (Annex C - ISDN) Time-out T6 defines the amount of time two terminals will continue to attempt to
-identify each other. T6 is 5+-0.5s. The timeout begins upon entering Phase B, and is reset upon
-detecting a valid signal, or when T6 times out. */
+    identify each other. T6 is 5+-0.5s. The timeout begins upon entering Phase B, and is reset upon
+    detecting a valid signal, or when T6 times out. */
 #define DEFAULT_TIMER_T6                5000
 
 /*! (Annex C - ISDN) Time-out T7 is used to detect loss of command/response synchronization. T7 is 6+-1s.
-The timeout begins when initiating a command search (e.g., the first entrance into the "command received"
-subroutine - see flow diagram in C.5) and is reset upon detecting a valid signal or when T7 times out. */
+    The timeout begins when initiating a command search (e.g., the first entrance into the "command received"
+    subroutine - see flow diagram in C.5) and is reset upon detecting a valid signal or when T7 times out. */
 #define DEFAULT_TIMER_T7                7000
 
 /*! (Annex C - ISDN) Time-out T8 defines the amount of time waiting for clearance of the busy condition
-of the receiving terminal. T8 is 10+-1s. The timeout begins on the first detection of the combination
-of no outstanding corrections and the RNR response. T8 is reset when T8 times out or MCF response is
-received. If the timer T8 expires, a DCN command is transmitted for call release. */
+    of the receiving terminal. T8 is 10+-1s. The timeout begins on the first detection of the combination
+    of no outstanding corrections and the RNR response. T8 is reset when T8 times out or MCF response is
+    received. If the timer T8 expires, a DCN command is transmitted for call release. */
 #define DEFAULT_TIMER_T8                10000
 
 /*! Final time we allow for things to flush through the system, before we disconnect, in milliseconds.
-   200ms should be fine for a PSTN call. For a T.38 call something longer is desirable. */
+    200ms should be fine for a PSTN call. For a T.38 call something longer is desirable. */
 #define FINAL_FLUSH_TIME                1000
 
 /*! The number of PPRs received before CTC or EOR is sent in ECM mode. T.30 defines this as 4,
-   but it could be varied, and the Japanese spec, for example, does make this value a
-   variable. */
+    but it could be varied, and the Japanese spec, for example, does make this value a
+    variable. */
 #define PPR_LIMIT_BEFORE_CTC_OR_EOR     4
 
 /* HDLC message header byte values */
@@ -401,10 +401,10 @@
     switch (s->operation_in_progress)
     {
     case OPERATION_IN_PROGRESS_T4_TX:
-        t4_tx_release(&(s->t4));
+        t4_tx_release(&s->t4);
         break;
     case OPERATION_IN_PROGRESS_T4_RX:
-        t4_rx_release(&(s->t4));
+        t4_rx_release(&s->t4);
         break;
     }
     s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
@@ -414,7 +414,7 @@
 
 static int tx_start_page(t30_state_t *s)
 {
-    if (t4_tx_start_page(&(s->t4)))
+    if (t4_tx_start_page(&s->t4))
     {
         terminate_operation_in_progress(s);
         return -1;
@@ -429,7 +429,7 @@
 static int tx_end_page(t30_state_t *s)
 {
     s->retries = 0;
-    if (t4_tx_end_page(&(s->t4)) == 0)
+    if (t4_tx_end_page(&s->t4) == 0)
     {
         s->tx_page_number++;
         s->ecm_block = 0;
@@ -453,7 +453,7 @@
     t4_rx_set_x_resolution(&s->t4, s->x_resolution);
     t4_rx_set_y_resolution(&s->t4, s->y_resolution);
 
-    if (t4_rx_start_page(&(s->t4)))
+    if (t4_rx_start_page(&s->t4))
         return -1;
     /* Clear the buffer */
     for (i = 0;  i < 256;  i++)
@@ -468,7 +468,7 @@
 
 static int rx_end_page(t30_state_t *s)
 {
-    if (t4_rx_end_page(&(s->t4)) == 0)
+    if (t4_rx_end_page(&s->t4) == 0)
     {
         s->rx_page_number++;
         s->ecm_block = 0;
@@ -619,7 +619,7 @@
     int res;
     int more;
 
-    res = t4_tx_next_page_has_different_format(&(s->t4));
+    res = t4_tx_next_page_has_different_format(&s->t4);
     if (res == 0)
     {
         span_log(&s->logging, SPAN_LOG_FLOW, "More pages to come with the same format\n");
@@ -628,7 +628,7 @@
     if (res > 0)
     {
         span_log(&s->logging, SPAN_LOG_FLOW, "More pages to come with a different format\n");
-        s->tx_start_page = t4_tx_get_current_page_in_file(&(s->t4)) + 1;
+        s->tx_start_page = t4_tx_get_current_page_in_file(&s->t4) + 1;
         return (s->local_interrupt_pending)  ?  T30_PRI_EOM  :  T30_EOM;
     }
     /* Call a user handler, if one is set, to check if another document is to be sent.
@@ -640,7 +640,7 @@
         more = FALSE;
     if (more)
     {
-        //if (test_ctrl_bit(s->far_dis_dtc_frame, 34))
+        //if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_MULTIPLE_SELECTIVE_POLLING_CAPABLE))
         //    return T30_EOS;
         return (s->local_interrupt_pending)  ?  T30_PRI_EOM  :  T30_EOM;
     }
@@ -690,7 +690,7 @@
     /* We filled the entire buffer */
     s->ecm_frames = 256;
     span_log(&s->logging, SPAN_LOG_FLOW, "Partial page buffer full (%d per frame)\n", s->octets_per_ecm_frame);
-    s->ecm_at_page_end = ((t4_tx_check_bit(&(s->t4)) & 2) != 0);
+    s->ecm_at_page_end = ((t4_tx_check_bit(&s->t4) & 2) != 0);
     return 256;
 }
 /*- End of function --------------------------------------------------------*/
@@ -900,28 +900,28 @@
 
 static int send_psa_frame(t30_state_t *s)
 {
-    if (test_ctrl_bit(s->far_dis_dtc_frame, 35)  &&  s->tx_info.polled_sub_address[0])
+    if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_POLLED_SUBADDRESSING_CAPABLE)  &&  s->tx_info.polled_sub_address[0])
     {
         span_log(&s->logging, SPAN_LOG_FLOW, "Sending polled sub-address '%s'\n", s->tx_info.polled_sub_address);
         send_20digit_msg_frame(s, T30_PSA, s->tx_info.polled_sub_address);
-        set_ctrl_bit(s->local_dis_dtc_frame, 35);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_POLLED_SUBADDRESSING_CAPABLE);
         return TRUE;
     }
-    clr_ctrl_bit(s->local_dis_dtc_frame, 35);
+    clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_POLLED_SUBADDRESSING_CAPABLE);
     return FALSE;
 }
 /*- End of function --------------------------------------------------------*/
 
 static int send_sep_frame(t30_state_t *s)
 {
-    if (test_ctrl_bit(s->far_dis_dtc_frame, 47)  &&  s->tx_info.selective_polling_address[0])
+    if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_SELECTIVE_POLLING_CAPABLE)  &&  s->tx_info.selective_polling_address[0])
     {
         span_log(&s->logging, SPAN_LOG_FLOW, "Sending selective polling address '%s'\n", s->tx_info.selective_polling_address);
         send_20digit_msg_frame(s, T30_SEP, s->tx_info.selective_polling_address);
-        set_ctrl_bit(s->local_dis_dtc_frame, 47);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SELECTIVE_POLLING_CAPABLE);
         return TRUE;
     }
-    clr_ctrl_bit(s->local_dis_dtc_frame, 47);
+    clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SELECTIVE_POLLING_CAPABLE);
     return FALSE;
 }
 /*- End of function --------------------------------------------------------*/
@@ -929,14 +929,14 @@
 static int send_sid_frame(t30_state_t *s)
 {
     /* Only send if there is an ID to send. */
-    if (test_ctrl_bit(s->far_dis_dtc_frame, 50)  &&  s->tx_info.sender_ident[0])
+    if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_PASSWORD)  &&  s->tx_info.sender_ident[0])
     {
         span_log(&s->logging, SPAN_LOG_FLOW, "Sending sender identification '%s'\n", s->tx_info.sender_ident);
         send_20digit_msg_frame(s, T30_SID, s->tx_info.sender_ident);
-        set_ctrl_bit(s->dcs_frame, 50);
+        set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_SENDER_ID_TRANSMISSION);
         return TRUE;
     }
-    clr_ctrl_bit(s->dcs_frame, 50);
+    clr_ctrl_bit(s->dcs_frame, T30_DCS_BIT_SENDER_ID_TRANSMISSION);
     return FALSE;
 }
 /*- End of function --------------------------------------------------------*/
@@ -944,14 +944,14 @@
 static int send_pwd_frame(t30_state_t *s)
 {
     /* Only send if there is a password to send. */
-    if (test_ctrl_bit(s->far_dis_dtc_frame, 50)  &&  s->tx_info.password[0])
+    if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_PASSWORD)  &&  s->tx_info.password[0])
     {
         span_log(&s->logging, SPAN_LOG_FLOW, "Sending password '%s'\n", s->tx_info.password);
         send_20digit_msg_frame(s, T30_PWD, s->tx_info.password);
-        set_ctrl_bit(s->local_dis_dtc_frame, 50);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_PASSWORD);
         return TRUE;
     }
-    clr_ctrl_bit(s->local_dis_dtc_frame, 50);
+    clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_PASSWORD);
     return FALSE;
 }
 /*- End of function --------------------------------------------------------*/
@@ -959,21 +959,21 @@
 static int send_sub_frame(t30_state_t *s)
 {
     /* Only send if there is a sub-address to send. */
-    if (test_ctrl_bit(s->far_dis_dtc_frame, 49)  &&  s->tx_info.sub_address[0])
+    if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_SUBADDRESSING_CAPABLE)  &&  s->tx_info.sub_address[0])
     {
         span_log(&s->logging, SPAN_LOG_FLOW, "Sending sub-address '%s'\n", s->tx_info.sub_address);
         send_20digit_msg_frame(s, T30_SUB, s->tx_info.sub_address);
-        set_ctrl_bit(s->dcs_frame, 49);
+        set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_SUBADDRESS_TRANSMISSION);
         return TRUE;
     }
-    clr_ctrl_bit(s->dcs_frame, 49);
+    clr_ctrl_bit(s->dcs_frame, T30_DCS_BIT_SUBADDRESS_TRANSMISSION);
     return FALSE;
 }
 /*- End of function --------------------------------------------------------*/
 
 static int send_tsa_frame(t30_state_t *s)
 {
-    if ((test_ctrl_bit(s->far_dis_dtc_frame, 1)  ||  test_ctrl_bit(s->far_dis_dtc_frame, 3))  &&  0)
+    if ((test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T37)  ||  test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T38))  &&  0)
     {
         span_log(&s->logging, SPAN_LOG_FLOW, "Sending transmitting subscriber internet address '%s'\n", "");
         return TRUE;
@@ -984,20 +984,20 @@
 
 static int send_ira_frame(t30_state_t *s)
 {
-    if (test_ctrl_bit(s->far_dis_dtc_frame, 102)  &&  0)
+    if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INTERNET_ROUTING_ADDRESS)  &&  0)
     {
         span_log(&s->logging, SPAN_LOG_FLOW, "Sending internet routing address '%s'\n", "");
-        set_ctrl_bit(s->dcs_frame, 102);
+        set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INTERNET_ROUTING_ADDRESS_TRANSMISSION);
         return TRUE;
     }
-    clr_ctrl_bit(s->dcs_frame, 102);
+    clr_ctrl_bit(s->dcs_frame, T30_DCS_BIT_INTERNET_ROUTING_ADDRESS_TRANSMISSION);
     return FALSE;
 }
 /*- End of function --------------------------------------------------------*/
 
 static int send_cia_frame(t30_state_t *s)
 {
-    if ((test_ctrl_bit(s->far_dis_dtc_frame, 1)  ||  test_ctrl_bit(s->far_dis_dtc_frame, 3))  &&  0)
+    if ((test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T37)  ||  test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T38))  &&  0)
     {
         span_log(&s->logging, SPAN_LOG_FLOW, "Sending calling subscriber internet address '%s'\n", "");
         return TRUE;
@@ -1008,13 +1008,13 @@
 
 static int send_isp_frame(t30_state_t *s)
 {
-    if (test_ctrl_bit(s->far_dis_dtc_frame, 101)  &&  0)
+    if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_INTERNET_SELECTIVE_POLLING_ADDRESS)  &&  0)
     {
         span_log(&s->logging, SPAN_LOG_FLOW, "Sending internet selective polling address '%s'\n", "");
-        set_ctrl_bit(s->local_dis_dtc_frame, 101);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INTERNET_SELECTIVE_POLLING_ADDRESS);
         return TRUE;
     }
-    clr_ctrl_bit(s->local_dis_dtc_frame, 101);
+    clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INTERNET_SELECTIVE_POLLING_ADDRESS);
     return FALSE;
 }
 /*- End of function --------------------------------------------------------*/
@@ -1058,14 +1058,14 @@
     s->local_dis_dtc_frame[2] = (uint8_t) (T30_DIS | s->dis_received);
     /* If we have a file name to receive into, then we are receive capable */
     if (s->rx_file[0])
-        set_ctrl_bit(s->local_dis_dtc_frame, 10);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_READY_TO_RECEIVE_FAX_DOCUMENT);
     else
-        clr_ctrl_bit(s->local_dis_dtc_frame, 10);
+        clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_READY_TO_RECEIVE_FAX_DOCUMENT);
     /* If we have a file name to transmit, then we are ready to transmit (polling) */
     if (s->tx_file[0])
-        set_ctrl_bit(s->local_dis_dtc_frame, 9);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_READY_TO_TRANSMIT_FAX_DOCUMENT);
     else
-        clr_ctrl_bit(s->local_dis_dtc_frame, 9);
+        clr_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_READY_TO_TRANSMIT_FAX_DOCUMENT);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
@@ -1088,9 +1088,9 @@
     /* Always say 256 octets per ECM frame preferred, as 64 is never used in the
        real world. */
     if ((s->iaf & T30_IAF_MODE_T37))
-        set_ctrl_bit(s->local_dis_dtc_frame, 1);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T37);
     if ((s->iaf & T30_IAF_MODE_T38))
-        set_ctrl_bit(s->local_dis_dtc_frame, 3);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T38);
     /* No 3G mobile  */
     /* No V.8 */
     /* 256 octets preferred - don't bother making this optional, as everything uses 256 */
@@ -1121,57 +1121,67 @@
     /* No scan-line padding required, but some may be specified by the application. */
     set_ctrl_bits(s->local_dis_dtc_frame, s->local_min_scan_time_code, 21);
     if ((s->supported_compressions & T30_SUPPORT_NO_COMPRESSION))
-        set_ctrl_bit(s->local_dis_dtc_frame, 26);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_UNCOMPRESSED_CAPABLE);
     if (s->ecm_allowed)
     {
         /* ECM allowed */
-        set_ctrl_bit(s->local_dis_dtc_frame, 27);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_ECM_CAPABLE);
         /* Only offer the option of fancy compression schemes, if we are
            also offering the ECM option needed to support them. */
         if ((s->supported_compressions & T30_SUPPORT_T6_COMPRESSION))
-            set_ctrl_bit(s->local_dis_dtc_frame, 31);
+            set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE);
         if ((s->supported_compressions & T30_SUPPORT_T43_COMPRESSION))
-            set_ctrl_bit(s->local_dis_dtc_frame, 36);
+            set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T43_CAPABLE);
+#if 0
+        if ((s->supported_compressions & T30_SUPPORT_T45_COMPRESSION))
+            set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T45_CAPABLE);
+        if ((s->supported_compressions & T30_SUPPORT_T81_COMPRESSION))
+            set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T81_CAPABLE);
+        if ((s->supported_compressions & T30_SUPPORT_SYCC_T81_COMPRESSION))
+            set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SYCC_T81_CAPABLE);
         if ((s->supported_compressions & T30_SUPPORT_T85_COMPRESSION))
-            set_ctrl_bit(s->local_dis_dtc_frame, 78);
+            set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE);
         /* No T.85 optional L0. */
-        if ((s->supported_compressions & T30_SUPPORT_T45_COMPRESSION))
-            set_ctrl_bit(s->local_dis_dtc_frame, 116);
+        //if ((s->supported_compressions & T30_SUPPORT_T85_L0_COMPRESSION))
+        //    set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T85_L0_CAPABLE);
+        //if ((s->supported_compressions & T30_SUPPORT_T89_COMPRESSION))
+        //    set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T89_CAPABLE);
+#endif
     }
     if ((s->supported_t30_features & T30_SUPPORT_FIELD_NOT_VALID))
-        set_ctrl_bit(s->local_dis_dtc_frame, 33);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_FNV_CAPABLE);
     if ((s->supported_t30_features & T30_SUPPORT_MULTIPLE_SELECTIVE_POLLING))
-        set_ctrl_bit(s->local_dis_dtc_frame, 34);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_MULTIPLE_SELECTIVE_POLLING_CAPABLE);
     if ((s->supported_t30_features & T30_SUPPORT_POLLED_SUB_ADDRESSING))
-        set_ctrl_bit(s->local_dis_dtc_frame, 35);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_POLLED_SUBADDRESSING_CAPABLE);
     /* No plane interleave */
     /* No G.726 */
     /* No extended voice coding */
     if ((s->supported_resolutions & T30_SUPPORT_SUPERFINE_RESOLUTION))
-        set_ctrl_bit(s->local_dis_dtc_frame, 41);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_200_400_CAPABLE);
     if ((s->supported_resolutions & T30_SUPPORT_300_300_RESOLUTION))
-        set_ctrl_bit(s->local_dis_dtc_frame, 42);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_300_300_CAPABLE);
     if ((s->supported_resolutions & (T30_SUPPORT_400_400_RESOLUTION | T30_SUPPORT_R16_RESOLUTION)))
-        set_ctrl_bit(s->local_dis_dtc_frame, 43);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_400_400_CAPABLE);
     /* Metric */ 
-    set_ctrl_bit(s->local_dis_dtc_frame, 45);
+    set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_METRIC_RESOLUTION_PREFERRED);
     /* Superfine minimum scan line time pattern follows fine */
     if ((s->supported_t30_features & T30_SUPPORT_SELECTIVE_POLLING))
-        set_ctrl_bit(s->local_dis_dtc_frame, 47);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SELECTIVE_POLLING_CAPABLE);
     if ((s->supported_t30_features & T30_SUPPORT_SUB_ADDRESSING))
-        set_ctrl_bit(s->local_dis_dtc_frame, 49);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_SUBADDRESSING_CAPABLE);
     if ((s->supported_t30_features & T30_SUPPORT_IDENTIFICATION))
-        set_ctrl_bit(s->local_dis_dtc_frame, 50);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_PASSWORD);
     /* Ready to transmit a data file (polling) */
     if (s->tx_file[0])
-        set_ctrl_bit(s->local_dis_dtc_frame, 51);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_READY_TO_TRANSMIT_DATA_FILE);
     /* No Binary file transfer (BFT) */
     /* No Document transfer mode (DTM) */
     /* No Electronic data interchange (EDI) */
     /* No Basic transfer mode (BTM) */
     /* No mixed mode (polling) */
     /* No character mode */
-    /* No mixed mode (Annex E/T.4) */
+    /* No mixed mode (T.4/Annex E) */
     /* No mode 26 (T.505) */
     /* No digital network capability */
     /* No duplex operation */
@@ -1182,9 +1192,9 @@
     /* No custom illuminant */
     /* No custom gamut range */
     if ((s->supported_image_sizes & T30_SUPPORT_US_LETTER_LENGTH))
-        set_ctrl_bit(s->local_dis_dtc_frame, 76);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_NORTH_AMERICAN_LETTER_CAPABLE);
     if ((s->supported_image_sizes & T30_SUPPORT_US_LEGAL_LENGTH))
-        set_ctrl_bit(s->local_dis_dtc_frame, 77);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_NORTH_AMERICAN_LEGAL_CAPABLE);
     /* No HKM key management */
     /* No RSA key management */
     /* No override */
@@ -1201,19 +1211,19 @@
     /* No simple phase C BFT negotiations */
     /* No extended BFT negotiations */
     if ((s->supported_t30_features & T30_SUPPORT_INTERNET_SELECTIVE_POLLING_ADDRESS))
-        set_ctrl_bit(s->local_dis_dtc_frame, 101);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INTERNET_SELECTIVE_POLLING_ADDRESS);
     if ((s->supported_t30_features & T30_SUPPORT_INTERNET_ROUTING_ADDRESS))
-        set_ctrl_bit(s->local_dis_dtc_frame, 102);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_INTERNET_ROUTING_ADDRESS);
     if ((s->supported_resolutions & T30_SUPPORT_600_600_RESOLUTION))
-        set_ctrl_bit(s->local_dis_dtc_frame, 105);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_600_600_CAPABLE);
     if ((s->supported_resolutions & T30_SUPPORT_1200_1200_RESOLUTION))
-        set_ctrl_bit(s->local_dis_dtc_frame, 106);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_1200_1200_CAPABLE);
     if ((s->supported_resolutions & T30_SUPPORT_300_600_RESOLUTION))
-        set_ctrl_bit(s->local_dis_dtc_frame, 107);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_300_600_CAPABLE);
     if ((s->supported_resolutions & T30_SUPPORT_400_800_RESOLUTION))
-        set_ctrl_bit(s->local_dis_dtc_frame, 108);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_400_800_CAPABLE);
     if ((s->supported_resolutions & T30_SUPPORT_600_1200_RESOLUTION))
-        set_ctrl_bit(s->local_dis_dtc_frame, 109);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_600_1200_CAPABLE);
     /* No colour/grey scale 600x600 */
     /* No colour/grey scale 1200x1200 */
     /* No double sided printing (alternate mode) */
@@ -1222,10 +1232,10 @@
     /* No shared data memory */
     /* No T.44 colour space */
     if ((s->iaf & T30_IAF_MODE_FLOW_CONTROL))
-        set_ctrl_bit(s->local_dis_dtc_frame, 121);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T38_FLOW_CONTROL_CAPABLE);
     /* No k > 4 */
     if ((s->iaf & T30_IAF_MODE_CONTINUOUS_FLOW))
-        set_ctrl_bit(s->local_dis_dtc_frame, 123);
+        set_ctrl_bit(s->local_dis_dtc_frame, T30_DIS_BIT_T38_FAX_CAPABLE);
     /* No T.89 profile */
     s->local_dis_dtc_len = 19;
     //t30_decode_dis_dtc_dcs(s, s->local_dis_dtc_frame, s->local_dis_dtc_len);
@@ -1271,11 +1281,11 @@
 
 #if 0
     /* Check for T.37 simple mode. */
-    if (test_ctrl_bit(s->far_dis_dtc_frame, 1))
-        set_ctrl_bit(s->dcs_frame, 1);
+    if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T37))
+        set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T37);
     /* Check for T.38 mode. */
-    if (test_ctrl_bit(s->far_dis_dtc_frame, 3))
-        set_ctrl_bit(s->dcs_frame, 3);
+    if (test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T38))
+        set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T38);
 #endif
 
     /* Set to required modem rate */
@@ -1284,12 +1294,19 @@
     /* Select the compression to use. */
     switch (s->line_encoding)
     {
+#if 0
+    case T4_COMPRESSION_ITU_T85:
+        set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_MODE);
+        //set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T85_L0_MODE);
+        set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21);
+        break;
+#endif
     case T4_COMPRESSION_ITU_T6:
-        set_ctrl_bit(s->dcs_frame, 31);
+        set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T6_MODE);
         set_ctrl_bits(s->dcs_frame, T30_MIN_SCAN_0MS, 21);
         break;
     case T4_COMPRESSION_ITU_T4_2D:
-        set_ctrl_bit(s->dcs_frame, 16);
+        set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_2D_CODING);
         set_ctrl_bits(s->dcs_frame, s->min_scan_time_code, 21);
         break;
     case T4_COMPRESSION_ITU_T4_1D:
@@ -1300,7 +1317,7 @@
         break;
     }
     /* We have a file to send, so tell the far end to go into receive mode. */
-    set_ctrl_bit(s->dcs_frame, 10);
+    set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_RECEIVE_FAX_DOCUMENT);
     /* Set the Y resolution bits */
     bad = T30_ERR_OK;
     switch (s->y_resolution)
@@ -1312,13 +1329,13 @@
             if (!(s->supported_resolutions & T30_SUPPORT_600_1200_RESOLUTION))
                 bad = T30_ERR_NORESSUPPORT;
             else
-                set_ctrl_bit(s->dcs_frame, 109);
+                set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_600_1200);
             break;
         case T4_X_RESOLUTION_1200:
             if (!(s->supported_resolutions & T30_SUPPORT_1200_1200_RESOLUTION))
                 bad = T30_ERR_NORESSUPPORT;
             else
-                set_ctrl_bit(s->dcs_frame, 106);
+                set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_1200_1200);
             break;
         default:
             bad = T30_ERR_NORESSUPPORT;
@@ -1332,7 +1349,7 @@
             if (!(s->supported_resolutions & T30_SUPPORT_400_800_RESOLUTION))
                 bad = T30_ERR_NORESSUPPORT;
             else
-                set_ctrl_bit(s->dcs_frame, 108);
+                set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_400_800);
             break;
         default:
             bad = T30_ERR_NORESSUPPORT;
@@ -1346,13 +1363,13 @@
             if (!(s->supported_resolutions & T30_SUPPORT_300_600_RESOLUTION))
                 bad = T30_ERR_NORESSUPPORT;
             else
-                set_ctrl_bit(s->dcs_frame, 107);
+                set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_300_600);
             break;
         case T4_X_RESOLUTION_600:
             if (!(s->supported_resolutions & T30_SUPPORT_600_600_RESOLUTION))
                 bad = T30_ERR_NORESSUPPORT;
             else
-                set_ctrl_bit(s->dcs_frame, 105);
+                set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_600_600);
             break;
         default:
             bad = T30_ERR_NORESSUPPORT;
@@ -1369,10 +1386,10 @@
             switch (s->x_resolution)
             {
             case T4_X_RESOLUTION_R8:
-                set_ctrl_bit(s->dcs_frame, 41);
+                set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_200_400);
                 break;
             case T4_X_RESOLUTION_R16:
-                set_ctrl_bit(s->dcs_frame, 43);
+                set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_400_400);
                 break;
             default:
                 bad = T30_ERR_NORESSUPPORT;
@@ -1387,7 +1404,7 @@
             if (!(s->supported_resolutions & T30_SUPPORT_300_300_RESOLUTION))
                 bad = T30_ERR_NORESSUPPORT;
             else
-                set_ctrl_bit(s->dcs_frame, 42);
+                set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_300_300);
             break;
         default:
             bad = T30_ERR_NORESSUPPORT;
@@ -1404,7 +1421,7 @@
             switch (s->x_resolution)
             {
             case T4_X_RESOLUTION_R8:
-                set_ctrl_bit(s->dcs_frame, 15);
+                set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_200_200);
                 break;
             default:
                 bad = T30_ERR_NORESSUPPORT;
@@ -1434,6 +1451,8 @@
     /* Deal with the image width. The X resolution will fall in line with any valid width. */
     /* Low (R4) res widths are not supported in recent versions of T.30 */
     bad = T30_ERR_OK;
+    /* The following treats a width field of 11 like 10, which does what note 6 of Table 2/T.30
+       says we should do with the invalid value 11. */
     switch (s->image_width)
     {
     case T4_WIDTH_R8_A4:
@@ -1451,7 +1470,7 @@
         if ((s->far_dis_dtc_frame[5] & (DISBIT2 | DISBIT1)) < 1)
             bad = T30_ERR_NOSIZESUPPORT;
         else if (!(s->supported_image_sizes & T30_SUPPORT_255MM_WIDTH))
-            bad = T30_ERR_BADTIFF;
+            bad = T30_ERR_NOSIZESUPPORT;
         else
             set_ctrl_bit(s->dcs_frame, 17);
         break;
@@ -1463,19 +1482,19 @@
         if ((s->far_dis_dtc_frame[5] & (DISBIT2 | DISBIT1)) < 2)
             bad = T30_ERR_NOSIZESUPPORT;
         else if (!(s->supported_image_sizes & T30_SUPPORT_303MM_WIDTH))    
-            bad = T30_ERR_BADTIFF;
+            bad = T30_ERR_NOSIZESUPPORT;
         else
             set_ctrl_bit(s->dcs_frame, 18);
         break;
     default:
         /* T.30 does not support this width */
-        bad = T30_ERR_BADTIFF;
+        bad = T30_ERR_NOSIZESUPPORT;
         break;
     }
     if (bad != T30_ERR_OK)
     {
         s->current_status = bad;
-        span_log(&s->logging, SPAN_LOG_FLOW, "Image width (%d pixels) not a valid FAX image width\n", s->image_width);
+        span_log(&s->logging, SPAN_LOG_FLOW, "Image width (%d pixels) not an acceptable FAX image width\n", s->image_width);
         return -1;
     }
     switch (s->image_width)
@@ -1488,36 +1507,36 @@
     case T4_WIDTH_300_A4:
     case T4_WIDTH_300_B4:
     case T4_WIDTH_300_A3:
-        if (!test_ctrl_bit(s->far_dis_dtc_frame, 42)  &&  !test_ctrl_bit(s->far_dis_dtc_frame, 107))
+        if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_300_300_CAPABLE)  &&  !test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_300_600_CAPABLE))
             bad = T30_ERR_NOSIZESUPPORT;
         break;
     case T4_WIDTH_R16_A4:
     case T4_WIDTH_R16_B4:
     case T4_WIDTH_R16_A3:
-        if (!test_ctrl_bit(s->far_dis_dtc_frame, 43))
+        if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_400_400_CAPABLE))
             bad = T30_ERR_NOSIZESUPPORT;
         break;
     case T4_WIDTH_600_A4:
     case T4_WIDTH_600_B4:
     case T4_WIDTH_600_A3:
-        if (!test_ctrl_bit(s->far_dis_dtc_frame, 105)  &&  !test_ctrl_bit(s->far_dis_dtc_frame, 109))
+        if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_600_600_CAPABLE)  &&  !test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_600_1200_CAPABLE))
             bad = T30_ERR_NOSIZESUPPORT;
         break;
     case T4_WIDTH_1200_A4:
     case T4_WIDTH_1200_B4:
     case T4_WIDTH_1200_A3:
-        if (!test_ctrl_bit(s->far_dis_dtc_frame, 106))
+        if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_1200_1200_CAPABLE))
             bad = T30_ERR_NOSIZESUPPORT;
         break;
     default:
         /* T.30 does not support this width */
-        bad = T30_ERR_BADTIFF;
+        bad = T30_ERR_NOSIZESUPPORT;
         break;
     }
     if (bad != T30_ERR_OK)
     {
         s->current_status = bad;
-        span_log(&s->logging, SPAN_LOG_FLOW, "Image width (%d pixels) not a valid FAX image width\n", s->image_width);
+        span_log(&s->logging, SPAN_LOG_FLOW, "Image width (%d pixels) not an acceptable FAX image width\n", s->image_width);
         return -1;
     }
     /* Deal with the image length */
@@ -1529,12 +1548,19 @@
         set_ctrl_bit(s->dcs_frame, 19);
 
     if (s->error_correcting_mode)
-        set_ctrl_bit(s->dcs_frame, 27);
+        set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_ECM);
 
-    if ((s->iaf & T30_IAF_MODE_FLOW_CONTROL)  &&  test_ctrl_bit(s->far_dis_dtc_frame, 121))
-        set_ctrl_bit(s->dcs_frame, 121);
-    if ((s->iaf & T30_IAF_MODE_CONTINUOUS_FLOW)  &&  test_ctrl_bit(s->far_dis_dtc_frame, 123))
-        set_ctrl_bit(s->dcs_frame, 123);
+    if ((s->iaf & T30_IAF_MODE_FLOW_CONTROL)  &&  test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T38_FLOW_CONTROL_CAPABLE))
+        set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T38_FLOW_CONTROL_CAPABLE);
+    if ((s->iaf & T30_IAF_MODE_CONTINUOUS_FLOW)  &&  test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T38_FAX_CAPABLE))
+    {
+        /* Clear the modem type bits, in accordance with note 77 of Table 2/T.30 */
+        clr_ctrl_bit(s->local_dis_dtc_frame, 11);
+        clr_ctrl_bit(s->local_dis_dtc_frame, 12);
+        clr_ctrl_bit(s->local_dis_dtc_frame, 13);
+        clr_ctrl_bit(s->local_dis_dtc_frame, 14);
+        set_ctrl_bit(s->dcs_frame, T30_DCS_BIT_T38_FAX_MODE);
+    }
     s->dcs_len = 19;
     //t30_decode_dis_dtc_dcs(s, s->dcs_frame, s->dcs_len);
     return 0;
@@ -1814,10 +1840,10 @@
     switch (s->operation_in_progress)
     {
     case OPERATION_IN_PROGRESS_T4_TX:
-        t4_tx_release(&(s->t4));
+        t4_tx_release(&s->t4);
         break;
     case OPERATION_IN_PROGRESS_T4_RX:
-        t4_rx_release(&(s->t4));
+        t4_rx_release(&s->t4);
         break;
     }
     s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
@@ -1855,16 +1881,16 @@
     switch (s->y_resolution)
     {
     case T4_Y_RESOLUTION_SUPERFINE:
-        if (!test_ctrl_bit(s->far_dis_dtc_frame, 41))
+        if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_400_CAPABLE))
         {
             s->current_status = T30_ERR_NORESSUPPORT;
             span_log(&s->logging, SPAN_LOG_FLOW, "Remote FAX does not support super-fine resolution.\n");
             return -1;
         }
-        s->min_scan_time_code = translate_min_scan_time[(test_ctrl_bit(s->far_dis_dtc_frame, 46))  ?  2  :  1][min_bits_field];
+        s->min_scan_time_code = translate_min_scan_time[(test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_MIN_SCAN_TIME_HALVES))  ?  2  :  1][min_bits_field];
         break;
     case T4_Y_RESOLUTION_FINE:
-        if (!test_ctrl_bit(s->far_dis_dtc_frame, 15))
+        if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_200_200_CAPABLE))
         {
             s->current_status = T30_ERR_NORESSUPPORT;
             span_log(&s->logging, SPAN_LOG_FLOW, "Remote FAX does not support fine resolution.\n");
@@ -1912,7 +1938,7 @@
        must be evaluated before the minimum scan row bits can be evaluated. */
     if ((min_row_bits = set_min_scan_time_code(s)) < 0)
     {
-        t4_tx_release(&(s->t4));
+        t4_tx_release(&s->t4);
         s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
         return -1;
     }
@@ -1921,7 +1947,7 @@
 
     if (tx_start_page(s))
         return -1;
-    s->image_width = t4_tx_get_image_width(&(s->t4));
+    s->image_width = t4_tx_get_image_width(&s->t4);
     if (s->error_correcting_mode)
     {
         if (get_partial_ecm_page(s) == 0)
@@ -1933,7 +1959,7 @@
 
 static int restart_sending_document(t30_state_t *s)
 {
-    t4_tx_restart_page(&(s->t4));
+    t4_tx_restart_page(&s->t4);
     s->retries = 0;
     s->ecm_block = 0;
     send_dcs_sequence(s, TRUE);
@@ -2006,11 +2032,19 @@
     /* 256 octets per ECM frame */
     s->octets_per_ecm_frame = 256;
     /* Select the compression to use. */
-    if (s->error_correcting_mode  &&  (s->supported_compressions & T30_SUPPORT_T6_COMPRESSION)  &&  test_ctrl_bit(s->far_dis_dtc_frame, 31))
+#if 0
+    if (s->error_correcting_mode  &&  (s->supported_compressions & T30_SUPPORT_T85_COMPRESSION)  &&  test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T85_CAPABLE))
     {
+        s->line_encoding = T4_COMPRESSION_ITU_T85;
+    }
+    else if (s->error_correcting_mode  &&  (s->supported_compressions & T30_SUPPORT_T6_COMPRESSION)  &&  test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE))
+#else
+    if (s->error_correcting_mode  &&  (s->supported_compressions & T30_SUPPORT_T6_COMPRESSION)  &&  test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_T6_CAPABLE))
+#endif
+    {
         s->line_encoding = T4_COMPRESSION_ITU_T6;
     }
-    else if ((s->supported_compressions & T30_SUPPORT_T4_2D_COMPRESSION)  &&  test_ctrl_bit(s->far_dis_dtc_frame, 16))
+    else if ((s->supported_compressions & T30_SUPPORT_T4_2D_COMPRESSION)  &&  test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_2D_CAPABLE))
     {
         s->line_encoding = T4_COMPRESSION_ITU_T4_2D;
     }
@@ -2018,7 +2052,7 @@
     {
         s->line_encoding = T4_COMPRESSION_ITU_T4_1D;
     }
-    span_log(&s->logging, SPAN_LOG_FLOW, "Selected compression %d\n", s->line_encoding);
+    span_log(&s->logging, SPAN_LOG_FLOW, "Selected compression %s (%d)\n", t4_encoding_to_str(s->line_encoding), s->line_encoding);
     switch (s->far_dis_dtc_frame[4] & (DISBIT6 | DISBIT5 | DISBIT4 | DISBIT3))
     {
     case (DISBIT6 | DISBIT4 | DISBIT3):
@@ -2077,7 +2111,7 @@
     if (s->tx_file[0])
     {
         span_log(&s->logging, SPAN_LOG_FLOW, "Trying to send file '%s'\n", s->tx_file);
-        if (!test_ctrl_bit(s->far_dis_dtc_frame, 10))
+        if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_READY_TO_RECEIVE_FAX_DOCUMENT))
         {
             span_log(&s->logging, SPAN_LOG_FLOW, "%s far end cannot receive\n", t30_frametype(msg[2]));
             s->current_status = T30_ERR_RX_INCAPABLE;
@@ -2103,7 +2137,7 @@
     if (s->rx_file[0])
     {
         span_log(&s->logging, SPAN_LOG_FLOW, "Trying to receive file '%s'\n", s->rx_file);
-        if (!test_ctrl_bit(s->far_dis_dtc_frame, 9))
+        if (!test_ctrl_bit(s->far_dis_dtc_frame, T30_DIS_BIT_READY_TO_TRANSMIT_FAX_DOCUMENT))
         {
             span_log(&s->logging, SPAN_LOG_FLOW, "%s far end cannot transmit\n", t30_frametype(msg[2]));
             s->current_status = T30_ERR_TX_INCAPABLE;
@@ -2174,30 +2208,30 @@
             memset(dcs_frame + len, 0, T30_MAX_DIS_DTC_DCS_LEN - len);
     }
 
-    s->octets_per_ecm_frame = test_ctrl_bit(dcs_frame, 28)  ?  256  :  64;
+    s->octets_per_ecm_frame = test_ctrl_bit(dcs_frame, T30_DCS_BIT_64_OCTET_ECM_FRAMES)  ?  256  :  64;
 
-    if (test_ctrl_bit(dcs_frame, 106))
+    if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_1200_1200))
         s->x_resolution = T4_X_RESOLUTION_1200;
-    else if (test_ctrl_bit(dcs_frame, 105)  ||  test_ctrl_bit(dcs_frame, 109))
+    else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_600_600)  ||  test_ctrl_bit(dcs_frame, T30_DCS_BIT_600_1200))
         s->x_resolution = T4_X_RESOLUTION_600;
-    else if (test_ctrl_bit(dcs_frame, 43)  ||  test_ctrl_bit(dcs_frame, 108))
+    else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_400_400)  ||  test_ctrl_bit(dcs_frame, T30_DCS_BIT_400_800))
         s->x_resolution = T4_X_RESOLUTION_R16;
-    else if (test_ctrl_bit(dcs_frame, 42)  ||  test_ctrl_bit(dcs_frame, 107))
+    else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_300)  ||  test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_600))
         s->x_resolution = T4_X_RESOLUTION_300;
     else
         s->x_resolution = T4_X_RESOLUTION_R8;
 
-    if (test_ctrl_bit(dcs_frame, 106)  ||  test_ctrl_bit(dcs_frame, 109))
+    if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_1200_1200)  ||  test_ctrl_bit(dcs_frame, T30_DCS_BIT_600_1200))
         s->y_resolution = T4_Y_RESOLUTION_1200;
-    else if (test_ctrl_bit(dcs_frame, 108))
+    else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_400_800))
         s->y_resolution = T4_Y_RESOLUTION_800;
-    else if (test_ctrl_bit(dcs_frame, 105)  ||  test_ctrl_bit(dcs_frame, 107))
+    else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_600_600)  ||  test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_600))
         s->y_resolution = T4_Y_RESOLUTION_600;
-    else if (test_ctrl_bit(dcs_frame, 41)  ||  test_ctrl_bit(dcs_frame, 43))
+    else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_200_400)  ||  test_ctrl_bit(dcs_frame, T30_DCS_BIT_400_400))
         s->y_resolution = T4_Y_RESOLUTION_SUPERFINE;
-    else if (test_ctrl_bit(dcs_frame, 42))
+    else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_300_300))
         s->y_resolution = T4_Y_RESOLUTION_300;
-    else if (test_ctrl_bit(dcs_frame, 15))
+    else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_200_200))
         s->y_resolution = T4_Y_RESOLUTION_FINE;
     else
         s->y_resolution = T4_Y_RESOLUTION_STANDARD;
@@ -2218,14 +2252,20 @@
     s->image_width = widths[i][dcs_frame[5] & (DISBIT2 | DISBIT1)];
 
     /* Check which compression we will use. */
-    if (test_ctrl_bit(dcs_frame, 31))
+#if 0
+    if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T85_MODE))
+        s->line_encoding = T4_COMPRESSION_ITU_T85;
+    else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T6_MODE))
+#else
+    if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_T6_MODE))
+#endif
         s->line_encoding = T4_COMPRESSION_ITU_T6;
-    else if (test_ctrl_bit(dcs_frame, 16))
+    else if (test_ctrl_bit(dcs_frame, T30_DCS_BIT_2D_CODING))
         s->line_encoding = T4_COMPRESSION_ITU_T4_2D;
     else
         s->line_encoding = T4_COMPRESSION_ITU_T4_1D;
     span_log(&s->logging, SPAN_LOG_FLOW, "Selected compression %d\n", s->line_encoding);
-    if (!test_ctrl_bit(dcs_frame, 10))
+    if (!test_ctrl_bit(dcs_frame, T30_DCS_BIT_RECEIVE_FAX_DOCUMENT))
         span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Remote is not requesting receive in DCS\n");
 
     if ((s->current_fallback = find_fallback_entry(dcs_frame[4] & (DISBIT6 | DISBIT5 | DISBIT4 | DISBIT3))) < 0)
@@ -2233,7 +2273,7 @@
         span_log(&s->logging, SPAN_LOG_FLOW, "Remote asked for a modem standard we do not support\n");
         return -1;
     }
-    s->error_correcting_mode = (test_ctrl_bit(dcs_frame, 27) != 0);
+    s->error_correcting_mode = (test_ctrl_bit(dcs_frame, T30_DCS_BIT_ECM) != 0);
 
     if (s->phase_b_handler)
     {
@@ -2671,7 +2711,6 @@
 {
     uint8_t fcf;
 
-    /* We should be sending the TCF data right now */
     fcf = msg[2] & 0xFE;
     switch (fcf)
     {
@@ -3055,14 +3094,14 @@
         case T30_COPY_QUALITY_PERFECT:
         case T30_COPY_QUALITY_GOOD:
             rx_end_page(s);
-            t4_rx_release(&(s->t4));
+            t4_rx_release(&s->t4);
             s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
             s->in_message = FALSE;
             set_state(s, T30_STATE_III_Q_MCF);
             break;
         case T30_COPY_QUALITY_POOR:
             rx_end_page(s);
-            t4_rx_release(&(s->t4));
+            t4_rx_release(&s->t4);
             s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
             s->in_message = FALSE;
             set_state(s, T30_STATE_III_Q_RTP);
@@ -3113,14 +3152,14 @@
         case T30_COPY_QUALITY_PERFECT:
         case T30_COPY_QUALITY_GOOD:
             rx_end_page(s);
-            t4_rx_release(&(s->t4));
+            t4_rx_release(&s->t4);
             s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
             s->in_message = FALSE;
             set_state(s, T30_STATE_III_Q_MCF);
             break;
         case T30_COPY_QUALITY_POOR:
             rx_end_page(s);
-            t4_rx_release(&(s->t4));
+            t4_rx_release(&s->t4);
             s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
             s->in_message = FALSE;
             set_state(s, T30_STATE_III_Q_RTP);
@@ -3140,7 +3179,7 @@
         case T30_COPY_QUALITY_PERFECT:
         case T30_COPY_QUALITY_GOOD:
             rx_end_page(s);
-            t4_rx_release(&(s->t4));
+            t4_rx_release(&s->t4);
             s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
             s->in_message = FALSE;
             set_state(s, T30_STATE_III_Q_MCF);
@@ -3148,7 +3187,7 @@
             break;
         case T30_COPY_QUALITY_POOR:
             rx_end_page(s);
-            t4_rx_release(&(s->t4));
+            t4_rx_release(&s->t4);
             s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
             s->in_message = FALSE;
             set_state(s, T30_STATE_III_Q_RTP);
@@ -3172,14 +3211,14 @@
         case T30_COPY_QUALITY_PERFECT:
         case T30_COPY_QUALITY_GOOD:
             rx_end_page(s);
-            t4_rx_release(&(s->t4));
+            t4_rx_release(&s->t4);
             s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
             s->in_message = FALSE;
             set_state(s, T30_STATE_III_Q_MCF);
             break;
         case T30_COPY_QUALITY_POOR:
             rx_end_page(s);
-            t4_rx_release(&(s->t4));
+            t4_rx_release(&s->t4);
             s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
             s->in_message = FALSE;
             set_state(s, T30_STATE_III_Q_RTP);
@@ -3516,7 +3555,7 @@
             tx_end_page(s);
             if (s->phase_d_handler)
                 s->phase_d_handler(s, s->phase_d_user_data, fcf);
-            t4_tx_release(&(s->t4));
+            t4_tx_release(&s->t4);
             s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
             if (span_log_test(&s->logging, SPAN_LOG_FLOW))
             {
@@ -3530,7 +3569,7 @@
             tx_end_page(s);
             if (s->phase_d_handler)
                 s->phase_d_handler(s, s->phase_d_user_data, fcf);
-            t4_tx_release(&(s->t4));
+            t4_tx_release(&s->t4);
             s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
             send_dcn(s);
             if (span_log_test(&s->logging, SPAN_LOG_FLOW))
@@ -3575,7 +3614,7 @@
             tx_end_page(s);
             if (s->phase_d_handler)
                 s->phase_d_handler(s, s->phase_d_user_data, fcf);
-            t4_tx_release(&(s->t4));
+            t4_tx_release(&s->t4);
             /* TODO: should go back to T, and resend */
             return_to_phase_b(s, TRUE);
             break;
@@ -3584,7 +3623,7 @@
             tx_end_page(s);
             if (s->phase_d_handler)
                 s->phase_d_handler(s, s->phase_d_user_data, fcf);
-            t4_tx_release(&(s->t4));
+            t4_tx_release(&s->t4);
             send_dcn(s);
             break;
         }
@@ -3895,7 +3934,7 @@
                 tx_end_page(s);
                 if (s->phase_d_handler)
                     s->phase_d_handler(s, s->phase_d_user_data, fcf);
-                t4_tx_release(&(s->t4));
+                t4_tx_release(&s->t4);
                 s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
                 if (span_log_test(&s->logging, SPAN_LOG_FLOW))
                 {
@@ -3909,7 +3948,7 @@
                 tx_end_page(s);
                 if (s->phase_d_handler)
                     s->phase_d_handler(s, s->phase_d_user_data, fcf);
-                t4_tx_release(&(s->t4));
+                t4_tx_release(&s->t4);
                 s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
                 send_dcn(s);
                 if (span_log_test(&s->logging, SPAN_LOG_FLOW))
@@ -3999,7 +4038,7 @@
                 tx_end_page(s);
                 if (s->phase_d_handler)
                     s->phase_d_handler(s, s->phase_d_user_data, fcf);
-                t4_tx_release(&(s->t4));
+                t4_tx_release(&s->t4);
                 s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
                 if (span_log_test(&s->logging, SPAN_LOG_FLOW))
                 {
@@ -4013,7 +4052,7 @@
                 tx_end_page(s);
                 if (s->phase_d_handler)
                     s->phase_d_handler(s, s->phase_d_user_data, fcf);
-                t4_tx_release(&(s->t4));
+                t4_tx_release(&s->t4);
                 s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
                 send_dcn(s);
                 if (span_log_test(&s->logging, SPAN_LOG_FLOW))
@@ -4119,7 +4158,7 @@
                 tx_end_page(s);
                 if (s->phase_d_handler)
                     s->phase_d_handler(s, s->phase_d_user_data, fcf);
-                t4_tx_release(&(s->t4));
+                t4_tx_release(&s->t4);
                 s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
                 if (span_log_test(&s->logging, SPAN_LOG_FLOW))
                 {
@@ -4133,7 +4172,7 @@
                 tx_end_page(s);
                 if (s->phase_d_handler)
                     s->phase_d_handler(s, s->phase_d_user_data, fcf);
-                t4_tx_release(&(s->t4));
+                t4_tx_release(&s->t4);
                 s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;
                 send_dcn(s);
                 if (span_log_test(&s->logging, SPAN_LOG_FLOW))
@@ -5395,7 +5434,7 @@
         break;
     case T30_STATE_I:
         /* Transferring real data. */
-        bit = t4_tx_get_bit(&(s->t4));
+        bit = t4_tx_get_bit(&s->t4);
         break;
     case T30_STATE_D_POST_TCF:
     case T30_STATE_II_Q:
@@ -5430,7 +5469,7 @@
         break;
     case T30_STATE_I:
         /* Transferring real data. */
-        byte = t4_tx_get_byte(&(s->t4));
+        byte = t4_tx_get_byte(&s->t4);
         break;
     case T30_STATE_D_POST_TCF:
     case T30_STATE_II_Q:
@@ -5813,9 +5852,8 @@
             }
             break;
         case T30_STATE_B:
-            /* We have now allowed time for the last message to flush
-               through the system, so it is safe to report the end of the
-               call. */
+            /* We have now allowed time for the last message to flush through
+               the system, so it is safe to report the end of the call. */
             if (s->phase_e_handler)
                 s->phase_e_handler(s, s->phase_e_user_data, s->current_status);
             set_state(s, T30_STATE_CALL_FINISHED);
@@ -5989,10 +6027,13 @@
 
 SPAN_DECLARE(void) t30_timer_update(t30_state_t *s, int samples)
 {
+    int previous;
+
     if (s->timer_t0_t1 > 0)
     {
         if ((s->timer_t0_t1 -= samples) <= 0)
         {
+            s->timer_t0_t1 = 0;
             if (s->far_end_detected)
                 timer_t1_expired(s);
             else
@@ -6002,13 +6043,21 @@
     if (s->timer_t3 > 0)
     {
         if ((s->timer_t3 -= samples) <= 0)
+        {
+            s->timer_t3 = 0;
             timer_t3_expired(s);
+        }
     }
     if (s->timer_t2_t4 > 0)
     {
         if ((s->timer_t2_t4 -= samples) <= 0)
         {
-            switch (s->timer_t2_t4_is)
+            previous = s->timer_t2_t4_is;
+            /* Don't allow the count to be left at a small negative number.
+               It looks cosmetically bad in the logs. */
+            s->timer_t2_t4 = 0;
+            s->timer_t2_t4_is = TIMER_IS_IDLE;
+            switch (previous)
             {
             case TIMER_IS_T1A:
                 timer_t1a_expired(s);
@@ -6037,7 +6086,10 @@
     if (s->timer_t5 > 0)
     {
         if ((s->timer_t5 -= samples) <= 0)
+        {
+            s->timer_t5 = 0;
             timer_t5_expired(s);
+        }
     }
 }
 /*- End of function --------------------------------------------------------*/
@@ -6199,10 +6251,10 @@
     switch (s->operation_in_progress)
     {
     case OPERATION_IN_PROGRESS_T4_TX:
-        t4_tx_release(&(s->t4));
+        t4_tx_release(&s->t4);
         break;
     case OPERATION_IN_PROGRESS_T4_RX:
-        t4_rx_release(&(s->t4));
+        t4_rx_release(&s->t4);
         break;
     }
     s->operation_in_progress = OPERATION_IN_PROGRESS_NONE;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t30_api.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t30_api.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t30_api.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t30_api.c,v 1.13 2009/02/03 16:28:40 steveu Exp $
+ * $Id: t30_api.c,v 1.13.4.2 2009/12/19 14:18:13 steveu Exp $
  */
 
 /*! \file */
@@ -60,7 +60,8 @@
 #include "spandsp/v29tx.h"
 #include "spandsp/v27ter_rx.h"
 #include "spandsp/v27ter_tx.h"
-#include "spandsp/t4.h"
+#include "spandsp/t4_rx.h"
+#include "spandsp/t4_tx.h"
 #include "spandsp/t30_fcf.h"
 #include "spandsp/t35.h"
 #include "spandsp/t30.h"
@@ -68,7 +69,8 @@
 #include "spandsp/t30_logging.h"
 
 #include "spandsp/private/logging.h"
-#include "spandsp/private/t4.h"
+#include "spandsp/private/t4_rx.h"
+#include "spandsp/private/t4_tx.h"
 #include "spandsp/private/t30.h"
 
 #include "t30_local.h"
@@ -83,7 +85,7 @@
     if (strlen(id) > T30_MAX_IDENT_LEN)
         return -1;
     strcpy(s->tx_info.ident, id);
-    t4_tx_set_local_ident(&(s->t4), s->tx_info.ident);
+    t4_tx_set_local_ident(&s->t4, s->tx_info.ident);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
@@ -544,7 +546,7 @@
     if (strlen(info) > T30_MAX_PAGE_HEADER_INFO)
         return -1;
     strcpy(s->header_info, info);
-    t4_tx_set_header_info(&(s->t4), s->header_info);
+    t4_tx_set_header_info(&s->t4, s->header_info);
     return 0;
 }
 /*- End of function --------------------------------------------------------*/

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t30_logging.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t30_logging.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t30_logging.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t30_logging.c,v 1.12 2009/04/12 09:12:10 steveu Exp $
+ * $Id: t30_logging.c,v 1.12.4.2 2009/12/19 10:44:10 steveu Exp $
  */
 
 /*! \file */
@@ -60,14 +60,16 @@
 #include "spandsp/v29tx.h"
 #include "spandsp/v27ter_rx.h"
 #include "spandsp/v27ter_tx.h"
-#include "spandsp/t4.h"
+#include "spandsp/t4_rx.h"
+#include "spandsp/t4_tx.h"
 #include "spandsp/t30_fcf.h"
 #include "spandsp/t35.h"
 #include "spandsp/t30.h"
 #include "spandsp/t30_logging.h"
 
 #include "spandsp/private/logging.h"
-#include "spandsp/private/t4.h"
+#include "spandsp/private/t4_rx.h"
+#include "spandsp/private/t4_tx.h"
 #include "spandsp/private/t30.h"
 
 #include "t30_local.h"
@@ -931,7 +933,7 @@
     octet_bit_field(log, pkt, 121, "Flow control capability for T.38 communication", NULL, NULL);
     octet_bit_field(log, pkt, 122, "K>4", NULL, NULL);
     octet_bit_field(log, pkt, 123, "Internet aware T.38 mode fax (not affected by data signal rate bits)", NULL, NULL);
-    octet_field(log, pkt, 124, 126, "T.89 (Application profiles for ITU-T Rec T.8)", t89_profile_tags);
+    octet_field(log, pkt, 124, 126, "T.89 (Application profiles for ITU-T Rec T.88)", t89_profile_tags);
     octet_bit_field(log, pkt, 127, "sYCC-JPEG coding", NULL, NULL);
     octet_bit_field(log, pkt, 128, "Extension indicator", NULL, NULL);
     if (!(pkt[18] & DISBIT8))

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t31.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t31.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t31.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -25,7 +25,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t31.c,v 1.153 2009/10/05 16:33:25 steveu Exp $
+ * $Id: t31.c,v 1.155.4.1 2009/12/19 10:44:10 steveu Exp $
  */
 
 /*! \file */
@@ -74,7 +74,8 @@
 #include "spandsp/v17rx.h"
 #include "spandsp/super_tone_rx.h"
 #include "spandsp/modem_connect_tones.h"
-#include "spandsp/t4.h"
+#include "spandsp/t4_rx.h"
+#include "spandsp/t4_tx.h"
 #include "spandsp/t30.h"
 #include "spandsp/t30_logging.h"
 #include "spandsp/t38_core.h"
@@ -1293,12 +1294,12 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static void tone_detected(void *user_data, int on, int level, int delay)
+static void tone_detected(void *user_data, int tone, int level, int delay)
 {
     t31_state_t *s;
 
     s = (t31_state_t *) user_data;
-    span_log(&s->logging, SPAN_LOG_FLOW, "FAX tone declared %s (%ddBm0)\n", (on)  ?  "on"  :  "off", level);
+    span_log(&s->logging, SPAN_LOG_FLOW, "%s detected (%ddBm0)\n", modem_connect_tone_to_str(tone), level);
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -1509,7 +1510,7 @@
     s->hdlc_tx.len = 0;
     s->dled = FALSE;
     hdlc_rx_init(&(s->audio.modems.hdlc_rx), FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, hdlc_accept_frame, s);
-    fsk_rx_init(&(s->audio.modems.v21_rx), &preset_fsk_specs[FSK_V21CH2], TRUE, (put_bit_func_t) hdlc_rx_put_bit, &(s->audio.modems.hdlc_rx));
+    fsk_rx_init(&(s->audio.modems.v21_rx), &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) hdlc_rx_put_bit, &(s->audio.modems.hdlc_rx));
     fsk_rx_signal_cutoff(&(s->audio.modems.v21_rx), -39.09f);
     s->at_state.transmit = TRUE;
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t38_core.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t38_core.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t38_core.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_core.c,v 1.53 2009/07/14 13:54:22 steveu Exp $
+ * $Id: t38_core.c,v 1.54 2009/10/09 14:53:57 steveu Exp $
  */
 
 /*! \file */
@@ -224,17 +224,17 @@
     switch (profile)
     {
     case '1':
-        return "G3 Facsimile Terminal: (Sending Facsimile)";
+        return "G3 FAX sending terminal";
     case '2':
-        return "G3 Facsimile Terminal: (Receiving Facsimile)";
+        return "G3 FAX receiving terminal";
     case '3':
-        return "V.34 HDX and G3 Facsimile Terminal: (Sending Facsimile)";
+        return "V.34 HDX and G3 FAX sending terminal";
     case '4':
-        return "V.34 HDX and G3 Facsimile Terminal: (Receiving Facsimile)";
+        return "V.34 HDX and G3 FAX receiving terminal";
     case '5':
-        return "V.34 HDX-only Facsimile Terminal: (Sending Facsimile)";
+        return "V.34 HDX-only FAX sending terminal";
     case '6':
-        return "V.34 HDX-only Facsimile Terminal: (Receiving Facsimile)";
+        return "V.34 HDX-only FAX receiving terminal";
     }
     return "???";
 }
@@ -260,10 +260,10 @@
             return "NACK: No compatible mode available";
         case '1':
             /* Response for profiles 1 and 2 */
-            return "NACK: No V.34 fax, use G3 fax";
+            return "NACK: No V.34 FAX, use G3 FAX";
         case '2':
             /* Response for profiles 5 and 6 */
-            return "NACK: V.34 fax only.";
+            return "NACK: V.34 only FAX.";
         }
         break;
     }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t38_gateway.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t38_gateway.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t38_gateway.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -23,7 +23,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_gateway.c,v 1.164 2009/07/14 13:54:22 steveu Exp $
+ * $Id: t38_gateway.c,v 1.171.4.2 2009/12/19 10:44:10 steveu Exp $
  */
 
 /*! \file */
@@ -73,7 +73,8 @@
 #include "spandsp/v17rx.h"
 #include "spandsp/super_tone_rx.h"
 #include "spandsp/modem_connect_tones.h"
-#include "spandsp/t4.h"
+#include "spandsp/t4_rx.h"
+#include "spandsp/t4_tx.h"
 #include "spandsp/t30_fcf.h"
 #include "spandsp/t35.h"
 #include "spandsp/t30.h"
@@ -95,7 +96,8 @@
 #include "spandsp/private/modem_connect_tones.h"
 #include "spandsp/private/hdlc.h"
 #include "spandsp/private/fax_modems.h"
-#include "spandsp/private/t4.h"
+#include "spandsp/private/t4_rx.h"
+#include "spandsp/private/t4_tx.h"
 #include "spandsp/private/t30.h"
 #include "spandsp/private/t38_core.h"
 #include "spandsp/private/t38_non_ecm_buffer.h"
@@ -181,7 +183,7 @@
 static void non_ecm_put_bit(void *user_data, int bit);
 static void non_ecm_remove_fill_and_put_bit(void *user_data, int bit);
 static void non_ecm_push_residue(t38_gateway_state_t *s);
-static void tone_detected(void *user_data, int on, int level, int delay);
+static void tone_detected(void *user_data, int tone, int level, int delay);
 
 static void set_rx_handler(t38_gateway_state_t *s, span_rx_handler_t *handler, void *user_data)
 {
@@ -302,12 +304,12 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static void tone_detected(void *user_data, int on, int level, int delay)
+static void tone_detected(void *user_data, int tone, int level, int delay)
 {
     t38_gateway_state_t *s;
 
     s = (t38_gateway_state_t *) user_data;
-    span_log(&s->logging, SPAN_LOG_FLOW, "FAX tone declared %s (%ddBm0)\n", (on)  ?  "on"  :  "off", level);
+    span_log(&s->logging, SPAN_LOG_FLOW, "%s detected (%ddBm0)\n", modem_connect_tone_to_str(tone), level);
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -540,16 +542,16 @@
         set_rx_active(s, TRUE);
         break;
     case T38_IND_V8_ANSAM:
-        t->tx_bit_rate = 0;
+        t->tx_bit_rate = 300;
         break;
     case T38_IND_V8_SIGNAL:
-        t->tx_bit_rate = 0;
+        t->tx_bit_rate = 300;
         break;
     case T38_IND_V34_CNTL_CHANNEL_1200:
-        t->tx_bit_rate = 0;
+        t->tx_bit_rate = 1200;
         break;
     case T38_IND_V34_PRI_CHANNEL:
-        t->tx_bit_rate = 0;
+        t->tx_bit_rate = 33600;
         break;
     case T38_IND_V34_CC_RETRAIN:
         t->tx_bit_rate = 0;
@@ -796,6 +798,13 @@
     case T30_DCS | 1:
         /* We need to check which modem type is about to be used, so we can start the
            correct modem. */
+        s->core.fast_bit_rate = 0;
+        s->core.fast_rx_modem = T38_NONE;
+        s->core.image_data_mode = FALSE;
+        s->core.short_train = FALSE;
+        if (from_modem)
+            s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_BEGIN;
+        /*endif*/
         if (len >= 5)
         {
             /* The table is short, and not searched often, so a brain-dead linear scan seems OK */
@@ -807,8 +816,12 @@
                 /*endif*/
             }
             /*endfor*/
+            /* If we are processing a message from the modem side, the contents determine the fast receive modem.
+               we are to use. If it comes from the T.38 side the contents do not. */
             s->core.fast_bit_rate = modem_codes[i].bit_rate;
-            s->core.fast_modem = modem_codes[i].modem_type;
+            if (from_modem)
+                s->core.fast_rx_modem = modem_codes[i].modem_type;
+            /*endif*/
         }
         /*endif*/
         if (len >= 6)
@@ -816,26 +829,34 @@
             j = (buf[5] & (DISBIT7 | DISBIT6 | DISBIT5)) >> 4;
             span_log(&s->logging, SPAN_LOG_FLOW, "Min bits test = 0x%X\n", buf[5]);
             s->core.min_row_bits = (s->core.fast_bit_rate*minimum_scan_line_times[j])/1000;
-            span_log(&s->logging, SPAN_LOG_FLOW, "Min bits per row = %d\n", j);
         }
+        else
+        {
+            s->core.min_row_bits = 0;
+        }
         /*endif*/
         s->core.ecm_mode = (len >= 7)  &&  (buf[6] & DISBIT3);
-        s->core.image_data_mode = FALSE;
-        s->core.short_train = FALSE;
-        if (from_modem)
-            s->core.timed_mode = TIMED_MODE_TCF_PREDICTABLE_MODEM_START_BEGIN;
-        /*endif*/
+        span_log(&s->logging, SPAN_LOG_FLOW, "Fast rx modem = %d/%d, ECM = %d, Min bits per row = %d\n", s->core.fast_rx_modem, s->core.fast_bit_rate, s->core.ecm_mode, s->core.min_row_bits);
         break;
     case T30_PPS:
     case T30_PPS | 1:
         switch (buf[3] & 0xFE)
         {
         case T30_EOP:
+        case T30_PRI_EOP:
         case T30_EOM:
+        case T30_PRI_EOM:
         case T30_EOS:
+#if 0
+            /* If we are hitting one of these conditions, it will take another DCS/DTC to select
+               the fast modem again, so abandon our idea of it. */
+            s->core.fast_bit_rate = 0;
+            s->core.fast_rx_modem = T38_NONE;
+            s->core.image_data_mode = FALSE;
+            s->core.short_train = FALSE;
+#endif
+            /* Fall through */
         case T30_MPS:
-        case T30_PRI_EOP:
-        case T30_PRI_EOM:
         case T30_PRI_MPS:
             s->core.count_page_on_mcf = TRUE;
             break;
@@ -843,18 +864,27 @@
         /*endswitch*/
         break;
     case T30_EOP:
+    case T30_EOP | 1:
+    case T30_PRI_EOP:
+    case T30_PRI_EOP | 1:
     case T30_EOM:
+    case T30_EOM | 1:
+    case T30_PRI_EOM:
+    case T30_PRI_EOM | 1:
     case T30_EOS:
+    case T30_EOS | 1:
+#if 0
+        /* If we are hitting one of these conditions, it will take another DCS/DTC to select
+           the fast modem again, so abandon our idea of t. */
+        s->core.fast_bit_rate = 0;
+        s->core.fast_rx_modem = T38_NONE;
+        s->core.image_data_mode = FALSE;
+        s->core.short_train = FALSE;
+#endif
+        /* Fall through */
     case T30_MPS:
-    case T30_PRI_EOP:
-    case T30_PRI_EOM:
+    case T30_MPS | 1:
     case T30_PRI_MPS:
-    case T30_EOP | 1:
-    case T30_EOM | 1:
-    case T30_EOS | 1:
-    case T30_MPS | 1:
-    case T30_PRI_EOP | 1:
-    case T30_PRI_EOM | 1:
     case T30_PRI_MPS | 1:
         s->core.count_page_on_mcf = TRUE;
         break;
@@ -1015,6 +1045,62 @@
 
     s = (t38_gateway_state_t *) user_data;
     xx = &s->t38x;
+    /* There are a couple of special cases of data type that need their own treatment. */
+    switch (data_type)
+    {
+    case T38_DATA_V8:
+        switch (field_type)
+        {
+        case T38_FIELD_CM_MESSAGE:
+            if (len >= 1)
+                span_log(&s->logging, SPAN_LOG_FLOW, "CM profile %d - %s\n", buf[0] - '0', t38_cm_profile_to_str(buf[0]));
+            else
+                span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for CM message - %d\n", len);
+            /*endif*/
+            break;
+        case T38_FIELD_JM_MESSAGE:
+            if (len >= 2)
+                span_log(&s->logging, SPAN_LOG_FLOW, "JM - %s\n", t38_jm_to_str(buf, len));
+            else
+                span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for JM message - %d\n", len);
+            /*endif*/
+            break;
+        case T38_FIELD_CI_MESSAGE:
+            if (len >= 1)
+                span_log(&s->logging, SPAN_LOG_FLOW, "CI 0x%X\n", buf[0]);
+            else
+                span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for CI message - %d\n", len);
+            /*endif*/
+            break;
+        default:
+            break;
+        }
+        /*endswitch*/
+        return 0;
+    case T38_DATA_V34_PRI_RATE:
+        switch (field_type)
+        {
+        case T38_FIELD_V34RATE:
+            if (len >= 3)
+            {
+                xx->t38.v34_rate = t38_v34rate_to_bps(buf, len);
+                span_log(&s->logging, SPAN_LOG_FLOW, "V.34 rate %d bps\n", xx->t38.v34_rate);
+            }   
+            else
+            {
+                span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for V34rate message - %d\n", len);
+            }
+            /*endif*/
+            break;
+        default:
+            break;
+        }
+        /*endswitch*/
+        return 0;
+    default:
+        break;
+    }
+    /*endswitch*/
     switch (field_type)
     {
     case T38_FIELD_HDLC_DATA:
@@ -1352,39 +1438,6 @@
         /*endif*/
         xx->corrupt_current_frame[0] = FALSE;
         break;
-    case T38_FIELD_CM_MESSAGE:
-        if (len >= 1)
-            span_log(&s->logging, SPAN_LOG_FLOW, "CM profile %d - %s\n", buf[0] - '0', t38_cm_profile_to_str(buf[0]));
-        else
-            span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for CM message - %d\n", len);
-        /*endif*/
-        break;
-    case T38_FIELD_JM_MESSAGE:
-        if (len >= 2)
-            span_log(&s->logging, SPAN_LOG_FLOW, "JM - %s\n", t38_jm_to_str(buf, len));
-        else
-            span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for JM message - %d\n", len);
-        /*endif*/
-        break;
-    case T38_FIELD_CI_MESSAGE:
-        if (len >= 1)
-            span_log(&s->logging, SPAN_LOG_FLOW, "CI 0x%X\n", buf[0]);
-        else
-            span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for CI message - %d\n", len);
-        /*endif*/
-        break;
-    case T38_FIELD_V34RATE:
-        if (len >= 3)
-        {
-            xx->t38.v34_rate = t38_v34rate_to_bps(buf, len);
-            span_log(&s->logging, SPAN_LOG_FLOW, "V.34 rate %d bps\n", xx->t38.v34_rate);
-        }
-        else
-        {
-            span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for V34rate message - %d\n", len);
-        }
-        /*endif*/
-        break;
     default:
         break;
     }
@@ -1944,14 +1997,14 @@
         s->core.to_t38.in_bits = 0;
         s->core.to_t38.out_octets = 0;
     }
-    span_log(&s->logging, SPAN_LOG_FLOW, "Restart rx modem - modem = %d, short train = %d, ECM = %d\n", s->core.fast_modem, s->core.short_train, s->core.ecm_mode);
+    span_log(&s->logging, SPAN_LOG_FLOW, "Restart rx modem - modem = %d, short train = %d, ECM = %d\n", s->core.fast_rx_modem, s->core.short_train, s->core.ecm_mode);
 
     hdlc_rx_init(&(s->audio.modems.hdlc_rx), FALSE, TRUE, HDLC_FRAMING_OK_THRESHOLD, NULL, s);
     s->audio.modems.rx_signal_present = FALSE;
     s->audio.modems.rx_trained = FALSE;
     /* Default to the transmit data being V.21, unless a faster modem pops up trained. */
     s->t38x.current_tx_data_type = T38_DATA_V21;
-    fsk_rx_init(&(s->audio.modems.v21_rx), &preset_fsk_specs[FSK_V21CH2], TRUE, (put_bit_func_t) t38_hdlc_rx_put_bit, &(s->audio.modems.hdlc_rx));
+    fsk_rx_init(&(s->audio.modems.v21_rx), &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) t38_hdlc_rx_put_bit, &(s->audio.modems.hdlc_rx));
 #if 0
     fsk_rx_signal_cutoff(&(s->audio.modems.v21_rx), -45.5f);
 #endif
@@ -1971,7 +2024,7 @@
     /*endif*/
     to_t38_buffer_init(&s->core.to_t38);
     s->core.to_t38.octets_per_data_packet = 1;
-    switch (s->core.fast_modem)
+    switch (s->core.fast_rx_modem)
     {
     case T38_V17_RX:
         v17_rx_restart(&s->audio.modems.v17_rx, s->core.fast_bit_rate, s->core.short_train);
@@ -2245,7 +2298,7 @@
     t38_gateway_set_nsx_suppression(s, (const uint8_t *) "\x00\x00\x00", 3, (const uint8_t *) "\x00\x00\x00", 3);
 
     s->core.to_t38.octets_per_data_packet = 1;
-    s->core.ecm_allowed = FALSE;
+    s->core.ecm_allowed = TRUE;
     t38_non_ecm_buffer_init(&s->core.non_ecm_to_modem, FALSE, 0);
     restart_rx_modem(s);
     s->core.timed_mode = TIMED_MODE_STARTUP;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t38_non_ecm_buffer.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t38_non_ecm_buffer.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t38_non_ecm_buffer.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -23,7 +23,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_non_ecm_buffer.c,v 1.9 2009/10/05 16:33:25 steveu Exp $
+ * $Id: t38_non_ecm_buffer.c,v 1.9.4.1 2009/12/19 06:43:28 steveu Exp $
  */
 
 /*! \file */
@@ -57,13 +57,22 @@
 
 #include "spandsp/private/t38_non_ecm_buffer.h"
 
+/* Phases */
+enum
+{
+    TCF_AT_INITIAL_ALL_ONES = 0,
+    TCF_AT_ALL_ZEROS = 1,
+    IMAGE_WAITING_FOR_FIRST_EOL = 2,
+    IMAGE_IN_PROGRESS = 3
+};
+
 static void restart_buffer(t38_non_ecm_buffer_state_t *s)
 {
     /* This should be called when draining the buffer is complete, which should
        occur before any fresh data can possibly arrive to begin refilling it. */
     s->octet = 0xFF;
     s->flow_control_fill_octet = 0xFF;
-    s->at_initial_all_ones = TRUE;
+    s->input_phase = (s->image_data_mode)  ?  IMAGE_WAITING_FOR_FIRST_EOL  :  TCF_AT_INITIAL_ALL_ONES;
     s->bit_stream = 0xFFFF;
     s->out_ptr = 0;
     s->in_ptr = 0;
@@ -126,61 +135,164 @@
     int upper;
     int lower;
 
+    /* TCF consists of:
+            - zero or more ones, followed by
+            - about 1.5s of zeros
+       There may be a little junk at the end, as the modem shuts down.
+
+       We can stuff with extra ones in the initial period of all ones, and we can stuff with extra
+       zeros once the zeros start. The thing we need to be wary about is the odd zero bit in the
+       midst of the ones, due to a bit error. */
+
+    /* Non-ECM image data consists of:
+            - zero or more ones, followed by
+            - zero or more zeros, followed by
+            - an EOL (end of line), which marks the start of the image, followed by
+            - a succession of data rows, with an EOL at the end of each, followed by
+            - an RTC (return to control)
+       There may be a little junk at the end, as the modem shuts down.
+
+       An EOL 11 zeros followed by a one in a T.4 1D image or 11 zeros followed by a one followed
+       by a one or a zero in a T.4 2D image. An RTC consists of 6 EOLs in succession, with no
+       pixel data between them.
+    
+       We can stuff with ones until we get the first EOL into our buffer, then we can stuff with
+       zeros in front of each EOL at any point up the the RTC. We should not pad between the EOLs
+       which make up the RTC. Most FAX machines don't care about this, but a few will not recognise
+       the RTC if here is padding between the EOLs.
+    
+       We need to buffer whole rows before we output their beginning, so there is no possibility
+       of underflow mid-row. */
+
+    /* FoIP has latency issues, because of the fairly tight timeouts in the T.30 spec. We must
+       ensure our buffering does everything needed to avoid underflows, and to meet the minimum
+       row length requirements imposed by many mechanical FAX machines. We cannot, however,
+       afford to bulk up the data, by sending superfluous bytes. The resulting loop delay could
+       provoke an erroneous timeout of the acknowledgement signal. */
+
     i = 0;
-    if (s->at_initial_all_ones)
+    switch (s->input_phase)
     {
+    case TCF_AT_INITIAL_ALL_ONES:
         /* Dump initial 0xFF bytes. We will add enough of our own to makes things flow
            smoothly. If we don't strip these off, we might end up delaying the start of
-           forwarding by a large amount, as we could end up with a large block of 0xFF
+           forwarding by a substantial amount, as we could end up with a large block of 0xFF
            bytes before the real data begins. This is especially true with PC FAX
-           systems. This test is very simplistic, as a single bit error will throw it
-           off course. */
+           systems. This test is very simplistic, as bit errors could confuse it. */
         for (  ;  i < len;  i++)
         {
             if (buf[i] != 0xFF)
             {
-                s->at_initial_all_ones = FALSE;
+                s->input_phase = TCF_AT_ALL_ZEROS;
+                s->flow_control_fill_octet = 0x00;
                 break;
             }
         }
-    }
-    if (s->image_data_mode)
-    {
-        /* This is image data */
+        /* Fall through */
+    case TCF_AT_ALL_ZEROS:
         for (  ;  i < len;  i++)
         {
-            /* Check for EOLs, because at an EOL we can pause and pump out zeros while
-               waiting for more incoming data. */
+            s->data[s->in_ptr] = buf[i];
+            s->latest_eol_ptr = s->in_ptr;
+            /* TODO: We can't buffer overflow, since we wrap around. However, the tail could
+                     overwrite itself if things fall badly behind. */
+            s->in_ptr = (s->in_ptr + 1) & (T38_NON_ECM_TX_BUF_LEN - 1);
+            s->in_octets++;
+        }
+        break;
+    case IMAGE_WAITING_FOR_FIRST_EOL:
+        /* Dump anything up to the first EOL. Let the output side stuff with 0xFF bytes while waiting
+           for that first EOL. What occurs before the first EOL is expected to be a period of all ones
+           and then a period of all zeros. We really don't care what junk might be there. By definition,
+           the image only starts at the first EOL. */
+        for (  ;  i < len;  i++)
+        {
             if (buf[i])
             {
                 /* There might be an EOL here. Look for at least 11 zeros, followed by a one, split
                    between two octets. Between those two octets we can insert numerous zero octets
                    as a means of flow control. Note that we stuff in blocks of 8 bits, and not at
                    the minimal level. */
-                /* Or'ing with 0x800 here is simply to avoid zero words looking like they have -1
+                /* Or'ing with 0x800 here is to avoid zero words looking like they have -1
                    trailing zeros */
                 upper = bottom_bit(s->bit_stream | 0x800);
                 lower = top_bit(buf[i]);
-                if (upper - lower > 3)
+                if ((upper - lower) > (11 - 8))
                 {
+                    /* This is an EOL - our first row is beginning. */
+                    s->input_phase = IMAGE_IN_PROGRESS;
+                    /* Start a new row */
+                    s->row_bits = lower - 8;
+                    s->latest_eol_ptr = s->in_ptr;
+                    s->flow_control_fill_octet = 0x00;
+
+                    /* If we push out two bytes of zero, and our latest non-zero byte
+                       we should definitely form a proper EOL to begin things, with a
+                       few harmless extra zero bits at the front. */
+                    s->data[s->in_ptr] = 0x00;
+                    s->in_ptr = (s->in_ptr + 1) & (T38_NON_ECM_TX_BUF_LEN - 1);
+                    s->data[s->in_ptr] = 0x00;
+                    s->in_ptr = (s->in_ptr + 1) & (T38_NON_ECM_TX_BUF_LEN - 1);
+                    s->data[s->in_ptr] = buf[i];
+                    s->in_ptr = (s->in_ptr + 1) & (T38_NON_ECM_TX_BUF_LEN - 1);
+                    s->in_octets += 3;
+                    s->bit_stream = (s->bit_stream << 8) | buf[i];
+                    i++;
+                    break;
+                }
+            }
+            s->bit_stream = (s->bit_stream << 8) | buf[i];
+        }
+        if (i >= len)
+            break;
+        /* Fall through */
+    case IMAGE_IN_PROGRESS:
+        /* Now we have seen an EOL, we can stuff with zeros just in front of that EOL, or any
+           subsequent EOL that does not immediately follow a previous EOL (i.e. a candidate RTC).
+           We need to track our way through the image data, allowing the output side to only send
+           up to the last EOL. This prevents the possibility of underflow mid-row, where we cannot
+           safely stuff anything in the bit stream. */
+        for (  ;  i < len;  i++)
+        {
+            if (buf[i])
+            {
+                /* There might be an EOL here. Look for at least 11 zeros, followed by a one, split
+                   between two octets. Between those two octets we can insert numerous zero octets
+                   as a means of flow control. Note that we stuff in blocks of 8 bits, and not at
+                   the minimal level. */
+                /* Or'ing with 0x800 here is to avoid zero words looking like they have -1
+                   trailing zeros */
+                upper = bottom_bit(s->bit_stream | 0x800);
+                lower = top_bit(buf[i]);
+                if ((upper - lower) > (11 - 8))
+                {
+                    /* This is an EOL. */
                     s->row_bits += (8 - lower);
-                    /* If the row is too short, extend it in chunks of a whole byte. */
-                    /* TODO: extend by the precise amount we should, instead of this
-                             rough approach. */
-                    while (s->row_bits < s->min_row_bits)
+                    /* Make sure we don't stretch back to back EOLs, as that could spoil the RTC.
+                       This is a slightly crude check, as we don't know if we are processing a T.4 1D
+                       or T.4 2D image. Accepting 12 or 12 bits apart as meaning back to back is fine,
+                       as no 1D image row could be 1 bit long. */
+                    if (s->row_bits < 12  ||  s->row_bits > 13)
                     {
-                        s->min_row_bits_fill_octets++;
-                        s->data[s->in_ptr] = 0;
-                        s->row_bits += 8;
-                        /* TODO: We can't buffer overflow, since we wrap around. However, the tail could
-                                 overwrite itself if things fall badly behind. */
-                        s->in_ptr = (s->in_ptr + 1) & (T38_NON_ECM_TX_BUF_LEN - 1);
+                        /* If the row is too short, extend it in chunks of a whole byte. */
+                        /* TODO: extend by the precise amount we should, instead of this
+                                 rough approach. */
+                        while (s->row_bits < s->min_bits_per_row)
+                        {
+                            s->min_row_bits_fill_octets++;
+                            s->data[s->in_ptr] = 0;
+                            s->row_bits += 8;
+                            /* TODO: We can't buffer overflow, since we wrap around. However,
+                                     the tail could overwrite itself if things fall badly behind. */
+                            s->in_ptr = (s->in_ptr + 1) & (T38_NON_ECM_TX_BUF_LEN - 1);
+                        }
+                        /* This is now the limit for the output side, before it starts
+                           stuffing. */
+                        s->latest_eol_ptr = s->in_ptr;
                     }
                     /* Start a new row */
                     s->row_bits = lower - 8;
                     s->in_rows++;
-                    s->latest_eol_ptr = s->in_ptr;
-                    s->flow_control_fill_octet = 0x00;
                 }
             }
             s->bit_stream = (s->bit_stream << 8) | buf[i];
@@ -191,27 +303,8 @@
             s->in_ptr = (s->in_ptr + 1) & (T38_NON_ECM_TX_BUF_LEN - 1);
             s->in_octets++;
         }
+        break;
     }
-    else
-    {
-        /* This is TCF data */
-        for (  ;  i < len;  i++)
-        {
-            /* Check for zero bytes, as we can pause and pump out zeros while waiting
-               for more incoming data. Of course, the entire TCF data should be zero,
-               but it might not be, due to bit errors, or something weird happening. */
-            if (buf[i] == 0x00)
-            {
-                s->latest_eol_ptr = s->in_ptr;
-                s->flow_control_fill_octet = 0x00;
-            }
-            s->data[s->in_ptr] = buf[i];
-            /* TODO: We can't buffer overflow, since we wrap around. However, the tail could
-                     overwrite itself if things fall badly behind. */
-            s->in_ptr = (s->in_ptr + 1) & (T38_NON_ECM_TX_BUF_LEN - 1);
-            s->in_octets++;
-        }
-    }
 }
 /*- End of function --------------------------------------------------------*/
 
@@ -249,14 +342,14 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-SPAN_DECLARE(void) t38_non_ecm_buffer_set_mode(t38_non_ecm_buffer_state_t *s, int mode, int min_row_bits)
+SPAN_DECLARE(void) t38_non_ecm_buffer_set_mode(t38_non_ecm_buffer_state_t *s, int mode, int min_bits_per_row)
 {
     s->image_data_mode = mode;
-    s->min_row_bits = min_row_bits;
+    s->min_bits_per_row = min_bits_per_row;
 }
 /*- End of function --------------------------------------------------------*/
 
-SPAN_DECLARE(t38_non_ecm_buffer_state_t *) t38_non_ecm_buffer_init(t38_non_ecm_buffer_state_t *s, int mode, int min_row_bits)
+SPAN_DECLARE(t38_non_ecm_buffer_state_t *) t38_non_ecm_buffer_init(t38_non_ecm_buffer_state_t *s, int mode, int min_bits_per_row)
 {
     if (s == NULL)
     {
@@ -264,12 +357,9 @@
             return NULL;
     }
     memset(s, 0, sizeof(*s));
-    s->octet = 0xFF;
-    s->flow_control_fill_octet = 0xFF;
-    s->at_initial_all_ones = TRUE;
-    s->bit_stream = 0xFFFF;
     s->image_data_mode = mode;
-    s->min_row_bits = min_row_bits;
+    s->min_bits_per_row = min_bits_per_row;
+    restart_buffer(s);
     return s;
 }
 /*- End of function --------------------------------------------------------*/

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t38_terminal.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t38_terminal.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t38_terminal.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_terminal.c,v 1.128 2009/09/04 14:38:46 steveu Exp $
+ * $Id: t38_terminal.c,v 1.129.4.2 2009/12/19 10:44:10 steveu Exp $
  */
 
 /*! \file */
@@ -63,7 +63,8 @@
 #include "spandsp/v27ter_rx.h"
 #include "spandsp/v17tx.h"
 #include "spandsp/v17rx.h"
-#include "spandsp/t4.h"
+#include "spandsp/t4_rx.h"
+#include "spandsp/t4_tx.h"
 #include "spandsp/t30_fcf.h"
 #include "spandsp/t35.h"
 #include "spandsp/t30.h"
@@ -73,7 +74,8 @@
 #include "spandsp/t38_terminal.h"
 
 #include "spandsp/private/logging.h"
-#include "spandsp/private/t4.h"
+#include "spandsp/private/t4_rx.h"
+#include "spandsp/private/t4_tx.h"
 #include "spandsp/private/t30.h"
 #include "spandsp/private/t38_core.h"
 #include "spandsp/private/t38_terminal.h"
@@ -231,8 +233,6 @@
         front_end_status(s, T30_FRONT_END_CED_PRESENT);
         break;
     case T38_IND_V21_PREAMBLE:
-        /* Some T.38 implementations insert these preamble indicators between HDLC frames, so
-           we need to be tolerant of that. */
         fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT);
         front_end_status(s, T30_FRONT_END_SIGNAL_PRESENT);
         break;
@@ -248,6 +248,8 @@
     case T38_IND_V17_12000_LONG_TRAINING:
     case T38_IND_V17_14400_SHORT_TRAINING:
     case T38_IND_V17_14400_LONG_TRAINING:
+    case T38_IND_V34_CNTL_CHANNEL_1200:
+    case T38_IND_V34_PRI_CHANNEL:
     case T38_IND_V33_12000_TRAINING:
     case T38_IND_V33_14400_TRAINING:
         /* We really don't care what kind of modem is delivering the following image data.
@@ -257,22 +259,30 @@
         break;
     case T38_IND_V8_ANSAM:
     case T38_IND_V8_SIGNAL:
-    case T38_IND_V34_CNTL_CHANNEL_1200:
-    case T38_IND_V34_PRI_CHANNEL:
     case T38_IND_V34_CC_RETRAIN:
         /* V.34 support is a work in progress. */
-        front_end_status(s, T30_FRONT_END_SIGNAL_PRESENT);
         break;
     default:
         front_end_status(s, T30_FRONT_END_SIGNAL_ABSENT);
         break;
     }
+    /*endswitch*/
     fe->hdlc_rx.len = 0;
     fe->rx_data_missing = FALSE;
     return 0;
 }
 /*- End of function --------------------------------------------------------*/
 
+static int fake_rx_indicator(t38_core_state_t *t, t38_terminal_state_t *s, int indicator)
+{
+    int ret;
+
+    ret = process_rx_indicator(t, s, indicator);
+    t->current_rx_indicator = indicator;
+    return ret;
+}
+/*- End of function --------------------------------------------------------*/
+
 static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type, int field_type, const uint8_t *buf, int len)
 {
     t38_terminal_state_t *s;
@@ -285,29 +295,64 @@
 
     s = (t38_terminal_state_t *) user_data;
     fe = &s->t38_fe;
-#if 0
-    /* In termination mode we don't care very much what the data type is. */
+    /* In termination mode we don't care very much what the data type is apart from a couple of
+       special cases. */
     switch (data_type)
     {
-    case T38_DATA_V21:
-    case T38_DATA_V27TER_2400:
-    case T38_DATA_V27TER_4800:
-    case T38_DATA_V29_7200:
-    case T38_DATA_V29_9600:
-    case T38_DATA_V17_7200:
-    case T38_DATA_V17_9600:
-    case T38_DATA_V17_12000:
-    case T38_DATA_V17_14400:
     case T38_DATA_V8:
+        switch (field_type)
+        {
+        case T38_FIELD_CM_MESSAGE:
+            if (len >= 1)
+                span_log(&s->logging, SPAN_LOG_FLOW, "CM profile %d - %s\n", buf[0] - '0', t38_cm_profile_to_str(buf[0]));
+            else
+                span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for CM message - %d\n", len);
+            //front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE);
+            break;
+        case T38_FIELD_JM_MESSAGE:
+            if (len >= 2)
+                span_log(&s->logging, SPAN_LOG_FLOW, "JM - %s\n", t38_jm_to_str(buf, len));
+            else
+                span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for JM message - %d\n", len);
+            //front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE);
+            break;
+        case T38_FIELD_CI_MESSAGE:
+            if (len >= 1)
+                span_log(&s->logging, SPAN_LOG_FLOW, "CI 0x%X\n", buf[0]);
+            else
+                span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for CI message - %d\n", len);
+            //front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE);
+            break;
+        default:
+            break;
+        }
+        /*endswitch*/
+        return 0;
     case T38_DATA_V34_PRI_RATE:
-    case T38_DATA_V34_CC_1200:
-    case T38_DATA_V34_PRI_CH:
-    case T38_DATA_V33_12000:
-    case T38_DATA_V33_14400:
+        switch (field_type)
+        {
+        case T38_FIELD_V34RATE:
+            if (len >= 3)
+            {
+                /* Just get and store the rate. The front end has no real interest in the
+                   actual bit rate. */
+                fe->t38.v34_rate = t38_v34rate_to_bps(buf, len);
+                span_log(&s->logging, SPAN_LOG_FLOW, "V.34 rate %d bps\n", fe->t38.v34_rate);
+            }
+            else
+            {
+                span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for V34rate message - %d\n", len);
+            }
+            break;
+        default:
+            break;
+        }
+        /*endswitch*/
+        return 0;
     default:
         break;
     }
-#endif
+    /*endswitch*/
     switch (field_type)
     {
     case T38_FIELD_HDLC_DATA:
@@ -316,8 +361,7 @@
             /* HDLC can just start without any signal indicator on some platforms, even when
                there is zero packet lost. Nasty, but true. Its a good idea to be tolerant of
                loss, though, so accepting a sudden start of HDLC data is the right thing to do. */
-            fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT);
-            front_end_status(s, T30_FRONT_END_SIGNAL_PRESENT);
+            fake_rx_indicator(t, s, T38_IND_V21_PREAMBLE);
             /* All real HDLC messages in the FAX world start with 0xFF. If this one is not starting
                with 0xFF it would appear some octets must have been missed before this one. */
             if (len <= 0  ||  buf[0] != 0xFF)
@@ -386,7 +430,8 @@
         }
         fe->hdlc_rx.len = 0;
         fe->rx_data_missing = FALSE;
-        fe->timeout_rx_samples = 0;
+        /* Treat this like a no signal indicator has occurred, so if the no signal indicator is missing, we are still OK */
+        fake_rx_indicator(t, s, T38_IND_NO_SIGNAL);
         break;
     case T38_FIELD_HDLC_FCS_BAD_SIG_END:
         if (len > 0)
@@ -406,7 +451,8 @@
         }
         fe->hdlc_rx.len = 0;
         fe->rx_data_missing = FALSE;
-        fe->timeout_rx_samples = 0;
+        /* Treat this like a no signal indicator has occurred, so if the no signal indicator is missing, we are still OK */
+        fake_rx_indicator(t, s, T38_IND_NO_SIGNAL);
         break;
     case T38_FIELD_HDLC_SIG_END:
         if (len > 0)
@@ -428,9 +474,10 @@
                The other is because the HDLC signal drops unexpectedly - i.e. not just after a final frame. */
             fe->hdlc_rx.len = 0;
             fe->rx_data_missing = FALSE;
-            fe->timeout_rx_samples = 0;
             front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE);
         }
+        /* Treat this like a no signal indicator has occurred, so if the no signal indicator is missing, we are still OK */
+        fake_rx_indicator(t, s, T38_IND_NO_SIGNAL);
         break;
     case T38_FIELD_T4_NON_ECM_DATA:
         if (!fe->rx_signal_present)
@@ -468,40 +515,13 @@
             front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE);
         }
         fe->rx_signal_present = FALSE;
-        fe->timeout_rx_samples = 0;
+        /* Treat this like a no signal indicator has occurred, so if the no signal indicator is missing, we are still OK */
+        fake_rx_indicator(t, s, T38_IND_NO_SIGNAL);
         break;
-    case T38_FIELD_CM_MESSAGE:
-        if (len >= 1)
-            span_log(&s->logging, SPAN_LOG_FLOW, "CM profile %d - %s\n", buf[0] - '0', t38_cm_profile_to_str(buf[0]));
-        else
-            span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for CM message - %d\n", len);
-        break;
-    case T38_FIELD_JM_MESSAGE:
-        if (len >= 2)
-            span_log(&s->logging, SPAN_LOG_FLOW, "JM - %s\n", t38_jm_to_str(buf, len));
-        else
-            span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for JM message - %d\n", len);
-        break;
-    case T38_FIELD_CI_MESSAGE:
-        if (len >= 1)
-            span_log(&s->logging, SPAN_LOG_FLOW, "CI 0x%X\n", buf[0]);
-        else
-            span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for CI message - %d\n", len);
-        break;
-    case T38_FIELD_V34RATE:
-        if (len >= 3)
-        {
-            fe->t38.v34_rate = t38_v34rate_to_bps(buf, len);
-            span_log(&s->logging, SPAN_LOG_FLOW, "V.34 rate %d bps\n", fe->t38.v34_rate);
-        }
-        else
-        {
-            span_log(&s->logging, SPAN_LOG_FLOW, "Bad length for V34rate message - %d\n", len);
-        }
-        break;
     default:
         break;
     }
+    /*endswitch*/
     return 0;
 }
 /*- End of function --------------------------------------------------------*/

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t4_rx.c (from rev 16612, freeswitch/trunk/libs/spandsp/src/t4_rx.c) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t4_rx.c	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t4_rx.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,1227 @@
+//#define T4_STATE_DEBUGGING
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * t4_rx.c - ITU T.4 FAX receive processing
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2003, 2007 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: t4_rx.c,v 1.12.2.8 2009/12/21 17:18:39 steveu Exp $
+ */
+
+/*
+ * Much of this file is based on the T.4 and T.6 support in libtiff, which requires
+ * the following notice in any derived source code:
+ *
+ * Copyright (c) 1990-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ *
+ * Decoder support is derived from code in Frank Cringle's viewfax program;
+ *      Copyright (C) 1990, 1995  Frank D. Cringle.
+ */
+
+/*! \file */
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <time.h>
+#include <memory.h>
+#include <string.h>
+#if defined(HAVE_TGMATH_H)
+#include <tgmath.h>
+#endif
+#if defined(HAVE_MATH_H)
+#include <math.h>
+#endif
+#include "floating_fudge.h"
+#include <tiffio.h>
+
+#include "spandsp/telephony.h"
+#include "spandsp/logging.h"
+#include "spandsp/bit_operations.h"
+#include "spandsp/async.h"
+#include "spandsp/t4_rx.h"
+#include "spandsp/t4_tx.h"
+#include "spandsp/version.h"
+
+#include "spandsp/private/logging.h"
+#include "spandsp/private/t4_rx.h"
+#include "spandsp/private/t4_tx.h"
+
+/*! The number of centimetres in one inch */
+#define CM_PER_INCH                 2.54f
+
+/*! The number of EOLs to expect at the end of a T.4 page */
+#define EOLS_TO_END_ANY_RX_PAGE     6
+/*! The number of EOLs to check at the end of a T.4 page */
+#define EOLS_TO_END_T4_RX_PAGE      5
+/*! The number of EOLs to check at the end of a T.6 page */
+#define EOLS_TO_END_T6_RX_PAGE      2
+
+#if defined(T4_STATE_DEBUGGING)
+static void STATE_TRACE(const char *format, ...)
+{
+    va_list arg_ptr;
+
+    va_start(arg_ptr, format);
+    vprintf(format, arg_ptr);
+    va_end(arg_ptr);
+}
+/*- End of function --------------------------------------------------------*/
+#else
+#define STATE_TRACE(...) /**/
+#endif
+
+/*! T.4 run length table entry */
+typedef struct
+{
+    /*! Length of T.4 code, in bits */
+    uint16_t length;
+    /*! T.4 code */
+    uint16_t code;
+    /*! Run length, in bits */
+    int16_t run_length;
+} t4_run_table_entry_t;
+
+#include "t4_t6_decode_states.h"
+
+#if defined(HAVE_LIBTIFF)
+static int set_tiff_directory_info(t4_state_t *s)
+{
+    time_t now;
+    struct tm *tm;
+    char buf[256 + 1];
+    uint16_t resunit;
+    float x_resolution;
+    float y_resolution;
+    t4_tiff_state_t *t;
+
+    t = &s->tiff;
+    /* Prepare the directory entry fully before writing the image, or libtiff complains */
+    TIFFSetField(t->tiff_file, TIFFTAG_COMPRESSION, t->output_compression);
+    if (t->output_compression == COMPRESSION_CCITT_T4)
+    {
+        TIFFSetField(t->tiff_file, TIFFTAG_T4OPTIONS, t->output_t4_options);
+        TIFFSetField(t->tiff_file, TIFFTAG_FAXMODE, FAXMODE_CLASSF);
+    }
+    TIFFSetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, s->image_width);
+    TIFFSetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, 1);
+    TIFFSetField(t->tiff_file, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
+    TIFFSetField(t->tiff_file, TIFFTAG_SAMPLESPERPIXEL, 1);
+    if (t->output_compression == COMPRESSION_CCITT_T4
+        ||
+        t->output_compression == COMPRESSION_CCITT_T6)
+    {
+        TIFFSetField(t->tiff_file, TIFFTAG_ROWSPERSTRIP, -1L);
+    }
+    else
+    {
+        TIFFSetField(t->tiff_file,
+                     TIFFTAG_ROWSPERSTRIP,
+                     TIFFDefaultStripSize(t->tiff_file, 0));
+    }
+    TIFFSetField(t->tiff_file, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+    TIFFSetField(t->tiff_file, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE);
+    TIFFSetField(t->tiff_file, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB);
+
+    x_resolution = s->x_resolution/100.0f;
+    y_resolution = s->y_resolution/100.0f;
+    /* Metric seems the sane thing to use in the 21st century, but a lot of lousy software
+       gets FAX resolutions wrong, and more get it wrong using metric than using inches. */
+#if 0
+    TIFFSetField(t->tiff_file, TIFFTAG_XRESOLUTION, x_resolution);
+    TIFFSetField(t->tiff_file, TIFFTAG_YRESOLUTION, y_resolution);
+    resunit = RESUNIT_CENTIMETER;
+    TIFFSetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, resunit);
+#else
+    TIFFSetField(t->tiff_file, TIFFTAG_XRESOLUTION, floorf(x_resolution*CM_PER_INCH + 0.5f));
+    TIFFSetField(t->tiff_file, TIFFTAG_YRESOLUTION, floorf(y_resolution*CM_PER_INCH + 0.5f));
+    resunit = RESUNIT_INCH;
+    TIFFSetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, resunit);
+#endif
+    /* TODO: add the version of spandsp */
+    TIFFSetField(t->tiff_file, TIFFTAG_SOFTWARE, "Spandsp " SPANDSP_RELEASE_DATETIME_STRING);
+    if (gethostname(buf, sizeof(buf)) == 0)
+        TIFFSetField(t->tiff_file, TIFFTAG_HOSTCOMPUTER, buf);
+
+#if defined(TIFFTAG_FAXDCS)
+    if (t->dcs)
+        TIFFSetField(t->tiff_file, TIFFTAG_FAXDCS, t->dcs);
+#endif
+    if (t->sub_address)
+        TIFFSetField(t->tiff_file, TIFFTAG_FAXSUBADDRESS, t->sub_address);
+    if (t->far_ident)
+        TIFFSetField(t->tiff_file, TIFFTAG_IMAGEDESCRIPTION, t->far_ident);
+    if (t->vendor)
+        TIFFSetField(t->tiff_file, TIFFTAG_MAKE, t->vendor);
+    if (t->model)
+        TIFFSetField(t->tiff_file, TIFFTAG_MODEL, t->model);
+
+    time(&now);
+    tm = localtime(&now);
+    sprintf(buf,
+            "%4d/%02d/%02d %02d:%02d:%02d",
+            tm->tm_year + 1900,
+            tm->tm_mon + 1,
+            tm->tm_mday,
+            tm->tm_hour,
+            tm->tm_min,
+            tm->tm_sec);
+    TIFFSetField(t->tiff_file, TIFFTAG_DATETIME, buf);
+    TIFFSetField(t->tiff_file, TIFFTAG_FAXRECVTIME, now - s->page_start_time);
+
+    TIFFSetField(t->tiff_file, TIFFTAG_IMAGELENGTH, s->image_length);
+    /* Set the total pages to 1. For any one page document we will get this
+       right. For multi-page documents we will need to come back and fill in
+       the right answer when we know it. */
+    TIFFSetField(t->tiff_file, TIFFTAG_PAGENUMBER, s->current_page++, 1);
+    s->tiff.pages_in_file = s->current_page;
+    if (t->output_compression == COMPRESSION_CCITT_T4)
+    {
+        if (s->t4_t6_rx.bad_rows)
+        {
+            TIFFSetField(t->tiff_file, TIFFTAG_BADFAXLINES, s->t4_t6_rx.bad_rows);
+            TIFFSetField(t->tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_REGENERATED);
+            TIFFSetField(t->tiff_file, TIFFTAG_CONSECUTIVEBADFAXLINES, s->t4_t6_rx.longest_bad_row_run);
+        }
+        else
+        {
+            TIFFSetField(t->tiff_file, TIFFTAG_CLEANFAXDATA, CLEANFAXDATA_CLEAN);
+        }
+    }
+    TIFFSetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, s->image_width);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int open_tiff_output_file(t4_state_t *s, const char *file)
+{
+    if ((s->tiff.tiff_file = TIFFOpen(file, "w")) == NULL)
+        return -1;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void write_tiff_image(t4_state_t *s)
+{
+    /* Set up the TIFF directory info... */
+    set_tiff_directory_info(s);
+    /* ..and then write the image... */
+    if (TIFFWriteEncodedStrip(s->tiff.tiff_file, 0, s->image_buffer, s->image_length*s->bytes_per_row) < 0)
+        span_log(&s->logging, SPAN_LOG_WARNING, "%s: Error writing TIFF strip.\n", s->tiff.file);
+    /* ...then the directory entry, and libtiff is happy. */
+    TIFFWriteDirectory(s->tiff.tiff_file);
+}
+/*- End of function --------------------------------------------------------*/
+
+static int close_tiff_output_file(t4_state_t *s)
+{
+    int i;
+    t4_tiff_state_t *t;
+
+    t = &s->tiff;
+    /* Perform any operations needed to tidy up a written TIFF file before
+       closure. */
+    if (s->current_page > 1)
+    {
+        /* We need to edit the TIFF directories. Until now we did not know
+           the total page count, so the TIFF file currently says one. Now we
+           need to set the correct total page count associated with each page. */
+        for (i = 0;  i < s->current_page;  i++)
+        {
+            TIFFSetDirectory(t->tiff_file, (tdir_t) i);
+            TIFFSetField(t->tiff_file, TIFFTAG_PAGENUMBER, i, s->current_page);
+            TIFFWriteDirectory(t->tiff_file);
+        }
+    }
+    TIFFClose(t->tiff_file);
+    t->tiff_file = NULL;
+    if (t->file)
+    {
+        /* Try not to leave a file behind, if we didn't receive any pages to
+           put in it. */
+        if (s->current_page == 0)
+            remove(t->file);
+        free((char *) t->file);
+        t->file = NULL;
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+#else
+
+static int set_tiff_directory_info(t4_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int get_tiff_directory_info(t4_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int test_tiff_directory_info(t4_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int open_tiff_input_file(t4_state_t *s, const char *file)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int read_tiff_image(t4_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int close_tiff_input_file(t4_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int open_tiff_output_file(t4_state_t *s, const char *file)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void write_tiff_image(t4_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int close_tiff_output_file(t4_state_t *s)
+{
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+#endif
+
+static void update_row_bit_info(t4_state_t *s)
+{
+    if (s->row_bits > s->max_row_bits)
+        s->max_row_bits = s->row_bits;
+    if (s->row_bits < s->min_row_bits)
+        s->min_row_bits = s->row_bits;
+    s->row_bits = 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+#if defined(__i386__)  ||  defined(__x86_64__)  ||  defined(__ppc__)  ||   defined(__powerpc__)
+static __inline__ int run_length(unsigned int bits)
+{
+    return 7 - top_bit(bits);
+}
+/*- End of function --------------------------------------------------------*/
+#else
+static __inline__ int run_length(unsigned int bits)
+{
+    static const uint8_t run_len[256] =
+    {
+        8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, /* 0x00 - 0x0F */
+        3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x10 - 0x1F */
+        2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x20 - 0x2F */
+        2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* 0x30 - 0x3F */
+        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x40 - 0x4F */
+        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x50 - 0x5F */
+        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x60 - 0x6F */
+        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x70 - 0x7F */
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 - 0x8F */
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90 - 0x9F */
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 - 0xAF */
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xB0 - 0xBF */
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xC0 - 0xCF */
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xD0 - 0xDF */
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 - 0xEF */
+        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xF0 - 0xFF */
+    };
+
+    return run_len[bits];
+}
+/*- End of function --------------------------------------------------------*/
+#endif
+
+static int free_buffers(t4_state_t *s)
+{
+    if (s->image_buffer)
+    {
+        free(s->image_buffer);
+        s->image_buffer = NULL;
+        s->image_buffer_size = 0;
+    }
+    if (s->cur_runs)
+    {
+        free(s->cur_runs);
+        s->cur_runs = NULL;
+    }
+    if (s->ref_runs)
+    {
+        free(s->ref_runs);
+        s->ref_runs = NULL;
+    }
+    if (s->row_buf)
+    {
+        free(s->row_buf);
+        s->row_buf = NULL;
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static __inline__ void add_run_to_row(t4_state_t *s)
+{
+    if (s->t4_t6_rx.run_length >= 0)
+    {
+        s->row_len += s->t4_t6_rx.run_length;
+        /* Don't allow rows to grow too long, and overflow the buffers */
+        if (s->row_len <= s->image_width)
+            s->cur_runs[s->t4_t6_rx.a_cursor++] = s->t4_t6_rx.run_length;
+    }
+    s->t4_t6_rx.run_length = 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int put_decoded_row(t4_state_t *s)
+{
+    static const int msbmask[9] =
+    {
+        0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff
+    };
+    uint8_t *t;
+    uint32_t i;
+    uint32_t *p;
+    int fudge;
+    int row_starts_at;
+    int x;
+    int j;
+
+    if (s->t4_t6_rx.run_length)
+        add_run_to_row(s);
+#if defined(T4_STATE_DEBUGGING)
+    /* Dump the runs of black and white for analysis */
+    {
+        int total;
+
+        total = 0;
+        for (x = 0;  x < s->t4_t6_rx.b_cursor;  x++)
+            total += s->ref_runs[x];
+        printf("Ref (%d)", total);
+        for (x = 0;  x < s->t4_t6_rx.b_cursor;  x++)
+            printf(" %" PRIu32, s->ref_runs[x]);
+        printf("\n");
+        total = 0;
+        for (x = 0;  x < s->t4_t6_rx.a_cursor;  x++)
+            total += s->cur_runs[x];
+        printf("Cur (%d)", total);
+        for (x = 0;  x < s->t4_t6_rx.a_cursor;  x++)
+            printf(" %" PRIu32, s->cur_runs[x]);
+        printf("\n");
+    }
+#endif
+    row_starts_at = s->image_size;
+    /* Make sure there is enough room for another row */
+    if (s->image_size + s->bytes_per_row >= s->image_buffer_size)
+    {
+        if ((t = realloc(s->image_buffer, s->image_buffer_size + 100*s->bytes_per_row)) == NULL)
+            return -1;
+        s->image_buffer_size += 100*s->bytes_per_row;
+        s->image_buffer = t;
+    }
+    if (s->row_len == s->image_width)
+    {
+        STATE_TRACE("%d Good row - %d %s\n", s->image_length, s->row_len, (s->row_is_2d)  ?  "2D"  :  "1D");
+        if (s->t4_t6_rx.curr_bad_row_run)
+        {
+            if (s->t4_t6_rx.curr_bad_row_run > s->t4_t6_rx.longest_bad_row_run)
+                s->t4_t6_rx.longest_bad_row_run = s->t4_t6_rx.curr_bad_row_run;
+            s->t4_t6_rx.curr_bad_row_run = 0;
+        }
+        /* Convert the runs to a bit image of the row */
+        /* White/black/white... runs, always starting with white. That means the first run could be
+           zero length. */
+        for (x = 0, fudge = 0;  x < s->t4_t6_rx.a_cursor;  x++, fudge ^= 0xFF)
+        {
+            i = s->cur_runs[x];
+            if ((int) i >= s->tx_bits)
+            {
+                s->tx_bitstream = (s->tx_bitstream << s->tx_bits) | (msbmask[s->tx_bits] & fudge);
+                for (i += (8 - s->tx_bits);  i >= 8;  i -= 8)
+                {
+                    s->tx_bits = 8;
+                    s->image_buffer[s->image_size++] = (uint8_t) s->tx_bitstream;
+                    s->tx_bitstream = fudge;
+                }
+            }
+            s->tx_bitstream = (s->tx_bitstream << i) | (msbmask[i] & fudge);
+            s->tx_bits -= i;
+        }
+        s->image_length++;
+    }
+    else
+    {
+        STATE_TRACE("%d Bad row - %d %s\n", s->image_length, s->row_len, (s->row_is_2d)  ?  "2D"  :  "1D");
+        /* Try to clean up the bad runs, and produce something reasonable as the reference
+           row for the next row. Use a copy of the previous good row as the actual current
+           row. If the row only fell apart near the end, reusing it might be the best
+           solution. */
+        for (j = 0, fudge = 0;  j < s->t4_t6_rx.a_cursor  &&  fudge < s->image_width;  j++)
+            fudge += s->cur_runs[j];
+        if (fudge < s->image_width)
+        {
+            /* Try to pad with white, and avoid black, to minimise mess on the image. */
+            if ((s->t4_t6_rx.a_cursor & 1))
+            {
+                /* We currently finish in white. We could extend that, but it is probably of
+                   the right length. Changing it would only further mess up what happens in the
+                   next row. It seems better to add a black spot, and an extra white run. */
+                s->cur_runs[s->t4_t6_rx.a_cursor++] = 1;
+                fudge++;
+                if (fudge < s->image_width)
+                    s->cur_runs[s->t4_t6_rx.a_cursor++] = s->image_width - fudge;
+            }
+            else
+            {
+                /* We currently finish on black, so we add an extra white run to fill out the line. */
+                s->cur_runs[s->t4_t6_rx.a_cursor++] = s->image_width - fudge;
+            }
+        }
+        else
+        {
+            /* Trim the last element to align with the proper image width */
+            s->cur_runs[s->t4_t6_rx.a_cursor] += (s->image_width - fudge);
+        }
+        /* Ensure there is a previous line to copy from. */
+        if (s->image_size != s->t4_t6_rx.last_row_starts_at)
+        {
+            /* Copy the previous row over this one */
+            memcpy(s->image_buffer + s->image_size, s->image_buffer + s->t4_t6_rx.last_row_starts_at, s->bytes_per_row);
+            s->image_size += s->bytes_per_row;
+            s->image_length++;
+        }
+        s->t4_t6_rx.bad_rows++;
+        s->t4_t6_rx.curr_bad_row_run++;
+    }
+
+    /* Pad the row as it becomes the reference row, so there are no odd runs to pick up if we
+       step off the end of the list. */
+    s->cur_runs[s->t4_t6_rx.a_cursor] = 0;
+    s->cur_runs[s->t4_t6_rx.a_cursor + 1] = 0;
+
+    /* Prepare the buffers for the next row. */
+    s->t4_t6_rx.last_row_starts_at = row_starts_at;
+    /* Swap the buffers */
+    p = s->cur_runs;
+    s->cur_runs = s->ref_runs;
+    s->ref_runs = p;
+
+    s->t4_t6_rx.b_cursor = 1;
+    s->t4_t6_rx.a_cursor = 0;
+    s->t4_t6_rx.b1 = s->ref_runs[0];
+    s->t4_t6_rx.a0 = 0;
+    
+    s->t4_t6_rx.run_length = 0;
+
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_rx_end_page(t4_state_t *s)
+{
+    int row;
+    int i;
+
+    if (s->line_encoding == T4_COMPRESSION_ITU_T6)
+    {
+        /* Push enough zeros through the decoder to flush out any remaining codes */
+        for (i = 0;  i < 13;  i++)
+            t4_rx_put_bit(s, 0);
+    }
+    if (s->t4_t6_rx.curr_bad_row_run)
+    {
+        if (s->t4_t6_rx.curr_bad_row_run > s->t4_t6_rx.longest_bad_row_run)
+            s->t4_t6_rx.longest_bad_row_run = s->t4_t6_rx.curr_bad_row_run;
+        s->t4_t6_rx.curr_bad_row_run = 0;
+    }
+
+    if (s->image_size == 0)
+        return -1;
+
+    if (s->t4_t6_rx.row_write_handler)
+    {
+        for (row = 0;  row < s->image_length;  row++)
+        {
+            if (s->t4_t6_rx.row_write_handler(s->t4_t6_rx.row_write_user_data, s->image_buffer + row*s->bytes_per_row, s->bytes_per_row) < 0)
+            {
+                span_log(&s->logging, SPAN_LOG_WARNING, "Write error at row %d.\n", row);
+                break;
+            }
+        }
+        /* Write a blank row to indicate the end of the image. */
+        if (s->t4_t6_rx.row_write_handler(s->t4_t6_rx.row_write_user_data, NULL, 0) < 0)
+            span_log(&s->logging, SPAN_LOG_WARNING, "Write error at row %d.\n", row);
+    }
+    else
+    {
+        write_tiff_image(s);
+    }
+    s->t4_t6_rx.rx_bits = 0;
+    s->t4_t6_rx.rx_skip_bits = 0;
+    s->t4_t6_rx.rx_bitstream = 0;
+    s->t4_t6_rx.consecutive_eols = EOLS_TO_END_ANY_RX_PAGE;
+
+    s->image_size = 0;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static __inline__ void drop_rx_bits(t4_state_t *s, int bits)
+{
+    /* Only remove one bit right now. The rest need to be removed step by step,
+       checking for a misaligned EOL along the way. This is time consuming, but
+       if we don't do it a single bit error can severely damage an image. */
+    s->row_bits += bits;
+    s->t4_t6_rx.rx_skip_bits += (bits - 1);
+    s->t4_t6_rx.rx_bits--;
+    s->t4_t6_rx.rx_bitstream >>= 1;
+}
+/*- End of function --------------------------------------------------------*/
+
+static __inline__ void force_drop_rx_bits(t4_state_t *s, int bits)
+{
+    /* This should only be called to drop the bits of an EOL, as that is the
+       only place where it is safe to drop them all at once. */
+    s->row_bits += bits;
+    s->t4_t6_rx.rx_skip_bits = 0;
+    s->t4_t6_rx.rx_bits -= bits;
+    s->t4_t6_rx.rx_bitstream >>= bits;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int rx_put_bits(t4_state_t *s, uint32_t bit_string, int quantity)
+{
+    int bits;
+
+    /* We decompress bit by bit, as the data stream is received. We need to
+       scan continuously for EOLs, so we might as well work this way. */
+    s->line_image_size += quantity;
+    s->t4_t6_rx.rx_bitstream |= (bit_string << s->t4_t6_rx.rx_bits);
+    /* The longest item we need to scan for is 13 bits long (a 2D EOL), so we
+       need a minimum of 13 bits in the buffer to proceed with any bit stream
+       analysis. */
+    if ((s->t4_t6_rx.rx_bits += quantity) < 13)
+        return FALSE;
+    if (s->t4_t6_rx.consecutive_eols)
+    {
+        /* Check if the image has already terminated. */
+        if (s->t4_t6_rx.consecutive_eols >= EOLS_TO_END_ANY_RX_PAGE)
+            return TRUE;
+        /* Check if the image hasn't even started. */
+        if (s->t4_t6_rx.consecutive_eols < 0)
+        {
+            /* We are waiting for the very first EOL (1D or 2D only). */
+            /* We need to take this bit by bit, as the EOL could be anywhere,
+               and any junk could preceed it. */
+            while ((s->t4_t6_rx.rx_bitstream & 0xFFF) != 0x800)
+            {
+                s->t4_t6_rx.rx_bitstream >>= 1;
+                if (--s->t4_t6_rx.rx_bits < 13)
+                    return FALSE;
+            }
+            /* We have an EOL, so now the page begins and we can proceed to
+               process the bit stream as image data. */
+            s->t4_t6_rx.consecutive_eols = 0;
+            if (s->line_encoding == T4_COMPRESSION_ITU_T4_1D)
+            {
+                s->row_is_2d = FALSE;
+                force_drop_rx_bits(s, 12);
+            }
+            else
+            {
+                s->row_is_2d = !(s->t4_t6_rx.rx_bitstream & 0x1000);
+                force_drop_rx_bits(s, 13);
+            }
+        }
+    }
+
+    while (s->t4_t6_rx.rx_bits >= 13)
+    {
+        /* We need to check for EOLs bit by bit through the whole stream. If
+           we just try looking between code words, we will miss an EOL when a bit
+           error has throw the code words completely out of step. The can mean
+           recovery takes many lines, and the image gets really messed up. */
+        /* Although EOLs are not inserted at the end of each row of a T.6 image,
+           they are still perfectly valid, and can terminate an image. */
+        if ((s->t4_t6_rx.rx_bitstream & 0x0FFF) == 0x0800)
+        {
+            STATE_TRACE("EOL\n");
+            if (s->row_len == 0)
+            {
+                /* A zero length row - i.e. 2 consecutive EOLs - is distinctly
+                   the end of page condition. That's all we actually get on a
+                   T.6 page. However, there are a minimum of 6 EOLs at the end of
+                   any T.4 page. We can look for more than 2 EOLs in case bit
+                   errors simulate the end of page condition at the wrong point.
+                   Such robust checking is irrelevant for a T.6 page, as it should
+                   be error free. */
+                /* Note that for a T.6 page we should get here on the very first
+                   EOL, as the row length should be zero at that point. Therefore
+                   we should count up both EOLs, unless there is some bogus partial
+                   row ahead of them. */
+                s->t4_t6_rx.consecutive_eols++;
+                if (s->line_encoding == T4_COMPRESSION_ITU_T6)
+                {
+                    if (s->t4_t6_rx.consecutive_eols >= EOLS_TO_END_T6_RX_PAGE)
+                    {
+                        s->t4_t6_rx.consecutive_eols = EOLS_TO_END_ANY_RX_PAGE;
+                        return TRUE;
+                    }
+                }
+                else
+                {
+                    if (s->t4_t6_rx.consecutive_eols >= EOLS_TO_END_T4_RX_PAGE)
+                    {
+                        s->t4_t6_rx.consecutive_eols = EOLS_TO_END_ANY_RX_PAGE;
+                        return TRUE;
+                    }
+                }
+            }
+            else
+            {
+                /* The EOLs are not back-to-back, so they are not part of the
+                   end of page condition. */
+                if (s->t4_t6_rx.run_length > 0)
+                    add_run_to_row(s);
+                s->t4_t6_rx.consecutive_eols = 0;
+                if (put_decoded_row(s))
+                    return TRUE;
+                update_row_bit_info(s);
+            }
+            if (s->line_encoding == T4_COMPRESSION_ITU_T4_2D)
+            {
+                s->row_is_2d = !(s->t4_t6_rx.rx_bitstream & 0x1000);
+                force_drop_rx_bits(s, 13);
+            }
+            else
+            {
+                force_drop_rx_bits(s, 12);
+            }
+            s->t4_t6_rx.its_black = FALSE;
+            s->t4_t6_rx.black_white = 0;
+            s->t4_t6_rx.run_length = 0;
+            s->row_len = 0;
+            continue;
+        }
+        if (s->t4_t6_rx.rx_skip_bits)
+        {
+            /* We are clearing out the remaining bits of the last code word we
+               absorbed. */
+            s->t4_t6_rx.rx_skip_bits--;
+            s->t4_t6_rx.rx_bits--;
+            s->t4_t6_rx.rx_bitstream >>= 1;
+            continue;
+        }
+        if (s->row_is_2d  &&  s->t4_t6_rx.black_white == 0)
+        {
+            bits = s->t4_t6_rx.rx_bitstream & 0x7F;
+            STATE_TRACE("State %d, %d - ",
+                        t4_2d_table[bits].state,
+                        t4_2d_table[bits].width);
+            if (s->row_len >= s->image_width)
+            {
+                drop_rx_bits(s, t4_2d_table[bits].width);
+                continue;
+            }
+            if (s->t4_t6_rx.a_cursor)
+            {
+                /* Move past a0, always staying on the current colour */
+                for (  ;  s->t4_t6_rx.b1 <= s->t4_t6_rx.a0;  s->t4_t6_rx.b_cursor += 2)
+                    s->t4_t6_rx.b1 += (s->ref_runs[s->t4_t6_rx.b_cursor] + s->ref_runs[s->t4_t6_rx.b_cursor + 1]);
+            }
+            switch (t4_2d_table[bits].state)
+            {
+            case S_Horiz:
+                STATE_TRACE("Horiz %d %d %d\n",
+                            s->image_width,
+                            s->t4_t6_rx.a0,
+                            s->t4_t6_rx.a_cursor);
+                /* We now need to extract a white/black or black/white pair of runs, using the 1D
+                   method. If the first of the pair takes us exactly to the end of the row, there
+                   should still be a zero length element for the second of the pair. */
+                s->t4_t6_rx.its_black = s->t4_t6_rx.a_cursor & 1;
+                s->t4_t6_rx.black_white = 2;
+                break;
+            case S_Vert:
+                STATE_TRACE("Vert[%d] %d %d %d %d\n",
+                            t4_2d_table[bits].param,
+                            s->image_width,
+                            s->t4_t6_rx.a0,
+                            s->t4_t6_rx.b1,
+                            s->t4_t6_rx.run_length);
+                s->t4_t6_rx.run_length += (s->t4_t6_rx.b1 - s->t4_t6_rx.a0 + t4_2d_table[bits].param);
+                s->t4_t6_rx.a0 = s->t4_t6_rx.b1 + t4_2d_table[bits].param;
+                add_run_to_row(s);
+                /* We need to move one step in one direction or the other, to change to the
+                   opposite colour */
+                if (t4_2d_table[bits].param >= 0)
+                {
+                    s->t4_t6_rx.b1 += s->ref_runs[s->t4_t6_rx.b_cursor++];
+                }
+                else
+                {
+                    if (s->t4_t6_rx.b_cursor)
+                        s->t4_t6_rx.b1 -= s->ref_runs[--s->t4_t6_rx.b_cursor];
+                }
+                break;
+            case S_Pass:
+                STATE_TRACE("Pass %d %d %d %d %d\n",
+                            s->image_width,
+                            s->t4_t6_rx.a0,
+                            s->t4_t6_rx.b1,
+                            s->ref_runs[s->t4_t6_rx.b_cursor],
+                            s->ref_runs[s->t4_t6_rx.b_cursor + 1]);
+                s->t4_t6_rx.b1 += s->ref_runs[s->t4_t6_rx.b_cursor++];
+                s->t4_t6_rx.run_length += (s->t4_t6_rx.b1 - s->t4_t6_rx.a0);
+                s->t4_t6_rx.a0 = s->t4_t6_rx.b1;
+                s->t4_t6_rx.b1 += s->ref_runs[s->t4_t6_rx.b_cursor++];
+                break;
+            case S_Ext:
+                /* We do not currently handle any kind of extension */
+                STATE_TRACE("Ext %d %d %d 0x%x\n",
+                            s->image_width,
+                            s->t4_t6_rx.a0,
+                            ((s->t4_t6_rx.rx_bitstream >> t4_2d_table[bits].width) & 0x7),
+                            s->t4_t6_rx.rx_bitstream);
+                /* TODO: The uncompressed option should be implemented. */
+                break;
+            case S_Null:
+                STATE_TRACE("Null\n");
+                break;
+            default:
+                STATE_TRACE("Unexpected T.4 state\n");
+                span_log(&s->logging, SPAN_LOG_WARNING, "Unexpected T.4 state %d\n", t4_2d_table[bits].state);
+                break;
+            }
+            drop_rx_bits(s, t4_2d_table[bits].width);
+        }
+        else
+        {
+            if (s->t4_t6_rx.its_black)
+            {
+                bits = s->t4_t6_rx.rx_bitstream & 0x1FFF;
+                STATE_TRACE("State %d, %d - Black %d %d %d\n",
+                            t4_1d_black_table[bits].state,
+                            t4_1d_black_table[bits].width,
+                            s->image_width,
+                            s->t4_t6_rx.a0,
+                            t4_1d_black_table[bits].param);
+                switch (t4_1d_black_table[bits].state)
+                {
+                case S_MakeUpB:
+                case S_MakeUp:
+                    s->t4_t6_rx.run_length += t4_1d_black_table[bits].param;
+                    s->t4_t6_rx.a0 += t4_1d_black_table[bits].param;
+                    break;
+                case S_TermB:
+                    s->t4_t6_rx.its_black = FALSE;
+                    if (s->row_len < s->image_width)
+                    {
+                        s->t4_t6_rx.run_length += t4_1d_black_table[bits].param;
+                        s->t4_t6_rx.a0 += t4_1d_black_table[bits].param;
+                        add_run_to_row(s);
+                    }
+                    if (s->t4_t6_rx.black_white)
+                        s->t4_t6_rx.black_white--;
+                    break;
+                default:
+                    /* Bad black */
+                    s->t4_t6_rx.black_white = 0;
+                    break;
+                }
+                drop_rx_bits(s, t4_1d_black_table[bits].width);
+            }
+            else
+            {
+                bits = s->t4_t6_rx.rx_bitstream & 0xFFF;
+                STATE_TRACE("State %d, %d - White %d %d %d\n",
+                            t4_1d_white_table[bits].state,
+                            t4_1d_white_table[bits].width,
+                            s->image_width,
+                            s->t4_t6_rx.a0,
+                            t4_1d_white_table[bits].param);
+                switch (t4_1d_white_table[bits].state)
+                {
+                case S_MakeUpW:
+                case S_MakeUp:
+                    s->t4_t6_rx.run_length += t4_1d_white_table[bits].param;
+                    s->t4_t6_rx.a0 += t4_1d_white_table[bits].param;
+                    break;
+                case S_TermW:
+                    s->t4_t6_rx.its_black = TRUE;
+                    if (s->row_len < s->image_width)
+                    {
+                        s->t4_t6_rx.run_length += t4_1d_white_table[bits].param;
+                        s->t4_t6_rx.a0 += t4_1d_white_table[bits].param;
+                        add_run_to_row(s);
+                    }
+                    if (s->t4_t6_rx.black_white)
+                        s->t4_t6_rx.black_white--;
+                    break;
+                default:
+                    /* Bad white */
+                    s->t4_t6_rx.black_white = 0;
+                    break;
+                }
+                drop_rx_bits(s, t4_1d_white_table[bits].width);
+            }
+        }
+        if (s->t4_t6_rx.a0 >= s->image_width)
+            s->t4_t6_rx.a0 = s->image_width - 1;
+
+        if (s->line_encoding == T4_COMPRESSION_ITU_T6)
+        {
+            /* T.6 has no EOL markers. We sense the end of a line by its length alone. */
+            /* The last test here is a backstop protection, so a corrupt image cannot
+               cause us to do bad things. Bad encoders have actually been seen, which
+               demand such protection. */
+            if (s->t4_t6_rx.black_white == 0  &&  s->row_len >= s->image_width)
+            {
+                STATE_TRACE("EOL T.6\n");
+                if (s->t4_t6_rx.run_length > 0)
+                    add_run_to_row(s);
+                update_row_bit_info(s);
+                if (put_decoded_row(s))
+                    return TRUE;
+                s->t4_t6_rx.its_black = FALSE;
+                s->t4_t6_rx.black_white = 0;
+                s->t4_t6_rx.run_length = 0;
+                s->row_len = 0;
+            }
+        }
+    }
+    return FALSE;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_rx_put_bit(t4_state_t *s, int bit)
+{
+    return rx_put_bits(s, bit & 1, 1);
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_rx_put_byte(t4_state_t *s, uint8_t byte)
+{
+    return rx_put_bits(s, byte & 0xFF, 8);
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_rx_put_chunk(t4_state_t *s, const uint8_t buf[], int len)
+{
+    int i;
+    uint8_t byte;
+
+    for (i = 0;  i < len;  i++)
+    {
+        byte = buf[i];
+        if (rx_put_bits(s, byte & 0xFF, 8))
+            return TRUE;
+    }
+    return FALSE;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_rx_set_row_write_handler(t4_state_t *s, t4_row_write_handler_t handler, void *user_data)
+{
+    s->t4_t6_rx.row_write_handler = handler;
+    s->t4_t6_rx.row_write_user_data = user_data;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(t4_state_t *) t4_rx_init(t4_state_t *s, const char *file, int output_encoding)
+{
+    if (s == NULL)
+    {
+        if ((s = (t4_state_t *) malloc(sizeof(*s))) == NULL)
+            return NULL;
+    }
+    memset(s, 0, sizeof(*s));
+    span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
+    span_log_set_protocol(&s->logging, "T.4");
+    s->rx = TRUE;
+    
+    span_log(&s->logging, SPAN_LOG_FLOW, "Start rx document\n");
+
+    if (open_tiff_output_file(s, file) < 0)
+        return NULL;
+
+    /* Save the file name for logging reports. */
+    s->tiff.file = strdup(file);
+    /* Only provide for one form of coding throughout the file, even though the
+       coding on the wire could change between pages. */
+    switch (output_encoding)
+    {
+    case T4_COMPRESSION_ITU_T4_1D:
+        s->tiff.output_compression = COMPRESSION_CCITT_T4;
+        s->tiff.output_t4_options = GROUP3OPT_FILLBITS;
+        break;
+    case T4_COMPRESSION_ITU_T4_2D:
+        s->tiff.output_compression = COMPRESSION_CCITT_T4;
+        s->tiff.output_t4_options = GROUP3OPT_FILLBITS | GROUP3OPT_2DENCODING;
+        break;
+    case T4_COMPRESSION_ITU_T6:
+        s->tiff.output_compression = COMPRESSION_CCITT_T6;
+        s->tiff.output_t4_options = 0;
+        break;
+    }
+
+    /* Until we have a valid figure for the bytes per row, we need it to be set to a suitable
+       value to ensure it will be seen as changing when the real value is used. */
+    s->bytes_per_row = 0;
+
+    s->current_page = 0;
+    s->tiff.pages_in_file = 0;
+    s->tiff.start_page = 0;
+    s->tiff.stop_page = INT_MAX;
+
+    s->image_buffer = NULL;
+    s->image_buffer_size = 0;
+
+    /* Set some default values */
+    s->x_resolution = T4_X_RESOLUTION_R8;
+    s->y_resolution = T4_Y_RESOLUTION_FINE;
+    s->image_width = T4_WIDTH_R8_A4;
+
+    return s;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_rx_start_page(t4_state_t *s)
+{
+    int bytes_per_row;
+    int run_space;
+    uint32_t *bufptr;
+
+    span_log(&s->logging, SPAN_LOG_FLOW, "Start rx page - compression %d\n", s->line_encoding);
+    if (s->tiff.tiff_file == NULL)
+        return -1;
+
+    /* Calculate the scanline/tile width. */
+    bytes_per_row = (s->image_width + 7)/8;
+    run_space = (s->image_width + 4)*sizeof(uint32_t);
+    if (bytes_per_row != s->bytes_per_row)
+    {
+        /* Allocate the space required for decoding the new row length. */
+        s->bytes_per_row = bytes_per_row;
+        if ((bufptr = (uint32_t *) realloc(s->cur_runs, run_space)) == NULL)
+            return -1;
+        s->cur_runs = bufptr;
+        if ((bufptr = (uint32_t *) realloc(s->ref_runs, run_space)) == NULL)
+            return -1;
+        s->ref_runs = bufptr;
+    }
+    memset(s->cur_runs, 0, run_space);
+    memset(s->ref_runs, 0, run_space);
+
+    s->t4_t6_rx.rx_bits = 0;
+    s->t4_t6_rx.rx_skip_bits = 0;
+    s->t4_t6_rx.rx_bitstream = 0;
+    s->row_bits = 0;
+    s->min_row_bits = INT_MAX;
+    s->max_row_bits = 0;
+
+    s->row_is_2d = (s->line_encoding == T4_COMPRESSION_ITU_T6);
+    /* We start at -1 EOLs for 1D and 2D decoding, as an indication we are waiting for the
+       first EOL. T.6 coding starts without any preamble. */
+    s->t4_t6_rx.consecutive_eols = (s->line_encoding == T4_COMPRESSION_ITU_T6)  ?  0  :  -1;
+
+    s->t4_t6_rx.bad_rows = 0;
+    s->t4_t6_rx.longest_bad_row_run = 0;
+    s->t4_t6_rx.curr_bad_row_run = 0;
+    s->image_length = 0;
+    s->tx_bitstream = 0;
+    s->tx_bits = 8;
+    s->image_size = 0;
+    s->line_image_size = 0;
+    s->t4_t6_rx.last_row_starts_at = 0;
+
+    s->row_len = 0;
+    s->t4_t6_rx.its_black = FALSE;
+    s->t4_t6_rx.black_white = 0;
+
+    /* Initialise the reference line to all white */
+    s->ref_runs[0] =
+    s->ref_runs[1] =
+    s->ref_runs[2] =
+    s->ref_runs[3] = s->image_width;
+
+    s->t4_t6_rx.b_cursor = 1;
+    s->t4_t6_rx.a_cursor = 0;
+    s->t4_t6_rx.b1 = s->ref_runs[0];
+    s->t4_t6_rx.a0 = 0;
+
+    s->t4_t6_rx.run_length = 0;
+
+    time (&s->page_start_time);
+
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_rx_release(t4_state_t *s)
+{
+    if (!s->rx)
+        return -1;
+    if (s->tiff.tiff_file)
+        close_tiff_output_file(s);
+    free_buffers(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_rx_free(t4_state_t *s)
+{
+    int ret;
+
+    ret = t4_rx_release(s);
+    free(s);
+    return ret;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) t4_rx_set_rx_encoding(t4_state_t *s, int encoding)
+{
+    s->line_encoding = encoding;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) t4_rx_set_image_width(t4_state_t *s, int width)
+{
+    s->image_width = width;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) t4_rx_set_y_resolution(t4_state_t *s, int resolution)
+{
+    s->y_resolution = resolution;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) t4_rx_set_x_resolution(t4_state_t *s, int resolution)
+{
+    s->x_resolution = resolution;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) t4_rx_set_dcs(t4_state_t *s, const char *dcs)
+{
+    s->tiff.dcs = (dcs  &&  dcs[0])  ?  dcs  :  NULL;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) t4_rx_set_sub_address(t4_state_t *s, const char *sub_address)
+{
+    s->tiff.sub_address = (sub_address  &&  sub_address[0])  ?  sub_address  :  NULL;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) t4_rx_set_far_ident(t4_state_t *s, const char *ident)
+{
+    s->tiff.far_ident = (ident  &&  ident[0])  ?  ident  :  NULL;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) t4_rx_set_vendor(t4_state_t *s, const char *vendor)
+{
+    s->tiff.vendor = vendor;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) t4_rx_set_model(t4_state_t *s, const char *model)
+{
+    s->tiff.model = model;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) t4_get_transfer_statistics(t4_state_t *s, t4_stats_t *t)
+{
+    t->pages_transferred = s->current_page - s->tiff.start_page;
+    t->pages_in_file = s->tiff.pages_in_file;
+    t->width = s->image_width;
+    t->length = s->image_length;
+    t->bad_rows = s->t4_t6_rx.bad_rows;
+    t->longest_bad_row_run = s->t4_t6_rx.longest_bad_row_run;
+    t->x_resolution = s->x_resolution;
+    t->y_resolution = s->y_resolution;
+    t->encoding = s->line_encoding;
+    t->line_image_size = s->line_image_size/8;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(const char *) t4_encoding_to_str(int encoding)
+{
+    switch (encoding)
+    {
+    case T4_COMPRESSION_ITU_T4_1D:
+        return "T.4 1-D";
+    case T4_COMPRESSION_ITU_T4_2D:
+        return "T.4 2-D";
+    case T4_COMPRESSION_ITU_T6:
+        return "T.6";
+    }
+    return "???";
+}
+/*- End of function --------------------------------------------------------*/
+/*- End of file ------------------------------------------------------------*/

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t4_t6_decode_states.h (from rev 16612, freeswitch/trunk/libs/spandsp/src/t4_t6_decode_states.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t4_t6_decode_states.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t4_t6_decode_states.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,12486 @@
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * t4_t6_decode_states.h - state tables for T.4/T.6 FAX image decoding
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2004 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: t4_t6_decode_states.h,v 1.1.2.4 2009/12/19 10:21:43 steveu Exp $
+ */
+
+/* Legitimate runs of zero bits which are the tail end of one code
+   plus the start of the next code do not exceed 10 bits. */
+
+/* Finite state machine state codes */
+enum
+{
+    S_Null      = 0,
+    S_Pass      = 1,
+    S_Horiz     = 2,
+    S_Vert      = 3,
+    S_Ext       = 4,
+    S_TermW     = 5,
+    S_TermB     = 6,
+    S_MakeUpW   = 7,
+    S_MakeUpB   = 8,
+    S_MakeUp    = 9,
+    S_EOL       = 10
+};
+
+/*! T.4 finite state machine state table entry */
+typedef struct
+{
+    /*! State */
+    uint8_t state;
+    /*! Width of code in bits */
+    uint8_t width;
+    /*! Run length in bits */
+    int16_t param;
+} t4_table_entry_t;
+
+static const t4_table_entry_t t4_2d_table[128] =
+{
+    {S_Null,       1,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,   -1},
+    {S_Vert,       1,    0},
+    {S_Horiz,      3,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,    1},
+    {S_Vert,       1,    0},
+    {S_Pass,       4,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,   -1},
+    {S_Vert,       1,    0},
+    {S_Horiz,      3,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,    1},
+    {S_Vert,       1,    0},
+    {S_Vert,       6,   -2},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,   -1},
+    {S_Vert,       1,    0},
+    {S_Horiz,      3,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,    1},
+    {S_Vert,       1,    0},
+    {S_Pass,       4,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,   -1},
+    {S_Vert,       1,    0},
+    {S_Horiz,      3,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,    1},
+    {S_Vert,       1,    0},
+    {S_Vert,       7,   -3},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,   -1},
+    {S_Vert,       1,    0},
+    {S_Horiz,      3,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,    1},
+    {S_Vert,       1,    0},
+    {S_Pass,       4,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,   -1},
+    {S_Vert,       1,    0},
+    {S_Horiz,      3,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,    1},
+    {S_Vert,       1,    0},
+    {S_Vert,       6,    2},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,   -1},
+    {S_Vert,       1,    0},
+    {S_Horiz,      3,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,    1},
+    {S_Vert,       1,    0},
+    {S_Pass,       4,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,   -1},
+    {S_Vert,       1,    0},
+    {S_Horiz,      3,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,    1},
+    {S_Vert,       1,    0},
+    {S_Ext,        7,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,   -1},
+    {S_Vert,       1,    0},
+    {S_Horiz,      3,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,    1},
+    {S_Vert,       1,    0},
+    {S_Pass,       4,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,   -1},
+    {S_Vert,       1,    0},
+    {S_Horiz,      3,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,    1},
+    {S_Vert,       1,    0},
+    {S_Vert,       6,   -2},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,   -1},
+    {S_Vert,       1,    0},
+    {S_Horiz,      3,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,    1},
+    {S_Vert,       1,    0},
+    {S_Pass,       4,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,   -1},
+    {S_Vert,       1,    0},
+    {S_Horiz,      3,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,    1},
+    {S_Vert,       1,    0},
+    {S_Vert,       7,    3},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,   -1},
+    {S_Vert,       1,    0},
+    {S_Horiz,      3,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,    1},
+    {S_Vert,       1,    0},
+    {S_Pass,       4,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,   -1},
+    {S_Vert,       1,    0},
+    {S_Horiz,      3,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,    1},
+    {S_Vert,       1,    0},
+    {S_Vert,       6,    2},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,   -1},
+    {S_Vert,       1,    0},
+    {S_Horiz,      3,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,    1},
+    {S_Vert,       1,    0},
+    {S_Pass,       4,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,   -1},
+    {S_Vert,       1,    0},
+    {S_Horiz,      3,    0},
+    {S_Vert,       1,    0},
+    {S_Vert,       3,    1},
+    {S_Vert,       1,    0}
+};
+
+static const t4_table_entry_t t4_1d_white_table[4096] =
+{
+    {S_Null,       1,    0},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   39},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    8,  576},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   55},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   45},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   53},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  448},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   35},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   51},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,   63},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1472},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   43},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1216},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   29},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   33},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   49},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   61},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   47},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   59},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   41},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  960},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   31},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   57},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    9,  704},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   37},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  320},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_MakeUp,    11, 1792},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   40},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  832},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   56},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   46},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   54},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  512},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   36},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   52},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,    0},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1600},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   44},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1344},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   30},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   34},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   50},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   62},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   48},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   60},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   42},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1088},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   32},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   58},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  640},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   38},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  384},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_Null,       1,    0},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   39},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    8,  576},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   55},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   45},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   53},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  448},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   35},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   51},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,   63},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1536},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   43},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1280},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   29},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   33},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   49},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   61},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   47},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   59},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   41},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1024},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   31},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   57},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    9,  768},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   37},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  320},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_MakeUp,    11, 1856},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   40},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  896},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   56},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   46},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   54},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  512},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   36},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   52},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,    0},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1728},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   44},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1408},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   30},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   34},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   50},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   62},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   48},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   60},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   42},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1152},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   32},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   58},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  640},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   38},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  384},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_Null,       1,    0},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   39},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    8,  576},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   55},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   45},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   53},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  448},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   35},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   51},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,   63},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1472},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   43},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1216},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   29},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   33},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   49},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   61},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   47},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   59},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   41},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  960},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   31},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   57},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    9,  704},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   37},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  320},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_MakeUp,    12, 2112},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   40},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  832},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   56},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   46},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   54},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  512},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   36},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   52},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,    0},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1600},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   44},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1344},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   30},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   34},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   50},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   62},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   48},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   60},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   42},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1088},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   32},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   58},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  640},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   38},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  384},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_Null,       1,    0},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   39},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    8,  576},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   55},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   45},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   53},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  448},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   35},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   51},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,   63},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1536},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   43},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1280},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   29},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   33},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   49},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   61},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   47},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   59},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   41},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1024},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   31},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   57},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    9,  768},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   37},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  320},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_MakeUp,    12, 2368},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   40},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  896},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   56},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   46},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   54},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  512},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   36},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   52},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,    0},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1728},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   44},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1408},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   30},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   34},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   50},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   62},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   48},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   60},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   42},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1152},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   32},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   58},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  640},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   38},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  384},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_Null,       1,    0},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   39},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    8,  576},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   55},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   45},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   53},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  448},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   35},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   51},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,   63},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1472},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   43},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1216},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   29},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   33},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   49},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   61},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   47},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   59},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   41},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  960},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   31},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   57},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    9,  704},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   37},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  320},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_MakeUp,    12, 1984},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   40},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  832},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   56},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   46},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   54},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  512},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   36},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   52},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,    0},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1600},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   44},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1344},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   30},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   34},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   50},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   62},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   48},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   60},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   42},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1088},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   32},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   58},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  640},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   38},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  384},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_Null,       1,    0},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   39},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    8,  576},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   55},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   45},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   53},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  448},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   35},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   51},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,   63},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1536},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   43},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1280},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   29},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   33},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   49},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   61},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   47},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   59},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   41},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1024},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   31},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   57},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    9,  768},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   37},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  320},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_MakeUp,    11, 1920},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   40},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  896},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   56},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   46},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   54},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  512},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   36},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   52},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,    0},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1728},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   44},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1408},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   30},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   34},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   50},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   62},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   48},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   60},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   42},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1152},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   32},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   58},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  640},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   38},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  384},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_Null,       1,    0},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   39},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    8,  576},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   55},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   45},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   53},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  448},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   35},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   51},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,   63},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1472},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   43},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1216},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   29},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   33},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   49},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   61},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   47},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   59},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   41},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  960},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   31},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   57},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    9,  704},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   37},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  320},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_MakeUp,    12, 2240},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   40},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  832},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   56},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   46},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   54},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  512},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   36},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   52},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,    0},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1600},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   44},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1344},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   30},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   34},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   50},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   62},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   48},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   60},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   42},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1088},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   32},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   58},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  640},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   38},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  384},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_Null,       1,    0},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   39},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    8,  576},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   55},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   45},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   53},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  448},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   35},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   51},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,   63},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1536},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   43},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1280},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   29},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   33},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   49},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   61},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   47},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   59},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   41},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1024},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   31},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   57},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    9,  768},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   37},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  320},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_MakeUp,    12, 2496},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   40},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  896},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   56},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   46},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   54},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  512},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   36},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   52},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,    0},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1728},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   44},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1408},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   30},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   34},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   50},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   62},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   48},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   60},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   42},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1152},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   32},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   58},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  640},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   38},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  384},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_EOL,       12,    0},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   39},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    8,  576},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   55},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   45},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   53},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  448},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   35},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   51},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,   63},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1472},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   43},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1216},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   29},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   33},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   49},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   61},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   47},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   59},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   41},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  960},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   31},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   57},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    9,  704},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   37},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  320},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_MakeUp,    11, 1792},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   40},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  832},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   56},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   46},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   54},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  512},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   36},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   52},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,    0},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1600},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   44},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1344},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   30},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   34},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   50},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   62},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   48},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   60},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   42},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1088},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   32},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   58},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  640},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   38},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  384},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_Null,       1,    0},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   39},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    8,  576},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   55},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   45},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   53},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  448},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   35},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   51},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,   63},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1536},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   43},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1280},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   29},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   33},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   49},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   61},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   47},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   59},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   41},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1024},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   31},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   57},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    9,  768},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   37},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  320},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_MakeUp,    11, 1856},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   40},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  896},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   56},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   46},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   54},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  512},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   36},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   52},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,    0},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1728},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   44},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1408},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   30},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   34},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   50},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   62},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   48},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   60},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   42},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1152},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   32},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   58},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  640},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   38},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  384},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_Null,       1,    0},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   39},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    8,  576},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   55},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   45},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   53},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  448},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   35},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   51},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,   63},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1472},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   43},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1216},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   29},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   33},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   49},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   61},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   47},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   59},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   41},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  960},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   31},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   57},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    9,  704},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   37},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  320},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_MakeUp,    12, 2176},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   40},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  832},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   56},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   46},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   54},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  512},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   36},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   52},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,    0},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1600},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   44},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1344},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   30},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   34},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   50},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   62},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   48},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   60},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   42},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1088},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   32},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   58},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  640},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   38},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  384},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_Null,       1,    0},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   39},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    8,  576},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   55},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   45},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   53},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  448},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   35},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   51},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,   63},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1536},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   43},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1280},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   29},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   33},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   49},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   61},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   47},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   59},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   41},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1024},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   31},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   57},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    9,  768},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   37},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  320},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_MakeUp,    12, 2432},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   40},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  896},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   56},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   46},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   54},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  512},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   36},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   52},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,    0},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1728},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   44},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1408},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   30},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   34},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   50},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   62},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   48},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   60},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   42},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1152},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   32},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   58},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  640},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   38},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  384},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_Null,       1,    0},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   39},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    8,  576},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   55},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   45},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   53},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  448},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   35},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   51},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,   63},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1472},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   43},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1216},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   29},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   33},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   49},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   61},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   47},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   59},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   41},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  960},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   31},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   57},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    9,  704},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   37},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  320},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_MakeUp,    12, 2048},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   40},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  832},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   56},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   46},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   54},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  512},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   36},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   52},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,    0},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1600},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   44},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1344},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   30},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   34},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   50},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   62},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   48},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   60},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   42},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1088},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   32},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   58},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  640},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   38},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  384},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_Null,       1,    0},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   39},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    8,  576},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   55},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   45},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   53},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  448},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   35},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   51},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,   63},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1536},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   43},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1280},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   29},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   33},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   49},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   61},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   47},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   59},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   41},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1024},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   31},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   57},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    9,  768},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   37},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  320},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_MakeUp,    11, 1920},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   40},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  896},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   56},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   46},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   54},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  512},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   36},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   52},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,    0},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1728},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   44},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1408},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   30},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   34},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   50},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   62},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   48},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   60},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   42},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1152},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   32},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   58},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  640},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   38},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  384},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_Null,       1,    0},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   39},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    8,  576},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   55},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   45},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   53},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  448},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   35},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   51},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,   63},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1472},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   43},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1216},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   29},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   33},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   49},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   61},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   47},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   59},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   41},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  960},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   31},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   57},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    9,  704},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   37},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  320},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_MakeUp,    12, 2304},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   40},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  832},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   56},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   46},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   54},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  512},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   36},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   52},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,    0},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1600},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   44},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1344},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   30},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   34},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   50},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   62},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   48},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   60},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   42},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1088},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   32},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   58},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  640},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   38},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  384},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_Null,       1,    0},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   39},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    8,  576},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   55},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   45},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   53},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  448},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   35},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   51},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,   63},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1536},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   43},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1280},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   29},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   33},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   49},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   61},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   47},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   59},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   41},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1024},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   31},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   57},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    9,  768},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   37},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  320},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_MakeUp,    12, 2560},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   20},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   24},
+    {S_TermW,      6,   14},
+    {S_TermW,      7,   28},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   23},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   27},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   40},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9,  896},
+    {S_TermW,      4,    6},
+    {S_TermW,      7,   19},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   56},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   46},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   54},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  512},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   36},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   52},
+    {S_TermW,      6,   15},
+    {S_TermW,      8,    0},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_MakeUpW,    9, 1728},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   44},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    9, 1408},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   30},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      6,   12},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    6, 1664},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   34},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      8,   50},
+    {S_TermW,      6,   14},
+    {S_TermW,      8,   62},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      8,   48},
+    {S_TermW,      4,    3},
+    {S_TermW,      8,   60},
+    {S_TermW,      4,    5},
+    {S_TermW,      8,   42},
+    {S_TermW,      6,   16},
+    {S_MakeUpW,    9, 1152},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   32},
+    {S_TermW,      5,    8},
+    {S_TermW,      8,   58},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      7,   22},
+    {S_TermW,      4,    3},
+    {S_TermW,      5,   11},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   26},
+    {S_TermW,      5,    9},
+    {S_MakeUpW,    8,  640},
+    {S_TermW,      4,    6},
+    {S_TermW,      8,   38},
+    {S_MakeUpW,    5,  128},
+    {S_TermW,      7,   25},
+    {S_TermW,      6,   15},
+    {S_MakeUpW,    8,  384},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7},
+    {S_TermW,      6,   13},
+    {S_TermW,      4,    3},
+    {S_TermW,      7,   18},
+    {S_TermW,      4,    5},
+    {S_TermW,      7,   21},
+    {S_TermW,      6,   17},
+    {S_MakeUpW,    7,  256},
+    {S_TermW,      4,    6},
+    {S_TermW,      6,    1},
+    {S_TermW,      5,    8},
+    {S_MakeUpW,    6,  192},
+    {S_MakeUpW,    5,   64},
+    {S_TermW,      5,   10},
+    {S_TermW,      4,    4},
+    {S_TermW,      4,    2},
+    {S_TermW,      4,    7}
+};
+
+static const t4_table_entry_t t4_1d_black_table[8192] =
+{
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      9,   15},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   18},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   17},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    11, 1792},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   23},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   20},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   25},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   12,  128},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   56},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   30},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    11, 1856},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   57},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   21},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   54},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      9,   15},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   52},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   48},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    12, 2112},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   44},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   36},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   12,  384},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   28},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   60},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   40},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    12, 2368},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   16},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   10,   64},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      9,   15},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   18},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   17},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    12, 1984},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   50},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   34},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   13, 1664},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   26},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   13, 1408},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   32},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    11, 1920},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   61},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   42},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   13, 1024},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      9,   15},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   13,  768},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   62},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    12, 2240},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   46},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   38},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   13,  512},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   19},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   24},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   22},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    12, 2496},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   16},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   10,   64},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_EOL,       12,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      9,   15},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   18},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   17},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    11, 1792},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   23},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   20},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   25},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   12,  192},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   13, 1280},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   31},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    11, 1856},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   58},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   21},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   13,  896},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      9,   15},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   13,  640},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   49},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    12, 2176},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   45},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   37},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   12,  448},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   29},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   13, 1536},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   41},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    12, 2432},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   16},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   10,   64},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      9,   15},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   18},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   17},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    12, 2048},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   51},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   35},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   12,  320},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   27},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   59},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   33},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    11, 1920},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   12,  256},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   43},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   13, 1152},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      9,   15},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   55},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   63},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    12, 2304},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   47},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   39},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   53},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   19},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   24},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   22},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    12, 2560},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   16},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   10,   64},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      9,   15},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   18},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   17},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    11, 1792},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   23},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   20},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   25},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   12,  128},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   56},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   30},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    11, 1856},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   57},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   21},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   54},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      9,   15},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   52},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   48},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    12, 2112},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   44},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   36},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   12,  384},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   28},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   60},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   40},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    12, 2368},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   16},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   10,   64},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      9,   15},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   18},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   17},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    12, 1984},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   50},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   34},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   13, 1728},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   26},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   13, 1472},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   32},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    11, 1920},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   61},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   42},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   13, 1088},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      9,   15},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   13,  832},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   62},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    12, 2240},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   46},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   38},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   13,  576},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   19},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   24},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   22},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    12, 2496},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   16},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   10,   64},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_EOL,       12,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      9,   15},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   18},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   17},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    11, 1792},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   23},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   20},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   25},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   12,  192},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   13, 1344},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   31},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    11, 1856},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   58},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   21},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   13,  960},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      9,   15},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   13,  704},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   49},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    12, 2176},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   45},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   37},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   12,  448},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   29},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   13, 1600},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   41},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    12, 2432},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   16},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   10,   64},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      9,   15},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   18},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   17},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    12, 2048},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   51},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   35},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   12,  320},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   27},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   59},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   33},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    11, 1920},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   12,  256},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   43},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   13, 1216},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      9,   15},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   55},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   63},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    12, 2304},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   47},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   39},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     12,   53},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_Null,       1,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   13},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   19},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   24},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     11,   22},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUp,    12, 2560},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   10},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,   16},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,     10,    0},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_MakeUpB,   10,   64},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    9},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   11},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      8,   14},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      6,    8},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      7,   12},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    6},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2},
+    {S_TermB,      5,    7},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    1},
+    {S_TermB,      2,    2},
+    {S_TermB,      4,    5},
+    {S_TermB,      2,    3},
+    {S_TermB,      3,    4},
+    {S_TermB,      2,    2}
+};
+
+/*- End of file ------------------------------------------------------------*/

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t4_tx.c (from rev 16612, freeswitch/trunk/libs/spandsp/src/t4_tx.c) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t4_tx.c	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/t4_tx.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,1539 @@
+//#define T4_STATE_DEBUGGING
+/*
+ * SpanDSP - a series of DSP components for telephony
+ *
+ * t4_tx.c - ITU T.4 FAX transmit processing
+ *
+ * Written by Steve Underwood <steveu@coppice.org>
+ *
+ * Copyright (C) 2003, 2007 Steve Underwood
+ *
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1,
+ * as published by the Free Software Foundation.
+ *
+ * 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * $Id: t4_tx.c,v 1.13.2.9 2009/12/21 17:18:40 steveu Exp $
+ */
+
+/*
+ * Much of this file is based on the T.4 and T.6 support in libtiff, which requires
+ * the following notice in any derived source code:
+ *
+ * Copyright (c) 1990-1997 Sam Leffler
+ * Copyright (c) 1991-1997 Silicon Graphics, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and 
+ * its documentation for any purpose is hereby granted without fee, provided
+ * that (i) the above copyright notices and this permission notice appear in
+ * all copies of the software and related documentation, and (ii) the names of
+ * Sam Leffler and Silicon Graphics may not be used in any advertising or
+ * publicity relating to the software without the specific, prior written
+ * permission of Sam Leffler and Silicon Graphics.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
+ * 
+ * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+ * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
+ * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
+ * OF THIS SOFTWARE.
+ */
+
+/*! \file */
+
+#if defined(HAVE_CONFIG_H)
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <inttypes.h>
+#include <limits.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <time.h>
+#include <memory.h>
+#include <string.h>
+#if defined(HAVE_TGMATH_H)
+#include <tgmath.h>
+#endif
+#if defined(HAVE_MATH_H)
+#include <math.h>
+#endif
+#include "floating_fudge.h"
+#include <tiffio.h>
+
+#include "spandsp/telephony.h"
+#include "spandsp/logging.h"
+#include "spandsp/bit_operations.h"
+#include "spandsp/async.h"
+#include "spandsp/t4_rx.h"
+#include "spandsp/t4_tx.h"
+#include "spandsp/version.h"
+
+#include "spandsp/private/logging.h"
+#include "spandsp/private/t4_rx.h"
+#include "spandsp/private/t4_tx.h"
+
+/*! The number of centimetres in one inch */
+#define CM_PER_INCH                 2.54f
+
+/*! The number of EOLs to be sent at the end of a T.4 page */
+#define EOLS_TO_END_T4_TX_PAGE      6
+/*! The number of EOLs to be sent at the end of a T.6 page */
+#define EOLS_TO_END_T6_TX_PAGE      2
+
+#if defined(T4_STATE_DEBUGGING)
+static void STATE_TRACE(const char *format, ...)
+{
+    va_list arg_ptr;
+
+    va_start(arg_ptr, format);
+    vprintf(format, arg_ptr);
+    va_end(arg_ptr);
+}
+/*- End of function --------------------------------------------------------*/
+#else
+#define STATE_TRACE(...) /**/
+#endif
+
+/*! T.4 run length table entry */
+typedef struct
+{
+    /*! Length of T.4 code, in bits */
+    uint16_t length;
+    /*! T.4 code */
+    uint16_t code;
+    /*! Run length, in bits */
+    int16_t run_length;
+} t4_run_table_entry_t;
+
+#include "faxfont.h"
+
+/* Legitimate runs of zero bits which are the tail end of one code
+   plus the start of the next code do not exceed 10 bits. */
+
+/*
+ * Note that these tables are ordered such that the index into the table
+ * is known to be either the run length, or (run length / 64) + a fixed
+ * offset.
+ */
+static const t4_run_table_entry_t t4_white_codes[] =
+{
+    { 8, 0x00AC,    0},         /* 0011 0101 */
+    { 6, 0x0038,    1},         /* 0001 11 */
+    { 4, 0x000E,    2},         /* 0111 */
+    { 4, 0x0001,    3},         /* 1000 */
+    { 4, 0x000D,    4},         /* 1011 */
+    { 4, 0x0003,    5},         /* 1100 */
+    { 4, 0x0007,    6},         /* 1110 */
+    { 4, 0x000F,    7},         /* 1111 */
+    { 5, 0x0019,    8},         /* 1001 1 */
+    { 5, 0x0005,    9},         /* 1010 0 */
+    { 5, 0x001C,   10},         /* 0011 1 */
+    { 5, 0x0002,   11},         /* 0100 0 */
+    { 6, 0x0004,   12},         /* 0010 00 */
+    { 6, 0x0030,   13},         /* 0000 11 */
+    { 6, 0x000B,   14},         /* 1101 00 */
+    { 6, 0x002B,   15},         /* 1101 01 */
+    { 6, 0x0015,   16},         /* 1010 10 */
+    { 6, 0x0035,   17},         /* 1010 11 */
+    { 7, 0x0072,   18},         /* 0100 111 */
+    { 7, 0x0018,   19},         /* 0001 100 */
+    { 7, 0x0008,   20},         /* 0001 000 */
+    { 7, 0x0074,   21},         /* 0010 111 */
+    { 7, 0x0060,   22},         /* 0000 011 */
+    { 7, 0x0010,   23},         /* 0000 100 */
+    { 7, 0x000A,   24},         /* 0101 000 */
+    { 7, 0x006A,   25},         /* 0101 011 */
+    { 7, 0x0064,   26},         /* 0010 011 */
+    { 7, 0x0012,   27},         /* 0100 100 */
+    { 7, 0x000C,   28},         /* 0011 000 */
+    { 8, 0x0040,   29},         /* 0000 0010 */
+    { 8, 0x00C0,   30},         /* 0000 0011 */
+    { 8, 0x0058,   31},         /* 0001 1010 */
+    { 8, 0x00D8,   32},         /* 0001 1011 */
+    { 8, 0x0048,   33},         /* 0001 0010 */
+    { 8, 0x00C8,   34},         /* 0001 0011 */
+    { 8, 0x0028,   35},         /* 0001 0100 */
+    { 8, 0x00A8,   36},         /* 0001 0101 */
+    { 8, 0x0068,   37},         /* 0001 0110 */
+    { 8, 0x00E8,   38},         /* 0001 0111 */
+    { 8, 0x0014,   39},         /* 0010 1000 */
+    { 8, 0x0094,   40},         /* 0010 1001 */
+    { 8, 0x0054,   41},         /* 0010 1010 */
+    { 8, 0x00D4,   42},         /* 0010 1011 */
+    { 8, 0x0034,   43},         /* 0010 1100 */
+    { 8, 0x00B4,   44},         /* 0010 1101 */
+    { 8, 0x0020,   45},         /* 0000 0100 */
+    { 8, 0x00A0,   46},         /* 0000 0101 */
+    { 8, 0x0050,   47},         /* 0000 1010 */
+    { 8, 0x00D0,   48},         /* 0000 1011 */
+    { 8, 0x004A,   49},         /* 0101 0010 */
+    { 8, 0x00CA,   50},         /* 0101 0011 */
+    { 8, 0x002A,   51},         /* 0101 0100 */
+    { 8, 0x00AA,   52},         /* 0101 0101 */
+    { 8, 0x0024,   53},         /* 0010 0100 */
+    { 8, 0x00A4,   54},         /* 0010 0101 */
+    { 8, 0x001A,   55},         /* 0101 1000 */
+    { 8, 0x009A,   56},         /* 0101 1001 */
+    { 8, 0x005A,   57},         /* 0101 1010 */
+    { 8, 0x00DA,   58},         /* 0101 1011 */
+    { 8, 0x0052,   59},         /* 0100 1010 */
+    { 8, 0x00D2,   60},         /* 0100 1011 */
+    { 8, 0x004C,   61},         /* 0011 0010 */
+    { 8, 0x00CC,   62},         /* 0011 0011 */
+    { 8, 0x002C,   63},         /* 0011 0100 */
+    { 5, 0x001B,   64},         /* 1101 1 */
+    { 5, 0x0009,  128},         /* 1001 0 */
+    { 6, 0x003A,  192},         /* 0101 11 */
+    { 7, 0x0076,  256},         /* 0110 111 */
+    { 8, 0x006C,  320},         /* 0011 0110 */
+    { 8, 0x00EC,  384},         /* 0011 0111 */
+    { 8, 0x0026,  448},         /* 0110 0100 */
+    { 8, 0x00A6,  512},         /* 0110 0101 */
+    { 8, 0x0016,  576},         /* 0110 1000 */
+    { 8, 0x00E6,  640},         /* 0110 0111 */
+    { 9, 0x0066,  704},         /* 0110 0110 0 */
+    { 9, 0x0166,  768},         /* 0110 0110 1 */
+    { 9, 0x0096,  832},         /* 0110 1001 0 */
+    { 9, 0x0196,  896},         /* 0110 1001 1 */
+    { 9, 0x0056,  960},         /* 0110 1010 0 */
+    { 9, 0x0156, 1024},         /* 0110 1010 1 */
+    { 9, 0x00D6, 1088},         /* 0110 1011 0 */
+    { 9, 0x01D6, 1152},         /* 0110 1011 1 */
+    { 9, 0x0036, 1216},         /* 0110 1100 0 */
+    { 9, 0x0136, 1280},         /* 0110 1100 1 */
+    { 9, 0x00B6, 1344},         /* 0110 1101 0 */
+    { 9, 0x01B6, 1408},         /* 0110 1101 1 */
+    { 9, 0x0032, 1472},         /* 0100 1100 0 */
+    { 9, 0x0132, 1536},         /* 0100 1100 1 */
+    { 9, 0x00B2, 1600},         /* 0100 1101 0 */
+    { 6, 0x0006, 1664},         /* 0110 00 */
+    { 9, 0x01B2, 1728},         /* 0100 1101 1 */
+    {11, 0x0080, 1792},         /* 0000 0001 000 */
+    {11, 0x0180, 1856},         /* 0000 0001 100 */
+    {11, 0x0580, 1920},         /* 0000 0001 101 */
+    {12, 0x0480, 1984},         /* 0000 0001 0010 */
+    {12, 0x0C80, 2048},         /* 0000 0001 0011 */
+    {12, 0x0280, 2112},         /* 0000 0001 0100 */
+    {12, 0x0A80, 2176},         /* 0000 0001 0101 */
+    {12, 0x0680, 2240},         /* 0000 0001 0110 */
+    {12, 0x0E80, 2304},         /* 0000 0001 0111 */
+    {12, 0x0380, 2368},         /* 0000 0001 1100 */
+    {12, 0x0B80, 2432},         /* 0000 0001 1101 */
+    {12, 0x0780, 2496},         /* 0000 0001 1110 */
+    {12, 0x0F80, 2560},         /* 0000 0001 1111 */
+};
+
+static const t4_run_table_entry_t t4_black_codes[] =
+{
+    {10, 0x03B0,    0},         /* 0000 1101 11 */
+    { 3, 0x0002,    1},         /* 010 */
+    { 2, 0x0003,    2},         /* 11 */
+    { 2, 0x0001,    3},         /* 10 */
+    { 3, 0x0006,    4},         /* 011 */
+    { 4, 0x000C,    5},         /* 0011 */
+    { 4, 0x0004,    6},         /* 0010 */
+    { 5, 0x0018,    7},         /* 0001 1 */
+    { 6, 0x0028,    8},         /* 0001 01 */
+    { 6, 0x0008,    9},         /* 0001 00 */
+    { 7, 0x0010,   10},         /* 0000 100 */
+    { 7, 0x0050,   11},         /* 0000 101 */
+    { 7, 0x0070,   12},         /* 0000 111 */
+    { 8, 0x0020,   13},         /* 0000 0100 */
+    { 8, 0x00E0,   14},         /* 0000 0111 */
+    { 9, 0x0030,   15},         /* 0000 1100 0 */
+    {10, 0x03A0,   16},         /* 0000 0101 11 */
+    {10, 0x0060,   17},         /* 0000 0110 00 */
+    {10, 0x0040,   18},         /* 0000 0010 00 */
+    {11, 0x0730,   19},         /* 0000 1100 111 */
+    {11, 0x00B0,   20},         /* 0000 1101 000 */
+    {11, 0x01B0,   21},         /* 0000 1101 100 */
+    {11, 0x0760,   22},         /* 0000 0110 111 */
+    {11, 0x00A0,   23},         /* 0000 0101 000 */
+    {11, 0x0740,   24},         /* 0000 0010 111 */
+    {11, 0x00C0,   25},         /* 0000 0011 000 */
+    {12, 0x0530,   26},         /* 0000 1100 1010 */
+    {12, 0x0D30,   27},         /* 0000 1100 1011 */
+    {12, 0x0330,   28},         /* 0000 1100 1100 */
+    {12, 0x0B30,   29},         /* 0000 1100 1101 */
+    {12, 0x0160,   30},         /* 0000 0110 1000 */
+    {12, 0x0960,   31},         /* 0000 0110 1001 */
+    {12, 0x0560,   32},         /* 0000 0110 1010 */
+    {12, 0x0D60,   33},         /* 0000 0110 1011 */
+    {12, 0x04B0,   34},         /* 0000 1101 0010 */
+    {12, 0x0CB0,   35},         /* 0000 1101 0011 */
+    {12, 0x02B0,   36},         /* 0000 1101 0100 */
+    {12, 0x0AB0,   37},         /* 0000 1101 0101 */
+    {12, 0x06B0,   38},         /* 0000 1101 0110 */
+    {12, 0x0EB0,   39},         /* 0000 1101 0111 */
+    {12, 0x0360,   40},         /* 0000 0110 1100 */
+    {12, 0x0B60,   41},         /* 0000 0110 1101 */
+    {12, 0x05B0,   42},         /* 0000 1101 1010 */
+    {12, 0x0DB0,   43},         /* 0000 1101 1011 */
+    {12, 0x02A0,   44},         /* 0000 0101 0100 */
+    {12, 0x0AA0,   45},         /* 0000 0101 0101 */
+    {12, 0x06A0,   46},         /* 0000 0101 0110 */
+    {12, 0x0EA0,   47},         /* 0000 0101 0111 */
+    {12, 0x0260,   48},         /* 0000 0110 0100 */
+    {12, 0x0A60,   49},         /* 0000 0110 0101 */
+    {12, 0x04A0,   50},         /* 0000 0101 0010 */
+    {12, 0x0CA0,   51},         /* 0000 0101 0011 */
+    {12, 0x0240,   52},         /* 0000 0010 0100 */
+    {12, 0x0EC0,   53},         /* 0000 0011 0111 */
+    {12, 0x01C0,   54},         /* 0000 0011 1000 */
+    {12, 0x0E40,   55},         /* 0000 0010 0111 */
+    {12, 0x0140,   56},         /* 0000 0010 1000 */
+    {12, 0x01A0,   57},         /* 0000 0101 1000 */
+    {12, 0x09A0,   58},         /* 0000 0101 1001 */
+    {12, 0x0D40,   59},         /* 0000 0010 1011 */
+    {12, 0x0340,   60},         /* 0000 0010 1100 */
+    {12, 0x05A0,   61},         /* 0000 0101 1010 */
+    {12, 0x0660,   62},         /* 0000 0110 0110 */
+    {12, 0x0E60,   63},         /* 0000 0110 0111 */
+    {10, 0x03C0,   64},         /* 0000 0011 11 */
+    {12, 0x0130,  128},         /* 0000 1100 1000 */
+    {12, 0x0930,  192},         /* 0000 1100 1001 */
+    {12, 0x0DA0,  256},         /* 0000 0101 1011 */
+    {12, 0x0CC0,  320},         /* 0000 0011 0011 */
+    {12, 0x02C0,  384},         /* 0000 0011 0100 */
+    {12, 0x0AC0,  448},         /* 0000 0011 0101 */
+    {13, 0x06C0,  512},         /* 0000 0011 0110 0 */
+    {13, 0x16C0,  576},         /* 0000 0011 0110 1 */
+    {13, 0x0A40,  640},         /* 0000 0010 0101 0 */
+    {13, 0x1A40,  704},         /* 0000 0010 0101 1 */
+    {13, 0x0640,  768},         /* 0000 0010 0110 0 */
+    {13, 0x1640,  832},         /* 0000 0010 0110 1 */
+    {13, 0x09C0,  896},         /* 0000 0011 1001 0 */
+    {13, 0x19C0,  960},         /* 0000 0011 1001 1 */
+    {13, 0x05C0, 1024},         /* 0000 0011 1010 0 */
+    {13, 0x15C0, 1088},         /* 0000 0011 1010 1 */
+    {13, 0x0DC0, 1152},         /* 0000 0011 1011 0 */
+    {13, 0x1DC0, 1216},         /* 0000 0011 1011 1 */
+    {13, 0x0940, 1280},         /* 0000 0010 1001 0 */
+    {13, 0x1940, 1344},         /* 0000 0010 1001 1 */
+    {13, 0x0540, 1408},         /* 0000 0010 1010 0 */
+    {13, 0x1540, 1472},         /* 0000 0010 1010 1 */
+    {13, 0x0B40, 1536},         /* 0000 0010 1101 0 */
+    {13, 0x1B40, 1600},         /* 0000 0010 1101 1 */
+    {13, 0x04C0, 1664},         /* 0000 0011 0010 0 */
+    {13, 0x14C0, 1728},         /* 0000 0011 0010 1 */
+    {11, 0x0080, 1792},         /* 0000 0001 000 */
+    {11, 0x0180, 1856},         /* 0000 0001 100 */
+    {11, 0x0580, 1920},         /* 0000 0001 101 */
+    {12, 0x0480, 1984},         /* 0000 0001 0010 */
+    {12, 0x0C80, 2048},         /* 0000 0001 0011 */
+    {12, 0x0280, 2112},         /* 0000 0001 0100 */
+    {12, 0x0A80, 2176},         /* 0000 0001 0101 */
+    {12, 0x0680, 2240},         /* 0000 0001 0110 */
+    {12, 0x0E80, 2304},         /* 0000 0001 0111 */
+    {12, 0x0380, 2368},         /* 0000 0001 1100 */
+    {12, 0x0B80, 2432},         /* 0000 0001 1101 */
+    {12, 0x0780, 2496},         /* 0000 0001 1110 */
+    {12, 0x0F80, 2560},         /* 0000 0001 1111 */
+};
+
+static int encode_row(t4_state_t *s);
+
+static void make_header(t4_state_t *s, char *header)
+{
+    time_t now;
+    struct tm tm;
+    static const char *months[] =
+    {
+        "Jan",
+        "Feb",
+        "Mar",
+        "Apr",
+        "May",
+        "Jun",
+        "Jul",
+        "Aug",
+        "Sep",
+        "Oct",
+        "Nov",
+        "Dec"
+    };
+
+    time(&now);
+    tm = *localtime(&now);
+    snprintf(header,
+             132,
+             "  %2d-%s-%d  %02d:%02d    %-50s %-21s   p.%d",
+             tm.tm_mday,
+             months[tm.tm_mon],
+             tm.tm_year + 1900,
+             tm.tm_hour,
+             tm.tm_min,
+             s->t4_t6_tx.header_info,
+             s->tiff.local_ident,
+             s->current_page + 1);
+}
+/*- End of function --------------------------------------------------------*/
+
+static int t4_tx_put_fax_header(t4_state_t *s)
+{
+    int row;
+    int i;
+    int repeats;
+    int pattern;
+    int row_bufptr;
+    char *t;
+    char header[132 + 1];
+
+    /* Modify the resulting image to include a header line, typical of hardware FAX machines */
+    make_header(s, header);
+    switch (s->y_resolution)
+    {
+    case T4_Y_RESOLUTION_1200:
+        repeats = 12;
+        break;
+    case T4_Y_RESOLUTION_800:
+        repeats = 8;
+        break;
+    case T4_Y_RESOLUTION_600:
+        repeats = 6;
+        break;
+    case T4_Y_RESOLUTION_SUPERFINE:
+        repeats = 4;
+        break;
+    case T4_Y_RESOLUTION_300:
+        repeats = 3;
+        break;
+    case T4_Y_RESOLUTION_FINE:
+        repeats = 2;
+        break;
+    default:
+        repeats = 1;
+        break;
+    }
+    for (row = 0;  row < 16;  row++)
+    {
+        t = header;
+        row_bufptr = 0;
+        for (t = header;  *t  &&  row_bufptr <= s->bytes_per_row - 2;  t++)
+        {
+            pattern = header_font[(uint8_t) *t][row];
+            s->row_buf[row_bufptr++] = (uint8_t) (pattern >> 8);
+            s->row_buf[row_bufptr++] = (uint8_t) (pattern & 0xFF);
+        }
+        for (  ;  row_bufptr < s->bytes_per_row;  )
+            s->row_buf[row_bufptr++] = 0;
+        for (i = 0;  i < repeats;  i++)
+        {
+            if (encode_row(s))
+                return -1;
+        }
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int test_resolution(int res_unit, float actual, float expected)
+{
+    if (res_unit == RESUNIT_INCH)
+        actual *= 1.0f/CM_PER_INCH;
+    return (expected*0.95f <= actual  &&  actual <= expected*1.05f);
+}
+/*- End of function --------------------------------------------------------*/
+
+static int get_tiff_directory_info(t4_state_t *s)
+{
+    static const struct
+    {
+        float resolution;
+        int code;
+    } x_res_table[] =
+    {
+        { 102.0f/CM_PER_INCH, T4_X_RESOLUTION_R4},
+        { 204.0f/CM_PER_INCH, T4_X_RESOLUTION_R8},
+        { 300.0f/CM_PER_INCH, T4_X_RESOLUTION_300},
+        { 408.0f/CM_PER_INCH, T4_X_RESOLUTION_R16},
+        { 600.0f/CM_PER_INCH, T4_X_RESOLUTION_600},
+        { 800.0f/CM_PER_INCH, T4_X_RESOLUTION_800},
+        {1200.0f/CM_PER_INCH, T4_X_RESOLUTION_1200},
+        {             -1.00f, -1}
+    };
+    static const struct
+    {
+        float resolution;
+        int code;
+        int max_rows_to_next_1d_row;
+    } y_res_table[] =
+    {
+        {             38.50f, T4_Y_RESOLUTION_STANDARD, 2},
+        {             77.00f, T4_Y_RESOLUTION_FINE, 4},
+        { 300.0f/CM_PER_INCH, T4_Y_RESOLUTION_300, 6},
+        {            154.00f, T4_Y_RESOLUTION_SUPERFINE, 8},
+        { 600.0f/CM_PER_INCH, T4_Y_RESOLUTION_600, 12},
+        { 800.0f/CM_PER_INCH, T4_Y_RESOLUTION_800, 16},
+        {1200.0f/CM_PER_INCH, T4_Y_RESOLUTION_1200, 24},
+        {             -1.00f, -1, -1}
+    };
+    uint16_t res_unit;
+    uint16_t parm16;
+    uint32_t parm32;
+    float x_resolution;
+    float y_resolution;
+    int i;
+    t4_tiff_state_t *t;
+
+    t = &s->tiff;
+    parm16 = 0;
+    TIFFGetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, &parm16);
+    if (parm16 != 1)
+        return -1;
+    TIFFGetField(t->tiff_file, TIFFTAG_SAMPLESPERPIXEL, &parm16);
+    if (parm16 != 1)
+        return -1;
+    parm32 = 0;
+    TIFFGetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, &parm32);
+    s->image_width = parm32;
+    s->bytes_per_row = (s->image_width + 7)/8;
+    parm32 = 0;
+    TIFFGetField(t->tiff_file, TIFFTAG_IMAGELENGTH, &parm32);
+    s->image_length = parm32;
+    x_resolution = 0.0f;
+    TIFFGetField(t->tiff_file, TIFFTAG_XRESOLUTION, &x_resolution);
+    y_resolution = 0.0f;
+    TIFFGetField(t->tiff_file, TIFFTAG_YRESOLUTION, &y_resolution);
+    res_unit = RESUNIT_INCH;
+    TIFFGetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, &res_unit);
+    t->photo_metric = PHOTOMETRIC_MINISWHITE;
+    TIFFGetField(t->tiff_file, TIFFTAG_PHOTOMETRIC, &t->photo_metric);
+    if (t->photo_metric != PHOTOMETRIC_MINISWHITE)
+        span_log(&s->logging, SPAN_LOG_FLOW, "%s: Photometric needs swapping.\n", t->file);
+    t->fill_order = FILLORDER_LSB2MSB;
+#if 0
+    TIFFGetField(t->tiff_file, TIFFTAG_FILLORDER, &t->fill_order);
+    if (t->fill_order != FILLORDER_LSB2MSB)
+        span_log(&s->logging, SPAN_LOG_FLOW, "%s: Fill order needs swapping.\n", t->file);
+#endif
+
+    /* Allow a little range for the X resolution in centimeters. The spec doesn't pin down the
+       precise value. The other value should be exact. */
+    /* Treat everything we can't match as R8. Most FAXes are this resolution anyway. */
+    s->x_resolution = T4_X_RESOLUTION_R8;
+    for (i = 0;  x_res_table[i].code > 0;  i++)
+    {
+        if (test_resolution(res_unit, x_resolution, x_res_table[i].resolution))
+        {
+            s->x_resolution = x_res_table[i].code;
+            break;
+        }
+    }
+
+    s->y_resolution = T4_Y_RESOLUTION_STANDARD;
+    s->t4_t6_tx.max_rows_to_next_1d_row = 2;
+    for (i = 0;  y_res_table[i].code > 0;  i++)
+    {
+        if (test_resolution(res_unit, y_resolution, y_res_table[i].resolution))
+        {
+            s->y_resolution = y_res_table[i].code;
+            s->t4_t6_tx.max_rows_to_next_1d_row = y_res_table[i].max_rows_to_next_1d_row;
+            break;
+        }
+    }
+
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int test_tiff_directory_info(t4_state_t *s)
+{
+    static const struct
+    {
+        float resolution;
+        int code;
+    } x_res_table[] =
+    {
+        { 102.0f/CM_PER_INCH, T4_X_RESOLUTION_R4},
+        { 204.0f/CM_PER_INCH, T4_X_RESOLUTION_R8},
+        { 300.0f/CM_PER_INCH, T4_X_RESOLUTION_300},
+        { 408.0f/CM_PER_INCH, T4_X_RESOLUTION_R16},
+        { 600.0f/CM_PER_INCH, T4_X_RESOLUTION_600},
+        { 800.0f/CM_PER_INCH, T4_X_RESOLUTION_800},
+        {1200.0f/CM_PER_INCH, T4_X_RESOLUTION_1200},
+        {             -1.00f, -1}
+    };
+    static const struct
+    {
+        float resolution;
+        int code;
+        int max_rows_to_next_1d_row;
+    } y_res_table[] =
+    {
+        {             38.50f, T4_Y_RESOLUTION_STANDARD, 2},
+        {             77.00f, T4_Y_RESOLUTION_FINE, 4},
+        { 300.0f/CM_PER_INCH, T4_Y_RESOLUTION_300, 6},
+        {            154.00f, T4_Y_RESOLUTION_SUPERFINE, 8},
+        { 600.0f/CM_PER_INCH, T4_Y_RESOLUTION_600, 12},
+        { 800.0f/CM_PER_INCH, T4_Y_RESOLUTION_800, 16},
+        {1200.0f/CM_PER_INCH, T4_Y_RESOLUTION_1200, 24},
+        {             -1.00f, -1, -1}
+    };
+    uint16_t res_unit;
+    uint16_t parm16;
+    uint32_t parm32;
+    float x_resolution;
+    float y_resolution;
+    int i;
+    t4_tiff_state_t *t;
+
+    t = &s->tiff;
+    parm16 = 0;
+    TIFFGetField(t->tiff_file, TIFFTAG_BITSPERSAMPLE, &parm16);
+    if (parm16 != 1)
+        return -1;
+    parm32 = 0;
+    TIFFGetField(t->tiff_file, TIFFTAG_IMAGEWIDTH, &parm32);
+    if (s->image_width != (int) parm32)
+        return 1;
+    x_resolution = 0.0f;
+    TIFFGetField(t->tiff_file, TIFFTAG_XRESOLUTION, &x_resolution);
+    y_resolution = 0.0f;
+    TIFFGetField(t->tiff_file, TIFFTAG_YRESOLUTION, &y_resolution);
+    res_unit = RESUNIT_INCH;
+    TIFFGetField(t->tiff_file, TIFFTAG_RESOLUTIONUNIT, &res_unit);
+
+    /* Allow a little range for the X resolution in centimeters. The spec doesn't pin down the
+       precise value. The other value should be exact. */
+    /* Treat everything we can't match as R8. Most FAXes are this resolution anyway. */
+    for (i = 0;  x_res_table[i].code > 0;  i++)
+    {
+        if (test_resolution(res_unit, x_resolution, x_res_table[i].resolution))
+            break;
+    }
+    if (s->x_resolution != x_res_table[i].code)
+        return 1;
+    for (i = 0;  y_res_table[i].code > 0;  i++)
+    {
+        if (test_resolution(res_unit, y_resolution, y_res_table[i].resolution))
+            break;
+    }
+    if (s->y_resolution != y_res_table[i].code)
+        return 1;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int get_tiff_total_pages(t4_state_t *s)
+{
+    int max;
+
+    /* Each page *should* contain the total number of pages, but can this be
+       trusted? Some files say 0. Actually searching for the last page is
+       more reliable. */
+    max = 0;
+    while (TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) max))
+        max++;
+    /* Back to the previous page */
+    if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page))
+        return -1;
+    return max;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int open_tiff_input_file(t4_state_t *s, const char *file)
+{
+    if ((s->tiff.tiff_file = TIFFOpen(file, "r")) == NULL)
+        return -1;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int read_tiff_image(t4_state_t *s)
+{
+    int row;
+    int image_length;
+    int i;
+
+    image_length = 0;
+    TIFFGetField(s->tiff.tiff_file, TIFFTAG_IMAGELENGTH, &image_length);
+    for (row = 0;  row < image_length;  row++)
+    {
+        if (TIFFReadScanline(s->tiff.tiff_file, s->row_buf, row, 0) <= 0)
+        {
+            span_log(&s->logging, SPAN_LOG_WARNING, "%s: Read error at row %d.\n", s->tiff.file, row);
+            break;
+        }
+        if (s->tiff.photo_metric != PHOTOMETRIC_MINISWHITE)
+        {
+            for (i = 0;  i < s->bytes_per_row;  i++)
+                s->row_buf[i] = ~s->row_buf[i];
+        }
+        if (s->tiff.fill_order != FILLORDER_LSB2MSB)
+            bit_reverse(s->row_buf, s->row_buf, s->bytes_per_row);
+        if (encode_row(s))
+            return -1;
+    }
+    return image_length;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int close_tiff_input_file(t4_state_t *s)
+{
+    TIFFClose(s->tiff.tiff_file);
+    s->tiff.tiff_file = NULL;
+    if (s->tiff.file)
+        free((char *) s->tiff.file);
+    s->tiff.file = NULL;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void update_row_bit_info(t4_state_t *s)
+{
+    if (s->row_bits > s->max_row_bits)
+        s->max_row_bits = s->row_bits;
+    if (s->row_bits < s->min_row_bits)
+        s->min_row_bits = s->row_bits;
+    s->row_bits = 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int free_buffers(t4_state_t *s)
+{
+    if (s->image_buffer)
+    {
+        free(s->image_buffer);
+        s->image_buffer = NULL;
+        s->image_buffer_size = 0;
+    }
+    if (s->cur_runs)
+    {
+        free(s->cur_runs);
+        s->cur_runs = NULL;
+    }
+    if (s->ref_runs)
+    {
+        free(s->ref_runs);
+        s->ref_runs = NULL;
+    }
+    if (s->row_buf)
+    {
+        free(s->row_buf);
+        s->row_buf = NULL;
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int row_to_run_lengths(uint32_t list[], const uint8_t row[], int width)
+{
+    uint32_t flip;
+    uint32_t x;
+    int span;
+    int entry;
+    int frag;
+    int rem;
+    int limit;
+    int i;
+    int pos;
+
+    /* Deal with whole words first. We know we are starting on a word boundary. */
+    entry = 0;
+    flip = 0;
+    limit = (width >> 3) & ~3;
+    span = 0;
+    pos = 0;
+    for (i = 0;  i < limit;  i += sizeof(uint32_t))
+    {
+        x = *((uint32_t *) &row[i]);
+        if (x != flip)
+        {
+            x = ((uint32_t) row[i] << 24) | ((uint32_t) row[i + 1] << 16) | ((uint32_t) row[i + 2] << 8) | ((uint32_t) row[i + 3]);
+            /* We know we are going to find at least one transition. */
+            frag = 31 - top_bit(x ^ flip);
+            pos += ((i << 3) - span + frag);
+            list[entry++] = pos;
+            x <<= frag;
+            flip ^= 0xFFFFFFFF;
+            rem = 32 - frag;
+            /* Now see if there are any more */
+            while ((frag = 31 - top_bit(x ^ flip)) < rem)
+            {
+                pos += frag;
+                list[entry++] = pos;
+                x <<= frag;
+                flip ^= 0xFFFFFFFF;
+                rem -= frag;
+            }
+            /* Save the remainder of the word */
+            span = (i << 3) + 32 - rem;
+        }
+    }
+    /* Now deal with some whole bytes, if there are any left. */
+    limit = width >> 3;
+    flip &= 0xFF000000;
+    if (i < limit)
+    {
+        for (  ;  i < limit;  i++)
+        {
+            x = (uint32_t) row[i] << 24;
+            if (x != flip)
+            {
+                /* We know we are going to find at least one transition. */
+                frag = 31 - top_bit(x ^ flip);
+                pos += ((i << 3) - span + frag);
+                list[entry++] = pos;
+                x <<= frag;
+                flip ^= 0xFF000000;
+                rem = 8 - frag;
+                /* Now see if there are any more */
+                while ((frag = 31 - top_bit(x ^ flip)) < rem)
+                {
+                    pos += frag;
+                    list[entry++] = pos;
+                    x <<= frag;
+                    flip ^= 0xFF000000;
+                    rem -= frag;
+                }   
+                /* Save the remainder of the word */
+                span = (i << 3) + 8 - rem;
+            }
+        }
+    }
+    /* Deal with any left over fractional byte. */
+    span = (i << 3) - span;
+    if ((rem = width & 7))
+    {
+        x = row[i];
+        x <<= 24;
+        do
+        {
+            frag = 31 - top_bit(x ^ flip);
+            if (frag > rem)
+                frag = rem;
+            pos += (span + frag);
+            list[entry++] = pos;
+            x <<= frag;
+            span = 0;
+            flip ^= 0xFF000000;
+            rem -= frag;
+        }
+        while (rem > 0);
+    }
+    else
+    {
+        if (span)
+        {
+            pos += span;
+            list[entry++] = pos;
+        }
+    }
+    return entry;
+}
+/*- End of function --------------------------------------------------------*/
+
+static __inline__ int put_encoded_bits(t4_state_t *s, uint32_t bits, int length)
+{
+    uint8_t *t;
+
+    /* We might be called with a large length value, to spew out a mass of zero bits for
+       minimum row length padding. */
+    s->tx_bitstream |= (bits << s->tx_bits);
+    s->tx_bits += length;
+    s->row_bits += length;
+    if ((s->image_size + (s->tx_bits + 7)/8) >= s->image_buffer_size)
+    {
+        if ((t = realloc(s->image_buffer, s->image_buffer_size + 100*s->bytes_per_row)) == NULL)
+            return -1;
+        s->image_buffer = t;
+        s->image_buffer_size += 100*s->bytes_per_row;
+    }
+    while (s->tx_bits >= 8)
+    {
+        s->image_buffer[s->image_size++] = (uint8_t) (s->tx_bitstream & 0xFF);
+        s->tx_bitstream >>= 8;
+        s->tx_bits -= 8;
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+/*
+ * Write the sequence of codes that describes
+ * the specified span of zero's or one's.  The
+ * appropriate table that holds the make-up and
+ * terminating codes is supplied.
+ */
+static __inline__ int put_1d_span(t4_state_t *s, int32_t span, const t4_run_table_entry_t *tab)
+{
+    const t4_run_table_entry_t *te;
+
+    te = &tab[63 + (2560 >> 6)];
+    while (span >= 2560 + 64)
+    {
+        if (put_encoded_bits(s, te->code, te->length))
+            return -1;
+        span -= te->run_length;
+    }
+    te = &tab[63 + (span >> 6)];
+    if (span >= 64)
+    {
+        if (put_encoded_bits(s, te->code, te->length))
+            return -1;
+        span -= te->run_length;
+    }
+    if (put_encoded_bits(s, tab[span].code, tab[span].length))
+        return -1;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+#define pixel_is_black(x,bit) (((x)[(bit) >> 3] << ((bit) & 7)) & 0x80)
+
+/*
+ * Write an EOL code to the output stream.  We also handle writing the tag
+ * bit for the next scanline when doing 2D encoding.
+ */
+static void encode_eol(t4_state_t *s)
+{
+    uint32_t code;
+    int length;
+
+    if (s->line_encoding == T4_COMPRESSION_ITU_T4_2D)
+    {
+        code = 0x0800 | ((!s->row_is_2d) << 12);
+        length = 13;
+    }
+    else
+    {
+        /* T.4 1D EOL, or T.6 EOFB */
+        code = 0x800;
+        length = 12;
+    }
+    if (s->row_bits)
+    {
+        /* We may need to pad the row to a minimum length, unless we are in T.6 mode.
+           In T.6 we only come here at the end of the page to add the EOFB marker, which
+           is like two 1D EOLs. */
+        if (s->line_encoding != T4_COMPRESSION_ITU_T6)
+        {
+            if (s->row_bits + length < s->t4_t6_tx.min_bits_per_row)
+                put_encoded_bits(s, 0, s->t4_t6_tx.min_bits_per_row - (s->row_bits + length));
+        }
+        put_encoded_bits(s, code, length);
+        update_row_bit_info(s);
+    }
+    else
+    {
+        /* We don't pad zero length rows. They are the consecutive EOLs which end a page. */
+        put_encoded_bits(s, code, length);
+        /* Don't do the full update row bit info, or the minimum suddenly drops to the
+           length of an EOL. Just clear the row bits, so we treat the next EOL as an
+           end of page EOL, with no padding. */
+        s->row_bits = 0;
+    }
+}
+/*- End of function --------------------------------------------------------*/
+
+/*
+ * 2D-encode a row of pixels.  Consult ITU specification T.4 for the algorithm.
+ */
+static void encode_2d_row(t4_state_t *s)
+{
+    static const t4_run_table_entry_t codes[] =
+    {
+        { 7, 0x60, 0 },         /* VR3          0000 011 */
+        { 6, 0x30, 0 },         /* VR2          0000 11 */
+        { 3, 0x06, 0 },         /* VR1          011 */
+        { 1, 0x01, 0 },         /* V0           1 */
+        { 3, 0x02, 0 },         /* VL1          010 */
+        { 6, 0x10, 0 },         /* VL2          0000 10 */
+        { 7, 0x20, 0 },         /* VL3          0000 010 */
+        { 3, 0x04, 0 },         /* horizontal   001 */
+        { 4, 0x08, 0 }          /* pass         0001 */
+    };
+
+    /* The reference or starting changing element on the coding line. At the start of the coding
+       line, a0 is set on an imaginary white changing element situated just before the first element
+       on the line. During the coding of the coding line, the position of a0 is defined by the
+       previous coding mode. (See T.4/4.2.1.3.2.) */
+    int a0;
+    /* The next changing element to the right of a0 on the coding line. */
+    int a1;
+    /* The next changing element to the right of a1 on the coding line. */
+    int a2;
+    /* The first changing element on the reference line to the right of a0 and of opposite colour to a0. */
+    int b1;
+    /* The next changing element to the right of b1 on the reference line. */
+    int b2;
+    int diff;
+    int a_cursor;
+    int b_cursor;
+    int cur_steps;
+    uint32_t *p;
+
+    /*
+                                                    b1          b2 
+            XX  XX  XX  XX  XX  --  --  --  --  --  XX  XX  XX  --  --  --  --  --
+            XX  XX  XX  --  --  --  --  --  XX  XX  XX  XX  XX  XX  --  --  --  --
+                        a0                  a1                      a2
+
+
+        a)  Pass mode
+            This mode is identified when the position of b2 lies to the left of a1. When this mode
+            has been coded, a0 is set on the element of the coding line below b2 in preparation for
+            the next coding (i.e. on a0').
+            
+                                    b1          b2 
+            XX  XX  XX  XX  --  --  XX  XX  XX  --  --  --  --  --
+            XX  XX  --  --  --  --  --  --  --  --  --  --  XX  XX 
+                    a0                          a0'         a1
+                                Pass mode
+                                
+
+            However, the state where b2 occurs just above a1, as shown in the figure below, is not
+            considered as a pass mode.
+
+                                    b1          b2 
+            XX  XX  XX  XX  --  --  XX  XX  XX  --  --  --  --  --
+            XX  XX  --  --  --  --  --  --  --  XX  XX  XX  XX  XX
+                    a0                          a1
+                                Not pass mode
+
+
+        b)  Vertical mode
+            When this mode is identified, the position of a1 is coded relative to the position of b1.
+            The relative distance a1b1 can take on one of seven values V(0), VR(1), VR(2), VR(3),
+            VL(1), VL(2) and VL(3), each of which is represented by a separate code word. The
+            subscripts R and L indicate that a1 is to the right or left respectively of b1, and the
+            number in brackets indicates the value of the distance a1b1. After vertical mode coding
+            has occurred, the position of a0 is set on a1 (see figure below).
+
+        c)  Horizontal mode
+            When this mode is identified, both the run-lengths a0a1 and a1a2 are coded using the code
+            words H + M(a0a1) + M(a1a2). H is the flag code word 001 taken from the two-dimensional
+            code table. M(a0a1) and M(a1a2) are code words which represent the length and "colour"
+            of the runs a0a1 and a1a2 respectively and are taken from the appropriate white or black
+            one-dimensional code tables. After a horizontal mode coding, the position of a0 is set on
+            a2 (see figure below).
+
+                                                            Vertical
+                                                            <a1 b1>
+                                                                    b1              b2 
+            --  XX  XX  XX  XX  XX  --  --  --  --  --  --  --  --  XX  XX  XX  XX  --  --  --
+            --  --  --  --  --  --  --  --  --  --  --  --  XX  XX  XX  XX  XX  XX  XX  --  --
+                                    a0                      a1                          a2
+                                   <-------- a0a1 --------><-------- a1a2 ------------>
+                                                    Horizontal mode
+                          Vertical and horizontal modes
+     */
+    /* The following implements the 2-D encoding section of the flow chart in Figure7/T.4 */
+    cur_steps = row_to_run_lengths(s->cur_runs, s->row_buf, s->image_width);
+    /* Stretch the row a little, so when we step by 2 we are guaranteed to
+       hit an entry showing the row length */
+    s->cur_runs[cur_steps] =
+    s->cur_runs[cur_steps + 1] =
+    s->cur_runs[cur_steps + 2] = s->cur_runs[cur_steps - 1];
+
+    a0 = 0;
+    a1 = s->cur_runs[0];
+    b1 = s->ref_runs[0];
+    a_cursor = 0;
+    b_cursor = 0;
+    for (;;)
+    {
+        b2 = s->ref_runs[b_cursor + 1];
+        if (b2 >= a1)
+        {
+            diff = b1 - a1;
+            if (abs(diff) <= 3)
+            {
+                /* Vertical mode coding */
+                put_encoded_bits(s, codes[diff + 3].code, codes[diff + 3].length);
+                a0 = a1;
+                a_cursor++;
+            }
+            else
+            {
+                /* Horizontal mode coding */
+                a2 = s->cur_runs[a_cursor + 1];
+                put_encoded_bits(s, codes[7].code, codes[7].length);
+                if (a0 + a1 == 0  ||  pixel_is_black(s->row_buf, a0) == 0)
+                {
+                    put_1d_span(s, a1 - a0, t4_white_codes);
+                    put_1d_span(s, a2 - a1, t4_black_codes);
+                }
+                else
+                {
+                    put_1d_span(s, a1 - a0, t4_black_codes);
+                    put_1d_span(s, a2 - a1, t4_white_codes);
+                }
+                a0 = a2;
+                a_cursor += 2;
+            }
+            if (a0 >= s->image_width)
+                break;
+            if (a_cursor >= cur_steps)
+                a_cursor = cur_steps - 1;
+            a1 = s->cur_runs[a_cursor];
+        }
+        else
+        {
+            /* Pass mode coding */
+            put_encoded_bits(s, codes[8].code, codes[8].length);
+            /* We now set a0 to somewhere in the middle of its current run,
+               but we know are aren't moving beyond that run. */
+            a0 = b2;
+            if (a0 >= s->image_width)
+                break;
+        }
+        /* We need to hunt for the correct position in the reference row, as the
+           runs there have no particular alignment with the runs in the current
+           row. */
+        if (pixel_is_black(s->row_buf, a0))
+            b_cursor |= 1;
+        else
+            b_cursor &= ~1;
+        if (a0 < (int) s->ref_runs[b_cursor])
+        {
+            for (  ;  b_cursor >= 0;  b_cursor -= 2)
+            {
+                if (a0 >= (int) s->ref_runs[b_cursor])
+                    break;
+            }
+            b_cursor += 2;
+        }
+        else
+        {
+            for (  ;  b_cursor < s->t4_t6_tx.ref_steps;  b_cursor += 2)
+            {
+                if (a0 < (int) s->ref_runs[b_cursor])
+                    break;
+            }
+            if (b_cursor >= s->t4_t6_tx.ref_steps)
+                b_cursor = s->t4_t6_tx.ref_steps - 1;
+        }
+        b1 = s->ref_runs[b_cursor];
+    }
+    /* Swap the buffers */
+    s->t4_t6_tx.ref_steps = cur_steps;
+    p = s->cur_runs;
+    s->cur_runs = s->ref_runs;
+    s->ref_runs = p;
+}
+/*- End of function --------------------------------------------------------*/
+
+/*
+ * 1D-encode a row of pixels. The encoding is a sequence of all-white or
+ * all-black spans of pixels encoded with Huffman codes.
+ */
+static void encode_1d_row(t4_state_t *s)
+{
+    int i;
+
+    /* Do our work in the reference row buffer, and it is already in place if
+       we need a reference row for a following 2D encoded row. */
+    s->t4_t6_tx.ref_steps = row_to_run_lengths(s->ref_runs, s->row_buf, s->image_width);
+    put_1d_span(s, s->ref_runs[0], t4_white_codes);
+    for (i = 1;  i < s->t4_t6_tx.ref_steps;  i++)
+        put_1d_span(s, s->ref_runs[i] - s->ref_runs[i - 1], (i & 1)  ?  t4_black_codes  :  t4_white_codes);
+    /* Stretch the row a little, so when we step by 2 we are guaranteed to
+       hit an entry showing the row length */
+    s->ref_runs[s->t4_t6_tx.ref_steps] =
+    s->ref_runs[s->t4_t6_tx.ref_steps + 1] =
+    s->ref_runs[s->t4_t6_tx.ref_steps + 2] = s->ref_runs[s->t4_t6_tx.ref_steps - 1];
+}
+/*- End of function --------------------------------------------------------*/
+
+static int encode_row(t4_state_t *s)
+{
+    switch (s->line_encoding)
+    {
+    case T4_COMPRESSION_ITU_T6:
+        /* T.6 compression is a trivial step up from T.4 2D, so we just
+           throw it in here. T.6 is only used with error correction,
+           so it does not need independantly compressed (i.e. 1D) lines
+           to recover from data errors. It doesn't need EOLs, either. */
+        if (s->row_bits)
+            update_row_bit_info(s);
+        encode_2d_row(s);
+        break;
+    case T4_COMPRESSION_ITU_T4_2D:
+        encode_eol(s);
+        if (s->row_is_2d)
+        {
+            encode_2d_row(s);
+            s->t4_t6_tx.rows_to_next_1d_row--;
+        }
+        else
+        {
+            encode_1d_row(s);
+            s->row_is_2d = TRUE;
+        }
+        if (s->t4_t6_tx.rows_to_next_1d_row <= 0)
+        {
+            /* Insert a row of 1D encoding */
+            s->row_is_2d = FALSE;
+            s->t4_t6_tx.rows_to_next_1d_row = s->t4_t6_tx.max_rows_to_next_1d_row - 1;
+        }
+        break;
+    default:
+    case T4_COMPRESSION_ITU_T4_1D:
+        encode_eol(s);
+        encode_1d_row(s);
+        break;
+    }
+    s->row++;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_tx_set_row_read_handler(t4_state_t *s, t4_row_read_handler_t handler, void *user_data)
+{
+    s->t4_t6_tx.row_read_handler = handler;
+    s->t4_t6_tx.row_read_user_data = user_data;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(t4_state_t *) t4_tx_init(t4_state_t *s, const char *file, int start_page, int stop_page)
+{
+    int run_space;
+
+    if (s == NULL)
+    {
+        if ((s = (t4_state_t *) malloc(sizeof(*s))) == NULL)
+            return NULL;
+    }
+    memset(s, 0, sizeof(*s));
+    span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
+    span_log_set_protocol(&s->logging, "T.4");
+    s->rx = FALSE;
+
+    span_log(&s->logging, SPAN_LOG_FLOW, "Start tx document\n");
+
+    if (open_tiff_input_file(s, file) < 0)
+        return NULL;
+    s->tiff.file = strdup(file);
+    s->current_page =
+    s->tiff.start_page = (start_page >= 0)  ?  start_page  :  0;
+    s->tiff.stop_page = (stop_page >= 0)  ?  stop_page : INT_MAX;
+
+    if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page))
+        return NULL;
+    if (get_tiff_directory_info(s))
+    {
+        close_tiff_input_file(s);
+        return NULL;
+    }
+
+    s->t4_t6_tx.rows_to_next_1d_row = s->t4_t6_tx.max_rows_to_next_1d_row - 1;
+
+    s->tiff.pages_in_file = -1;
+
+    run_space = (s->image_width + 4)*sizeof(uint32_t);
+    if ((s->cur_runs = (uint32_t *) malloc(run_space)) == NULL)
+        return NULL;
+    if ((s->ref_runs = (uint32_t *) malloc(run_space)) == NULL)
+    {
+        free_buffers(s);
+        close_tiff_input_file(s);
+        return NULL;
+    }
+    if ((s->row_buf = malloc(s->bytes_per_row)) == NULL)
+    {
+        free_buffers(s);
+        close_tiff_input_file(s);
+        return NULL;
+    }
+    s->ref_runs[0] =
+    s->ref_runs[1] =
+    s->ref_runs[2] =
+    s->ref_runs[3] = s->image_width;
+    s->t4_t6_tx.ref_steps = 1;
+    s->image_buffer_size = 0;
+    return s;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_tx_start_page(t4_state_t *s)
+{
+    int row;
+    int i;
+    int run_space;
+    int len;
+    int old_image_width;
+    uint8_t *bufptr8;
+    uint32_t *bufptr;
+
+    span_log(&s->logging, SPAN_LOG_FLOW, "Start tx page %d\n", s->current_page);
+    if (s->current_page > s->tiff.stop_page)
+        return -1;
+    if (s->tiff.tiff_file == NULL)
+        return -1;
+    old_image_width = s->image_width;
+    if (s->t4_t6_tx.row_read_handler == NULL)
+    {
+#if defined(HAVE_LIBTIFF)
+        if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page))
+            return -1;
+        get_tiff_directory_info(s);
+#endif
+    }
+    s->image_size = 0;
+    s->tx_bitstream = 0;
+    s->tx_bits = 0;
+    s->row_is_2d = (s->line_encoding == T4_COMPRESSION_ITU_T6);
+    s->t4_t6_tx.rows_to_next_1d_row = s->t4_t6_tx.max_rows_to_next_1d_row - 1;
+
+    /* Allow for pages being of different width. */
+    run_space = (s->image_width + 4)*sizeof(uint32_t);
+    if (old_image_width != s->image_width)
+    {
+        s->bytes_per_row = (s->image_width + 7)/8;
+
+        if ((bufptr = (uint32_t *) realloc(s->cur_runs, run_space)) == NULL)
+            return -1;
+        s->cur_runs = bufptr;
+        if ((bufptr = (uint32_t *) realloc(s->ref_runs, run_space)) == NULL)
+            return -1;
+        s->ref_runs = bufptr;
+        if ((bufptr8 = realloc(s->row_buf, s->bytes_per_row)) == NULL)
+            return -1;
+        s->row_buf = bufptr8;
+    }
+    s->ref_runs[0] =
+    s->ref_runs[1] =
+    s->ref_runs[2] =
+    s->ref_runs[3] = s->image_width;
+    s->t4_t6_tx.ref_steps = 1;
+
+    s->row_bits = 0;
+    s->min_row_bits = INT_MAX;
+    s->max_row_bits = 0;
+
+    if (s->t4_t6_tx.header_info  &&  s->t4_t6_tx.header_info[0])
+    {
+        if (t4_tx_put_fax_header(s))
+            return -1;
+    }
+    if (s->t4_t6_tx.row_read_handler)
+    {
+        for (row = 0;  ;  row++)
+        {
+            if ((len = s->t4_t6_tx.row_read_handler(s->t4_t6_tx.row_read_user_data, s->row_buf, s->bytes_per_row)) < 0)
+            {
+                span_log(&s->logging, SPAN_LOG_WARNING, "%s: Read error at row %d.\n", s->tiff.file, row);
+                break;
+            }
+            if (len == 0)
+                break;
+            if (encode_row(s))
+                return -1;
+        }
+        s->image_length = row;
+    }
+    else
+    {
+        if ((s->image_length = read_tiff_image(s)) < 0)
+            return -1;
+    }
+    if (s->line_encoding == T4_COMPRESSION_ITU_T6)
+    {
+        /* Attach an EOFB (end of facsimile block == 2 x EOLs) to the end of the page */
+        for (i = 0;  i < EOLS_TO_END_T6_TX_PAGE;  i++)
+            encode_eol(s);
+    }
+    else
+    {
+        /* Attach an RTC (return to control == 6 x EOLs) to the end of the page */
+        s->row_is_2d = FALSE;
+        for (i = 0;  i < EOLS_TO_END_T4_TX_PAGE;  i++)
+            encode_eol(s);
+    }
+
+    /* Force any partial byte in progress to flush using ones. Any post EOL padding when
+       sending is normally ones, so this is consistent. */
+    put_encoded_bits(s, 0xFF, 7);
+    s->t4_t6_tx.bit_pos = 7;
+    s->t4_t6_tx.bit_ptr = 0;
+    s->line_image_size = s->image_size*8;
+
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_tx_next_page_has_different_format(t4_state_t *s)
+{
+    span_log(&s->logging, SPAN_LOG_FLOW, "Checking for the existance of page %d\n", s->current_page + 1);
+    if (s->current_page >= s->tiff.stop_page)
+        return -1;
+    if (s->t4_t6_tx.row_read_handler == NULL)
+    {
+#if defined(HAVE_LIBTIFF)
+        if (s->tiff.tiff_file == NULL)
+            return -1;
+        if (!TIFFSetDirectory(s->tiff.tiff_file, (tdir_t) s->current_page + 1))
+            return -1;
+        return test_tiff_directory_info(s);
+#endif
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_tx_restart_page(t4_state_t *s)
+{
+    s->t4_t6_tx.bit_pos = 7;
+    s->t4_t6_tx.bit_ptr = 0;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_tx_end_page(t4_state_t *s)
+{
+    s->current_page++;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_tx_get_bit(t4_state_t *s)
+{
+    int bit;
+
+    if (s->t4_t6_tx.bit_ptr >= s->image_size)
+        return SIG_STATUS_END_OF_DATA;
+    bit = (s->image_buffer[s->t4_t6_tx.bit_ptr] >> (7 - s->t4_t6_tx.bit_pos)) & 1;
+    if (--s->t4_t6_tx.bit_pos < 0)
+    {
+        s->t4_t6_tx.bit_pos = 7;
+        s->t4_t6_tx.bit_ptr++;
+    }
+    return bit;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_tx_get_byte(t4_state_t *s)
+{
+    if (s->t4_t6_tx.bit_ptr >= s->image_size)
+        return 0x100;
+    return s->image_buffer[s->t4_t6_tx.bit_ptr++];
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_tx_get_chunk(t4_state_t *s, uint8_t buf[], int max_len)
+{
+    if (s->t4_t6_tx.bit_ptr >= s->image_size)
+        return 0;
+    if (s->t4_t6_tx.bit_ptr + max_len > s->image_size)
+        max_len = s->image_size - s->t4_t6_tx.bit_ptr;
+    memcpy(buf, &s->image_buffer[s->t4_t6_tx.bit_ptr], max_len);
+    s->t4_t6_tx.bit_ptr += max_len;
+    return max_len;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_tx_check_bit(t4_state_t *s)
+{
+    int bit;
+
+    if (s->t4_t6_tx.bit_ptr >= s->image_size)
+        return SIG_STATUS_END_OF_DATA;
+    bit = (s->image_buffer[s->t4_t6_tx.bit_ptr] >> s->t4_t6_tx.bit_pos) & 1;
+    return bit;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_tx_release(t4_state_t *s)
+{
+    if (s->rx)
+        return -1;
+    if (s->tiff.tiff_file)
+        close_tiff_input_file(s);
+    free_buffers(s);
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_tx_free(t4_state_t *s)
+{
+    int ret;
+
+    ret = t4_tx_release(s);
+    free(s);
+    return ret;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) t4_tx_set_tx_encoding(t4_state_t *s, int encoding)
+{
+    s->line_encoding = encoding;
+    s->t4_t6_tx.rows_to_next_1d_row = s->t4_t6_tx.max_rows_to_next_1d_row - 1;
+    s->row_is_2d = FALSE;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) t4_tx_set_min_row_bits(t4_state_t *s, int bits)
+{
+    s->t4_t6_tx.min_bits_per_row = bits;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) t4_tx_set_local_ident(t4_state_t *s, const char *ident)
+{
+    s->tiff.local_ident = (ident  &&  ident[0])  ?  ident  :  NULL;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(void) t4_tx_set_header_info(t4_state_t *s, const char *info)
+{
+    s->t4_t6_tx.header_info = (info  &&  info[0])  ?  info  :  NULL;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_tx_get_y_resolution(t4_state_t *s)
+{
+    return s->y_resolution;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_tx_get_x_resolution(t4_state_t *s)
+{
+    return s->x_resolution;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_tx_get_image_width(t4_state_t *s)
+{
+    return s->image_width;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_tx_get_pages_in_file(t4_state_t *s)
+{
+    int max;
+
+    max = 0;
+    if (s->t4_t6_tx.row_read_handler == NULL)
+        max = get_tiff_total_pages(s);
+    if (max >= 0)
+        s->tiff.pages_in_file = max;
+    return max;
+}
+/*- End of function --------------------------------------------------------*/
+
+SPAN_DECLARE(int) t4_tx_get_current_page_in_file(t4_state_t *s)
+{
+    return s->current_page;
+}
+/*- End of function --------------------------------------------------------*/
+/*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/tone_generate.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/tone_generate.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/tone_generate.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: tone_generate.c,v 1.53 2009/06/02 16:03:56 steveu Exp $
+ * $Id: tone_generate.c,v 1.53.4.1 2009/12/23 14:23:49 steveu Exp $
  */
 
 /*! \file */
@@ -59,8 +59,6 @@
 #define M_PI 3.14159265358979323846264338327
 #endif
 
-#define ms_to_samples(t)            (((t)*SAMPLE_RATE)/1000)
-
 SPAN_DECLARE(void) make_tone_gen_descriptor(tone_gen_descriptor_t *s,
                                             int f1,
                                             int l1,

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v17_v32bis_rx_constellation_maps.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v17_v32bis_rx_constellation_maps.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v17_v32bis_rx_constellation_maps.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -24,7 +24,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v17_v32bis_rx_constellation_maps.h,v 1.1 2009/06/02 11:51:57 steveu Exp $
+ * $Id: v17_v32bis_rx_constellation_maps.h,v 1.1.4.1 2009/12/24 16:52:30 steveu Exp $
  */
 
 /* The following table maps the 8 soft-decisions associated with every possible point in the
@@ -5514,4 +5514,1376 @@
     }
 };
 
+static const uint8_t constel_map_4800[36][36] =
+{   /* 4,800bps map - No trellis. V.32/V.32bis only */
+    {
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x00,
+        0x00,
+        0x00,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x00,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x01,
+        0x01,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x01,
+        0x01,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x01
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03
+    },
+    {
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x02,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03,
+        0x03
+    }
+};
+
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v17_v32bis_tx_constellation_maps.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v17_v32bis_tx_constellation_maps.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v17_v32bis_tx_constellation_maps.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -24,7 +24,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v17_v32bis_tx_constellation_maps.h,v 1.1 2009/06/02 11:51:57 steveu Exp $
+ * $Id: v17_v32bis_tx_constellation_maps.h,v 1.1.4.1 2009/12/24 16:52:30 steveu Exp $
  */
 
 #if defined(SPANDSP_USE_FIXED_POINTx)
@@ -299,16 +299,30 @@
     {-2, -2}        /* 0x0F */
 };
 
+/* This one does not exist in V.17 as a data constellation. It is only
+   the equaliser training constellation. In V.32/V.32bis it is a data mode. */
 #if defined(SPANDSP_USE_FIXED_POINTx)
 static const complexi16_t v17_v32bis_4800_constellation[4] =
 #else
 static const complexf_t v17_v32bis_4800_constellation[4] =
 #endif
 {
-    {-6, -2},
-    { 2, -6},
-    { 6,  2},
-    {-2,  6}
+    {-6, -2},       /* 0x00 */
+    {-2,  6},       /* 0x01 */
+    { 2, -6},       /* 0x02 */
+    { 6,  2}        /* 0x03 */
 };
 
+#if defined(SPANDSP_USE_FIXED_POINTx)
+static const complexi16_t v17_v32bis_abcd_constellation[4] =
+#else
+static const complexf_t v17_v32bis_abcd_constellation[4] =
+#endif
+{
+    {-6, -2},       /* A */
+    { 2, -6},       /* B */
+    { 6,  2},       /* C */
+    {-2,  6}        /* D */
+};
+
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v17rx.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v17rx.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v17rx.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -23,7 +23,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v17rx.c,v 1.153 2009/07/09 14:17:57 steveu Exp $
+ * $Id: v17rx.c,v 1.153.4.6 2009/12/28 12:20:46 steveu Exp $
  */
 
 /*! \file */
@@ -121,22 +121,28 @@
 /* Coefficients for the band edge symbol timing synchroniser (alpha = 0.99) */
 /* low_edge = 2.0f*M_PI*(CARRIER_NOMINAL_FREQ - BAUD_RATE/2.0f)/SAMPLE_RATE; */
 /* high_edge = 2.0f*M_PI*(CARRIER_NOMINAL_FREQ + BAUD_RATE/2.0f)/SAMPLE_RATE; */
+#define SIN_LOW_BAND_EDGE               0.453990499f
+#define COS_LOW_BAND_EDGE               0.891006542f
+#define SIN_HIGH_BAND_EDGE              0.707106781f
+#define COS_HIGH_BAND_EDGE             -0.707106781f
+#define ALPHA                           0.99f
+
 #if defined(SPANDSP_USE_FIXED_POINTx)
-#define SYNC_LOW_BAND_EDGE_COEFF_0      ((int)(FP_FACTOR* 1.764193f))   /* 2*alpha*cos(low_edge) */
-#define SYNC_LOW_BAND_EDGE_COEFF_1      ((int)(FP_FACTOR*-0.980100f))   /* -alpha^2 */
-#define SYNC_HIGH_BAND_EDGE_COEFF_0     ((int)(FP_FACTOR*-1.400072f))   /* 2*alpha*cos(high_edge) */
-#define SYNC_HIGH_BAND_EDGE_COEFF_1     ((int)(FP_FACTOR*-0.980100f))   /* -alpha^2 */
-#define SYNC_CROSS_CORR_COEFF_A         ((int)(FP_FACTOR*-0.932131f))   /* -alpha^2*sin(freq_diff) */
-#define SYNC_CROSS_CORR_COEFF_B         ((int)(FP_FACTOR* 0.700036f))   /* alpha*sin(high_edge) */
-#define SYNC_CROSS_CORR_COEFF_C         ((int)(FP_FACTOR*-0.449451f))   /* -alpha*sin(low_edge) */
+#define SYNC_LOW_BAND_EDGE_COEFF_0      ((int)(FP_FACTOR*(2.0f*ALPHA*COS_LOW_BAND_EDGE)))
+#define SYNC_LOW_BAND_EDGE_COEFF_1      ((int)(FP_FACTOR*(-ALPHA*ALPHA)))
+#define SYNC_LOW_BAND_EDGE_COEFF_2      ((int)(FP_FACTOR*(-ALPHA*SIN_LOW_BAND_EDGE)))
+#define SYNC_HIGH_BAND_EDGE_COEFF_0     ((int)(FP_FACTOR*(2.0f*ALPHA*COS_HIGH_BAND_EDGE)))
+#define SYNC_HIGH_BAND_EDGE_COEFF_1     ((int)(FP_FACTOR*(-ALPHA*ALPHA)))
+#define SYNC_HIGH_BAND_EDGE_COEFF_2     ((int)(FP_FACTOR*(-ALPHA*SIN_HIGH_BAND_EDGE)))
+#define SYNC_MIXED_EDGES_COEFF_3        ((int)(FP_FACTOR*(-ALPHA*ALPHA*(SIN_HIGH_BAND_EDGE*COS_LOW_BAND_EDGE - SIN_LOW_BAND_EDGE*COS_HIGH_BAND_EDGE))))
 #else
-#define SYNC_LOW_BAND_EDGE_COEFF_0       1.764193f                      /* 2*alpha*cos(low_edge) */
-#define SYNC_LOW_BAND_EDGE_COEFF_1      -0.980100f                      /* -alpha^2 */
-#define SYNC_HIGH_BAND_EDGE_COEFF_0     -1.400072f                      /* 2*alpha*cos(high_edge) */
-#define SYNC_HIGH_BAND_EDGE_COEFF_1     -0.980100f                      /* -alpha^2 */
-#define SYNC_CROSS_CORR_COEFF_A         -0.932131f                      /* -alpha^2*sin(freq_diff) */
-#define SYNC_CROSS_CORR_COEFF_B          0.700036f                      /* alpha*sin(high_edge) */
-#define SYNC_CROSS_CORR_COEFF_C         -0.449451f                      /* -alpha*sin(low_edge) */
+#define SYNC_LOW_BAND_EDGE_COEFF_0      (2.0f*ALPHA*COS_LOW_BAND_EDGE)
+#define SYNC_LOW_BAND_EDGE_COEFF_1      (-ALPHA*ALPHA)
+#define SYNC_LOW_BAND_EDGE_COEFF_2      (-ALPHA*SIN_LOW_BAND_EDGE)
+#define SYNC_HIGH_BAND_EDGE_COEFF_0     (2.0f*ALPHA*COS_HIGH_BAND_EDGE)
+#define SYNC_HIGH_BAND_EDGE_COEFF_1     (-ALPHA*ALPHA)
+#define SYNC_HIGH_BAND_EDGE_COEFF_2     (-ALPHA*SIN_HIGH_BAND_EDGE)
+#define SYNC_MIXED_EDGES_COEFF_3        (-ALPHA*ALPHA*(SIN_HIGH_BAND_EDGE*COS_LOW_BAND_EDGE - SIN_LOW_BAND_EDGE*COS_HIGH_BAND_EDGE))
 #endif
 
 #if defined(SPANDSP_USE_FIXED_POINTx)
@@ -291,7 +297,8 @@
 {
     int out_bit;
 
-    out_bit = (in_bit ^ (s->scramble_reg >> 17) ^ (s->scramble_reg >> 22)) & 1;
+    //out_bit = (in_bit ^ (s->scramble_reg >> s->scrambler_tap) ^ (s->scramble_reg >> (23 - 1))) & 1;
+    out_bit = (in_bit ^ (s->scramble_reg >> (18 - 1)) ^ (s->scramble_reg >> (23 - 1))) & 1;
     s->scramble_reg <<= 1;
     if (s->training_stage > TRAINING_STAGE_NORMAL_OPERATION  &&  s->training_stage < TRAINING_STAGE_TCM_WINDUP)
         s->scramble_reg |= out_bit;
@@ -355,12 +362,22 @@
 
 static int decode_baud(v17_rx_state_t *s, complexf_t *z)
 {
-    static const int diff_code[16] =
+    static const uint8_t v32bis_4800_differential_decoder[4][4] =
     {
-        0, 3, 2, 1, 1, 0, 3, 2, 2, 1, 0, 3, 3, 2, 1, 0                         
+        {2, 3, 0, 1},
+        {0, 2, 1, 3},
+        {3, 1, 2, 0},
+        {1, 0, 3, 2}
     };
-    static const int tcm_paths[8][4] =
+    static const uint8_t v17_differential_decoder[4][4] =
     {
+        {0, 1, 2, 3},
+        {3, 0, 1, 2},
+        {2, 3, 0, 1},
+        {1, 2, 3, 0}
+    };
+    static const uint8_t tcm_paths[8][4] =
+    {
         {0, 6, 2, 4},
         {6, 0, 4, 2},
         {2, 4, 0, 6},
@@ -402,6 +419,17 @@
     else if (im < 0)
         im = 0;
 
+    if (s->bits_per_symbol == 2)
+    {
+        /* 4800bps V.32bis mode, without trellis coding */
+        nearest = constel_map_4800[re][im];
+        raw = v32bis_4800_differential_decoder[s->diff][nearest];
+        s->diff = nearest;
+        put_bit(s, raw);
+        put_bit(s, raw >> 1);
+        return nearest;
+    }
+
     /* Find a set of 8 candidate constellation positions, that are the closest
        to the target, with different patterns in the last 3 bits. */
 #if defined(SPANDSP_USE_FIXED_POINTx)
@@ -509,7 +537,7 @@
     nearest = s->full_path_to_past_state_locations[j][k] >> 1;
 
     /* Differentially decode */
-    raw = (nearest & 0x3C) | diff_code[((nearest & 0x03) << 2) | s->diff];
+    raw = (nearest & 0x3C) | v17_differential_decoder[s->diff][nearest & 0x03];
     s->diff = nearest & 0x03;
     for (i = 0;  i < s->bits_per_symbol;  i++)
     {
@@ -533,42 +561,45 @@
 
     /* This routine adapts the position of the half baud samples entering the equalizer. */
 
+    /* This symbol sync scheme is based on the technique first described by Dominique Godard in
+        Passband Timing Recovery in an All-Digital Modem Receiver
+        IEEE TRANSACTIONS ON COMMUNICATIONS, VOL. COM-26, NO. 5, MAY 1978 */
+
+    /* This is slightly rearranged for figure 3b of the Godard paper, as this saves a couple of
+       maths operations */
 #if defined(SPANDSP_USE_FIXED_POINTx)
     /* TODO: The scalings used here need more thorough evaluation, to see if overflows are possible. */
     /* Cross correlate */
-    v = (((s->symbol_sync_low[1] >> 5)*(s->symbol_sync_high[1] >> 4)) >> 15)*SYNC_CROSS_CORR_COEFF_A
-      + (((s->symbol_sync_low[0] >> 5)*(s->symbol_sync_high[1] >> 4)) >> 15)*SYNC_CROSS_CORR_COEFF_B
-      + (((s->symbol_sync_low[1] >> 5)*(s->symbol_sync_high[0] >> 4)) >> 15)*SYNC_CROSS_CORR_COEFF_C;
+    v = (((s->symbol_sync_low[1] >> 5)*(s->symbol_sync_high[0] >> 4)) >> 15)*SYNC_LOW_BAND_EDGE_COEFF_2
+      - (((s->symbol_sync_low[0] >> 5)*(s->symbol_sync_high[1] >> 4)) >> 15)*SYNC_HIGH_BAND_EDGE_COEFF_2
+      + (((s->symbol_sync_low[1] >> 5)*(s->symbol_sync_high[1] >> 4)) >> 15)*SYNC_MIXED_EDGES_COEFF_3;
     /* Filter away any DC component */
     p = v - s->symbol_sync_dc_filter[1];
     s->symbol_sync_dc_filter[1] = s->symbol_sync_dc_filter[0];
     s->symbol_sync_dc_filter[0] = v;
-    /* A little integration will now filter away much of the noise */
+    /* A little integration will now filter away much of the HF noise */
     s->baud_phase -= p;
     if (abs(s->baud_phase) > 100*FP_FACTOR)
     {
         if (s->baud_phase > 0)
-            i = (s->baud_phase > 1000*FP_FACTOR)  ?  5  :  1;
+            i = (s->baud_phase > 1000*FP_FACTOR)  ?  15  :  1;
         else
-            i = (s->baud_phase < -1000*FP_FACTOR)  ?  -5  :  -1;
-
+            i = (s->baud_phase < -1000*FP_FACTOR)  ?  -15  :  -1;
         //printf("v = %10.5f %5d - %f %f %d %d\n", v, i, p, s->baud_phase, s->total_baud_timing_correction);
         s->eq_put_step += i;
         s->total_baud_timing_correction += i;
     }
 #else
     /* Cross correlate */
-    v = s->symbol_sync_low[1]*s->symbol_sync_high[1]*SYNC_CROSS_CORR_COEFF_A
-      + s->symbol_sync_low[0]*s->symbol_sync_high[1]*SYNC_CROSS_CORR_COEFF_B
-      + s->symbol_sync_low[1]*s->symbol_sync_high[0]*SYNC_CROSS_CORR_COEFF_C;
-
+    v = s->symbol_sync_low[1]*s->symbol_sync_high[0]*SYNC_LOW_BAND_EDGE_COEFF_2
+      - s->symbol_sync_low[0]*s->symbol_sync_high[1]*SYNC_HIGH_BAND_EDGE_COEFF_2
+      + s->symbol_sync_low[1]*s->symbol_sync_high[1]*SYNC_MIXED_EDGES_COEFF_3;
     /* Filter away any DC component  */
     p = v - s->symbol_sync_dc_filter[1];
     s->symbol_sync_dc_filter[1] = s->symbol_sync_dc_filter[0];
     s->symbol_sync_dc_filter[0] = v;
     /* A little integration will now filter away much of the HF noise */
     s->baud_phase -= p;
-
     if (fabsf(s->baud_phase) > 100.0f)
     {
         if (s->baud_phase > 0.0f)
@@ -576,7 +607,6 @@
         else
             i = (s->baud_phase < -1000.0f)  ?  -15  :  -1;
         //printf("v = %10.5f %5d - %f %f %d\n", v, i, p, s->baud_phase, s->total_baud_timing_correction);
-
         s->eq_put_step += i;
         s->total_baud_timing_correction += i;
     }
@@ -612,8 +642,7 @@
 
     /* This routine processes every half a baud, as we put things into the equalizer at the T/2 rate. */
 
-    /* Add a sample to the equalizer's circular buffer, but don't calculate anything
-       at this time. */
+    /* Add a sample to the equalizer's circular buffer, but don't calculate anything at this time. */
     s->eq_buf[s->eq_step] = *sample;
     if (++s->eq_step >= V17_EQUALIZER_LEN)
         s->eq_step = 0;
@@ -868,7 +897,18 @@
         {
             s->training_count = 0;
             s->training_error = 0.0f;
-            s->training_stage = TRAINING_STAGE_TCM_WINDUP;
+            if (s->bits_per_symbol == 2)
+            {
+                /* Restart the differential decoder */
+                /* There is no trellis, so go straight to processing decoded data */
+                s->diff = (s->short_train)  ?  0  :  1;
+                s->training_stage = TRAINING_STAGE_TEST_ONES;
+            }
+            else
+            {
+                /* Wait for the trellis to wind up */
+                s->training_stage = TRAINING_STAGE_TCM_WINDUP;
+            }
         }
         break;
     case TRAINING_STAGE_SHORT_WAIT_FOR_CDBA:
@@ -925,7 +965,19 @@
             if (s->training_error < (V17_TRAINING_SHORT_SEG_2_LEN - 8)*4.0f*constellation_spacing[s->space_map])
             {
                 s->training_count = 0;
-                s->training_stage = TRAINING_STAGE_TCM_WINDUP;
+                if (s->bits_per_symbol == 2)
+                {
+                    /* There is no trellis, so go straight to processing decoded data */
+                    /* Restart the differential decoder */
+                    s->diff = (s->short_train)  ?  0  :  1;
+                    s->training_error = 0.0f;
+                    s->training_stage = TRAINING_STAGE_TEST_ONES;
+                }
+                else
+                {
+                    /* Wait for the trellis to wind up */
+                    s->training_stage = TRAINING_STAGE_TCM_WINDUP;
+                }
                 report_status_change(s, SIG_STATUS_TRAINING_IN_PROGRESS);
             }
             else
@@ -1242,6 +1294,13 @@
         s->space_map = 3;
         s->bits_per_symbol = 3;
         break;
+    case 4800:
+        /* This does not exist in the V.17 spec as a valid mode of operation.
+           However, it does exist in V.32bis, so it is here for completeness. */
+        s->constellation = v17_v32bis_4800_constellation;
+        s->space_map = 0;
+        s->bits_per_symbol = 2;
+        break;
     default:
         return -1;
     }
@@ -1294,28 +1353,50 @@
         s->agc_scaling = s->agc_scaling_save;
         equalizer_restore(s);
         /* Don't allow any frequency correction at all, until we start to pull the phase in. */
+#if defined(SPANDSP_USE_FIXED_POINTx)
+        s->carrier_track_i = 0;
+        s->carrier_track_p = 40000;
+#else
         s->carrier_track_i = 0.0f;
         s->carrier_track_p = 40000.0f;
+#endif
     }
     else
     {
         s->carrier_phase_rate = dds_phase_ratef(CARRIER_NOMINAL_FREQ);
+        equalizer_reset(s);
+#if defined(SPANDSP_USE_FIXED_POINTx)
+        s->agc_scaling_save = 0;
+        s->agc_scaling = (float) FP_FACTOR*32768.0f*0.0017f/RX_PULSESHAPER_GAIN;
+        s->carrier_track_i = 5000;
+        s->carrier_track_p = 40000;
+#else
         s->agc_scaling_save = 0.0f;
         s->agc_scaling = 0.0017f/RX_PULSESHAPER_GAIN;
-        equalizer_reset(s);
         s->carrier_track_i = 5000.0f;
         s->carrier_track_p = 40000.0f;
+#endif
     }
     s->last_sample = 0;
 
     /* Initialise the working data for symbol timing synchronisation */
-    s->symbol_sync_low[0] = 0.0f;
-    s->symbol_sync_low[1] = 0.0f;
-    s->symbol_sync_high[0] = 0.0f;
-    s->symbol_sync_high[1] = 0.0f;
-    s->symbol_sync_dc_filter[0] = 0.0f;
-    s->symbol_sync_dc_filter[1] = 0.0f;
+#if defined(SPANDSP_USE_FIXED_POINTx)
+    for (i = 0;  i < 2;  i++)
+    {
+        s->symbol_sync_low[i] = 0;
+        s->symbol_sync_high[i] = 0;
+        s->symbol_sync_dc_filter[i] = 0;
+    }
+    s->baud_phase = 0;
+#else
+    for (i = 0;  i < 2;  i++)
+    {
+        s->symbol_sync_low[i] = 0.0f;
+        s->symbol_sync_high[i] = 0.0f;
+        s->symbol_sync_dc_filter[i] = 0.0f;
+    }
     s->baud_phase = 0.0f;
+#endif
     s->baud_half = 0;
     
     s->total_baud_timing_correction = 0;
@@ -1332,6 +1413,8 @@
     case 12000:
     case 9600:
     case 7200:
+    case 4800:
+        /* 4800 is an extension of V.17, to provide full converage of the V.32bis modes */
         break;
     default:
         return NULL;
@@ -1347,11 +1430,11 @@
     s->put_bit = put_bit;
     s->put_bit_user_data = user_data;
     s->short_train = FALSE;
+    //s->scrambler_tap = 18 - 1;
     v17_rx_signal_cutoff(s, -45.5f);
     s->agc_scaling = 0.0017f/RX_PULSESHAPER_GAIN;
     s->agc_scaling_save = 0.0f;
     s->carrier_phase_rate_save = dds_phase_ratef(CARRIER_NOMINAL_FREQ);
-
     v17_rx_restart(s, bit_rate, s->short_train);
     return s;
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v17tx.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v17tx.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v17tx.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v17tx.c,v 1.75 2009/06/02 16:03:56 steveu Exp $
+ * $Id: v17tx.c,v 1.75.4.1 2009/12/24 16:52:30 steveu Exp $
  */
 
 /*! \file */
@@ -100,7 +100,8 @@
 {
     int out_bit;
 
-    out_bit = (in_bit ^ (s->scramble_reg >> 17) ^ (s->scramble_reg >> 22)) & 1;
+    //out_bit = (in_bit ^ (s->scramble_reg >> s->scrambler_tap) ^ (s->scramble_reg >> (23 - 1))) & 1;
+    out_bit = (in_bit ^ (s->scramble_reg >> (18 - 1)) ^ (s->scramble_reg >> (23 - 1))) & 1;
     s->scramble_reg = (s->scramble_reg << 1) | out_bit;
     return out_bit;
 }
@@ -135,7 +136,7 @@
             if (s->training_step <= V17_TRAINING_SEG_TEP_B)
             {
                 /* Optional segment: Unmodulated carrier (talker echo protection) */
-                return v17_v32bis_4800_constellation[0];
+                return v17_v32bis_abcd_constellation[0];
             }
             if (s->training_step <= V17_TRAINING_SEG_1)
             {
@@ -143,7 +144,7 @@
                 return zero;
             }
             /* Segment 1: ABAB... */
-            return v17_v32bis_4800_constellation[(s->training_step & 1) ^ 1];
+            return v17_v32bis_abcd_constellation[(s->training_step & 1) ^ 1];
         }
         /* Segment 2: CDBA... */
         /* Apply the scrambler */
@@ -155,7 +156,7 @@
             /* Go straight to the ones test. */
             s->training_step = V17_TRAINING_SEG_4;
         }
-        return v17_v32bis_4800_constellation[s->constellation_state];
+        return v17_v32bis_abcd_constellation[s->constellation_state];
     }
     /* Segment 3: Bridge... */
     shift = ((s->training_step - V17_TRAINING_SEG_3 - 1) & 0x7) << 1;
@@ -163,30 +164,53 @@
     bits = scramble(s, V17_BRIDGE_WORD >> shift);
     bits = (bits << 1) | scramble(s, V17_BRIDGE_WORD >> (shift + 1));
     s->constellation_state = (s->constellation_state + dibit_to_step[bits]) & 3;
-    return v17_v32bis_4800_constellation[s->constellation_state];
+    return v17_v32bis_abcd_constellation[s->constellation_state];
 }
 /*- End of function --------------------------------------------------------*/
 
 static __inline__ int diff_and_convolutional_encode(v17_tx_state_t *s, int q)
 {
-    static const int diff_code[16] =
+    static const uint8_t v32bis_4800_differential_encoder[4][4] =
     {
-        0, 1, 2, 3, 1, 2, 3, 0, 2, 3, 0, 1, 3, 0, 1, 2
+        {2, 3, 0, 1},
+        {0, 2, 1, 3},
+        {3, 1, 2, 0},
+        {1, 0, 3, 2}
     };
-    int y1;
-    int y2;
-    int this1;
-    int this2;
+    static const uint8_t v17_differential_encoder[4][4] =
+    {
+        {0, 1, 2, 3},
+        {1, 2, 3, 0},
+        {2, 3, 0, 1},
+        {3, 0, 1, 2}
+    };
+    static const uint8_t v17_convolutional_coder[8][4] =
+    {
+        {0, 2, 3, 1},
+        {4, 7, 5, 6},
+        {1, 3, 2, 0},
+        {7, 4, 6, 5},
+        {2, 0, 1, 3},
+        {6, 5, 7, 4},
+        {3, 1, 0, 2},
+        {5, 6, 4, 7}
+    };
 
+    if (s->bits_per_symbol == 2)
+    {
+        /* 4800bps mode for V.32bis */
+        /* There is no trellis. We just differentially encode. */
+        s->diff = v32bis_4800_differential_encoder[s->diff][q & 0x03];
+        return s->diff;
+    }
     /* Differentially encode */
-    s->diff = diff_code[((q & 0x03) << 2) | s->diff];
+    s->diff = v17_differential_encoder[s->diff][q & 0x03];
 
     /* Convolutionally encode the redundant bit */
-    y2 = s->diff >> 1;
-    y1 = s->diff;
-    this2 = y2 ^ y1 ^ (s->convolution >> 2) ^ ((y2 ^ (s->convolution >> 1)) & s->convolution);
-    this1 = y2 ^ (s->convolution >> 1) ^ (y1 & s->convolution);
-    s->convolution = ((s->convolution & 1) << 2) | ((this2 & 1) << 1) | (this1 & 1);
+    s->convolution = v17_convolutional_coder[s->convolution][s->diff];
+
+    /* The final result is the combination of some uncoded bits, 2 differentially
+       encoded bits, and the convolutionally encoded redundant bit. */
     return ((q << 1) & 0x78) | (s->diff << 1) | ((s->convolution >> 2) & 1);
 }
 /*- End of function --------------------------------------------------------*/
@@ -373,12 +397,18 @@
         s->bits_per_symbol = 3;
         s->constellation = v17_v32bis_7200_constellation;
         break;
+    case 4800:
+        /* This does not exist in the V.17 spec as a valid mode of operation.
+           However, it does exist in V.32bis, so it is here for completeness. */
+        s->bits_per_symbol = 2;
+        s->constellation = v17_v32bis_4800_constellation;
+        break;
     default:
         return -1;
     }
+    s->bit_rate = bit_rate;
     /* NB: some modems seem to use 3 instead of 1 for long training */
     s->diff = (short_train)  ?  0  :  1;
-    s->bit_rate = bit_rate;
 #if defined(SPANDSP_USE_FIXED_POINT)
     memset(s->rrc_filter, 0, sizeof(s->rrc_filter));
 #else
@@ -406,6 +436,8 @@
     case 12000:
     case 9600:
     case 7200:
+    case 4800:
+        /* 4800 is an extension of V.17, to provide full converage of the V.32bis modes */
         break;
     default:
         return NULL;
@@ -420,6 +452,7 @@
     span_log_set_protocol(&s->logging, "V.17 TX");
     s->get_bit = get_bit;
     s->get_bit_user_data = user_data;
+    //s->scrambler_tap = 18 - 1;
     s->carrier_phase_rate = dds_phase_ratef(CARRIER_NOMINAL_FREQ);
     v17_tx_power(s, -14.0f);
     v17_tx_restart(s, bit_rate, tep, FALSE);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v18.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v18.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v18.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v18.c,v 1.10 2009/06/02 16:03:56 steveu Exp $
+ * $Id: v18.c,v 1.12 2009/11/04 15:52:06 steveu Exp $
  */
  
 /*! \file */
@@ -738,7 +738,7 @@
 /*- End of function --------------------------------------------------------*/
 
 SPAN_DECLARE(v18_state_t *) v18_init(v18_state_t *s,
-                                     int caller,
+                                     int calling_party,
                                      int mode,
                                      put_msg_func_t put_msg,
                                      void *user_data)
@@ -749,7 +749,7 @@
             return NULL;
     }
     memset(s, 0, sizeof(*s));
-    s->caller = caller;
+    s->calling_party = calling_party;
     s->mode = mode;
     s->put_msg = put_msg;
     s->user_data = user_data;
@@ -763,7 +763,7 @@
         s->baudot_tx_shift = 2;
         /* TDD uses 5 bit data, no parity and 1.5 stop bits. We scan for the first stop bit, and
            ride over the fraction. */
-        fsk_rx_init(&(s->fskrx), &preset_fsk_specs[FSK_WEITBRECHT], 7, v18_tdd_put_async_byte, s);
+        fsk_rx_init(&(s->fskrx), &preset_fsk_specs[FSK_WEITBRECHT], FSK_FRAME_MODE_5N1_FRAMES, v18_tdd_put_async_byte, s);
         s->baudot_rx_shift = 0;
         break;
     case V18_MODE_5BIT_50:
@@ -773,7 +773,7 @@
         s->baudot_tx_shift = 2;
         /* TDD uses 5 bit data, no parity and 1.5 stop bits. We scan for the first stop bit, and
            ride over the fraction. */
-        fsk_rx_init(&(s->fskrx), &preset_fsk_specs[FSK_WEITBRECHT50], 7, v18_tdd_put_async_byte, s);
+        fsk_rx_init(&(s->fskrx), &preset_fsk_specs[FSK_WEITBRECHT50], FSK_FRAME_MODE_5N1_FRAMES, v18_tdd_put_async_byte, s);
         s->baudot_rx_shift = 0;
         break;
     case V18_MODE_DTMF:

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v22bis_rx.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v22bis_rx.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v22bis_rx.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v22bis_rx.c,v 1.68 2009/06/02 16:03:56 steveu Exp $
+ * $Id: v22bis_rx.c,v 1.69 2009/11/04 15:52:06 steveu Exp $
  */
 
 /*! \file */
@@ -490,7 +490,7 @@
                error could be higher. */
             s->rx.gardner_step = 4;
             s->rx.pattern_repeats = 0;
-            if (s->caller)
+            if (s->calling_party)
                 s->rx.training = V22BIS_RX_TRAINING_STAGE_UNSCRAMBLED_ONES;
             else
                 s->rx.training = V22BIS_RX_TRAINING_STAGE_SCRAMBLED_ONES_AT_1200;
@@ -586,7 +586,7 @@
                     span_log(&s->logging, SPAN_LOG_FLOW, "+++ S1 detected (%d long)\n", s->rx.pattern_repeats);
                     if (s->bit_rate == 2400)
                     {
-                        if (!s->caller)
+                        if (!s->calling_party)
                         {
                             /* Accept establishment at 2400bps */
                             span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting U0011 (S1) (Answerer)\n");
@@ -601,7 +601,7 @@
             if (s->rx.training_count >= ms_to_symbols(270))
             {
                 /* If we haven't seen the S1 signal by now, we are committed to be in 1200bps mode */
-                if (s->caller)
+                if (s->calling_party)
                 {
                     span_log(&s->logging, SPAN_LOG_FLOW, "+++ Rx normal operation (1200)\n");
                     /* The transmit side needs to sustain the scrambled ones for a timed period */
@@ -625,7 +625,7 @@
         }
         else
         {
-            if (s->caller)
+            if (s->calling_party)
             {
                 if (s->rx.training_count >= ms_to_symbols(100 + 450))
                 {
@@ -716,7 +716,7 @@
         /* Calculate the I filter, with an arbitrary phase step, just so we can calculate
            the signal power of the required carrier, with any guard tone or spillback of our
            own transmitted signal suppressed. */
-        if (s->caller)
+        if (s->calling_party)
         {
             ii = rx_pulseshaper_2400_re[6][0]*s->rx.rrc_filter[s->rx.rrc_filter_step];
             for (j = 1;  j < V22BIS_RX_FILTER_STEPS;  j++)
@@ -769,7 +769,7 @@
                 if (step > PULSESHAPER_COEFF_SETS - 1)
                     step = PULSESHAPER_COEFF_SETS - 1;
                 s->rx.eq_put_step += PULSESHAPER_COEFF_SETS*40/(3*2);
-                if (s->caller)
+                if (s->calling_party)
                 {
                     ii = rx_pulseshaper_2400_re[step][0]*s->rx.rrc_filter[s->rx.rrc_filter_step];
                     qq = rx_pulseshaper_2400_im[step][0]*s->rx.rrc_filter[s->rx.rrc_filter_step];
@@ -836,7 +836,7 @@
     s->rx.training_count = 0;
     s->rx.signal_present = FALSE;
 
-    s->rx.carrier_phase_rate = dds_phase_ratef((s->caller)  ?  2400.0f  :  1200.0f);
+    s->rx.carrier_phase_rate = dds_phase_ratef((s->calling_party)  ?  2400.0f  :  1200.0f);
     s->rx.carrier_phase = 0;
     power_meter_init(&(s->rx.rx_power), 5);
     v22bis_rx_signal_cutoff(s, -45.5f);
@@ -855,7 +855,7 @@
     s->rx.training_error = 0.0f;
     s->rx.total_baud_timing_correction = 0;
     /* We want the carrier to pull in faster on the answerer side, as it has very little time to adapt. */
-    s->rx.carrier_track_i = (s->caller)  ?  8000.0f  :  40000.0f;
+    s->rx.carrier_track_i = (s->calling_party)  ?  8000.0f  :  40000.0f;
     s->rx.carrier_track_p = 8000000.0f;
 
     s->negotiated_bit_rate = 1200;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v22bis_tx.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v22bis_tx.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v22bis_tx.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v22bis_tx.c,v 1.63 2009/06/02 16:03:56 steveu Exp $
+ * $Id: v22bis_tx.c,v 1.64 2009/11/04 15:52:06 steveu Exp $
  */
 
 /*! \file */
@@ -346,7 +346,7 @@
         if (++s->tx.training_count >= ms_to_symbols(100))
         {
             span_log(&s->logging, SPAN_LOG_FLOW, "+++ starting S11 after U0011\n");
-            if (s->caller)
+            if (s->calling_party)
             {
                 s->tx.training_count = 0;
                 s->tx.training = V22BIS_TX_TRAINING_STAGE_S11;
@@ -523,7 +523,7 @@
     s->tx.rrc_filter_step = 0;
     s->tx.scramble_reg = 0;
     s->tx.scrambler_pattern_count = 0;
-    if (s->caller)
+    if (s->calling_party)
         s->tx.training = V22BIS_TX_TRAINING_STAGE_INITIAL_SILENCE;
     else
         s->tx.training = V22BIS_TX_TRAINING_STAGE_INITIAL_TIMED_SILENCE;
@@ -634,7 +634,7 @@
 SPAN_DECLARE(v22bis_state_t *) v22bis_init(v22bis_state_t *s,
                                            int bit_rate,
                                            int guard,
-                                           int caller,
+                                           int calling_party,
                                            get_bit_func_t get_bit,
                                            void *get_bit_user_data,
                                            put_bit_func_t put_bit,
@@ -657,14 +657,14 @@
     span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
     span_log_set_protocol(&s->logging, "V.22bis");
     s->bit_rate = bit_rate;
-    s->caller = caller;
+    s->calling_party = calling_party;
 
     s->get_bit = get_bit;
     s->get_bit_user_data = get_bit_user_data;
     s->put_bit = put_bit;
     s->put_bit_user_data = put_bit_user_data;
 
-    if (s->caller)
+    if (s->calling_party)
     {
         s->tx.carrier_phase_rate = dds_phase_ratef(1200.0f);
     }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v29rx.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v29rx.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v29rx.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -23,7 +23,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v29rx.c,v 1.167 2009/07/08 15:11:09 steveu Exp $
+ * $Id: v29rx.c,v 1.167.4.5 2009/12/28 12:20:47 steveu Exp $
  */
 
 /*! \file */
@@ -131,22 +131,28 @@
 /* Coefficients for the band edge symbol timing synchroniser (alpha = 0.99) */
 /* low_edge = 2.0f*M_PI*(CARRIER_NOMINAL_FREQ - BAUD_RATE/2.0f)/SAMPLE_RATE; */
 /* high_edge = 2.0f*M_PI*(CARRIER_NOMINAL_FREQ + BAUD_RATE/2.0f)/SAMPLE_RATE; */
+#define SIN_LOW_BAND_EDGE               0.382683432f
+#define COS_LOW_BAND_EDGE               0.923879533f
+#define SIN_HIGH_BAND_EDGE              0.760405966f
+#define COS_HIGH_BAND_EDGE             -0.649448048f
+#define ALPHA                           0.99f
+
 #if defined(SPANDSP_USE_FIXED_POINT)
-#define SYNC_LOW_BAND_EDGE_COEFF_0      ((int)(FP_FACTOR* 1.829281f))   /* 2*alpha*cos(low_edge) */
-#define SYNC_LOW_BAND_EDGE_COEFF_1      ((int)(FP_FACTOR*-0.980100f))   /* -alpha^2 */
-#define SYNC_HIGH_BAND_EDGE_COEFF_0     ((int)(FP_FACTOR*-1.285907f))   /* 2*alpha*cos(high_edge) */
-#define SYNC_HIGH_BAND_EDGE_COEFF_1     ((int)(FP_FACTOR*-0.980100f))   /* -alpha^2 */
-#define SYNC_CROSS_CORR_COEFF_A         ((int)(FP_FACTOR*-0.932131f))   /* -alpha^2*sin(freq_diff) */
-#define SYNC_CROSS_CORR_COEFF_B         ((int)(FP_FACTOR* 0.752802f))   /* alpha*sin(high_edge) */
-#define SYNC_CROSS_CORR_COEFF_C         ((int)(FP_FACTOR*-0.378857f))   /* -alpha*sin(low_edge) */
+#define SYNC_LOW_BAND_EDGE_COEFF_0      ((int)(FP_FACTOR*(2.0f*ALPHA*COS_LOW_BAND_EDGE)))
+#define SYNC_LOW_BAND_EDGE_COEFF_1      ((int)(FP_FACTOR*(-ALPHA*ALPHA)))
+#define SYNC_LOW_BAND_EDGE_COEFF_2      ((int)(FP_FACTOR*(-ALPHA*SIN_LOW_BAND_EDGE)))
+#define SYNC_HIGH_BAND_EDGE_COEFF_0     ((int)(FP_FACTOR*(2.0f*ALPHA*COS_HIGH_BAND_EDGE)))
+#define SYNC_HIGH_BAND_EDGE_COEFF_1     ((int)(FP_FACTOR*(-ALPHA*ALPHA)))
+#define SYNC_HIGH_BAND_EDGE_COEFF_2     ((int)(FP_FACTOR*(-ALPHA*SIN_HIGH_BAND_EDGE)))
+#define SYNC_MIXED_EDGES_COEFF_3        ((int)(FP_FACTOR*(-ALPHA*ALPHA*(SIN_HIGH_BAND_EDGE*COS_LOW_BAND_EDGE - SIN_LOW_BAND_EDGE*COS_HIGH_BAND_EDGE))))
 #else
-#define SYNC_LOW_BAND_EDGE_COEFF_0       1.829281f                      /* 2*alpha*cos(low_edge) */
-#define SYNC_LOW_BAND_EDGE_COEFF_1      -0.980100f                      /* -alpha^2 */
-#define SYNC_HIGH_BAND_EDGE_COEFF_0     -1.285907f                      /* 2*alpha*cos(high_edge) */
-#define SYNC_HIGH_BAND_EDGE_COEFF_1     -0.980100f                      /* -alpha^2 */
-#define SYNC_CROSS_CORR_COEFF_A         -0.932131f                      /* -alpha^2*sin(freq_diff) */
-#define SYNC_CROSS_CORR_COEFF_B          0.752802f                      /* alpha*sin(high_edge) */
-#define SYNC_CROSS_CORR_COEFF_C         -0.378857f                      /* -alpha*sin(low_edge) */
+#define SYNC_LOW_BAND_EDGE_COEFF_0      (2.0f*ALPHA*COS_LOW_BAND_EDGE)
+#define SYNC_LOW_BAND_EDGE_COEFF_1      (-ALPHA*ALPHA)
+#define SYNC_LOW_BAND_EDGE_COEFF_2      (-ALPHA*SIN_LOW_BAND_EDGE)
+#define SYNC_HIGH_BAND_EDGE_COEFF_0     (2.0f*ALPHA*COS_HIGH_BAND_EDGE)
+#define SYNC_HIGH_BAND_EDGE_COEFF_1     (-ALPHA*ALPHA)
+#define SYNC_HIGH_BAND_EDGE_COEFF_2     (-ALPHA*SIN_HIGH_BAND_EDGE)
+#define SYNC_MIXED_EDGES_COEFF_3        (-ALPHA*ALPHA*(SIN_HIGH_BAND_EDGE*COS_LOW_BAND_EDGE - SIN_LOW_BAND_EDGE*COS_HIGH_BAND_EDGE))
 #endif
 
 SPAN_DECLARE(float) v29_rx_carrier_frequency(v29_rx_state_t *s)
@@ -489,17 +495,23 @@
 
     /* This routine adapts the position of the half baud samples entering the equalizer. */
 
+    /* This symbol sync scheme is based on the technique first described by Dominique Godard in
+        Passband Timing Recovery in an All-Digital Modem Receiver
+        IEEE TRANSACTIONS ON COMMUNICATIONS, VOL. COM-26, NO. 5, MAY 1978 */
+
+    /* This is slightly rearranged for figure 3b of the Godard paper, as this saves a couple of
+       maths operations */
 #if defined(SPANDSP_USE_FIXED_POINT)
     /* TODO: The scalings used here need more thorough evaluation, to see if overflows are possible. */
     /* Cross correlate */
-    v = (((s->symbol_sync_low[1] >> 5)*(s->symbol_sync_high[1] >> 4)) >> 15)*SYNC_CROSS_CORR_COEFF_A
-      + (((s->symbol_sync_low[0] >> 5)*(s->symbol_sync_high[1] >> 4)) >> 15)*SYNC_CROSS_CORR_COEFF_B
-      + (((s->symbol_sync_low[1] >> 5)*(s->symbol_sync_high[0] >> 4)) >> 15)*SYNC_CROSS_CORR_COEFF_C;
+    v = (((s->symbol_sync_low[1] >> 5)*(s->symbol_sync_high[0] >> 4)) >> 15)*SYNC_LOW_BAND_EDGE_COEFF_2
+      - (((s->symbol_sync_low[0] >> 5)*(s->symbol_sync_high[1] >> 4)) >> 15)*SYNC_HIGH_BAND_EDGE_COEFF_2
+      + (((s->symbol_sync_low[1] >> 5)*(s->symbol_sync_high[1] >> 4)) >> 15)*SYNC_MIXED_EDGES_COEFF_3;
     /* Filter away any DC component */
     p = v - s->symbol_sync_dc_filter[1];
     s->symbol_sync_dc_filter[1] = s->symbol_sync_dc_filter[0];
     s->symbol_sync_dc_filter[0] = v;
-    /* A little integration will now filter away much of the noise */
+    /* A little integration will now filter away much of the HF noise */
     s->baud_phase -= p;
     if (abs(s->baud_phase) > 30*FP_FACTOR)
     {
@@ -507,33 +519,27 @@
             i = (s->baud_phase > 1000*FP_FACTOR)  ?  5  :  1;
         else
             i = (s->baud_phase < -1000*FP_FACTOR)  ?  -5  :  -1;
-
         //printf("v = %10.5f %5d - %f %f %d %d\n", v, i, p, s->baud_phase, s->total_baud_timing_correction);
         s->eq_put_step += i;
         s->total_baud_timing_correction += i;
     }
 #else
     /* Cross correlate */
-    v = s->symbol_sync_low[1]*s->symbol_sync_high[1]*SYNC_CROSS_CORR_COEFF_A
-      + s->symbol_sync_low[0]*s->symbol_sync_high[1]*SYNC_CROSS_CORR_COEFF_B
-      + s->symbol_sync_low[1]*s->symbol_sync_high[0]*SYNC_CROSS_CORR_COEFF_C;
+    v = s->symbol_sync_low[1]*s->symbol_sync_high[0]*SYNC_LOW_BAND_EDGE_COEFF_2
+      - s->symbol_sync_low[0]*s->symbol_sync_high[1]*SYNC_HIGH_BAND_EDGE_COEFF_2
+      + s->symbol_sync_low[1]*s->symbol_sync_high[1]*SYNC_MIXED_EDGES_COEFF_3;
     /* Filter away any DC component */
     p = v - s->symbol_sync_dc_filter[1];
     s->symbol_sync_dc_filter[1] = s->symbol_sync_dc_filter[0];
     s->symbol_sync_dc_filter[0] = v;
-    /* A little integration will now filter away much of the noise */
+    /* A little integration will now filter away much of the HF noise */
     s->baud_phase -= p;
-#if 0
-    if (fabsf(s->baud_phase) > 100.0f)
-#else
     if (fabsf(s->baud_phase) > 30.0f)
-#endif
     {
         if (s->baud_phase > 0.0f)
             i = (s->baud_phase > 1000.0f)  ?  5  :  1;
         else
             i = (s->baud_phase < -1000.0f)  ?  -5  :  -1;
-
         //printf("v = %10.5f %5d - %f %f %d %d\n", v, i, p, s->baud_phase, s->total_baud_timing_correction);
         s->eq_put_step += i;
         s->total_baud_timing_correction += i;
@@ -574,8 +580,7 @@
 
     /* This routine processes every half a baud, as we put things into the equalizer at the T/2 rate. */
 
-    /* Add a sample to the equalizer's circular buffer, but don't calculate anything
-       at this time. */
+    /* Add a sample to the equalizer's circular buffer, but don't calculate anything at this time. */
     s->eq_buf[s->eq_step] = *sample;
     if (++s->eq_step >= V29_EQUALIZER_LEN)
         s->eq_step = 0;
@@ -1070,6 +1075,8 @@
 
 SPAN_DECLARE(int) v29_rx_restart(v29_rx_state_t *s, int bit_rate, int old_train)
 {
+    int i;
+
     switch (bit_rate)
     {
     case 9600:
@@ -1141,20 +1148,20 @@
 
     /* Initialise the working data for symbol timing synchronisation */
 #if defined(SPANDSP_USE_FIXED_POINT)
-    s->symbol_sync_low[0] = 0;
-    s->symbol_sync_low[1] = 0;
-    s->symbol_sync_high[0] = 0;
-    s->symbol_sync_high[1] = 0;
-    s->symbol_sync_dc_filter[0] = 0;
-    s->symbol_sync_dc_filter[1] = 0;
+    for (i = 0;  i < 2;  i++)
+    {
+        s->symbol_sync_low[i] = 0;
+        s->symbol_sync_high[i] = 0;
+        s->symbol_sync_dc_filter[i] = 0;
+    }
     s->baud_phase = 0;
 #else
-    s->symbol_sync_low[0] = 0.0f;
-    s->symbol_sync_low[1] = 0.0f;
-    s->symbol_sync_high[0] = 0.0f;
-    s->symbol_sync_high[1] = 0.0f;
-    s->symbol_sync_dc_filter[0] = 0.0f;
-    s->symbol_sync_dc_filter[1] = 0.0f;
+    for (i = 0;  i < 2;  i++)
+    {
+        s->symbol_sync_low[i] = 0.0f;
+        s->symbol_sync_high[i] = 0.0f;
+        s->symbol_sync_dc_filter[i] = 0.0f;
+    }
     s->baud_phase = 0.0f;
 #endif
     s->baud_half = 0;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v42.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v42.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v42.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v42.c,v 1.50 2009/02/10 13:06:47 steveu Exp $
+ * $Id: v42.c,v 1.51 2009/11/04 15:52:06 steveu Exp $
  */
 
 /* THIS IS A WORK IN PROGRESS. IT IS NOT FINISHED. */
@@ -1138,11 +1138,11 @@
             break;
         /*endif*/
         s->rxstream &= 0x3FF;
-        if (s->caller  &&  s->rxstream == 0x145)
+        if (s->calling_party  &&  s->rxstream == 0x145)
         {
             s->rx_negotiation_step++;
         }
-        else if (!s->caller  &&  s->rxstream == 0x111)
+        else if (!s->calling_party  &&  s->rxstream == 0x111)
         {
             s->rx_negotiation_step++;
         }
@@ -1174,15 +1174,15 @@
             break;
         /*endif*/
         s->rxstream &= 0x3FF;
-        if (s->caller  &&  s->rxstream == 0x185)
+        if (s->calling_party  &&  s->rxstream == 0x185)
         {
             s->rx_negotiation_step++;
         }
-        else if (s->caller  &&  s->rxstream == 0x001)
+        else if (s->calling_party  &&  s->rxstream == 0x001)
         {
             s->rx_negotiation_step++;
         }
-        else if (!s->caller  &&  s->rxstream == 0x113)
+        else if (!s->calling_party  &&  s->rxstream == 0x113)
         {
             s->rx_negotiation_step++;
         }
@@ -1206,7 +1206,7 @@
             {
                 /* HIT */
                 s->rx_negotiation_step++;
-                if (s->caller)
+                if (s->calling_party)
                 {
                     if (s->t400_timer >= 0)
                     {
@@ -1252,7 +1252,7 @@
 {
     int bit;
 
-    if (s->caller)
+    if (s->calling_party)
     {
         if (s->txbits <= 0)
         {
@@ -1355,7 +1355,7 @@
 {
     span_schedule_init(&s->lapm.sched);
 
-    s->lapm.we_are_originator = s->caller;
+    s->lapm.we_are_originator = s->calling_party;
     lapm_restart(&s->lapm);
     if (s->detect)
     {
@@ -1379,7 +1379,7 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-SPAN_DECLARE(v42_state_t *) v42_init(v42_state_t *s, int caller, int detect, v42_frame_handler_t frame_handler, void *user_data)
+SPAN_DECLARE(v42_state_t *) v42_init(v42_state_t *s, int calling_party, int detect, v42_frame_handler_t frame_handler, void *user_data)
 {
     int alloced;
     
@@ -1394,7 +1394,7 @@
         alloced = TRUE;
     }
     memset(s, 0, sizeof(*s));
-    s->caller = caller;
+    s->calling_party = calling_party;
     s->detect = detect;
     s->lapm.iframe_receive = frame_handler;
     s->lapm.iframe_receive_user_data = user_data;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v8.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v8.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/v8.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v8.c,v 1.39 2009/06/24 00:34:38 steveu Exp $
+ * $Id: v8.c,v 1.42.4.3 2009/12/28 12:20:47 steveu Exp $
  */
  
 /*! \file */
@@ -47,6 +47,7 @@
 #include "spandsp/logging.h"
 #include "spandsp/queue.h"
 #include "spandsp/async.h"
+#include "spandsp/vector_int.h"
 #include "spandsp/complex.h"
 #include "spandsp/dds.h"
 #include "spandsp/tone_detect.h"
@@ -62,12 +63,9 @@
 #include "spandsp/private/modem_connect_tones.h"
 #include "spandsp/private/v8.h"
 
-#define ms_to_samples(t)    (((t)*SAMPLE_RATE)/1000)
-
 enum
 {
     V8_WAIT_1S,
-    V8_CI,
     V8_CI_ON,
     V8_CI_OFF,
     V8_HEARD_ANSAM,
@@ -76,7 +74,6 @@
     V8_CM_WAIT,
 
     V8_SIGC,
-    V8_WAIT_200MS,
     V8_JM_ON,
     V8_SIGA,
 
@@ -91,6 +88,23 @@
     V8_SYNC_V92
 } v8_sync_types_e;
 
+enum
+{
+    V8_CALL_FUNCTION_TAG = 0x01,
+    V8_MODULATION_TAG = 0x05,
+    V8_PROTOCOLS_TAG = 0x0A,
+    V8_PSTN_ACCESS_TAG = 0x0D,
+    V8_NSF_TAG = 0x0F,
+    V8_PCM_MODEM_AVAILABILITY_TAG = 0x07,
+    V8_T66_TAG = 0x0E
+};
+
+enum
+{
+    V8_CI_SYNC_OCTET = 0x00,
+    V8_CM_JM_SYNC_OCTET = 0xE0
+};
+
 SPAN_DECLARE(const char *) v8_call_function_to_str(int call_function)
 {
     switch (call_function)
@@ -172,16 +186,89 @@
 
 SPAN_DECLARE(const char *) v8_pstn_access_to_str(int pstn_access)
 {
+    switch (pstn_access)
+    {
+    case V8_PSTN_ACCESS_CALL_DCE_CELLULAR:
+        return "Calling modem on cellular";
+    case V8_PSTN_ACCESS_ANSWER_DCE_CELLULAR:
+        return "Answering modem on cellular";
+    case V8_PSTN_ACCESS_ANSWER_DCE_CELLULAR | V8_PSTN_ACCESS_CALL_DCE_CELLULAR:
+        return "Answering and calling modems on cellular";
+    case V8_PSTN_ACCESS_DCE_ON_DIGITAL:
+        return "DCE on digital";
+    case V8_PSTN_ACCESS_DCE_ON_DIGITAL | V8_PSTN_ACCESS_CALL_DCE_CELLULAR:
+        return "DCE on digital, and calling modem on cellular";
+    case V8_PSTN_ACCESS_DCE_ON_DIGITAL | V8_PSTN_ACCESS_ANSWER_DCE_CELLULAR:
+        return "DCE on digital, answering modem on cellular";
+    case V8_PSTN_ACCESS_DCE_ON_DIGITAL | V8_PSTN_ACCESS_ANSWER_DCE_CELLULAR | V8_PSTN_ACCESS_CALL_DCE_CELLULAR:
+        return "DCE on digital, and answering and calling modems on cellular";
+    }
     return "???";
 }
 /*- End of function --------------------------------------------------------*/
 
+SPAN_DECLARE(const char *) v8_nsf_to_str(int nsf)
+{
+    switch (nsf)
+    {
+    case 0:
+        return "???";
+    }
+    return "???";
+}
+/*- End of function --------------------------------------------------------*/
+
 SPAN_DECLARE(const char *) v8_pcm_modem_availability_to_str(int pcm_modem_availability)
 {
+    switch (pcm_modem_availability)
+    {
+    case 0:
+        return "PCM unavailable";
+    case V8_PSTN_PCM_MODEM_V90_V92_ANALOGUE:
+        return "V.90/V.92 analogue available";
+    case V8_PSTN_PCM_MODEM_V90_V92_DIGITAL:
+        return "V.90/V.92 digital available";
+    case V8_PSTN_PCM_MODEM_V90_V92_DIGITAL | V8_PSTN_PCM_MODEM_V90_V92_ANALOGUE:
+        return "V.90/V.92 digital/analogue available";
+    case V8_PSTN_PCM_MODEM_V91:
+        return "V.91 available";
+    case V8_PSTN_PCM_MODEM_V91 | V8_PSTN_PCM_MODEM_V90_V92_ANALOGUE:
+        return "V.91 and V.90/V.92 analogue available";
+    case V8_PSTN_PCM_MODEM_V91 | V8_PSTN_PCM_MODEM_V90_V92_DIGITAL:
+        return "V.91 and V.90/V.92 digital available";
+    case V8_PSTN_PCM_MODEM_V91 | V8_PSTN_PCM_MODEM_V90_V92_DIGITAL | V8_PSTN_PCM_MODEM_V90_V92_ANALOGUE:
+        return "V.91 and V.90/V.92 digital/analogue available";
+    }
     return "???";
 }
 /*- End of function --------------------------------------------------------*/
 
+SPAN_DECLARE(const char *) v8_t66_to_str(int t66)
+{
+    /* T.66 doesn't really define any V.8 values. The bits are all reserved. */
+    switch (t66)
+    {
+    case 0:
+        return "???";
+    case 1:
+        return "Reserved TIA";
+    case 2:
+        return "Reserved";
+    case 3:
+        return "Reserved TIA + others";
+    case 4:
+        return "Reserved";
+    case 5:
+        return "Reserved TIA + others";
+    case 6:
+        return "Reserved";
+    case 7:
+        return "Reserved TIA + others";
+    }
+    return "???";
+}
+/*- End of function --------------------------------------------------------*/
+
 SPAN_DECLARE(void) v8_log_supported_modulations(v8_state_t *s, int modulation_schemes)
 {
     const char *comma;
@@ -203,18 +290,15 @@
 
 static const uint8_t *process_call_function(v8_state_t *s, const uint8_t *p)
 {
-    int call_function;
-
-    call_function = (*p >> 5) & 0x07;
-    span_log(&s->logging, SPAN_LOG_FLOW, "%s\n", v8_call_function_to_str(call_function));
-    s->call_function = call_function;
+    s->result.call_function = (*p >> 5) & 0x07;
+    span_log(&s->logging, SPAN_LOG_FLOW, "%s\n", v8_call_function_to_str(s->result.call_function));
     return ++p;
 }
 /*- End of function --------------------------------------------------------*/
 
 static const uint8_t *process_modulation_mode(v8_state_t *s, const uint8_t *p)
 {
-    int far_end_modulations;
+    unsigned int far_end_modulations;
 
     /* Modulation mode octet */
     far_end_modulations = 0;
@@ -225,6 +309,7 @@
     if (*p & 0x20)
         far_end_modulations |= V8_MOD_V90;
 
+    /* Check for an extension octet */
     if ((*++p & 0x38) == 0x10)
     {
         if (*p & 0x80)
@@ -238,6 +323,7 @@
         if (*p & 0x01)
             far_end_modulations |= V8_MOD_V32;
 
+        /* Check for an extension octet */
         if ((*++p & 0x38) == 0x10)
         {
             if (*p & 0x80)
@@ -250,77 +336,58 @@
                 far_end_modulations |= V8_MOD_V26BIS;
             if (*p & 0x01)
                 far_end_modulations |= V8_MOD_V26TER;
-            /* Skip any future extensions we do not understand */
-            while  ((*++p & 0x38) == 0x10)
-                /* dummy loop */;
         }
     }
-    s->far_end_modulations = far_end_modulations;
-    v8_log_supported_modulations(s, s->far_end_modulations);
+    s->far_end_modulations =
+    s->result.modulations = far_end_modulations;
+    v8_log_supported_modulations(s, far_end_modulations);
     return ++p;
 }
 /*- End of function --------------------------------------------------------*/
 
 static const uint8_t *process_protocols(v8_state_t *s, const uint8_t *p)
 {
-    int protocol;
-
-    protocol = (*p >> 5) & 0x07;
-    span_log(&s->logging, SPAN_LOG_FLOW, "%s\n", v8_protocol_to_str(protocol));
-    s->protocol = protocol;
+    s->result.protocol = (*p >> 5) & 0x07;
+    span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, "%s\n", v8_protocol_to_str(s->result.protocol));
     return ++p;
 }
 /*- End of function --------------------------------------------------------*/
 
 static const uint8_t *process_pstn_access(v8_state_t *s, const uint8_t *p)
 {
-    int pstn_access;
-
-    pstn_access = (*p >> 5) & 0x07;
-    if (pstn_access & V8_PSTN_ACCESS_DCE_ON_DIGTIAL)
-        span_log(&s->logging, SPAN_LOG_FLOW, "DCE on digital network connection\n");
-    else
-        span_log(&s->logging, SPAN_LOG_FLOW, "DCE on analogue network connection\n");
-    if (pstn_access & V8_PSTN_ACCESS_ANSWER_DCE_CELLULAR)
-        span_log(&s->logging, SPAN_LOG_FLOW, "Answer DCE on cellular connection\n");
-    if (pstn_access & V8_PSTN_ACCESS_CALL_DCE_CELLULAR)
-        span_log(&s->logging, SPAN_LOG_FLOW, "Call DCE on cellular connection\n");
+    s->result.pstn_access = (*p >> 5) & 0x07;
+    span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, "%s\n", v8_pstn_access_to_str(s->result.pstn_access));
     return ++p;
 }
 /*- End of function --------------------------------------------------------*/
 
 static const uint8_t *process_non_standard_facilities(v8_state_t *s, const uint8_t *p)
 {
-    ++p;
-    p += *p;
+    s->result.nsf = (*p >> 5) & 0x07;
+    span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, "%s\n", v8_nsf_to_str(s->result.nsf));
     return p;
 }
 /*- End of function --------------------------------------------------------*/
 
 static const uint8_t *process_pcm_modem_availability(v8_state_t *s, const uint8_t *p)
 {
-    int pcm_availability;
-
-    pcm_availability = (*p >> 5) & 0x07;
-    if (pcm_availability & V8_PSTN_PCM_MODEM_V91)
-        span_log(&s->logging, SPAN_LOG_FLOW, "V.91 available\n");
-    if (pcm_availability & V8_PSTN_PCM_MODEM_V90_V92_DIGITAL)
-        span_log(&s->logging, SPAN_LOG_FLOW, "V.90 or V.92 digital modem available\n");
-    if (pcm_availability & V8_PSTN_PCM_MODEM_V90_V92_ANALOGUE)
-        span_log(&s->logging, SPAN_LOG_FLOW, "V.90 or V.92 analogue modem available\n");
+    s->result.pcm_modem_availability = (*p >> 5) & 0x07;
+    span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, "%s\n", v8_pcm_modem_availability_to_str(s->result.pcm_modem_availability));
     return ++p;
 }
 /*- End of function --------------------------------------------------------*/
 
 static const uint8_t *process_t66(v8_state_t *s, const uint8_t *p)
 {
+    s->result.t66 = (*p >> 5) & 0x07;
+    span_log(&s->logging, SPAN_LOG_FLOW | SPAN_LOG_SUPPRESS_LABELLING, "%s\n", v8_t66_to_str(s->result.t66));
     return ++p;
 }
 /*- End of function --------------------------------------------------------*/
 
 static void ci_decode(v8_state_t *s)
 {
-    if ((s->rx_data[0] & 0x1F) == 0x01)
+    if ((s->rx_data[0] & 0x1F) == V8_CALL_FUNCTION_TAG)
         process_call_function(s, &s->rx_data[0]);
 }
 /*- End of function --------------------------------------------------------*/
@@ -333,57 +400,60 @@
         return;
 
     /* We must receive two consecutive identical CM or JM sequences to accept it. */
-    if (s->cm_jm_count <= 0
+    if (s->cm_jm_len <= 0
         ||
-        s->cm_jm_count != s->rx_data_ptr
+        s->cm_jm_len != s->rx_data_ptr
         ||
         memcmp(s->cm_jm_data, s->rx_data, s->rx_data_ptr))
     {
         /* Save the current CM or JM sequence */
-        s->cm_jm_count = s->rx_data_ptr;
+        s->cm_jm_len = s->rx_data_ptr;
         memcpy(s->cm_jm_data, s->rx_data, s->rx_data_ptr);
         return;
     }
-    /* We have a pair of matching CMs or JMs */
+    /* We have a matching pair of CMs or JMs, so we are happy this is correct. */
     s->got_cm_jm = TRUE;
 
     span_log(&s->logging, SPAN_LOG_FLOW, "Decoding\n");
 
     /* Zero indicates the end */
-    s->cm_jm_data[s->cm_jm_count] = 0;
+    s->cm_jm_data[s->cm_jm_len] = 0;
 
-    s->far_end_modulations = 0;
+    s->result.modulations = 0;
     p = s->cm_jm_data;
 
     while (*p)
     {
         switch (*p & 0x1F)
         {
-        case 0x01:
+        case V8_CALL_FUNCTION_TAG:
             p = process_call_function(s, p);
             break;
-        case 0x05:
+        case V8_MODULATION_TAG:
             p = process_modulation_mode(s, p);
             break;
-        case 0x0A:
+        case V8_PROTOCOLS_TAG:
             p = process_protocols(s, p);
             break;
-        case 0x0D:
+        case V8_PSTN_ACCESS_TAG:
             p = process_pstn_access(s, p);
             break;
-        case 0x0F:
+        case V8_NSF_TAG:
             p = process_non_standard_facilities(s, p);
             break;
-        case 0x07:
+        case V8_PCM_MODEM_AVAILABILITY_TAG:
             p = process_pcm_modem_availability(s, p);
             break;
-        case 0x0E:
+        case V8_T66_TAG:
             p = process_t66(s, p);
             break;
         default:
             p++;
             break;
         }
+        /* Skip any future extensions we do not understand */
+        while ((*p & 0x38) == 0x10)
+            p++;
     }
 }
 /*- End of function --------------------------------------------------------*/
@@ -411,43 +481,60 @@
         }
         return;
     }
+    //span_log(&s->logging, SPAN_LOG_FLOW, "Bit %d\n", bit);
     /* Wait until we sync. */
     s->bit_stream = (s->bit_stream >> 1) | (bit << 19);
-    if (s->bit_stream == 0x803FF)
+    /* CI preamble is 10 ones then a framed 0x00
+       CM/JM preamble is 10 ones then a framed 0x07
+       V.92 preamble is 10 ones then a framed 0x55
+       Should we look at all 10 ones? The first couple might be
+       settling down. */
+    /* The preamble + synchronisation bit sequence should be unique in
+       any bit stream, so we can rely on seeing this at any time as being
+       a real sync code. */
+    switch (s->bit_stream)
+    {
+    case 0x803FF:
         new_preamble_type = V8_SYNC_CI;
-    else if (s->bit_stream == 0xF03FF)
+        break;
+    case 0xF03FF:
         new_preamble_type = V8_SYNC_CM_JM;
-    else if (s->bit_stream == 0xAABFF)
+        break;
+    case 0xAABFF:
         new_preamble_type = V8_SYNC_V92;
-    else
+        break;
+    default:
         new_preamble_type = V8_SYNC_UNKNOWN;
-    if (new_preamble_type)
+        break;
+    }
+    if (new_preamble_type != V8_SYNC_UNKNOWN)
     {
+        /* We have seen a fresh sync code */
         /* Debug */
         if (span_log_test(&s->logging, SPAN_LOG_FLOW))
         {
-            if (s->preamble_type == V8_SYNC_CI)
+            if (s->preamble_type != V8_SYNC_UNKNOWN)
             {
-                tag = "CI: ";
+                switch (s->preamble_type)
+                {
+                case V8_SYNC_CI:
+                    tag = "CI: ";
+                    break;
+                case V8_SYNC_CM_JM:
+                    tag = (s->calling_party)  ?  "JM: "  :  "CM: ";
+                    break;
+                case V8_SYNC_V92:
+                    tag = "V92: ";
+                    break;
+                default:
+                    tag = "??: ";
+                    break;
+                }
+                span_log_buf(&s->logging, SPAN_LOG_FLOW, tag, s->rx_data, s->rx_data_ptr);
             }
-            else if (s->preamble_type == V8_SYNC_CM_JM)
-            {
-                if (s->caller)
-                    tag = "JM: ";
-                else
-                    tag = "CM: ";
-            }
-            else if (s->preamble_type == V8_SYNC_V92)
-            {
-                tag = "V92: ";
-            }
-            else
-            {
-                tag = "??: ";
-            }
-            span_log_buf(&s->logging, SPAN_LOG_FLOW, tag, s->rx_data, s->rx_data_ptr);
         }
-        /* Decode previous sequence */
+        /* If we were handling a valid sync code then we should process what has been
+           received to date. */
         switch (s->preamble_type)
         {
         case V8_SYNC_CI:
@@ -462,16 +549,16 @@
         s->rx_data_ptr = 0;
     }
     
-    /* Parse octets with 1 bit start, 1 bit stop */
-    if (s->preamble_type)
+    if (s->preamble_type != V8_SYNC_UNKNOWN)
     {
+        /* Parse octets with 1 bit start, 1 bit stop */
         s->bit_cnt++;
         /* Start, stop? */
         if ((s->bit_stream & 0x80400) == 0x80000  &&  s->bit_cnt >= 10)
         {
             /* Store the available data */
             data = (uint8_t) ((s->bit_stream >> 11) & 0xFF);
-            /* CJ detection */
+            /* CJ (3 successive zero octets) detection */
             if (data == 0)
             {
                 if (++s->zero_byte_count == 3)
@@ -492,13 +579,15 @@
 
 static void v8_decode_init(v8_state_t *s)
 {
-    if (s->caller)
-        fsk_rx_init(&s->v21rx, &preset_fsk_specs[FSK_V21CH2], FALSE, put_bit, s);
-    else
-        fsk_rx_init(&s->v21rx, &preset_fsk_specs[FSK_V21CH1], FALSE, put_bit, s);
-    s->preamble_type = 0;
+    fsk_rx_init(&s->v21rx,
+                &preset_fsk_specs[(s->calling_party)  ?  FSK_V21CH2  :  FSK_V21CH1],
+                FSK_FRAME_MODE_ASYNC,
+                put_bit,
+                s);
+    fsk_rx_signal_cutoff(&s->v21rx, -45.5f);
+    s->preamble_type = V8_SYNC_UNKNOWN;
     s->bit_stream = 0;
-    s->cm_jm_count = 0;
+    s->cm_jm_len = 0;
     s->got_cm_jm = FALSE;
     s->got_cj = FALSE;
     s->zero_byte_count = 0;
@@ -513,11 +602,22 @@
 
     s = user_data;
     if (queue_read(s->tx_queue, &bit, 1) <= 0)
-        bit = 1;
+        return SIG_STATUS_END_OF_DATA;
     return bit;
 }
 /*- End of function --------------------------------------------------------*/
 
+static void v8_put_preamble(v8_state_t *s)
+{
+    static const uint8_t preamble[10] =
+    {
+        1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+    };
+
+    queue_write(s->tx_queue, preamble, 10);
+}
+/*- End of function --------------------------------------------------------*/
+
 static void v8_put_byte(v8_state_t *s, int data)
 {
     int i;
@@ -535,155 +635,190 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static void send_cm_jm(v8_state_t *s, int mod_mask)
+static void send_cm_jm(v8_state_t *s)
 {
     int val;
-    static const uint8_t preamble[20] =
-    {
-        /* 10 1's (0x3FF), then 10 bits of CM sync (0x00F) */
-        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1
-    };
+    unsigned int offered_modulations;
+    
+    offered_modulations = s->parms.modulations & s->far_end_modulations;
 
     /* Send a CM, or a JM as appropriate */
-    queue_write(s->tx_queue, preamble, 20);
-    
+    v8_put_preamble(s);
+    v8_put_byte(s, V8_CM_JM_SYNC_OCTET);
     /* Data call */
-    v8_put_byte(s, (V8_CALL_V_SERIES << 5) | 0x01);
+    v8_put_byte(s, (s->result.call_function << 5) | V8_CALL_FUNCTION_TAG);
     
     /* Supported modulations */
     val = 0x05;
-    if (mod_mask & V8_MOD_V90)
+    if (offered_modulations & V8_MOD_V90)
         val |= 0x20;
-    if (mod_mask & V8_MOD_V34)
+    if (offered_modulations & V8_MOD_V34)
         val |= 0x40;
     v8_put_byte(s, val);
 
     val = 0x10;
-    if (mod_mask & V8_MOD_V32)
+    if (offered_modulations & V8_MOD_V32)
         val |= 0x01;
-    if (mod_mask & V8_MOD_V22)
+    if (offered_modulations & V8_MOD_V22)
         val |= 0x02;
-    if (mod_mask & V8_MOD_V17)
+    if (offered_modulations & V8_MOD_V17)
         val |= 0x04;
-    if (mod_mask & V8_MOD_V29)
+    if (offered_modulations & V8_MOD_V29)
         val |= 0x40;
-    if (mod_mask & V8_MOD_V27TER)
+    if (offered_modulations & V8_MOD_V27TER)
         val |= 0x80;
     v8_put_byte(s, val);
 
     val = 0x10;
-    if (mod_mask & V8_MOD_V26TER)
+    if (offered_modulations & V8_MOD_V26TER)
         val |= 0x01;
-    if (mod_mask & V8_MOD_V26BIS)
+    if (offered_modulations & V8_MOD_V26BIS)
         val |= 0x02;
-    if (mod_mask & V8_MOD_V23)
+    if (offered_modulations & V8_MOD_V23)
         val |= 0x04;
-    if (mod_mask & V8_MOD_V23HALF)
+    if (offered_modulations & V8_MOD_V23HALF)
         val |= 0x40;
-    if (mod_mask & V8_MOD_V21)
+    if (offered_modulations & V8_MOD_V21)
         val |= 0x80;
     v8_put_byte(s, val);
 
-    v8_put_byte(s, (0 << 5) | 0x07);
+    if (s->parms.protocol)
+        v8_put_byte(s, (s->parms.protocol << 5) | V8_PROTOCOLS_TAG);
+    if (s->parms.pcm_modem_availability)
+        v8_put_byte(s, (s->parms.pcm_modem_availability << 5) | V8_PCM_MODEM_AVAILABILITY_TAG);
+    if (s->parms.pstn_access)
+        v8_put_byte(s, (s->parms.pstn_access << 5) | V8_PSTN_ACCESS_TAG);
+    if (s->parms.t66 >= 0)
+        v8_put_byte(s, (s->parms.t66 << 5) | V8_T66_TAG);
 
-    v8_put_byte(s, (V8_PROTOCOL_LAPM_V42 << 5) | 0x0A);
-
-    /* No cellular right now */    
-    v8_put_byte(s, (0 << 5) | 0x0D);
+    /* No NSF */
+    //v8_put_byte(s, (0 << 5) | V8_NSF_TAG);
 }
 /*- End of function --------------------------------------------------------*/
 
-static int select_modulation(int mask)
-{
-    if (mask & V8_MOD_V90)
-        return V8_MOD_V90;
-    if (mask & V8_MOD_V34)
-        return V8_MOD_V34;
-    if (mask & V8_MOD_V32)
-        return V8_MOD_V32;
-    if (mask & V8_MOD_V23)
-        return V8_MOD_V23;
-    if (mask & V8_MOD_V21)
-        return V8_MOD_V21;
-    return V8_MOD_FAILED;
-}
-/*- End of function --------------------------------------------------------*/
-
 SPAN_DECLARE_NONSTD(int) v8_tx(v8_state_t *s, int16_t *amp, int max_len)
 {
     int len;
 
     //span_log(&s->logging, SPAN_LOG_FLOW, "v8_tx state %d\n", s->state);
     len = 0;
-    switch (s->state)
+    if (s->modem_connect_tone_tx_on)
     {
-    case V8_CI_ON:
-    case V8_CM_ON:
-    case V8_JM_ON:
-    case V8_CJ_ON:
-        len = fsk_tx(&s->v21tx, amp, max_len);
-        break;
-    case V8_CM_WAIT:
-        /* Send the ANSam tone */
-        len = modem_connect_tones_tx(&s->ansam_tx, amp, max_len);
-        break;
+        if (s->modem_connect_tone_tx_on > ms_to_samples(75))
+        {
+            /* Send the ANSam tone */
+            len = modem_connect_tones_tx(&s->ansam_tx, amp, max_len);
+            if (len < max_len)
+            {
+                span_log(&s->logging, SPAN_LOG_FLOW, "ANSam or ANSam/ ended\n");
+                s->modem_connect_tone_tx_on = ms_to_samples(75);
+            }
+        }
+        else
+        {
+            /* Send the 75ms of silence after the ANSam tone */
+            if (max_len > s->modem_connect_tone_tx_on)
+                len = s->modem_connect_tone_tx_on;
+            else
+                len = max_len;
+            vec_zeroi16(amp, len);
+            s->modem_connect_tone_tx_on -= len;
+        }
     }
+    if (s->fsk_tx_on  &&  len < max_len)
+    {
+        max_len -= len;
+        len = fsk_tx(&s->v21tx, amp + len, max_len);
+        if (len < max_len)
+        {
+            span_log(&s->logging, SPAN_LOG_FLOW, "FSK ends\n");
+            s->fsk_tx_on = FALSE;
+        }
+    }
     return len;
 }
 /*- End of function --------------------------------------------------------*/
 
+static void v8_send_ci(v8_state_t *s)
+{
+    int i;
+
+    /* Send 4 CI packets in a burst (the spec says at least 3) */
+    for (i = 0;  i < 4;  i++)
+    {
+        v8_put_preamble(s);
+        v8_put_byte(s, V8_CI_SYNC_OCTET);
+        v8_put_byte(s, (s->result.call_function << 5) | V8_CALL_FUNCTION_TAG);
+    }
+}
+/*- End of function --------------------------------------------------------*/
+
+static void handle_modem_connect_tone(v8_state_t *s, int tone)
+{
+    s->result.modem_connect_tone = tone;
+    span_log(&s->logging, SPAN_LOG_FLOW, "'%s' recognised\n", modem_connect_tone_to_str(tone));
+    if (tone == MODEM_CONNECT_TONES_ANSAM
+        ||
+        tone == MODEM_CONNECT_TONES_ANSAM_PR)
+    {
+        /* Set the Te interval. The spec. says 500ms is the minimum,
+           but gives reasons why 1 second is a better value. */
+        s->state = V8_HEARD_ANSAM;
+        s->ci_timer = ms_to_samples(1000);
+    }
+    else
+    {
+        /* If we found a connect tone, and it isn't one of the modulated answer tones,
+           indicating V.8 startup, we are not going to do V.8 processing. */
+        span_log(&s->logging, SPAN_LOG_FLOW, "Non-V.8 modem connect tone detected\n");
+        s->state = V8_PARKED;
+        if (s->result_handler)
+            s->result_handler(s->result_handler_user_data, &s->result);
+    }
+}
+/*- End of function --------------------------------------------------------*/
+
 SPAN_DECLARE_NONSTD(int) v8_rx(v8_state_t *s, const int16_t *amp, int len)
 {
     int i;
     int residual_samples;
-    v8_result_t result;
-    static const uint8_t preamble[20] =
-    {
-        /* 10 1's (0x3FF), then 10 bits of CI sync (0x001) */
-        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
-    };
+    int tone;
 
     //span_log(&s->logging, SPAN_LOG_FLOW, "v8_rx state %d\n", s->state);
     residual_samples = 0;
     switch (s->state)
     {
     case V8_WAIT_1S:
+        residual_samples = modem_connect_tones_rx(&s->ansam_rx, amp, len);
         /* Wait 1 second before sending the first CI packet */
         if ((s->negotiation_timer -= len) > 0)
             break;
-        s->state = V8_CI;
-        s->ci_count = 0;
-        modem_connect_tones_rx_init(&s->ansam_rx, MODEM_CONNECT_TONES_ANS_PR, NULL, NULL);
-        fsk_tx_init(&s->v21tx, &preset_fsk_specs[FSK_V21CH1], get_bit, s);
-        /* Fall through to the next state */
-    case V8_CI:
-        residual_samples = modem_connect_tones_rx(&s->ansam_rx, amp, len);
-        /* Send 4 CI packets in a burst (the spec says at least 3) */
-        for (i = 0;  i < 4;  i++)
-        {
-            /* 10 1's (0x3FF), then CI sync (0x001) */
-            queue_write(s->tx_queue, preamble, 20);
-            v8_put_byte(s, (V8_CALL_V_SERIES << 5) | 0x01);
-        }
+        fsk_tx_restart(&s->v21tx, &preset_fsk_specs[FSK_V21CH1]);
+        v8_send_ci(s);
         s->state = V8_CI_ON;
+        s->fsk_tx_on = TRUE;
         break;
     case V8_CI_ON:
         residual_samples = modem_connect_tones_rx(&s->ansam_rx, amp, len);
+        /* Check if an ANSam or ANSam/ tone has been detected */
+        if ((tone = modem_connect_tones_rx_get(&s->ansam_rx)) != MODEM_CONNECT_TONES_NONE)
+        {
+            handle_modem_connect_tone(s, tone);
+            break;
+        }
         if (queue_empty(s->tx_queue))
         {
             s->state = V8_CI_OFF;
             s->ci_timer = ms_to_samples(500);
+            break;
         }
         break;
     case V8_CI_OFF:
         residual_samples = modem_connect_tones_rx(&s->ansam_rx, amp, len);
-        /* Check if an ANSam tone has been detected */
-        if (modem_connect_tones_rx_get(&s->ansam_rx))
+        /* Check if an ANSam or ANSam/ tone has been detected */
+        if ((tone = modem_connect_tones_rx_get(&s->ansam_rx)) != MODEM_CONNECT_TONES_NONE)
         {
-            /* Set the Te interval. The spec. says 500ms is the minimum,
-               but gives reasons why 1 second is a better value. */
-            s->ci_timer = ms_to_samples(1000);
-            s->state = V8_HEARD_ANSAM;
+            handle_modem_connect_tone(s, tone);
             break;
         }
         if ((s->ci_timer -= len) <= 0)
@@ -691,6 +826,7 @@
             if (++s->ci_count >= 10)
             {
                 /* The spec says we should give up now. */
+                span_log(&s->logging, SPAN_LOG_FLOW, "Timeout waiting for modem connect tone\n");
                 s->state = V8_PARKED;
                 if (s->result_handler)
                     s->result_handler(s->result_handler_user_data, NULL);
@@ -698,46 +834,52 @@
             else
             {
                 /* Try again */
-                s->state = V8_CI;
+                fsk_tx_restart(&s->v21tx, &preset_fsk_specs[FSK_V21CH1]);
+                v8_send_ci(s);
+                s->state = V8_CI_ON;
+                s->fsk_tx_on = TRUE;
             }
         }
         break;
     case V8_HEARD_ANSAM:
-        /* We have heard the ANSam signal, but we still need to wait for the
+        /* We have heard the ANSam or ANSam/ signal, but we still need to wait for the
            end of the Te timeout period to comply with the spec. */
         if ((s->ci_timer -= len) <= 0)
         {
             v8_decode_init(s);
+            s->negotiation_timer = ms_to_samples(5000);
+            fsk_tx_restart(&s->v21tx, &preset_fsk_specs[FSK_V21CH1]);
+            send_cm_jm(s);
             s->state = V8_CM_ON;
-            s->negotiation_timer = ms_to_samples(5000);
-            send_cm_jm(s, s->available_modulations);
+            s->fsk_tx_on = TRUE;
         }
         break;
     case V8_CM_ON:
         residual_samples = fsk_rx(&s->v21rx, amp, len);
         if (s->got_cm_jm)
         {
-            /* Now JM has been detected we send CJ and wait for 75 ms
+            span_log(&s->logging, SPAN_LOG_FLOW, "JM recognised\n");
+            /* Now JM has been detected, we send CJ and wait for 75 ms
                before finishing the V.8 analysis. */
-            s->negotiated_modulation = select_modulation(s->far_end_modulations);
-
-            queue_flush(s->tx_queue);
-            for (i = 0;  i < 9;  i++)
+            fsk_tx_restart(&s->v21tx, &preset_fsk_specs[FSK_V21CH1]);
+            for (i = 0;  i < 3;  i++)
                 v8_put_byte(s, 0);
             s->state = V8_CJ_ON;
+            s->fsk_tx_on = TRUE;
             break;
         }
         if ((s->negotiation_timer -= len) <= 0)
         {
             /* Timeout */
+            span_log(&s->logging, SPAN_LOG_FLOW, "Timeout waiting for JM\n");
             s->state = V8_PARKED;
             if (s->result_handler)
                 s->result_handler(s->result_handler_user_data, NULL);
         }
-        if (queue_empty(s->tx_queue))
+        if (queue_contents(s->tx_queue) < 10)
         {
             /* Send CM again */
-            send_cm_jm(s, s->available_modulations);
+            send_cm_jm(s);
         }
         break;
     case V8_CJ_ON:
@@ -752,49 +894,34 @@
         if ((s->negotiation_timer -= len) <= 0)
         {
             /* The V.8 negotiation has succeeded. */
+            span_log(&s->logging, SPAN_LOG_FLOW, "Negotiation succeeded\n");
             s->state = V8_PARKED;
             if (s->result_handler)
-            {
-                result.call_function = s->call_function;
-                result.available_modulations = s->far_end_modulations;
-                result.negotiated_modulation = s->negotiated_modulation;
-                result.protocol = s->protocol;
-                result.pstn_access = s->pstn_access;
-                result.nsf_seen = s->nsf_seen;
-                result.pcm_modem_availability = s->pcm_modem_availability;
-                result.t66_seen = s->t66_seen;
-                s->result_handler(s->result_handler_user_data, &result);
-            }
+                s->result_handler(s->result_handler_user_data, &s->result);
         }
         break;
-    case V8_WAIT_200MS:
-        if ((s->negotiation_timer -= len) <= 0)
-        {
-            /* Send the ANSam tone */
-            modem_connect_tones_tx_init(&s->ansam_tx, MODEM_CONNECT_TONES_ANSAM_PR);
-                
-            v8_decode_init(s);
-            s->state = V8_CM_WAIT;
-            s->negotiation_timer = ms_to_samples(5000);
-        }
-        break;
     case V8_CM_WAIT:
         residual_samples = fsk_rx(&s->v21rx, amp, len);
         if (s->got_cm_jm)
         {
-            /* Stop sending ANSam and send JM instead */
+            span_log(&s->logging, SPAN_LOG_FLOW, "CM recognised\n");
+            
+            /* TODO: negotiate if the call function is acceptable */
+            
+            /* Stop sending ANSam or ANSam/ and send JM instead */
             fsk_tx_init(&s->v21tx, &preset_fsk_specs[FSK_V21CH2], get_bit, s);
             /* Set the timeout for JM */
             s->negotiation_timer = ms_to_samples(5000); 
             s->state = V8_JM_ON;
-            s->common_modulations = s->available_modulations & s->far_end_modulations;
-            s->negotiated_modulation = select_modulation(s->common_modulations);
-            send_cm_jm(s, s->common_modulations);
+            send_cm_jm(s);
+            s->modem_connect_tone_tx_on = ms_to_samples(75);
+            s->fsk_tx_on = TRUE;
             break;
         }
         if ((s->negotiation_timer -= len) <= 0)
         {
             /* Timeout */
+            span_log(&s->logging, SPAN_LOG_FLOW, "Timeout waiting for CM\n");
             s->state = V8_PARKED;
             if (s->result_handler)
                 s->result_handler(s->result_handler_user_data, NULL);
@@ -804,7 +931,9 @@
         residual_samples = fsk_rx(&s->v21rx, amp, len);
         if (s->got_cj)
         {
-            /* Stop sending JM, and wait 75 ms */
+            span_log(&s->logging, SPAN_LOG_FLOW, "CJ recognised\n");
+            /* Stop sending JM, flushing anything left in the buffer, and wait 75 ms */
+            queue_flush(s->tx_queue);
             s->negotiation_timer = ms_to_samples(75);
             s->state = V8_SIGA;
             break;
@@ -812,34 +941,26 @@
         if ((s->negotiation_timer -= len) <= 0)
         {
             /* Timeout */
+            span_log(&s->logging, SPAN_LOG_FLOW, "Timeout waiting for CJ\n");
             s->state = V8_PARKED;
             if (s->result_handler)
                 s->result_handler(s->result_handler_user_data, NULL);
             break;
         }
-        if (queue_empty(s->tx_queue))
+        if (queue_contents(s->tx_queue) < 10)
         {
             /* Send JM */
-            send_cm_jm(s, s->common_modulations);
+            send_cm_jm(s);
         }
         break;
     case V8_SIGA:
         if ((s->negotiation_timer -= len) <= 0)
         {
             /* The V.8 negotiation has succeeded. */
+            span_log(&s->logging, SPAN_LOG_FLOW, "Negotiation succeeded\n");
             s->state = V8_PARKED;
             if (s->result_handler)
-            {
-                result.call_function = s->call_function;
-                result.available_modulations = s->far_end_modulations;
-                result.negotiated_modulation = s->negotiated_modulation;
-                result.protocol = s->protocol;
-                result.pstn_access = s->pstn_access;
-                result.nsf_seen = s->nsf_seen;
-                result.pcm_modem_availability = s->pcm_modem_availability;
-                result.t66_seen = s->t66_seen;
-                s->result_handler(s->result_handler_user_data, &result);
-            }
+                s->result_handler(s->result_handler_user_data, &s->result);
         }
         break;
     case V8_PARKED:
@@ -856,9 +977,49 @@
 }
 /*- End of function --------------------------------------------------------*/
 
+SPAN_DECLARE(int) v8_restart(v8_state_t *s,
+                             int calling_party,
+                             v8_parms_t *parms)
+{
+    memcpy(&s->parms, parms, sizeof(s->parms));
+    memset(&s->result, 0, sizeof(s->result));
+
+    s->result.call_function = s->parms.call_function;
+    s->result.nsf = -1;
+    s->result.t66 = -1;
+
+    s->ci_timer = 0;
+    if (calling_party)
+    {
+        s->calling_party = TRUE;
+        s->state = V8_WAIT_1S;
+        s->negotiation_timer = ms_to_samples(1000);
+        s->ci_count = 0;
+        modem_connect_tones_rx_init(&s->ansam_rx, MODEM_CONNECT_TONES_ANS_PR, NULL, NULL);
+        fsk_tx_init(&s->v21tx, &preset_fsk_specs[FSK_V21CH1], get_bit, s);
+    }
+    else
+    {
+        /* Send the ANSam or ANSam/ tone */
+        s->calling_party = FALSE;
+        modem_connect_tones_tx_init(&s->ansam_tx, s->parms.modem_connect_tone);
+                
+        v8_decode_init(s);
+        s->state = V8_CM_WAIT;
+        s->negotiation_timer = ms_to_samples(200 + 5000);
+        s->modem_connect_tone_tx_on = ms_to_samples(75) + 1;
+    }
+    s->result.modem_connect_tone = MODEM_CONNECT_TONES_NONE;
+
+    if ((s->tx_queue = queue_init(NULL, 1024, 0)) == NULL)
+        return -1;
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
 SPAN_DECLARE(v8_state_t *) v8_init(v8_state_t *s,
-                                   int caller,
-                                   int available_modulations,
+                                   int calling_party,
+                                   v8_parms_t *parms,
                                    v8_result_handler_t *result_handler,
                                    void *user_data)
 {
@@ -868,22 +1029,42 @@
             return NULL;
     }
     memset(s, 0, sizeof(*s));
-    s->caller = caller;
-    s->available_modulations = available_modulations;
+    span_log_init(&s->logging, SPAN_LOG_NONE, NULL);
+    span_log_set_protocol(&s->logging, "V.8");
     s->result_handler = result_handler;
     s->result_handler_user_data = user_data;
 
+    v8_restart(s, calling_party, parms);
+
+    memcpy(&s->parms, parms, sizeof(s->parms));
+
+    s->result.call_function = s->parms.call_function;
+    s->result.nsf = -1;
+    s->result.t66 = -1;
+
     s->ci_timer = 0;
-    if (s->caller)
+    if (calling_party)
     {
+        s->calling_party = TRUE;
         s->state = V8_WAIT_1S;
         s->negotiation_timer = ms_to_samples(1000);
+        s->ci_count = 0;
+        modem_connect_tones_rx_init(&s->ansam_rx, MODEM_CONNECT_TONES_ANS_PR, NULL, NULL);
+        fsk_tx_init(&s->v21tx, &preset_fsk_specs[FSK_V21CH1], get_bit, s);
     }
     else
     {
-        s->state = V8_WAIT_200MS;
-        s->negotiation_timer = ms_to_samples(200);
+        /* Send the ANSam or ANSam/ tone */
+        s->calling_party = FALSE;
+        modem_connect_tones_tx_init(&s->ansam_tx, s->parms.modem_connect_tone);
+                
+        v8_decode_init(s);
+        s->state = V8_CM_WAIT;
+        s->negotiation_timer = ms_to_samples(200 + 5000);
+        s->modem_connect_tone_tx_on = ms_to_samples(75) + 1;
     }
+    s->result.modem_connect_tone = MODEM_CONNECT_TONES_NONE;
+
     if ((s->tx_queue = queue_init(NULL, 1024, 0)) == NULL)
         return NULL;
     return s;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/vector_int.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/vector_int.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/src/vector_int.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: vector_int.c,v 1.26 2009/07/12 09:23:09 steveu Exp $
+ * $Id: vector_int.c,v 1.26.4.1 2009/12/28 11:54:59 steveu Exp $
  */
 
 /*! \file */
@@ -53,8 +53,7 @@
 {
     int32_t z;
 
-#if defined(__GNUC__)  &&  defined(SPANDSP_USE_MMX)
-#if defined(__x86_64__)
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_MMX)  &&  defined(__x86_64__)
     __asm__ __volatile__(
         " emms;\n"
         " pxor %%mm0,%%mm0;\n"
@@ -152,7 +151,7 @@
         : "S" (x), "D" (y), "a" (n)
         : "cc"
     );
-#else
+#elif defined(__GNUC__)  &&  defined(SPANDSP_USE_MMX)  &&  defined(__i386__)
     __asm__ __volatile__(
         " emms;\n"
         " pxor %%mm0,%%mm0;\n"
@@ -250,7 +249,6 @@
         : "S" (x), "D" (y), "a" (n)
         : "cc"
     );
-#endif
 #else
     int i;
 
@@ -290,12 +288,11 @@
 
 SPAN_DECLARE(int32_t) vec_min_maxi16(const int16_t x[], int n, int16_t out[])
 {
-#if defined(__GNUC__)  &&  defined(SPANDSP_USE_MMX)
+#if defined(__GNUC__)  &&  defined(SPANDSP_USE_MMX)  &&  defined(__x86_64__)
     static const int32_t lower_bound = 0x80008000;
     static const int32_t upper_bound = 0x7FFF7FFF;
     int32_t max;
 
-#if defined(__x86_64__)
     __asm__ __volatile__(
         " emms;\n"
         " pushq %%rdx;\n"
@@ -443,7 +440,11 @@
         : "S" (x), "a" (n), "d" (out), [lower] "m" (lower_bound), [upper] "m" (upper_bound)
         : "ecx"
     );
-#else
+#elif defined(__GNUC__)  &&  defined(SPANDSP_USE_MMX)  &&  defined(__i386__)
+    static const int32_t lower_bound = 0x80008000;
+    static const int32_t upper_bound = 0x7FFF7FFF;
+    int32_t max;
+
     __asm__ __volatile__(
         " emms;\n"
         " pushl %%edx;\n"
@@ -592,8 +593,6 @@
         : "S" (x), "a" (n), "d" (out), [lower] "m" (lower_bound), [upper] "m" (upper_bound)
         : "ecx"
     );
-#endif
-    return max;
 #else
     int i;
     int16_t min;
@@ -622,8 +621,8 @@
     z = abs(min);
     if (z > max)
         return z;
-    return max;
 #endif
+    return max;
 }
 /*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/at_interpreter_tests.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/at_interpreter_tests.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/at_interpreter_tests.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: at_interpreter_tests.c,v 1.23 2009/05/30 15:23:13 steveu Exp $
+ * $Id: at_interpreter_tests.c,v 1.24 2009/10/09 14:53:57 steveu Exp $
  */
 
 /*! \file */
@@ -234,6 +234,9 @@
     {"AT+ETBM?\r", "\r\n+ETBM:0,0\r\n\r\nOK\r\n"},
     {"AT+EWIND=?\r", "\r\n+EWIND:(1-127),(1-127)\r\n\r\nOK\r\n"},   /* V.250 6.5.7 - Window size */ 
     {"AT+EWIND?\r", "\r\n+EWIND:0,0\r\n\r\nOK\r\n"},
+    {"AT+F34=?\r",  "\r\n+F34:(0-14),(0-14),(0-2),(0-14),(0-14)\r\n\r\nOK\r\n"},
+                                                                    /* T.31 B.6.1 - Initial V.34 rate controls for FAX */
+    {"AT+F34?\r", "\r\n+F34:0,0,0,0,0\r\n\r\nOK\r\n"},
     {"AT+FAR=?\r", "\r\n0,1\r\n\r\nOK\r\n"},                        /* T.31 8.5.1 - Adaptive reception control */ 
     {"AT+FAR?\r", "\r\n0\r\n\r\nOK\r\n"},
     {"AT+FCL=?\r", "\r\n(0-255)\r\n\r\nOK\r\n"},                    /* T.31 8.5.2 - Carrier loss timeout */ 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/fax_decode.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/fax_decode.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/fax_decode.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: fax_decode.c,v 1.57 2009/09/15 14:01:53 steveu Exp $
+ * $Id: fax_decode.c,v 1.58 2009/11/02 13:25:20 steveu Exp $
  */
 
 /*! \page fax_decode_page FAX decoder
@@ -479,7 +479,7 @@
     span_log_set_protocol(&t30_dummy.logging, "T.30");
 
     hdlc_rx_init(&hdlcrx, FALSE, TRUE, 5, hdlc_accept, NULL);
-    fsk = fsk_rx_init(NULL, &preset_fsk_specs[FSK_V21CH2], TRUE, v21_put_bit, NULL);
+    fsk = fsk_rx_init(NULL, &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, v21_put_bit, NULL);
     v17 = v17_rx_init(NULL, 14400, v17_put_bit, NULL);
     v29 = v29_rx_init(NULL, 9600, v29_put_bit, NULL);
     //v29 = v29_rx_init(NULL, 7200, v29_put_bit, NULL);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/fax_tester.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/fax_tester.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/fax_tester.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * License along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: fax_tester.c,v 1.22 2009/02/12 12:38:39 steveu Exp $
+ * $Id: fax_tester.c,v 1.23 2009/11/02 13:25:20 steveu Exp $
  */
 
 /*! \file */
@@ -496,7 +496,7 @@
     case T30_MODEM_V21:
         if (s->flush_handler)
             s->flush_handler(s, s->flush_user_data, 3);
-        fsk_rx_init(&t->v21_rx, &preset_fsk_specs[FSK_V21CH2], TRUE, (put_bit_func_t) hdlc_rx_put_bit, put_bit_user_data);
+        fsk_rx_init(&t->v21_rx, &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) hdlc_rx_put_bit, put_bit_user_data);
         fsk_rx_signal_cutoff(&t->v21_rx, -45.5);
         t->rx_handler = (span_rx_handler_t *) &fsk_rx;
         t->rx_user_data = &t->v21_rx;
@@ -670,7 +670,7 @@
 
     hdlc_rx_init(&s->hdlc_rx, FALSE, FALSE, HDLC_FRAMING_OK_THRESHOLD, hdlc_accept, user_data);
     hdlc_tx_init(&s->hdlc_tx, FALSE, 2, FALSE, hdlc_underflow_handler, user_data);
-    fsk_rx_init(&s->v21_rx, &preset_fsk_specs[FSK_V21CH2], TRUE, (put_bit_func_t) hdlc_rx_put_bit, &s->hdlc_rx);
+    fsk_rx_init(&s->v21_rx, &preset_fsk_specs[FSK_V21CH2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) hdlc_rx_put_bit, &s->hdlc_rx);
     fsk_rx_signal_cutoff(&s->v21_rx, -45.5);
     fsk_tx_init(&s->v21_tx, &preset_fsk_specs[FSK_V21CH2], (get_bit_func_t) hdlc_tx_get_bit, &s->hdlc_tx);
     fsk_tx_set_modem_status_handler(&s->v21_tx, modem_tx_status, user_data);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/fax_utils.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/fax_utils.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/fax_utils.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: fax_utils.c,v 1.3 2009/05/16 03:34:45 steveu Exp $
+ * $Id: fax_utils.c,v 1.3.4.1 2009/12/19 09:47:57 steveu Exp $
  */
 
 #if defined(HAVE_CONFIG_H)
@@ -95,8 +95,8 @@
     printf("%s: ECM %s\n", tag, (t.error_correcting_mode)  ?  "on"  :  "off");
     printf("%s: tx pages %d, rx pages %d\n", tag, t.pages_tx, t.pages_rx);
     printf("%s: pages in the file %d\n", tag, t.pages_in_file);
-    printf("%s: image size %d x %d\n", tag, t.width, t.length);
-    printf("%s: image resolution %d x %d\n", tag, t.x_resolution, t.y_resolution);
+    printf("%s: image size %d pels x %d pels\n", tag, t.width, t.length);
+    printf("%s: image resolution %d pels/m x %d pels/m\n", tag, t.x_resolution, t.y_resolution);
     printf("%s: bad rows %d, longest bad row run %d\n", tag, t.bad_rows, t.longest_bad_row_run);
     printf("%s: bad ECM frames %d\n", tag, t.error_correcting_mode_retries);
     printf("%s: compression type %d\n", tag, t.encoding);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/fsk_tests.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/fsk_tests.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/fsk_tests.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: fsk_tests.c,v 1.58 2009/07/09 13:52:09 steveu Exp $
+ * $Id: fsk_tests.c,v 1.59 2009/11/02 13:25:20 steveu Exp $
  */
 
 /*! \page fsk_tests_page FSK modem tests
@@ -283,7 +283,7 @@
             fprintf(stderr, "    Cannot open audio file '%s'\n", decode_test_file);
             exit(2);
         }
-        caller_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_1], TRUE, put_bit, NULL);
+        caller_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_1], FSK_FRAME_MODE_SYNC, put_bit, NULL);
         fsk_rx_set_modem_status_handler(caller_rx, rx_status, (void *) &caller_rx);
         test_bps = preset_fsk_specs[modem_under_test_1].baud_rate;
 
@@ -306,7 +306,7 @@
     else
     {
         printf("Test cutoff level\n");
-        caller_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_1], TRUE, cutoff_test_put_bit, NULL);
+        caller_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_1], FSK_FRAME_MODE_SYNC, cutoff_test_put_bit, NULL);
         fsk_rx_signal_cutoff(caller_rx, -30.0f);
         fsk_rx_set_modem_status_handler(caller_rx, cutoff_test_rx_status, (void *) &caller_rx);
         on_at = 0;
@@ -370,14 +370,14 @@
         {
             caller_tx = fsk_tx_init(NULL, &preset_fsk_specs[modem_under_test_1], (get_bit_func_t) bert_get_bit, &caller_bert);
             fsk_tx_set_modem_status_handler(caller_tx, tx_status, (void *) &caller_tx);
-            answerer_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_1], TRUE, (put_bit_func_t) bert_put_bit, &answerer_bert);
+            answerer_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_1], FSK_FRAME_MODE_SYNC, (put_bit_func_t) bert_put_bit, &answerer_bert);
             fsk_rx_set_modem_status_handler(answerer_rx, rx_status, (void *) &answerer_rx);
         }
         if (modem_under_test_2 >= 0)
         {
             answerer_tx = fsk_tx_init(NULL, &preset_fsk_specs[modem_under_test_2], (get_bit_func_t) bert_get_bit, &answerer_bert);
             fsk_tx_set_modem_status_handler(answerer_tx, tx_status, (void *) &answerer_tx);
-            caller_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_2], TRUE, (put_bit_func_t) bert_put_bit, &caller_bert);
+            caller_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) bert_put_bit, &caller_bert);
             fsk_rx_set_modem_status_handler(caller_rx, rx_status, (void *) &caller_rx);
         }
         test_bps = preset_fsk_specs[modem_under_test_1].baud_rate;
@@ -477,14 +477,14 @@
                 {
                     caller_tx = fsk_tx_init(NULL, &preset_fsk_specs[modem_under_test_1], (get_bit_func_t) bert_get_bit, &caller_bert);
                     fsk_tx_set_modem_status_handler(caller_tx, tx_status, (void *) &caller_tx);
-                    answerer_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_1], TRUE, (put_bit_func_t) bert_put_bit, &answerer_bert);
+                    answerer_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_1], FSK_FRAME_MODE_SYNC, (put_bit_func_t) bert_put_bit, &answerer_bert);
                     fsk_rx_set_modem_status_handler(answerer_rx, rx_status, (void *) &answerer_rx);
                 }
                 if (modem_under_test_2 >= 0)
                 {
                     answerer_tx = fsk_tx_init(NULL, &preset_fsk_specs[modem_under_test_2], (get_bit_func_t) bert_get_bit, &answerer_bert);
                     fsk_tx_set_modem_status_handler(answerer_tx, tx_status, (void *) &answerer_tx);
-                    caller_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_2], TRUE, (put_bit_func_t) bert_put_bit, &caller_bert);
+                    caller_rx = fsk_rx_init(NULL, &preset_fsk_specs[modem_under_test_2], FSK_FRAME_MODE_SYNC, (put_bit_func_t) bert_put_bit, &caller_bert);
                     fsk_rx_set_modem_status_handler(caller_rx, rx_status, (void *) &caller_rx);
                 }
                 noise_level++;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/modem_connect_tones_tests.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/modem_connect_tones_tests.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/modem_connect_tones_tests.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: modem_connect_tones_tests.c,v 1.30 2009/05/30 15:23:14 steveu Exp $
+ * $Id: modem_connect_tones_tests.c,v 1.32 2009/11/02 15:04:15 steveu Exp $
  */
 
 /*! \page modem_connect_tones_tests_page Modem connect tones tests
@@ -61,11 +61,21 @@
 #define FALSE 0
 #define TRUE (!FALSE)
 
-#define LEVEL_MAX                   0
+#define LEVEL_MAX                   -5
 #define LEVEL_MIN                   -48
 #define LEVEL_MIN_ACCEPT            -43
 #define LEVEL_MIN_REJECT            -44
 
+/* The 1100Hz tone is supposed to be within 38Hz, according to T.30. Allow another 8Hz for FDM, even though
+   you rarely see that used today. */
+#define CED_FREQ_TOLERANCE          (38 + 8)
+#define CED_FREQ_BLACKOUT           (80)
+/* The 2100Hz tone is supposed to be within 15Hz, according to T.30. Allow another 8Hz for FDM, even though
+   you rarely see that used today. */
+#define CNG_FREQ_TOLERANCE          (15 + 8)
+#define CNG_FREQ_BLACKOUT           (80)
+#define AM_FREQ_TOLERANCE           (1)
+
 const char *bellcore_files[] =
 {
     MITEL_DIR    "mitel-cm7291-talkoff.wav",
@@ -88,13 +98,21 @@
     PERFORM_TEST_2A = (1 << 6),
     PERFORM_TEST_2B = (1 << 7),
     PERFORM_TEST_2C = (1 << 8),
-    PERFORM_TEST_3A = (1 << 9),
-    PERFORM_TEST_3B = (1 << 10),
-    PERFORM_TEST_3C = (1 << 11),
-    PERFORM_TEST_4 = (1 << 12),
-    PERFORM_TEST_5A = (1 << 13),
-    PERFORM_TEST_5B = (1 << 14),
-    PERFORM_TEST_6 = (1 << 15)
+    PERFORM_TEST_2D = (1 << 9),
+    PERFORM_TEST_2E = (1 << 10),
+    PERFORM_TEST_3A = (1 << 11),
+    PERFORM_TEST_3B = (1 << 12),
+    PERFORM_TEST_3C = (1 << 13),
+    PERFORM_TEST_3D = (1 << 14),
+    PERFORM_TEST_3E = (1 << 15),
+    PERFORM_TEST_4 = (1 << 16),
+    PERFORM_TEST_5A = (1 << 17),
+    PERFORM_TEST_5B = (1 << 18),
+    PERFORM_TEST_6A = (1 << 19),
+    PERFORM_TEST_6B = (1 << 20),
+    PERFORM_TEST_7A = (1 << 21),
+    PERFORM_TEST_7B = (1 << 22),
+    PERFORM_TEST_8 = (1 << 23)
 };
 
 int preamble_count = 0;
@@ -129,45 +147,41 @@
 }
 /*- End of function --------------------------------------------------------*/
 
-static void preamble_detected(void *user_data, int on, int level, int delay)
+static void cng_detected(void *user_data, int tone, int level, int delay)
 {
-    printf("%s (%d) declared at bit %d (%ddBm0)\n", modem_connect_tone_to_str(on), on, preamble_count, level);
-    if (on)
-        preamble_on_at = preamble_count;
-    else
-        preamble_off_at = preamble_count;
-    /*endif*/
-}
-/*- End of function --------------------------------------------------------*/
-
-static void ced_detected(void *user_data, int on, int level, int delay)
-{
-    printf("%s (%d) declared at %fs, delay %d (%ddBm0)\n", modem_connect_tone_to_str(on), on, (float) when/SAMPLE_RATE, delay, level);
-    if (on)
+    printf("%s (%d) declared at %fs, delay %d (%ddBm0)\n", modem_connect_tone_to_str(tone), tone, (float) when/SAMPLE_RATE, delay, level);
+    if (tone == MODEM_CONNECT_TONES_FAX_CNG)
         hits++;
 }
 /*- End of function --------------------------------------------------------*/
 
-static void ans_pr_detected(void *user_data, int on, int level, int delay)
+static void preamble_detected(void *user_data, int tone, int level, int delay)
 {
-    printf("%s (%d) declared at %fs, delay %d (%ddBm0)\n", modem_connect_tone_to_str(on), on, (float) when/SAMPLE_RATE, delay, level);
-    if (on == MODEM_CONNECT_TONES_ANS_PR)
-        hits++;
+    printf("%s (%d) declared at bit %d (%ddBm0)\n", modem_connect_tone_to_str(tone), tone, preamble_count, level);
+    if (tone == MODEM_CONNECT_TONES_FAX_PREAMBLE)
+        preamble_on_at = preamble_count;
+    else
+        preamble_off_at = preamble_count;
+    /*endif*/
 }
 /*- End of function --------------------------------------------------------*/
 
-static void cng_detected(void *user_data, int on, int level, int delay)
+static void ced_detected(void *user_data, int tone, int level, int delay)
 {
-    printf("%s (%d) declared at %fs, delay %d (%ddBm0)\n", modem_connect_tone_to_str(on), on, (float) when/SAMPLE_RATE, delay, level);
-    if (on)
+    printf("%s (%d) declared at %fs, delay %d (%ddBm0)\n", modem_connect_tone_to_str(tone), tone, (float) when/SAMPLE_RATE, delay, level);
+    if (tone == MODEM_CONNECT_TONES_FAX_PREAMBLE
+        ||
+        tone == MODEM_CONNECT_TONES_ANS)
+    {
         hits++;
+    }
 }
 /*- End of function --------------------------------------------------------*/
 
-static void ec_dis_detected(void *user_data, int on, int level, int delay)
+static void ans_pr_detected(void *user_data, int tone, int level, int delay)
 {
-    printf("%s (%d) declared at %fs, delay %d (%ddBm0)\n", modem_connect_tone_to_str(on), on, (float) when/SAMPLE_RATE, delay, level);
-    if (on)
+    printf("%s (%d) declared at %fs, delay %d (%ddBm0)\n", modem_connect_tone_to_str(tone), tone, (float) when/SAMPLE_RATE, delay, level);
+    if (tone == MODEM_CONNECT_TONES_ANS_PR)
         hits++;
 }
 /*- End of function --------------------------------------------------------*/
@@ -177,6 +191,7 @@
     int i;
     int j;
     int pitch;
+    int depth;
     int level;
     int interval;
     int cycle;
@@ -194,13 +209,12 @@
     int hit;
     int false_hit;
     int false_miss;
-    tone_gen_descriptor_t tone_desc;
-    tone_gen_state_t tone_tx;
     power_meter_t power_state;
     int power;
     int max_power;
     int level2;
     int max_level2;
+    int tone_type;
     int test_list;
     int opt;
     char *decode_test_file;
@@ -241,20 +255,36 @@
             test_list |= PERFORM_TEST_2B;
         else if (strcasecmp(argv[i], "2c") == 0)
             test_list |= PERFORM_TEST_2C;
+        else if (strcasecmp(argv[i], "2d") == 0)
+            test_list |= PERFORM_TEST_2D;
+        else if (strcasecmp(argv[i], "2e") == 0)
+            test_list |= PERFORM_TEST_2E;
         else if (strcasecmp(argv[i], "3a") == 0)
             test_list |= PERFORM_TEST_3A;
         else if (strcasecmp(argv[i], "3b") == 0)
             test_list |= PERFORM_TEST_3B;
         else if (strcasecmp(argv[i], "3c") == 0)
             test_list |= PERFORM_TEST_3C;
+        else if (strcasecmp(argv[i], "3d") == 0)
+            test_list |= PERFORM_TEST_3D;
+        else if (strcasecmp(argv[i], "3e") == 0)
+            test_list |= PERFORM_TEST_3E;
         else if (strcasecmp(argv[i], "4") == 0)
             test_list |= PERFORM_TEST_4;
         else if (strcasecmp(argv[i], "5a") == 0)
             test_list |= PERFORM_TEST_5A;
         else if (strcasecmp(argv[i], "5b") == 0)
             test_list |= PERFORM_TEST_5B;
-        else if (strcasecmp(argv[i], "6") == 0)
-            test_list |= PERFORM_TEST_6;
+        else if (strcasecmp(argv[i], "6a") == 0)
+            test_list |= PERFORM_TEST_6A;
+        else if (strcasecmp(argv[i], "6b") == 0)
+            test_list |= PERFORM_TEST_6B;
+        else if (strcasecmp(argv[i], "7a") == 0)
+            test_list |= PERFORM_TEST_7A;
+        else if (strcasecmp(argv[i], "7b") == 0)
+            test_list |= PERFORM_TEST_7B;
+        else if (strcasecmp(argv[i], "8") == 0)
+            test_list |= PERFORM_TEST_8;
         else
         {
             fprintf(stderr, "Unknown test '%s' specified\n", argv[i]);
@@ -310,7 +340,7 @@
 
     if ((test_list & PERFORM_TEST_1C))
     {
-        printf("Test 1c: ANSAM (Modulated ANS) generation to a file\n");
+        printf("Test 1c: ANSam (Modulated ANS) generation to a file\n");
         /* Some with modulation */
         modem_connect_tones_tx_init(&modem_tone_tx, MODEM_CONNECT_TONES_ANSAM);
         for (i = 0;  i < 20*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
@@ -330,8 +360,8 @@
 
     if ((test_list & PERFORM_TEST_1D))
     {
-        printf("Test 1d: ANS PR (EC-disable) generation to a file\n");
-        /* Some without modulation */
+        printf("Test 1d: ANS/ (EC-disable) generation to a file\n");
+        /* Some without modulation, but with phase reversals */
         modem_connect_tones_tx_init(&modem_tone_tx, MODEM_CONNECT_TONES_ANS_PR);
         for (i = 0;  i < 20*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
         {
@@ -350,8 +380,8 @@
     
     if ((test_list & PERFORM_TEST_1E))
     {
-        printf("Test 1e: ANSAM PR (Modulated EC-disable) generation to a file\n");
-        /* Some with modulation */
+        printf("Test 1e: ANSam/ (Modulated EC-disable) generation to a file\n");
+        /* Some with modulation and phase reversals */
         modem_connect_tones_tx_init(&modem_tone_tx, MODEM_CONNECT_TONES_ANSAM_PR);
         for (i = 0;  i < 20*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
         {
@@ -378,24 +408,17 @@
     if ((test_list & PERFORM_TEST_2A))
     {
         printf("Test 2a: CNG detection with frequency\n");
+        tone_type = MODEM_CONNECT_TONES_FAX_CNG;
         awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f);
         false_hit = FALSE;
         false_miss = FALSE;
-        for (pitch = 600;  pitch < 1600;  pitch++)
+        for (pitch = 600;  pitch <= 1600;  pitch++)
         {
-            make_tone_gen_descriptor(&tone_desc,
-                                     pitch,
-                                     -11,
-                                     0,
-                                     0,
-                                     425,
-                                     3000,
-                                     0,
-                                     0,
-                                     TRUE);
-            tone_gen_init(&tone_tx, &tone_desc);
-
-            modem_connect_tones_rx_init(&cng_rx, MODEM_CONNECT_TONES_FAX_CNG, NULL, NULL);
+            /* Use the transmitter to test the receiver */
+            modem_connect_tones_tx_init(&modem_tone_tx, tone_type);
+            /* Fudge things for the test */
+            modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch);
+            modem_connect_tones_rx_init(&cng_rx, tone_type, NULL, NULL);
             power_meter_init(&power_state, 5);
             power = 0;
             max_power = 0;
@@ -403,7 +426,7 @@
             max_level2 = 0;
             for (i = 0;  i < 10*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
             {
-                samples = tone_gen(&tone_tx, amp, SAMPLES_PER_CHUNK);
+                samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
                 for (j = 0;  j < samples;  j++)
                 {
                     amp[j] += awgn(&chan_noise_source);
@@ -420,21 +443,21 @@
             }
             /*endfor*/
             hit = modem_connect_tones_rx_get(&cng_rx);
-            if (pitch < (1100 - 70)  ||  pitch > (1100 + 70))
+            if (pitch < (1100 - CED_FREQ_BLACKOUT)  ||  pitch > (1100 + CED_FREQ_BLACKOUT))
             {
-                if (hit == MODEM_CONNECT_TONES_FAX_CNG)
+                if (hit != MODEM_CONNECT_TONES_NONE)
                     false_hit = TRUE;
                 /*endif*/
             }
-            else if (pitch > (1100 - 50)  &&  pitch < (1100 + 50))
+            else if (pitch > (1100 - CED_FREQ_TOLERANCE)  &&  pitch < (1100 + CED_FREQ_TOLERANCE))
             {
-                if (hit != MODEM_CONNECT_TONES_FAX_CNG)
+                if (hit != tone_type)
                     false_miss = TRUE;
                 /*endif*/
             }
             /*endif*/
-            if (hit)
-                printf("Detected at %5dHz %12d %12d %d\n", pitch, cng_rx.channel_level, cng_rx.notch_level, hit);
+            if (hit != MODEM_CONNECT_TONES_NONE)
+                printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, cng_rx.channel_level, cng_rx.notch_level, hit);
             /*endif*/
         }
         /*endfor*/
@@ -447,7 +470,7 @@
         printf("Test passed.\n");
     }
     /*endif*/
-    
+
     if ((test_list & PERFORM_TEST_2B))
     {
         printf("Test 2b: CED/ANS detection with frequency\n");
@@ -456,22 +479,14 @@
         false_miss = FALSE;
         for (pitch = 1600;  pitch < 2600;  pitch++)
         {
-            make_tone_gen_descriptor(&tone_desc,
-                                     pitch,
-                                     -11,
-                                     0,
-                                     0,
-                                     2600,
-                                     0,
-                                     0,
-                                     0,
-                                     FALSE);
-            tone_gen_init(&tone_tx, &tone_desc);
-
+            /* Use the transmitter to test the receiver */
+            modem_connect_tones_tx_init(&modem_tone_tx, MODEM_CONNECT_TONES_ANS);
+            /* Fudge things for the test */
+            modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch);
             modem_connect_tones_rx_init(&ced_rx, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE, NULL, NULL);
             for (i = 0;  i < 10*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
             {
-                samples = tone_gen(&tone_tx, amp, SAMPLES_PER_CHUNK);
+                samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
                 for (j = 0;  j < samples;  j++)
                     amp[j] += awgn(&chan_noise_source);
                 /*endfor*/
@@ -479,19 +494,21 @@
             }
             /*endfor*/
             hit = modem_connect_tones_rx_get(&ced_rx);
-            if (pitch < (2100 - 70)  ||  pitch > (2100 + 70))
+            if (pitch < (2100 - CNG_FREQ_BLACKOUT)  ||  pitch > (2100 + CNG_FREQ_BLACKOUT))
             {
-                if (hit == MODEM_CONNECT_TONES_FAX_CED)
+                if (hit != MODEM_CONNECT_TONES_NONE)
                     false_hit = TRUE;
+                /*endif*/
             }
-            else if (pitch > (2100 - 50)  &&  pitch < (2100 + 50))
+            else if (pitch > (2100 - CNG_FREQ_TOLERANCE)  &&  pitch < (2100 + CNG_FREQ_TOLERANCE))
             {
                 if (hit != MODEM_CONNECT_TONES_FAX_CED)
                     false_miss = TRUE;
+                /*endif*/
             }
             /*endif*/
-            if (hit)
-                printf("Detected at %5dHz %12d %12d %d\n", pitch, ced_rx.channel_level, ced_rx.notch_level, hit);
+            if (hit != MODEM_CONNECT_TONES_NONE)
+                printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ced_rx.channel_level, ced_rx.notch_level, hit);
             /*endif*/
         }
         if (false_hit  ||  false_miss)
@@ -506,18 +523,18 @@
 
     if ((test_list & PERFORM_TEST_2C))
     {
-        printf("Test 2c: EC disable detection with frequency\n");
+        printf("Test 2c: ANSam detection with frequency\n");
+        tone_type = MODEM_CONNECT_TONES_ANSAM;
         awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f);
         false_hit = FALSE;
         false_miss = FALSE;
-        for (pitch = 2000;  pitch < 2200;  pitch++)
+        for (pitch = 2000;  pitch <= 2200;  pitch++)
         {
             /* Use the transmitter to test the receiver */
-            modem_connect_tones_tx_init(&modem_tone_tx, MODEM_CONNECT_TONES_ANS_PR);
+            modem_connect_tones_tx_init(&modem_tone_tx, tone_type);
             /* Fudge things for the test */
             modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch);
-            modem_tone_tx.level = dds_scaling_dbm0(-25);
-            modem_connect_tones_rx_init(&ans_pr_rx, MODEM_CONNECT_TONES_ANS_PR, NULL, NULL);
+            modem_connect_tones_rx_init(&ans_pr_rx, tone_type, NULL, NULL);
             for (i = 0;  i < 10*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
             {
                 samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
@@ -528,21 +545,21 @@
             }
             /*endfor*/
             hit = modem_connect_tones_rx_get(&ans_pr_rx);
-            if (pitch < (2100 - 70)  ||  pitch > (2100 + 70))
+            if (pitch < (2100 - CNG_FREQ_BLACKOUT)  ||  pitch > (2100 + CNG_FREQ_BLACKOUT))
             {
-                if (hit == MODEM_CONNECT_TONES_ANS_PR)
+                if (hit != MODEM_CONNECT_TONES_NONE)
                     false_hit = TRUE;
                 /*endif*/
             }
-            else if (pitch > (2100 - 50)  &&  pitch < (2100 + 50))
+            else if (pitch > (2100 - CNG_FREQ_TOLERANCE)  &&  pitch < (2100 + CNG_FREQ_TOLERANCE))
             {
-                if (hit != MODEM_CONNECT_TONES_ANS_PR)
+                if (hit != tone_type)
                     false_miss = TRUE;
                 /*endif*/
             }
             /*endif*/
-            if (hit)
-                printf("Detected at %5dHz %12d %12d %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit);
+            if (hit != MODEM_CONNECT_TONES_NONE)
+                printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit);
             /*endif*/
         }
         /*endfor*/
@@ -556,32 +573,130 @@
     }
     /*endif*/
 
+    if ((test_list & PERFORM_TEST_2D))
+    {
+        printf("Test 2d: ANS/ (EC-disable) detection with frequency\n");
+        tone_type = MODEM_CONNECT_TONES_ANS_PR;
+        awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f);
+        false_hit = FALSE;
+        false_miss = FALSE;
+        for (pitch = 2000;  pitch <= 2200;  pitch++)
+        {
+            /* Use the transmitter to test the receiver */
+            modem_connect_tones_tx_init(&modem_tone_tx, tone_type);
+            /* Fudge things for the test */
+            modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch);
+            modem_connect_tones_rx_init(&ans_pr_rx, tone_type, NULL, NULL);
+            for (i = 0;  i < 10*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
+            {
+                samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
+                for (j = 0;  j < samples;  j++)
+                    amp[j] += awgn(&chan_noise_source);
+                /*endfor*/
+                modem_connect_tones_rx(&ans_pr_rx, amp, samples);
+            }
+            /*endfor*/
+            hit = modem_connect_tones_rx_get(&ans_pr_rx);
+            if (pitch < (2100 - CNG_FREQ_BLACKOUT)  ||  pitch > (2100 + CNG_FREQ_BLACKOUT))
+            {
+                if (hit != MODEM_CONNECT_TONES_NONE)
+                    false_hit = TRUE;
+                /*endif*/
+            }
+            else if (pitch > (2100 - CNG_FREQ_TOLERANCE)  &&  pitch < (2100 + CNG_FREQ_TOLERANCE))
+            {
+                if (hit != tone_type)
+                    false_miss = TRUE;
+                /*endif*/
+            }
+            /*endif*/
+            if (hit != MODEM_CONNECT_TONES_NONE)
+                printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit);
+            /*endif*/
+        }
+        /*endfor*/
+        if (false_hit  ||  false_miss)
+        {
+            printf("Test failed.\n");
+            exit(2);
+        }
+        /*endif*/
+        printf("Test passed.\n");
+    }
+    /*endif*/
+
+    if ((test_list & PERFORM_TEST_2E))
+    {
+        printf("Test 2e: ANSam/ (Modulated EC-disable) detection with frequency\n");
+        tone_type = MODEM_CONNECT_TONES_ANSAM_PR;
+        awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f);
+        false_hit = FALSE;
+        false_miss = FALSE;
+        for (pitch = 2000;  pitch <= 2200;  pitch++)
+        {
+            /* Use the transmitter to test the receiver */
+            modem_connect_tones_tx_init(&modem_tone_tx, tone_type);
+            /* Fudge things for the test */
+            modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch);
+            modem_connect_tones_rx_init(&ans_pr_rx, tone_type, NULL, NULL);
+            for (i = 0;  i < 10*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
+            {
+                samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
+                for (j = 0;  j < samples;  j++)
+                    amp[j] += awgn(&chan_noise_source);
+                /*endfor*/
+                modem_connect_tones_rx(&ans_pr_rx, amp, samples);
+            }
+            /*endfor*/
+            hit = modem_connect_tones_rx_get(&ans_pr_rx);
+            if (pitch < (2100 - CNG_FREQ_BLACKOUT)  ||  pitch > (2100 + CNG_FREQ_BLACKOUT))
+            {
+                if (hit != MODEM_CONNECT_TONES_NONE)
+                    false_hit = TRUE;
+                /*endif*/
+            }
+            else if (pitch > (2100 - CNG_FREQ_TOLERANCE)  &&  pitch < (2100 + CNG_FREQ_TOLERANCE))
+            {
+                if (hit != tone_type)
+                    false_miss = TRUE;
+                /*endif*/
+            }
+            /*endif*/
+            if (hit != MODEM_CONNECT_TONES_NONE)
+                printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit);
+            /*endif*/
+        }
+        /*endfor*/
+        if (false_hit  ||  false_miss)
+        {
+            printf("Test failed.\n");
+            exit(2);
+        }
+        /*endif*/
+        printf("Test passed.\n");
+    }
+    /*endif*/
+
     if ((test_list & PERFORM_TEST_3A))
     {
         printf("Test 3a: CNG detection with level\n");
+        tone_type = MODEM_CONNECT_TONES_FAX_CNG;
         awgn_init_dbm0(&chan_noise_source, 7162534, -60.0f);
         false_hit = FALSE;
         false_miss = FALSE;
-        for (pitch = 1062;  pitch <= 1138;  pitch += 2*38)
+        for (pitch = 1100 - CED_FREQ_TOLERANCE;  pitch <= 1100 + CED_FREQ_TOLERANCE;  pitch += 2*CED_FREQ_TOLERANCE)
         {
             for (level = LEVEL_MAX;  level >= LEVEL_MIN;  level--)
             {
-                make_tone_gen_descriptor(&tone_desc,
-                                         pitch,
-                                         level,
-                                         0,
-                                         0,
-                                         500,
-                                         3000,
-                                         0,
-                                         0,
-                                         TRUE);
-                tone_gen_init(&tone_tx, &tone_desc);
-
-                modem_connect_tones_rx_init(&cng_rx, MODEM_CONNECT_TONES_FAX_CNG, NULL, NULL);
+                /* Use the transmitter to test the receiver */
+                modem_connect_tones_tx_init(&modem_tone_tx, tone_type);
+                /* Fudge things for the test */
+                modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch);
+                modem_tone_tx.level = dds_scaling_dbm0(level);
+                modem_connect_tones_rx_init(&cng_rx, tone_type, NULL, NULL);
                 for (i = 0;  i < 10*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
                 {
-                    samples = tone_gen(&tone_tx, amp, SAMPLES_PER_CHUNK);
+                    samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
                     for (j = 0;  j < samples;  j++)
                         amp[j] += awgn(&chan_noise_source);
                     /*endfor*/
@@ -591,25 +706,19 @@
                 hit = modem_connect_tones_rx_get(&cng_rx);
                 if (level < LEVEL_MIN_REJECT)
                 {
-                    if (hit == MODEM_CONNECT_TONES_FAX_CNG)
-                    {
-                        printf("False hit %d at %ddB\n", hit, level);
+                    if (hit != MODEM_CONNECT_TONES_NONE)
                         false_hit = TRUE;
-                    }
                     /*endif*/
                 }
                 else if (level > LEVEL_MIN_ACCEPT)
                 {
-                    if (hit != MODEM_CONNECT_TONES_FAX_CNG)
-                    {
-                        printf("False miss %d at %ddB\n", hit, level);
+                    if (hit != tone_type)
                         false_miss = TRUE;
-                    }
                     /*endif*/
                 }
                 /*endif*/
-                if (hit)
-                    printf("Detected at %5dHz %4ddB %12d %12d %d\n", pitch, level, cng_rx.channel_level, cng_rx.notch_level, hit);
+                if (hit != MODEM_CONNECT_TONES_NONE)
+                    printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %d\n", pitch, level, cng_rx.channel_level, cng_rx.notch_level, hit);
                 /*endif*/
             }
             /*endfor*/
@@ -628,28 +737,23 @@
     if ((test_list & PERFORM_TEST_3B))
     {
         printf("Test 3b: CED/ANS detection with level\n");
+        tone_type = MODEM_CONNECT_TONES_ANS;
         awgn_init_dbm0(&chan_noise_source, 7162534, -60.0f);
         false_hit = FALSE;
         false_miss = FALSE;
-        for (pitch = 2062;  pitch <= 2138;  pitch += 2*38)
+        for (pitch = 2100 - CNG_FREQ_TOLERANCE;  pitch <= 2100 + CNG_FREQ_TOLERANCE;  pitch += 2*CNG_FREQ_TOLERANCE)
         {
             for (level = LEVEL_MAX;  level >= LEVEL_MIN;  level--)
             {
-                make_tone_gen_descriptor(&tone_desc,
-                                         pitch,
-                                         level,
-                                         0,
-                                         0,
-                                         2600,
-                                         0,
-                                         0,
-                                         0,
-                                         FALSE);
-                tone_gen_init(&tone_tx, &tone_desc);
+                /* Use the transmitter to test the receiver */
+                modem_connect_tones_tx_init(&modem_tone_tx, tone_type);
+                /* Fudge things for the test */
+                modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch);
+                modem_tone_tx.level = dds_scaling_dbm0(level);
                 modem_connect_tones_rx_init(&ced_rx, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE, NULL, NULL);
                 for (i = 0;  i < 10*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
                 {
-                    samples = tone_gen(&tone_tx, amp, SAMPLES_PER_CHUNK);
+                    samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
                     for (j = 0;  j < samples;  j++)
                         amp[j] += awgn(&chan_noise_source);
                     /*endfor*/
@@ -659,19 +763,19 @@
                 hit = modem_connect_tones_rx_get(&ced_rx);
                 if (level < LEVEL_MIN_REJECT)
                 {
-                    if (hit == MODEM_CONNECT_TONES_FAX_CED)
+                    if (hit != MODEM_CONNECT_TONES_NONE)
                         false_hit = TRUE;
                     /*endif*/
                 }
                 else if (level > LEVEL_MIN_ACCEPT)
                 {
-                    if (hit != MODEM_CONNECT_TONES_FAX_CED)
+                    if (hit != tone_type)
                         false_miss = TRUE;
                     /*endif*/
                 }
                 /*endif*/
-                if (hit)
-                    printf("Detected at %5dHz %4ddB %12d %12d %d\n", pitch, level, ced_rx.channel_level, ced_rx.notch_level, hit);
+                if (hit != MODEM_CONNECT_TONES_NONE)
+                    printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %d\n", pitch, level, ced_rx.channel_level, ced_rx.notch_level, hit);
                 /*endif*/
             }
             /*endfor*/
@@ -689,20 +793,80 @@
 
     if ((test_list & PERFORM_TEST_3C))
     {
-        printf("Test 3c: EC disable detection with level\n");
+        printf("Test 3c: ANSam detection with level\n");
+        tone_type = MODEM_CONNECT_TONES_ANSAM;
         awgn_init_dbm0(&chan_noise_source, 7162534, -60.0f);
         false_hit = FALSE;
         false_miss = FALSE;
-        for (pitch = 2062;  pitch <= 2138;  pitch += 2*38)
+        for (pitch = 2100 - CNG_FREQ_TOLERANCE;  pitch <= 2100 + CNG_FREQ_TOLERANCE;  pitch += 2*CNG_FREQ_TOLERANCE)
         {
+            //for (level = LEVEL_MAX;  level >= LEVEL_MIN;  level--)
+            for (level = -26;  level >= -26;  level--)
+            {
+                /* Use the transmitter to test the receiver */
+                modem_connect_tones_tx_init(&modem_tone_tx, tone_type);
+                /* Fudge things for the test */
+                modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch);
+                modem_tone_tx.level = dds_scaling_dbm0(level);
+                modem_tone_tx.mod_level = modem_tone_tx.level*20/100;
+                modem_connect_tones_rx_init(&ans_pr_rx, tone_type, NULL, NULL);
+                for (i = 0;  i < 10*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
+                {
+                    samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
+                    for (j = 0;  j < samples;  j++)
+                        amp[j] += awgn(&chan_noise_source);
+                    /*endfor*/
+                    modem_connect_tones_rx(&ans_pr_rx, amp, samples);
+                }
+                /*endfor*/
+                hit = modem_connect_tones_rx_get(&ans_pr_rx);
+                if (level < LEVEL_MIN_REJECT)
+                {
+                    if (hit != MODEM_CONNECT_TONES_NONE)
+                        false_hit = TRUE;
+                    /*endif*/
+                }
+                else if (level > LEVEL_MIN_ACCEPT)
+                {
+                    if (hit != tone_type)
+                        false_miss = TRUE;
+                    /*endif*/
+                }
+                /*endif*/
+                //if (hit != MODEM_CONNECT_TONES_NONE)
+                    printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %d\n", pitch, level, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit);
+                /*endif*/
+            }
+            /*endfor*/
+        }
+        /*endfor*/
+        if (false_hit  ||  false_miss)
+        {
+            printf("Test failed.\n");
+            exit(2);
+        }
+        /*endif*/
+        printf("Test passed.\n");
+    }
+    /*endif*/
+
+    if ((test_list & PERFORM_TEST_3D))
+    {
+        printf("Test 3d: ANS/ (EC-disable) detection with level\n");
+        tone_type = MODEM_CONNECT_TONES_ANS_PR;
+        awgn_init_dbm0(&chan_noise_source, 7162534, -60.0f);
+        false_hit = FALSE;
+        false_miss = FALSE;
+        for (pitch = 2100 - CNG_FREQ_TOLERANCE;  pitch <= 2100 + CNG_FREQ_TOLERANCE;  pitch += 2*CNG_FREQ_TOLERANCE)
+        {
             for (level = LEVEL_MAX;  level >= LEVEL_MIN;  level--)
             {
                 /* Use the transmitter to test the receiver */
-                modem_connect_tones_tx_init(&modem_tone_tx, MODEM_CONNECT_TONES_ANS_PR);
+                modem_connect_tones_tx_init(&modem_tone_tx, tone_type);
                 /* Fudge things for the test */
                 modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch);
                 modem_tone_tx.level = dds_scaling_dbm0(level);
-                modem_connect_tones_rx_init(&ans_pr_rx, MODEM_CONNECT_TONES_ANS_PR, NULL, NULL);
+                modem_connect_tones_rx_init(&ans_pr_rx, tone_type, NULL, NULL);
                 for (i = 0;  i < 10*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
                 {
                     samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
@@ -715,19 +879,19 @@
                 hit = modem_connect_tones_rx_get(&ans_pr_rx);
                 if (level < LEVEL_MIN_REJECT)
                 {
-                    if (hit == MODEM_CONNECT_TONES_ANS_PR)
+                    if (hit != MODEM_CONNECT_TONES_NONE)
                         false_hit = TRUE;
                     /*endif*/
                 }
                 else if (level > LEVEL_MIN_ACCEPT)
                 {
-                    if (hit != MODEM_CONNECT_TONES_ANS_PR)
+                    if (hit != tone_type)
                         false_miss = TRUE;
                     /*endif*/
                 }
                 /*endif*/
-                if (hit)
-                    printf("Detected at %5dHz %4ddB %12d %12d %d\n", pitch, level, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit);
+                if (hit != MODEM_CONNECT_TONES_NONE)
+                    printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %d\n", pitch, level, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit);
                 /*endif*/
             }
             /*endfor*/
@@ -743,6 +907,64 @@
     }
     /*endif*/
 
+    if ((test_list & PERFORM_TEST_3E))
+    {
+        printf("Test 3e: ANSam/ (Modulated EC-disable) detection with level\n");
+        tone_type = MODEM_CONNECT_TONES_ANSAM_PR;
+        awgn_init_dbm0(&chan_noise_source, 7162534, -60.0f);
+        false_hit = FALSE;
+        false_miss = FALSE;
+        for (pitch = 2100 - CNG_FREQ_TOLERANCE;  pitch <= 2100 + CNG_FREQ_TOLERANCE;  pitch += 2*CNG_FREQ_TOLERANCE)
+        {
+            for (level = LEVEL_MAX;  level >= LEVEL_MIN;  level--)
+            {
+                /* Use the transmitter to test the receiver */
+                modem_connect_tones_tx_init(&modem_tone_tx, tone_type);
+                /* Fudge things for the test */
+                modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch);
+                modem_tone_tx.level = dds_scaling_dbm0(level);
+                modem_tone_tx.mod_level = modem_tone_tx.level*20/100;
+                modem_connect_tones_rx_init(&ans_pr_rx, tone_type, NULL, NULL);
+                for (i = 0;  i < 10*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
+                {
+                    samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
+                    for (j = 0;  j < samples;  j++)
+                        amp[j] += awgn(&chan_noise_source);
+                    /*endfor*/
+                    modem_connect_tones_rx(&ans_pr_rx, amp, samples);
+                }
+                /*endfor*/
+                hit = modem_connect_tones_rx_get(&ans_pr_rx);
+                if (level < LEVEL_MIN_REJECT)
+                {
+                    if (hit != MODEM_CONNECT_TONES_NONE)
+                        false_hit = TRUE;
+                    /*endif*/
+                }
+                else if (level > LEVEL_MIN_ACCEPT)
+                {
+                    if (hit != tone_type)
+                        false_miss = TRUE;
+                    /*endif*/
+                }
+                /*endif*/
+                if (hit != MODEM_CONNECT_TONES_NONE)
+                    printf("Detected at %5dHz %4ddB %12" PRId32 " %12" PRId32 " %d\n", pitch, level, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit);
+                /*endif*/
+            }
+            /*endfor*/
+        }
+        /*endfor*/
+        if (false_hit  ||  false_miss)
+        {
+            printf("Test failed.\n");
+            exit(2);
+        }
+        /*endif*/
+        printf("Test passed.\n");
+    }
+    /*endif*/
+
     if ((test_list & PERFORM_TEST_4))
     {
         printf("Test 4: CED detection, when stimulated with V.21 preamble\n");
@@ -779,21 +1001,17 @@
 
     if ((test_list & PERFORM_TEST_5A))
     {
-        printf("Test 5A: ANS/ANS PR detection with reversal interval\n");
+        printf("Test 5A: ANS and ANS/ detection with reversal interval\n");
+        tone_type = MODEM_CONNECT_TONES_ANS_PR;
         awgn_init_dbm0(&chan_noise_source, 7162534, -60.0f);
         false_hit = FALSE;
         false_miss = FALSE;
-        pitch = 2100;
-        level = -15;
         for (interval = 400;  interval < 800;  interval++)
         {
             printf("Reversal interval = %d\n", interval);
             /* Use the transmitter to test the receiver */
-            modem_connect_tones_tx_init(&modem_tone_tx, MODEM_CONNECT_TONES_ANS_PR);
-            /* Fudge things for the test */
-            modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch);
-            modem_tone_tx.level = dds_scaling_dbm0(level);
-            modem_connect_tones_rx_init(&ans_pr_rx, MODEM_CONNECT_TONES_ANS_PR, ans_pr_detected, NULL);
+            modem_connect_tones_tx_init(&modem_tone_tx, tone_type);
+            modem_connect_tones_rx_init(&ans_pr_rx, tone_type, ans_pr_detected, NULL);
             hits = 0;
             for (i = 0;  i < 10*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
             {
@@ -829,7 +1047,7 @@
             }
             /*endif*/
             if (hits)
-                printf("Detected at %5dHz %4ddB %dms %12d %12d %d\n", pitch, level, interval, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hits);
+                printf("Detected at %5dHz %4ddB %dms %12" PRId32 " %12" PRId32 " %d\n", 2100, -11, interval, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hits);
             /*endif*/
         }
         /*endfor*/
@@ -845,22 +1063,18 @@
 
     if ((test_list & PERFORM_TEST_5B))
     {
-        printf("Test 5B: ANS/ANS PR detection with mixed reversal intervals\n");
+        printf("Test 5B: ANS and ANS/ detection with mixed reversal intervals\n");
         awgn_init_dbm0(&chan_noise_source, 7162534, -60.0f);
+        tone_type = MODEM_CONNECT_TONES_ANS_PR;
         false_hit = FALSE;
         false_miss = FALSE;
-        pitch = 2100;
-        level = -15;
         interval = 450;
         printf("Reversal interval = %d\n", interval);
         /* Use the transmitter to test the receiver */
-        modem_connect_tones_tx_init(&modem_tone_tx, MODEM_CONNECT_TONES_ANS_PR);
-        /* Fudge things for the test */
-        modem_tone_tx.tone_phase_rate = dds_phase_rate(pitch);
-        modem_tone_tx.level = dds_scaling_dbm0(level);
-        modem_connect_tones_rx_init(&ans_pr_rx, MODEM_CONNECT_TONES_ANS_PR, ans_pr_detected, NULL);
+        modem_connect_tones_tx_init(&modem_tone_tx, tone_type);
+        modem_connect_tones_rx_init(&ans_pr_rx, tone_type, ans_pr_detected, NULL);
+        cycle = 0;
         hits = 0;
-        cycle = 0;
         for (i = 0;  i < 60*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
         {
             when = i;
@@ -883,6 +1097,7 @@
                 amp[j] += awgn(&chan_noise_source);
             /*endfor*/
             modem_connect_tones_rx(&ans_pr_rx, amp, samples);
+            /* TODO: Add test result detection logic. */
         }
         /*endfor*/
         if (false_hit  ||  false_miss)
@@ -895,8 +1110,218 @@
     }
     /*endif*/
 
-    if ((test_list & PERFORM_TEST_6))
+    if ((test_list & PERFORM_TEST_6A))
     {
+        printf("Test 6a: ANSam detection with AM pitch\n");
+        tone_type = MODEM_CONNECT_TONES_ANSAM;
+        awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f);
+        false_hit = FALSE;
+        false_miss = FALSE;
+        for (pitch = 5;  pitch < 25;  pitch++)
+        {
+            /* Use the transmitter to test the receiver */
+            modem_connect_tones_tx_init(&modem_tone_tx, tone_type);
+            /* Fudge things for the test */
+            modem_tone_tx.mod_phase_rate = dds_phase_rate(pitch);
+            modem_connect_tones_rx_init(&ans_pr_rx, tone_type, NULL, NULL);
+            for (i = 0;  i < 10*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
+            {
+                samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
+                for (j = 0;  j < samples;  j++)
+                    amp[j] += awgn(&chan_noise_source);
+                /*endfor*/
+                modem_connect_tones_rx(&ans_pr_rx, amp, samples);
+            }
+            /*endfor*/
+            hit = modem_connect_tones_rx_get(&ans_pr_rx);
+            if (pitch < (15 - 10)  ||  pitch > (15 + 10))
+            {
+                if (hit == tone_type)
+                    false_hit = TRUE;
+                /*endif*/
+            }
+            else if (pitch > (15 - AM_FREQ_TOLERANCE)  &&  pitch < (15 + AM_FREQ_TOLERANCE))
+            {
+                if (hit != tone_type)
+                    false_miss = TRUE;
+                /*endif*/
+            }
+            /*endif*/
+            if (hit != MODEM_CONNECT_TONES_NONE)
+                printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit);
+            /*endif*/
+        }
+        /*endfor*/
+        if (false_hit  ||  false_miss)
+        {
+            printf("Test failed.\n");
+            exit(2);
+        }
+        /*endif*/
+        printf("Test passed.\n");
+    }
+    /*endif*/
+
+    if ((test_list & PERFORM_TEST_6B))
+    {
+        printf("Test 6b: ANSam/ (Modulated EC-disable) detection with AM pitch\n");
+        tone_type = MODEM_CONNECT_TONES_ANSAM_PR;
+        awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f);
+        false_hit = FALSE;
+        false_miss = FALSE;
+        for (pitch = 5;  pitch < 25;  pitch++)
+        {
+            /* Use the transmitter to test the receiver */
+            modem_connect_tones_tx_init(&modem_tone_tx, tone_type);
+            /* Fudge things for the test */
+            modem_tone_tx.mod_phase_rate = dds_phase_rate(pitch);
+            modem_connect_tones_rx_init(&ans_pr_rx, tone_type, NULL, NULL);
+            for (i = 0;  i < 10*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
+            {
+                samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
+                for (j = 0;  j < samples;  j++)
+                    amp[j] += awgn(&chan_noise_source);
+                /*endfor*/
+                modem_connect_tones_rx(&ans_pr_rx, amp, samples);
+            }
+            /*endfor*/
+            hit = modem_connect_tones_rx_get(&ans_pr_rx);
+            if (pitch < (15 - 10)  ||  pitch > (15 + 10))
+            {
+                if (hit == tone_type)
+                    false_hit = TRUE;
+                /*endif*/
+            }
+            else if (pitch > (15 - AM_FREQ_TOLERANCE)  &&  pitch < (15 + AM_FREQ_TOLERANCE))
+            {
+                if (hit != tone_type)
+                    false_miss = TRUE;
+                /*endif*/
+            }
+            /*endif*/
+            if (hit != MODEM_CONNECT_TONES_NONE)
+                printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit);
+            /*endif*/
+        }
+        /*endfor*/
+        if (false_hit  ||  false_miss)
+        {
+            printf("Test failed.\n");
+            exit(2);
+        }
+        /*endif*/
+        printf("Test passed.\n");
+    }
+    /*endif*/
+
+    if ((test_list & PERFORM_TEST_7A))
+    {
+        printf("Test 7a: ANSam detection with AM depth\n");
+        tone_type = MODEM_CONNECT_TONES_ANSAM;
+        pitch = 2100;
+        awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f);
+        false_hit = FALSE;
+        false_miss = FALSE;
+        for (depth = 0;  depth < 40;  depth++)
+        {
+            /* Use the transmitter to test the receiver */
+            modem_connect_tones_tx_init(&modem_tone_tx, tone_type);
+            /* Fudge things for the test */
+            modem_tone_tx.mod_level = modem_tone_tx.level*depth/100;
+            modem_connect_tones_rx_init(&ans_pr_rx, tone_type, NULL, NULL);
+            for (i = 0;  i < 10*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
+            {
+                samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
+                for (j = 0;  j < samples;  j++)
+                    amp[j] += awgn(&chan_noise_source);
+                /*endfor*/
+                modem_connect_tones_rx(&ans_pr_rx, amp, samples);
+            }
+            /*endfor*/
+            hit = modem_connect_tones_rx_get(&ans_pr_rx);
+            if (depth < 10)
+            {
+                if (hit == tone_type)
+                    false_hit = TRUE;
+                /*endif*/
+            }
+            else if (depth > 15)
+            {
+                if (hit != tone_type)
+                    false_miss = TRUE;
+                /*endif*/
+            }
+            /*endif*/
+            if (hit != MODEM_CONNECT_TONES_NONE)
+                printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit);
+            /*endif*/
+        }
+        /*endfor*/
+        if (false_hit  ||  false_miss)
+        {
+            printf("Test failed.\n");
+            exit(2);
+        }
+        /*endif*/
+        printf("Test passed.\n");
+    }
+    /*endif*/
+
+    if ((test_list & PERFORM_TEST_7B))
+    {
+        printf("Test 7b: ANSam/ (Modulated EC-disable) detection with AM depth\n");
+        tone_type = MODEM_CONNECT_TONES_ANSAM_PR;
+        pitch = 2100;
+        awgn_init_dbm0(&chan_noise_source, 7162534, -50.0f);
+        false_hit = FALSE;
+        false_miss = FALSE;
+        for (depth = 0;  depth < 40;  depth++)
+        {
+            /* Use the transmitter to test the receiver */
+            modem_connect_tones_tx_init(&modem_tone_tx, tone_type);
+            /* Fudge things for the test */
+            modem_tone_tx.mod_level = modem_tone_tx.level*depth/100;
+            modem_connect_tones_rx_init(&ans_pr_rx, tone_type, NULL, NULL);
+            for (i = 0;  i < 10*SAMPLE_RATE;  i += SAMPLES_PER_CHUNK)
+            {
+                samples = modem_connect_tones_tx(&modem_tone_tx, amp, SAMPLES_PER_CHUNK);
+                for (j = 0;  j < samples;  j++)
+                    amp[j] += awgn(&chan_noise_source);
+                /*endfor*/
+                modem_connect_tones_rx(&ans_pr_rx, amp, samples);
+            }
+            /*endfor*/
+            hit = modem_connect_tones_rx_get(&ans_pr_rx);
+            if (depth < 10)
+            {
+                if (hit == tone_type)
+                    false_hit = TRUE;
+                /*endif*/
+            }
+            else if (depth > 15)
+            {
+                if (hit != tone_type)
+                    false_miss = TRUE;
+                /*endif*/
+            }
+            /*endif*/
+            if (hit != MODEM_CONNECT_TONES_NONE)
+                printf("Detected at %5dHz %12" PRId32 " %12" PRId32 " %d\n", pitch, ans_pr_rx.channel_level, ans_pr_rx.notch_level, hit);
+            /*endif*/
+        }
+        /*endfor*/
+        if (false_hit  ||  false_miss)
+        {
+            printf("Test failed.\n");
+            exit(2);
+        }
+        /*endif*/
+        printf("Test passed.\n");
+    }
+    /*endif*/
+
+    if ((test_list & PERFORM_TEST_8))
+    {
         /* Talk-off test */
         /* Here we use the BellCore and Mitel talk off test tapes, intended for DTMF
            detector testing. Presumably they should also have value here, but I am not
@@ -904,11 +1329,10 @@
            might go easy on detectors looking for different pitches. However, the
            Mitel DTMF test tape is known (the hard way) to exercise 2280Hz tone
            detectors quite well. */
-        printf("Test 6: Talk-off test\n");
+        printf("Test 8: Talk-off test\n");
         modem_connect_tones_rx_init(&cng_rx, MODEM_CONNECT_TONES_FAX_CNG, NULL, NULL);
         modem_connect_tones_rx_init(&ced_rx, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE, NULL, NULL);
         modem_connect_tones_rx_init(&ans_pr_rx, MODEM_CONNECT_TONES_ANS_PR, NULL, NULL);
-        hits = 0;
         for (j = 0;  bellcore_files[j][0];  j++)
         {
             if ((inhandle = sf_open_telephony_read(bellcore_files[j], 1)) == NULL)
@@ -976,7 +1400,7 @@
         printf("Decode file '%s'\n", decode_test_file);
         modem_connect_tones_rx_init(&cng_rx, MODEM_CONNECT_TONES_FAX_CNG, cng_detected, NULL);
         modem_connect_tones_rx_init(&ced_rx, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE, ced_detected, NULL);
-        modem_connect_tones_rx_init(&ans_pr_rx, MODEM_CONNECT_TONES_ANS_PR, ec_dis_detected, NULL);
+        modem_connect_tones_rx_init(&ans_pr_rx, MODEM_CONNECT_TONES_ANS_PR, ans_pr_detected, NULL);
         hits = 0;
         if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL)
         {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/t38_gateway_tests.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/t38_gateway_tests.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/t38_gateway_tests.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_gateway_tests.c,v 1.82 2009/05/30 15:23:14 steveu Exp $
+ * $Id: t38_gateway_tests.c,v 1.82.4.1 2009/12/19 09:47:57 steveu Exp $
  */
 
 /*! \file */
@@ -99,7 +99,7 @@
     char tag[20];
 
     i = (int) (intptr_t) user_data;
-    snprintf(tag, sizeof(tag), "%c: Phase B:", i);
+    snprintf(tag, sizeof(tag), "%c: Phase B", i);
     printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
     log_rx_parameters(s, tag);
     return T30_ERR_OK;
@@ -112,7 +112,7 @@
     char tag[20];
 
     i = (int) (intptr_t) user_data;
-    snprintf(tag, sizeof(tag), "%c: Phase D:", i);
+    snprintf(tag, sizeof(tag), "%c: Phase D", i);
     printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
     log_transfer_statistics(s, tag);
     log_tx_parameters(s, tag);
@@ -128,7 +128,7 @@
     char tag[20];
     
     i = (int) (intptr_t) user_data;
-    snprintf(tag, sizeof(tag), "%c: Phase E:", i);
+    snprintf(tag, sizeof(tag), "%c: Phase E", i);
     printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result));
     log_transfer_statistics(s, tag);
     log_tx_parameters(s, tag);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/t38_gateway_to_terminal_tests.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/t38_gateway_to_terminal_tests.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/t38_gateway_to_terminal_tests.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_gateway_to_terminal_tests.c,v 1.66 2009/05/30 15:23:14 steveu Exp $
+ * $Id: t38_gateway_to_terminal_tests.c,v 1.66.4.1 2009/12/19 09:47:57 steveu Exp $
  */
 
 /*! \file */
@@ -94,7 +94,7 @@
     char tag[20];
 
     i = (int) (intptr_t) user_data;
-    snprintf(tag, sizeof(tag), "%c: Phase B:", i);
+    snprintf(tag, sizeof(tag), "%c: Phase B", i);
     printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
     log_rx_parameters(s, tag);
     return T30_ERR_OK;
@@ -107,7 +107,7 @@
     char tag[20];
 
     i = (int) (intptr_t) user_data;
-    snprintf(tag, sizeof(tag), "%c: Phase D:", i);
+    snprintf(tag, sizeof(tag), "%c: Phase D", i);
     printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
     log_transfer_statistics(s, tag);
     log_tx_parameters(s, tag);
@@ -123,7 +123,7 @@
     char tag[20];
     
     i = (int) (intptr_t) user_data;
-    snprintf(tag, sizeof(tag), "%c: Phase E:", i);
+    snprintf(tag, sizeof(tag), "%c: Phase E", i);
     printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result));
     log_transfer_statistics(s, tag);
     log_tx_parameters(s, tag);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/t38_non_ecm_buffer_tests.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/t38_non_ecm_buffer_tests.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/t38_non_ecm_buffer_tests.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_non_ecm_buffer_tests.c,v 1.5 2009/04/25 14:17:47 steveu Exp $
+ * $Id: t38_non_ecm_buffer_tests.c,v 1.5.4.1 2009/12/19 06:43:28 steveu Exp $
  */
 
 /*! \file */
@@ -50,6 +50,88 @@
 
 #include "spandsp.h"
 
+/* A pattern of widening gaps between ones, until at 11 apart an
+   EOL should be registered */
+static const uint8_t spreader[] =
+{
+    0x55,
+    0x55,
+    0x55,
+    0x55,
+    0x55,
+    0x55,
+    0x55,
+    0x55,       /* 1 apart */
+    0x22,       /* 2 and 3 apart */
+    0x10,       /* 4 apart */
+    0x40,       /* 5 apart */
+    0x80,       /* 6 apart */
+    0x80,       /* 7 apart */
+    0x40,       /* 8 apart */
+    0x10,       /* 9 apart */
+    0x02,       /* 10 apart */
+    0x00,
+    0x25        /* 11 apart */
+};
+
+static int bit_no;
+
+static int xxx(t38_non_ecm_buffer_state_t *s, logging_state_t *l, int log_bits, int n, int expected)
+{
+    int i;
+    int j;
+    int bit;
+
+    t38_non_ecm_buffer_inject(s, &spreader[n], 1);
+    if (expected >= 0)
+    {
+        for (i = 0;  i < 128;  i++)
+        {
+            bit = t38_non_ecm_buffer_get_bit((void *) s);
+            if (log_bits)
+                printf("Rx bit %d - %d\n", bit_no, bit);
+            if (bit != expected)
+            {
+                printf("Tests failed - %d %d %d\n", bit_no, bit, expected);
+                exit(2);
+            }
+            bit_no++;
+        }
+    }
+    else
+    {
+        j = -1;
+        for (i = 0;  i < 256;  i++)
+        {
+            bit = t38_non_ecm_buffer_get_bit((void *) s);
+            if (log_bits)
+                printf("Rx bit %d - %d\n", bit_no, bit);
+            if (j < 0)
+            {
+                if (bit == 1)
+                    j = 18*8 - 5;
+            }
+            else
+            {
+                expected = (spreader[j >> 3] >> (7 - (j & 7))) & 1;
+                if (bit != expected)
+                {
+                    printf("Tests failed - %d %d %d\n", bit_no, bit, expected);
+                    exit(2);
+                }
+                j++;
+                if (j >= 18*8)
+                    j = 0;
+            }
+            bit_no++;
+            if (j == 17*8)
+                return 0;
+        }
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
 int main(int argc, char *argv[])
 {
     t38_non_ecm_buffer_state_t buffer;
@@ -60,65 +142,170 @@
     int log_bits;
     int i;
 
-    log_bits = FALSE;
+    log_bits = (argc > 1);
+    printf("T.38 non-ECM rate adapting buffer tests.\n");
     span_log_init(&logging, SPAN_LOG_FLOW, NULL);
     span_log_set_protocol(&logging, "Buffer");
 
+    printf("1 - Impose no minimum for the bits per row\n");
     t38_non_ecm_buffer_init(&buffer, TRUE, 0);
-    memset(buf, 0, sizeof(buf));
-    memset(buf + 10, 0x55, 10);
-    buf[25] = 0x80;
-    memset(buf + 30, 0x55, 10);
-    t38_non_ecm_buffer_inject(&buffer, buf, 50);
-    t38_non_ecm_buffer_push(&buffer);
     n = 0;
-    do
-    {
-        bit = t38_non_ecm_buffer_get_bit((void *) &buffer);
-        if (log_bits)
-            printf("Rx bit %d - %d\n", n++, bit);
-    }
-    while (bit >= 0);
+    bit_no = 0;
+    /* We should get ones until the buffers recognises an EOL */
+    printf("    We should get ones here\n");
+    for (i = 0;  i < 17;  i++)
+        xxx(&buffer, &logging, log_bits, i, 1);
+    printf("    We should change to zeros here\n");
+    xxx(&buffer, &logging, log_bits, i, 0);
+    for (i = 0;  i < 17;  i++)
+        xxx(&buffer, &logging, log_bits, i, 0);
+    printf("    We should get the first row here\n");
+    xxx(&buffer, &logging, log_bits, i, -1);
+    for (i = 0;  i < 17;  i++)
+        xxx(&buffer, &logging, log_bits, i, 0);
+    printf("    We should get the second row here\n");
+    xxx(&buffer, &logging, log_bits, i, -1);
+    for (i = 0;  i < 17;  i++)
+        xxx(&buffer, &logging, log_bits, i, 0);
+    printf("    We should get the third row here\n");
+    xxx(&buffer, &logging, log_bits, i, -1);
+    printf("    Done\n");
     t38_non_ecm_buffer_report_input_status(&buffer, &logging);
     t38_non_ecm_buffer_report_output_status(&buffer, &logging);
 
+    printf("2 - Impose no minimum for the bits per row, different alignment\n");
     t38_non_ecm_buffer_init(&buffer, TRUE, 0);
+    n = 0;
     memset(buf, 0, sizeof(buf));
+    /* The first one in this should be seen as the first EOL */
     memset(buf + 10, 0x55, 10);
-    buf[25] = 0x40;
+    /* EOL 2 */
+    buf[25] = 0x20;
+    /* EOL 3 */
     memset(buf + 30, 0x55, 10);
+    /* EOL 4 */
+    buf[45] = 0x10;
     t38_non_ecm_buffer_inject(&buffer, buf, 50);
     t38_non_ecm_buffer_push(&buffer);
-    n = 0;
-    do
+    for (;;)
     {
         bit = t38_non_ecm_buffer_get_bit((void *) &buffer);
         if (log_bits)
-            printf("Rx bit %d - %d\n", n++, bit);
+            printf("Rx bit %d - %d\n", n, bit);
+        n++;
+        if (bit == SIG_STATUS_END_OF_DATA)
+        {
+            if (n != 337)
+            {
+                printf("Tests failed\n");
+                exit(2);
+            }
+            break;
+        }
+        if (n >= 18  &&  n <= 96)
+        {
+            if (bit == (n & 1))
+            {
+                printf("Tests failed\n");
+                exit(2);
+            }
+        }
+        else if (n >= 178  &&  n <= 256)
+        {
+            if (bit == (n & 1))
+            {
+                printf("Tests failed\n");
+                exit(2);
+            }
+        }
+        else if (n == 139  ||  n == 300)
+        {
+            if (bit != 1)
+            {
+                printf("Tests failed\n");
+                exit(2);
+            }
+        }
+        else
+        {
+            if (bit != 0)
+            {
+                printf("Tests failed\n");
+                exit(2);
+            }
+        }
     }
-    while (bit >= 0);
     t38_non_ecm_buffer_report_input_status(&buffer, &logging);
     t38_non_ecm_buffer_report_output_status(&buffer, &logging);
 
+    printf("3 - Demand a fairly high minimum for the bits per row\n");
     t38_non_ecm_buffer_init(&buffer, TRUE, 400);
+    n = 0;
     memset(buf, 0, sizeof(buf));
+    /* The first one in this should be seen as the first EOL */
     memset(buf + 10, 0x55, 10);
-    buf[25] = 0x01;
+    /* EOL 2 */
+    buf[25] = 0x08;
+    /* EOL 3 */
     memset(buf + 30, 0x55, 10);
+    /* EOL 4 */
+    buf[45] = 0x04;
     t38_non_ecm_buffer_inject(&buffer, buf, 50);
     t38_non_ecm_buffer_push(&buffer);
-    n = 0;
-    do
+    for (;;)
     {
         bit = t38_non_ecm_buffer_get_bit((void *) &buffer);
         if (log_bits)
-            printf("Rx bit %d - %d\n", n++, bit);
+            printf("Rx bit %d - %d\n", n, bit);
+        n++;
+        if (bit == SIG_STATUS_END_OF_DATA)
+        {
+            if (n != 1273)
+            {
+                printf("Tests failed\n");
+                exit(2);
+            }
+            break;
+        }
+        if (n >= 18  &&  n <= 96)
+        {
+            if (bit == (n & 1))
+            {
+                printf("Tests failed\n");
+                exit(2);
+            }
+        }
+        else if (n >= 834  &&  n <= 912)
+        {
+            if (bit == (n & 1))
+            {
+                printf("Tests failed\n");
+                exit(2);
+            }
+        }
+        else if (n == 429  ||  n == 1238)
+        {
+            if (bit != 1)
+            {
+                printf("Tests failed\n");
+                exit(2);
+            }
+        }
+        else
+        {
+            if (bit != 0)
+            {
+                printf("Tests failed\n");
+                exit(2);
+            }
+        }
     }
-    while (bit >= 0);
     t38_non_ecm_buffer_report_input_status(&buffer, &logging);
     t38_non_ecm_buffer_report_output_status(&buffer, &logging);
 
+    printf("4 - Take some time to get to the first row of the image, output ahead\n");
     t38_non_ecm_buffer_init(&buffer, TRUE, 400);
+    n = 0;
     /* Get some initial bits from an empty buffer. These should be ones */
     for (i = 0;  i < 1000;  i++)
     {
@@ -131,6 +318,7 @@
             exit(2);
         }
     }
+    printf("    Initial ones OK\n");
     /* Now put some zeros into the buffer, but no EOL. We should continue
        getting ones out. */
     memset(buf, 0, sizeof(buf));
@@ -146,6 +334,7 @@
             exit(2);
         }
     }
+    printf("    Continuing initial ones OK\n");
     /* Now add a one, to make an EOL. We should see the zeros come out. */
     buf[0] = 0x01;
     t38_non_ecm_buffer_inject(&buffer, buf, 1);
@@ -160,8 +349,9 @@
             exit(2);
         }
     }
+    printf("    First EOL caused zeros to output OK\n");
     /* Now add another line. We should see the first line come out. This means just the
-       eighth bit from now will be a one. */
+       23rd bit from now will be a one. */
     buf[0] = 0x00;
     buf[4] = 0x01;
     t38_non_ecm_buffer_inject(&buffer, buf, 5);
@@ -170,15 +360,346 @@
         bit = t38_non_ecm_buffer_get_bit((void *) &buffer);
         if (log_bits)
             printf("Rx bit %d - %d\n", n++, bit);
-        if (i != 7  &&  bit != 0)
+        if ((i == 23  &&  bit == 0)  ||  (i != 23  &&  bit != 0))
         {
             printf("Tests failed (%d)\n", i);
             exit(2);
         }
     }
+    printf("    Second EOL caused the first row to output OK\n");
+    /* Now inject an RTC - 6 EOLs */
+    memset(buf, 0, sizeof(buf));
+    /* T.4 1D style */
+    for (i = 10;  i < 19;  i += 3)
+    {
+        buf[i] = 0x00;
+        buf[i + 1] = 0x10;
+        buf[i + 2] = 0x01;
+    }
+    /* T.4 2D style */
+    buf[25 + 0] = 0x00;
+    buf[25 + 1] = 0x18;
+    buf[25 + 2] = 0x00;
+    buf[25 + 3] = 0xC0;
+    buf[25 + 4] = 0x06;
+    buf[25 + 5] = 0x00;
+    buf[25 + 6] = 0x30;
+    buf[25 + 7] = 0x01;
+    buf[25 + 8] = 0x80;
+    buf[25 + 9] = 0x0C;
+    t38_non_ecm_buffer_inject(&buffer, buf, 50);
+    t38_non_ecm_buffer_push(&buffer);
+    for (i = 0;  i < 1000;  i++)
+    {
+        bit = t38_non_ecm_buffer_get_bit((void *) &buffer);
+        if (log_bits)
+            printf("Rx bit %d - %d\n", n++, bit);
+        if (i == 7
+            ||
+            i == 400 + 11 + 0*12
+            ||
+            i == 400 + 11 + 1*12
+            ||
+            i == 400 + 11 + 2*12
+            ||
+            i == 400 + 11 + 3*12
+            ||
+            i == 400 + 11 + 4*12
+            ||
+            i == 400 + 11 + 5*12
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 0*13
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 0*13 + 1
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 1*13
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 1*13 + 1
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 2*13
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 2*13 + 1
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 3*13
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 3*13 + 1
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 4*13
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 4*13 + 1
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 5*13
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 5*13 + 1)
+        {
+            if (bit == 0)
+            {
+                printf("Tests failed (%d)\n", i);
+                exit(2);
+            }
+        }
+        else
+        {
+            if (bit == 1)
+            {
+                printf("Tests failed (%d)\n", i);
+                exit(2);
+            }
+        }
+    }
+    printf("    RTC output OK\n");
     t38_non_ecm_buffer_report_input_status(&buffer, &logging);
     t38_non_ecm_buffer_report_output_status(&buffer, &logging);
 
+    printf("5 - Take some time to get to the first row of the image, output behind\n");
+    t38_non_ecm_buffer_init(&buffer, TRUE, 400);
+    n = 0;
+    /* Inject some ones. */
+    memset(buf, 0xFF, 100);
+    t38_non_ecm_buffer_inject(&buffer, buf, 100);
+    /* Inject some zeros */
+    memset(buf, 0, sizeof(buf));
+    t38_non_ecm_buffer_inject(&buffer, buf, 100);
+    for (i = 0;  i < 1000;  i++)
+    {
+        bit = t38_non_ecm_buffer_get_bit((void *) &buffer);
+        if (log_bits)
+            printf("Rx bit %d - %d\n", n++, bit);
+        if (bit != 1)
+        {
+            printf("Tests failed\n");
+            exit(2);
+        }
+    }
+    printf("    Initial ones OK\n");
+    /* Now add a one, to make an EOL. We should see the zeros come out. */
+    buf[0] = 0x01;
+    t38_non_ecm_buffer_inject(&buffer, buf, 1);
+    for (i = 0;  i < 1000;  i++)
+    {
+        bit = t38_non_ecm_buffer_get_bit((void *) &buffer);
+        if (log_bits)
+            printf("Rx bit %d - %d\n", n++, bit);
+        if (bit != 0)
+        {
+            printf("Tests failed\n");
+            exit(2);
+        }
+    }
+    printf("    First EOL caused zeros to output OK\n");
+    /* Now add another line. We should see the first line come out. This means just the
+       23rd bit from now will be a one. */
+    buf[0] = 0x00;
+    buf[4] = 0x01;
+    t38_non_ecm_buffer_inject(&buffer, buf, 5);
+    for (i = 0;  i < 1000;  i++)
+    {
+        bit = t38_non_ecm_buffer_get_bit((void *) &buffer);
+        if (log_bits)
+            printf("Rx bit %d - %d\n", n++, bit);
+        if ((i == 23  &&  bit == 0)  ||  (i != 23  &&  bit != 0))
+        {
+            printf("Tests failed (%d)\n", i);
+            exit(2);
+        }
+    }
+    printf("    Second EOL caused the first row to output OK\n");
+    /* Now inject an RTC - 6 EOLs */
+    memset(buf, 0, sizeof(buf));
+    /* T.4 1D style */
+    for (i = 10;  i < 19;  i += 3)
+    {
+        buf[i] = 0x00;
+        buf[i + 1] = 0x10;
+        buf[i + 2] = 0x01;
+    }
+    /* T.4 2D style */
+    buf[25 + 0] = 0x00;
+    buf[25 + 1] = 0x18;
+    buf[25 + 2] = 0x00;
+    buf[25 + 3] = 0xC0;
+    buf[25 + 4] = 0x06;
+    buf[25 + 5] = 0x00;
+    buf[25 + 6] = 0x30;
+    buf[25 + 7] = 0x01;
+    buf[25 + 8] = 0x80;
+    buf[25 + 9] = 0x0C;
+    t38_non_ecm_buffer_inject(&buffer, buf, 50);
+    t38_non_ecm_buffer_push(&buffer);
+    for (i = 0;  i < 1000;  i++)
+    {
+        bit = t38_non_ecm_buffer_get_bit((void *) &buffer);
+        if (log_bits)
+            printf("Rx bit %d - %d\n", n++, bit);
+        if (i == 7
+            ||
+            i == 400 + 11 + 0*12
+            ||
+            i == 400 + 11 + 1*12
+            ||
+            i == 400 + 11 + 2*12
+            ||
+            i == 400 + 11 + 3*12
+            ||
+            i == 400 + 11 + 4*12
+            ||
+            i == 400 + 11 + 5*12
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 0*13
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 0*13 + 1
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 1*13
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 1*13 + 1
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 2*13
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 2*13 + 1
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 3*13
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 3*13 + 1
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 4*13
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 4*13 + 1
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 5*13
+            ||
+            i == 400 + 11 + 60 + 400 + 4 + 5*13 + 1)
+        {
+            if (bit == 0)
+            {
+                printf("Tests failed (%d)\n", i);
+                exit(2);
+            }
+        }
+        else
+        {
+            if (bit == 1)
+            {
+                printf("Tests failed (%d)\n", i);
+                exit(2);
+            }
+        }
+    }
+    printf("    RTC output OK\n");
+    t38_non_ecm_buffer_report_input_status(&buffer, &logging);
+    t38_non_ecm_buffer_report_output_status(&buffer, &logging);
+
+    printf("6 - TCF without leading ones\n");
+    t38_non_ecm_buffer_init(&buffer, FALSE, 400);
+    n = 0;
+    /* Get some initial bits from an empty buffer. These should be ones */
+    for (i = 0;  i < 1000;  i++)
+    {
+        bit = t38_non_ecm_buffer_get_bit((void *) &buffer);
+        if (log_bits)
+            printf("Rx bit %d - %d\n", n++, bit);
+        if (bit != 1)
+        {
+            printf("Tests failed\n");
+            exit(2);
+        }
+    }
+    printf("    Initial ones from an empty TCF buffer OK\n");
+    /* Now send some TCF through, and see that it comes out */
+    memset(buf, 0x00, sizeof(buf));
+    t38_non_ecm_buffer_inject(&buffer, buf, 500);
+    t38_non_ecm_buffer_push(&buffer);
+    for (i = 0;  i < 500*8;  i++)
+    {
+        bit = t38_non_ecm_buffer_get_bit((void *) &buffer);
+        if (log_bits)
+            printf("Rx bit %d - %d\n", n++, bit);
+        if (bit != 0)
+        {
+            printf("Tests failed\n");
+            exit(2);
+        }
+    }
+    printf("    Passthrough of TCF OK\n");
+    /* Check the right number of bits was buffered */
+    bit = t38_non_ecm_buffer_get_bit((void *) &buffer);
+    if (log_bits)
+        printf("Rx bit %d - %d\n", n++, bit);
+    if (bit != SIG_STATUS_END_OF_DATA)
+    {
+        printf("Tests failed\n");
+        exit(2);
+    }
+    printf("    End of data seen OK\n");
+    t38_non_ecm_buffer_report_input_status(&buffer, &logging);
+    t38_non_ecm_buffer_report_output_status(&buffer, &logging);
+
+    printf("7 - TCF with leading ones\n");
+    t38_non_ecm_buffer_init(&buffer, FALSE, 400);
+    n = 0;
+    /* Get some initial bits from an empty buffer. These should be ones */
+    for (i = 0;  i < 1000;  i++)
+    {
+        bit = t38_non_ecm_buffer_get_bit((void *) &buffer);
+        if (log_bits)
+            printf("Rx bit %d - %d\n", n++, bit);
+        if (bit != 1)
+        {
+            printf("Tests failed\n");
+            exit(2);
+        }
+    }
+    printf("    Initial ones from an empty TCF buffer OK\n");
+    
+    /* Now send some initial ones, and see that we continue to get all ones
+       as the stuffing. */
+    memset(buf, 0xFF, 500);
+    t38_non_ecm_buffer_inject(&buffer, buf, 500);
+    for (i = 0;  i < 500*8;  i++)
+    {
+        bit = t38_non_ecm_buffer_get_bit((void *) &buffer);
+        if (log_bits)
+            printf("Rx bit %d - %d\n", n++, bit);
+        if (bit != 1)
+        {
+            printf("Tests failed\n");
+            exit(2);
+        }
+    }
+    printf("    Sustaining ones OK\n");
+
+    /* Now send some initial ones, and some TCF through, and see that only
+       the TCF comes out */
+    memset(buf, 0x00, sizeof(buf));
+    memset(buf, 0xFF, 100);
+    /* End the ones mid byte */
+    buf[100] = 0xF0;
+    t38_non_ecm_buffer_inject(&buffer, buf, 500);
+    t38_non_ecm_buffer_push(&buffer);
+    for (i = 0;  i < 400*8;  i++)
+    {
+        bit = t38_non_ecm_buffer_get_bit((void *) &buffer);
+        if (log_bits)
+            printf("Rx bit %d - %d\n", n++, bit);
+        if ((i < 4  &&  bit == 0)  ||  (i >= 4  &&  bit != 0))
+        {
+            printf("Tests failed\n");
+            exit(2);
+        }
+    }
+    printf("    Passthrough of TCF OK\n");
+    /* Check the right number of bits was buffered */
+    bit = t38_non_ecm_buffer_get_bit((void *) &buffer);
+    if (log_bits)
+        printf("Rx bit %d - %d\n", n++, bit);
+    if (bit != SIG_STATUS_END_OF_DATA)
+    {
+        printf("Tests failed\n");
+        exit(2);
+    }
+    printf("    End of data seen OK\n");
+    t38_non_ecm_buffer_report_input_status(&buffer, &logging);
+    t38_non_ecm_buffer_report_output_status(&buffer, &logging);
+
     printf("Tests passed\n");
     return  0;
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/t38_terminal_tests.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/t38_terminal_tests.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/t38_terminal_tests.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_terminal_tests.c,v 1.67 2009/04/25 14:34:45 steveu Exp $
+ * $Id: t38_terminal_tests.c,v 1.67.4.1 2009/12/19 09:47:57 steveu Exp $
  */
 
 /*! \file */
@@ -90,7 +90,7 @@
     char tag[20];
 
     i = (int) (intptr_t) user_data;
-    snprintf(tag, sizeof(tag), "%c: Phase B:", i);
+    snprintf(tag, sizeof(tag), "%c: Phase B", i);
     printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
     log_rx_parameters(s, tag);
     return T30_ERR_OK;
@@ -103,7 +103,7 @@
     char tag[20];
 
     i = (int) (intptr_t) user_data;
-    snprintf(tag, sizeof(tag), "%c: Phase D:", i);
+    snprintf(tag, sizeof(tag), "%c: Phase D", i);
     printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
     log_transfer_statistics(s, tag);
     log_tx_parameters(s, tag);
@@ -119,7 +119,7 @@
     char tag[20];
 
     i = (int) (intptr_t) user_data;
-    snprintf(tag, sizeof(tag), "%c: Phase E:", i);
+    snprintf(tag, sizeof(tag), "%c: Phase E", i);
     printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result));
     log_transfer_statistics(s, tag);
     log_tx_parameters(s, tag);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/t38_terminal_to_gateway_tests.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/t38_terminal_to_gateway_tests.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/t38_terminal_to_gateway_tests.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t38_terminal_to_gateway_tests.c,v 1.65 2009/05/30 15:23:14 steveu Exp $
+ * $Id: t38_terminal_to_gateway_tests.c,v 1.65.4.1 2009/12/19 09:47:57 steveu Exp $
  */
 
 /*! \file */
@@ -94,7 +94,7 @@
     char tag[20];
 
     i = (int) (intptr_t) user_data;
-    snprintf(tag, sizeof(tag), "%c: Phase B:", i);
+    snprintf(tag, sizeof(tag), "%c: Phase B", i);
     printf("%c: Phase B handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
     log_rx_parameters(s, tag);
     return T30_ERR_OK;
@@ -107,7 +107,7 @@
     char tag[20];
 
     i = (int) (intptr_t) user_data;
-    snprintf(tag, sizeof(tag), "%c: Phase D:", i);
+    snprintf(tag, sizeof(tag), "%c: Phase D", i);
     printf("%c: Phase D handler on channel %c - (0x%X) %s\n", i, i, result, t30_frametype(result));
     log_transfer_statistics(s, tag);
     log_tx_parameters(s, tag);
@@ -123,7 +123,7 @@
     char tag[20];
     
     i = (int) (intptr_t) user_data;
-    snprintf(tag, sizeof(tag), "%c: Phase E:", i);
+    snprintf(tag, sizeof(tag), "%c: Phase E", i);
     printf("%c: Phase E handler on channel %c - (%d) %s\n", i, i, result, t30_completion_code_to_str(result));
     log_transfer_statistics(s, tag);
     log_tx_parameters(s, tag);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/t4_tests.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/t4_tests.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/t4_tests.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,7 +22,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: t4_tests.c,v 1.69 2009/05/16 03:34:45 steveu Exp $
+ * $Id: t4_tests.c,v 1.69.4.1 2009/12/19 09:47:57 steveu Exp $
  */
 
 /*! \file */
@@ -129,8 +129,8 @@
 
     t4_get_transfer_statistics(s, &stats);
     printf("Pages = %d\n", stats.pages_transferred);
-    printf("Image size = %d x %d pixels\n", stats.width, stats.length);
-    printf("Image resolution = %d/m x %d/m\n", stats.x_resolution, stats.y_resolution);
+    printf("Image size = %d pels x %d pels\n", stats.width, stats.length);
+    printf("Image resolution = %d pels/m x %d pels/m\n", stats.x_resolution, stats.y_resolution);
     printf("Bad rows = %d\n", stats.bad_rows);
     printf("Longest bad row run = %d\n", stats.longest_bad_row_run);
     printf("Bits per row - min %d, max %d\n", s->min_row_bits, s->max_row_bits);
@@ -144,6 +144,7 @@
     const char *s;
     static int row = 0;
 
+    /* Send the test pattern. */
     s = t4_test_patterns[row++];
     if (row >= 16)
         return 0;
@@ -170,6 +171,7 @@
     static int row = 0;
     uint8_t ref[8192];
 
+    /* Verify that what is received matches the test pattern. */
     if (len == 0)
         return 0;
     s = t4_test_patterns[row++];
@@ -280,9 +282,15 @@
 {
     static const int compression_sequence[] =
     {
+        //T4_COMPRESSION_NONE,
         T4_COMPRESSION_ITU_T4_1D,
         T4_COMPRESSION_ITU_T4_2D,
-        T4_COMPRESSION_ITU_T6
+        T4_COMPRESSION_ITU_T6,
+        //T4_COMPRESSION_ITU_T85,
+        //T4_COMPRESSION_ITU_T43,
+        //T4_COMPRESSION_ITU_T45,
+        //T4_COMPRESSION_ITU_T81,
+        //T4_COMPRESSION_ITU_SYCC_T81
     };
     int sends;
     int page_no;
@@ -486,11 +494,11 @@
         }
         span_log_set_level(&receive_state.logging, SPAN_LOG_SHOW_SEVERITY | SPAN_LOG_SHOW_PROTOCOL | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME | SPAN_LOG_FLOW);
         t4_rx_set_row_write_handler(&receive_state, row_write_handler, NULL);
+        t4_rx_set_image_width(&receive_state, t4_tx_get_image_width(&send_state));
         t4_rx_set_x_resolution(&receive_state, t4_tx_get_x_resolution(&send_state));
         t4_rx_set_y_resolution(&receive_state, t4_tx_get_y_resolution(&send_state));
-        t4_rx_set_image_width(&receive_state, t4_tx_get_image_width(&send_state));
 
-        /* Now send and receive all the pages in the source TIFF file */
+        /* Now send and receive the test data with all compression modes. */
         page_no = 1;
         /* If we are stepping around the compression schemes, reset to the start of the sequence. */
         if (compression_step > 0)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/v8_tests.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/v8_tests.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/spandsp/tests/v8_tests.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -22,16 +22,13 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: v8_tests.c,v 1.33 2009/05/30 15:23:14 steveu Exp $
+ * $Id: v8_tests.c,v 1.36.4.1 2009/12/28 12:32:53 steveu Exp $
  */
 
 /*! \page v8_tests_page V.8 tests
 \section v8_tests_page_sec_1 What does it do?
 */
 
-/* Enable the following definition to enable direct probing into the internal structures */
-//#define WITH_SPANDSP_INTERNALS
-
 #if defined(HAVE_CONFIG_H)
 #include "config.h"
 #endif
@@ -59,8 +56,25 @@
 
 int negotiations_ok = 0;
 
-static void handler(void *user_data, v8_result_t *result)
+static int select_modulation(int mask)
 {
+    /* Select the fastest data modem available */
+    if (mask & V8_MOD_V90)
+        return V8_MOD_V90;
+    if (mask & V8_MOD_V34)
+        return V8_MOD_V34;
+    if (mask & V8_MOD_V32)
+        return V8_MOD_V32;
+    if (mask & V8_MOD_V23)
+        return V8_MOD_V23;
+    if (mask & V8_MOD_V21)
+        return V8_MOD_V21;
+    return V8_MOD_FAILED;
+}
+/*- End of function --------------------------------------------------------*/
+
+static void handler(void *user_data, v8_parms_t *result)
+{
     const char *s;
     
     s = (const char *) user_data;
@@ -70,31 +84,357 @@
         printf("%s V.8 negotiation failed\n", s);
         return;
     }
-    printf("%s V.8 negotiation result:\n", s);
-    printf("  Call function '%s'\n", v8_call_function_to_str(result->call_function));
-    printf("  Negotiated modulation '%s'\n", v8_modulation_to_str(result->negotiated_modulation));
-    printf("  Protocol '%s'\n", v8_protocol_to_str(result->protocol));
-    printf("  PSTN access '%s'\n", v8_pstn_access_to_str(result->pstn_access));
-    printf("  PCM modem availability '%s'\n", v8_pcm_modem_availability_to_str(result->pcm_modem_availability));
-    if (result->call_function == V8_CALL_V_SERIES
-        &&
-        result->negotiated_modulation == V8_MOD_V90
-        &&
-        result->protocol == V8_PROTOCOL_LAPM_V42)
+    if (result->modem_connect_tone == MODEM_CONNECT_TONES_ANSAM
+        ||
+        result->modem_connect_tone == MODEM_CONNECT_TONES_ANSAM_PR
+        ||
+        result->modem_connect_tone == MODEM_CONNECT_TONES_NONE)
     {
-        negotiations_ok++;
+        printf("%s V.8 negotiation result:\n", s);
+        printf("  Modem connect tone '%s' (%d)\n", modem_connect_tone_to_str(result->modem_connect_tone), result->modem_connect_tone);
+        printf("  Call function '%s' (%d)\n", v8_call_function_to_str(result->call_function), result->call_function);
+        printf("  Far end modulations 0x%X\n", result->modulations);
+        printf("  Protocol '%s' (%d)\n", v8_protocol_to_str(result->protocol), result->protocol);
+        printf("  PSTN access '%s' (%d)\n", v8_pstn_access_to_str(result->pstn_access), result->pstn_access);
+        printf("  PCM modem availability '%s' (%d)\n", v8_pcm_modem_availability_to_str(result->pcm_modem_availability), result->pcm_modem_availability);
+        if (result->t66 >= 0)
+            printf("  T.66 '%s' (%d)\n", v8_t66_to_str(result->t66), result->t66);
+        if (result->nsf >= 0)
+            printf("  NSF %d\n", result->nsf);
+        if (result->call_function == V8_CALL_V_SERIES
+            &&
+            result->protocol == V8_PROTOCOL_LAPM_V42)
+        {
+            negotiations_ok++;
+        }
     }
+    else
+    {
+        printf("%s V.8 negotiation result:\n", s);
+        printf("  Modem connect tone '%s' (%d)\n", modem_connect_tone_to_str(result->modem_connect_tone), result->modem_connect_tone);
+    }
 }
+/*- End of function --------------------------------------------------------*/
 
-int main(int argc, char *argv[])
+static int v8_calls_v8_tests(SNDFILE *outhandle)
 {
+    v8_state_t *v8_caller;
+    v8_state_t *v8_answerer;
+    logging_state_t *caller_logging;
+    logging_state_t *answerer_logging;
+    int caller_available_modulations;
+    int answerer_available_modulations;
     int i;
+    int samples;
+    int remnant;
+    int outframes;
     int16_t amp[SAMPLES_PER_CHUNK];
     int16_t out_amp[2*SAMPLES_PER_CHUNK];
-    v8_state_t *v8_caller;
+    v8_parms_t v8_call_parms;
+    v8_parms_t v8_answer_parms;
+
+    caller_available_modulations = V8_MOD_V17
+                                 | V8_MOD_V21
+                                 | V8_MOD_V22
+                                 | V8_MOD_V23HALF
+                                 | V8_MOD_V23
+                                 | V8_MOD_V26BIS
+                                 | V8_MOD_V26TER
+                                 | V8_MOD_V27TER
+                                 | V8_MOD_V29
+                                 | V8_MOD_V32
+                                 | V8_MOD_V34HALF
+                                 | V8_MOD_V34
+                                 | V8_MOD_V90
+                                 | V8_MOD_V92;
+    answerer_available_modulations = V8_MOD_V17
+                                   | V8_MOD_V21
+                                   | V8_MOD_V22
+                                   | V8_MOD_V23HALF
+                                   | V8_MOD_V23
+                                   | V8_MOD_V26BIS
+                                   | V8_MOD_V26TER
+                                   | V8_MOD_V27TER
+                                   | V8_MOD_V29
+                                   | V8_MOD_V32
+                                   | V8_MOD_V34HALF
+                                   | V8_MOD_V34
+                                   | V8_MOD_V90
+                                   | V8_MOD_V92;
+    negotiations_ok = 0;
+
+    v8_call_parms.modem_connect_tone = MODEM_CONNECT_TONES_NONE;
+    v8_call_parms.call_function = V8_CALL_V_SERIES;
+    v8_call_parms.modulations = caller_available_modulations;
+    v8_call_parms.protocol = V8_PROTOCOL_LAPM_V42;
+    v8_call_parms.pcm_modem_availability = 0;
+    v8_call_parms.pstn_access = 0;
+    v8_call_parms.nsf = -1;
+    v8_call_parms.t66 = -1;
+    v8_caller = v8_init(NULL,
+                        TRUE,
+                        &v8_call_parms,
+                        handler,
+                        (void *) "caller");
+    v8_answer_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR;
+    v8_answer_parms.call_function = V8_CALL_V_SERIES;
+    v8_answer_parms.modulations = answerer_available_modulations;
+    v8_answer_parms.protocol = V8_PROTOCOL_LAPM_V42;
+    v8_answer_parms.pcm_modem_availability = 0;
+    v8_answer_parms.pstn_access = 0;
+    v8_answer_parms.nsf = -1;
+    v8_answer_parms.t66 = -1;
+    v8_answerer = v8_init(NULL,
+                          FALSE,
+                          &v8_answer_parms,
+                          handler,
+                          (void *) "answerer");
+    caller_logging = v8_get_logging_state(v8_caller);
+    span_log_set_level(caller_logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(caller_logging, "caller");
+    answerer_logging = v8_get_logging_state(v8_answerer);
+    span_log_set_level(answerer_logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(answerer_logging, "answerer");
+    for (i = 0;  i < 1000;  i++)
+    {
+        samples = v8_tx(v8_caller, amp, SAMPLES_PER_CHUNK);
+        if (samples < SAMPLES_PER_CHUNK)
+        {
+            memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples));
+            samples = SAMPLES_PER_CHUNK;
+        }
+        span_log_bump_samples(caller_logging, samples);
+        remnant = v8_rx(v8_answerer, amp, samples);
+        for (i = 0;  i < samples;  i++)
+            out_amp[2*i] = amp[i];
+        
+        samples = v8_tx(v8_answerer, amp, SAMPLES_PER_CHUNK);
+        if (samples < SAMPLES_PER_CHUNK)
+        {
+            memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples));
+            samples = SAMPLES_PER_CHUNK;
+        }
+        span_log_bump_samples(answerer_logging, samples);
+        if (v8_rx(v8_caller, amp, samples)  &&  remnant)
+            break;
+        for (i = 0;  i < samples;  i++)
+            out_amp[2*i + 1] = amp[i];
+
+        outframes = sf_writef_short(outhandle, out_amp, samples);
+        if (outframes != samples)
+        {
+            fprintf(stderr, "    Error writing audio file\n");
+            exit(2);
+        }
+    }
+    v8_free(v8_caller);
+    v8_free(v8_answerer);
+
+    if (negotiations_ok != 2)
+    {
+        printf("Tests failed.\n");
+        exit(2);
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int non_v8_calls_v8_tests(SNDFILE *outhandle)
+{
+    silence_gen_state_t *non_v8_caller_tx;
+    modem_connect_tones_rx_state_t *non_v8_caller_rx;
     v8_state_t *v8_answerer;
+    logging_state_t *answerer_logging;
+    int answerer_available_modulations;
+    int i;
+    int samples;
+    int remnant;
     int outframes;
+    int tone;
+    int16_t amp[SAMPLES_PER_CHUNK];
+    int16_t out_amp[2*SAMPLES_PER_CHUNK];
+    v8_parms_t v8_answer_parms;
+
+    answerer_available_modulations = V8_MOD_V17
+                                   | V8_MOD_V21
+                                   | V8_MOD_V22
+                                   | V8_MOD_V23HALF
+                                   | V8_MOD_V23
+                                   | V8_MOD_V26BIS
+                                   | V8_MOD_V26TER
+                                   | V8_MOD_V27TER
+                                   | V8_MOD_V29
+                                   | V8_MOD_V32
+                                   | V8_MOD_V34HALF
+                                   | V8_MOD_V34
+                                   | V8_MOD_V90
+                                   | V8_MOD_V92;
+    negotiations_ok = 0;
+
+    non_v8_caller_tx = silence_gen_init(NULL, 10*SAMPLE_RATE);
+    non_v8_caller_rx = modem_connect_tones_rx_init(NULL, MODEM_CONNECT_TONES_ANS_PR, NULL, NULL);
+
+    v8_answer_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR;
+    v8_answer_parms.call_function = V8_CALL_V_SERIES;
+    v8_answer_parms.modulations = answerer_available_modulations;
+    v8_answer_parms.protocol = V8_PROTOCOL_LAPM_V42;
+    v8_answer_parms.pcm_modem_availability = 0;
+    v8_answer_parms.pstn_access = 0;
+    v8_answer_parms.nsf = -1;
+    v8_answer_parms.t66 = -1;
+    v8_answerer = v8_init(NULL,
+                          FALSE,
+                          &v8_answer_parms,
+                          handler,
+                          (void *) "answerer");
+    answerer_logging = v8_get_logging_state(v8_answerer);
+    span_log_set_level(answerer_logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(answerer_logging, "answerer");
+    for (i = 0;  i < 1000;  i++)
+    {
+        samples = silence_gen(non_v8_caller_tx, amp, SAMPLES_PER_CHUNK);
+        if (samples < SAMPLES_PER_CHUNK)
+        {
+            memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples));
+            samples = SAMPLES_PER_CHUNK;
+        }
+        remnant = v8_rx(v8_answerer, amp, samples);
+        if (remnant)
+            break;
+        for (i = 0;  i < samples;  i++)
+            out_amp[2*i] = amp[i];
+        
+        samples = v8_tx(v8_answerer, amp, SAMPLES_PER_CHUNK);
+        if (samples < SAMPLES_PER_CHUNK)
+        {
+            memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples));
+            samples = SAMPLES_PER_CHUNK;
+        }
+        span_log_bump_samples(answerer_logging, samples);
+        modem_connect_tones_rx(non_v8_caller_rx, amp, samples);
+        if ((tone = modem_connect_tones_rx_get(non_v8_caller_rx)) != MODEM_CONNECT_TONES_NONE)
+        {
+            printf("Detected %s (%d)\n", modem_connect_tone_to_str(tone), tone);
+            if (tone == MODEM_CONNECT_TONES_ANSAM_PR)
+                negotiations_ok++;
+        }
+        for (i = 0;  i < samples;  i++)
+            out_amp[2*i + 1] = amp[i];
+
+        outframes = sf_writef_short(outhandle, out_amp, samples);
+        if (outframes != samples)
+        {
+            fprintf(stderr, "    Error writing audio file\n");
+            exit(2);
+        }
+    }
+    silence_gen_free(non_v8_caller_tx);
+    modem_connect_tones_rx_free(non_v8_caller_rx);
+    v8_free(v8_answerer);
+
+    if (negotiations_ok != 1)
+    {
+        printf("Tests failed.\n");
+        exit(2);
+    }
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+static int v8_calls_non_v8_tests(SNDFILE *outhandle)
+{
+    v8_state_t *v8_caller;
+    modem_connect_tones_tx_state_t *non_v8_answerer_tx;
+    logging_state_t *caller_logging;
+    int caller_available_modulations;
+    int i;
     int samples;
+    int outframes;
+    int16_t amp[SAMPLES_PER_CHUNK];
+    int16_t out_amp[2*SAMPLES_PER_CHUNK];
+    v8_parms_t v8_call_parms;
+
+    caller_available_modulations = V8_MOD_V17
+                                 | V8_MOD_V21
+                                 | V8_MOD_V22
+                                 | V8_MOD_V23HALF
+                                 | V8_MOD_V23
+                                 | V8_MOD_V26BIS
+                                 | V8_MOD_V26TER
+                                 | V8_MOD_V27TER
+                                 | V8_MOD_V29
+                                 | V8_MOD_V32
+                                 | V8_MOD_V34HALF
+                                 | V8_MOD_V34
+                                 | V8_MOD_V90
+                                 | V8_MOD_V92;
+    negotiations_ok = 0;
+
+    v8_call_parms.modem_connect_tone = MODEM_CONNECT_TONES_NONE;
+    v8_call_parms.call_function = V8_CALL_V_SERIES;
+    v8_call_parms.modulations = caller_available_modulations;
+    v8_call_parms.protocol = V8_PROTOCOL_LAPM_V42;
+    v8_call_parms.pcm_modem_availability = 0;
+    v8_call_parms.pstn_access = 0;
+    v8_call_parms.nsf = -1;
+    v8_call_parms.t66 = -1;
+    v8_caller = v8_init(NULL,
+                        TRUE,
+                        &v8_call_parms,
+                        handler,
+                        (void *) "caller");
+    non_v8_answerer_tx = modem_connect_tones_tx_init(NULL, MODEM_CONNECT_TONES_ANS_PR);
+    caller_logging = v8_get_logging_state(v8_caller);
+    span_log_set_level(caller_logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG | SPAN_LOG_SHOW_SAMPLE_TIME);
+    span_log_set_tag(caller_logging, "caller");
+    for (i = 0;  i < 1000;  i++)
+    {
+        samples = v8_tx(v8_caller, amp, SAMPLES_PER_CHUNK);
+        if (samples < SAMPLES_PER_CHUNK)
+        {
+            memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples));
+            samples = SAMPLES_PER_CHUNK;
+        }
+        span_log_bump_samples(caller_logging, samples);
+        for (i = 0;  i < samples;  i++)
+            out_amp[2*i] = amp[i];
+        
+        samples = modem_connect_tones_tx(non_v8_answerer_tx, amp, SAMPLES_PER_CHUNK);
+        if (samples < SAMPLES_PER_CHUNK)
+        {
+            memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples));
+            samples = SAMPLES_PER_CHUNK;
+        }
+        if (v8_rx(v8_caller, amp, samples))
+            break;
+        for (i = 0;  i < samples;  i++)
+            out_amp[2*i + 1] = amp[i];
+
+        outframes = sf_writef_short(outhandle, out_amp, samples);
+        if (outframes != samples)
+        {
+            fprintf(stderr, "    Error writing audio file\n");
+            exit(2);
+        }
+    }
+    v8_free(v8_caller);
+    modem_connect_tones_tx_free(non_v8_answerer_tx);
+
+#if 0
+    if (negotiations_ok != 1)
+    {
+        printf("Tests failed.\n");
+        exit(2);
+    }
+#endif
+    return 0;
+}
+/*- End of function --------------------------------------------------------*/
+
+int main(int argc, char *argv[])
+{
+    int16_t amp[SAMPLES_PER_CHUNK];
+    int samples;
     int remnant;
     int caller_available_modulations;
     int answerer_available_modulations;
@@ -102,6 +442,10 @@
     SNDFILE *outhandle;
     int opt;
     char *decode_test_file;
+    v8_state_t *v8_caller;
+    v8_state_t *v8_answerer;
+    v8_parms_t v8_call_parms;
+    v8_parms_t v8_answer_parms;
     logging_state_t *logging;
 
     decode_test_file = NULL;
@@ -155,68 +499,61 @@
             fprintf(stderr, "    Cannot create audio file '%s'\n", OUTPUT_FILE_NAME);
             exit(2);
         }
-    
-        v8_caller = v8_init(NULL, TRUE, caller_available_modulations, handler, (void *) "caller");
-        v8_answerer = v8_init(NULL, FALSE, answerer_available_modulations, handler, (void *) "answerer");
-        logging = v8_get_logging_state(v8_caller);
-        span_log_set_level(logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG);
-        span_log_set_tag(logging, "caller");
-        logging = v8_get_logging_state(v8_answerer);
-        span_log_set_level(logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG);
-        span_log_set_tag(logging, "answerer");
-        for (i = 0;  i < 1000;  i++)
-        {
-            samples = v8_tx(v8_caller, amp, SAMPLES_PER_CHUNK);
-            if (samples < SAMPLES_PER_CHUNK)
-            {
-                memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples));
-                samples = SAMPLES_PER_CHUNK;
-            }
-            remnant = v8_rx(v8_answerer, amp, samples);
-            for (i = 0;  i < samples;  i++)
-                out_amp[2*i] = amp[i];
-            
-            samples = v8_tx(v8_answerer, amp, SAMPLES_PER_CHUNK);
-            if (samples < SAMPLES_PER_CHUNK)
-            {
-                memset(amp + samples, 0, sizeof(int16_t)*(SAMPLES_PER_CHUNK - samples));
-                samples = SAMPLES_PER_CHUNK;
-            }
-            if (v8_rx(v8_caller, amp, samples)  &&  remnant)
-                break;
-            for (i = 0;  i < samples;  i++)
-                out_amp[2*i + 1] = amp[i];
-    
-            outframes = sf_writef_short(outhandle, out_amp, samples);
-            if (outframes != samples)
-            {
-                fprintf(stderr, "    Error writing audio file\n");
-                exit(2);
-            }
-        }
+
+        printf("Test 1: V.8 terminal calls V.8 terminal\n");
+        v8_calls_v8_tests(outhandle);
+
+        printf("Test 2: non-V.8 terminal calls V.8 terminal\n");
+        non_v8_calls_v8_tests(outhandle);
+
+        printf("Test 3: V.8 terminal calls non-V.8 terminal\n");
+        v8_calls_non_v8_tests(outhandle);
+
         if (sf_close(outhandle))
         {
             fprintf(stderr, "    Cannot close audio file '%s'\n", OUTPUT_FILE_NAME);
             exit(2);
         }
         
-        v8_free(v8_caller);
-        v8_free(v8_answerer);
-        
-        if (negotiations_ok != 2)
-        {
-            printf("Tests failed.\n");
-            exit(2);
-        }
         printf("Tests passed.\n");
     }
     else
     {
         printf("Decode file '%s'\n", decode_test_file);
-        v8_answerer = v8_init(NULL, FALSE, answerer_available_modulations, handler, (void *) "answerer");
+        v8_call_parms.modem_connect_tone = MODEM_CONNECT_TONES_NONE;
+        v8_call_parms.call_function = V8_CALL_V_SERIES;
+        v8_call_parms.modulations = caller_available_modulations;
+        v8_call_parms.protocol = V8_PROTOCOL_LAPM_V42;
+        v8_call_parms.pcm_modem_availability = 0;
+        v8_call_parms.pstn_access = 0;
+        v8_call_parms.nsf = -1;
+        v8_call_parms.t66 = -1;
+        v8_caller = v8_init(NULL,
+                            TRUE,
+                            &v8_call_parms,
+                            handler,
+                            (void *) "caller");
+        logging = v8_get_logging_state(v8_caller);
+        span_log_set_level(logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG);
+        span_log_set_tag(logging, "caller");
+
+        v8_answer_parms.modem_connect_tone = MODEM_CONNECT_TONES_ANSAM_PR;
+        v8_answer_parms.call_function = V8_CALL_V_SERIES;
+        v8_answer_parms.modulations = answerer_available_modulations;
+        v8_answer_parms.protocol = V8_PROTOCOL_LAPM_V42;
+        v8_answer_parms.pcm_modem_availability = 0;
+        v8_answer_parms.pstn_access = 0;
+        v8_answer_parms.nsf = -1;
+        v8_answer_parms.t66 = -1;
+        v8_answerer = v8_init(NULL,
+                              FALSE,
+                              &v8_answer_parms,
+                              handler,
+                              (void *) "answerer");
         logging = v8_get_logging_state(v8_answerer);
         span_log_set_level(logging, SPAN_LOG_FLOW | SPAN_LOG_SHOW_TAG);
-        span_log_set_tag(logging, "decoder");
+        span_log_set_tag(logging, "answerer");
+
         if ((inhandle = sf_open_telephony_read(decode_test_file, 1)) == NULL)
         {
             fprintf(stderr, "    Cannot open speech file '%s'\n", decode_test_file);
@@ -226,10 +563,14 @@
 
         while ((samples = sf_readf_short(inhandle, amp, SAMPLES_PER_CHUNK)))
         {
+            remnant = v8_rx(v8_caller, amp, samples);
             remnant = v8_rx(v8_answerer, amp, samples);
+            remnant = v8_tx(v8_caller, amp, samples);
+            remnant = v8_tx(v8_answerer, amp, samples);
         }
         /*endwhile*/
 
+        v8_free(v8_caller);
         v8_free(v8_answerer);
         if (sf_close(inhandle) != 0)
         {

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/speex


Name: svn:ignore
   - configure
Makefile.in
autom4te.cache
config.log
.complete
config.h
Makefile
speex.pc
config.status
stamp-h1
libtool
depcomp
config.guess
ltmain.sh
config.sub
missing
aclocal.m4
install-sh
lib
speexdsp.pc
config.h.in
configure.lineno
   + configure
Makefile.in
autom4te.cache
config.log
.complete
config.h
Makefile
speex.pc
config.status
stamp-h1
libtool
depcomp
config.guess
ltmain.sh
config.sub
missing
aclocal.m4
install-sh
lib
speexdsp.pc
config.h.in
configure.lineno
a.out.dSYM

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/speex/configure.ac (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/speex/configure.ac	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/speex/configure.ac	2010-02-12 00:54:22 UTC (rev 16614)
@@ -29,6 +29,10 @@
 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
 AM_MAINTAINER_MODE
 
+CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
+
 AC_CANONICAL_HOST
 AC_LIBTOOL_WIN32_DLL
 AM_PROG_LIBTOOL

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sqlite/configure.ac (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sqlite/configure.ac	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/sqlite/configure.ac	2010-02-12 00:54:22 UTC (rev 16614)
@@ -145,6 +145,10 @@
 echo "Version number set to $VERSION_NUMBER"
 AC_SUBST(VERSION_NUMBER)
 
+CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
+
 #########
 # Check to see if the --with-hints=FILE option is used.  If there is none,
 # then check for a files named "$host.hints" and ../$hosts.hints where

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/srtp


Name: svn:ignore
   - config_in.h
Makefile.in
configure
aclocal.m4
Debug
Release
*.ncb
*.user
*.bak
config.log
.complete
aes_tables
*.pc
.libs
.deps
Makefile
config.status
libtool
libsrtp.a
autom4te.cache
Debug Dll
x64
configure.lineno
   + config_in.h
Makefile.in
configure
aclocal.m4
Debug
Release
*.ncb
*.user
*.bak
config.log
.complete
aes_tables
*.pc
.libs
.deps
Makefile
config.status
libtool
libsrtp.a
autom4te.cache
Debug Dll
x64
configure.lineno
a.out.dSYM

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/srtp/configure.in (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/srtp/configure.in	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/srtp/configure.in	2010-02-12 00:54:22 UTC (rev 16614)
@@ -3,6 +3,10 @@
 AC_CONFIG_AUX_DIR(build)
 AM_INIT_AUTOMAKE(libsrtp,1.4.2)
 
+CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
+
 #Set default language
 AC_LANG_C
 # Checks for programs.

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/stfu/stfu.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/stfu/stfu.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/stfu/stfu.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -178,7 +178,7 @@
 	return 0;
 }
 
-stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, void *data, size_t datalen, int last)
+stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, int last)
 {
 	uint32_t index;
 	stfu_frame_t *frame;
@@ -203,10 +203,7 @@
 		if (stfu_n_process(i, i->out_queue) < 0) {
             if (i->in_queue->array_len == i->in_queue->array_size && i->out_queue->array_len == i->out_queue->array_size) {
                 stfu_n_resize(i, i->out_queue->array_size * 2);
-                printf("DOH RESIZE\n");
             }
-
-
 			//return STFU_IT_FAILED;
 		}
 		for(index = 0; index < i->out_queue->array_len; index++) {
@@ -226,6 +223,7 @@
 	}
 
 	memcpy(frame->data, data, cplen);
+    frame->pt = pt;
 	frame->ts = ts;
 	frame->dlen = cplen;
 	frame->was_read = 0;	

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/stfu/stfu.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/stfu/stfu.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/stfu/stfu.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -74,6 +74,7 @@
 
 struct stfu_frame {
 	uint32_t ts;
+	uint32_t pt;
 	uint8_t data[STFU_DATALEN];
 	size_t dlen;
 	uint8_t was_read;
@@ -97,12 +98,12 @@
 void stfu_n_destroy(stfu_instance_t **i);
 stfu_instance_t *stfu_n_init(uint32_t qlen);
 stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen);
-stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, void *data, size_t datalen, int last);
+stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void *data, size_t datalen, int last);
 stfu_frame_t *stfu_n_read_a_frame(stfu_instance_t *i);
 void stfu_n_reset(stfu_instance_t *i);
 
 #define stfu_im_done(i) stfu_n_add_data(i, 0, NULL, 0, 1)
-#define stfu_n_eat(i,t,d,l) stfu_n_add_data(i, t, d, l, 0)
+#define stfu_n_eat(i,t,p,d,l) stfu_n_add_data(i, t, p, d, l, 0)
 
 #ifdef __cplusplus
 }

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/tiff-3.8.2


Name: svn:ignore
   - config.log
config.status
libtool
Makefile
configure
Makefile.in
autom4te.cache
aclocal.m4
   + config.log
config.status
libtool
Makefile
configure
Makefile.in
autom4te.cache
aclocal.m4
a.out.dSYM

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/tiff-3.8.2/config


Name: svn:ignore
   - config.guess
config.sub
ltmain.sh
   + config.guess
config.sub
ltmain.sh
install-sh

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/tiff-3.8.2/configure.ac (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/tiff-3.8.2/configure.ac	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/tiff-3.8.2/configure.ac	2010-02-12 00:54:22 UTC (rev 16614)
@@ -29,6 +29,9 @@
 AC_CONFIG_AUX_DIR(config)
 AC_CONFIG_MACRO_DIR(m4)
 AC_LANG(C)
+CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
 
 dnl Compute the canonical target-system type variable
 AC_CANONICAL_TARGET

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/tiff-3.8.2/m4


Name: svn:ignore
   + ltsugar.m4
libtool.m4
ltversion.m4
lt~obsolete.m4
ltoptions.m4

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/udns/udns_resolver.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/udns/udns_resolver.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/udns/udns_resolver.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -45,6 +45,9 @@
 # undef HAVE_POLL
 #else
 #define udns_inet_pton inet_pton
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
 # include <sys/types.h>
 # include <sys/socket.h>
 # include <netinet/in.h>

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/unimrcp


Name: svn:ignore
   - .git
configure
Makefile.in
config.log
Makefile
config.status
autom4te.cache
libtool
aclocal.m4
unimrcp.ncb
*.suo
*.XML
   + .git
configure
Makefile.in
config.log
Makefile
config.status
autom4te.cache
libtool
aclocal.m4
unimrcp.ncb
*.suo
*.XML
a.out.dSYM

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/unimrcp/build/acmacros


Name: svn:ignore
   + ltsugar.m4
libtool.m4
ltversion.m4
lt~obsolete.m4
ltoptions.m4

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/unimrcp/configure.ac (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/unimrcp/configure.ac	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/unimrcp/configure.ac	2010-02-12 00:54:22 UTC (rev 16614)
@@ -8,6 +8,9 @@
 AC_CONFIG_AUX_DIR([build])
 AC_CONFIG_MACRO_DIR([build/acmacros])
 AC_PREFIX_DEFAULT(/usr/local/unimrcp)
+CFLAGS="$CFLAGS $CONFIGURE_CFLAGS"
+CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS"
+LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS"
 
 plugindir='${prefix}/plugin'
 confdir='${prefix}/conf'

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/Dowload 32khz Sounds.2008.vcproj (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/Dowload 32khz Sounds.2008.vcproj	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/Dowload 32khz Sounds.2008.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -75,7 +75,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading 32khzsound."
-					CommandLine="set /P SOUND_VERSION=&lt;$(ProjectDir)..\..\build\sounds_version.txt&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\32000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-en-us-callie-32000-%SOUND_VERSION%.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\32000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzipSounds en-us-callie 32000 &quot;$(ProjectDir)..\sounds&quot; &quot;$(ProjectDir)..\..\build\sounds_version.txt&quot;"
 					Outputs="$(ProjectDir)..\sounds\en\us\callie\voicemail\32000"
 				/>
 			</FileConfiguration>
@@ -85,7 +85,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading 32khzsound."
-					CommandLine="set /P SOUND_VERSION=&lt;$(ProjectDir)..\..\build\sounds_version.txt&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\32000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-en-us-callie-32000-%SOUND_VERSION%.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\32000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzipSounds en-us-callie 32000 &quot;$(ProjectDir)..\sounds&quot; &quot;$(ProjectDir)..\..\build\sounds_version.txt&quot;"
 					Outputs="$(ProjectDir)..\sounds\en\us\callie\voicemail\32000"
 				/>
 			</FileConfiguration>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/Download 16khz Sounds.2008.vcproj (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/Download 16khz Sounds.2008.vcproj	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/Download 16khz Sounds.2008.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -75,7 +75,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading 16khzsound."
-					CommandLine="set /P SOUND_VERSION=&lt;$(ProjectDir)..\..\build\sounds_version.txt&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\16000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-en-us-callie-16000-%SOUND_VERSION%.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\16000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzipSounds en-us-callie 16000 &quot;$(ProjectDir)..\sounds&quot; &quot;$(ProjectDir)..\..\build\sounds_version.txt&quot;"
 					Outputs="$(ProjectDir)..\sounds\en\us\callie\voicemail\16000"
 				/>
 			</FileConfiguration>
@@ -85,7 +85,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading 16khzsound."
-					CommandLine="set /P SOUND_VERSION=&lt;$(ProjectDir)..\..\build\sounds_version.txt&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\16000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-en-us-callie-16000-%SOUND_VERSION%.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\16000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzipSounds en-us-callie 16000 &quot;$(ProjectDir)..\sounds&quot; &quot;$(ProjectDir)..\..\build\sounds_version.txt&quot;"
 					Outputs="$(ProjectDir)..\sounds\en\us\callie\voicemail\16000"
 				/>
 			</FileConfiguration>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/Download 8khz Sounds.2008.vcproj (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/Download 8khz Sounds.2008.vcproj	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/Download 8khz Sounds.2008.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -75,7 +75,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading 8khzsound."
-					CommandLine="set /P SOUND_VERSION=&lt;$(ProjectDir)..\..\build\sounds_version.txt&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\8000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-en-us-callie-8000-%SOUND_VERSION%.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\8000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzipSounds en-us-callie 8000 &quot;$(ProjectDir)..\sounds&quot; &quot;$(ProjectDir)..\..\build\sounds_version.txt&quot;"
 					Outputs="$(ProjectDir)..\sounds\en\us\callie\voicemail\8000"
 				/>
 			</FileConfiguration>
@@ -85,7 +85,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading 8khzsound."
-					CommandLine="set /P SOUND_VERSION=&lt;$(ProjectDir)..\..\build\sounds_version.txt&#x0D;&#x0A;if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\8000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/freeswitch-sounds-en-us-callie-8000-%SOUND_VERSION%.tar.gz &quot;$(ProjectDir)..\sounds&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\sounds\en\us\callie\voicemail\8000&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzipSounds en-us-callie 8000 &quot;$(ProjectDir)..\sounds&quot; &quot;$(ProjectDir)..\..\build\sounds_version.txt&quot;"
 					Outputs="$(ProjectDir)..\sounds\en\us\callie\voicemail\8000"
 				/>
 			</FileConfiguration>

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/Download CELT.vcproj (from rev 16612, freeswitch/trunk/libs/win32/Download CELT.vcproj) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/Download CELT.vcproj	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/Download CELT.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="Download CELT"
+	ProjectGUID="{FFF82F9B-6A2B-4BE3-95D8-DC5A4FC71E19}"
+	RootNamespace="Download CELT"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+				CommandLine=""
+				Outputs=""
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="10"
+			CharacterSet="2"
+			BuildLogFile="$(IntDir)\BuildLog $(ProjectName).htm"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+				CommandLine=""
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\CELT\cleancount"
+			>
+			<FileConfiguration
+				Name="Debug|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Downloading CELT."
+					CommandLine="if not exist &quot;$(ProjectDir)..\celt-0.7.1&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/celt-0.7.1.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;xcopy &quot;$(ProjectDir)\celt\config.h&quot; &quot;$(ProjectDir)..\celt-0.7.1\libcelt&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(ProjectDir)\celt\float_cast.h&quot; &quot;$(ProjectDir)..\celt-0.7.1\libcelt&quot; /C /D /Y /S /I&#x0D;&#x0A;"
+					Outputs="$(ProjectDir)..\CELT"
+				/>
+			</FileConfiguration>
+			<FileConfiguration
+				Name="Release|Win32"
+				>
+				<Tool
+					Name="VCCustomBuildTool"
+					Description="Downloading CELT."
+					CommandLine="if not exist &quot;$(ProjectDir)..\celt-0.7.1&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/celt-0.7.1.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;xcopy &quot;$(ProjectDir)\celt\config.h&quot; &quot;$(ProjectDir)..\celt-0.7.1\libcelt&quot; /C /D /Y /S /I&#x0D;&#x0A;xcopy &quot;$(ProjectDir)\celt\float_cast.h&quot; &quot;$(ProjectDir)..\celt-0.7.1\libcelt&quot; /C /D /Y /S /I&#x0D;&#x0A;"
+					Outputs="$(ProjectDir)..\CELT"
+				/>
+			</FileConfiguration>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/Download pocketsphinx.2008.vcproj (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/Download pocketsphinx.2008.vcproj	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/Download pocketsphinx.2008.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -75,7 +75,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading pocketsphinx."
-					CommandLine="if not exist &quot;$(ProjectDir)..\pocketsphinx-0.5.99&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/pocketsphinx-0.5.99-latest.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\pocketsphinx-0.5.99&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/pocketsphinx-0.5.99-20091212.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\pocketsphinx-0.5.99"
 				/>
 			</FileConfiguration>
@@ -85,7 +85,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading pocketsphinx."
-					CommandLine="if not exist &quot;$(ProjectDir)..\pocketsphinx-0.5.99&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/pocketsphinx-0.5.99-latest.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\pocketsphinx-0.5.99&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/pocketsphinx-0.5.99-20091212.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\pocketsphinx-0.5.99"
 				/>
 			</FileConfiguration>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/Download sphinxbase.2008.vcproj (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/Download sphinxbase.2008.vcproj	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/Download sphinxbase.2008.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -75,7 +75,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading sphinxbase."
-					CommandLine="if not exist &quot;$(ProjectDir)..\sphinxbase-0.4.99&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/sphinxbase-0.4.99-latest.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\sphinxbase-0.4.99&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/sphinxbase-0.4.99-20091212.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\sphinxbase-0.4.99"
 				/>
 			</FileConfiguration>
@@ -85,7 +85,7 @@
 				<Tool
 					Name="VCCustomBuildTool"
 					Description="Downloading sphinxbase."
-					CommandLine="if not exist &quot;$(ProjectDir)..\sphinxbase-0.4.99&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/sphinxbase-0.4.99-latest.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
+					CommandLine="if not exist &quot;$(ProjectDir)..\sphinxbase-0.4.99&quot; cscript /nologo &quot;$(ProjectDir)util.vbs&quot; GetUnzip http://files.freeswitch.org/downloads/libs/sphinxbase-0.4.99-20091212.tar.gz &quot;$(ProjectDir)..&quot;&#x0D;&#x0A;"
 					Outputs="$(ProjectDir)..\sphinxbase-0.4.99"
 				/>
 			</FileConfiguration>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/apr-util/xml.2008.vcproj (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/apr-util/xml.2008.vcproj	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/apr-util/xml.2008.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -26,6 +26,7 @@
 			UseOfMFC="0"
 			ATLMinimizesCRunTimeLibraryUsage="false"
 			CharacterSet="2"
+			WholeProgramOptimization="1"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
@@ -51,10 +52,10 @@
 				StringPooling="true"
 				RuntimeLibrary="2"
 				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile=".\LibR/xml.pch"
-				AssemblerListingLocation=".\LibR/"
-				ObjectFile=".\LibR/"
-				ProgramDataBaseFileName="LibR\xml_src"
+				PrecompiledHeaderFile="$(IntDir)/xml.pch"
+				AssemblerListingLocation="$(IntDir)\"
+				ObjectFile="$(IntDir)\"
+				ProgramDataBaseFileName="$(IntDir)\xml_src"
 				WarningLevel="3"
 				SuppressStartupBanner="true"
 				DebugInformationFormat="3"
@@ -83,7 +84,7 @@
 			<Tool
 				Name="VCBscMakeTool"
 				SuppressStartupBanner="true"
-				OutputFile=".\LibR/xml.bsc"
+				OutputFile="$(IntDir)\xml.bsc"
 			/>
 			<Tool
 				Name="VCFxCopTool"
@@ -93,13 +94,14 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory="$(ConfigurationName)"
-			IntermediateDirectory="$(ConfigurationName)"
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
 			ConfigurationType="4"
 			UseOfMFC="0"
 			ATLMinimizesCRunTimeLibraryUsage="false"
 			CharacterSet="2"
+			WholeProgramOptimization="1"
 			>
 			<Tool
 				Name="VCPreBuildEventTool"
@@ -115,18 +117,21 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
+				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				AdditionalOptions="/EHsc "
-				Optimization="0"
+				Optimization="2"
+				InlineFunctionExpansion="1"
 				AdditionalIncludeDirectories="$(ProjectDir)..\..\apr-util\xml\expat\lib\"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;VERSION=\&quot;expat_1.95.2\&quot;"
-				RuntimeLibrary="3"
-				PrecompiledHeaderFile=".\LibD/xml.pch"
-				AssemblerListingLocation=".\LibD/"
-				ObjectFile=".\LibD/"
-				ProgramDataBaseFileName="LibD\xml_src"
+				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;VERSION=\&quot;expat_1.95.2\&quot;"
+				StringPooling="true"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				PrecompiledHeaderFile="$(IntDir)\xml.pch"
+				AssemblerListingLocation="$(IntDir)\"
+				ObjectFile="$(IntDir)\"
+				ProgramDataBaseFileName="$(IntDir)\vc90.pdb"
 				WarningLevel="3"
 				SuppressStartupBanner="true"
 				DebugInformationFormat="3"
@@ -155,7 +160,7 @@
 			<Tool
 				Name="VCBscMakeTool"
 				SuppressStartupBanner="true"
-				OutputFile=".\LibD/xml.bsc"
+				OutputFile="$(IntDir)\xml.bsc"
 			/>
 			<Tool
 				Name="VCFxCopTool"
@@ -165,9 +170,9 @@
 			/>
 		</Configuration>
 		<Configuration
-			Name="Release|x64"
-			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
-			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			Name="Debug|Win32"
+			OutputDirectory="$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
 			ConfigurationType="4"
 			UseOfMFC="0"
 			ATLMinimizesCRunTimeLibraryUsage="false"
@@ -187,21 +192,18 @@
 			/>
 			<Tool
 				Name="VCMIDLTool"
-				TargetEnvironment="3"
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
+				AdditionalOptions="/EHsc "
+				Optimization="0"
 				AdditionalIncludeDirectories="$(ProjectDir)..\..\apr-util\xml\expat\lib\"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;VERSION=\&quot;expat_1.95.2\&quot;"
-				StringPooling="true"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile=".\LibR/xml.pch"
-				AssemblerListingLocation=".\LibR/"
-				ObjectFile=".\LibR/"
-				ProgramDataBaseFileName="LibR\xml_src"
+				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;VERSION=\&quot;expat_1.95.2\&quot;"
+				RuntimeLibrary="3"
+				PrecompiledHeaderFile="$(IntDir)\xml.pch"
+				AssemblerListingLocation="$(IntDir)\"
+				ObjectFile="$(IntDir)\"
+				ProgramDataBaseFileName="LibD\xml_src"
 				WarningLevel="3"
 				SuppressStartupBanner="true"
 				DebugInformationFormat="3"
@@ -230,7 +232,7 @@
 			<Tool
 				Name="VCBscMakeTool"
 				SuppressStartupBanner="true"
-				OutputFile=".\LibR/xml.bsc"
+				OutputFile="$(IntDir)\xml.bsc"
 			/>
 			<Tool
 				Name="VCFxCopTool"
@@ -271,9 +273,9 @@
 				AdditionalIncludeDirectories="$(ProjectDir)..\..\apr-util\xml\expat\lib\"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;VERSION=\&quot;expat_1.95.2\&quot;"
 				RuntimeLibrary="3"
-				PrecompiledHeaderFile=".\LibD/xml.pch"
-				AssemblerListingLocation=".\LibD/"
-				ObjectFile=".\LibD/"
+				PrecompiledHeaderFile="$(IntDir)\xml.pch"
+				AssemblerListingLocation="$(IntDir)\"
+				ObjectFile="$(IntDir)\"
 				ProgramDataBaseFileName="LibD\xml_src"
 				WarningLevel="3"
 				SuppressStartupBanner="true"
@@ -303,7 +305,7 @@
 			<Tool
 				Name="VCBscMakeTool"
 				SuppressStartupBanner="true"
-				OutputFile=".\LibD/xml.bsc"
+				OutputFile="$(IntDir)\xml.bsc"
 			/>
 			<Tool
 				Name="VCFxCopTool"
@@ -333,7 +335,7 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
+					Name="Release|x64"
 					>
 					<Tool
 						Name="VCCLCompilerTool"
@@ -342,7 +344,7 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Release|x64"
+					Name="Debug|Win32"
 					>
 					<Tool
 						Name="VCCLCompilerTool"
@@ -373,7 +375,7 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
+					Name="Release|x64"
 					>
 					<Tool
 						Name="VCCLCompilerTool"
@@ -382,7 +384,7 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Release|x64"
+					Name="Debug|Win32"
 					>
 					<Tool
 						Name="VCCLCompilerTool"
@@ -413,7 +415,7 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
+					Name="Release|x64"
 					>
 					<Tool
 						Name="VCCLCompilerTool"
@@ -422,7 +424,7 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Release|x64"
+					Name="Debug|Win32"
 					>
 					<Tool
 						Name="VCCLCompilerTool"
@@ -454,7 +456,7 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
+					Name="Release|x64"
 					ExcludedFromBuild="true"
 					>
 					<Tool
@@ -464,7 +466,7 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Release|x64"
+					Name="Debug|Win32"
 					ExcludedFromBuild="true"
 					>
 					<Tool
@@ -498,7 +500,7 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
+					Name="Release|x64"
 					ExcludedFromBuild="true"
 					>
 					<Tool
@@ -508,7 +510,7 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Release|x64"
+					Name="Debug|Win32"
 					ExcludedFromBuild="true"
 					>
 					<Tool
@@ -595,7 +597,7 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
+					Name="Release|x64"
 					>
 					<Tool
 						Name="VCCustomBuildTool"
@@ -605,7 +607,7 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Release|x64"
+					Name="Debug|Win32"
 					>
 					<Tool
 						Name="VCCustomBuildTool"
@@ -639,7 +641,7 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Debug|Win32"
+					Name="Release|x64"
 					>
 					<Tool
 						Name="VCCustomBuildTool"
@@ -649,7 +651,7 @@
 					/>
 				</FileConfiguration>
 				<FileConfiguration
-					Name="Release|x64"
+					Name="Debug|Win32"
 					>
 					<Tool
 						Name="VCCustomBuildTool"

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/celt (from rev 16612, freeswitch/trunk/libs/win32/celt)

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/celt/config.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/celt/config.h (from rev 16612, freeswitch/trunk/libs/win32/celt/config.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/celt/config.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/celt/config.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,35 @@
+/* This is a build of CELT */
+#define CELT_BUILD 
+
+/* Version extra */
+#define CELT_EXTRA_VERSION "-1"
+
+/* Version major */
+#define CELT_MAJOR_VERSION 0
+
+/* Version micro */
+#define CELT_MICRO_VERSION 0
+
+/* Version minor */
+#define CELT_MINOR_VERSION 7
+
+/* Complete version string */
+#define CELT_VERSION "0.7.0-1"
+
+/* Compile as fixed-point */
+/* #undef FIXED_POINT */
+
+/* Compile as floating-point */
+#define FLOATING_POINT 
+
+/* Make use of alloca */
+/* #undef USE_ALLOCA */
+#define USE_ALLOCA 1 /* disable this when using SSE */
+
+/* Define to equivalent of C99 restrict keyword, or to nothing if this is not
+   supported. Do not define if restrict is supported directly. */
+#define restrict /* __restrict */
+
+// Microsoft version of 'inline'
+#define inline __inline
+

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/celt/float_cast.h

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/celt/float_cast.h (from rev 16612, freeswitch/trunk/libs/win32/celt/float_cast.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/celt/float_cast.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/celt/float_cast.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,114 @@
+/*
+** Copyright (C) 2001 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
+**
+** Permission to use, copy, modify, distribute, and sell this file for any 
+** purpose is hereby granted without fee, provided that the above copyright 
+** and this permission notice appear in all copies.  No representations are
+** made about the suitability of this software for any purpose.  It is 
+** provided "as is" without express or implied warranty.
+*/
+
+/* Version 1.1 */
+
+#ifndef FLOAT_CAST_H
+#define FLOAT_CAST_H
+
+/*============================================================================ 
+**	On Intel Pentium processors (especially PIII and probably P4), converting
+**	from float to int is very slow. To meet the C specs, the code produced by 
+**	most C compilers targeting Pentium needs to change the FPU rounding mode 
+**	before the float to int conversion is performed. 
+**
+**	Changing the FPU rounding mode causes the FPU pipeline to be flushed. It 
+**	is this flushing of the pipeline which is so slow.
+**
+**	Fortunately the ISO C99 specifications define the functions lrint, lrintf,
+**	llrint and llrintf which fix this problem as a side effect. 
+**
+**	On Unix-like systems, the configure process should have detected the 
+**	presence of these functions. If they weren't found we have to replace them 
+**	here with a standard C cast.
+*/
+
+/*	
+**	The C99 prototypes for lrint and lrintf are as follows:
+**	
+**		long int lrintf (float x) ;
+**		long int lrint  (double x) ;
+*/
+
+/*	The presence of the required functions are detected during the configure
+**	process and the values HAVE_LRINT and HAVE_LRINTF are set accordingly in
+**	the config.h file.
+*/
+
+#if (HAVE_LRINTF)
+/*#if 0*/
+
+	/*	These defines enable functionality introduced with the 1999 ISO C
+	**	standard. They must be defined before the inclusion of math.h to
+	**	engage them. If optimisation is enabled, these functions will be 
+	**	inlined. With optimisation switched off, you have to link in the
+	**	maths library using -lm.
+	*/
+
+	#define	_ISOC9X_SOURCE	1
+	#define _ISOC99_SOURCE	1
+
+	#define	__USE_ISOC9X	1
+	#define	__USE_ISOC99	1
+
+	#include	<math.h>
+	#define float2int(x) lrintf(x)
+
+#elif (defined(HAVE_LRINT))
+
+#define	_ISOC9X_SOURCE	1
+#define _ISOC99_SOURCE	1
+
+#define	__USE_ISOC9X	1
+#define	__USE_ISOC99	1
+
+#include	<math.h>
+#define float2int(x) lrint(x)
+
+#elif (defined (WIN32) || defined (_WIN32))
+
+	#include	<math.h>
+
+	/*	Win32 doesn't seem to have these functions. 
+	**	Therefore implement inline versions of these functions here.
+	*/
+
+#ifndef _WIN64 
+	__inline long int 
+	float2int (float flt)
+	{	int intgr;
+
+		_asm
+		{	fld flt
+			fistp intgr
+			} ;
+			
+		return intgr ;
+	}
+#else               
+#define float2int   
+#endif            
+  
+
+#else
+
+#ifdef __GNUC__ /* supported by gcc, but not by all other compilers*/
+	#warning "Don't have the functions lrint() and lrintf ()."
+	#warning "Replacing these functions with a standard C cast."
+#endif /* __GNUC__ */
+
+	#include	<math.h>
+
+	#define	float2int(flt)		((int)(floor(.5+flt)))
+
+#endif
+
+
+#endif /* FLOAT_CAST_H */

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/celt/libcelt.vcproj

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/celt/libcelt.vcproj (from rev 16612, freeswitch/trunk/libs/win32/celt/libcelt.vcproj) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/celt/libcelt.vcproj	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/celt/libcelt.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,367 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="libcelt"
+	ProjectGUID="{ABB71A76-42B0-47A4-973A-42E3D920C6FD}"
+	RootNamespace="celt"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="196613"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\celt-0.7.1\libcelt"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="4"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="0"
+				AdditionalIncludeDirectories="..\..\celt-0.7.1\libcelt"
+				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;HAVE_CONFIG_H;_AMD64_;_WIN64"
+				MinimalRebuild="true"
+				BasicRuntimeChecks="3"
+				RuntimeLibrary="3"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+			IntermediateDirectory="$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="&quot;..\..\celt-0.7.1\libcelt&quot;"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="4"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				Optimization="2"
+				EnableIntrinsicFunctions="true"
+				AdditionalIncludeDirectories="&quot;..\..\celt-0.7.1\libcelt&quot;"
+				PreprocessorDefinitions="WIN32;NDEBUG;_LIB;HAVE_CONFIG_H;_AMD64_;_WIN64"
+				RuntimeLibrary="2"
+				EnableFunctionLevelLinking="true"
+				UsePrecompiledHeader="0"
+				WarningLevel="3"
+				DebugInformationFormat="3"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLibrarianTool"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<Filter
+			Name="Source Files"
+			Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+			UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+			>
+			<File
+				RelativePath="..\..\celt-0.7.1\libcelt\bands.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\celt-0.7.1\libcelt\celt.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\celt-0.7.1\libcelt\cwrs.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\celt-0.7.1\libcelt\entcode.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\celt-0.7.1\libcelt\entdec.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\celt-0.7.1\libcelt\entenc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\celt-0.7.1\libcelt\header.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\celt-0.7.1\libcelt\kiss_fft.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\celt-0.7.1\libcelt\laplace.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\celt-0.7.1\libcelt\mdct.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\celt-0.7.1\libcelt\modes.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\celt-0.7.1\libcelt\pitch.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\celt-0.7.1\libcelt\quant_bands.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\celt-0.7.1\libcelt\rangedec.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\celt-0.7.1\libcelt\rangeenc.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\celt-0.7.1\libcelt\rate.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\celt-0.7.1\libcelt\vq.c"
+				>
+			</File>
+		</Filter>
+		<Filter
+			Name="Header Files"
+			Filter="h;hpp;hxx;hm;inl;inc;xsd"
+			UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+			>
+		</Filter>
+		<Filter
+			Name="Resource Files"
+			Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+			UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+			>
+		</Filter>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/pocketsphinx/pocketsphinx.2008.vcproj (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/pocketsphinx/pocketsphinx.2008.vcproj	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/pocketsphinx/pocketsphinx.2008.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -401,10 +401,22 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\cmu6_lts_rules.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\dict.h"
 				>
 			</File>
 			<File
+				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\dict2pid.h"
+				>
+			</File>
+			<File
+				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\fillpen.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\fsg_history.h"
 				>
 			</File>
@@ -429,6 +441,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\lextree.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\mdef.h"
 				>
 			</File>
@@ -457,7 +473,7 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\pocketsphinx-0.5.99\include\pocketsphinx.h"
+				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\phone_loop_search.h"
 				>
 			</File>
 			<File
@@ -465,6 +481,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\pocketsphinx-0.5.99\include\pocketsphinx.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\include\pocketsphinx_export.h"
 				>
 			</File>
@@ -493,7 +513,7 @@
 				>
 			</File>
 			<File
-				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\phone_loop_search.h"
+				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\s3dict.h"
 				>
 			</File>
 			<File
@@ -501,9 +521,17 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\tst_search.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\vector.h"
 				>
 			</File>
+			<File
+				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\vithist.h"
+				>
+			</File>
 		</Filter>
 		<Filter
 			Name="Source Files"
@@ -593,46 +621,18 @@
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\dict.c"
+				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\cmu6_lts_rules.c"
 				>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|x64"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-					/>
-				</FileConfiguration>
 			</File>
 			<File
+				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\dict2pid.c"
+				>
+			</File>
+			<File
+				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\fillpen.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\fsg_history.c"
 				>
 				<FileConfiguration
@@ -833,6 +833,10 @@
 				</FileConfiguration>
 			</File>
 			<File
+				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\lextree.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\mdef.c"
 				>
 				<FileConfiguration
@@ -1005,6 +1009,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\phone_loop_search.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\pocketsphinx.c"
 				>
 			</File>
@@ -1057,7 +1065,7 @@
 				</FileConfiguration>
 			</File>
 			<File
-				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\phone_loop_search.c"
+				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\s3dict.c"
 				>
 			</File>
 			<File
@@ -1101,6 +1109,10 @@
 				</FileConfiguration>
 			</File>
 			<File
+				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\tst_search.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\vector.c"
 				>
 				<FileConfiguration
@@ -1140,6 +1152,10 @@
 					/>
 				</FileConfiguration>
 			</File>
+			<File
+				RelativePath="..\..\pocketsphinx-0.5.99\src\libpocketsphinx\vithist.c"
+				>
+			</File>
 		</Filter>
 		<Filter
 			Name="Resource Files"

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/util.vbs (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/util.vbs	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/win32/util.vbs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -45,6 +45,8 @@
 			Wget objArgs(1), Showpath(objArgs(2))
 		Case "GetUnzip"		
 			WgetUnCompress objArgs(1), Showpath(objArgs(2))
+		Case "GetUnzipSounds"
+			WgetSounds objArgs(1), objArgs(2), Showpath(objArgs(3)), objArgs(4)
 		Case "Version"					
 			'CreateVersion(tmpFolder, VersionDir, includebase, includedest)
 			CreateVersion Showpath(objArgs(1)), Showpath(objArgs(2)), objArgs(3), objArgs(4)
@@ -56,6 +58,25 @@
 ' Utility Subroutines
 ' *******************
 
+Sub WgetSounds(PrimaryName, Freq, DestFolder, VersionFile)
+    BaseURL = "http://files.freeswitch.org/freeswitch-sounds"
+    Set objFSO = CreateObject("Scripting.FileSystemObject")
+    Set objTextFile = objFSO.OpenTextFile(VersionFile,1)
+    Do Until objTextFile.AtEndOfStream
+        strLine = objTextFile.Readline
+        if Len(strLine) > 2 then
+            versionPos = InstrRev(strLine, " ", -1, 1)
+            name = Left(strLine, versionPos-1)
+            if name = PrimaryName Then
+                version = Right(strLine, Len(strLine) - versionPos)
+                Wscript.Echo "Sound name: " & name & " Version " & version
+                URL = BaseURL & "-" & name & "-" & Freq &"-" & version & ".tar.gz"
+                Wscript.Echo "URL: " & URL
+                WgetUnCompress URL, Showpath(DestFolder)
+            End If
+        End if
+    Loop
+End Sub
 
 Sub WgetUnCompress(URL, DestFolder)
 	If Right(DestFolder, 1) <> "\" Then DestFolder = DestFolder & "\" End If

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/xmlrpc-c/lib/abyss/src


Name: svn:ignore
   - .libs
   + .libs
abyss_trace.c

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/xmlrpc-c/src/method.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/xmlrpc-c/src/method.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/xmlrpc-c/src/method.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -210,7 +210,7 @@
     cursorP = &sigListString[0];
     
     while (!envP->fault_occurred && *cursorP != '\0') {
-        struct xmlrpc_signature * signatureP;
+        struct xmlrpc_signature * signatureP = NULL;
         
         parseOneSignature(envP, cursorP, &signatureP, &cursorP);
         

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/xmlrpc-c/src/parse_value.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/xmlrpc-c/src/parse_value.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/xmlrpc-c/src/parse_value.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -188,7 +188,7 @@
                       "<member> element has %u children.  Only one <name> and "
                       "one <value> make sense.", childCount);
     else {
-        xml_element * nameElemP;
+        xml_element * nameElemP = NULL;
 
         getNameChild(envP, memberP, &nameElemP);
 
@@ -196,7 +196,7 @@
             parseName(envP, nameElemP, keyPP);
 
             if (!envP->fault_occurred) {
-                xml_element * valueElemP;
+                xml_element * valueElemP = NULL;
 
                 getValueChild(envP, memberP, &valueElemP);
                 
@@ -242,7 +242,7 @@
                 setParseFault(envP, "<%s> element found where only <member> "
                               "makes sense", elemName);
             else {
-                xmlrpc_value * keyP;
+                xmlrpc_value * keyP = NULL;
                 xmlrpc_value * valueP;
 
                 parseMember(envP, members[i], maxRecursion, &keyP, &valueP);
@@ -414,10 +414,10 @@
        Design note: in my experiments, using strtod() was 10 times
        slower than using this function.
     */
-    const char * mantissa;
-    const char * mantissaEnd;
-    const char * fraction;
-    const char * fractionEnd;
+    const char * mantissa = NULL;
+    const char * mantissaEnd = NULL;
+    const char * fraction = NULL;
+    const char * fractionEnd = NULL;
 
     scanAndValidateDoubleString(envP, string, &mantissa, &mantissaEnd,
                                 &fraction, &fractionEnd);
@@ -500,7 +500,7 @@
    'str' is that content.
 -----------------------------------------------------------------------------*/
     xmlrpc_env parseEnv;
-    double valueDouble;
+    double valueDouble = 0;
 
     XMLRPC_ASSERT_ENV_OK(envP);
     XMLRPC_ASSERT_PTR_OK(str);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/xmlrpc-c/src/system_method.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/xmlrpc-c/src/system_method.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/xmlrpc-c/src/system_method.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -452,7 +452,7 @@
                      signatureP && !envP->fault_occurred;
                      signatureP = signatureP->nextP) {
                     
-                    xmlrpc_value * signatureVP;
+                    xmlrpc_value * signatureVP = NULL;
                     
                     buildSignatureValue(envP, signatureP, &signatureVP);
                     

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/libs/xmlrpc-c/src/xmlrpc_server_abyss.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/libs/xmlrpc-c/src/xmlrpc_server_abyss.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/libs/xmlrpc-c/src/xmlrpc_server_abyss.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -471,7 +471,7 @@
             &env, XMLRPC_LIMIT_EXCEEDED_ERROR,
             "XML-RPC request too large (%d bytes)", contentSize);
     else {
-        xmlrpc_mem_block * body;
+        xmlrpc_mem_block * body = NULL;
         /* Read XML data off the wire. */
         getBody(&env, abyssSessionP, contentSize, trace, &body);
         if (!env.fault_occurred) {
@@ -890,8 +890,8 @@
    to use.
 -----------------------------------------------------------------------------*/
     bool socketBound;
-    unsigned int portNumber;
-    TOsSocket socketFd;
+    unsigned int portNumber = 0;
+    TOsSocket socketFd = 0;
     const char * logFileName;
 
     extractServerCreateParms(envP, parmsP, parmSize,

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/patches/zrtp_changes.diff

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/scripts/debug_sofia.sh (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/scripts/debug_sofia.sh	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/scripts/debug_sofia.sh	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 
 export SOFIA_DEBUG=9
 export NUA_DEBUG=9

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/scripts/freeswitch-gcore (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/scripts/freeswitch-gcore	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/scripts/freeswitch-gcore	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,5 +1,5 @@
-#!/bin/bash
-fspid=$(cat /usr/local/freeswitch/log/freeswitch.pid)
+#!/bin/sh
+fspid=$(cat /usr/local/freeswitch/run/freeswitch.pid)
 gcore -o /usr/local/freeswitch/log/freeswitch.gcore $fspid && \
 	gdb /usr/local/freeswitch/bin/freeswitch \
 	-c /usr/local/freeswitch/log/freeswitch.gcore.$fspid \

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/scripts/freeswitch-reporter (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/scripts/freeswitch-reporter	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/scripts/freeswitch-reporter	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 email=traces@freeswitch.org
 errorlvl=1
 while [ $errorlvl -gt 0 ]
@@ -6,7 +6,7 @@
 	/usr/local/freeswitch/bin/freeswitch -core
 	errorlvl=$?
 	if [ $errorlvl -gt 0 ]; then
-		pid=$(cat /usr/local/freeswitch/log/freeswitch.pid)
+		pid=$(cat /usr/local/freeswitch/run/freeswitch.pid)
 		corefile=core.$pid
 		tempfile=$(tempfile)
 		if [ -f $corefile ]; then

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/scripts/gentls_cert.in (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/scripts/gentls_cert.in	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/scripts/gentls_cert.in	2010-02-12 00:54:22 UTC (rev 16614)
@@ -126,7 +126,7 @@
 remove_ca() {
 	echo "Removing CA"
 
-	if [ ! -d "${CONFDIR}/CA" ]; then
+	if [ -d "${CONFDIR}/CA" ]; then
 		rm "${CONFDIR}/CA/"*
 		rmdir "${CONFDIR}/CA"
 	fi

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/scripts/perl/dhcp-inform.pl (from rev 16612, freeswitch/trunk/scripts/perl/dhcp-inform.pl) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/scripts/perl/dhcp-inform.pl	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/scripts/perl/dhcp-inform.pl	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,72 @@
+#!/usr/bin/perl
+#
+# Send DHCPACK when you receive a DHCPINFORM from a polycom 
+# so we can provide the provisioning URL to the phone
+#
+# Authors: (and wish lists)
+#
+# Brian West <brian@freeswitch.org> http://www.amazon.com/gp/registry/wishlist/1BWDJUX5LYQE0
+# Raymond Chandler <intralanman@freeswitch.org> http://www.amazon.com/gp/registry/wishlist/27XDISBBI4NOU
+#
+#
+
+use IO::Socket::INET;
+use Net::DHCP::Packet;
+use Net::DHCP::Constants;
+use Getopt::Std;
+
+getopt("du");
+
+$| = 1;
+
+if (!$opt_u) {
+  print "Usage: $0 -u <url> [-d 1]\n";
+  exit;
+}
+
+$sock = IO::Socket::INET->new(
+			      LocalPort => '67',
+			      Proto => 'udp',
+			      Broadcast => 1,
+			      ReuseAddr => 1,
+			     ) or die "socket: $@";
+
+while ($sock->recv($newmsg, 1024)) {
+  my $dhcpreq = Net::DHCP::Packet->new($newmsg);
+  if ($opt_d) {
+    print $dhcpreq->toString();
+    print "\n---------------------------------------------------------------------\n";
+  }
+  $tmp = $dhcpreq->chaddr();
+
+  print "--$tmp--\n";
+
+  if ($dhcpreq->getOptionValue(DHO_DHCP_MESSAGE_TYPE()) == 8 && $dhcpreq->chaddr() =~ /^0004f2/) {
+    my $dhcpresp = new Net::DHCP::Packet(
+					 Op => BOOTREPLY(),
+					 Hops => $dhcpreq->hops(),
+					 Xid => $dhcpreq->xid(),
+					 Htype => $dhcpreq->htype(),
+					 Ciaddr => $dhcpreq->ciaddr(),
+					 Chaddr => $dhcpreq->chaddr(),
+					 DHO_DHCP_MESSAGE_TYPE() => DHCPACK(),
+					 DHO_DHCP_SERVER_IDENTIFIER() => $sock->sockhost,
+					 DHO_TFTP_SERVER() => "$opt_u",
+					);
+
+
+    if ($opt_d) {
+      print $dhcpresp->toString();
+      print "\n---------------------------------------------------------------------\n";
+    }
+    print "Sending option 66 as $opt_u\n";
+
+    $handle = IO::Socket::INET->new(Proto => 'udp',
+				    PeerPort => '68',
+				    LocalPort => '67',
+				    ReuseAddr => 1,
+				    PeerAddr => $dhcpreq->ciaddr(),
+				   ) or die "socket: $@";
+    $handle->send($dhcpresp->serialize())
+  }
+}

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/scripts/perl/snom-pnpd.pl (from rev 16612, freeswitch/trunk/scripts/perl/snom-pnpd.pl) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/scripts/perl/snom-pnpd.pl	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/scripts/perl/snom-pnpd.pl	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,90 @@
+#!/usr/bin/perl
+#
+# Snom PNP Daemon that can provide URL for provisioning.
+#
+# Authors: (and wish lists)
+#
+# Brian West <brian@freeswitch.org> http://www.amazon.com/gp/registry/wishlist/1BWDJUX5LYQE0
+# Raymond Chandler <intralanman@freeswitch.org> http://www.amazon.com/gp/registry/wishlist/27XDISBBI4NOU
+#
+#
+
+use Data::Dumper;
+use Net::SIP;
+use IO::Socket::Multicast;
+use Getopt::Std;
+
+my $count = 0;
+
+getopt("dui");
+
+$| = 1;
+
+if (!$opt_u && !$opt_i) {
+  print "Usage: $0 -i <ipaddress> -u <url> [-d 1]\n";
+  exit;
+}
+
+my $local_addr = $opt_i;
+my $local_port = '8160';
+
+
+sub reply($;) {
+  my ($body) = shift;
+
+  if($opt_d) {
+    print Dumper $body;
+  }
+
+  if($body =~ m/^SUBSCRIBE/i) {
+    my $pkt = Net::SIP::Request->new( $body );
+
+    my $resp = $pkt->create_response(200, "OK");
+    my $contact = $pkt->get_header('contact');
+    $contact =~ s/<sip:(.*)>/$1/i;
+    my $leg = Net::SIP::Leg->new(
+				 addr => $local_addr,
+				 port => $local_port,
+				);
+    $leg->deliver( $resp, "$contact" );
+    
+    my $hash = {};
+
+
+    my @version = split(";", $pkt->get_header('event'));
+    foreach my $blah (@version) {
+      if($blah =~ /=/) {
+	my($var,$val) = split(/=/,$blah);
+	$val =~ s/\"//g;
+	$hash->{$var} = $val;
+      }
+    }
+
+    my $prov_url = "$opt_u/{mac}.xml";
+    print "Sending pnp provisioning URL as $opt_u/{mac}.xml\n";
+
+    $notify = Net::SIP::Request->new('NOTIFY', $contact, {});
+    $notify->set_header('From' => $pkt->get_header('to'));
+    $notify->set_header('To' => $pkt->get_header('to'));
+    $notify->set_header('User-Agent' => 'test');
+    $notify->set_header('Event' => $pkt->get_header('event'));
+    $notify->set_header('Contact' => "<sip:$local_host:$local_port>");
+    $notify->set_header('Call-ID' => rand());
+    $notify->set_header('CSeq' => '1 NOTIFY');
+    $notify->set_body("$prov_url");
+    $leg->deliver($notify, $contact);
+  }
+}
+
+my $socket = IO::Socket::Multicast->new(
+					LocalPort => '5060',
+					LocalAddr => '224.0.1.75',
+					Proto => 'udp',
+					ReuseAddr => 1
+				       );
+
+$socket->mcast_add('224.0.1.75');
+
+while($socket->recv($data,8192)) {
+  &reply($data);
+}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/g711.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/g711.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/g711.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -35,58 +35,58 @@
 #include "g711.h"
 
 /* Copied from the CCITT G.711 specification */
-static const uint8_t ulaw_to_alaw_table[256] =
-{
-     42,  43,  40,  41,  46,  47,  44,  45,  34,  35,  32,  33,  38,  39,  36,  37,
-     58,  59,  56,  57,  62,  63,  60,  61,  50,  51,  48,  49,  54,  55,  52,  53,
-     10,  11,   8,   9,  14,  15,  12,  13,   2,   3,   0,   1,   6,   7,   4,  26,
-     27,  24,  25,  30,  31,  28,  29,  18,  19,  16,  17,  22,  23,  20,  21, 106,
-    104, 105, 110, 111, 108, 109,  98,  99,  96,  97, 102, 103, 100, 101, 122, 120,
-    126, 127, 124, 125, 114, 115, 112, 113, 118, 119, 116, 117,  75,  73,  79,  77,
-     66,  67,  64,  65,  70,  71,  68,  69,  90,  91,  88,  89,  94,  95,  92,  93,
-     82,  82,  83,  83,  80,  80,  81,  81,  86,  86,  87,  87,  84,  84,  85,  85,
-    170, 171, 168, 169, 174, 175, 172, 173, 162, 163, 160, 161, 166, 167, 164, 165,
-    186, 187, 184, 185, 190, 191, 188, 189, 178, 179, 176, 177, 182, 183, 180, 181,
-    138, 139, 136, 137, 142, 143, 140, 141, 130, 131, 128, 129, 134, 135, 132, 154,
-    155, 152, 153, 158, 159, 156, 157, 146, 147, 144, 145, 150, 151, 148, 149, 234,
-    232, 233, 238, 239, 236, 237, 226, 227, 224, 225, 230, 231, 228, 229, 250, 248,
-    254, 255, 252, 253, 242, 243, 240, 241, 246, 247, 244, 245, 203, 201, 207, 205,
-    194, 195, 192, 193, 198, 199, 196, 197, 218, 219, 216, 217, 222, 223, 220, 221,
-    210, 210, 211, 211, 208, 208, 209, 209, 214, 214, 215, 215, 212, 212, 213, 213
+static const uint8_t ulaw_to_alaw_table[256] = {
+	42, 43, 40, 41, 46, 47, 44, 45, 34, 35, 32, 33, 38, 39, 36, 37,
+	58, 59, 56, 57, 62, 63, 60, 61, 50, 51, 48, 49, 54, 55, 52, 53,
+	10, 11, 8, 9, 14, 15, 12, 13, 2, 3, 0, 1, 6, 7, 4, 26,
+	27, 24, 25, 30, 31, 28, 29, 18, 19, 16, 17, 22, 23, 20, 21, 106,
+	104, 105, 110, 111, 108, 109, 98, 99, 96, 97, 102, 103, 100, 101, 122, 120,
+	126, 127, 124, 125, 114, 115, 112, 113, 118, 119, 116, 117, 75, 73, 79, 77,
+	66, 67, 64, 65, 70, 71, 68, 69, 90, 91, 88, 89, 94, 95, 92, 93,
+	82, 82, 83, 83, 80, 80, 81, 81, 86, 86, 87, 87, 84, 84, 85, 85,
+	170, 171, 168, 169, 174, 175, 172, 173, 162, 163, 160, 161, 166, 167, 164, 165,
+	186, 187, 184, 185, 190, 191, 188, 189, 178, 179, 176, 177, 182, 183, 180, 181,
+	138, 139, 136, 137, 142, 143, 140, 141, 130, 131, 128, 129, 134, 135, 132, 154,
+	155, 152, 153, 158, 159, 156, 157, 146, 147, 144, 145, 150, 151, 148, 149, 234,
+	232, 233, 238, 239, 236, 237, 226, 227, 224, 225, 230, 231, 228, 229, 250, 248,
+	254, 255, 252, 253, 242, 243, 240, 241, 246, 247, 244, 245, 203, 201, 207, 205,
+	194, 195, 192, 193, 198, 199, 196, 197, 218, 219, 216, 217, 222, 223, 220, 221,
+	210, 210, 211, 211, 208, 208, 209, 209, 214, 214, 215, 215, 212, 212, 213, 213
 };
 
 /* These transcoding tables are copied from the CCITT G.711 specification. To achieve
    optimal results, do not change them. */
 
-static const uint8_t alaw_to_ulaw_table[256] =
-{
-     42,  43,  40,  41,  46,  47,  44,  45,  34,  35,  32,  33,  38,  39,  36,  37,
-     57,  58,  55,  56,  61,  62,  59,  60,  49,  50,  47,  48,  53,  54,  51,  52,
-     10,  11,   8,   9,  14,  15,  12,  13,   2,   3,   0,   1,   6,   7,   4,   5,
-     26,  27,  24,  25,  30,  31,  28,  29,  18,  19,  16,  17,  22,  23,  20,  21,
-     98,  99,  96,  97, 102, 103, 100, 101,  93,  93,  92,  92,  95,  95,  94,  94,
-    116, 118, 112, 114, 124, 126, 120, 122, 106, 107, 104, 105, 110, 111, 108, 109,
-     72,  73,  70,  71,  76,  77,  74,  75,  64,  65,  63,  63,  68,  69,  66,  67,
-     86,  87,  84,  85,  90,  91,  88,  89,  79,  79,  78,  78,  82,  83,  80,  81,
-    170, 171, 168, 169, 174, 175, 172, 173, 162, 163, 160, 161, 166, 167, 164, 165,
-    185, 186, 183, 184, 189, 190, 187, 188, 177, 178, 175, 176, 181, 182, 179, 180,
-    138, 139, 136, 137, 142, 143, 140, 141, 130, 131, 128, 129, 134, 135, 132, 133,
-    154, 155, 152, 153, 158, 159, 156, 157, 146, 147, 144, 145, 150, 151, 148, 149,
-    226, 227, 224, 225, 230, 231, 228, 229, 221, 221, 220, 220, 223, 223, 222, 222,
-    244, 246, 240, 242, 252, 254, 248, 250, 234, 235, 232, 233, 238, 239, 236, 237,
-    200, 201, 198, 199, 204, 205, 202, 203, 192, 193, 191, 191, 196, 197, 194, 195,
-    214, 215, 212, 213, 218, 219, 216, 217, 207, 207, 206, 206, 210, 211, 208, 209
+static const uint8_t alaw_to_ulaw_table[256] = {
+	42, 43, 40, 41, 46, 47, 44, 45, 34, 35, 32, 33, 38, 39, 36, 37,
+	57, 58, 55, 56, 61, 62, 59, 60, 49, 50, 47, 48, 53, 54, 51, 52,
+	10, 11, 8, 9, 14, 15, 12, 13, 2, 3, 0, 1, 6, 7, 4, 5,
+	26, 27, 24, 25, 30, 31, 28, 29, 18, 19, 16, 17, 22, 23, 20, 21,
+	98, 99, 96, 97, 102, 103, 100, 101, 93, 93, 92, 92, 95, 95, 94, 94,
+	116, 118, 112, 114, 124, 126, 120, 122, 106, 107, 104, 105, 110, 111, 108, 109,
+	72, 73, 70, 71, 76, 77, 74, 75, 64, 65, 63, 63, 68, 69, 66, 67,
+	86, 87, 84, 85, 90, 91, 88, 89, 79, 79, 78, 78, 82, 83, 80, 81,
+	170, 171, 168, 169, 174, 175, 172, 173, 162, 163, 160, 161, 166, 167, 164, 165,
+	185, 186, 183, 184, 189, 190, 187, 188, 177, 178, 175, 176, 181, 182, 179, 180,
+	138, 139, 136, 137, 142, 143, 140, 141, 130, 131, 128, 129, 134, 135, 132, 133,
+	154, 155, 152, 153, 158, 159, 156, 157, 146, 147, 144, 145, 150, 151, 148, 149,
+	226, 227, 224, 225, 230, 231, 228, 229, 221, 221, 220, 220, 223, 223, 222, 222,
+	244, 246, 240, 242, 252, 254, 248, 250, 234, 235, 232, 233, 238, 239, 236, 237,
+	200, 201, 198, 199, 204, 205, 202, 203, 192, 193, 191, 191, 196, 197, 194, 195,
+	214, 215, 212, 213, 218, 219, 216, 217, 207, 207, 206, 206, 210, 211, 208, 209
 };
 
 uint8_t alaw_to_ulaw(uint8_t alaw)
 {
-    return alaw_to_ulaw_table[alaw];
+	return alaw_to_ulaw_table[alaw];
 }
+
 /*- End of function --------------------------------------------------------*/
 
 uint8_t ulaw_to_alaw(uint8_t ulaw)
 {
-    return ulaw_to_alaw_table[ulaw];
+	return ulaw_to_alaw_table[ulaw];
 }
+
 /*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/SimpleGlob.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/SimpleGlob.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/SimpleGlob.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -302,13 +302,17 @@
 
 	const char *GetFileNameS(char) const {
 		return m_oFindDataA.cFileName;
-	} const wchar_t *GetFileNameS(wchar_t) const {
+	}
+	const wchar_t *GetFileNameS(wchar_t) const {
 		return m_oFindDataW.cFileName;
-	} bool IsDirS(char) const {
+	}
+	bool IsDirS(char) const {
 		return GetFileTypeS(m_oFindDataA.dwFileAttributes) == SG_FILETYPE_DIR;
-	} bool IsDirS(wchar_t) const {
+	}
+	bool IsDirS(wchar_t) const {
 		return GetFileTypeS(m_oFindDataW.dwFileAttributes) == SG_FILETYPE_DIR;
-	} SG_FileType GetFileTypeS(const char *a_pszPath) {
+	}
+	SG_FileType GetFileTypeS(const char *a_pszPath) {
 		return GetFileTypeS(GetFileAttributesA(a_pszPath));
 	}
 	SG_FileType GetFileTypeS(const wchar_t *a_pszPath) {
@@ -390,10 +394,12 @@
 	const char *GetFileNameS(char) const {
 		SG_ASSERT(m_uiCurr != (size_t) -1);
 		return m_glob.gl_pathv[m_uiCurr];
-	} bool IsDirS(char) const {
+	}
+	bool IsDirS(char) const {
 		SG_ASSERT(m_uiCurr != (size_t) -1);
 		return m_bIsDir;
-	} SG_FileType GetFileTypeS(const char *a_pszPath) const {
+	}
+	SG_FileType GetFileTypeS(const char *a_pszPath) const {
 		struct stat sb;
 		if   (0 != stat(a_pszPath, &sb)) {
 			return SG_FILETYPE_INVALID;
@@ -777,7 +783,7 @@
 // ---------------------------------------------------------------------------
 
 typedef CSimpleGlobTempl < char >CSimpleGlobA;	/*!< @brief ASCII/MBCS version of CSimpleGlob */
-typedef CSimpleGlobTempl < wchar_t >CSimpleGlobW;	/*!< @brief wchar_t version of CSimpleGlob */
+typedef CSimpleGlobTempl < wchar_t > CSimpleGlobW;	/*!< @brief wchar_t version of CSimpleGlob */
 #if defined(_UNICODE)
 # define CSimpleGlob CSimpleGlobW	/*!< @brief TCHAR version dependent on if _UNICODE is defined */
 #else

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/private/switch_core_pvt.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/private/switch_core_pvt.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/private/switch_core_pvt.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -74,6 +74,7 @@
 #endif
 #endif
 
+
 /* #define DEBUG_ALLOC */
 #define DO_EVENTS
 
@@ -114,7 +115,7 @@
 	switch_codec_implementation_t write_impl;
 	switch_codec_implementation_t video_read_impl;
 	switch_codec_implementation_t video_write_impl;
-	
+
 	switch_audio_resampler_t *read_resampler;
 	switch_audio_resampler_t *write_resampler;
 
@@ -129,11 +130,12 @@
 	void *streams[SWITCH_MAX_STREAMS];
 	int stream_count;
 
-	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1];
+	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
 	void *private_info;
 	switch_queue_t *event_queue;
 	switch_queue_t *message_queue;
 	switch_queue_t *private_event_queue;
+	switch_queue_t *private_event_queue_pri;
 	switch_thread_rwlock_t *bug_rwlock;
 	switch_media_bug_t *bugs;
 	switch_app_log_t *app_log;
@@ -154,6 +156,7 @@
 	uint32_t read_frame_count;
 	uint32_t track_duration;
 	uint32_t track_id;
+	switch_log_level_t loglevel;
 };
 
 struct switch_media_bug {
@@ -191,6 +194,7 @@
 	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
 	uint32_t flags;
 	switch_time_t timestamp;
+	switch_mutex_t *uuid_mutex;
 	switch_mutex_t *throttle_mutex;
 	switch_mutex_t *session_hash_mutex;
 	switch_mutex_t *global_mutex;
@@ -211,10 +215,25 @@
 	char *odbc_user;
 	char *odbc_pass;
 	uint32_t debug_level;
+	uint32_t runlevel;
+	uint32_t tipping_point;
 };
 
 extern struct switch_runtime runtime;
 
+
+struct switch_session_manager {
+	switch_memory_pool_t *memory_pool;
+	switch_hash_t *session_table;
+	uint32_t session_count;
+	uint32_t session_limit;
+	switch_size_t session_id;
+};
+
+extern struct switch_session_manager session_manager;
+
+
+
 switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_t manage);
 void switch_core_sqldb_stop(void);
 void switch_core_session_init(switch_memory_pool_t *pool);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -106,7 +106,7 @@
 #include "switch_platform.h"
 #include "switch_types.h"
 #include "switch_apr.h"
-
+#include "switch_mprintf.h"
 #include "switch_core_db.h"
 #include "switch_dso.h"
 #include "switch_regex.h"

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_apr.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_apr.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_apr.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -40,17 +40,22 @@
 #define SWITCH_APR_H
 
 SWITCH_BEGIN_EXTERN_C
-
 #ifdef WIN32
-typedef DWORD                switch_thread_id_t;
+typedef DWORD switch_thread_id_t;
 #else
 #include <pthread.h>
-typedef pthread_t             switch_thread_id_t;
+typedef pthread_t switch_thread_id_t;
 #endif
 
 SWITCH_DECLARE(switch_thread_id_t) switch_thread_self(void);
 
+/*! \brief Compare two thread ids 
+ *  \param tid1 1st Thread ID to compare
+ *  \param tid2 2nd Thread ID to compare
+*/
+SWITCH_DECLARE(int) switch_thread_equal(switch_thread_id_t tid1, switch_thread_id_t tid2);
 
+
 /*
    The pieces of apr we allow ppl to pass around between modules we typedef into our namespace and wrap all the functions
    any other apr code should be as hidden as possible.
@@ -102,7 +107,7 @@
  * @bug We aught to provide an alternative to RTLD_GLOBAL, which
  * is the only supported method of loading DSOs today.
  */
-SWITCH_DECLARE(switch_status_t) switch_dso_load(switch_dso_handle_t **res_handle, const char *path, switch_memory_pool_t *ctx);
+SWITCH_DECLARE(switch_status_t) switch_dso_load(switch_dso_handle_t ** res_handle, const char *path, switch_memory_pool_t *ctx);
 
 /**
  * Close a DSO library.
@@ -372,7 +377,7 @@
  * it will behave as either a nested or an unnested lock.
  *
 */
-SWITCH_DECLARE(switch_status_t) switch_mutex_init(switch_mutex_t **lock, unsigned int flags, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_mutex_init(switch_mutex_t ** lock, unsigned int flags, switch_memory_pool_t *pool);
 
 
 /**
@@ -414,7 +419,7 @@
 /** Opaque structure used for the rwlock */
 	 typedef struct apr_thread_rwlock_t switch_thread_rwlock_t;
 
-SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_create(switch_thread_rwlock_t **rwlock, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_create(switch_thread_rwlock_t ** rwlock, switch_memory_pool_t *pool);
 SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_destroy(switch_thread_rwlock_t *rwlock);
 SWITCH_DECLARE(switch_memory_pool_t *) switch_thread_rwlock_pool_get(switch_thread_rwlock_t *rwlock);
 SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_rdlock(switch_thread_rwlock_t *rwlock);
@@ -448,7 +453,7 @@
  *        will be stored.
  * @param pool the pool from which to allocate the mutex.
  */
-SWITCH_DECLARE(switch_status_t) switch_thread_cond_create(switch_thread_cond_t **cond, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_thread_cond_create(switch_thread_cond_t ** cond, switch_memory_pool_t *pool);
 
 /**
  * Put the active calling thread to sleep until signaled to wake up. Each
@@ -574,7 +579,7 @@
  * @param queue_capacity maximum size of the queue
  * @param pool a pool to allocate queue from
  */
-SWITCH_DECLARE(switch_status_t) switch_queue_create(switch_queue_t **queue, unsigned int queue_capacity, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_queue_create(switch_queue_t ** queue, unsigned int queue_capacity, switch_memory_pool_t *pool);
 
 /**
  * pop/get an object from the queue, blocking if the queue is already empty
@@ -768,17 +773,14 @@
  * @remark If perm is SWITCH_FPROT_OS_DEFAULT and the file is being created,
  * appropriate default permissions will be used.
  */
-SWITCH_DECLARE(switch_status_t) switch_file_open(switch_file_t **newf, const char *fname, int32_t flag, switch_fileperms_t perm,
+SWITCH_DECLARE(switch_status_t) switch_file_open(switch_file_t ** newf, const char *fname, int32_t flag, switch_fileperms_t perm,
 												 switch_memory_pool_t *pool);
 
 
 SWITCH_DECLARE(switch_status_t) switch_file_seek(switch_file_t *thefile, switch_seek_where_t where, int64_t *offset);
 
 
-SWITCH_DECLARE(switch_status_t) switch_file_copy(const char *from_path, 
-												 const char *to_path,
-												 switch_fileperms_t perms,
-												 switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_file_copy(const char *from_path, const char *to_path, switch_fileperms_t perms, switch_memory_pool_t *pool);
 
 /**
  * Close the specified file.
@@ -838,7 +840,7 @@
 SWITCH_DECLARE(switch_status_t) switch_file_write(switch_file_t *thefile, const void *buf, switch_size_t *nbytes);
 SWITCH_DECLARE(int) switch_file_printf(switch_file_t *thefile, const char *format, ...);
 
-SWITCH_DECLARE(switch_status_t) switch_file_mktemp(switch_file_t **thefile, char *templ, int32_t flags, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_file_mktemp(switch_file_t ** thefile, char *templ, int32_t flags, switch_memory_pool_t *pool);
 
 SWITCH_DECLARE(switch_size_t) switch_file_get_size(switch_file_t *thefile);
 
@@ -879,7 +881,7 @@
 	 };
 	 typedef struct switch_array_header_t switch_array_header_t;
 
-SWITCH_DECLARE(switch_status_t) switch_dir_open(switch_dir_t **new_dir, const char *dirname, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_dir_open(switch_dir_t ** new_dir, const char *dirname, switch_memory_pool_t *pool);
 SWITCH_DECLARE(switch_status_t) switch_dir_close(switch_dir_t *thedir);
 SWITCH_DECLARE(const char *) switch_dir_next_file(switch_dir_t *thedir, char *buf, switch_size_t len);
 
@@ -914,7 +916,7 @@
  * @param new_attr The newly created threadattr.
  * @param pool The pool to use
  */
-SWITCH_DECLARE(switch_status_t) switch_threadattr_create(switch_threadattr_t **new_attr, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_threadattr_create(switch_threadattr_t ** new_attr, switch_memory_pool_t *pool);
 
 /**
  * Set if newly created threads should be created in detached state.
@@ -931,7 +933,7 @@
  * @param data Any data to be passed to the starting function
  * @param cont The pool to use
  */
-SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_thread, switch_threadattr_t *attr,
+SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t ** new_thread, switch_threadattr_t *attr,
 													 switch_thread_start_t func, void *data, switch_memory_pool_t *cont);
 
 /** @} */
@@ -1000,7 +1002,7 @@
  * @param protocol The protocol of the socket (e.g., SWITCH_PROTO_TCP).
  * @param pool The pool to use
  */
-SWITCH_DECLARE(switch_status_t) switch_socket_create(switch_socket_t **new_sock, int family, int type, int protocol, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_socket_create(switch_socket_t ** new_sock, int family, int type, int protocol, switch_memory_pool_t *pool);
 
 /**
  * Shutdown either reading, writing, or both sides of a socket.
@@ -1049,7 +1051,7 @@
  * @param sock The socket we are listening on.
  * @param pool The pool for the new socket.
  */
-SWITCH_DECLARE(switch_status_t) switch_socket_accept(switch_socket_t **new_sock, switch_socket_t *sock, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_socket_accept(switch_socket_t ** new_sock, switch_socket_t *sock, switch_memory_pool_t *pool);
 
 /**
  * Issue a connection request to a socket either on the same machine 
@@ -1089,7 +1091,7 @@
  * </PRE>
  * @param pool The pool for the apr_sockaddr_t and associated storage.
  */
-SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t **sa, const char *hostname,
+SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t ** sa, const char *hostname,
 														 int32_t family, switch_port_t port, int32_t flags, switch_memory_pool_t *pool);
 
 /**
@@ -1118,7 +1120,8 @@
  * @param buf  The data to send
  * @param len  The length of the data to send
  */
-SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t *sock, switch_sockaddr_t *where, int32_t flags, const char *buf, switch_size_t *len);
+SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t *sock, switch_sockaddr_t *where, int32_t flags, const char *buf,
+													 switch_size_t *len);
 
 /**
  * @param from The apr_sockaddr_t to fill in the recipient info
@@ -1213,26 +1216,27 @@
 
 /** @} */
 
-typedef enum {
-    SWITCH_NO_DESC,                /**< nothing here */
-    SWITCH_POLL_SOCKET,            /**< descriptor refers to a socket */
-    SWITCH_POLL_FILE,              /**< descriptor refers to a file */
-    SWITCH_POLL_LASTDESC           /**< descriptor is the last one in the list */
-} switch_pollset_type_t;
+	 typedef enum {
+		 SWITCH_NO_DESC,		   /**< nothing here */
+		 SWITCH_POLL_SOCKET,	   /**< descriptor refers to a socket */
+		 SWITCH_POLL_FILE,		   /**< descriptor refers to a file */
+		 SWITCH_POLL_LASTDESC	   /**< descriptor is the last one in the list */
+	 } switch_pollset_type_t;
 
-typedef union {
-    switch_file_t *f;              /**< file */
-    switch_socket_t *s;            /**< socket */
-} switch_descriptor_t;
+	 typedef union {
+		 switch_file_t *f;		   /**< file */
+		 switch_socket_t *s;	   /**< socket */
+	 } switch_descriptor_t;
 
-struct switch_pollfd {
-    switch_memory_pool_t *p;              /**< associated pool */
-    switch_pollset_type_t desc_type;   /**< descriptor type */
-    int16_t reqevents;      /**< requested events */
-    int16_t rtnevents;      /**< returned events */
-    switch_descriptor_t desc;        /**< @see apr_descriptor */
-    void *client_data;          /**< allows app to associate context */
-};
+	 struct switch_pollfd {
+		 switch_memory_pool_t *p;		  /**< associated pool */
+		 switch_pollset_type_t desc_type;
+									   /**< descriptor type */
+		 int16_t reqevents;	/**< requested events */
+		 int16_t rtnevents;	/**< returned events */
+		 switch_descriptor_t desc;	 /**< @see apr_descriptor */
+		 void *client_data;		/**< allows app to associate context */
+	 };
 
 
 
@@ -1271,7 +1275,7 @@
  * platforms; the apr_pollset_create() call will fail with
  * APR_ENOTIMPL on platforms where it is not supported.
  */
-SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t **pollset, uint32_t size, switch_memory_pool_t *p, uint32_t flags);
+SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t ** pollset, uint32_t size, switch_memory_pool_t *p, uint32_t flags);
 
 /**
  * Add a socket or file descriptor to a pollset
@@ -1315,10 +1319,10 @@
   \param pool the memory pool to use
   \return SWITCH_STATUS_SUCCESS when successful
 */
-SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **poll, switch_socket_t *sock, int16_t flags, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t ** poll, switch_socket_t *sock, int16_t flags, switch_memory_pool_t *pool);
 
-SWITCH_DECLARE(switch_status_t) switch_match_glob(const char *pattern, switch_array_header_t **result, switch_memory_pool_t *p);
-SWITCH_DECLARE(switch_status_t) switch_socket_addr_get(switch_sockaddr_t **sa, switch_bool_t remote, switch_socket_t *sock);
+SWITCH_DECLARE(switch_status_t) switch_match_glob(const char *pattern, switch_array_header_t ** result, switch_memory_pool_t *p);
+SWITCH_DECLARE(switch_status_t) switch_socket_addr_get(switch_sockaddr_t ** sa, switch_bool_t remote, switch_socket_t *sock);
 
 /**
  * Create an anonymous pipe.
@@ -1326,7 +1330,7 @@
  * @param out The file descriptor to use as output from the pipe.
  * @param pool The pool to operate on.
  */
-SWITCH_DECLARE(switch_status_t) switch_file_pipe_create(switch_file_t **in, switch_file_t **out, switch_memory_pool_t *p);
+SWITCH_DECLARE(switch_status_t) switch_file_pipe_create(switch_file_t ** in, switch_file_t ** out, switch_memory_pool_t *p);
 
 /**
  * Get the timeout value for a pipe or manipulate the blocking state.

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_bitpack.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_bitpack.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_bitpack.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_buffer.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_buffer.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_buffer.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_caller.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_caller.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_caller.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -147,7 +147,7 @@
 SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(_In_ switch_core_session_t *session,
 																		_In_z_ const char *extension_name, _In_z_ const char *extension_number);
 
-SWITCH_DECLARE(switch_status_t) switch_caller_extension_clone(switch_caller_extension_t **new_ext, switch_caller_extension_t *orig, 
+SWITCH_DECLARE(switch_status_t) switch_caller_extension_clone(switch_caller_extension_t **new_ext, switch_caller_extension_t *orig,
 															  switch_memory_pool_t *pool);
 
 /*!
@@ -169,8 +169,8 @@
   \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, ...);
+																	_In_ switch_caller_extension_t *caller_extension,
+																	_In_z_ const char *application_name, _In_z_ const char *fmt, ...);
 
 
 /*!

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_channel.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_channel.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_channel.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -48,6 +48,7 @@
 	switch_time_t progress_media;
 	switch_time_t hungup;
 	switch_time_t transferred;
+	switch_time_t resurrected;
 	struct switch_channel_timetable *next;
 };
 
@@ -74,21 +75,20 @@
   \param channel channel to test
   \return true if the channel is ready
 */
-SWITCH_DECLARE(int) switch_channel_test_ready(switch_channel_t *channel, switch_bool_t media);
+SWITCH_DECLARE(int) switch_channel_test_ready(switch_channel_t *channel, switch_bool_t check_ready, switch_bool_t check_media);
 
-#define switch_channel_ready(_channel) switch_channel_test_ready(_channel, SWITCH_FALSE)
-#define switch_channel_media_ready(_channel) switch_channel_test_ready(_channel, SWITCH_TRUE)
+#define switch_channel_ready(_channel) switch_channel_test_ready(_channel, SWITCH_TRUE, SWITCH_FALSE)
+#define switch_channel_media_ready(_channel) switch_channel_test_ready(_channel, SWITCH_TRUE, SWITCH_TRUE)
+
 #define switch_channel_up(_channel) (switch_channel_get_state(_channel) < CS_HANGUP)
 #define switch_channel_down(_channel) (switch_channel_get_state(_channel) >= CS_HANGUP)
 #define switch_channel_media_ack(_channel) (!switch_channel_test_cap(_channel, CC_MEDIA_ACK) || switch_channel_test_flag(_channel, CF_MEDIA_ACK))
 
 SWITCH_DECLARE(void) switch_channel_wait_for_state(switch_channel_t *channel, switch_channel_t *other_channel, switch_channel_state_t want_state);
 SWITCH_DECLARE(void) switch_channel_wait_for_state_timeout(switch_channel_t *other_channel, switch_channel_state_t want_state, uint32_t timeout);
-SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_flag(switch_channel_t *channel, 
-															 switch_channel_flag_t want_flag, 
-															 switch_bool_t pres, 
-															 uint32_t to,
-															 switch_channel_t *super_channel);
+SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_flag(switch_channel_t *channel,
+															 switch_channel_flag_t want_flag,
+															 switch_bool_t pres, uint32_t to, switch_channel_t *super_channel);
 
 SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_state(switch_channel_t *channel,
 																		const char *file, const char *func, int line, switch_channel_state_t state);
@@ -142,7 +142,8 @@
   \param pool memory_pool to use for allocation
   \return SWITCH_STATUS_SUCCESS if successful
 */
-SWITCH_DECLARE(switch_status_t) switch_channel_alloc(_In_ switch_channel_t **channel, _In_ switch_call_direction_t direction, _In_ switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_channel_alloc(_In_ switch_channel_t **channel, _In_ switch_call_direction_t direction,
+													 _In_ switch_memory_pool_t *pool);
 
 /*!
   \brief Connect a newly allocated channel to a session object and setup it's initial state
@@ -231,11 +232,12 @@
 
 SWITCH_DECLARE(switch_status_t) switch_channel_set_profile_var(switch_channel_t *channel, const char *name, const char *val);
 
-SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_var_check(switch_channel_t *channel, 
+SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_var_check(switch_channel_t *channel,
 																	  const char *varname, const char *value, switch_bool_t var_check);
-SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_printf(switch_channel_t *channel, const char *varname,  const char *fmt, ...);
+SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_printf(switch_channel_t *channel, const char *varname, const char *fmt, ...);
+SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_name_printf(switch_channel_t *channel, const char *val, const char *fmt, ...);
 
-SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_partner_var_check(switch_channel_t *channel, 
+SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_partner_var_check(switch_channel_t *channel,
 																			  const char *varname, const char *value, switch_bool_t var_check);
 SWITCH_DECLARE(const char *) switch_channel_get_variable_partner(switch_channel_t *channel, const char *varname);
 
@@ -249,7 +251,9 @@
   \param varname the name of the variable
   \return the value of the requested variable
 */
-SWITCH_DECLARE(const char *) switch_channel_get_variable(switch_channel_t *channel, const char *varname);
+SWITCH_DECLARE(const char *) switch_channel_get_variable_dup(switch_channel_t *channel, const char *varname, switch_bool_t dup);
+#define switch_channel_get_variable(_c, _v) switch_channel_get_variable_dup(_c, _v, SWITCH_TRUE)
+
 SWITCH_DECLARE(switch_status_t) switch_channel_get_variables(switch_channel_t *channel, switch_event_t **event);
 
 SWITCH_DECLARE(switch_status_t) switch_channel_pass_callee_id(switch_channel_t *channel, switch_channel_t *other_channel);
@@ -299,10 +303,14 @@
   \param channel channel on which to set flag
   \param flag or'd list of flags to set
 */
-SWITCH_DECLARE(void) switch_channel_set_flag(switch_channel_t *channel, switch_channel_flag_t flag);
+SWITCH_DECLARE(void) switch_channel_set_flag_value(switch_channel_t *channel, switch_channel_flag_t flag, uint32_t value);
+#define switch_channel_set_flag(_c, _f) switch_channel_set_flag_value(_c, _f, 1)
+
 SWITCH_DECLARE(void) switch_channel_set_flag_recursive(switch_channel_t *channel, switch_channel_flag_t flag);
 
-SWITCH_DECLARE(void) switch_channel_set_cap(switch_channel_t *channel, switch_channel_cap_t cap);
+SWITCH_DECLARE(void) switch_channel_set_cap_value(switch_channel_t *channel, switch_channel_cap_t cap, uint32_t value);
+#define switch_channel_set_cap(_c, _cc) switch_channel_set_cap_value(_c, _cc, 1)
+
 SWITCH_DECLARE(void) switch_channel_clear_cap(switch_channel_t *channel, switch_channel_cap_t cap);
 SWITCH_DECLARE(uint32_t) switch_channel_test_cap(switch_channel_t *channel, switch_channel_cap_t cap);
 
@@ -337,6 +345,7 @@
   \param flag flag to clear
 */
 SWITCH_DECLARE(void) switch_channel_clear_flag(switch_channel_t *channel, switch_channel_flag_t flag);
+
 SWITCH_DECLARE(void) switch_channel_clear_flag_recursive(switch_channel_t *channel, switch_channel_flag_t flag);
 
 SWITCH_DECLARE(switch_status_t) switch_channel_perform_answer(switch_channel_t *channel, const char *file, const char *func, int line);
@@ -433,6 +442,7 @@
   \return void pointer to channel's private data
 */
 SWITCH_DECLARE(void *) switch_channel_get_private(switch_channel_t *channel, const char *key);
+SWITCH_DECLARE(void *) switch_channel_get_private_partner(switch_channel_t *channel, const char *key);
 
 /*!
   \brief Assign a name to a given channel
@@ -537,6 +547,9 @@
 SWITCH_DECLARE(int) switch_channel_test_app_flag(switch_channel_t *channel, uint32_t flags);
 SWITCH_DECLARE(void) switch_channel_set_hangup_time(switch_channel_t *channel);
 SWITCH_DECLARE(switch_call_direction_t) switch_channel_direction(switch_channel_t *channel);
+SWITCH_DECLARE(switch_core_session_t *) switch_channel_get_session(switch_channel_t *channel);
+SWITCH_DECLARE(char *) switch_channel_get_flag_string(switch_channel_t *channel);
+SWITCH_DECLARE(char *) switch_channel_get_cap_string(switch_channel_t *channel);
 
 /** @} */
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_config.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_config.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_config.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_console.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_console.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_console.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -76,6 +76,22 @@
 
 SWITCH_DECLARE(switch_status_t) switch_stream_write_file_contents(switch_stream_handle_t *stream, const char *path);
 
+
+SWITCH_DECLARE(switch_status_t) switch_console_init(switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_console_shutdown(void);
+SWITCH_DECLARE(switch_status_t) switch_console_add_complete_func(const char *name, switch_console_complete_callback_t cb);
+SWITCH_DECLARE(switch_status_t) switch_console_del_complete_func(const char *name);
+SWITCH_DECLARE(switch_status_t) switch_console_run_complete_func(const char *func, const char *line,
+																 const char *last_word, switch_console_callback_match_t **matches);
+SWITCH_DECLARE(void) switch_console_push_match(switch_console_callback_match_t **matches, const char *new_val);
+SWITCH_DECLARE(void) switch_console_free_matches(switch_console_callback_match_t **matches);
+SWITCH_DECLARE(unsigned char) switch_console_complete(const char *line, const char *last_word,
+													  FILE * console_out, switch_stream_handle_t *stream, switch_xml_t xml);
+SWITCH_DECLARE(void) switch_console_sort_matches(switch_console_callback_match_t *matches);
+SWITCH_DECLARE(void) switch_console_save_history(void);
+SWITCH_DECLARE(char *) switch_console_expand_alias(char *cmd, char *arg);
+SWITCH_DECLARE(switch_status_t) switch_console_execute(char *xcmd, int rec, switch_stream_handle_t *istream);
+
 SWITCH_END_EXTERN_C
 #endif
 /* For Emacs:

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_core.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_core.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_core.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -134,6 +134,8 @@
 SWITCH_DECLARE(void) switch_core_session_enable_heartbeat(switch_core_session_t *session, uint32_t seconds);
 SWITCH_DECLARE(void) switch_core_session_disable_heartbeat(switch_core_session_t *session);
 
+#define switch_core_session_get_name(_s) switch_channel_get_name(switch_core_session_get_channel(_s))
+
 /*!
   \brief Add a media bug to the session
   \param session the session to add the bug to
@@ -202,6 +204,8 @@
   \return true value if the object has the flags defined
 */
 SWITCH_DECLARE(uint32_t) switch_core_media_bug_test_flag(_In_ switch_media_bug_t *bug, _In_ uint32_t flag);
+SWITCH_DECLARE(uint32_t) switch_core_media_bug_set_flag(_In_ switch_media_bug_t *bug, _In_ uint32_t flag);
+SWITCH_DECLARE(uint32_t) switch_core_media_bug_clear_flag(_In_ switch_media_bug_t *bug, _In_ uint32_t flag);
 
 /*!
   \brief Set a return replace frame
@@ -365,7 +369,8 @@
 
 
 #ifdef SWITCH_DEBUG_RWLOCKS
-SWITCH_DECLARE(switch_status_t) switch_core_session_perform_read_lock_hangup(_In_ switch_core_session_t *session, const char *file, const char *func, int line);
+SWITCH_DECLARE(switch_status_t) switch_core_session_perform_read_lock_hangup(_In_ switch_core_session_t *session, const char *file, const char *func,
+																			 int line);
 #endif
 
 /*! 
@@ -552,6 +557,17 @@
 SWITCH_DECLARE(char *) switch_core_session_sprintf(_In_ switch_core_session_t *session, _In_z_ _Printf_format_string_ const char *fmt, ...);
 
 /*!
+  \brief printf-style style printing routine.  The data is output to a string allocated from the session
+  \param session a session to use for allocation
+  \param fmt The format of the string
+  \param ap The arguments to use while printing the data
+  \return The new string
+*/
+#ifndef SWIG
+SWITCH_DECLARE(char *) switch_core_session_vsprintf(switch_core_session_t *session, const char *fmt, va_list ap);
+#endif
+
+/*!
   \brief printf-style style printing routine.  The data is output to a string allocated from the pool
   \param pool a pool to use for allocation
   \param fmt The format of the string
@@ -560,6 +576,17 @@
 */
 SWITCH_DECLARE(char *) switch_core_sprintf(_In_ switch_memory_pool_t *pool, _In_z_ _Printf_format_string_ const char *fmt, ...);
 
+/*!
+  \brief printf-style style printing routine.  The data is output to a string allocated from the pool
+  \param pool a pool to use for allocation
+  \param fmt The format of the string
+  \param ap The arguments to use while printing the data
+  \return The new string
+*/
+#ifndef SWIG
+SWITCH_DECLARE(char *) switch_core_vsprintf(switch_memory_pool_t *pool, _In_z_ _Printf_format_string_ const char *fmt, va_list ap);
+#endif
+
 /*! 
   \brief Retrieve the memory pool from a session
   \param session the session to retrieve the pool from
@@ -569,6 +596,9 @@
 SWITCH_DECLARE(switch_memory_pool_t *) switch_core_session_get_pool(_In_ switch_core_session_t *session);
 ///\}
 
+SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_xml(switch_endpoint_interface_t *endpoint_interface,
+																		switch_memory_pool_t **pool, switch_xml_t xml);
+
 ///\defgroup sessm Session Creation / Management
 ///\ingroup core1
 ///\{
@@ -578,7 +608,7 @@
   \param pool the pool to use for the allocation (a new one will be used if NULL)
   \return the newly created session
 */
-SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(_In_ switch_endpoint_interface_t *endpoint_interface, 
+SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(_In_ switch_endpoint_interface_t *endpoint_interface,
 																		 _In_ switch_call_direction_t direction,
 																		 _Inout_opt_ switch_memory_pool_t **pool, _In_opt_z_ const char *use_uuid);
 #define switch_core_session_request(_ep, _d, _p) switch_core_session_request_uuid(_ep, _d, _p, NULL)
@@ -597,7 +627,7 @@
 
 SWITCH_DECLARE(void) switch_core_session_destroy_state(switch_core_session_t *session);
 SWITCH_DECLARE(void) switch_core_session_reporting_state(switch_core_session_t *session);
-SWITCH_DECLARE(void) switch_core_session_hangup_state(switch_core_session_t *session);
+SWITCH_DECLARE(void) switch_core_session_hangup_state(switch_core_session_t *session, switch_bool_t force);
 
 /*! 
   \brief Provide the total number of sessions
@@ -619,9 +649,8 @@
   \param pool the pool to use
   \return the newly created session
 */
-SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(_In_z_ const char *endpoint_name, 
-																			_In_ switch_call_direction_t direction,
-																			_Inout_ switch_memory_pool_t **pool);
+SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(_In_z_ const char *endpoint_name,
+																			_In_ switch_call_direction_t direction, _Inout_ switch_memory_pool_t **pool);
 
 /*! 
   \brief Launch the session thread (state machine) on a given session
@@ -650,7 +679,23 @@
 */
 SWITCH_DECLARE(char *) switch_core_session_get_uuid(_In_ switch_core_session_t *session);
 
+
 /*! 
+  \brief Sets the log level for a session
+  \param session the session to set the log level on 
+  \return SWITCH_STATUS_SUCCESS
+*/
+SWITCH_DECLARE(switch_status_t) switch_core_session_set_loglevel(switch_core_session_t *session, switch_log_level_t loglevel);
+
+
+/*! 
+  \brief Get the log level for a session
+  \param session the session to get the log level from 
+  \return the log level
+*/
+SWITCH_DECLARE(switch_log_level_t) switch_core_session_get_loglevel(switch_core_session_t *session);
+
+/*! 
   \brief Retrieve the unique identifier from the core
   \return a string representing the uuid
 */
@@ -808,12 +853,24 @@
   \param session the current session
   \param app the application's name
   \param arg application arguments
-  \warning Has to be called from the session's thread
+  \param flags pointer to a flags variable to set the applications flags to
   \return the application's return value
 */
-SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application(_In_ switch_core_session_t *session,
-																		_In_ const char *app, _In_opt_z_ const char *arg);
+SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_get_flags(_In_ switch_core_session_t *session,
+																				  _In_ const char *app, _In_opt_z_ const char *arg, _Out_opt_ int32_t *flags);
+
+SWITCH_DECLARE(switch_status_t) switch_core_session_get_app_flags(const char *app, int32_t *flags);
+
 /*! 
+  \brief Execute an application on a session 
+  \param session the current session
+  \param app the application's name
+  \param arg application arguments
+  \return the application's return value
+*/
+#define switch_core_session_execute_application(_a, _b, _c) switch_core_session_execute_application_get_flags(_a, _b, _c, NULL)
+
+/*! 
   \brief Run a dialplan and execute an extension
   \param session the current session
   \param exten the interface of the application to execute
@@ -909,7 +966,8 @@
 																		 _In_z_ const char *endpoint_name,
 																		 _In_ switch_caller_profile_t *caller_profile,
 																		 _Inout_ switch_core_session_t **new_session,
-																		 _Inout_ switch_memory_pool_t **pool, _In_ switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
+																		 _Inout_ switch_memory_pool_t **pool, _In_ switch_originate_flag_t flags,
+																		 switch_call_cause_t *cancel_cause);
 
 SWITCH_DECLARE(switch_call_cause_t) switch_core_session_resurrect_channel(_In_z_ const char *endpoint_name,
 																		  _Inout_ switch_core_session_t **new_session,
@@ -921,7 +979,7 @@
   \param message the message to recieve
   \return the status returned by the message handler
 */
-SWITCH_DECLARE(switch_status_t) switch_core_session_perform_receive_message(_In_ switch_core_session_t *session, 
+SWITCH_DECLARE(switch_status_t) switch_core_session_perform_receive_message(_In_ switch_core_session_t *session,
 																			_In_ switch_core_session_message_t *message,
 																			const char *file, const char *func, int line);
 #define switch_core_session_receive_message(_session, _message) switch_core_session_perform_receive_message(_session, _message, \
@@ -956,9 +1014,11 @@
   \brief Queue a private event on a given session
   \param session the session to queue the message on
   \param event the event to queue
+  \param priority event has high priority
   \return the status returned by the message handler
 */
-SWITCH_DECLARE(switch_status_t) switch_core_session_queue_private_event(_In_ switch_core_session_t *session, _Inout_ switch_event_t **event);
+SWITCH_DECLARE(switch_status_t) switch_core_session_queue_private_event(_In_ switch_core_session_t *session, _Inout_ switch_event_t **event,
+																		switch_bool_t priority);
 
 
 /*! 
@@ -1199,6 +1259,8 @@
 SWITCH_DECLARE(switch_status_t) switch_core_timer_init(switch_timer_t *timer, const char *timer_name, int interval, int samples,
 													   switch_memory_pool_t *pool);
 
+SWITCH_DECLARE(void) switch_time_calibrate_clock(void);
+
 /*! 
   \brief Wait for one cycle on an existing timer
   \param timer the timer to wait on
@@ -1324,10 +1386,10 @@
 SWITCH_DECLARE(void) switch_core_session_unlock_codec_read(_In_ switch_core_session_t *session);
 
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_get_read_impl(switch_core_session_t *session,  switch_codec_implementation_t *impp);
-SWITCH_DECLARE(switch_status_t) switch_core_session_get_write_impl(switch_core_session_t *session,  switch_codec_implementation_t *impp);
-SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_read_impl(switch_core_session_t *session,  switch_codec_implementation_t *impp);
-SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_write_impl(switch_core_session_t *session,  switch_codec_implementation_t *impp);
+SWITCH_DECLARE(switch_status_t) switch_core_session_get_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp);
+SWITCH_DECLARE(switch_status_t) switch_core_session_get_write_impl(switch_core_session_t *session, switch_codec_implementation_t *impp);
+SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp);
+SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_write_impl(switch_core_session_t *session, switch_codec_implementation_t *impp);
 
 
 /*! 
@@ -1579,8 +1641,7 @@
   \param flags flags in/out for fine tuning
   \return SWITCH_STATUS_SUCCESS with len adjusted to the bytes written if successful
 */
-SWITCH_DECLARE(switch_status_t) switch_core_speech_read_tts(switch_speech_handle_t *sh,
-															void *data, switch_size_t *datalen, switch_speech_flag_t *flags);
+SWITCH_DECLARE(switch_status_t) switch_core_speech_read_tts(switch_speech_handle_t *sh, void *data, switch_size_t *datalen, switch_speech_flag_t *flags);
 /*! 
   \brief Close an open speech handle
   \param sh the speech handle to close
@@ -1850,7 +1911,7 @@
 /*! 
   \brief Launch a thread
 */
-SWITCH_DECLARE(switch_thread_t *) switch_core_launch_thread(void *(SWITCH_THREAD_FUNC *func) (switch_thread_t *, void *), 
+SWITCH_DECLARE(switch_thread_t *) switch_core_launch_thread(void *(SWITCH_THREAD_FUNC * func) (switch_thread_t *, void *),
 															void *obj, switch_memory_pool_t *pool);
 #endif
 
@@ -1902,6 +1963,9 @@
 SWITCH_DECLARE(switch_bool_t) switch_check_network_list_ip_token(const char *ip_str, const char *list_name, const char **token);
 #define switch_check_network_list_ip(_ip_str, _list_name) switch_check_network_list_ip_token(_ip_str, _list_name, NULL)
 SWITCH_DECLARE(void) switch_time_set_monotonic(switch_bool_t enable);
+SWITCH_DECLARE(void) switch_time_set_nanosleep(switch_bool_t enable);
+SWITCH_DECLARE(void) switch_time_set_matrix(switch_bool_t enable);
+SWITCH_DECLARE(void) switch_time_set_cond_yield(switch_bool_t enable);
 SWITCH_DECLARE(uint32_t) switch_core_min_dtmf_duration(uint32_t duration);
 SWITCH_DECLARE(uint32_t) switch_core_max_dtmf_duration(uint32_t duration);
 SWITCH_DECLARE(uint32_t) switch_core_default_dtmf_duration(uint32_t duration);
@@ -1910,7 +1974,7 @@
 SWITCH_DECLARE(int) switch_system(const char *cmd, switch_bool_t wait);
 SWITCH_DECLARE(void) switch_cond_yield(switch_interval_time_t t);
 SWITCH_DECLARE(void) switch_cond_next(void);
-SWITCH_DECLARE(switch_status_t) switch_core_chat_send(const char *name, const char *proto, const char *from, const char *to, 
+SWITCH_DECLARE(switch_status_t) switch_core_chat_send(const char *name, const char *proto, const char *from, const char *to,
 													  const char *subject, const char *body, const char *type, const char *hint);
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_preprocess_session(switch_core_session_t *session, const char *cmds);
@@ -1922,50 +1986,51 @@
 */
 
 #define CACHE_DB_LEN 256
-typedef enum {
-	CDF_INUSE = (1 << 0)
-} cache_db_flag_t;
+	 typedef enum {
+		 CDF_INUSE = (1 << 0)
+	 } cache_db_flag_t;
 
-typedef enum {
-	SCDB_TYPE_CORE_DB,
-	SCDB_TYPE_ODBC
-} switch_cache_db_handle_type_t;
+	 typedef enum {
+		 SCDB_TYPE_CORE_DB,
+		 SCDB_TYPE_ODBC
+	 } switch_cache_db_handle_type_t;
 
-typedef union {
-	switch_core_db_t *core_db_dbh;
-	switch_odbc_handle_t *odbc_dbh;	
-} switch_cache_db_native_handle_t;
+	 typedef union {
+		 switch_core_db_t *core_db_dbh;
+		 switch_odbc_handle_t *odbc_dbh;
+	 } switch_cache_db_native_handle_t;
 
-typedef struct {
-	char *db_path;
-} switch_cache_db_core_db_options_t;
+	 typedef struct {
+		 char *db_path;
+	 } switch_cache_db_core_db_options_t;
 
-typedef struct {
-	char *dsn;
-	char *user;
-	char *pass;
-} switch_cache_db_odbc_options_t;
+	 typedef struct {
+		 char *dsn;
+		 char *user;
+		 char *pass;
+	 } switch_cache_db_odbc_options_t;
 
-typedef union {
-	switch_cache_db_core_db_options_t core_db_options;
-	switch_cache_db_odbc_options_t odbc_options;
-} switch_cache_db_connection_options_t;
+	 typedef union {
+		 switch_cache_db_core_db_options_t core_db_options;
+		 switch_cache_db_odbc_options_t odbc_options;
+	 } switch_cache_db_connection_options_t;
 
-typedef struct {
-	char name[CACHE_DB_LEN];
-	switch_cache_db_handle_type_t type;
-	switch_cache_db_native_handle_t native_handle;
-	time_t last_used;
-	switch_mutex_t *mutex;
-	switch_memory_pool_t *pool;
-	int32_t flags;
-	unsigned long hash;
-	char creator[CACHE_DB_LEN];
-	char last_user[CACHE_DB_LEN];
-} switch_cache_db_handle_t;
+	 typedef struct {
+		 char name[CACHE_DB_LEN];
+		 switch_cache_db_handle_type_t type;
+		 switch_cache_db_native_handle_t native_handle;
+		 time_t last_used;
+		 switch_mutex_t *mutex;
+		 switch_mutex_t *io_mutex;
+		 switch_memory_pool_t *pool;
+		 int32_t flags;
+		 unsigned long hash;
+		 char creator[CACHE_DB_LEN];
+		 char last_user[CACHE_DB_LEN];
+	 } switch_cache_db_handle_t;
 
 
-static inline const char *switch_cache_db_type_name(switch_cache_db_handle_type_t type)
+	 static inline const char *switch_cache_db_type_name(switch_cache_db_handle_type_t type)
 {
 	const char *type_str = "INVALID";
 
@@ -1985,9 +2050,9 @@
 	return type_str;
 }
 
-SWITCH_DECLARE(void) switch_cache_db_release_db_handle(switch_cache_db_handle_t **dbh);
-SWITCH_DECLARE(void) switch_cache_db_destroy_db_handle(switch_cache_db_handle_t **dbh);
-SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_handle_t **dbh, 
+SWITCH_DECLARE(void) switch_cache_db_release_db_handle(switch_cache_db_handle_t ** dbh);
+SWITCH_DECLARE(void) switch_cache_db_destroy_db_handle(switch_cache_db_handle_t ** dbh);
+SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_handle_t ** dbh,
 															   switch_cache_db_handle_type_t type,
 															   switch_cache_db_connection_options_t *connection_options,
 															   const char *file, const char *func, int line);
@@ -1995,18 +2060,22 @@
 
 SWITCH_DECLARE(char *) switch_cache_db_execute_sql2str(switch_cache_db_handle_t *dbh, char *sql, char *str, size_t len, char **err);
 SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql(switch_cache_db_handle_t *dbh, char *sql, char **err);
-SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_callback(switch_cache_db_handle_t *dbh, const char *sql, 
+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);
+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__)
 
-SWITCH_DECLARE(void) switch_cache_db_test_reactive(switch_cache_db_handle_t *db, const char *test_sql, const char *drop_sql, const char *reactive_sql);
+SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_handle_t *db,
+															const char *test_sql, const char *drop_sql, const char *reactive_sql);
 SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute(switch_cache_db_handle_t *dbh, const char *sql, uint32_t retries);
 SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_cache_db_handle_t *dbh, char *sql, uint32_t retries);
 SWITCH_DECLARE(void) switch_cache_db_detach(void);
 SWITCH_DECLARE(uint32_t) switch_core_debug_level(void);
+SWITCH_DECLARE(void) switch_cache_db_flush_handles(void);
+SWITCH_DECLARE(const char *) switch_core_banner(void);
+SWITCH_DECLARE(switch_bool_t) switch_core_session_in_thread(switch_core_session_t *session);
 
 SWITCH_END_EXTERN_C
 #endif

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_core_db.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_core_db.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_core_db.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -539,13 +539,7 @@
  * should always use %q instead of %s when inserting text into a string 
  * literal.
  */
-SWITCH_DECLARE(char *) switch_mprintf(const char *zFormat, ...);
 
-/*!
- * \see switch_mprintf
- */
-SWITCH_DECLARE(char *) switch_vmprintf(const char *zFormat, va_list ap);
-
 SWITCH_END_EXTERN_C
 #endif
 /* For Emacs:

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_core_event_hook.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_core_event_hook.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_core_event_hook.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -47,7 +47,7 @@
 typedef struct switch_io_event_hook_state_change switch_io_event_hook_state_change_t;
 typedef struct switch_io_event_hook_resurrect_session switch_io_event_hook_resurrect_session_t;
 typedef switch_status_t (*switch_outgoing_channel_hook_t)
-                               (switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t *, switch_originate_flag_t);
+                (switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t *, switch_originate_flag_t);
 typedef switch_status_t (*switch_receive_message_hook_t) (switch_core_session_t *, switch_core_session_message_t *);
 typedef switch_status_t (*switch_receive_event_hook_t) (switch_core_session_t *, switch_event_t *);
 typedef switch_status_t (*switch_read_frame_hook_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_cpp.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_cpp.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_cpp.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -154,7 +154,7 @@
 		 virtual SWITCH_DECLARE_CONSTRUCTOR ~ Event();
 		 SWITCH_DECLARE(const char *) serialize(const char *format = NULL);
 		 SWITCH_DECLARE(bool) setPriority(switch_priority_t priority = SWITCH_PRIORITY_NORMAL);
-		 SWITCH_DECLARE(const char *) getHeader(char *header_name);
+		 SWITCH_DECLARE(const char *) getHeader(const char *header_name);
 		 SWITCH_DECLARE(char *) getBody(void);
 		 SWITCH_DECLARE(const char *) getType(void);
 		 SWITCH_DECLARE(bool) addBody(const char *value);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_dso.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_dso.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_dso.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -25,10 +25,10 @@
 #ifdef WIN32
 typedef HINSTANCE switch_dso_lib_t;
 #else
-typedef void * switch_dso_lib_t;
+typedef void *switch_dso_lib_t;
 #endif
 
-typedef void * switch_dso_data_t;
+typedef void *switch_dso_data_t;
 
 SWITCH_DECLARE(void) switch_dso_destroy(switch_dso_lib_t *lib);
 SWITCH_DECLARE(switch_dso_lib_t) switch_dso_open(const char *path, int global, char **err);
@@ -48,4 +48,3 @@
  * For VIM:
  * vim:set softtabstop=4 shiftwidth=4 tabstop=4
  */
-

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_event.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_event.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_event.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -182,7 +182,8 @@
 */
 SWITCH_DECLARE(switch_status_t) switch_event_add_header_string(switch_event_t *event, switch_stack_t stack, const char *header_name, const char *data);
 
-SWITCH_DECLARE(switch_status_t) switch_event_del_header(switch_event_t *event, const char *header_name);
+SWITCH_DECLARE(switch_status_t) switch_event_del_header_val(switch_event_t *event, const char *header_name, const char *val);
+#define switch_event_del_header(_e, _h) switch_event_del_header_val(_e, _h, NULL)
 
 /*!
   \brief Destroy an event
@@ -236,7 +237,7 @@
   \param node bind handle to later remove the binding.
   \return SWITCH_STATUS_SUCCESS if the event was binded
 */
-SWITCH_DECLARE(switch_status_t) switch_event_bind_removable(const char *id, switch_event_types_t event, const char *subclass_name, 
+SWITCH_DECLARE(switch_status_t) switch_event_bind_removable(const char *id, switch_event_types_t event, const char *subclass_name,
 															switch_event_callback_t callback, void *user_data, switch_event_node_t **node);
 /*!
   \brief Unbind a bound event consumer
@@ -341,15 +342,16 @@
 */
 #define switch_event_create(event, id) switch_event_create_subclass(event, id, SWITCH_EVENT_SUBCLASS_ANY)
 
-static inline switch_status_t switch_event_create_plain(switch_event_t **event, switch_event_types_t event_id)
+	 static inline switch_status_t switch_event_create_plain(switch_event_t **event, switch_event_types_t event_id)
 {
 	switch_status_t status = switch_event_create(event, SWITCH_EVENT_CLONE);
 	if (status == SWITCH_STATUS_SUCCESS) {
 		(*event)->event_id = event_id;
 	}
-	
+
 	return status;
 }
+
 /*!
   \brief Deliver an event to all of the registered event listeners
   \param event the event to send (will be nulled)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_frame.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_frame.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_frame.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -46,7 +46,7 @@
 	/*! the originating source of the frame */
 	const char *source;
 	/*! the raw packet */
-	void *packet;	
+	void *packet;
 	/*! the size of the raw packet when applicable */
 	uint32_t packetlen;
 	/*! the extra frame data */

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_ivr.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_ivr.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_ivr.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -123,7 +123,8 @@
   \param timeout a timeout in milliseconds
   \return SWITCH_STATUS_SUCCESS to keep the collection moving.
 */
-SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_session_t *session, switch_input_args_t *args, uint32_t digit_timeout, uint32_t abs_timeout);
+SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_session_t *session, switch_input_args_t *args, uint32_t digit_timeout,
+																   uint32_t abs_timeout);
 
 /*!
   \brief Wait for specified number of DTMF digits, untile terminator is received or until the channel hangs up.
@@ -197,6 +198,8 @@
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, const char *name);
 
+SWITCH_DECLARE(switch_status_t) switch_ivr_set_param_detect_speech(switch_core_session_t *session, const char *name, const char *val);
+
 /*!
   \brief Record a session to disk
   \param session the session to record
@@ -244,6 +247,10 @@
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_stop_record_session(switch_core_session_t *session, const char *file);
 
+
+SWITCH_DECLARE(switch_status_t) switch_ivr_session_audio(switch_core_session_t *session, const char *cmd, const char *direction, int level);
+SWITCH_DECLARE(switch_status_t) switch_ivr_stop_session_audio(switch_core_session_t *session);
+
 /*!
   \brief Start looking for DTMF inband
   \param session the session to start looking
@@ -300,7 +307,7 @@
 */
 SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_session_t *session,
 															   const char *key, const char *tone_spec,
-															   const char *flags, time_t timeout, int hits, 
+															   const char *flags, time_t timeout, int hits,
 															   const char *app, const char *data, switch_tone_detect_callback_t callback);
 
 
@@ -317,7 +324,7 @@
 SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *session, switch_file_handle_t *fh, const char *file,
 													 switch_input_args_t *args);
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_silence(switch_core_session_t *session, uint32_t thresh, uint32_t silence_hits, 
+SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_silence(switch_core_session_t *session, uint32_t thresh, uint32_t silence_hits,
 															uint32_t listen_hits, uint32_t timeout_ms, const char *file);
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *session, const char *script, int32_t loops, switch_input_args_t *args);
@@ -404,11 +411,8 @@
 													 const switch_state_handler_table_t *table,
 													 const char *cid_name_override,
 													 const char *cid_num_override,
-													 switch_caller_profile_t *caller_profile_override, 
-													 switch_event_t *ovars,
-													 switch_originate_flag_t flags,
-													 switch_call_cause_t *cancel_cause
-													 );
+													 switch_caller_profile_t *caller_profile_override,
+													 switch_event_t *ovars, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_session_t *session,
 																switch_core_session_t **bleg,
@@ -418,10 +422,8 @@
 																const switch_state_handler_table_t *table,
 																const char *cid_name_override,
 																const char *cid_num_override,
-																switch_caller_profile_t *caller_profile_override, 
-																switch_event_t *ovars,
-																switch_originate_flag_t flags
-																);
+																switch_caller_profile_t *caller_profile_override,
+																switch_event_t *ovars, switch_originate_flag_t flags);
 
 SWITCH_DECLARE(void) switch_ivr_bridge_display(switch_core_session_t *session, switch_core_session_t *peer_session);
 
@@ -567,17 +569,17 @@
 
 /******************************************************************************************************/
 
-struct switch_ivr_digit_stream_parser;
-typedef struct switch_ivr_digit_stream_parser switch_ivr_digit_stream_parser_t;
-struct switch_ivr_digit_stream;
-typedef struct switch_ivr_digit_stream switch_ivr_digit_stream_t;
+	 struct switch_ivr_digit_stream_parser;
+	 typedef struct switch_ivr_digit_stream_parser switch_ivr_digit_stream_parser_t;
+	 struct switch_ivr_digit_stream;
+	 typedef struct switch_ivr_digit_stream switch_ivr_digit_stream_t;
 /*!
   \brief Create a digit stream parser object
   \param pool the pool to use for the new hash
   \param parser a pointer to the object pointer
   \return SWITCH_STATUS_SUCCESS if all is well 
 */
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_new(switch_memory_pool_t *pool, switch_ivr_digit_stream_parser_t **parser);
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_new(switch_memory_pool_t *pool, switch_ivr_digit_stream_parser_t ** parser);
 
 /*!
   \brief Destroy a digit stream parser object
@@ -592,14 +594,14 @@
   \param stream a pointer to the stream object pointer
   \return NULL if no match found or consumer data that was associated with a given digit string when matched
 */
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_new(switch_ivr_digit_stream_parser_t *parser, switch_ivr_digit_stream_t **stream);
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_new(switch_ivr_digit_stream_parser_t *parser, switch_ivr_digit_stream_t ** stream);
 
 /*!
   \brief Destroys a digit stream object
   \param stream a pointer to the stream object
   \return NULL if no match found or consumer data that was associated with a given digit string when matched
 */
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_destroy(switch_ivr_digit_stream_t **stream);
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_destroy(switch_ivr_digit_stream_t ** stream);
 
 /*!
   \brief Set a digit string to action mapping
@@ -656,25 +658,25 @@
  * @{
  */
 
-typedef enum {
-	SWITCH_IVR_MENU_FLAG_FALLTOMAIN = (1 << 0),
-	SWITCH_IVR_MENU_FLAG_FREEPOOL = (1 << 1),
-	SWITCH_IVR_MENU_FLAG_STACK = (1 << 2)
-} switch_ivr_menu_flags;
+	 typedef enum {
+		 SWITCH_IVR_MENU_FLAG_FALLTOMAIN = (1 << 0),
+		 SWITCH_IVR_MENU_FLAG_FREEPOOL = (1 << 1),
+		 SWITCH_IVR_MENU_FLAG_STACK = (1 << 2)
+	 } switch_ivr_menu_flags;
 /* Actions are either set in switch_ivr_menu_bind_function or returned by a callback */
-typedef enum {
-	SWITCH_IVR_ACTION_DIE,	/* Exit the menu.                  */
-	SWITCH_IVR_ACTION_EXECMENU,	/* Goto another menu in the stack. */
-	SWITCH_IVR_ACTION_EXECAPP,	/* Execute an application.         */
-	SWITCH_IVR_ACTION_PLAYSOUND,	/* Play a sound.                   */
-	SWITCH_IVR_ACTION_BACK,	/* Go back 1 menu.                 */
-	SWITCH_IVR_ACTION_TOMAIN,	/* Go back to the top level menu.  */
-	SWITCH_IVR_ACTION_NOOP	/* No operation                    */
-} switch_ivr_action_t;
-struct switch_ivr_menu;
-typedef switch_ivr_action_t switch_ivr_menu_action_function_t (struct switch_ivr_menu *, char *, char *, size_t, void *);
-typedef struct switch_ivr_menu switch_ivr_menu_t;
-typedef struct switch_ivr_menu_action switch_ivr_menu_action_t;
+	 typedef enum {
+		 SWITCH_IVR_ACTION_DIE,	/* Exit the menu.                  */
+		 SWITCH_IVR_ACTION_EXECMENU,	/* Goto another menu in the stack. */
+		 SWITCH_IVR_ACTION_EXECAPP,	/* Execute an application.         */
+		 SWITCH_IVR_ACTION_PLAYSOUND,	/* Play a sound.                   */
+		 SWITCH_IVR_ACTION_BACK,	/* Go back 1 menu.                 */
+		 SWITCH_IVR_ACTION_TOMAIN,	/* Go back to the top level menu.  */
+		 SWITCH_IVR_ACTION_NOOP	/* No operation                    */
+	 } switch_ivr_action_t;
+	 struct switch_ivr_menu;
+	 typedef switch_ivr_action_t switch_ivr_menu_action_function_t(struct switch_ivr_menu *, char *, char *, size_t, void *);
+	 typedef struct switch_ivr_menu switch_ivr_menu_t;
+	 typedef struct switch_ivr_menu_action switch_ivr_menu_action_t;
 /******************************************************************************************************/
 
 /*!
@@ -699,7 +701,7 @@
  *\return SWITCH_STATUS_SUCCESS if the menu was created.
  */
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t **new_menu,
+SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t ** new_menu,
 													 switch_ivr_menu_t *main,
 													 const char *name,
 													 const char *greeting_sound,
@@ -711,7 +713,7 @@
 													 const char *tts_engine,
 													 const char *tts_voice,
 													 int confirm_attempts,
-													 int inter_timeout, int digit_len, int timeout, int max_failures, 
+													 int inter_timeout, int digit_len, int timeout, int max_failures,
 													 int max_timeouts, switch_memory_pool_t *pool);
 
 /*!
@@ -722,8 +724,7 @@
  *\param bind KeyStrokes to bind the action to.
  *\return SWUTCH_STATUS_SUCCESS if the action was binded
  */
-SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_action(switch_ivr_menu_t *menu, switch_ivr_action_t ivr_action, const char *arg,
-															const char *bind);
+SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_action(switch_ivr_menu_t *menu, switch_ivr_action_t ivr_action, const char *arg, const char *bind);
 
 
 /*!
@@ -758,8 +759,8 @@
  */
 SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_free(switch_ivr_menu_t *stack);
 
-struct switch_ivr_menu_xml_ctx;
-typedef struct switch_ivr_menu_xml_ctx switch_ivr_menu_xml_ctx_t;
+	 struct switch_ivr_menu_xml_ctx;
+	 typedef struct switch_ivr_menu_xml_ctx switch_ivr_menu_xml_ctx_t;
 /*!
  *\brief Build a menu stack from an xml source
  *\param xml_menu_ctx The XML menu parser context previously created by switch_ivr_menu_stack_xml_init
@@ -769,7 +770,7 @@
  *\return SWITCH_STATUS_SUCCESS if all is well
  */
 SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_xml_ctx_t *xml_menu_ctx,
-																switch_ivr_menu_t **menu_stack, switch_xml_t xml_menus, switch_xml_t xml_menu);
+																switch_ivr_menu_t ** menu_stack, switch_xml_t xml_menus, switch_xml_t xml_menu);
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_menu_str2action(const char *action_name, switch_ivr_action_t *action);
 
@@ -787,7 +788,7 @@
  *\param pool memory pool (NULL to create one)
  *\return SWITCH_STATUS_SUCCESS if all is well
  */
-SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_init(switch_ivr_menu_xml_ctx_t **xml_menu_ctx, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_init(switch_ivr_menu_xml_ctx_t ** xml_menu_ctx, switch_memory_pool_t *pool);
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro(switch_core_session_t *session, const char *macro_name, const char *data, const char *lang,
 														switch_input_args_t *args);
@@ -802,8 +803,7 @@
 												uint32_t max_digits,
 												const char *prompt_audio_file,
 												const char *var_name,
-												char *digit_buffer,
-												switch_size_t digit_buffer_length, uint32_t timeout, const char *valid_terminators);
+												char *digit_buffer, switch_size_t digit_buffer_length, uint32_t timeout, const char *valid_terminators);
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_session_t *session, uint32_t key,
 																  switch_bind_flag_t bind_flags, const char *app);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_loadable_module.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_loadable_module.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_loadable_module.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -268,7 +268,7 @@
   \param filename the path to the module's dll or so file
   \return SWITCH_STATUS_SUCCESS on a successful load
 */
-SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(switch_loadable_module_interface_t **module_interface, char *filename);
+SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(switch_loadable_module_interface_t ** module_interface, char *filename);
 SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void);
 
 /*!
@@ -325,34 +325,39 @@
 		break;															\
 	}
 
-static inline int switch_check_interval(uint32_t rate, uint32_t ptime)
+	 static inline int switch_check_interval(uint32_t rate, uint32_t ptime)
 {
 	uint32_t max_ms = 0, ptime_div = 0;
 
 	switch (rate) {
 	case 22050:
 	case 11025:
-		if (ptime < 120) return 1;
+		if (ptime < 120)
+			return 1;
 		break;
 	case 48000:
 		max_ms = 40;
 		ptime_div = 2;
 		break;
 	case 32000:
+	case 24000:
 	case 16000:
 		max_ms = 60;
 		ptime_div = 2;
 		break;
+	case 12000:
+		max_ms = 100;
+		ptime_div = 2;
 	case 8000:
 		max_ms = 120;
 		ptime_div = 2;
-		break;		
+		break;
 	}
 
 	if (max_ms && ptime_div && (ptime <= max_ms && (ptime % ptime_div) == 0) && ((rate / 1000) * ptime) < SWITCH_RECOMMENDED_BUFFER_SIZE) {
 		return 1;
 	}
-	
+
 	return 0;
 }
 
@@ -416,7 +421,7 @@
 		impl->impl_id = switch_core_codec_next_id();
 		codec_interface->implementations = impl;
 	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Rejected codec name: %s rate: %u ptime: %u\n", 
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Rejected codec name: %s rate: %u ptime: %u\n",
 						  iananame, actual_samples_per_second, microseconds_per_packet / 1000);
 	}
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_log.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_log.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_log.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -114,9 +114,8 @@
   \see switch_types.h
 */
 SWITCH_DECLARE(void) switch_log_vprintf(_In_ switch_text_channel_t channel, _In_z_ const char *file,
-									   _In_z_ const char *func, _In_ int line,
-									   _In_opt_z_ const char *userdata, _In_ switch_log_level_t level,
-										const char *fmt, va_list ap);
+										_In_z_ const char *func, _In_ int line,
+										_In_opt_z_ const char *userdata, _In_ switch_log_level_t level, const char *fmt, va_list ap);
 
 #endif
 /*! 
@@ -144,7 +143,7 @@
 #define switch_log_check_mask(_mask, _level) (_mask & (1 << _level))
 
 
-SWITCH_DECLARE(switch_log_node_t*) switch_log_node_dup(const switch_log_node_t *node);
+SWITCH_DECLARE(switch_log_node_t *) switch_log_node_dup(const switch_log_node_t *node);
 SWITCH_DECLARE(void) switch_log_node_free(switch_log_node_t **pnode);
 
 ///\}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_module_interfaces.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_module_interfaces.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_module_interfaces.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -45,7 +45,7 @@
 SWITCH_BEGIN_EXTERN_C
 /*! \brief A table of functions to execute at various states 
  */
-typedef enum {
+	typedef enum {
 	SWITCH_SHN_ON_INIT,
 	SWITCH_SHN_ON_ROUTING,
 	SWITCH_SHN_ON_EXECUTE,
@@ -106,7 +106,27 @@
 
 
 typedef switch_call_cause_t (*switch_io_outgoing_channel_t)
-(switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t **, switch_memory_pool_t **, switch_originate_flag_t, switch_call_cause_t *);
+ 
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	
+	(switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t **, switch_memory_pool_t **, switch_originate_flag_t,
+	 switch_call_cause_t *);
 typedef switch_status_t (*switch_io_read_frame_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int);
 typedef switch_status_t (*switch_io_write_frame_t) (switch_core_session_t *, switch_frame_t *, switch_io_flag_t, int);
 typedef switch_status_t (*switch_io_kill_channel_t) (switch_core_session_t *, int);
@@ -338,6 +358,7 @@
 	int line;
 	char *file_path;
 	char *spool_path;
+	const char *prefix;
 };
 
 /*! \brief Abstract interface to an asr module */
@@ -440,7 +461,7 @@
 	switch_audio_resampler_t *resampler;
 	switch_buffer_t *buffer;
 	switch_byte_t *dbuf;
-	switch_size_t dbuflen;	
+	switch_size_t dbuflen;
 	/*! the current samplerate */
 	uint32_t samplerate;
 	/*! the current native samplerate */
@@ -469,7 +490,7 @@
 	/*! the name of the interface */
 	const char *interface_name;
 	/*! function to open the directory interface */
-	switch_status_t (*chat_send) (const char *proto, const char *from, const char *to, 
+	switch_status_t (*chat_send) (const char *proto, const char *from, const char *to,
 								  const char *subject, const char *body, const char *type, const char *hint);
 	switch_thread_rwlock_t *rwlock;
 	int refs;
@@ -583,6 +604,7 @@
 	void *private_info;
 	switch_payload_t agreed_pt;
 	switch_mutex_t *mutex;
+	struct switch_codec *next;
 };
 
 /*! \brief A table of settings and callbacks that define a paticular implementation of a codec */
@@ -678,8 +700,8 @@
 	struct switch_api_interface *next;
 };
 
-#define PROTECT_INTERFACE(_it) if (_it) {switch_mutex_lock(_it->reflock); switch_thread_rwlock_rdlock(_it->parent->rwlock); switch_thread_rwlock_rdlock(_it->rwlock); _it->refs++; _it->parent->refs++; switch_mutex_unlock(_it->reflock);} //if (!strcmp(_it->interface_name, "user")) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "+++++++++++LOCK %s %d/%d\n", _it->interface_name, _it->refs, _it->parent->refs);
-#define UNPROTECT_INTERFACE(_it) if (_it) {switch_mutex_lock(_it->reflock); switch_thread_rwlock_unlock(_it->rwlock); switch_thread_rwlock_unlock(_it->parent->rwlock); _it->refs--; _it->parent->refs--; switch_mutex_unlock(_it->reflock);} //if (!strcmp(_it->interface_name, "user")) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "---------UNLOCK %s %d/%d\n", _it->interface_name, _it->refs, _it->parent->refs);
+#define PROTECT_INTERFACE(_it) if (_it) {switch_mutex_lock(_it->reflock); switch_thread_rwlock_rdlock(_it->parent->rwlock); switch_thread_rwlock_rdlock(_it->rwlock); _it->refs++; _it->parent->refs++; switch_mutex_unlock(_it->reflock);}	//if (!strcmp(_it->interface_name, "user")) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "+++++++++++LOCK %s %d/%d\n", _it->interface_name, _it->refs, _it->parent->refs);
+#define UNPROTECT_INTERFACE(_it) if (_it) {switch_mutex_lock(_it->reflock); switch_thread_rwlock_unlock(_it->rwlock); switch_thread_rwlock_unlock(_it->parent->rwlock); _it->refs--; _it->parent->refs--; switch_mutex_unlock(_it->reflock);}	//if (!strcmp(_it->interface_name, "user")) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "---------UNLOCK %s %d/%d\n", _it->interface_name, _it->refs, _it->parent->refs);
 
 
 SWITCH_END_EXTERN_C

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_mprintf.h (from rev 16612, freeswitch/trunk/src/include/switch_mprintf.h) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_mprintf.h	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_mprintf.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,62 @@
+/*
+** 2001 September 22
+**
+** The author disclaims copyright to this source code.  In place of
+** a legal notice, here is a blessing:
+**
+**    May you do good and not evil.
+**    May you find forgiveness for yourself and forgive others.
+**    May you share freely, never taking more than you give.
+**
+*************************************************************************
+*/
+#ifndef SWITCH_MPRINTF_H
+#define SWITCH_MPRINTF_H
+
+SWITCH_BEGIN_EXTERN_C
+/**
+ * This routine is a variant of the "sprintf()" from the
+ * standard C library.  The resulting string is written into memory
+ * obtained from malloc() so that there is never a possiblity of buffer
+ * overflow.  This routine also implement some additional formatting
+ * options that are useful for constructing SQL statements.
+ *
+ * The strings returned by this routine should be freed by calling
+ * switch_core_db_free().
+ *
+ * All of the usual printf formatting options apply.  In addition, there
+ * is a "%q" option.  %q works like %s in that it substitutes a null-terminated
+ * string from the argument list.  But %q also doubles every '\'' character.
+ * %q is designed for use inside a string literal.  By doubling each '\''
+ * character it escapes that character and allows it to be inserted into
+ * the string.
+ *
+ * For example, so some string variable contains text as follows:
+ *
+ *      char *zText = "It's a happy day!";
+ *
+ * We can use this text in an SQL statement as follows:
+ *
+ *      char *z = switch_core_db_mprintf("INSERT INTO TABLES('%q')", zText);
+ *      switch_core_db_exec(db, z, callback1, 0, 0);
+ *      switch_core_db_free(z);
+ *
+ * Because the %q format string is used, the '\'' character in zText
+ * is escaped and the SQL generated is as follows:
+ *
+ *      INSERT INTO table1 VALUES('It''s a happy day!')
+ *
+ * This is correct.  Had we used %s instead of %q, the generated SQL
+ * would have looked like this:
+ *
+ *      INSERT INTO table1 VALUES('It's a happy day!');
+ *
+ * This second example is an SQL syntax error.  As a general rule you
+ * should always use %q instead of %s when inserting text into a string
+ * literal.
+ */
+SWITCH_DECLARE(char *) switch_mprintf(const char *zFormat, ...);
+SWITCH_DECLARE(char *) switch_vmprintf(const char *zFormat, va_list ap);
+
+SWITCH_END_EXTERN_C
+#endif /* SWITCH_MPRINTF_H */

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_nat.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_nat.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_nat.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -38,9 +38,7 @@
 #ifndef _SWITCH_NAT_H
 #define _SWITCH_NAT_H
 
-SWITCH_BEGIN_EXTERN_C
-
-typedef enum {
+SWITCH_BEGIN_EXTERN_C typedef enum {
 	SWITCH_NAT_TYPE_NONE,
 	SWITCH_NAT_TYPE_PMP,
 	SWITCH_NAT_TYPE_UPNP
@@ -87,8 +85,13 @@
  \param external_port [out] Mapped external port 
  \param sticky make the mapping permanent
 */
-SWITCH_DECLARE(switch_status_t) switch_nat_add_mapping(switch_port_t port, switch_nat_ip_proto_t proto, switch_port_t *external_port, switch_bool_t sticky);
+SWITCH_DECLARE(switch_status_t) switch_nat_add_mapping(switch_port_t port, switch_nat_ip_proto_t proto, switch_port_t *external_port,
+													   switch_bool_t sticky);
 /*!
+ \brief Has the NAT subsystem been initialized
+*/
+SWITCH_DECLARE(switch_bool_t) switch_nat_is_initialized(void);
+/*!
  \brief Deletes a NAT mapping
  \param proto Protocol
 */

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_odbc.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_odbc.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_odbc.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -34,11 +34,9 @@
 
 #include <switch.h>
 
-SWITCH_BEGIN_EXTERN_C 
+SWITCH_BEGIN_EXTERN_C struct switch_odbc_handle;
+typedef void *switch_odbc_statement_handle_t;
 
-struct switch_odbc_handle;
-typedef void * switch_odbc_statement_handle_t;
-
 typedef enum {
 	SWITCH_ODBC_STATE_INIT,
 	SWITCH_ODBC_STATE_DOWN,
@@ -56,13 +54,11 @@
 SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_connect(switch_odbc_handle_t *handle);
 SWITCH_DECLARE(void) switch_odbc_handle_destroy(switch_odbc_handle_t **handlep);
 SWITCH_DECLARE(switch_odbc_state_t) switch_odbc_handle_get_state(switch_odbc_handle_t *handle);
-SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_t *handle, const char *sql, switch_odbc_statement_handle_t * rstmt);
-SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec_string(switch_odbc_handle_t *handle,
-																	const char *sql,
-																	char *resbuf,
-																	size_t len);
+SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_t *handle, const char *sql, switch_odbc_statement_handle_t *rstmt,
+															 char **err);
+SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec_string(switch_odbc_handle_t *handle, const char *sql, char *resbuf, size_t len, char **err);
 SWITCH_DECLARE(switch_bool_t) switch_odbc_available(void);
-SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_statement_handle_free(switch_odbc_statement_handle_t * stmt);
+SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_statement_handle_free(switch_odbc_statement_handle_t *stmt);
 
 /*!
   \brief Execute the sql query and issue a callback for each row returned
@@ -77,7 +73,8 @@
   \note none
 */
 SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(const char *file, const char *func, int line, switch_odbc_handle_t *handle,
-																			   const char *sql, switch_core_db_callback_func_t callback, void *pdata, char **err);
+																			   const char *sql, switch_core_db_callback_func_t callback, void *pdata,
+																			   char **err);
 /*!
   \brief Execute the sql query and issue a callback for each row returned
   \param handle the ODBC handle
@@ -91,7 +88,7 @@
 		switch_odbc_handle_callback_exec_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, \
 												  handle, sql, callback, pdata, err)
 
-																	  
+
 SWITCH_DECLARE(char *) switch_odbc_handle_get_error(switch_odbc_handle_t *handle, switch_odbc_statement_handle_t stmt);
 SWITCH_END_EXTERN_C
 #endif

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_platform.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_platform.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_platform.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -36,6 +36,10 @@
 
 SWITCH_BEGIN_EXTERN_C
 #define SWITCH_USE_CLOCK_FUNCS
+
+#if defined(WIN32) && defined(_MSC_VER)
+#define atoll _atoi64
+#endif
 #ifdef __ICC
 #pragma warning (disable:810 869 981 279 1469 188)
 #endif
@@ -85,7 +89,7 @@
 #undef inline
 #define inline __inline
 #ifndef uint32_t
-	typedef unsigned __int8 uint8_t;
+typedef unsigned __int8 uint8_t;
 typedef unsigned __int16 uint16_t;
 typedef unsigned __int32 uint32_t;
 typedef unsigned __int64 uint64_t;
@@ -334,6 +338,7 @@
 #define _Out_z_cap_(x)
 #define _Out_ptrdiff_cap_(x)
 #define _Out_opt_ptrdiff_cap_(x)
+#define _Post_count_(x)
 #endif
 /* For Emacs:
  * Local Variables:

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_regex.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_regex.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_regex.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -68,7 +68,7 @@
  \param partial If non-zero returns SUCCESS if the target is a partial match, on successful return, this is set to non-zero if the match was partial and zero if it was a full match
  \return Boolean if a match was found or not
 */
-SWITCH_DECLARE(switch_status_t) switch_regex_match_partial(const char *target, const char *expression, int * partial_match);
+SWITCH_DECLARE(switch_status_t) switch_regex_match_partial(const char *target, const char *expression, int *partial_match);
 
 
 #define switch_regex_safe_free(re)	if (re) {\

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_resample.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_resample.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_resample.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -51,7 +51,7 @@
   \{ 
 */
 /*! \brief An audio resampling handle */
-typedef struct {
+	typedef struct {
 	/*! a pointer to store the resampler object */
 	void *resampler;
 	/*! the rate to resample from in hz */
@@ -61,11 +61,11 @@
 	/*! the factor to resample by (from / to) */
 	double factor;
 	double rfactor;
-    int16_t *to;
-    /*! the size of the to buffer used */
-    uint32_t to_len;
-    /*! the total size of the to buffer */
-    uint32_t to_size;
+	int16_t *to;
+	/*! the size of the to buffer used */
+	uint32_t to_len;
+	/*! the total size of the to buffer */
+	uint32_t to_size;
 
 } switch_audio_resampler_t;
 
@@ -79,9 +79,7 @@
  */
 SWITCH_DECLARE(switch_status_t) switch_resample_perform_create(switch_audio_resampler_t **new_resampler,
 															   uint32_t from_rate, uint32_t to_rate, uint32_t to_size,
-															   int quality,
-															   uint32_t channels,
-															   const char *file, const char *func, int line);
+															   int quality, uint32_t channels, const char *file, const char *func, int line);
 
 
 #define switch_resample_create(_n, _fr, _tr, _ts, _q, _c) switch_resample_perform_create(_n, _fr, _tr, _ts, _q, _c, __FILE__, __SWITCH_FUNC__, __LINE__)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_rtp.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_rtp.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_rtp.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -45,8 +45,7 @@
 #define SWITCH_RTP_KEY_LEN 30
 #define SWITCH_RTP_CRYPTO_KEY_32 "AES_CM_128_HMAC_SHA1_32"
 #define SWITCH_RTP_CRYPTO_KEY_80 "AES_CM_128_HMAC_SHA1_80"
-
-typedef enum {
+	typedef enum {
 	SWITCH_RTP_CRYPTO_SEND,
 	SWITCH_RTP_CRYPTO_RECV,
 	SWITCH_RTP_CRYPTO_MAX
@@ -54,7 +53,7 @@
 
 typedef enum {
 	NO_CRYPTO,
-	AES_CM_128_HMAC_SHA1_80, 
+	AES_CM_128_HMAC_SHA1_80,
 	AES_CM_128_HMAC_SHA1_32,
 	AES_CM_128_NULL_AUTH
 } switch_rtp_crypto_key_type_t;
@@ -97,6 +96,8 @@
 */
 SWITCH_DECLARE(switch_port_t) switch_rtp_set_start_port(switch_port_t port);
 
+SWITCH_DECLARE(switch_status_t) switch_rtp_set_ssrc(switch_rtp_t *rtp_session, uint32_t ssrc);
+
 /*!
   \brief Set/Get RTP end port
   \param port new value (if > 0)
@@ -166,7 +167,7 @@
   \param port the remote port
   \param err pointer for error messages
 */
-SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_session, const char *host, switch_port_t port, 
+SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_session, const char *host, switch_port_t port,
 															  switch_bool_t change_adv_addr, const char **err);
 
 SWITCH_DECLARE(char *) switch_rtp_get_remote_host(switch_rtp_t *rtp_session);
@@ -183,8 +184,7 @@
   \param err pointer for error messages
   \note this call also binds the RTP session's socket to the new address
 */
-SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_session, const char *host, 
-															 switch_port_t port, const char **err);
+SWITCH_DECLARE(switch_status_t) switch_rtp_set_local_address(switch_rtp_t *rtp_session, const char *host, switch_port_t port, const char **err);
 
 /*! 
   \brief Kill the socket on an existing RTP session

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_scheduler.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_scheduler.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_scheduler.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_stun.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_stun.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_stun.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -41,8 +41,7 @@
 #define SWITCH_STUN_DEFAULT_PORT 3478
 #define SWITCH_STUN_PACKET_MIN_LEN 20
 #define SWITCH_STUN_ATTRIBUTE_MIN_LEN 8
-
-typedef enum {
+	typedef enum {
 	SWITCH_STUN_BINDING_REQUEST = 0x0001,
 	SWITCH_STUN_BINDING_RESPONSE = 0x0101,
 	SWITCH_STUN_BINDING_ERROR_RESPONSE = 0x0111,

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_types.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_types.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_types.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -102,6 +102,7 @@
 #define SWITCH_SEQ_CLEARLINEEND SWITCH_SEQ_ESC SWITCH_SEQ_CLEARLINEEND_CHAR
 #define SWITCH_SEQ_CLEARSCR SWITCH_SEQ_ESC SWITCH_SEQ_CLEARSCR_CHAR SWITCH_SEQ_HOME
 #endif
+#define SWITCH_DEFAULT_CLID_NAME ""
 #define SWITCH_DEFAULT_DTMF_DURATION 2000
 #define SWITCH_MIN_DTMF_DURATION 400
 #define SWITCH_MAX_DTMF_DURATION 192000
@@ -180,7 +181,6 @@
 #define SWITCH_BITS_PER_BYTE 8
 #define SWITCH_DEFAULT_FILE_BUFFER_LEN 65536
 #define SWITCH_DTMF_LOG_LEN 1000
-
 typedef uint8_t switch_byte_t;
 
 typedef struct {
@@ -241,7 +241,11 @@
 	SCF_VG = (1 << 3),
 	SCF_RESTART = (1 << 4),
 	SCF_SHUTDOWN_REQUESTED = (1 << 5),
-	SCF_USE_AUTO_NAT = (1 << 6)
+	SCF_USE_AUTO_NAT = (1 << 6),
+	SCF_EARLY_HANGUP = (1 << 7),
+	SCF_CALIBRATE_CLOCK = (1 << 8),
+	SCF_USE_COND_TIMING = (1 << 9),
+	SCF_USE_CLOCK_RT = (1 << 10)
 } switch_core_flag_enum_t;
 typedef uint32_t switch_core_flag_t;
 
@@ -326,7 +330,8 @@
 	SMF_LOOP = (1 << 4),
 	SMF_HOLD_BLEG = (1 << 5),
 	SMF_IMMEDIATE = (1 << 6),
-	SMF_EXEC_INLINE = (1 << 7)
+	SMF_EXEC_INLINE = (1 << 7),
+	SMF_PRIORITY = (1 << 8)
 } switch_media_flag_enum_t;
 typedef uint32_t switch_media_flag_t;
 
@@ -374,6 +379,8 @@
 	char *htdocs_dir;
 	char *grammar_dir;
 	char *storage_dir;
+	char *recordings_dir;
+	char *sounds_dir;
 };
 
 typedef struct switch_directories switch_directories;
@@ -386,7 +393,7 @@
 #define SWITCH_INTERVAL_PAD 10	/* A little extra buffer space to be safe */
 #define SWITCH_MAX_SAMPLE_LEN 48
 #define SWITCH_BYTES_PER_SAMPLE 2	/* slin is 2 bytes per sample */
-#define SWITCH_RECOMMENDED_BUFFER_SIZE 4096 /* worst case of 32khz @60ms we only do 48khz @10ms which is 960 */
+#define SWITCH_RECOMMENDED_BUFFER_SIZE 4096	/* worst case of 32khz @60ms we only do 48khz @10ms which is 960 */
 #define SWITCH_MAX_CODECS 50
 #define SWITCH_MAX_STATE_HANDLERS 30
 #define SWITCH_CORE_QUEUE_LEN 100000
@@ -417,7 +424,7 @@
 	SWITCH_XML_SECTION_DIRECTORY = (1 << 1),
 	SWITCH_XML_SECTION_DIALPLAN = (1 << 2),
 	SWITCH_XML_SECTION_PHRASES = (1 << 3),
-	
+
 	/* Nothing after this line */
 	SWITCH_XML_SECTION_MAX = (1 << 4)
 } switch_xml_section_enum_t;
@@ -522,36 +529,35 @@
 typedef uint32_t switch_rtp_flag_t;
 
 typedef enum {
-	RTP_BUG_NONE = 0, /* won't be using this one much ;) */
+	RTP_BUG_NONE = 0,			/* won't be using this one much ;) */
 
 	RTP_BUG_CISCO_SKIP_MARK_BIT_2833 = (1 << 0),
 	/* Some Cisco devices get mad when you send the mark bit on new 2833 because it makes
 	   them flush their jitterbuffer and the dtmf along with it.
 
 	   This flag will disable the sending of the mark bit on the first DTMF packet.
-	*/
+	 */
 
 
 	RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833 = (1 << 1)
-	/*
-	  Sonus wrongly expects that, when sending a multi-packet 2833 DTMF event, The sender
-	  should increment the RTP timestamp in each packet when, in reality, the sender should
-	  send the same exact timestamp and increment the duration field in the 2833 payload.
-	  This allows a reconstruction of the duration if any of the packets are lost.
+		/*
+		   Sonus wrongly expects that, when sending a multi-packet 2833 DTMF event, The sender
+		   should increment the RTP timestamp in each packet when, in reality, the sender should
+		   send the same exact timestamp and increment the duration field in the 2833 payload.
+		   This allows a reconstruction of the duration if any of the packets are lost.
 
-	  final_duration - initial_timestamp = total_samples
+		   final_duration - initial_timestamp = total_samples
 
-	  However, if the duration value exceeds the space allocated (16 bits), The sender should increment
-	  the timestamp one unit and reset the duration to 0. 
-	  
-	  Always sending a duration of 0 with a new timestamp should be tolerated but is rarely intentional
-	  and is mistakenly done by many devices.  
-	  The issue is that the Sonus expects everyone to do it this way instead of tolerating either way.
-	  Sonus will actually ignore every packet with the same timestamp before concluding if it's DTMF.
-	  
-	  This flag will cause each packet to have a new timestamp.
-	*/
+		   However, if the duration value exceeds the space allocated (16 bits), The sender should increment
+		   the timestamp one unit and reset the duration to 0. 
 
+		   Always sending a duration of 0 with a new timestamp should be tolerated but is rarely intentional
+		   and is mistakenly done by many devices.  
+		   The issue is that the Sonus expects everyone to do it this way instead of tolerating either way.
+		   Sonus will actually ignore every packet with the same timestamp before concluding if it's DTMF.
+
+		   This flag will cause each packet to have a new timestamp.
+		 */
 } switch_rtp_bug_flag_t;
 
 #ifdef _MSC_VER
@@ -669,8 +675,11 @@
 	SWITCH_MESSAGE_INDICATE_AUDIO_SYNC,
 	SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA,
 	SWITCH_MESSAGE_INDICATE_UUID_CHANGE,
-	SWITCH_MESSAGE_INDICATE_WARNING,
+	SWITCH_MESSAGE_INDICATE_SIMPLIFY,
 	SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO,
+	SWITCH_MESSAGE_INDICATE_PROXY_MEDIA,
+	SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC,
+	SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC_COMPLETE,
 	SWITCH_MESSAGE_INVALID
 } switch_core_session_message_types_t;
 
@@ -798,7 +807,8 @@
 typedef enum {
 	SWITCH_CHANNEL_ID_LOG,
 	SWITCH_CHANNEL_ID_LOG_CLEAN,
-	SWITCH_CHANNEL_ID_EVENT
+	SWITCH_CHANNEL_ID_EVENT,
+	SWITCH_CHANNEL_ID_SESSION
 } switch_text_channel_t;
 
 typedef enum {
@@ -810,11 +820,11 @@
 
 #define SWITCH_CHANNEL_LOG SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
 #define SWITCH_CHANNEL_LOG_CLEAN SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
-#define SWITCH_CHANNEL_SESSION_LOG_CLEAN(x) SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__, ((x) ? switch_core_session_get_uuid(x) : NULL)
+#define SWITCH_CHANNEL_SESSION_LOG_CLEAN(x) SWITCH_CHANNEL_ID_LOG_CLEAN, __FILE__, __SWITCH_FUNC__, __LINE__, switch_core_session_get_uuid((x))
 #define SWITCH_CHANNEL_EVENT SWITCH_CHANNEL_ID_EVENT, __FILE__, __SWITCH_FUNC__, __LINE__, NULL
-#define SWITCH_CHANNEL_SESSION_LOG(x) SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, ((x) ? switch_core_session_get_uuid(x) : NULL)
-#define SWITCH_CHANNEL_CHANNEL_LOG(x) SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, ((x) ? switch_channel_get_uuid(x) : NULL)
-#define SWITCH_CHANNEL_UUID_LOG(x) SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, x
+#define SWITCH_CHANNEL_SESSION_LOG(x) SWITCH_CHANNEL_ID_SESSION, __FILE__, __SWITCH_FUNC__, __LINE__, (const char*)(x)
+#define SWITCH_CHANNEL_CHANNEL_LOG(x) SWITCH_CHANNEL_ID_SESSION, __FILE__, __SWITCH_FUNC__, __LINE__, (const char*)switch_channel_get_session(x)
+#define SWITCH_CHANNEL_UUID_LOG(x) SWITCH_CHANNEL_ID_LOG, __FILE__, __SWITCH_FUNC__, __LINE__, (x)
 
 /*!
   \enum switch_channel_state_t
@@ -919,6 +929,7 @@
 	CF_UNICAST,
 	CF_VIDEO,
 	CF_EVENT_LOCK,
+	CF_EVENT_LOCK_PRI,
 	CF_RESET,
 	CF_ORIGINATING,
 	CF_STOP_BROADCAST,
@@ -943,6 +954,9 @@
 	CF_MEDIA_BRIDGE_TTL,
 	CF_BYPASS_MEDIA_AFTER_BRIDGE,
 	CF_LEG_HOLDING,
+	CF_BROADCAST_DROP_MEDIA,
+	CF_EARLY_HANGUP,
+	CF_MEDIA_SET,
 	/* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */
 	CF_FLAG_MAX
 } switch_channel_flag_t;
@@ -983,7 +997,8 @@
 typedef enum {
 	SAF_NONE = 0,
 	SAF_SUPPORT_NOMEDIA = (1 << 0),
-	SAF_ROUTING_EXEC = (1 << 1)
+	SAF_ROUTING_EXEC = (1 << 1),
+	SAF_MEDIA_TAP = (1 << 2)
 } switch_application_flag_enum_t;
 typedef uint32_t switch_application_flag_t;
 
@@ -1253,7 +1268,8 @@
 	SWITCH_EVENT_NOTIFY				- Notification
 	SWITCH_EVENT_SEND_MESSAGE		- Message
 	SWITCH_EVENT_RECV_MESSAGE		- Message
-  SWITCH_EVENT_NAT            - NAT Management (new/del/status)
+	SWITCH_EVENT_NAT            - NAT Management (new/del/status)
+	SWITCH_EVENT_FAILURE            - A failure occurred which might impact the normal functioning of the switch
     SWITCH_EVENT_ALL				- All events at once
 </pre>
 
@@ -1330,6 +1346,8 @@
 	SWITCH_EVENT_RECORD_START,
 	SWITCH_EVENT_RECORD_STOP,
 	SWITCH_EVENT_CALL_UPDATE,
+	SWITCH_EVENT_FAILURE,
+	SWITCH_EVENT_SOCKET_DATA,
 	SWITCH_EVENT_ALL
 } switch_event_types_t;
 
@@ -1423,7 +1441,12 @@
 	SCSC_SHUTDOWN_ASAP,
 	SCSC_CANCEL_SHUTDOWN,
 	SCSC_SEND_SIGHUP,
-	SCSC_DEBUG_LEVEL
+	SCSC_DEBUG_LEVEL,
+	SCSC_FLUSH_DB_HANDLES,
+	SCSC_SHUTDOWN_NOW,
+	SCSC_CALIBRATE_CLOCK,
+	SCSC_SAVE_HISTORY,
+	SCSC_CRASH
 } switch_session_ctl_t;
 
 typedef enum {
@@ -1476,6 +1499,22 @@
 typedef struct switch_management_interface switch_management_interface_t;
 typedef struct switch_core_port_allocator switch_core_port_allocator_t;
 typedef struct switch_media_bug switch_media_bug_t;
+
+struct switch_console_callback_match_node {
+	char *val;
+	struct switch_console_callback_match_node *next;
+};
+typedef struct switch_console_callback_match_node switch_console_callback_match_node_t;
+
+struct switch_console_callback_match {
+	struct switch_console_callback_match_node *head;
+	struct switch_console_callback_match_node *end;
+	int count;
+	int dynamic;
+};
+typedef struct switch_console_callback_match switch_console_callback_match_t;
+
+typedef switch_status_t (*switch_console_complete_callback_t) (const char *, const char *, switch_console_callback_match_t **matches);
 typedef switch_bool_t (*switch_media_bug_callback_t) (switch_media_bug_t *, void *, switch_abc_type_t);
 typedef switch_bool_t (*switch_tone_detect_callback_t) (switch_core_session_t *, const char *, const char *);
 typedef struct switch_xml_binding switch_xml_binding_t;
@@ -1506,7 +1545,7 @@
 
 typedef void (*switch_event_callback_t) (switch_event_t *);
 typedef switch_caller_extension_t *(*switch_dialplan_hunt_function_t) (switch_core_session_t *, void *, switch_caller_profile_t *);
-#define SWITCH_STANDARD_DIALPLAN(name) static switch_caller_extension_t * name (switch_core_session_t *session, void *arg, switch_caller_profile_t *caller_profile)
+#define SWITCH_STANDARD_DIALPLAN(name) static switch_caller_extension_t *name (switch_core_session_t *session, void *arg, switch_caller_profile_t *caller_profile)
 
 
 typedef struct switch_scheduler_task switch_scheduler_task_t;
@@ -1540,9 +1579,9 @@
 												  char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args);
 typedef struct switch_xml *switch_xml_t;
 typedef struct switch_core_time_duration switch_core_time_duration_t;
-typedef switch_xml_t (*switch_xml_search_function_t) (const char *section,
-													  const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
-													  void *user_data);
+typedef switch_xml_t(*switch_xml_search_function_t) (const char *section,
+													 const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
+													 void *user_data);
 
 typedef struct switch_hash switch_hash_t;
 struct HashElem;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_utils.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_utils.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_utils.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -40,9 +40,7 @@
 
 #include <switch.h>
 
-SWITCH_BEGIN_EXTERN_C
-
-SWITCH_DECLARE(int) switch_toupper(int c);
+SWITCH_BEGIN_EXTERN_C SWITCH_DECLARE(int) switch_toupper(int c);
 SWITCH_DECLARE(int) switch_tolower(int c);
 SWITCH_DECLARE(int) switch_isalnum(int c);
 SWITCH_DECLARE(int) switch_isalpha(int c);
@@ -74,10 +72,15 @@
   \param s the string to test
   \return true value if the string is NULL or zero length
 */
-static inline int zstr(const char *s) {
+_Check_return_ static inline int _zstr(_In_opt_z_ const char *s)
+{
 	return !s || *s == '\0';
 }
-
+#ifdef _PREFAST_
+#define zstr(x) (_zstr(x) ? 1 : __analysis_assume(x),0)
+#else
+#define zstr(x) _zstr(x)
+#endif
 #define switch_strlen_zero(x) zstr(x)
 #define switch_strlen_zero_buf(x) zstr_buf(x)
 #define zstr_buf(s) (*(s) == '\0')
@@ -89,8 +92,12 @@
 	return SWITCH_TRUE;
 }
 
-#define switch_is_valid_rate(_tmp) (_tmp == 8000 || _tmp == 16000 || _tmp == 32000 || _tmp == 11025 || _tmp == 22050 || _tmp == 44100 || _tmp == 48000)
+#define switch_arraylen(_a) (sizeof(_a) / sizeof(_a[0]))
+#define switch_split(_data, _delim, _array) switch_separate_string(_data, _delim, _array, switch_arraylen(_array))
 
+#define switch_is_valid_rate(_tmp) (_tmp == 8000 || _tmp == 12000 || _tmp == 16000 || _tmp == 24000 || _tmp == 32000 || _tmp == 11025 || _tmp == 22050 || _tmp == 44100 || _tmp == 48000)
+
+
 static inline int switch_string_has_escaped_data(const char *in)
 {
 	const char *i = strchr(in, '\\');
@@ -102,7 +109,7 @@
 		}
 		i = strchr(i, '\\');
 	}
-	
+
 	return 0;
 }
 
@@ -110,7 +117,7 @@
 SWITCH_DECLARE(switch_size_t) switch_b64_decode(char *in, char *out, switch_size_t olen);
 SWITCH_DECLARE(char *) switch_amp_encode(char *s, char *buf, switch_size_t len);
 
-	 static inline switch_bool_t switch_is_digit_string(const char *s)
+static inline switch_bool_t switch_is_digit_string(const char *s)
 {
 
 	while (s && *s) {
@@ -204,11 +211,11 @@
 /*!
   \brief flags to be used with switch_build_uri()
  */
-enum switch_uri_flags {
-	SWITCH_URI_NUMERIC_HOST = 1,
-	SWITCH_URI_NUMERIC_PORT = 2,
-	SWITCH_URI_NO_SCOPE = 4
-};
+	 enum switch_uri_flags {
+		 SWITCH_URI_NUMERIC_HOST = 1,
+		 SWITCH_URI_NUMERIC_PORT = 2,
+		 SWITCH_URI_NO_SCOPE = 4
+	 };
 
 /*!
   \brief build a URI string from components
@@ -220,12 +227,7 @@
   \param flags logical OR-ed combination of flags from \ref switch_uri_flags
   \return number of characters printed (not including the trailing null)
  */
-SWITCH_DECLARE(int) switch_build_uri(char *uri,
-									 switch_size_t size,
-									 const char *scheme,
-									 const char *user,
-									 const switch_sockaddr_t *sa,
-									 int flags);
+SWITCH_DECLARE(int) switch_build_uri(char *uri, switch_size_t size, const char *scheme, const char *user, const switch_sockaddr_t *sa, int flags);
 
 #define SWITCH_STATUS_IS_BREAK(x) (x == SWITCH_STATUS_BREAK || x == 730035 || x == 35)
 
@@ -309,7 +311,7 @@
 #define switch_set_string(_dst, _src) switch_copy_string(_dst, _src, sizeof(_dst))
 
 
-static inline char *switch_sanitize_number(char *number)
+	 static inline char *switch_sanitize_number(char *number)
 {
 	char *p = number, *q;
 	char warp[] = "/:";
@@ -319,10 +321,12 @@
 		return number;
 	}
 
-	while((q = strrchr(p, '@'))) *q = '\0';
- 
-	for(i = 0; i < (int)strlen(warp); i++) {
-		while(p && (q = strchr(p, warp[i]))) p = q + 1;
+	while ((q = strrchr(p, '@')))
+		*q = '\0';
+
+	for (i = 0; i < (int) strlen(warp); i++) {
+		while (p && (q = strchr(p, warp[i])))
+			p = q + 1;
 	}
 
 	return p;
@@ -330,46 +334,46 @@
 
 static inline switch_bool_t switch_string_var_check(char *s, switch_bool_t disable)
 {
-    char *p;
+	char *p;
 	char *dol = NULL;
 
-    for (p = s; p && *p; p++) {
-        if (*p == '$') {
-            dol = p;
-        } else if (dol) {
-            if (*p == '{') {
+	for (p = s; p && *p; p++) {
+		if (*p == '$') {
+			dol = p;
+		} else if (dol) {
+			if (*p == '{') {
 				if (disable) {
 					*dol = '%';
 					dol = NULL;
 				} else {
 					return SWITCH_TRUE;
 				}
-            } else if (*p != '\\') {
-                dol = NULL;
-            }
-        }
-    }
-    return SWITCH_FALSE;
+			} else if (*p != '\\') {
+				dol = NULL;
+			}
+		}
+	}
+	return SWITCH_FALSE;
 }
 
 
 static inline switch_bool_t switch_string_var_check_const(const char *s)
 {
-    const char *p;
+	const char *p;
 	int dol = 0;
 
-    for (p = s; p && *p; p++) {
-        if (*p == '$') {
-            dol = 1;
-        } else if (dol) {
-            if (*p == '{') {
-					return SWITCH_TRUE;
-            } else if (*p != '\\') {
-                dol = 0;
-            }
-        }
-    }
-    return SWITCH_FALSE;
+	for (p = s; p && *p; p++) {
+		if (*p == '$') {
+			dol = 1;
+		} else if (dol) {
+			if (*p == '{') {
+				return SWITCH_TRUE;
+			} else if (*p != '\\') {
+				dol = 0;
+			}
+		}
+	}
+	return SWITCH_FALSE;
 }
 
 static inline char *switch_var_clean_string(char *s)
@@ -382,7 +386,7 @@
 {
 	char *p;
 	for (p = s; p && *p; p++) {
-		uint8_t x = (uint8_t) *p;
+		uint8_t x = (uint8_t) * p;
 		if ((x < 32) && x != '\n' && x != '\r') {
 			*p = ' ';
 		}
@@ -399,7 +403,7 @@
 */
 #define switch_safe_free(it) if (it) {free(it);it=NULL;}
 
-static inline char *switch_safe_strdup(const char *it) 
+static inline char *switch_safe_strdup(const char *it)
 {
 	if (it) {
 		return strdup(it);
@@ -409,14 +413,14 @@
 }
 
 
-static inline char *switch_lc_strdup(const char *it) 
+static inline char *switch_lc_strdup(const char *it)
 {
 	char *dup;
 	char *p;
 
 	if (it) {
 		dup = strdup(it);
-		for(p = dup; p && *p; p++) {
+		for (p = dup; p && *p; p++) {
 			*p = (char) switch_tolower(*p);
 		}
 		return dup;
@@ -426,14 +430,14 @@
 }
 
 
-static inline char *switch_uc_strdup(const char *it) 
+static inline char *switch_uc_strdup(const char *it)
 {
 	char *dup;
 	char *p;
 
 	if (it) {
 		dup = strdup(it);
-		for(p = dup; p && *p; p++) {
+		for (p = dup; p && *p; p++) {
 			*p = (char) switch_toupper(*p);
 		}
 		return dup;
@@ -536,8 +540,8 @@
   \param arraylen the max number of elements in the array
   \return the number of elements added to the array
 */
-SWITCH_DECLARE(unsigned int) switch_separate_string(char *buf, char delim, char **array, unsigned int arraylen);
-SWITCH_DECLARE(unsigned int) switch_separate_string_string(char *buf, char *delim, char **array, unsigned int arraylen);
+SWITCH_DECLARE(unsigned int) switch_separate_string(_In_ char *buf, char delim, _Post_count_(return) char **array, unsigned int arraylen);
+SWITCH_DECLARE(unsigned int) switch_separate_string_string(char *buf, char *delim, _Post_count_(return) char **array, unsigned int arraylen);
 
 SWITCH_DECLARE(switch_bool_t) switch_is_number(const char *str);
 SWITCH_DECLARE(char *) switch_strip_spaces(const char *str);
@@ -557,6 +561,9 @@
 */
 SWITCH_DECLARE(char *) switch_escape_char(switch_memory_pool_t *pool, char *in, const char *delim, char esc);
 
+SWITCH_DECLARE(char *) switch_escape_string(const char *in, char *out, switch_size_t outlen);
+SWITCH_DECLARE(char *) switch_escape_string_pool(const char *in, switch_memory_pool_t *pool);
+
 /*!
   \brief Wait for a socket
   \param poll the pollfd to wait on
@@ -584,17 +591,14 @@
 #define SWITCH_READ_ACCEPTABLE(status) (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK)
 SWITCH_DECLARE(size_t) switch_url_encode(const char *url, char *buf, size_t len);
 SWITCH_DECLARE(char *) switch_url_decode(char *s);
-SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to, 
-												  const char *from, 
-												  const char *headers, 
-												  const char *body, 
-												  const char *file,
-												  const char *convert_cmd,
-												  const char *convert_ext);
+SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to,
+												  const char *from,
+												  const char *headers,
+												  const char *body, const char *file, const char *convert_cmd, const char *convert_ext);
 SWITCH_DECLARE(char *) switch_find_end_paren(const char *s, char open, char close);
 
 
-static inline switch_bool_t switch_is_file_path(const char *file)
+	 static inline switch_bool_t switch_is_file_path(const char *file)
 {
 	const char *e;
 	int r;
@@ -604,21 +608,21 @@
 			file = e + 1;
 		}
 	}
-
 #ifdef WIN32
-	r = (file && (*file == '\\' || *(file +1) == ':' || *file == '/' || strstr(file, SWITCH_URL_SEPARATOR)));
+	r = (file && (*file == '\\' || *(file + 1) == ':' || *file == '/' || strstr(file, SWITCH_URL_SEPARATOR)));
 #else
 	r = (file && ((*file == '/') || strstr(file, SWITCH_URL_SEPARATOR)));
 #endif
 
 	return r ? SWITCH_TRUE : SWITCH_FALSE;
-	
+
 }
 
 
 
 SWITCH_DECLARE(int) switch_parse_cidr(const char *string, uint32_t *ip, uint32_t *mask, uint32_t *bitp);
-SWITCH_DECLARE(switch_status_t) switch_network_list_create(switch_network_list_t **list, const char *name, switch_bool_t default_type, switch_memory_pool_t *pool);
+SWITCH_DECLARE(switch_status_t) switch_network_list_create(switch_network_list_t **list, const char *name, switch_bool_t default_type,
+														   switch_memory_pool_t *pool);
 SWITCH_DECLARE(switch_status_t) switch_network_list_add_cidr_token(switch_network_list_t *list, const char *cidr_str, switch_bool_t ok, const char *token);
 #define switch_network_list_add_cidr(_list, _cidr_str, _ok) switch_network_list_add_cidr_token(_list, _cidr_str, _ok, NULL)
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_xml.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_xml.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_xml.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -96,6 +96,8 @@
 	switch_xml_t parent;
 	/*! flags */
 	uint32_t flags;
+	/*! is_switch_xml_root bool */
+	switch_bool_t is_switch_xml_root_t;
 };
 
 /*! 
@@ -103,7 +105,7 @@
  * \param s The string to parse
  * \param dup true if you want the string to be strdup()'d automatically
  * \return the switch_xml_t or NULL if an error occured
- */ 
+ */
 SWITCH_DECLARE(switch_xml_t) switch_xml_parse_str_dynamic(_In_z_ char *s, _In_ switch_bool_t dup);
 
 /*! 
@@ -156,7 +158,8 @@
 ///\param attrname the attribute name
 ///\param value the value
 ///\return an xml node or NULL
-SWITCH_DECLARE(switch_xml_t) switch_xml_find_child(_In_ switch_xml_t node, _In_z_ const char *childname, _In_opt_z_ const char *attrname, _In_opt_z_ const char *value);
+SWITCH_DECLARE(switch_xml_t) switch_xml_find_child(_In_ switch_xml_t node, _In_z_ const char *childname, _In_opt_z_ const char *attrname,
+												   _In_opt_z_ const char *value);
 SWITCH_DECLARE(switch_xml_t) switch_xml_find_child_multi(_In_ switch_xml_t node, _In_z_ const char *childname, ...);
 
 ///\brief returns the next tag of the same name in the same section and depth or NULL
@@ -202,7 +205,7 @@
 ///\ Returns NULL if not found.
 ///\param xml the xml node
 ///\return an xml node or NULL
-SWITCH_DECLARE(switch_xml_t) switch_xml_get(_In_ switch_xml_t xml, ...);
+SWITCH_DECLARE(switch_xml_t) switch_xml_get(_In_ switch_xml_t xml,...);
 
 ///\brief Converts an switch_xml structure back to xml. Returns a string of xml data that
 ///\ must be freed.
@@ -218,7 +221,8 @@
 ///\param offset offset to start at
 ///\param prn_header add <?xml version..> header too
 ///\return the xml text string
-SWITCH_DECLARE(char *) switch_xml_toxml_buf(_In_ switch_xml_t xml, _In_z_ char *buf, _In_ switch_size_t buflen, _In_ switch_size_t offset, _In_ switch_bool_t prn_header);
+SWITCH_DECLARE(char *) switch_xml_toxml_buf(_In_ switch_xml_t xml, _In_z_ char *buf, _In_ switch_size_t buflen, _In_ switch_size_t offset,
+											_In_ switch_bool_t prn_header);
 
 ///\brief returns a NULL terminated array of processing instructions for the given
 ///\ target
@@ -346,31 +350,37 @@
 ///\return SWITCH_STATUS_SUCCESS if successful root and node will be assigned
 SWITCH_DECLARE(switch_status_t) switch_xml_locate(_In_z_ const char *section,
 												  _In_opt_z_ const char *tag_name,
-												  _In_opt_z_ const char *key_name, 
-												  _In_opt_z_ const char *key_value, 
-												  _Out_ switch_xml_t *root, 
-												  _Out_ switch_xml_t *node,
-												  _In_opt_ switch_event_t *params,
-												  _In_ switch_bool_t clone);
+												  _In_opt_z_ const char *key_name,
+												  _In_opt_z_ const char *key_value,
+												  _Out_ switch_xml_t *root,
+												  _Out_ switch_xml_t *node, _In_opt_ switch_event_t *params, _In_ switch_bool_t clone);
 
-SWITCH_DECLARE(switch_status_t) switch_xml_locate_domain(_In_z_ const char *domain_name, _In_opt_ switch_event_t *params, _Out_ switch_xml_t *root, _Out_ switch_xml_t *domain);
+SWITCH_DECLARE(switch_status_t) switch_xml_locate_domain(_In_z_ const char *domain_name, _In_opt_ switch_event_t *params, _Out_ switch_xml_t *root,
+														 _Out_ switch_xml_t *domain);
 
 SWITCH_DECLARE(switch_status_t) switch_xml_locate_group(_In_z_ const char *group_name,
-														_In_z_ const char *domain_name, 
+														_In_z_ const char *domain_name,
 														_Out_ switch_xml_t *root,
-														_Out_ switch_xml_t *domain,
-														_Out_ switch_xml_t *group,
-														_In_opt_ switch_event_t *params);
+														_Out_ switch_xml_t *domain, _Out_ switch_xml_t *group, _In_opt_ switch_event_t *params);
 
 SWITCH_DECLARE(switch_status_t) switch_xml_locate_user(_In_z_ const char *key,
 													   _In_z_ const char *user_name,
 													   _In_z_ const char *domain_name,
 													   _In_opt_z_ const char *ip,
-													   _Out_ switch_xml_t *root, _Out_ switch_xml_t *domain, _Out_ switch_xml_t *user, _Out_opt_ switch_xml_t *ingroup, 
-													   _In_opt_ switch_event_t *params);
+													   _Out_ switch_xml_t *root, _Out_ switch_xml_t *domain, _Out_ switch_xml_t *user,
+													   _Out_opt_ switch_xml_t *ingroup, _In_opt_ switch_event_t *params);
 
-SWITCH_DECLARE(switch_status_t) switch_xml_locate_user_in_domain(_In_z_ const char *user_name, _In_ switch_xml_t domain, _Out_ switch_xml_t *user, _Out_opt_ switch_xml_t *ingroup);
+SWITCH_DECLARE(switch_status_t) switch_xml_locate_user_in_domain(_In_z_ const char *user_name, _In_ switch_xml_t domain, _Out_ switch_xml_t *user,
+																 _Out_opt_ switch_xml_t *ingroup);
 
+
+SWITCH_DECLARE(switch_status_t) switch_xml_locate_user_merged(const char *key, const char *user_name, const char *domain_name,
+															  const char *ip, switch_xml_t *user, switch_event_t *params);
+
+SWITCH_DECLARE(void) switch_xml_merge_user(switch_xml_t user, switch_xml_t domain, switch_xml_t group);
+
+SWITCH_DECLARE(switch_xml_t) switch_xml_dup(switch_xml_t xml);
+
 ///\brief open a config in the core registry
 ///\param file_path the name of the config section e.g. modules.conf
 ///\param node a pointer to point to the node if it is found
@@ -390,7 +400,8 @@
 SWITCH_DECLARE(switch_xml_section_t) switch_xml_get_binding_sections(_In_ switch_xml_binding_t *binding);
 SWITCH_DECLARE(void *) switch_xml_get_binding_user_data(_In_ switch_xml_binding_t *binding);
 
-SWITCH_DECLARE(switch_status_t) switch_xml_bind_search_function_ret(_In_ switch_xml_search_function_t function, _In_ switch_xml_section_t sections, _In_opt_ void *user_data, switch_xml_binding_t **ret_binding);
+SWITCH_DECLARE(switch_status_t) switch_xml_bind_search_function_ret(_In_ switch_xml_search_function_t function, _In_ switch_xml_section_t sections,
+																	_In_opt_ void *user_data, switch_xml_binding_t **ret_binding);
 #define switch_xml_bind_search_function(_f, _s, _u) switch_xml_bind_search_function_ret(_f, _s, _u, NULL)
 
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_xml_config.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_xml_config.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/include/switch_xml_config.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -36,38 +36,37 @@
 #include <switch.h>
 
 SWITCH_BEGIN_EXTERN_C
+/*! \brief Type of value to parse */
+	typedef enum {
+	SWITCH_CONFIG_INT,			/*< (ptr=int* default=int data=NULL) Integer */
+	SWITCH_CONFIG_STRING,		/*< (ptr=[char* or char ** (for alloc)] default=char* data=switch_xml_config_string_options_t*) Zero-terminated C-string */
+	SWITCH_CONFIG_BOOL,			/*< (ptr=switch_bool_t* default=switch_bool_t data=NULL) Yes and no */
+	SWITCH_CONFIG_CUSTOM,		/*< (ptr=<custom function data> default=<custom function data> data=switch_xml_config_callback_t) Custom, get value through function pointer  */
+	SWITCH_CONFIG_ENUM,			/*< (ptr=int* default=int data=switch_xml_config_enum_item_t*) */
+	SWITCH_CONFIG_FLAG,			/*< (ptr=int32_t* default=switch_bool_t data=int (flag index) */
+	SWITCH_CONFIG_FLAGARRAY,	/*< (ptr=int8_t* default=switch_bool_t data=int (flag index) */
 
-/*! \brief Type of value to parse */
-typedef enum {
-	SWITCH_CONFIG_INT,				/*< (ptr=int* default=int data=NULL) Integer */
-	SWITCH_CONFIG_STRING, 			/*< (ptr=[char* or char ** (for alloc)] default=char* data=switch_xml_config_string_options_t*) Zero-terminated C-string */
-	SWITCH_CONFIG_BOOL, 			/*< (ptr=switch_bool_t* default=switch_bool_t data=NULL) Yes and no */
-	SWITCH_CONFIG_CUSTOM, 			/*< (ptr=<custom function data> default=<custom function data> data=switch_xml_config_callback_t) Custom, get value through function pointer  */
-	SWITCH_CONFIG_ENUM, 			/*< (ptr=int* default=int data=switch_xml_config_enum_item_t*) */
-	SWITCH_CONFIG_FLAG,				/*< (ptr=int32_t* default=switch_bool_t data=int (flag index) */
-	SWITCH_CONFIG_FLAGARRAY,		/*< (ptr=int8_t* default=switch_bool_t data=int (flag index) */
-	
 	/* No more past that line */
 	SWITCH_CONFIG_LAST
 } switch_xml_config_type_t;
 
-typedef struct {                	
-	char *key;						/*< The item's key or NULL if this is the last one in the list */
-	int value;						/*< The item's value */
+typedef struct {
+	char *key;					/*< The item's key or NULL if this is the last one in the list */
+	int value;					/*< The item's value */
 } switch_xml_config_enum_item_t;
 
 typedef struct {
-	switch_memory_pool_t *pool; 	/*< If set, the string will be allocated on the pool (unless the length param is > 0, then you misread this file)*/
-	switch_size_t length;			/*< Length of the char array, or 0 if memory has to be allocated dynamically*/
-	char *validation_regex;			/*< Enforce validation using this regular expression */
+	switch_memory_pool_t *pool;	/*< If set, the string will be allocated on the pool (unless the length param is > 0, then you misread this file) */
+	switch_size_t length;		/*< Length of the char array, or 0 if memory has to be allocated dynamically */
+	char *validation_regex;		/*< Enforce validation using this regular expression */
 } switch_xml_config_string_options_t;
 
-SWITCH_DECLARE_DATA extern switch_xml_config_string_options_t switch_config_string_strdup; 	/*< String options structure for strdup, no validation */
+SWITCH_DECLARE_DATA extern switch_xml_config_string_options_t switch_config_string_strdup;	/*< String options structure for strdup, no validation */
 
 typedef struct {
 	switch_bool_t enforce_min;
 	int min;
-	switch_bool_t enforce_max;	
+	switch_bool_t enforce_max;
 	int max;
 } switch_xml_config_int_options_t;
 
@@ -85,21 +84,22 @@
 	CONFIG_REQUIRED = (1 << 1)
 } switch_config_flags_t;
 
-typedef switch_status_t (*switch_xml_config_callback_t)(switch_xml_config_item_t *item, const char *newvalue, switch_config_callback_type_t callback_type, switch_bool_t changed);
+typedef switch_status_t (*switch_xml_config_callback_t) (switch_xml_config_item_t *item, const char *newvalue, switch_config_callback_type_t callback_type,
+														 switch_bool_t changed);
 
 /*!
  * \brief A configuration instruction read by switch_xml_config_parse 
 */
 struct switch_xml_config_item {
-	const char *key;					   	/*< The key of the element, or NULL to indicate the end of the list */
-	switch_xml_config_type_t type; 			/*< The type of variable */
-	int flags; 	   							/*< True if the var can be changed on reload */
-	void *ptr;					   			/*< Ptr to the var to be changed */
-	const void *defaultvalue; 		   		/*< Default value */
-	void *data; 				   			/*< Custom data (depending on the type) */
+	const char *key;			/*< The key of the element, or NULL to indicate the end of the list */
+	switch_xml_config_type_t type;	/*< The type of variable */
+	int flags;					/*< True if the var can be changed on reload */
+	void *ptr;					/*< Ptr to the var to be changed */
+	const void *defaultvalue;	/*< Default value */
+	void *data;					/*< Custom data (depending on the type) */
 	switch_xml_config_callback_t function;	/*< Callback to be called after the var is parsed */
-	const char *syntax;						/*< Optional syntax documentation for this setting */
-	const char *helptext;					/*< Optional documentation text for this setting */
+	const char *syntax;			/*< Optional syntax documentation for this setting */
+	const char *helptext;		/*< Optional documentation text for this setting */
 };
 
 #define SWITCH_CONFIG_ITEM(_key, _type, _flags, _ptr, _defaultvalue, _data, _syntax, _helptext)	{ _key, _type, _flags, _ptr, (void*)_defaultvalue, (void*)_data, NULL, _syntax, _helptext }
@@ -110,9 +110,10 @@
 #define SWITCH_CONFIG_SET_ITEM(_item, _key, _type, _flags, _ptr, _defaultvalue, _data, _syntax, _helptext)  switch_config_perform_set_item(&(_item), _key, _type, _flags, _ptr, (void*)(_defaultvalue), _data, NULL, _syntax, _helptext)
 #define SWITCH_CONFIG_SET_ITEM_CALLBACK(_item, _key, _type, _flags, _ptr, _defaultvalue, _data, _function, _syntax, _helptext)  switch_config_perform_set_item(&(_item), _key, _type, _flags, _ptr, (void*)(_defaultvalue), _data, _function, _syntax, _helptext)
 
-SWITCH_DECLARE(void) switch_config_perform_set_item(switch_xml_config_item_t *item, const char *key, switch_xml_config_type_t type, int flags, void *ptr, 	
-	const void* defaultvalue, void *data, switch_xml_config_callback_t function, const char *syntax, const char *helptext);
-	
+SWITCH_DECLARE(void) switch_config_perform_set_item(switch_xml_config_item_t *item, const char *key, switch_xml_config_type_t type, int flags, void *ptr,
+													const void *defaultvalue, void *data, switch_xml_config_callback_t function, const char *syntax,
+													const char *helptext);
+
 /*! 
  * \brief Gets the int representation of an enum
  * \param enum_options the switch_xml_config_enum_item_t array for this enum
@@ -125,7 +126,7 @@
  * \param enum_options the switch_xml_config_enum_item_t array for this enum
  * \param value int value to search 
  */
-SWITCH_DECLARE(const char*) switch_xml_config_enum_int2str(switch_xml_config_enum_item_t *enum_options, int value);
+SWITCH_DECLARE(const char *) switch_xml_config_enum_int2str(switch_xml_config_enum_item_t *enum_options, int value);
 
 /*!
  * \brief Prints out an item's documentation on the console 
@@ -158,7 +159,8 @@
  * \param instructions instrutions on how to parse the elements
  * \see switch_xml_config_item_t
  */
-SWITCH_DECLARE(switch_status_t) switch_xml_config_parse_event(switch_event_t *event, int count, switch_bool_t reload, switch_xml_config_item_t *instructions);
+SWITCH_DECLARE(switch_status_t) switch_xml_config_parse_event(switch_event_t *event, int count, switch_bool_t reload,
+															  switch_xml_config_item_t *instructions);
 
 /*!
  * \brief Parses a list of xml elements into an event  
@@ -176,9 +178,7 @@
 SWITCH_DECLARE(void) switch_xml_config_cleanup(switch_xml_config_item_t *instructions);
 
 SWITCH_END_EXTERN_C
-
 #endif /* !defined(SWITCH_XML_CONFIG_H) */
-
 /* For Emacs:
  * Local Variables:
  * mode:c

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/inet_pton.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/inet_pton.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/inet_pton.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -52,9 +52,9 @@
  * sizeof(int) < 4.  sizeof(int) > 4 is fine; all the world's not a VAX.
  */
 
-static int      inet_pton4(const char *src, unsigned char *dst);
+static int inet_pton4(const char *src, unsigned char *dst);
 #ifdef ENABLE_IPV6
-static int      inet_pton6(const char *src, unsigned char *dst);
+static int inet_pton6(const char *src, unsigned char *dst);
 #endif
 
 /* int
@@ -68,24 +68,23 @@
  * author:
  *      Paul Vixie, 1996.
  */
-SWITCH_DECLARE(int)
-switch_inet_pton(int af, const char *src, void *dst)
+SWITCH_DECLARE(int) switch_inet_pton(int af, const char *src, void *dst)
 {
-  switch (af) {
-  case AF_INET:
-    return (inet_pton4(src, (unsigned char *)dst));
+	switch (af) {
+	case AF_INET:
+		return (inet_pton4(src, (unsigned char *) dst));
 #ifdef ENABLE_IPV6
 #ifndef AF_INET6
-#define AF_INET6        (AF_MAX+1)        /* just to let this compile */
+#define AF_INET6        (AF_MAX+1)	/* just to let this compile */
 #endif
-  case AF_INET6:
-    return (inet_pton6(src, (unsigned char *)dst));
+	case AF_INET6:
+		return (inet_pton6(src, (unsigned char *) dst));
 #endif
-  default:
-    errno = EAFNOSUPPORT;
-    return (-1);
-  }
-  /* NOTREACHED */
+	default:
+		errno = EAFNOSUPPORT;
+		return (-1);
+	}
+	/* NOTREACHED */
 }
 
 /* int
@@ -98,44 +97,43 @@
  * author:
  *      Paul Vixie, 1996.
  */
-static int
-inet_pton4(const char *src, unsigned char *dst)
+static int inet_pton4(const char *src, unsigned char *dst)
 {
-  static const char digits[] = "0123456789";
-  int saw_digit, octets, ch;
-  unsigned char tmp[INADDRSZ], *tp;
+	static const char digits[] = "0123456789";
+	int saw_digit, octets, ch;
+	unsigned char tmp[INADDRSZ], *tp;
 
-  saw_digit = 0;
-  octets = 0;
-  tp = tmp;
-  *tp = 0;
-  while ((ch = *src++) != '\0') {
-    const char *pch;
+	saw_digit = 0;
+	octets = 0;
+	tp = tmp;
+	*tp = 0;
+	while ((ch = *src++) != '\0') {
+		const char *pch;
 
-    if ((pch = strchr(digits, ch)) != NULL) {
-      unsigned int val = *tp * 10 + (unsigned int)(pch - digits);
+		if ((pch = strchr(digits, ch)) != NULL) {
+			unsigned int val = *tp * 10 + (unsigned int) (pch - digits);
 
-      if (val > 255)
-        return (0);
-      *tp = (unsigned char)val;
-      if (! saw_digit) {
-        if (++octets > 4)
-          return (0);
-        saw_digit = 1;
-      }
-    } else if (ch == '.' && saw_digit) {
-      if (octets == 4)
-        return (0);
-      *++tp = 0;
-      saw_digit = 0;
-    } else
-      return (0);
-  }
-  if (octets < 4)
-    return (0);
-  /* bcopy(tmp, dst, INADDRSZ); */
-  memcpy(dst, tmp, INADDRSZ);
-  return (1);
+			if (val > 255)
+				return (0);
+			*tp = (unsigned char) val;
+			if (!saw_digit) {
+				if (++octets > 4)
+					return (0);
+				saw_digit = 1;
+			}
+		} else if (ch == '.' && saw_digit) {
+			if (octets == 4)
+				return (0);
+			*++tp = 0;
+			saw_digit = 0;
+		} else
+			return (0);
+	}
+	if (octets < 4)
+		return (0);
+	/* bcopy(tmp, dst, INADDRSZ); */
+	memcpy(dst, tmp, INADDRSZ);
+	return (1);
 }
 
 #ifdef ENABLE_IPV6
@@ -152,88 +150,85 @@
  * author:
  *      Paul Vixie, 1996.
  */
-static int
-inet_pton6(const char *src, unsigned char *dst)
+static int inet_pton6(const char *src, unsigned char *dst)
 {
-  static const char xdigits_l[] = "0123456789abcdef",
-    xdigits_u[] = "0123456789ABCDEF";
-  unsigned char tmp[IN6ADDRSZ], *tp, *endp, *colonp;
-  const char *xdigits, *curtok;
-  int ch, saw_xdigit;
-  unsigned int val;
+	static const char xdigits_l[] = "0123456789abcdef", xdigits_u[] = "0123456789ABCDEF";
+	unsigned char tmp[IN6ADDRSZ], *tp, *endp, *colonp;
+	const char *xdigits, *curtok;
+	int ch, saw_xdigit;
+	unsigned int val;
 
-  memset((tp = tmp), 0, IN6ADDRSZ);
-  endp = tp + IN6ADDRSZ;
-  colonp = NULL;
-  /* Leading :: requires some special handling. */
-  if (*src == ':')
-    if (*++src != ':')
-      return (0);
-  curtok = src;
-  saw_xdigit = 0;
-  val = 0;
-  while ((ch = *src++) != '\0') {
-    const char *pch;
+	memset((tp = tmp), 0, IN6ADDRSZ);
+	endp = tp + IN6ADDRSZ;
+	colonp = NULL;
+	/* Leading :: requires some special handling. */
+	if (*src == ':')
+		if (*++src != ':')
+			return (0);
+	curtok = src;
+	saw_xdigit = 0;
+	val = 0;
+	while ((ch = *src++) != '\0') {
+		const char *pch;
 
-    if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
-      pch = strchr((xdigits = xdigits_u), ch);
-    if (pch != NULL) {
-      val <<= 4;
-      val |= (pch - xdigits);
-      if (val > 0xffff)
-        return (0);
-      saw_xdigit = 1;
-      continue;
-    }
-    if (ch == ':') {
-      curtok = src;
-      if (!saw_xdigit) {
-        if (colonp)
-          return (0);
-        colonp = tp;
-        continue;
-      }
-      if (tp + INT16SZ > endp)
-        return (0);
-      *tp++ = (unsigned char) (val >> 8) & 0xff;
-      *tp++ = (unsigned char) val & 0xff;
-      saw_xdigit = 0;
-      val = 0;
-      continue;
-    }
-    if (ch == '.' && ((tp + INADDRSZ) <= endp) &&
-        inet_pton4(curtok, tp) > 0) {
-      tp += INADDRSZ;
-      saw_xdigit = 0;
-      break;    /* '\0' was seen by inet_pton4(). */
-    }
-    return (0);
-  }
-  if (saw_xdigit) {
-    if (tp + INT16SZ > endp)
-      return (0);
-    *tp++ = (unsigned char) (val >> 8) & 0xff;
-    *tp++ = (unsigned char) val & 0xff;
-  }
-  if (colonp != NULL) {
-    /*
-     * Since some memmove()'s erroneously fail to handle
-     * overlapping regions, we'll do the shift by hand.
-     */
-    const int n = tp - colonp;
-    int i;
+		if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
+			pch = strchr((xdigits = xdigits_u), ch);
+		if (pch != NULL) {
+			val <<= 4;
+			val |= (pch - xdigits);
+			if (val > 0xffff)
+				return (0);
+			saw_xdigit = 1;
+			continue;
+		}
+		if (ch == ':') {
+			curtok = src;
+			if (!saw_xdigit) {
+				if (colonp)
+					return (0);
+				colonp = tp;
+				continue;
+			}
+			if (tp + INT16SZ > endp)
+				return (0);
+			*tp++ = (unsigned char) (val >> 8) & 0xff;
+			*tp++ = (unsigned char) val & 0xff;
+			saw_xdigit = 0;
+			val = 0;
+			continue;
+		}
+		if (ch == '.' && ((tp + INADDRSZ) <= endp) && inet_pton4(curtok, tp) > 0) {
+			tp += INADDRSZ;
+			saw_xdigit = 0;
+			break;				/* '\0' was seen by inet_pton4(). */
+		}
+		return (0);
+	}
+	if (saw_xdigit) {
+		if (tp + INT16SZ > endp)
+			return (0);
+		*tp++ = (unsigned char) (val >> 8) & 0xff;
+		*tp++ = (unsigned char) val & 0xff;
+	}
+	if (colonp != NULL) {
+		/*
+		 * Since some memmove()'s erroneously fail to handle
+		 * overlapping regions, we'll do the shift by hand.
+		 */
+		const int n = tp - colonp;
+		int i;
 
-    for (i = 1; i <= n; i++) {
-      endp[- i] = colonp[n - i];
-      colonp[n - i] = 0;
-    }
-    tp = endp;
-  }
-  if (tp != endp)
-    return (0);
-  /* bcopy(tmp, dst, IN6ADDRSZ); */
-  memcpy(dst, tmp, IN6ADDRSZ);
-  return (1);
+		for (i = 1; i <= n; i++) {
+			endp[-i] = colonp[n - i];
+			colonp[n - i] = 0;
+		}
+		tp = endp;
+	}
+	if (tp != endp)
+		return (0);
+	/* bcopy(tmp, dst, IN6ADDRSZ); */
+	memcpy(dst, tmp, IN6ADDRSZ);
+	return (1);
 }
 #endif /* ENABLE_IPV6 */
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/Makefile.am (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/Makefile.am	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/Makefile.am	2010-02-12 00:54:22 UTC (rev 16614)
@@ -25,11 +25,12 @@
 	then echo ; echo "WARNING $$modname is not a valid FreeSWITCH module dir, skipping it....." ; else \
 		echo ;\
 		echo making $$target $$modname ;\
+		test -d "$$buildmoddir" || mkdir -p $$buildmoddir ; \
 		(if test -f "$$moddir/Makefile" ; then \
 			test -f "$$buildmoddir/Makefile" || cp $$moddir/Makefile $$buildmoddir/Makefile ; \
-			cd $$buildmoddir && MODDIR=$$moddir MODNAME=$$modname BASE=$(switch_srcdir) $(MAKE) $(AM_MAKEFLAGS) $$target; \
+			cd $$buildmoddir && MODDIR=$$moddir MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) $$target; \
 		else\
-			cd $$buildmoddir && MODDIR=$$moddir MODNAME=$$modname BASE=$(switch_srcdir) $(MAKE) $(AM_MAKEFLAGS) -f $(switch_builddir)/build/modmake.rules $$target ;\
+			cd $$buildmoddir && MODDIR=$$moddir MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) -f $(switch_builddir)/build/modmake.rules $$target ;\
 		fi;) || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
 	fi; \
 	test -z "$$fail" ;
@@ -38,4 +39,3 @@
 	@if test -z "`echo $@ | grep all`"; then  $(MAKE) $(AM_MAKEFLAGS) $@-all ; else echo Unknown target `echo $@ | sed -e 's|-all||'`; exit 1; fi
 
 
-

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_cidlookup/mod_cidlookup.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_cidlookup/mod_cidlookup.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_cidlookup/mod_cidlookup.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -28,7 +28,7 @@
  * mod_cidlookup.c -- API for querying cid->name services
  *
  */
- 
+
 #include <switch.h>
 #include <curl/curl.h>
 
@@ -50,12 +50,12 @@
 	char *url;
 	int curl_timeout;
 	int curl_warnduration;
-	
+
 	char *whitepages_apikey;
 
 	switch_bool_t cache;
 	int cache_expire;
-	
+
 	char *odbc_dsn;
 	char *odbc_user;
 	char *odbc_pass;
@@ -92,22 +92,24 @@
 {
 	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) {
+
+	if (!zstr(globals.odbc_dsn)) {
 		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;
+		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)
+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;
-	
+
 	switch_cache_db_handle_t *dbh = NULL;
 
 	if (!switch_odbc_available()) {
@@ -117,7 +119,7 @@
 
 	if ((callback_type == CONFIG_LOAD || callback_type == CONFIG_RELOAD) && changed) {
 
-		if(zstr(newvalue)) {
+		if (zstr(newvalue)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No local database defined.\n");
 		} else {
 			switch_safe_free(globals.odbc_dsn);
@@ -139,25 +141,31 @@
 	}
 
 	switch_goto_status(SWITCH_STATUS_SUCCESS, done);
-	
-done:
+
+  done:
 	switch_cache_db_release_db_handle(&dbh);
 	return status;
 }
 
-static switch_xml_config_string_options_t config_opt_dsn = {NULL, 0, NULL}; /* anything is ok here */
+static switch_xml_config_string_options_t config_opt_dsn = { NULL, 0, NULL };	/* anything is ok here */
 static switch_xml_config_item_t instructions[] = {
 	/* parameter name        type                 reloadable   pointer                         default value     options structure */
-	SWITCH_CONFIG_ITEM_STRING_STRDUP("url", CONFIG_RELOAD, &globals.url, NULL, "http://server.example.com/app?number=${caller_id_number}", "URL for the CID lookup service"),
-	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_STRING_STRDUP("url", CONFIG_RELOAD, &globals.url, NULL, "http://server.example.com/app?number=${caller_id_number}",
+									 "URL for the CID lookup service"),
+	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("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_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,
-		"db:user:passwd", "Database to use."),
+								"db:user:passwd", "Database to use."),
 	SWITCH_CONFIG_ITEM_END()
 };
 
@@ -166,7 +174,7 @@
 	if (switch_xml_config_parse_module_settings("cidlookup.conf", reload, instructions) != SWITCH_STATUS_SUCCESS) {
 		return SWITCH_STATUS_GENERR;
 	}
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -179,10 +187,10 @@
 {
 	switch_bool_t retval = SWITCH_FALSE;
 	switch_cache_db_handle_t *dbh = 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) {
+		if (switch_cache_db_execute_sql_callback(dbh, sql, callback, (void *) cbt, err)
+			== SWITCH_ODBC_FAIL) {
 			retval = SWITCH_FALSE;
 		} else {
 			retval = SWITCH_TRUE;
@@ -190,7 +198,7 @@
 	} 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_cache_db_release_db_handle(&dbh);
 	return retval;
 }
@@ -199,33 +207,31 @@
 {
 	callback_t *cbt = (callback_t *) pArg;
 	switch_memory_pool_t *pool = cbt->pool;
-	
+
 	if (argc < 1) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-							"Unexpected number of columns returned for SQL.  Returned column count: %d. ",
-							argc);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unexpected number of columns returned for SQL.  Returned column count: %d. ", argc);
 		return SWITCH_STATUS_GENERR;
 	}
 	cbt->name = switch_core_strdup(pool, switch_str_nil(argv[0]));
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Name: %s\n", cbt->name);
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
 /* make a new string with digits only */
-static char *string_digitsonly(switch_memory_pool_t *pool, const char *str) 
+static char *string_digitsonly(switch_memory_pool_t *pool, const char *str)
 {
 	char *p, *np, *newstr;
 	size_t len;
 
-	p = (char *)str;
+	p = (char *) str;
 
 	len = strlen(str);
-	newstr = switch_core_alloc(pool, len+1);
+	newstr = switch_core_alloc(pool, len + 1);
 	switch_assert(newstr);
 	np = newstr;
-	
-	while(*p) {
+
+	while (*p) {
 		if (switch_isdigit(*p)) {
 			*np = *p;
 			np++;
@@ -237,16 +243,17 @@
 	return newstr;
 }
 
-static cid_data_t *check_cache(switch_memory_pool_t *pool, const char *number) {
+static cid_data_t *check_cache(switch_memory_pool_t *pool, const char *number)
+{
 	char *cmd;
 	char *name = NULL;
 	char *area = NULL;
 	char *src = NULL;
 	cid_data_t *cid = NULL;
 	switch_stream_handle_t stream = { 0 };
-	
+
 	SWITCH_STANDARD_STREAM(stream);
-	
+
 	cmd = switch_core_sprintf(pool, "get fs:cidlookup:name:%s", number);
 	if (switch_api_execute("memcache", cmd, NULL, &stream) == SWITCH_STATUS_SUCCESS) {
 		if (strncmp("-ERR", stream.data, 4)) {
@@ -275,7 +282,7 @@
 			src = NULL;
 		}
 	}
-	
+
 	if (name || area || src) {
 		cid = switch_core_alloc(pool, sizeof(cid_data_t));
 		switch_assert(cid);
@@ -283,24 +290,21 @@
 		cid->area = area;
 		cid->src = src;
 	}
-	
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "memcache: k:'%s', vn:'%s', va:'%s', vs:'%s'\n", 
-						cmd, 
-						(name) ? name : "(null)",
-						(area) ? area : "(null)",
-						(src) ? src : "(null)"
-						);
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "memcache: k:'%s', vn:'%s', va:'%s', vs:'%s'\n",
+					  cmd, (name) ? name : "(null)", (area) ? area : "(null)", (src) ? src : "(null)");
 	switch_safe_free(stream.data);
 	return cid;
 }
 
-switch_bool_t set_cache(switch_memory_pool_t *pool, char *number, cid_data_t *cid) {
+switch_bool_t set_cache(switch_memory_pool_t *pool, char *number, cid_data_t *cid)
+{
 	char *cmd;
 	switch_bool_t success = SWITCH_TRUE;
 	switch_stream_handle_t stream = { 0 };
-	
+
 	SWITCH_STANDARD_STREAM(stream);
-	
+
 	cmd = switch_core_sprintf(pool, "set fs:cidlookup:name:%s '%s' %d", number, cid->name, globals.cache_expire);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "memcache: %s\n", cmd);
 	if (switch_api_execute("memcache", cmd, NULL, &stream) == SWITCH_STATUS_SUCCESS) {
@@ -334,7 +338,7 @@
 		}
 	}
 
-done:
+  done:
 	switch_safe_free(stream.data);
 	return success;
 }
@@ -347,18 +351,18 @@
 	http_data->bytes += realsize;
 
 	if (http_data->bytes > http_data->max_bytes) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Oversized file detected [%d bytes]\n", (int)http_data->bytes);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Oversized file detected [%d bytes]\n", (int) http_data->bytes);
 		http_data->err = 1;
 		return 0;
 	}
 
-	http_data->stream.write_function(
-		&http_data->stream, "%.*s",  realsize, ptr);
+	http_data->stream.write_function(&http_data->stream, "%.*s", realsize, ptr);
 	return realsize;
 }
 
-static char *do_lookup_url(switch_memory_pool_t *pool, switch_event_t *event, const char *query) {
-	char *name = NULL;
+static long do_lookup_url(switch_memory_pool_t *pool, switch_event_t *event, char **response, const char *query, struct curl_httppost *post,
+						  struct curl_slist *headers, int timeout)
+{
 	switch_time_t start_time = switch_micro_time_now();
 	switch_time_t time_diff = 0;
 	CURL *curl_handle = NULL;
@@ -366,31 +370,49 @@
 	char hostname[256] = "";
 
 	struct http_data http_data;
-	
+
 	memset(&http_data, 0, sizeof(http_data));
-	
+
 	http_data.max_bytes = 10240;
 	SWITCH_STANDARD_STREAM(http_data.stream);
 
 	gethostname(hostname, sizeof(hostname));
-	
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "url: %s\n", query);
 	curl_handle = curl_easy_init();
-	
+
+	curl_easy_setopt(curl_handle, CURLOPT_VERBOSE, 0);
+	curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
+
 	if (!strncasecmp(query, "https", 5)) {
 		curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
 		curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
 	}
-	curl_easy_setopt(curl_handle, CURLOPT_POST, SWITCH_FALSE);
+	if (post) {
+		curl_easy_setopt(curl_handle, CURLOPT_HTTPPOST, post);
+	} else {
+		curl_easy_setopt(curl_handle, CURLOPT_HTTPGET, 1);
+	}
+	if (headers) {
+		curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers);
+	}
 	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 
+	   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);
+	if (timeout > 0) {
+		curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT_MS, timeout);
+	} else {
+		curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT_MS, globals.curl_timeout);
+	}
 #else
-	curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, globals.curl_timeout/1000);
+	if (timeout > 0) {
+		curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 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);
@@ -400,36 +422,26 @@
 	curl_easy_perform(curl_handle);
 	curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes);
 	curl_easy_cleanup(curl_handle);
-	
-	if (	http_data.stream.data &&
-			!zstr((char *)http_data.stream.data) &&
-			strcmp(" ", http_data.stream.data) ) {
-		
+
+	if (http_data.stream.data && !zstr((char *) http_data.stream.data) && strcmp(" ", http_data.stream.data)) {
+
 		/* don't return UNKNOWN */
-		if (strcmp("UNKNOWN", http_data.stream.data) ||
-			strcmp("UNAVAILABLE", http_data.stream.data)) {
-			name = switch_core_strdup(pool, http_data.stream.data);
+		if (strcmp("UNKNOWN", http_data.stream.data) || strcmp("UNAVAILABLE", http_data.stream.data)) {
+			*response = switch_core_strdup(pool, http_data.stream.data);
 		}
 	}
-	
-	time_diff = (switch_micro_time_now() - start_time); /* convert to milli from micro */
-	
-	if ((time_diff/1000) >= globals.curl_warnduration) {
+
+	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);
+						  "%um, " "%us, " "%ums" "): url: %s\n", duration.min, duration.sec, duration.ms, query);
 	}
-	
+
 	switch_safe_free(http_data.stream.data);
-	return name;
+	return httpRes;
 }
 
 static cid_data_t *do_whitepages_lookup(switch_memory_pool_t *pool, switch_event_t *event, const char *num)
@@ -446,19 +458,19 @@
 
 	/* NANPA check */
 	if (strlen(num) == 11 && num[0] == '1') {
-		num++; /* skip past leading 1 */
+		num++;					/* skip past leading 1 */
 	} else {
 		goto done;
 	}
-	
+
 	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "whitepages-cid", num);
 	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "whitepages-api-key", globals.whitepages_apikey);
-	
+
 	query = switch_event_expand_headers(event, "http://api.whitepages.com/reverse_phone/1.0/?phone=${whitepages-cid};api_key=${whitepages-api-key}");
-	xml_s = do_lookup_url(pool, event, query);
-	
+	do_lookup_url(pool, event, &xml_s, query, NULL, NULL, 0);
+
 	xml = switch_xml_parse_str_dup(xml_s);
-	
+
 	if (!xml) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to parse XML: %s\n", xml_s);
 		goto done;
@@ -470,14 +482,14 @@
 		name = switch_core_strdup(pool, switch_xml_txt(node));
 		goto area;
 	}
-	
+
 	node = switch_xml_get(xml, "wp:listings", 0, "wp:listing", 0, "wp:displayname", -1);
 	if (node) {
 		name = switch_core_strdup(pool, switch_xml_txt(node));
 	}
 
-area:
-	
+  area:
+
 	node = switch_xml_get(xml, "wp:listings", 0, "wp:listing", 0, "wp:address", 0, "wp:city", -1);
 	if (node) {
 		city = switch_xml_txt(node);
@@ -487,12 +499,12 @@
 	if (node) {
 		state = switch_xml_txt(node);
 	}
-	
+
 	if (city || state) {
 		area = switch_core_sprintf(pool, "%s %s", city ? city : "", state ? state : "");
 	}
 
-done:
+  done:
 
 	if (query) {
 		switch_safe_free(query);
@@ -502,23 +514,24 @@
 	}
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "whitepages XML: %s\n", xml_s);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "whitepages name: %s, area: %s\n", name ? name : "(null)", area ? area : "(null)");
-	
+
 	cid = switch_core_alloc(pool, sizeof(cid_data_t));
 	switch_assert(cid);
-	
+
 	cid->name = name;
 	cid->area = area;
 	cid->src = "whitepages";
 	return cid;
 }
 
-static char *do_db_lookup(switch_memory_pool_t *pool, switch_event_t *event, const char *num, const char *sql) {
+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.odbc_dsn) {
 		newsql = switch_event_expand_headers(event, sql);
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL: %s\n", newsql);
@@ -534,13 +547,14 @@
 	return name;
 }
 
-static cid_data_t *do_lookup(switch_memory_pool_t *pool, switch_event_t *event, const char *num, switch_bool_t skipurl, switch_bool_t skipcitystate) {
+static cid_data_t *do_lookup(switch_memory_pool_t *pool, switch_event_t *event, const char *num, switch_bool_t skipurl, switch_bool_t skipcitystate)
+{
 	char *number = NULL;
 	char *name = NULL;
 	char *url_query = NULL;
 	cid_data_t *cid = NULL;
 	switch_bool_t save_cache = SWITCH_FALSE;
-	
+
 	cid = switch_core_alloc(pool, sizeof(cid_data_t));
 	switch_assert(cid);
 
@@ -567,37 +581,34 @@
 
 	if (!skipurl && globals.whitepages_apikey) {
 		cid = do_whitepages_lookup(pool, event, number);
-		if (cid && cid->name) { /* only cache if we have a name */
+		if (cid && cid->name) {	/* only cache if we have a name */
 			save_cache = SWITCH_TRUE;
 			goto done;
 		}
 	}
-		
+
 	if (!skipurl && globals.url) {
 		url_query = switch_event_expand_headers(event, globals.url);
-		name = do_lookup_url(pool, event, url_query);
+		do_lookup_url(pool, event, &name, url_query, NULL, NULL, 0);
 		if (name) {
 			cid->name = name;
 			cid->src = "url";
-			
+
 			save_cache = SWITCH_TRUE;
 		}
 		if (url_query != globals.url) {
 			switch_safe_free(url_query);
 		}
 	}
-	
-done:
+
+  done:
 	if (!cid) {
 		cid = switch_core_alloc(pool, sizeof(cid_data_t));
 		switch_assert(cid);
 	}
 	/* append area if we can */
-	if (!cid->area &&
-		!skipcitystate && 
-		strlen(number) == 11 && number[0] == '1' &&
-		switch_odbc_available() && globals.odbc_dsn && globals.citystate_sql) {
-		
+	if (!cid->area && !skipcitystate && strlen(number) == 11 && number[0] == '1' && switch_odbc_available() && globals.odbc_dsn && globals.citystate_sql) {
+
 		/* yes, this is really area */
 		name = do_db_lookup(pool, event, number, globals.citystate_sql);
 		if (name) {
@@ -609,7 +620,7 @@
 			}
 		}
 	}
-	
+
 	if (!cid->area) {
 		cid->area = "UNKNOWN";
 	}
@@ -619,12 +630,12 @@
 	if (!cid->src) {
 		cid->src = "UNKNOWN";
 	}
-	
+
 	if (globals.cache && save_cache) {
 		set_cache(pool, number, cid);
 	}
-	
 
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "cidlookup source: %s\n", cid->src);
 	return cid;
 }
@@ -632,7 +643,7 @@
 SWITCH_STANDARD_APP(cidlookup_app_function)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	
+
 	char *argv[4] = { 0 };
 	int argc;
 	char *mydata = NULL;
@@ -646,7 +657,7 @@
 	const char *number = NULL;
 	switch_bool_t skipurl = SWITCH_FALSE;
 	switch_bool_t skipcitystate = SWITCH_FALSE;
-	
+
 	if (session) {
 		pool = switch_core_session_get_pool(session);
 	} else {
@@ -657,7 +668,7 @@
 	if (!(mydata = switch_core_session_strdup(session, data))) {
 		return;
 	}
-	
+
 	if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
 		if (argc > 0) {
 			number = switch_core_session_strdup(session, argv[0]);
@@ -670,15 +681,20 @@
 			}
 		}
 	}
-	
+
 	if (!number && profile) {
 		number = switch_caller_get_field_by_name(profile, "caller_id_number");
 	}
-	
+
 	if (number) {
 		cid = do_lookup(pool, event, number, skipurl, skipcitystate);
 	}
-	
+
+	if (switch_string_var_check_const(cid->name)) {
+		switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_CRIT, "Invalid CID data {%s} contains a variable\n", cid->name);
+		switch_goto_status(SWITCH_STATUS_GENERR, done);
+	}
+
 	if (cid && channel) {
 		switch_channel_set_variable(channel, "original_caller_id_name", switch_core_strdup(pool, profile->caller_id_name));
 		if (!zstr(cid->src)) {
@@ -689,10 +705,10 @@
 		}
 		profile->caller_id_name = switch_core_strdup(profile->pool, cid->name);;
 	}
-	
+
 	switch_goto_status(SWITCH_STATUS_SUCCESS, done);
-	
-done:
+
+  done:
 	if (event) {
 		switch_event_destroy(&event);
 	}
@@ -700,6 +716,7 @@
 		switch_core_destroy_memory_pool(&pool);
 	}
 }
+
 SWITCH_STANDARD_API(cidlookup_function)
 {
 	switch_status_t status;
@@ -714,7 +731,7 @@
 	switch_bool_t skipurl = SWITCH_FALSE;
 	switch_bool_t skipcitystate = SWITCH_FALSE;
 	switch_bool_t verbose = SWITCH_FALSE;
-	
+
 	if (zstr(cmd)) {
 		switch_goto_status(SWITCH_STATUS_SUCCESS, usage);
 	}
@@ -731,22 +748,18 @@
 		if (argc < 1) {
 			switch_goto_status(SWITCH_STATUS_SUCCESS, usage);
 		}
-		
+
 		if (!strcmp("status", argv[0])) {
-			stream->write_function(stream, "+OK\n url: %s\n cache: %s\n cache-expire: %d\n", 
-									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)",
-									globals.sql ? globals.sql : "(null)",
-									globals.citystate_sql ? globals.citystate_sql : "(null)");
-			stream->write_function(stream, " ODBC Compiled: %s\n", switch_odbc_available() ? "true" : "false");
+			stream->write_function(stream, "+OK\n url: %s\n cache: %s\n cache-expire: %d\n",
+								   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)",
+								   globals.sql ? globals.sql : "(null)", globals.citystate_sql ? globals.citystate_sql : "(null)");
+			stream->write_function(stream, " ODBC Compiled: %s\n", switch_odbc_available()? "true" : "false");
+
 			switch_goto_status(SWITCH_STATUS_SUCCESS, done);
 		}
 		for (i = 1; i < argc; i++) {
@@ -761,6 +774,11 @@
 
 		cid = do_lookup(pool, event, argv[0], skipurl, skipcitystate);
 		if (cid) {
+			if (switch_string_var_check_const(cid->name)) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Invalid CID data {%s} contains a variable\n", cid->name);
+				stream->write_function(stream, "-ERR Invalid CID data {%s} contains a variable\n", cid->name);
+				switch_goto_status(SWITCH_STATUS_SUCCESS, done);
+			}
 			stream->write_function(stream, cid->name);
 			if (verbose) {
 				stream->write_function(stream, " (%s) [%s]", cid->area, cid->src);
@@ -771,11 +789,11 @@
 	}
 	switch_goto_status(SWITCH_STATUS_SUCCESS, done);
 
-usage:
+  usage:
 	stream->write_function(stream, "-ERR\n%s\n", SYNTAX);
 	switch_goto_status(status, done);
-	
-done: 
+
+  done:
 	switch_safe_free(mydata);
 	if (event) {
 		switch_event_destroy(&event);
@@ -795,16 +813,16 @@
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	memset(&globals, 0, sizeof(globals));
-	
+
 	globals.pool = pool;
 
 	do_config(SWITCH_FALSE);
-	
+
 	if ((switch_event_bind_removable(modname, SWITCH_EVENT_RELOADXML, NULL, event_handler, NULL, &reload_xml_event) != SWITCH_STATUS_SUCCESS)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind event!\n");
 		return SWITCH_STATUS_TERM;
 	}
-	
+
 	SWITCH_ADD_API(api_interface, "cidlookup", "cidlookup API", cidlookup_function, SYNTAX);
 	SWITCH_ADD_APP(app_interface, "cidlookup", "Perform a CID lookup", "Perform a CID lookup",
 				   cidlookup_app_function, "[number [skipurl]]", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_cluechoo/mod_cluechoo.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_cluechoo/mod_cluechoo.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_cluechoo/mod_cluechoo.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -52,11 +52,11 @@
 SWITCH_STANDARD_APP(cluechoo_app)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	
+
 	switch_channel_answer(channel);
 	switch_ivr_sleep(session, 1000, SWITCH_FALSE, NULL);
 
-	while(switch_channel_ready(channel)) {
+	while (switch_channel_ready(channel)) {
 		if (vgo(0, session) < 0) {
 			break;
 		}
@@ -66,7 +66,7 @@
 SWITCH_STANDARD_API(cluechoo_function)
 {
 	//stream->write_function(stream, "+OK Reloading\n");
-	
+
 	go(0);
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -81,7 +81,7 @@
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hello World!\n");
-	
+
 	SWITCH_ADD_API(api_interface, "cluechoo", "Cluechoo API", cluechoo_function, "syntax");
 
 	SWITCH_ADD_APP(app_interface, "cluechoo", "cluechoo", "cluechoo", cluechoo_app, "", SAF_NONE);
@@ -134,36 +134,45 @@
 #include <unistd.h>
 #include "sl.h"
 
-int ACCIDENT  = 0;
-int LOGO      = 0;
-int FLY       = 0;
+int ACCIDENT = 0;
+int LOGO = 0;
+int FLY = 0;
 
 int my_mvaddstr(int y, int x, char *str)
 {
-    for ( ; x < 0; ++x, ++str)
-		if (*str == '\0')  return ERR;
-    for ( ; *str != '\0'; ++str, ++x)
-		if (mvaddch(y, x, *str) == ERR)  return ERR;
-    return OK;
+	for (; x < 0; ++x, ++str)
+		if (*str == '\0')
+			return ERR;
+	for (; *str != '\0'; ++str, ++x)
+		if (mvaddch(y, x, *str) == ERR)
+			return ERR;
+	return OK;
 }
 
 void option(char *str)
 {
-    extern int ACCIDENT, FLY;
+	extern int ACCIDENT, FLY;
 
-    while (*str != '\0') {
+	while (*str != '\0') {
 		switch (*str++) {
-	    case 'a': ACCIDENT = 1; break;
-	    case 'F': FLY      = 1; break;
-	    case 'l': LOGO     = 1; break;
-	    default:                break;
+		case 'a':
+			ACCIDENT = 1;
+			break;
+		case 'F':
+			FLY = 1;
+			break;
+		case 'l':
+			LOGO = 1;
+			break;
+		default:
+			break;
 		}
-    }
+	}
 }
 
 int go(int i)
 {
-    int x;
+	int x;
 	int sleep_len = 40000;
 
 	if (i > 0) {
@@ -171,23 +180,25 @@
 	}
 
 	/*
-    for (i = 1; i < argc; ++i) {
-		if (*argv[i] == '-') {
-			option(argv[i] + 1);
-		}
-    }
-	*/
-    initscr();
-    signal(SIGINT, SIG_IGN);
-    noecho();
-    leaveok(stdscr, TRUE);
-    scrollok(stdscr, FALSE);
+	   for (i = 1; i < argc; ++i) {
+	   if (*argv[i] == '-') {
+	   option(argv[i] + 1);
+	   }
+	   }
+	 */
+	initscr();
+	signal(SIGINT, SIG_IGN);
+	noecho();
+	leaveok(stdscr, TRUE);
+	scrollok(stdscr, FALSE);
 
-    for (x = COLS - 1; ; --x) {
+	for (x = COLS - 1;; --x) {
 		if (LOGO == 0) {
-			if (add_D51(x) == ERR) break;
+			if (add_D51(x) == ERR)
+				break;
 		} else {
-			if (add_sl(x) == ERR) break;
+			if (add_sl(x) == ERR)
+				break;
 		}
 		refresh();
 		if (x == COLS / 4) {
@@ -195,9 +206,9 @@
 		} else {
 			usleep(sleep_len);
 		}
-    }
-    mvcur(0, COLS - 1, LINES - 1, 0);
-    endwin();
+	}
+	mvcur(0, COLS - 1, LINES - 1, 0);
+	endwin();
 
 	return 0;
 }
@@ -205,20 +216,20 @@
 
 int vgo(int i, switch_core_session_t *session)
 {
-    int x;
+	int x;
 	int sleep_len = 40000;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_frame_t *read_frame;
 	switch_status_t status;
-    switch_codec_implementation_t read_impl = {0};
-	switch_codec_t codec = {0};
+	switch_codec_implementation_t read_impl = { 0 };
+	switch_codec_t codec = { 0 };
 	int hangover_hits = 0, hangunder_hits = 0;
 	int diff_level = 400;
 	int hangover = 40, hangunder = 15;
 	int talking = 0;
 	int energy_level = 500;
 	int done = 0;
-    switch_core_session_get_read_impl(session, &read_impl);
+	switch_core_session_get_read_impl(session, &read_impl);
 
 	printf("%s", SWITCH_SEQ_CLEARSCR);
 
@@ -226,16 +237,16 @@
 		sleep_len = i;
 	}
 
-    initscr();
-    signal(SIGINT, SIG_IGN);
-    noecho();
-    leaveok(stdscr, TRUE);
-    scrollok(stdscr, FALSE);
+	initscr();
+	signal(SIGINT, SIG_IGN);
+	noecho();
+	leaveok(stdscr, TRUE);
+	scrollok(stdscr, FALSE);
 
 
 	if (switch_core_codec_init(&codec,
 							   "L16",
-							   NULL, (int) read_impl.samples_per_second, read_impl.microseconds_per_packet / 1000, 
+							   NULL, (int) read_impl.samples_per_second, read_impl.microseconds_per_packet / 1000,
 							   1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
 							   switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
 		return -1;
@@ -243,28 +254,27 @@
 
 	switch_core_session_set_read_codec(session, &codec);
 
-    for (x = COLS - 1; ; --x) {
+	for (x = COLS - 1;; --x) {
 
 		if (!done && !switch_channel_ready(channel)) {
 			done = 1;
 		}
-		
+
 		if (!done) {
 			status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
 			if (!SWITCH_READ_ACCEPTABLE(status)) {
 				done = 1;
 			}
 		}
-		
-		if (!done)
-		{
+
+		if (!done) {
 			int16_t *fdata = (int16_t *) read_frame->data;
 			uint32_t samples = read_frame->datalen / sizeof(*fdata);
 			uint32_t score, count = 0, j = 0;
 			double energy = 0;
 			int divisor = 0;
 
-			
+
 			for (count = 0; count < samples; count++) {
 				energy += abs(fdata[j]);
 				j += read_impl.number_of_channels;
@@ -275,7 +285,7 @@
 			}
 
 			score = (uint32_t) (energy / (samples / divisor));
-			
+
 			if (score > energy_level) {
 				uint32_t diff = score - energy_level;
 				if (hangover_hits) {
@@ -284,7 +294,7 @@
 
 				if (diff >= diff_level || ++hangunder_hits >= hangunder) {
 					hangover_hits = hangunder_hits = 0;
-					
+
 					if (!talking) {
 						talking = 1;
 					}
@@ -310,22 +320,24 @@
 		}
 
 		if (LOGO == 0) {
-			if (add_D51(x) == ERR) break;
+			if (add_D51(x) == ERR)
+				break;
 		} else {
-			if (add_sl(x) == ERR) break;
+			if (add_sl(x) == ERR)
+				break;
 		}
 		refresh();
 
 		/*
-		if (x == COLS / 4) {
-			sleep(2);
-		} else {
-			usleep(sleep_len);
-		}
-		*/
-    }
-    mvcur(0, COLS - 1, LINES - 1, 0);
-    endwin();
+		   if (x == COLS / 4) {
+		   sleep(2);
+		   } else {
+		   usleep(sleep_len);
+		   }
+		 */
+	}
+	mvcur(0, COLS - 1, LINES - 1, 0);
+	endwin();
 
 	switch_core_session_set_read_codec(session, NULL);
 	switch_core_codec_destroy(&codec);
@@ -335,103 +347,114 @@
 
 int add_sl(int x)
 {
-    static char *sl[LOGOPATTERNS][LOGOHIGHT + 1]
-		= {{LOGO1, LOGO2, LOGO3, LOGO4, LWHL11, LWHL12, DELLN},
-		   {LOGO1, LOGO2, LOGO3, LOGO4, LWHL21, LWHL22, DELLN},
-		   {LOGO1, LOGO2, LOGO3, LOGO4, LWHL31, LWHL32, DELLN},
-		   {LOGO1, LOGO2, LOGO3, LOGO4, LWHL41, LWHL42, DELLN},
-		   {LOGO1, LOGO2, LOGO3, LOGO4, LWHL51, LWHL52, DELLN},
-		   {LOGO1, LOGO2, LOGO3, LOGO4, LWHL61, LWHL62, DELLN}};
+	static char *sl[LOGOPATTERNS][LOGOHIGHT + 1]
+	= { {LOGO1, LOGO2, LOGO3, LOGO4, LWHL11, LWHL12, DELLN},
+	{LOGO1, LOGO2, LOGO3, LOGO4, LWHL21, LWHL22, DELLN},
+	{LOGO1, LOGO2, LOGO3, LOGO4, LWHL31, LWHL32, DELLN},
+	{LOGO1, LOGO2, LOGO3, LOGO4, LWHL41, LWHL42, DELLN},
+	{LOGO1, LOGO2, LOGO3, LOGO4, LWHL51, LWHL52, DELLN},
+	{LOGO1, LOGO2, LOGO3, LOGO4, LWHL61, LWHL62, DELLN}
+	};
 
-    static char *coal[LOGOHIGHT + 1]
-		= {LCOAL1, LCOAL2, LCOAL3, LCOAL4, LCOAL5, LCOAL6, DELLN};
+	static char *coal[LOGOHIGHT + 1]
+	= { LCOAL1, LCOAL2, LCOAL3, LCOAL4, LCOAL5, LCOAL6, DELLN };
 
-    static char *car[LOGOHIGHT + 1]
-		= {LCAR1, LCAR2, LCAR3, LCAR4, LCAR5, LCAR6, DELLN};
+	static char *car[LOGOHIGHT + 1]
+	= { LCAR1, LCAR2, LCAR3, LCAR4, LCAR5, LCAR6, DELLN };
 
-    int i, y, py1 = 0, py2 = 0, py3 = 0;
-    
-    if (x < - LOGOLENGTH)  return ERR;
-    y = LINES / 2 - 3;
+	int i, y, py1 = 0, py2 = 0, py3 = 0;
 
-    if (FLY == 1) {
+	if (x < -LOGOLENGTH)
+		return ERR;
+	y = LINES / 2 - 3;
+
+	if (FLY == 1) {
 		y = (x / 6) + LINES - (COLS / 6) - LOGOHIGHT;
-		py1 = 2;  py2 = 4;  py3 = 6;
-    }
+		py1 = 2;
+		py2 = 4;
+		py3 = 6;
+	}
 
-    for (i = 0; i <= LOGOHIGHT; ++i) {
+	for (i = 0; i <= LOGOHIGHT; ++i) {
 		my_mvaddstr(y + i, x, sl[(LOGOLENGTH + x) / 3 % LOGOPATTERNS][i]);
 		my_mvaddstr(y + i + py1, x + 21, coal[i]);
 		my_mvaddstr(y + i + py2, x + 42, car[i]);
 		my_mvaddstr(y + i + py3, x + 63, car[i]);
-    }
-    if (ACCIDENT == 1) {
+	}
+	if (ACCIDENT == 1) {
 		add_man(y + 1, x + 14);
-		add_man(y + 1 + py2, x + 45);  add_man(y + 1 + py2, x + 53);
-		add_man(y + 1 + py3, x + 66);  add_man(y + 1 + py3, x + 74);
-    }
-    add_smoke(y - 1, x + LOGOFUNNEL);
-    return OK;
+		add_man(y + 1 + py2, x + 45);
+		add_man(y + 1 + py2, x + 53);
+		add_man(y + 1 + py3, x + 66);
+		add_man(y + 1 + py3, x + 74);
+	}
+	add_smoke(y - 1, x + LOGOFUNNEL);
+	return OK;
 }
 
 static int loops = 0;
 
 int add_D51(int x)
 {
-    static char *d51[D51PATTERNS][D51HIGHT + 1]
-		= {{D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7,
-			D51WHL11, D51WHL12, D51WHL13, D51DEL},
-		   {D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7,
-			D51WHL21, D51WHL22, D51WHL23, D51DEL},
-		   {D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7,
-			D51WHL31, D51WHL32, D51WHL33, D51DEL},
-		   {D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7,
-			D51WHL41, D51WHL42, D51WHL43, D51DEL},
-		   {D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7,
-			D51WHL51, D51WHL52, D51WHL53, D51DEL},
-		   {D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7,
-			D51WHL61, D51WHL62, D51WHL63, D51DEL}};
-    static char *coal[D51HIGHT + 1]
-		= {COAL01, COAL02, COAL03, COAL04, COAL05,
-		   COAL06, COAL07, COAL08, COAL09, COAL10, COALDEL};
+	static char *d51[D51PATTERNS][D51HIGHT + 1]
+		= { {D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7,
+			 D51WHL11, D51WHL12, D51WHL13, D51DEL},
+	{D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7,
+	 D51WHL21, D51WHL22, D51WHL23, D51DEL},
+	{D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7,
+	 D51WHL31, D51WHL32, D51WHL33, D51DEL},
+	{D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7,
+	 D51WHL41, D51WHL42, D51WHL43, D51DEL},
+	{D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7,
+	 D51WHL51, D51WHL52, D51WHL53, D51DEL},
+	{D51STR1, D51STR2, D51STR3, D51STR4, D51STR5, D51STR6, D51STR7,
+	 D51WHL61, D51WHL62, D51WHL63, D51DEL}
+	};
+	static char *coal[D51HIGHT + 1]
+		= { COAL01, COAL02, COAL03, COAL04, COAL05,
+		COAL06, COAL07, COAL08, COAL09, COAL10, COALDEL
+	};
 
-    static char *acoal[D51HIGHT + 1]
-		= {COAL01, COAL02, COAL03, COAL04, COAL5A,
-		   COAL06, COAL07, COAL08, COAL09, COAL10, COALDEL};
+	static char *acoal[D51HIGHT + 1]
+		= { COAL01, COAL02, COAL03, COAL04, COAL5A,
+		COAL06, COAL07, COAL08, COAL09, COAL10, COALDEL
+	};
 
-    int y, i, dy = 0;
+	int y, i, dy = 0;
 
-    if (x < - D51LENGTH)  return ERR;
-    y = LINES / 2 - 5;
+	if (x < -D51LENGTH)
+		return ERR;
+	y = LINES / 2 - 5;
 
-    if (FLY == 1) {
+	if (FLY == 1) {
 		y = (x / 7) + LINES - (COLS / 7) - D51HIGHT;
 		dy = 1;
-    }
+	}
 
-    for (i = 0; i <= D51HIGHT; ++i) {
+	for (i = 0; i <= D51HIGHT; ++i) {
 		my_mvaddstr(y + i, x, d51[(D51LENGTH + x) % D51PATTERNS][i]);
 		my_mvaddstr(y + i + dy, x + 53, loops > 60 ? coal[i] : acoal[i]);
 		loops++;
-		if (loops == 500) loops =  -100;
-    }
-    if (ACCIDENT == 1) {
+		if (loops == 500)
+			loops = -100;
+	}
+	if (ACCIDENT == 1) {
 		add_man(y + 2, x + 43);
 		add_man(y + 2, x + 47);
-    }
-    add_smoke(y - 1, x + D51FUNNEL);
-    return OK;
+	}
+	add_smoke(y - 1, x + D51FUNNEL);
+	return OK;
 }
 
 
 int add_man(int y, int x)
 {
-    static char *man[2][2] = {{"", "(O)"}, {"Help!", "\\O/"}};
-    int i;
+	static char *man[2][2] = { {"", "(O)"}, {"Help!", "\\O/"} };
+	int i;
 
-    for (i = 0; i < 2; ++i) {
+	for (i = 0; i < 2; ++i) {
 		my_mvaddstr(y + i, x, man[(LOGOLENGTH + x) / 12 % 2][i]);
-    }
+	}
 
 	return 0;
 }
@@ -440,45 +463,51 @@
 int add_smoke(int y, int x)
 #define SMOKEPTNS	16
 {
-    static struct smokes {
+	static struct smokes {
 		int y, x;
 		int ptrn, kind;
-    } S[1000];
-    static int sum = 0;
-    static char *Smoke[2][SMOKEPTNS]
-		= {{"(   )", "(    )", "(    )", "(   )", "(  )",
-			"(  )" , "( )"   , "( )"   , "()"   , "()"  ,
-			"O"    , "O"     , "O"     , "O"    , "O"   ,
-			" "                                          },
-		   {"(@@@)", "(@@@@)", "(@@@@)", "(@@@)", "(@@)",
-			"(@@)" , "(@)"   , "(@)"   , "@@"   , "@@"  ,
-			"@"    , "@"     , "@"     , "@"    , "@"   ,
-			" "                                          }};
-    static char *Eraser[SMOKEPTNS]
-		=  {"     ", "      ", "      ", "     ", "    ",
-			"    " , "   "   , "   "   , "  "   , "  "  ,
-			" "    , " "     , " "     , " "    , " "   ,
-			" "                                          };
-    static int dy[SMOKEPTNS] = { 2,  1, 1, 1, 0, 0, 0, 0, 0, 0,
-								 0,  0, 0, 0, 0, 0             };
-    static int dx[SMOKEPTNS] = {-2, -1, 0, 1, 1, 1, 1, 1, 2, 2,
-								2,  2, 2, 3, 3, 3             };
-    int i;
+	} S[1000];
+	static int sum = 0;
+	static char *Smoke[2][SMOKEPTNS]
+		= { {"(   )", "(    )", "(    )", "(   )", "(  )",
+			 "(  )", "( )", "( )", "()", "()",
+			 "O", "O", "O", "O", "O",
+			 " "},
+	{"(@@@)", "(@@@@)", "(@@@@)", "(@@@)", "(@@)",
+	 "(@@)", "(@)", "(@)", "@@", "@@",
+	 "@", "@", "@", "@", "@",
+	 " "}
+	};
+	static char *Eraser[SMOKEPTNS]
+		= { "     ", "      ", "      ", "     ", "    ",
+		"    ", "   ", "   ", "  ", "  ",
+		" ", " ", " ", " ", " ",
+		" "
+	};
+	static int dy[SMOKEPTNS] = { 2, 1, 1, 1, 0, 0, 0, 0, 0, 0,
+		0, 0, 0, 0, 0, 0
+	};
+	static int dx[SMOKEPTNS] = { -2, -1, 0, 1, 1, 1, 1, 1, 2, 2,
+		2, 2, 2, 3, 3, 3
+	};
+	int i;
 
-    if (x % 4 == 0) {
+	if (x % 4 == 0) {
 		for (i = 0; i < sum; ++i) {
 			my_mvaddstr(S[i].y, S[i].x, Eraser[S[i].ptrn]);
-			S[i].y    -= dy[S[i].ptrn];
-			S[i].x    += dx[S[i].ptrn];
+			S[i].y -= dy[S[i].ptrn];
+			S[i].x += dx[S[i].ptrn];
 			S[i].ptrn += (S[i].ptrn < SMOKEPTNS - 1) ? 1 : 0;
 			my_mvaddstr(S[i].y, S[i].x, Smoke[S[i].kind][S[i].ptrn]);
 		}
 		my_mvaddstr(y, x, Smoke[sum % 2][0]);
-		S[sum].y = y;    S[sum].x = x;
-		S[sum].ptrn = 0; S[sum].kind = sum % 2;
-		sum ++;
-    }
-	
+		S[sum].y = y;
+		S[sum].x = x;
+		S[sum].ptrn = 0;
+		S[sum].kind = sum % 2;
+		sum++;
+	}
+
 	return 0;
 }
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_commands/mod_commands.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_commands/mod_commands.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_commands/mod_commands.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -45,22 +45,47 @@
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_commands_shutdown);
 SWITCH_MODULE_DEFINITION(mod_commands, mod_commands_load, mod_commands_shutdown, NULL);
 
+SWITCH_STANDARD_API(banner_function)
+{
+	stream->write_function(stream, "%s", switch_core_banner());
+	return SWITCH_STATUS_SUCCESS;
+}
+
 SWITCH_STANDARD_API(hostname_api_function)
 {
-	char hostname[256]="";
+	char hostname[256] = "";
 	gethostname(hostname, sizeof(hostname));
-	stream->write_function(stream, "%s",hostname);
+	stream->write_function(stream, "%s", hostname);
 	return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_STANDARD_API(db_cache_function) {
+
+SWITCH_STANDARD_API(shutdown_function)
+{
+	switch_session_ctl_t command = SCSC_SHUTDOWN;
+	int arg = 0;
+
+	stream->write_function(stream, "+OK\n");
+	switch_core_session_ctl(command, &arg);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_STANDARD_API(version_function)
+{
+	stream->write_function(stream, "FreeSWITCH Version %s\n", SWITCH_VERSION_FULL);
+	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);
 
@@ -75,11 +100,12 @@
 	} else {
 		goto error;
 	}
-	
-error:
-		stream->write_function(stream, "%s", "parameter missing\n");
-ok:
-		return SWITCH_STATUS_SUCCESS;
+
+  error:
+	stream->write_function(stream, "%s", "parameter missing\n");
+  ok:
+	switch_safe_free(mydata);
+	return SWITCH_STATUS_SUCCESS;
 }
 
 SWITCH_STANDARD_API(host_lookup_function)
@@ -112,6 +138,11 @@
 		goto error;
 	}
 
+	if (!switch_nat_is_initialized()) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "nat_map API called while NAT not initialized\n");
+		goto error;
+	}
+
 	mydata = strdup(cmd);
 	switch_assert(mydata);
 
@@ -136,7 +167,7 @@
 		switch_safe_free(tmp);
 		goto ok;
 	}
-	
+
 	if (argc < 3) {
 		goto error;
 	}
@@ -146,18 +177,18 @@
 	} else if (argv[2] && switch_stristr("udp", argv[2])) {
 		proto = SWITCH_NAT_UDP;
 	}
-	
+
 	if (argv[3] && switch_stristr("sticky", argv[3])) {
 		sticky = SWITCH_TRUE;
 	}
 
 	if (argv[0] && switch_stristr("add", argv[0])) {
-		if (switch_nat_add_mapping((switch_port_t)atoi(argv[1]), proto, &external_port, sticky) == SWITCH_STATUS_SUCCESS) {
-			stream->write_function(stream, "true"); /* still return true */
+		if (switch_nat_add_mapping((switch_port_t) atoi(argv[1]), proto, &external_port, sticky) == SWITCH_STATUS_SUCCESS) {
+			stream->write_function(stream, "true");	/* still return true */
 			goto ok;
 		}
 	} else if (argv[0] && switch_stristr("del", argv[0])) {
-		if (switch_nat_del_mapping((switch_port_t)atoi(argv[1]), proto) == SWITCH_STATUS_SUCCESS) {
+		if (switch_nat_del_mapping((switch_port_t) atoi(argv[1]), proto) == SWITCH_STATUS_SUCCESS) {
 			stream->write_function(stream, "true");
 			goto ok;
 		}
@@ -183,7 +214,7 @@
 	int diff;
 	int max = 10, a = 0;
 	char *p;
-	if (zstr(cmd)){
+	if (zstr(cmd)) {
 		stream->write_function(stream, "parameter missing\n");
 		return SWITCH_STATUS_SUCCESS;
 	}
@@ -195,7 +226,7 @@
 	}
 
 	if ((p = strchr(cmd, ' '))) {
-		if ((a = atoi(p+1)) > 0) {
+		if ((a = atoi(p + 1)) > 0) {
 			max = a;
 			if (max > 100) {
 				max = 100;
@@ -216,6 +247,83 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+#define TIMER_TEST_SYNTAX "<10|20|40|60|120> [<1..200>] [<timer_name>]"
+
+SWITCH_STANDARD_API(timer_test_function)
+{
+	switch_time_t now, then, start, end;
+	int x;
+	int mss = 20;
+	uint32_t total = 0;
+	int diff;
+	int max = 50;
+	switch_timer_t timer = { 0 };
+	int argc = 0;
+	char *argv[5] = { 0 };
+	const char *timer_name = "soft";
+	switch_memory_pool_t *pool;
+	char *mycmd = NULL;
+
+	switch_core_new_memory_pool(&pool);
+
+	if (zstr(cmd)) {
+		mycmd = "";
+	} else {
+		mycmd = switch_core_strdup(pool, cmd);
+	}
+
+	argc = switch_split(mycmd, ' ', argv);
+
+	if (argc > 0) {
+		mss = atoi(argv[0]);
+	}
+
+	if (argc > 1) {
+		int tmp = atoi(argv[1]);
+		if (tmp > 0 && tmp <= 400) {
+			max = tmp;
+		}
+	}
+
+	if (argc > 2) {
+		timer_name = argv[2];
+	}
+
+	if (mss != 10 && mss != 20 && mss != 30 && mss != 40 && mss != 60 && mss != 120) {
+		stream->write_function(stream, "parameter missing: %s\n", TIMER_TEST_SYNTAX);
+		goto end;
+	}
+
+	if (switch_core_timer_init(&timer, timer_name, mss, 1, pool) != SWITCH_STATUS_SUCCESS) {
+		stream->write_function(stream, "Timer Error!\n");
+		goto end;
+	}
+
+	start = switch_time_now();
+	for (x = 1; x <= max; x++) {
+		then = switch_time_now();
+		switch_core_timer_next(&timer);
+		now = switch_time_now();
+		diff = (int) (now - then);
+		//stream->write_function(stream, "test %d sleep %ld %d\n", x, mss, diff);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Timer Test: %d sleep %d %d\n", x, mss, diff);
+		total += diff;
+	}
+	end = switch_time_now();
+
+	switch_yield(250000);
+
+	stream->write_function(stream, "Avg: %0.3fms Total Time: %0.3fms\n", (float) ((float) (total / (x > 1 ? x - 1 : 1)) / 1000),
+						   (float) ((float) (end - start) / 1000));
+
+  end:
+
+	switch_core_destroy_memory_pool(&pool);
+
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
 SWITCH_STANDARD_API(group_call_function)
 {
 	char *domain;
@@ -240,12 +348,13 @@
 	if ((flags = strchr(group_name, '+'))) {
 		*flags++ = '\0';
 		for (fp = flags; fp && *fp; fp++) {
-			switch(*fp) {
+			switch (*fp) {
 			case 'F':
 				call_delim = "|";
 				break;
 			case 'A':
 				call_delim = ",";
+				break;
 			case 'E':
 				call_delim = SWITCH_ENT_ORIGINATE_DELIM;
 				break;
@@ -254,15 +363,15 @@
 			}
 		}
 	}
-	
+
 	domain = strchr(group_name, '@');
-	
+
 	if (domain) {
 		*domain++ = '\0';
 	} else {
 		domain = switch_core_get_variable("domain");
 	}
-	
+
 	if (!zstr(domain)) {
 		switch_xml_t xml, x_domain, x_group;
 		switch_event_t *params;
@@ -274,18 +383,32 @@
 		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "group", group_name);
 		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "domain", domain);
 		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "action", "group_call");
-		
+
 		if (switch_xml_locate_group(group_name, domain, &xml, &x_domain, &x_group, params) == SWITCH_STATUS_SUCCESS) {
-			switch_xml_t x_user, x_users, x_param, x_params;
-			
+			switch_xml_t x_user, x_users, x_param, x_params, my_x_user;
+
 			if ((x_users = switch_xml_child(x_group, "users"))) {
 				ok++;
-				
-				for(x_user = switch_xml_child(x_users, "user"); x_user; x_user = x_user->next) {
+
+				for (x_user = switch_xml_child(x_users, "user"); x_user; x_user = x_user->next) {
 					const char *id = switch_xml_attr_soft(x_user, "id");
+					const char *x_user_type = switch_xml_attr_soft(x_user, "type");
 					const char *dest = NULL;
 					char *d_dest = NULL;
-					
+					switch_xml_t xml_for_pointer = NULL, x_domain_for_pointer = NULL, x_group_for_pointer = NULL, x_user_for_pointer = NULL;
+
+					my_x_user = x_user;
+
+					if (!strcmp(x_user_type, "pointer")) {
+						if (switch_xml_locate_user("id", id, domain, NULL,
+												   &xml_for_pointer, &x_domain_for_pointer,
+												   &x_user_for_pointer, &x_group_for_pointer, params) != SWITCH_STATUS_SUCCESS) {
+							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Can't find user [%s@%s]\n", id, domain);
+							goto done_x_user;
+						}
+						my_x_user = x_user_for_pointer;
+					}
+
 					if ((x_params = switch_xml_child(x_domain, "params"))) {
 						for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
 							const char *var = switch_xml_attr(x_param, "name");
@@ -318,11 +441,11 @@
 						}
 					}
 
-					if ((x_params = switch_xml_child(x_user, "params"))) {
+					if ((x_params = switch_xml_child(my_x_user, "params"))) {
 						for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
 							const char *var = switch_xml_attr(x_param, "name");
 							const char *val = switch_xml_attr(x_param, "value");
-							
+
 							if (!strcasecmp(var, "group-dial-string")) {
 								dest = val;
 								break;
@@ -333,7 +456,7 @@
 							}
 						}
 					}
-					
+
 					if (dest) {
 						if (channel) {
 							switch_channel_set_variable(channel, "dialed_group", group_name);
@@ -352,7 +475,7 @@
 					} else {
 						d_dest = switch_mprintf("user/%s@%s", id, domain);
 					}
-					
+
 					if (d_dest) {
 						dstream.write_function(&dstream, "%s%s", d_dest, call_delim);
 
@@ -360,6 +483,12 @@
 							free(d_dest);
 						}
 					}
+
+				  done_x_user:
+					if (xml_for_pointer) {
+						switch_xml_free(xml_for_pointer);
+						xml_for_pointer = NULL;
+					}
 				}
 
 				if (ok && dstream.data) {
@@ -384,17 +513,17 @@
 				} else {
 					ok = 0;
 				}
-				
+
 			}
 		}
 		switch_xml_free(xml);
 		switch_event_destroy(&params);
 	}
 
- end:
+  end:
 
 	switch_safe_free(group_name);
-	
+
 	if (!ok) {
 		stream->write_function(stream, "error/NO_ROUTE_DESTINATION");
 	}
@@ -412,7 +541,7 @@
 	switch_event_t *params = NULL;
 	const char *rval = "false";
 	char *group;
-	
+
 	if (zstr(cmd) || !(mydata = strdup(cmd))) {
 		goto end;
 	}
@@ -444,11 +573,11 @@
 	}
 
   end:
-	
+
 	stream->write_function(stream, "%s", rval);
-	
+
 	switch_xml_free(xml);
-	free(mydata);
+	switch_safe_free(mydata);
 	switch_event_destroy(&params);
 
 	return SWITCH_STATUS_SUCCESS;
@@ -482,7 +611,7 @@
 			domain = "cluecon.com";
 		}
 	}
-	
+
 	switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS);
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "user", user);
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "domain", domain);
@@ -512,7 +641,7 @@
 
 			}
 		}
-		
+
 		if ((x_params = switch_xml_child(x_domain, container))) {
 			for (x_param = switch_xml_child(x_params, elem); x_param; x_param = x_param->next) {
 				const char *var = switch_xml_attr(x_param, "name");
@@ -528,7 +657,7 @@
 
   end:
 	switch_xml_free(xml);
-	free(mydata);
+	switch_safe_free(mydata);
 	switch_event_destroy(&params);
 
 	return SWITCH_STATUS_SUCCESS;
@@ -603,10 +732,10 @@
 			free(xmlstr);
 		}
 	}
-	
+
 	switch_xml_free(xml);
-			
-	free(mydata);
+
+	switch_safe_free(mydata);
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -623,7 +752,7 @@
 		stream->write_function(stream, "%s", digest);
 	}
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 SWITCH_STANDARD_API(url_decode_function)
@@ -636,11 +765,11 @@
 		switch_url_decode(data);
 		reply = data;
 	}
-	
+
 	stream->write_function(stream, "%s", reply);
 
 	switch_safe_free(data);
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 SWITCH_STANDARD_API(echo_function)
@@ -652,7 +781,7 @@
 SWITCH_STANDARD_API(stun_function)
 {
 	char *stun_ip = NULL;
-	switch_port_t stun_port = (switch_port_t)SWITCH_STUN_DEFAULT_PORT;
+	switch_port_t stun_port = (switch_port_t) SWITCH_STUN_DEFAULT_PORT;
 	char *p;
 	char ip_buf[256] = "";
 	char *ip = NULL;
@@ -719,7 +848,7 @@
 	const char *p;
 	switch_core_session_t *xsession;
 	char uuid[80] = "";
-	
+
 	if (zstr(cmd)) {
 		stream->write_function(stream, "-ERR, no input\n");
 		return SWITCH_STATUS_SUCCESS;
@@ -734,7 +863,7 @@
 			switch_copy_string(uuid, p, mycmd - p);
 		}
 	}
-	
+
 	if (zstr(mycmd)) {
 		stream->write_function(stream, "-ERR, no input\n");
 		return SWITCH_STATUS_SUCCESS;
@@ -767,7 +896,59 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+SWITCH_STANDARD_API(console_complete_function)
+{
+	const char *p, *cursor = NULL;
+	int c;
 
+	if (zstr(cmd)) {
+		cmd = " ";
+	}
+
+	if ((p = strstr(cmd, "c="))) {
+		p += 2;
+		c = atoi(p);
+		if ((p = strchr(p, ';'))) {
+			cmd = p + 1;
+			cursor = cmd + c;
+		}
+	}
+
+	switch_console_complete(cmd, cursor, NULL, stream, NULL);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_STANDARD_API(console_complete_xml_function)
+{
+	const char *p, *cursor = NULL;
+	int c;
+	switch_xml_t xml = switch_xml_new("complete");
+	char *sxml;
+
+	if (zstr(cmd)) {
+		cmd = " ";
+	}
+
+	if ((p = strstr(cmd, "c="))) {
+		p += 2;
+		c = atoi(p);
+		if ((p = strchr(p, ';'))) {
+			cmd = p + 1;
+			cursor = cmd + c;
+		}
+	}
+
+	switch_console_complete(cmd, cursor, NULL, NULL, xml);
+
+	sxml = switch_xml_toxml(xml, SWITCH_TRUE);
+	stream->write_function(stream, "%s", sxml);
+	free(sxml);
+
+	switch_xml_free(xml);
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
 SWITCH_STANDARD_API(eval_function)
 {
 	char *expanded;
@@ -779,20 +960,20 @@
 		stream->write_function(stream, "%s", "");
 		return SWITCH_STATUS_SUCCESS;
 	}
-	
+
 	if (!strncasecmp(cmd, "uuid:", 5)) {
 		p = cmd + 5;
 		if ((input = strchr(p, ' ')) && *input++) {
 			switch_copy_string(uuid, p, input - p);
 		}
 	}
-	
+
 	if (zstr(input)) {
 		stream->write_function(stream, "%s", "");
 		return SWITCH_STATUS_SUCCESS;
 	}
 
-	
+
 	switch_event_create(&event, SWITCH_EVENT_CHANNEL_DATA);
 	if (*uuid) {
 		if ((session = switch_core_session_locate(uuid))) {
@@ -802,14 +983,14 @@
 	}
 
 	expanded = switch_event_expand_headers(event, input);
-	
+
 	stream->write_function(stream, "%s", expanded);
 
 	if (expanded != input) {
 		free(expanded);
 	}
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 SWITCH_STANDARD_API(module_exists_function)
@@ -819,25 +1000,25 @@
 			stream->write_function(stream, "true");
 		} else {
 			stream->write_function(stream, "false");
-		}		
+		}
 	}
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 SWITCH_STANDARD_API(domain_exists_function)
 {
 	switch_xml_t root = NULL, domain = NULL;
-	
-	if (!zstr(cmd)) {	
+
+	if (!zstr(cmd)) {
 		if (switch_xml_locate_domain(cmd, NULL, &root, &domain) == SWITCH_STATUS_SUCCESS) {
 			stream->write_function(stream, "true");
-			switch_xml_free(root); 
+			switch_xml_free(root);
 		} else {
 			stream->write_function(stream, "false");
 		}
 	}
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -845,7 +1026,7 @@
 {
 	char *reply = "";
 	char *data = NULL;
-	int len = 0 ;
+	int len = 0;
 
 	if (!zstr(cmd)) {
 		len = (strlen(cmd) * 3) + 1;
@@ -857,7 +1038,7 @@
 	stream->write_function(stream, "%s", reply);
 
 	switch_safe_free(data);
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 
 }
 
@@ -1031,7 +1212,7 @@
 
 	mydata = strdup(cmd);
 	switch_assert(mydata);
-	
+
 	d = mydata;
 
 	if (*d == 'm' && *(d + 1) == ':' && *(d + 2)) {
@@ -1048,8 +1229,8 @@
 			break;
 		}
 	}
-	
 
+
 	argc = switch_separate_string(d, delim, argv, (sizeof(argv) / sizeof(argv[0])));
 
 	if (argc < 2) {
@@ -1278,7 +1459,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-#define CTL_SYNTAX "[send_sighup|hupall|pause|resume|shutdown [cancel|elegant|asap|restart]|sps|sync_clock|reclaim_mem|max_sessions|min_dtmf_duration [num]|max_dtmf_duration [num]|default_dtmf_duration [num]|loglevel [level]|debug_level [level]]"
+#define CTL_SYNTAX "[send_sighup|hupall|pause|resume|shutdown [cancel|elegant|asap|now|restart]|sps|sync_clock|reclaim_mem|max_sessions|min_dtmf_duration [num]|max_dtmf_duration [num]|default_dtmf_duration [num]|loglevel [level]|debug_level [level]]"
 SWITCH_STANDARD_API(ctl_function)
 {
 	int argc;
@@ -1297,6 +1478,9 @@
 			arg = 1;
 			switch_core_session_ctl(SCSC_HUPALL, &arg);
 			stream->write_function(stream, "+OK\n");
+		} else if (!strcasecmp(argv[0], "flush_db_handles")) {
+			switch_core_session_ctl(SCSC_FLUSH_DB_HANDLES, NULL);
+			stream->write_function(stream, "+OK\n");
 		} else if (!strcasecmp(argv[0], "pause")) {
 			arg = 1;
 			switch_core_session_ctl(SCSC_PAUSE_INBOUND, &arg);
@@ -1309,6 +1493,15 @@
 			arg = 0;
 			switch_core_session_ctl(SCSC_PAUSE_INBOUND, &arg);
 			stream->write_function(stream, "+OK\n");
+		} else if (!strcasecmp(argv[0], "calibrate_clock")) {
+			switch_core_session_ctl(SCSC_CALIBRATE_CLOCK, NULL);
+			stream->write_function(stream, "+OK\n");
+		} else if (!strcasecmp(argv[0], "crash")) {
+			switch_core_session_ctl(SCSC_CRASH, NULL);
+			stream->write_function(stream, "+OK\n");
+		} else if (!strcasecmp(argv[0], "save_history")) {
+			switch_core_session_ctl(SCSC_SAVE_HISTORY, NULL);
+			stream->write_function(stream, "+OK\n");
 		} else if (!strcasecmp(argv[0], "shutdown")) {
 			switch_session_ctl_t command = SCSC_SHUTDOWN;
 			int x = 0;
@@ -1321,6 +1514,8 @@
 						break;
 					} else if (!strcasecmp(argv[x], "elegant")) {
 						command = SCSC_SHUTDOWN_ELEGANT;
+					} else if (!strcasecmp(argv[x], "now")) {
+						command = SCSC_SHUTDOWN_NOW;
 					} else if (!strcasecmp(argv[x], "asap")) {
 						command = SCSC_SHUTDOWN_ASAP;
 					} else if (!strcasecmp(argv[x], "restart")) {
@@ -1449,10 +1644,10 @@
 
 	if (*p == '-') {
 		p++;
-		while(p && *p) {
+		while (p && *p) {
 			switch (*p) {
 			case ' ':
-				cmd = p+1;
+				cmd = p + 1;
 				goto end;
 			case 'f':
 				force = SWITCH_TRUE;
@@ -1463,7 +1658,7 @@
 			p++;
 		}
 	}
- end:
+  end:
 
 	if (zstr(cmd)) {
 		stream->write_function(stream, "-USAGE: %s\n", UNLOAD_SYNTAX);
@@ -1492,10 +1687,10 @@
 
 	if (*p == '-') {
 		p++;
-		while(p && *p) {
+		while (p && *p) {
 			switch (*p) {
 			case ' ':
-				cmd = p+1;
+				cmd = p + 1;
 				goto end;
 			case 'f':
 				force = SWITCH_TRUE;
@@ -1506,7 +1701,7 @@
 			p++;
 		}
 	}
- end:
+  end:
 
 	if (zstr(cmd)) {
 		stream->write_function(stream, "-USAGE: %s\n", UNLOAD_SYNTAX);
@@ -1563,9 +1758,9 @@
 		stream->write_function(stream, "-ERR No Such Channel!\n");
 	} else {
 		switch_channel_t *channel = switch_core_session_get_channel(ksession);
-		if (!zstr(kcause)){
+		if (!zstr(kcause)) {
 			cause = switch_channel_str2cause(kcause);
-		}  
+		}
 		switch_channel_hangup(channel, cause);
 		switch_core_session_rwunlock(ksession);
 		stream->write_function(stream, "+OK\n");
@@ -1596,16 +1791,16 @@
 		stream->write_function(stream, "-ERR No Such Channel!\n");
 		goto done;
 	} else {
-		switch_ivr_preprocess_session(ksession, (char *)argv[1]);
+		switch_ivr_preprocess_session(ksession, (char *) argv[1]);
 		switch_core_session_rwunlock(ksession);
 		stream->write_function(stream, "+OK\n");
 		goto done;
 	}
 
- usage:
+  usage:
 	stream->write_function(stream, "-USAGE: %s\n", PREPROCESS_SYNTAX);
 
- done:
+  done:
 	switch_safe_free(mycmd);
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -2105,28 +2300,22 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-#define WARNING_SYNTAX "<uuid> <warning>"
-SWITCH_STANDARD_API(uuid_warning_function)
+#define SIMPLIFY_SYNTAX "<uuid>"
+SWITCH_STANDARD_API(uuid_simplify_function)
 {
-	char *mycmd = NULL, *argv[2] = { 0 };
-	int argc = 0;
-	switch_status_t status = SWITCH_STATUS_FALSE;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
-	if (!zstr(cmd) && (mycmd = strdup(cmd))) {
-		argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
-	}
-
-	if (zstr(cmd) || argc < 2 || zstr(argv[0]) || zstr(argv[1])) {
-		stream->write_function(stream, "-USAGE: %s\n", WARNING_SYNTAX);
+	if (zstr(cmd)) {
+		stream->write_function(stream, "-USAGE: %s\n", SIMPLIFY_SYNTAX);
 	} else {
 		switch_core_session_message_t msg = { 0 };
 		switch_core_session_t *lsession = NULL;
 
-		msg.message_id = SWITCH_MESSAGE_INDICATE_WARNING;
-		msg.string_arg = argv[1];
+		msg.message_id = SWITCH_MESSAGE_INDICATE_SIMPLIFY;
+		msg.string_arg = cmd;
 		msg.from = __FILE__;
 
-		if ((lsession = switch_core_session_locate(argv[0]))) {
+		if ((lsession = switch_core_session_locate(cmd))) {
 			status = switch_core_session_receive_message(lsession, &msg);
 			switch_core_session_rwunlock(lsession);
 		}
@@ -2138,7 +2327,6 @@
 		stream->write_function(stream, "-ERR Operation Failed\n");
 	}
 
-	switch_safe_free(mycmd);
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -2160,7 +2348,7 @@
 	} else {
 		switch_core_session_message_t msg = { 0 };
 		switch_core_session_t *lsession = NULL;
-		
+
 		msg.message_id = SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO;
 		msg.string_array_arg[0] = argv[1];
 		msg.string_array_arg[1] = argv[2];
@@ -2177,9 +2365,9 @@
 	} else {
 		stream->write_function(stream, "-ERR Operation Failed\n");
 	}
-	
- done:
 
+  done:
+
 	switch_safe_free(mycmd);
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -2257,8 +2445,8 @@
 	}
 
 	if (!strcasecmp(action, "start")) {
-		if (switch_ivr_record_session(rsession, path, limit, NULL)!= SWITCH_STATUS_SUCCESS) {
-			stream->write_function(stream, "-ERR Cannot record session!\n"); 
+		if (switch_ivr_record_session(rsession, path, limit, NULL) != SWITCH_STATUS_SUCCESS) {
+			stream->write_function(stream, "-ERR Cannot record session!\n");
 		} else {
 			stream->write_function(stream, "+OK Success\n");
 		}
@@ -2329,7 +2517,7 @@
 		if (switch_ivr_stop_displace_session(rsession, path) != SWITCH_STATUS_SUCCESS) {
 			stream->write_function(stream, "-ERR Cannot stop displace session!\n");
 		} else {
-			stream->write_function(stream, "+OK Success\n"); 
+			stream->write_function(stream, "+OK Success\n");
 		}
 	} else {
 		goto usage;
@@ -2349,6 +2537,72 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+
+#define AUDIO_SYNTAX "<uuid> [start [read|write] [mute|level <level>]|stop]"
+SWITCH_STANDARD_API(session_audio_function)
+{
+	switch_core_session_t *u_session = NULL;
+	char *mycmd = NULL;
+	int fail = 0;
+	int argc = 0;
+	char *argv[5] = { 0 };
+	int level;
+
+	if (zstr(cmd)) {
+		fail++;
+		goto done;
+	}
+
+	mycmd = strdup(cmd);
+	argc = switch_split(mycmd, ' ', argv);
+
+	if (argc < 2) {
+		fail++;
+		goto done;
+	}
+
+	if (!(u_session = switch_core_session_locate(argv[0]))) {
+		stream->write_function(stream, "-ERR No Such Channel!\n");
+		goto done;
+	}
+
+	if (!strcasecmp(argv[1], "stop")) {
+		switch_ivr_stop_session_audio(u_session);
+		goto done;
+	}
+
+	if (strcasecmp(argv[1], "start") || argc < 5 || (strcasecmp(argv[2], "read") && strcasecmp(argv[2], "write"))) {
+		fail++;
+		goto done;
+	}
+
+	level = atoi(argv[4]);
+
+	if (!strcasecmp(argv[3], "mute")) {
+		switch_ivr_session_audio(u_session, "mute", argv[2], level);
+	} else if (!strcasecmp(argv[3], "level")) {
+		switch_ivr_session_audio(u_session, "level", argv[2], level);
+	} else {
+		fail++;
+	}
+
+  done:
+
+	if (u_session) {
+		switch_core_session_rwunlock(u_session);
+	}
+
+	switch_safe_free(mycmd);
+
+	if (fail) {
+		stream->write_function(stream, "-USAGE: %s\n", AUDIO_SYNTAX);
+	} else {
+		stream->write_function(stream, "+OK\n");
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
 #define BREAK_SYNTAX "<uuid> [all]"
 SWITCH_STANDARD_API(break_function)
 {
@@ -2385,7 +2639,7 @@
 		switch_channel_set_flag(channel, CF_BREAK);
 	}
 
- done:
+  done:
 	if (psession) {
 		switch_core_session_rwunlock(psession);
 	}
@@ -2500,7 +2754,6 @@
 	}
 
 	caller_channel = switch_core_session_get_channel(caller_session);
-	switch_channel_clear_state_handler(caller_channel, NULL);
 
 	if (*exten == '&' && *(exten + 1)) {
 		switch_caller_extension_t *extension = NULL;
@@ -2644,7 +2897,7 @@
 SWITCH_STANDARD_API(unsched_api_function)
 {
 	uint32_t id;
-	
+
 	if (!cmd) {
 		stream->write_function(stream, "-ERR Invalid syntax. USAGE: %s\n", UNSCHED_SYNTAX);
 		return SWITCH_STATUS_SUCCESS;
@@ -2704,7 +2957,7 @@
 		}
 	}
 
- bad:
+  bad:
 
 	stream->write_function(stream, "-ERR Invalid syntax. USAGE: %s\n", SCHED_SYNTAX);
 
@@ -2834,12 +3087,12 @@
 			return -1;
 		}
 	}
-	
+
 	if (holder->justcount) {
-	    holder->count++;
-	    return 0;
+		holder->count++;
+		return 0;
 	}
-		
+
 	if (!(row = switch_xml_add_child_d(holder->xml, "row", holder->rows++))) {
 		return -1;
 	}
@@ -2872,12 +3125,12 @@
 {
 	struct holder *holder = (struct holder *) pArg;
 	int x;
-	
+
 	if (holder->justcount) {
-	    holder->count++;
-	    return 0;
+		holder->count++;
+		return 0;
 	}
-	
+
 	if (holder->print_title && holder->count == 0) {
 		if (holder->http) {
 			holder->stream->write_function(holder->stream, "\n<tr>");
@@ -2949,7 +3202,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-#define SHOW_SYNTAX "codec|endpoint|application|api|dialplan|file|timer|calls [count]|channels [count]|distinct_channels|aliases|complete|chat|endpoint|management|modules|nat_map|say|interfaces|interface_types"
+#define SHOW_SYNTAX "codec|endpoint|application|api|dialplan|file|timer|calls [count]|channels [count|like <match string>]|distinct_channels|aliases|complete|chat|management|modules|nat_map|say|interfaces|interface_types|tasks"
 SWITCH_STANDARD_API(show_function)
 {
 	char sql[1024];
@@ -2964,22 +3217,22 @@
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
 	switch_core_db_handle(&db);
-	
+
 	holder.justcount = 0;
-	
+
 	if (cmd && (mydata = strdup(cmd))) {
 		argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
 		command = argv[0];
 		if (argv[2] && !strcasecmp(argv[1], "as")) {
 			as = argv[2];
 		}
-		
+
 	}
 
 	if (stream->param_event) {
 		const char *var;
 		holder.http = switch_event_get_header(stream->param_event, "http-host");
-		
+
 		if ((var = switch_event_get_header(stream->param_event, "content-type"))) {
 			if (!strcasecmp(var, "text/plain")) {
 				holder.http = NULL;
@@ -3002,43 +3255,43 @@
 	if (!command) {
 		stream->write_function(stream, "-USAGE: %s\n", SHOW_SYNTAX);
 		goto end;
-	} else if (!strncasecmp(command, "codec", 5) || 
-			   !strncasecmp(command, "dialplan", 8) || 
-			   !strncasecmp(command, "file", 4) || 
-			   !strncasecmp(command, "timer", 5) || 
-			   !strncasecmp(command, "chat", 4) || 
-			   !strncasecmp(command, "say", 3) || 
-			   !strncasecmp(command, "management", 10) || 
-			   !strncasecmp(command, "endpoint", 8)) {
+	} else if (!strncasecmp(command, "codec", 5) ||
+			   !strncasecmp(command, "dialplan", 8) ||
+			   !strncasecmp(command, "file", 4) ||
+			   !strncasecmp(command, "timer", 5) ||
+			   !strncasecmp(command, "chat", 4) ||
+			   !strncasecmp(command, "say", 3) || !strncasecmp(command, "management", 10) || !strncasecmp(command, "endpoint", 8)) {
 		if (end_of(command) == 's') {
 			end_of(command) = '\0';
 		}
-		sprintf(sql, "select type, name, key from interfaces where type = '%s' order by type,name", command);
+		sprintf(sql, "select type, name, ikey from interfaces where type = '%s' order by type,name", command);
 	} else if (!strncasecmp(command, "module", 6)) {
 		if (argv[1]) {
-			sprintf(sql, "select distinct type, name, key, filename from interfaces where key = '%s' order by type,name", argv[1]);
+			sprintf(sql, "select distinct type, name, ikey, filename from interfaces where ikey = '%s' order by type,name", argv[1]);
 		} else {
-			sprintf(sql, "select distinct type, name, key, filename from interfaces order by type,name");
+			sprintf(sql, "select distinct type, name, ikey, filename from interfaces order by type,name");
 		}
 	} else if (!strcasecmp(command, "interfaces")) {
-		sprintf(sql, "select type, name, key from interfaces order by type,name");
+		sprintf(sql, "select type, name, ikey from interfaces order by type,name");
 	} else if (!strcasecmp(command, "interface_types")) {
 		sprintf(sql, "select type,count(type) as total from interfaces group by type order by type");
 	} else if (!strcasecmp(command, "tasks")) {
 		sprintf(sql, "select * from %s", command);
 	} else if (!strcasecmp(command, "application") || !strcasecmp(command, "api")) {
 		if (argv[1] && strcasecmp(argv[1], "as")) {
-			sprintf(sql, "select name, description, syntax, key from interfaces where type = '%s' and description != '' and name = '%s' order by type,name", command, argv[1]);
+			sprintf(sql,
+					"select name, description, syntax, ikey from interfaces where type = '%s' and description != '' and name = '%s' order by type,name",
+					command, argv[1]);
 		} else {
-			sprintf(sql, "select name, description, syntax, key from interfaces where type = '%s' and description != '' order by type,name", command);
+			sprintf(sql, "select name, description, syntax, ikey from interfaces where type = '%s' and description != '' order by type,name", command);
 		}
 	} else if (!strcasecmp(command, "calls")) {
 		sprintf(sql, "select * from calls order by call_created_epoch");
-		if (argv[1] && !strcasecmp(argv[1],"count")) {
-		    holder.justcount = 1;
-		    if (argv[3] && !strcasecmp(argv[2], "as")) {
-			as = argv[3];
-		    }
+		if (argv[1] && !strcasecmp(argv[1], "count")) {
+			holder.justcount = 1;
+			if (argv[3] && !strcasecmp(argv[2], "as")) {
+				as = argv[3];
+			}
 		}
 	} else if (!strcasecmp(command, "channels") && argv[1] && !strcasecmp(argv[1], "like")) {
 		if (argv[2]) {
@@ -3049,27 +3302,29 @@
 				}
 			}
 			if (strchr(argv[2], '%')) {
-				sprintf(sql, "select * from channels where uuid like '%s' or name like '%s' or cid_name like '%s' or cid_num like '%s' order by created_epoch",
+				sprintf(sql,
+						"select * from channels where uuid like '%s' or name like '%s' or cid_name like '%s' or cid_num like '%s' order by created_epoch",
 						argv[2], argv[2], argv[2], argv[2]);
 			} else {
-				sprintf(sql, "select * from channels where uuid like '%%%s%%' or name like '%%%s%%' or cid_name like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch",
+				sprintf(sql,
+						"select * from channels where uuid like '%%%s%%' or name like '%%%s%%' or cid_name like '%%%s%%' or cid_num like '%%%s%%' order by created_epoch",
 						argv[2], argv[2], argv[2], argv[2]);
 
 			}
-					
-		    if (argv[4] && !strcasecmp(argv[3], "as")) {
+
+			if (argv[4] && !strcasecmp(argv[3], "as")) {
 				as = argv[4];
-		    }
+			}
 		} else {
 			sprintf(sql, "select * from channels order by created_epoch");
 		}
 	} else if (!strcasecmp(command, "channels")) {
 		sprintf(sql, "select * from channels order by created_epoch");
-		if (argv[1] && !strcasecmp(argv[1],"count")) {
-		    holder.justcount = 1;
-		    if (argv[3] && !strcasecmp(argv[2], "as")) {
+		if (argv[1] && !strcasecmp(argv[1], "count")) {
+			holder.justcount = 1;
+			if (argv[3] && !strcasecmp(argv[2], "as")) {
 				as = argv[3];
-		    }
+			}
 		}
 	} else if (!strcasecmp(command, "distinct_channels")) {
 		sprintf(sql, "select * from channels left join calls on "
@@ -3088,23 +3343,18 @@
 		holder.print_title = 0;
 		if ((cmdname = strchr(command, ' ')) && strcasecmp(cmdname, "as")) {
 			*cmdname++ = '\0';
-			switch_snprintf(sql, sizeof(sql) - 1, "select name, syntax, description, key from interfaces where type = 'api' and name = '%s' order by name",
-							cmdname);
+			switch_snprintf(sql, sizeof(sql) - 1,
+							"select name, syntax, description, ikey from interfaces where type = 'api' and name = '%s' order by name", cmdname);
 		} else {
-			switch_snprintf(sql, sizeof(sql) - 1, "select name, syntax, description, key from interfaces where type = 'api' order by name");
+			switch_snprintf(sql, sizeof(sql) - 1, "select name, syntax, description, ikey from interfaces where type = 'api' order by name");
 		}
 	} else if (!strcasecmp(command, "nat_map")) {
-			switch_snprintf(sql, sizeof(sql) - 1, 
-				"SELECT port, "
-				"  CASE proto "
-				"	WHEN 0 THEN 'udp' "
-				"	WHEN 1 THEN 'tcp' "
-				"	ELSE 'unknown' "
-				"  END AS proto, "
-				"  proto AS proto_num, "
-				"  sticky "
-				" FROM nat ORDER BY port, proto"
-			);
+		switch_snprintf(sql, sizeof(sql) - 1,
+						"SELECT port, "
+						"  CASE proto "
+						"	WHEN 0 THEN 'udp' "
+						"	WHEN 1 THEN 'tcp' "
+						"	ELSE 'unknown' " "  END AS proto, " "  proto AS proto_num, " "  sticky " " FROM nat ORDER BY port, proto");
 	} else {
 		stream->write_function(stream, "-USAGE: %s\n", SHOW_SYNTAX);
 		goto end;
@@ -3123,7 +3373,7 @@
 	}
 
 	/* switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "SQL: %s.\n", sql); */
-	
+
 	if (!strcasecmp(as, "delim") || !strcasecmp(as, "csv")) {
 		if (zstr(holder.delim)) {
 			if (!(holder.delim = argv[3])) {
@@ -3176,7 +3426,7 @@
 		holder.stream->write_function(holder.stream, "-ERR Cannot find format %s\n", as);
 	}
 
- end:
+  end:
 
 	switch_safe_free(mydata);
 
@@ -3187,15 +3437,6 @@
 	return status;
 }
 
-SWITCH_STANDARD_API(version_function)
-{
-	char version_string[1024];
-	switch_snprintf(version_string, sizeof(version_string) - 1, "FreeSWITCH Version %s\n", SWITCH_VERSION_FULL);
-
-	stream->write_function(stream, version_string);
-	return SWITCH_STATUS_SUCCESS;
-}
-
 SWITCH_STANDARD_API(help_function)
 {
 	char showcmd[1024];
@@ -3234,12 +3475,12 @@
 	if (argc < 2 || !argv[0]) {
 		goto error;
 	}
-	
+
 	if (!(l_session = switch_core_session_locate(argv[0]))) {
 		stream->write_function(stream, "-ERR Usage: cannot locate session.\n");
 		return SWITCH_STATUS_SUCCESS;
 	}
-	
+
 	if (!strcasecmp(argv[1], "sched")) {
 		x = 2;
 		sched++;
@@ -3255,7 +3496,7 @@
 	} else if (!switch_true(argv[x])) {
 		seconds = 0;
 	}
-	
+
 	if (seconds) {
 		if (sched) {
 			switch_core_session_sched_heartbeat(l_session, seconds);
@@ -3266,14 +3507,14 @@
 	} else {
 		switch_core_session_disable_heartbeat(l_session);
 	}
-	
+
 	switch_core_session_rwunlock(l_session);
-	
-	switch_safe_free(mycmd);	
+
+	switch_safe_free(mycmd);
 	stream->write_function(stream, "+OK\n");
 	return SWITCH_STATUS_SUCCESS;
-	
- error:
+
+  error:
 	switch_safe_free(mycmd);
 	stream->write_function(stream, "-ERR Usage: uuid_session_heartbeat %s", HEARTBEAT_SYNTAX);
 	return SWITCH_STATUS_SUCCESS;
@@ -3309,7 +3550,7 @@
 			char *var_value = NULL;
 
 			if (argc == 3) {
-				var_value =	argv[2];
+				var_value = argv[2];
 			}
 
 			if ((psession = switch_core_session_locate(uuid))) {
@@ -3358,10 +3599,10 @@
 
 		if ((psession = switch_core_session_locate(uuid))) {
 			switch_channel_t *channel = switch_core_session_get_channel(psession);
-			int x, y = 0;		
+			int x, y = 0;
 			argc = switch_separate_string(vars, ';', argv, (sizeof(argv) / sizeof(argv[0])));
 
-			for (x = 0 ; x < argc; x++) {
+			for (x = 0; x < argc; x++) {
 				var_name = argv[x];
 				if (var_name && (var_value = strchr(var_name, '='))) {
 					*var_value++ = '\0';
@@ -3374,7 +3615,7 @@
 					y++;
 				}
 			}
-			
+
 			switch_core_session_rwunlock(psession);
 			if (y) {
 				stream->write_function(stream, "+OK\n");
@@ -3384,7 +3625,7 @@
 			stream->write_function(stream, "-ERR No Such Channel!\n");
 		}
 	}
-	
+
 	stream->write_function(stream, "-USAGE: %s\n", SETVAR_MULTI_SYNTAX);
 
   done:
@@ -3487,10 +3728,10 @@
 	switch_core_session_send_dtmf_string(psession, (const char *) dtmf_data);
 	goto done;
 
-usage:
+  usage:
 	stream->write_function(stream, "-USAGE: %s\n", UUID_SEND_DTMF_SYNTAX);
 
-done:
+  done:
 	if (psession) {
 		switch_core_session_rwunlock(psession);
 	}
@@ -3499,6 +3740,54 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+
+
+#define UUID_RECV_DTMF_SYNTAX "<uuid> <dtmf_data>"
+SWITCH_STANDARD_API(uuid_recv_dtmf_function)
+{
+	switch_core_session_t *psession = NULL;
+	char *mycmd = NULL, *argv[2] = { 0 };
+	char *uuid = NULL, *dtmf_data = NULL;
+	int argc = 0;
+
+	if (zstr(cmd)) {
+		goto usage;
+	}
+
+	if (!(mycmd = strdup(cmd))) {
+		goto usage;
+	}
+
+	if ((argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) {
+		goto usage;
+	}
+
+	uuid = argv[0];
+	dtmf_data = argv[1];
+	if (zstr(uuid) || zstr(dtmf_data)) {
+		goto usage;
+	}
+
+	if (!(psession = switch_core_session_locate(uuid))) {
+		stream->write_function(stream, "-ERR Cannot locate session!\n");
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	switch_channel_queue_dtmf_string(switch_core_session_get_channel(psession), dtmf_data);
+	goto done;
+
+  usage:
+	stream->write_function(stream, "-USAGE: %s\n", UUID_RECV_DTMF_SYNTAX);
+
+  done:
+	if (psession) {
+		switch_core_session_rwunlock(psession);
+	}
+
+	switch_safe_free(mycmd);
+	return SWITCH_STATUS_SUCCESS;
+}
+
 #define DUMP_SYNTAX "<uuid> [format]"
 SWITCH_STANDARD_API(uuid_dump_function)
 {
@@ -3606,34 +3895,34 @@
 #define SYSTEM_SYNTAX "<command>"
 SWITCH_STANDARD_API(system_function)
 {
-    if (zstr(cmd)) {
-        stream->write_function(stream, "-USAGE: %s\n", SYSTEM_SYNTAX);
-        return SWITCH_STATUS_SUCCESS;
-    } 
+	if (zstr(cmd)) {
+		stream->write_function(stream, "-USAGE: %s\n", SYSTEM_SYNTAX);
+		return SWITCH_STATUS_SUCCESS;
+	}
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Executing command: %s\n", cmd);
-    if (switch_system(cmd, SWITCH_TRUE) < 0) {
-       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Failed to execute command: %s\n", cmd);
-    }
-    stream->write_function(stream, "+OK\n");
-    return SWITCH_STATUS_SUCCESS;
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Executing command: %s\n", cmd);
+	if (switch_system(cmd, SWITCH_TRUE) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Failed to execute command: %s\n", cmd);
+	}
+	stream->write_function(stream, "+OK\n");
+	return SWITCH_STATUS_SUCCESS;
 }
 
 
 #define SYSTEM_SYNTAX "<command>"
 SWITCH_STANDARD_API(bg_system_function)
 {
-    if (zstr(cmd)) {
-        stream->write_function(stream, "-USAGE: %s\n", SYSTEM_SYNTAX);
-        return SWITCH_STATUS_SUCCESS;
-    } 
+	if (zstr(cmd)) {
+		stream->write_function(stream, "-USAGE: %s\n", SYSTEM_SYNTAX);
+		return SWITCH_STATUS_SUCCESS;
+	}
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Executing command: %s\n", cmd);
-    if (switch_system(cmd, SWITCH_FALSE) < 0) {
-       switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Failed to execute command: %s\n", cmd);
-    }
-    stream->write_function(stream, "+OK\n");
-    return SWITCH_STATUS_SUCCESS;
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Executing command: %s\n", cmd);
+	if (switch_system(cmd, SWITCH_FALSE) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Failed to execute command: %s\n", cmd);
+	}
+	stream->write_function(stream, "+OK\n");
+	return SWITCH_STATUS_SUCCESS;
 }
 
 SWITCH_STANDARD_API(strftime_tz_api_function)
@@ -3649,13 +3938,13 @@
 			*format++ = '\0';
 		}
 	}
-	
-	if (switch_strftime_tz(tz_name, format, date, sizeof(date), 0) == SWITCH_STATUS_SUCCESS) { /* The lookup of the zone may fail. */
+
+	if (switch_strftime_tz(tz_name, format, date, sizeof(date), 0) == SWITCH_STATUS_SUCCESS) {	/* The lookup of the zone may fail. */
 		stream->write_function(stream, "%s", date);
 	} else {
 		stream->write_function(stream, "-ERR Invalid Timezone\n");
 	}
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -3686,17 +3975,80 @@
 	} else {
 		switch_core_session_hupall_matching_var(var, val, cause);
 	}
-	
+
 	if (zstr(var)) {
 		stream->write_function(stream, "+OK hangup all channels with cause %s\n", switch_channel_cause2str(cause));
 	} else {
 		stream->write_function(stream, "+OK hangup all channels matching [%s]=[%s] with cause: %s\n", var, val, switch_channel_cause2str(cause));
 	}
-	
+
 	switch_safe_free(mycmd);
 	return SWITCH_STATUS_SUCCESS;
 }
 
+SWITCH_STANDARD_API(escape_function)
+{
+	int len;
+	char *mycmd;
+
+	if (zstr(cmd)) {
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	len = strlen(cmd) * 2;
+	mycmd = malloc(len);
+
+	stream->write_function(stream, "%s", switch_escape_string(cmd, mycmd, len));
+
+	switch_safe_free(mycmd);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+#define UUID_LOGLEVEL_SYNTAX "<uuid> <level>"
+SWITCH_STANDARD_API(uuid_loglevel)
+{
+	switch_core_session_t *tsession = NULL;
+	char *uuid = NULL, *text = NULL;
+
+	if (!zstr(cmd) && (uuid = strdup(cmd))) {
+		if ((text = strchr(uuid, ' '))) {
+			*text++ = '\0';
+		}
+	}
+
+	if (zstr(uuid) || zstr(text)) {
+		stream->write_function(stream, "-USAGE: %s\n", UUID_LOGLEVEL_SYNTAX);
+	} else {
+		switch_log_level_t level = switch_log_str2level(text);
+
+		if (level == SWITCH_LOG_INVALID) {
+			stream->write_function(stream, "-ERR Invalid log level!\n");
+		} else if ((tsession = switch_core_session_locate(uuid))) {
+
+			switch_core_session_set_loglevel(tsession, level);
+			stream->write_function(stream, "+OK\n");
+			switch_core_session_rwunlock(tsession);
+		} else {
+			stream->write_function(stream, "-ERR No Such Channel %s!\n", uuid);
+		}
+	}
+
+	switch_safe_free(uuid);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+#define SQL_ESCAPE_SYNTAX "<string>"
+SWITCH_STANDARD_API(sql_escape)
+{
+	if (zstr(cmd)) {
+		stream->write_function(stream, "-USAGE: %s\n", SQL_ESCAPE_SYNTAX);
+	} else {
+		stream->write_function(stream, "%q", cmd);
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_commands_shutdown)
 {
 	int x;
@@ -3726,138 +4078,200 @@
 
 	switch_thread_rwlock_create(&bgapi_rwlock, pool);
 
+	SWITCH_ADD_API(commands_api_interface, "acl", "compare an ip to an acl list", acl_function, "<ip> <list_name>");
+	SWITCH_ADD_API(commands_api_interface, "alias", "Alias", alias_function, ALIAS_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "banner", "Returns the system banner", banner_function, "");
+	SWITCH_ADD_API(commands_api_interface, "bgapi", "Execute an api command in a thread", bgapi_function, "<command>[ <arg>]");
+	SWITCH_ADD_API(commands_api_interface, "bg_system", "Execute a system command in the background", bg_system_function, SYSTEM_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "break", "Break", break_function, BREAK_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "complete", "Complete", complete_function, COMPLETE_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "cond", "Eval a conditional", cond_function, "<expr> ? <true val> : <false val>");
+	SWITCH_ADD_API(commands_api_interface, "console_complete", "", console_complete_function, "<line>");
+	SWITCH_ADD_API(commands_api_interface, "console_complete_xml", "", console_complete_xml_function, "<line>");
+	SWITCH_ADD_API(commands_api_interface, "create_uuid", "Create a uuid", uuid_function, UUID_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "db_cache", "db cache management", db_cache_function, "status");
+	SWITCH_ADD_API(commands_api_interface, "domain_exists", "check if a domain exists", domain_exists_function, "<domain>");
+	SWITCH_ADD_API(commands_api_interface, "echo", "echo", echo_function, "<data>");
+	SWITCH_ADD_API(commands_api_interface, "escape", "escape a string", escape_function, "<data>");
+	SWITCH_ADD_API(commands_api_interface, "eval", "eval (noop)", eval_function, "[uuid:<uuid> ]<expression>");
+	SWITCH_ADD_API(commands_api_interface, "expand", "expand vars and execute", expand_function, "[uuid:<uuid> ]<cmd> <args>");
+	SWITCH_ADD_API(commands_api_interface, "find_user_xml", "find a user", find_user_function, "<key> <user> <domain>");
+	SWITCH_ADD_API(commands_api_interface, "fsctl", "control messages", ctl_function, CTL_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "...", "shutdown", shutdown_function, "");
+	SWITCH_ADD_API(commands_api_interface, "shutdown", "shutdown", shutdown_function, "");
+	SWITCH_ADD_API(commands_api_interface, "version", "version", version_function, "");
+	SWITCH_ADD_API(commands_api_interface, "global_getvar", "global_getvar", global_getvar_function, GLOBAL_GETVAR_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "global_setvar", "global_setvar", global_setvar_function, GLOBAL_SETVAR_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "group_call", "Generate a dial string to call a group", group_call_function, "<group>[@<domain>]");
+	SWITCH_ADD_API(commands_api_interface, "help", "Show help for all the api commands", help_function, "");
+	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, "hupall", "hupall", hupall_api_function, "<cause> [<var> <value>]");
 	SWITCH_ADD_API(commands_api_interface, "in_group", "determine if a user is in a group", in_group_function, "<user>[@<domain>] <group_name>");
-
-	SWITCH_ADD_API(commands_api_interface, "uuid_flush_dtmf", "Flush dtmf on a given uuid", uuid_flush_dtmf_function, "<uuid>");
+	SWITCH_ADD_API(commands_api_interface, "is_lan_addr", "see if an ip is a lan addr", lan_addr_function, "<ip>");
+	SWITCH_ADD_API(commands_api_interface, "load", "Load Module", load_function, LOAD_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "md5", "md5", md5_function, "<data>");
-	SWITCH_ADD_API(commands_api_interface, "hupall", "hupall", hupall_api_function, "<cause> [<var> <value>]");
-	SWITCH_ADD_API(commands_api_interface, "strftime_tz", "strftime_tz", strftime_tz_api_function, "<Timezone_name> [format string]");
+	SWITCH_ADD_API(commands_api_interface, "module_exists", "check if module exists", module_exists_function, "<module>");
+	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, "originate", "Originate a Call", originate_function, ORIGINATE_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "tone_detect", "Start Tone Detection on a channel", tone_detect_session_function, TONE_DETECT_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "uuid_kill", "Kill Channel", kill_function, KILL_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "uuid_preprocess", "Pre-process Channel", preprocess_function, PREPROCESS_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "uuid_park", "Park Channel", park_function, PARK_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "pause", "Pause", pause_function, PAUSE_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "regex", "Eval a regex", regex_function, "<data>|<pattern>[|<subst string>]");
 	SWITCH_ADD_API(commands_api_interface, "reloadacl", "Reload ACL", reload_acl_function, "[reloadxml]");
-	switch_console_set_complete("add reloadacl reloadxml");
+	SWITCH_ADD_API(commands_api_interface, "reload", "Reload Module", reload_function, UNLOAD_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "reloadxml", "Reload XML", reload_xml_function, "");
-	SWITCH_ADD_API(commands_api_interface, "unload", "Unload Module", unload_function, UNLOAD_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "reload", "Reload Module", reload_function, UNLOAD_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "load", "Load Module", load_function, LOAD_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "uuid_transfer", "Transfer a session", transfer_function, TRANSFER_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "pause", "Pause", pause_function, PAUSE_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "break", "Break", break_function, BREAK_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "sched_api", "Schedule an api command", sched_api_function, SCHED_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "sched_broadcast", "Schedule a broadcast event to a running call", sched_broadcast_function,
+				   SCHED_BROADCAST_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "sched_del", "Delete a Scheduled task", sched_del_function, "<task_id>|<group_id>");
+	SWITCH_ADD_API(commands_api_interface, "sched_hangup", "Schedule a running call to hangup", sched_hangup_function, SCHED_HANGUP_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "sched_transfer", "Schedule a transfer for a running call", sched_transfer_function, SCHED_TRANSFER_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "show", "Show", show_function, SHOW_SYNTAX);
-	switch_console_set_complete("add show channels");
-	switch_console_set_complete("add show codec");
-	switch_console_set_complete("add show application");
-	switch_console_set_complete("add show api");
-	switch_console_set_complete("add show dialplan");
-	switch_console_set_complete("add show file");
-	switch_console_set_complete("add show timer");
-	switch_console_set_complete("add show calls");
-	switch_console_set_complete("add show channels");
-	switch_console_set_complete("add show aliases");
-	switch_console_set_complete("add show complete");
-	switch_console_set_complete("add show distinct_channels");
-	switch_console_set_complete("add show chat");
-	switch_console_set_complete("add show endpoint");
-	switch_console_set_complete("add show management");
-	switch_console_set_complete("add show modules");
-	switch_console_set_complete("add show nat_map");
-	switch_console_set_complete("add nat_map status");
-	switch_console_set_complete("add nat_map republish");
-	switch_console_set_complete("add nat_map reinit");
-	switch_console_set_complete("add show say");
-	switch_console_set_complete("add show interfaces");
-	switch_console_set_complete("add show interface_types");
-	SWITCH_ADD_API(commands_api_interface, "complete", "Complete", complete_function, COMPLETE_SYNTAX);
-	switch_console_set_complete("add complete add");
-	switch_console_set_complete("add complete del");
-	SWITCH_ADD_API(commands_api_interface, "alias", "Alias", alias_function, ALIAS_SYNTAX);
-	switch_console_set_complete("add alias add");
-	switch_console_set_complete("add alias del");
+	SWITCH_ADD_API(commands_api_interface, "sql_escape", "Escape a string to prevent sql injection", sql_escape, SQL_ESCAPE_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "status", "status", status_function, "");
-	SWITCH_ADD_API(commands_api_interface, "uuid_session_heartbeat", "uuid_session_heartbeat", uuid_session_heartbeat_function, HEARTBEAT_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "strftime_tz", "strftime_tz", strftime_tz_api_function, "<Timezone_name> [format string]");
+	SWITCH_ADD_API(commands_api_interface, "stun", "stun", stun_function, "<stun_server>[:port]");
+	SWITCH_ADD_API(commands_api_interface, "system", "Execute a system command", system_function, SYSTEM_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "time_test", "time_test", time_test_function, "<mss> [count]");
+	SWITCH_ADD_API(commands_api_interface, "timer_test", "timer_test", timer_test_function, TIMER_TEST_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "tone_detect", "Start Tone Detection on a channel", tone_detect_session_function, TONE_DETECT_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "unload", "Unload Module", unload_function, UNLOAD_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "unsched_api", "Unschedule an api command", unsched_api_function, UNSCHED_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "url_decode", "url decode a string", url_decode_function, "<string>");
+	SWITCH_ADD_API(commands_api_interface, "url_encode", "url encode a string", url_encode_function, "<string>");
+	SWITCH_ADD_API(commands_api_interface, "user_data", "find user data", user_data_function, "<user>@<domain> [var|param|attr] <name>");
+	SWITCH_ADD_API(commands_api_interface, "user_exists", "find a user", user_exists_function, "<key> <user> <domain>");
+	SWITCH_ADD_API(commands_api_interface, "uuid_audio", "uuid_audio", session_audio_function, AUDIO_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "uuid_bridge", "uuid_bridge", uuid_bridge_function, "");
-	SWITCH_ADD_API(commands_api_interface, "uuid_setvar", "uuid_setvar", uuid_setvar_function, SETVAR_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "uuid_setvar_multi", "uuid_setvar_multi", uuid_setvar_multi_function, SETVAR_MULTI_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "uuid_broadcast", "broadcast", uuid_broadcast_function, BROADCAST_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "uuid_chat", "Send a chat message", uuid_chat, UUID_CHAT_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "uuid_debug_audio", "debug audio", uuid_debug_audio_function, DEBUG_AUDIO_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "uuid_deflect", "Send a deflect", uuid_deflect, UUID_DEFLECT_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "uuid_displace", "session displace", session_displace_function, "<uuid> [start|stop] <path> [<limit>] [mux]");
+	SWITCH_ADD_API(commands_api_interface, "uuid_display", "change display", uuid_display_function, DISPLAY_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "uuid_dump", "uuid_dump", uuid_dump_function, DUMP_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "uuid_exists", "see if a uuid exists", uuid_exists_function, EXISTS_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "uuid_flush_dtmf", "Flush dtmf on a given uuid", uuid_flush_dtmf_function, "<uuid>");
 	SWITCH_ADD_API(commands_api_interface, "uuid_getvar", "uuid_getvar", uuid_getvar_function, GETVAR_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "uuid_exists", "see if a uuid exists", uuid_exists_function, EXISTS_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "uuid_dump", "uuid_dump", uuid_dump_function, DUMP_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "global_setvar", "global_setvar", global_setvar_function, GLOBAL_SETVAR_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "global_getvar", "global_getvar", global_getvar_function, GLOBAL_GETVAR_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "uuid_displace", "session displace", session_displace_function, "<uuid> [start|stop] <path> [<limit>] [mux]");
-	SWITCH_ADD_API(commands_api_interface, "uuid_record", "session record", session_record_function, SESS_REC_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "uuid_broadcast", "broadcast", uuid_broadcast_function, BROADCAST_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "uuid_hold", "hold", uuid_hold_function, HOLD_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "uuid_display", "change display", uuid_display_function, DISPLAY_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "uuid_warning", "send popup", uuid_warning_function, WARNING_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "uuid_debug_audio", "debug audio", uuid_debug_audio_function, DEBUG_AUDIO_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "uuid_kill", "Kill Channel", kill_function, KILL_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "uuid_loglevel", "set loglevel on session", uuid_loglevel, UUID_LOGLEVEL_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "uuid_media", "media", uuid_media_function, MEDIA_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "fsctl", "control messages", ctl_function, CTL_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "uuid_park", "Park Channel", park_function, PARK_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "uuid_preprocess", "Pre-process Channel", preprocess_function, PREPROCESS_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "uuid_record", "session record", session_record_function, SESS_REC_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "uuid_recv_dtmf", "receive dtmf digits", uuid_recv_dtmf_function, UUID_RECV_DTMF_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "uuid_send_dtmf", "send dtmf digits", uuid_send_dtmf_function, UUID_SEND_DTMF_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "uuid_session_heartbeat", "uuid_session_heartbeat", uuid_session_heartbeat_function, HEARTBEAT_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "uuid_setvar_multi", "uuid_setvar_multi", uuid_setvar_multi_function, SETVAR_MULTI_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "uuid_setvar", "uuid_setvar", uuid_setvar_function, SETVAR_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "uuid_transfer", "Transfer a session", transfer_function, TRANSFER_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "uuid_simplify", "Try to cut out of a call path / attended xfer", uuid_simplify_function, SIMPLIFY_SYNTAX);
+	SWITCH_ADD_API(commands_api_interface, "xml_locate", "find some xml", xml_locate_function, "[root | <section> <tag> <tag_attr_name> <tag_attr_val>]");
+	SWITCH_ADD_API(commands_api_interface, "xml_wrap", "Wrap another api command in xml", xml_wrap_api_function, "<command> <args>");
+	switch_console_set_complete("add alias add");
+	switch_console_set_complete("add alias del");
+	switch_console_set_complete("add complete add");
+	switch_console_set_complete("add complete del");
+	switch_console_set_complete("add db_cache status");
+	switch_console_set_complete("add fsctl debug_level");
+	switch_console_set_complete("add fsctl default_dtmf_duration");
 	switch_console_set_complete("add fsctl hupall");
 	switch_console_set_complete("add fsctl loglevel");
-	switch_console_set_complete("add fsctl debug_level");
+	switch_console_set_complete("add fsctl loglevel console");
+	switch_console_set_complete("add fsctl loglevel alert");
+	switch_console_set_complete("add fsctl loglevel crit");
+	switch_console_set_complete("add fsctl loglevel err");
+	switch_console_set_complete("add fsctl loglevel warning");
+	switch_console_set_complete("add fsctl loglevel notice");
+	switch_console_set_complete("add fsctl loglevel info");
+	switch_console_set_complete("add fsctl loglevel debug");
+	switch_console_set_complete("add fsctl max_dtmf_duration");
+	switch_console_set_complete("add fsctl max_sessions");
+	switch_console_set_complete("add fsctl min_dtmf_duration");
 	switch_console_set_complete("add fsctl pause");
+	switch_console_set_complete("add fsctl reclaim_mem");
 	switch_console_set_complete("add fsctl resume");
 	switch_console_set_complete("add fsctl shutdown");
-	switch_console_set_complete("add fsctl shutdown restart");
+	switch_console_set_complete("add fsctl shutdown asap");
+	switch_console_set_complete("add fsctl shutdown now");
+	switch_console_set_complete("add fsctl shutdown asap restart");
+	switch_console_set_complete("add fsctl shutdown cancel");
 	switch_console_set_complete("add fsctl shutdown elegant");
-	switch_console_set_complete("add fsctl shutdown asap");
 	switch_console_set_complete("add fsctl shutdown elegant restart");
+	switch_console_set_complete("add fsctl shutdown restart");
+	switch_console_set_complete("add fsctl shutdown restart asap");
 	switch_console_set_complete("add fsctl shutdown restart elegant");
-	switch_console_set_complete("add fsctl shutdown asap restart");
-	switch_console_set_complete("add fsctl shutdown restart asap");
-	switch_console_set_complete("add fsctl shutdown cancel");
 	switch_console_set_complete("add fsctl sps");
- 	switch_console_set_complete("add fsctl sync_clock");
-	switch_console_set_complete("add fsctl reclaim_mem");
-	switch_console_set_complete("add fsctl max_sessions");
-	switch_console_set_complete("add fsctl max_dtmf_duration");
-	switch_console_set_complete("add fsctl min_dtmf_duration");
-	switch_console_set_complete("add fsctl default_dtmf_duration");
-	SWITCH_ADD_API(commands_api_interface, "help", "Show help for all the api commands", help_function, "");
-	SWITCH_ADD_API(commands_api_interface, "version", "Show version of the switch", version_function, "");
-	SWITCH_ADD_API(commands_api_interface, "sched_hangup", "Schedule a running call to hangup", sched_hangup_function, SCHED_HANGUP_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "sched_broadcast", "Schedule a broadcast event to a running call", sched_broadcast_function,
-				   SCHED_BROADCAST_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "sched_transfer", "Schedule a transfer for a running call", sched_transfer_function,
-				   SCHED_TRANSFER_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "create_uuid", "Create a uuid", uuid_function, UUID_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "sched_api", "Schedule an api command", sched_api_function, SCHED_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "unsched_api", "Unschedule an api command", unsched_api_function, UNSCHED_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "bgapi", "Execute an api command in a thread", bgapi_function, "<command>[ <arg>]");
-	SWITCH_ADD_API(commands_api_interface, "sched_del", "Delete a Scheduled task", sched_del_function, "<task_id>|<group_id>");
-	SWITCH_ADD_API(commands_api_interface, "xml_wrap", "Wrap another api command in xml", xml_wrap_api_function, "<command> <args>");
-	SWITCH_ADD_API(commands_api_interface, "is_lan_addr", "see if an ip is a lan addr", lan_addr_function, "<ip>");
-	SWITCH_ADD_API(commands_api_interface, "cond", "Eval a conditional", cond_function, "<expr> ? <true val> : <false val>");
-	SWITCH_ADD_API(commands_api_interface, "regex", "Eval a regex", regex_function, "<data>|<pattern>[|<subst string>]");
-	SWITCH_ADD_API(commands_api_interface, "acl", "compare an ip to an acl list", acl_function, "<ip> <list_name>");
-	SWITCH_ADD_API(commands_api_interface, "uuid_chat", "Send a chat message", uuid_chat, UUID_CHAT_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "uuid_deflect", "Send a deflect", uuid_deflect, UUID_DEFLECT_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "find_user_xml", "find a user", find_user_function, "<key> <user> <domain>");
-	SWITCH_ADD_API(commands_api_interface, "user_exists", "find a user", user_exists_function, "<key> <user> <domain>");
-	SWITCH_ADD_API(commands_api_interface, "xml_locate", "find some xml", xml_locate_function, "[root | <section> <tag> <tag_attr_name> <tag_attr_val>]");
-	SWITCH_ADD_API(commands_api_interface, "user_data", "find user data", user_data_function, "<user>@<domain> [var|param|attr] <name>");
-	SWITCH_ADD_API(commands_api_interface, "url_encode", "url encode a string", url_encode_function, "<string>");
-	SWITCH_ADD_API(commands_api_interface, "url_decode", "url decode a string", url_decode_function, "<string>");
-	SWITCH_ADD_API(commands_api_interface, "module_exists", "check if module exists", module_exists_function, "<module>");
-	SWITCH_ADD_API(commands_api_interface, "domain_exists", "check if a domain exists", domain_exists_function, "<domain>");
-	SWITCH_ADD_API(commands_api_interface, "uuid_send_dtmf", "send dtmf digits", uuid_send_dtmf_function, UUID_SEND_DTMF_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "eval", "eval (noop)", eval_function, "[uuid:<uuid> ]<expression>");
-	SWITCH_ADD_API(commands_api_interface, "expand", "expand vars and execute", expand_function, "[uuid:<uuid> ]<cmd> <args>");
-	SWITCH_ADD_API(commands_api_interface, "echo", "echo", echo_function, "<data>");
-	SWITCH_ADD_API(commands_api_interface, "stun", "stun", stun_function, "<stun_server>[:port]");
-	SWITCH_ADD_API(commands_api_interface, "system", "Execute a system command", system_function, SYSTEM_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "bg_system", "Execute a system command in the background", bg_system_function, SYSTEM_SYNTAX);
-	SWITCH_ADD_API(commands_api_interface, "time_test", "time_test", time_test_function, "<mss>");
-	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");
+	switch_console_set_complete("add fsctl sync_clock");
+	switch_console_set_complete("add fsctl flush_db_handles");
+	switch_console_set_complete("add nat_map reinit");
+	switch_console_set_complete("add nat_map republish");
+	switch_console_set_complete("add nat_map status");
+	switch_console_set_complete("add reloadacl reloadxml");
+	switch_console_set_complete("add show aliases");
+	switch_console_set_complete("add show api");
+	switch_console_set_complete("add show application");
+	switch_console_set_complete("add show calls");
+	switch_console_set_complete("add show channels");
+	switch_console_set_complete("add show channels");
+	switch_console_set_complete("add show chat");
+	switch_console_set_complete("add show codec");
+	switch_console_set_complete("add show complete");
+	switch_console_set_complete("add show dialplan");
+	switch_console_set_complete("add show distinct_channels");
+	switch_console_set_complete("add show endpoint");
+	switch_console_set_complete("add show file");
+	switch_console_set_complete("add show interfaces");
+	switch_console_set_complete("add show interface_types");
+	switch_console_set_complete("add show tasks");
+	switch_console_set_complete("add show management");
+	switch_console_set_complete("add show modules");
+	switch_console_set_complete("add show nat_map");
+	switch_console_set_complete("add show say");
+	switch_console_set_complete("add show timer");
+	switch_console_set_complete("add shutdown");
+	switch_console_set_complete("add sql_escape");
+	switch_console_set_complete("add uuid_audio ::console::list_uuid start read mute");
+	switch_console_set_complete("add uuid_audio ::console::list_uuid start read level");
+	switch_console_set_complete("add uuid_audio ::console::list_uuid start write mute");
+	switch_console_set_complete("add uuid_audio ::console::list_uuid start write level");
+	switch_console_set_complete("add uuid_audio ::console::list_uuid stop");
+	switch_console_set_complete("add uuid_bridge ::console::list_uuid ::console::list_uuid");
+	switch_console_set_complete("add uuid_broadcast ::console::list_uuid");
+	switch_console_set_complete("add uuid_chat ::console::list_uuid");
+	switch_console_set_complete("add uuid_debug_audio ::console::list_uuid");
+	switch_console_set_complete("add uuid_deflect ::console::list_uuid");
+	switch_console_set_complete("add uuid_displace ::console::list_uuid");
+	switch_console_set_complete("add uuid_display ::console::list_uuid");
+	switch_console_set_complete("add uuid_dump ::console::list_uuid");
+	switch_console_set_complete("add uuid_exists ::console::list_uuid");
+	switch_console_set_complete("add uuid_flush_dtmf ::console::list_uuid");
+	switch_console_set_complete("add uuid_getvar ::console::list_uuid");
+	switch_console_set_complete("add uuid_hold ::console::list_uuid");
+	switch_console_set_complete("add uuid_kill ::console::list_uuid");
+	switch_console_set_complete("add uuid_loglevel ::console::list_uuid console");
+	switch_console_set_complete("add uuid_loglevel ::console::list_uuid alert");
+	switch_console_set_complete("add uuid_loglevel ::console::list_uuid crit");
+	switch_console_set_complete("add uuid_loglevel ::console::list_uuid err");
+	switch_console_set_complete("add uuid_loglevel ::console::list_uuid warning");
+	switch_console_set_complete("add uuid_loglevel ::console::list_uuid notice");
+	switch_console_set_complete("add uuid_loglevel ::console::list_uuid info");
+	switch_console_set_complete("add uuid_loglevel ::console::list_uuid debug");
+	switch_console_set_complete("add uuid_media ::console::list_uuid");
+	switch_console_set_complete("add uuid_park ::console::list_uuid");
+	switch_console_set_complete("add uuid_preprocess ::console::list_uuid");
+	switch_console_set_complete("add uuid_record ::console::list_uuid");
+	switch_console_set_complete("add uuid_recv_dtmf ::console::list_uuid");
+	switch_console_set_complete("add uuid_send_dtmf ::console::list_uuid");
+	switch_console_set_complete("add uuid_session_heartbeat ::console::list_uuid");
+	switch_console_set_complete("add uuid_setvar_multi ::console::list_uuid");
+	switch_console_set_complete("add uuid_setvar ::console::list_uuid");
+	switch_console_set_complete("add uuid_transfer ::console::list_uuid");
+	switch_console_set_complete("add version");
+	switch_console_set_complete("add uuid_warning ::console::list_uuid");
+	switch_console_set_complete("add ...");
 
+
 	/* 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_conference/mod_conference.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_conference/mod_conference.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_conference/mod_conference.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -42,7 +42,7 @@
 
 static const char global_app_name[] = "conference";
 static char *global_cf_name = "conference.conf";
-static char *cf_pin_url_param_name ="X-ConfPin=";
+static char *cf_pin_url_param_name = "X-ConfPin=";
 static char *api_syntax;
 static int EC = 0;
 
@@ -94,6 +94,8 @@
 
 typedef enum {
 	CALLER_CONTROL_MUTE,
+	CALLER_CONTROL_MUTE_ON,
+	CALLER_CONTROL_MUTE_OFF,
 	CALLER_CONTROL_DEAF_MUTE,
 	CALLER_CONTROL_ENERGY_UP,
 	CALLER_CONTROL_ENERGY_EQU_CONF,
@@ -173,7 +175,8 @@
 	CFLAG_ANSWERED = (1 << 5),
 	CFLAG_BRIDGE_TO = (1 << 6),
 	CFLAG_WAIT_MOD = (1 << 7),
-	CFLAG_VID_FLOOR = (1 << 8)
+	CFLAG_VID_FLOOR = (1 << 8),
+	CFLAG_WASTE_BANDWIDTH = (1 << 9)
 } conf_flag_t;
 
 typedef enum {
@@ -295,6 +298,7 @@
 	uint32_t eflags;
 	uint32_t verbose_events;
 	int end_count;
+	uint32_t relationship_total;
 } conference_obj_t;
 
 /* Relationship with another member */
@@ -402,12 +406,13 @@
 static void launch_conference_thread(conference_obj_t *conference);
 static void launch_conference_video_thread(conference_obj_t *conference);
 static void *SWITCH_THREAD_FUNC conference_loop_input(switch_thread_t *thread, void *obj);
-static switch_status_t conference_local_play_file(conference_obj_t *conference, switch_core_session_t *session, char *path, uint32_t leadin, void *buf, uint32_t buflen);
+static switch_status_t conference_local_play_file(conference_obj_t *conference, switch_core_session_t *session, char *path, uint32_t leadin, void *buf,
+												  uint32_t buflen);
 static switch_status_t conference_member_play_file(conference_member_t *member, char *file, uint32_t leadin);
 static switch_status_t conference_member_say(conference_member_t *member, char *text, uint32_t leadin);
 static uint32_t conference_member_stop_file(conference_member_t *member, file_stop_t stop);
 static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_memory_pool_t *pool);
-static switch_status_t chat_send(const char *proto, const char *from, const char *to, const char *subject, 
+static switch_status_t chat_send(const char *proto, const char *from, const char *to, const char *subject,
 								 const char *body, const char *type, const char *hint);
 
 static void launch_conference_record_thread(conference_obj_t *conference, char *path);
@@ -455,13 +460,13 @@
 
 	if (member->session) {
 		switch_channel_t *channel = switch_core_session_get_channel(member->session);
-		
+
 		if (member->verbose_events) {
 			switch_channel_event_set_data(channel, event);
 		} else {
 			switch_channel_event_set_basic_data(channel, event);
 		}
-		
+
 	}
 
 	switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Member-ID", "%u", member->id);
@@ -569,7 +574,11 @@
 
 	rel->id = id;
 
+
 	lock_member(member);
+	switch_mutex_lock(member->conference->member_mutex);
+	member->conference->relationship_total++;
+	switch_mutex_unlock(member->conference->member_mutex);
 	rel->next = member->relationships;
 	member->relationships = rel;
 	unlock_member(member);
@@ -597,6 +606,11 @@
 			} else {
 				member->relationships = rel->next;
 			}
+
+			switch_mutex_lock(member->conference->member_mutex);
+			member->conference->relationship_total--;
+			switch_mutex_unlock(member->conference->member_mutex);
+
 		}
 		last = rel;
 	}
@@ -665,7 +679,7 @@
 				conference_stop_file(conference, FILE_STOP_ASYNC);
 			}
 			if (conference->enter_sound) {
-				conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 
+				conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session),
 									 switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1);
 			}
 		}
@@ -688,7 +702,8 @@
 					if (!switch_test_flag(conference, CFLAG_BRIDGE_TO)) {
 						if (conference->alone_sound) {
 							conference_stop_file(conference, FILE_STOP_ASYNC);
-							conference_play_file(conference, conference->alone_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), 1);
+							conference_play_file(conference, conference->alone_sound, CONF_DEFAULT_LEADIN,
+												 switch_core_session_get_channel(member->session), 1);
 						} else {
 							switch_snprintf(msg, sizeof(msg), "You are currently the only person in this conference.");
 							conference_member_say(member, msg, CONF_DEFAULT_LEADIN);
@@ -898,7 +913,7 @@
 			req_iframe = 0;
 			goto do_continue;
 		}
-		
+
 		if (conference->floor_holder->id != last_member) {
 			int iframe = 0;
 #if 0
@@ -916,13 +931,13 @@
 
 			if (vid_frame->codec->implementation->ianacode == 34) {	/* h.263 */
 				//iframe = (*((int16_t *) vid_frame->data) >> 12 == 6);
-				iframe = 1;			
+				iframe = 1;
 			} else if (vid_frame->codec->implementation->ianacode == 115) {	/* h.263-1998 */
 				int y = *((int8_t *) vid_frame->data + 2) & 0xfe;
 				iframe = (y == 0x80 || y == 0x82);
 			} else if (vid_frame->codec->implementation->ianacode == 99) {	/* h.264 */
 				iframe = (*((int16_t *) vid_frame->data) >> 5 == 0x11);
-			} else {		/* we need more defs */
+			} else {			/* we need more defs */
 				iframe = 1;
 			}
 
@@ -930,7 +945,7 @@
 				goto do_continue;
 			}
 
-			req_iframe = 0;			
+			req_iframe = 0;
 		}
 
 		last_member = conference->floor_holder->id;
@@ -945,8 +960,8 @@
 			}
 		}
 
-	do_continue:
-		
+	  do_continue:
+
 		switch_mutex_unlock(conference->member_mutex);
 	}
 
@@ -968,6 +983,9 @@
 	switch_event_t *event;
 	uint8_t *file_frame;
 	uint8_t *async_file_frame;
+	int16_t *bptr;
+	int x;
+	int32_t z = 0;
 
 	file_frame = switch_core_alloc(conference->pool, SWITCH_RECOMMENDED_BUFFER_SIZE);
 	async_file_frame = switch_core_alloc(conference->pool, SWITCH_RECOMMENDED_BUFFER_SIZE);
@@ -984,13 +1002,13 @@
 	switch_mutex_unlock(globals.hash_mutex);
 
 	conference->is_recording = 0;
-	
+
 	while (globals.running && !switch_test_flag(conference, CFLAG_DESTRUCT)) {
 		switch_size_t file_sample_len = samples;
 		switch_size_t file_data_len = samples * 2;
 		int has_file_data = 0, members_with_video = 0;
 
-  		if (conference->perpetual_sound && !conference->async_fnode) {
+		if (conference->perpetual_sound && !conference->async_fnode) {
 			conference_play_file(conference, conference->perpetual_sound, CONF_DEFAULT_LEADIN, NULL, 1);
 		} else if (conference->moh_sound && (conference->count == 1 || switch_test_flag(conference, CFLAG_WAIT_MOD)) && !conference->async_fnode) {
 			conference_play_file(conference, conference->moh_sound, CONF_DEFAULT_LEADIN, NULL, 1);
@@ -1028,12 +1046,12 @@
 		}
 
 		/* Start recording if there's more than one participant. */
-		if (ready > 1 && conference->auto_record && !conference->is_recording){
+		if (ready > 1 && conference->auto_record && !conference->is_recording) {
 			conference->is_recording = 1;
 			imember = conference->members;
 			if (imember) {
 				switch_channel_t *channel = switch_core_session_get_channel(imember->session);
-				char *rfile = switch_channel_expand_variables(channel, conference->auto_record); 
+				char *rfile = switch_channel_expand_variables(channel, conference->auto_record);
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Auto recording file: %s\n", rfile);
 				launch_conference_record_thread(conference, rfile);
 				if (rfile != conference->auto_record) {
@@ -1109,7 +1127,7 @@
 
 						for (x = 0; x < file_sample_len; x++) {
 							int32_t z;
-							int16_t *bptr, *muxed;
+							int16_t *muxed;
 
 							muxed = (int16_t *) file_frame;
 							bptr = (int16_t *) async_file_frame;
@@ -1125,99 +1143,108 @@
 			}
 		}
 
+		if (switch_test_flag(conference, CFLAG_WASTE_BANDWIDTH) && !has_file_data) {
+			file_sample_len = bytes / 2;
+
+			if (conference->comfort_noise_level) {
+				switch_generate_sln_silence((int16_t *) file_frame, file_sample_len, conference->comfort_noise_level);
+			} else {
+				memset(file_frame, 255, bytes);
+			}
+			has_file_data = 1;
+		}
+
+
 		if (ready || has_file_data) {
-			/* Build a muxed frame for every member that contains the mixed audio of everyone else */
+			/* Use more bits in the main_frame to preserve the exact sum of the audio samples. */
+			int main_frame[SWITCH_RECOMMENDED_BUFFER_SIZE / 2] = { 0 };
+			int16_t write_frame[SWITCH_RECOMMENDED_BUFFER_SIZE / 2] = { 0 };
 
-			for (omember = conference->members; omember; omember = omember->next) {
-				if (has_file_data && file_sample_len) {
-					uint32_t sample_bytes = file_sample_len * 2;
-					memcpy(omember->mux_frame, file_frame, sample_bytes);
-					if (sample_bytes < bytes) {
-						if (conference->comfort_noise_level) {
-							switch_generate_sln_silence((int16_t *) omember->mux_frame + sample_bytes,
-														(bytes - sample_bytes) / 2, conference->comfort_noise_level);
-						} else {
-							memset(omember->mux_frame + sample_bytes, 255, bytes - sample_bytes);
-						}
-					}
-				} else {
-					if (conference->comfort_noise_level) {
-						switch_generate_sln_silence((int16_t *) omember->mux_frame, bytes / 2, conference->comfort_noise_level);
+
+			/* Init the main frame with file data if there is any. */
+			bptr = (int16_t *) file_frame;
+			if (has_file_data && file_sample_len) {
+				for (x = 0; x < bytes / 2; x++) {
+					if (x <= file_sample_len) {
+						main_frame[x] = (int32_t) bptr[x];
 					} else {
-						memset(omember->mux_frame, 255, bytes);
+						main_frame[x] = 255;
 					}
 				}
-				for (imember = conference->members; imember; imember = imember->next) {
-					uint32_t x;
-					int16_t *bptr, *muxed;
+			}
 
-					if (imember == omember || !imember->read) {
-						/* Don't add audio from yourself or if you didn't read any */
-						continue;
-					}
+			/* Copy audio from every member known to be producing audio into the main frame. */
+			for (omember = conference->members; omember; omember = omember->next) {
+				if (!(switch_test_flag(omember, MFLAG_RUNNING) && switch_test_flag(omember, MFLAG_HAS_AUDIO))) {
+					continue;
+				}
+				bptr = (int16_t *) omember->frame;
+				for (x = 0; x < omember->read / 2; x++) {
+					main_frame[x] += (int32_t) bptr[x];
+				}
+			}
 
-					/* If they are not supposed to talk to us then don't let them */
-					if (omember->relationships) {
-						conference_relationship_t *rel;
+			/* Create write frame once per member who is not deaf for each sample in the main frame
+			   check if our audio is involved and if so, subtract it from the sample so we don't hear ourselves.
+			   Since main frame was 32 bit int, we did not lose any detail, now that we have to convert to 16 bit we can
+			   cut it off at the min and max range if need be and write the frame to the output buffer.
+			 */
+			for (omember = conference->members; omember; omember = omember->next) {
+				switch_size_t ok = 1;
 
-						if ((rel = member_get_relationship(omember, imember))) {
-							if (!switch_test_flag(rel, RFLAG_CAN_HEAR)) {
-								continue;
-							}
-						}
+				if (!switch_test_flag(omember, MFLAG_RUNNING)) {
+					continue;
+				}
+
+				if (!switch_test_flag(omember, MFLAG_CAN_HEAR) && !switch_test_flag(omember, MFLAG_WASTE_BANDWIDTH)
+					&& !switch_test_flag(conference, CFLAG_WASTE_BANDWIDTH)) {
+					continue;
+				}
+
+				bptr = (int16_t *) omember->frame;
+				for (x = 0; x < bytes / 2; x++) {
+					z = main_frame[x];
+					/* bptr[x] represents my own contribution to this audio sample */
+					if (switch_test_flag(omember, MFLAG_HAS_AUDIO) && x <= omember->read / 2) {
+						z -= (int32_t) bptr[x];
 					}
 
-					/* If we are not supposed to hear them then don't let it happen */
-					if (imember->relationships) {
-						conference_relationship_t *rel;
+					/* when there are relationships, we have to do more work by scouring all the members to see if there are any 
+					   reasons why we should not be hearing a paticular member, and if not, delete their samples as well.
+					 */
+					if (conference->relationship_total) {
+						for (imember = conference->members; imember; imember = imember->next) {
+							conference_relationship_t *rel;
+							for (rel = imember->relationships; rel; rel = rel->next) {
+								if (imember != omember && switch_test_flag(imember, MFLAG_HAS_AUDIO)) {
+									int16_t *rptr = (int16_t *) imember->frame;
+									if ((rel->id == omember->id || rel->id == 0) && !switch_test_flag(rel, RFLAG_CAN_SPEAK)) {
+										z -= (int32_t) rptr[x];
+									}
+									if ((rel->id == imember->id || rel->id == 0) && !switch_test_flag(rel, RFLAG_CAN_HEAR)) {
+										z -= (int32_t) rptr[x];
+									}
+								}
 
-						if ((rel = member_get_relationship(imember, omember))) {
-							if (!switch_test_flag(rel, RFLAG_CAN_SPEAK)) {
-								continue;
 							}
 						}
 					}
-#if 0
-					if (nt && conference->not_talking_buf_len && !switch_test_flag(omember, MFLAG_HAS_AUDIO)) {
-						memcpy(omember->mux_frame, conference->not_talking_buf, conference->not_talking_buf_len);
-						continue;
-					}
-#endif
-					bptr = (int16_t *) imember->frame;
-					muxed = (int16_t *) omember->mux_frame;
 
-					for (x = 0; x < imember->read / 2; x++) {
-						int32_t z = muxed[x] + bptr[x];
-						switch_normalize_to_16bit(z);
-						muxed[x] = (int16_t) z;
-					}
-#if 0
-					if (total - ready > 1) {
-						conference->not_talking_buf_len = imember->read;
-						if (!conference->not_talking_buf) {
-							conference->not_talking_buf = switch_core_alloc(conference->pool, imember->read + 128);
-						}
-						memcpy(conference->not_talking_buf, muxed, conference->not_talking_buf_len);
-						nt++;
-					}
-#endif
+					/* Now we can convert to 16 bit. */
+					switch_normalize_to_16bit(z);
+					write_frame[x] = (int16_t) z;
 				}
-			}
-			if (bytes) {
-				/* Go back and write each member his dedicated copy of the audio frame that does not contain his own audio. */
-				for (imember = conference->members; imember; imember = imember->next) {
-					if (switch_test_flag(imember, MFLAG_RUNNING)) {
-						switch_size_t ok = 1;
-						switch_mutex_lock(imember->audio_out_mutex);
-						ok = switch_buffer_write(imember->mux_buffer, imember->mux_frame, bytes);
-						switch_mutex_unlock(imember->audio_out_mutex);
-						if (!ok) {
-							goto end;
-						}
-					}
+
+				switch_mutex_lock(omember->audio_out_mutex);
+				ok = switch_buffer_write(omember->mux_buffer, write_frame, bytes);
+				switch_mutex_unlock(omember->audio_out_mutex);
+
+				if (!ok) {
+					goto end;
 				}
 			}
 		}
+
 		if (conference->async_fnode && conference->async_fnode->done) {
 			switch_memory_pool_t *pool;
 			switch_core_file_close(&conference->async_fnode->fh);
@@ -1245,7 +1272,7 @@
 		switch_mutex_unlock(conference->mutex);
 	}
 	/* Rinse ... Repeat */
- end:
+  end:
 
 	if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
@@ -1372,7 +1399,23 @@
 	}
 }
 
+static void conference_loop_fn_mute_on(conference_member_t *member, caller_control_action_t *action)
+{
+	if (switch_test_flag(member, MFLAG_CAN_SPEAK)) {
+		conf_api_sub_mute(member, NULL, NULL);
+	}
+}
 
+static void conference_loop_fn_mute_off(conference_member_t *member, caller_control_action_t *action)
+{
+	if (!switch_test_flag(member, MFLAG_CAN_SPEAK)) {
+		conf_api_sub_unmute(member, NULL, NULL);
+		if (!switch_test_flag(member, MFLAG_CAN_HEAR)) {
+			conf_api_sub_undeaf(member, NULL, NULL);
+		}
+	}
+}
+
 static void conference_loop_fn_lock_toggle(conference_member_t *member, caller_control_action_t *action)
 {
 	switch_event_t *event;
@@ -1386,7 +1429,7 @@
 		}
 
 		switch_set_flag_locked(member->conference, CFLAG_LOCKED);
-		if (test_eflag(member->conference, EFLAG_LOCK) && 
+		if (test_eflag(member->conference, EFLAG_LOCK) &&
 			switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
 			conference_add_event_data(member->conference, event);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "lock");
@@ -1398,7 +1441,7 @@
 		}
 
 		switch_clear_flag_locked(member->conference, CFLAG_LOCKED);
-		if (test_eflag(member->conference, EFLAG_UNLOCK) && 
+		if (test_eflag(member->conference, EFLAG_UNLOCK) &&
 			switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
 			conference_add_event_data(member->conference, event);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "unlock");
@@ -1674,7 +1717,7 @@
 	int argc;
 	char *mydata = NULL;
 	switch_event_t *event;
-	
+
 	if (test_eflag(member->conference, EFLAG_DTMF) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
 		conference_add_event_member_data(member, event);
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "transfer");
@@ -1682,7 +1725,7 @@
 		switch_event_fire(&event);
 	}
 	switch_clear_flag_locked(member, MFLAG_RUNNING);
-	
+
 	if ((mydata = switch_core_session_strdup(member->session, action->data))) {
 		if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
 			if (argc > 0) {
@@ -1694,7 +1737,7 @@
 			if (argc > 2) {
 				context = argv[2];
 			}
-			
+
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_ERROR, "Empty transfer string [%s]\n", (char *) action->data);
 			goto done;
@@ -1704,11 +1747,10 @@
 		goto done;
 	}
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_DEBUG, "Transfering to: %s, %s, %s\n", exten, dialplan, context);
-	
-	switch_ivr_session_transfer(member->session,
-								exten, dialplan, context);
-								
-done:
+
+	switch_ivr_session_transfer(member->session, exten, dialplan, context);
+
+  done:
 	return;
 }
 
@@ -1722,14 +1764,14 @@
 	char *mydata = NULL;
 	switch_event_t *event = NULL;
 	switch_channel_t *channel = NULL;
-	
+
 	if (test_eflag(member->conference, EFLAG_DTMF) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
 		conference_add_event_member_data(member, event);
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "execute_app");
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application", action->data);
 		switch_event_fire(&event);
 	}
-	
+
 	if ((mydata = switch_core_session_strdup(member->session, action->data))) {
 		if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
 			if (argc > 0) {
@@ -1738,7 +1780,7 @@
 			if (argc > 1) {
 				arg = argv[1];
 			}
-			
+
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_ERROR, "Empty execute app string [%s]\n", (char *) action->data);
 			goto done;
@@ -1755,13 +1797,13 @@
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_DEBUG, "Execute app: %s, %s\n", app, arg);
 
 	channel = switch_core_session_get_channel(member->session);
-	
+
 	switch_channel_set_app_flag(channel, CF_APP_TAGGED);
 	switch_core_session_set_read_codec(member->session, NULL);
 	switch_core_session_execute_application(member->session, app, arg);
-	switch_core_session_set_read_codec(member->session, &member->read_codec);							
-	switch_channel_clear_app_flag(channel, CF_APP_TAGGED);										
-done:
+	switch_core_session_set_read_codec(member->session, &member->read_codec);
+	switch_channel_clear_app_flag(channel, CF_APP_TAGGED);
+  done:
 	return;
 }
 
@@ -1778,7 +1820,7 @@
 	switch_status_t status;
 	switch_frame_t *read_frame = NULL;
 	uint32_t hangover = 40, hangunder = 15, hangover_hits = 0, hangunder_hits = 0, energy_level = 0, diff_level = 400;
-	switch_codec_implementation_t read_impl = {0};
+	switch_codec_implementation_t read_impl = { 0 };
 	switch_core_session_t *session = member->session;
 	switch_assert(member != NULL);
 
@@ -1827,7 +1869,7 @@
 					}
 				}
 			}
-			
+
 			goto do_continue;
 		}
 
@@ -1856,9 +1898,9 @@
 				member->score = energy / (samples / divisor);
 			}
 
-			member->score_iir = (int)(((1.0 - SCORE_DECAY) * (float)member->score) + (SCORE_DECAY * (float)member->score_iir));
+			member->score_iir = (int) (((1.0 - SCORE_DECAY) * (float) member->score) + (SCORE_DECAY * (float) member->score_iir));
 
-			if(member->score_iir > SCORE_MAX_IIR) {
+			if (member->score_iir > SCORE_MAX_IIR) {
 				member->score_iir = SCORE_MAX_IIR;
 			}
 
@@ -1892,14 +1934,14 @@
 							member->conference->floor_holder = member;
 						}
 						switch_mutex_unlock(member->conference->member_mutex);
-						
+
 						if (test_eflag(member->conference, EFLAG_START_TALKING) && switch_test_flag(member, MFLAG_CAN_SPEAK) &&
 							switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
 							conference_add_event_member_data(member, event);
 							switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "start-talking");
 							switch_event_fire(&event);
 						}
-						
+
 						if (switch_test_flag(member, MFLAG_MUTE_DETECT) && !switch_test_flag(member, MFLAG_CAN_SPEAK)) {
 
 							if (!zstr(member->conference->mute_detect_sound)) {
@@ -1914,7 +1956,7 @@
 							}
 
 						}
-						
+
 					}
 				}
 			} else {
@@ -1939,12 +1981,12 @@
 		}
 
 		/* skip frames that are not actual media or when we are muted or silent */
-		if ((switch_test_flag(member, MFLAG_TALKING) || energy_level == 0) && switch_test_flag(member, MFLAG_CAN_SPEAK) && 
+		if ((switch_test_flag(member, MFLAG_TALKING) || energy_level == 0) && switch_test_flag(member, MFLAG_CAN_SPEAK) &&
 			!switch_test_flag(member->conference, CFLAG_WAIT_MOD)) {
 			switch_audio_resampler_t *read_resampler = member->read_resampler;
 			void *data;
 			uint32_t datalen;
-			
+
 			if (read_resampler) {
 				int16_t *bptr = (int16_t *) read_frame->data;
 				int len = (int) read_frame->datalen;
@@ -1978,7 +2020,7 @@
 			}
 		}
 
-	do_continue:
+	  do_continue:
 
 		switch_mutex_unlock(member->read_mutex);
 	}
@@ -1990,6 +2032,82 @@
 	return NULL;
 }
 
+
+static void member_add_file_data(conference_member_t *member, int16_t *data, switch_size_t file_data_len)
+{
+	switch_size_t file_sample_len = file_data_len / 2;
+	int16_t file_frame[SWITCH_RECOMMENDED_BUFFER_SIZE / 2] = { 0 };
+
+	if (!member->fnode) {
+		return;
+	}
+
+	/* if we are done, clean it up */
+	if (member->fnode->done) {
+		conference_file_node_t *fnode;
+		switch_memory_pool_t *pool;
+
+		if (member->fnode->type != NODE_TYPE_SPEECH) {
+			switch_core_file_close(&member->fnode->fh);
+		}
+
+		fnode = member->fnode;
+		member->fnode = member->fnode->next;
+
+		pool = fnode->pool;
+		fnode = NULL;
+		switch_core_destroy_memory_pool(&pool);
+	} else {
+		/* skip this frame until leadin time has expired */
+		if (member->fnode->leadin) {
+			member->fnode->leadin--;
+		} else {
+			if (member->fnode->type == NODE_TYPE_SPEECH) {
+				switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_BLOCKING;
+
+				if (switch_core_speech_read_tts(member->fnode->sh, file_frame, &file_data_len, &flags) == SWITCH_STATUS_SUCCESS) {
+					file_sample_len = file_data_len / 2;
+				} else {
+					file_sample_len = file_data_len = 0;
+				}
+			} else if (member->fnode->type == NODE_TYPE_FILE) {
+				switch_core_file_read(&member->fnode->fh, file_frame, &file_sample_len);
+				file_data_len = file_sample_len * 2;
+			}
+
+			if (file_sample_len <= 0) {
+				switch_event_t *event;
+				member->fnode->done++;
+
+				if (test_eflag(member->conference, EFLAG_PLAY_FILE) &&
+					switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
+					conference_add_event_data(member->conference, event);
+					conference_add_event_member_data(member, event);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "play-file-member-done");
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "File", member->fnode->file);
+					switch_event_fire(&event);
+				}
+			} else {			/* there is file node data to mix into the frame */
+				int32_t i, sample;
+
+				/* Check for output volume adjustments */
+				if (member->volume_out_level) {
+					switch_change_sln_volume(file_frame, file_sample_len, member->volume_out_level);
+				}
+
+				for (i = 0; i < file_sample_len; i++) {
+					sample = data[i] + file_frame[i];
+					switch_normalize_to_16bit(sample);
+					data[i] = sample;
+				}
+
+			}
+		}
+	}
+}
+
+
+
 /* launch an input thread for the call leg */
 static void launch_conference_loop_input(conference_member_t *member, switch_memory_pool_t *pool)
 {
@@ -2008,6 +2126,8 @@
 
 static caller_control_fn_table_t ccfntbl[] = {
 	{"mute", "0", CALLER_CONTROL_MUTE, conference_loop_fn_mute_toggle},
+	{"mute on", NULL, CALLER_CONTROL_MUTE_ON, conference_loop_fn_mute_on},
+	{"mute off", NULL, CALLER_CONTROL_MUTE_OFF, conference_loop_fn_mute_off},
 	{"deaf mute", "*", CALLER_CONTROL_DEAF_MUTE, conference_loop_fn_deafmute_toggle},
 	{"energy up", "9", CALLER_CONTROL_ENERGY_UP, conference_loop_fn_energy_up},
 	{"energy equ", "8", CALLER_CONTROL_ENERGY_EQU_CONF, conference_loop_fn_energy_equ_conf},
@@ -2043,14 +2163,14 @@
 	uint32_t low_count, bytes;
 	call_list_t *call_list, *cp;
 	int restarting = -1;
-	switch_codec_implementation_t read_impl = {0};
-	
- top:
+	switch_codec_implementation_t read_impl = { 0 };
 
+  top:
+
 	switch_core_session_get_read_impl(member->session, &read_impl);
 
 	restarting++;
-	
+
 	if (switch_test_flag(member, MFLAG_RESTART)) {
 		switch_clear_flag(member, MFLAG_RESTART);
 		switch_set_flag_locked(member, MFLAG_FLUSH_BUFFER);
@@ -2096,11 +2216,12 @@
 	if (!restarting) {
 		/* Start the input thread */
 		launch_conference_loop_input(member, switch_core_session_get_pool(member->session));
-		
+
 		/* build a digit stream object */
 		if (member->conference->dtmf_parser != NULL
 			&& switch_ivr_digit_stream_new(member->conference->dtmf_parser, &member->digit_stream) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_ERROR, "Danger Will Robinson, there is no digit parser stream object\n");
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_ERROR,
+							  "Danger Will Robinson, there is no digit parser stream object\n");
 		}
 
 		if ((call_list = switch_channel_get_private(channel, "_conference_autocall_list_"))) {
@@ -2111,7 +2232,7 @@
 			const char *ann = switch_channel_get_variable(channel, "conference_auto_outcall_announce");
 			const char *prefix = switch_channel_get_variable(channel, "conference_auto_outcall_prefix");
 			int to = 60;
-		
+
 			if (ann) {
 				member->conference->special_announce = switch_core_strdup(member->conference->pool, ann);
 			}
@@ -2153,15 +2274,13 @@
 	while (switch_test_flag(member, MFLAG_RUNNING) && switch_test_flag(member, MFLAG_ITHREAD)
 		   && switch_channel_ready(channel)) {
 		char dtmf[128] = "";
-		uint8_t file_frame[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 };
 		char *digit;
 		switch_event_t *event;
 		caller_control_action_t *caller_action = NULL;
 		int use_timer = 0;
-		switch_size_t file_sample_len = csamples;
-		switch_size_t file_data_len = file_sample_len * 2;
+		switch_buffer_t *use_buffer = NULL;
+		uint32_t mux_used = 0;
 
-
 		switch_mutex_lock(member->write_mutex);
 
 		if (switch_test_flag(member, MFLAG_RESTART)) {
@@ -2194,7 +2313,8 @@
 		if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
 			/* test to see if outbound channel has answered */
 			if (switch_channel_test_flag(channel, CF_ANSWERED) && !switch_test_flag(member->conference, CFLAG_ANSWERED)) {
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_DEBUG, "Outbound conference channel answered, setting CFLAG_ANSWERED\n");
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_DEBUG,
+								  "Outbound conference channel answered, setting CFLAG_ANSWERED\n");
 				switch_set_flag(member->conference, CFLAG_ANSWERED);
 			}
 		} else {
@@ -2234,8 +2354,7 @@
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session),
 							  SWITCH_LOG_INFO,
 							  "executing caller control '%s' param '%s' on call '%u, %s\n",
-							  caller_action->fndesc->key,
-							  param ? param : "none", member->id, switch_channel_get_name(channel));
+							  caller_action->fndesc->key, param ? param : "none", member->id, switch_channel_get_name(channel));
 #endif
 
 			caller_action->fndesc->handler(member, caller_action);
@@ -2244,121 +2363,68 @@
 			caller_action = NULL;
 		}
 
-		/* handle file and TTS frames */
-		if (member->fnode) {
-			/* if we are done, clean it up */
-			if (member->fnode->done) {
-				conference_file_node_t *fnode;
-				switch_memory_pool_t *pool;
 
-				if (member->fnode->type != NODE_TYPE_SPEECH) {
-					switch_core_file_close(&member->fnode->fh);
-				}
+		use_buffer = NULL;
+		mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer);
 
-				fnode = member->fnode;
-				member->fnode = member->fnode->next;
-
-				pool = fnode->pool;
-				fnode = NULL;
-				switch_core_destroy_memory_pool(&pool);
-			} else {
-				/* skip this frame until leadin time has expired */
-				if (member->fnode->leadin) {
-					member->fnode->leadin--;
-				} else {		/* send the node frame instead of the conference frame to the call leg */
-					if (member->fnode->type == NODE_TYPE_SPEECH) {
-						switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_BLOCKING;
-						
-						if (switch_core_speech_read_tts(member->fnode->sh, file_frame, &file_data_len, &flags) == SWITCH_STATUS_SUCCESS) {
-							file_sample_len = file_data_len / 2;
-						} else {
-							file_sample_len = file_data_len = 0;
-						}
-					} else if (member->fnode->type == NODE_TYPE_FILE) {
-						switch_core_file_read(&member->fnode->fh, file_frame, &file_sample_len);
-						file_data_len = file_sample_len * 2;
-					}
-
-					if (file_sample_len <= 0) {
-						member->fnode->done++;
-
-						if (test_eflag(member->conference, EFLAG_PLAY_FILE) &&
-							switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) {
-							conference_add_event_data(member->conference, event);
-							switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "play-file-member-done");
-							switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "File", member->fnode->file);
-							switch_event_fire(&event);
-						}
-					} else {	/* there is file node data to deliver */
-						write_frame.data = file_frame;
-						write_frame.datalen = (uint32_t) file_data_len;
-						write_frame.samples = (uint32_t) file_sample_len;
-						/* Check for output volume adjustments */
-						if (member->volume_out_level) {
-							switch_change_sln_volume(write_frame.data, write_frame.samples, member->volume_out_level);
-						}
-						write_frame.timestamp = timer.samplecount;
-						switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
-						switch_core_timer_next(&timer);
-
-
-						/* forget the conference data we played file node data instead */
-						switch_set_flag_locked(member, MFLAG_FLUSH_BUFFER);
-					}
-				}
-			}
-		} else {
-			switch_buffer_t *use_buffer = NULL;
-			uint32_t mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer);
-
-			if (mux_used) {
-				if (mux_used < bytes) {
-					if (++low_count >= 5) {
-						/* partial frame sitting around this long is useless and builds delay */
-						switch_set_flag_locked(member, MFLAG_FLUSH_BUFFER);
-					}
-				} else if (mux_used > flush_len) {
-					/* getting behind, clear the buffer */
+		if (mux_used) {
+			if (mux_used < bytes) {
+				if (++low_count >= 5) {
+					/* partial frame sitting around this long is useless and builds delay */
 					switch_set_flag_locked(member, MFLAG_FLUSH_BUFFER);
 				}
+			} else if (mux_used > flush_len) {
+				/* getting behind, clear the buffer */
+				switch_set_flag_locked(member, MFLAG_FLUSH_BUFFER);
 			}
+		}
 
 
-			use_timer = 1;
+		use_timer = 1;
 
-			if (mux_used) {
-				/* Flush the output buffer and write all the data (presumably muxed) back to the channel */
-				switch_mutex_lock(member->audio_out_mutex);
-				write_frame.data = data;
-				use_buffer = member->mux_buffer;
-				low_count = 0;
-				if ((write_frame.datalen = (uint32_t) switch_buffer_read(use_buffer, write_frame.data, bytes))) {
-					if (write_frame.datalen && switch_test_flag(member, MFLAG_CAN_HEAR)) {
-						write_frame.samples = write_frame.datalen / 2;
+		if (mux_used) {
+			/* Flush the output buffer and write all the data (presumably muxed) back to the channel */
+			switch_mutex_lock(member->audio_out_mutex);
+			write_frame.data = data;
+			use_buffer = member->mux_buffer;
+			low_count = 0;
+			if ((write_frame.datalen = (uint32_t) switch_buffer_read(use_buffer, write_frame.data, bytes))) {
+				if (write_frame.datalen && switch_test_flag(member, MFLAG_CAN_HEAR)) {
+					write_frame.samples = write_frame.datalen / 2;
 
-						/* Check for output volume adjustments */
-						if (member->volume_out_level) {
-							switch_change_sln_volume(write_frame.data, write_frame.samples, member->volume_out_level);
-						}
-						write_frame.timestamp = timer.samplecount;
-						switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
+					/* Check for output volume adjustments */
+					if (member->volume_out_level) {
+						switch_change_sln_volume(write_frame.data, write_frame.samples, member->volume_out_level);
 					}
-				}
-
-				switch_mutex_unlock(member->audio_out_mutex);
-			} else {
-				if (switch_test_flag(member, MFLAG_WASTE_BANDWIDTH)) {
-					if (member->conference->comfort_noise_level) {
-						switch_generate_sln_silence(write_frame.data, samples, member->conference->comfort_noise_level);
-					} else {
-						memset(write_frame.data, 255, bytes);
+					write_frame.timestamp = timer.samplecount;
+					if (member->fnode) {
+						member_add_file_data(member, write_frame.data, write_frame.datalen);
 					}
-					write_frame.datalen = bytes;
-					write_frame.samples = samples;
-					write_frame.timestamp = timer.samplecount;
 					switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
 				}
 			}
+
+			switch_mutex_unlock(member->audio_out_mutex);
+		} else if (member->fnode) {
+			write_frame.datalen = bytes;
+			write_frame.samples = samples;
+			memset(write_frame.data, 255, write_frame.datalen);
+			member_add_file_data(member, write_frame.data, write_frame.datalen);
+			switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
+		} else if (!switch_test_flag(member->conference, CFLAG_WASTE_BANDWIDTH)) {
+			if (switch_test_flag(member, MFLAG_WASTE_BANDWIDTH)) {
+				if (member->conference->comfort_noise_level) {
+					switch_generate_sln_silence(write_frame.data, samples, member->conference->comfort_noise_level);
+				} else {
+					memset(write_frame.data, 255, bytes);
+				}
+
+				write_frame.datalen = bytes;
+				write_frame.samples = samples;
+				write_frame.timestamp = timer.samplecount;
+
+				switch_core_session_write_frame(member->session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
+			}
 		}
 
 		if (switch_test_flag(member, MFLAG_FLUSH_BUFFER)) {
@@ -2369,7 +2435,7 @@
 			}
 			switch_clear_flag_locked(member, MFLAG_FLUSH_BUFFER);
 		}
-		
+
 		switch_mutex_unlock(member->write_mutex);
 
 
@@ -2382,14 +2448,14 @@
 		} else {
 			switch_ivr_parse_all_messages(member->session);
 		}
-		
+
 		if (use_timer) {
 			switch_core_timer_next(&timer);
 		} else {
 			switch_cond_next();
 		}
 
-	} /* Rinse ... Repeat */
+	}							/* Rinse ... Repeat */
 
 
 	if (member->digit_stream != NULL) {
@@ -2480,7 +2546,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Joining Conference\n");
 		goto end;
 	}
-	
+
 	fh.pre_buffer_datalen = SWITCH_DEFAULT_FILE_BUFFER_LEN;
 
 	if (switch_core_file_open(&fh,
@@ -2508,7 +2574,7 @@
 	while (switch_test_flag(member, MFLAG_RUNNING) && switch_test_flag(conference, CFLAG_RUNNING) && conference->count) {
 		switch_size_t len = 0;
 		mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer);
-		
+
 		if (switch_test_flag(member, MFLAG_FLUSH_BUFFER)) {
 			if (mux_used) {
 				switch_mutex_lock(member->audio_out_mutex);
@@ -2531,13 +2597,13 @@
 					len = (switch_size_t) rlen / sizeof(int16_t);
 				}
 				switch_mutex_unlock(member->audio_out_mutex);
-			} 
-			
+			}
+
 			if (len < (switch_size_t) samples) {
-				memset(data_buf + (len * sizeof(int16_t)), 255, ((switch_size_t)samples - len) * sizeof(int16_t));
+				memset(data_buf + (len * sizeof(int16_t)), 255, ((switch_size_t) samples - len) * sizeof(int16_t));
 				len = (switch_size_t) samples;
 			}
-			
+
 			if (!len || switch_core_file_write(&fh, data_buf, &len) != SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write Failed\n");
 				switch_clear_flag_locked(member, MFLAG_RUNNING);
@@ -2648,12 +2714,12 @@
 	for (imember = conference->members; imember; imember = imember->next) {
 		/* don't send to self */
 		if (imember->id == member->id) {
-			continue; 			
+			continue;
 		}
 		if (imember->session) {
 			const char *p;
 			for (p = dtmf; p && *p; p++) {
-				switch_dtmf_t digit = { *p, SWITCH_DEFAULT_DTMF_DURATION};
+				switch_dtmf_t digit = { *p, SWITCH_DEFAULT_DTMF_DURATION };
 				lock_member(imember);
 				switch_core_session_kill_channel(imember->session, SWITCH_SIG_BREAK);
 				switch_core_session_send_dtmf(imember->session, &digit);
@@ -3408,6 +3474,7 @@
 	}
 
 	if (conference == NULL) {
+		switch_mutex_lock(globals.hash_mutex);
 		for (hi = switch_hash_first(NULL, globals.conference_hash); hi; hi = switch_hash_next(hi)) {
 			switch_hash_this(hi, NULL, NULL, &val);
 			conference = (conference_obj_t *) val;
@@ -3415,9 +3482,7 @@
 			stream->write_function(stream, "Conference %s (%u member%s rate: %u%s)\n",
 								   conference->name,
 								   conference->count,
-								   conference->count == 1 ? "" : "s",
-								   conference->rate,
-								   switch_test_flag(conference, CFLAG_LOCKED) ? " locked" : "");
+								   conference->count == 1 ? "" : "s", conference->rate, switch_test_flag(conference, CFLAG_LOCKED) ? " locked" : "");
 			count++;
 			if (!summary) {
 				if (pretty) {
@@ -3427,6 +3492,7 @@
 				}
 			}
 		}
+		switch_mutex_unlock(globals.hash_mutex);
 	} else {
 		count++;
 		if (pretty) {
@@ -3454,7 +3520,7 @@
 
 	x_tag = switch_xml_add_child_d(x_member, name, off);
 	switch_assert(x_tag);
-	
+
 	switch_zmalloc(data, dlen);
 
 	switch_url_encode(value, data, dlen);
@@ -3471,7 +3537,7 @@
 	char *ival = i;
 	switch_assert(conference != NULL);
 	switch_assert(x_conference != NULL);
-	
+
 	switch_xml_set_attr_d(x_conference, "name", conference->name);
 	switch_snprintf(i, sizeof(i), "%d", conference->count);
 	switch_xml_set_attr_d(x_conference, "member-count", ival);
@@ -3481,7 +3547,7 @@
 	if (switch_test_flag(conference, CFLAG_LOCKED)) {
 		switch_xml_set_attr_d(x_conference, "locked", "true");
 	}
-	
+
 	if (switch_test_flag(conference, CFLAG_DESTRUCT)) {
 		switch_xml_set_attr_d(x_conference, "destruct", "true");
 	}
@@ -3512,7 +3578,7 @@
 
 	x_members = switch_xml_add_child_d(x_conference, "members", 0);
 	switch_assert(x_members);
-	
+
 	switch_mutex_lock(conference->member_mutex);
 
 	for (member = conference->members; member; member = member->next) {
@@ -3523,7 +3589,7 @@
 		uint32_t count = 0;
 		switch_xml_t x_tag;
 		int toff = 0;
-		
+
 		if (switch_test_flag(member, MFLAG_NOCHANNEL)) {
 			continue;
 		}
@@ -3533,7 +3599,7 @@
 		profile = switch_channel_get_caller_profile(channel);
 		name = switch_channel_get_name(channel);
 
-		
+
 		x_member = switch_xml_add_child_d(x_members, "member", moff++);
 		switch_assert(x_member);
 
@@ -3543,8 +3609,8 @@
 		add_x_tag(x_member, "uuid", uuid, toff++);
 		add_x_tag(x_member, "caller_id_name", profile->caller_id_name, toff++);
 		add_x_tag(x_member, "caller_id_number", profile->caller_id_number, toff++);
-		
 
+
 		x_flags = switch_xml_add_child_d(x_member, "flags", count++);
 		switch_assert(x_flags);
 
@@ -3559,16 +3625,16 @@
 
 		x_tag = switch_xml_add_child_d(x_flags, "has_video", count++);
 		switch_xml_set_txt_d(x_tag, switch_channel_test_flag(switch_core_session_get_channel(member->session), CF_VIDEO) ? "true" : "false");
-		
+
 		x_tag = switch_xml_add_child_d(x_flags, "has_floor", count++);
 		switch_xml_set_txt_d(x_tag, (member == member->conference->floor_holder) ? "true" : "false");
-		
+
 		x_tag = switch_xml_add_child_d(x_flags, "is_moderator", count++);
 		switch_xml_set_txt_d(x_tag, switch_test_flag(member, MFLAG_MOD) ? "true" : "false");
-		
+
 		x_tag = switch_xml_add_child_d(x_flags, "end_conference", count++);
 		switch_xml_set_txt_d(x_tag, switch_test_flag(member, MFLAG_ENDCONF) ? "true" : "false");
-		
+
 	}
 
 	switch_mutex_unlock(conference->member_mutex);
@@ -3584,12 +3650,13 @@
 
 	x_conferences = switch_xml_new("conferences");
 	switch_assert(x_conferences);
-	
+
 	if (conference == NULL) {
+		switch_mutex_lock(globals.hash_mutex);
 		for (hi = switch_hash_first(NULL, globals.conference_hash); hi; hi = switch_hash_next(hi)) {
 			switch_hash_this(hi, NULL, NULL, &val);
 			conference = (conference_obj_t *) val;
-			
+
 			x_conference = switch_xml_add_child_d(x_conferences, "conference", off++);
 			switch_assert(conference);
 
@@ -3597,6 +3664,7 @@
 			conference_xlist(conference, x_conference, off);
 
 		}
+		switch_mutex_unlock(globals.hash_mutex);
 	} else {
 		x_conference = switch_xml_add_child_d(x_conferences, "conference", off++);
 		switch_assert(conference);
@@ -3941,7 +4009,7 @@
 
 	switch_uuid_get(&uuid);
 	switch_uuid_format(uuid_str, &uuid);
-	
+
 	if (conference) {
 		conference_outcall_bg(conference, NULL, NULL, argv[2], 60, NULL, argv[4], argv[3], uuid_str);
 	} else {
@@ -3981,7 +4049,7 @@
 			switch_channel_t *channel;
 			switch_event_t *event;
 			switch_xml_t cxml = NULL, cfg = NULL, profiles = NULL;
-			
+
 			if (!id || !(member = conference_member_get(conference, id))) {
 				stream->write_function(stream, "No Member %u in conference %s.\n", id, conference->name);
 				continue;
@@ -4086,7 +4154,7 @@
 			}
 
 			unlock_member(member);
-			
+
 			stream->write_function(stream, "OK Member '%d' sent to conference %s.\n", member->id, argv[2]);
 
 			/* tell them what happened */
@@ -4109,7 +4177,7 @@
 	}
 
   done:
-	
+
 	if (locked) {
 		switch_mutex_unlock(globals.setup_mutex);
 		locked = 0;
@@ -4201,43 +4269,43 @@
 /* API Interface Function sub-commands */
 /* Entries in this list should be kept in sync with the enum above */
 static api_command_t conf_api_sub_commands[] = {
-	{"list", (void_fn_t) &conf_api_sub_list, CONF_API_SUB_ARGS_SPLIT, "<confname> list [delim <string>]"},
-	{"xml_list", (void_fn_t) &conf_api_sub_xml_list, CONF_API_SUB_ARGS_SPLIT, "<confname> xml_list"},
-	{"energy", (void_fn_t) &conf_api_sub_energy, CONF_API_SUB_MEMBER_TARGET,
+	{"list", (void_fn_t) & conf_api_sub_list, CONF_API_SUB_ARGS_SPLIT, "<confname> list [delim <string>]"},
+	{"xml_list", (void_fn_t) & conf_api_sub_xml_list, CONF_API_SUB_ARGS_SPLIT, "<confname> xml_list"},
+	{"energy", (void_fn_t) & conf_api_sub_energy, CONF_API_SUB_MEMBER_TARGET,
 	 "<confname> energy <member_id|all|last> [<newval>]"},
-	{"volume_in", (void_fn_t) &conf_api_sub_volume_in, CONF_API_SUB_MEMBER_TARGET,
+	{"volume_in", (void_fn_t) & conf_api_sub_volume_in, CONF_API_SUB_MEMBER_TARGET,
 	 "<confname> volume_in <member_id|all|last> [<newval>]"},
-	{"volume_out", (void_fn_t) &conf_api_sub_volume_out, CONF_API_SUB_MEMBER_TARGET,
+	{"volume_out", (void_fn_t) & conf_api_sub_volume_out, CONF_API_SUB_MEMBER_TARGET,
 	 "<confname> volume_out <member_id|all|last> [<newval>]"},
-	{"play", (void_fn_t) &conf_api_sub_play, CONF_API_SUB_ARGS_SPLIT, "<confname> play <file_path> [async|<member_id>]"},
-	{"say", (void_fn_t) &conf_api_sub_say, CONF_API_SUB_ARGS_AS_ONE, "<confname> say <text>"},
-	{"saymember", (void_fn_t) &conf_api_sub_saymember, CONF_API_SUB_ARGS_AS_ONE,
+	{"play", (void_fn_t) & conf_api_sub_play, CONF_API_SUB_ARGS_SPLIT, "<confname> play <file_path> [async|<member_id>]"},
+	{"say", (void_fn_t) & conf_api_sub_say, CONF_API_SUB_ARGS_AS_ONE, "<confname> say <text>"},
+	{"saymember", (void_fn_t) & conf_api_sub_saymember, CONF_API_SUB_ARGS_AS_ONE,
 	 "<confname> saymember <member_id> <text>"},
-	{"stop", (void_fn_t) &conf_api_sub_stop, CONF_API_SUB_ARGS_SPLIT,
+	{"stop", (void_fn_t) & conf_api_sub_stop, CONF_API_SUB_ARGS_SPLIT,
 	 "<confname> stop <[current|all|async|last]> [<member_id>]"},
-	{"dtmf", (void_fn_t) &conf_api_sub_dtmf, CONF_API_SUB_MEMBER_TARGET,
+	{"dtmf", (void_fn_t) & conf_api_sub_dtmf, CONF_API_SUB_MEMBER_TARGET,
 	 "<confname> dtmf <[member_id|all|last]> <digits>"},
-	{"kick", (void_fn_t) &conf_api_sub_kick, CONF_API_SUB_MEMBER_TARGET, "<confname> kick <[member_id|all|last]>"},
-	{"mute", (void_fn_t) &conf_api_sub_mute, CONF_API_SUB_MEMBER_TARGET, "<confname> mute <[member_id|all]|last>"},
-	{"unmute", (void_fn_t) &conf_api_sub_unmute, CONF_API_SUB_MEMBER_TARGET,
+	{"kick", (void_fn_t) & conf_api_sub_kick, CONF_API_SUB_MEMBER_TARGET, "<confname> kick <[member_id|all|last]>"},
+	{"mute", (void_fn_t) & conf_api_sub_mute, CONF_API_SUB_MEMBER_TARGET, "<confname> mute <[member_id|all]|last>"},
+	{"unmute", (void_fn_t) & conf_api_sub_unmute, CONF_API_SUB_MEMBER_TARGET,
 	 "<confname> unmute <[member_id|all]|last>"},
-	{"deaf", (void_fn_t) &conf_api_sub_deaf, CONF_API_SUB_MEMBER_TARGET, "<confname> deaf <[member_id|all]|last>"},
-	{"undeaf", (void_fn_t) &conf_api_sub_undeaf, CONF_API_SUB_MEMBER_TARGET,
+	{"deaf", (void_fn_t) & conf_api_sub_deaf, CONF_API_SUB_MEMBER_TARGET, "<confname> deaf <[member_id|all]|last>"},
+	{"undeaf", (void_fn_t) & conf_api_sub_undeaf, CONF_API_SUB_MEMBER_TARGET,
 	 "<confname> undeaf <[member_id|all]|last>"},
-	{"relate", (void_fn_t) &conf_api_sub_relate, CONF_API_SUB_ARGS_SPLIT,
+	{"relate", (void_fn_t) & conf_api_sub_relate, CONF_API_SUB_ARGS_SPLIT,
 	 "<confname> relate <member_id> <other_member_id> [nospeak|nohear|clear]"},
-	{"lock", (void_fn_t) &conf_api_sub_lock, CONF_API_SUB_ARGS_SPLIT, "<confname> lock"},
-	{"unlock", (void_fn_t) &conf_api_sub_unlock, CONF_API_SUB_ARGS_SPLIT, "<confname> unlock"},
-	{"dial", (void_fn_t) &conf_api_sub_dial, CONF_API_SUB_ARGS_SPLIT,
+	{"lock", (void_fn_t) & conf_api_sub_lock, CONF_API_SUB_ARGS_SPLIT, "<confname> lock"},
+	{"unlock", (void_fn_t) & conf_api_sub_unlock, CONF_API_SUB_ARGS_SPLIT, "<confname> unlock"},
+	{"dial", (void_fn_t) & conf_api_sub_dial, CONF_API_SUB_ARGS_SPLIT,
 	 "<confname> dial <endpoint_module_name>/<destination> <callerid number> <callerid name>"},
-	{"bgdial", (void_fn_t) &conf_api_sub_bgdial, CONF_API_SUB_ARGS_SPLIT,
+	{"bgdial", (void_fn_t) & conf_api_sub_bgdial, CONF_API_SUB_ARGS_SPLIT,
 	 "<confname> bgdial <endpoint_module_name>/<destination> <callerid number> <callerid name>"},
-	{"transfer", (void_fn_t) &conf_api_sub_transfer, CONF_API_SUB_ARGS_SPLIT,
+	{"transfer", (void_fn_t) & conf_api_sub_transfer, CONF_API_SUB_ARGS_SPLIT,
 	 "<confname> transfer <conference_name> <member id> [...<member id>]"},
-	{"record", (void_fn_t) &conf_api_sub_record, CONF_API_SUB_ARGS_SPLIT, "<confname> record <filename>"},
-	{"norecord", (void_fn_t) &conf_api_sub_norecord, CONF_API_SUB_ARGS_SPLIT, "<confname> norecord <[filename|all]>"},
-	{"pin", (void_fn_t) &conf_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "<confname> pin <pin#>"},
-	{"nopin", (void_fn_t) &conf_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "<confname> nopin"},
+	{"record", (void_fn_t) & conf_api_sub_record, CONF_API_SUB_ARGS_SPLIT, "<confname> record <filename>"},
+	{"norecord", (void_fn_t) & conf_api_sub_norecord, CONF_API_SUB_ARGS_SPLIT, "<confname> norecord <[filename|all]>"},
+	{"pin", (void_fn_t) & conf_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "<confname> pin <pin#>"},
+	{"nopin", (void_fn_t) & conf_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "<confname> nopin"},
 };
 
 #define CONFFUNCAPISIZE (sizeof(conf_api_sub_commands)/sizeof(conf_api_sub_commands[0]))
@@ -4485,8 +4553,10 @@
 
 	/* establish an outbound call leg */
 
-	if (switch_ivr_originate(session, &peer_session, cause, bridgeto, timeout, NULL, cid_name, cid_num, NULL, NULL, SOF_NONE, NULL) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot create outgoing channel, cause: %s\n", switch_channel_cause2str(*cause));
+	if (switch_ivr_originate(session, &peer_session, cause, bridgeto, timeout, NULL, cid_name, cid_num, NULL, NULL, SOF_NONE, NULL) !=
+		SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot create outgoing channel, cause: %s\n",
+						  switch_channel_cause2str(*cause));
 		if (caller_channel) {
 			switch_channel_hangup(caller_channel, *cause);
 		}
@@ -4571,7 +4641,7 @@
 	if (call) {
 		switch_call_cause_t cause;
 		switch_event_t *event;
-		
+
 		conference_outcall(call->conference, call->conference_name,
 						   call->session, call->bridgeto, call->timeout, call->flags, call->cid_name, call->cid_num, &cause);
 
@@ -4639,7 +4709,7 @@
 	if (conference_name) {
 		call->conference_name = strdup(conference_name);
 	}
-	
+
 	if (call_uuid) {
 		call->uuid = strdup(call_uuid);
 	}
@@ -4654,7 +4724,8 @@
 }
 
 /* Play a file */
-static switch_status_t conference_local_play_file(conference_obj_t *conference, switch_core_session_t *session, char *path, uint32_t leadin, void *buf, uint32_t buflen)
+static switch_status_t conference_local_play_file(conference_obj_t *conference, switch_core_session_t *session, char *path, uint32_t leadin, void *buf,
+												  uint32_t buflen)
 {
 	uint32_t x = 0;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -4724,7 +4795,7 @@
 		char *argv[10] = { 0 };
 		int i, argc = 0;
 
-		for(p = dup; p && *p; p++) {
+		for (p = dup; p && *p; p++) {
 			if (*p == ',') {
 				*p = '|';
 			}
@@ -4732,7 +4803,7 @@
 
 		argc = switch_separate_string(dup, '|', argv, (sizeof(argv) / sizeof(argv[0])));
 
-		for(i = 0; i < argc && argv[i]; i++) {
+		for (i = 0; i < argc && argv[i]; i++) {
 			if (!strcasecmp(argv[i], "mute")) {
 				*f &= ~MFLAG_CAN_SPEAK;
 			} else if (!strcasecmp(argv[i], "deaf")) {
@@ -4766,7 +4837,7 @@
 		char *argv[10] = { 0 };
 		int i, argc = 0;
 
-		for(p = dup; p && *p; p++) {
+		for (p = dup; p && *p; p++) {
 			if (*p == ',') {
 				*p = '|';
 			}
@@ -4774,11 +4845,13 @@
 
 		argc = switch_separate_string(dup, '|', argv, (sizeof(argv) / sizeof(argv[0])));
 
-		for(i = 0; i < argc && argv[i]; i++) {
+		for (i = 0; i < argc && argv[i]; i++) {
 			if (!strcasecmp(argv[i], "wait-mod")) {
 				*f |= CFLAG_WAIT_MOD;
 			} else if (!strcasecmp(argv[i], "video-floor-only")) {
 				*f |= CFLAG_VID_FLOOR;
+			} else if (!strcasecmp(argv[i], "waste-bandwidth")) {
+				*f |= CFLAG_WASTE_BANDWIDTH;
 			}
 		}
 
@@ -4887,7 +4960,7 @@
 
 static int setup_media(conference_member_t *member, conference_obj_t *conference)
 {
-	switch_codec_implementation_t read_impl = {0};
+	switch_codec_implementation_t read_impl = { 0 };
 	switch_core_session_get_read_impl(member->session, &read_impl);
 
 	switch_core_session_reset(member->session, SWITCH_TRUE, SWITCH_FALSE);
@@ -4955,8 +5028,7 @@
 							   read_impl.microseconds_per_packet / 1000,
 							   1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, member->pool) == SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_DEBUG,
-						  "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
-						  conference->rate, read_impl.microseconds_per_packet / 1000);
+						  "Raw Codec Activation Success L16@%uhz 1 channel %dms\n", conference->rate, read_impl.microseconds_per_packet / 1000);
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
 						  conference->rate, read_impl.microseconds_per_packet / 1000);
@@ -4977,15 +5049,15 @@
 
 	return 0;
 
- codec_done1:
+  codec_done1:
 	switch_core_codec_destroy(&member->read_codec);
- codec_done2:
+  codec_done2:
 	switch_core_codec_destroy(&member->write_codec);
- done:
+  done:
 
 	return -1;
-	
 
+
 }
 
 
@@ -5034,7 +5106,7 @@
 
 	if ((flags_str = strstr(mydata, flags_prefix))) {
 		char *p;
-		*((char *)flags_str) = '\0';
+		*((char *) flags_str) = '\0';
 		flags_str += strlen(flags_prefix);
 		if ((p = strchr(flags_str, '}'))) {
 			*p = '\0';
@@ -5073,7 +5145,7 @@
 	} else {
 		profile_name = "default";
 	}
-	
+
 #if 0
 	if (0) {
 		member.dtmf_parser = conference->dtmf_parser;
@@ -5162,9 +5234,11 @@
 
 		/* if the conference exists, get the pointer to it */
 		if (!conference) {
+			const char *max_members_str;
+
 			/* couldn't find the conference, create one */
 			conference = conference_new(conf_name, xml_cfg, NULL);
-			
+
 			if (!conference) {
 				goto done;
 			}
@@ -5177,23 +5251,36 @@
 			switch_channel_set_variable(channel, "conference_name", conference->name);
 
 			/* Set MOH from variable if not set */
-			if(zstr(conference->moh_sound)) {
+			if (zstr(conference->moh_sound)) {
 				conference->moh_sound = switch_core_strdup(conference->pool, switch_channel_get_variable(channel, "conference_moh_sound"));
 			}
 			/* Set perpetual-sound from variable if not set */
-			if(zstr(conference->perpetual_sound)) {
+			if (zstr(conference->perpetual_sound)) {
 				conference->perpetual_sound = switch_core_strdup(conference->pool, switch_channel_get_variable(channel, "conference_perpetual_sound"));
 			}
-			
+
 			/* Set the minimum number of members (once you go above it you cannot go below it) */
 			conference->min = 1;
 
+			/* check for variable used to specify override for max_members */
+			if (!zstr(max_members_str = switch_channel_get_variable(channel, "conference_max_members"))) {
+				uint32_t max_members_val;
+				errno = 0;		/* sanity first */
+				max_members_val = strtol(max_members_str, NULL, 0);	/* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */
+				if (errno == ERANGE || errno == EINVAL || max_members_val < 0 || max_members_val == 1) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+									  "conference_max_members variable %s is invalid, not setting a limit\n", max_members_str);
+				} else {
+					conference->max_members = max_members_val;
+				}
+			}
+
 			/* Indicate the conference is dynamic */
 			switch_set_flag_locked(conference, CFLAG_DYNAMIC);
 
 			/* Start the conference thread for this conference */
 			launch_conference_thread(conference);
-		} else { /* setup user variable */
+		} else {				/* setup user variable */
 			switch_channel_set_variable(channel, "conference_name", conference->name);
 		}
 
@@ -5220,23 +5307,23 @@
 
 			/* Answer the channel */
 			switch_channel_answer(channel);
-			
-			/* look for PIN in channel variable first.  If not present or invalid revert to prompting user */ 
+
+			/* look for PIN in channel variable first.  If not present or invalid revert to prompting user */
 			supplied_pin_value = switch_core_strdup(conference->pool, switch_channel_get_variable(channel, "supplied_pin"));
-			if (!zstr(supplied_pin_value)){
+			if (!zstr(supplied_pin_value)) {
 				char *supplied_pin_value_start;
 				int i = 0;
-				if ((supplied_pin_value_start = (char *)switch_stristr(cf_pin_url_param_name, supplied_pin_value))){
+				if ((supplied_pin_value_start = (char *) switch_stristr(cf_pin_url_param_name, supplied_pin_value))) {
 					/* pin supplied as a URL parameter, move pointer to start of actual pin value */
 					supplied_pin_value = supplied_pin_value_start + strlen(cf_pin_url_param_name);
 				}
-				while (*supplied_pin_value != 0 && *supplied_pin_value != ';'){
+				while (*supplied_pin_value != 0 && *supplied_pin_value != ';') {
 					pin_buf[i++] = *supplied_pin_value++;
 				}
 				pin_valid = (strcmp(pin_buf, dpin) == 0);
 				memset(pin_buf, 0, sizeof(pin_buf));
 			}
-			
+
 			if (!conference->pin_sound) {
 				conference->pin_sound = switch_core_strdup(conference->pool, "conference/conf-pin.wav");
 			}
@@ -5247,16 +5334,17 @@
 
 			while (!pin_valid && pin_retries && status == SWITCH_STATUS_SUCCESS) {
 				switch_status_t pstatus = SWITCH_STATUS_FALSE;
-				
+
 				/* be friendly */
 				if (conference->pin_sound) {
 					pstatus = conference_local_play_file(conference, session, conference->pin_sound, 20, pin_buf, sizeof(pin_buf));
 				} else if (conference->tts_engine && conference->tts_voice) {
-					pstatus = switch_ivr_speak_text(session, conference->tts_engine, conference->tts_voice, "please enter the conference pin number", NULL);
+					pstatus =
+						switch_ivr_speak_text(session, conference->tts_engine, conference->tts_voice, "please enter the conference pin number", NULL);
 				} else {
 					pstatus = switch_ivr_speak_text(session, "flite", "slt", "please enter the conference pin number", NULL);
 				}
-				
+
 				if (pstatus != SWITCH_STATUS_SUCCESS && pstatus != SWITCH_STATUS_BREAK) {
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot ask the user for a pin, ending call");
 					switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -5266,11 +5354,10 @@
 				if (strlen(pin_buf) < strlen(dpin)) {
 					char *buf = pin_buf + strlen(pin_buf);
 					char term = '\0';
-					
+
 					status = switch_ivr_collect_digits_count(session,
 															 buf,
-															 sizeof(pin_buf) - strlen(pin_buf),
-															 strlen(dpin) - strlen(pin_buf), "#", &term, 10000, 0, 0);
+															 sizeof(pin_buf) - strlen(pin_buf), strlen(dpin) - strlen(pin_buf), "#", &term, 10000, 0, 0);
 					if (status == SWITCH_STATUS_TIMEOUT) {
 						status = SWITCH_STATUS_SUCCESS;
 					}
@@ -5371,7 +5458,7 @@
 	if (mflags & MFLAG_MINTWO) {
 		conference->min = 2;
 	}
-	
+
 	/* Add the caller to the conference */
 	if (conference_add_member(conference, &member) != SWITCH_STATUS_SUCCESS) {
 		switch_core_codec_destroy(&member.read_codec);
@@ -5556,20 +5643,10 @@
 		} else {
 			return SWITCH_STATUS_SUCCESS;
 		}
-#if 0
-		else {
-			if (strcasecmp(argv[0], "help") == 0 || strcasecmp(argv[0], "commands") == 0) {
-				stream.write_function(&stream, "%s\n", api_syntax);
-				/* find a normal command */
-			} else {
-				conf_api_dispatch(conference, &stream, argc, argv, (const char *) body, 0);
-			}
-		}
-#endif
 	}
 
 	switch_safe_free(lbuf);
-	
+
 	switch_core_chat_send(proto, CONF_CHAT_PROTO, to, hint && strchr(hint, '/') ? hint : from, "", stream.data, NULL, NULL);
 	switch_safe_free(stream.data);
 
@@ -5722,126 +5799,126 @@
 
 	/* parse the profile tree for param values */
 	if (cfg.profile)
-	for (xml_kvp = switch_xml_child(cfg.profile, "param"); xml_kvp; xml_kvp = xml_kvp->next) {
-		char *var = (char *) switch_xml_attr_soft(xml_kvp, "name");
-		char *val = (char *) switch_xml_attr_soft(xml_kvp, "value");
-		char buf[128] = "";
-		char *p;
+		for (xml_kvp = switch_xml_child(cfg.profile, "param"); xml_kvp; xml_kvp = xml_kvp->next) {
+			char *var = (char *) switch_xml_attr_soft(xml_kvp, "name");
+			char *val = (char *) switch_xml_attr_soft(xml_kvp, "value");
+			char buf[128] = "";
+			char *p;
 
-		if ((p = strchr(var, '_'))) {
-			switch_copy_string(buf, var, sizeof(buf));
-			for (p = buf; *p; p++) {
-				if (*p == '_') {
-					*p = '-';
+			if ((p = strchr(var, '_'))) {
+				switch_copy_string(buf, var, sizeof(buf));
+				for (p = buf; *p; p++) {
+					if (*p == '_') {
+						*p = '-';
+					}
 				}
+				var = buf;
 			}
-			var = buf;
-		}
 
-		if (!strcasecmp(var, "rate") && !zstr(val)) {
-			uint32_t tmp = atoi(val);
-			if (tmp == 8000 || tmp == 16000 || tmp == 32000 || tmp == 48000) {
-				rate = tmp;
+			if (!strcasecmp(var, "rate") && !zstr(val)) {
+				uint32_t tmp = atoi(val);
+				if (tmp == 8000 || tmp == 12000 || tmp == 16000 || tmp == 24000 || tmp == 32000 || tmp == 48000) {
+					rate = tmp;
+				}
+			} else if (!strcasecmp(var, "domain") && !zstr(val)) {
+				domain = val;
+			} else if (!strcasecmp(var, "interval") && !zstr(val)) {
+				uint32_t tmp = atoi(val);
+				if (SWITCH_ACCEPTABLE_INTERVAL(tmp)) {
+					interval = tmp;
+				} else {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+									  "Interval must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL);
+				}
+			} else if (!strcasecmp(var, "timer-name") && !zstr(val)) {
+				timer_name = val;
+			} else if (!strcasecmp(var, "tts-engine") && !zstr(val)) {
+				tts_engine = val;
+			} else if (!strcasecmp(var, "tts-voice") && !zstr(val)) {
+				tts_voice = val;
+			} else if (!strcasecmp(var, "enter-sound") && !zstr(val)) {
+				enter_sound = val;
+			} else if (!strcasecmp(var, "exit-sound") && !zstr(val)) {
+				exit_sound = val;
+			} else if (!strcasecmp(var, "alone-sound") && !zstr(val)) {
+				alone_sound = val;
+			} else if (!strcasecmp(var, "perpetual-sound") && !zstr(val)) {
+				perpetual_sound = val;
+			} else if (!strcasecmp(var, "moh-sound") && !zstr(val)) {
+				moh_sound = val;
+			} else if (!strcasecmp(var, "ack-sound") && !zstr(val)) {
+				ack_sound = val;
+			} else if (!strcasecmp(var, "nack-sound") && !zstr(val)) {
+				nack_sound = val;
+			} else if (!strcasecmp(var, "muted-sound") && !zstr(val)) {
+				muted_sound = val;
+			} else if (!strcasecmp(var, "mute-detect-sound") && !zstr(val)) {
+				mute_detect_sound = val;
+			} else if (!strcasecmp(var, "unmuted-sound") && !zstr(val)) {
+				unmuted_sound = val;
+			} else if (!strcasecmp(var, "locked-sound") && !zstr(val)) {
+				locked_sound = val;
+			} else if (!strcasecmp(var, "is-locked-sound") && !zstr(val)) {
+				is_locked_sound = val;
+			} else if (!strcasecmp(var, "is-unlocked-sound") && !zstr(val)) {
+				is_unlocked_sound = val;
+			} else if (!strcasecmp(var, "member-flags") && !zstr(val)) {
+				member_flags = val;
+			} else if (!strcasecmp(var, "conference-flags") && !zstr(val)) {
+				conference_flags = val;
+			} else if (!strcasecmp(var, "kicked-sound") && !zstr(val)) {
+				kicked_sound = val;
+			} else if (!strcasecmp(var, "pin") && !zstr(val)) {
+				pin = val;
+			} else if (!strcasecmp(var, "pin-sound") && !zstr(val)) {
+				pin_sound = val;
+			} else if (!strcasecmp(var, "bad-pin-sound") && !zstr(val)) {
+				bad_pin_sound = val;
+			} else if (!strcasecmp(var, "energy-level") && !zstr(val)) {
+				energy_level = val;
+			} else if (!strcasecmp(var, "caller-id-name") && !zstr(val)) {
+				caller_id_name = val;
+			} else if (!strcasecmp(var, "caller-id-number") && !zstr(val)) {
+				caller_id_number = val;
+			} else if (!strcasecmp(var, "caller-controls") && !zstr(val)) {
+				caller_controls = val;
+			} else if (!strcasecmp(var, "comfort-noise") && !zstr(val)) {
+				int tmp;
+				tmp = atoi(val);
+				if (tmp > 1 && tmp < 10000) {
+					comfort_noise_level = tmp;
+				} else if (switch_true(val)) {
+					comfort_noise_level = 1400;
+				}
+			} else if (!strcasecmp(var, "sound-prefix") && !zstr(val)) {
+				sound_prefix = val;
+			} else if (!strcasecmp(var, "max-members") && !zstr(val)) {
+				errno = 0;		/* sanity first */
+				max_members = strtol(val, NULL, 0);	/* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */
+				if (errno == ERANGE || errno == EINVAL || max_members < 0 || max_members == 1) {
+					/* a negative wont work well, and its foolish to have a conference limited to 1 person unless the outbound 
+					 * stuff is added, see comments above
+					 */
+					max_members = 0;	/* set to 0 to disable max counts */
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "max-members %s is invalid, not setting a limit\n", val);
+				}
+			} else if (!strcasecmp(var, "max-members-sound") && !zstr(val)) {
+				maxmember_sound = val;
+			} else if (!strcasecmp(var, "announce-count") && !zstr(val)) {
+				errno = 0;		/* safety first */
+				announce_count = strtol(val, NULL, 0);
+				if (errno == ERANGE || errno == EINVAL) {
+					announce_count = 0;
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "announce-count is invalid, not anouncing member counts\n");
+				}
+			} else if (!strcasecmp(var, "suppress-events") && !zstr(val)) {
+				suppress_events = val;
+			} else if (!strcasecmp(var, "verbose-events") && !zstr(val)) {
+				verbose_events = val;
+			} else if (!strcasecmp(var, "auto-record") && !zstr(val)) {
+				auto_record = val;
 			}
-		} else if (!strcasecmp(var, "domain") && !zstr(val)) {
-			domain = val;
-		} else if (!strcasecmp(var, "interval") && !zstr(val)) {
-			uint32_t tmp = atoi(val);
-			if (SWITCH_ACCEPTABLE_INTERVAL(tmp)) {
-				interval = tmp;
-			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-								  "Interval must be multipe of 10 and less than %d, Using default of 20\n", SWITCH_MAX_INTERVAL);
-			}
-		} else if (!strcasecmp(var, "timer-name") && !zstr(val)) {
-			timer_name = val;
-		} else if (!strcasecmp(var, "tts-engine") && !zstr(val)) {
-			tts_engine = val;
-		} else if (!strcasecmp(var, "tts-voice") && !zstr(val)) {
-			tts_voice = val;
-		} else if (!strcasecmp(var, "enter-sound") && !zstr(val)) {
-			enter_sound = val;
-		} else if (!strcasecmp(var, "exit-sound") && !zstr(val)) {
-			exit_sound = val;
-		} else if (!strcasecmp(var, "alone-sound") && !zstr(val)) {
-			alone_sound = val;
-		} else if (!strcasecmp(var, "perpetual-sound") && !zstr(val)) {
-			perpetual_sound = val;
-		} else if (!strcasecmp(var, "moh-sound") && !zstr(val)) {
-			moh_sound = val;
-		} else if (!strcasecmp(var, "ack-sound") && !zstr(val)) {
-			ack_sound = val;
-		} else if (!strcasecmp(var, "nack-sound") && !zstr(val)) {
-			nack_sound = val;
-		} else if (!strcasecmp(var, "muted-sound") && !zstr(val)) {
-			muted_sound = val;
-		} else if (!strcasecmp(var, "mute-detect-sound") && !zstr(val)) {
-			mute_detect_sound = val;
-		} else if (!strcasecmp(var, "unmuted-sound") && !zstr(val)) {
-			unmuted_sound = val;
-		} else if (!strcasecmp(var, "locked-sound") && !zstr(val)) {
-			locked_sound = val;
-		} else if (!strcasecmp(var, "is-locked-sound") && !zstr(val)) {
-			is_locked_sound = val;
-		} else if (!strcasecmp(var, "is-unlocked-sound") && !zstr(val)) {
-			is_unlocked_sound = val;
-		} else if (!strcasecmp(var, "member-flags") && !zstr(val)) {
-			member_flags = val;
-		} else if (!strcasecmp(var, "conference-flags") && !zstr(val)) {
-			conference_flags = val;
-		} else if (!strcasecmp(var, "kicked-sound") && !zstr(val)) {
-			kicked_sound = val;
-		} else if (!strcasecmp(var, "pin") && !zstr(val)) {
-			pin = val;
-		} else if (!strcasecmp(var, "pin-sound") && !zstr(val)) {
-			pin_sound = val;
-		} else if (!strcasecmp(var, "bad-pin-sound") && !zstr(val)) {
-			bad_pin_sound = val;
-		} else if (!strcasecmp(var, "energy-level") && !zstr(val)) {
-			energy_level = val;
-		} else if (!strcasecmp(var, "caller-id-name") && !zstr(val)) {
-			caller_id_name = val;
-		} else if (!strcasecmp(var, "caller-id-number") && !zstr(val)) {
-			caller_id_number = val;
-		} else if (!strcasecmp(var, "caller-controls") && !zstr(val)) {
-			caller_controls = val;
-		} else if (!strcasecmp(var, "comfort-noise") && !zstr(val)) {
-			int tmp;
-			tmp = atoi(val);
-			if (tmp > 1 && tmp < 10000) {
-				comfort_noise_level = tmp;
-			} else if (switch_true(val)) {
-				comfort_noise_level = 1400;
-			}
-		} else if (!strcasecmp(var, "sound-prefix") && !zstr(val)) {
-			sound_prefix = val;
-		} else if (!strcasecmp(var, "max-members") && !zstr(val)) {
-			errno = 0;			/* sanity first */
-			max_members = strtol(val, NULL, 0);	/* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */
-			if (errno == ERANGE || errno == EINVAL || max_members < 0 || max_members == 1) {
-				/* a negative wont work well, and its foolish to have a conference limited to 1 person unless the outbound 
-				 * stuff is added, see comments above
-				 */
-				max_members = 0;	/* set to 0 to disable max counts */
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "max-members %s is invalid, not setting a limit\n", val);
-			}
-		} else if (!strcasecmp(var, "max-members-sound") && !zstr(val)) {
-			maxmember_sound = val;
-		} else if (!strcasecmp(var, "announce-count") && !zstr(val)) {
-			errno = 0;			/* safety first */
-			announce_count = strtol(val, NULL, 0);
-			if (errno == ERANGE || errno == EINVAL) {
-				announce_count = 0;
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "announce-count is invalid, not anouncing member counts\n");
-			}
-		} else if (!strcasecmp(var, "suppress-events") && !zstr(val)) {
-			suppress_events = val;
-		} else if (!strcasecmp(var, "verbose-events") && !zstr(val)) {
-			verbose_events = val;
-		} else if (!strcasecmp(var, "auto-record") && !zstr(val)) {
-			auto_record = val;
 		}
-	}
 
 	/* Set defaults and various paramaters */
 
@@ -5901,7 +5978,7 @@
 	}
 
 	conference->mflags = MFLAG_CAN_SPEAK | MFLAG_CAN_HEAR;
-	
+
 	if (!zstr(moh_sound) && switch_is_moh(moh_sound)) {
 		conference->moh_sound = switch_core_strdup(conference->pool, moh_sound);
 	}
@@ -6015,7 +6092,7 @@
 	if (!zstr(verbose_events) && switch_true(verbose_events)) {
 		conference->verbose_events = 1;
 	}
-	
+
 	/* caller control configuration chores */
 	if (switch_ivr_digit_stream_parser_new(conference->pool, &conference->dtmf_parser) == SWITCH_STATUS_SUCCESS) {
 
@@ -6042,9 +6119,11 @@
 	switch_mutex_init(&conference->flag_mutex, SWITCH_MUTEX_NESTED, conference->pool);
 	switch_thread_rwlock_create(&conference->rwlock, conference->pool);
 	switch_mutex_init(&conference->member_mutex, SWITCH_MUTEX_NESTED, conference->pool);
+	switch_mutex_lock(globals.hash_mutex);
 	switch_core_hash_insert(globals.conference_hash, conference->name, conference);
+	switch_mutex_unlock(globals.hash_mutex);
 
- end:
+  end:
 
 	switch_mutex_unlock(globals.hash_mutex);
 
@@ -6205,7 +6284,8 @@
 	switch_mutex_init(&globals.setup_mutex, SWITCH_MUTEX_NESTED, globals.conference_pool);
 
 	/* Subscribe to presence request events */
-	if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL, &globals.node) != SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL, &globals.node) !=
+		SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't subscribe to presence request events!\n");
 		return SWITCH_STATUS_GENERR;
 	}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_curl/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_curl/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_curl/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -2,26 +2,24 @@
 BASE=../../../..
 WANT_CURL=yes
 
-JSON_DIR=$(BASE)/libs/$(json-c)
+JSON_DIR=$(switch_srcdir)/libs/$(json-c)
+JSON_BUILDDIR=$(switch_builddir)/libs/$(json-c)
 
-JSONLA=$(JSON_DIR)/libjson.la
+JSONLA=$(JSON_BUILDDIR)/libjson.la
 
 LOCAL_CFLAGS=-I$(JSON_DIR)
 LOCAL_LIBADD=$(JSONLA)
 
 include $(BASE)/build/modmake.rules
 
-DEFAULT_ARGS=--prefix=$(PREFIX) --disable-shared --with-pic
-
-$(LOCAL_OBJS): $(LOCAL_SOURCES)
-
 $(JSON_DIR):
 	$(GETLIB) $(json-c).tar.gz
 
-$(JSON_DIR)/Makefile: $(JSON_DIR)
-	cd $(JSON_DIR) && CFLAGS=$(AM_CFLAGS) CC=$(CC) CXX=$(CXX) ./configure --disable-shared --with-pic CPPFLAGS= LDFLAGS=
+$(JSON_BUILDDIR)/Makefile: $(JSON_DIR)
+	mkdir -p $(JSON_BUILDDIR)
+	cd $(JSON_BUILDDIR) && $(DEFAULT_VARS) $(JSON_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(JSON_DIR) CPPFLAGS= LDFLAGS=
 	$(TOUCH_TARGET)
 
-$(JSONLA): $(JSON_DIR)/Makefile
-	cd $(JSON_DIR) && $(MAKE)
+$(JSONLA): $(JSON_BUILDDIR)/Makefile
+	cd $(JSON_BUILDDIR) && $(MAKE)
 	$(TOUCH_TARGET)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_curl/mod_curl.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_curl/mod_curl.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_curl/mod_curl.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -28,7 +28,7 @@
  * mod_curl.c -- API for performing http queries
  *
  */
- 
+
 #include <switch.h>
 #include <curl/curl.h>
 #include <json.h>
@@ -75,13 +75,12 @@
 	http_data->bytes += realsize;
 
 	if (http_data->bytes > http_data->max_bytes) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Oversized file detected [%d bytes]\n", (int)http_data->bytes);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Oversized file detected [%d bytes]\n", (int) http_data->bytes);
 		http_data->err = 1;
 		return 0;
 	}
 
-	http_data->stream.write_function(
-		&http_data->stream, "%.*s",  realsize, ptr);
+	http_data->stream.write_function(&http_data->stream, "%.*s", realsize, ptr);
 	return realsize;
 }
 
@@ -90,18 +89,19 @@
 	register unsigned int realsize = (unsigned int) (size * nmemb);
 	http_data_t *http_data = data;
 	char *header = NULL;
-	
-	header = switch_core_alloc(http_data->pool, realsize+1);
+
+	header = switch_core_alloc(http_data->pool, realsize + 1);
 	switch_copy_string(header, ptr, realsize);
 	header[realsize] = '\0';
 
 	http_data->headers = curl_slist_append(http_data->headers, header);
-	
+
 	return realsize;
 }
 
-static http_data_t *do_lookup_url(switch_memory_pool_t *pool, const char *url, const char *method, const char *data) {
-	
+static http_data_t *do_lookup_url(switch_memory_pool_t *pool, const char *url, const char *method, const char *data)
+{
+
 	CURL *curl_handle = NULL;
 	long httpRes = 0;
 	char hostname[256] = "";
@@ -111,35 +111,36 @@
 	http_data = switch_core_alloc(pool, sizeof(http_data_t));
 	memset(http_data, 0, sizeof(http_data_t));
 	http_data->pool = pool;
-	
+
 	http_data->max_bytes = 64000;
 	SWITCH_STANDARD_STREAM(http_data->stream);
 
 	gethostname(hostname, sizeof(hostname));
-	
+
 	if (!method) {
 		method = "get";
 	}
-	
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "method: %s, url: %s\n", method, url);
 	curl_handle = curl_easy_init();
-	
+
 	if (!strncasecmp(url, "https", 5)) {
 		curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
 		curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
 	}
 	if (!strcasecmp(method, "head")) {
-		curl_easy_setopt(curl_handle, CURLOPT_NOBODY, SWITCH_TRUE);
-	} else if(!strcasecmp(method, "post")) {
+		curl_easy_setopt(curl_handle, CURLOPT_NOBODY, 1);
+	} else if (!strcasecmp(method, "post")) {
 		curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDSIZE, strlen(data));
 		curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, (void *) data);
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Post data: %s\n", data);
 	} else {
-		curl_easy_setopt(curl_handle, CURLOPT_HTTPGET, SWITCH_TRUE);
+		curl_easy_setopt(curl_handle, CURLOPT_HTTPGET, 1);
 	}
 	curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 0);
 	curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 0);
 	curl_easy_setopt(curl_handle, CURLOPT_URL, url);
+	curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
 	curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, file_callback);
 	curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) http_data);
 	curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, header_callback);
@@ -149,54 +150,53 @@
 	curl_easy_perform(curl_handle);
 	curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes);
 	curl_easy_cleanup(curl_handle);
-	
-	if (	http_data->stream.data &&
-			!zstr((char *)http_data->stream.data) &&
-			strcmp(" ", http_data->stream.data) ) {
-		
+
+	if (http_data->stream.data && !zstr((char *) http_data->stream.data) && strcmp(" ", http_data->stream.data)) {
+
 		http_data->http_response = switch_core_strdup(pool, http_data->stream.data);
 	}
-	
+
 	http_data->http_response_code = httpRes;
-	
+
 	switch_safe_free(http_data->stream.data);
 	return http_data;
 }
 
 
-static char *print_json(switch_memory_pool_t *pool, http_data_t *http_data) {
+static char *print_json(switch_memory_pool_t *pool, http_data_t *http_data)
+{
 	struct json_object *top = NULL;
 	struct json_object *headers = NULL;
 	char *data = NULL;
 	struct curl_slist *header = http_data->headers;
-	
+
 	top = json_object_new_object();
 	headers = json_object_new_array();
 	json_object_object_add(top, "status_code", json_object_new_int(http_data->http_response_code));
 	if (http_data->http_response) {
 		json_object_object_add(top, "body", json_object_new_string(http_data->http_response));
 	}
-	
+
 	/* parse header data */
-	while(header) {
+	while (header) {
 		struct json_object *obj = NULL;
 		/* remove trailing \r */
-		if ((data=rindex(header->data, '\r'))) {
+		if ((data = rindex(header->data, '\r'))) {
 			*data = '\0';
 		}
-		
+
 		if (zstr(header->data)) {
 			header = header->next;
 			continue;
 		}
-		
+
 		if ((data = index(header->data, ':'))) {
 			*data = '\0';
 			data++;
-			while(*data == ' ' && *data != '\0') {
+			while (*data == ' ' && *data != '\0') {
 				data++;
 			}
-			obj = json_object_new_object(); 
+			obj = json_object_new_object();
 			json_object_object_add(obj, "key", json_object_new_string(header->data));
 			json_object_object_add(obj, "value", json_object_new_string(data));
 			json_object_array_add(headers, obj);
@@ -222,15 +222,15 @@
 	}
 	json_object_object_add(top, "headers", headers);
 	data = switch_core_strdup(pool, json_object_to_json_string(top));
-	json_object_put(top); /* should free up all children */
-	
+	json_object_put(top);		/* should free up all children */
+
 	return data;
 }
 
 SWITCH_STANDARD_APP(curl_app_function)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	
+
 	char *argv[10] = { 0 };
 	int argc;
 	char *mydata = NULL;
@@ -246,8 +246,8 @@
 	struct curl_slist *slist = NULL;
 	switch_stream_handle_t stream = { 0 };
 	int i = 0;
-	
-	
+
+
 	if (session) {
 		pool = switch_core_session_get_pool(session);
 	} else {
@@ -256,24 +256,23 @@
 	if (!(mydata = switch_core_session_strdup(session, data))) {
 		return;
 	}
-	
+
 	if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
 		if (argc == 0) {
 			switch_goto_status(SWITCH_STATUS_SUCCESS, usage);
 		}
-		
+
 		url = switch_core_strdup(pool, argv[0]);
 
-		for (i =1; i < argc; i++) {
+		for (i = 1; i < argc; i++) {
 			if (!strcasecmp("headers", argv[i])) {
 				do_headers = SWITCH_TRUE;
 			} else if (!strcasecmp("json", argv[i])) {
 				do_json = SWITCH_TRUE;
-			} else if ( !strcasecmp("get", argv[i]) || 
-						!strcasecmp("head", argv[i])) {
+			} else if (!strcasecmp("get", argv[i]) || !strcasecmp("head", argv[i])) {
 				method = switch_core_strdup(pool, argv[i]);
 			} else if (!strcasecmp("post", argv[i])) {
-				if ( ++i < argc) { 
+				if (++i < argc) {
 					postdata = switch_core_strdup(pool, argv[i]);
 					switch_url_decode(postdata);
 				} else {
@@ -282,15 +281,15 @@
 			}
 		}
 	}
-	
+
 	http_data = do_lookup_url(pool, url, method, postdata);
 	if (do_json) {
 		switch_channel_set_variable(channel, "curl_response_data", print_json(pool, http_data));
 	} else {
 		SWITCH_STANDARD_STREAM(stream);
-		if(do_headers) {
+		if (do_headers) {
 			slist = http_data->headers;
-			while(slist) {
+			while (slist) {
 				stream.write_function(&stream, "%s\n", slist->data);
 				slist = slist->next;
 			}
@@ -299,17 +298,16 @@
 		stream.write_function(&stream, "%s", http_data->http_response ? http_data->http_response : "");
 		switch_channel_set_variable(channel, "curl_response_data", stream.data);
 	}
-	switch_channel_set_variable(channel, "curl_response_code", 
-	switch_core_sprintf(pool, "%ld", http_data->http_response_code));
+	switch_channel_set_variable(channel, "curl_response_code", switch_core_sprintf(pool, "%ld", http_data->http_response_code));
 	switch_channel_set_variable(channel, "curl_method", method);
 
 	switch_goto_status(SWITCH_STATUS_SUCCESS, done);
-	
-usage:
+
+  usage:
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: %s\n", SYNTAX);
 	switch_goto_status(status, done);
-	
-done:
+
+  done:
 	switch_safe_free(stream.data);
 	if (http_data && http_data->headers) {
 		curl_slist_free_all(http_data->headers);
@@ -318,6 +316,7 @@
 		switch_core_destroy_memory_pool(&pool);
 	}
 }
+
 SWITCH_STANDARD_API(curl_function)
 {
 	switch_status_t status;
@@ -334,7 +333,7 @@
 	int i = 0;
 
 	switch_memory_pool_t *pool = NULL;
-	
+
 	if (zstr(cmd)) {
 		switch_goto_status(SWITCH_STATUS_SUCCESS, usage);
 	}
@@ -350,20 +349,19 @@
 		if (argc < 1) {
 			switch_goto_status(SWITCH_STATUS_SUCCESS, usage);
 		}
-		
+
 		url = switch_core_strdup(pool, argv[0]);
-		
-		for (i =1; i < argc; i++) {
+
+		for (i = 1; i < argc; i++) {
 			if (!strcasecmp("headers", argv[i])) {
 				do_headers = SWITCH_TRUE;
 			} else if (!strcasecmp("json", argv[i])) {
 				do_json = SWITCH_TRUE;
-			} else if ( !strcasecmp("get", argv[i]) || 
-						!strcasecmp("head", argv[i])) {
+			} else if (!strcasecmp("get", argv[i]) || !strcasecmp("head", argv[i])) {
 				method = switch_core_strdup(pool, argv[i]);
 			} else if (!strcasecmp("post", argv[i])) {
 				method = "post";
-				if ( ++i < argc) { 
+				if (++i < argc) {
 					postdata = switch_core_strdup(pool, argv[i]);
 					switch_url_decode(postdata);
 				} else {
@@ -371,14 +369,14 @@
 				}
 			}
 		}
-		
+
 		http_data = do_lookup_url(pool, url, method, postdata);
 		if (do_json) {
 			stream->write_function(stream, "%s", print_json(pool, http_data));
 		} else {
-			if(do_headers) {
+			if (do_headers) {
 				slist = http_data->headers;
-				while(slist) {
+				while (slist) {
 					stream->write_function(stream, "%s\n", slist->data);
 					slist = slist->next;
 				}
@@ -389,11 +387,11 @@
 	}
 	switch_goto_status(SWITCH_STATUS_SUCCESS, done);
 
-usage:
+  usage:
 	stream->write_function(stream, "-ERR\n%s\n", SYNTAX);
 	switch_goto_status(status, done);
-	
-done: 
+
+  done:
 	if (http_data && http_data->headers) {
 		curl_slist_free_all(http_data->headers);
 	}
@@ -413,7 +411,7 @@
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	memset(&globals, 0, sizeof(globals));
-	
+
 	globals.pool = pool;
 
 	SWITCH_ADD_API(api_interface, "curl", "curl API", curl_function, SYNTAX);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_directory/mod_directory.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_directory/mod_directory.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_directory/mod_directory.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -40,19 +40,16 @@
 static const char *global_cf = "directory.conf";
 
 static char dir_sql[] =
-"CREATE TABLE directory_search (\n"
-"   hostname         VARCHAR(255),\n"
-"   uuid             VARCHAR(255),\n"
-"   extension        VARCHAR(255),\n"
-"   full_name        VARCHAR(255),\n"
-"   full_name_digit  VARCHAR(255),\n"
-"   first_name       VARCHAR(255),\n"
-"   first_name_digit VARCHAR(255),\n"
-"   last_name        VARCHAR(255),\n"
-"   last_name_digit  VARCHAR(255),\n"
-"   name_visible          INTEGER,\n"
-"   exten_visible         INTEGER\n"
-");\n";
+	"CREATE TABLE directory_search (\n"
+	"   hostname         VARCHAR(255),\n"
+	"   uuid             VARCHAR(255),\n"
+	"   extension        VARCHAR(255),\n"
+	"   full_name        VARCHAR(255),\n"
+	"   full_name_digit  VARCHAR(255),\n"
+	"   first_name       VARCHAR(255),\n"
+	"   first_name_digit VARCHAR(255),\n"
+	"   last_name        VARCHAR(255),\n"
+	"   last_name_digit  VARCHAR(255),\n" "   name_visible          INTEGER,\n" "   exten_visible         INTEGER\n" ");\n";
 
 #define DIR_RESULT_ITEM "directory_result_item"
 #define DIR_RESULT_SAY_NAME "directory_result_say_name"
@@ -113,51 +110,52 @@
 	PFLAG_DESTROY = 1 << 0
 } dir_flags_t;
 
-static int digit_matching_keypad(char letter) {
+static int digit_matching_keypad(char letter)
+{
 	int result = -1;
-	switch(toupper(letter)) {
-		case 'A':
-		case 'B':
-		case 'C':
-			result = 2;
-			break;
-		case 'D':
-		case 'E':
-		case 'F':
-			result = 3;
-			break;
-		case 'G':
-		case 'H':
-		case 'I':
-			result = 4;
-			break;
-		case 'J':
-		case 'K':
-		case 'L':
-			result = 5;
-			break;
-		case 'M':
-		case 'N':
-		case 'O':
-			result = 6;
-			break;
-		case 'P':
-		case 'Q':
-		case 'R':
-		case 'S':
-			result = 7;
-			break;
-		case 'T':
-		case 'U':
-		case 'V':
-			result = 8;
-			break;
-		case 'W':
-		case 'X':
-		case 'Y':
-		case 'Z':
-			result = 9;
-			break;
+	switch (toupper(letter)) {
+	case 'A':
+	case 'B':
+	case 'C':
+		result = 2;
+		break;
+	case 'D':
+	case 'E':
+	case 'F':
+		result = 3;
+		break;
+	case 'G':
+	case 'H':
+	case 'I':
+		result = 4;
+		break;
+	case 'J':
+	case 'K':
+	case 'L':
+		result = 5;
+		break;
+	case 'M':
+	case 'N':
+	case 'O':
+		result = 6;
+		break;
+	case 'P':
+	case 'Q':
+	case 'R':
+	case 'S':
+		result = 7;
+		break;
+	case 'T':
+	case 'U':
+	case 'V':
+		result = 8;
+		break;
+	case 'W':
+	case 'X':
+	case 'Y':
+	case 'Z':
+		result = 9;
+		break;
 	}
 
 
@@ -185,7 +183,7 @@
 		if (*d) {
 			*d = '\0';
 		}
-	}	
+	}
 	return dst;
 }
 
@@ -206,7 +204,7 @@
 	status = switch_core_db_persistant_execute(db, sql, 1);
 	switch_core_db_close(db);
 
-end:
+  end:
 	if (mutex) {
 		switch_mutex_unlock(mutex);
 	}
@@ -304,7 +302,7 @@
 		switch_core_db_close(db);
 	}
 
-end:
+  end:
 	if (mutex) {
 		switch_mutex_unlock(mutex);
 	}
@@ -337,34 +335,32 @@
 
 	profile->config_str_pool.pool = profile->pool;
 
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "next-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
-			&profile->next_key, "6", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "prev-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
-			&profile->prev_key, "4", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "next-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->next_key, "6", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "prev-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->prev_key, "4", &config_dtmf, NULL, NULL);
 	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "terminator-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
-			&profile->terminator_key, "#", &config_dtmf, NULL, NULL);
+						   &profile->terminator_key, "#", &config_dtmf, NULL, NULL);
 	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "switch-order-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
-			&profile->switch_order_key, "*", &config_dtmf, NULL, NULL);
+						   &profile->switch_order_key, "*", &config_dtmf, NULL, NULL);
 	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "select-name-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
-			&profile->select_name_key, "1", &config_dtmf, NULL, NULL);
+						   &profile->select_name_key, "1", &config_dtmf, NULL, NULL);
 	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "new-search-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
-			&profile->new_search_key, "3", &config_dtmf, NULL, NULL);
+						   &profile->new_search_key, "3", &config_dtmf, NULL, NULL);
 	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "search-order", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
-			&profile->search_order, "last_name", &profile->config_str_pool, NULL, NULL);
+						   &profile->search_order, "last_name", &profile->config_str_pool, NULL, NULL);
 	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "digit-timeout", SWITCH_CONFIG_INT, CONFIG_RELOADABLE,
-			&profile->digit_timeout, 3000, &config_int_digit_timeout, NULL, NULL);
+						   &profile->digit_timeout, 3000, &config_int_digit_timeout, NULL, NULL);
 	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "min-search-digits", SWITCH_CONFIG_INT, CONFIG_RELOADABLE,
-			&profile->min_search_digits, 3, &config_int_ht_0, NULL, NULL);
+						   &profile->min_search_digits, 3, &config_int_ht_0, NULL, NULL);
 	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "max-menu-attempts", SWITCH_CONFIG_INT, CONFIG_RELOADABLE,
-			&profile->max_menu_attempt, 3, &config_int_ht_0, NULL, NULL);
+						   &profile->max_menu_attempt, 3, &config_int_ht_0, NULL, NULL);
 	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "max-result", SWITCH_CONFIG_INT, CONFIG_RELOADABLE,
-			&profile->max_result, 5, &config_int_ht_0, NULL, NULL);
+						   &profile->max_result, 5, &config_int_ht_0, NULL, NULL);
 
 	return profile;
 
 }
 
-static dir_profile_t * load_profile(const char *profile_name)
+static dir_profile_t *load_profile(const char *profile_name)
 {
 	dir_profile_t *profile = NULL;
 	switch_xml_t x_profiles, x_profile, cfg, xml = NULL;
@@ -413,7 +409,7 @@
 		switch_core_hash_insert(globals.profile_hash, profile->name, profile);
 	}
 
-end:
+  end:
 	switch_xml_free(xml);
 
 	return profile;
@@ -451,7 +447,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static dir_profile_t * get_profile(const char *profile_name)
+static dir_profile_t *get_profile(const char *profile_name)
 {
 	dir_profile_t *profile = NULL;
 
@@ -469,7 +465,8 @@
 	return profile;
 }
 
-static switch_status_t populate_database(switch_core_session_t *session, dir_profile_t * profile, const char *domain_name) {
+static switch_status_t populate_database(switch_core_session_t *session, dir_profile_t *profile, const char *domain_name)
+{
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
 	char *sql = NULL;
@@ -561,8 +558,9 @@
 					firstNameDigit = string_to_keypad_digit(firstName);
 
 					/* add user into DB */
-					sql = switch_mprintf("insert into directory_search values('%q','%q','%q','%q','%q','%q','%q','%q','%q','%d','%d')", 
-							globals.hostname, switch_core_session_get_uuid(session), id, fullName, fullNameDigit, firstName, firstNameDigit, lastName, lastNameDigit, name_visible, exten_visible);
+					sql = switch_mprintf("insert into directory_search values('%q','%q','%q','%q','%q','%q','%q','%q','%q','%d','%d')",
+										 globals.hostname, switch_core_session_get_uuid(session), id, fullName, fullNameDigit, firstName, firstNameDigit,
+										 lastName, lastNameDigit, name_visible, exten_visible);
 
 					if (sqlvalues) {
 						sqltmp = sqlvalues;
@@ -580,10 +578,10 @@
 			}
 		}
 	}
-	sql = switch_mprintf("BEGIN;%s;COMMIT;",sqlvalues);
+	sql = switch_mprintf("BEGIN;%s;COMMIT;", sqlvalues);
 	directory_execute_sql(sql, profile->mutex);
 
-end:
+  end:
 	switch_safe_free(sql);
 	switch_safe_free(sqlvalues);
 	switch_event_destroy(&xml_params);
@@ -603,27 +601,27 @@
 static switch_status_t on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen)
 {
 	switch (itype) {
-		case SWITCH_INPUT_TYPE_DTMF:
-			{
-				switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
-				cbr_t *cbr = (cbr_t *) buf;
-				cbr->digit = dtmf->digit;
-				if (dtmf->digit == *cbr->profile->terminator_key || dtmf->digit == *cbr->profile->switch_order_key) {
-					return SWITCH_STATUS_BREAK;
-				}
+	case SWITCH_INPUT_TYPE_DTMF:
+		{
+			switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
+			cbr_t *cbr = (cbr_t *) buf;
+			cbr->digit = dtmf->digit;
+			if (dtmf->digit == *cbr->profile->terminator_key || dtmf->digit == *cbr->profile->switch_order_key) {
+				return SWITCH_STATUS_BREAK;
+			}
 
-				if (strlen(cbr->digits) < sizeof(cbr->digits) - 2) {
-					int at = strlen(cbr->digits);
-					cbr->digits[at++] = dtmf->digit;
-					cbr->digits[at] = '\0';
-				} else {
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "DTMF buffer is full\n");
-					return SWITCH_STATUS_BREAK;
-				}
+			if (strlen(cbr->digits) < sizeof(cbr->digits) - 2) {
+				int at = strlen(cbr->digits);
+				cbr->digits[at++] = dtmf->digit;
+				cbr->digits[at] = '\0';
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "DTMF buffer is full\n");
+				return SWITCH_STATUS_BREAK;
 			}
-			break;
-		default:
-			break;
+		}
+		break;
+	default:
+		break;
 	}
 
 	return SWITCH_STATUS_BREAK;
@@ -650,12 +648,12 @@
 	}
 
 	if (zstr_buf(buf)) {
-		switch_snprintf(macro, sizeof(macro), "phrase:%s:%d", DIR_RESULT_ITEM, cbt->want+1);
+		switch_snprintf(macro, sizeof(macro), "phrase:%s:%d", DIR_RESULT_ITEM, cbt->want + 1);
 		switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), 1, profile->terminator_key);
 	}
 
 	if (!zstr_buf(recorded_name) && zstr_buf(buf)) {
-        switch_ivr_read(session, 0, 1, recorded_name, NULL, buf, sizeof(buf), 1, profile->terminator_key);
+		switch_ivr_read(session, 0, 1, recorded_name, NULL, buf, sizeof(buf), 1, profile->terminator_key);
 
 	}
 	if (zstr_buf(recorded_name) && zstr_buf(buf)) {
@@ -667,7 +665,8 @@
 		switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), 1, profile->terminator_key);
 	}
 	if (zstr_buf(buf)) {
-		switch_snprintf(macro, sizeof(macro), "phrase:%s:%c,%c,%c,%c", DIR_RESULT_MENU, *profile->select_name_key, *profile->next_key, *profile->prev_key, *profile->new_search_key);
+		switch_snprintf(macro, sizeof(macro), "phrase:%s:%c,%c,%c,%c", DIR_RESULT_MENU, *profile->select_name_key, *profile->next_key, *profile->prev_key,
+						*profile->new_search_key);
 		switch_ivr_read(session, 0, 1, macro, NULL, buf, sizeof(buf), profile->digit_timeout, profile->terminator_key);
 	}
 
@@ -688,7 +687,8 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-switch_status_t gather_name_digit(switch_core_session_t *session, dir_profile_t *profile, search_params_t *params) {
+switch_status_t gather_name_digit(switch_core_session_t *session, dir_profile_t *profile, search_params_t *params)
+{
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	cbr_t cbr;
@@ -707,7 +707,7 @@
 
 		/* Gather the user Name */
 
-		switch_snprintf(macro, sizeof(macro), "%s:%c", (params->search_by_last_name?"last_name":"first_name"), *profile->switch_order_key);
+		switch_snprintf(macro, sizeof(macro), "%s:%c", (params->search_by_last_name ? "last_name" : "first_name"), *profile->switch_order_key);
 		switch_ivr_phrase_macro(session, DIR_INTRO, macro, NULL, &args);
 
 		while (switch_channel_ready(channel)) {
@@ -737,7 +737,8 @@
 	return status;
 }
 
-switch_status_t navigate_entrys(switch_core_session_t *session, dir_profile_t *profile, search_params_t *params) {
+switch_status_t navigate_entrys(switch_core_session_t *session, dir_profile_t *profile, search_params_t *params)
+{
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	char *sql = NULL;
 	char entry_count[80] = "";
@@ -749,7 +750,10 @@
 	cbt.buf = entry_count;
 	cbt.len = sizeof(entry_count);
 
-	sql = switch_mprintf("select count(*) from directory_search where hostname = '%q' and uuid = '%q' and name_visible = 1 and %s like '%q%%'", globals.hostname, switch_core_session_get_uuid(session), (params->search_by_last_name?"last_name_digit":"first_name_digit"), params->digits);
+	sql =
+		switch_mprintf("select count(*) from directory_search where hostname = '%q' and uuid = '%q' and name_visible = 1 and %s like '%q%%'",
+					   globals.hostname, switch_core_session_get_uuid(session), (params->search_by_last_name ? "last_name_digit" : "first_name_digit"),
+					   params->digits);
 
 	directory_execute_sql_callback(profile->mutex, sql, sql2str_callback, &cbt);
 	switch_safe_free(sql);
@@ -773,7 +777,10 @@
 	memset(&listing_cbt, 0, sizeof(listing_cbt));
 	listing_cbt.params = params;
 
-	sql = switch_mprintf("select extension, full_name, last_name, first_name, name_visible, exten_visible from directory_search where hostname = '%q' and uuid = '%q' and name_visible = 1 and %s like '%q%%' order by last_name, first_name", globals.hostname, switch_core_session_get_uuid(session), (params->search_by_last_name?"last_name_digit":"first_name_digit"), params->digits);
+	sql =
+		switch_mprintf
+		("select extension, full_name, last_name, first_name, name_visible, exten_visible from directory_search where hostname = '%q' and uuid = '%q' and name_visible = 1 and %s like '%q%%' order by last_name, first_name",
+		 globals.hostname, switch_core_session_get_uuid(session), (params->search_by_last_name ? "last_name_digit" : "first_name_digit"), params->digits);
 
 	for (cur_entry = 0; cur_entry < result_count; cur_entry++) {
 		listing_cbt.index = 0;
@@ -812,7 +819,7 @@
 		}
 	}
 
-end:
+  end:
 	switch_safe_free(sql);
 	return status;
 
@@ -825,8 +832,8 @@
 	char *argv[6] = { 0 };
 	char *mydata = NULL;
 	const char *profile_name = NULL;
-	const char *domain_name = NULL; 
-	dir_profile_t * profile = NULL;
+	const char *domain_name = NULL;
+	dir_profile_t *profile = NULL;
 	int x = 0;
 	char *sql = NULL;
 	search_params_t s_param;
@@ -866,7 +873,7 @@
 		s_param.search_by_last_name = 0;
 	}
 	attempts = profile->max_menu_attempt;
-	s_param.try_again = 1;	
+	s_param.try_again = 1;
 	while (switch_channel_ready(channel) && (s_param.try_again && attempts-- > 0)) {
 		s_param.try_again = 0;
 		gather_name_digit(session, profile, &s_param);
@@ -895,7 +902,7 @@
 	sql = switch_mprintf("delete from directory_search where hostname = '%q' and uuid = '%q'", globals.hostname, switch_core_session_get_uuid(session));
 	directory_execute_sql(sql, profile->mutex);
 	switch_safe_free(sql);
-	profile_rwunlock(profile);	
+	profile_rwunlock(profile);
 }
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_directory_load)
@@ -954,7 +961,7 @@
 
 	switch_mutex_lock(globals.mutex);
 
-	while((hi = switch_hash_first(NULL, globals.profile_hash))) {
+	while ((hi = switch_hash_first(NULL, globals.profile_hash))) {
 		switch_hash_this(hi, &key, &keylen, &val);
 		profile = (dir_profile_t *) val;
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_distributor/mod_distributor.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_distributor/mod_distributor.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_distributor/mod_distributor.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -64,7 +64,7 @@
 static void destroy_node(struct dist_node *node)
 {
 	struct dist_node *old;
-	while(node) {
+	while (node) {
 		old = node;
 		node = node->next;
 		if (old->name) {
@@ -78,7 +78,7 @@
 {
 	struct dist_list *old;
 
-	while(list) {
+	while (list) {
 		old = list;
 		list = list->next;
 		destroy_node(old->nodes);
@@ -97,14 +97,14 @@
 
 
 
-static int load_config(int reloading) 
+static int load_config(int reloading)
 {
-	struct dist_list *main_list=NULL, *new_list, *old_list=NULL, *lp=NULL;
+	struct dist_list *main_list = NULL, *new_list, *old_list = NULL, *lp = NULL;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	char *cf = "distributor.conf";
 	switch_xml_t cfg, xml, lists, list, param;
-	
-	
+
+
 	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
 		return SWITCH_STATUS_TERM;
@@ -120,7 +120,7 @@
 	for (list = switch_xml_child(lists, "list"); list; list = list->next) {
 		const char *name = switch_xml_attr(list, "name");
 		const char *tweight = switch_xml_attr(list, "total-weight");
-		struct dist_node *node, *np=NULL;
+		struct dist_node *node, *np = NULL;
 		int target_weight = 10;
 		int accum = 0;
 
@@ -128,30 +128,30 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing NAME!\n");
 			continue;
 		}
-		
+
 		if (!zstr(tweight)) {
 			target_weight = atoi(tweight);
 		}
 
 		switch_zmalloc(new_list, sizeof(*new_list));
-		
+
 		new_list->name = strdup(name);
 		new_list->last = -1;
 		new_list->target_weight = target_weight;
-		
+
 		if (lp) {
 			lp->next = new_list;
 		} else {
 			main_list = new_list;
 		}
-		
+
 		lp = new_list;
-		
+
 		for (param = switch_xml_child(list, "node"); param; param = param->next) {
 			char *name = (char *) switch_xml_attr_soft(param, "name");
 			char *weight_val = (char *) switch_xml_attr_soft(param, "weight");
 			int weight = 0, tmp;
-			
+
 			if ((tmp = atoi(weight_val)) < 1) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Weight %d value incorrect, must be > 0\n", tmp);
 				continue;
@@ -163,24 +163,26 @@
 			}
 
 			if (accum + tmp > lp->target_weight) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Target Weight %d already met, ignoring subsequent entries.\n", lp->target_weight);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Target Weight %d already met, ignoring subsequent entries.\n",
+								  lp->target_weight);
 				continue;
 			}
 
 			accum += tmp;
 
 			weight = lp->target_weight - tmp;
-				
+
 			if (weight < 0 || weight > lp->target_weight) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Weight %d value incorrect, must be between 1 and %d\n", weight, lp->target_weight);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Weight %d value incorrect, must be between 1 and %d\n", weight,
+								  lp->target_weight);
 				continue;
 			}
-			
+
 			switch_zmalloc(node, sizeof(*node));
 			node->name = strdup(name);
 			node->weight = node->cur_weight = weight;
-			
 
+
 			if (np) {
 				np->next = node;
 			} else {
@@ -198,7 +200,7 @@
 
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Total weight does not add up to total weight %d\n", lp->target_weight);
 
-			for(np1 = lp->nodes; np1; np1 = np1->next) {
+			for (np1 = lp->nodes; np1; np1 = np1->next) {
 				np1->weight += lp->target_weight - ea;
 			}
 
@@ -230,7 +232,7 @@
 {
 	struct dist_node *np;
 
-	for(np = list->nodes; np; np = np->next) {
+	for (np = list->nodes; np; np = np->next) {
 		np->cur_weight = np->weight;
 	}
 	list->last = -1;
@@ -243,9 +245,9 @@
 	struct dist_node *np, *match = NULL;
 	int x = 0, mx = 0;
 	int matches = 0, loops = 0;
-	
-	for(;;) {
 
+	for (;;) {
+
 		if (++loops > 1000) {
 			break;
 		}
@@ -255,7 +257,7 @@
 			list->last = -1;
 		}
 		match = NULL;
-		for(np = list->nodes; np; np = np->next) {
+		for (np = list->nodes; np; np = np->next) {
 			if (np->cur_weight < list->target_weight) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s %d/%d\n", np->name, np->cur_weight, list->target_weight);
 				matches++;
@@ -274,7 +276,7 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Choose %s\n", match->name);
 			return match;
 		}
-		
+
 		if (matches) {
 			list->last = -1;
 		} else {
@@ -294,7 +296,7 @@
 	char *str = NULL;
 
 	switch_mutex_lock(globals.mod_lock);
-	for(lp = globals.list; lp; lp = lp->next) {
+	for (lp = globals.list; lp; lp = lp->next) {
 		if (!strcasecmp(name, lp->name)) {
 			np = find_next(lp);
 			break;
@@ -307,14 +309,14 @@
 	switch_mutex_unlock(globals.mod_lock);
 
 	return str;
-	
+
 }
 
 SWITCH_STANDARD_APP(distributor_exec)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	char *ret = NULL;
-	
+
 	if (zstr(data)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "distributor requires an argument\n");
 		return;
@@ -370,11 +372,12 @@
 	globals.pool = pool;
 
 	load_config(SWITCH_FALSE);
-	
 
+
 	SWITCH_ADD_API(api_interface, "distributor", "Distributor API", distributor_function, "<list name>");
 	SWITCH_ADD_API(api_interface, "distributor_ctl", "Distributor API", distributor_ctl_function, "[reload]");
-	SWITCH_ADD_APP(app_interface, "distributor", "Distributor APP", "Distributor APP", distributor_exec, "<list name>", SAF_SUPPORT_NOMEDIA|SAF_ROUTING_EXEC);
+	SWITCH_ADD_APP(app_interface, "distributor", "Distributor APP", "Distributor APP", distributor_exec, "<list name>",
+				   SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
 
 
 	/* indicate that the module should continue to be loaded */

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_dptools/mod_dptools.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_dptools/mod_dptools.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_dptools/mod_dptools.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -46,6 +46,7 @@
 	int x = 0;
 	char *lbuf;
 	char *target = arg;
+	char delim = ',';
 
 	if (!caller_profile) {
 		caller_profile = switch_channel_get_caller_profile(channel);
@@ -59,13 +60,20 @@
 		target = caller_profile->destination_number;
 	}
 
-	if (!zstr(target) && (lbuf = switch_core_session_strdup(session, target))
-		&& (argc = switch_separate_string(lbuf, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+
+	if (zstr(target)) {
+		return NULL;
 	} else {
-		return NULL;
+		lbuf = switch_core_session_strdup(session, target);
 	}
 
+	if (*lbuf == 'm' && *(lbuf + 1) == ':' && *(lbuf + 3) == ':') {
+		delim = *(lbuf + 2);
+		lbuf += 4;
+	}
 
+	argc = switch_separate_string(lbuf, delim, argv, (sizeof(argv) / sizeof(argv[0])));
+
 	for (x = 0; x < argc; x++) {
 		char *app = argv[x];
 		char *data = strchr(app, ':');
@@ -81,7 +89,7 @@
 		switch_caller_extension_add_application(session, extension, app, data);
 	}
 
-	caller_profile->destination_number = (char *)caller_profile->rdnis;
+	caller_profile->destination_number = (char *) caller_profile->rdnis;
 	caller_profile->rdnis = SWITCH_BLANK_STRING;
 
 	return extension;
@@ -106,6 +114,8 @@
 			switch_ivr_resume_detect_speech(session);
 		} else if (!strcasecmp(argv[0], "stop")) {
 			switch_ivr_stop_detect_speech(session);
+		} else if (!strcasecmp(argv[0], "param")) {
+			switch_ivr_set_param_detect_speech(session, argv[1], argv[2]);
 		} else if (argc >= 3) {
 			switch_ivr_detect_speech(session, argv[0], argv[1], argv[2], argv[3], NULL);
 		}
@@ -169,7 +179,8 @@
 SWITCH_STANDARD_APP(mkdir_function)
 {
 	switch_dir_make_recursive(data, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session));
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s MKDIR: %s\n", switch_channel_get_name(switch_core_session_get_channel(session)), data);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s MKDIR: %s\n",
+					  switch_channel_get_name(switch_core_session_get_channel(session)), data);
 }
 
 #define SOFT_HOLD_SYNTAX "<unhold key> [<moh_a>] [<moh_b>]"
@@ -268,7 +279,7 @@
 		if (strchr(argv[2], '1')) {
 			bind_flags |= SBF_ONCE;
 		}
-		
+
 		if (switch_ivr_bind_dtmf_meta_session(session, kval, bind_flags, argv[3]) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Bind Error!\n");
 		}
@@ -367,7 +378,7 @@
 				if (e_data.total) {
 					for (x = 0; x < e_data.total && switch_channel_ready(channel); x++) {
 						/* If we have a group and 1000 concurrent calls, we will flood the logs. This check avoids this */
-						if ( !require_group )
+						if (!require_group)
 							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Spy: %s\n", e_data.uuid_list[x]);
 						if ((file = switch_channel_get_variable(channel, "eavesdrop_indicate_new"))) {
 							switch_ivr_play_file(session, NULL, file, NULL);
@@ -419,6 +430,56 @@
 	switch_ivr_set_user(session, data);
 }
 
+#define SET_AUDIO_LEVEL_SYNTAX "[read|write] <vol>"
+SWITCH_STANDARD_APP(set_audio_level_function)
+{
+	char *argv[2] = { 0 };
+	int argc = 0;
+	char *mydata;
+	int level = 0;
+
+	mydata = switch_core_session_strdup(session, data);
+	argc = switch_split(mydata, ' ', argv);
+
+	if (argc != 2) {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Error. USAGE: %s\n",
+						  switch_core_session_get_name(session), SET_AUDIO_LEVEL_SYNTAX);
+		return;
+	}
+
+	level = atoi(argv[1]);
+
+	switch_ivr_session_audio(session, "level", argv[0], level);
+
+
+}
+
+#define SET_MUTE_SYNTAX "[read|write] [[true|cn level]|false]"
+SWITCH_STANDARD_APP(set_mute_function)
+{
+	char *argv[2] = { 0 };
+	int argc = 0;
+	char *mydata;
+	int level = 0;
+
+	mydata = switch_core_session_strdup(session, data);
+	argc = switch_split(mydata, ' ', argv);
+
+	if (argc != 2) {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Error. USAGE: %s\n",
+						  switch_core_session_get_name(session), SET_MUTE_SYNTAX);
+		return;
+	}
+
+	if ((level = atoi(argv[1])) <= 0) {
+		level = switch_true(argv[1]);
+	}
+
+	switch_ivr_session_audio(session, "mute", argv[0], level);
+
+}
+
+
 SWITCH_STANDARD_APP(ring_ready_function)
 {
 	switch_channel_ring_ready(switch_core_session_get_channel(session));
@@ -653,8 +714,6 @@
 SWITCH_STANDARD_APP(answer_function)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	switch_channel_clear_flag(channel, CF_PROXY_MEDIA);
-	switch_channel_clear_flag(channel, CF_PROXY_MODE);
 	switch_channel_answer(channel);
 }
 
@@ -675,14 +734,12 @@
 		return;
 	}
 
-	switch_channel_presence(channel, argv[0], argv[1], argv[2]);	
+	switch_channel_presence(channel, argv[0], argv[1], argv[2]);
 }
 
 SWITCH_STANDARD_APP(pre_answer_function)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	switch_channel_clear_flag(channel, CF_PROXY_MEDIA);
-	switch_channel_clear_flag(channel, CF_PROXY_MODE);
 	switch_channel_pre_answer(channel);
 }
 
@@ -708,17 +765,6 @@
 	switch_core_session_receive_message(session, &msg);
 }
 
-SWITCH_STANDARD_APP(warning_function)
-{
-	switch_core_session_message_t msg = { 0 };
-
-	/* Tell the channel to redirect */
-	msg.from = __FILE__;
-	msg.string_arg = data;
-	msg.message_id = SWITCH_MESSAGE_INDICATE_WARNING;
-	switch_core_session_receive_message(session, &msg);
-}
-
 SWITCH_STANDARD_APP(respond_function)
 {
 	switch_core_session_message_t msg = { 0 };
@@ -744,7 +790,7 @@
 SWITCH_STANDARD_APP(set_function)
 {
 	char *var, *val = NULL;
-	
+
 	if (zstr(data)) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No variable name specified.\n");
 	} else {
@@ -765,7 +811,8 @@
 			expanded = switch_channel_expand_variables(channel, val);
 		}
 
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SET [%s]=[%s]\n", switch_channel_get_name(channel), var, expanded ? expanded : "UNDEF");
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SET [%s]=[%s]\n", switch_channel_get_name(channel), var,
+						  expanded ? expanded : "UNDEF");
 		switch_channel_set_variable_var_check(channel, var, expanded, SWITCH_FALSE);
 
 		if (expanded && expanded != val) {
@@ -814,7 +861,7 @@
 				val = NULL;
 			}
 		}
-		
+
 		switch_channel_set_profile_var(switch_core_session_get_channel(session), name, val);
 	}
 }
@@ -848,8 +895,8 @@
 			}
 		}
 
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "EXPORT %s[%s]=[%s]\n", local ? "" : "(REMOTE ONLY) ", var_name ? var_name : "",
-						  val ? val : "UNDEF");
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "EXPORT %s[%s]=[%s]\n", local ? "" : "(REMOTE ONLY) ",
+						  var_name ? var_name : "", val ? val : "UNDEF");
 		switch_channel_set_variable(channel, var, val);
 
 		if (var && val) {
@@ -956,11 +1003,11 @@
 						while (*p == ' ')
 							*p++ = '\0';
 						val = p;
-						if (!strcasecmp(var,"Event-Name")) {
+						if (!strcasecmp(var, "Event-Name")) {
 							switch_name_event(val, &event->event_id);
 							switch_event_del_header(event, var);
 							switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, var, val);
-						} else if (!strcasecmp(var,"Event-Subclass")) {
+						} else if (!strcasecmp(var, "Event-Subclass")) {
 							size_t len = strlen(val) + 1;
 							void *new = malloc(len);
 							switch_assert(new);
@@ -1000,7 +1047,8 @@
 			switch_clear_flag(caller_profile, SWITCH_CPF_HIDE_NAME);
 			switch_clear_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER);
 		} else {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "INVALID privacy mode specified. Use a valid mode [no|yes|name|full|number].\n");
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
+							  "INVALID privacy mode specified. Use a valid mode [no|yes|name|full|number].\n");
 		}
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Set Privacy to %s [%d]\n", data, caller_profile->flags);
 	}
@@ -1069,7 +1117,7 @@
 SWITCH_STANDARD_API(presence_api_function)
 {
 	switch_event_t *event;
-	char *lbuf = NULL , *argv[4];
+	char *lbuf = NULL, *argv[4];
 	int argc = 0;
 	switch_event_types_t type = SWITCH_EVENT_PRESENCE_IN;
 	int need = 4;
@@ -1115,7 +1163,7 @@
 	switch_safe_free(lbuf);
 	return SWITCH_STATUS_SUCCESS;
 
- error:
+  error:
 
 	switch_safe_free(lbuf);
 	stream->write_function(stream, "Invalid: presence %s", PRESENCE_USAGE);
@@ -1130,8 +1178,7 @@
 	if (!zstr(cmd) && (lbuf = strdup(cmd))
 		&& (argc = switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0])))) >= 4) {
 
-		if (switch_core_chat_send(argv[0], "dp", argv[1], argv[2], "", argv[3],
-								  !zstr(argv[4]) ? argv[4] : NULL , "") == SWITCH_STATUS_SUCCESS) {
+		if (switch_core_chat_send(argv[0], "dp", argv[1], argv[2], "", argv[3], !zstr(argv[4]) ? argv[4] : NULL, "") == SWITCH_STATUS_SUCCESS) {
 			stream->write_function(stream, "Sent");
 		} else {
 			stream->write_function(stream, "Error! Message Not Sent");
@@ -1163,7 +1210,7 @@
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_event_t *params;
-	const char *name = (const char*)data;
+	const char *name = (const char *) data;
 
 	if (channel) {
 		switch_xml_t cxml = NULL, cfg = NULL, xml_menus = NULL, xml_menu = NULL;
@@ -1191,7 +1238,7 @@
 						&& switch_ivr_menu_stack_xml_build(xml_ctx, &menu_stack, xml_menus, xml_menu) == SWITCH_STATUS_SUCCESS) {
 						switch_xml_free(cxml);
 						cxml = NULL;
-						switch_ivr_menu_execute(session, menu_stack, (char*)name, NULL);
+						switch_ivr_menu_execute(session, menu_stack, (char *) name, NULL);
 						switch_ivr_menu_stack_free(menu_stack);
 					} else {
 						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Unable to create menu\n");
@@ -1361,7 +1408,7 @@
 			for (p = terminators; p && *p; p++) {
 				if (*p == dtmf->digit) {
 					switch_snprintf(sbuf, sizeof(sbuf), "%c", *p);
-					switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, sbuf );
+					switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, sbuf);
 					return SWITCH_STATUS_BREAK;
 				}
 			}
@@ -1389,7 +1436,7 @@
 			args.input_callback = on_dtmf;
 			args.buf = buf;
 			args.buflen = sizeof(buf);
-			switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, "" );
+			switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, "");
 		}
 
 		switch_ivr_sleep(session, ms, SWITCH_TRUE, &args);
@@ -1460,7 +1507,7 @@
 	args.buf = buf;
 	args.buflen = sizeof(buf);
 
-	switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, "" );
+	switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, "");
 
 	switch_ivr_speak_text(session, engine, voice, text, &args);
 }
@@ -1539,7 +1586,8 @@
 			switch_stream_handle_t stream = { 0 };
 			SWITCH_STANDARD_STREAM(stream);
 			switch_api_execute("uuid_bridge", id, NULL, &stream);
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "\nHangup Command uuid_bridge(%s):\n%s\n", id, switch_str_nil((char *) stream.data));
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "\nHangup Command uuid_bridge(%s):\n%s\n", id,
+							  switch_str_nil((char *) stream.data));
 			switch_safe_free(stream.data);
 		}
 
@@ -1563,9 +1611,8 @@
 	}
 
 	switch_channel_set_variable(channel, SWITCH_SOFT_HOLDING_UUID_VARIABLE, bond);
-	switch_channel_set_flag(channel, CF_XFER_ZOMBIE);
 
-	if (switch_ivr_originate(session, &peer_session, &cause, data, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL) 
+	if (switch_ivr_originate(session, &peer_session, &cause, data, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL)
 		!= SWITCH_STATUS_SUCCESS || !peer_session) {
 		goto end;
 	}
@@ -1579,31 +1626,40 @@
 	switch_channel_clear_flag(peer_channel, CF_INNER_BRIDGE);
 	switch_channel_clear_flag(channel, CF_INNER_BRIDGE);
 
-	if (switch_channel_down(peer_channel)) {
+	if (zstr(bond) && switch_channel_down(peer_channel)) {
 		switch_core_session_rwunlock(peer_session);
 		goto end;
 	}
 
 	if (bond) {
 		char buf[128] = "";
+		int br = 0;
 
-		if (!switch_channel_ready(channel)) {
-			switch_ivr_uuid_bridge(switch_core_session_get_uuid(peer_session), bond);
-		} else if ((b_session = switch_core_session_locate(bond))) {
-			switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
-			switch_snprintf(buf, sizeof(buf), "%s %s", switch_core_session_get_uuid(peer_session), switch_core_session_get_uuid(session));
-			switch_channel_set_variable(b_channel, "xfer_uuids", buf);
+		switch_channel_set_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE, bond);
 
-			switch_snprintf(buf, sizeof(buf), "%s %s", switch_core_session_get_uuid(peer_session), bond);
-			switch_channel_set_variable(channel, "xfer_uuids", buf);
+		if (!switch_channel_down(peer_channel)) {
+			if (!switch_channel_ready(channel)) {
+				switch_ivr_uuid_bridge(switch_core_session_get_uuid(peer_session), bond);
+				br++;
+			} else if ((b_session = switch_core_session_locate(bond))) {
+				switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
+				switch_snprintf(buf, sizeof(buf), "%s %s", switch_core_session_get_uuid(peer_session), switch_core_session_get_uuid(session));
+				switch_channel_set_variable(b_channel, "xfer_uuids", buf);
 
-			switch_core_event_hook_add_state_change(session, hanguphook);
-			switch_core_event_hook_add_state_change(b_session, hanguphook);
+				switch_snprintf(buf, sizeof(buf), "%s %s", switch_core_session_get_uuid(peer_session), bond);
+				switch_channel_set_variable(channel, "xfer_uuids", buf);
 
-			switch_core_session_rwunlock(b_session);
+				switch_core_event_hook_add_state_change(session, hanguphook);
+				switch_core_event_hook_add_state_change(b_session, hanguphook);
+
+				switch_core_session_rwunlock(b_session);
+			}
 		}
 
-		switch_channel_set_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE, bond);
+		if (!br) {
+			switch_ivr_uuid_bridge(switch_core_session_get_uuid(session), bond);
+		}
+
 	}
 
 	switch_core_session_rwunlock(peer_session);
@@ -1762,11 +1818,11 @@
 
 	if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
 		&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) == 4) {
-		
+
 		args.input_callback = on_dtmf;
-		
-		switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, "" );
-		
+
+		switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, "");
+
 		switch_ivr_say(session, argv[3], argv[0], argv[1], argv[2], &args);
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: %s\n", SAY_SYNTAX);
@@ -1790,15 +1846,16 @@
 		if ((mdata = strchr(macro, ','))) {
 			*mdata++ = '\0';
 		}
-		
+
 		lang = switch_channel_get_variable(channel, "language");
 
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Execute %s(%s) lang %s\n", macro, switch_str_nil(mdata), switch_str_nil(lang));
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Execute %s(%s) lang %s\n", macro, switch_str_nil(mdata),
+						  switch_str_nil(lang));
 
 		args.input_callback = on_dtmf;
-		
-		switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, "" );
 
+		switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, "");
+
 		status = switch_ivr_phrase_macro(session, macro, mdata, lang, &args);
 	} else {
 		status = SWITCH_STATUS_NOOP;
@@ -1827,10 +1884,10 @@
 	switch_file_handle_t fh = { 0 };
 	char *p;
 	const char *file = NULL;
-	
+
 	if (data) {
 		file = switch_core_session_strdup(session, data);
-		if ((p = strchr(file, '@')) && *(p+1) == '@') {
+		if ((p = strchr(file, '@')) && *(p + 1) == '@') {
 			*p = '\0';
 			p += 2;
 			if (p && *p) {
@@ -1843,7 +1900,7 @@
 
 	args.input_callback = on_dtmf;
 
-	switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, "" );
+	switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, "");
 
 	status = switch_ivr_play_file(session, &fh, file, &args);
 
@@ -1869,8 +1926,8 @@
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	const char *file = data;
-	
-	while(switch_channel_ready(channel)) {
+
+	while (switch_channel_ready(channel)) {
 		status = switch_ivr_play_file(session, NULL, file, NULL);
 
 		if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
@@ -1917,7 +1974,7 @@
 
 	args.input_callback = on_dtmf;
 
-	switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, "" );
+	switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, "");
 
 	switch_ivr_gentones(session, tone_script, loops, &args);
 }
@@ -2009,7 +2066,7 @@
 
 	args.input_callback = on_dtmf;
 
-	switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, "" );
+	switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, "");
 
 	status = switch_ivr_record_file(session, &fh, path, &args, limit);
 
@@ -2020,7 +2077,7 @@
 
 SWITCH_STANDARD_APP(preprocess_session_function)
 {
-	switch_ivr_preprocess_session(session, (char *)data);
+	switch_ivr_preprocess_session(session, (char *) data);
 }
 
 SWITCH_STANDARD_APP(record_session_function)
@@ -2038,7 +2095,7 @@
 	/* Search for a space then a plus followed by only numbers at the end of the path, 
 	   if found trim any spaces to the left/right of the plus use the left side as the
 	   path and right side as a time limit on the recording
-	*/
+	 */
 
 	/* if we find a + and the character before it is a space */
 	if ((path_end = strrchr(path, '+')) && path_end > path && *(path_end - 1) == ' ') {
@@ -2051,7 +2108,7 @@
 			path_end--;
 
 			/* trim spaces to the left of the plus */
-			while(path_end > path && *path_end == ' ') {
+			while (path_end > path && *path_end == ' ') {
 				path_end--;
 			}
 
@@ -2114,15 +2171,15 @@
 	args.input_callback = camp_fire;
 	args.buf = dbuf;
 	args.buflen = sizeof(dbuf);
-	
+
 	switch_core_session_read_lock(session);
 
 	/* don't set this to a local_stream:// or you will not be happy */
 	if ((greet = switch_channel_get_variable(channel, "campon_announce_sound"))) {
 		status = switch_ivr_play_file(session, NULL, greet, &args);
 	}
-	
-	while(stake->running && switch_channel_ready(channel)) {
+
+	while (stake->running && switch_channel_ready(channel)) {
 		if (status != SWITCH_STATUS_BREAK) {
 			if (!strcasecmp(moh, "silence")) {
 				status = switch_ivr_collect_digits_callback(session, &args, 0, 0);
@@ -2156,7 +2213,7 @@
 	switch_threadattr_t *thd_attr = NULL;
 	char *camp_data = NULL;
 	switch_status_t status;
-	
+
 	if (zstr(data)) {
 		return;
 	}
@@ -2167,7 +2224,7 @@
 	if ((v_campon = switch_channel_get_variable(caller_channel, "campon")) && switch_true(v_campon)) {
 		const char *cid_name = NULL;
 		const char *cid_number = NULL;
-		
+
 		if (!(cid_name = switch_channel_get_variable(caller_channel, "effective_caller_id_name"))) {
 			cid_name = switch_channel_get_variable(caller_channel, "caller_id_name");
 		}
@@ -2188,7 +2245,7 @@
 		v_campon_timeout = switch_channel_get_variable(caller_channel, "campon_timeout");
 		v_campon_sleep = switch_channel_get_variable(caller_channel, "campon_sleep");
 		v_campon_fallback_exten = switch_channel_get_variable(caller_channel, "campon_fallback_exten");
-		
+
 		if (v_campon_retries) {
 			if ((tmp = atoi(v_campon_retries)) > 0) {
 				campon_retries = tmp;
@@ -2211,10 +2268,10 @@
 		camping = 1;
 
 		if (cid_name && cid_number) {
-			camp_data = switch_core_session_sprintf(session, "{origination_caller_id_name='%s',origination_caller_id_number='%s'}%s", 
+			camp_data = switch_core_session_sprintf(session, "{origination_caller_id_name='%s',origination_caller_id_number='%s'}%s",
 													cid_name, cid_number, data);
 		} else {
-			camp_data = (char *)data;
+			camp_data = (char *) data;
 		}
 
 		if (!(moh = switch_channel_get_variable(caller_channel, "hold_music"))) {
@@ -2224,22 +2281,22 @@
 		do {
 			fail = 0;
 			status = switch_ivr_originate(NULL, &peer_session, &cause, camp_data, campon_timeout, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL);
-			
+
 			if (!switch_channel_ready(caller_channel)) {
 				fail = 1;
 				break;
 			}
-			
+
 			if (status == SWITCH_STATUS_SUCCESS) {
 				camping = 0;
 				break;
 			} else {
 				fail = 1;
 			}
-			
+
 			if (camping) {
-				
-				if (!thread_started && fail && moh && !switch_channel_test_flag(caller_channel, CF_PROXY_MODE) && 
+
+				if (!thread_started && fail && moh && !switch_channel_test_flag(caller_channel, CF_PROXY_MODE) &&
 					!switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA) &&
 					!switch_true(switch_channel_get_variable(caller_channel, "bypass_media"))) {
 					switch_threadattr_create(&thd_attr, switch_core_session_get_pool(session));
@@ -2260,15 +2317,15 @@
 
 				if (fail) {
 					int64_t wait = campon_sleep * 1000000;
-					
-					while(stake.running && wait > 0 && switch_channel_ready(caller_channel)) {
+
+					while (stake.running && wait > 0 && switch_channel_ready(caller_channel)) {
 						switch_yield(100000);
 						wait -= 100000;
 					}
 				}
 			}
 		} while (camping && switch_channel_ready(caller_channel));
-		
+
 		if (thread) {
 			stake.running = 0;
 			switch_channel_set_flag(caller_channel, CF_NOT_READY);
@@ -2276,17 +2333,18 @@
 		}
 
 		switch_channel_clear_flag(caller_channel, CF_NOT_READY);
-		
+
 		if (stake.do_xfer && !zstr(v_campon_fallback_exten)) {
-			switch_ivr_session_transfer(session, 
-										v_campon_fallback_exten, 
+			switch_ivr_session_transfer(session,
+										v_campon_fallback_exten,
 										switch_channel_get_variable(caller_channel, "campon_fallback_dialplan"),
 										switch_channel_get_variable(caller_channel, "campon_fallback_context"));
 			return;
 		}
 
 	} else {
-		if ((status = switch_ivr_originate(session, &peer_session, &cause, data, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL)) != SWITCH_STATUS_SUCCESS) {
+		if ((status =
+			 switch_ivr_originate(session, &peer_session, &cause, data, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL)) != SWITCH_STATUS_SUCCESS) {
 			fail = 1;
 		}
 	}
@@ -2299,34 +2357,34 @@
 		   'true' to continue on all failures.
 		   'false' to not continue.
 		   A list of codes either names or numbers eg "user_busy,normal_temporary_failure,603"
-		   failure_causes acts as the opposite version	
+		   failure_causes acts as the opposite version  
 		   EXCEPTION... ATTENDED_TRANSFER never is a reason to continue.......
 		 */
 		if (cause != SWITCH_CAUSE_ATTENDED_TRANSFER) {
 			if (continue_on_fail || failure_causes) {
 				const char *cause_str;
 				char cause_num[35] = "";
-																
+
 				cause_str = switch_channel_cause2str(cause);
 				switch_snprintf(cause_num, sizeof(cause_num), "%u", cause);
-			
+
 				if (failure_causes) {
 					char *lbuf = switch_core_session_strdup(session, failure_causes);
 					char *argv[256] = { 0 };
 					int argc = switch_separate_string(lbuf, ',', argv, (sizeof(argv) / sizeof(argv[0])));
 					int i, x = 0;
-					
+
 					for (i = 0; i < argc; i++) {
 						if (!strcasecmp(argv[i], cause_str) || !strcasecmp(argv[i], cause_num)) {
 							x++;
 							break;
 						}
-						if (!x) {
-							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
-											  "Failiure causes [%s]:  Cause: %s\n", failure_causes, cause_str);
-							return;
-						}
 					}
+					if (!x) {
+						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+										  "Failure causes [%s]:  Cause: %s\n", failure_causes, cause_str);
+						return;
+					}
 				}
 
 				if (continue_on_fail) {
@@ -2337,10 +2395,10 @@
 						char *argv[256] = { 0 };
 						int argc = switch_separate_string(lbuf, ',', argv, (sizeof(argv) / sizeof(argv[0])));
 						int i;
-						
+
 						for (i = 0; i < argc; i++) {
 							if (!strcasecmp(argv[i], cause_str) || !strcasecmp(argv[i], cause_num)) {
-								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
+								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
 												  "Continue on fail [%s]:  Cause: %s\n", continue_on_fail, cause_str);
 								return;
 							}
@@ -2359,7 +2417,7 @@
 		}
 		return;
 	} else {
-		
+
 		if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE)) {
 			switch_ivr_signal_bridge(session, peer_session);
 		} else {
@@ -2385,13 +2443,14 @@
 				b_key = NULL;
 			}
 
-			if (switch_true(switch_channel_get_variable(caller_channel, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE))) {
+			if (switch_true(switch_channel_get_variable(caller_channel, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE)) ||
+				switch_true(switch_channel_get_variable(peer_channel, SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE))) {
 				switch_channel_set_flag(caller_channel, CF_BYPASS_MEDIA_AFTER_BRIDGE);
 			}
 
-			switch_ivr_multi_threaded_bridge(session, peer_session, func, a_key, a_key);
+			switch_ivr_multi_threaded_bridge(session, peer_session, func, a_key, b_key);
 		}
-		
+
 		if (peer_session) {
 			switch_core_session_rwunlock(peer_session);
 		}
@@ -2401,17 +2460,19 @@
 /* fake chan_error */
 switch_endpoint_interface_t *error_endpoint_interface;
 static switch_call_cause_t error_outgoing_channel(switch_core_session_t *session,
-												 switch_event_t *var_event,
-												 switch_caller_profile_t *outbound_profile,
-												 switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
+												  switch_event_t *var_event,
+												  switch_caller_profile_t *outbound_profile,
+												  switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+												  switch_call_cause_t *cancel_cause);
 switch_io_routines_t error_io_routines = {
 	/*.outgoing_channel */ error_outgoing_channel
 };
 
 static switch_call_cause_t error_outgoing_channel(switch_core_session_t *session,
-												 switch_event_t *var_event,
-												 switch_caller_profile_t *outbound_profile,
-												 switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
+												  switch_event_t *var_event,
+												  switch_caller_profile_t *outbound_profile,
+												  switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+												  switch_call_cause_t *cancel_cause)
 {
 	switch_call_cause_t cause = switch_channel_str2cause(outbound_profile->destination_number);
 	if (cause == SWITCH_CAUSE_NONE) {
@@ -2425,17 +2486,19 @@
 /* fake chan_group */
 switch_endpoint_interface_t *group_endpoint_interface;
 static switch_call_cause_t group_outgoing_channel(switch_core_session_t *session,
-												 switch_event_t *var_event,
-												 switch_caller_profile_t *outbound_profile,
-												 switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
+												  switch_event_t *var_event,
+												  switch_caller_profile_t *outbound_profile,
+												  switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+												  switch_call_cause_t *cancel_cause);
 switch_io_routines_t group_io_routines = {
 	/*.outgoing_channel */ group_outgoing_channel
 };
 
 static switch_call_cause_t group_outgoing_channel(switch_core_session_t *session,
-												 switch_event_t *var_event,
-												 switch_caller_profile_t *outbound_profile,
-												 switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
+												  switch_event_t *var_event,
+												  switch_caller_profile_t *outbound_profile,
+												  switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+												  switch_call_cause_t *cancel_cause)
 {
 	char *group = NULL;
 	switch_call_cause_t cause = SWITCH_CAUSE_NONE;
@@ -2450,33 +2513,32 @@
 
 	group = strdup(outbound_profile->destination_number);
 
-	if (!group) goto done;
-	
+	if (!group)
+		goto done;
+
 	if ((domain = strchr(group, '@'))) {
 		*domain++ = '\0';
 	} else {
 		domain = switch_core_get_variable("domain");
 	}
-	
+
 	if (!domain) {
 		goto done;
 	}
 
-	if (var_event && (skip=switch_event_get_header(var_event, "group_recurse_variables")) && switch_false(skip)) {
-		if ((var = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) || 
-			(var = switch_event_get_header(var_event, "leg_timeout"))) {
+	if (var_event && (skip = switch_event_get_header(var_event, "group_recurse_variables")) && switch_false(skip)) {
+		if ((var = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) || (var = switch_event_get_header(var_event, "leg_timeout"))) {
 			timelimit = atoi(var);
 		}
 		var_event = NULL;
 	}
 
 	template = switch_mprintf("${group_call(%s@%s)}", group, domain);
-	
+
 	if (session) {
 		switch_channel_t *channel = switch_core_session_get_channel(session);
 		dest = switch_channel_expand_variables(channel, template);
-		if ((var = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE)) ||
-			(var = switch_event_get_header(var_event, "leg_timeout"))) {
+		if ((var = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE)) || (var = switch_event_get_header(var_event, "leg_timeout"))) {
 			timelimit = atoi(var);
 		}
 	} else if (var_event) {
@@ -2491,28 +2553,27 @@
 	if (!dest) {
 		goto done;
 	}
-	
+
 	if (var_event) {
 		cid_name_override = switch_event_get_header(var_event, "origination_caller_id_name");
 		cid_num_override = switch_event_get_header(var_event, "origination_caller_id_number");
-		if ((var = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) ||
-			(var = switch_event_get_header(var_event, "leg_timeout"))) {
+		if ((var = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) || (var = switch_event_get_header(var_event, "leg_timeout"))) {
 			timelimit = atoi(var);
 		}
 	}
-	
+
 	if ((flags & SOF_FORKED_DIAL)) {
 		myflags |= SOF_NOBLOCK;
 	}
-	
-	
-	if (switch_ivr_originate(session, new_session, &cause, dest, timelimit, NULL, 
+
+
+	if (switch_ivr_originate(session, new_session, &cause, dest, timelimit, NULL,
 							 cid_name_override, cid_num_override, NULL, var_event, myflags, cancel_cause) == SWITCH_STATUS_SUCCESS) {
 		const char *context;
 		switch_caller_profile_t *cp;
-		
+
 		new_channel = switch_core_session_get_channel(*new_session);
-		
+
 		if ((context = switch_channel_get_variable(new_channel, "group_context"))) {
 			if ((cp = switch_channel_get_caller_profile(new_channel))) {
 				cp->context = switch_core_strdup(cp->pool, context);
@@ -2527,10 +2588,10 @@
 	if (dest && dest != template) {
 		switch_safe_free(dest);
 	}
-	
-	switch_safe_free(template);	
-	switch_safe_free(group);	
 
+	switch_safe_free(template);
+	switch_safe_free(group);
+
 	if (cause == SWITCH_CAUSE_NONE) {
 		cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
 	}
@@ -2545,7 +2606,8 @@
 static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
 												 switch_event_t *var_event,
 												 switch_caller_profile_t *outbound_profile,
-												 switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
+												 switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+												 switch_call_cause_t *cancel_cause);
 switch_io_routines_t user_io_routines = {
 	/*.outgoing_channel */ user_outgoing_channel
 };
@@ -2553,7 +2615,8 @@
 static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
 												 switch_event_t *var_event,
 												 switch_caller_profile_t *outbound_profile,
-												 switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
+												 switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+												 switch_call_cause_t *cancel_cause)
 {
 	switch_xml_t x_domain = NULL, xml = NULL, x_user = NULL, x_group = NULL, x_param, x_params;
 	char *user = NULL, *domain = NULL;
@@ -2571,22 +2634,22 @@
 
 	user = strdup(outbound_profile->destination_number);
 
-	if (!user) goto done;
+	if (!user)
+		goto done;
 
 	if ((domain = strchr(user, '@'))) {
 		*domain++ = '\0';
 	} else {
 		domain = switch_core_get_variable("domain");
 	}
-	
+
 	if (!domain) {
 		goto done;
 	}
-	
 
-	if (var_event && (skip=switch_event_get_header(var_event, "user_recurse_variables")) && switch_false(skip)) {
-		if ((var = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) || 
-			(var = switch_event_get_header(var_event, "leg_timeout"))) {
+
+	if (var_event && (skip = switch_event_get_header(var_event, "user_recurse_variables")) && switch_false(skip)) {
+		if ((var = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) || (var = switch_event_get_header(var_event, "leg_timeout"))) {
 			timelimit = atoi(var);
 		}
 		var_event = NULL;
@@ -2693,7 +2756,7 @@
 				switch_event_dup(&event, var_event);
 				switch_event_del_header(event, "dialed_user");
 				switch_event_del_header(event, "dialed_domain");
-				if ((varval = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) || 
+				if ((varval = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) ||
 					(varval = switch_event_get_header(var_event, "leg_timeout"))) {
 					timelimit = atoi(varval);
 				}
@@ -2714,10 +2777,12 @@
 
 		switch_snprintf(stupid, sizeof(stupid), "user/%s", user);
 		if (switch_stristr(stupid, d_dest)) {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Waddya Daft? You almost called '%s' in an infinate loop!\n", stupid);
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Waddya Daft? You almost called '%s' in an infinate loop!\n",
+							  stupid);
 			cause = SWITCH_CAUSE_INVALID_IE_CONTENTS;
-		} else if (switch_ivr_originate(session, new_session, &cause, d_dest, timelimit, NULL, 
-										cid_name_override, cid_num_override, outbound_profile, var_event, myflags, cancel_cause) == SWITCH_STATUS_SUCCESS) {
+		} else if (switch_ivr_originate(session, new_session, &cause, d_dest, timelimit, NULL,
+										cid_name_override, cid_num_override, outbound_profile, var_event, myflags,
+										cancel_cause) == SWITCH_STATUS_SUCCESS) {
 			const char *context;
 			switch_caller_profile_t *cp;
 
@@ -2761,7 +2826,7 @@
 	if (params) {
 		switch_event_destroy(&params);
 	}
-	
+
 	if (var_event && var_event_orig != var_event) {
 		switch_event_destroy(&var_event);
 	}
@@ -2788,6 +2853,11 @@
 	switch_channel_set_flag(switch_core_session_get_channel(session), CF_VERBOSE_EVENTS);
 }
 
+SWITCH_STANDARD_APP(early_hangup_function)
+{
+	switch_channel_set_flag(switch_core_session_get_channel(session), CF_EARLY_HANGUP);
+}
+
 #define WAIT_FOR_SILENCE_SYNTAX "<silence_thresh> <silence_hits> <listen_hits> <timeout_ms> [<file>]"
 SWITCH_STANDARD_APP(wait_for_silence_function)
 {
@@ -2795,7 +2865,7 @@
 	uint32_t thresh, silence_hits, listen_hits, timeout_ms = 0;
 	int argc;
 	char *lbuf = NULL;
-	
+
 	if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))
 		&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 3) {
 		thresh = atoi(argv[0]);
@@ -2813,8 +2883,8 @@
 			return;
 		}
 
-	} 
-	
+	}
+
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: %s\n", WAIT_FOR_SILENCE_SYNTAX);
 }
 
@@ -2824,12 +2894,17 @@
 	switch_event_t *event;
 
 	if (switch_event_create(&event, SWITCH_EVENT_RECV_MESSAGE) == SWITCH_STATUS_SUCCESS) {
-		if (proto) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Proto", proto);
-		if (from) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "From", from);
-		if (subject) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Subject", subject);
-		if (hint) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Hint", hint);
-		if (body) switch_event_add_body(event, "%s", body);
-		if (to) { 
+		if (proto)
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Proto", proto);
+		if (from)
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "From", from);
+		if (subject)
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Subject", subject);
+		if (hint)
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Hint", hint);
+		if (body)
+			switch_event_add_body(event, "%s", body);
+		if (to) {
 			const char *v;
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "To", to);
 			if ((v = switch_core_get_variable(to))) {
@@ -2843,18 +2918,18 @@
 
 		switch_event_destroy(&event);
 	}
-	
+
 	return SWITCH_STATUS_MEMERR;
 }
 
 static switch_status_t api_chat_send(const char *proto, const char *from, const char *to, const char *subject,
 									 const char *body, const char *type, const char *hint)
 {
-	if (to) { 
+	if (to) {
 		const char *v;
 		switch_stream_handle_t stream = { 0 };
 		char *cmd = NULL, *arg;
-		
+
 		if (!(v = switch_core_get_variable(to))) {
 			v = to;
 		}
@@ -2872,19 +2947,36 @@
 		switch_api_execute(cmd, arg, NULL, &stream);
 
 		if (proto) {
-			switch_core_chat_send(proto, "api", to, hint && strchr(hint, '/') ? hint : from, 
-								  !zstr(type) ? type : NULL, (char *) stream.data, NULL, NULL);
+			switch_core_chat_send(proto, "api", to, hint && strchr(hint, '/') ? hint : from, !zstr(type) ? type : NULL, (char *) stream.data, NULL, NULL);
 		}
 
 		switch_safe_free(stream.data);
-		
+
 		free(cmd);
 
 	}
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
+
+#define SESSION_LOGLEVEL_SYNTAX "<level>"
+SWITCH_STANDARD_APP(session_loglevel_function)
+{
+	if (!zstr(data)) {
+		switch_log_level_t level = switch_log_str2level(data);
+
+		if (level == SWITCH_LOG_INVALID) {
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid log level: %s\n", data);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setting log level \"%s\" on session\n", switch_log_level2str(level));
+			switch_core_session_set_loglevel(session, level);
+		}
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No log level specified\n");
+	}
+}
+
 #define SPEAK_DESC "Speak text to a channel via the tts interface"
 #define DISPLACE_DESC "Displace audio from a file to the channels input"
 #define SESS_REC_DESC "Starts a background recording of the entire session"
@@ -2924,7 +3016,7 @@
 
 	SWITCH_ADD_CHAT(chat_interface, "event", event_chat_send);
 	SWITCH_ADD_CHAT(chat_interface, "api", api_chat_send);
-	
+
 	SWITCH_ADD_API(api_interface, "strepoch", "Convert a date string into epoch time", strepoch_api_function, "<string>");
 	SWITCH_ADD_API(api_interface, "chat", "chat", chat_api_function, "<proto>|<from>|<to>|<message>|[<content-type>]");
 	SWITCH_ADD_API(api_interface, "strftime", "strftime", strftime_api_function, "<format_string>");
@@ -2932,6 +3024,9 @@
 	SWITCH_ADD_APP(app_interface, "privacy", "Set privacy on calls", "Set caller privacy on calls.", privacy_function, "off|on|name|full|number",
 				   SAF_SUPPORT_NOMEDIA);
 
+	SWITCH_ADD_APP(app_interface, "set_audio_level", "set volume", "set volume", set_audio_level_function, "", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "set_mute", "set mute", "set mute", set_mute_function, "", SAF_NONE);
+
 	SWITCH_ADD_APP(app_interface, "flush_dtmf", "flush any queued dtmf", "flush any queued dtmf", flush_dtmf_function, "", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "hold", "Send a hold message", "Send a hold message", hold_function, HOLD_SYNTAX, SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "unhold", "Send a un-hold message", "Send a un-hold message", unhold_function, UNHOLD_SYNTAX, SAF_SUPPORT_NOMEDIA);
@@ -2939,7 +3034,9 @@
 				   SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "check_acl", "Check an ip against an ACL list", "Check an ip against an ACL list", check_acl_function,
 				   "<ip> <acl | cidr> [<hangup_cause>]", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
-	SWITCH_ADD_APP(app_interface, "verbose_events", "Make ALL Events verbose.", "Make ALL Events verbose.", verbose_events_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
+	SWITCH_ADD_APP(app_interface, "verbose_events", "Make ALL Events verbose.", "Make ALL Events verbose.", verbose_events_function, "",
+				   SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
+	SWITCH_ADD_APP(app_interface, "early_hangup", "Enable early hangup", "", early_hangup_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
 	SWITCH_ADD_APP(app_interface, "sleep", "Pause a channel", SLEEP_LONG_DESC, sleep_function, "<pausemilliseconds>", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "delay_echo", "echo audio at a specified delay", "Delay n ms", delay_function, "<delay ms>", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "strftime", "strftime", "strftime", strftime_function, "[<epoch>|]<format string>", SAF_SUPPORT_NOMEDIA);
@@ -2949,19 +3046,23 @@
 	SWITCH_ADD_APP(app_interface, "answer", "Answer the call", "Answer the call for a channel.", answer_function, "", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "hangup", "Hangup the call", "Hangup the call for a channel.", hangup_function, "[<cause>]", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "set_name", "Name the channel", "Name the channel", set_name_function, "<name>", SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "presence", "Send Presence", "Send Presence.", presence_function, "<rpid> <status> [<id>]", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
-	SWITCH_ADD_APP(app_interface, "log", "Logs to the logger", LOG_LONG_DESC, log_function, "<log_level> <log_string>", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
+	SWITCH_ADD_APP(app_interface, "presence", "Send Presence", "Send Presence.", presence_function, "<rpid> <status> [<id>]",
+				   SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
+	SWITCH_ADD_APP(app_interface, "log", "Logs to the logger", LOG_LONG_DESC, log_function, "<log_level> <log_string>",
+				   SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
 	SWITCH_ADD_APP(app_interface, "info", "Display Call Info", "Display Call Info", info_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
 	SWITCH_ADD_APP(app_interface, "event", "Fire an event", "Fire an event", event_function, "", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
 	SWITCH_ADD_APP(app_interface, "sound_test", "Analyze Audio", "Analyze Audio", sound_test_function, "", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "export", "Export a channel variable across a bridge", EXPORT_LONG_DESC, export_function, "<varname>=<value>",
 				   SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
-	SWITCH_ADD_APP(app_interface, "set", "Set a channel variable", SET_LONG_DESC, set_function, "<varname>=<value>", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
+	SWITCH_ADD_APP(app_interface, "set", "Set a channel variable", SET_LONG_DESC, set_function, "<varname>=<value>",
+				   SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
 	SWITCH_ADD_APP(app_interface, "set_global", "Set a global variable", SET_GLOBAL_LONG_DESC, set_global_function, "<varname>=<value>",
 				   SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
 	SWITCH_ADD_APP(app_interface, "set_profile_var", "Set a caller profile variable", SET_PROFILE_VAR_LONG_DESC, set_profile_var_function,
 				   "<varname>=<value>", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
-	SWITCH_ADD_APP(app_interface, "unset", "Unset a channel variable", UNSET_LONG_DESC, unset_function, "<varname>", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
+	SWITCH_ADD_APP(app_interface, "unset", "Unset a channel variable", UNSET_LONG_DESC, unset_function, "<varname>",
+				   SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
 	SWITCH_ADD_APP(app_interface, "ring_ready", "Indicate Ring_Ready", "Indicate Ring_Ready on a channel.", ring_ready_function, "", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "remove_bugs", "Remove media bugs", "Remove all media bugs from a channel.", remove_bugs_function, "", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "break", "Break", "Set the break flag.", break_function, "", SAF_SUPPORT_NOMEDIA);
@@ -2971,8 +3072,6 @@
 				   SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "send_display", "Send session a new display", "Send session a new display.", display_function, "<text>",
 				   SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "send_warning", "Send session a popup", "Send session a popup.", warning_function, "<text>",
-				   SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "respond", "Send session respond", "Send a respond message to a session.", respond_function, "<respond_data>",
 				   SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "deflect", "Send call deflect", "Send a call deflect.", deflect_function, "<deflect_data>", SAF_SUPPORT_NOMEDIA);
@@ -2987,50 +3086,51 @@
 	SWITCH_ADD_APP(app_interface, "sched_transfer", SCHED_TRANSF_DESCR, SCHED_TRANSF_DESCR, sched_transfer_function,
 				   "[+]<time> <extension> <dialplan> <context>", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "execute_extension", "Execute an extension", "Execute an extension", exe_function, EXE_SYNTAX, SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "sched_heartbeat", "Enable Scheduled Heartbeat", "Enable Scheduled Heartbeat", 
+	SWITCH_ADD_APP(app_interface, "sched_heartbeat", "Enable Scheduled Heartbeat", "Enable Scheduled Heartbeat",
 				   sched_heartbeat_function, SCHED_HEARTBEAT_SYNTAX, SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "enable_heartbeat", "Enable Media Heartbeat", "Enable Media Heartbeat", 
+	SWITCH_ADD_APP(app_interface, "enable_heartbeat", "Enable Media Heartbeat", "Enable Media Heartbeat",
 				   heartbeat_function, HEARTBEAT_SYNTAX, SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "mkdir", "Create a directory", "Create a directory", mkdir_function, MKDIR_SYNTAX, SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "soft_hold", "Put a bridged channel on hold", "Put a bridged channel on hold", soft_hold_function, SOFT_HOLD_SYNTAX,
 				   SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "bind_meta_app", "Bind a key to an application", "Bind a key to an application", dtmf_bind_function, BIND_SYNTAX,
 				   SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "unbind_meta_app", "Unbind a key from an application", "Unbind a key from an application", dtmf_unbind_function, 
+	SWITCH_ADD_APP(app_interface, "unbind_meta_app", "Unbind a key from an application", "Unbind a key from an application", dtmf_unbind_function,
 				   UNBIND_SYNTAX, SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "intercept", "intercept", "intercept", intercept_function, INTERCEPT_SYNTAX, SAF_NONE);
-	SWITCH_ADD_APP(app_interface, "eavesdrop", "eavesdrop on a uuid", "eavesdrop on a uuid", eavesdrop_function, eavesdrop_SYNTAX, SAF_NONE);
-	SWITCH_ADD_APP(app_interface, "three_way", "three way call with a uuid", "three way call with a uuid", three_way_function, threeway_SYNTAX, SAF_NONE);
-	SWITCH_ADD_APP(app_interface, "set_user", "Set a User", "Set a User", set_user_function, SET_USER_SYNTAX, SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC );
+	SWITCH_ADD_APP(app_interface, "eavesdrop", "eavesdrop on a uuid", "eavesdrop on a uuid", eavesdrop_function, eavesdrop_SYNTAX, SAF_MEDIA_TAP);
+	SWITCH_ADD_APP(app_interface, "three_way", "three way call with a uuid", "three way call with a uuid", three_way_function, threeway_SYNTAX,
+				   SAF_MEDIA_TAP);
+	SWITCH_ADD_APP(app_interface, "set_user", "Set a User", "Set a User", set_user_function, SET_USER_SYNTAX, SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
 	SWITCH_ADD_APP(app_interface, "stop_dtmf", "stop inband dtmf", "Stop detecting inband dtmf.", stop_dtmf_session_function, "", SAF_NONE);
-	SWITCH_ADD_APP(app_interface, "start_dtmf", "Detect dtmf", "Detect inband dtmf on the session", dtmf_session_function, "", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "start_dtmf", "Detect dtmf", "Detect inband dtmf on the session", dtmf_session_function, "", SAF_MEDIA_TAP);
 	SWITCH_ADD_APP(app_interface, "stop_dtmf_generate", "stop inband dtmf generation", "Stop generating inband dtmf.",
 				   stop_dtmf_session_generate_function, "[write]", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "start_dtmf_generate", "Generate dtmf", "Generate inband dtmf on the session", dtmf_session_generate_function, "",
 				   SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "stop_tone_detect", "stop detecting tones", "Stop detecting tones", stop_fax_detect_session_function, "", SAF_NONE);
-	SWITCH_ADD_APP(app_interface, "fax_detect", "Detect faxes", "Detect fax send tone", fax_detect_session_function, "", SAF_NONE);
-	SWITCH_ADD_APP(app_interface, "tone_detect", "Detect tones", "Detect tones", tone_detect_session_function, "", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "fax_detect", "Detect faxes", "Detect fax send tone", fax_detect_session_function, "", SAF_MEDIA_TAP);
+	SWITCH_ADD_APP(app_interface, "tone_detect", "Detect tones", "Detect tones", tone_detect_session_function, "", SAF_MEDIA_TAP);
 	SWITCH_ADD_APP(app_interface, "echo", "Echo", "Perform an echo test against the calling channel", echo_function, "", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "park", "Park", "Park", park_function, "", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "park_state", "Park State", "Park State", park_state_function, "", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "gentones", "Generate Tones", "Generate tones to the channel", gentones_function, "<tgml_script>[|<loops>]", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "playback", "Playback File", "Playback a file to the channel", playback_function, "<path>", SAF_NONE);
-	SWITCH_ADD_APP(app_interface, "endless_playback", "Playback File Endlessly", "Endlessly Playback a file to the channel", 
+	SWITCH_ADD_APP(app_interface, "endless_playback", "Playback File Endlessly", "Endlessly Playback a file to the channel",
 				   endless_playback_function, "<path>", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "att_xfer", "Attended Transfer", "Attended Transfer", att_xfer_function, "<channel_url>", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "read", "Read Digits", "Read Digits", read_function, "<min> <max> <file> <var_name> <timeout> <terminators>", SAF_NONE);
-	SWITCH_ADD_APP(app_interface, "play_and_get_digits", "Play and get Digits", "Play and get Digits", 
+	SWITCH_ADD_APP(app_interface, "play_and_get_digits", "Play and get Digits", "Play and get Digits",
 				   play_and_get_digits_function, "<min> <max> <tries> <timeout> <terminators> <file> <invalid_file> <var_name> <regexp>", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "stop_record_session", "Stop Record Session", STOP_SESS_REC_DESC, stop_record_session_function, "<path>", SAF_NONE);
-	SWITCH_ADD_APP(app_interface, "record_session", "Record Session", SESS_REC_DESC, record_session_function, "<path> [+<timeout>]", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "record_session", "Record Session", SESS_REC_DESC, record_session_function, "<path> [+<timeout>]", SAF_MEDIA_TAP);
 	SWITCH_ADD_APP(app_interface, "record", "Record File", "Record a file from the channels input", record_function,
 				   "<path> [<time_limit_secs>] [<silence_thresh>] [<silence_hits>]", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "preprocess", "pre-process", "pre-process", preprocess_session_function, "", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "stop_displace_session", "Stop Displace File", "Stop Displacing to a file", stop_displace_session_function, "<path>",
 				   SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "displace_session", "Displace File", DISPLACE_DESC, displace_session_function, "<path> [<flags>] [+time_limit_ms]",
-				   SAF_NONE);
+				   SAF_MEDIA_TAP);
 	SWITCH_ADD_APP(app_interface, "speak", "Speak text", SPEAK_DESC, speak_function, "<engine>|<voice>|<text>", SAF_NONE);
 	SWITCH_ADD_APP(app_interface, "clear_speech_cache", "Clear Speech Handle Cache", "Clear Speech Handle Cache", clear_speech_cache_function, "",
 				   SAF_NONE);
@@ -3040,7 +3140,10 @@
 				   SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "say", "say", "say", say_function, SAY_SYNTAX, SAF_NONE);
 
-	SWITCH_ADD_APP(app_interface, "wait_for_silence", "wait_for_silence", "wait_for_silence", wait_for_silence_function, WAIT_FOR_SILENCE_SYNTAX, SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "wait_for_silence", "wait_for_silence", "wait_for_silence", wait_for_silence_function, WAIT_FOR_SILENCE_SYNTAX,
+				   SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "session_loglevel", "session_loglevel", "session_loglevel", session_loglevel_function, SESSION_LOGLEVEL_SYNTAX,
+				   SAF_SUPPORT_NOMEDIA);
 
 	SWITCH_ADD_DIALPLAN(dp_interface, "inline", inline_dialplan_hunt);
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_easyroute/mod_easyroute.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_easyroute/mod_easyroute.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_easyroute/mod_easyroute.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -38,22 +38,22 @@
 
 #include <switch.h>
 
-typedef struct easyroute_results{
-	char	limit[16];
-	char	dialstring[256];
-	char	group[16];
-	char	acctcode[17];
-	char	translated[17];
+typedef struct easyroute_results {
+	char limit[16];
+	char dialstring[256];
+	char group[16];
+	char acctcode[17];
+	char translated[17];
 } easyroute_results_t;
 
 
 typedef struct route_callback {
-	char	gateway[129];
-	char	group[129];
-	char	techprofile[129];
-	char	limit[129];
-	char	acctcode[129];
-	char	translated[17];
+	char gateway[129];
+	char group[129];
+	char techprofile[129];
+	char limit[129];
+	char acctcode[129];
+	char translated[17];
 } route_callback_t;
 
 static struct {
@@ -97,13 +97,13 @@
 	char *cf = "easyroute.conf";
 	switch_xml_t cfg, xml = NULL, param, settings;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	
+
 	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
 		status = SWITCH_STATUS_FALSE;
 		goto done;
 	}
-	
+
 	if ((settings = switch_xml_child(cfg, "settings"))) {
 		for (param = switch_xml_child(settings, "param"); param; param = param->next) {
 			char *var = (char *) switch_xml_attr_soft(param, "name");
@@ -123,8 +123,8 @@
 			}
 		}
 	}
-	
-done:
+
+  done:
 	if (zstr(globals.db_username)) {
 		set_global_db_username("root");
 	}
@@ -151,11 +151,11 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Opened ODBC Database!\n");
 		}
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: %s\n", globals.db_dsn);
-		if (!globals.custom_query){
-			if (switch_odbc_handle_exec(globals.master_odbc, "select count(*) from numbers", NULL) != SWITCH_STATUS_SUCCESS) {
+		if (!globals.custom_query) {
+			if (switch_odbc_handle_exec(globals.master_odbc, "select count(*) from numbers", NULL, NULL) != SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot find  SQL Database! (Where\'s the numbers table\?\?)\n");
 			}
-			if (switch_odbc_handle_exec(globals.master_odbc, "select count(*) from gateways", NULL) != SWITCH_STATUS_SUCCESS) {
+			if (switch_odbc_handle_exec(globals.master_odbc, "select count(*) from gateways", NULL, NULL) != SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot find  SQL Database! (Where\'s the gateways table\?\?)\n");
 			}
 		}
@@ -163,7 +163,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Connection (did you enable it?!)\n");
 	}
 
-reallydone:
+  reallydone:
 
 	if (xml) {
 		switch_xml_free(xml);
@@ -177,76 +177,77 @@
 	return status;
 }
 
-static char SQL_LOOKUP[] = "SELECT gateways.gateway_ip, gateways.group, gateways.limit, gateways.techprofile, numbers.acctcode, numbers.translated from gateways, numbers where numbers.number = '%q' and numbers.gateway_id = gateways.gateway_id limit 1;";
+static char SQL_LOOKUP[] =
+	"SELECT gateways.gateway_ip, gateways.group, gateways.limit, gateways.techprofile, numbers.acctcode, numbers.translated from gateways, numbers where numbers.number = '%q' and numbers.gateway_id = gateways.gateway_id limit 1;";
 
-static switch_status_t route_lookup(char *dn, easyroute_results_t *results, int noat, char *seperator)
-{	
+static switch_status_t route_lookup(char *dn, easyroute_results_t *results, int noat, char *separator)
+{
 	switch_status_t sstatus = SWITCH_STATUS_SUCCESS;
 	char *sql = NULL;
 	route_callback_t pdata;
 
 	if (!switch_odbc_available()) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, 
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
 						  "mod_easyroute requires core ODBC support. Please refer to the documentation on how to enable this\n");
 		return sstatus;
 	}
 
 	memset(&pdata, 0, sizeof(pdata));
-	if (!globals.custom_query){
+	if (!globals.custom_query) {
 		sql = switch_mprintf(SQL_LOOKUP, dn);
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,  "Doing static Query\n[%s]\n", sql);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Doing static Query\n[%s]\n", sql);
 	} else {
 		sql = switch_mprintf(globals.custom_query, dn);
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,  "Doing custom Query\n[%s]\n", sql);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Doing custom Query\n[%s]\n", sql);
 	}
 
-	if (globals.mutex){
+	if (globals.mutex) {
 		switch_mutex_lock(globals.mutex);
 	}
 	/* Do the Query */
-	if (switch_odbc_handle_callback_exec(globals.master_odbc, sql, route_callback, &pdata, NULL) == SWITCH_ODBC_SUCCESS){
+	if (switch_odbc_handle_callback_exec(globals.master_odbc, sql, route_callback, &pdata, NULL) == SWITCH_ODBC_SUCCESS) {
 		char tmp_profile[129];
 		char tmp_gateway[129];
 
 		if (zstr(pdata.limit)) {
-			switch_set_string(results->limit, "9999" );
+			switch_set_string(results->limit, "9999");
 		} else {
-			switch_set_string(results->limit, pdata.limit );
+			switch_set_string(results->limit, pdata.limit);
 		}
 
-		if (zstr(pdata.techprofile)){
+		if (zstr(pdata.techprofile)) {
 			switch_set_string(tmp_profile, globals.default_techprofile);
 		} else {
 			switch_set_string(tmp_profile, pdata.techprofile);
 		}
 
-		if (zstr(pdata.gateway)){
+		if (zstr(pdata.gateway)) {
 			switch_set_string(tmp_gateway, globals.default_gateway);
 		} else {
 			switch_set_string(tmp_gateway, pdata.gateway);
 		}
 
-		if (zstr(pdata.translated)){
+		if (zstr(pdata.translated)) {
 			switch_set_string(results->translated, dn);
 		} else {
 			switch_set_string(results->translated, pdata.translated);
 		}
 		if (noat) {
-			switch_snprintf(results->dialstring, 256, "%s/%s%s", tmp_profile , results->translated, tmp_gateway);
-		} else if (seperator) {
-			switch_snprintf(results->dialstring, 256, "%s/%s%s%s", tmp_profile , results->translated, seperator, tmp_gateway);
+			switch_snprintf(results->dialstring, 256, "%s/%s%s", tmp_profile, results->translated, tmp_gateway);
+		} else if (separator) {
+			switch_snprintf(results->dialstring, 256, "%s/%s%s%s", tmp_profile, results->translated, separator, tmp_gateway);
 		} else {
-			switch_snprintf(results->dialstring, 256, "%s/%s@%s", tmp_profile , results->translated, tmp_gateway);
+			switch_snprintf(results->dialstring, 256, "%s/%s@%s", tmp_profile, results->translated, tmp_gateway);
 		}
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,  "THE ROUTE [%s]\n", results->dialstring);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "THE ROUTE [%s]\n", results->dialstring);
 
-		if (zstr(pdata.group)){
+		if (zstr(pdata.group)) {
 			switch_set_string(results->group, "");
 		} else {
 			switch_set_string(results->group, pdata.group);
 		}
 
-		if (zstr(pdata.acctcode)){
+		if (zstr(pdata.acctcode)) {
 			switch_set_string(results->acctcode, "");
 		} else {
 			switch_set_string(results->acctcode, pdata.acctcode);
@@ -254,11 +255,11 @@
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "DB Error Setting Default Route!\n");
 		switch_set_string(results->limit, "9999");
-		if (noat){
+		if (noat) {
 			switch_snprintf(results->dialstring, 256, "%s/%s%s", globals.default_techprofile, dn, globals.default_gateway);
-		} else if (seperator){
-			switch_snprintf(results->dialstring, 256, "%s/%s%s%s", globals.default_techprofile, dn, seperator, globals.default_gateway);
-		} else { 
+		} else if (separator) {
+			switch_snprintf(results->dialstring, 256, "%s/%s%s%s", globals.default_techprofile, dn, separator, globals.default_gateway);
+		} else {
 			switch_snprintf(results->dialstring, 256, "%s/%s@%s", globals.default_techprofile, dn, globals.default_gateway);
 		}
 		switch_set_string(results->group, "");
@@ -267,7 +268,7 @@
 
 	switch_safe_free(sql);
 
-	if (globals.mutex){
+	if (globals.mutex) {
 		switch_mutex_unlock(globals.mutex);
 	}
 	return sstatus;
@@ -278,10 +279,10 @@
 	int argc = 0;
 	char *argv[4] = { 0 };
 	char *mydata = NULL;
-	char *destnum = NULL; 
+	char *destnum = NULL;
 
 	int noat = 0;
-	char *seperator = NULL;
+	char *separator = NULL;
 
 	easyroute_results_t results;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -289,23 +290,23 @@
 	if (!channel) {
 		return;
 	}
-	
+
 	if (!(mydata = switch_core_session_strdup(session, data))) {
 		return;
 	}
-	
+
 	if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
 		destnum = argv[0];
 		if (argc == 2) {
 			if (!strcasecmp(argv[1], "noat")) {
 				noat = 1;
-                        } else if (!strcasecmp(argv[1], "seperator")) {
-                                if (argc == 3){
-					switch_set_string(seperator, argv[2]);
+			} else if (!strcasecmp(argv[1], "separator")) {
+				if (argc == 3) {
+					switch_set_string(separator, argv[2]);
 				}
 			}
 		}
-		route_lookup(destnum, &results, noat, seperator);
+		route_lookup(destnum, &results, noat, separator);
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "EASY ROUTE DEST: [%s]\n", results.dialstring);
 		switch_channel_set_variable(channel, "easy_destnum", destnum);
 		switch_channel_set_variable(channel, "easy_dialstring", results.dialstring);
@@ -321,11 +322,11 @@
 	char *argv[4] = { 0 };
 	char *mydata = NULL;
 	char *destnum = NULL;
-	char *seperator = NULL;
+	char *separator = NULL;
 	int noat = 0;
 	easyroute_results_t results;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	
+
 	if (session) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "This function cannot be called from the dialplan.\n");
 		status = SWITCH_STATUS_FALSE;
@@ -337,39 +338,40 @@
 		status = SWITCH_STATUS_SUCCESS;
 		goto done;
 	}
-	
+
 	if (!cmd || !(mydata = strdup(cmd))) {
 		stream->write_function(stream, "Usage: easyroute <number>\n");
 		status = SWITCH_STATUS_SUCCESS;
 		goto done;
 	}
-	
+
 	if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
 		destnum = argv[0];
-		if (argc < 1 || argc > 3){
+		if (argc < 1 || argc > 3) {
 			stream->write_function(stream, "Invalid Input!\n");
 			status = SWITCH_STATUS_SUCCESS;
 			goto done;
-		} 
+		}
 		if (argc == 2) {
 			if (!strcasecmp(argv[1], "noat")) {
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Entering noat.\n");
 				noat = 1;
-                        } else if (!strcasecmp(argv[1], "seperator")) {
-                                if (argc == 3){
-					switch_set_string(seperator, argv[2]);
+			} else if (!strcasecmp(argv[1], "separator")) {
+				if (argc == 3) {
+					switch_set_string(separator, argv[2]);
 				}
 			}
 		}
-		
-		if (!route_lookup(destnum, &results, noat, seperator) == SWITCH_STATUS_SUCCESS) {
+
+		if (!route_lookup(destnum, &results, noat, separator) == SWITCH_STATUS_SUCCESS) {
 			stream->write_function(stream, "No Match!\n");
 			status = SWITCH_STATUS_SUCCESS;
 			goto done;
 		}
-		if (argc != 2){
+		if (argc != 2) {
 			stream->write_function(stream, "Number    \tLimit     \tGroup    \tAcctCode  \tDialstring\n");
-			stream->write_function(stream, "%-10s\t%-10s\t%-10s\t%-10s\t%s\n", destnum, results.limit, results.group, results.acctcode, results.dialstring);
+			stream->write_function(stream, "%-10s\t%-10s\t%-10s\t%-10s\t%s\n", destnum, results.limit, results.group, results.acctcode,
+								   results.dialstring);
 		} else {
 			if (!strncasecmp(argv[1], "dialstring", 10)) {
 				stream->write_function(stream, "%s", results.dialstring);
@@ -386,12 +388,12 @@
 				status = SWITCH_STATUS_SUCCESS;
 				goto done;
 			}
-		} 
+		}
 	} else {
 		stream->write_function(stream, "Invalid Input!\n");
 	}
-	
- done:
+
+  done:
 	switch_safe_free(mydata);
 	return status;
 }
@@ -400,21 +402,22 @@
 {
 	switch_api_interface_t *api_interface;
 	switch_application_interface_t *app_interface;
-	
+
 	memset(&globals, 0, sizeof(globals));
 	load_config();
-	
+
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	SWITCH_ADD_API(api_interface, "easyroute", "EasyRoute", easyroute_function, "");
-	SWITCH_ADD_APP(app_interface, "easyroute", "Perform an easyroute lookup", "Perform an easyroute lookup", easyroute_app_function, "<number>", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
-	
+	SWITCH_ADD_APP(app_interface, "easyroute", "Perform an easyroute lookup", "Perform an easyroute lookup", easyroute_app_function, "<number>",
+				   SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
+
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_easyroute_shutdown)
-{	
+{
 	switch_odbc_handle_disconnect(globals.master_odbc);
 	switch_safe_free(globals.db_username);
 	switch_safe_free(globals.db_password);

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_enum


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Win32
x64
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Win32
x64
Makefile.in
mod_enum.log
.deps
Makefile

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_enum/Makefile

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_enum/Makefile.am (from rev 16612, freeswitch/trunk/src/mod/applications/mod_enum/Makefile.am) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_enum/Makefile.am	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_enum/Makefile.am	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,14 @@
+include $(top_srcdir)/build/modmake.rulesam
+MODNAME=mod_enum
+
+UDNS_DIR=$(switch_srcdir)/libs/udns
+AM_CFLAGS += -I$(UDNS_DIR) -DHAVE_POLL
+
+mod_LTLIBRARIES = mod_enum.la
+mod_enum_la_SOURCES  = mod_enum.c 
+mod_enum_la_SOURCES += $(UDNS_DIR)/udns_dn.c $(UDNS_DIR)/udns_dntosp.c $(UDNS_DIR)/udns_parse.c $(UDNS_DIR)/udns_misc.c
+mod_enum_la_SOURCES += $(UDNS_DIR)/udns_rr_a.c $(UDNS_DIR)/udns_rr_ptr.c $(UDNS_DIR)/udns_rr_mx.c $(UDNS_DIR)/udns_rr_txt.c $(UDNS_DIR)/udns_bl.c
+mod_enum_la_SOURCES += $(UDNS_DIR)/udns_rr_srv.c $(UDNS_DIR)/udns_rr_naptr.c $(UDNS_DIR)/udns_codes.c $(UDNS_DIR)/udns_resolver.c
+mod_enum_la_CFLAGS   = $(AM_CFLAGS)
+mod_enum_la_LIBADD   = $(switch_builddir)/libfreeswitch.la
+mod_enum_la_LDFLAGS  = -avoid-version -module -no-undefined -shared

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_enum/mod_enum.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_enum/mod_enum.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_enum/mod_enum.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -251,7 +251,7 @@
 	}
 }
 
-static void free_results(enum_record_t **results)
+static void free_results(enum_record_t ** results)
 {
 	enum_record_t *fp, *rp;
 
@@ -447,7 +447,7 @@
 	free(result);
 }
 
-static switch_status_t enum_lookup(char *root, char *in, enum_record_t **results)
+static switch_status_t enum_lookup(char *root, char *in, enum_record_t ** results)
 {
 	switch_status_t sstatus = SWITCH_STATUS_SUCCESS;
 	char *name = NULL;
@@ -829,7 +829,7 @@
 
 	memset(&globals, 0, sizeof(globals));
 	do_load();
-	
+
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	SWITCH_ADD_API(api_interface, "enum", "ENUM", enum_function, "");
@@ -850,7 +850,7 @@
 	if (globals.pool) {
 		switch_core_destroy_memory_pool(&globals.pool);
 	}
-	
+
 	switch_safe_free(globals.root);
 	switch_safe_free(globals.isn_root);
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_esf/mod_esf.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_esf/mod_esf.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_esf/mod_esf.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -78,10 +78,10 @@
 	switch_port_t mcast_control_port = 6061;
 	char *mcast_port_str = "34567";
 	const char *esf_broadcast_ip = NULL, *var;
-	switch_codec_implementation_t read_impl = {0};
+	switch_codec_implementation_t read_impl = { 0 };
 	int mcast_ttl = 1;
 
-    switch_core_session_get_read_impl(session, &read_impl);
+	switch_core_session_get_read_impl(session, &read_impl);
 
 	if (!zstr((char *) data)) {
 		mydata = switch_core_session_strdup(session, data);
@@ -105,7 +105,7 @@
 		if (!zstr(argv[2])) {
 			mcast_control_port = (switch_port_t) atoi(argv[2]);
 		}
-		
+
 		if (!zstr(argv[3])) {
 			mcast_ttl = atoi(argv[3]);
 			if (mcast_ttl < 1 || mcast_ttl > 255) {
@@ -136,7 +136,7 @@
 		goto fail;
 	}
 
-	if (switch_mcast_hops(socket, mcast_ttl) != SWITCH_STATUS_SUCCESS) {
+	if (switch_mcast_hops(socket, (uint8_t) mcast_ttl) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Mutlicast TTL set failed\n");
 		goto fail;
 	}
@@ -201,8 +201,7 @@
 									 mcast_port,
 									 read_impl.ianacode,
 									 read_impl.samples_per_packet,
-									 read_impl.microseconds_per_packet,
-									 (switch_rtp_flag_t) flags, "soft", &err, switch_core_session_get_pool(session));
+									 read_impl.microseconds_per_packet, (switch_rtp_flag_t) flags, "soft", &err, switch_core_session_get_pool(session));
 
 		if (!switch_rtp_ready(rtp_session)) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "RTP Error\n");

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr


Name: svn:ignore
   - mod_expr.so
.libs
Debug
*.pdb
*.user
Release
debug
Win32
x64
   + mod_expr.so
.libs
Debug
*.pdb
*.user
Release
debug
Win32
x64
Makefile.in
.deps
Makefile
mod_expr.log

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/Makefile

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/Makefile.am (from rev 16612, freeswitch/trunk/src/mod/applications/mod_expr/Makefile.am) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/Makefile.am	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/Makefile.am	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,8 @@
+include $(top_srcdir)/build/modmake.rulesam
+MODNAME=mod_expr
+
+mod_LTLIBRARIES = mod_expr.la
+mod_expr_la_SOURCES  = mod_expr.c expreval.c exprinit.c exprobj.c exprutil.c exprfunc.c exprmem.c exprpars.c exprval.c
+mod_expr_la_CFLAGS   = $(AM_CFLAGS)
+mod_expr_la_LIBADD   = $(switch_builddir)/libfreeswitch.la
+mod_expr_la_LDFLAGS  = -avoid-version -module -no-undefined -shared -lm

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/conio.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/conio.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/conio.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -20,25 +20,24 @@
 
 #define BLINK 0
 
-typedef enum
-{
-    BLACK,
-    BLUE,
-    GREEN,
-    CYAN,
-    RED,
-    MAGENTA,
-    BROWN,
-    LIGHTGRAY,
-    DARKGRAY,
-    LIGHTBLUE,
-    LIGHTGREEN,
-    LIGHTCYAN,
-    LIGHTRED,
-    LIGHTMAGENTA,
-    YELLOW,
-    WHITE
-} COLORS;
+	typedef enum {
+		BLACK,
+		BLUE,
+		GREEN,
+		CYAN,
+		RED,
+		MAGENTA,
+		BROWN,
+		LIGHTGRAY,
+		DARKGRAY,
+		LIGHTBLUE,
+		LIGHTGREEN,
+		LIGHTCYAN,
+		LIGHTRED,
+		LIGHTMAGENTA,
+		YELLOW,
+		WHITE
+	} COLORS;
 
 
 #define cgets	_cgets
@@ -49,17 +48,16 @@
 
 /* blinkvideo */
 
-void clreol (void);
-void clrscr (void);
+	void clreol(void);
+	void clrscr(void);
 
-int _conio_gettext (int left, int top, int right, int bottom,
-                    char *str);
+	int _conio_gettext(int left, int top, int right, int bottom, char *str);
 /* _conio_kbhit */
 
-void delline (void);
+	void delline(void);
 
 /* gettextinfo */
-void gotoxy(int x, int y);
+	void gotoxy(int x, int y);
 /*
 highvideo
 insline
@@ -69,9 +67,9 @@
 normvideo
 */
 
-void gotoxy(int x, int y);
+	void gotoxy(int x, int y);
 
-void puttext (int left, int top, int right, int bottom, char *str);
+	void puttext(int left, int top, int right, int bottom, char *str);
 
 // Screen Variables
 
@@ -89,19 +87,19 @@
 ScreenVisualBell
 _set_screen_lines */
 
-void _setcursortype (int type);
+	void _setcursortype(int type);
 
-void textattr (int _attr);
+	void textattr(int _attr);
 
-void textbackground (int color);
+	void textbackground(int color);
 
-void textcolor (int color);
+	void textcolor(int color);
 
 /* textmode */
 
-int wherex (void);
+	int wherex(void);
 
-int wherey (void);
+	int wherey(void);
 
 /* window */
 
@@ -135,27 +133,26 @@
  *
  */
 
-char*	_cgets (char*);
-int	_cprintf (const char*, ...);
-int	_cputs (const char*);
-int	_cscanf (char*, ...);
+	char *_cgets(char *);
+	int _cprintf(const char *, ...);
+	int _cputs(const char *);
+	int _cscanf(char *, ...);
 
-int	_getch (void);
-int	_getche (void);
-int	_kbhit (void);
-int	_putch (int);
-int	_ungetch (int);
+	int _getch(void);
+	int _getche(void);
+	int _kbhit(void);
+	int _putch(int);
+	int _ungetch(int);
 
 
-int	getch (void);
-int	getche (void);
-int	kbhit (void);
-int	putch (int);
-int	ungetch (int);
+	int getch(void);
+	int getche(void);
+	int kbhit(void);
+	int putch(int);
+	int ungetch(int);
 
 
 #ifdef __cplusplus
 }
 #endif
-
-#endif /* _CONIO_H_ */
+#endif							/* _CONIO_H_ */

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/expreval.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/expreval.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/expreval.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -15,9 +15,9 @@
 /* Defines for error checking */
 #include <errno.h>
 
-#if(EXPR_ERROR_LEVEL >= EXPR_ERROR_LEVEL_CHECK)
+#if (EXPR_ERROR_LEVEL >= EXPR_ERROR_LEVEL_CHECK)
 #define EXPR_RESET_ERR() errno = 0
-#define EXPR_CHECK_ERR() if(errno) return EXPR_ERROR_OUTOFRANGE
+#define EXPR_CHECK_ERR() if (errno) return EXPR_ERROR_OUTOFRANGE
 #else
 #define EXPR_RESET_ERR()
 #define EXPR_CHECK_ERR()
@@ -136,7 +136,7 @@
 				if (d2 != 0.0)
 					*val = d1 / d2;
 				else {
-#if(EXPR_ERROR_LEVEL >= EXPR_ERROR_LEVEL_CHECK)
+#if (EXPR_ERROR_LEVEL >= EXPR_ERROR_LEVEL_CHECK)
 					return EXPR_ERROR_DIVBYZERO;
 #else
 					*val = 0.0;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/expreval.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/expreval.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/expreval.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -19,7 +19,7 @@
 
 
 /* Define type of data to use */
-typedef double EXPRTYPE;
+	typedef double EXPRTYPE;
 
 /* Defines for various things */
 
@@ -27,101 +27,96 @@
 #define EXPR_MAXIDENTSIZE 255
 
 /* Error values */
-enum
-    {
-    EXPR_ERROR_UNKNOWN = -1, /* Unknown error */
-    EXPR_ERROR_NOERROR = 0, /* No Error */
-    EXPR_ERROR_MEMORY, /* Memory allocation failed */
-    EXPR_ERROR_NULLPOINTER, /* Null pointer passed to function */
-    EXPR_ERROR_NOTFOUND, /* Item not found in a list */
-    EXPR_ERROR_UNMATCHEDCOMMENT, /* Unmatched comment tags */
-    EXPR_ERROR_INVALIDCHAR, /* Invalid characters in expression */
-    EXPR_ERROR_ALREADYEXISTS, /* An item already called create */
-    EXPR_ERROR_ALREADYPARSEDBAD, /* Expression parsed already, but unsuccessfully. call free or clear */
-    EXPR_ERROR_ALREADYPARSEDGOOD, /* Expression parsed already, successfully, call free or clear */
-    EXPR_ERROR_EMPTYEXPR, /* Empty expression string passed to parse */
-    EXPR_ERROR_UNMATCHEDPAREN, /* Unmatched parenthesis */
-    EXPR_ERROR_SYNTAX, /* Syntax error in expression */
-    EXPR_ERROR_MISSINGSEMICOLON, /* Missing semicolon at end of expression */
-    EXPR_ERROR_BADIDENTIFIER, /* Identifier was to big or not formed right */
-    EXPR_ERROR_NOSUCHFUNCTION, /* Function does not exist in function list */
-    EXPR_ERROR_BADNUMBERARGUMENTS, /* Bad number of arguments in a function call */
-    EXPR_ERROR_BADEXPR, /* This is a bad expression to evaluate. It has not been parsed or has unsuccessfully */
-    EXPR_ERROR_UNABLETOASSIGN, /* Unable to do an assignment, maybe no variable list */
-    EXPR_ERROR_DIVBYZERO, /* Attempted a division by zero */
-    EXPR_ERROR_NOVARLIST, /* No variable list found but one is needed */
-    EXPR_ERROR_BREAK, /* Expression was broken by break function */
-    EXPR_ERROR_CONSTANTASSIGN, /* Assignment to a constant */
-    EXPR_ERROR_REFCONSTANT, /* Constant used as a reference parameter */
-    EXPR_ERROR_OUTOFRANGE, /* A bad value was passed to a function */
+	enum {
+		EXPR_ERROR_UNKNOWN = -1,	/* Unknown error */
+		EXPR_ERROR_NOERROR = 0,	/* No Error */
+		EXPR_ERROR_MEMORY,		/* Memory allocation failed */
+		EXPR_ERROR_NULLPOINTER,	/* Null pointer passed to function */
+		EXPR_ERROR_NOTFOUND,	/* Item not found in a list */
+		EXPR_ERROR_UNMATCHEDCOMMENT,	/* Unmatched comment tags */
+		EXPR_ERROR_INVALIDCHAR,	/* Invalid characters in expression */
+		EXPR_ERROR_ALREADYEXISTS,	/* An item already called create */
+		EXPR_ERROR_ALREADYPARSEDBAD,	/* Expression parsed already, but unsuccessfully. call free or clear */
+		EXPR_ERROR_ALREADYPARSEDGOOD,	/* Expression parsed already, successfully, call free or clear */
+		EXPR_ERROR_EMPTYEXPR,	/* Empty expression string passed to parse */
+		EXPR_ERROR_UNMATCHEDPAREN,	/* Unmatched parenthesis */
+		EXPR_ERROR_SYNTAX,		/* Syntax error in expression */
+		EXPR_ERROR_MISSINGSEMICOLON,	/* Missing semicolon at end of expression */
+		EXPR_ERROR_BADIDENTIFIER,	/* Identifier was to big or not formed right */
+		EXPR_ERROR_NOSUCHFUNCTION,	/* Function does not exist in function list */
+		EXPR_ERROR_BADNUMBERARGUMENTS,	/* Bad number of arguments in a function call */
+		EXPR_ERROR_BADEXPR,		/* This is a bad expression to evaluate. It has not been parsed or has unsuccessfully */
+		EXPR_ERROR_UNABLETOASSIGN,	/* Unable to do an assignment, maybe no variable list */
+		EXPR_ERROR_DIVBYZERO,	/* Attempted a division by zero */
+		EXPR_ERROR_NOVARLIST,	/* No variable list found but one is needed */
+		EXPR_ERROR_BREAK,		/* Expression was broken by break function */
+		EXPR_ERROR_CONSTANTASSIGN,	/* Assignment to a constant */
+		EXPR_ERROR_REFCONSTANT,	/* Constant used as a reference parameter */
+		EXPR_ERROR_OUTOFRANGE,	/* A bad value was passed to a function */
 
-    EXPR_ERROR_USER /* Custom errors should be larger than this */
-    };
+		EXPR_ERROR_USER			/* Custom errors should be larger than this */
+	};
 
 /* Macros */
 
 /* Forward declarations */
-typedef struct _exprNode exprNode;
-typedef struct _exprFuncList exprFuncList;
-typedef struct _exprValList exprValList;
-typedef struct _exprObj exprObj;
+	typedef struct _exprNode exprNode;
+	typedef struct _exprFuncList exprFuncList;
+	typedef struct _exprValList exprValList;
+	typedef struct _exprObj exprObj;
 
 /* Function types */
-typedef int (*exprFuncType)(exprObj *obj, exprNode *nodes, int nodecount, EXPRTYPE **refs, int refcount, EXPRTYPE *val);
-typedef int (*exprBreakFuncType)(exprObj *obj);
+	typedef int (*exprFuncType) (exprObj * obj, exprNode * nodes, int nodecount, EXPRTYPE ** refs, int refcount, EXPRTYPE * val);
+	typedef int (*exprBreakFuncType) (exprObj * obj);
 
 
 
 /* Functions */
 
 /* Version information function */
-void exprGetVersion(int *major, int *minor);
+	void exprGetVersion(int *major, int *minor);
 
 /* Functions for function lists */
-int exprFuncListCreate(exprFuncList **flist);
-int exprFuncListAdd(exprFuncList *flist, char *name, exprFuncType ptr, int min, int max, int refmin, int refmax);
-int exprFuncListFree(exprFuncList *flist);
-int exprFuncListClear(exprFuncList *flist);
-int exprFuncListInit(exprFuncList *flist);
+	int exprFuncListCreate(exprFuncList ** flist);
+	int exprFuncListAdd(exprFuncList * flist, char *name, exprFuncType ptr, int min, int max, int refmin, int refmax);
+	int exprFuncListFree(exprFuncList * flist);
+	int exprFuncListClear(exprFuncList * flist);
+	int exprFuncListInit(exprFuncList * flist);
 
 /* Functions for value lists */
-int exprValListCreate(exprValList **vlist);
-int exprValListAdd(exprValList *vlist, char *name, EXPRTYPE val);
-int exprValListSet(exprValList *vlist, char *name, EXPRTYPE val);
-int exprValListGet(exprValList *vlist, char *name, EXPRTYPE *val);
-int exprValListAddAddress(exprValList *vlist, char *name, EXPRTYPE *addr);
-int exprValListGetAddress(exprValList *vlist, char *name, EXPRTYPE **addr);
-void *exprValListGetNext(exprValList *vlist, char **name, EXPRTYPE *value, EXPRTYPE** addr, void *cookie);
-int exprValListFree(exprValList *vlist);
-int exprValListClear(exprValList *vlist);
-int exprValListInit(exprValList *vlist);
+	int exprValListCreate(exprValList ** vlist);
+	int exprValListAdd(exprValList * vlist, char *name, EXPRTYPE val);
+	int exprValListSet(exprValList * vlist, char *name, EXPRTYPE val);
+	int exprValListGet(exprValList * vlist, char *name, EXPRTYPE * val);
+	int exprValListAddAddress(exprValList * vlist, char *name, EXPRTYPE * addr);
+	int exprValListGetAddress(exprValList * vlist, char *name, EXPRTYPE ** addr);
+	void *exprValListGetNext(exprValList * vlist, char **name, EXPRTYPE * value, EXPRTYPE ** addr, void *cookie);
+	int exprValListFree(exprValList * vlist);
+	int exprValListClear(exprValList * vlist);
+	int exprValListInit(exprValList * vlist);
 
 /* Functions for expression objects */
-int exprCreate(exprObj **obj, exprFuncList *flist, exprValList *vlist, exprValList *clist,
-    exprBreakFuncType breaker, void *userdata);
-int exprFree(exprObj *obj);
-int exprClear(exprObj *obj);
-int exprParse(exprObj *obj, char *expr);
-int exprEval(exprObj *obj, EXPRTYPE *val);
-int exprEvalNode(exprObj *obj, exprNode *nodes, int curnode, EXPRTYPE *val);
-exprFuncList *exprGetFuncList(exprObj *obj);
-exprValList *exprGetVarList(exprObj *obj);
-exprValList *exprGetConstList(exprObj *obj);
-exprBreakFuncType exprGetBreakFunc(exprObj *obj);
-int exprGetBreakResult(exprObj *obj);
-void* exprGetUserData(exprObj *obj);
-void exprSetUserData(exprObj *obj, void *userdata);
-void exprSetBreakCount(exprObj *obj, int count);
-void exprGetErrorPosition(exprObj *obj, int *start, int *end);
+	int exprCreate(exprObj ** obj, exprFuncList * flist, exprValList * vlist, exprValList * clist, exprBreakFuncType breaker, void *userdata);
+	int exprFree(exprObj * obj);
+	int exprClear(exprObj * obj);
+	int exprParse(exprObj * obj, char *expr);
+	int exprEval(exprObj * obj, EXPRTYPE * val);
+	int exprEvalNode(exprObj * obj, exprNode * nodes, int curnode, EXPRTYPE * val);
+	exprFuncList *exprGetFuncList(exprObj * obj);
+	exprValList *exprGetVarList(exprObj * obj);
+	exprValList *exprGetConstList(exprObj * obj);
+	exprBreakFuncType exprGetBreakFunc(exprObj * obj);
+	int exprGetBreakResult(exprObj * obj);
+	void *exprGetUserData(exprObj * obj);
+	void exprSetUserData(exprObj * obj, void *userdata);
+	void exprSetBreakCount(exprObj * obj, int count);
+	void exprGetErrorPosition(exprObj * obj, int *start, int *end);
 
 /* Other useful routines */
-int exprValidIdent(char *name);
+	int exprValidIdent(char *name);
 
 /* Name mangling */
 #ifdef __cplusplus
 }
 #endif
-
-
-
-#endif /* __BAVII_EXPREVAL_H */
+#endif							/* __BAVII_EXPREVAL_H */

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/exprilfs.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/exprilfs.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/exprilfs.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -38,1027 +38,910 @@
 
 /* abs */
 case EXPR_NODEFUNC_ABS:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        if(d1 >= 0)
-            *val = d1;
-        else
-            *val = -d1;
-        }
-    else
-        return err;
+	if (!err) {
+		if (d1 >= 0)
+			*val = d1;
+		else
+			*val = -d1;
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* mod */
 case EXPR_NODEFUNC_MOD:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
 
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        *val = fmod(d1, d2);
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+	if (!err) {
+		EXPR_RESET_ERR();
+		*val = fmod(d1, d2);
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* ipart */
 case EXPR_NODEFUNC_IPART:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        modf(d1, val);
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+	if (!err) {
+		EXPR_RESET_ERR();
+		modf(d1, val);
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* fpart */
 case EXPR_NODEFUNC_FPART:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        *val = modf(d1, &d2);
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+	if (!err) {
+		EXPR_RESET_ERR();
+		*val = modf(d1, &d2);
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* min */
 case EXPR_NODEFUNC_MIN:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        for(pos = 1; pos < nodes->data.function.nodecount; pos++)
-            {
-            err = exprEvalNode(obj, nodes->data.function.nodes, pos, &d2);
-            if(!err)
-                {
-                if(d2 < d1)
-                    d1 = d2;
-                }
-            else
-                return err;
-            }
-        }
-    else
-        return err;
+	if (!err) {
+		for (pos = 1; pos < nodes->data.function.nodecount; pos++) {
+			err = exprEvalNode(obj, nodes->data.function.nodes, pos, &d2);
+			if (!err) {
+				if (d2 < d1)
+					d1 = d2;
+			} else
+				return err;
+		}
+	} else
+		return err;
 
-    *val = d1;
+	*val = d1;
 
-    break;
-    }
+	break;
+}
 
 /* max */
 case EXPR_NODEFUNC_MAX:
-    {
-    int tmppos;
+{
+	int tmppos;
 
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        for(tmppos = 1; tmppos < nodes->data.function.nodecount; tmppos++)
-            {
-            err = exprEvalNode(obj, nodes->data.function.nodes, tmppos, &d2);
-            if(!err)
-                {
-                if(d2 > d1)
-                    d1 = d2;
-                }
-            else
-                return err;
-            }
-        }
-    else
-        return err;
+	if (!err) {
+		for (tmppos = 1; tmppos < nodes->data.function.nodecount; tmppos++) {
+			err = exprEvalNode(obj, nodes->data.function.nodes, tmppos, &d2);
+			if (!err) {
+				if (d2 > d1)
+					d1 = d2;
+			} else
+				return err;
+		}
+	} else
+		return err;
 
-    *val = d1;
+	*val = d1;
 
-    break;
-    }
+	break;
+}
 
 /* pow */
 case EXPR_NODEFUNC_POW:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
 
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        *val = pow(d1, d2);
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+	if (!err) {
+		EXPR_RESET_ERR();
+		*val = pow(d1, d2);
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* sqrt */
 case EXPR_NODEFUNC_SQRT:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
-    
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        *val = sqrt(d1);
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    break;
-    }
+	if (!err) {
+		EXPR_RESET_ERR();
+		*val = sqrt(d1);
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
+	break;
+}
+
 /* sin */
 case EXPR_NODEFUNC_SIN:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        *val = sin(d1);
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+	if (!err) {
+		EXPR_RESET_ERR();
+		*val = sin(d1);
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* sinh */
 case EXPR_NODEFUNC_SINH:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        *val = sinh(d1);
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+	if (!err) {
+		EXPR_RESET_ERR();
+		*val = sinh(d1);
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* asin */
 case EXPR_NODEFUNC_ASIN:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        *val = asin(d1);
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+	if (!err) {
+		EXPR_RESET_ERR();
+		*val = asin(d1);
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* cos */
-case EXPR_NODEFUNC_COS: 
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1); 
+case EXPR_NODEFUNC_COS:
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        *val = cos(d1);
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+	if (!err) {
+		EXPR_RESET_ERR();
+		*val = cos(d1);
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* cosh */
-case EXPR_NODEFUNC_COSH: 
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1); 
+case EXPR_NODEFUNC_COSH:
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        *val = cosh(d1);
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+	if (!err) {
+		EXPR_RESET_ERR();
+		*val = cosh(d1);
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* acos */
-case EXPR_NODEFUNC_ACOS: 
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1); 
+case EXPR_NODEFUNC_ACOS:
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        *val = acos(d1);
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+	if (!err) {
+		EXPR_RESET_ERR();
+		*val = acos(d1);
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* tan */
-case EXPR_NODEFUNC_TAN: 
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1); 
+case EXPR_NODEFUNC_TAN:
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        *val = tan(d1);
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+	if (!err) {
+		EXPR_RESET_ERR();
+		*val = tan(d1);
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* tanh */
-case EXPR_NODEFUNC_TANH: 
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1); 
+case EXPR_NODEFUNC_TANH:
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        *val = tanh(d1);
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+	if (!err) {
+		EXPR_RESET_ERR();
+		*val = tanh(d1);
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* atan */
-case EXPR_NODEFUNC_ATAN: 
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1); 
+case EXPR_NODEFUNC_ATAN:
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        *val = atan(d1);
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+	if (!err) {
+		EXPR_RESET_ERR();
+		*val = atan(d1);
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* atan2 */
-case EXPR_NODEFUNC_ATAN2: 
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+case EXPR_NODEFUNC_ATAN2:
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
 
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        *val = atan2(d1, d2);
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+	if (!err) {
+		EXPR_RESET_ERR();
+		*val = atan2(d1, d2);
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* log */
-case EXPR_NODEFUNC_LOG: 
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1); 
+case EXPR_NODEFUNC_LOG:
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        *val = log10(d1);
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+	if (!err) {
+		EXPR_RESET_ERR();
+		*val = log10(d1);
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* pow10 */
-case EXPR_NODEFUNC_POW10: 
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1); 
+case EXPR_NODEFUNC_POW10:
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        *val = pow(10.0, d1);
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+	if (!err) {
+		EXPR_RESET_ERR();
+		*val = pow(10.0, d1);
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* ln */
-case EXPR_NODEFUNC_LN: 
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1); 
+case EXPR_NODEFUNC_LN:
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        *val = log(d1);
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+	if (!err) {
+		EXPR_RESET_ERR();
+		*val = log(d1);
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* exp */
-case EXPR_NODEFUNC_EXP: 
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1); 
+case EXPR_NODEFUNC_EXP:
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        *val = exp(d1);
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+	if (!err) {
+		EXPR_RESET_ERR();
+		*val = exp(d1);
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
-case EXPR_NODEFUNC_LOGN: 
-    {
-    EXPRTYPE l1, l2;
+case EXPR_NODEFUNC_LOGN:
+{
+	EXPRTYPE l1, l2;
 
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1); 
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
 
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        l1 = log(d1);
-        EXPR_CHECK_ERR();
-        l2 = log(d2);
-        EXPR_CHECK_ERR();
+	if (!err) {
+		EXPR_RESET_ERR();
+		l1 = log(d1);
+		EXPR_CHECK_ERR();
+		l2 = log(d2);
+		EXPR_CHECK_ERR();
 
 
-        if(l2 == 0.0)
-            {
+		if (l2 == 0.0) {
 #if(EXPR_ERROR_LEVEL >= EXPR_ERROR_LEVEL_CHECK)
-            return EXPR_ERROR_OUTOFRANGE;
+			return EXPR_ERROR_OUTOFRANGE;
 #else
-            *val = 0.0;
-            return EXPR_ERROR_NOERROR;
+			*val = 0.0;
+			return EXPR_ERROR_NOERROR;
 #endif
-            }
+		}
 
-        *val = l1 / l2;
-        }
-    else
-        return err;
+		*val = l1 / l2;
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* ceil */
-case EXPR_NODEFUNC_CEIL: 
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1); 
+case EXPR_NODEFUNC_CEIL:
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        *val = ceil(d1);
-        }
-    else
-        return err;
+	if (!err) {
+		*val = ceil(d1);
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* floor */
-case EXPR_NODEFUNC_FLOOR: 
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+case EXPR_NODEFUNC_FLOOR:
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        *val = floor(d1);
-        }
-    else
-        return err;
+	if (!err) {
+		*val = floor(d1);
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* rand */
 case EXPR_NODEFUNC_RAND:
-    {
-    long a;
-    
-    /* Perform random routine directly */
-    a = ((long)(*(nodes->data.function.refs[0]))) * 214013L + 2531011L;
-    *(nodes->data.function.refs[0]) = (EXPRTYPE)a;
+{
+	long a;
 
-    *val =  (EXPRTYPE)((a >> 16) & 0x7FFF) / (EXPRTYPE)(32768);
-    break;
-    }
+	/* Perform random routine directly */
+	a = ((long) (*(nodes->data.function.refs[0]))) * 214013L + 2531011L;
+	*(nodes->data.function.refs[0]) = (EXPRTYPE) a;
 
+	*val = (EXPRTYPE) ((a >> 16) & 0x7FFF) / (EXPRTYPE) (32768);
+	break;
+}
+
 /* random */
 case EXPR_NODEFUNC_RANDOM:
-    {
-    EXPRTYPE diff, rval;
-    long a;
+{
+	EXPRTYPE diff, rval;
+	long a;
 
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
 
-    if(!err)
-        {
-        diff = d2 - d1;
+	if (!err) {
+		diff = d2 - d1;
 
-        /* Perform random routine directly */
-        a = ((long)(*(nodes->data.function.refs[0]))) * 214013L + 2531011L;
-        *(nodes->data.function.refs[0]) = (EXPRTYPE)a;
+		/* Perform random routine directly */
+		a = ((long) (*(nodes->data.function.refs[0]))) * 214013L + 2531011L;
+		*(nodes->data.function.refs[0]) = (EXPRTYPE) a;
 
-        rval = (EXPRTYPE)((a >> 16) & 0x7FFF) / (EXPRTYPE)(32767);
+		rval = (EXPRTYPE) ((a >> 16) & 0x7FFF) / (EXPRTYPE) (32767);
 
-        *val = (rval * diff) + d1;
-        }
-    else
-        return err;
+		*val = (rval * diff) + d1;
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* randomize */
 case EXPR_NODEFUNC_RANDOMIZE:
-    {
-    static int curcall = 0;
+{
+	static int curcall = 0;
 
-    curcall++;
+	curcall++;
 
-    *(nodes->data.function.refs[0]) = (EXPRTYPE)((clock() + 1024 + curcall) * time(NULL));
+	*(nodes->data.function.refs[0]) = (EXPRTYPE) ((clock() + 1024 + curcall) * time(NULL));
 
-    break;
-    }
+	break;
+}
 
 /* deg */
 case EXPR_NODEFUNC_DEG:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
-    
-    if(!err)
-        {
-        *val = (180.0 * d1) / M_PI;
-        }
-    else
-        return err;
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    break;
-    }
+	if (!err) {
+		*val = (180.0 * d1) / M_PI;
+	} else
+		return err;
 
+	break;
+}
+
 /* rad */
 case EXPR_NODEFUNC_RAD:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
-    
-    if(!err)
-        {
-        *val = (M_PI * d1) / 180.0;
-        }
-    else
-        return err;
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    break;
-    }
+	if (!err) {
+		*val = (M_PI * d1) / 180.0;
+	} else
+		return err;
 
+	break;
+}
+
 /* recttopolr */
 case EXPR_NODEFUNC_RECTTOPOLR:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
-    
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        *val = sqrt((d1 * d1) + (d2 * d2));
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
 
-    break;
-    }
+	if (!err) {
+		EXPR_RESET_ERR();
+		*val = sqrt((d1 * d1) + (d2 * d2));
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
+	break;
+}
+
 /* recttopola */
 case EXPR_NODEFUNC_RECTTOPOLA:
-    {
-    EXPRTYPE tmp;
+{
+	EXPRTYPE tmp;
 
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
-    
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        tmp = atan2(d2, d1);
-        EXPR_CHECK_ERR();
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
 
-        if(tmp < 0.0)
-            *val = tmp = (2.0 * M_PI);
-        else
-            *val = tmp;
-        }
-    else
-        return err;
+	if (!err) {
+		EXPR_RESET_ERR();
+		tmp = atan2(d2, d1);
+		EXPR_CHECK_ERR();
 
-    break;
-    }
+		if (tmp < 0.0)
+			*val = tmp = (2.0 * M_PI);
+		else
+			*val = tmp;
+	} else
+		return err;
 
+	break;
+}
+
 /* poltorectx */
 case EXPR_NODEFUNC_POLTORECTX:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
-    
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        *val = d1 * cos(d2);
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
 
-    break;
-    }
+	if (!err) {
+		EXPR_RESET_ERR();
+		*val = d1 * cos(d2);
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
+	break;
+}
+
 /* poltorecty */
 case EXPR_NODEFUNC_POLTORECTY:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
-    
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        *val = d1 * sin(d2);
-        EXPR_CHECK_ERR();
-        }
-    else
-        return err;
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
 
-    break;
-    }
+	if (!err) {
+		EXPR_RESET_ERR();
+		*val = d1 * sin(d2);
+		EXPR_CHECK_ERR();
+	} else
+		return err;
 
+	break;
+}
+
 /* if */
 case EXPR_NODEFUNC_IF:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        if(d1 != 0.0)
-            {
-            err = exprEvalNode(obj, nodes->data.function.nodes, 1, val);
-            if(err)
-                return err;
-            }
-        else
-            {
-            err = exprEvalNode(obj, nodes->data.function.nodes, 2, val);
-            if(err)
-                return err;
-            }
-        }
-    else
-        return err;
+	if (!err) {
+		if (d1 != 0.0) {
+			err = exprEvalNode(obj, nodes->data.function.nodes, 1, val);
+			if (err)
+				return err;
+		} else {
+			err = exprEvalNode(obj, nodes->data.function.nodes, 2, val);
+			if (err)
+				return err;
+		}
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* select */
 case EXPR_NODEFUNC_SELECT:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        if(d1 < 0.0)
-            {
-            err = exprEvalNode(obj, nodes->data.function.nodes, 1, val);
-            if(err)
-                return err;
-            }
-        else if(d1 == 0.0)
-            {
-            err = exprEvalNode(obj, nodes->data.function.nodes, 2, val);
-            if(err)
-                return err;
-            }
-        else
-            {
-            if(nodes->data.function.nodecount == 3)
-                {
-                err = exprEvalNode(obj, nodes->data.function.nodes, 2, val);
-                if(err)
-                    return err;
-                }
-            else
-                {
-                err = exprEvalNode(obj, nodes->data.function.nodes, 3, val);
-                if(err)
-                    return err;
-                }
-            }
-        }
-    else
-        return err;
+	if (!err) {
+		if (d1 < 0.0) {
+			err = exprEvalNode(obj, nodes->data.function.nodes, 1, val);
+			if (err)
+				return err;
+		} else if (d1 == 0.0) {
+			err = exprEvalNode(obj, nodes->data.function.nodes, 2, val);
+			if (err)
+				return err;
+		} else {
+			if (nodes->data.function.nodecount == 3) {
+				err = exprEvalNode(obj, nodes->data.function.nodes, 2, val);
+				if (err)
+					return err;
+			} else {
+				err = exprEvalNode(obj, nodes->data.function.nodes, 3, val);
+				if (err)
+					return err;
+			}
+		}
+	} else
+		return err;
 
-    break;
-    }
+	break;
+}
 
 /* equal */
 case EXPR_NODEFUNC_EQUAL:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
-    
-    if(!err)
-        {
-        *val = (d1 == d2) ? 1.0 : 0.0;
-        }
-    else
-        return err;
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
 
-    break;
-    }
+	if (!err) {
+		*val = (d1 == d2) ? 1.0 : 0.0;
+	} else
+		return err;
 
+	break;
+}
+
 /* above */
 case EXPR_NODEFUNC_ABOVE:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
-    
-    if(!err)
-        {
-        *val = (d1 > d2) ? 1.0 : 0.0;
-        }
-    else
-        return err;
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
 
-    break;
-    }
+	if (!err) {
+		*val = (d1 > d2) ? 1.0 : 0.0;
+	} else
+		return err;
 
+	break;
+}
+
 /* below */
 case EXPR_NODEFUNC_BELOW:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
-    
-    if(!err)
-        {
-        *val = (d1 < d2) ? 1.0 : 0.0;
-        }
-    else
-        return err;
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
 
-    break;
-    }
+	if (!err) {
+		*val = (d1 < d2) ? 1.0 : 0.0;
+	} else
+		return err;
 
+	break;
+}
+
 /* avg */
 case EXPR_NODEFUNC_AVG:
-    {
-    d2 = 0.0;
-    
-    for(pos = 0; pos < nodes->data.function.nodecount; pos++)
-        {
-        err = exprEvalNode(obj, nodes->data.function.nodes, pos, &d1);
-        if(!err)
-            {
-            d2 += d1;
-            }
-        else
-            return err;
-        }
+{
+	d2 = 0.0;
 
-    *val = d2 / (EXPRTYPE)(nodes->data.function.nodecount);
+	for (pos = 0; pos < nodes->data.function.nodecount; pos++) {
+		err = exprEvalNode(obj, nodes->data.function.nodes, pos, &d1);
+		if (!err) {
+			d2 += d1;
+		} else
+			return err;
+	}
 
-    break;
-    }
+	*val = d2 / (EXPRTYPE) (nodes->data.function.nodecount);
 
+	break;
+}
+
 /* clip */
 case EXPR_NODEFUNC_CLIP:
-    {
-    EXPRTYPE v;
+{
+	EXPRTYPE v;
 
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &v);
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &v);
 
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d1);
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d1);
 
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
-    
-    if(!err)
-        {
-        if(v < d1)
-            *val = d1;
-        else if(v > d2)
-            *val = d2;
-        else
-            *val = v;
-        }
-    else
-        return err;
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
 
-    break;
-    }
+	if (!err) {
+		if (v < d1)
+			*val = d1;
+		else if (v > d2)
+			*val = d2;
+		else
+			*val = v;
+	} else
+		return err;
 
+	break;
+}
+
 /* clamp */
 case EXPR_NODEFUNC_CLAMP:
-    {
-    EXPRTYPE v, tmp;
+{
+	EXPRTYPE v, tmp;
 
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &v);
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &v);
 
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d1);
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d1);
 
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
-    
-    if(!err)
-        {
-        EXPR_RESET_ERR();
-        tmp = fmod(v - d1, d2 - d1);
-        EXPR_CHECK_ERR();
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
 
-        if(tmp < 0.0)
-            *val = tmp * d2;
-        else
-            *val = tmp + d1;
-        }
-    else
-        return err;
+	if (!err) {
+		EXPR_RESET_ERR();
+		tmp = fmod(v - d1, d2 - d1);
+		EXPR_CHECK_ERR();
 
-    break;
-    }
+		if (tmp < 0.0)
+			*val = tmp * d2;
+		else
+			*val = tmp + d1;
+	} else
+		return err;
 
+	break;
+}
+
 /* pntchange */
 case EXPR_NODEFUNC_PNTCHANGE:
-    {
-    EXPRTYPE n1, n2, pnt;
-    EXPRTYPE odiff, ndiff, perc;
+{
+	EXPRTYPE n1, n2, pnt;
+	EXPRTYPE odiff, ndiff, perc;
 
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
 
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 2, &n1);
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 2, &n1);
 
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 3, &n2);
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 3, &n2);
 
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 4, &pnt);
-    
-    if(!err)
-        {
-        odiff = d2 - d1;
-        ndiff = n2 - n1;
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 4, &pnt);
 
-        if(odiff == 0.0)
-            {
-            *val = d1;
-            return EXPR_ERROR_NOERROR;
-            }
+	if (!err) {
+		odiff = d2 - d1;
+		ndiff = n2 - n1;
 
-        perc = (pnt - d1) / odiff;
+		if (odiff == 0.0) {
+			*val = d1;
+			return EXPR_ERROR_NOERROR;
+		}
 
-        *val = n1 + (perc * ndiff);
-        }
-    else
-        return err;
+		perc = (pnt - d1) / odiff;
 
-    break;
-    }
+		*val = n1 + (perc * ndiff);
+	} else
+		return err;
 
+	break;
+}
+
 /* poly */
 case EXPR_NODEFUNC_POLY:
-    {
-    EXPRTYPE total, curpow;
+{
+	EXPRTYPE total, curpow;
 
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        curpow = (EXPRTYPE)(nodes->data.function.nodecount) - 2.0;
-        total = 0.0;
+	if (!err) {
+		curpow = (EXPRTYPE) (nodes->data.function.nodecount) - 2.0;
+		total = 0.0;
 
-        for(pos = 1; pos < nodes->data.function.nodecount; pos++)
-            {
-            err = exprEvalNode(obj, nodes->data.function.nodes, pos, &d2);
-            if(err)
-                return err;
+		for (pos = 1; pos < nodes->data.function.nodecount; pos++) {
+			err = exprEvalNode(obj, nodes->data.function.nodes, pos, &d2);
+			if (err)
+				return err;
 
-            EXPR_RESET_ERR();
-            total = total + (d2 * pow(d1, curpow));
-            EXPR_CHECK_ERR();
+			EXPR_RESET_ERR();
+			total = total + (d2 * pow(d1, curpow));
+			EXPR_CHECK_ERR();
 
-            curpow = curpow - 1.0;
-            }
-        }
-    else
-        return err;
+			curpow = curpow - 1.0;
+		}
+	} else
+		return err;
 
-    *val = total;
-    break;
-    }
+	*val = total;
+	break;
+}
 
 /* and */
 case EXPR_NODEFUNC_AND:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
-    
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        if(d1 == 0.0 || d2 == 0.0)
-            *val = 0.0;
-        else
-            *val = 1.0;
-        }
-    else
-        return err;
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
 
-    break;
-    }
+	if (!err) {
+		if (d1 == 0.0 || d2 == 0.0)
+			*val = 0.0;
+		else
+			*val = 1.0;
+	} else
+		return err;
 
+	break;
+}
+
 /* or */
 case EXPR_NODEFUNC_OR:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
-    
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        if(d1 != 0.0 || d2 != 0.0)
-            *val = 1.0;
-        else
-            *val = 0.0;
-        }
-    else
-        return err;
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 1, &d2);
 
-    break;
-    }
+	if (!err) {
+		if (d1 != 0.0 || d2 != 0.0)
+			*val = 1.0;
+		else
+			*val = 0.0;
+	} else
+		return err;
 
+	break;
+}
+
 /* not */
 case EXPR_NODEFUNC_NOT:
-    {
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
-    
-    if(!err)
-        {
-        if(d1 != 0.0)
-            *val = 0.0;
-        else
-            *val = 1.0;
-        }
-    else
-        return err;
+{
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    break;
-    }
+	if (!err) {
+		if (d1 != 0.0)
+			*val = 0.0;
+		else
+			*val = 1.0;
+	} else
+		return err;
 
+	break;
+}
+
 /* for */
 case EXPR_NODEFUNC_FOR:
-    {
-    int tmppos;
-    EXPRTYPE test;
+{
+	int tmppos;
+	EXPRTYPE test;
 
-    err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
-    
-    if(!err)
-        err = exprEvalNode(obj, nodes->data.function.nodes, 1, &test);
+	err = exprEvalNode(obj, nodes->data.function.nodes, 0, &d1);
 
-    if(!err)
-        {
-        while(test != 0.0)
-            {
-            for(tmppos = 3; tmppos < nodes->data.function.nodecount; tmppos++)
-                {
-                err = exprEvalNode(obj, nodes->data.function.nodes, tmppos, val);
-                if(err)
-                    return err;
-                }
+	if (!err)
+		err = exprEvalNode(obj, nodes->data.function.nodes, 1, &test);
 
-            err = exprEvalNode(obj, nodes->data.function.nodes, 2, &d1);
-            if(err)
-                return err;
+	if (!err) {
+		while (test != 0.0) {
+			for (tmppos = 3; tmppos < nodes->data.function.nodecount; tmppos++) {
+				err = exprEvalNode(obj, nodes->data.function.nodes, tmppos, val);
+				if (err)
+					return err;
+			}
 
-            err = exprEvalNode(obj, nodes->data.function.nodes, 1, &test);
-            if(err)
-                return err;
-            }
-        }
-    else
-        return err;
+			err = exprEvalNode(obj, nodes->data.function.nodes, 2, &d1);
+			if (err)
+				return err;
 
-    break;
-    }
+			err = exprEvalNode(obj, nodes->data.function.nodes, 1, &test);
+			if (err)
+				return err;
+		}
+	} else
+		return err;
 
+	break;
+}
+
 /* many */
 case EXPR_NODEFUNC_MANY:
-    {
-    for(pos = 0; pos < nodes->data.function.nodecount; pos++)
-        {
-        err = exprEvalNode(obj, nodes->data.function.nodes, pos, val);
-        if(err)
-            return err;
-        }
+{
+	for (pos = 0; pos < nodes->data.function.nodecount; pos++) {
+		err = exprEvalNode(obj, nodes->data.function.nodes, pos, val);
+		if (err)
+			return err;
+	}
 
-    break;
-    }
-
+	break;
+}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/exprinit.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/exprinit.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/exprinit.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -16,13 +16,13 @@
 /* Macro for adding a function node type */
 #define EXPR_ADDFUNC_TYPE(name, type, argmin, argmax, refmin, refmax) \
 err = exprFuncListAddType(flist, name, type, argmin, argmax, refmin, refmax); \
-if(err != EXPR_ERROR_NOERROR) \
+if (err != EXPR_ERROR_NOERROR) \
     return err;
 
 /* Macro for adding a constant */
 #define EXPR_ADDCONST(name, val) \
 err = exprValListAdd(vlist, name, val); \
-if(err != EXPR_ERROR_NOERROR) \
+if (err != EXPR_ERROR_NOERROR) \
     return err;
 
 /* Call this function to initialize these functions into a function list */

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/exprmem.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/exprmem.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/exprmem.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -13,7 +13,7 @@
 /* Needed for exprNode */
 #include "exprpriv.h"
 
-void* exprAllocMem(size_t size);
+void *exprAllocMem(size_t size);
 void exprFreeMem(void *data);
 exprNode *exprAllocNodes(size_t count);
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/exprpriv.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/exprpriv.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/exprpriv.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -30,196 +30,180 @@
 #define EXPR_VERSIONMINOR 7
 
 /* Node types */
-enum
-    {
-    EXPR_NODETYPE_UNKNOWN = 0,
-    EXPR_NODETYPE_MULTI,
-    EXPR_NODETYPE_ADD,
-    EXPR_NODETYPE_SUBTRACT,
-    EXPR_NODETYPE_MULTIPLY,
-    EXPR_NODETYPE_DIVIDE,
-    EXPR_NODETYPE_EXPONENT,
-    EXPR_NODETYPE_NEGATE,
-    EXPR_NODETYPE_VALUE,
-    EXPR_NODETYPE_VARIABLE,
-    EXPR_NODETYPE_ASSIGN,
-    EXPR_NODETYPE_FUNCTION
-    };
+	enum {
+		EXPR_NODETYPE_UNKNOWN = 0,
+		EXPR_NODETYPE_MULTI,
+		EXPR_NODETYPE_ADD,
+		EXPR_NODETYPE_SUBTRACT,
+		EXPR_NODETYPE_MULTIPLY,
+		EXPR_NODETYPE_DIVIDE,
+		EXPR_NODETYPE_EXPONENT,
+		EXPR_NODETYPE_NEGATE,
+		EXPR_NODETYPE_VALUE,
+		EXPR_NODETYPE_VARIABLE,
+		EXPR_NODETYPE_ASSIGN,
+		EXPR_NODETYPE_FUNCTION
+	};
 
 /* Functions can be evaluated directly in EXPREVAL.  If fptr
    is NULL, type is used to determine what the function is */
-enum
-    {
-    EXPR_NODEFUNC_UNKNOWN = 0,
-    EXPR_NODEFUNC_ABS,
-    EXPR_NODEFUNC_MOD,
-    EXPR_NODEFUNC_IPART,
-    EXPR_NODEFUNC_FPART,
-    EXPR_NODEFUNC_MIN,
-    EXPR_NODEFUNC_MAX,
-    EXPR_NODEFUNC_POW,
-    EXPR_NODEFUNC_SQRT,
-    EXPR_NODEFUNC_SIN,
-    EXPR_NODEFUNC_SINH,
-    EXPR_NODEFUNC_ASIN,
-    EXPR_NODEFUNC_COS,
-    EXPR_NODEFUNC_COSH,
-    EXPR_NODEFUNC_ACOS,
-    EXPR_NODEFUNC_TAN,
-    EXPR_NODEFUNC_TANH,
-    EXPR_NODEFUNC_ATAN,
-    EXPR_NODEFUNC_ATAN2,
-    EXPR_NODEFUNC_LOG,
-    EXPR_NODEFUNC_POW10,
-    EXPR_NODEFUNC_LN,
-    EXPR_NODEFUNC_EXP,
-    EXPR_NODEFUNC_LOGN,
-    EXPR_NODEFUNC_CEIL,
-    EXPR_NODEFUNC_FLOOR,
-    EXPR_NODEFUNC_RAND,
-    EXPR_NODEFUNC_RANDOM,
-    EXPR_NODEFUNC_RANDOMIZE,
-    EXPR_NODEFUNC_DEG,
-    EXPR_NODEFUNC_RAD,
-    EXPR_NODEFUNC_RECTTOPOLR,
-    EXPR_NODEFUNC_RECTTOPOLA,
-    EXPR_NODEFUNC_POLTORECTX,
-    EXPR_NODEFUNC_POLTORECTY,
-    EXPR_NODEFUNC_IF,
-    EXPR_NODEFUNC_SELECT,
-    EXPR_NODEFUNC_EQUAL,
-    EXPR_NODEFUNC_ABOVE,
-    EXPR_NODEFUNC_BELOW,
-    EXPR_NODEFUNC_AVG,
-    EXPR_NODEFUNC_CLIP,
-    EXPR_NODEFUNC_CLAMP,
-    EXPR_NODEFUNC_PNTCHANGE,
-    EXPR_NODEFUNC_POLY,
-    EXPR_NODEFUNC_AND,
-    EXPR_NODEFUNC_OR,
-    EXPR_NODEFUNC_NOT,
-    EXPR_NODEFUNC_FOR,
-    EXPR_NODEFUNC_MANY
-    };
+	enum {
+		EXPR_NODEFUNC_UNKNOWN = 0,
+		EXPR_NODEFUNC_ABS,
+		EXPR_NODEFUNC_MOD,
+		EXPR_NODEFUNC_IPART,
+		EXPR_NODEFUNC_FPART,
+		EXPR_NODEFUNC_MIN,
+		EXPR_NODEFUNC_MAX,
+		EXPR_NODEFUNC_POW,
+		EXPR_NODEFUNC_SQRT,
+		EXPR_NODEFUNC_SIN,
+		EXPR_NODEFUNC_SINH,
+		EXPR_NODEFUNC_ASIN,
+		EXPR_NODEFUNC_COS,
+		EXPR_NODEFUNC_COSH,
+		EXPR_NODEFUNC_ACOS,
+		EXPR_NODEFUNC_TAN,
+		EXPR_NODEFUNC_TANH,
+		EXPR_NODEFUNC_ATAN,
+		EXPR_NODEFUNC_ATAN2,
+		EXPR_NODEFUNC_LOG,
+		EXPR_NODEFUNC_POW10,
+		EXPR_NODEFUNC_LN,
+		EXPR_NODEFUNC_EXP,
+		EXPR_NODEFUNC_LOGN,
+		EXPR_NODEFUNC_CEIL,
+		EXPR_NODEFUNC_FLOOR,
+		EXPR_NODEFUNC_RAND,
+		EXPR_NODEFUNC_RANDOM,
+		EXPR_NODEFUNC_RANDOMIZE,
+		EXPR_NODEFUNC_DEG,
+		EXPR_NODEFUNC_RAD,
+		EXPR_NODEFUNC_RECTTOPOLR,
+		EXPR_NODEFUNC_RECTTOPOLA,
+		EXPR_NODEFUNC_POLTORECTX,
+		EXPR_NODEFUNC_POLTORECTY,
+		EXPR_NODEFUNC_IF,
+		EXPR_NODEFUNC_SELECT,
+		EXPR_NODEFUNC_EQUAL,
+		EXPR_NODEFUNC_ABOVE,
+		EXPR_NODEFUNC_BELOW,
+		EXPR_NODEFUNC_AVG,
+		EXPR_NODEFUNC_CLIP,
+		EXPR_NODEFUNC_CLAMP,
+		EXPR_NODEFUNC_PNTCHANGE,
+		EXPR_NODEFUNC_POLY,
+		EXPR_NODEFUNC_AND,
+		EXPR_NODEFUNC_OR,
+		EXPR_NODEFUNC_NOT,
+		EXPR_NODEFUNC_FOR,
+		EXPR_NODEFUNC_MANY
+	};
 
 /* Forward declarations */
-typedef struct _exprFunc exprFunc;
-typedef struct _exprVal exprVal;
+	typedef struct _exprFunc exprFunc;
+	typedef struct _exprVal exprVal;
 
 /* Expression object */
-struct _exprObj
-    {
-    struct _exprFuncList *flist; /* Functions */
-    struct _exprValList *vlist; /* Variables */
-    struct _exprValList *clist; /* Constants */
-    struct _exprNode *headnode; /* Head parsed node */
+	struct _exprObj {
+		struct _exprFuncList *flist;	/* Functions */
+		struct _exprValList *vlist;	/* Variables */
+		struct _exprValList *clist;	/* Constants */
+		struct _exprNode *headnode;	/* Head parsed node */
 
-    exprBreakFuncType breakerfunc; /* Break function type */
+		exprBreakFuncType breakerfunc;	/* Break function type */
 
-    void *userdata; /* User data, can be any 32 bit value */
-    int parsedgood; /* non-zero if successfully parsed */
-    int parsedbad; /* non-zero if parsed but unsuccessful */
-    int breakcount; /* how often to check the breaker function */
-    int breakcur; /* do we check the breaker function yet */
-    int starterr; /* start position of an error */
-    int enderr; /* end position of an error */
-    };
+		void *userdata;			/* User data, can be any 32 bit value */
+		int parsedgood;			/* non-zero if successfully parsed */
+		int parsedbad;			/* non-zero if parsed but unsuccessful */
+		int breakcount;			/* how often to check the breaker function */
+		int breakcur;			/* do we check the breaker function yet */
+		int starterr;			/* start position of an error */
+		int enderr;				/* end position of an error */
+	};
 
 /* Object for a function */
-struct _exprFunc
-    {
-    char *fname; /* Name of the function */
-    exprFuncType fptr; /* Function pointer */
-    int min, max; /* Min and max args for the function. */
-    int refmin, refmax; /* Min and max ref. variables for the function */
-    int type; /* Function node type.  exprEvalNOde solves the function */
+	struct _exprFunc {
+		char *fname;			/* Name of the function */
+		exprFuncType fptr;		/* Function pointer */
+		int min, max;			/* Min and max args for the function. */
+		int refmin, refmax;		/* Min and max ref. variables for the function */
+		int type;				/* Function node type.  exprEvalNOde solves the function */
 
-    struct _exprFunc *next; /* For linked list */
-    };
+		struct _exprFunc *next;	/* For linked list */
+	};
 
 /* Function list object */
-struct _exprFuncList
-    {
-    struct _exprFunc *head;
-    };
+	struct _exprFuncList {
+		struct _exprFunc *head;
+	};
 
 /* Object for values */
-struct _exprVal
-    {
-    char *vname; /* Name of the value */
-    EXPRTYPE vval; /* Value of the value */
-    EXPRTYPE *vptr; /* Pointer to a value.  Used only if not NULL */
+	struct _exprVal {
+		char *vname;			/* Name of the value */
+		EXPRTYPE vval;			/* Value of the value */
+		EXPRTYPE *vptr;			/* Pointer to a value.  Used only if not NULL */
 
-    struct _exprVal *next; /* For linked list */
-    };
+		struct _exprVal *next;	/* For linked list */
+	};
 
 /* Value list */
-struct _exprValList
-    {
-    struct _exprVal *head;
-    };
+	struct _exprValList {
+		struct _exprVal *head;
+	};
 
 /* Expression node type */
-struct _exprNode
-    {
-    int type; /* Node type */
+	struct _exprNode {
+		int type;				/* Node type */
 
-    union _data /* Union of info for various types */
-        {
-        struct _oper
-            {
-            struct _exprNode *nodes; /* Operation arguments */
-            int nodecount; /* Number of arguments */
-            } oper;
+		union _data {			/* Union of info for various types */
+			struct _oper {
+				struct _exprNode *nodes;	/* Operation arguments */
+				int nodecount;	/* Number of arguments */
+			} oper;
 
-        struct _variable
-            {
-            EXPRTYPE *vaddr; /* Used if EXPR_FAST_VAR_ACCESS defined */
-            } variable;
+			struct _variable {
+				EXPRTYPE *vaddr;	/* Used if EXPR_FAST_VAR_ACCESS defined */
+			} variable;
 
-        struct _value
-            {
-            EXPRTYPE value; /* Value if type is value */
-            } value;
+			struct _value {
+				EXPRTYPE value;	/* Value if type is value */
+			} value;
 
-        struct _assign /* Assignment struct */
-            {
-            EXPRTYPE *vaddr; /* Used if EXPR_FAST_VAR_ACCESS defined */
-            struct _exprNode *node; /* Node to evaluate */
-            } assign;
+			struct _assign {	/* Assignment struct */
+				EXPRTYPE *vaddr;	/* Used if EXPR_FAST_VAR_ACCESS defined */
+				struct _exprNode *node;	/* Node to evaluate */
+			} assign;
 
-        struct _function
-            {
-            exprFuncType fptr; /* Function pointer */
-            struct _exprNode *nodes; /* Array of argument nodes */
-            int nodecount; /* Number of argument nodes */
-            EXPRTYPE **refs; /* Reference variables */
-            int refcount; /* Number of variable references (not a reference counter) */
-            int type; /* Type of function for exprEvalNode if fptr is NULL */
-            } function;
-        } data;
-    };
+			struct _function {
+				exprFuncType fptr;	/* Function pointer */
+				struct _exprNode *nodes;	/* Array of argument nodes */
+				int nodecount;	/* Number of argument nodes */
+				EXPRTYPE **refs;	/* Reference variables */
+				int refcount;	/* Number of variable references (not a reference counter) */
+				int type;		/* Type of function for exprEvalNode if fptr is NULL */
+			} function;
+		} data;
+	};
 
 
 
 /* Functions for function lists */
-int exprFuncListAddType(exprFuncList *flist, char *name, int type, int min, int max, int refmin, int refmax);
-int exprFuncListGet(exprFuncList *flist, char *name, exprFuncType *ptr, int *type, int *min, int *max, int *refmin, int *refmax);
+	int exprFuncListAddType(exprFuncList * flist, char *name, int type, int min, int max, int refmin, int refmax);
+	int exprFuncListGet(exprFuncList * flist, char *name, exprFuncType * ptr, int *type, int *min, int *max, int *refmin, int *refmax);
 
 #ifdef WIN32
 #define SWITCH_DECLARE(type)			__declspec(dllimport) type __stdcall
 #else
-#define SWITCH_DECLARE(type) type 
+#define SWITCH_DECLARE(type) type
 #endif
 
-SWITCH_DECLARE(int) switch_isalnum(int c);
-SWITCH_DECLARE(int) switch_isalpha(int c);
-SWITCH_DECLARE(int) switch_isdigit(int c);
-SWITCH_DECLARE(int) switch_isspace(int c);
+	    SWITCH_DECLARE(int) switch_isalnum(int c);
+	    SWITCH_DECLARE(int) switch_isalpha(int c);
+	    SWITCH_DECLARE(int) switch_isdigit(int c);
+	    SWITCH_DECLARE(int) switch_isspace(int c);
 
 #ifdef __cplusplus
 }
 #endif
-
-#endif /* __BAVII_EXPRPRIV_H */
-
+#endif							/* __BAVII_EXPRPRIV_H */

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/mod_expr.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/mod_expr.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_expr/mod_expr.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_fax/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_fax/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_fax/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,22 +1,25 @@
 BASE=../../../..
 
-TIFF_DIR=$(BASE)/libs/tiff-3.8.2
-TIFF_LA=$(TIFF_DIR)/libtiff/libtiff.la
+TIFF_DIR=$(switch_srcdir)/libs/tiff-3.8.2
+TIFF_BUILDDIR=$(switch_builddir)/libs/tiff-3.8.2
+TIFF_LA=$(TIFF_BUILDDIR)/libtiff/libtiff.la
 
-SPANDSP_DIR=$(BASE)/libs/spandsp
-SPANDSP_LA=$(SPANDSP_DIR)/src/libspandsp.la
+SPANDSP_DIR=$(switch_srcdir)/libs/spandsp
+SPANDSP_BUILDDIR=$(switch_builddir)/libs/spandsp
+SPANDSP_LA=$(SPANDSP_BUILDDIR)/src/libspandsp.la
 
-LOCAL_CFLAGS=-I$(SPANDSP_DIR)/src -I$(TIFF_DIR)/libtiff
+LOCAL_CFLAGS=-I$(SPANDSP_DIR)/src -I$(TIFF_DIR)/libtiff -I$(SPANDSP_BUILDDIR)/src -I$(TIFF_BUILDDIR)/libtiff
 LOCAL_LIBADD=$(SPANDSP_LA)
 
 include $(BASE)/build/modmake.rules
+$(MODNAME).lo: $(SPANDSP_LA) $(TIFF_LA)
 
 $(SPANDSP_LA): $(TIFF_LA) $(SPANDSP_DIR) $(SPANDSP_DIR)/.update
-	cd $(SPANDSP_DIR) && $(MAKE)
+	cd $(SPANDSP_BUILDDIR) && $(MAKE) -j1
 	$(TOUCH_TARGET)
 
 $(TIFF_LA): $(TIFF_DIR) $(TIFF_DIR)/.update
-	cd $(TIFF_DIR) && $(MAKE)
+	cd $(TIFF_BUILDDIR) && $(MAKE) -j1
 	$(TOUCH_TARGET)
 
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_fax/mod_fax.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_fax/mod_fax.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_fax/mod_fax.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -88,12 +88,12 @@
 
 	int tx_page_start;
 	int tx_page_end;
-	
+
 	int done;
 
 	/* UNUSED AT THE MOMENT
 	   int          enable_t38_reinvite;
-	*/
+	 */
 
 };
 
@@ -141,7 +141,7 @@
 /*
  * Called at the end of the document
  */
-static void phase_e_handler(t30_state_t * s, void *user_data, int result)
+static void phase_e_handler(t30_state_t *s, void *user_data, int result)
 {
 	t30_stats_t t;
 	const char *local_ident;
@@ -153,7 +153,7 @@
 
 	pvt = (pvt_t *) user_data;
 	switch_assert(pvt);
-	
+
 	session = pvt->session;
 	switch_assert(session);
 
@@ -184,8 +184,8 @@
 
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Remote station id: %s\n", far_ident);
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Local station id:  %s\n", local_ident);
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Pages transferred: %i\n", 
-		pvt->app_mode == FUNCTION_TX ? t.pages_rx : t.pages_rx);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Pages transferred: %i\n",
+					  pvt->app_mode == FUNCTION_TX ? t.pages_rx : t.pages_rx);
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Total fax pages:   %i\n", t.pages_in_file);
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Image resolution:  %ix%i\n", t.x_resolution, t.y_resolution);
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Transfer Rate:     %i\n", t.bit_rate);
@@ -195,11 +195,12 @@
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote vendor:    %s\n", switch_str_nil(t30_get_rx_vendor(s)));
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "remote model:     %s\n", switch_str_nil(t30_get_rx_model(s)));
 
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "==============================================================================\n");
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+					  "==============================================================================\n");
 
 	/*
-	Set our channel variables
-	*/
+	   Set our channel variables
+	 */
 
 	tmp = switch_mprintf("%i", result);
 	if (tmp) {
@@ -250,15 +251,15 @@
 	}
 
 	/* switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); */
-	
+
 	pvt->done = 1;
 
 	/*
-	TODO Fire events
-	*/
+	   TODO Fire events
+	 */
 }
 
-static switch_status_t spanfax_init(pvt_t * pvt, transport_mode_t trans_mode)
+static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode)
 {
 
 	switch_core_session_t *session;
@@ -342,7 +343,7 @@
 		   Here goes the T.38 SpanDSP initializing functions 
 		   T.38 will require a big effort as it needs a different approach
 		   but the pieces are already in place
-		*/
+		 */
 	default:
 		assert(0);				/* Whaaat ? */
 		break;
@@ -351,7 +352,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t spanfax_destroy(pvt_t * pvt)
+static switch_status_t spanfax_destroy(pvt_t *pvt)
 {
 	int terminate;
 	t30_state_t *t30;
@@ -403,9 +404,9 @@
 	switch_codec_t write_codec = { 0 };
 	switch_frame_t *read_frame = { 0 };
 	switch_frame_t write_frame = { 0 };
-    switch_codec_implementation_t read_impl = {0};
+	switch_codec_implementation_t read_impl = { 0 };
 	int16_t *buf = NULL;
-    switch_core_session_get_read_impl(session, &read_impl);
+	switch_core_session_get_read_impl(session, &read_impl);
 
 	/* make sure we have a valid channel when starting the FAX application */
 	channel = switch_core_session_get_channel(session);
@@ -414,7 +415,7 @@
 	if (!switch_channel_media_ready(channel)) {
 		switch_channel_answer(channel);
 	}
-	
+
 	/* Allocate our structs */
 	pvt = switch_core_session_alloc(session, sizeof(pvt_t));
 
@@ -468,8 +469,8 @@
 		pvt->verbose = globals.verbose;
 	}
 
-	if ( (tmp=switch_channel_get_variable(channel, "fax_force_caller")) ) {
-		if ( switch_true(tmp) ) {
+	if ((tmp = switch_channel_get_variable(channel, "fax_force_caller"))) {
+		if (switch_true(tmp)) {
 			pvt->caller = 1;
 		} else {
 			pvt->caller = 0;
@@ -515,7 +516,8 @@
 		pvt->filename = switch_core_session_strdup(session, data);
 		if (pvt->app_mode == FUNCTION_TX) {
 			if ((switch_file_exists(pvt->filename, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS)) {
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot send inexistant fax file [%s]\n", switch_str_nil(pvt->filename));
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot send inexistant fax file [%s]\n",
+								  switch_str_nil(pvt->filename));
 				goto done;
 			}
 		}
@@ -548,12 +550,12 @@
 	}
 
 	/*
-	*** Initialize the SpanDSP elements ***
+	 *** Initialize the SpanDSP elements ***
 
-	Note: we could analyze if a fax was already detected in previous stages
-	and if so, when T.38 will be supported, send a reinvite in T38_MODE,
-	bypassing AUDIO_MODE.
-	*/
+	 Note: we could analyze if a fax was already detected in previous stages
+	 and if so, when T.38 will be supported, send a reinvite in T38_MODE,
+	 bypassing AUDIO_MODE.
+	 */
 
 	if ((spanfax_init(pvt, AUDIO_MODE) != SWITCH_STATUS_SUCCESS)) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot initialize Fax engine\n");
@@ -563,14 +565,14 @@
 	/* 
 	   Note: Disable echocan on the channel, remember to call app "disable_ec" in the dialplan
 	   before invoking fax applications
-	*/
+	 */
 
 	/*
-	Note: we are disabling the Jitterbuffer, here, before we answer.
-	If you have set it to something else and the channel is pre-answered,
-	it will have no effect. Make sure that if you want more reliable
-	faxes, it is disabled.
-	*/
+	   Note: we are disabling the Jitterbuffer, here, before we answer.
+	   If you have set it to something else and the channel is pre-answered,
+	   it will have no effect. Make sure that if you want more reliable
+	   faxes, it is disabled.
+	 */
 	switch_channel_set_variable(channel, "jitterbuffer_msec", "0");
 
 
@@ -614,7 +616,7 @@
 	}
 
 	switch_ivr_sleep(session, 250, SWITCH_TRUE, NULL);
-	
+
 	while (switch_channel_ready(channel)) {
 		int tx = 0;
 		switch_status_t status;
@@ -628,7 +630,7 @@
 		   - call t38_terminal_send_timeout(), sleep for a while
 
 		   The T.38 stuff can be placed here (and the audio stuff can be skipped)
-		*/
+		 */
 
 		/* read new audio frame from the channel */
 		status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
@@ -640,7 +642,7 @@
 
 		/* Skip CNG frames (auto-generated by FreeSWITCH, usually) */
 		if (!switch_test_flag(read_frame, SFF_CNG)) {
-		/* pass the new incoming audio frame to the fax_rx function */
+			/* pass the new incoming audio frame to the fax_rx function */
 			if (fax_rx(pvt->fax_state, (int16_t *) read_frame->data, read_frame->samples)) {
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "fax_rx reported an error\n");
 				goto done;
@@ -670,13 +672,13 @@
 
 	}
 
- done:
+  done:
 	/* Destroy the SpanDSP structures */
 	spanfax_destroy(pvt);
 
 	/* restore the original codecs over the channel */
 
-    switch_core_session_set_read_codec(session, NULL);
+	switch_core_session_set_read_codec(session, NULL);
 
 	if (switch_core_codec_ready(&read_codec)) {
 		switch_core_codec_destroy(&read_codec);
@@ -782,8 +784,10 @@
 
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
-	SWITCH_ADD_APP(app_interface, "rxfax", "FAX Receive Application", "FAX Receive Application", spanfax_rx_function, SPANFAX_RX_USAGE, SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "txfax", "FAX Transmit Application", "FAX Transmit Application", spanfax_tx_function, SPANFAX_TX_USAGE, SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "rxfax", "FAX Receive Application", "FAX Receive Application", spanfax_rx_function, SPANFAX_RX_USAGE,
+				   SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "txfax", "FAX Transmit Application", "FAX Transmit Application", spanfax_tx_function, SPANFAX_TX_USAGE,
+				   SAF_SUPPORT_NOMEDIA);
 
 	memset(&globals, 0, sizeof(globals));
 	switch_core_new_memory_pool(&globals.pool);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_fifo/mod_fifo.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_fifo/mod_fifo.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_fifo/mod_fifo.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -90,11 +90,10 @@
 			const char *consumer_exit_key = switch_channel_get_variable(channel, "fifo_consumer_exit_key");
 
 			if (switch_channel_test_flag(switch_core_session_get_channel(session), CF_BRIDGE_ORIGINATOR)) {
-				if ( consumer_exit_key && dtmf->digit == *consumer_exit_key ) {
+				if (consumer_exit_key && dtmf->digit == *consumer_exit_key) {
 					switch_channel_hangup(bchan, SWITCH_CAUSE_NORMAL_CLEARING);
 					return SWITCH_STATUS_BREAK;
-				}
-				else if ( !consumer_exit_key && dtmf->digit == '*' ) {
+				} else if (!consumer_exit_key && dtmf->digit == '*') {
 					switch_channel_hangup(bchan, SWITCH_CAUSE_NORMAL_CLEARING);
 					return SWITCH_STATUS_BREAK;
 				} else if (dtmf->digit == '0') {
@@ -228,8 +227,8 @@
 			args.buflen = sizeof(buf);
 
 			if (switch_ivr_play_file(session, NULL, cd->list[cd->index], &args) != SWITCH_STATUS_SUCCESS) {
-                return SWITCH_STATUS_FALSE;
-            }
+				return SWITCH_STATUS_FALSE;
+			}
 
 			if (caller_exit_key && *buf == *caller_exit_key) {
 				cd->abort = 1;
@@ -250,8 +249,8 @@
 {
 	fifo_node_t *node, **node_list = (fifo_node_t **) user_data;
 	int x = 0, total = 0, i = 0;
-	
-	for (i = 0 ;; i++) {
+
+	for (i = 0;; i++) {
 		if (!(node = node_list[i])) {
 			break;
 		}
@@ -277,50 +276,55 @@
 	char hostname[256];
 	char *dbname;
 	char *odbc_dsn;
+	char *odbc_user;
+	char *odbc_pass;
 	int node_thread_running;
 	switch_odbc_handle_t *master_odbc;
 } globals;
 
 
+switch_cache_db_handle_t *fifo_get_db_handle(void)
+{
+	switch_cache_db_connection_options_t options = { {0} };
+	switch_cache_db_handle_t *dbh = NULL;
+
+	if (!zstr(globals.odbc_dsn)) {
+		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 fifo_execute_sql(char *sql, switch_mutex_t *mutex)
 {
-	switch_core_db_t *db;
-	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	char *err_str;
+	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) {
-			
-			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;
-		}
-
-		err_str = NULL;
-		switch_core_db_exec(db, sql, NULL, NULL, &err_str);
-		if (err_str) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error [%s]\n[%s]\n", sql, err_str);
-			free(err_str);
-		}
-		switch_core_db_close(db);
+	if (!(dbh = fifo_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);
 	}
@@ -331,34 +335,29 @@
 static switch_bool_t fifo_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 = fifo_get_db_handle())) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
+		goto end;
+	}
 
-		switch_core_db_exec(db, sql, callback, pdata, &errmsg);
+	switch_cache_db_execute_sql_callback(dbh, 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);
 	}
@@ -431,7 +430,7 @@
 	switch_mutex_unlock(node->mutex);
 
 	return total;
-	
+
 }
 
 static switch_status_t hanguphook(switch_core_session_t *session)
@@ -443,9 +442,10 @@
 
 	if (state == CS_HANGUP || state == CS_ROUTING) {
 		if ((uuid = switch_channel_get_variable(channel, "fifo_outbound_uuid"))) {
-			switch_snprintf(sql, sizeof(sql), "update fifo_outbound set use_count=use_count-1, outbound_call_count=outbound_call_count+1, next_avail=%ld + lag where uuid='%s'", 
-							(long)switch_epoch_time_now(NULL), uuid);
-							
+			switch_snprintf(sql, sizeof(sql),
+							"update fifo_outbound set use_count=use_count-1, outbound_call_count=outbound_call_count+1, next_avail=%ld + lag where uuid='%s'",
+							(long) switch_epoch_time_now(NULL), uuid);
+
 			fifo_execute_sql(sql, globals.sql_mutex);
 		}
 		switch_core_event_hook_remove_state_change(session, hanguphook);
@@ -478,7 +478,7 @@
 	switch_mutex_lock(globals.mutex);
 	node = switch_core_hash_find(globals.fifo_hash, h->node_name);
 	switch_mutex_unlock(globals.mutex);
-	
+
 	if (node) {
 		switch_mutex_lock(node->mutex);
 		node->ring_consumer_count++;
@@ -487,19 +487,21 @@
 
 	switch_snprintf(sql, sizeof(sql), "update fifo_outbound set use_count=use_count+1 where uuid='%s'", h->uuid);
 	fifo_execute_sql(sql, globals.sql_mutex);
-	
+
 	switch_event_create(&ovars, SWITCH_EVENT_REQUEST_PARAMS);
 	switch_assert(ovars);
 	switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "originate_timeout", "%d", h->timeout);
-	
-	if (switch_ivr_originate(NULL, &session, &cause, h->originate_string, h->timeout, NULL, NULL, NULL, NULL, ovars, SOF_NONE, NULL) != SWITCH_STATUS_SUCCESS) {
-		switch_snprintf(sql, sizeof(sql), "update fifo_outbound set use_count=use_count-1, outbound_fail_count=outbound_fail_count+1, next_avail=%ld + lag where uuid='%s'", 
-						(long)switch_epoch_time_now(NULL), h->uuid);
+
+	if (switch_ivr_originate(NULL, &session, &cause, h->originate_string, h->timeout, NULL, NULL, NULL, NULL, ovars, SOF_NONE, NULL) !=
+		SWITCH_STATUS_SUCCESS) {
+		switch_snprintf(sql, sizeof(sql),
+						"update fifo_outbound set use_count=use_count-1, outbound_fail_count=outbound_fail_count+1, next_avail=%ld + lag where uuid='%s'",
+						(long) switch_epoch_time_now(NULL), h->uuid);
 		fifo_execute_sql(sql, globals.sql_mutex);
 		goto end;
 	}
-	
 
+
 	channel = switch_core_session_get_channel(session);
 
 	if ((member_wait = switch_channel_get_variable(channel, "fifo_member_wait")) || (member_wait = switch_channel_get_variable(channel, "member_wait"))) {
@@ -523,7 +525,8 @@
 	switch_event_destroy(&ovars);
 	if (node) {
 		switch_mutex_lock(node->mutex);
-		if (node->ring_consumer_count-- < 0) node->ring_consumer_count = 0;
+		if (node->ring_consumer_count-- < 0)
+			node->ring_consumer_count = 0;
 		switch_mutex_unlock(node->mutex);
 	}
 	switch_core_destroy_memory_pool(&h->pool);
@@ -540,7 +543,7 @@
 	switch_threadattr_t *thd_attr = NULL;
 	switch_memory_pool_t *pool;
 	struct call_helper *h;
-	
+
 	switch_core_new_memory_pool(&pool);
 	h = switch_core_alloc(pool, sizeof(*h));
 	h->pool = pool;
@@ -556,7 +559,7 @@
 	switch_thread_create(&thread, thd_attr, o_thread_run, h, h->pool);
 
 	(*need)--;
-	
+
 	return *need ? 0 : -1;
 }
 
@@ -578,10 +581,10 @@
 static void *SWITCH_THREAD_FUNC node_thread_run(switch_thread_t *thread, void *obj)
 {
 	fifo_node_t *node;
-	
+
 	globals.node_thread_running = 1;
 
-	while(globals.node_thread_running == 1) {
+	while (globals.node_thread_running == 1) {
 		switch_hash_index_t *hi;
 		void *val;
 		const void *var;
@@ -590,22 +593,22 @@
 		switch_mutex_lock(globals.mutex);
 		for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
 			switch_hash_this(hi, &var, NULL, &val);
-			if ((node = (fifo_node_t *) val)) { 
-			if (node->has_outbound && node->ready) {
-				switch_mutex_lock(node->mutex);
-				ppl_waiting = node_consumer_wait_count(node);
-				consumer_total = node->consumer_count;
-				idle_consumers = node_idle_consumers(node);
+			if ((node = (fifo_node_t *) val)) {
+				if (node->has_outbound && node->ready) {
+					switch_mutex_lock(node->mutex);
+					ppl_waiting = node_consumer_wait_count(node);
+					consumer_total = node->consumer_count;
+					idle_consumers = node_idle_consumers(node);
 
-				/* switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
-				"%s waiting %d consumer_total %d idle_consumers %d ring_consumers %d\n", node->name, ppl_waiting, consumer_total, idle_consumers, node->ring_consumer_count); */
-		
-				if ((ppl_waiting - node->ring_consumer_count > 0)&& (!consumer_total || !idle_consumers)) {
-					find_consumers(node);
+					/* switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
+					   "%s waiting %d consumer_total %d idle_consumers %d ring_consumers %d\n", node->name, ppl_waiting, consumer_total, idle_consumers, node->ring_consumer_count); */
+
+					if ((ppl_waiting - node->ring_consumer_count > 0) && (!consumer_total || !idle_consumers)) {
+						find_consumers(node);
+					}
+					switch_mutex_unlock(node->mutex);
 				}
-				switch_mutex_unlock(node->mutex);
 			}
-			}
 		}
 		switch_mutex_unlock(globals.mutex);
 
@@ -613,7 +616,7 @@
 	}
 
 	globals.node_thread_running = 0;
-	
+
 	return NULL;
 }
 
@@ -634,7 +637,7 @@
 
 	if (globals.node_thread_running) {
 		globals.node_thread_running = -1;
-		while(globals.node_thread_running) {
+		while (globals.node_thread_running) {
 			switch_yield(500000);
 			if (!--sanity) {
 				return -1;
@@ -645,15 +648,15 @@
 	return 0;
 }
 
-static void check_cancel(fifo_node_t *node) 
+static void check_cancel(fifo_node_t *node)
 {
 	int ppl_waiting = node_consumer_wait_count(node);
-		
+
 	if (node->ring_consumer_count > 0 && ppl_waiting < 1) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Outbound call count (%d) exceeds required value for queue %s (%d), "
 						  "Ending extraneous calls\n", node->ring_consumer_count, node->name, ppl_waiting);
-						  
-						  
+
+
 		switch_core_session_hupall_matching_var("fifo_hangup_check", node->name, SWITCH_CAUSE_ORIGINATOR_CANCEL);
 	}
 }
@@ -737,12 +740,12 @@
 	}
 
 	switch_mutex_unlock(globals.mutex);
-	
+
 	str = switch_mprintf("dial:%s", url);
 	switch_queue_push(node->fifo_list[priority], (void *) str);
-	
+
 	return switch_queue_size(node->fifo_list[priority]);
-	
+
 }
 
 
@@ -771,16 +774,16 @@
 
 	stream->write_function(stream, "%d", fifo_add_outbound(argv[0], argv[1], priority));
 
-	
-	free(data);	
-	return SWITCH_STATUS_SUCCESS;	
 
+	free(data);
+	return SWITCH_STATUS_SUCCESS;
 
- fail:
 
-	free(data);	
+  fail:
+
+	free(data);
 	stream->write_function(stream, "0");
-	return SWITCH_STATUS_SUCCESS;	
+	return SWITCH_STATUS_SUCCESS;
 
 }
 
@@ -870,7 +873,7 @@
 			}
 		}
 
-		
+
 		if (!(node = switch_core_hash_find(globals.fifo_hash, nlist[i]))) {
 			node = create_node(nlist[i], importance, globals.sql_mutex);
 			node->ready = 1;
@@ -878,7 +881,7 @@
 		node_list[node_count++] = node;
 	}
 
-	if(switch_true(switch_channel_get_variable(channel, "fifo_destroy_after_use"))) {
+	if (switch_true(switch_channel_get_variable(channel, "fifo_destroy_after_use"))) {
 		node->ready = FIFO_DELAY_DESTROY;
 	}
 
@@ -984,7 +987,7 @@
 			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "FIFO-Slot", "%d", p);
 			switch_event_fire(&event);
 		}
-		
+
 		switch_queue_push(node->fifo_list[p], (void *) strdup(uuid));
 		switch_snprintf(tmp, sizeof(tmp), "%d", switch_queue_size(node->fifo_list[p]));
 		switch_channel_set_variable(channel, "fifo_position", tmp);
@@ -1302,14 +1305,15 @@
 				switch_call_cause_t cause = SWITCH_CAUSE_NONE;
 				const char *o_announce = NULL;
 				url = uuid + 5;
-				
+
 				if ((o_announce = switch_channel_get_variable(channel, "fifo_outbound_announce"))) {
 					switch_ivr_play_file(session, NULL, o_announce, NULL);
 				}
 
 				if (switch_ivr_originate(session, &other_session, &cause, url, 120, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL) != SWITCH_STATUS_SUCCESS) {
 					other_session = NULL;
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Originate to [%s] failed, cause: %s\n", url, switch_channel_cause2str(cause));
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Originate to [%s] failed, cause: %s\n", url,
+									  switch_channel_cause2str(cause));
 
 					if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
 						switch_channel_event_set_data(channel, event);
@@ -1319,7 +1323,7 @@
 						switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Outbound-URL", url);
 						switch_event_fire(&event);
 					}
-					
+
 				} else {
 					if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
 						switch_channel_event_set_data(channel, event);
@@ -1328,7 +1332,7 @@
 						switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Result", "success");
 						switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Outbound-URL", url);
 						switch_event_fire(&event);
-					}					
+					}
 					url = NULL;
 					free(uuid);
 					uuid = strdup(switch_core_session_get_uuid(other_session));
@@ -1353,7 +1357,7 @@
 				const char *record_template = switch_channel_get_variable(channel, "fifo_record_template");
 				char *expanded = NULL;
 
-				
+
 				if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
 					switch_channel_event_set_data(channel, event);
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Name", argv[0]);
@@ -1387,7 +1391,7 @@
 					const char *app = switch_channel_get_variable(other_channel, "current_application");
 					const char *arg = switch_channel_get_variable(other_channel, "current_application_data");
 					switch_caller_extension_t *extension = NULL;
-					
+
 					switch_mutex_lock(node->mutex);
 					node->caller_count--;
 					switch_core_hash_delete(node->caller_hash, uuid);
@@ -1456,7 +1460,7 @@
 				switch_ivr_multi_threaded_bridge(session, other_session, on_dtmf, other_session, session);
 				switch_core_media_bug_pause(session);
 				switch_core_media_bug_pause(other_session);
-				
+
 				if (record_template) {
 					switch_ivr_stop_record_session(session, expanded);
 					if (expanded != record_template) {
@@ -1489,7 +1493,7 @@
 				fifo_consumer_wrapup_sound = switch_channel_get_variable(channel, "fifo_consumer_wrapup_sound");
 				fifo_consumer_wrapup_key = switch_channel_get_variable(channel, "fifo_consumer_wrapup_key");
 				sfifo_consumer_wrapup_time = switch_channel_get_variable(channel, "fifo_consumer_wrapup_time");
-				if (!zstr(sfifo_consumer_wrapup_time)){
+				if (!zstr(sfifo_consumer_wrapup_time)) {
 					fifo_consumer_wrapup_time = atoi(sfifo_consumer_wrapup_time);
 				} else {
 					fifo_consumer_wrapup_time = 5000;
@@ -1513,15 +1517,15 @@
 					args.buflen = sizeof(buf);
 					switch_ivr_play_file(session, NULL, fifo_consumer_wrapup_sound, &args);
 				}
-				
+
 				if (fifo_consumer_wrapup_time) {
 					wrapup_time_started = switch_micro_time_now();
 				}
 
 				if (!zstr(fifo_consumer_wrapup_key) && strcmp(buf, fifo_consumer_wrapup_key)) {
-					while(switch_channel_ready(channel)) {
+					while (switch_channel_ready(channel)) {
 						char terminator = 0;
-						
+
 						if (fifo_consumer_wrapup_time) {
 							wrapup_time_elapsed = (switch_micro_time_now() - wrapup_time_started) / 1000;
 							if (wrapup_time_elapsed > fifo_consumer_wrapup_time) {
@@ -1531,14 +1535,15 @@
 							}
 						}
 
-						switch_ivr_collect_digits_count(session, buf, sizeof(buf) - 1, 1, fifo_consumer_wrapup_key, &terminator, 0, 0, (uint32_t) wrapup_time_remaining);
+						switch_ivr_collect_digits_count(session, buf, sizeof(buf) - 1, 1, fifo_consumer_wrapup_key, &terminator, 0, 0,
+														(uint32_t) wrapup_time_remaining);
 						if ((terminator == *fifo_consumer_wrapup_key) || !(switch_channel_ready(channel))) {
 							break;
 						}
 
 					}
 				} else if (fifo_consumer_wrapup_time && (zstr(fifo_consumer_wrapup_key) || !strcmp(buf, fifo_consumer_wrapup_key))) {
-					while(switch_channel_ready(channel)) {
+					while (switch_channel_ready(channel)) {
 						wrapup_time_elapsed = (switch_micro_time_now() - wrapup_time_started) / 1000;
 						if (wrapup_time_elapsed > fifo_consumer_wrapup_time) {
 							break;
@@ -1548,7 +1553,7 @@
 				}
 				switch_channel_set_variable(channel, "fifo_status", "WAITING");
 			}
-			
+
 			if (do_wait && switch_channel_ready(channel)) {
 				if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
 					switch_channel_event_set_data(channel, event);
@@ -1558,7 +1563,7 @@
 				}
 			}
 		}
-		
+
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
 			switch_channel_event_set_data(channel, event);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Name", argv[0]);
@@ -1579,7 +1584,7 @@
 		}
 	}
 
- done:
+  done:
 
 	switch_mutex_lock(globals.mutex);
 	if (node && node->ready == FIFO_DELAY_DESTROY && node->consumer_count == 0 && node->caller_count == 0) {
@@ -1638,7 +1643,7 @@
 	switch_xml_set_attr_d(x_out, "outbound-call-count", argv[10]);
 	switch_xml_set_attr_d(x_out, "outbound-fail-count", argv[11]);
 	switch_xml_set_attr_d(x_out, "next-available", expires);
-	
+
 	switch_xml_set_txt_d(x_out, argv[2]);
 
 	return 0;
@@ -1659,7 +1664,7 @@
 	h.verbose = verbose;
 
 	fifo_execute_sql_callback(globals.sql_mutex, sql, xml_callback, &h);
-	
+
 	switch_safe_free(sql);
 
 	return h.cc_off;
@@ -1738,7 +1743,7 @@
 	switch_xml_set_attr_d(x_fifo, "waiting_count", tmp);
 	switch_snprintf(tmp, sizeof(buffer), "%u", node->importance);
 	switch_xml_set_attr_d(x_fifo, "importance", tmp);
-	
+
 	cc_off = xml_outbound(x_fifo, node, "outbound", "member", cc_off, verbose);
 	cc_off = xml_hash(x_fifo, node->caller_hash, "callers", "caller", cc_off, verbose);
 	cc_off = xml_hash(x_fifo, node->consumer_hash, "consumers", "consumer", cc_off, verbose);
@@ -1853,7 +1858,7 @@
 }
 
 
-const char outbound_sql[] = 
+const char outbound_sql[] =
 	"create table fifo_outbound (\n"
 	" uuid varchar(255),\n"
 	" fifo_name varchar(255),\n"
@@ -1863,24 +1868,17 @@
 	" timeout integer,\n"
 	" lag integer,\n"
 	" next_avail integer,\n"
-	" expires integer,\n"
-	" static integer,\n"
-	" outbound_call_count integer,"
-	" outbound_fail_count integer,"
-	" hostname varchar(255)\n"
-	");\n";
+	" expires integer,\n" " static integer,\n" " outbound_call_count integer," " outbound_fail_count integer," " hostname varchar(255)\n" ");\n";
 
 
 static switch_status_t load_config(int reload, int del_all)
 {
 	char *cf = "fifo.conf";
 	switch_xml_t cfg, xml, fifo, fifos, member, settings, param;
-	char *odbc_user = NULL;
-	char *odbc_pass = NULL;
-	switch_core_db_t *db;
-	switch_status_t status = SWITCH_STATUS_SUCCESS;	
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	char *sql;
 	switch_bool_t delete_all_outbound_member_on_startup = SWITCH_FALSE;
+	switch_cache_db_handle_t *dbh = NULL;
 
 	gethostname(globals.hostname, sizeof(globals.hostname));
 
@@ -1900,10 +1898,10 @@
 			if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
 				if (switch_odbc_available()) {
 					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';
+					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 {
@@ -1915,39 +1913,20 @@
 		}
 	}
 
-	if (zstr(globals.odbc_dsn) || zstr(odbc_user) || zstr(odbc_pass)) {
+	if (zstr(globals.odbc_dsn)) {
 		globals.dbname = "fifo";
 	}
 
-	if (switch_odbc_available() && globals.odbc_dsn) {
-		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, "delete from fifo_outbound", NULL) != SWITCH_STATUS_SUCCESS) {
-			if (switch_odbc_handle_exec(globals.master_odbc, (char *)outbound_sql, NULL) != SWITCH_STATUS_SUCCESS) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Create SQL Database!\n");
-			}
-		}
-	} else {
-		if ((db = switch_core_db_open_file(globals.dbname))) {
-			switch_core_db_test_reactive(db, "delete from fifo_outbound where static = 1", NULL, (char *)outbound_sql);
-		} 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);
+
+	if (!(dbh = fifo_get_db_handle())) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot open DB!\n");
+		goto done;
 	}
 
+	switch_cache_db_test_reactive(dbh, "delete from fifo_outbound where static = 1", "drop table fifo_outbound", outbound_sql);
+	switch_cache_db_release_db_handle(&dbh);
+
 	if (reload) {
 		switch_hash_index_t *hi;
 		fifo_node_t *node;
@@ -1962,12 +1941,12 @@
 		switch_mutex_unlock(globals.mutex);
 	}
 
-	if ((reload && del_all) || (!reload && delete_all_outbound_member_on_startup) ) {
+	if ((reload && del_all) || (!reload && delete_all_outbound_member_on_startup)) {
 		sql = switch_mprintf("delete from fifo_outbound where hostname='%q'", globals.hostname);
 	} else {
 		sql = switch_mprintf("delete from fifo_outbound where static=1 and hostname='%q'", globals.hostname);
 	}
-	
+
 	fifo_execute_sql(sql, globals.sql_mutex);
 	switch_safe_free(sql);
 
@@ -1982,14 +1961,14 @@
 			int timeout_i = 60;
 			int lag_i = 10;
 			fifo_node_t *node;
-			
+
 			name = switch_xml_attr(fifo, "name");
-			
+
 			if ((importance = switch_xml_attr(fifo, "importance"))) {
 				if ((imp = atoi(importance)) < 0) {
 					imp = 0;
 				}
-			}				
+			}
 
 			if (!name) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "fifo has no name!\n");
@@ -2001,11 +1980,11 @@
 				node = create_node(name, imp, globals.sql_mutex);
 			}
 			switch_mutex_unlock(globals.mutex);
-			
+
 			switch_assert(node);
-			
+
 			switch_mutex_lock(node->mutex);
-			
+
 			for (member = switch_xml_child(fifo, "member"); member; member = member->next) {
 				const char *simo = switch_xml_attr_soft(member, "simo");
 				const char *lag = switch_xml_attr_soft(member, "lag");
@@ -2030,12 +2009,12 @@
 						lag_i = 10;
 					}
 				}
-				
+
 				name_dup = strdup(node->name);
 				if ((p = strchr(name_dup, '@'))) {
 					*p = '\0';
 				}
-				
+
 				if (switch_stristr("origination_caller_id", member->txt)) {
 					sql = switch_mprintf("insert into fifo_outbound "
 										 "(uuid, fifo_name, originate_string, simo_count, use_count, timeout, lag, "
@@ -2053,7 +2032,7 @@
 										 "'{execute_on_answer=''unset fifo_hangup_check'',fifo_hangup_check=''%q'',origination_caller_id_name=Queue,"
 										 "origination_caller_id_number=''fifo+%q''}%q',%d,%d,%d,%d,0,0,1,0,0,'%q')",
 										 digest, node->name, node->name, name_dup, member->txt, simo_i, 0, timeout_i, lag_i, globals.hostname);
-										 
+
 				}
 
 				switch_assert(sql);
@@ -2061,14 +2040,14 @@
 				free(sql);
 				free(name_dup);
 				node->has_outbound = 1;
-				
+
 			}
 			node->ready = 1;
 			node->is_static = 1;
 			switch_mutex_unlock(node->mutex);
-			
+
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s configured\n", node->name);
-		
+
 		}
 	}
 	switch_xml_free(xml);
@@ -2080,7 +2059,7 @@
 		void *val, *pop;
 		fifo_node_t *node;
 		switch_mutex_lock(globals.mutex);
-	top:
+	  top:
 		for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
 			int x = 0;
 			switch_hash_this(hi, NULL, NULL, &val);
@@ -2099,7 +2078,7 @@
 						free(pop);
 					}
 				}
-				
+
 				switch_core_hash_delete(globals.fifo_hash, node->name);
 				switch_core_hash_destroy(&node->caller_hash);
 				switch_core_hash_destroy(&node->consumer_hash);
@@ -2122,15 +2101,15 @@
 	char digest[SWITCH_MD5_DIGEST_STRING_SIZE] = { 0 };
 	char *sql, *name_dup, *p;
 	fifo_node_t *node = NULL;
-	
+
 	switch_md5_string(digest, (void *) originate_string, strlen(originate_string));
-	
+
 	sql = switch_mprintf("delete from fifo_outbound where fifo_name='%q' and uuid = '%q'", fifo_name, digest);
 	switch_assert(sql);
 	fifo_execute_sql(sql, globals.sql_mutex);
 	free(sql);
-	
-	
+
+
 	switch_mutex_lock(globals.mutex);
 	if (!(node = switch_core_hash_find(globals.fifo_hash, fifo_name))) {
 		node = create_node(fifo_name, 0, globals.sql_mutex);
@@ -2138,7 +2117,7 @@
 	}
 	switch_mutex_unlock(globals.mutex);
 
-	node->has_outbound = 1;	
+	node->has_outbound = 1;
 
 	name_dup = strdup(fifo_name);
 	if ((p = strchr(name_dup, '@'))) {
@@ -2151,13 +2130,12 @@
 						 "values ('%q','%q',"
 						 "'{execute_on_answer=''unset fifo_hangup_check'',fifo_hangup_check=''%q'',origination_caller_id_name=Queue,"
 						 "origination_caller_id_number=''fifo+%q''}%q',%d,%d,%d,%d,%d,%ld,0,0,0,'%q')",
-						 digest, fifo_name, fifo_name, name_dup, originate_string, simo_count, 0, timeout, lag, 0, (long)expires, globals.hostname
-						 );
+						 digest, fifo_name, fifo_name, name_dup, originate_string, simo_count, 0, timeout, lag, 0, (long) expires, globals.hostname);
 	switch_assert(sql);
 	fifo_execute_sql(sql, globals.sql_mutex);
 	free(sql);
 	free(name_dup);
-	
+
 }
 
 static void fifo_member_del(char *fifo_name, char *originate_string)
@@ -2166,7 +2144,7 @@
 	char *sql;
 
 	switch_md5_string(digest, (void *) originate_string, strlen(originate_string));
-	
+
 	sql = switch_mprintf("delete from fifo_outbound where fifo_name='%q' and uuid = '%q' and hostname='%q'", fifo_name, digest, globals.hostname);
 	switch_assert(sql);
 	fifo_execute_sql(sql, globals.sql_mutex);
@@ -2190,7 +2168,7 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if (zstr(cmd)){
+	if (zstr(cmd)) {
 		stream->write_function(stream, "-USAGE: %s\n", FIFO_MEMBER_API_SYNTAX);
 		return SWITCH_STATUS_SUCCESS;
 	}
@@ -2204,11 +2182,11 @@
 		stream->write_function(stream, "%s", "-ERR Invalid!\n");
 		goto done;
 	}
-	
+
 	action = argv[0];
 	fifo_name = argv[1];
 	originate_string = argv[2];
-	
+
 	if (action && !strcasecmp(action, "add")) {
 		if (argc > 3) {
 			simo_count = atoi(argv[3]);
@@ -2231,7 +2209,7 @@
 		if (lag < 0) {
 			lag = 5;
 		}
-		
+
 		fifo_member_add(fifo_name, originate_string, simo_count, timeout, lag, expires);
 		stream->write_function(stream, "%s", "+OK\n");
 	} else if (action && !strcasecmp(action, "del")) {
@@ -2263,7 +2241,7 @@
 	}
 
 	/* Subscribe to presence request events */
-	if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, 
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY,
 									pres_event_handler, NULL, &globals.node) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't subscribe to presence request events!\n");
 		return SWITCH_STATUS_GENERR;
@@ -2273,10 +2251,10 @@
 	switch_core_hash_init(&globals.fifo_hash, globals.pool);
 	switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
 	switch_mutex_init(&globals.sql_mutex, SWITCH_MUTEX_NESTED, globals.pool);
-	
+
 	globals.running = 1;
-	
-	if ((status = load_config(0,1)) != SWITCH_STATUS_SUCCESS) {
+
+	if ((status = load_config(0, 1)) != SWITCH_STATUS_SUCCESS) {
 		switch_event_unbind(&globals.node);
 		switch_event_free_subclass(FIFO_EVENT);
 		switch_core_hash_destroy(&globals.fifo_hash);
@@ -2310,24 +2288,24 @@
 	fifo_node_t *node;
 	switch_memory_pool_t *pool = globals.pool;
 	switch_mutex_t *mutex = globals.mutex;
-	
+
 	switch_event_unbind(&globals.node);
 	switch_event_free_subclass(FIFO_EVENT);
-	
+
 	switch_mutex_lock(mutex);
 
 	globals.running = 0;
 	/* Cleanup */
-	
+
 	if (globals.node_thread_running) {
 		stop_node_thread();
 	}
-		
+
 	while ((hi = switch_hash_first(NULL, globals.fifo_hash))) {
 		int x = 0;
 		switch_hash_this(hi, NULL, NULL, &val);
 		node = (fifo_node_t *) val;
-		
+
 		switch_thread_rwlock_wrlock(node->rwlock);
 		for (x = 0; x < MAX_PRI; x++) {
 			while (switch_queue_trypop(node->fifo_list[x], &pop) == SWITCH_STATUS_SUCCESS) {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_fsv/mod_fsv.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_fsv/mod_fsv.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_fsv/mod_fsv.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -107,7 +107,7 @@
 	int fd;
 	switch_mutex_t *mutex = NULL;
 	switch_codec_t codec, *vid_codec;
-	switch_codec_implementation_t read_impl = {0};
+	switch_codec_implementation_t read_impl = { 0 };
 	switch_core_session_get_read_impl(session, &read_impl);
 
 	switch_channel_answer(channel);
@@ -219,7 +219,7 @@
 	0};
 	int fd = -1;
 	int bytes;
-	switch_codec_t *read_codec = NULL, codec = { 0 }, vid_codec = {
+	switch_codec_t codec = { 0 }, vid_codec = {
 	0}, *read_vid_codec;
 	unsigned char *aud_buffer;
 	unsigned char *vid_buffer;
@@ -227,8 +227,8 @@
 	uint32_t ts = 0, last = 0;
 	switch_timer_t timer = { 0 };
 	switch_payload_t pt = 0;
-    switch_codec_implementation_t read_impl = {0};
-    switch_core_session_get_read_impl(session, &read_impl);
+	switch_codec_implementation_t read_impl = { 0 };
+	switch_core_session_get_read_impl(session, &read_impl);
 
 	aud_buffer = switch_core_session_alloc(session, SWITCH_RECOMMENDED_BUFFER_SIZE);
 	vid_buffer = switch_core_session_alloc(session, SWITCH_RECOMMENDED_BUFFER_SIZE);
@@ -264,6 +264,7 @@
 	vid_frame.data = vid_buffer + 12;
 	vid_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE - 12;
 	switch_set_flag((&vid_frame), SFF_RAW_RTP);
+	switch_set_flag((&vid_frame), SFF_PROXY_PACKET);
 
 	if (switch_core_timer_init(&timer, "soft", read_impl.microseconds_per_packet / 1000,
 							   read_impl.samples_per_packet, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
@@ -317,6 +318,10 @@
 				hdr->pt = pt;
 			}
 			if (switch_channel_test_flag(channel, CF_VIDEO)) {
+				switch_byte_t *data = (switch_byte_t *) vid_frame.packet;
+
+				vid_frame.data = data + 12;
+				vid_frame.datalen = vid_frame.packetlen - 12;
 				switch_core_session_write_video_frame(session, &vid_frame, SWITCH_IO_FLAG_NONE, 0);
 			}
 			if (ts && last && last != ts) {
@@ -342,10 +347,10 @@
 		switch_core_timer_destroy(&timer);
 	}
 
-	if (read_codec) {
-		switch_core_session_set_read_codec(session, read_codec);
-	}
 
+	switch_core_session_set_read_codec(session, NULL);
+
+
 	if (switch_core_codec_ready(&codec)) {
 		switch_core_codec_destroy(&codec);
 	}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_lcr/mod_lcr.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_lcr/mod_lcr.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_lcr/mod_lcr.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -122,7 +122,7 @@
 	switch_bool_t profile_has_intrastate;
 	switch_bool_t profile_has_intralata;
 	switch_bool_t profile_has_npanxx;
-	
+
 	switch_bool_t reorder_by_rate;
 	switch_bool_t quote_in_list;
 	switch_bool_t info_in_headers;
@@ -173,21 +173,21 @@
 	char *src_regex = NULL;
 	char *dst_regex = NULL;
 	switch_channel_t *channel = NULL;
-	
+
 	if (!zstr(cid)) {
 		len = strlen(cid);
 	} else {
 		goto done;
 	}
-	
+
 	src = switch_core_strdup(pool, cid);
 	/* check that this is a valid regexp and split the string */
-	
-	if ((src[0] == '/') && src[len-1] == '/') {
+
+	if ((src[0] == '/') && src[len - 1] == '/') {
 		/* strip leading / trailing slashes */
-		src[len-1] = '\0';
+		src[len - 1] = '\0';
 		src++;
-		
+
 		/* break on first / */
 		dst = strchr(src, '/');
 		*dst = '\0';
@@ -199,29 +199,29 @@
 	}
 
 	/* if a session is provided, check if the source part of the regex has any channel variables, then expand them */
-	if(session) {
+	if (session) {
 		channel = switch_core_session_get_channel(session);
 		switch_assert(channel);
 
-		if(switch_string_var_check_const(src) || switch_string_has_escaped_data(src)) {
+		if (switch_string_var_check_const(src) || switch_string_has_escaped_data(src)) {
 			tmp_regex = switch_channel_expand_variables(channel, src);
 			src_regex = switch_core_strdup(pool, tmp_regex);
 			switch_safe_free(tmp_regex);
 			src = src_regex;
 		}
 
-		if(switch_string_var_check_const(dst) || switch_string_has_escaped_data(dst)) {
+		if (switch_string_var_check_const(dst) || switch_string_has_escaped_data(dst)) {
 			tmp_regex = switch_channel_expand_variables(channel, dst);
 			dst_regex = switch_core_strdup(pool, tmp_regex);
 			switch_safe_free(tmp_regex);
 			dst = dst_regex;
 		}
-			
+
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "expanded src: %s, dst: %s\n", src, dst);
 	}
-  
+
 	if ((proceed = switch_regex_perform(number, src, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
-		len = (uint32_t) (strlen(src) + strlen(dst) + 10) * proceed; /* guestimate size */
+		len = (uint32_t) (strlen(src) + strlen(dst) + 10) * proceed;	/* guestimate size */
 		if (!(substituted = switch_core_alloc(pool, len))) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Memory Error!\n");
 			goto done;
@@ -233,77 +233,71 @@
 	}
 
 	switch_regex_safe_free(re);
-	
+
 	return substituted;
-	
-done:
+
+  done:
 	switch_regex_safe_free(re);
 	return number;
 }
 
-static char *get_bridge_data(switch_memory_pool_t *pool, char *dialed_number, char *caller_id, lcr_route cur_route, profile_t *profile, switch_core_session_t *session)
+static char *get_bridge_data(switch_memory_pool_t *pool, char *dialed_number, char *caller_id, lcr_route cur_route, profile_t *profile,
+							 switch_core_session_t *session)
 {
 	size_t lstrip;
-	size_t  tstrip;
+	size_t tstrip;
 	char *data = NULL;
 	char *destination_number = NULL;
-	char *orig_destination_number = NULL; 
+	char *orig_destination_number = NULL;
 	char *codec = NULL;
 	char *cid = NULL;
 	char *header = NULL;
 	char *user_rate = NULL;
 
 	orig_destination_number = destination_number = switch_core_strdup(pool, dialed_number);
-	
+
 	tstrip = ((cur_route->digit_len - cur_route->tstrip) + 1);
 	lstrip = cur_route->lstrip;
-	
+
 	if (cur_route->tstrip > 0) {
 		if (strlen(destination_number) > tstrip) {
 			destination_number[tstrip] = '\0';
-		}
-		else {
+		} else {
 			destination_number[0] = '\0';
-			       }
-    }
+		}
+	}
 	if (cur_route->lstrip > 0) {
 		if (strlen(destination_number) > lstrip) {
 			destination_number += lstrip;
-		}
-		else {
+		} else {
 			destination_number[0] = '\0';
 		}
-	}	
+	}
 	codec = "";
 	if (!zstr(cur_route->codec)) {
 		codec = switch_core_sprintf(pool, ",absolute_codec_string=%s", cur_route->codec);
 	}
-	
+
 	cid = "";
 	if (!zstr(cur_route->cid)) {
-		cid = switch_core_sprintf(pool, ",origination_caller_id_number=%s", 
-								  do_cid(pool, cur_route->cid, caller_id, session));
+		cid = switch_core_sprintf(pool, ",origination_caller_id_number=%s", do_cid(pool, cur_route->cid, caller_id, session));
 	}
-	
+
 	header = "";
 	if (profile->info_in_headers) {
-		header = switch_core_sprintf(pool, ",sip_h_X-LCR-INFO=lcr_rate=%s;lcr_carrier=%s",
-									  cur_route->rate_str, 
-									  cur_route->carrier_name);
+		header = switch_core_sprintf(pool, ",sip_h_X-LCR-INFO=lcr_rate=%s;lcr_carrier=%s", cur_route->rate_str, cur_route->carrier_name);
 	}
-	
+
 	if (zstr(cur_route->user_rate_str)) {
 		user_rate = "";
 	} else {
 		user_rate = switch_core_sprintf(pool, ",lcr_user_rate=%s", cur_route->user_rate_str);
 	}
-	
-	data = switch_core_sprintf(pool, "[lcr_carrier=%s,lcr_rate=%s%s%s%s%s]%s%s%s%s%s"
-								, cur_route->carrier_name, cur_route->rate_str
-								, user_rate, codec, cid, header
-								, cur_route->gw_prefix, cur_route->prefix
-								, destination_number, cur_route->suffix, cur_route->gw_suffix);
-			
+
+	data =
+		switch_core_sprintf(pool, "[lcr_carrier=%s,lcr_rate=%s%s%s%s%s]%s%s%s%s%s", cur_route->carrier_name, cur_route->rate_str, user_rate, codec, cid,
+							header, cur_route->gw_prefix, cur_route->prefix, destination_number, cur_route->suffix, cur_route->gw_suffix);
+
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Returning Dialstring %s\n", data);
 	return data;
 }
@@ -311,13 +305,13 @@
 static profile_t *locate_profile(const char *profile_name)
 {
 	profile_t *profile = NULL;
-	
+
 	if (zstr(profile_name)) {
 		profile = globals.default_profile;
 	} else if (!(profile = switch_core_hash_find(globals.profile_hash, profile_name))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error invalid profile %s\n", profile_name);
 	}
-	
+
 	return profile;
 }
 
@@ -365,7 +359,7 @@
 		if (current->digit_str != NULL) {
 			if (current->digit_len > maxes->digit_str) {
 				maxes->digit_str = current->digit_len;
-			} 
+			}
 		}
 		if (current->rate_str != NULL) {
 			this_len = strlen(current->rate_str);
@@ -374,7 +368,7 @@
 			}
 		}
 		if (current->codec != NULL) {
-			this_len= strlen(current->codec);
+			this_len = strlen(current->codec);
 			if (this_len > maxes->codec) {
 				maxes->codec = this_len;
 			}
@@ -393,13 +387,14 @@
 {
 	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) {
+
+	if (!zstr(globals.odbc_dsn)) {
 		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;
+		if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_ODBC, &options) != SWITCH_STATUS_SUCCESS)
+			dbh = NULL;
 	}
 	return dbh;
 }
@@ -426,27 +421,27 @@
 		db_random = "rand()";
 		return SWITCH_TRUE;
 	}
-	if(db_check("SELECT random();") == SWITCH_TRUE) {
+	if (db_check("SELECT random();") == SWITCH_TRUE) {
 		db_random = "random()";
 		return SWITCH_TRUE;
 	}
-	
+
 	return SWITCH_FALSE;
 }
 
 /* make a new string with digits only */
-static char *string_digitsonly(switch_memory_pool_t *pool, const char *str) 
+static char *string_digitsonly(switch_memory_pool_t *pool, const char *str)
 {
 	char *p, *np, *newstr;
 	size_t len;
 
-	p = (char *)str;
+	p = (char *) str;
 
 	len = strlen(str);
-	newstr = switch_core_alloc(pool, len+1);
+	newstr = switch_core_alloc(pool, len + 1);
 	np = newstr;
-	
-	while(*p) {
+
+	while (*p) {
 		if (switch_isdigit(*p)) {
 			*np = *p;
 			np++;
@@ -478,14 +473,10 @@
 
 	digit_len = strlen(digits);
 	digits_copy = switch_core_strdup(pool, digits);
-	
+
 	for (n = digit_len; n > 0; n--) {
 		digits_copy[n] = '\0';
-		dig_stream.write_function(&dig_stream, "%s%s%s%s", 
-									(n==digit_len ? "" : ", "), 
-									(quote ? "'" : ""),
-									digits_copy,
-									(quote ? "'" : ""));
+		dig_stream.write_function(&dig_stream, "%s%s%s%s", (n == digit_len ? "" : ", "), (quote ? "'" : ""), digits_copy, (quote ? "'" : ""));
 	}
 
 	ret = switch_core_strdup(pool, dig_stream.data);
@@ -496,42 +487,41 @@
 /* format the custom sql */
 static char *format_custom_sql(const char *custom_sql, callback_t *cb_struct, const char *digits)
 {
-	char * tmpSQL = NULL;
-	char * newSQL = NULL;
+	char *tmpSQL = NULL;
+	char *newSQL = NULL;
 	switch_channel_t *channel;
-	
+
 	/* first replace %s with digits to maintain backward compat */
 	if (cb_struct->profile->custom_sql_has_percent == SWITCH_TRUE) {
 		tmpSQL = switch_string_replace(custom_sql, "%q", digits);
 		newSQL = tmpSQL;
 	}
-	
+
 	/* expand the vars */
 	if (cb_struct->profile->custom_sql_has_vars == SWITCH_TRUE) {
 		if (cb_struct->session) {
 			channel = switch_core_session_get_channel(cb_struct->session);
 			switch_assert(channel);
 			/*
-			newSQL = switch_channel_expand_variables_escape(channel, 
-															tmpSQL ? tmpSQL : custom_sql,
-															escape_sql);
-			*/
-			newSQL = switch_channel_expand_variables(channel, 
-														tmpSQL ? tmpSQL : custom_sql);
+			   newSQL = switch_channel_expand_variables_escape(channel, 
+			   tmpSQL ? tmpSQL : custom_sql,
+			   escape_sql);
+			 */
+			newSQL = switch_channel_expand_variables(channel, tmpSQL ? tmpSQL : custom_sql);
 		} else if (cb_struct->event) {
 			/* use event system to expand vars */
 			newSQL = switch_event_expand_headers(cb_struct->event, tmpSQL ? tmpSQL : custom_sql);
-			
+
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(cb_struct->session), SWITCH_LOG_CRIT,
-								"mod_lcr called without a valid session while using a custom_sql that has channel variables.\n");
+							  "mod_lcr called without a valid session while using a custom_sql that has channel variables.\n");
 		}
 	}
-	
+
 	if (tmpSQL != newSQL) {
 		switch_safe_free(tmpSQL);
 	}
-	
+
 	if (newSQL == NULL) {
 		return (char *) custom_sql;
 	} else {
@@ -543,10 +533,10 @@
 {
 	switch_bool_t retval = SWITCH_FALSE;
 	switch_cache_db_handle_t *dbh = 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) {
+			== SWITCH_ODBC_FAIL) {
 			retval = SWITCH_FALSE;
 		} else {
 			retval = SWITCH_TRUE;
@@ -562,23 +552,21 @@
 	lcr_route current = NULL;
 	callback_t *cbt = (callback_t *) pArg;
 	char *key = NULL;
-	
+
 	switch_memory_pool_t *pool = cbt->pool;
-	
-	
+
+
 	if (argc < LCR_QUERY_COLS_REQUIRED) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
-							"Unexpected number of columns returned for SQL.  Returned column count: %d. "
-							"If using a custom sql for this profile, verify it is correct.  Otherwise file a bug report.\n",
-							argc);
+						  "Unexpected number of columns returned for SQL.  Returned column count: %d. "
+						  "If using a custom sql for this profile, verify it is correct.  Otherwise file a bug report.\n", argc);
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (zstr(argv[LCR_GW_PREFIX_PLACE]) && zstr(argv[LCR_GW_SUFFIX_PLACE]) ) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-								"There's no way to dial this Gateway: Carrier: \"%s\" Prefix: \"%s\", Suffix \"%s\"\n",
-								switch_str_nil(argv[LCR_CARRIER_PLACE]),
-								switch_str_nil(argv[LCR_GW_PREFIX_PLACE]), switch_str_nil(argv[LCR_GW_SUFFIX_PLACE]));
+	if (zstr(argv[LCR_GW_PREFIX_PLACE]) && zstr(argv[LCR_GW_SUFFIX_PLACE])) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+						  "There's no way to dial this Gateway: Carrier: \"%s\" Prefix: \"%s\", Suffix \"%s\"\n",
+						  switch_str_nil(argv[LCR_CARRIER_PLACE]), switch_str_nil(argv[LCR_GW_PREFIX_PLACE]), switch_str_nil(argv[LCR_GW_SUFFIX_PLACE]));
 		return SWITCH_STATUS_SUCCESS;
 	}
 
@@ -590,7 +578,7 @@
 	additional->suffix = switch_core_strdup(pool, switch_str_nil(argv[LCR_SUFFIX_PLACE]));
 	additional->prefix = switch_core_strdup(pool, switch_str_nil(argv[LCR_PREFIX_PLACE]));
 	additional->carrier_name = switch_core_strdup(pool, switch_str_nil(argv[LCR_CARRIER_PLACE]));
-	additional->rate = (float)atof(switch_str_nil(argv[LCR_RATE_PLACE]));
+	additional->rate = (float) atof(switch_str_nil(argv[LCR_RATE_PLACE]));
 	additional->rate_str = switch_core_sprintf(pool, "%0.5f", additional->rate);
 	additional->gw_prefix = switch_core_strdup(pool, switch_str_nil(argv[LCR_GW_PREFIX_PLACE]));
 	additional->gw_suffix = switch_core_strdup(pool, switch_str_nil(argv[LCR_GW_SUFFIX_PLACE]));
@@ -603,7 +591,7 @@
 		additional->cid = switch_core_strdup(pool, switch_str_nil(argv[LCR_CID_PLACE]));
 	}
 	if (argc > LCR_USER_RATE_PLACE) {
-		additional->user_rate = (float)atof(switch_str_nil(argv[LCR_USER_RATE_PLACE]));
+		additional->user_rate = (float) atof(switch_str_nil(argv[LCR_USER_RATE_PLACE]));
 		additional->user_rate_str = switch_core_sprintf(pool, "%0.5f", additional->user_rate);
 	}
 	additional->dialstring = get_bridge_data(pool, cbt->lookup_number, cbt->cid, additional, cbt->profile, cbt->session);
@@ -620,14 +608,12 @@
 		return SWITCH_STATUS_SUCCESS;
 	}
 
-	
+
 	for (current = cbt->head; current; current = current->next) {
-	
+
 		key = switch_core_sprintf(pool, "%s:%s", additional->gw_prefix, additional->gw_suffix);
 		if (switch_core_hash_find(cbt->dedup_hash, key)) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
-								"Ignoring Duplicate route for termination point (%s)\n",
-								key);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Ignoring Duplicate route for termination point (%s)\n", key);
 			break;
 		}
 
@@ -647,13 +633,12 @@
 			if (current->rate > additional->rate) {
 				/* insert myself here */
 				if (current->prev != NULL) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding %s before %s\n", 
-										additional->carrier_name, current->carrier_name);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding %s before %s\n", additional->carrier_name, current->carrier_name);
 					current->prev->next = additional;
 				} else {
 					/* put this one at the head */
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Inserting %s to list head before %s\n", 
-										additional->carrier_name, current->carrier_name);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Inserting %s to list head before %s\n",
+									  additional->carrier_name, current->carrier_name);
 					cbt->head = additional;
 				}
 				additional->next = current;
@@ -665,7 +650,7 @@
 				break;
 			} else if (current->next == NULL) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "adding %s to end of list after %s\n",
-									additional->carrier_name, current->carrier_name);
+								  additional->carrier_name, current->carrier_name);
 				current->next = additional;
 				additional->prev = current;
 				if (switch_core_hash_insert(cbt->dedup_hash, key, additional) != SWITCH_STATUS_SUCCESS) {
@@ -683,7 +668,7 @@
 {
 	int count = 0;
 	callback_t *cbt = (callback_t *) pArg;
-	
+
 	count = atoi(argv[1]);
 	if (count == 1) {
 		if (!strcmp(argv[0], "state")) {
@@ -693,19 +678,19 @@
 		}
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Type: %s, Count: %d\n", argv[0], count);    
-	
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Type: %s, Count: %d\n", argv[0], count);
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t is_intrastatelata(callback_t *cb_struct)
 {
 	char *sql = NULL;
-	
+
 	/* extract npa nxx - make some assumptions about format:
-		e164 format without the +
-		NANP only (so 11 digits starting with 1)
-	*/
+	   e164 format without the +
+	   NANP only (so 11 digits starting with 1)
+	 */
 	if (!cb_struct->lookup_number || (strlen(cb_struct->lookup_number) != 11 && *cb_struct->lookup_number != '1')) {
 		/* dest doesn't appear to be NANP number */
 		return SWITCH_STATUS_GENERR;
@@ -714,29 +699,28 @@
 		/* cid not NANP */
 		return SWITCH_STATUS_GENERR;
 	}
-	
+
 	/* assume that if the area code (plus leading 1) are the same we're intrastate */
 	/* probably a bad assumption */
 	/*
-	if (!strncmp(cb_struct->lookup_number, cb_struct->cid, 4)) {
-		cb_struct->intrastate = SWITCH_TRUE;
-		return SWITCH_STATUS_SUCCESS;
-	}
-	*/
-	
+	   if (!strncmp(cb_struct->lookup_number, cb_struct->cid, 4)) {
+	   cb_struct->intrastate = SWITCH_TRUE;
+	   return SWITCH_STATUS_SUCCESS;
+	   }
+	 */
+
 	sql = switch_core_sprintf(cb_struct->pool,
-								"SELECT 'state', count(DISTINCT state) FROM npa_nxx_company_ocn WHERE (npa=%3.3s AND nxx=%3.3s) OR (npa=%3.3s AND nxx=%3.3s)"
-								" UNION "
-								"SELECT 'lata', count(DISTINCT lata) FROM npa_nxx_company_ocn WHERE (npa=%3.3s AND nxx=%3.3s) OR (npa=%3.3s AND nxx=%3.3s)",
-								cb_struct->lookup_number+1, cb_struct->lookup_number+4,
-								cb_struct->cid+1, cb_struct->cid+4,
-								cb_struct->lookup_number+1, cb_struct->lookup_number+4,
-								cb_struct->cid+1, cb_struct->cid+4);
+							  "SELECT 'state', count(DISTINCT state) FROM npa_nxx_company_ocn WHERE (npa=%3.3s AND nxx=%3.3s) OR (npa=%3.3s AND nxx=%3.3s)"
+							  " UNION "
+							  "SELECT 'lata', count(DISTINCT lata) FROM npa_nxx_company_ocn WHERE (npa=%3.3s AND nxx=%3.3s) OR (npa=%3.3s AND nxx=%3.3s)",
+							  cb_struct->lookup_number + 1, cb_struct->lookup_number + 4,
+							  cb_struct->cid + 1, cb_struct->cid + 4,
+							  cb_struct->lookup_number + 1, cb_struct->lookup_number + 4, cb_struct->cid + 1, cb_struct->cid + 4);
 
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(cb_struct->session), SWITCH_LOG_DEBUG, "SQL: %s\n", sql);    
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(cb_struct->session), SWITCH_LOG_DEBUG, "SQL: %s\n", sql);
 
-	return(lcr_execute_sql_callback(sql, intrastatelata_callback, cb_struct));
-	
+	return (lcr_execute_sql_callback(sql, intrastatelata_callback, cb_struct));
+
 }
 
 static switch_status_t lcr_do_lookup(callback_t *cb_struct)
@@ -752,26 +736,26 @@
 	char *safe_sql = NULL;
 	char *rate_field = NULL;
 	char *user_rate_field = NULL;
-	
+
 	switch_assert(cb_struct->lookup_number != NULL);
 
 	digits_copy = string_digitsonly(cb_struct->pool, digits);
 	if (zstr(digits_copy)) {
 		return SWITCH_STATUS_GENERR;
 	}
-	
+
 	/* allocate the dedup hash */
 	if (switch_core_hash_init(&cb_struct->dedup_hash, cb_struct->pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(cb_struct->session), SWITCH_LOG_ERROR, "Error initializing the dedup hash\n");
 		return SWITCH_STATUS_GENERR;
 	}
-	
+
 	digits_expanded = expand_digits(cb_struct->pool, digits_copy, cb_struct->profile->quote_in_list);
-	
+
 	if (profile->profile_has_npanxx == SWITCH_TRUE) {
 		is_intrastatelata(cb_struct);
 	}
-	
+
 	/* set our rate field based on env and profile */
 	if (cb_struct->intralata == SWITCH_TRUE && profile->profile_has_intralata == SWITCH_TRUE) {
 		rate_field = switch_core_strdup(cb_struct->pool, "intralata_rate");
@@ -785,7 +769,7 @@
 	}
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(cb_struct->session), SWITCH_LOG_DEBUG, "intra routing [state:%d lata:%d] so rate field is [%s]\n",
 					  cb_struct->intrastate, cb_struct->intralata, rate_field);
-	
+
 	/* set some channel vars if we have a session */
 	if (cb_struct->session) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(cb_struct->session), SWITCH_LOG_DEBUG, "we have a session\n");
@@ -822,11 +806,11 @@
 		/* channel_expand_variables returned the same string to us, no need to free */
 		switch_safe_free(safe_sql);
 	}
-	
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(cb_struct->session), SWITCH_LOG_DEBUG, "SQL: %s\n", (char *)sql_stream.data);    
-	
-	lookup_status = lcr_execute_sql_callback((char *)sql_stream.data, route_add_callback, cb_struct);
 
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(cb_struct->session), SWITCH_LOG_DEBUG, "SQL: %s\n", (char *) sql_stream.data);
+
+	lookup_status = lcr_execute_sql_callback((char *) sql_stream.data, route_add_callback, cb_struct);
+
 	switch_safe_free(sql_stream.data);
 	switch_event_safe_destroy(&cb_struct->event);
 	switch_core_hash_destroy(&cb_struct->dedup_hash);
@@ -848,16 +832,15 @@
 	switch_event_create(&event, SWITCH_EVENT_MESSAGE);
 	routes.event = event;
 	routes.pool = pool;
-	
+
 	if (!(routes.profile = locate_profile(lcr_profile))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown profile: %s\n", lcr_profile);
 		return SWITCH_FALSE;
 	}
-	
+
 	routes.lookup_number = "15555551212";
 	routes.cid = "18005551212";
-	return (lcr_do_lookup(&routes) == SWITCH_STATUS_SUCCESS) ?
-	        SWITCH_TRUE : SWITCH_FALSE;
+	return (lcr_do_lookup(&routes) == SWITCH_STATUS_SUCCESS) ? SWITCH_TRUE : SWITCH_FALSE;
 }
 
 static switch_status_t lcr_load_config()
@@ -893,19 +876,16 @@
 			}
 		}
 	}
-	
+
 	/* 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_DEBUG
-						  , "dsn is \"%s\", user is \"%s\"\n"
-						  , globals.odbc_dsn, globals.odbc_user
-						  );
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "dsn is \"%s\", user is \"%s\"\n", globals.odbc_dsn, globals.odbc_user);
 		if (!(dbh = lcr_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 (set_db_random() == SWITCH_TRUE) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Database RANDOM function set to %s\n", db_random);
 	} else {
@@ -926,7 +906,7 @@
 			char *custom_sql = NULL;
 			int argc, x = 0;
 			char *argv[4] = { 0 };
-			
+
 			SWITCH_STANDARD_STREAM(order_by);
 
 			for (param = switch_xml_child(x_profile, "param"); param; param = param->next) {
@@ -934,12 +914,12 @@
 
 				var = (char *) switch_xml_attr_soft(param, "name");
 				val = (char *) switch_xml_attr_soft(param, "value");
-				
-				if (!strcasecmp(var, "order_by")  && !zstr(val)) {
+
+				if (!strcasecmp(var, "order_by") && !zstr(val)) {
 					thisorder = &order_by;
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "param val is %s\n", val);
 					if ((argc = switch_separate_string(val, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
-						for (x=0; x<argc; x++) {
+						for (x = 0; x < argc; x++) {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "arg #%d/%d is %s\n", x, argc, argv[x]);
 							if (!zstr(argv[x])) {
 								if (!strcasecmp(argv[x], "quality")) {
@@ -976,37 +956,37 @@
 					quote_in_list = val;
 				}
 			}
-			
+
 			if (zstr(name)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No name specified.\n");
 			} else {
 				profile = switch_core_alloc(globals.pool, sizeof(*profile));
 				memset(profile, 0, sizeof(profile_t));
 				profile->name = switch_core_strdup(globals.pool, name);
-				
-				if (!zstr((char *)order_by.data)) {
-					profile->order_by = switch_core_strdup(globals.pool, (char *)order_by.data);
+
+				if (!zstr((char *) order_by.data)) {
+					profile->order_by = switch_core_strdup(globals.pool, (char *) order_by.data);
 				} else {
 					/* default to rate */
 					profile->order_by = ", ${lcr_rate_field}";
 				}
 
 				if (!zstr(id_s)) {
-					profile->id = (uint16_t)atoi(id_s);
+					profile->id = (uint16_t) atoi(id_s);
 				}
-				
+
 				/* SWITCH_STANDARD_STREAM doesn't use pools.  but we only have to free sql_stream.data */
 				SWITCH_STANDARD_STREAM(sql_stream);
 				if (zstr(custom_sql)) {
 					/* use default sql */
-					sql_stream.write_function(&sql_stream, 
-											  "SELECT l.digits, c.carrier_name, l.${lcr_rate_field}, cg.prefix AS gw_prefix, cg.suffix AS gw_suffix, l.lead_strip, l.trail_strip, l.prefix, l.suffix "
-											  );
+					sql_stream.write_function(&sql_stream,
+											  "SELECT l.digits, c.carrier_name, l.${lcr_rate_field}, cg.prefix AS gw_prefix, cg.suffix AS gw_suffix, l.lead_strip, l.trail_strip, l.prefix, l.suffix ");
 					if (db_check("SELECT codec from carrier_gateway limit 1") == SWITCH_TRUE) {
 						sql_stream.write_function(&sql_stream, ", cg.codec ");
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "codec field defined.\n");
 					} else {
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "codec field not defined, please update your lcr carrier_gateway database schema.\n");
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+										  "codec field not defined, please update your lcr carrier_gateway database schema.\n");
 					}
 					if (db_check("SELECT cid from lcr limit 1") == SWITCH_TRUE) {
 						sql_stream.write_function(&sql_stream, ", l.cid ");
@@ -1014,41 +994,38 @@
 					} else {
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "cid field not defined, please update your lcr database schema.\n");
 					}
-					sql_stream.write_function(&sql_stream, "FROM lcr l JOIN carriers c ON l.carrier_id=c.id JOIN carrier_gateway cg ON c.id=cg.carrier_id WHERE c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1' AND digits IN (");
+					sql_stream.write_function(&sql_stream,
+											  "FROM lcr l JOIN carriers c ON l.carrier_id=c.id JOIN carrier_gateway cg ON c.id=cg.carrier_id WHERE c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1' AND digits IN (");
 					sql_stream.write_function(&sql_stream, "${lcr_query_expanded_digits}");
 					sql_stream.write_function(&sql_stream, ") AND CURRENT_TIMESTAMP BETWEEN date_start AND date_end ");
 					if (profile->id > 0) {
 						sql_stream.write_function(&sql_stream, "AND lcr_profile=%d ", profile->id);
 					}
-					sql_stream.write_function(&sql_stream, "ORDER BY digits DESC%s", 
-															profile->order_by);
+					sql_stream.write_function(&sql_stream, "ORDER BY digits DESC%s", profile->order_by);
 					if (db_random) {
 						sql_stream.write_function(&sql_stream, ", %s", db_random);
 					}
 					sql_stream.write_function(&sql_stream, ";");
-					
+
 					custom_sql = sql_stream.data;
 				}
-				
-				
+
+
 				profile->profile_has_intralata = db_check("SELECT intralata_rate FROM lcr LIMIT 1");
 				if (profile->profile_has_intralata != SWITCH_TRUE) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
-									  "no \"intralata_rate\" field found in the \"lcr\" table, routing by intralata rates will be disabled until the field is added and mod_lcr is reloaded\n"
-									  );
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+									  "no \"intralata_rate\" field found in the \"lcr\" table, routing by intralata rates will be disabled until the field is added and mod_lcr is reloaded\n");
 				}
 				profile->profile_has_intrastate = db_check("SELECT intrastate_rate FROM lcr LIMIT 1");
 				if (profile->profile_has_intrastate != SWITCH_TRUE) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
-									  "no \"intrastate_rate\" field found in the \"lcr\" table, routing by intrastate rates will be disabled until the field is added and mod_lcr is reloaded\n"
-									  );
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+									  "no \"intrastate_rate\" field found in the \"lcr\" table, routing by intrastate rates will be disabled until the field is added and mod_lcr is reloaded\n");
 				}
-				
+
 				profile->profile_has_npanxx = db_check("SELECT npa, nxx, state FROM npa_nxx_company_ocn LIMIT 1");
 				if (profile->profile_has_npanxx != SWITCH_TRUE) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
-									  "no \"npa_nxx_company_ocn\" table found in the \"lcr\" database, automatic intrastate detection will be disabled until the table is added and mod_lcr is reloaded\n"
-									  );
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+									  "no \"npa_nxx_company_ocn\" table found in the \"lcr\" database, automatic intrastate detection will be disabled until the table is added and mod_lcr is reloaded\n");
 				}
 
 				if (switch_string_var_check_const(custom_sql) || switch_string_has_escaped_data(custom_sql)) {
@@ -1057,20 +1034,20 @@
 				if (strstr(custom_sql, "%")) {
 					profile->custom_sql_has_percent = SWITCH_TRUE;
 				}
-				profile->custom_sql = switch_core_strdup(globals.pool, (char *)custom_sql);
-				
+				profile->custom_sql = switch_core_strdup(globals.pool, (char *) custom_sql);
+
 				if (!zstr(reorder_by_rate)) {
 					profile->reorder_by_rate = switch_true(reorder_by_rate);
 				}
-				
+
 				if (!zstr(info_in_headers)) {
 					profile->info_in_headers = switch_true(info_in_headers);
 				}
-				
+
 				if (!zstr(quote_in_list)) {
 					profile->quote_in_list = switch_true(quote_in_list);
 				}
-				
+
 				switch_core_hash_insert(globals.profile_hash, profile->name, profile);
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Loaded lcr profile %s.\n", profile->name);
 				/* test the profile */
@@ -1083,7 +1060,7 @@
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Removing INVALID Profile %s.\n", profile->name);
 					switch_core_hash_delete(globals.profile_hash, profile->name);
 				}
-				
+
 			}
 			switch_safe_free(order_by.data);
 			switch_safe_free(sql_stream.data);
@@ -1091,7 +1068,7 @@
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No lcr profiles defined.\n");
 	}
-	
+
 	/* define default profile  */
 	if (!globals.default_profile) {
 		profile = switch_core_alloc(globals.pool, sizeof(*profile));
@@ -1102,7 +1079,7 @@
 		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;
@@ -1138,17 +1115,17 @@
 	intralata = switch_channel_get_variable(channel, "intralata");
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "intrastate channel var is [%s]\n", intrastate);
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "intralata channel var is [%s]\n", intralata);
-	if (!zstr(intralata) && !strcasecmp((char *)intralata, "true")) {
+	if (!zstr(intralata) && !strcasecmp((char *) intralata, "true")) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Select routes based on intralata rates\n");
 		routes.intralata = SWITCH_FALSE;
-	} else if (!zstr(intrastate) && !strcasecmp((char *)intrastate, "true")) {
+	} else if (!zstr(intrastate) && !strcasecmp((char *) intrastate, "true")) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Select routes based on intrastate rates\n");
 		routes.intrastate = SWITCH_TRUE;
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Select routes based on interstate rates\n");
 		routes.intrastate = SWITCH_FALSE;
 	}
-	
+
 	if (!caller_profile) {
 		caller_profile = switch_channel_get_caller_profile(channel);
 	}
@@ -1173,7 +1150,7 @@
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "LCR lookup failed for %s\n", caller_profile->destination_number);
 	}
 
-end:
+  end:
 	if (!session) {
 		switch_core_destroy_memory_pool(&pool);
 	}
@@ -1184,9 +1161,9 @@
 {
 	size_t i;
 
-	/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "repeating %d of '%s'\n", (int)how_many, what);*/
-	
-	for (i=0; i<how_many; i++) {
+	/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "repeating %d of '%s'\n", (int)how_many, what); */
+
+	for (i = 0; i < how_many; i++) {
 		str_stream->write_function(str_stream, "%s", what);
 	}
 }
@@ -1227,9 +1204,8 @@
 	routes.pool = pool;
 
 	intra = switch_channel_get_variable(channel, "intrastate");
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "intrastate channel var is [%s]\n", 
-					zstr(intra) ? "undef" : intra);
-	if (zstr(intra) || strcasecmp((char *)intra, "true")) {
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "intrastate channel var is [%s]\n", zstr(intra) ? "undef" : intra);
+	if (zstr(intra) || strcasecmp((char *) intra, "true")) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Select routes based on interstate rates\n");
 		routes.intrastate = SWITCH_FALSE;
 	} else {
@@ -1248,7 +1224,7 @@
 		if (argc > 1) {
 			lcr_profile = argv[1];
 		}
-		
+
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "LCR Lookup on %s using profile %s\n", dest, lcr_profile);
 		routes.lookup_number = dest;
 		if (caller_profile) {
@@ -1258,7 +1234,7 @@
 			}
 		}
 
-	
+
 		if (!(routes.profile = locate_profile(lcr_profile))) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Unknown profile: %s\n", lcr_profile);
 			goto end;
@@ -1289,16 +1265,17 @@
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "LCR lookup failed for %s\n", dest);
 		}
 	}
-	
-end:
+
+  end:
 	if (!session) {
 		switch_core_destroy_memory_pool(&pool);
 	}
 }
 
-static void write_data(switch_stream_handle_t *stream, switch_bool_t as_xml, const char *key, const char *data, int indent, int maxlen) {
+static void write_data(switch_stream_handle_t *stream, switch_bool_t as_xml, const char *key, const char *data, int indent, int maxlen)
+{
 	if (as_xml) {
-		str_repeat(indent*2, " ", stream);
+		str_repeat(indent * 2, " ", stream);
 		stream->write_function(stream, "<%s>%s</%s>\n", key, data, key);
 	} else {
 		stream->write_function(stream, " | %s", data);
@@ -1320,15 +1297,13 @@
 	switch_event_t *event;
 	switch_status_t lookup_status = SWITCH_STATUS_SUCCESS;
 	switch_bool_t as_xml = SWITCH_FALSE;
-	int rowcount=0;
+	int rowcount = 0;
 
 	if (zstr(cmd)) {
 		goto usage;
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG
-					  , "data passed to lcr is [%s]\n", cmd
-					  );
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "data passed to lcr is [%s]\n", cmd);
 
 	if (session) {
 		pool = switch_core_session_get_pool(session);
@@ -1339,7 +1314,7 @@
 		cb_struct.event = event;
 	}
 	cb_struct.pool = pool;
-	
+
 	mydata = switch_core_strdup(pool, cmd);
 
 	if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
@@ -1350,29 +1325,27 @@
 		}
 		if (argc > 2) {
 			int i;
-			for (i=2; i<argc; i++) {
+			for (i = 2; i < argc; i++) {
 				if (!strcasecmp(argv[i], "intrastate")) {
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Select routes based on intrastate rates\n");
 					cb_struct.intrastate = SWITCH_TRUE;
-				} else if(!strcasecmp(argv[i], "as")) {
+				} else if (!strcasecmp(argv[i], "as")) {
 					i++;
-					if(argv[i] && !strcasecmp(argv[i], "xml")) {
-							as_xml = SWITCH_TRUE;
-						} else {
-							goto usage;
-						}
+					if (argv[i] && !strcasecmp(argv[i], "xml")) {
+						as_xml = SWITCH_TRUE;
+					} else {
+						goto usage;
+					}
 				} else {
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Set Caller ID to [%s]\n", argv[i]);
 					/* the only other option we have right now is caller id */
 					cb_struct.cid = switch_core_strdup(pool, argv[i]);
 				}
 			}
-		} 
+		}
 		if (zstr(cb_struct.cid)) {
 			cb_struct.cid = "18005551212";
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING
-							  , "Using default CID [%s]\n", cb_struct.cid
-							  );
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Using default CID [%s]\n", cb_struct.cid);
 		}
 
 
@@ -1432,7 +1405,7 @@
 				if (as_xml) {
 					stream->write_function(stream, "  <row id=\"%d\">\n", rowcount);
 				}
-				
+
 				write_data(stream, as_xml, "prefix", current->digit_str, 2, maximum_lengths.digit_str);
 				write_data(stream, as_xml, "carrier_name", current->carrier_name, 2, maximum_lengths.carrier_name);
 				write_data(stream, as_xml, "rate", current->rate_str, 2, maximum_lengths.rate);
@@ -1447,7 +1420,7 @@
 				} else {
 					write_data(stream, as_xml, "cid", "", 2, maximum_lengths.cid);
 				}
-				
+
 				write_data(stream, as_xml, "dialstring", current->dialstring, 2, maximum_lengths.dialstring);
 
 				if (as_xml) {
@@ -1473,14 +1446,14 @@
 		}
 	}
 
-end:
+  end:
 	if (!session) {
 		if (pool) {
 			switch_core_destroy_memory_pool(&pool);
 		}
 	}
 	return SWITCH_STATUS_SUCCESS;
-usage:
+  usage:
 	stream->write_function(stream, "USAGE: %s\n", LCR_SYNTAX);
 	goto end;
 }
@@ -1509,7 +1482,7 @@
 			for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
 				switch_hash_this(hi, NULL, NULL, &val);
 				profile = (profile_t *) val;
-				
+
 				stream->write_function(stream, "Name:\t\t%s\n", profile->name);
 				if (zstr(profile->custom_sql)) {
 					stream->write_function(stream, " ID:\t\t%d\n", profile->id);
@@ -1522,12 +1495,9 @@
 				stream->write_function(stream, " has intrastate:\t%s\n", profile->profile_has_intrastate ? "true" : "false");
 				stream->write_function(stream, " has intralata:\t%s\n", profile->profile_has_intralata ? "true" : "false");
 				stream->write_function(stream, " has npanxx:\t%s\n", profile->profile_has_npanxx ? "true" : "false");
-				stream->write_function(stream, " Reorder rate:\t%s\n", 
-										profile->reorder_by_rate ? "enabled" : "disabled");
-				stream->write_function(stream, " Info in headers:\t%s\n", 
-										profile->info_in_headers ? "enabled" : "disabled");
-				stream->write_function(stream, " Quote IN() List:\t%s\n", 
-										profile->quote_in_list ? "enabled" : "disabled");
+				stream->write_function(stream, " Reorder rate:\t%s\n", profile->reorder_by_rate ? "enabled" : "disabled");
+				stream->write_function(stream, " Info in headers:\t%s\n", profile->info_in_headers ? "enabled" : "disabled");
+				stream->write_function(stream, " Quote IN() List:\t%s\n", profile->quote_in_list ? "enabled" : "disabled");
 				stream->write_function(stream, "\n");
 			}
 		} else {
@@ -1536,20 +1506,20 @@
 	}
 	switch_safe_free(mydata);
 	return SWITCH_STATUS_SUCCESS;
-usage:
+  usage:
 	switch_safe_free(mydata);
 	stream->write_function(stream, "-ERR %s\n", LCR_ADMIN_SYNTAX);
 	return SWITCH_STATUS_SUCCESS;
-		
+
 }
-	
+
 SWITCH_MODULE_LOAD_FUNCTION(mod_lcr_load)
 {
 	switch_api_interface_t *dialplan_lcr_api_interface;
 	switch_api_interface_t *dialplan_lcr_api_admin_interface;
 	switch_application_interface_t *app_interface;
 	switch_dialplan_interface_t *dp_interface;
-	
+
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	if (!switch_odbc_available()) {
@@ -1573,7 +1543,7 @@
 	SWITCH_ADD_APP(app_interface, "lcr", "Perform an LCR lookup", "Perform an LCR lookup",
 				   lcr_app_function, "<number>", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
 	SWITCH_ADD_DIALPLAN(dp_interface, "lcr", lcr_dialplan_hunt);
-	
+
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_limit/mod_limit.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_limit/mod_limit.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_limit/mod_limit.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -51,12 +51,12 @@
 	char *odbc_pass;
 	switch_mutex_t *mutex;
 	switch_mutex_t *limit_hash_mutex;
-	switch_hash_t *limit_hash;	
+	switch_hash_t *limit_hash;
 	switch_mutex_t *db_hash_mutex;
-	switch_hash_t *db_hash;	
+	switch_hash_t *db_hash;
 } globals;
 
-typedef struct  {
+typedef struct {
 	uint32_t total_usage;
 	uint32_t rate_usage;
 	time_t last_check;
@@ -68,43 +68,33 @@
 
 static char limit_sql[] =
 	"CREATE TABLE limit_data (\n"
-	"   hostname   VARCHAR(255),\n"
-	"   realm      VARCHAR(255),\n"
-	"   id         VARCHAR(255),\n"
-	"   uuid       VARCHAR(255)\n"
-	");\n";
+	"   hostname   VARCHAR(255),\n" "   realm      VARCHAR(255),\n" "   id         VARCHAR(255),\n" "   uuid       VARCHAR(255)\n" ");\n";
 
 static char db_sql[] =
 	"CREATE TABLE db_data (\n"
-	"   hostname   VARCHAR(255),\n"
-	"   realm      VARCHAR(255),\n"
-	"   data_key   VARCHAR(255),\n"
-	"   data       VARCHAR(255)\n"
-	");\n";
+	"   hostname   VARCHAR(255),\n" "   realm      VARCHAR(255),\n" "   data_key   VARCHAR(255),\n" "   data       VARCHAR(255)\n" ");\n";
 
 static char group_sql[] =
-	"CREATE TABLE group_data (\n"
-	"   hostname   VARCHAR(255),\n"
-	"   groupname  VARCHAR(255),\n"
-	"   url        VARCHAR(255)\n"
-	");\n";
+	"CREATE TABLE group_data (\n" "   hostname   VARCHAR(255),\n" "   groupname  VARCHAR(255),\n" "   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) {
+
+	if (!zstr(globals.odbc_dsn)) {
 		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;
+		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;
+		if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_CORE_DB, &options) != SWITCH_STATUS_SUCCESS)
+			dbh = NULL;
 		return dbh;
 	}
 }
@@ -127,7 +117,7 @@
 	status = switch_cache_db_execute_sql(dbh, sql, NULL);
 
   end:
-	
+
 	switch_cache_db_release_db_handle(&dbh);
 
 	if (mutex) {
@@ -142,16 +132,16 @@
 	switch_bool_t ret = SWITCH_FALSE;
 	char *errmsg = NULL;
 	switch_cache_db_handle_t *dbh = NULL;
-	
+
 	if (mutex) {
 		switch_mutex_lock(mutex);
 	}
 
 	if (!(dbh = limit_get_db_handle())) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
-        goto end;
-    }
-	
+		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);
 
 	if (errmsg) {
@@ -174,23 +164,23 @@
 static switch_xml_config_string_options_t limit_config_dsn = { NULL, 0, "[^:]+:[^:]+:.+" };
 
 static switch_xml_config_item_t config_settings[] = {
-	SWITCH_CONFIG_ITEM("odbc-dsn", SWITCH_CONFIG_STRING, 0, &globals.odbc_dsn, NULL, &limit_config_dsn,  
-		"dsn:username:password", "If set, the ODBC DSN used by the limit and db applications"),
+	SWITCH_CONFIG_ITEM("odbc-dsn", SWITCH_CONFIG_STRING, 0, &globals.odbc_dsn, NULL, &limit_config_dsn,
+					   "dsn:username:password", "If set, the ODBC DSN used by the limit and db applications"),
 	SWITCH_CONFIG_ITEM_END()
 };
 
 static switch_status_t do_config()
 {
-	switch_cache_db_handle_t *dbh;
+	switch_cache_db_handle_t *dbh = NULL;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	char *sql = NULL;
-	
+
 	limit_config_dsn.pool = globals.pool;
 
 	if (switch_xml_config_parse_module_settings("limit.conf", SWITCH_FALSE, config_settings) != SWITCH_STATUS_SUCCESS) {
 		return SWITCH_STATUS_TERM;
 	}
-	
+
 	if (globals.odbc_dsn) {
 		if ((globals.odbc_user = strchr(globals.odbc_dsn, ':'))) {
 			*globals.odbc_user++ = '\0';
@@ -203,9 +193,9 @@
 			globals.odbc_dsn = globals.odbc_user = globals.odbc_pass;
 		}
 	}
-	
 
-	if (zstr(globals.odbc_dsn) || zstr(globals.odbc_user) || zstr(globals.odbc_pass)) {
+
+	if (zstr(globals.odbc_dsn)) {
 		globals.dbname = "call_limit";
 		dbh = limit_get_db_handle();
 	}
@@ -225,16 +215,16 @@
 			NULL
 		};
 
-		
 
+
 		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_cache_db_execute_sql(dbh, indexes[x], NULL);
 		}
-	
+
 		switch_cache_db_release_db_handle(&dbh);
 
 		sql = switch_mprintf("delete from limit_data where hostname='%q';", globals.hostname);
@@ -248,7 +238,7 @@
 static void limit_fire_event(const char *realm, const char *key, uint32_t usage, uint32_t rate, uint32_t max, uint32_t ratemax)
 {
 	switch_event_t *event;
-	
+
 	if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, LIMIT_EVENT_USAGE) == SWITCH_STATUS_SUCCESS) {
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "realm", realm);
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", key);
@@ -268,8 +258,7 @@
 	const char *vval = switch_channel_get_variable(channel, LIMIT_IGNORE_TRANSFER_VARIABLE);
 
 	if (state >= CS_HANGUP || (state == CS_ROUTING && !switch_true(vval))) {
-		sql = switch_mprintf("delete from limit_data where uuid='%q';",
-							 switch_core_session_get_uuid(session));
+		sql = switch_mprintf("delete from limit_data where uuid='%q';", switch_core_session_get_uuid(session));
 		limit_execute_sql(sql, globals.mutex);
 		switch_safe_free(sql);
 		switch_core_event_hook_remove_state_change(session, db_state_handler);
@@ -279,98 +268,46 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t hash_state_handler(switch_core_session_t *session) 
+static switch_status_t hash_state_handler(switch_core_session_t *session)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_channel_state_t state = switch_channel_get_state(channel);
 	limit_hash_private_t *pvt = switch_channel_get_private(channel, "limit_hash");
 	const char *vval = switch_channel_get_variable(channel, LIMIT_IGNORE_TRANSFER_VARIABLE);
-	
+
 	/* The call is either hung up, or is going back into the dialplan, decrement appropriate couters */
-	if (state >= CS_HANGUP || (state == CS_ROUTING && !switch_true(vval))) {	
+	if (state >= CS_HANGUP || (state == CS_ROUTING && !switch_true(vval))) {
 		switch_hash_index_t *hi;
 		switch_mutex_lock(globals.limit_hash_mutex);
 
 		/* Loop through the channel's hashtable which contains mapping to all the limit_hash_item_t referenced by that channel */
-		while((hi = switch_hash_first(NULL, pvt->hash)))
-		{
+		while ((hi = switch_hash_first(NULL, pvt->hash))) {
 			void *val = NULL;
 			const void *key;
 			switch_ssize_t keylen;
 			limit_hash_item_t *item = NULL;
-			
+
 			switch_hash_this(hi, &key, &keylen, &val);
-			
-			item = (limit_hash_item_t*)val;
-			item->total_usage--;	
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d\n", (const char*)key, item->total_usage);
-			
-			if (item->total_usage == 0)  {
+
+			item = (limit_hash_item_t *) val;
+			item->total_usage--;
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d\n", (const char *) key, item->total_usage);
+
+			if (item->total_usage == 0) {
 				/* Noone is using this item anymore */
-				switch_core_hash_delete(globals.limit_hash, (const char*)key);
+				switch_core_hash_delete(globals.limit_hash, (const char *) key);
 				free(item);
 			}
-			
-			switch_core_hash_delete(pvt->hash, (const char*)key);
+
+			switch_core_hash_delete(pvt->hash, (const char *) key);
 		}
-		
+
 		/* Remove handler */
 		switch_core_event_hook_remove_state_change(session, hash_state_handler);
-		
+
 		switch_mutex_unlock(globals.limit_hash_mutex);
 	}
-	
-	return SWITCH_STATUS_SUCCESS;
-}
 
-static switch_status_t memcache_state_handler(switch_core_session_t *session) 
-{
-	switch_channel_t *channel = switch_core_session_get_channel(session);
-	switch_channel_state_t state = switch_channel_get_state(channel);
-	int argc = 0;
-	char *argv[32] = { 0 };
-	char *pvt = switch_channel_get_private(channel, "limit_keys");
-	char *mydata = NULL;
-	int i = 0;
-
-	char *hashkey = NULL;
-	uint32_t total_usage = 0;
-	char *cmd = NULL;
-	switch_stream_handle_t stream = { 0 };
-	const char *vval = switch_channel_get_variable(channel, LIMIT_IGNORE_TRANSFER_VARIABLE);
-	
-	SWITCH_STANDARD_STREAM(stream);
-	
-	switch_assert(pvt);
-	
-	/* The call is either hung up, or is going back into the dialplan, decrement appropriate couters */
-	if (state >= CS_HANGUP || (state == CS_ROUTING && !switch_true(vval))) {	
-
-		/* Loop through the channel's keys which contains mapping to all the limits referenced by that channel */
-		mydata = switch_core_session_strdup(session, pvt);
-		argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0])));
-		for (i = 0; i < argc; i++) {
-			hashkey = argv[i];
-			cmd = switch_core_session_sprintf(session, "decrement limit:%s_total 1", hashkey);
-			switch_api_execute("memcache", cmd, session, &stream);
-			if (strncmp("-ERR", stream.data, 4)) {
-				total_usage = atoi(stream.data);
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d\n", (const char*)hashkey, total_usage);
-			} else {
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error from mod_memcache %s.", (const char *) stream.data);
-				goto end;
-			}
-			
-			stream.end = stream.data;
-		}
-			
-		/* Remove handler */
-		switch_core_event_hook_remove_state_change(session, memcache_state_handler);
-		switch_channel_set_private(channel, "limit_keys", NULL);
-	}
-	
-end:
-	switch_safe_free(stream.data);
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -525,21 +462,21 @@
 	char *mydata = NULL;
 	char *hash_key = NULL;
 	char *value = NULL;
-	
+
 	switch_mutex_lock(globals.db_hash_mutex);
-	
+
 	if (!zstr(data)) {
 		mydata = strdup(data);
 		switch_assert(mydata);
 		argc = switch_separate_string(mydata, '/', argv, (sizeof(argv) / sizeof(argv[0])));
 	}
-	
+
 	if (argc < 3 || !argv[0]) {
 		goto usage;
 	}
-	
+
 	hash_key = switch_mprintf("%s_%s", argv[1], argv[2]);
-	
+
 	if (!strcasecmp(argv[0], "insert")) {
 		if (argc < 4) {
 			goto usage;
@@ -559,13 +496,13 @@
 	} else {
 		goto usage;
 	}
-	
+
 	goto done;
 
-usage:
+  usage:
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "USAGE: hash %s\n", HASH_USAGE);
 
-done:
+  done:
 	switch_mutex_unlock(globals.db_hash_mutex);
 	switch_safe_free(mydata);
 	switch_safe_free(hash_key);
@@ -587,13 +524,13 @@
 		switch_assert(mydata);
 		argc = switch_separate_string(mydata, '/', argv, (sizeof(argv) / sizeof(argv[0])));
 	}
-	
+
 	if (argc < 3 || !argv[0]) {
 		goto usage;
 	}
-	
+
 	hash_key = switch_mprintf("%s_%s", argv[1], argv[2]);
-	
+
 	if (!strcasecmp(argv[0], "insert")) {
 		if (argc < 4) {
 			goto usage;
@@ -621,17 +558,17 @@
 	} else {
 		goto usage;
 	}
-	
+
 	goto done;
-	
-usage:
+
+  usage:
 	stream->write_function(stream, "-ERR Usage: hash %s\n", HASH_API_USAGE);
-	
-done:
+
+  done:
 	switch_mutex_unlock(globals.db_hash_mutex);
 	switch_safe_free(mydata);
 	switch_safe_free(hash_key);
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -700,7 +637,7 @@
 
 		limit_execute_sql_callback(NULL, sql, group_callback, &cbt);
 		switch_safe_free(sql);
-		
+
 		*(buf + (strlen(buf) - 1)) = '\0';
 		stream->write_function(stream, "%s", buf);
 
@@ -774,15 +711,15 @@
 
 	cbt.buf = buf;
 	cbt.len = sizeof(buf);
-	sql = switch_mprintf("select count(hostname) from limit_data where realm='%q' and id like '%q'", realm, id);
+	sql = switch_mprintf("select count(hostname) from limit_data where realm='%q' and id='%q'", realm, id);
 	limit_execute_sql_callback(NULL, sql, sql2str_callback, &cbt);
 	switch_safe_free(sql);
 	got = atoi(buf);
 
 	if (max < 0) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s_%s is now %d\n", realm, id, got+1);
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s_%s is now %d\n", realm, id, got + 1);
 	} else {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s_%s is now %d/%d\n", realm, id, got+1, max);
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s_%s is now %d/%d\n", realm, id, got + 1, max);
 	}
 
 	if (max >= 0 && got + 1 > max) {
@@ -797,7 +734,7 @@
 					   switch_core_session_get_uuid(session));
 	limit_execute_sql(sql, NULL);
 	switch_safe_free(sql);
-	
+
 	{
 		const char *susage = switch_core_session_sprintf(session, "%d", ++got);
 
@@ -838,8 +775,8 @@
 
 	realm = argv[0];
 	id = argv[1];
-	
-	/* Accept '-' as unlimited (act as counter)*/
+
+	/* Accept '-' as unlimited (act as counter) */
 	if (argv[2][0] == '-') {
 		max = -1;
 	} else {
@@ -847,7 +784,7 @@
 
 		if (max < 0) {
 			max = 0;
-		}	
+		}
 	}
 
 	if (argc >= 4) {
@@ -859,12 +796,12 @@
 	if (!do_limit(session, realm, id, max)) {
 		/* Limit exceeded */
 		if (*xfer_exten == '!') {
-			switch_channel_hangup(channel, switch_channel_str2cause(xfer_exten+1));
+			switch_channel_hangup(channel, switch_channel_str2cause(xfer_exten + 1));
 		} else {
 			switch_ivr_session_transfer(session, xfer_exten, argv[4], argv[5]);
 		}
 	}
-	
+
 }
 
 /* !\brief Releases usage of a limit_-controlled ressource  */
@@ -872,8 +809,7 @@
 {
 	char *sql = NULL;
 
-	sql = switch_mprintf("delete from limit_data where uuid='%q' and realm='%q' and id like '%q'", 
-						switch_core_session_get_uuid(session), realm, id);
+	sql = switch_mprintf("delete from limit_data where uuid='%q' and realm='%q' and id like '%q'", switch_core_session_get_uuid(session), realm, id);
 	limit_execute_sql(sql, globals.mutex);
 	switch_safe_free(sql);
 }
@@ -896,16 +832,16 @@
 		mydata = switch_core_session_strdup(session, data);
 		argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
 	}
-	
+
 	if (argc < 2) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "USAGE: limit_execute %s\n", LIMITEXECUTE_USAGE);
 		return;
 	}
-	
+
 	realm = argv[0];
 	id = argv[1];
-	
-	/* Accept '-' as unlimited (act as counter)*/
+
+	/* Accept '-' as unlimited (act as counter) */
 	if (argv[2][0] == '-') {
 		max = -1;
 	} else {
@@ -913,7 +849,7 @@
 
 		if (max < 0) {
 			max = 0;
-		}	
+		}
 	}
 
 	app = argv[3];
@@ -966,7 +902,7 @@
 
 	stream->write_function(stream, "%s", buf);
 
-end:
+  end:
 	switch_safe_free(mydata);
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -988,22 +924,21 @@
 	time_t now = switch_epoch_time_now(NULL);
 	limit_hash_private_t *pvt = NULL;
 	uint8_t increment = 1;
-	
+
 	hashkey = switch_core_session_sprintf(session, "%s_%s", realm, id);
 
 	switch_mutex_lock(globals.limit_hash_mutex);
 	/* Check if that realm+id has ever been checked */
-	if (!(item = (limit_hash_item_t*)switch_core_hash_find(globals.limit_hash, hashkey))) {
+	if (!(item = (limit_hash_item_t *) switch_core_hash_find(globals.limit_hash, hashkey))) {
 		/* No, create an empty structure and add it, then continue like as if it existed */
-		item = (limit_hash_item_t*)malloc(sizeof(limit_hash_item_t));
+		item = (limit_hash_item_t *) malloc(sizeof(limit_hash_item_t));
 		switch_assert(item);
 		memset(item, 0, sizeof(limit_hash_item_t));
 		switch_core_hash_insert(globals.limit_hash, hashkey, item);
 	}
 
 	/* Did we already run on this channel before? */
-	if ((pvt = switch_channel_get_private(channel, "limit_hash")))
-	{
+	if ((pvt = switch_channel_get_private(channel, "limit_hash"))) {
 		/* Yes, but check if we did that realm+id
 		   If we didnt, allow incrementing the counter.
 		   If we did, dont touch it but do the validation anyways
@@ -1011,7 +946,7 @@
 		increment = !switch_core_hash_find(pvt->hash, hashkey);
 	} else {
 		/* This is the first limit check on this channel, create a hashtable, set our prviate data and add a state handler */
-		pvt = (limit_hash_private_t*)switch_core_session_alloc(session, sizeof(limit_hash_private_t));
+		pvt = (limit_hash_private_t *) switch_core_session_alloc(session, sizeof(limit_hash_private_t));
 		memset(pvt, 0, sizeof(limit_hash_private_t));
 		switch_core_hash_init(&pvt->hash, switch_core_session_get_pool(session));
 		switch_channel_set_private(channel, "limit_hash", pvt);
@@ -1025,13 +960,14 @@
 			/* Always increment rate when its checked as it doesnt depend on the channel */
 			item->rate_usage++;
 
-			if ((max >= 0) && (item->rate_usage > (uint32_t)max)) {
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s exceeds maximum rate of %d/%ds, now at %d\n", hashkey, max, interval, item->rate_usage);
+			if ((max >= 0) && (item->rate_usage > (uint32_t) max)) {
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s exceeds maximum rate of %d/%ds, now at %d\n",
+								  hashkey, max, interval, item->rate_usage);
 				status = SWITCH_FALSE;
 				goto end;
 			}
 		}
-	} else if ((max >= 0) && (item->total_usage + increment > (uint32_t)max)) {
+	} else if ((max >= 0) && (item->total_usage + increment > (uint32_t) max)) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is already at max value (%d)\n", hashkey, item->total_usage);
 		status = SWITCH_FALSE;
 		goto end;
@@ -1045,12 +981,13 @@
 		if (max == -1) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d\n", hashkey, item->total_usage);
 		} else if (interval == 0) {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d/%d\n", hashkey, item->total_usage, max);	
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d/%d\n", hashkey, item->total_usage, max);
 		} else {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d/%d for the last %d seconds\n", hashkey, item->rate_usage, max, interval);
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d/%d for the last %d seconds\n", hashkey,
+							  item->rate_usage, max, interval);
 		}
 
-		limit_fire_event(realm, id, item->total_usage, item->rate_usage, max, max >=0 ? (uint32_t)max : 0);
+		limit_fire_event(realm, id, item->total_usage, item->rate_usage, max, max >= 0 ? (uint32_t) max : 0);
 	}
 
 	/* Save current usage & rate into channel variables so it can be used later in the dialplan, or added to CDR records */
@@ -1067,7 +1004,7 @@
 
 	switch_core_event_hook_add_state_change(session, hash_state_handler);
 
-end:	
+  end:
 	switch_mutex_unlock(globals.limit_hash_mutex);
 	return status;
 }
@@ -1079,28 +1016,28 @@
 	limit_hash_private_t *pvt = switch_channel_get_private(channel, "limit_hash");
 	limit_hash_item_t *item = NULL;
 	char *hashkey = NULL;
-	
+
 	if (!pvt || !pvt->hash) {
 		return;
 	}
-	
+
 	hashkey = switch_core_session_sprintf(session, "%s_%s", realm, id);
-	
+
 	switch_mutex_lock(globals.limit_hash_mutex);
-	
-	if ((item = (limit_hash_item_t*)switch_core_hash_find(pvt->hash, hashkey))) {
-		item->total_usage--;	
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d\n", (const char*)hashkey, item->total_usage);
-	
+
+	if ((item = (limit_hash_item_t *) switch_core_hash_find(pvt->hash, hashkey))) {
+		item->total_usage--;
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d\n", (const char *) hashkey, item->total_usage);
+
 		switch_core_hash_delete(pvt->hash, hashkey);
-	
-		if (item->total_usage == 0)  {
+
+		if (item->total_usage == 0) {
 			/* Noone is using this item anymore */
-			switch_core_hash_delete(globals.limit_hash, (const char*)hashkey);
+			switch_core_hash_delete(globals.limit_hash, (const char *) hashkey);
 			free(item);
 		}
 	}
-	
+
 	switch_mutex_unlock(globals.limit_hash_mutex);
 }
 
@@ -1123,29 +1060,28 @@
 		mydata = switch_core_session_strdup(session, data);
 		argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
 	}
-	
+
 	if (argc < 2) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "USAGE: limit_hash %s\n", LIMITHASH_USAGE);
 		return;
 	}
-	
+
 	realm = argv[0];
 	id = argv[1];
-	
+
 	/* If max is omitted or negative, only act as a counter and skip maximum checks */
 	if (argc > 2) {
 		if (argv[2][0] == '-') {
 			max = -1;
 		} else {
 			char *szinterval = NULL;
-			if ((szinterval = strchr(argv[2], '/')))
-			{
+			if ((szinterval = strchr(argv[2], '/'))) {
 				*szinterval++ = '\0';
 				interval = atoi(szinterval);
 			}
-			
+
 			max = atoi(argv[2]);
-			
+
 			if (max < 0) {
 				max = 0;
 			}
@@ -1157,11 +1093,11 @@
 	} else {
 		xfer_exten = limit_def_xfer_exten;
 	}
-	
+
 	if (!do_limit_hash(session, realm, id, max, interval)) {
 		/* Limit exceeded */
 		if (*xfer_exten == '!') {
-			switch_channel_hangup(channel, switch_channel_str2cause(xfer_exten+1));
+			switch_channel_hangup(channel, switch_channel_str2cause(xfer_exten + 1));
 		} else {
 			switch_ivr_session_transfer(session, xfer_exten, argv[4], argv[5]);
 		}
@@ -1188,23 +1124,22 @@
 		mydata = switch_core_session_strdup(session, data);
 		argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
 	}
-	
+
 	if (argc < 5) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "USAGE: limit_hash_execute %s\n", LIMITHASHEXECUTE_USAGE);
 		return;
 	}
-	
+
 	realm = argv[0];
 	id = argv[1];
-	
-	/* Accept '-' as unlimited (act as counter)*/
+
+	/* Accept '-' as unlimited (act as counter) */
 	if (argv[2][0] == '-') {
 		max = -1;
 	} else {
 		char *szinterval = NULL;
 
-		if ((szinterval = strchr(argv[2], '/')))
-		{
+		if ((szinterval = strchr(argv[2], '/'))) {
 			*szinterval++ = '\0';
 			interval = atoi(szinterval);
 		}
@@ -1213,9 +1148,9 @@
 
 		if (max < 0) {
 			max = 0;
-		}	
+		}
 	}
-	
+
 	app = argv[3];
 	app_arg = argv[4];
 
@@ -1226,7 +1161,10 @@
 
 	if (do_limit_hash(session, realm, id, max, interval)) {
 		switch_core_session_execute_application(session, app, app_arg);
-		limit_hash_release(session, realm, id);
+		/* Only release the resource if we are still in CS_EXECUTE */
+		if (switch_channel_get_state(switch_core_session_get_channel(session)) == CS_EXECUTE) {
+			limit_hash_release(session, realm, id);			
+		}
 	}
 }
 
@@ -1242,378 +1180,34 @@
 	uint32_t count = 0;
 
 	switch_mutex_lock(globals.limit_hash_mutex);
-	
+
 	if (!zstr(cmd)) {
 		mydata = strdup(cmd);
 		switch_assert(mydata);
 		argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
 	}
-	
+
 	if (argc < 2) {
 		stream->write_function(stream, "USAGE: limit_hash_usage %s\n", LIMIT_HASH_USAGE_USAGE);
 		goto end;
 	}
-	
+
 	hash_key = switch_mprintf("%s_%s", argv[0], argv[1]);
-	
+
 	if ((item = switch_core_hash_find(globals.limit_hash, hash_key))) {
 		count = item->total_usage;
-	} 
-	
+	}
+
 	stream->write_function(stream, "%d", count);
-	
-end:
+
+  end:
 	switch_safe_free(mydata);
 	switch_safe_free(hash_key);
 	switch_mutex_unlock(globals.limit_hash_mutex);
-	
-	return SWITCH_STATUS_SUCCESS;
-}
 
-/* \brief Enforces limit_memcache restrictions
- * \param session current session
- * \param realm limit realm
- * \param id limit id
- * \param max maximum count
- * \param interval interval for rate limiting
- * \return SWITCH_TRUE if the access is allowed, SWITCH_FALSE if it isnt
- */
-static switch_bool_t do_limit_memcache(switch_core_session_t *session, const char *realm, const char *id, int max, int interval)
-{
-	switch_channel_t *channel = switch_core_session_get_channel(session);
-	char *hashkey = NULL;
-	switch_bool_t status = SWITCH_TRUE;
-	uint8_t increment = 1;
-	uint32_t total_usage = 0;
-	uint32_t rate_usage = 0;
-	char *cmd = NULL;
-	char *pvt = NULL;
-	int argc = 0;
-	int i = 0;
-	char *argv[32] = { 0 };
-	char *mydata = NULL;
-	
-	switch_stream_handle_t stream = { 0 };
-	
-	if (switch_loadable_module_exists("mod_memcache") != SWITCH_STATUS_SUCCESS) {
-		status = SWITCH_TRUE;
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "mod_memcache is not loaded.");
-		goto end;
-	}
-	
-	SWITCH_STANDARD_STREAM(stream);
-	hashkey = switch_core_session_sprintf(session, "%s_%s", realm, id);
-	
-	/* Did we already run on this channel before? */
-	if ((pvt = switch_channel_get_private(channel, "limit_keys")))
-	{
-		/* Yes, but check if we did that realm+id
-		   If we didnt, allow incrementing the counter.
-		   If we did, dont touch it but do the validation anyways
-		 */
-		mydata = switch_core_session_strdup(session, pvt);
-		argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0])));
-		for (i = 0; i < argc; i++) {
-			if (!strcmp(hashkey, argv[i])) {
-				increment = 0;
-				break;
-			}
-		}
-	}
-	
-	cmd = switch_core_session_sprintf(session, "get limit:%s_total", hashkey);
-	switch_api_execute("memcache", cmd, session, &stream);
-	if (strncmp("-ERR", stream.data, 4)) {
-		total_usage = atoi(stream.data);
-	} else if (!strncmp("-ERR NOT FOUND", stream.data, 14)) {
-		total_usage = 0;
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error from mod_memcache %s.", (const char *) stream.data);
-		status = SWITCH_TRUE;
-		goto end;
-	}
-	
-	stream.end = stream.data;
-
-	if (interval > 0) {
-		cmd = switch_core_session_sprintf(session, "increment limit:%s_rate 1 %d", hashkey, interval);
-		switch_api_execute("memcache", cmd, session, &stream);
-		if (strncmp("-ERR", stream.data, 4)) {
-			rate_usage = atoi(stream.data);
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error from mod_memcache %s.", (const char *) stream.data);
-			status = SWITCH_TRUE;
-			goto end;
-		}
-		if ((max >= 0) && (rate_usage > (uint32_t)max)) {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s exceeds maximum rate of %d/%ds, now at %d\n", hashkey, max, interval, rate_usage);
-			status = SWITCH_FALSE;
-			goto end;
-		}
-	} else if ((max >= 0) && (total_usage + increment > (uint32_t)max)) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is already at max value (%d)\n", hashkey, total_usage);
-		status = SWITCH_FALSE;
-		goto end;
-	}
-	
-	stream.end = stream.data;
-
-	if (increment) {
-		cmd = switch_core_session_sprintf(session, "increment limit:%s_total 1", hashkey);
-		switch_api_execute("memcache", cmd, session, &stream);
-		if (strncmp("-ERR", stream.data, 4)) {
-			total_usage = atoi(stream.data);
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error from mod_memcache %s.", (const char *) stream.data);
-			status = SWITCH_TRUE;
-			goto end;
-		}
-		if (max == -1) {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d\n", hashkey, total_usage);
-		} else if (interval == 0) {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d/%d\n", hashkey, total_usage, max);	
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d/%d for the last %d seconds\n", hashkey, rate_usage, max, interval);
-		}
-
-		limit_fire_event(realm, id, total_usage, rate_usage, max, max >=0 ? (uint32_t)max : 0);
-	}
-
-	/* Save current usage & rate into channel variables so it can be used later in the dialplan, or added to CDR records */
-	{
-		const char *susage = switch_core_session_sprintf(session, "%d", total_usage);
-		const char *srate = switch_core_session_sprintf(session, "%d", rate_usage);
-
-		switch_channel_set_variable(channel, "limit_usage", susage);
-		switch_channel_set_variable(channel, switch_core_session_sprintf(session, "limit_usage_%s", hashkey), susage);
-
-		switch_channel_set_variable(channel, "limit_rate", srate);
-		switch_channel_set_variable(channel, switch_core_session_sprintf(session, "limit_rate_%s", hashkey), srate);
-	}
-	
-	if (pvt && increment) {
-		pvt = switch_core_session_sprintf(session, "%s,%s", pvt, hashkey);
-	} else {
-		/* This is the first limit check on this channel, create a hashtable, set our prviate data and add a state handler */
-		pvt = (char *) hashkey;
-	}
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "hash_keys: %s\n", pvt);
-	switch_channel_set_private(channel, "limit_keys", pvt);
-
-	switch_core_event_hook_add_state_change(session, memcache_state_handler);
-
-end:	
-	switch_safe_free(stream.data);
-	return status;
-}
-
-/* !\brief Releases usage of a limit_hash-controlled ressource  */
-static void limit_memcache_release(switch_core_session_t *session, const char *realm, const char *id)
-{
-	char *hashkey = NULL;
-	uint32_t total_usage = 0;
-	char *cmd = NULL;
-	switch_stream_handle_t stream = { 0 };
-	SWITCH_STANDARD_STREAM(stream);
-	
-	if (switch_loadable_module_exists("mod_memcache") != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "mod_memcache is not loaded.");
-		goto end;
-	}
-
-	hashkey = switch_core_session_sprintf(session, "%s_%s", realm, id);
-	
-	cmd = switch_core_session_sprintf(session, "decrement limit:%s_total 1", hashkey);
-	switch_api_execute("memcache", cmd, session, &stream);
-	if (strncmp("-ERR", stream.data, 4)) {
-		total_usage = atoi(stream.data);
-	} else if (!strncmp("-ERR NOT FOUND", stream.data, 14)) {
-		total_usage = 0;
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error from mod_memcache %s.", (const char *) stream.data);
-		goto end;
-	}
-
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Usage for %s is now %d\n", (const char*)hashkey, total_usage);
-
-end:
-	switch_safe_free(stream.data);
-}
-
-#define LIMITMEMCACHE_USAGE "<realm> <id> [<max>[/interval]] [number [dialplan [context]]]"
-#define LIMITMEMCACHE_DESC "limit access to a resource and transfer to an extension if the limit is exceeded"
-SWITCH_STANDARD_APP(limit_memcache_function)
-{
-	int argc = 0;
-	char *argv[6] = { 0 };
-	char *mydata = NULL;
-	char *realm = NULL;
-	char *id = NULL;
-	char *xfer_exten = NULL;
-	int max = -1;
-	int interval = 0;
-	char *szinterval = NULL;
-	switch_channel_t *channel = switch_core_session_get_channel(session);
-
-	/* Parse application data  */
-	if (!zstr(data)) {
-		mydata = switch_core_session_strdup(session, data);
-		argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
-	}
-	
-	if (argc < 2) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "USAGE: limit_memcache %s\n", LIMITMEMCACHE_USAGE);
-		return;
-	}
-	
-	realm = argv[0];
-	id = argv[1];
-	
-	/* If max is omitted, only act as a counter and skip maximum checks */
-	if (argc > 2) {
-		if ((szinterval = strchr(argv[2], '/')))
-		{
-			*szinterval++ = '\0';
-			interval = atoi(szinterval);
-		}
-		
-		max = atoi(argv[2]);
-		
-		if (max < 0) {
-			max = 0;
-		}
-	}
-
-	if (argc > 3) {
-		xfer_exten = argv[3];
-	} else {
-		xfer_exten = limit_def_xfer_exten;
-	}
-	
-	if (!do_limit_memcache(session, realm, id, max, interval)) {
-		/* Limit exceeded */
-		if (*xfer_exten == '!') {
-			switch_channel_hangup(channel, switch_channel_str2cause(xfer_exten+1));
-		} else {
-			switch_ivr_session_transfer(session, xfer_exten, argv[4], argv[5]);
-		}
-	}
-}
-
-
-#define LIMITMEMCACHEEXECUTE_USAGE "<realm> <id> [<max>[/interval]] [application] [application arguments]"
-#define LIMITMEMCACHEEXECUTE_DESC "limit access to a resource. the specified application will only be executed if the resource is available"
-SWITCH_STANDARD_APP(limit_memcache_execute_function)
-{
-	int argc = 0;
-	char *argv[5] = { 0 };
-	char *mydata = NULL;
-	char *realm = NULL;
-	char *id = NULL;
-	char *app = NULL;
-	char *app_arg = NULL;
-	int max = -1;
-	int interval = 0;
-	char *szinterval = NULL;
-
-	/* Parse application data  */
-	if (!zstr(data)) {
-		mydata = switch_core_session_strdup(session, data);
-		argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
-	}
-	
-	if (argc < 2) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "USAGE: limit_memcache_execute %s\n", LIMITMEMCACHEEXECUTE_USAGE);
-		return;
-	}
-	
-	realm = argv[0];
-	id = argv[1];
-	
-	/* If max is omitted, only act as a counter and skip maximum checks */
-	if (argc > 2) {
-		if ((szinterval = strchr(argv[2], '/')))
-		{
-			*szinterval++ = '\0';
-			interval = atoi(szinterval);
-		}
-		
-		max = atoi(argv[2]);
-		
-		if (max < 0) {
-			max = 0;
-		}
-	}
-
-
-	app = argv[3];
-	app_arg = argv[4];
-
-	if (zstr(app)) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing application\n");
-		return;
-	}
-
-	if (do_limit_memcache(session, realm, id, max, interval)) {
-		switch_core_session_execute_application(session, app, app_arg);
-		limit_memcache_release(session, realm, id);
-	}
-}
-
-
-#define LIMIT_MEMCACHE_USAGE_USAGE "<realm> <id>"
-SWITCH_STANDARD_API(limit_memcache_usage_function)
-{
-	int argc = 0;
-	char *argv[3] = { 0 };
-	char *mydata = NULL;
-	uint32_t count = 0;
-	char *apicmd = NULL;
-	switch_bool_t status = SWITCH_TRUE;
-	switch_stream_handle_t apistream = { 0 };
-
-	SWITCH_STANDARD_STREAM(apistream);
-	if (switch_loadable_module_exists("mod_memcache") != SWITCH_STATUS_SUCCESS) {
-		status = SWITCH_TRUE;
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "mod_memcache is not loaded.");
-		stream->write_function(stream, "-ERR mod_memcache not loaded");
-		goto end;
-	}
-
-	if (!zstr(cmd)) {
-		mydata = strdup(cmd);
-		switch_assert(mydata);
-		argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
-	}
-	
-	if (argc < 2) {
-		stream->write_function(stream, "USAGE: limit_memcache_usage %s\n", LIMIT_MEMCACHE_USAGE_USAGE);
-		goto end;
-	}
-	
-	apicmd = switch_mprintf("get limit:%s_%s_total", argv[0], argv[1]);
-	switch_api_execute("memcache", apicmd, session, &apistream);
-	if (strncmp("-ERR", apistream.data, 4)) {
-		count = atoi(apistream.data);
-	} else if (!strncmp("-ERR NOT FOUND", apistream.data, 14)) {
-		count = 0;
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error from mod_memcache %s.", (const char *) apistream.data);
-		status = SWITCH_TRUE;
-		goto end;
-	}
-	
-	stream->write_function(stream, "%d", count);
-	
-end:
-	switch_safe_free(mydata);
-	switch_safe_free(apistream.data);
-	switch_safe_free(apicmd);
-	
 	return SWITCH_STATUS_SUCCESS;
 }
 
-
 SWITCH_MODULE_LOAD_FUNCTION(mod_limit_load)
 {
 	switch_status_t status;
@@ -1626,11 +1220,10 @@
 
 
 	if (switch_event_reserve_subclass(LIMIT_EVENT_USAGE) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldnt register event subclass \"%s\"", 
-			LIMIT_EVENT_USAGE);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldnt register event subclass \"%s\"", LIMIT_EVENT_USAGE);
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	if ((status = do_config() != SWITCH_STATUS_SUCCESS)) {
 		return status;
 	}
@@ -1643,21 +1236,20 @@
 
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
-		
 
 
+
 	SWITCH_ADD_APP(app_interface, "limit", "Limit", LIMIT_DESC, limit_function, LIMIT_USAGE, SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "limit_execute", "Limit", LIMITEXECUTE_USAGE, limit_execute_function, LIMITEXECUTE_USAGE, SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "limit_hash", "Limit (hash)", LIMITHASH_DESC, limit_hash_function, LIMITHASH_USAGE, SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "limit_hash_execute", "Limit (hash)", LIMITHASHEXECUTE_USAGE, limit_hash_execute_function, LIMITHASHEXECUTE_USAGE, SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "limit_memcache", "Limit (memcache)", LIMITMEMCACHE_DESC, limit_memcache_function, LIMITMEMCACHE_USAGE, SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "limit_memcache_execute", "Limit (memcache)", LIMITMEMCACHEEXECUTE_USAGE, limit_memcache_execute_function, LIMITMEMCACHEEXECUTE_USAGE, SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "limit_hash_execute", "Limit (hash)", LIMITHASHEXECUTE_USAGE, limit_hash_execute_function, LIMITHASHEXECUTE_USAGE,
+				   SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "db", "Insert to the db", DB_DESC, db_function, DB_USAGE, SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_APP(app_interface, "hash", "Insert into the hashtable", HASH_DESC, hash_function, HASH_USAGE, SAF_SUPPORT_NOMEDIA)
-	SWITCH_ADD_APP(app_interface, "group", "Manage a group", GROUP_DESC, group_function, GROUP_USAGE, SAF_SUPPORT_NOMEDIA);
+		SWITCH_ADD_APP(app_interface, "group", "Manage a group", GROUP_DESC, group_function, GROUP_USAGE, SAF_SUPPORT_NOMEDIA);
 
-	SWITCH_ADD_API(commands_api_interface, "limit_hash_usage", "Gets the usage count of a limited resource", limit_hash_usage_function,  LIMIT_HASH_USAGE_USAGE);
-	SWITCH_ADD_API(commands_api_interface, "limit_memcache_usage", "Gets the usage count of a limited resource", limit_memcache_usage_function,  LIMIT_MEMCACHE_USAGE_USAGE);
+	SWITCH_ADD_API(commands_api_interface, "limit_hash_usage", "Gets the usage count of a limited resource", limit_hash_usage_function,
+				   LIMIT_HASH_USAGE_USAGE);
 	SWITCH_ADD_API(commands_api_interface, "limit_usage", "Gets the usage count of a limited resource", limit_usage_function, "<realm> <id>");
 	SWITCH_ADD_API(commands_api_interface, "db", "db get/set", db_api_function, "[insert|delete|select]/<realm>/<key>/<value>");
 	switch_console_set_complete("add db insert");
@@ -1677,13 +1269,13 @@
 }
 
 
-SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_limit_shutdown) 
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_limit_shutdown)
 {
-	
+
 	switch_event_free_subclass(LIMIT_EVENT_USAGE);
-	
+
 	switch_xml_config_cleanup(config_settings);
-	
+
 	switch_mutex_destroy(globals.mutex);
 	switch_mutex_destroy(globals.limit_hash_mutex);
 	switch_mutex_destroy(globals.db_hash_mutex);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_memcache/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_memcache/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_memcache/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,30 +1,28 @@
 MEMCACHED=libmemcached-0.32
-switch_srcdir=../../../..
+BASE=../../../..
 
 WANT_CURL=yes
 
 MEMCACHED_DIR=$(switch_srcdir)/libs/$(MEMCACHED)
+MEMCACHED_BUILDDIR=$(switch_builddir)/libs/$(MEMCACHED)
 
-MEMCACHEDLA=$(MEMCACHED_DIR)/libmemcached/libmemcached.la
+MEMCACHEDLA=$(MEMCACHED_BUILDDIR)/libmemcached/libmemcached.la
 
-LOCAL_CFLAGS=-I$(MEMCACHED_DIR)
+LOCAL_CFLAGS=-I$(MEMCACHED_DIR) -I$(MEMCACHED_BUILDDIR)
 LOCAL_LIBADD=$(MEMCACHEDLA)
 
-include $(switch_srcdir)/build/modmake.rules
+include $(BASE)/build/modmake.rules
 
-DEFAULT_ARGS=--prefix=$(PREFIX) --disable-shared --with-pic
-
-$(LOCAL_OBJS): $(LOCAL_SOURCES)
-
 $(MEMCACHED_DIR):
 	$(GETLIB) $(MEMCACHED).tar.gz
 
-$(MEMCACHED_DIR)/Makefile: $(MEMCACHED_DIR)
-	cd $(MEMCACHED_DIR) && CFLAGS=$(AM_CFLAGS) CC=$(CC) CXX=$(CXX) ./configure --disable-shared --with-pic --with-memcached=no CPPFLAGS= LDFLAGS=
+$(MEMCACHED_BUILDDIR)/Makefile: $(MEMCACHED_DIR)
+	mkdir -p $(MEMCACHED_BUILDDIR)
+	cd $(MEMCACHED_BUILDDIR) && $(DEFAULT_VARS) $(MEMCACHED_DIR)/configure $(DEFAULT_ARGS) --with-memcached=no --srcdir=$(MEMCACHED_DIR)  CPPFLAGS= LDFLAGS=
 	$(TOUCH_TARGET)
 
-$(MEMCACHEDLA): $(MEMCACHED_DIR)/Makefile
-	cd $(MEMCACHED_DIR) && $(MAKE)
+$(MEMCACHEDLA): $(MEMCACHED_BUILDDIR)/Makefile
+	cd $(MEMCACHED_BUILDDIR) && $(MAKE)
 	$(TOUCH_TARGET)
 
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_memcache/mod_memcache.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_memcache/mod_memcache.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_memcache/mod_memcache.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -42,11 +42,8 @@
 SWITCH_MODULE_DEFINITION(mod_memcache, mod_memcache_load, mod_memcache_shutdown, NULL);
 
 static char *SYNTAX = "memcache <set|replace|add> <key> <value> [expiration [flags]]\n"
-  "memcache <get|getflags> <key>\n"
-  "memcache <delete> <key>\n"
-  "memcache <increment|decrement> <key> [offset [expires [flags]]]\n"
-  "memcache <flush>\n"
-  "memcache <status> [verbose]\n";
+	"memcache <get|getflags> <key>\n"
+	"memcache <delete> <key>\n" "memcache <increment|decrement> <key> [offset [expires [flags]]]\n" "memcache <flush>\n" "memcache <status> [verbose]\n";
 
 static struct {
 	memcached_st *memcached;
@@ -55,7 +52,8 @@
 
 static switch_event_node_t *NODE = NULL;
 
-static switch_status_t config_callback_memcached(switch_xml_config_item_t *data, const char *newvalue, switch_config_callback_type_t callback_type, switch_bool_t changed) 
+static switch_status_t config_callback_memcached(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;
 	memcached_server_st *memcached_server = NULL;
@@ -64,23 +62,23 @@
 	const char *memcached_str = NULL;
 	memcached_return rc;
 	unsigned int servercount;
-	
+
 	if ((callback_type == CONFIG_LOAD || callback_type == CONFIG_RELOAD) && changed) {
 		memcached_str = newvalue;
-		
+
 		/* initialize main ptr */
 		memcached_server = memcached_servers_parse(memcached_str);
 		if (!memcached_server) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to initialize memcached data structure (server_list).\n");
 			switch_goto_status(SWITCH_STATUS_GENERR, end);
 		}
-		
+
 		if ((servercount = memcached_server_list_count(memcached_server)) == 0) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No memcache servers defined.  Server string: %s.\n", memcached_str);
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%u servers defined (%s).\n", servercount, memcached_str);
 		}
-		
+
 		/* setup memcached */
 		newmemcached = memcached_create(NULL);
 		if (!newmemcached) {
@@ -93,16 +91,16 @@
 			switch_goto_status(SWITCH_STATUS_GENERR, end);
 		}
 		/* memcached_behavior_set(newmemcached, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 1); */
-		
+
 		/* swap pointers */
 		oldmemcached = globals.memcached;
 		globals.memcached = newmemcached;
 		newmemcached = NULL;
 	}
-	
+
 	switch_goto_status(SWITCH_STATUS_SUCCESS, end);
 
-end:
+  end:
 	if (memcached_server) {
 		memcached_server_list_free(memcached_server);
 	}
@@ -115,12 +113,13 @@
 	return status;
 }
 
-static switch_xml_config_string_options_t config_opt_memcache_servers = {NULL, 0, NULL}; /* anything ok */
+static switch_xml_config_string_options_t config_opt_memcache_servers = { NULL, 0, NULL };	/* anything ok */
 
 static switch_xml_config_item_t instructions[] = {
 	/* parameter name        type                 reloadable   pointer                         default value     options structure */
-	SWITCH_CONFIG_ITEM_CALLBACK("memcache-servers", SWITCH_CONFIG_STRING, CONFIG_REQUIRED | CONFIG_RELOAD, &globals.memcached_str, "", config_callback_memcached, &config_opt_memcache_servers,
-		"host,host:port,host", "List of memcached servers."),
+	SWITCH_CONFIG_ITEM_CALLBACK("memcache-servers", SWITCH_CONFIG_STRING, CONFIG_REQUIRED | CONFIG_RELOAD, &globals.memcached_str, "",
+								config_callback_memcached, &config_opt_memcache_servers,
+								"host,host:port,host", "List of memcached servers."),
 	SWITCH_CONFIG_ITEM_END()
 };
 
@@ -129,8 +128,8 @@
 	if (switch_xml_config_parse_module_settings("memcache.conf", reload, instructions) != SWITCH_STATUS_SUCCESS) {
 		return SWITCH_STATUS_GENERR;
 	}
-	
-	
+
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -154,42 +153,42 @@
 	time_t expires = 0;
 	uint32_t flags = 0;
 	unsigned int server_count = 0;
-	
+
 	memcached_return rc;
 	memcached_st *memcached = NULL;
 	memcached_stat_st *stat = NULL;
 	memcached_server_st *server_list;
-	
+
 	if (zstr(cmd)) {
 		goto usage;
 	}
-	
+
 	mydata = strdup(cmd);
 	if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
 		if (argc < 1) {
 			goto usage;
 		}
-		
+
 		/* clone memcached struct so we're thread safe */
 		memcached = memcached_clone(NULL, globals.memcached);
 		if (!memcached) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error cloning memcached object");
 			stream->write_function(stream, "-ERR Error cloning memcached object\n");
 		}
-		
+
 		subcmd = argv[0];
-		
+
 		if ((!strcasecmp(subcmd, "set") || !strcasecmp(subcmd, "replace") || !strcasecmp(subcmd, "add")) && argc > 2) {
 			key = argv[1];
 			val = argv[2];
 
-			if(argc > 3) {
+			if (argc > 3) {
 				expires_str = argv[3];
-				expires = (time_t)strtol(expires_str, NULL, 10);
+				expires = (time_t) strtol(expires_str, NULL, 10);
 			}
-			if(argc > 4) {
+			if (argc > 4) {
 				flags_str = argv[4];
-				flags = (uint32_t)strtol(flags_str, NULL, 16);
+				flags = (uint32_t) strtol(flags_str, NULL, 16);
 			}
 			if (!strcasecmp(subcmd, "set")) {
 				rc = memcached_set(memcached, key, strlen(key), val, strlen(val), expires, flags);
@@ -198,7 +197,7 @@
 			} else if (!strcasecmp(subcmd, "add")) {
 				rc = memcached_add(memcached, key, strlen(key), val, strlen(val), expires, flags);
 			}
-			
+
 			if (rc == MEMCACHED_SUCCESS) {
 				stream->write_function(stream, "+OK\n");
 			} else {
@@ -206,10 +205,10 @@
 			}
 		} else if (!strcasecmp(subcmd, "get") && argc > 1) {
 			key = argv[1];
-			
+
 			val = memcached_get(memcached, key, strlen(key), &string_length, &flags, &rc);
 			if (rc == MEMCACHED_SUCCESS) {
-				stream->write_function(stream, "%.*s", (int)string_length, val);
+				stream->write_function(stream, "%.*s", (int) string_length, val);
 			} else {
 				switch_safe_free(val);
 				switch_goto_status(SWITCH_STATUS_SUCCESS, mcache_error);
@@ -217,7 +216,7 @@
 			switch_safe_free(val);
 		} else if (!strcasecmp(subcmd, "getflags") && argc > 1) {
 			key = argv[1];
-			
+
 			val = memcached_get(memcached, key, strlen(key), &string_length, &flags, &rc);
 			if (rc == MEMCACHED_SUCCESS) {
 				stream->write_function(stream, "%x", flags);
@@ -227,26 +226,27 @@
 			}
 			switch_safe_free(val);
 		} else if ((!strcasecmp(subcmd, "increment") || !strcasecmp(subcmd, "decrement")) && argc > 1) {
-			key = argv[1];
 			uint64_t ivalue;
 			unsigned int offset = 1;
 			switch_bool_t increment = SWITCH_TRUE;
 			char *svalue = NULL;
+			key = argv[1];
+
 			if (argc > 2) {
-				offset = (unsigned int)strtol(argv[2], NULL, 10);
+				offset = (unsigned int) strtol(argv[2], NULL, 10);
 				svalue = argv[2];
 			} else {
 				svalue = "1";
 			}
-			if(argc > 3) {
+			if (argc > 3) {
 				expires_str = argv[3];
-				expires = (time_t)strtol(expires_str, NULL, 10);
+				expires = (time_t) strtol(expires_str, NULL, 10);
 			}
-			if(argc > 4) {
+			if (argc > 4) {
 				flags_str = argv[4];
-				flags = (uint32_t)strtol(flags_str, NULL, 16);
+				flags = (uint32_t) strtol(flags_str, NULL, 16);
 			}
-			
+
 			if (!strcasecmp(subcmd, "increment")) {
 				increment = SWITCH_TRUE;
 				rc = memcached_increment(memcached, key, strlen(key), offset, &ivalue);
@@ -258,18 +258,20 @@
 				/* ok, trying to incr / decr a value that doesn't exist yet.
 				   Try to add an appropriate initial value.  If someone else beat
 				   us to it, then redo incr/decr.  Otherwise we're good.
-				*/
+				 */
 				rc = memcached_add(memcached, key, strlen(key), (increment) ? svalue : "0", strlen(svalue), expires, flags);
 				if (rc == MEMCACHED_SUCCESS) {
 					ivalue = (increment) ? offset : 0;
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Initialized inc/dec memcache key: %s to value %d\n", key, offset);
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Initialized inc/dec memcache key: %s to value %d\n", key,
+									  offset);
 				} else {
 					if (increment) {
 						rc = memcached_increment(memcached, key, strlen(key), offset, &ivalue);
 					} else {
 						rc = memcached_decrement(memcached, key, strlen(key), offset, &ivalue);
 					}
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Someone else created incr/dec memcache key, resubmitting inc/dec request.\n");
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+									  "Someone else created incr/dec memcache key, resubmitting inc/dec request.\n");
 				}
 			}
 			if (rc == MEMCACHED_SUCCESS) {
@@ -279,9 +281,9 @@
 			}
 		} else if (!strcasecmp(subcmd, "delete") && argc > 1) {
 			key = argv[1];
-			if(argc > 2) {
+			if (argc > 2) {
 				expires_str = argv[3];
-				expires = (time_t)strtol(expires_str, NULL, 10);
+				expires = (time_t) strtol(expires_str, NULL, 10);
 			}
 			rc = memcached_delete(memcached, key, strlen(key), expires);
 			if (rc == MEMCACHED_SUCCESS) {
@@ -290,9 +292,9 @@
 				switch_goto_status(SWITCH_STATUS_SUCCESS, mcache_error);
 			}
 		} else if (!strcasecmp(subcmd, "flush")) {
-			if(argc > 1) {
+			if (argc > 1) {
 				expires_str = argv[3];
-				expires = (time_t)strtol(expires_str, NULL, 10);
+				expires = (time_t) strtol(expires_str, NULL, 10);
 			}
 			rc = memcached_flush(memcached, expires);
 			if (rc == MEMCACHED_SUCCESS) {
@@ -309,7 +311,7 @@
 					verbose = SWITCH_TRUE;
 				}
 			}
-			
+
 			stream->write_function(stream, "Lib version: %s\n", memcached_lib_version());
 			stat = memcached_stat(memcached, NULL, &rc);
 			if (rc != MEMCACHED_SUCCESS && rc != MEMCACHED_SOME_ERRORS) {
@@ -319,13 +321,14 @@
 			server_count = memcached_server_count(memcached);
 			stream->write_function(stream, "Servers: %d\n", server_count);
 			for (x = 0; x < server_count; x++) {
-				stream->write_function(stream, "  %s (%u)\n", memcached_server_name(memcached, server_list[x]), memcached_server_port(memcached, server_list[x]));
+				stream->write_function(stream, "  %s (%u)\n", memcached_server_name(memcached, server_list[x]),
+									   memcached_server_port(memcached, server_list[x]));
 				if (verbose == SWITCH_TRUE) {
 					char **list;
 					char **ptr;
 					char *value;
 					memcached_return rc2;
-					
+
 					list = memcached_stat_get_keys(memcached, &stat[x], &rc);
 					for (ptr = list; *ptr; ptr++) {
 						value = memcached_stat_get_value(memcached, &stat[x], *ptr, &rc2);
@@ -342,25 +345,26 @@
 	}
 	switch_goto_status(SWITCH_STATUS_SUCCESS, done);
 
-mcache_error:
+  mcache_error:
 	if (rc != MEMCACHED_NOTFOUND) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error while running command %s: %s\n", subcmd, memcached_strerror(memcached, rc));
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error while running command %s: %s\n", subcmd,
+						  memcached_strerror(memcached, rc));
 	}
 	stream->write_function(stream, "-ERR %s\n", memcached_strerror(memcached, rc));
 	goto done;
-	
-usage:
+
+  usage:
 	stream->write_function(stream, "-ERR\n%s\n", SYNTAX);
 	switch_goto_status(SWITCH_STATUS_SUCCESS, done);
-	
-done: 
+
+  done:
 	if (memcached) {
 		memcached_quit(memcached);
 		memcached_free(memcached);
 	}
 	switch_safe_free(mydata);
 	switch_safe_free(stat);
-	
+
 	return status;
 }
 
@@ -374,12 +378,12 @@
 	memset(&globals, 0, sizeof(globals));
 
 	do_config(SWITCH_FALSE);
-	
+
 	if ((switch_event_bind_removable(modname, SWITCH_EVENT_RELOADXML, NULL, event_handler, NULL, &NODE) != SWITCH_STATUS_SUCCESS)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind event!\n");
 		return SWITCH_STATUS_TERM;
 	}
-	
+
 	SWITCH_ADD_API(api_interface, "memcache", "Memcache API", memcache_function, "syntax");
 
 	/* indicate that the module should continue to be loaded */
@@ -396,9 +400,9 @@
 	if (globals.memcached) {
 		memcached_free(globals.memcached);
 	}
-	
+
 	switch_event_unbind(&NODE);
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_nibblebill/mod_nibblebill.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_nibblebill/mod_nibblebill.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_nibblebill/mod_nibblebill.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -53,31 +53,28 @@
 static char SQL_LOOKUP[] = "SELECT %s FROM %s WHERE %s='%s'";
 static char SQL_SAVE[] = "UPDATE %s SET %s=%s-%f WHERE %s='%s'";
 
-typedef struct
-{
-	switch_time_t lastts;	/* Last time we did any billing */
-	float total;	/* Total amount billed so far */
+typedef struct {
+	switch_time_t lastts;		/* Last time we did any billing */
+	float total;				/* Total amount billed so far */
 
-	switch_time_t pausets;	/* Timestamp of when a pause action started. 0 if not paused */
-	float bill_adjustments;	/* Adjustments to make to the next billing, based on pause/resume events */
+	switch_time_t pausets;		/* Timestamp of when a pause action started. 0 if not paused */
+	float bill_adjustments;		/* Adjustments to make to the next billing, based on pause/resume events */
 
 } nibble_data_t;
 
 
-typedef struct nibblebill_results
-{
-	float	balance;
+typedef struct nibblebill_results {
+	float balance;
 
-	float	percall_max; /* Overrides global on a per-user level */
-	float	lowbal_amt;  /*  ditto */
+	float percall_max;			/* Overrides global on a per-user level */
+	float lowbal_amt;			/*  ditto */
 } nibblebill_results_t;
 
 
 /* Keep track of our config, event hooks and database connection variables, for this module only */
-static struct
-{
+static struct {
 	/* Memory */
-        switch_memory_pool_t *pool;
+	switch_memory_pool_t *pool;
 
 	/* Event hooks */
 	switch_event_node_t *node;
@@ -86,15 +83,15 @@
 	switch_mutex_t *mutex;
 
 	/* Global billing config options */
-	float	percall_max_amt;	/* Per-call billing limit (safety check, for fraud) */
-	char	*percall_action;	/* Exceeded length of per-call action */
-	float	lowbal_amt;		/* When we warn them they are near depletion */
-	char	*lowbal_action;		/* Low balance action */
-	float	nobal_amt;		/* Minimum amount that must remain in the account */
-	char	*nobal_action;		/* Drop action */
+	float percall_max_amt;		/* Per-call billing limit (safety check, for fraud) */
+	char *percall_action;		/* Exceeded length of per-call action */
+	float lowbal_amt;			/* When we warn them they are near depletion */
+	char *lowbal_action;		/* Low balance action */
+	float nobal_amt;			/* Minimum amount that must remain in the account */
+	char *nobal_action;			/* Drop action */
 
 	/* Other options */
-	int	global_heartbeat;	/* Supervise and bill every X seconds, 0 means off */
+	int global_heartbeat;		/* Supervise and bill every X seconds, 0 means off */
 
 	/* Database settings */
 	char *db_username;
@@ -135,7 +132,7 @@
 {
 	nibblebill_results_t *cbt = (nibblebill_results_t *) pArg;
 
-	cbt->balance = (float)atof(argv[0]);
+	cbt->balance = (float) atof(argv[0]);
 
 	return 0;
 }
@@ -145,13 +142,13 @@
 	char *cf = "nibblebill.conf";
 	switch_xml_t cfg, xml = NULL, param, settings;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	
+
 	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
-		status = SWITCH_STATUS_SUCCESS;  /* We don't fail because we can still write to a text file or buffer */
+		status = SWITCH_STATUS_SUCCESS;	/* We don't fail because we can still write to a text file or buffer */
 		goto setdefaults;
 	}
-	
+
 	if ((settings = switch_xml_child(cfg, "settings"))) {
 		for (param = switch_xml_child(settings, "param"); param; param = param->next) {
 			char *var = (char *) switch_xml_attr_soft(param, "name");
@@ -172,32 +169,23 @@
 			} else if (!strcasecmp(var, "percall_action")) {
 				set_global_percall_action(val);
 			} else if (!strcasecmp(var, "percall_max_amt")) {
-				globals.percall_max_amt = (float)atof(val);
+				globals.percall_max_amt = (float) atof(val);
 			} else if (!strcasecmp(var, "lowbal_action")) {
 				set_global_lowbal_action(val);
 			} else if (!strcasecmp(var, "lowbal_amt")) {
-				globals.lowbal_amt = (float)atof(val);
+				globals.lowbal_amt = (float) atof(val);
 			} else if (!strcasecmp(var, "nobal_action")) {
 				set_global_nobal_action(val);
 			} else if (!strcasecmp(var, "nobal_amt")) {
-				globals.nobal_amt = (float)atof(val);
+				globals.nobal_amt = (float) atof(val);
 			} else if (!strcasecmp(var, "global_heartbeat")) {
 				globals.global_heartbeat = atoi(val);
 			}
 		}
 	}
-	
+
 /* Set defaults for any variables still not set */
-setdefaults:
-	if (zstr(globals.db_username)) {
-		set_global_db_username("bandwidth.com");
-	}
-	if (zstr(globals.db_password)) {
-		set_global_db_password("dev");
-	}
-	if (zstr(globals.db_dsn)) {
-		set_global_db_dsn("bandwidth.com");
-	}
+  setdefaults:
 	if (zstr(globals.percall_action)) {
 		set_global_percall_action("hangup");
 	}
@@ -218,7 +206,7 @@
 		}
 
 		if (switch_odbc_handle_connect(globals.master_odbc) != SWITCH_ODBC_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, 
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
 							  "Cannot connect to ODBC driver/database %s (user: %s / pass %s)!\n",
 							  globals.db_dsn, globals.db_username, globals.db_password);
 			status = SWITCH_STATUS_FALSE;
@@ -229,10 +217,10 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: %s\n", globals.db_dsn);
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
-						  "ODBC does not appear to be installed in the core. You need to run ./configure --enable-core-odbc-support\n");
+						  "ODBC does not appear to be installed in the core or your dsn is empty. You need to run ./configure --enable-core-odbc-support\n");
 	}
 
-done:
+  done:
 	if (xml) {
 		switch_xml_free(xml);
 	}
@@ -241,7 +229,7 @@
 
 void debug_event_handler(switch_event_t *event)
 {
-	 if (!event) {
+	if (!event) {
 		return;
 	}
 
@@ -305,10 +293,11 @@
 		return SWITCH_STATUS_SUCCESS;
 	}
 
-	switch_snprintf(sql, 1024, SQL_SAVE, globals.db_table, globals.db_column_cash, globals.db_column_cash, billamount, globals.db_column_account, billaccount);
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,  "Doing update query\n[%s]\n", sql);
+	switch_snprintf(sql, 1024, SQL_SAVE, globals.db_table, globals.db_column_cash, globals.db_column_cash, billamount, globals.db_column_account,
+					billaccount);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Doing update query\n[%s]\n", sql);
 
-	if (switch_odbc_handle_exec(globals.master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
+	if (switch_odbc_handle_exec(globals.master_odbc, sql, &stmt, NULL) != SWITCH_ODBC_SUCCESS) {
 		char *err_str;
 		err_str = switch_odbc_handle_get_error(globals.master_odbc, stmt);
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, switch_str_nil(err_str));
@@ -347,9 +336,9 @@
 		/* Successfully retrieved! */
 		balance = pdata.balance;
 
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,  "Retrieved current balance for account %s (balance = %f)\n", billaccount, balance);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Retrieved current balance for account %s (balance = %f)\n", billaccount, balance);
 	}
-	
+
 	return balance;
 }
 
@@ -371,6 +360,8 @@
 	switch_time_exp_t tm;
 	const char *billrate;
 	const char *billaccount;
+	float nobal_amt = globals.nobal_amt;
+	float lowbal_amt = globals.lowbal_amt;
 	float balance;
 
 	if (!session) {
@@ -388,13 +379,21 @@
 	/* Variables kept in FS but relevant only to this module */
 	billrate = switch_channel_get_variable(channel, "nibble_rate");
 	billaccount = switch_channel_get_variable(channel, "nibble_account");
+	
+	if (!zstr(switch_channel_get_variable(channel, "nobal_amt"))) {
+		nobal_amt = atof(switch_channel_get_variable(channel, "nobal_amt"));
+	}
+	if (!zstr(switch_channel_get_variable(channel, "lowbal_amt"))) {
+		lowbal_amt = atof(switch_channel_get_variable(channel, "lowbal_amt"));
+	}
 
 	/* Return if there's no billing information on this session */
 	if (!billrate || !billaccount) {
 		return SWITCH_STATUS_SUCCESS;
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Attempting to bill at $%s per minute to account %s\n", billrate, billaccount);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Attempting to bill at $%s per minute to account %s\n", billrate,
+					  billaccount);
 
 	/* Get caller profile info from channel */
 	profile = switch_channel_get_caller_profile(channel);
@@ -409,10 +408,11 @@
 
 		/* See if this person has enough money left to continue the call */
 		balance = get_balance(billaccount);
-switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Comparing %f to hangup balance of %f\n", balance, globals.nobal_amt);
-		if (balance <= globals.nobal_amt) {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Comparing %f to hangup balance of %f\n", balance, nobal_amt);
+		if (balance <= nobal_amt) {
 			/* Not enough money - reroute call to nobal location */
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Balance of %f fell below allowed amount of %f! (Account %s)\n", balance, globals.nobal_amt, billaccount);
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Balance of %f fell below allowed amount of %f! (Account %s)\n",
+							  balance, nobal_amt, billaccount);
 
 			transfer_call(session, globals.nobal_action);
 		}
@@ -443,7 +443,7 @@
 		memset(nibble_data, 0, sizeof(*nibble_data));
 
 		/* Setup new billing data (based on call answer time, in case this module started late with active calls) */
-		nibble_data->lastts = profile->times->answered;		/* Set the initial answer time to match when the call was really answered */
+		nibble_data->lastts = profile->times->answered;	/* Set the initial answer time to match when the call was really answered */
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Beginning new billing on %s\n", uuid);
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Last successful billing time was %s\n", date);
@@ -452,13 +452,15 @@
 	switch_time_exp_lt(&tm, nibble_data->lastts);
 	switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
 
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%d seconds passed since last bill time of %s\n", (int) ((ts - nibble_data->lastts) / 1000000), date);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%d seconds passed since last bill time of %s\n",
+					  (int) ((ts - nibble_data->lastts) / 1000000), date);
 
 	if ((ts - nibble_data->lastts) >= 0) {
 		/* Convert billrate into microseconds and multiply by # of microseconds that have passed since last *successful* bill */
-		billamount = ((float)atof(billrate) / 1000000 / 60) * ((ts - nibble_data->lastts)) - nibble_data->bill_adjustments;
+		billamount = ((float) atof(billrate) / 1000000 / 60) * ((ts - nibble_data->lastts)) - nibble_data->bill_adjustments;
 
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Billing $%f to %s (Call: %s / %f so far)\n", billamount, billaccount, uuid, nibble_data->total);
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Billing $%f to %s (Call: %s / %f so far)\n", billamount, billaccount,
+						  uuid, nibble_data->total);
 
 		/* DO ODBC BILLING HERE and reset counters if it's successful! */
 		if (bill_event(billamount, billaccount) == SWITCH_STATUS_SUCCESS) {
@@ -474,7 +476,8 @@
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Failed to log to database!\n");
 		}
 	} else {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Just tried to bill %s negative minutes! That should be impossible.\n", uuid);
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Just tried to bill %s negative minutes! That should be impossible.\n",
+						  uuid);
 	}
 
 	/* Update the last time we billed */
@@ -486,9 +489,10 @@
 
 		/* See if this person has enough money left to continue the call */
 		balance = get_balance(billaccount);
-		if (balance <= globals.nobal_amt) {
+		if (balance <= nobal_amt) {
 			/* Not enough money - reroute call to nobal location */
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Balance of %f fell below allowed amount of %f! (Account %s)\n", balance, globals.nobal_amt, billaccount);
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Balance of %f fell below allowed amount of %f! (Account %s)\n",
+							  balance, nobal_amt, billaccount);
 
 			/* IMPORTANT: Billing must be paused before the transfer occurs! This prevents infinite loops, since the transfer will result */
 			/* in nibblebill checking the call again in the routing process for an allowed balance! */
@@ -496,7 +500,7 @@
 			nibblebill_pause(session);
 			transfer_call(session, globals.nobal_action);
 		}
-        }
+	}
 
 
 	/* Done changing - release lock */
@@ -515,18 +519,18 @@
 	switch_core_session_t *session;
 	char *uuid;
 
-	if (!event){
+	if (!event) {
 		/* We should never get here - it means an event came in without the event info */
 		return;
 	}
 
 	/* Make sure everything is sane */
-	if (!(uuid = switch_event_get_header(event, "Unique-ID"))){
+	if (!(uuid = switch_event_get_header(event, "Unique-ID"))) {
 		/* Donde esta channel? */
 		return;
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Received request via %s!\n", switch_event_name (event->event_id));
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Received request via %s!\n", switch_event_name(event->event_id));
 
 	/* Display debugging info */
 	if (switch_event_get_header(event, "nibble_debug")) {
@@ -594,12 +598,14 @@
 	nibble_data = (nibble_data_t *) switch_channel_get_private(channel, "_nibble_data_");
 
 	if (!nibble_data) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Can't resume - channel is not initialized for billing (This is expected at hangup time)!\n");
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+						  "Can't resume - channel is not initialized for billing (This is expected at hangup time)!\n");
 		return;
 	}
 
 	if (nibble_data->pausets == 0) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Can't resume - channel is not paused! (This is expected at hangup time)\n");
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+						  "Can't resume - channel is not paused! (This is expected at hangup time)\n");
 		return;
 	}
 
@@ -611,8 +617,9 @@
 	billrate = switch_channel_get_variable(channel, "nibble_rate");
 
 	/* Calculate how much was "lost" to billings during pause - we do this here because you never know when the billrate may change during a call */
-	nibble_data->bill_adjustments += ((float)atof(billrate) / 1000000 / 60) * ((ts - nibble_data->pausets));
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Resumed billing! Subtracted %f from this billing cycle.\n", (atof(billrate) / 1000000 / 60) * ((ts - nibble_data->pausets)));
+	nibble_data->bill_adjustments += ((float) atof(billrate) / 1000000 / 60) * ((ts - nibble_data->pausets));
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Resumed billing! Subtracted %f from this billing cycle.\n",
+					  (atof(billrate) / 1000000 / 60) * ((ts - nibble_data->pausets)));
 
 	nibble_data->pausets = 0;
 
@@ -699,7 +706,7 @@
 	}
 
 	/* Variables kept in FS but relevant only to this module */
-	
+
 	billaccount = switch_channel_get_variable(channel, "nibble_account");
 
 	/* Return if there's no billing information on this session */
@@ -725,7 +732,7 @@
 	if (!zstr(data) && (lbuf = strdup(data))
 		&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
 		if (!strcasecmp(argv[0], "adjust") && argc == 2) {
-			nibblebill_adjust(session, (float)atof(argv[1]));
+			nibblebill_adjust(session, (float) atof(argv[1]));
 		} else if (!strcasecmp(argv[0], "flush")) {
 			do_billing(session);
 		} else if (!strcasecmp(argv[0], "pause")) {
@@ -760,7 +767,7 @@
 				channel = switch_core_session_get_channel(psession);
 
 				if (!strcasecmp(argv[1], "adjust") && argc == 3) {
-					nibblebill_adjust(psession, (float)atof(argv[2]));
+					nibblebill_adjust(psession, (float) atof(argv[2]));
 				} else if (!strcasecmp(argv[1], "flush")) {
 					do_billing(psession);
 				} else if (!strcasecmp(argv[1], "pause")) {
@@ -805,7 +812,7 @@
 static switch_status_t process_hangup(switch_core_session_t *session)
 {
 	/* Resume any paused billings, just in case */
-	//	nibblebill_resume(session);
+	//  nibblebill_resume(session);
 
 	/* Now go handle like normal billing */
 	do_billing(session);
@@ -813,17 +820,19 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-switch_state_handler_table_t nibble_state_handler =
-{
-	/* on_init */   	NULL,
-	/* on_routing */   	process_hangup,	/* Need to add a check here for anything in their account before routing */
-	/* on_execute */   	sched_billing,  /* Turn on heartbeat for this session and do an initial account check */
-	/* on_hangup */   	process_hangup, /* On hangup - most important place to go bill */
-	/* on_exch_media */   	sched_billing,
-	/* on_soft_exec */   	NULL,
-	/* on_consume_med */   	NULL,
-	/* on_hibernate */   	NULL,
-	/* on_reset */   	NULL
+switch_state_handler_table_t nibble_state_handler = {
+	/* on_init */ NULL,
+										/* on_routing */ process_hangup,
+										/* Need to add a check here for anything in their account before routing */
+									/* on_execute */ sched_billing,
+									/* Turn on heartbeat for this session and do an initial account check */
+									/* on_hangup */ process_hangup,
+									/* On hangup - most important place to go bill */
+	/* on_exch_media */ sched_billing,
+	/* on_soft_exec */ NULL,
+	/* on_consume_med */ NULL,
+	/* on_hibernate */ NULL,
+	/* on_reset */ NULL
 };
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_nibblebill_load)
@@ -831,13 +840,13 @@
 	switch_api_interface_t *api_interface;
 	switch_application_interface_t *app_interface;
 
-	/* Set every byte in this structure to 0 */	
+	/* Set every byte in this structure to 0 */
 	memset(&globals, 0, sizeof(globals));
 	globals.pool = pool;
 	switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool);
 
 	load_config();
-	
+
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
@@ -845,13 +854,16 @@
 	SWITCH_ADD_API(api_interface, "nibblebill", "Manage billing parameters for a channel/call", nibblebill_api_function, API_SYNTAX);
 
 	/* Add dialplan applications */
-	SWITCH_ADD_APP(app_interface, "nibblebill", "Handle billing for the current channel/call", "Pause, resume, reset, adjust, flush, heartbeat commands to handle billing.", nibblebill_app_function, APP_SYNTAX, SAF_NONE | SAF_ROUTING_EXEC);
+	SWITCH_ADD_APP(app_interface, "nibblebill", "Handle billing for the current channel/call",
+				   "Pause, resume, reset, adjust, flush, heartbeat commands to handle billing.", nibblebill_app_function, APP_SYNTAX,
+				   SAF_NONE | SAF_ROUTING_EXEC);
 
 	/* register state handlers for billing */
 	switch_core_add_state_handler(&nibble_state_handler);
 
 	/* bind to heartbeat events */
-	if (switch_event_bind_removable(modname, SWITCH_EVENT_SESSION_HEARTBEAT, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL, &globals.node) != SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_SESSION_HEARTBEAT, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL, &globals.node) !=
+		SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind event to monitor for session heartbeats!\n");
 		return SWITCH_STATUS_GENERR;
 	}
@@ -861,7 +873,7 @@
 }
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_nibblebill_shutdown)
-{	
+{
 	switch_event_unbind(&globals.node);
 	switch_core_remove_state_handler(&nibble_state_handler);
 	switch_odbc_handle_disconnect(globals.master_odbc);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_rss/mod_rss.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_rss/mod_rss.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_rss/mod_rss.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -184,9 +184,9 @@
 	switch_input_args_t args = { 0 };
 	const char *vcf = NULL;
 	char *chanvars = switch_channel_build_param_string(channel, NULL, NULL);
-	switch_codec_implementation_t read_impl = {0};
+	switch_codec_implementation_t read_impl = { 0 };
 	uint32_t rate, interval;
-    switch_core_session_get_read_impl(session, &read_impl);
+	switch_core_session_get_read_impl(session, &read_impl);
 	interval = read_impl.microseconds_per_packet / 1000;
 
 	if ((vcf = switch_channel_get_variable(channel, "rss_alt_config"))) {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_skel/mod_skel.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_skel/mod_skel.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_skel/mod_skel.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -55,42 +55,46 @@
 	int integer;
 } globals;
 
-static switch_status_t config_callback_siptrace(switch_xml_config_item_t *data, switch_config_callback_type_t callback_type, switch_bool_t changed) 
+static switch_status_t config_callback_siptrace(switch_xml_config_item_t *data, switch_config_callback_type_t callback_type, switch_bool_t changed)
 {
-	switch_bool_t value = *(switch_bool_t*)data->ptr;
+	switch_bool_t value = *(switch_bool_t *) data->ptr;
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "In siptrace callback: value %s changed %s\n",
-		value ? "true" : "false", changed ? "true" : "false");
-	
-	
+					  value ? "true" : "false", changed ? "true" : "false");
+
+
 	/*
-	if ((callback_type == CONFIG_LOG || callback_type == CONFIG_RELOAD) && changed) {
-		nua_set_params(((sofia_profile_t*)data->functiondata)->nua, TPTAG_LOG(value), TAG_END());
-	} 
-	*/
-	
+	   if ((callback_type == CONFIG_LOG || callback_type == CONFIG_RELOAD) && changed) {
+	   nua_set_params(((sofia_profile_t*)data->functiondata)->nua, TPTAG_LOG(value), TAG_END());
+	   } 
+	 */
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_xml_config_string_options_t config_opt_codec_negotiation = { NULL, 0, "greedy|generous|evil" };
+
 /* enforce_min, min, enforce_max, max */
 static switch_xml_config_int_options_t config_opt_integer = { SWITCH_TRUE, 0, SWITCH_TRUE, 10 };
-static switch_xml_config_enum_item_t config_opt_codec_negotiation_enum[] = { 
-	{ "greedy", CODEC_NEGOTIATION_GREEDY },
-	{ "generous", CODEC_NEGOTIATION_GENEROUS },
-	{ "evil", CODEC_NEGOTIATION_EVIL },
-	{ NULL, 0 } 
+static switch_xml_config_enum_item_t config_opt_codec_negotiation_enum[] = {
+	{"greedy", CODEC_NEGOTIATION_GREEDY},
+	{"generous", CODEC_NEGOTIATION_GENEROUS},
+	{"evil", CODEC_NEGOTIATION_EVIL},
+	{NULL, 0}
 };
 
 static switch_xml_config_item_t instructions[] = {
 	/* parameter name        type                 reloadable   pointer                         default value     options structure */
-	SWITCH_CONFIG_ITEM("codec-negotiation-str", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &globals.codec_negotiation_str, "greedy", &config_opt_codec_negotiation, \
-		"greedy|generous|evil", "Specifies the codec negotiation scheme to be used."),
-	SWITCH_CONFIG_ITEM("codec-negotiation", SWITCH_CONFIG_ENUM, CONFIG_RELOADABLE, &globals.codec_negotiation,  (void*)CODEC_NEGOTIATION_GREEDY, &config_opt_codec_negotiation_enum,
-		"greedy|generous|evil", "Specifies the codec negotiation scheme to be used."),
-	SWITCH_CONFIG_ITEM_CALLBACK("sip-trace", SWITCH_CONFIG_BOOL, CONFIG_RELOADABLE, &globals.sip_trace,  (void*)SWITCH_FALSE,  (switch_xml_config_callback_t)config_callback_siptrace, NULL,
-		"yes|no", "If enabled, print out sip messages on the console."),
-	SWITCH_CONFIG_ITEM("integer", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, &globals.integer, (void*)100, &config_opt_integer,
-		NULL, NULL),
+	SWITCH_CONFIG_ITEM("codec-negotiation-str", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &globals.codec_negotiation_str, "greedy",
+					   &config_opt_codec_negotiation,
+					   "greedy|generous|evil", "Specifies the codec negotiation scheme to be used."),
+	SWITCH_CONFIG_ITEM("codec-negotiation", SWITCH_CONFIG_ENUM, CONFIG_RELOADABLE, &globals.codec_negotiation, (void *) CODEC_NEGOTIATION_GREEDY,
+					   &config_opt_codec_negotiation_enum,
+					   "greedy|generous|evil", "Specifies the codec negotiation scheme to be used."),
+	SWITCH_CONFIG_ITEM_CALLBACK("sip-trace", SWITCH_CONFIG_BOOL, CONFIG_RELOADABLE, &globals.sip_trace, (void *) SWITCH_FALSE,
+								(switch_xml_config_callback_t) config_callback_siptrace, NULL,
+								"yes|no", "If enabled, print out sip messages on the console."),
+	SWITCH_CONFIG_ITEM("integer", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, &globals.integer, (void *) 100, &config_opt_integer,
+					   NULL, NULL),
 	SWITCH_CONFIG_ITEM_END()
 };
 
@@ -102,14 +106,14 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not open skel.conf\n");
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
 SWITCH_STANDARD_API(skel_function)
 {
 	do_config(SWITCH_TRUE);
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -121,9 +125,9 @@
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hello World!\n");
-	
+
 	do_config(SWITCH_FALSE);
-	
+
 	SWITCH_ADD_API(api_interface, "skel", "Skel API", skel_function, "syntax");
 
 	/* indicate that the module should continue to be loaded */

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_snapshot/mod_snapshot.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_snapshot/mod_snapshot.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_snapshot/mod_snapshot.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -65,17 +65,18 @@
 
 		break;
 	case SWITCH_ABC_TYPE_READ:
-		
+
 		if (cb->buffer) {
 			uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
 			switch_frame_t frame = { 0 };
 
 			frame.data = data;
 			frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
-			
+
 			if (switch_mutex_trylock(cb->mutex) == SWITCH_STATUS_SUCCESS) {
 				while (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS && !switch_test_flag((&frame), SFF_CNG)) {
-					if (frame.datalen) switch_buffer_slide_write(cb->buffer, frame.data, frame.datalen);
+					if (frame.datalen)
+						switch_buffer_slide_write(cb->buffer, frame.data, frame.datalen);
 				}
 				switch_mutex_unlock(cb->mutex);
 			}
@@ -95,7 +96,7 @@
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_media_bug_t *bug;
 	switch_status_t status;
-	switch_codec_implementation_t read_impl = {0};
+	switch_codec_implementation_t read_impl = { 0 };
 	struct cap_cb *cb;
 	switch_size_t bytes;
 	switch_bind_flag_t bind_flags = 0;
@@ -109,16 +110,16 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Must be at least 5 seconds!\n");
 		return SWITCH_STATUS_FALSE;
 	}
-	
-    switch_core_session_get_read_impl(session, &read_impl);
 
+	switch_core_session_get_read_impl(session, &read_impl);
+
 	if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
 		return SWITCH_STATUS_FALSE;
 	}
 
 	cb = switch_core_session_alloc(session, sizeof(*cb));
 	cb->base = switch_core_session_strdup(session, base);
-	
+
 	bytes = read_impl.samples_per_second * seconds * 2;
 
 	switch_buffer_create_dynamic(&cb->buffer, bytes, bytes, bytes);
@@ -132,7 +133,7 @@
 	switch_ivr_bind_dtmf_meta_session(session, 7, bind_flags, "snapshot::snap");
 
 	switch_channel_set_private(channel, "snapshot", bug);
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -141,11 +142,11 @@
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_media_bug_t *bug = switch_channel_get_private(channel, "snapshot");
 	char *file;
-	switch_file_handle_t fh = {0};
-	switch_codec_implementation_t read_impl = {0};
+	switch_file_handle_t fh = { 0 };
+	switch_codec_implementation_t read_impl = { 0 };
 	switch_size_t bytes_read;
-	int16_t pdata[4096] = {0};
-		
+	int16_t pdata[4096] = { 0 };
+
 	if (bug) {
 		switch_time_exp_t tm;
 		switch_size_t retsize;
@@ -158,19 +159,17 @@
 
 		switch_time_exp_lt(&tm, switch_time_make(switch_epoch_time_now(NULL), 0));
 		switch_strftime(date, &retsize, sizeof(date), "%Y_%m_%d_%H_%M_%S", &tm);
-			
-		file = switch_core_session_sprintf(session, "%s%ssounds%s%s_%s.wav", SWITCH_GLOBAL_dirs.base_dir, 
-										   SWITCH_PATH_SEPARATOR, SWITCH_PATH_SEPARATOR, cb->base, date);
 
+		file = switch_core_session_sprintf(session, "%s%s%s_%s.wav", SWITCH_GLOBAL_dirs.sounds_dir, SWITCH_PATH_SEPARATOR, cb->base, date);
+
 		switch_core_session_get_read_impl(session, &read_impl);
 		fh.channels = 0;
 		fh.native_rate = read_impl.actual_samples_per_second;
-			
+
 		if (switch_core_file_open(&fh,
 								  file,
 								  0,
-								  read_impl.actual_samples_per_second,
-								  SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
+								  read_impl.actual_samples_per_second, SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error opening %s\n", file);
 			switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 			switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
@@ -180,7 +179,7 @@
 		switch_mutex_lock(cb->mutex);
 		while ((bytes_read = switch_buffer_read(cb->buffer, pdata, sizeof(pdata)))) {
 			switch_size_t samples = bytes_read / 2;
-				
+
 			if (switch_core_file_write(&fh, pdata, &samples) != SWITCH_STATUS_SUCCESS) {
 				break;
 			}
@@ -205,8 +204,8 @@
 
 	if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data))) {
 		argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
-	} 
-	
+	}
+
 	if (argc < 1) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: %s\n", SNAP_SYNTAX);
 		return;
@@ -240,7 +239,7 @@
 		}
 
 		start_capture(session, seconds, flags, base);
-		
+
 	}
 
 	if (!strcasecmp(argv[0], "snap")) {
@@ -276,7 +275,7 @@
 				const char *base = argv[3];
 				int seconds = 5;
 				switch_media_bug_flag_t flags = SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_PING;
-				
+
 				if (sec) {
 					int tmp = atoi(sec);
 					if (tmp > 5) {
@@ -297,7 +296,7 @@
 				if (!base) {
 					base = "mod_snapshot";
 				}
-				
+
 				status = start_capture(lsession, seconds, flags, base);
 			}
 
@@ -311,7 +310,7 @@
 		stream->write_function(stream, "-ERR Operation Failed\n");
 	}
 
- done:
+  done:
 
 	switch_safe_free(mycmd);
 	return SWITCH_STATUS_SUCCESS;
@@ -327,7 +326,7 @@
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hello World!\n");
-	
+
 	SWITCH_ADD_API(api_interface, "uuid_snapshot", "Snapshot API", snapshot_function, SNAP_API_SYNTAX);
 	SWITCH_ADD_APP(app_interface, "snapshot", "", "", snapshot_app_function, SNAP_SYNTAX, SAF_SUPPORT_NOMEDIA);
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_snipe_hunt/mod_snipe_hunt.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_snipe_hunt/mod_snipe_hunt.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_snipe_hunt/mod_snipe_hunt.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -55,42 +55,46 @@
 	int integer;
 } globals;
 
-static switch_status_t config_callback_siptrace(switch_xml_config_item_t *data, switch_config_callback_type_t callback_type, switch_bool_t changed) 
+static switch_status_t config_callback_siptrace(switch_xml_config_item_t *data, switch_config_callback_type_t callback_type, switch_bool_t changed)
 {
-	switch_bool_t value = *(switch_bool_t*)data->ptr;
+	switch_bool_t value = *(switch_bool_t *) data->ptr;
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "In siptrace callback: value %s changed %s\n",
-		value ? "true" : "false", changed ? "true" : "false");
-	
-	
+					  value ? "true" : "false", changed ? "true" : "false");
+
+
 	/*
-	if ((callback_type == CONFIG_LOG || callback_type == CONFIG_RELOAD) && changed) {
-		nua_set_params(((sofia_profile_t*)data->functiondata)->nua, TPTAG_LOG(value), TAG_END());
-	} 
-	*/
-	
+	   if ((callback_type == CONFIG_LOG || callback_type == CONFIG_RELOAD) && changed) {
+	   nua_set_params(((sofia_profile_t*)data->functiondata)->nua, TPTAG_LOG(value), TAG_END());
+	   } 
+	 */
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_xml_config_string_options_t config_opt_codec_negotiation = { NULL, 0, "greedy|generous|evil" };
+
 /* enforce_min, min, enforce_max, max */
 static switch_xml_config_int_options_t config_opt_integer = { SWITCH_TRUE, 0, SWITCH_TRUE, 10 };
-static switch_xml_config_enum_item_t config_opt_codec_negotiation_enum[] = { 
-	{ "greedy", CODEC_NEGOTIATION_GREEDY },
-	{ "generous", CODEC_NEGOTIATION_GENEROUS },
-	{ "evil", CODEC_NEGOTIATION_EVIL },
-	{ NULL, 0 } 
+static switch_xml_config_enum_item_t config_opt_codec_negotiation_enum[] = {
+	{"greedy", CODEC_NEGOTIATION_GREEDY},
+	{"generous", CODEC_NEGOTIATION_GENEROUS},
+	{"evil", CODEC_NEGOTIATION_EVIL},
+	{NULL, 0}
 };
 
 static switch_xml_config_item_t instructions[] = {
 	/* parameter name        type                 reloadable   pointer                         default value     options structure */
-	SWITCH_CONFIG_ITEM("codec-negotiation-str", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &globals.codec_negotiation_str, "greedy", &config_opt_codec_negotiation, \
-		"greedy|generous|evil", "Specifies the codec negotiation scheme to be used."),
-	SWITCH_CONFIG_ITEM("codec-negotiation", SWITCH_CONFIG_ENUM, CONFIG_RELOADABLE, &globals.codec_negotiation,  (void*)CODEC_NEGOTIATION_GREEDY, &config_opt_codec_negotiation_enum,
-		"greedy|generous|evil", "Specifies the codec negotiation scheme to be used."),
-	SWITCH_CONFIG_ITEM_CALLBACK("sip-trace", SWITCH_CONFIG_BOOL, CONFIG_RELOADABLE, &globals.sip_trace,  (void*)SWITCH_FALSE,  (switch_xml_config_callback_t)config_callback_siptrace, NULL,
-		"yes|no", "If enabled, print out sip messages on the console."),
-	SWITCH_CONFIG_ITEM("integer", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, &globals.integer, (void*)100, &config_opt_integer,
-		NULL, NULL),
+	SWITCH_CONFIG_ITEM("codec-negotiation-str", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &globals.codec_negotiation_str, "greedy",
+					   &config_opt_codec_negotiation,
+					   "greedy|generous|evil", "Specifies the codec negotiation scheme to be used."),
+	SWITCH_CONFIG_ITEM("codec-negotiation", SWITCH_CONFIG_ENUM, CONFIG_RELOADABLE, &globals.codec_negotiation, (void *) CODEC_NEGOTIATION_GREEDY,
+					   &config_opt_codec_negotiation_enum,
+					   "greedy|generous|evil", "Specifies the codec negotiation scheme to be used."),
+	SWITCH_CONFIG_ITEM_CALLBACK("sip-trace", SWITCH_CONFIG_BOOL, CONFIG_RELOADABLE, &globals.sip_trace, (void *) SWITCH_FALSE,
+								(switch_xml_config_callback_t) config_callback_siptrace, NULL,
+								"yes|no", "If enabled, print out sip messages on the console."),
+	SWITCH_CONFIG_ITEM("integer", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, &globals.integer, (void *) 100, &config_opt_integer,
+					   NULL, NULL),
 	SWITCH_CONFIG_ITEM_END()
 };
 
@@ -102,14 +106,14 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not open snipe_hunt.conf\n");
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
 SWITCH_STANDARD_API(snipe_hunt_function)
 {
 	do_config(SWITCH_TRUE);
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -121,9 +125,9 @@
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hello World!\n");
-	
+
 	do_config(SWITCH_FALSE);
-	
+
 	SWITCH_ADD_API(api_interface, "snipe_hunt", "Snipe_Hunt API", snipe_hunt_function, "syntax");
 
 	/* indicate that the module should continue to be loaded */

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_snom/mod_snom.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_snom/mod_snom.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_snom/mod_snom.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -33,14 +33,9 @@
 SWITCH_MODULE_LOAD_FUNCTION(mod_snom_load);
 SWITCH_MODULE_DEFINITION(mod_snom, mod_snom_load, NULL, NULL);
 
-static switch_bool_t snom_bind_key(const char *key, 
-								   const char *light, 
-								   const char *label,
-								   const char *user, 
-								   const char *host, 
-								   const char *profile, 
-								   const char *action_name, 
-								   const char *action)
+static switch_bool_t snom_bind_key(const char *key,
+								   const char *light,
+								   const char *label, const char *user, const char *host, const char *profile, const char *action_name, const char *action)
 {
 	switch_event_t *event;
 
@@ -61,7 +56,7 @@
 		}
 		return SWITCH_TRUE;
 	}
-	
+
 	return SWITCH_FALSE;
 }
 
@@ -92,17 +87,17 @@
 	if (argc < 6) {
 		goto err;
 	}
-	
+
 	if (snom_bind_key(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7])) {
 		stream->write_function(stream, "+OK %s\n", cmd);
 		goto end;
 	}
-	
- err:
 
+  err:
+
 	stream->write_function(stream, "-Error %s\n", KEY_BIND_SYNTAX);
 
- end:
+  end:
 
 	free(mydata);
 
@@ -122,7 +117,7 @@
 	SWITCH_ADD_API(commands_api_interface, "snom_bind_key", "Bind a key", snom_bind_key_api_function, KEY_BIND_SYNTAX);
 	SWITCH_ADD_API(commands_api_interface, "snom_url", "url", snom_url_api_function, URL_SYNTAX);
 
-	
+
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_soundtouch/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_soundtouch/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_soundtouch/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,20 +1,21 @@
 VERSION=soundtouch-1.3.1
 DIRECTORY=$(switch_srcdir)/libs/$(VERSION)
-LA=$(DIRECTORY)/source/SoundTouch/.libs/libSoundTouch.a
+BUILD_DIRECTORY=$(switch_builddir)/libs/$(VERSION)
+LA=$(BUILD_DIRECTORY)/source/SoundTouch/.libs/libSoundTouch.a
 
 BASE=../../../..
-LOCAL_CFLAGS += -I$(DIRECTORY)/include -DINTEGER_SAMPLES
+LOCAL_CFLAGS += -I$(DIRECTORY)/include -DINTEGER_SAMPLES -I$(BUILD_DIRECTORY)/include
 LOCAL_LIBADD=$(LA)
-DEFAULT_ARGS=--prefix=$(PREFIX) --disable-shared --with-pic
 
 include $(BASE)/build/modmake.rules
 
-$(DIRECTORY)/Makefile $(DIRECTORY)/config.status:
+$(BUILD_DIRECTORY)/Makefile $(BUILD_DIRECTORY)/config.status:
 	$(GETLIB) $(VERSION).tar.gz
-	cd $(DIRECTORY) && ./configure $(DEFAULT_ARGS) --enable-integer-samples
+	mkdir -p $(BUILD_DIRECTORY)
+	cd $(BUILD_DIRECTORY) && $(DEFAULT_VARS) $(DIRECTORY)/configure $(DEFAULT_ARGS) --enable-integer-samples --srcdir=$(DIRECTORY)
 	$(TOUCH_TARGET)
 
-$(LA): $(DIRECTORY)/Makefile $(DIRECTORY)/config.status
-	cd $(DIRECTORY) && $(MAKE)
+$(LA): $(BUILD_DIRECTORY)/Makefile $(BUILD_DIRECTORY)/config.status
+	cd $(BUILD_DIRECTORY) && $(MAKE)
 	$(TOUCH_TARGET)
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_spy/mod_spy.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_spy/mod_spy.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_spy/mod_spy.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -39,10 +39,10 @@
 SWITCH_MODULE_DEFINITION(mod_spy, mod_spy_load, mod_spy_shutdown, NULL);
 
 struct mod_spy_globals {
-	switch_memory_pool_t* pool;
-	switch_event_node_t* node;
-	switch_hash_t* spy_hash;
-	switch_thread_rwlock_t* spy_hash_lock;
+	switch_memory_pool_t *pool;
+	switch_event_node_t *node;
+	switch_hash_t *spy_hash;
+	switch_thread_rwlock_t *spy_hash_lock;
 	uint32_t spy_count;
 } globals;
 
@@ -50,14 +50,14 @@
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 
-	char* data = switch_channel_get_private(channel,"_userspy_");
+	char *data = switch_channel_get_private(channel, "_userspy_");
 	switch_thread_rwlock_wrlock(globals.spy_hash_lock);
-	
-	if ((switch_core_hash_delete(globals.spy_hash,data) != SWITCH_STATUS_SUCCESS)) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,"No such key in userspy: %s \n",data);
 
-	} else {	
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,"Userspy deactivated on %s\n",data);
+	if ((switch_core_hash_delete(globals.spy_hash, data) != SWITCH_STATUS_SUCCESS)) {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No such key in userspy: %s \n", data);
+
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Userspy deactivated on %s\n", data);
 		globals.spy_count--;
 	}
 
@@ -68,16 +68,16 @@
 static switch_status_t spy_on_exchange_media(switch_core_session_t *session)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	const char* spy_uuid = switch_channel_get_variable(channel,"spy_uuid");
-   
+	const char *spy_uuid = switch_channel_get_variable(channel, "spy_uuid");
+
 	if (spy_uuid) {
-		if (switch_ivr_eavesdrop_session(session,spy_uuid,NULL,ED_DTMF) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,"Can't eavesdrop on uuid %s\n",spy_uuid);
+		if (switch_ivr_eavesdrop_session(session, spy_uuid, NULL, ED_DTMF) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't eavesdrop on uuid %s\n", spy_uuid);
 		}
 	}
 
-	switch_channel_set_state(channel,CS_PARK);
-    return SWITCH_STATUS_FALSE;
+	switch_channel_set_state(channel, CS_PARK);
+	return SWITCH_STATUS_FALSE;
 }
 
 static switch_status_t spy_on_park(switch_core_session_t *session)
@@ -85,7 +85,7 @@
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	const char *moh = switch_channel_get_variable(channel, "hold_music");
 
-	while(switch_channel_ready(channel) && switch_channel_get_state(channel) == CS_PARK) {
+	while (switch_channel_ready(channel) && switch_channel_get_state(channel) == CS_PARK) {
 		if (moh) {
 			switch_status_t status = switch_ivr_play_file(session, NULL, moh, NULL);
 			if (!SWITCH_READ_ACCEPTABLE(status)) {
@@ -98,13 +98,13 @@
 
 
 static const switch_state_handler_table_t spy_state_handlers = {
-    /*.on_init */ NULL,
-    /*.on_routing */ NULL,
-    /*.on_execute */ NULL,
-    /*.on_hangup */ spy_on_hangup,
-    /*.on_exchange_media */ spy_on_exchange_media,
-    /*.on_soft_execute */ NULL,
-    /*.on_consume_media */ NULL,
+	/*.on_init */ NULL,
+	/*.on_routing */ NULL,
+	/*.on_execute */ NULL,
+	/*.on_hangup */ spy_on_hangup,
+	/*.on_exchange_media */ spy_on_exchange_media,
+	/*.on_soft_execute */ NULL,
+	/*.on_consume_media */ NULL,
 	/* on_hibernate */ NULL,
 	/* on reset */ NULL,
 	/* on_park */ spy_on_park,
@@ -113,29 +113,29 @@
 SWITCH_STANDARD_API(dump_hash)
 {
 	switch_hash_index_t *hi;
-	const void* key;
-	void* val;
+	const void *key;
+	void *val;
 
 	switch_thread_rwlock_rdlock(globals.spy_hash_lock);
 
-	for (hi = switch_hash_first(NULL,globals.spy_hash);hi; hi = switch_hash_next(hi)){
-		switch_hash_this(hi,&key,NULL,&val);
-		stream->write_function(stream,"%s : %s\n",(char*)key,(const char*)val);
+	for (hi = switch_hash_first(NULL, globals.spy_hash); hi; hi = switch_hash_next(hi)) {
+		switch_hash_this(hi, &key, NULL, &val);
+		stream->write_function(stream, "%s : %s\n", (char *) key, (const char *) val);
 	}
 
-	stream->write_function(stream,"\n%d total spy\n",globals.spy_count);
+	stream->write_function(stream, "\n%d total spy\n", globals.spy_count);
 	switch_thread_rwlock_unlock(globals.spy_hash_lock);
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static void event_handler(switch_event_t* event) 
+static void event_handler(switch_event_t *event)
 {
 	switch_core_session_t *session = NULL;
 	switch_channel_t *channel;
-	char *username[2] = {0};
-	char* domain[2] = {0};
+	char *username[2] = { 0 };
+	char *domain[2] = { 0 };
 	char key[512];
-	char* uuid = NULL, *my_uuid = NULL;
+	char *uuid = NULL, *my_uuid = NULL;
 	int i;
 
 	switch_thread_rwlock_rdlock(globals.spy_hash_lock);
@@ -144,22 +144,22 @@
 		goto done;
 	}
 
-	username[0] = switch_event_get_header(event,"Caller-Username");
-	domain[0] = switch_event_get_header(event,"variable_domain_name");
-	domain[1] = switch_event_get_header(event,"variable_dialed_domain");
-	username[1] = switch_event_get_header(event,"variable_dialed_user");
+	username[0] = switch_event_get_header(event, "Caller-Username");
+	domain[0] = switch_event_get_header(event, "variable_domain_name");
+	domain[1] = switch_event_get_header(event, "variable_dialed_domain");
+	username[1] = switch_event_get_header(event, "variable_dialed_user");
 
 	for (i = 0; i < 2; i++) {
 		if (username[i] && domain[i]) {
-			switch_snprintf(key,sizeof(key),"%s@%s",username[i],domain[i]);	   
+			switch_snprintf(key, sizeof(key), "%s@%s", username[i], domain[i]);
 
-			if ((uuid = switch_core_hash_find(globals.spy_hash,key))) {
+			if ((uuid = switch_core_hash_find(globals.spy_hash, key))) {
 				break;
 			}
 		}
 	}
 
- done:
+  done:
 	switch_thread_rwlock_unlock(globals.spy_hash_lock);
 
 	if (!uuid) {
@@ -169,64 +169,64 @@
 	session = switch_core_session_locate(uuid);
 	channel = switch_core_session_get_channel(session);
 
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,"UserSpy retrieved uuid %s for key %s, activating eavesdrop \n",uuid,key);
-	my_uuid = switch_event_get_header(event,"Unique-ID");
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "UserSpy retrieved uuid %s for key %s, activating eavesdrop \n", uuid, key);
+	my_uuid = switch_event_get_header(event, "Unique-ID");
 
-	switch_channel_set_variable(channel,"spy_uuid",my_uuid);
+	switch_channel_set_variable(channel, "spy_uuid", my_uuid);
 
-	switch_channel_set_state(channel,CS_EXCHANGE_MEDIA);
-	switch_channel_set_flag(channel,CF_BREAK);
+	switch_channel_set_state(channel, CS_EXCHANGE_MEDIA);
+	switch_channel_set_flag(channel, CF_BREAK);
 
 	switch_core_session_rwunlock(session);
 
 }
 
 #define USERSPY_SYNTAX "<user@domain> [uuid]"
-SWITCH_STANDARD_APP(userspy_function) 
+SWITCH_STANDARD_APP(userspy_function)
 {
 	int argc = 0;
-	char* argv[2] = {0};
-	char* params = NULL;
+	char *argv[2] = { 0 };
+	char *params = NULL;
 
-	if (!zstr(data) && (params = switch_core_session_strdup(session,data))) {
+	if (!zstr(data) && (params = switch_core_session_strdup(session, data))) {
 		if ((argc = switch_separate_string(params, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
 
 			switch_channel_t *channel = switch_core_session_get_channel(session);
-			char* uuid = switch_core_session_get_uuid(session);
+			char *uuid = switch_core_session_get_uuid(session);
 			switch_status_t status;
 
 			switch_thread_rwlock_wrlock(globals.spy_hash_lock);
-			if (switch_core_hash_find(globals.spy_hash,argv[0])) {
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,"Spy already exists for %s\n",argv[0]);
-				switch_channel_hangup(channel,SWITCH_CAUSE_NORMAL_CLEARING);
+			if (switch_core_hash_find(globals.spy_hash, argv[0])) {
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Spy already exists for %s\n", argv[0]);
+				switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
 				switch_thread_rwlock_unlock(globals.spy_hash_lock);
 				return;
 			}
 
-			status = switch_core_hash_insert(globals.spy_hash,argv[0],(void*) uuid);
+			status = switch_core_hash_insert(globals.spy_hash, argv[0], (void *) uuid);
 
 			if ((status != SWITCH_STATUS_SUCCESS)) {
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,"Cant insert to spy hash\n");
-				switch_channel_hangup(channel,SWITCH_CAUSE_SERVICE_NOT_IMPLEMENTED);
-				switch_thread_rwlock_unlock(globals.spy_hash_lock);		
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cant insert to spy hash\n");
+				switch_channel_hangup(channel, SWITCH_CAUSE_SERVICE_NOT_IMPLEMENTED);
+				switch_thread_rwlock_unlock(globals.spy_hash_lock);
 				return;
 			}
 
 			globals.spy_count++;
 			switch_thread_rwlock_unlock(globals.spy_hash_lock);
 
-			switch_channel_set_private(channel,"_userspy_",(void*) argv[0]);
-			switch_channel_add_state_handler(channel,&spy_state_handlers);
+			switch_channel_set_private(channel, "_userspy_", (void *) argv[0]);
+			switch_channel_add_state_handler(channel, &spy_state_handlers);
 
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE,"UserSpy activated on %s \n",argv[0]);
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "UserSpy activated on %s \n", argv[0]);
 
 			if (argv[1]) {
-				switch_channel_set_variable(channel,"spy_uuid",argv[1]);
-				switch_channel_set_state(channel,CS_EXCHANGE_MEDIA);
+				switch_channel_set_variable(channel, "spy_uuid", argv[1]);
+				switch_channel_set_state(channel, CS_EXCHANGE_MEDIA);
 				return;
 			}
 
-			switch_channel_set_state(channel,CS_PARK);
+			switch_channel_set_state(channel, CS_PARK);
 			return;
 		}
 		return;
@@ -244,15 +244,15 @@
 
 	globals.pool = pool;
 
-	switch_core_hash_init(&globals.spy_hash,pool);
-	switch_thread_rwlock_create(&globals.spy_hash_lock,pool);
+	switch_core_hash_init(&globals.spy_hash, pool);
+	switch_thread_rwlock_create(&globals.spy_hash_lock, pool);
 	globals.spy_count = 0;
 
 	switch_event_bind_removable(modname, SWITCH_EVENT_CHANNEL_BRIDGE, NULL, event_handler, NULL, &globals.node);
-	
-	SWITCH_ADD_APP(app_interface,"userspy","Spy on a user constantly","Spy on a user constantly",userspy_function,USERSPY_SYNTAX,SAF_NONE);
-	SWITCH_ADD_API(api_interface,"userspy_show","Show current spies",dump_hash,"userspy_show");
-	
+
+	SWITCH_ADD_APP(app_interface, "userspy", "Spy on a user constantly", "Spy on a user constantly", userspy_function, USERSPY_SYNTAX, SAF_NONE);
+	SWITCH_ADD_API(api_interface, "userspy_show", "Show current spies", dump_hash, "userspy_show");
+
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -261,12 +261,12 @@
 {
 	int sanity = 0;
 
-    while (globals.spy_count) {
-        switch_cond_next();
-        if (++sanity >= 60000) {
-            break;
-        }
-    }
+	while (globals.spy_count) {
+		switch_cond_next();
+		if (++sanity >= 60000) {
+			break;
+		}
+	}
 
 	switch_event_unbind(&globals.node);
 	switch_core_hash_destroy(&globals.spy_hash);

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_stress


Name: svn:ignore
   - Debug
*.pdb
*.user
Release
.libs
*.so
   + Debug
*.pdb
*.user
Release
.libs
*.so
Makefile.in
mod_stress.log
.deps
Makefile

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_stress/FFTReal.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_stress/FFTReal.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_stress/FFTReal.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -14,7 +14,7 @@
 
 
 #if defined (FFTReal_CURRENT_HEADER)
-	#error Recursive inclusion of FFTReal header file.
+#error Recursive inclusion of FFTReal header file.
 #endif
 #define	FFTReal_CURRENT_HEADER
 
@@ -25,89 +25,83 @@
 
 #if defined (_MSC_VER)
 #pragma pack (push, 8)
-#endif	// _MSC_VER
+#endif // _MSC_VER
 
 
 
-class	FFTReal
-{
+class FFTReal {
 
 /*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
 
-public:
+  public:
 
 	/* Change this typedef to use a different floating point type in your FFTs
-		(i.e. float, double or long double). */
-	typedef float	flt_t;
+	   (i.e. float, double or long double). */
+	typedef float flt_t;
 
-	explicit			FFTReal (const long length);
-						~FFTReal ();
-	void				do_fft (flt_t f [], const flt_t x []) const;
-	void				do_ifft (const flt_t f [], flt_t x []) const;
-	void				rescale (flt_t x []) const;
+	explicit FFTReal(const long length);
+	    ~FFTReal();
+	void do_fft(flt_t f[], const flt_t x[]) const;
+	void do_ifft(const flt_t f[], flt_t x[]) const;
+	void rescale(flt_t x[]) const;
 
 
 
 /*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
 
-private:
+  private:
 
 	/* Bit-reversed look-up table nested class */
-	class BitReversedLUT
-	{
-	public:
-		explicit			BitReversedLUT (const int nbr_bits);
-							~BitReversedLUT ();
-		const long *	get_ptr () const
-		{
+	      class BitReversedLUT {
+	  public:
+		explicit BitReversedLUT(const int nbr_bits);
+		   ~BitReversedLUT();
+		const long *get_ptr() const {
 			return (_ptr);
-		}
-	private:
-		long *			_ptr;
+	  } private:
+		long *_ptr;
 	};
 
 	/* Trigonometric look-up table nested class */
-	class	TrigoLUT
-	{
-	public:
-		explicit			TrigoLUT (const int nbr_bits);
-							~TrigoLUT ();
-		const flt_t	*	get_ptr (const int level) const
-		{
+	class TrigoLUT {
+	  public:
+		explicit TrigoLUT(const int nbr_bits);
+		   ~TrigoLUT();
+		const flt_t *get_ptr(const int level) const {
 			return (_ptr + (1L << (level - 1)) - 4);
 		};
-	private:
-		flt_t	*			_ptr;
+	  private:
+		      flt_t *_ptr;
 	};
 
-	const BitReversedLUT	_bit_rev_lut;
-	const TrigoLUT	_trigo_lut;
-	const flt_t		_sqrt2_2;
-	const long		_length;
-	const int		_nbr_bits;
-	flt_t *			_buffer_ptr;
+	const BitReversedLUT _bit_rev_lut;
+	const TrigoLUT _trigo_lut;
+	const flt_t _sqrt2_2;
+	const long _length;
+	const int _nbr_bits;
+	flt_t *_buffer_ptr;
 
 
 
 /*\\\ FORBIDDEN MEMBER FUNCTIONS \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
 
-private:
+  private:
 
-						FFTReal (const FFTReal &other);
-	const FFTReal&	operator = (const FFTReal &other);
-	int				operator == (const FFTReal &other);
-	int				operator != (const FFTReal &other);
+	FFTReal(const FFTReal & other);
+	const FFTReal & operator =(const FFTReal & other);
+	int operator ==(const FFTReal & other);
+	int operator !=(const FFTReal & other);
 };
 
 
 
 #if defined (_MSC_VER)
 #pragma pack (pop)
-#endif	// _MSC_VER
+#endif // _MSC_VER
 
 
 
-#endif	// FFTReal_HEADER_INCLUDED
+#endif // FFTReal_HEADER_INCLUDED
 
 #undef FFTReal_CURRENT_HEADER
 

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_stress/Makefile

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_stress/Makefile.am (from rev 16612, freeswitch/trunk/src/mod/applications/mod_stress/Makefile.am) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_stress/Makefile.am	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_stress/Makefile.am	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,8 @@
+include $(top_srcdir)/build/modmake.rulesam
+MODNAME=mod_stress
+
+mod_LTLIBRARIES = mod_stress.la
+mod_stress_la_SOURCES  = mod_stress.cpp FFTReal.cpp
+mod_stress_la_CFLAGS   = $(AM_CFLAGS)
+mod_stress_la_LIBADD   = $(switch_builddir)/libfreeswitch.la
+mod_stress_la_LDFLAGS  = -avoid-version -module -no-undefined -shared

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_stress/mod_stress.cpp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_stress/mod_stress.cpp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_stress/mod_stress.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_t38gateway


Name: svn:ignore
   + Makefile.in
.deps
Makefile
mod_t38gateway.log

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_t38gateway/Makefile

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_t38gateway/Makefile.am (from rev 16612, freeswitch/trunk/src/mod/applications/mod_t38gateway/Makefile.am) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_t38gateway/Makefile.am	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_t38gateway/Makefile.am	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,8 @@
+include $(top_srcdir)/build/modmake.rulesam
+MODNAME=mod_t38gateway
+
+mod_LTLIBRARIES = mod_t38gateway.la
+mod_t38gateway_la_SOURCES  = mod_t38gateway.c udptl.c
+mod_t38gateway_la_CFLAGS   = $(AM_CFLAGS)
+mod_t38gateway_la_LIBADD   = $(switch_builddir)/libfreeswitch.la
+mod_t38gateway_la_LDFLAGS  = -avoid-version -module -no-undefined -shared

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_t38gateway/mod_t38gateway.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_t38gateway/mod_t38gateway.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_t38gateway/mod_t38gateway.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -54,40 +54,42 @@
 
 /*! Type that holds codec information. */
 typedef struct {
-    /*! The sampling rate of the audio stream. */
-    int rate;
-    /*! The number of channels. */
-    int channels;
+	/*! The sampling rate of the audio stream. */
+	int rate;
+	/*! The number of channels. */
+	int channels;
 } t38gateway_codec_info_t;
 
 /*! Type that holds session information pertinent to the t38gateway module. */
 typedef struct {
-    /*! Internal FreeSWITCH session. */
-    switch_core_session_t *session;
-    /*! Codec information for the session. */
-    t38gateway_codec_info_t t38gateway_codec;
-    t38_gateway_state_t *t38;
-    t38_core_state_t *t38_core;
-    udptl_state_t *udptl;
+	/*! Internal FreeSWITCH session. */
+	switch_core_session_t *session;
+	/*! Codec information for the session. */
+	t38gateway_codec_info_t t38gateway_codec;
+	t38_gateway_state_t *t38;
+	t38_core_state_t *t38_core;
+	udptl_state_t *udptl;
 } t38gateway_session_info_t;
 
 static int tx_packet_handler(t38_core_state_t *s, void *user_data, const uint8_t *buf, int len, int count)
 {
-    t38gateway_session_info_t *t;
+	t38gateway_session_info_t *t;
 
-    t = (t38gateway_session_info_t *) user_data;
-    return 0;
+	t = (t38gateway_session_info_t *) user_data;
+	return 0;
 }
+
 /*- End of function --------------------------------------------------------*/
 
 static int rx_packet_handler(void *user_data, const uint8_t *buf, int len, int seq_no)
 {
-    t38gateway_session_info_t *t;
+	t38gateway_session_info_t *t;
 
-    t = (t38gateway_session_info_t *) user_data;
-    t38_core_rx_ifp_packet(t->t38_core, buf, len, seq_no);
-    return 0;
+	t = (t38gateway_session_info_t *) user_data;
+	t38_core_rx_ifp_packet(t->t38_core, buf, len, seq_no);
+	return 0;
 }
+
 /*- End of function --------------------------------------------------------*/
 
 /*! \brief The callback function that is called when new audio data becomes available 
@@ -98,39 +100,39 @@
  * @param type The switch callback type.
  * @return The success or failure of the function.
  */
-static switch_bool_t t38gateway_callback(switch_media_bug_t * bug, void *user_data, switch_abc_type_t type)
+static switch_bool_t t38gateway_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
 {
-    t38gateway_session_info_t *t38gateway_info;
-    switch_codec_t *read_codec;
-    switch_frame_t *frame;
-    int16_t *amp;
+	t38gateway_session_info_t *t38gateway_info;
+	switch_codec_t *read_codec;
+	switch_frame_t *frame;
+	int16_t *amp;
 
-    t38gateway_info = (t38gateway_session_info_t *) user_data;
-    if (t38gateway_info == NULL) {
-        return SWITCH_FALSE;
-    }
+	t38gateway_info = (t38gateway_session_info_t *) user_data;
+	if (t38gateway_info == NULL) {
+		return SWITCH_FALSE;
+	}
 
-    switch (type) {
-    case SWITCH_ABC_TYPE_INIT:
-        read_codec = switch_core_session_get_read_codec(t38gateway_info->session);
-        t38gateway_info->t38gateway_codec.rate = read_codec->implementation->samples_per_second;
-        t38gateway_info->t38gateway_codec.channels = read_codec->implementation->number_of_channels;
-        break;
-    case SWITCH_ABC_TYPE_READ_PING:
-    case SWITCH_ABC_TYPE_CLOSE:
-        break;
-    case SWITCH_ABC_TYPE_READ:
-        frame = switch_core_media_bug_get_read_replace_frame(bug);
-        amp = (int16_t *) frame->data;
-        t38_gateway_rx(t38gateway_info->t38, amp, frame->samples);
-        break;
-    case SWITCH_ABC_TYPE_WRITE:
-    case SWITCH_ABC_TYPE_READ_REPLACE:
-    case SWITCH_ABC_TYPE_WRITE_REPLACE:
-        break;
-    }
+	switch (type) {
+	case SWITCH_ABC_TYPE_INIT:
+		read_codec = switch_core_session_get_read_codec(t38gateway_info->session);
+		t38gateway_info->t38gateway_codec.rate = read_codec->implementation->samples_per_second;
+		t38gateway_info->t38gateway_codec.channels = read_codec->implementation->number_of_channels;
+		break;
+	case SWITCH_ABC_TYPE_READ_PING:
+	case SWITCH_ABC_TYPE_CLOSE:
+		break;
+	case SWITCH_ABC_TYPE_READ:
+		frame = switch_core_media_bug_get_read_replace_frame(bug);
+		amp = (int16_t *) frame->data;
+		t38_gateway_rx(t38gateway_info->t38, amp, frame->samples);
+		break;
+	case SWITCH_ABC_TYPE_WRITE:
+	case SWITCH_ABC_TYPE_READ_REPLACE:
+	case SWITCH_ABC_TYPE_WRITE_REPLACE:
+		break;
+	}
 
-    return SWITCH_TRUE;
+	return SWITCH_TRUE;
 }
 
 /*! \brief FreeSWITCH module loading function 
@@ -140,19 +142,19 @@
  */
 SWITCH_MODULE_LOAD_FUNCTION(mod_t38gateway_load)
 {
-    switch_application_interface_t *app_interface;
-    switch_api_interface_t *api_interface;
-    /* connect my internal structure to the blank pointer passed to me */
-    *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	switch_application_interface_t *app_interface;
+	switch_api_interface_t *api_interface;
+	/* connect my internal structure to the blank pointer passed to me */
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "T.38 gateway enabled\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "T.38 gateway enabled\n");
 
-    SWITCH_ADD_APP(app_interface, "t38gateway", "T.38 gateway", "T.38 gateway", t38gateway_start_function, "[start] [stop]", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "t38gateway", "T.38 gateway", "T.38 gateway", t38gateway_start_function, "[start] [stop]", SAF_NONE);
 
-    SWITCH_ADD_API(api_interface, "t38gateway", "T.38 gateway", t38gateway_api_main, T38GATEWAY_SYNTAX);
+	SWITCH_ADD_API(api_interface, "t38gateway", "T.38 gateway", t38gateway_api_main, T38GATEWAY_SYNTAX);
 
-    /* indicate that the module should continue to be loaded */
-    return SWITCH_STATUS_SUCCESS;
+	/* indicate that the module should continue to be loaded */
+	return SWITCH_STATUS_SUCCESS;
 }
 
 /*! \brief FreeSWITCH application handler function.
@@ -163,48 +165,48 @@
  */
 SWITCH_STANDARD_APP(t38gateway_start_function)
 {
-    switch_media_bug_t *bug;
-    switch_status_t status;
-    switch_channel_t *channel;
-    t38gateway_session_info_t *t38gateway_info;
+	switch_media_bug_t *bug;
+	switch_status_t status;
+	switch_channel_t *channel;
+	t38gateway_session_info_t *t38gateway_info;
 
-    if (session == NULL)
-        return;
+	if (session == NULL)
+		return;
 
-    channel = switch_core_session_get_channel(session);
+	channel = switch_core_session_get_channel(session);
 
-    /* Is this channel already set? */
-    bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_t38gateway_");
-    /* If yes */
-    if (bug != NULL) {
-        /* If we have a stop remove audio bug */
-        if (strcasecmp(data, "stop") == 0) {
-            switch_channel_set_private(channel, "_t38gateway_", NULL);
-            switch_core_media_bug_remove(session, &bug);
-            return;
-        }
+	/* Is this channel already set? */
+	bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_t38gateway_");
+	/* If yes */
+	if (bug != NULL) {
+		/* If we have a stop remove audio bug */
+		if (strcasecmp(data, "stop") == 0) {
+			switch_channel_set_private(channel, "_t38gateway_", NULL);
+			switch_core_media_bug_remove(session, &bug);
+			return;
+		}
 
-        /* We have already started */
-        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot run 2 at once on the same channel!\n");
+		/* We have already started */
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot run 2 at once on the same channel!\n");
 
-        return;
-    }
+		return;
+	}
 
-    t38gateway_info = (t38gateway_session_info_t *) switch_core_session_alloc(session, sizeof(t38gateway_session_info_t));
+	t38gateway_info = (t38gateway_session_info_t *) switch_core_session_alloc(session, sizeof(t38gateway_session_info_t));
 
-    t38gateway_info->session = session;
-    t38gateway_info->t38 = t38_gateway_init(NULL, tx_packet_handler, (void *) t38gateway_info);
-    t38gateway_info->t38_core = t38_gateway_get_t38_core_state(t38gateway_info->t38);
-    t38gateway_info->udptl = udptl_init(NULL, UDPTL_ERROR_CORRECTION_REDUNDANCY, 3, 3, rx_packet_handler, (void *) t38gateway_info);
+	t38gateway_info->session = session;
+	t38gateway_info->t38 = t38_gateway_init(NULL, tx_packet_handler, (void *) t38gateway_info);
+	t38gateway_info->t38_core = t38_gateway_get_t38_core_state(t38gateway_info->t38);
+	t38gateway_info->udptl = udptl_init(NULL, UDPTL_ERROR_CORRECTION_REDUNDANCY, 3, 3, rx_packet_handler, (void *) t38gateway_info);
 
-    status = switch_core_media_bug_add(session, t38gateway_callback, t38gateway_info, 0, SMBF_READ_STREAM, &bug);
+	status = switch_core_media_bug_add(session, t38gateway_callback, t38gateway_info, 0, SMBF_READ_STREAM, &bug);
 
-    if (status != SWITCH_STATUS_SUCCESS) {
-        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failure hooking to stream\n");
-        return;
-    }
+	if (status != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failure hooking to stream\n");
+		return;
+	}
 
-    switch_channel_set_private(channel, "_t38gateway_", bug);
+	switch_channel_set_private(channel, "_t38gateway_", bug);
 }
 
 /*! \brief Called when the module shuts down
@@ -214,9 +216,9 @@
  */
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_t38gateway_shutdown)
 {
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "T.38 gateway disabled\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "T.38 gateway disabled\n");
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 /*! \brief FreeSWITCH API handler function.
@@ -228,110 +230,110 @@
  */
 SWITCH_STANDARD_API(t38gateway_api_main)
 {
-    switch_core_session_t *t38gateway_session;
-    switch_media_bug_t *bug;
-    t38gateway_session_info_t *t38gateway_info;
-    switch_channel_t *channel;
-    switch_status_t status;
-    int argc;
-    char *argv[T38GATEWAY_PARAMS];
-    char *ccmd;
-    char *uuid;
-    char *command;
+	switch_core_session_t *t38gateway_session;
+	switch_media_bug_t *bug;
+	t38gateway_session_info_t *t38gateway_info;
+	switch_channel_t *channel;
+	switch_status_t status;
+	int argc;
+	char *argv[T38GATEWAY_PARAMS];
+	char *ccmd;
+	char *uuid;
+	char *command;
 
-    /* No command? Display usage */
-    if (cmd == NULL) {
-        stream->write_function(stream, "-USAGE: %s\n", T38GATEWAY_SYNTAX);
-        return SWITCH_STATUS_SUCCESS;
-    }
+	/* No command? Display usage */
+	if (cmd == NULL) {
+		stream->write_function(stream, "-USAGE: %s\n", T38GATEWAY_SYNTAX);
+		return SWITCH_STATUS_SUCCESS;
+	}
 
-    /* Duplicated contents of original string */
-    ccmd = strdup(cmd);
-    /* Separate the arguments */
-    argc = switch_separate_string(ccmd, ' ', argv, T38GATEWAY_PARAMS);
+	/* Duplicated contents of original string */
+	ccmd = strdup(cmd);
+	/* Separate the arguments */
+	argc = switch_separate_string(ccmd, ' ', argv, T38GATEWAY_PARAMS);
 
-    /* If we don't have the expected number of parameters 
-     * display usage */
-    if (argc != T38GATEWAY_PARAMS) {
-        stream->write_function(stream, "-USAGE: %s\n", T38GATEWAY_SYNTAX);
-        switch_safe_free(ccmd);
-        return SWITCH_STATUS_SUCCESS;
-    }
+	/* If we don't have the expected number of parameters 
+	 * display usage */
+	if (argc != T38GATEWAY_PARAMS) {
+		stream->write_function(stream, "-USAGE: %s\n", T38GATEWAY_SYNTAX);
+		switch_safe_free(ccmd);
+		return SWITCH_STATUS_SUCCESS;
+	}
 
-    uuid = argv[0];
-    command = argv[1];
+	uuid = argv[0];
+	command = argv[1];
 
-    /* using uuid locate a reference to the FreeSWITCH session */
-    t38gateway_session = switch_core_session_locate(uuid);
+	/* using uuid locate a reference to the FreeSWITCH session */
+	t38gateway_session = switch_core_session_locate(uuid);
 
-    /* If the session was not found exit */
-    if (t38gateway_session == NULL) {
-        switch_safe_free(ccmd);
-        stream->write_function(stream, "-USAGE: %s\n", T38GATEWAY_SYNTAX);
-        return SWITCH_STATUS_FALSE;
-    }
+	/* If the session was not found exit */
+	if (t38gateway_session == NULL) {
+		switch_safe_free(ccmd);
+		stream->write_function(stream, "-USAGE: %s\n", T38GATEWAY_SYNTAX);
+		return SWITCH_STATUS_FALSE;
+	}
 
-    /* Get current channel of the session to tag the session
-     * This indicates that our module is present */
-    channel = switch_core_session_get_channel(t38gateway_session);
+	/* Get current channel of the session to tag the session
+	 * This indicates that our module is present */
+	channel = switch_core_session_get_channel(t38gateway_session);
 
-    /* Is this channel already set? */
-    bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_t38gateway_");
-    /* If yes */
-    if (bug != NULL) {
-        /* If we have a stop remove audio bug */
-        if (strcasecmp(command, "stop") == 0) {
-            switch_channel_set_private(channel, "_t38gateway_", NULL);
-            switch_core_media_bug_remove(t38gateway_session, &bug);
-            switch_safe_free(ccmd);
-            stream->write_function(stream, "+OK\n");
-            return SWITCH_STATUS_SUCCESS;
-        }
+	/* Is this channel already set? */
+	bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_t38gateway_");
+	/* If yes */
+	if (bug != NULL) {
+		/* If we have a stop remove audio bug */
+		if (strcasecmp(command, "stop") == 0) {
+			switch_channel_set_private(channel, "_t38gateway_", NULL);
+			switch_core_media_bug_remove(t38gateway_session, &bug);
+			switch_safe_free(ccmd);
+			stream->write_function(stream, "+OK\n");
+			return SWITCH_STATUS_SUCCESS;
+		}
 
-        /* We have already started */
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot run 2 at once on the same channel!\n");
+		/* We have already started */
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot run 2 at once on the same channel!\n");
 
-        switch_safe_free(ccmd);
-        return SWITCH_STATUS_FALSE;
-    }
+		switch_safe_free(ccmd);
+		return SWITCH_STATUS_FALSE;
+	}
 
-    /* If we don't see the expected start exit */
-    if (strcasecmp(command, "start") != 0) {
-        switch_safe_free(ccmd);
-        stream->write_function(stream, "-USAGE: %s\n", T38GATEWAY_SYNTAX);
-        return SWITCH_STATUS_FALSE;
-    }
+	/* If we don't see the expected start exit */
+	if (strcasecmp(command, "start") != 0) {
+		switch_safe_free(ccmd);
+		stream->write_function(stream, "-USAGE: %s\n", T38GATEWAY_SYNTAX);
+		return SWITCH_STATUS_FALSE;
+	}
 
-    /* Allocate memory attached to this FreeSWITCH session for
-     * use in the callback routine and to store state information */
-    t38gateway_info = (t38gateway_session_info_t *) switch_core_session_alloc(t38gateway_session, sizeof(t38gateway_session_info_t));
+	/* Allocate memory attached to this FreeSWITCH session for
+	 * use in the callback routine and to store state information */
+	t38gateway_info = (t38gateway_session_info_t *) switch_core_session_alloc(t38gateway_session, sizeof(t38gateway_session_info_t));
 
-    /* Set initial values and states */
-    t38gateway_info->session = t38gateway_session;
-    t38gateway_info->t38 = t38_gateway_init(NULL, tx_packet_handler, (void *) t38gateway_info);
-    t38gateway_info->t38_core = t38_gateway_get_t38_core_state(t38gateway_info->t38);
-    t38gateway_info->udptl = udptl_init(NULL, UDPTL_ERROR_CORRECTION_REDUNDANCY, 3, 3, rx_packet_handler, (void *) t38gateway_info);
+	/* Set initial values and states */
+	t38gateway_info->session = t38gateway_session;
+	t38gateway_info->t38 = t38_gateway_init(NULL, tx_packet_handler, (void *) t38gateway_info);
+	t38gateway_info->t38_core = t38_gateway_get_t38_core_state(t38gateway_info->t38);
+	t38gateway_info->udptl = udptl_init(NULL, UDPTL_ERROR_CORRECTION_REDUNDANCY, 3, 3, rx_packet_handler, (void *) t38gateway_info);
 
-    /* Add a media bug that allows me to intercept the 
-     * reading leg of the audio stream */
-    status = switch_core_media_bug_add(t38gateway_session, t38gateway_callback, t38gateway_info, 0, SMBF_READ_STREAM, &bug);
+	/* Add a media bug that allows me to intercept the 
+	 * reading leg of the audio stream */
+	status = switch_core_media_bug_add(t38gateway_session, t38gateway_callback, t38gateway_info, 0, SMBF_READ_STREAM, &bug);
 
-    /* If adding a media bug fails exit */
-    if (status != SWITCH_STATUS_SUCCESS) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure hooking to stream\n");
+	/* If adding a media bug fails exit */
+	if (status != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failure hooking to stream\n");
 
-        switch_safe_free(ccmd);
-        return SWITCH_STATUS_FALSE;
-    }
+		switch_safe_free(ccmd);
+		return SWITCH_STATUS_FALSE;
+	}
 
-    /* Set the t38gateway tag to detect an existing t38gateway media bug */
-    switch_channel_set_private(channel, "_t38gateway_", bug);
+	/* Set the t38gateway tag to detect an existing t38gateway media bug */
+	switch_channel_set_private(channel, "_t38gateway_", bug);
 
-    /* Everything went according to plan! Notify the user */
-    stream->write_function(stream, "+OK\n");
+	/* Everything went according to plan! Notify the user */
+	stream->write_function(stream, "+OK\n");
 
-    switch_safe_free(ccmd);
-    return SWITCH_STATUS_SUCCESS;
+	switch_safe_free(ccmd);
+	return SWITCH_STATUS_SUCCESS;
 }
 
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_t38gateway/udptl.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_t38gateway/udptl.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_t38gateway/udptl.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -36,561 +36,528 @@
 
 static int decode_length(const uint8_t *buf, int limit, int *len, int *pvalue)
 {
-    if (*len >= limit)
-        return -1;
-    if ((buf[*len] & 0x80) == 0)
-    {
-        *pvalue = buf[(*len)++];
-        return 0;
-    }
-    if ((buf[*len] & 0x40) == 0)
-    {
-        if (*len >= limit - 1)
-            return -1;
-        *pvalue = (buf[(*len)++] & 0x3F) << 8;
-        *pvalue |= buf[(*len)++];
-        return 0;
-    }
-    *pvalue = (buf[(*len)++] & 0x3F) << 14;
-    /* Indicate we have a fragment */
-    return 1;
+	if (*len >= limit)
+		return -1;
+	if ((buf[*len] & 0x80) == 0) {
+		*pvalue = buf[(*len)++];
+		return 0;
+	}
+	if ((buf[*len] & 0x40) == 0) {
+		if (*len >= limit - 1)
+			return -1;
+		*pvalue = (buf[(*len)++] & 0x3F) << 8;
+		*pvalue |= buf[(*len)++];
+		return 0;
+	}
+	*pvalue = (buf[(*len)++] & 0x3F) << 14;
+	/* Indicate we have a fragment */
+	return 1;
 }
+
 /*- End of function --------------------------------------------------------*/
 
-static int decode_open_type(const uint8_t *buf, int limit, int *len, const uint8_t **p_object, int *p_num_octets)
+static int decode_open_type(const uint8_t *buf, int limit, int *len, const uint8_t ** p_object, int *p_num_octets)
 {
-    int octet_cnt;
-    int octet_idx;
-    int stat;
-    int i;
-    const uint8_t **pbuf;
+	int octet_cnt;
+	int octet_idx;
+	int stat;
+	int i;
+	const uint8_t **pbuf;
 
-    for (octet_idx = 0, *p_num_octets = 0;  ;  octet_idx += octet_cnt)
-    {
-        if ((stat = decode_length(buf, limit, len, &octet_cnt)) < 0)
-            return -1;
-        if (octet_cnt > 0)
-        {
-            *p_num_octets += octet_cnt;
+	for (octet_idx = 0, *p_num_octets = 0;; octet_idx += octet_cnt) {
+		if ((stat = decode_length(buf, limit, len, &octet_cnt)) < 0)
+			return -1;
+		if (octet_cnt > 0) {
+			*p_num_octets += octet_cnt;
 
-            pbuf = &p_object[octet_idx];
-            i = 0;
-            /* Make sure the buffer contains at least the number of bits requested */
-            if ((*len + octet_cnt) > limit)
-                return -1;
+			pbuf = &p_object[octet_idx];
+			i = 0;
+			/* Make sure the buffer contains at least the number of bits requested */
+			if ((*len + octet_cnt) > limit)
+				return -1;
 
-            *pbuf = &buf[*len];
-            *len += octet_cnt;
-        }
-        if (stat == 0)
-            break;
-    }
-    return 0;
+			*pbuf = &buf[*len];
+			*len += octet_cnt;
+		}
+		if (stat == 0)
+			break;
+	}
+	return 0;
 }
+
 /*- End of function --------------------------------------------------------*/
 
 static int encode_length(uint8_t *buf, int *len, int value)
 {
-    int multiplier;
+	int multiplier;
 
-    if (value < 0x80)
-    {
-        /* 1 octet */
-        buf[(*len)++] = value;
-        return value;
-    }
-    if (value < 0x4000)
-    {
-        /* 2 octets */
-        /* Set the first bit of the first octet */
-        buf[(*len)++] = ((0x8000 | value) >> 8) & 0xFF;
-        buf[(*len)++] = value & 0xFF;
-        return value;
-    }
-    /* Fragmentation */
-    multiplier = (value < 0x10000)  ?  (value >> 14)  :  4;
-    /* Set the first 2 bits of the octet */
-    buf[(*len)++] = 0xC0 | multiplier;
-    return multiplier << 14;
+	if (value < 0x80) {
+		/* 1 octet */
+		buf[(*len)++] = value;
+		return value;
+	}
+	if (value < 0x4000) {
+		/* 2 octets */
+		/* Set the first bit of the first octet */
+		buf[(*len)++] = ((0x8000 | value) >> 8) & 0xFF;
+		buf[(*len)++] = value & 0xFF;
+		return value;
+	}
+	/* Fragmentation */
+	multiplier = (value < 0x10000) ? (value >> 14) : 4;
+	/* Set the first 2 bits of the octet */
+	buf[(*len)++] = 0xC0 | multiplier;
+	return multiplier << 14;
 }
+
 /*- End of function --------------------------------------------------------*/
 
 static int encode_open_type(uint8_t *buf, int *len, const uint8_t *data, int num_octets)
 {
-    int enclen;
-    int octet_idx;
-    uint8_t zero_byte;
+	int enclen;
+	int octet_idx;
+	uint8_t zero_byte;
 
-    /* If open type is of zero length, add a single zero byte (10.1) */
-    if (num_octets == 0)
-    {
-        zero_byte = 0;
-        data = &zero_byte;
-        num_octets = 1;
-    }
-    /* Encode the open type */
-    for (octet_idx = 0;  ;  num_octets -= enclen, octet_idx += enclen)
-    {
-        if ((enclen = encode_length(buf, len, num_octets)) < 0)
-            return -1;
-        if (enclen > 0)
-        {
-            memcpy(&buf[*len], &data[octet_idx], enclen);
-            *len += enclen;
-        }
-        if (enclen >= num_octets)
-            break;
-    }
+	/* If open type is of zero length, add a single zero byte (10.1) */
+	if (num_octets == 0) {
+		zero_byte = 0;
+		data = &zero_byte;
+		num_octets = 1;
+	}
+	/* Encode the open type */
+	for (octet_idx = 0;; num_octets -= enclen, octet_idx += enclen) {
+		if ((enclen = encode_length(buf, len, num_octets)) < 0)
+			return -1;
+		if (enclen > 0) {
+			memcpy(&buf[*len], &data[octet_idx], enclen);
+			*len += enclen;
+		}
+		if (enclen >= num_octets)
+			break;
+	}
 
-    return 0;
+	return 0;
 }
+
 /*- End of function --------------------------------------------------------*/
 
 int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len)
 {
-    int stat;
-    int stat2;
-    int i;
-    int j;
-    int k;
-    int l;
-    int m;
-    int x;
-    int limit;
-    int which;
-    int ptr;
-    int count;
-    int total_count;
-    int seq_no;
-    const uint8_t *msg;
-    const uint8_t *data;
-    int msg_len;
-    int repaired[16];
-    const uint8_t *bufs[16];
-    int lengths[16];
-    int span;
-    int entries;
+	int stat;
+	int stat2;
+	int i;
+	int j;
+	int k;
+	int l;
+	int m;
+	int x;
+	int limit;
+	int which;
+	int ptr;
+	int count;
+	int total_count;
+	int seq_no;
+	const uint8_t *msg;
+	const uint8_t *data;
+	int msg_len;
+	int repaired[16];
+	const uint8_t *bufs[16];
+	int lengths[16];
+	int span;
+	int entries;
 
-    ptr = 0;
-    /* Decode seq_number */
-    if (ptr + 2 > len)
-        return -1;
-    seq_no = (buf[0] << 8) | buf[1];
-    ptr += 2;
-    /* Break out the primary packet */
-    if ((stat = decode_open_type(buf, len, &ptr, &msg, &msg_len)) != 0)
-        return -1;
-    /* Decode error_recovery */
-    if (ptr + 1 > len)
-        return -1;
-    /* Our buffers cannot tolerate overlength packets */
-    if (msg_len > LOCAL_FAX_MAX_DATAGRAM)
-        return -1;
-    /* Update any missed slots in the buffer */
-    for (i = s->rx_seq_no;  seq_no > i;  i++)
-    {
-        x = i & UDPTL_BUF_MASK;
-        s->rx[x].buf_len = -1;
-        s->rx[x].fec_len[0] = 0;
-        s->rx[x].fec_span = 0;
-        s->rx[x].fec_entries = 0;
-    }
-    /* Save the new packet. Pure redundancy mode won't use this, but some systems will switch
-       into FEC mode after sending some redundant packets. */
-    x = seq_no & UDPTL_BUF_MASK;
-    memcpy(s->rx[x].buf, msg, msg_len);
-    s->rx[x].buf_len = msg_len;
-    s->rx[x].fec_len[0] = 0;
-    s->rx[x].fec_span = 0;
-    s->rx[x].fec_entries = 0;
-    if ((buf[ptr++] & 0x80) == 0)
-    {
-        /* Secondary packet mode for error recovery */
-        /* We might have the packet we want, but we need to check through
-           the redundant stuff, and verify the integrity of the UDPTL.
-           This greatly reduces our chances of accepting garbage. */
-        total_count = 0;
-        do
-        {
-            if ((stat2 = decode_length(buf, len, &ptr, &count)) < 0)
-                return -1;
-            for (i = 0;  i < count;  i++)
-            {
-                if ((stat = decode_open_type(buf, len, &ptr, &bufs[total_count + i], &lengths[total_count + i])) != 0)
-                    return -1;
-            }
-            total_count += count;
-        }
-        while (stat2 > 0);
-        /* We should now be exactly at the end of the packet. If not, this is a fault. */
-        if (ptr != len)
-            return -1;
-        if (seq_no > s->rx_seq_no)
-        {
-            /* We received a later packet than we expected, so we need to check if we can fill in the gap from the
-               secondary packets. */
-            /* Step through in reverse order, so we go oldest to newest */
-            for (i = total_count;  i > 0;  i--)
-            {
-                if (seq_no - i >= s->rx_seq_no)
-                {
-                    /* This one wasn't seen before */
-                    /* Decode the secondary packet */
+	ptr = 0;
+	/* Decode seq_number */
+	if (ptr + 2 > len)
+		return -1;
+	seq_no = (buf[0] << 8) | buf[1];
+	ptr += 2;
+	/* Break out the primary packet */
+	if ((stat = decode_open_type(buf, len, &ptr, &msg, &msg_len)) != 0)
+		return -1;
+	/* Decode error_recovery */
+	if (ptr + 1 > len)
+		return -1;
+	/* Our buffers cannot tolerate overlength packets */
+	if (msg_len > LOCAL_FAX_MAX_DATAGRAM)
+		return -1;
+	/* Update any missed slots in the buffer */
+	for (i = s->rx_seq_no; seq_no > i; i++) {
+		x = i & UDPTL_BUF_MASK;
+		s->rx[x].buf_len = -1;
+		s->rx[x].fec_len[0] = 0;
+		s->rx[x].fec_span = 0;
+		s->rx[x].fec_entries = 0;
+	}
+	/* Save the new packet. Pure redundancy mode won't use this, but some systems will switch
+	   into FEC mode after sending some redundant packets. */
+	x = seq_no & UDPTL_BUF_MASK;
+	memcpy(s->rx[x].buf, msg, msg_len);
+	s->rx[x].buf_len = msg_len;
+	s->rx[x].fec_len[0] = 0;
+	s->rx[x].fec_span = 0;
+	s->rx[x].fec_entries = 0;
+	if ((buf[ptr++] & 0x80) == 0) {
+		/* Secondary packet mode for error recovery */
+		/* We might have the packet we want, but we need to check through
+		   the redundant stuff, and verify the integrity of the UDPTL.
+		   This greatly reduces our chances of accepting garbage. */
+		total_count = 0;
+		do {
+			if ((stat2 = decode_length(buf, len, &ptr, &count)) < 0)
+				return -1;
+			for (i = 0; i < count; i++) {
+				if ((stat = decode_open_type(buf, len, &ptr, &bufs[total_count + i], &lengths[total_count + i])) != 0)
+					return -1;
+			}
+			total_count += count;
+		}
+		while (stat2 > 0);
+		/* We should now be exactly at the end of the packet. If not, this is a fault. */
+		if (ptr != len)
+			return -1;
+		if (seq_no > s->rx_seq_no) {
+			/* We received a later packet than we expected, so we need to check if we can fill in the gap from the
+			   secondary packets. */
+			/* Step through in reverse order, so we go oldest to newest */
+			for (i = total_count; i > 0; i--) {
+				if (seq_no - i >= s->rx_seq_no) {
+					/* This one wasn't seen before */
+					/* Decode the secondary packet */
 #if defined(UDPTL_DEBUG)
-                    fprintf(stderr, "Secondary %d, len %d\n", seq_no - i, lengths[i - 1]);
+					fprintf(stderr, "Secondary %d, len %d\n", seq_no - i, lengths[i - 1]);
 #endif
-                    /* Save the new packet. Redundancy mode won't use this, but some systems will switch into
-                       FEC mode after sending some redundant packets, and this may then be important. */
-                    x = (seq_no - i) & UDPTL_BUF_MASK;
-                    memcpy(s->rx[x].buf, bufs[i - 1], lengths[i - 1]);
-                    s->rx[x].buf_len = lengths[i - 1];
-                    s->rx[x].fec_len[0] = 0;
-                    s->rx[x].fec_span = 0;
-                    s->rx[x].fec_entries = 0;
-                    if (s->rx_packet_handler(s->user_data, bufs[i - 1], lengths[i - 1], seq_no - i) < 0)
-                        fprintf(stderr, "Bad IFP\n");
-                }
-            }
-        }
-    }
-    else
-    {
-        /* FEC mode for error recovery */
+					/* Save the new packet. Redundancy mode won't use this, but some systems will switch into
+					   FEC mode after sending some redundant packets, and this may then be important. */
+					x = (seq_no - i) & UDPTL_BUF_MASK;
+					memcpy(s->rx[x].buf, bufs[i - 1], lengths[i - 1]);
+					s->rx[x].buf_len = lengths[i - 1];
+					s->rx[x].fec_len[0] = 0;
+					s->rx[x].fec_span = 0;
+					s->rx[x].fec_entries = 0;
+					if (s->rx_packet_handler(s->user_data, bufs[i - 1], lengths[i - 1], seq_no - i) < 0)
+						fprintf(stderr, "Bad IFP\n");
+				}
+			}
+		}
+	} else {
+		/* FEC mode for error recovery */
 
-        /* Decode the FEC packets */
-        /* The span is defined as an unconstrained integer, but will never be more
-           than a small value. */
-        if (ptr + 2 > len)
-            return -1;
-        if (buf[ptr++] != 1)
-            return -1;
-        span = buf[ptr++];
+		/* Decode the FEC packets */
+		/* The span is defined as an unconstrained integer, but will never be more
+		   than a small value. */
+		if (ptr + 2 > len)
+			return -1;
+		if (buf[ptr++] != 1)
+			return -1;
+		span = buf[ptr++];
 
-        x = seq_no & UDPTL_BUF_MASK;
+		x = seq_no & UDPTL_BUF_MASK;
 
-        s->rx[x].fec_span = span;
+		s->rx[x].fec_span = span;
 
-        memset(repaired, 0, sizeof(repaired));
-        repaired[x] = TRUE;
+		memset(repaired, 0, sizeof(repaired));
+		repaired[x] = TRUE;
 
-        /* The number of entries is defined as a length, but will only ever be a small
-           value. Treat it as such. */
-        if (ptr + 1 > len)
-            return -1;
-        entries = buf[ptr++];
-        s->rx[x].fec_entries = entries;
+		/* The number of entries is defined as a length, but will only ever be a small
+		   value. Treat it as such. */
+		if (ptr + 1 > len)
+			return -1;
+		entries = buf[ptr++];
+		s->rx[x].fec_entries = entries;
 
-        /* Decode the elements */
-        for (i = 0;  i < entries;  i++)
-        {
-            if ((stat = decode_open_type(buf, len, &ptr, &data, &s->rx[x].fec_len[i])) != 0)
-                return -1;
-            if (s->rx[x].fec_len[i] > LOCAL_FAX_MAX_DATAGRAM)
-                return -1;
+		/* Decode the elements */
+		for (i = 0; i < entries; i++) {
+			if ((stat = decode_open_type(buf, len, &ptr, &data, &s->rx[x].fec_len[i])) != 0)
+				return -1;
+			if (s->rx[x].fec_len[i] > LOCAL_FAX_MAX_DATAGRAM)
+				return -1;
 
-            /* Save the new FEC data */
-            memcpy(s->rx[x].fec[i], data, s->rx[x].fec_len[i]);
+			/* Save the new FEC data */
+			memcpy(s->rx[x].fec[i], data, s->rx[x].fec_len[i]);
 #if 0
-            fprintf(stderr, "FEC: ");
-            for (j = 0;  j < s->rx[x].fec_len[i];  j++)
-                fprintf(stderr, "%02X ", data[j]);
-            fprintf(stderr, "\n");
+			fprintf(stderr, "FEC: ");
+			for (j = 0; j < s->rx[x].fec_len[i]; j++)
+				fprintf(stderr, "%02X ", data[j]);
+			fprintf(stderr, "\n");
 #endif
-        }
-        /* We should now be exactly at the end of the packet. If not, this is a fault. */
-        if (ptr != len)
-            return -1;
-        /* See if we can reconstruct anything which is missing */
-        /* TODO: this does not comprehensively hunt back and repair everything that is possible */
-        for (l = x;  l != ((x - (16 - span*entries)) & UDPTL_BUF_MASK);  l = (l - 1) & UDPTL_BUF_MASK)
-        {
-            if (s->rx[l].fec_len[0] <= 0)
-                continue;
-            for (m = 0;  m < s->rx[l].fec_entries;  m++)
-            {
-                limit = (l + m) & UDPTL_BUF_MASK;
-                for (which = -1, k = (limit - s->rx[l].fec_span*s->rx[l].fec_entries) & UDPTL_BUF_MASK;  k != limit;  k = (k + s->rx[l].fec_entries) & UDPTL_BUF_MASK)
-                {
-                    if (s->rx[k].buf_len <= 0)
-                        which = (which == -1)  ?  k  :  -2;
-                }
-                if (which >= 0)
-                {
-                    /* Repairable */
-                    for (j = 0;  j < s->rx[l].fec_len[m];  j++)
-                    {
-                        s->rx[which].buf[j] = s->rx[l].fec[m][j];
-                        for (k = (limit - s->rx[l].fec_span*s->rx[l].fec_entries) & UDPTL_BUF_MASK;  k != limit;  k = (k + s->rx[l].fec_entries) & UDPTL_BUF_MASK)
-                            s->rx[which].buf[j] ^= (s->rx[k].buf_len > j)  ?  s->rx[k].buf[j]  :  0;
-                    }
-                    s->rx[which].buf_len = s->rx[l].fec_len[m];
-                    repaired[which] = TRUE;
-                }
-            }
-        }
-        /* Now play any new packets forwards in time */
-        for (l = (x + 1) & UDPTL_BUF_MASK, j = seq_no - UDPTL_BUF_MASK;  l != x;  l = (l + 1) & UDPTL_BUF_MASK, j++)
-        {
-            if (repaired[l])
-            {
+		}
+		/* We should now be exactly at the end of the packet. If not, this is a fault. */
+		if (ptr != len)
+			return -1;
+		/* See if we can reconstruct anything which is missing */
+		/* TODO: this does not comprehensively hunt back and repair everything that is possible */
+		for (l = x; l != ((x - (16 - span * entries)) & UDPTL_BUF_MASK); l = (l - 1) & UDPTL_BUF_MASK) {
+			if (s->rx[l].fec_len[0] <= 0)
+				continue;
+			for (m = 0; m < s->rx[l].fec_entries; m++) {
+				limit = (l + m) & UDPTL_BUF_MASK;
+				for (which = -1, k = (limit - s->rx[l].fec_span * s->rx[l].fec_entries) & UDPTL_BUF_MASK; k != limit;
+					 k = (k + s->rx[l].fec_entries) & UDPTL_BUF_MASK) {
+					if (s->rx[k].buf_len <= 0)
+						which = (which == -1) ? k : -2;
+				}
+				if (which >= 0) {
+					/* Repairable */
+					for (j = 0; j < s->rx[l].fec_len[m]; j++) {
+						s->rx[which].buf[j] = s->rx[l].fec[m][j];
+						for (k = (limit - s->rx[l].fec_span * s->rx[l].fec_entries) & UDPTL_BUF_MASK; k != limit;
+							 k = (k + s->rx[l].fec_entries) & UDPTL_BUF_MASK)
+							s->rx[which].buf[j] ^= (s->rx[k].buf_len > j) ? s->rx[k].buf[j] : 0;
+					}
+					s->rx[which].buf_len = s->rx[l].fec_len[m];
+					repaired[which] = TRUE;
+				}
+			}
+		}
+		/* Now play any new packets forwards in time */
+		for (l = (x + 1) & UDPTL_BUF_MASK, j = seq_no - UDPTL_BUF_MASK; l != x; l = (l + 1) & UDPTL_BUF_MASK, j++) {
+			if (repaired[l]) {
 #if defined(UDPTL_DEBUG)
-                fprintf(stderr, "Fixed packet %d, len %d\n", j, l);
+				fprintf(stderr, "Fixed packet %d, len %d\n", j, l);
 #endif
-                if (s->rx_packet_handler(s->user_data, s->rx[l].buf, s->rx[l].buf_len, j) < 0)
-                    fprintf(stderr, "Bad IFP\n");
-            }
-        }
-    }
-    /* If packets are received out of sequence, we may have already processed this packet from the error
-       recovery information in a packet already received. */
-    if (seq_no >= s->rx_seq_no)
-    {
-        /* Decode the primary packet */
+				if (s->rx_packet_handler(s->user_data, s->rx[l].buf, s->rx[l].buf_len, j) < 0)
+					fprintf(stderr, "Bad IFP\n");
+			}
+		}
+	}
+	/* If packets are received out of sequence, we may have already processed this packet from the error
+	   recovery information in a packet already received. */
+	if (seq_no >= s->rx_seq_no) {
+		/* Decode the primary packet */
 #if defined(UDPTL_DEBUG)
-        fprintf(stderr, "Primary packet %d, len %d\n", seq_no, msg_len);
+		fprintf(stderr, "Primary packet %d, len %d\n", seq_no, msg_len);
 #endif
-        if (s->rx_packet_handler(s->user_data, msg, msg_len, seq_no) < 0)
-            fprintf(stderr, "Bad IFP\n");
-    }
+		if (s->rx_packet_handler(s->user_data, msg, msg_len, seq_no) < 0)
+			fprintf(stderr, "Bad IFP\n");
+	}
 
-    s->rx_seq_no = (seq_no + 1) & 0xFFFF;
-    return 0;
+	s->rx_seq_no = (seq_no + 1) & 0xFFFF;
+	return 0;
 }
+
 /*- End of function --------------------------------------------------------*/
 
 int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int msg_len)
 {
-    uint8_t fec[LOCAL_FAX_MAX_DATAGRAM];
-    int i;
-    int j;
-    int seq;
-    int entry;
-    int entries;
-    int span;
-    int m;
-    int len;
-    int limit;
-    int high_tide;
+	uint8_t fec[LOCAL_FAX_MAX_DATAGRAM];
+	int i;
+	int j;
+	int seq;
+	int entry;
+	int entries;
+	int span;
+	int m;
+	int len;
+	int limit;
+	int high_tide;
 
-    /* UDPTL cannot cope with zero length messages, and our buffering for redundancy limits their
-       maximum length. */
-    if (msg_len < 1  ||  msg_len > LOCAL_FAX_MAX_DATAGRAM)
-        return -1;
-    seq = s->tx_seq_no & 0xFFFF;
+	/* UDPTL cannot cope with zero length messages, and our buffering for redundancy limits their
+	   maximum length. */
+	if (msg_len < 1 || msg_len > LOCAL_FAX_MAX_DATAGRAM)
+		return -1;
+	seq = s->tx_seq_no & 0xFFFF;
 
-    /* Map the sequence number to an entry in the circular buffer */
-    entry = seq & UDPTL_BUF_MASK;
+	/* Map the sequence number to an entry in the circular buffer */
+	entry = seq & UDPTL_BUF_MASK;
 
-    /* We save the message in a circular buffer, for generating FEC or
-       redundancy sets later on. */
-    s->tx[entry].buf_len = msg_len;
-    memcpy(s->tx[entry].buf, msg, msg_len);
-    
-    /* Build the UDPTL packet */
+	/* We save the message in a circular buffer, for generating FEC or
+	   redundancy sets later on. */
+	s->tx[entry].buf_len = msg_len;
+	memcpy(s->tx[entry].buf, msg, msg_len);
 
-    len = 0;
-    /* Encode the sequence number */
-    buf[len++] = (seq >> 8) & 0xFF;
-    buf[len++] = seq & 0xFF;
+	/* Build the UDPTL packet */
 
-    /* Encode the primary packet */
-    if (encode_open_type(buf, &len, msg, msg_len) < 0)
-        return -1;
+	len = 0;
+	/* Encode the sequence number */
+	buf[len++] = (seq >> 8) & 0xFF;
+	buf[len++] = seq & 0xFF;
 
-    /* Encode the appropriate type of error recovery information */
-    switch (s->error_correction_scheme)
-    {
-    case UDPTL_ERROR_CORRECTION_NONE:
-        /* Encode the error recovery type */
-        buf[len++] = 0x00;
-        /* The number of entries will always be zero, so it is pointless allowing
-           for the fragmented case here. */
-        if (encode_length(buf, &len, 0) < 0)
-            return -1;
-        break;
-    case UDPTL_ERROR_CORRECTION_REDUNDANCY:
-        /* Encode the error recovery type */
-        buf[len++] = 0x00;
-        if (s->tx_seq_no > s->error_correction_entries)
-            entries = s->error_correction_entries;
-        else
-            entries = s->tx_seq_no;
-        /* The number of entries will always be small, so it is pointless allowing
-           for the fragmented case here. */
-        if (encode_length(buf, &len, entries) < 0)
-            return -1;
-        /* Encode the elements */
-        for (i = 0;  i < entries;  i++)
-        {
-            j = (entry - i - 1) & UDPTL_BUF_MASK;
-            if (encode_open_type(buf, &len, s->tx[j].buf, s->tx[j].buf_len) < 0)
-                return -1;
-        }
-        break;
-    case UDPTL_ERROR_CORRECTION_FEC:
-        span = s->error_correction_span;
-        entries = s->error_correction_entries;
-        if (seq < s->error_correction_span*s->error_correction_entries)
-        {
-            /* In the initial stages, wind up the FEC smoothly */
-            entries = seq/s->error_correction_span;
-            if (seq < s->error_correction_span)
-                span = 0;
-        }
-        /* Encode the error recovery type */
-        buf[len++] = 0x80;
-        /* Span is defined as an inconstrained integer, which it dumb. It will only
-           ever be a small value. Treat it as such. */
-        buf[len++] = 1;
-        buf[len++] = span;
-        /* The number of entries is defined as a length, but will only ever be a small
-           value. Treat it as such. */
-        buf[len++] = entries;
-        for (m = 0;  m < entries;  m++)
-        {
-            /* Make an XOR'ed entry the maximum length */
-            limit = (entry + m) & UDPTL_BUF_MASK;
-            high_tide = 0;
-            for (i = (limit - span*entries) & UDPTL_BUF_MASK;  i != limit;  i = (i + entries) & UDPTL_BUF_MASK)
-            {
-                if (high_tide < s->tx[i].buf_len)
-                {
-                    for (j = 0;  j < high_tide;  j++)
-                        fec[j] ^= s->tx[i].buf[j];
-                    for (  ;  j < s->tx[i].buf_len;  j++)
-                        fec[j] = s->tx[i].buf[j];
-                    high_tide = s->tx[i].buf_len;
-                }
-                else
-                {
-                    for (j = 0;  j < s->tx[i].buf_len;  j++)
-                        fec[j] ^= s->tx[i].buf[j];
-                }
-            }
-            if (encode_open_type(buf, &len, fec, high_tide) < 0)
-                return -1;
-        }
-        break;
-    }
+	/* Encode the primary packet */
+	if (encode_open_type(buf, &len, msg, msg_len) < 0)
+		return -1;
 
-    if (s->verbose)
-        fprintf(stderr, "\n");
-    s->tx_seq_no++;
-    return len;
+	/* Encode the appropriate type of error recovery information */
+	switch (s->error_correction_scheme) {
+	case UDPTL_ERROR_CORRECTION_NONE:
+		/* Encode the error recovery type */
+		buf[len++] = 0x00;
+		/* The number of entries will always be zero, so it is pointless allowing
+		   for the fragmented case here. */
+		if (encode_length(buf, &len, 0) < 0)
+			return -1;
+		break;
+	case UDPTL_ERROR_CORRECTION_REDUNDANCY:
+		/* Encode the error recovery type */
+		buf[len++] = 0x00;
+		if (s->tx_seq_no > s->error_correction_entries)
+			entries = s->error_correction_entries;
+		else
+			entries = s->tx_seq_no;
+		/* The number of entries will always be small, so it is pointless allowing
+		   for the fragmented case here. */
+		if (encode_length(buf, &len, entries) < 0)
+			return -1;
+		/* Encode the elements */
+		for (i = 0; i < entries; i++) {
+			j = (entry - i - 1) & UDPTL_BUF_MASK;
+			if (encode_open_type(buf, &len, s->tx[j].buf, s->tx[j].buf_len) < 0)
+				return -1;
+		}
+		break;
+	case UDPTL_ERROR_CORRECTION_FEC:
+		span = s->error_correction_span;
+		entries = s->error_correction_entries;
+		if (seq < s->error_correction_span * s->error_correction_entries) {
+			/* In the initial stages, wind up the FEC smoothly */
+			entries = seq / s->error_correction_span;
+			if (seq < s->error_correction_span)
+				span = 0;
+		}
+		/* Encode the error recovery type */
+		buf[len++] = 0x80;
+		/* Span is defined as an inconstrained integer, which it dumb. It will only
+		   ever be a small value. Treat it as such. */
+		buf[len++] = 1;
+		buf[len++] = span;
+		/* The number of entries is defined as a length, but will only ever be a small
+		   value. Treat it as such. */
+		buf[len++] = entries;
+		for (m = 0; m < entries; m++) {
+			/* Make an XOR'ed entry the maximum length */
+			limit = (entry + m) & UDPTL_BUF_MASK;
+			high_tide = 0;
+			for (i = (limit - span * entries) & UDPTL_BUF_MASK; i != limit; i = (i + entries) & UDPTL_BUF_MASK) {
+				if (high_tide < s->tx[i].buf_len) {
+					for (j = 0; j < high_tide; j++)
+						fec[j] ^= s->tx[i].buf[j];
+					for (; j < s->tx[i].buf_len; j++)
+						fec[j] = s->tx[i].buf[j];
+					high_tide = s->tx[i].buf_len;
+				} else {
+					for (j = 0; j < s->tx[i].buf_len; j++)
+						fec[j] ^= s->tx[i].buf[j];
+				}
+			}
+			if (encode_open_type(buf, &len, fec, high_tide) < 0)
+				return -1;
+		}
+		break;
+	}
+
+	if (s->verbose)
+		fprintf(stderr, "\n");
+	s->tx_seq_no++;
+	return len;
 }
+
 /*- End of function --------------------------------------------------------*/
 
-int udptl_set_error_correction(udptl_state_t *s,
-                               int ec_scheme,
-                               int span,
-                               int entries)
+int udptl_set_error_correction(udptl_state_t *s, int ec_scheme, int span, int entries)
 {
-    switch (ec_scheme)
-    {
-    case UDPTL_ERROR_CORRECTION_FEC:
-    case UDPTL_ERROR_CORRECTION_REDUNDANCY:
-    case UDPTL_ERROR_CORRECTION_NONE:
-        s->error_correction_scheme = ec_scheme;
-        break;
-    case -1:
-        /* Just don't change the scheme */
-        break;
-    default:
-        return -1;
-    }
-    if (span >= 0)
-        s->error_correction_span = span;
-    if (entries >= 0)
-        s->error_correction_entries = entries;
-    return 0;
+	switch (ec_scheme) {
+	case UDPTL_ERROR_CORRECTION_FEC:
+	case UDPTL_ERROR_CORRECTION_REDUNDANCY:
+	case UDPTL_ERROR_CORRECTION_NONE:
+		s->error_correction_scheme = ec_scheme;
+		break;
+	case -1:
+		/* Just don't change the scheme */
+		break;
+	default:
+		return -1;
+	}
+	if (span >= 0)
+		s->error_correction_span = span;
+	if (entries >= 0)
+		s->error_correction_entries = entries;
+	return 0;
 }
+
 /*- End of function --------------------------------------------------------*/
 
-int udptl_get_error_correction(udptl_state_t *s,
-                               int *ec_scheme,
-                               int *span,
-                               int *entries)
+int udptl_get_error_correction(udptl_state_t *s, int *ec_scheme, int *span, int *entries)
 {
-    if (ec_scheme)
-        *ec_scheme = s->error_correction_scheme;
-    if (span)
-        *span = s->error_correction_span;
-    if (entries)
-        *entries = s->error_correction_entries;
-    return 0;
+	if (ec_scheme)
+		*ec_scheme = s->error_correction_scheme;
+	if (span)
+		*span = s->error_correction_span;
+	if (entries)
+		*entries = s->error_correction_entries;
+	return 0;
 }
+
 /*- End of function --------------------------------------------------------*/
 
 int udptl_set_local_max_datagram(udptl_state_t *s, int max_datagram)
 {
-    s->local_max_datagram_size = max_datagram;
-    return 0;
+	s->local_max_datagram_size = max_datagram;
+	return 0;
 }
+
 /*- End of function --------------------------------------------------------*/
 
 int udptl_get_local_max_datagram(udptl_state_t *s)
 {
-    return s->local_max_datagram_size;
+	return s->local_max_datagram_size;
 }
+
 /*- End of function --------------------------------------------------------*/
 
 int udptl_set_far_max_datagram(udptl_state_t *s, int max_datagram)
 {
-    s->far_max_datagram_size = max_datagram;
-    return 0;
+	s->far_max_datagram_size = max_datagram;
+	return 0;
 }
+
 /*- End of function --------------------------------------------------------*/
 
 int udptl_get_far_max_datagram(udptl_state_t *s)
 {
-    return s->far_max_datagram_size;
+	return s->far_max_datagram_size;
 }
+
 /*- End of function --------------------------------------------------------*/
 
-udptl_state_t *udptl_init(udptl_state_t *s,
-                          int ec_scheme,
-                          int span,
-                          int entries,
-                          udptl_rx_packet_handler_t rx_packet_handler,
-                          void *user_data)
+udptl_state_t *udptl_init(udptl_state_t *s, int ec_scheme, int span, int entries, udptl_rx_packet_handler_t rx_packet_handler, void *user_data)
 {
-    int i;
+	int i;
 
-    if (rx_packet_handler == NULL)
-        return NULL;
+	if (rx_packet_handler == NULL)
+		return NULL;
 
-    if (s == NULL)
-    {
-        if ((s = (udptl_state_t *) malloc(sizeof(*s))) == NULL)
-            return NULL;
-    }
-    memset(s, 0, sizeof(*s));    
-    
-    s->error_correction_scheme = ec_scheme;
-    s->error_correction_span = span;
-    s->error_correction_entries = entries;
-    
-    s->far_max_datagram_size = LOCAL_FAX_MAX_DATAGRAM;
-    s->local_max_datagram_size = LOCAL_FAX_MAX_DATAGRAM;
+	if (s == NULL) {
+		if ((s = (udptl_state_t *) malloc(sizeof(*s))) == NULL)
+			return NULL;
+	}
+	memset(s, 0, sizeof(*s));
 
-    memset(&s->rx, 0, sizeof(s->rx));
-    memset(&s->tx, 0, sizeof(s->tx));
-    for (i = 0;  i <= UDPTL_BUF_MASK;  i++)
-    {
-        s->rx[i].buf_len = -1;
-        s->tx[i].buf_len = -1;
-    }
+	s->error_correction_scheme = ec_scheme;
+	s->error_correction_span = span;
+	s->error_correction_entries = entries;
 
-    s->rx_packet_handler = rx_packet_handler;
-    s->user_data = user_data;
+	s->far_max_datagram_size = LOCAL_FAX_MAX_DATAGRAM;
+	s->local_max_datagram_size = LOCAL_FAX_MAX_DATAGRAM;
 
-    return s;
+	memset(&s->rx, 0, sizeof(s->rx));
+	memset(&s->tx, 0, sizeof(s->tx));
+	for (i = 0; i <= UDPTL_BUF_MASK; i++) {
+		s->rx[i].buf_len = -1;
+		s->tx[i].buf_len = -1;
+	}
+
+	s->rx_packet_handler = rx_packet_handler;
+	s->user_data = user_data;
+
+	return s;
 }
+
 /*- End of function --------------------------------------------------------*/
 
 int udptl_release(udptl_state_t *s)
 {
-    return 0;
+	return 0;
 }
+
 /*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_t38gateway/udptl.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_t38gateway/udptl.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_t38gateway/udptl.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -30,71 +30,66 @@
 
 #define UDPTL_BUF_MASK              15
 
-typedef int (udptl_rx_packet_handler_t)(void *user_data, const uint8_t msg[], int len, int seq_no);
+typedef int (udptl_rx_packet_handler_t) (void *user_data, const uint8_t msg[], int len, int seq_no);
 
-typedef struct
-{
-    int buf_len;
-    uint8_t buf[LOCAL_FAX_MAX_DATAGRAM];
+typedef struct {
+	int buf_len;
+	uint8_t buf[LOCAL_FAX_MAX_DATAGRAM];
 } udptl_fec_tx_buffer_t;
 
-typedef struct
-{
-    int buf_len;
-    uint8_t buf[LOCAL_FAX_MAX_DATAGRAM];
-    int fec_len[LOCAL_FAX_MAX_FEC_PACKETS];
-    uint8_t fec[LOCAL_FAX_MAX_FEC_PACKETS][LOCAL_FAX_MAX_DATAGRAM];
-    int fec_span;
-    int fec_entries;
+typedef struct {
+	int buf_len;
+	uint8_t buf[LOCAL_FAX_MAX_DATAGRAM];
+	int fec_len[LOCAL_FAX_MAX_FEC_PACKETS];
+	uint8_t fec[LOCAL_FAX_MAX_FEC_PACKETS][LOCAL_FAX_MAX_DATAGRAM];
+	int fec_span;
+	int fec_entries;
 } udptl_fec_rx_buffer_t;
 
-struct udptl_state_s
-{
-    udptl_rx_packet_handler_t *rx_packet_handler;
-    void *user_data;
+struct udptl_state_s {
+	udptl_rx_packet_handler_t *rx_packet_handler;
+	void *user_data;
 
-    /*! This option indicates the error correction scheme used in transmitted UDPTL
-        packets. */
-    int error_correction_scheme;
+	/*! This option indicates the error correction scheme used in transmitted UDPTL
+	   packets. */
+	int error_correction_scheme;
 
-    /*! This option indicates the number of error correction entries transmitted in
-        UDPTL packets. */
-    int error_correction_entries;
+	/*! This option indicates the number of error correction entries transmitted in
+	   UDPTL packets. */
+	int error_correction_entries;
 
-    /*! This option indicates the span of the error correction entries in transmitted
-        UDPTL packets (FEC only). */
-    int error_correction_span;
+	/*! This option indicates the span of the error correction entries in transmitted
+	   UDPTL packets (FEC only). */
+	int error_correction_span;
 
-    /*! This option indicates the maximum size of a datagram that can be accepted by
-        the remote device. */
-    int far_max_datagram_size;
+	/*! This option indicates the maximum size of a datagram that can be accepted by
+	   the remote device. */
+	int far_max_datagram_size;
 
-    /*! This option indicates the maximum size of a datagram that we are prepared to
-        accept. */
-    int local_max_datagram_size;
+	/*! This option indicates the maximum size of a datagram that we are prepared to
+	   accept. */
+	int local_max_datagram_size;
 
-    int verbose;
+	int verbose;
 
-    int tx_seq_no;
-    int rx_seq_no;
-    int rx_expected_seq_no;
+	int tx_seq_no;
+	int rx_seq_no;
+	int rx_expected_seq_no;
 
-    udptl_fec_tx_buffer_t tx[UDPTL_BUF_MASK + 1];
-    udptl_fec_rx_buffer_t rx[UDPTL_BUF_MASK + 1];
+	udptl_fec_tx_buffer_t tx[UDPTL_BUF_MASK + 1];
+	udptl_fec_rx_buffer_t rx[UDPTL_BUF_MASK + 1];
 };
 
-enum
-{
-    UDPTL_ERROR_CORRECTION_NONE,
-    UDPTL_ERROR_CORRECTION_FEC,
-    UDPTL_ERROR_CORRECTION_REDUNDANCY
+enum {
+	UDPTL_ERROR_CORRECTION_NONE,
+	UDPTL_ERROR_CORRECTION_FEC,
+	UDPTL_ERROR_CORRECTION_REDUNDANCY
 };
 
 typedef struct udptl_state_s udptl_state_t;
 
 #if defined(__cplusplus)
-extern "C"
-{
+extern "C" {
 #endif
 
 /*! \brief Process an arriving UDPTL packet.
@@ -102,7 +97,7 @@
     \param buf The UDPTL packet buffer.
     \param len The length of the packet.
     \return 0 for OK. */
-int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len);
+	int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len);
 
 /*! \brief Construct a UDPTL packet, ready for transmission.
     \param s The UDPTL context.
@@ -110,7 +105,7 @@
     \param msg The primary packet.
     \param len The length of the primary packet.
     \return The length of the constructed UDPTL packet. */
-int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int msg_len);
+	int udptl_build_packet(udptl_state_t *s, uint8_t buf[], const uint8_t msg[], int msg_len);
 
 /*! \brief Change the error correction settings of a UDPTL context.
     \param s The UDPTL context.
@@ -118,10 +113,7 @@
     \param span The packet span over which error correction should be applied.
     \param entries The number of error correction entries to include in packets.
     \return 0 for OK. */
-int udptl_set_error_correction(udptl_state_t *s,
-                               int ec_scheme,
-                               int span,
-                               int entries);
+	int udptl_set_error_correction(udptl_state_t *s, int ec_scheme, int span, int entries);
 
 /*! \brief Check the error correction settings of a UDPTL context.
     \param s The UDPTL context.
@@ -129,18 +121,15 @@
     \param span The packet span over which error correction is being applied.
     \param entries The number of error correction being included in packets.
     \return 0 for OK. */
-int udptl_get_error_correction(udptl_state_t *s,
-                               int *ec_scheme,
-                               int *span,
-                               int *entries);
+	int udptl_get_error_correction(udptl_state_t *s, int *ec_scheme, int *span, int *entries);
 
-int udptl_set_local_max_datagram(udptl_state_t *s, int max_datagram);
+	int udptl_set_local_max_datagram(udptl_state_t *s, int max_datagram);
 
-int udptl_get_local_max_datagram(udptl_state_t *s);
+	int udptl_get_local_max_datagram(udptl_state_t *s);
 
-int udptl_set_far_max_datagram(udptl_state_t *s, int max_datagram);
+	int udptl_set_far_max_datagram(udptl_state_t *s, int max_datagram);
 
-int udptl_get_far_max_datagram(udptl_state_t *s);
+	int udptl_get_far_max_datagram(udptl_state_t *s);
 
 /*! \brief Initialise a UDPTL context.
     \param s The UDPTL context.
@@ -150,21 +139,15 @@
     \param rx_packet_handler The callback function, used to report arriving IFP packets.
     \param user_data An opaque pointer supplied to rx_packet_handler.
     \return A pointer to the UDPTL context, or NULL if there was a problem. */
-udptl_state_t *udptl_init(udptl_state_t *s,
-                          int ec_scheme,
-                          int span,
-                          int entries,
-                          udptl_rx_packet_handler_t rx_packet_handler,
-                          void *user_data);
+	udptl_state_t *udptl_init(udptl_state_t *s, int ec_scheme, int span, int entries, udptl_rx_packet_handler_t rx_packet_handler, void *user_data);
 
 /*! \brief Release a UDPTL context.
     \param s The UDPTL context.
     \return 0 for OK. */
-int udptl_release(udptl_state_t *s);
+	int udptl_release(udptl_state_t *s);
 
 #if defined(__cplusplus)
 }
 #endif
-
 #endif
 /*- End of file ------------------------------------------------------------*/

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_valet_parking/mod_valet_parking.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_valet_parking/mod_valet_parking.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_valet_parking/mod_valet_parking.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -87,10 +87,11 @@
 	int i, r = 0, m;
 	char buf[128] = "";
 
-	if (!min) min = 1;
+	if (!min)
+		min = 1;
 
 	switch_mutex_lock(globals.mutex);
-	for(i = min ; (i < max || max == 0) ; i++) {
+	for (i = min; (i < max || max == 0); i++) {
 		switch_snprintf(buf, sizeof(buf), "%d", i);
 		m = !!switch_core_hash_find(lot->hash, buf);
 
@@ -131,7 +132,7 @@
 		lot = valet_find_lot(lot_name);
 		switch_assert(lot);
 
-		if (!strcasecmp(ext, "auto")) {		
+		if (!strcasecmp(ext, "auto")) {
 			const char *io = argv[2];
 			const char *min = argv[3];
 			const char *max = argv[4];
@@ -165,7 +166,7 @@
 				switch_mutex_unlock(lot->mutex);
 				return;
 			}
-			
+
 			switch_snprintf(dtmf_buf, sizeof(dtmf_buf), "%d", id);
 			ext = dtmf_buf;
 		} else if (!strcasecmp(ext, "ask")) {
@@ -174,28 +175,28 @@
 			int max = 11;
 			int to = 10000;
 			int i;
-			
+
 			tmp = argv[2] ? argv[2] : switch_channel_get_variable(channel, "valet_ext_min");
 			if (tmp) {
 				if ((i = atoi(tmp)) > 0) {
 					min = i;
 				}
 			}
-			
+
 			tmp = argv[3] ? argv[3] : switch_channel_get_variable(channel, "valet_ext_max");
 			if (tmp) {
 				if ((i = atoi(tmp)) > 0) {
 					max = i;
 				}
 			}
-			
+
 			tmp = argv[4] ? argv[4] : switch_channel_get_variable(channel, "valet_ext_to");
 			if (tmp) {
 				if ((i = atoi(tmp)) > 0) {
 					to = i;
 				}
 			}
-			
+
 			tmp = argv[5] ? argv[5] : switch_channel_get_variable(channel, "valet_ext_prompt");
 			if (tmp) {
 				prompt = tmp;
@@ -211,7 +212,7 @@
 				switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 			}
 		}
-		
+
 		switch_mutex_lock(lot->mutex);
 		if ((uuid = switch_core_hash_find(lot->hash, ext))) {
 			switch_core_session_t *b_session;
@@ -224,7 +225,7 @@
 					switch_channel_event_set_data(switch_core_session_get_channel(b_session), event);
 					switch_event_fire(&event);
 					switch_core_session_rwunlock(b_session);
-					
+
 					switch_ivr_uuid_bridge(switch_core_session_get_uuid(session), uuid);
 					switch_mutex_unlock(lot->mutex);
 					return;
@@ -241,7 +242,7 @@
 
 			if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
 				switch_core_session_t *b_session;
-				
+
 				if ((b_session = switch_core_session_locate(uuid))) {
 					switch_ivr_phrase_macro(session, "valet_announce_ext", tmp, NULL, NULL);
 					switch_ivr_session_transfer(b_session, dest, "inline", NULL);
@@ -254,8 +255,8 @@
 
 			switch_ivr_phrase_macro(session, "valet_announce_ext", tmp, NULL, NULL);
 		}
-		
-			
+
+
 		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, VALET_EVENT) == SWITCH_STATUS_SUCCESS) {
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Valet-Lot-Name", lot_name);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Valet-Extension", ext);
@@ -263,14 +264,15 @@
 			switch_event_fire(&event);
 		}
 
-		
+
 		if (!(tmp = switch_channel_get_variable(channel, "valet_hold_music"))) {
 			tmp = switch_channel_get_variable(channel, "hold_music");
 		}
-		if (tmp) music = tmp;
-		
+		if (tmp)
+			music = tmp;
+
 		switch_core_hash_insert(lot->hash, ext, switch_core_session_get_uuid(session));
-		
+
 		args.input_callback = valet_on_dtmf;
 		args.buf = dbuf;
 		args.buflen = sizeof(dbuf);
@@ -293,7 +295,7 @@
 {
 	switch_hash_index_t *hi;
 	const void *var;
-    void *val;
+	void *val;
 	char *name;
 	valet_lot_t *lot;
 
@@ -310,9 +312,10 @@
 		switch_hash_this(hi, &var, NULL, &val);
 		name = (char *) var;
 		lot = (valet_lot_t *) val;
-		
-		if (!zstr(cmd) && strcasecmp(cmd, name)) continue;
-		
+
+		if (!zstr(cmd) && strcasecmp(cmd, name))
+			continue;
+
 		stream->write_function(stream, "  <lot name=\"%s\">\n", name);
 
 		for (i_hi = switch_hash_first(NULL, lot->hash); i_hi; i_hi = switch_hash_next(i_hi)) {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_vmd/mod_vmd.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_vmd/mod_vmd.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_vmd/mod_vmd.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -47,7 +47,7 @@
 #include <float.h>
 #define ISNAN(x) (!!(_isnan(x)))
 #else
-#define ISNAN(x) ((x)== NAN)
+#define ISNAN(x) (isnan(x))
 #endif
 
 /*! Number of points for beep detection. */
@@ -128,48 +128,50 @@
 
 /*! Type that holds state information about the beep. */
 typedef enum vmd_state {
-    BEEP_DETECTED, BEEP_NOT_DETECTED
+	BEEP_DETECTED, BEEP_NOT_DETECTED
 } vmd_state_t;
 
 /*! Type that holds data for 5 points of discreet energy separation */
 typedef struct vmd_point {
-    double freq;
-    double ampl;
+	double freq;
+	double ampl;
 } vmd_point_t;
 
 /*! Type that holds codec information. */
 typedef struct vmd_codec_info {
-    /*! The sampling rate of the audio stream. */
-    int rate;
-    /*! The number of channels. */
-    int channels;
+	/*! The sampling rate of the audio stream. */
+	int rate;
+	/*! The number of channels. */
+	int channels;
 } vmd_codec_info_t;
 
 /*! Type that holds session information pertinent to the vmd module. */
 typedef struct vmd_session_info {
-    /*! State of the session. */
-    vmd_state_t state;
-    /*! Snapshot of DESA samples. */
-    vmd_point_t points[POINTS];
-    /*! Internal FreeSWITCH session. */
-    switch_core_session_t *session;
-    /*! Codec information for the session. */
-    vmd_codec_info_t vmd_codec;
-    /*! Current position in the snapshot. */
-    unsigned int pos;
-    /*! Frequency aproximation of a detected beep. */
-    double beep_freq;
-    /*! A count of how long a distinct beep was detected
-     *  by the discreet energy separation algorithm. */
-    switch_size_t timestamp;
+	/*! State of the session. */
+	vmd_state_t state;
+	/*! Snapshot of DESA samples. */
+	vmd_point_t points[POINTS];
+	/*! Internal FreeSWITCH session. */
+	switch_core_session_t *session;
+	/*! Codec information for the session. */
+	vmd_codec_info_t vmd_codec;
+	/*! Current position in the snapshot. */
+	unsigned int pos;
+	/*! Frequency aproximation of a detected beep. */
+	double beep_freq;
+	/*! A count of how long a distinct beep was detected
+	 *  by the discreet energy separation algorithm. */
+	switch_size_t timestamp;
+	/*! The MIN_TIME to use for this call */
+	int minTime;
 } vmd_session_info_t;
 
-static switch_bool_t process_data(vmd_session_info_t * vmd_info, switch_frame_t * frame);
-static switch_bool_t vmd_callback(switch_media_bug_t * bug, void *user_data, switch_abc_type_t type);
+static switch_bool_t process_data(vmd_session_info_t *vmd_info, switch_frame_t *frame);
+static switch_bool_t vmd_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type);
 static double freq_estimator(double *x);
 static double ampl_estimator(double *x);
-static void convert_pts(int16_t * i_pts, double *d_pts, int16_t max);
-static void find_beep(vmd_session_info_t * vmd_info, switch_frame_t * frame);
+static void convert_pts(int16_t *i_pts, double *d_pts, int16_t max);
+static void find_beep(vmd_session_info_t *vmd_info, switch_frame_t *frame);
 static double median(double *m, int n);
 
 /*
@@ -185,40 +187,40 @@
  * @param type The switch callback type.
  * @return The success or failure of the function.
  */
-static switch_bool_t vmd_callback(switch_media_bug_t * bug, void *user_data, switch_abc_type_t type)
+static switch_bool_t vmd_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
 {
-    vmd_session_info_t *vmd_info;
-    switch_codec_t *read_codec;
-    switch_frame_t *frame;
+	vmd_session_info_t *vmd_info;
+	switch_codec_t *read_codec;
+	switch_frame_t *frame;
 
-    vmd_info = (vmd_session_info_t *) user_data;
-    if (vmd_info == NULL) {
-        return SWITCH_FALSE;
-    }
+	vmd_info = (vmd_session_info_t *) user_data;
+	if (vmd_info == NULL) {
+		return SWITCH_FALSE;
+	}
 
-    switch (type) {
+	switch (type) {
 
-    case SWITCH_ABC_TYPE_INIT:
-        read_codec = switch_core_session_get_read_codec(vmd_info->session);
-        vmd_info->vmd_codec.rate = read_codec->implementation->samples_per_second;
-        vmd_info->vmd_codec.channels = read_codec->implementation->number_of_channels;
-        break;
+	case SWITCH_ABC_TYPE_INIT:
+		read_codec = switch_core_session_get_read_codec(vmd_info->session);
+		vmd_info->vmd_codec.rate = read_codec->implementation->samples_per_second;
+		vmd_info->vmd_codec.channels = read_codec->implementation->number_of_channels;
+		break;
 
-    case SWITCH_ABC_TYPE_READ_PING:
-    case SWITCH_ABC_TYPE_CLOSE:
-    case SWITCH_ABC_TYPE_READ:
-    case SWITCH_ABC_TYPE_WRITE:
-        break;
+	case SWITCH_ABC_TYPE_READ_PING:
+	case SWITCH_ABC_TYPE_CLOSE:
+	case SWITCH_ABC_TYPE_READ:
+	case SWITCH_ABC_TYPE_WRITE:
+		break;
 
-    case SWITCH_ABC_TYPE_READ_REPLACE:
-        frame = switch_core_media_bug_get_read_replace_frame(bug);
-        return process_data(vmd_info, frame);
+	case SWITCH_ABC_TYPE_READ_REPLACE:
+		frame = switch_core_media_bug_get_read_replace_frame(bug);
+		return process_data(vmd_info, frame);
 
-    case SWITCH_ABC_TYPE_WRITE_REPLACE:
-        break;
-    }
+	case SWITCH_ABC_TYPE_WRITE_REPLACE:
+		break;
+	}
 
-    return SWITCH_TRUE;
+	return SWITCH_TRUE;
 }
 
 /*! \brief Process and convert data to be used by the find_beep() function 
@@ -228,23 +230,23 @@
  * @param frame The audio data.
  * @return The success or failure of the function.
  */
-static switch_bool_t process_data(vmd_session_info_t * vmd_info, switch_frame_t * frame)
+static switch_bool_t process_data(vmd_session_info_t *vmd_info, switch_frame_t *frame)
 {
-    uint32_t i;
-    unsigned int j;
-    double pts[P];
-    int16_t *data;
-    int16_t max;
-    switch_ssize_t len;
+	uint32_t i;
+	unsigned int j;
+	double pts[P];
+	int16_t *data;
+	int16_t max;
+	switch_ssize_t len;
 
-    len = frame->samples * sizeof(int16_t);
-    data = (int16_t *) frame->data;
+	len = frame->samples * sizeof(int16_t);
+	data = (int16_t *) frame->data;
 
-    for (max = (int16_t) abs(data[0]), i = 1; i < frame->samples; i++) {
-        if ((int16_t) abs(data[i]) > max) {
-            max = (int16_t) abs(data[i]);
-        }
-    }
+	for (max = (int16_t) abs(data[0]), i = 1; i < frame->samples; i++) {
+		if ((int16_t) abs(data[i]) > max) {
+			max = (int16_t) abs(data[i]);
+		}
+	}
 
 /*
     if (vmd_info->data_len != len){
@@ -267,16 +269,16 @@
     }
 */
 
-    for (i = 0, j = vmd_info->pos; i < frame->samples; j++, j %= POINTS, i += 5) {
-        /*      convert_pts(vmd_info->data + i, pts); */
-        convert_pts(data + i, pts, max);
-        vmd_info->points[j].freq = TO_HZ(freq_estimator(pts));
-        vmd_info->points[j].ampl = ampl_estimator(pts);
-        vmd_info->pos = j % POINTS;
-        find_beep(vmd_info, frame);
-    }
+	for (i = 0, j = vmd_info->pos; i < frame->samples; j++, j %= POINTS, i += 5) {
+		/*      convert_pts(vmd_info->data + i, pts); */
+		convert_pts(data + i, pts, max);
+		vmd_info->points[j].freq = TO_HZ(freq_estimator(pts));
+		vmd_info->points[j].ampl = ampl_estimator(pts);
+		vmd_info->pos = j % POINTS;
+		find_beep(vmd_info, frame);
+	}
 
-    return SWITCH_TRUE;
+	return SWITCH_TRUE;
 }
 
 /*! \brief Find voicemail beep in the audio stream 
@@ -286,98 +288,96 @@
  * @param frame The audio data.
  * @return The success or failure of the function.
  */
-static void find_beep(vmd_session_info_t * vmd_info, switch_frame_t * frame)
+static void find_beep(vmd_session_info_t *vmd_info, switch_frame_t *frame)
 {
-    int i;
-    int c;
-    double m[POINTS];
-    double med;
-    unsigned int j = (vmd_info->pos + 1) % POINTS;
-    unsigned int k = j;
-    switch_event_t *event;
-    switch_status_t status;
-    switch_event_t *event_copy;
-    switch_channel_t *channel = switch_core_session_get_channel(vmd_info->session);
+	int i;
+	int c;
+	double m[POINTS];
+	double med;
+	unsigned int j = (vmd_info->pos + 1) % POINTS;
+	unsigned int k = j;
+	switch_event_t *event;
+	switch_status_t status;
+	switch_event_t *event_copy;
+	switch_channel_t *channel = switch_core_session_get_channel(vmd_info->session);
 
-    switch (vmd_info->state) {
-    case BEEP_DETECTED:
-        for (c = 0, i = 0; i < POINTS; j++, j %= POINTS, i++) {
-            vmd_info->timestamp++;
-            if (vmd_info->points[j].freq < TOLERANCE_T(vmd_info->beep_freq) &&
-                vmd_info->points[j].freq > TOLERANCE_B(vmd_info->beep_freq)) {
-                c++;
-                vmd_info->beep_freq = (vmd_info->beep_freq * 0.95) + (vmd_info->points[j].freq * 0.05);
-            }
-        }
+	switch (vmd_info->state) {
+	case BEEP_DETECTED:
+		for (c = 0, i = 0; i < POINTS; j++, j %= POINTS, i++) {
+			vmd_info->timestamp++;
+			if (vmd_info->points[j].freq < TOLERANCE_T(vmd_info->beep_freq) && vmd_info->points[j].freq > TOLERANCE_B(vmd_info->beep_freq)) {
+				c++;
+				vmd_info->beep_freq = (vmd_info->beep_freq * 0.95) + (vmd_info->points[j].freq * 0.05);
+			}
+		}
 
-        if (c < (POINTS - MAX_CHIRP)) {
-            vmd_info->state = BEEP_NOT_DETECTED;
-            if (vmd_info->timestamp < MIN_TIME) {
-                break;
-            }
+		if (c < (POINTS - MAX_CHIRP)) {
+			vmd_info->state = BEEP_NOT_DETECTED;
+			if (vmd_info->timestamp < (switch_size_t) vmd_info->minTime) {
+				break;
+			}
 
-            status = switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, VMD_EVENT_BEEP);
-            if (status != SWITCH_STATUS_SUCCESS) {
-                return;
-            }
+			status = switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, VMD_EVENT_BEEP);
+			if (status != SWITCH_STATUS_SUCCESS) {
+				return;
+			}
 
-            switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Beep-Status", "stop");
-            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Beep-Time", "%d", (int) vmd_info->timestamp / POINTS);
-            switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(vmd_info->session));
-            switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Frequency", "%6.4lf", vmd_info->beep_freq);
-            switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "vmd");
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Beep-Status", "stop");
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Beep-Time", "%d", (int) vmd_info->timestamp / POINTS);
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(vmd_info->session));
+			switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Frequency", "%6.4lf", vmd_info->beep_freq);
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "vmd");
 
-            if ((switch_event_dup(&event_copy, event)) != SWITCH_STATUS_SUCCESS) {
-                return;
-            }
+			if ((switch_event_dup(&event_copy, event)) != SWITCH_STATUS_SUCCESS) {
+				return;
+			}
 
-            switch_core_session_queue_event(vmd_info->session, &event);
-            switch_event_fire(&event_copy);
+			switch_core_session_queue_event(vmd_info->session, &event);
+			switch_event_fire(&event_copy);
 
-            switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(vmd_info->session), SWITCH_LOG_INFO, "<<< VMD - Beep Detected >>>\n");
-            switch_channel_set_variable(channel, "vmd_detect", "TRUE");
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(vmd_info->session), SWITCH_LOG_INFO, "<<< VMD - Beep Detected >>>\n");
+			switch_channel_set_variable(channel, "vmd_detect", "TRUE");
 
-            vmd_info->timestamp = 0;
-        }
+			vmd_info->timestamp = 0;
+		}
 
-        break;
+		break;
 
-    case BEEP_NOT_DETECTED:
+	case BEEP_NOT_DETECTED:
 
-        for (i = 0; i < POINTS; k++, k %= POINTS, i++) {
-            m[i] = vmd_info->points[k].freq;
-            if (ISNAN(m[i])) {
-                m[i] = 0.0;
-            }
-        }
+		for (i = 0; i < POINTS; k++, k %= POINTS, i++) {
+			m[i] = vmd_info->points[k].freq;
+			if (ISNAN(m[i])) {
+				m[i] = 0.0;
+			}
+		}
 
-        med = median(m, POINTS);
-        if (ISNAN(med)) {
-            for (i = 0; i < POINTS; i++) {
-                if (!ISNAN(m[i])) {
-                    med = m[i];
-                    break;
-                }
-            }
-        }
+		med = median(m, POINTS);
+		if (ISNAN(med)) {
+			for (i = 0; i < POINTS; i++) {
+				if (!ISNAN(m[i])) {
+					med = m[i];
+					break;
+				}
+			}
+		}
 
-        for (c = 0, i = 0; i < POINTS; j++, j %= POINTS, i++) {
-            if (vmd_info->points[j].freq < TOLERANCE_T(med) && vmd_info->points[j].freq > TOLERANCE_B(med)) {
-                if (vmd_info->points[j].ampl > MIN_AMPL &&
-                    vmd_info->points[j].freq > MIN_FREQ && vmd_info->points[j].freq < MAX_FREQ) {
-                    c++;
-                }
-            }
-        }
+		for (c = 0, i = 0; i < POINTS; j++, j %= POINTS, i++) {
+			if (vmd_info->points[j].freq < TOLERANCE_T(med) && vmd_info->points[j].freq > TOLERANCE_B(med)) {
+				if (vmd_info->points[j].ampl > MIN_AMPL && vmd_info->points[j].freq > MIN_FREQ && vmd_info->points[j].freq < MAX_FREQ) {
+					c++;
+				}
+			}
+		}
 
-        if (c >= VALID) {
-            vmd_info->state = BEEP_DETECTED;
-            vmd_info->beep_freq = med;
-            vmd_info->timestamp = 0;
-        }
+		if (c >= VALID) {
+			vmd_info->state = BEEP_DETECTED;
+			vmd_info->beep_freq = med;
+			vmd_info->timestamp = 0;
+		}
 
-        break;
-    }
+		break;
+	}
 }
 
 /*! \brief Find the median of an array of doubles 
@@ -388,65 +388,65 @@
  */
 static double median(double *m, int n)
 {
-    int i;
-    int less;
-    int greater;
-    int equal;
-    double min;
-    double max;
-    double guess;
-    double maxltguess;
-    double mingtguess;
+	int i;
+	int less;
+	int greater;
+	int equal;
+	double min;
+	double max;
+	double guess;
+	double maxltguess;
+	double mingtguess;
 
-    min = max = m[0];
+	min = max = m[0];
 
-    for (i = 1; i < n; i++) {
-        if (m[i] < min)
-            min = m[i];
-        if (m[i] > max)
-            max = m[i];
-    }
+	for (i = 1; i < n; i++) {
+		if (m[i] < min)
+			min = m[i];
+		if (m[i] > max)
+			max = m[i];
+	}
 
-    for (;;) {
-        guess = (min + max) / 2;
-        less = 0;
-        greater = 0;
-        equal = 0;
-        maxltguess = min;
-        mingtguess = max;
+	for (;;) {
+		guess = (min + max) / 2;
+		less = 0;
+		greater = 0;
+		equal = 0;
+		maxltguess = min;
+		mingtguess = max;
 
-        for (i = 0; i < n; i++) {
-            if (m[i] < guess) {
-                less++;
-                if (m[i] > maxltguess) {
-                    maxltguess = m[i];
-                }
-            } else if (m[i] > guess) {
-                greater++;
-                if (m[i] < mingtguess) {
-                    mingtguess = m[i];
-                }
-            } else {
-                equal++;
-            }
-        }
+		for (i = 0; i < n; i++) {
+			if (m[i] < guess) {
+				less++;
+				if (m[i] > maxltguess) {
+					maxltguess = m[i];
+				}
+			} else if (m[i] > guess) {
+				greater++;
+				if (m[i] < mingtguess) {
+					mingtguess = m[i];
+				}
+			} else {
+				equal++;
+			}
+		}
 
-        if (less <= (n + 1) / 2 && greater <= (n + 1) / 2) {
-            break;
-        } else if (less > greater) {
-            max = maxltguess;
-        } else {
-            min = mingtguess;
-        }
-    }
+		if (less <= (n + 1) / 2 && greater <= (n + 1) / 2) {
+			break;
+		} else if (less > greater) {
+			max = maxltguess;
+		} else {
+			min = mingtguess;
+		}
+	}
 
-    if (less >= (n + 1) / 2) {
-        return maxltguess;
-    } else if (less + equal >= (n + 1) / 2) {
-        return guess;
-    }
+	if (less >= (n + 1) / 2) {
+		return maxltguess;
+	} else if (less + equal >= (n + 1) / 2) {
+		return guess;
+	}
 
-    return mingtguess;
+	return mingtguess;
 }
 
 /*! \brief Convert many points for Signed L16 to relative floating point 
@@ -457,13 +457,13 @@
  * @param max The maximum value in the entire audio frame.
  * @return Nothing.
  */
-static void convert_pts(int16_t * i_pts, double *d_pts, int16_t max)
+static void convert_pts(int16_t *i_pts, double *d_pts, int16_t max)
 {
-    int i;
-    for (i = 0; i < P; i++) {
-        /*! Signed L16 to relative floating point conversion */
-        d_pts[i] = ((((double) (i_pts[i]) + (double) max) / (double) (2 * max)) - 0.5) * 2.0;
-    }
+	int i;
+	for (i = 0; i < P; i++) {
+		/*! Signed L16 to relative floating point conversion */
+		d_pts[i] = ((((double) (i_pts[i]) + (double) max) / (double) (2 * max)) - 0.5) * 2.0;
+	}
 }
 
 /*! \brief Amplitude estimator for DESA-2
@@ -476,12 +476,12 @@
  */
 double ampl_estimator(double *x)
 {
-    double freq_sq;
+	double freq_sq;
 
-    freq_sq = freq_estimator(x);
-    freq_sq *= freq_sq;
+	freq_sq = freq_estimator(x);
+	freq_sq *= freq_sq;
 
-    return sqrt(PSI(x) / sin(freq_sq));
+	return sqrt(PSI(x) / sin(freq_sq));
 }
 
 /*! \brief The DESA-2 algorithm 
@@ -498,12 +498,12 @@
  */
 double freq_estimator(double *x)
 {
-    return 0.5 * acos((((x[2] * x[2]) - (x[0] * x[4]))
-                       - ((x[1] * x[1]) - (x[0] * x[2]))
-                       - ((x[3] * x[3]) - (x[2] * x[4])))
-                      / (2.0 * ((x[2] * x[2]) - (x[1] * x[3])))
+	return 0.5 * acos((((x[2] * x[2]) - (x[0] * x[4]))
+					   - ((x[1] * x[1]) - (x[0] * x[2]))
+					   - ((x[3] * x[3]) - (x[2] * x[4])))
+					  / (2.0 * ((x[2] * x[2]) - (x[1] * x[3])))
 
-        );
+		);
 }
 
 /*! \brief FreeSWITCH module loading function 
@@ -513,19 +513,19 @@
  */
 SWITCH_MODULE_LOAD_FUNCTION(mod_vmd_load)
 {
-    switch_application_interface_t *app_interface;
-    switch_api_interface_t *api_interface;
-    /* connect my internal structure to the blank pointer passed to me */
-    *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	switch_application_interface_t *app_interface;
+	switch_api_interface_t *api_interface;
+	/* connect my internal structure to the blank pointer passed to me */
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Voicemail detection enabled\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Voicemail detection enabled\n");
 
-    SWITCH_ADD_APP(app_interface, "vmd", "Detect beeps", "Detect voicemail beeps", vmd_start_function, "[start] [stop]", SAF_NONE);
+	SWITCH_ADD_APP(app_interface, "vmd", "Detect beeps", "Detect voicemail beeps", vmd_start_function, "[start] [stop]", SAF_NONE);
 
-    SWITCH_ADD_API(api_interface, "vmd", "Detected voicemail beeps", vmd_api_main, VMD_SYNTAX);
+	SWITCH_ADD_API(api_interface, "vmd", "Detected voicemail beeps", vmd_api_main, VMD_SYNTAX);
 
-    /* indicate that the module should continue to be loaded */
-    return SWITCH_STATUS_SUCCESS;
+	/* indicate that the module should continue to be loaded */
+	return SWITCH_STATUS_SUCCESS;
 }
 
 /*! \brief FreeSWITCH application handler function.
@@ -536,58 +536,67 @@
  */
 SWITCH_STANDARD_APP(vmd_start_function)
 {
-    switch_media_bug_t *bug;
-    switch_status_t status;
-    switch_channel_t *channel;
-    vmd_session_info_t *vmd_info;
-    int i;
+	switch_media_bug_t *bug;
+	switch_status_t status;
+	switch_channel_t *channel;
+	vmd_session_info_t *vmd_info;
+	int i;
+	const char *minTimeString;
+	int mintime = 0;
 
-    if (session == NULL)
-        return;
+	if (session == NULL)
+		return;
 
-    channel = switch_core_session_get_channel(session);
+	channel = switch_core_session_get_channel(session);
 
-    /* Is this channel already set? */
-    bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_vmd_");
-    /* If yes */
-    if (bug != NULL) {
-        /* If we have a stop remove audio bug */
-        if (strcasecmp(data, "stop") == 0) {
-            switch_channel_set_private(channel, "_vmd_", NULL);
-            switch_core_media_bug_remove(session, &bug);
-            return;
-        }
+	/* Is this channel already set? */
+	bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_vmd_");
+	/* If yes */
+	if (bug != NULL) {
+		/* If we have a stop remove audio bug */
+		if (strcasecmp(data, "stop") == 0) {
+			switch_channel_set_private(channel, "_vmd_", NULL);
+			switch_core_media_bug_remove(session, &bug);
+			return;
+		}
 
-        /* We have already started */
-        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot run 2 at once on the same channel!\n");
+		/* We have already started */
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot run 2 at once on the same channel!\n");
 
-        return;
-    }
+		return;
+	}
 
-    vmd_info = (vmd_session_info_t *) switch_core_session_alloc(session, sizeof(vmd_session_info_t)
-        );
+	vmd_info = (vmd_session_info_t *) switch_core_session_alloc(session, sizeof(vmd_session_info_t)
+		);
 
-    vmd_info->state = BEEP_NOT_DETECTED;
-    vmd_info->session = session;
-    vmd_info->pos = 0;
-    /*
-       vmd_info->data = NULL;
-       vmd_info->data_len = 0;
-     */
-    for (i = 0; i < POINTS; i++) {
-        vmd_info->points[i].freq = 0.0;
-        vmd_info->points[i].ampl = 0.0;
-    }
+	vmd_info->state = BEEP_NOT_DETECTED;
+	vmd_info->session = session;
+	vmd_info->pos = 0;
+	/*
+	   vmd_info->data = NULL;
+	   vmd_info->data_len = 0;
+	 */
+	for (i = 0; i < POINTS; i++) {
+		vmd_info->points[i].freq = 0.0;
+		vmd_info->points[i].ampl = 0.0;
+	}
 
-    status = switch_core_media_bug_add(session, vmd_callback, vmd_info, 0, SMBF_READ_REPLACE, &bug);
+	status = switch_core_media_bug_add(session, vmd_callback, vmd_info, 0, SMBF_READ_REPLACE, &bug);
 
-    if (status != SWITCH_STATUS_SUCCESS) {
-        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failure hooking to stream\n");
-        return;
-    }
+	if (status != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failure hooking to stream\n");
+		return;
+	}
 
-    switch_channel_set_private(channel, "_vmd_", bug);
+	switch_channel_set_private(channel, "_vmd_", bug);
 
+	if ((minTimeString = switch_channel_get_variable(channel, "vmd_min_time")) && (mintime = atoi(minTimeString))) {
+		vmd_info->minTime = mintime;
+	} else {
+		vmd_info->minTime = MIN_TIME;
+	}
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "MIN_TIME for call: %d\n", vmd_info->minTime);
 }
 
 /*! \brief Called when the module shuts down
@@ -597,9 +606,9 @@
  */
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_vmd_shutdown)
 {
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Voicemail detection disabled\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Voicemail detection disabled\n");
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 /*! \brief FreeSWITCH API handler function.
@@ -611,121 +620,121 @@
  */
 SWITCH_STANDARD_API(vmd_api_main)
 {
-    switch_core_session_t *vmd_session = NULL;
-    switch_media_bug_t *bug;
-    vmd_session_info_t *vmd_info;
-    switch_channel_t *channel;
-    switch_status_t status;
-    int argc;
-    char *argv[VMD_PARAMS];
-    char *ccmd = NULL;
-    char *uuid;
-    char *command;
-    int i;
+	switch_core_session_t *vmd_session = NULL;
+	switch_media_bug_t *bug;
+	vmd_session_info_t *vmd_info;
+	switch_channel_t *channel;
+	switch_status_t status;
+	int argc;
+	char *argv[VMD_PARAMS];
+	char *ccmd = NULL;
+	char *uuid;
+	char *command;
+	int i;
 
-    /* No command? Display usage */
-    if (zstr(cmd)) {
-        stream->write_function(stream, "-USAGE: %s\n", VMD_SYNTAX);
-        return SWITCH_STATUS_SUCCESS;
-    }
+	/* No command? Display usage */
+	if (zstr(cmd)) {
+		stream->write_function(stream, "-USAGE: %s\n", VMD_SYNTAX);
+		return SWITCH_STATUS_SUCCESS;
+	}
 
-    /* Duplicated contents of original string */
-    ccmd = strdup(cmd);
-    /* Separate the arguments */
-    argc = switch_separate_string(ccmd, ' ', argv, VMD_PARAMS);
+	/* Duplicated contents of original string */
+	ccmd = strdup(cmd);
+	/* Separate the arguments */
+	argc = switch_separate_string(ccmd, ' ', argv, VMD_PARAMS);
 
-    /* If we don't have the expected number of parameters 
-     * display usage */
-    if (argc != VMD_PARAMS) {
-        stream->write_function(stream, "-USAGE: %s\n", VMD_SYNTAX);
+	/* If we don't have the expected number of parameters 
+	 * display usage */
+	if (argc != VMD_PARAMS) {
+		stream->write_function(stream, "-USAGE: %s\n", VMD_SYNTAX);
 		goto end;
-    }
+	}
 
-    uuid = argv[0];
-    command = argv[1];
+	uuid = argv[0];
+	command = argv[1];
 
-    /* using uuid locate a reference to the FreeSWITCH session */
-    vmd_session = switch_core_session_locate(uuid);
+	/* using uuid locate a reference to the FreeSWITCH session */
+	vmd_session = switch_core_session_locate(uuid);
 
-    /* If the session was not found exit */
-    if (vmd_session == NULL) {
-        stream->write_function(stream, "-USAGE: %s\n", VMD_SYNTAX);
+	/* If the session was not found exit */
+	if (vmd_session == NULL) {
+		stream->write_function(stream, "-USAGE: %s\n", VMD_SYNTAX);
 		goto end;
-    }
+	}
 
-    /* Get current channel of the session to tag the session
-     * This indicates that our module is present */
-    channel = switch_core_session_get_channel(vmd_session);
+	/* Get current channel of the session to tag the session
+	 * This indicates that our module is present */
+	channel = switch_core_session_get_channel(vmd_session);
 
-    /* Is this channel already set? */
-    bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_vmd_");
-    /* If yes */
-    if (bug != NULL) {
-        /* If we have a stop remove audio bug */
-        if (strcasecmp(command, "stop") == 0) {
-            switch_channel_set_private(channel, "_vmd_", NULL);
-            switch_core_media_bug_remove(vmd_session, &bug);
-            switch_safe_free(ccmd);
-            stream->write_function(stream, "+OK\n");
+	/* Is this channel already set? */
+	bug = (switch_media_bug_t *) switch_channel_get_private(channel, "_vmd_");
+	/* If yes */
+	if (bug != NULL) {
+		/* If we have a stop remove audio bug */
+		if (strcasecmp(command, "stop") == 0) {
+			switch_channel_set_private(channel, "_vmd_", NULL);
+			switch_core_media_bug_remove(vmd_session, &bug);
+			switch_safe_free(ccmd);
+			stream->write_function(stream, "+OK\n");
 			goto end;
-        }
+		}
 
-        /* We have already started */
-        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot run 2 at once on the same channel!\n");
+		/* We have already started */
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot run 2 at once on the same channel!\n");
 		goto end;
-    }
+	}
 
-    /* If we don't see the expected start exit */
-    if (strcasecmp(command, "start") != 0) {
-        stream->write_function(stream, "-USAGE: %s\n", VMD_SYNTAX);
+	/* If we don't see the expected start exit */
+	if (strcasecmp(command, "start") != 0) {
+		stream->write_function(stream, "-USAGE: %s\n", VMD_SYNTAX);
 		goto end;
-    }
+	}
 
-    /* Allocate memory attached to this FreeSWITCH session for
-     * use in the callback routine and to store state information */
-    vmd_info = (vmd_session_info_t *) switch_core_session_alloc(vmd_session, sizeof(vmd_session_info_t)
-        );
+	/* Allocate memory attached to this FreeSWITCH session for
+	 * use in the callback routine and to store state information */
+	vmd_info = (vmd_session_info_t *) switch_core_session_alloc(vmd_session, sizeof(vmd_session_info_t)
+		);
 
-    /* Set initial values and states */
-    vmd_info->state = BEEP_NOT_DETECTED;
-    vmd_info->session = vmd_session;
-    vmd_info->pos = 0;
+	/* Set initial values and states */
+	vmd_info->state = BEEP_NOT_DETECTED;
+	vmd_info->session = vmd_session;
+	vmd_info->pos = 0;
 /*
     vmd_info->data = NULL;
     vmd_info->data_len = 0;
 */
 
-    for (i = 0; i < POINTS; i++) {
-        vmd_info->points[i].freq = 0.0;
-        vmd_info->points[i].ampl = 0.0;
-    }
+	for (i = 0; i < POINTS; i++) {
+		vmd_info->points[i].freq = 0.0;
+		vmd_info->points[i].ampl = 0.0;
+	}
 
-    /* Add a media bug that allows me to intercept the 
-     * reading leg of the audio stream */
-    status = switch_core_media_bug_add(vmd_session, vmd_callback, vmd_info, 0, SMBF_READ_REPLACE, &bug);
+	/* Add a media bug that allows me to intercept the 
+	 * reading leg of the audio stream */
+	status = switch_core_media_bug_add(vmd_session, vmd_callback, vmd_info, 0, SMBF_READ_REPLACE, &bug);
 
-    /* If adding a media bug fails exit */
-    if (status != SWITCH_STATUS_SUCCESS) {
-        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failure hooking to stream\n");
-        goto end;
-    }
+	/* If adding a media bug fails exit */
+	if (status != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failure hooking to stream\n");
+		goto end;
+	}
 
-    /* Set the vmd tag to detect an existing vmd media bug */
-    switch_channel_set_private(channel, "_vmd_", bug);
+	/* Set the vmd tag to detect an existing vmd media bug */
+	switch_channel_set_private(channel, "_vmd_", bug);
 
-    /* Everything went according to plan! Notify the user */
-    stream->write_function(stream, "+OK\n");
+	/* Everything went according to plan! Notify the user */
+	stream->write_function(stream, "+OK\n");
 
 
- end:
+  end:
 
 	if (vmd_session) {
 		switch_core_session_rwunlock(vmd_session);
 	}
 
-    switch_safe_free(ccmd);
+	switch_safe_free(ccmd);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_voicemail/mod_voicemail.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_voicemail/mod_voicemail.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/applications/mod_voicemail/mod_voicemail.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -146,7 +146,7 @@
 	switch_thread_rwlock_t *rwlock;
 	switch_memory_pool_t *pool;
 	uint32_t flags;
-	
+
 	switch_xml_config_item_t config[VM_PROFILE_CONFIGITEM_COUNT];
 	switch_xml_config_string_options_t config_str_pool;
 };
@@ -157,17 +157,19 @@
 {
 	switch_cache_db_connection_options_t options = { {0} };
 	switch_cache_db_handle_t *dbh = NULL;
-	
-	if (profile->odbc_dsn && profile->odbc_user && profile->odbc_pass) {
+
+	if (!zstr(profile->odbc_dsn)) {
 		options.odbc_options.dsn = profile->odbc_dsn;
 		options.odbc_options.user = profile->odbc_user;
 		options.odbc_options.pass = profile->odbc_pass;
 
-		if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_ODBC, &options) != SWITCH_STATUS_SUCCESS) dbh = NULL;
+		if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_ODBC, &options) != SWITCH_STATUS_SUCCESS)
+			dbh = NULL;
 		return dbh;
 	} else {
 		options.core_db_options.db_path = profile->dbname;
-		if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_CORE_DB, &options) != SWITCH_STATUS_SUCCESS) dbh = NULL;
+		if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_CORE_DB, &options) != SWITCH_STATUS_SUCCESS)
+			dbh = NULL;
 		return dbh;
 	}
 }
@@ -190,7 +192,7 @@
 	status = switch_cache_db_execute_sql(dbh, sql, NULL);
 
   end:
-	
+
 	switch_cache_db_release_db_handle(&dbh);
 
 	if (mutex) {
@@ -200,21 +202,22 @@
 	return status;
 }
 
-static switch_bool_t vm_execute_sql_callback(vm_profile_t *profile, switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, void *pdata)
+static switch_bool_t vm_execute_sql_callback(vm_profile_t *profile, switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback,
+											 void *pdata)
 {
 	switch_bool_t ret = SWITCH_FALSE;
 	char *errmsg = NULL;
 	switch_cache_db_handle_t *dbh = NULL;
-	
+
 	if (mutex) {
 		switch_mutex_lock(mutex);
 	}
 
 	if (!(dbh = vm_get_db_handle(profile))) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
-        goto end;
-    }
-	
+		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);
 
 	if (errmsg) {
@@ -245,20 +248,14 @@
 	"   cid_name      VARCHAR(255),\n"
 	"   cid_number    VARCHAR(255),\n"
 	"   in_folder     VARCHAR(255),\n"
-	"   file_path     VARCHAR(255),\n" 
-	"   message_len   INTEGER,\n" 
-	"   flags         VARCHAR(255),\n" 
-	"   read_flags    VARCHAR(255)\n" 
-	");\n";
+	"   file_path     VARCHAR(255),\n"
+	"   message_len   INTEGER,\n" "   flags         VARCHAR(255),\n" "   read_flags    VARCHAR(255),\n" "   forwarded_by  VARCHAR(255)\n" ");\n";
 
 static char vm_pref_sql[] =
 	"CREATE TABLE voicemail_prefs (\n"
 	"   username        VARCHAR(255),\n"
-	"   domain          VARCHAR(255),\n" 
-	"   name_path       VARCHAR(255),\n" 
-	"   greeting_path   VARCHAR(255),\n" 
-	"   password        VARCHAR(255)\n" 
-	");\n";
+	"   domain          VARCHAR(255),\n"
+	"   name_path       VARCHAR(255),\n" "   greeting_path   VARCHAR(255),\n" "   password        VARCHAR(255)\n" ");\n";
 
 static char *vm_index_list[] = {
 	"create index voicemail_msgs_idx1 on voicemail_msgs(created_epoch)",
@@ -267,6 +264,7 @@
 	"create index voicemail_msgs_idx4 on voicemail_msgs(uuid)",
 	"create index voicemail_msgs_idx5 on voicemail_msgs(in_folder)",
 	"create index voicemail_msgs_idx6 on voicemail_msgs(read_flags)",
+	"create index voicemail_msgs_idx7 on voicemail_msgs(forwarded_by)",
 	"create index voicemail_prefs_idx1 on voicemail_prefs(username)",
 	"create index voicemail_prefs_idx2 on voicemail_prefs(domain)",
 	NULL
@@ -278,7 +276,7 @@
 	switch_core_destroy_memory_pool(&profile->pool);
 }
 
-static void destroy_profile(const char *profile_name, switch_bool_t block) 
+static void destroy_profile(const char *profile_name, switch_bool_t block)
 {
 	vm_profile_t *profile = NULL;
 	switch_mutex_lock(globals.mutex);
@@ -293,17 +291,18 @@
 	}
 
 	if (block) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[%s] Waiting for write lock\n", profile->name);	
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[%s] Waiting for write lock\n", profile->name);
 		switch_thread_rwlock_wrlock(profile->rwlock);
 	} else {
 		if (switch_thread_rwlock_trywrlock(profile->rwlock) != SWITCH_STATUS_SUCCESS) {
 			/* Lock failed, set the destroy flag so it'll be destroyed whenever its not in use anymore */
 			switch_set_flag(profile, PFLAG_DESTROY);
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[%s] Profile is in use, memory will be freed whenever its not longer in use\n", profile->name);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[%s] Profile is in use, memory will be freed whenever its no longer in use\n",
+							  profile->name);
 			return;
 		}
 	}
-	
+
 	free_profile(profile);
 }
 
@@ -319,26 +318,26 @@
 static switch_xml_config_int_options_t config_int_ht_0 = { SWITCH_TRUE, 0 };
 
 static switch_xml_config_enum_item_t config_play_date_announcement[] = {
-	{ "first", VM_DATE_FIRST },
-	{ "last", VM_DATE_LAST },
-	{ "never", VM_DATE_NEVER },
-	{ NULL, 0 }
+	{"first", VM_DATE_FIRST},
+	{"last", VM_DATE_LAST},
+	{"never", VM_DATE_NEVER},
+	{NULL, 0}
 };
 
 
-static switch_status_t vm_config_email_callback(switch_xml_config_item_t *item, const char *newvalue, switch_config_callback_type_t callback_type, switch_bool_t changed)
+static switch_status_t vm_config_email_callback(switch_xml_config_item_t *item, const char *newvalue, switch_config_callback_type_t callback_type,
+												switch_bool_t changed)
 {
-	vm_profile_t *profile = (vm_profile_t*)item->data;
-	
+	vm_profile_t *profile = (vm_profile_t *) item->data;
+
 	switch_assert(profile);
-	
-	if (callback_type == CONFIG_LOAD || callback_type == CONFIG_RELOAD)
-	{
+
+	if (callback_type == CONFIG_LOAD || callback_type == CONFIG_RELOAD) {
 		char *email_headers = NULL, *email_body = NULL;
 		if (newvalue) {
 			switch_stream_handle_t stream;
 			SWITCH_STANDARD_STREAM(stream);
-			if (switch_stream_write_file_contents(&stream, newvalue) == SWITCH_STATUS_SUCCESS) {		
+			if (switch_stream_write_file_contents(&stream, newvalue) == SWITCH_STATUS_SUCCESS) {
 				email_headers = switch_core_strdup(profile->pool, stream.data);
 				if ((email_body = strstr(email_headers, "\n\n"))) {
 					*email_body = '\0';
@@ -348,10 +347,10 @@
 					email_body += 4;
 				}
 			}
-			
+
 			free(stream.data);
 		}
-		
+
 		if (email_headers) {
 			profile->email_headers = email_headers;
 		}
@@ -359,23 +358,23 @@
 			profile->email_body = email_body;
 		}
 	}
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t vm_config_notify_callback(switch_xml_config_item_t *item, const char *newvalue, switch_config_callback_type_t callback_type, switch_bool_t changed)
+static switch_status_t vm_config_notify_callback(switch_xml_config_item_t *item, const char *newvalue, switch_config_callback_type_t callback_type,
+												 switch_bool_t changed)
 {
-	vm_profile_t *profile = (vm_profile_t*)item->data;
-	
+	vm_profile_t *profile = (vm_profile_t *) item->data;
+
 	switch_assert(profile);
-		
-	if (callback_type == CONFIG_LOAD || callback_type == CONFIG_RELOAD)
-	{
+
+	if (callback_type == CONFIG_LOAD || callback_type == CONFIG_RELOAD) {
 		char *email_headers = NULL, *email_body = NULL;
 		if (newvalue) {
 			switch_stream_handle_t stream;
 			SWITCH_STANDARD_STREAM(stream);
-			if (switch_stream_write_file_contents(&stream, newvalue) == SWITCH_STATUS_SUCCESS) {		
+			if (switch_stream_write_file_contents(&stream, newvalue) == SWITCH_STATUS_SUCCESS) {
 				email_headers = switch_core_strdup(profile->pool, stream.data);
 				if ((email_body = strstr(email_headers, "\n\n"))) {
 					*email_body = '\0';
@@ -385,10 +384,10 @@
 					email_body += 4;
 				}
 			}
-			
+
 			free(stream.data);
 		}
-		
+
 		if (email_headers) {
 			profile->notify_email_headers = email_headers;
 		}
@@ -396,24 +395,24 @@
 			profile->notify_email_body = email_body;
 		}
 	}
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t vm_config_web_callback(switch_xml_config_item_t *item, const char *newvalue, switch_config_callback_type_t callback_type, switch_bool_t changed)
+static switch_status_t vm_config_web_callback(switch_xml_config_item_t *item, const char *newvalue, switch_config_callback_type_t callback_type,
+											  switch_bool_t changed)
 {
-	vm_profile_t *profile = (vm_profile_t*)item->data;
-	
+	vm_profile_t *profile = (vm_profile_t *) item->data;
+
 	switch_assert(profile);
-		
-	if (callback_type == CONFIG_LOAD || callback_type == CONFIG_RELOAD)
-	{
+
+	if (callback_type == CONFIG_LOAD || callback_type == CONFIG_RELOAD) {
 		char *web_head = NULL, *web_tail = NULL;
 		if (newvalue) {
 			switch_stream_handle_t stream;
 			SWITCH_STANDARD_STREAM(stream);
-			if (switch_stream_write_file_contents(&stream, newvalue) == SWITCH_STATUS_SUCCESS) {		
-				web_head = switch_core_strdup(profile->	pool, stream.data);
+			if (switch_stream_write_file_contents(&stream, newvalue) == SWITCH_STATUS_SUCCESS) {
+				web_head = switch_core_strdup(profile->pool, stream.data);
 
 				if ((web_tail = strstr(web_head, "<!break>\n"))) {
 					*web_tail = '\0';
@@ -423,32 +422,33 @@
 					web_tail += 10;
 				}
 			}
-		
+
 			free(stream.data);
 		}
-		
+
 		if (web_head) {
-			profile->web_head= web_head;
+			profile->web_head = web_head;
 		}
-		
+
 		if (web_tail) {
 			profile->web_tail = web_tail;
 		}
 	}
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t vm_config_validate_samplerate(switch_xml_config_item_t *item, const char *newvalue, switch_config_callback_type_t callback_type, switch_bool_t changed)
+static switch_status_t vm_config_validate_samplerate(switch_xml_config_item_t *item, const char *newvalue, switch_config_callback_type_t callback_type,
+													 switch_bool_t changed)
 {
 	if ((callback_type == CONFIG_LOAD || callback_type == CONFIG_RELOAD) && newvalue) {
-		int val = *(int*)item->ptr;
+		int val = *(int *) item->ptr;
 		if (val != 0 && !switch_is_valid_rate(val)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid samplerate %s\n", newvalue);
 			return SWITCH_STATUS_FALSE;
 		}
 	}
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -458,159 +458,153 @@
 vm_profile_t *profile_set_config(vm_profile_t *profile)
 {
 	int i = 0;
-	
+
 	profile->config_str_pool.pool = profile->pool;
 
 	/*
-	SWITCH _CONFIG_SET_ITEM(item, "key", type, flags, 
-		pointer, default, options, help_syntax, help_description)
-	*/
-	
-	/* DTMFs */	
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "terminator-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->terminator_key, "#", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "play-new-messages-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->play_new_messages_key, "1", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "play-saved-messages-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->play_saved_messages_key, "2", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "login-keys", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->login_keys, "0", &config_login_keys, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "main-menu-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->main_menu_key, "0", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "skip-greet-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->skip_greet_key, "#", &config_dtmf, NULL, NULL);		
+	   SWITCH _CONFIG_SET_ITEM(item, "key", type, flags, 
+	   pointer, default, options, help_syntax, help_description)
+	 */
+
+	/* DTMFs */
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "terminator-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->terminator_key, "#", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "play-new-messages-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->play_new_messages_key, "1", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "play-saved-messages-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->play_saved_messages_key, "2", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "login-keys", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->login_keys, "0", &config_login_keys, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "main-menu-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->main_menu_key, "0", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "skip-greet-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->skip_greet_key, "#", &config_dtmf, NULL, NULL);
 	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "skip-info-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
-		&profile->skip_info_key, "", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "config-menu-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->config_menu_key, "5", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-greeting-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->record_greeting_key, "1", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "choose-greeting-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->choose_greeting_key, "2", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-name-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->record_name_key, "3", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "change-pass-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->change_pass_key, "6", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-file-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->record_file_key, "3", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "listen-file-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->listen_file_key, "1", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "save-file-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->save_file_key, "2", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "delete-file-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->delete_file_key, "7", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "undelete-file-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->undelete_file_key, "8", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "email-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->email_key, "4", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "callback-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->callback_key, "5", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "pause-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->pause_key, "0", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "restart-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->restart_key, "1", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "ff-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->ff_key, "6", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "rew-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->rew_key, "4", &config_dtmf, NULL, NULL);
-        SWITCH_CONFIG_SET_ITEM(profile->config[i++], "previous-message-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
-                &profile->prev_msg_key, "", &config_dtmf, NULL, NULL);
-        SWITCH_CONFIG_SET_ITEM(profile->config[i++], "next-message-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
-                &profile->next_msg_key, "", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "urgent-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->urgent_key, "*", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "operator-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->operator_key, "", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "vmain-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->vmain_key, "", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "vmain-extension", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->vmain_ext, "", &profile->config_str_pool, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "forward-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->forward_key, "8", &config_dtmf, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "prepend-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->prepend_key, "1", &config_dtmf, NULL, NULL);
+						   &profile->skip_info_key, "", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "config-menu-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->config_menu_key, "5", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-greeting-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->record_greeting_key, "1", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "choose-greeting-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->choose_greeting_key, "2", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-name-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->record_name_key, "3", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "change-pass-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->change_pass_key, "6", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-file-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->record_file_key, "3", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "listen-file-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->listen_file_key, "1", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "save-file-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->save_file_key, "2", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "delete-file-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->delete_file_key, "7", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "undelete-file-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->undelete_file_key, "8", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "email-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->email_key, "4", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "callback-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->callback_key, "5", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "pause-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->pause_key, "0", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "restart-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->restart_key, "1", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "ff-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->ff_key, "6", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "rew-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->rew_key, "4", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "previous-message-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->prev_msg_key, "", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "next-message-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->next_msg_key, "", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "urgent-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->urgent_key, "*", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "operator-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->operator_key, "", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "vmain-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, &profile->vmain_key, "", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "vmain-extension", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->vmain_ext, "", &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "forward-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->forward_key, "8", &config_dtmf, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "prepend-key", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->prepend_key, "1", &config_dtmf, NULL, NULL);
 
 	/* Other settings */
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "file-extension", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->file_ext, "wav", &config_file_ext, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-title", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->record_title, "FreeSWITCH Voicemail", &profile->config_str_pool, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-comment", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->record_comment, "FreeSWITCH Voicemail", &profile->config_str_pool, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-copyright", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->record_copyright, "http://www.freeswitch.org", &profile->config_str_pool, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "operator-extension", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->operator_ext, "", &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "file-extension", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->file_ext, "wav", &config_file_ext, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-title", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->record_title, "FreeSWITCH Voicemail", &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-comment", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->record_comment, "FreeSWITCH Voicemail", &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-copyright", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->record_copyright, "http://www.freeswitch.org", &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "operator-extension", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->operator_ext, "", &profile->config_str_pool, NULL, NULL);
 
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "tone-spec", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->tone_spec, "%(1000, 0, 640)", &profile->config_str_pool, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "storage-dir", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->storage_dir, "", &profile->config_str_pool, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "callback-dialplan", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->callback_dialplan, "XML", &profile->config_str_pool, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "callback-context", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->callback_context, "default", &profile->config_str_pool, NULL, NULL);
-		
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "notify-email-body", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->notify_email_body, NULL, &profile->config_str_pool, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "notify-email-headers", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->notify_email_headers, NULL, &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "tone-spec", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->tone_spec, "%(1000, 0, 640)", &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "storage-dir", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->storage_dir, "", &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "callback-dialplan", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->callback_dialplan, "XML", &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "callback-context", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->callback_context, "default", &profile->config_str_pool, NULL, NULL);
 
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "play-date-announcement", SWITCH_CONFIG_ENUM, CONFIG_RELOADABLE, 
-		&profile->play_date_announcement, VM_DATE_FIRST, &config_play_date_announcement, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "notify-email-body", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->notify_email_body, NULL, &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "notify-email-headers", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->notify_email_headers, NULL, &profile->config_str_pool, NULL, NULL);
 
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "convert-cmd", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "play-date-announcement", SWITCH_CONFIG_ENUM, CONFIG_RELOADABLE,
+						   &profile->play_date_announcement, VM_DATE_FIRST, &config_play_date_announcement, NULL, NULL);
+
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "convert-cmd", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
 						   &profile->convert_cmd, NULL, &profile->config_str_pool, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "convert-ext", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "convert-ext", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
 						   &profile->convert_ext, NULL, &profile->config_str_pool, NULL, NULL);
 
-	
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "digit-timeout", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, 
-		&profile->digit_timeout, 10000, &config_int_digit_timeout, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "max-login-attempts", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, 
-		&profile->max_login_attempts, 3, &config_int_max_logins, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "min-record-len", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, 
-		&profile->min_record_len, 3, &config_int_0_10000, "seconds", NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "max-record-len", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, 
-		&profile->max_record_len, 300, &config_int_0_1000, "seconds", NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "max-retries", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, 
-		&profile->max_retries, 3, &config_int_ht_0, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-silence-threshold", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, 
-		&profile->record_threshold, 200, &config_int_0_10000, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-silence-hits", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, 
-		&profile->record_silence_hits, 2, &config_int_0_1000, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM_CALLBACK(profile->config[i++], "record-sample-rate", SWITCH_CONFIG_INT, CONFIG_RELOADABLE, 
-		&profile->record_sample_rate, 0, NULL, vm_config_validate_samplerate, NULL, NULL);
 
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "email_headers", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->email_headers, NULL, &profile->config_str_pool, NULL, NULL);	
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "email_body", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->email_body, NULL, &profile->config_str_pool, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "email_email-from", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->email_from, NULL, &profile->config_str_pool, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "email_date-fmt", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE, 
-		&profile->date_fmt, "%A, %B %d %Y, %I %M %p", &profile->config_str_pool, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "odbc-dsn", SWITCH_CONFIG_STRING, 0,
-		&profile->odbc_dsn, NULL, &profile->config_str_pool, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM_CALLBACK(profile->config[i++], "email_template-file", SWITCH_CONFIG_CUSTOM, CONFIG_RELOADABLE, 
-		NULL, NULL, profile, vm_config_email_callback, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM_CALLBACK(profile->config[i++], "email_notify-template-file", SWITCH_CONFIG_CUSTOM, CONFIG_RELOADABLE, 
-		NULL, NULL, profile, vm_config_notify_callback, NULL, NULL);
-	SWITCH_CONFIG_SET_ITEM_CALLBACK(profile->config[i++], "web-template-file", SWITCH_CONFIG_CUSTOM, CONFIG_RELOADABLE, 
-		NULL, NULL, profile, vm_config_web_callback, NULL, NULL);
-		
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "digit-timeout", SWITCH_CONFIG_INT, CONFIG_RELOADABLE,
+						   &profile->digit_timeout, 10000, &config_int_digit_timeout, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "max-login-attempts", SWITCH_CONFIG_INT, CONFIG_RELOADABLE,
+						   &profile->max_login_attempts, 3, &config_int_max_logins, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "min-record-len", SWITCH_CONFIG_INT, CONFIG_RELOADABLE,
+						   &profile->min_record_len, 3, &config_int_0_10000, "seconds", NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "max-record-len", SWITCH_CONFIG_INT, CONFIG_RELOADABLE,
+						   &profile->max_record_len, 300, &config_int_0_1000, "seconds", NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "max-retries", SWITCH_CONFIG_INT, CONFIG_RELOADABLE,
+						   &profile->max_retries, 3, &config_int_ht_0, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-silence-threshold", SWITCH_CONFIG_INT, CONFIG_RELOADABLE,
+						   &profile->record_threshold, 200, &config_int_0_10000, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "record-silence-hits", SWITCH_CONFIG_INT, CONFIG_RELOADABLE,
+						   &profile->record_silence_hits, 2, &config_int_0_1000, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM_CALLBACK(profile->config[i++], "record-sample-rate", SWITCH_CONFIG_INT, CONFIG_RELOADABLE,
+									&profile->record_sample_rate, 0, NULL, vm_config_validate_samplerate, NULL, NULL);
+
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "email_headers", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->email_headers, NULL, &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "email_body", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->email_body, NULL, &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "email_email-from", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->email_from, NULL, &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "email_date-fmt", SWITCH_CONFIG_STRING, CONFIG_RELOADABLE,
+						   &profile->date_fmt, "%A, %B %d %Y, %I %M %p", &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM(profile->config[i++], "odbc-dsn", SWITCH_CONFIG_STRING, 0, &profile->odbc_dsn, NULL, &profile->config_str_pool, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM_CALLBACK(profile->config[i++], "email_template-file", SWITCH_CONFIG_CUSTOM, CONFIG_RELOADABLE,
+									NULL, NULL, profile, vm_config_email_callback, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM_CALLBACK(profile->config[i++], "email_notify-template-file", SWITCH_CONFIG_CUSTOM, CONFIG_RELOADABLE,
+									NULL, NULL, profile, vm_config_notify_callback, NULL, NULL);
+	SWITCH_CONFIG_SET_ITEM_CALLBACK(profile->config[i++], "web-template-file", SWITCH_CONFIG_CUSTOM, CONFIG_RELOADABLE,
+									NULL, NULL, profile, vm_config_web_callback, NULL, NULL);
+
 	switch_assert(i < VM_PROFILE_CONFIGITEM_COUNT);
-	
+
 	return profile;
 
 }
 
-static vm_profile_t * load_profile(const char *profile_name)
+static vm_profile_t *load_profile(const char *profile_name)
 {
 	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;
+	switch_cache_db_handle_t *dbh = NULL;
 
 	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);
@@ -650,26 +644,25 @@
 			if ((param = switch_xml_child(x_email, "headers"))) {
 				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "email_headers", param->txt);
 			}
-			
+
 			for (param = switch_xml_child(x_email, "param"); param; param = param->next) {
 				char *var, *val;
 				char buf[2048];
-				
-				if ((var = (char *) switch_xml_attr_soft(param, "name")) && 
-					(val = (char *) switch_xml_attr_soft(param, "value"))) {
+
+				if ((var = (char *) switch_xml_attr_soft(param, "name")) && (val = (char *) switch_xml_attr_soft(param, "value"))) {
 					switch_snprintf(buf, 2048, "email_%s", var);
-					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, buf, val);					
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, buf, val);
 				}
 			}
 		}
 
-		
+
 		if (switch_xml_config_parse_event(event, count, SWITCH_FALSE, profile->config) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to process configuration\n");
 			switch_core_destroy_memory_pool(&pool);
 			goto end;
 		}
-		
+
 		switch_thread_rwlock_create(&profile->rwlock, pool);
 		profile->name = switch_core_strdup(pool, profile_name);
 
@@ -688,11 +681,14 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot open DB!\n");
 			goto end;
 		}
-		
-		switch_cache_db_test_reactive(dbh, "select count(message_len) from voicemail_msgs", "drop table voicemail_msgs", vm_sql);
+
+		switch_cache_db_test_reactive(dbh, "select count(forwarded_by) from voicemail_msgs", NULL,
+									  "alter table voicemail_msgs add forwarded_by varchar(255)");
+		switch_cache_db_test_reactive(dbh, "select count(forwarded_by) from voicemail_msgs", "drop table voicemail_msgs", vm_sql);
+
 		switch_cache_db_test_reactive(dbh, "select count(username) from voicemail_prefs", "drop table voicemail_prefs", vm_pref_sql);
 		switch_cache_db_test_reactive(dbh, "select count(password) from voicemail_prefs", NULL, "alter table voicemail_prefs add password varchar(255)");
-		
+
 		for (x = 0; vm_index_list[x]; x++) {
 			errmsg = NULL;
 			switch_cache_db_execute_sql(dbh, vm_index_list[x], &errmsg);
@@ -707,7 +703,9 @@
 	}
 
   end:
+
 	switch_cache_db_release_db_handle(&dbh);
+
 	if (xml) {
 		switch_xml_free(xml);
 	}
@@ -718,17 +716,17 @@
 }
 
 
-static vm_profile_t * get_profile(const char *profile_name) 
+static vm_profile_t *get_profile(const char *profile_name)
 {
 	vm_profile_t *profile = NULL;
 
 	switch_mutex_lock(globals.mutex);
 	if (!(profile = switch_core_hash_find(globals.profile_hash, profile_name))) {
-    	profile = load_profile(profile_name);
+		profile = load_profile(profile_name);
 	}
 	if (profile) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[%s] rwlock\n", profile->name);
-		
+
 		switch_thread_rwlock_rdlock(profile->rwlock);
 	}
 	switch_mutex_unlock(globals.mutex);
@@ -888,7 +886,7 @@
 	switch_copy_string(cbt->name_path, argv[2], sizeof(cbt->name_path));
 	switch_copy_string(cbt->greeting_path, argv[3], sizeof(cbt->greeting_path));
 	switch_copy_string(cbt->password, argv[4], sizeof(cbt->password));
-	
+
 	return 0;
 }
 
@@ -1005,16 +1003,16 @@
 static int message_count_callback(void *pArg, int argc, char **argv, char **columnNames)
 {
 	msg_cnt_callback_t *cbt = (msg_cnt_callback_t *) pArg;
-	if (atoi(argv[0]) == 1) { /* UnRead */
-		if (!strcasecmp(argv[1], "A_URGENT")) { /* Urgent */
+	if (atoi(argv[0]) == 1) {	/* UnRead */
+		if (!strcasecmp(argv[1], "A_URGENT")) {	/* Urgent */
 			cbt->total_new_urgent_messages = atoi(argv[2]);
-		} else { /* Normal */
+		} else {				/* Normal */
 			cbt->total_new_messages = atoi(argv[2]);
 		}
-	} else { /* Already Read */
-		if (!strcasecmp(argv[1], "A_URGENT")) { /* Urgent */
+	} else {					/* Already Read */
+		if (!strcasecmp(argv[1], "A_URGENT")) {	/* Urgent */
 			cbt->total_saved_urgent_messages = atoi(argv[2]);
-		} else { /* Normal */
+		} else {				/* Normal */
 			cbt->total_saved_messages = atoi(argv[2]);
 		}
 	}
@@ -1052,16 +1050,12 @@
 
 switch_status_t measure_file_len(const char *path, switch_size_t *message_len)
 {
-	
+
 	switch_file_handle_t fh = { 0 };
 	uint32_t pos = 0;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
-	if (switch_core_file_open(&fh,
-							  path,
-							  0,
-							  0,
-							  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) == SWITCH_STATUS_SUCCESS) {
+	if (switch_core_file_open(&fh, path, 0, 0, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) == SWITCH_STATUS_SUCCESS) {
 
 		if (switch_core_file_seek(&fh, &pos, 0, SEEK_END) == SWITCH_STATUS_SUCCESS) {
 			*message_len = pos / fh.samplerate;
@@ -1069,7 +1063,7 @@
 		}
 		switch_core_file_close(&fh);
 	}
-	
+
 	return status;
 
 }
@@ -1085,10 +1079,10 @@
 	char term;
 	char input[10] = "", key_buf[80] = "";
 	cc_t cc = { 0 };
-	switch_codec_implementation_t read_impl = {0};
+	switch_codec_implementation_t read_impl = { 0 };
 	int got_file = 0;
 
-    switch_core_session_get_read_impl(session, &read_impl);
+	switch_core_session_get_read_impl(session, &read_impl);
 
 
 	if (exit_keys) {
@@ -1102,7 +1096,8 @@
 	  record_file:
 		*message_len = 0;
 
-		if (macro_name) TRY_CODE(switch_ivr_phrase_macro(session, macro_name, NULL, NULL, NULL));
+		if (macro_name)
+			TRY_CODE(switch_ivr_phrase_macro(session, macro_name, NULL, NULL, NULL));
 		switch_channel_flush_dtmf(channel);
 		TRY_CODE(switch_ivr_gentones(session, profile->tone_spec, 0, NULL));
 
@@ -1146,7 +1141,7 @@
 		}
 
 		if (profile->auto_playback_recordings) {
-		play_file:
+		  play_file:
 			memset(&fh, 0, sizeof(fh));
 			args.input_callback = control_playback;
 			memset(&cc, 0, sizeof(cc));
@@ -1164,7 +1159,7 @@
 				status = SWITCH_STATUS_SUCCESS;
 				*cc.buf = '\0';
 			} else {
-				(void)vm_macro_get(session, VM_RECORD_FILE_CHECK_MACRO, key_buf, input, sizeof(input), 1, "", &term, profile->digit_timeout);
+				(void) vm_macro_get(session, VM_RECORD_FILE_CHECK_MACRO, key_buf, input, sizeof(input), 1, "", &term, profile->digit_timeout);
 			}
 
 			if (!strcmp(input, profile->listen_file_key)) {
@@ -1172,7 +1167,7 @@
 			} else if (!strcmp(input, profile->record_file_key)) {
 				goto record_file;
 			} else {
-				(void)switch_ivr_phrase_macro(session, VM_ACK_MACRO, "saved", NULL, NULL);
+				(void) switch_ivr_phrase_macro(session, VM_ACK_MACRO, "saved", NULL, NULL);
 				goto end;
 			}
 		}
@@ -1201,11 +1196,12 @@
 	char message_len[255];
 	char flags[255];
 	char read_flags[255];
+	char forwarded_by[255];
 	char *email;
 	int index;
 	int want;
 	msg_type_t type;
-	msg_move_t move; 
+	msg_move_t move;
 	char *convert_cmd;
 	char *convert_ext;
 };
@@ -1231,6 +1227,7 @@
 	switch_copy_string(cbt->message_len, argv[9], 255);
 	switch_copy_string(cbt->flags, argv[10], 255);
 	switch_copy_string(cbt->read_flags, argv[11], 255);
+	switch_copy_string(cbt->forwarded_by, argv[12], 255);
 
 	return -1;
 }
@@ -1244,18 +1241,17 @@
 	switch_event_create(&params, SWITCH_EVENT_GENERAL);
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "action", action);
 
-	if (switch_xml_locate_user("id", myid, domain_name, NULL,
-							   &xx_domain_root, &xx_domain, &xx_user, NULL, params) == SWITCH_STATUS_SUCCESS) {
+	if (switch_xml_locate_user("id", myid, domain_name, NULL, &xx_domain_root, &xx_domain, &xx_user, NULL, params) == SWITCH_STATUS_SUCCESS) {
 		ret = strdup(switch_xml_attr(xx_user, "id"));
 		switch_xml_free(xx_domain_root);
 	}
-	
+
 	switch_event_destroy(&params);
 	return ret;
 }
 
-static void message_count(vm_profile_t *profile, const char *id_in, const char *domain_name, const char *myfolder, int *total_new_messages, 
-		int *total_saved_messages, int *total_new_urgent_messages, int *total_saved_urgent_messages)
+static void message_count(vm_profile_t *profile, const char *id_in, const char *domain_name, const char *myfolder, int *total_new_messages,
+						  int *total_saved_messages, int *total_new_urgent_messages, int *total_saved_urgent_messages)
 {
 	char msg_count[80] = "";
 	msg_cnt_callback_t cbt = { 0 };
@@ -1275,7 +1271,7 @@
 
 	switch_snprintf(sql, sizeof(sql),
 					"select read_epoch=0, read_flags, count(read_epoch) from voicemail_msgs where username='%s' and domain='%s' and in_folder='%s' group by read_epoch=0,read_flags;",
-						myid, domain_name, myfolder);
+					myid, domain_name, myfolder);
 
 	vm_execute_sql_callback(profile, profile->mutex, sql, message_count_callback, &cbt);
 
@@ -1293,8 +1289,9 @@
 
 static char *vm_merge_file(switch_core_session_t *session, vm_profile_t *profile, const char *announce, const char *orig)
 {
-	switch_channel_t *channel = switch_core_session_get_channel(session);	
-	switch_file_handle_t lrfh = { 0 }, *rfh = NULL, lfh = { 0 }, *fh = NULL;
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_file_handle_t lrfh = { 0 }, *rfh = NULL, lfh = {
+	0}, *fh = NULL;
 	char *tmp_path;
 	switch_uuid_t uuid;
 	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
@@ -1302,8 +1299,8 @@
 	int16_t *abuf = NULL;
 	switch_size_t olen = 0;
 	int asis = 0;
-    switch_codec_implementation_t read_impl = {0};
-    switch_core_session_get_read_impl(session, &read_impl);
+	switch_codec_implementation_t read_impl = { 0 };
+	switch_core_session_get_read_impl(session, &read_impl);
 
 	switch_uuid_get(&uuid);
 	switch_uuid_format(uuid_str, &uuid);
@@ -1316,20 +1313,18 @@
 	if (switch_core_file_open(&lfh,
 							  tmp_path,
 							  lfh.channels,
-							  read_impl.actual_samples_per_second,
-							  SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
+							  read_impl.actual_samples_per_second, SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to open file %s\n", tmp_path);
 		goto end;
 	}
 
 	fh = &lfh;
-	
 
+
 	if (switch_core_file_open(&lrfh,
 							  announce,
 							  lfh.channels,
-							  read_impl.actual_samples_per_second,
-							  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
+							  read_impl.actual_samples_per_second, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to open file %s\n", announce);
 		goto end;
 	}
@@ -1340,7 +1335,7 @@
 
 	if (switch_test_flag(fh, SWITCH_FILE_NATIVE)) {
 		asis = 1;
-	}	
+	}
 
 	while (switch_channel_ready(channel)) {
 		olen = VM_STARTSAMPLES;
@@ -1352,7 +1347,7 @@
 		if (switch_core_file_read(rfh, abuf, &olen) != SWITCH_STATUS_SUCCESS || !olen) {
 			break;
 		}
-		
+
 		switch_core_file_write(fh, abuf, &olen);
 
 	}
@@ -1365,8 +1360,7 @@
 	if (switch_core_file_open(&lrfh,
 							  orig,
 							  lfh.channels,
-							  read_impl.actual_samples_per_second,
-							  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
+							  read_impl.actual_samples_per_second, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to open file %s\n", orig);
 		goto end;
 	}
@@ -1383,7 +1377,7 @@
 		if (switch_core_file_read(rfh, abuf, &olen) != SWITCH_STATUS_SUCCESS || !olen) {
 			break;
 		}
-		
+
 		switch_core_file_write(fh, abuf, &olen);
 
 	}
@@ -1392,7 +1386,7 @@
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Failed to delete file [%s]\n", announce);
 	}
 	ret = tmp_path;
-	
+
   end:
 
 	if (fh) {
@@ -1421,18 +1415,18 @@
 	char input[10] = "", key_buf[80] = "";
 	switch_file_handle_t fh = { 0 };
 	cc_t cc = { 0 };
-	char *forward_file_path = NULL;				
+	char *forward_file_path = NULL;
 
 
 	if (switch_channel_ready(channel)) {
 
 		args.input_callback = cancel_on_dtmf;
 
-		switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s:%s:%s%s%s", profile->listen_file_key, profile->save_file_key, 
-						profile->delete_file_key, profile->email_key, profile->callback_key, 
+		switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s:%s:%s%s%s", profile->listen_file_key, profile->save_file_key,
+						profile->delete_file_key, profile->email_key, profile->callback_key,
 						profile->forward_key, cbt->email ? ":" : "", cbt->email ? cbt->email : "");
-						
 
+
 		switch_snprintf(input, sizeof(input), "%s:%d", cbt->type == MSG_NEW ? "new" : "saved", cbt->want + 1);
 		memset(&cc, 0, sizeof(cc));
 		cc.profile = profile;
@@ -1481,8 +1475,8 @@
 				char *new_file_path = NULL;
 				char vm_cc[256] = "";
 				char macro_buf[80] = "";
-				
-				
+
+
 				switch_snprintf(key_buf, sizeof(key_buf), "%s:%s", profile->prepend_key, profile->forward_key);
 				TRY_CODE(vm_macro_get(session, VM_FORWARD_PREPEND_MACRO, key_buf, input, sizeof(input), 1, "", &term, profile->digit_timeout));
 				if (!strcmp(input, profile->prepend_key)) {
@@ -1490,11 +1484,12 @@
 					char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
 					switch_size_t message_len = 0;
 					char *new_path = NULL;
-					
+
 					switch_uuid_get(&uuid);
 					switch_uuid_format(uuid_str, &uuid);
 
-					forward_file_path = switch_core_session_sprintf(session, "%s%smsg_%s.wav", SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, uuid_str);
+					forward_file_path =
+						switch_core_session_sprintf(session, "%s%smsg_%s.wav", SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, uuid_str);
 					TRY_CODE(create_file(session, profile, VM_RECORD_MESSAGE_MACRO, forward_file_path, &message_len, SWITCH_TRUE, NULL, NULL));
 					if ((new_path = vm_merge_file(session, profile, forward_file_path, cbt->file_path))) {
 						switch_ivr_sleep(session, 1500, SWITCH_TRUE, NULL);
@@ -1509,16 +1504,17 @@
 				} else {
 					new_file_path = cbt->file_path;
 				}
-				
-			get_exten:
-				
+
+			  get_exten:
+
 				switch_snprintf(macro_buf, sizeof(macro_buf), "phrase:%s:%s", VM_FORWARD_MESSAGE_ENTER_EXTENSION_MACRO, profile->terminator_key);
 				vm_cc[0] = '\0';
 
-				TRY_CODE(switch_ivr_read(session, 0, sizeof(vm_cc), macro_buf, NULL, vm_cc, sizeof(vm_cc), profile->digit_timeout, profile->terminator_key));
-				
-				cmd = switch_core_session_sprintf(session, "%s@%s %s %s %s", vm_cc, cbt->domain, new_file_path, cbt->cid_number, cbt->cid_name);
+				TRY_CODE(switch_ivr_read
+						 (session, 0, sizeof(vm_cc), macro_buf, NULL, vm_cc, sizeof(vm_cc), profile->digit_timeout, profile->terminator_key));
 
+				cmd = switch_core_session_sprintf(session, "%s@%s %s %s '%s'", vm_cc, cbt->domain, new_file_path, cbt->cid_number, cbt->cid_name);
+
 				if (voicemail_inject(cmd) == SWITCH_STATUS_SUCCESS) {
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Sent Carbon Copy to %s\n", vm_cc);
 					TRY_CODE(switch_ivr_phrase_macro(session, VM_ACK_MACRO, "saved", NULL, NULL));
@@ -1558,7 +1554,7 @@
 					message_count(profile, cbt->user, cbt->domain, cbt->in_folder, &total_new_messages, &total_saved_messages,
 								  &total_new_urgent_messages, &total_saved_urgent_messages);
 
-					switch_time_exp_lt(&tm, switch_time_make (atol(cbt->created_epoch), 0));
+					switch_time_exp_lt(&tm, switch_time_make(atol(cbt->created_epoch), 0));
 					switch_strftime(date, &retsize, sizeof(date), profile->date_fmt, &tm);
 
 					switch_snprintf(tmp, sizeof(tmp), "%d", total_new_messages);
@@ -1581,7 +1577,7 @@
 					switch_channel_set_variable(channel, "voicemail_priority", tmp);
 					message_len = atoi(cbt->message_len);
 
-					l_duration = switch_time_make (atol(cbt->message_len), 0);
+					l_duration = switch_time_make(atol(cbt->message_len), 0);
 					switch_core_measure_time(l_duration, &duration);
 					duration.day += duration.yr * 365;
 					duration.hr += duration.day * 24;
@@ -1666,7 +1662,8 @@
 	int total_saved_urgent_messages = 0;
 	switch_event_t *event;
 
-	message_count(profile, id, domain_name, myfolder, &total_new_messages, &total_saved_messages, &total_new_urgent_messages, &total_saved_urgent_messages);
+	message_count(profile, id, domain_name, myfolder, &total_new_messages, &total_saved_messages, &total_new_urgent_messages,
+				  &total_saved_urgent_messages);
 
 	if (switch_event_create(&event, SWITCH_EVENT_MESSAGE_WAITING) != SWITCH_STATUS_SUCCESS) {
 		return;
@@ -1677,7 +1674,8 @@
 	}
 	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", yn);
 	switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Message-Account", "%s@%s", id, domain_name);
-	switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)", total_new_messages, total_saved_messages, total_new_urgent_messages, total_saved_urgent_messages);
+	switch_event_add_header(event, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", "%d/%d (%d/%d)", total_new_messages, total_saved_messages,
+							total_new_urgent_messages, total_saved_urgent_messages);
 	switch_event_fire(&event);
 }
 
@@ -1754,7 +1752,7 @@
 				char msg_count[80] = "";
 				switch_input_args_t folder_args = { 0 };
 				switch_event_t *params;
-				
+
 				folder_args.input_callback = cancel_on_dtmf;
 				folder_args.buf = &global_buf;
 				folder_args.buflen = sizeof(global_buf);
@@ -1899,13 +1897,10 @@
 				}
 
 				switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s:%s",
-								profile->record_greeting_key, 
-								profile->choose_greeting_key, 
-								profile->record_name_key, 
-								profile->change_pass_key, 
-								profile->main_menu_key);
-				
+								profile->record_greeting_key,
+								profile->choose_greeting_key, profile->record_name_key, profile->change_pass_key, profile->main_menu_key);
 
+
 				TRY_CODE(vm_macro_get(session, VM_CONFIG_MENU_MACRO, key_buf, input, sizeof(input), 1, "", &term, timeout));
 				if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
 					goto end;
@@ -1984,14 +1979,14 @@
 					switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "VM-User", myid);
 					switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "VM-Domain", domain_name);
 					switch_channel_event_set_data(channel, params);
-					
+
 					if (switch_xml_locate_user("id", myid, domain_name, switch_channel_get_variable(channel, "network_addr"),
 											   &xx_domain_root, &xx_domain, &xx_user, NULL, params) == SWITCH_STATUS_SUCCESS) {
 						switch_xml_free(xx_domain_root);
 					}
 
 					switch_event_fire(&params);
-					
+
 				} else if (!strcmp(input, profile->record_name_key)) {
 					file_path = switch_mprintf("%s%srecorded_name.%s", dir_path, SWITCH_PATH_SEPARATOR, profile->file_ext);
 					TRY_CODE(create_file(session, profile, VM_RECORD_NAME_MACRO, file_path, &message_len, SWITCH_FALSE, NULL, NULL));
@@ -2022,7 +2017,7 @@
 				} else {
 					switch_snprintf(key_buf, sizeof(key_buf), "%s:%s:%s:%s",
 									profile->play_new_messages_key, profile->play_saved_messages_key, profile->config_menu_key, profile->terminator_key);
-					
+
 					status = vm_macro_get(session, VM_MENU_MACRO, key_buf, input, sizeof(input), 1, "", &term, timeout);
 				}
 
@@ -2050,7 +2045,8 @@
 			break;
 		case VM_CHECK_AUTH:
 			{
-				prefs_callback_t cbt = {{0}};
+				prefs_callback_t cbt = { {0}
+				};
 				char sql[512] = "";
 
 				if (!attempts) {
@@ -2083,8 +2079,8 @@
 					switch_assert(params);
 					switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "destination_number", caller_profile->destination_number);
 					switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "caller_id_number", caller_id_number);
-					
-					
+
+
 					if (switch_xml_locate_user("id", myid, domain_name, switch_channel_get_variable(channel, "network_addr"),
 											   &x_domain_root, &x_domain, &x_user, NULL, params) != SWITCH_STATUS_SUCCESS) {
 						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Can't find user [%s@%s]\n", myid, domain_name);
@@ -2118,7 +2114,7 @@
 				for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
 					const char *var = switch_xml_attr_soft(x_param, "name");
 					const char *val = switch_xml_attr_soft(x_param, "value");
-					
+
 					if (!strcasecmp(var, "a1-hash")) {
 						thehash = switch_core_session_strdup(session, val);
 					} else if (!strcasecmp(var, "vm-a1-hash")) {
@@ -2146,10 +2142,10 @@
 						convert_ext = switch_core_session_strdup(session, val);
 					} else if (!strcasecmp(var, "storage-dir")) {
 						vm_storage_dir = switch_core_session_strdup(session, val);
-						
+
 					} else if (!strcasecmp(var, "timezone")) {
 						switch_channel_set_variable(channel, var, val);
-					} 
+					}
 
 				}
 
@@ -2173,7 +2169,7 @@
 				if (vmhash) {
 					thehash = vmhash;
 				}
-				
+
 				if (!auth && !thepass && !zstr(cbt.password)) {
 					thepass = cbt.password;
 				}
@@ -2195,7 +2191,7 @@
 							}
 							switch_safe_free(lpbuf);
 						}
-						
+
 						if (!auth && thepass && !strcmp(thepass, mypass)) {
 							auth++;
 						}
@@ -2203,13 +2199,15 @@
 				}
 
 				FREE_DOMAIN_ROOT();
-				
+
 				if (auth) {
 					if (!dir_path) {
 						if (!zstr(vm_storage_dir)) {
 							dir_path = switch_core_session_sprintf(session, "%s%s%s", vm_storage_dir, SWITCH_PATH_SEPARATOR, myid);
-						} else if ( !zstr(profile->storage_dir) ) {
-							dir_path = switch_core_session_sprintf(session, "%s%s%s%s%s", profile->storage_dir, SWITCH_PATH_SEPARATOR, domain_name, SWITCH_PATH_SEPARATOR, myid);
+						} else if (!zstr(profile->storage_dir)) {
+							dir_path =
+								switch_core_session_sprintf(session, "%s%s%s%s%s", profile->storage_dir, SWITCH_PATH_SEPARATOR, domain_name,
+															SWITCH_PATH_SEPARATOR, myid);
 						} else {
 							dir_path = switch_core_session_sprintf(session, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir,
 																   SWITCH_PATH_SEPARATOR,
@@ -2227,11 +2225,11 @@
 				} else {
 					goto failed;
 				}
-				
+
 				continue;
 
 			  failed:
-				
+
 				FREE_DOMAIN_ROOT();
 
 				status = switch_ivr_phrase_macro(session, VM_FAIL_AUTH_MACRO, NULL, NULL, NULL);
@@ -2261,17 +2259,15 @@
 }
 
 
-static switch_status_t deliver_vm(vm_profile_t *profile, 
-								switch_xml_t x_user, 
-								const char *domain_name, 
-								const char *path, 
-								uint32_t message_len,
-								const char *read_flags,
-								switch_event_t *params, 
-								switch_memory_pool_t *pool, 
-								const char *caller_id_name, 
-								const char *caller_id_number,
-								switch_bool_t copy)
+static switch_status_t deliver_vm(vm_profile_t *profile,
+								  switch_xml_t x_user,
+								  const char *domain_name,
+								  const char *path,
+								  uint32_t message_len,
+								  const char *read_flags,
+								  switch_event_t *params,
+								  switch_memory_pool_t *pool,
+								  const char *caller_id_name, const char *caller_id_number, const char *forwarded_by, switch_bool_t copy)
 {
 	char *file_path = NULL, *dir_path = NULL;
 	const char *myid = switch_xml_attr(x_user, "id");
@@ -2301,7 +2297,7 @@
 		switch_event_create(&local_event, SWITCH_EVENT_REQUEST_PARAMS);
 		params = local_event;
 	}
-	
+
 	if ((tmp = switch_event_get_header(params, "effective_caller_id_name"))) {
 		caller_id_name = tmp;
 	}
@@ -2309,7 +2305,7 @@
 	if ((tmp = switch_event_get_header(params, "effective_caller_id_number"))) {
 		caller_id_number = tmp;
 	}
-	
+
 	switch_uuid_get(&uuid);
 	switch_uuid_format(uuid_str, &uuid);
 
@@ -2323,7 +2319,7 @@
 	for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
 		const char *var = switch_xml_attr_soft(x_param, "name");
 		const char *val = switch_xml_attr_soft(x_param, "value");
-		
+
 		if (!strcasecmp(var, "timezone")) {
 			vm_timezone = switch_core_strdup(pool, val);
 		}
@@ -2356,7 +2352,7 @@
 		} else if (!strcasecmp(var, "timezone")) {
 			vm_timezone = switch_core_strdup(pool, val);
 		}
-		/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send mail is %d, var is %s\n", send_mail, var);*/
+		/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Send mail is %d, var is %s\n", send_mail, var); */
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deliver VM to %s@%s\n", myid, domain_name);
@@ -2382,7 +2378,7 @@
 	if (copy) {
 		switch_file_copy(path, file_path, SWITCH_FPROT_FILE_SOURCE_PERMS, pool);
 	} else {
-		file_path = (char *)path;
+		file_path = (char *) path;
 	}
 
 	if (!message_len) {
@@ -2395,7 +2391,7 @@
 	if (insert_db && switch_file_exists(file_path, pool) == SWITCH_STATUS_SUCCESS) {
 		char *usql;
 		switch_event_t *message_event;
-		
+
 		switch_event_create_subclass(&message_event, SWITCH_EVENT_CUSTOM, VM_EVENT_MAINT);
 		switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "VM-Action", "leave-message");
 		switch_event_add_header_string(message_event, SWITCH_STACK_BOTTOM, "VM-User", myid);
@@ -2411,10 +2407,10 @@
 		switch_event_fire(&message_event);
 
 		usql = switch_mprintf("insert into voicemail_msgs(created_epoch, read_epoch, username, domain, uuid, cid_name, "
-							  "cid_number, in_folder, file_path, message_len, flags, read_flags) "
-							  "values(%ld,0,'%q','%q','%q','%q','%q','%q','%q','%u','','%q')", (long) switch_epoch_time_now(NULL),
+							  "cid_number, in_folder, file_path, message_len, flags, read_flags, forwarded_by) "
+							  "values(%ld,0,'%q','%q','%q','%q','%q','%q','%q','%u','','%q','%q')", (long) switch_epoch_time_now(NULL),
 							  myid, domain_name, uuid_str, caller_id_name, caller_id_number,
-							  myfolder, file_path, message_len, read_flags);
+							  myfolder, file_path, message_len, read_flags, switch_str_nil(forwarded_by));
 
 		vm_execute_sql(profile, usql, profile->mutex);
 		switch_safe_free(usql);
@@ -2474,7 +2470,7 @@
 		if (vm_notify_email) {
 			switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "voicemail_notify_email", vm_notify_email);
 		}
-		l_duration = switch_time_make (message_len, 0);
+		l_duration = switch_time_make(message_len, 0);
 		switch_core_measure_time(l_duration, &duration);
 		duration.day += duration.yr * 365;
 		duration.hr += duration.day * 24;
@@ -2491,10 +2487,8 @@
 
 		if (send_main) {
 			if (zstr(profile->email_headers)) {
-				headers = switch_mprintf(
-										 "From: FreeSWITCH mod_voicemail <%s@%s>\n"
-										 "Subject: Voicemail from %s %s\nX-Priority: %d",
-										 myid, domain_name, caller_id_name, caller_id_number, priority);
+				headers = switch_mprintf("From: FreeSWITCH mod_voicemail <%s@%s>\n"
+										 "Subject: Voicemail from %s %s\nX-Priority: %d", myid, domain_name, caller_id_name, caller_id_number, priority);
 			} else {
 				headers = switch_event_expand_headers(params, profile->email_headers);
 			}
@@ -2530,9 +2524,9 @@
 			}
 
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending message to %s\n", vm_email);
-			
+
 			if (body != profile->email_body) {
-				switch_safe_free(body);	
+				switch_safe_free(body);
 			}
 
 			if (headers != profile->email_headers) {
@@ -2543,10 +2537,8 @@
 
 		if (send_notify) {
 			if (zstr(profile->notify_email_headers)) {
-				headers = switch_mprintf(
-										 "From: FreeSWITCH mod_voicemail <%s@%s>\n"
-										 "Subject: Voicemail from %s %s\nX-Priority: %d",
-										 myid, domain_name, caller_id_name, caller_id_number, priority);
+				headers = switch_mprintf("From: FreeSWITCH mod_voicemail <%s@%s>\n"
+										 "Subject: Voicemail from %s %s\nX-Priority: %d", myid, domain_name, caller_id_name, caller_id_number, priority);
 			} else {
 				headers = switch_event_expand_headers(params, profile->notify_email_headers);
 			}
@@ -2578,9 +2570,9 @@
 			switch_simple_email(vm_notify_email, from, header_string, body, NULL, NULL, NULL);
 
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sending notify message to %s\n", vm_notify_email);
-			
+
 			if (body != profile->notify_email_body) {
-				switch_safe_free(body);	
+				switch_safe_free(body);
 			}
 
 			if (headers != profile->notify_email_headers) {
@@ -2616,15 +2608,17 @@
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	int isgroup = 0, isall = 0;
 	int argc = 0;
-	char *argv[4];
+	char *argv[6] = { 0 };
 	char *box, *path, *cid_num, *cid_name;
 	switch_memory_pool_t *pool = NULL;
+	char *forwarded_by = NULL;
+	char *read_flags = "B";
 
 	if (zstr(data)) {
 		status = SWITCH_STATUS_FALSE;
 		goto end;
 	}
-	
+
 	dup = strdup(data);
 	switch_assert(dup);
 
@@ -2638,9 +2632,13 @@
 	path = argv[1];
 	cid_num = argv[2] ? argv[2] : "anonymous";
 	cid_name = argv[3] ? argv[3] : "anonymous";
+	forwarded_by = argv[4];
+	if (!zstr(argv[5])) {
+		read_flags = argv[5];
+	}
 
 	user = box;
-	
+
 	if ((domain = strchr(user, '@'))) {
 		*domain++ = '\0';
 	} else {
@@ -2659,7 +2657,7 @@
 	} else if (user == domain) {
 		isall++;
 	}
-	
+
 	if (!(user && domain)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid syntax [%s][%s]\n", switch_str_nil(user), switch_str_nil(domain));
 		status = SWITCH_STATUS_FALSE;
@@ -2671,7 +2669,7 @@
 			profile = get_profile("default");
 		}
 	}
-	
+
 	if (!profile) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find profile\n");
 		status = SWITCH_STATUS_FALSE;
@@ -2693,21 +2691,24 @@
 			}
 		}
 
+		if (forwarded_by) {
+			switch_event_add_header_string(my_params, SWITCH_STACK_BOTTOM, "Forwarded-By", forwarded_by);
+		}
 		switch_event_add_header_string(my_params, SWITCH_STACK_BOTTOM, "domain", domain);
 		switch_event_add_header_string(my_params, SWITCH_STACK_BOTTOM, "purpose", "publish-vm");
-		
+
 		if (switch_xml_locate_domain(domain, my_params, &xml_root, &x_domain) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot locate domain %s\n", domain);
 			status = SWITCH_STATUS_FALSE;
 			switch_event_destroy(&my_params);
 			goto end;
 		}
-		
+
 		switch_event_destroy(&my_params);
 
 		switch_core_new_memory_pool(&pool);
-		
-		
+
+
 		if (isgroup) {
 			switch_xml_t group = NULL, groups = NULL, users = NULL;
 			if ((groups = switch_xml_child(x_domain, "groups"))) {
@@ -2715,21 +2716,23 @@
 					if ((users = switch_xml_child(group, "users"))) {
 						for (ut = switch_xml_child(users, "user"); ut; ut = ut->next) {
 							const char *type = switch_xml_attr_soft(ut, "type");
-							
+
 							if (!strcasecmp(type, "pointer")) {
 								const char *uname = switch_xml_attr_soft(ut, "id");
 								switch_xml_t ux;
 
 								if (switch_xml_locate_user_in_domain(uname, x_domain, &ux, NULL) == SWITCH_STATUS_SUCCESS) {
 									switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS);
-									status = deliver_vm(profile, ux, domain, path, 0, "B", my_params, pool, cid_name, cid_num, SWITCH_TRUE);
+									status =
+										deliver_vm(profile, ux, domain, path, 0, read_flags, my_params, pool, cid_name, cid_num, forwarded_by,
+												   SWITCH_TRUE);
 									switch_event_destroy(&my_params);
 								}
 								continue;
 							}
-							
+
 							switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS);
-							status = deliver_vm(profile, ut, domain, path, 0, "B", my_params, pool, cid_name, cid_num, SWITCH_TRUE);
+							status = deliver_vm(profile, ut, domain, path, 0, read_flags, my_params, pool, cid_name, cid_num, forwarded_by, SWITCH_TRUE);
 							switch_event_destroy(&my_params);
 						}
 					}
@@ -2744,32 +2747,32 @@
 					if ((users = switch_xml_child(group, "users"))) {
 						for (ut = switch_xml_child(users, "user"); ut; ut = ut->next) {
 							const char *type = switch_xml_attr_soft(ut, "type");
-							
+
 							if (!strcasecmp(type, "pointer")) {
 								continue;
 							}
 
 							switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS);
-							status = deliver_vm(profile, ut, domain, path, 0, "B", my_params, pool, cid_name, cid_num, SWITCH_TRUE);
+							status = deliver_vm(profile, ut, domain, path, 0, read_flags, my_params, pool, cid_name, cid_num, forwarded_by, SWITCH_TRUE);
 							switch_event_destroy(&my_params);
 						}
 					}
 				}
 			}
-			
+
 		} else {
 			switch_xml_t x_group = NULL;
 
 			if ((status = switch_xml_locate_user_in_domain(user, x_domain, &ut, &x_group)) == SWITCH_STATUS_SUCCESS) {
 				switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS);
-				status = deliver_vm(profile, ut, domain, path, 0, "B", my_params, pool, cid_name, cid_num, SWITCH_TRUE);
+				status = deliver_vm(profile, ut, domain, path, 0, read_flags, my_params, pool, cid_name, cid_num, forwarded_by, SWITCH_TRUE);
 				switch_event_destroy(&my_params);
 			} else {
 				status = SWITCH_STATUS_FALSE;
 			}
 		}
 		profile_rwunlock(profile);
-		
+
 		switch_core_destroy_memory_pool(&pool);
 
 		switch_xml_free(xml_root);
@@ -2827,7 +2830,7 @@
 
 	switch_channel_set_variable(channel, "skip_greeting", NULL);
 	switch_channel_set_variable(channel, "skip_instructions", NULL);
-	
+
 	if (!(caller_id_name = switch_channel_get_variable(channel, "effective_caller_id_name"))) {
 		caller_id_name = caller_profile->caller_id_name;
 	}
@@ -2842,13 +2845,22 @@
 		int ok = 1;
 		switch_event_t *locate_params = NULL;
 		const char *email_addr = NULL;
+		char *x;
 
+
 		switch_event_create(&locate_params, SWITCH_EVENT_REQUEST_PARAMS);
 		switch_assert(locate_params);
 
 		if (switch_xml_locate_user("id", id, domain_name, switch_channel_get_variable(channel, "network_addr"),
 								   &x_domain_root, &x_domain, &x_user, NULL, locate_params) == SWITCH_STATUS_SUCCESS) {
 			id = switch_core_session_strdup(session, switch_xml_attr(x_user, "id"));
+
+			x = switch_xml_toxml(x_user, SWITCH_FALSE);
+			x_user = switch_xml_parse_str_dynamic(x, SWITCH_FALSE);
+			x_domain = NULL;
+			switch_xml_free(x_domain_root);
+			x_domain_root = NULL;
+
 			if ((x_params = switch_xml_child(x_user, "params"))) {
 				for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
 					const char *var = switch_xml_attr_soft(x_param, "name");
@@ -2874,6 +2886,8 @@
 						disk_quota = atoi(val);
 					} else if (!strcasecmp(var, "vm-alternate-greet-id")) {
 						read_id = switch_core_session_strdup(session, val);
+					} else if (!strcasecmp(var, "vm-message-ext")) {
+						vm_ext = switch_core_session_strdup(session, val);
 					}
 				}
 			}
@@ -2893,9 +2907,10 @@
 					send_notify = 0;
 				}
 			}
-			
+
 			if (send_mail && (!(send_main || send_notify))) {
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Falling back to leaving message locally due to too many misconfiguration.\n");
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
+								  "Falling back to leaving message locally due to too many misconfiguration.\n");
 				send_mail = 0;
 				insert_db = 1;
 			}
@@ -2903,14 +2918,14 @@
 			if (send_notify && !send_main) {
 				insert_db = 1;
 			}
-			
+
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Can't find user [%s@%s]\n", id, domain_name);
 			ok = 0;
 		}
 
 		switch_event_destroy(&locate_params);
-		
+
 		if (!ok) {
 			goto end;
 		}
@@ -2934,7 +2949,9 @@
 	switch_snprintf(sql, sizeof(sql), "select * from voicemail_prefs where username='%s' and domain='%s'", id, domain_name);
 	vm_execute_sql_callback(profile, profile->mutex, sql, prefs_callback, &cbt);
 
-	vm_ext = profile->file_ext;
+	if (!vm_ext) {
+		vm_ext = profile->file_ext;
+	}
 	if ((vtmp = switch_channel_get_variable(channel, "vm_message_ext"))) {
 		vm_ext = vtmp;
 	}
@@ -2950,7 +2967,7 @@
 		greet_path = cbt.greeting_path;
 	}
 
-greet:
+  greet:
 	if (!skip_greeting) {
 		memset(buf, 0, sizeof(buf));
 		args.input_callback = cancel_on_dtmf;
@@ -2978,38 +2995,38 @@
 			}
 		}
 
-        if (*buf != '\0') {
-greet_key_press:
-            if (switch_stristr(buf, profile->login_keys)) {
-                voicemail_check_main(session, profile, domain_name, id, 0);
-            } else if (!strcasecmp(buf, profile->operator_key) && !zstr(profile->operator_key)) {
-                int argc;
-                char *argv[4];
-                char *mycmd;
+		if (*buf != '\0') {
+		  greet_key_press:
+			if (switch_stristr(buf, profile->login_keys)) {
+				voicemail_check_main(session, profile, domain_name, id, 0);
+			} else if (!strcasecmp(buf, profile->operator_key) && !zstr(profile->operator_key)) {
+				int argc;
+				char *argv[4];
+				char *mycmd;
 
-                if (!zstr(profile->operator_ext) && (mycmd = switch_core_session_strdup(session, profile->operator_ext))) {
-                    argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
-                    if (argc >= 1 && argc <= 4) {
-                        switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
-                        /* the application still runs after we leave it so we need to make sure that we don't do anything evil */
-                        send_mail = 0;
-                        goto end;
-                    }
-                }
-            } else if (!strcasecmp(buf, profile->vmain_key) && !zstr(profile->vmain_key)) {
-                int argc;
-                char *argv[4];
-                char *mycmd;
+				if (!zstr(profile->operator_ext) && (mycmd = switch_core_session_strdup(session, profile->operator_ext))) {
+					argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+					if (argc >= 1 && argc <= 4) {
+						switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
+						/* the application still runs after we leave it so we need to make sure that we don't do anything evil */
+						send_mail = 0;
+						goto end;
+					}
+				}
+			} else if (!strcasecmp(buf, profile->vmain_key) && !zstr(profile->vmain_key)) {
+				int argc;
+				char *argv[4];
+				char *mycmd;
 
-                if (!zstr(profile->vmain_ext) && (mycmd = switch_core_session_strdup(session, profile->vmain_ext))) {
-                    argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
-                    if (argc >= 1 && argc <= 4) {
-                        switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
-                        /* the application still runs after we leave it so we need to make sure that we don't do anything evil */
-                        send_mail = 0;
-                        goto end;
-                    }
-                }
+				if (!zstr(profile->vmain_ext) && (mycmd = switch_core_session_strdup(session, profile->vmain_ext))) {
+					argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
+					if (argc >= 1 && argc <= 4) {
+						switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
+						/* the application still runs after we leave it so we need to make sure that we don't do anything evil */
+						send_mail = 0;
+						goto end;
+					}
+				}
 			} else if (*profile->skip_greet_key && !strcasecmp(buf, profile->skip_greet_key)) {
 				skip_instructions = SWITCH_TRUE;
 			} else {
@@ -3025,14 +3042,12 @@
 	if (disk_quota) {
 		callback_t callback = { 0 };
 		char sqlstmt[256];
-		char disk_usage[256] = ""; 
+		char disk_usage[256] = "";
 
 		callback.buf = disk_usage;
 		callback.len = sizeof(disk_usage);
 
-		switch_snprintf(sqlstmt, sizeof(sqlstmt),
-						"select sum(message_len) from voicemail_msgs where username='%s' and domain='%s'",
-						id, domain_name);
+		switch_snprintf(sqlstmt, sizeof(sqlstmt), "select sum(message_len) from voicemail_msgs where username='%s' and domain='%s'", id, domain_name);
 		vm_execute_sql_callback(profile, profile->mutex, sqlstmt, sql2str_callback, &callback);
 
 		if (atoi(disk_usage) >= disk_quota) {
@@ -3079,30 +3094,26 @@
 
 		switch_snprintf(key_buf, sizeof(key_buf), "%s:%s", profile->urgent_key, profile->terminator_key);
 
-		(void)vm_macro_get(session, VM_RECORD_URGENT_CHECK_MACRO, key_buf, input, sizeof(input), 1, "", &term, profile->digit_timeout);
+		(void) vm_macro_get(session, VM_RECORD_URGENT_CHECK_MACRO, key_buf, input, sizeof(input), 1, "", &term, profile->digit_timeout);
 		if (*profile->urgent_key == *input) {
 			read_flags = URGENT_FLAG_STRING;
 			priority = 1;
-			(void)switch_ivr_phrase_macro(session, VM_ACK_MACRO, "marked-urgent", NULL, NULL);
+			(void) switch_ivr_phrase_macro(session, VM_ACK_MACRO, "marked-urgent", NULL, NULL);
 		} else {
-			(void)switch_ivr_phrase_macro(session, VM_ACK_MACRO, "saved", NULL, NULL);
+			(void) switch_ivr_phrase_macro(session, VM_ACK_MACRO, "saved", NULL, NULL);
 		}
 	}
-	
-	if (!x_domain_root) {
-		switch_xml_locate_user("id", id, domain_name, switch_channel_get_variable(channel, "network_addr"),
-							   &x_domain_root, &x_domain, &x_user, NULL, NULL);
-		id = switch_core_session_strdup(session, switch_xml_attr(x_user, "id"));
-	}
 
-	if (x_domain_root) {
+	if (x_user) {
 		switch_channel_get_variables(channel, &vars);
-		status = deliver_vm(profile, x_user, domain_name, file_path, message_len, read_flags, vars, 
-							switch_core_session_get_pool(session), caller_id_name, caller_id_number, SWITCH_FALSE);
+		status = deliver_vm(profile, x_user, domain_name, file_path, message_len, read_flags, vars,
+							switch_core_session_get_pool(session), caller_id_name, caller_id_number, NULL, SWITCH_FALSE);
 		switch_event_destroy(&vars);
 		if (status == SWITCH_STATUS_SUCCESS) {
 			if ((vm_cc = switch_channel_get_variable(channel, "vm_cc"))) {
-				char *cmd = switch_core_session_sprintf(session, "%s %s %s %s", vm_cc, file_path, caller_id_number, caller_id_name);
+				char *cmd = switch_core_session_sprintf(session, "%s %s %s %s %s@%s %s",
+														vm_cc, file_path, caller_id_number, caller_id_name, id, domain_name, read_flags);
+
 				if (voicemail_inject(cmd) == SWITCH_STATUS_SUCCESS) {
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Sent Carbon Copy to %s\n", vm_cc);
 				} else {
@@ -3118,9 +3129,9 @@
 
   end:
 
-	if (x_domain_root) {
-		switch_xml_free(x_domain_root);
-		x_domain_root = NULL;
+	if (x_user) {
+		switch_xml_free(x_user);
+		x_user = NULL;
 	}
 
 	switch_safe_free(file_path);
@@ -3141,7 +3152,7 @@
 	int argc = 0;
 	char *argv[6] = { 0 };
 	char *mydata = NULL;
-	vm_profile_t * profile = NULL;
+	vm_profile_t *profile = NULL;
 	const char *profile_name = NULL;
 	const char *domain_name = NULL;
 	const char *id = NULL;
@@ -3211,7 +3222,7 @@
 	}
 
 	profile_rwunlock(profile);
-	
+
 }
 
 #define BOXCOUNT_SYNTAX "[profile/]<user>@<domain>[|[new|saved|new-urgent|saved-urgent|all]]"
@@ -3225,20 +3236,20 @@
 	int total_saved_urgent_messages = 0;
 	vm_profile_t *profile;
 	char *id, *domain, *p, *profilename = NULL;
-	
+
 	if (zstr(cmd)) {
-		stream->write_function(stream, "%d", 0);	
+		stream->write_function(stream, "%d", 0);
 		return SWITCH_STATUS_SUCCESS;
 	}
 
 	id = dup = strdup(cmd);
-	
+
 	if ((p = strchr(dup, '/'))) {
 		*p++ = '\0';
 		id = p;
 		profilename = dup;
 	}
-	
+
 	if (!strncasecmp(id, "sip:", 4)) {
 		id += 4;
 	}
@@ -3292,10 +3303,11 @@
 		stream->write_function(stream, "%d", total_new_messages);
 	}
 
-done:
+  done:
 	switch_safe_free(dup);
 	return SWITCH_STATUS_SUCCESS;
 }
+
 #define PREFS_SYNTAX "[profile/]<user>@<domain>[|[name_path|greeting_path|password]]"
 SWITCH_STANDARD_API(prefs_api_function)
 {
@@ -3304,7 +3316,7 @@
 	vm_profile_t *profile = NULL;
 	char *id, *domain, *p, *profilename = NULL;
 	char sql[256];
-	prefs_callback_t cbt = {{0}};
+	prefs_callback_t cbt = { {0} };
 
 	if (zstr(cmd)) {
 		stream->write_function(stream, "%d", 0);
@@ -3360,9 +3372,9 @@
 		stream->write_function(stream, "%s", cbt.password);
 	} else {
 		stream->write_function(stream, "%s:%s:%s", cbt.greeting_path, cbt.name_path, cbt.password);
-	} 
+	}
 	profile_rwunlock(profile);
-done:
+  done:
 	switch_safe_free(dup);
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -3602,15 +3614,15 @@
 	char title_aft[128 * 3] = "";
 
 	if (argc > 0) {
-		l_created = switch_time_make (atol(argv[0]), 0);
+		l_created = switch_time_make(atol(argv[0]), 0);
 	}
 
 	if (argc > 1) {
-		l_read = switch_time_make (atol(argv[1]), 0);
+		l_read = switch_time_make(atol(argv[1]), 0);
 	}
 
 	if (argc > 9) {
-		l_duration = switch_time_make (atol(argv[9]), 0);
+		l_duration = switch_time_make(atol(argv[9]), 0);
 	}
 
 	if ((fname = strrchr(argv[8], '/'))) {
@@ -3692,15 +3704,15 @@
 	char heard[80];
 
 	if (argc > 0) {
-		l_created = switch_time_make (atol(argv[0]), 0);
+		l_created = switch_time_make(atol(argv[0]), 0);
 	}
 
 	if (argc > 1) {
-		l_read = switch_time_make (atol(argv[1]), 0);
+		l_read = switch_time_make(atol(argv[1]), 0);
 	}
 
 	if (argc > 9) {
-		l_duration = switch_time_make (atol(argv[9]), 0);
+		l_duration = switch_time_make(atol(argv[9]), 0);
 	}
 
 	switch_core_measure_time(l_duration, &duration);
@@ -3841,7 +3853,8 @@
 }
 
 
-static void do_web(vm_profile_t *profile, const char *user_in, const char *domain, const char *host, const char *port, const char *uri, switch_stream_handle_t *stream)
+static void do_web(vm_profile_t *profile, const char *user_in, const char *domain, const char *host, const char *port, const char *uri,
+				   switch_stream_handle_t *stream)
 {
 	char buf[80] = "";
 	struct holder holder;
@@ -3969,7 +3982,7 @@
 			}
 			stream->write_function(stream, "+OK reload complete\n");
 			goto done;
-			
+
 		} else if (!strcasecmp(argv[0], "status")) {
 			stream->write_function(stream, "============================\n");
 			switch_mutex_lock(globals.mutex);
@@ -4107,15 +4120,15 @@
 	switch_event_unbind_callback(message_query_handler);
 
 	switch_mutex_lock(globals.mutex);
-	while((hi = switch_hash_first(NULL, globals.profile_hash))) {
+	while ((hi = switch_hash_first(NULL, globals.profile_hash))) {
 		switch_hash_this(hi, &key, &keylen, &val);
 		profile = (vm_profile_t *) val;
-		
+
 		switch_core_hash_delete(globals.profile_hash, profile->name);
 
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Waiting for write lock (Profile %s)\n", profile->name);	
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Waiting for write lock (Profile %s)\n", profile->name);
 		switch_thread_rwlock_wrlock(profile->rwlock);
-		
+
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroying Profile %s\n", profile->name);
 
 		switch_core_destroy_memory_pool(&profile->pool);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_cepstral/mod_cepstral.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_cepstral/mod_cepstral.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_cepstral/mod_cepstral.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_flite/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_flite/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_flite/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,27 +1,33 @@
 FLITE=flite-1.3.99
+
 FLITE_DIR=$(switch_srcdir)/libs/$(FLITE)
-FLITE_LIBDIR=$(FLITE_DIR)/build/libs
+FLITE_BUILDDIR=$(switch_builddir)/libs/$(FLITE)
+
+FLITE_LIBDIR=$(FLITE_BUILDDIR)/build/libs
 FLITE_A=$(FLITE_LIBDIR)/libflite_cmu_us_awb.a \
 	$(FLITE_LIBDIR)/libflite_cmu_us_kal.a \
 	$(FLITE_LIBDIR)/libflite_cmu_us_rms.a \
 	$(FLITE_LIBDIR)/libflite_cmu_us_slt.a \
 	$(FLITE_LIBDIR)/libflite_cmulex.a $(FLITE_LIBDIR)/libflite_usenglish.a $(FLITE_LIBDIR)/libflite.a -lm
 
-LOCAL_CFLAGS=-I$(switch_srcdir)/libs/$(FLITE)/include
+LOCAL_CFLAGS=-I$(FLITE_DIR)/include -I$(FLITE_BUILDDIR)/include
 LOCAL_LIBADD=$(FLITE_A)
 
 BASE=../../../..
 include $(BASE)/build/modmake.rules
 
+$(MODNAME).lo: $(FLITE_A)
 $(FLITE_DIR):
 	$(GETLIB) $(FLITE)-latest.tar.gz
 
-$(FLITE_DIR)/Makefile: $(FLITE_DIR)
-	cd $(FLITE_DIR) && CFLAGS="`echo $(CFLAGS) | sed -e 's:-std=c99::'`" ./configure --without-audio --with-pic --disable-shared
+$(FLITE_BUILDDIR)/Makefile: $(FLITE_DIR)
+	mkdir -p $(FLITE_BUILDDIR)
+	cd $(FLITE_BUILDDIR) && $(DEFAULT_VARS) $(FLITE_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(FLITE_DIR) --without-audio --with-pic --disable-shared
 	$(TOUCH_TARGET)
 
-$(FLITE_A): $(FLITE_DIR) $(FLITE_DIR)/Makefile
-	cd $(FLITE_DIR) && $(MAKE)
+$(FLITE_A): $(FLITE_DIR) $(FLITE_BUILDDIR)/Makefile
+	cd $(FLITE_BUILDDIR) && $(MAKE) -j1
 	test -d $(FLITE_LIBDIR) || mkdir $(FLITE_LIBDIR)
-	cd $(FLITE_DIR) && FLITE_TMP_LIBDIR=`$(FLITE_DIR)/config.guess | sed "s/-[^-]*//" | sed "s/i[3456]86/i386/"` && cp build/$$FLITE_TMP_LIBDIR/lib/*.a $(FLITE_LIBDIR)
-
+	TARGET_OS=`grep TARGET_OS $(FLITE_BUILDDIR)/config/config | sed "s/^.*= //"` ;\
+	TARGET_CPU=`grep TARGET_CPU $(FLITE_BUILDDIR)/config/config | sed "s/^.*= //"` ;\
+	cd $(FLITE_BUILDDIR) && cp build/$$TARGET_CPU-$$TARGET_OS/lib/*.a $(FLITE_LIBDIR)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_flite/mod_flite.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_flite/mod_flite.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_flite/mod_flite.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -71,7 +71,7 @@
 	flite_t *flite = switch_core_alloc(sh->memory_pool, sizeof(*flite));
 
 	sh->native_rate = 16000;
-	
+
 	if (!strcasecmp(voice_name, "awb")) {
 		flite->v = globals.awb;
 	} else if (!strcasecmp(voice_name, "kal")) {
@@ -108,9 +108,9 @@
 static switch_status_t flite_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags)
 {
 	flite_t *flite = (flite_t *) sh->private_info;
-	
+
 	flite->w = flite_text_to_wave(text, flite->v);
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -128,10 +128,10 @@
 {
 	size_t bytes_read;
 	flite_t *flite = (flite_t *) sh->private_info;
-	
+
 	if (!flite->audio_buffer) {
 		int32_t len;
-		
+
 		if (flite->w) {
 			len = flite->w->num_samples * 2;
 		} else {
@@ -146,28 +146,28 @@
 		switch_buffer_write(flite->audio_buffer, flite->w->samples, flite->w->num_samples * 2);
 		free_wave(flite->w);
 	}
-	
+
 	if ((bytes_read = switch_buffer_read(flite->audio_buffer, data, *datalen))) {
 		*datalen = bytes_read;
 		return SWITCH_STATUS_SUCCESS;
 	}
-	
+
 	return SWITCH_STATUS_FALSE;
 }
 
 static void flite_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val)
 {
-	
+
 }
 
 static void flite_numeric_param_tts(switch_speech_handle_t *sh, char *param, int val)
 {
-	
+
 }
 
 static void flite_float_param_tts(switch_speech_handle_t *sh, char *param, double val)
 {
-	
+
 }
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_flite_load)
@@ -179,7 +179,7 @@
 	globals.kal = register_cmu_us_kal();
 	globals.rms = register_cmu_us_rms();
 	globals.slt = register_cmu_us_slt();
-	
+
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	speech_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_SPEECH_INTERFACE);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_pocketsphinx/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_pocketsphinx/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_pocketsphinx/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,11 +1,13 @@
 SPHINXBASE=sphinxbase-0.4.99
 SPHINXBASE_DIR=$(switch_srcdir)/libs/$(SPHINXBASE)
+SPHINXBASE_BUILDDIR=$(switch_builddir)/libs/$(SPHINXBASE)
 POCKETSPHINX=pocketsphinx-0.5.99
 POCKETSPHINX_DIR=$(switch_srcdir)/libs/$(POCKETSPHINX)
-SPHINXBASE_LA=$(SPHINXBASE_DIR)/src/libsphinxbase/libsphinxbase.la
-SPHINXBASE_LA2=$(SPHINXBASE_DIR)/src/libsphinxad/libsphinxad.la
+POCKETSPHINX_BUILDDIR=$(switch_builddir)/libs/$(POCKETSPHINX)
+SPHINXBASE_LA=$(SPHINXBASE_BUILDDIR)/src/libsphinxbase/libsphinxbase.la
+SPHINXBASE_LA2=$(SPHINXBASE_BUILDDIR)/src/libsphinxad/libsphinxad.la
 
-POCKETSPHINX_LA=$(POCKETSPHINX_DIR)/src/libpocketsphinx/libpocketsphinx.la
+POCKETSPHINX_LA=$(POCKETSPHINX_BUILDDIR)/src/libpocketsphinx/libpocketsphinx.la
 
 SPHINXMODEL=communicator_semi_6000_20080321
 
@@ -15,43 +17,45 @@
 include $(BASE)/build/modmake.rules
 
 $(SPHINXBASE_DIR):
-	$(GETLIB) $(SPHINXBASE)-latest.tar.gz
+	$(GETLIB) $(SPHINXBASE)-20091212.tar.gz
 
-$(SPHINXBASE_DIR)/buildstamp: $(SPHINXBASE_DIR)
-	test -f $(SPHINXBASE_DIR)/Makefile || (cd $(SPHINXBASE_DIR) && ./configure --with-pic --without-python --disable-shared CFLAGS=)
-	test -f $(SPHINXBASE_DIR)/buildstamp || (touch $(SPHINXBASE_DIR)/buildstamp)
+$(SPHINXBASE_BUILDDIR)/buildstamp: $(SPHINXBASE_DIR)
+	mkdir -p $(SPHINXBASE_BUILDDIR)
+	test -f $(SPHINXBASE_BUILDDIR)/Makefile || (cd $(SPHINXBASE_BUILDDIR) && $(DEFAULT_VARS) $(SPHINXBASE_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(SPHINXBASE_DIR) --without-python CFLAGS=)
+	test -f $(SPHINXBASE_BUILDDIR)/buildstamp || (touch $(SPHINXBASE_BUILDDIR)/buildstamp)
 
-$(SPHINXBASE_LA): $(SPHINXBASE_DIR)/buildstamp
-	cd $(SPHINXBASE_DIR) && $(MAKE)
+$(SPHINXBASE_LA): $(SPHINXBASE_BUILDDIR)/buildstamp
+	cd $(SPHINXBASE_BUILDDIR) && $(MAKE)
 	$(TOUCH_TARGET)
 
 $(POCKETSPHINX_DIR):
-	$(GETLIB) $(POCKETSPHINX)-latest.tar.gz
+	$(GETLIB) $(POCKETSPHINX)-20091212.tar.gz
 
-$(POCKETSPHINX_DIR)/Makefile: $(POCKETSPHINX_DIR)
-	cd $(POCKETSPHINX_DIR) && ./configure --with-pic --without-python --disable-shared --with-sphinxbase=$(SPHINXBASE_DIR) CFLAGS=
+$(POCKETSPHINX_BUILDDIR)/Makefile: $(POCKETSPHINX_DIR) $(SPHINXBASE_LA)
+	mkdir -p $(POCKETSPHINX_BUILDDIR)
+	cd $(POCKETSPHINX_BUILDDIR) && $(DEFAULT_VARS) $(POCKETSPHINX_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(POCKETSPHINX_DIR) --without-python --with-sphinxbase=$(SPHINXBASE_DIR) --with-sphinxbase-build=$(SPHINXBASE_BUILDDIR) CFLAGS=
 	$(TOUCH_TARGET)
 
-$(POCKETSPHINX_DIR)/buildstamp: $(POCKETSPHINX_DIR)/Makefile
-	test -f $(POCKETSPHINX_DIR)/buildstamp || touch $(POCKETSPHINX_DIR)/buildstamp
+$(POCKETSPHINX_BUILDDIR)/buildstamp: $(POCKETSPHINX_BUILDDIR)/Makefile
+	test -f $(POCKETSPHINX_BUILDDIR)/buildstamp || touch $(POCKETSPHINX_BUILDDIR)/buildstamp
 
-$(POCKETSPHINX_LA): $(POCKETSPHINX_DIR)/Makefile 
-	cd $(POCKETSPHINX_DIR) && $(MAKE)
+$(POCKETSPHINX_LA): $(POCKETSPHINX_BUILDDIR)/Makefile 
+	cd $(POCKETSPHINX_BUILDDIR) && $(MAKE)
 	$(TOUCH_TARGET)
 
-$(DESTDIR)$(PREFIX)/grammar/model:
-	mkdir -p $(DESTDIR)$(PREFIX)/grammar/model
+$(DESTDIR)$(grammardir)/model:
+	mkdir -p $(DESTDIR)$(grammardir)/model
 
-$(DESTDIR)$(PREFIX)/grammar/model/communicator:
+$(DESTDIR)$(grammardir)/model/communicator:
 	$(GETLIB) $(SPHINXMODEL).tar.gz
-	mkdir -p $(DESTDIR)$(PREFIX)/grammar/model/communicator
-	cp -rp $(BASE)/libs/Communicator_semi_40.cd_semi_6000/* $(DESTDIR)$(PREFIX)/grammar/model/communicator
+	mkdir -p $(DESTDIR)$(grammardir)/model/communicator
+	cp -rp $(switch_srcdir)/libs/Communicator_semi_40.cd_semi_6000/* $(DESTDIR)$(grammardir)/model/communicator
 
-$(DESTDIR)$(PREFIX)/grammar/model/wsj1:
-	mkdir -p $(DESTDIR)$(PREFIX)/grammar/model/wsj1
-	cp -rp $(POCKETSPHINX_DIR)/model/hmm/wsj1/* $(DESTDIR)$(PREFIX)/grammar/model/wsj1
+$(DESTDIR)$(grammardir)/model/wsj1:
+	mkdir -p $(DESTDIR)$(grammardir)/model/wsj1
+	cp -rp $(POCKETSPHINX_DIR)/model/hmm/wsj1/* $(DESTDIR)$(grammardir)/model/wsj1
 
 dictionary:
-	@cp -f $(POCKETSPHINX_DIR)/model/lm/cmudict.0.6d $(DESTDIR)$(PREFIX)/grammar/default.dic
+	@cp -f $(POCKETSPHINX_DIR)/model/lm/cmudict.0.6d $(DESTDIR)$(grammardir)/default.dic
 
-local_install: $(DESTDIR)$(PREFIX)/grammar/model $(DESTDIR)$(PREFIX)/grammar/model/communicator $(DESTDIR)$(PREFIX)/grammar/model/wsj1 dictionary
+local_install: $(DESTDIR)$(grammardir)/model $(DESTDIR)$(grammardir)/model/communicator $(DESTDIR)$(grammardir)/model/wsj1 dictionary

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_pocketsphinx/mod_pocketsphinx.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -87,23 +87,23 @@
 	if (!(ps = (pocketsphinx_t *) switch_core_alloc(ah->memory_pool, sizeof(*ps)))) {
 		return SWITCH_STATUS_MEMERR;
 	}
-	
+
 	switch_mutex_init(&ps->flag_mutex, SWITCH_MUTEX_NESTED, ah->memory_pool);
 	ah->private_info = ps;
 
-	if (rate == 8000) { 
+	if (rate == 8000) {
 		ah->rate = 8000;
 	} else if (rate == 16000) {
 		ah->rate = 16000;
-	} else {  
+	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid rate %d. Only 8000 and 16000 are supported.\n", rate);
 	}
 
 	codec = "L16";
 
-	ah->codec = switch_core_strdup(ah->memory_pool, codec); 
+	ah->codec = switch_core_strdup(ah->memory_pool, codec);
 
-	
+
 	ps->thresh = globals.thresh;
 	ps->silence_hits = globals.silence_hits;
 	ps->listen_hits = globals.listen_hits;
@@ -139,34 +139,28 @@
 	dic = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, globals.dictionary);
 
 	if (switch_file_exists(dic, ah->memory_pool) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open dictionary %s.\n", dic); 
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open dictionary %s.\n", dic);
 		goto end;
 	}
 
 	if (switch_file_exists(model, ah->memory_pool) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't open speech model %s.\n", model); 
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't open speech model %s.\n", model);
 		goto end;
 	}
 
 	if (switch_file_exists(jsgf, ah->memory_pool) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't open grammar file %s.\n", jsgf); 
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't open grammar file %s.\n", jsgf);
 		goto end;
 	}
 
-	rate = switch_mprintf("%d", ah->rate); 
+	rate = switch_mprintf("%d", ah->rate);
 
 	switch_assert(jsgf && dic && model);
-	
+
 	ps->config = cmd_ln_init(ps->config, ps_args(), FALSE,
 							 "-samprate", rate,
-							 "-hmm", model,
-							 "-jsgf", jsgf, 
-							 "-lw", globals.language_weight,
-							 "-dict", dic,
-							 "-frate", "50",
-							 "-silprob", "0.005",
-							 NULL);
-	  
+							 "-hmm", model, "-jsgf", jsgf, "-lw", globals.language_weight, "-dict", dic, "-frate", "50", "-silprob", "0.005", NULL);
+
 	if (ps->config == NULL) {
 		status = SWITCH_STATUS_GENERR;
 		goto end;
@@ -185,19 +179,19 @@
 	switch_mutex_unlock(ps->flag_mutex);
 
 	ps_start_utt(ps->ps, NULL);
-	switch_set_flag(ps, PSFLAG_READY);	
+	switch_set_flag(ps, PSFLAG_READY);
 	switch_safe_free(ps->grammar);
 	ps->grammar = strdup(grammar);
 
 	status = SWITCH_STATUS_SUCCESS;
 
- end:
-	
+  end:
+
 	switch_safe_free(rate);
 	switch_safe_free(jsgf);
 	switch_safe_free(dic);
 	switch_safe_free(model);
-	
+
 	return status;
 }
 
@@ -224,7 +218,7 @@
 	switch_mutex_unlock(ps->flag_mutex);
 	switch_clear_flag(ps, PSFLAG_HAS_TEXT);
 	switch_clear_flag(ps, PSFLAG_READY);
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Port Closed.\n"); 
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Port Closed.\n");
 	switch_set_flag(ah, SWITCH_ASR_FLAG_CLOSED);
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -233,7 +227,7 @@
 {
 	uint32_t score, count = 0, j = 0;
 	double energy = 0;
-	
+
 	if (ps->countdown) {
 		if (!--ps->countdown) {
 			ps->silence_hits = ps->org_silence_hits;
@@ -242,12 +236,12 @@
 		}
 		return SWITCH_FALSE;
 	}
-	
 
+
 	for (count = 0; count < samples; count++) {
 		energy += abs(data[j]);
 	}
-	
+
 	score = (uint32_t) (energy / samples);
 
 	if (score >= ps->thresh) {
@@ -274,20 +268,21 @@
 	pocketsphinx_t *ps = (pocketsphinx_t *) ah->private_info;
 	int rv = 0;
 
-	if (switch_test_flag(ah, SWITCH_ASR_FLAG_CLOSED)) return SWITCH_STATUS_BREAK; 
-	
+	if (switch_test_flag(ah, SWITCH_ASR_FLAG_CLOSED))
+		return SWITCH_STATUS_BREAK;
+
 	if (!switch_test_flag(ps, PSFLAG_HAS_TEXT) && switch_test_flag(ps, PSFLAG_READY)) {
-		if (stop_detect(ps, (int16_t *)data, len / 2)) {
+		if (stop_detect(ps, (int16_t *) data, len / 2)) {
 			char const *hyp;
 
-			switch_mutex_lock(ps->flag_mutex); 
+			switch_mutex_lock(ps->flag_mutex);
 			if ((hyp = ps_get_hyp(ps->ps, &ps->score, &ps->uttid))) {
 				if (!zstr(hyp)) {
 					ps_end_utt(ps->ps);
 					switch_clear_flag(ps, PSFLAG_READY);
 					if ((hyp = ps_get_hyp(ps->ps, &ps->score, &ps->uttid))) {
 						if (zstr(hyp)) {
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Lost the text, never mind....\n");   
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Lost the text, never mind....\n");
 							ps_start_utt(ps->ps, NULL);
 							switch_set_flag(ps, PSFLAG_READY);
 						} else {
@@ -303,7 +298,7 @@
 		/* only feed ps_process_raw when we are listening */
 		if (ps->listening) {
 			switch_mutex_lock(ps->flag_mutex);
-			rv = ps_process_raw(ps->ps, (int16 *)data, len / 2 , FALSE, FALSE);
+			rv = ps_process_raw(ps->ps, (int16 *) data, len / 2, FALSE, FALSE);
 			switch_mutex_unlock(ps->flag_mutex);
 		}
 
@@ -321,13 +316,13 @@
 	pocketsphinx_t *ps = (pocketsphinx_t *) ah->private_info;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
-	switch_mutex_lock(ps->flag_mutex);		
+	switch_mutex_lock(ps->flag_mutex);
 	if (switch_test_flag(ps, PSFLAG_READY)) {
 		ps_end_utt(ps->ps);
 		switch_clear_flag(ps, PSFLAG_READY);
 		status = SWITCH_STATUS_SUCCESS;
 	}
-	switch_mutex_unlock(ps->flag_mutex);		
+	switch_mutex_unlock(ps->flag_mutex);
 
 	return status;
 }
@@ -337,19 +332,19 @@
 {
 	pocketsphinx_t *ps = (pocketsphinx_t *) ah->private_info;
 	switch_status_t status = SWITCH_STATUS_FALSE;
-	
-	switch_mutex_lock(ps->flag_mutex);		
+
+	switch_mutex_lock(ps->flag_mutex);
 	switch_clear_flag(ps, PSFLAG_HAS_TEXT);
-	if (!switch_test_flag(ps, PSFLAG_READY)) { 
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Manually Resuming\n");   
-		
+	if (!switch_test_flag(ps, PSFLAG_READY)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Manually Resuming\n");
+
 		if (ps_start_utt(ps->ps, NULL)) {
 			status = SWITCH_STATUS_GENERR;
 		} else {
-			switch_set_flag(ps, PSFLAG_READY); 
+			switch_set_flag(ps, PSFLAG_READY);
 		}
 	}
-	switch_mutex_unlock(ps->flag_mutex);		
+	switch_mutex_unlock(ps->flag_mutex);
 
 	return status;
 }
@@ -365,7 +360,7 @@
 /*! function to read results from the ASR*/
 static switch_status_t pocketsphinx_asr_get_results(switch_asr_handle_t *ah, char **xmlstr, switch_asr_flag_t *flags)
 {
-	pocketsphinx_t *ps = (pocketsphinx_t *) ah->private_info; 
+	pocketsphinx_t *ps = (pocketsphinx_t *) ah->private_info;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	int32_t conf;
 
@@ -375,7 +370,7 @@
 	}
 
 	if (switch_test_flag(ps, PSFLAG_HAS_TEXT)) {
-		switch_mutex_lock(ps->flag_mutex); 
+		switch_mutex_lock(ps->flag_mutex);
 		switch_clear_flag(ps, PSFLAG_HAS_TEXT);
 		conf = ps_get_prob(ps->ps, &ps->uttid);
 
@@ -386,20 +381,18 @@
 		}
 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Recognized: %s, Confidence: %d\n", ps->hyp, ps->confidence);
-		switch_mutex_unlock(ps->flag_mutex); 
+		switch_mutex_unlock(ps->flag_mutex);
 
 		*xmlstr = switch_mprintf("<?xml version=\"1.0\"?>\n"
 								 "<result grammar=\"%s\">\n"
 								 "  <interpretation grammar=\"%s\" confidence=\"%d\">\n"
 								 "    <input mode=\"speech\">%s</input>\n"
-								 "  </interpretation>\n"
-								 "</result>\n",
-								 ps->grammar, ps->grammar, ps->confidence, ps->hyp);
+								 "  </interpretation>\n" "</result>\n", ps->grammar, ps->grammar, ps->confidence, ps->hyp);
 
 		if (switch_test_flag(ps, SWITCH_ASR_FLAG_AUTO_RESUME)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Auto Resuming\n");
 			switch_set_flag(ps, PSFLAG_READY);
-		
+
 			ps_start_utt(ps->ps, NULL);
 		}
 
@@ -467,7 +460,7 @@
 		globals.language_weight = switch_core_strdup(globals.pool, "6.5");
 	}
 
- done:
+  done:
 	if (xml) {
 		switch_xml_free(xml);
 	}
@@ -495,7 +488,7 @@
 	switch_asr_interface_t *asr_interface;
 
 	switch_mutex_init(&MUTEX, SWITCH_MUTEX_NESTED, pool);
-	
+
 	globals.pool = pool;
 
 	if ((switch_event_bind_removable(modname, SWITCH_EVENT_RELOADXML, NULL, event_handler, NULL, &NODE) != SWITCH_STATUS_SUCCESS)) {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_tts_commandline/mod_tts_commandline.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -76,7 +76,7 @@
 	}
 
 	if (zstr(globals.command)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No command set, please edit %s\n", cf);   
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No command set, please edit %s\n", cf);
 	}
 
 	return SWITCH_STATUS_SUCCESS;
@@ -96,7 +96,7 @@
 	switch_uuid_t uuid;
 	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
 	char outfile[512] = "";
-	
+
 	tts_commandline_t *info = switch_core_alloc(sh->memory_pool, sizeof(*info));
 
 	info->voice_name = switch_core_strdup(sh->memory_pool, voice_name);
@@ -107,11 +107,11 @@
 	switch_uuid_format(uuid_str, &uuid);
 	switch_snprintf(outfile, sizeof(outfile), "%s%s.tmp.wav", SWITCH_GLOBAL_dirs.temp_dir, uuid_str);
 	info->file = switch_core_strdup(sh->memory_pool, outfile);
-	
+
 	info->fh = (switch_file_handle_t *) switch_core_alloc(sh->memory_pool, sizeof(switch_file_handle_t));
-	
+
 	sh->private_info = info;
-  
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -119,47 +119,45 @@
 {
 	tts_commandline_t *info = (tts_commandline_t *) sh->private_info;
 	assert(info != NULL);
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t tts_commandline_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags)
 {
+	char *message, *tmp, *rate;
 	tts_commandline_t *info = (tts_commandline_t *) sh->private_info;
+
 	assert(info != NULL);
 
-	char *message, *tmp, *rate;
-	
 	message = switch_core_strdup(sh->memory_pool, globals.command);
-	
+
 	tmp = switch_util_quote_shell_arg(text);
 	message = switch_string_replace(message, "${text}", tmp);
-	
+
 	tmp = switch_util_quote_shell_arg(info->voice_name);
 	message = switch_string_replace(message, "${voice}", tmp);
-	
+
 	rate = switch_core_sprintf(sh->memory_pool, "%d", info->rate);
 	message = switch_string_replace(message, "${rate}", rate);
-	
+
 	tmp = switch_util_quote_shell_arg(info->file);
 	message = switch_string_replace(message, "${file}", tmp);
-	
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Executing: %s\n", message);
-	
+
 	if (switch_system(message, SWITCH_TRUE) < 0) {
-	   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to execute command: %s\n", message);
-	   return SWITCH_STATUS_FALSE;
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to execute command: %s\n", message);
+		return SWITCH_STATUS_FALSE;
 	}
 
-	if (switch_core_file_open(info->fh,
-							info->file,
-							0, //number_of_channels,
-							0, //samples_per_second,
-							SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
-	   switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open file: %s\n", info->file);
-	   return SWITCH_STATUS_FALSE;
+	if (switch_core_file_open(info->fh, info->file, 0,	//number_of_channels,
+							  0,	//samples_per_second,
+							  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open file: %s\n", info->file);
+		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	sh->private_info = info;
 
 	return SWITCH_STATUS_SUCCESS;
@@ -168,16 +166,16 @@
 static switch_status_t tts_commandline_speech_read_tts(switch_speech_handle_t *sh, void *data, size_t *datalen, switch_speech_flag_t *flags)
 {
 	tts_commandline_t *info = (tts_commandline_t *) sh->private_info;
-	assert(info != NULL);
-	
 	size_t my_datalen = *datalen / 2;
-	
+
+	assert(info != NULL);
+
 	if (switch_core_file_read(info->fh, data, &my_datalen) != SWITCH_STATUS_SUCCESS) {
 		*datalen = my_datalen * 2;
 		return SWITCH_STATUS_FALSE;
 	}
 	*datalen = my_datalen * 2;
-	if(datalen == 0) {
+	if (datalen == 0) {
 		return SWITCH_STATUS_BREAK;
 	} else {
 		return SWITCH_STATUS_SUCCESS;
@@ -188,7 +186,7 @@
 {
 	tts_commandline_t *info = (tts_commandline_t *) sh->private_info;
 	assert(info != NULL);
-	
+
 	switch_core_file_close(info->fh);
 	if (unlink(info->file) != 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Sound file [%s] delete failed\n", info->file);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_unimrcp/Makefile.am (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_unimrcp/Makefile.am	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_unimrcp/Makefile.am	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,26 +1,19 @@
+include $(top_srcdir)/build/modmake.rulesam
+
 MODNAME=mod_unimrcp
 
-AM_CFLAGS   = $(SWITCH_AM_CFLAGS)
-AM_CPPFLAGS = $(SWITCH_AM_CXXFLAGS)
-#AM_LDFLAGS  = $(SWITCH_AM_LDFLAGS)
-#we should set all these vars from configure, no reason to have these in each Makefile.am
-LIBTOOL = echo "`link=\`echo $@|grep .la;echo $@|grep .so;echo $@|grep .dll\`;if test -n "$$link"; then echo Creating $@;fi`";`if test -z "$(VERBOSE)" ; \
-then echo $(SHELL) $(switch_builddir)/quiet_libtool ;else echo $(SHELL) $(switch_builddir)/libtool;  fi`
-AM_MAKEFLAGS=`test -n "$(VERBOSE)" || echo -s`
-# Dirty trick to override the link output
-LIBS+=> $(MODNAME).log || error="yes";if test -n "$(VERBOSE)" -o "$$error" = "yes";then cat $(MODNAME).log;fi;if test "$$error" = "yes";then exit 1;fi
+UNIMRCP_DIR=$(switch_srcdir)/libs/unimrcp
+UNIMRCP_BUILDDIR=$(switch_builddir)/libs/unimrcp
+UNIMRCPLA=$(UNIMRCP_BUILDDIR)/platforms/libunimrcp-client/libunimrcpclient.la
 
-moddir=@modinstdir@
-
-UNIMRCP_DIR=$(switch_builddir)/libs/unimrcp
-UNIMRCPLA=$(UNIMRCP_DIR)/platforms/libunimrcp-client/libunimrcpclient.la
-
 mod_LTLIBRARIES = mod_unimrcp.la
 mod_unimrcp_la_SOURCES = mod_unimrcp.c
 mod_unimrcp_la_CFLAGS  = $(AM_CFLAGS) 
 mod_unimrcp_la_CFLAGS += -I.
 mod_unimrcp_la_CFLAGS += -I$(switch_srcdir)/libs/apr/include
 mod_unimrcp_la_CFLAGS += -I$(switch_srcdir)/libs/apr-util/include
+mod_unimrcp_la_CFLAGS += -I$(switch_builddir)/libs/apr/include
+mod_unimrcp_la_CFLAGS += -I$(switch_builddir)/libs/apr-util/include
 mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/build
 mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/platforms/libunimrcp-client/include
 mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/modules/mrcp-sofiasip/include
@@ -36,7 +29,7 @@
 mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/apr-toolkit/include
 
 mod_unimrcp_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(UNIMRCPLA) $(switch_builddir)/libs/apr/libapr-1.la
-mod_unimrcp_la_LDFLAGS = -avoid-version -module -no-undefined
+mod_unimrcp_la_LDFLAGS = -avoid-version -module -no-undefined -shared
 
 if ISMAC
 mod_unimrcp_la_LDFLAGS += -framework CoreFoundation -framework SystemConfiguration
@@ -45,7 +38,7 @@
 BUILT_SOURCES = $(UNIMRCPLA)
 
 $(UNIMRCPLA): $(UNIMRCP_DIR) $(UNIMRCP_DIR)/.update
-	cd $(UNIMRCP_DIR) && $(MAKE)
+	cd $(UNIMRCP_BUILDDIR) && $(MAKE)
 	$(TOUCH_TARGET)
 
 $(mod_unimrcp_la_SOURCES) : $(BUILT_SOURCES)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -138,7 +138,7 @@
 	const char *srgs_mime_type;
 };
 typedef struct profile profile_t;
-static switch_status_t profile_create(profile_t **profile, const char *name, switch_memory_pool_t *pool);
+static switch_status_t profile_create(profile_t ** profile, const char *name, switch_memory_pool_t *pool);
 
 /* Profile events that may be monitored.  Useful for tracking MRCP profile utilization */
 #define MY_EVENT_PROFILE_CREATE "unimrcp::profile_create"
@@ -149,13 +149,18 @@
  * Defines XML parsing instructions
  */
 static switch_xml_config_item_t instructions[] = {
-	SWITCH_CONFIG_ITEM_STRING_STRDUP("max-connection-count", CONFIG_REQUIRED, &globals.unimrcp_max_connection_count, "100", "", "The max MRCPv2 connections to manage"),
+	SWITCH_CONFIG_ITEM_STRING_STRDUP("max-connection-count", CONFIG_REQUIRED, &globals.unimrcp_max_connection_count, "100", "",
+									 "The max MRCPv2 connections to manage"),
 	/* TODO figure out what this param does */
 	SWITCH_CONFIG_ITEM_STRING_STRDUP("offer-new-connection", CONFIG_REQUIRED, &globals.unimrcp_offer_new_connection, "1", "", ""),
-	SWITCH_CONFIG_ITEM_STRING_STRDUP("default-tts-profile", CONFIG_REQUIRED, &globals.unimrcp_default_synth_profile, "default", "", "The default profile to use for TTS"), 
-	SWITCH_CONFIG_ITEM_STRING_STRDUP("default-asr-profile", CONFIG_REQUIRED, &globals.unimrcp_default_recog_profile, "default", "", "The default profile to use for ASR"),
-	SWITCH_CONFIG_ITEM_STRING_STRDUP("log-level", CONFIG_REQUIRED, &globals.unimrcp_log_level, "WARNING", "EMERGENCY|ALERT|CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG", "Logging level for UniMRCP"),
-	SWITCH_CONFIG_ITEM_STRING_STRDUP("enable-profile-events", CONFIG_REQUIRED, &globals.enable_profile_events_param, "false", "", "Fire profile events (true|false)"),
+	SWITCH_CONFIG_ITEM_STRING_STRDUP("default-tts-profile", CONFIG_REQUIRED, &globals.unimrcp_default_synth_profile, "default", "",
+									 "The default profile to use for TTS"),
+	SWITCH_CONFIG_ITEM_STRING_STRDUP("default-asr-profile", CONFIG_REQUIRED, &globals.unimrcp_default_recog_profile, "default", "",
+									 "The default profile to use for ASR"),
+	SWITCH_CONFIG_ITEM_STRING_STRDUP("log-level", CONFIG_REQUIRED, &globals.unimrcp_log_level, "WARNING",
+									 "EMERGENCY|ALERT|CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG", "Logging level for UniMRCP"),
+	SWITCH_CONFIG_ITEM_STRING_STRDUP("enable-profile-events", CONFIG_REQUIRED, &globals.enable_profile_events_param, "false", "",
+									 "Fire profile events (true|false)"),
 	SWITCH_CONFIG_ITEM_END()
 };
 
@@ -243,7 +248,7 @@
 };
 typedef struct audio_queue audio_queue_t;
 
-static switch_status_t audio_queue_create(audio_queue_t **queue, const char *name, switch_memory_pool_t *pool);
+static switch_status_t audio_queue_create(audio_queue_t ** queue, const char *name, switch_memory_pool_t *pool);
 static switch_status_t audio_queue_write(audio_queue_t *queue, void *data, switch_size_t *data_len);
 static switch_status_t audio_queue_read(audio_queue_t *queue, void *data, switch_size_t *data_len, int block);
 static switch_status_t audio_queue_clear(audio_queue_t *queue);
@@ -308,6 +313,8 @@
 	speech_channel_state_t state;
 	/** UniMRCP <--> FreeSWITCH audio buffer */
 	audio_queue_t *audio_queue;
+	/** True, if channel was opened successfully */
+	int channel_opened;
 	/** rate */
 	uint16_t rate;
 	/** silence sample */
@@ -321,11 +328,14 @@
 
 /* speech channel interface for UniMRCP */
 static apt_bool_t speech_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status);
-static apt_bool_t speech_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status);
-static apt_bool_t speech_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status);
+static apt_bool_t speech_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel,
+										mrcp_sig_status_code_e status);
+static apt_bool_t speech_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel,
+										   mrcp_sig_status_code_e status);
 
 /* speech_channel funcs */
-static switch_status_t speech_channel_create(speech_channel_t **schannel, const char *name, speech_channel_type_t type, mod_unimrcp_application_t *app, uint16_t rate, switch_memory_pool_t *pool);
+static switch_status_t speech_channel_create(speech_channel_t ** schannel, const char *name, speech_channel_type_t type, mod_unimrcp_application_t *app,
+											 uint16_t rate, switch_memory_pool_t *pool);
 static mpf_termination_t *speech_channel_create_mpf_termination(speech_channel_t *schannel);
 static switch_status_t speech_channel_open(speech_channel_t *schannel, profile_t *profile);
 static switch_status_t speech_channel_destroy(speech_channel_t *schannel);
@@ -367,7 +377,8 @@
 
 /* synthesizer specific speech_channel funcs */
 static switch_status_t synth_channel_speak(speech_channel_t *schannel, const char *text);
-static switch_status_t synth_channel_set_params(speech_channel_t *schannel, mrcp_message_t *msg, mrcp_generic_header_t *gen_hdr, mrcp_synth_header_t *synth_hdr);
+static switch_status_t synth_channel_set_params(speech_channel_t *schannel, mrcp_message_t *msg, mrcp_generic_header_t *gen_hdr,
+												mrcp_synth_header_t *synth_hdr);
 static switch_status_t synth_channel_set_header(speech_channel_t *schannel, int id, char *val, mrcp_message_t *msg, mrcp_synth_header_t *synth_hdr);
 
 /*********************************************************************************************************************************************
@@ -405,7 +416,7 @@
 };
 typedef struct grammar grammar_t;
 
-static switch_status_t grammar_create(grammar_t **grammar, const char *name, grammar_type_t type, const char *data, switch_memory_pool_t *pool);
+static switch_status_t grammar_create(grammar_t ** grammar, const char *name, grammar_type_t type, const char *data, switch_memory_pool_t *pool);
 static const char *grammar_type_to_mime(grammar_type_t type, profile_t *profile);
 
 /*********************************************************************************************************************************************
@@ -430,7 +441,7 @@
 typedef struct recognizer_data recognizer_data_t;
 
 static switch_status_t recog_load(switch_loadable_module_interface_t *module_interface, switch_memory_pool_t *pool);
-static switch_status_t recog_shutdown() ;
+static switch_status_t recog_shutdown();
 
 /* recognizer's interface for FreeSWITCH */
 static switch_status_t recog_asr_open(switch_asr_handle_t *ah, const char *codec, int rate, const char *dest, switch_asr_flag_t *flags);
@@ -464,7 +475,8 @@
 static switch_status_t recog_channel_start_input_timers(speech_channel_t *schannel);
 static switch_status_t recog_channel_set_results(speech_channel_t *schannel, const char *results);
 static switch_status_t recog_channel_get_results(speech_channel_t *schannel, char **results);
-static switch_status_t recog_channel_set_params(speech_channel_t *schannel, mrcp_message_t *msg, mrcp_generic_header_t *gen_hdr, mrcp_recog_header_t *recog_hdr);
+static switch_status_t recog_channel_set_params(speech_channel_t *schannel, mrcp_message_t *msg, mrcp_generic_header_t *gen_hdr,
+												mrcp_recog_header_t *recog_hdr);
 static switch_status_t recog_channel_set_header(speech_channel_t *schannel, int id, char *val, mrcp_message_t *msg, mrcp_recog_header_t *recog_hdr);
 static switch_status_t recog_channel_set_timers_started(speech_channel_t *schannel);
 
@@ -476,13 +488,13 @@
  * @param pool the memory pool to use
  * @return SWITCH_STATUS_SUCCESS if the profile is created
  */
-static switch_status_t profile_create(profile_t **profile, const char *name, switch_memory_pool_t *pool)
+static switch_status_t profile_create(profile_t ** profile, const char *name, switch_memory_pool_t *pool)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	profile_t *lprofile = NULL;
 	switch_event_t *event = NULL;
-	
-	lprofile = (profile_t *)switch_core_alloc(pool, sizeof(profile_t));
+
+	lprofile = (profile_t *) switch_core_alloc(pool, sizeof(profile_t));
 	if (lprofile) {
 		lprofile->name = switch_core_strdup(pool, name);
 		lprofile->srgs_mime_type = "application/srgs";
@@ -499,7 +511,7 @@
 		*profile = NULL;
 		status = SWITCH_STATUS_FALSE;
 	}
-	
+
 	return status;
 }
 
@@ -525,7 +537,7 @@
 		/* is there a match? */
 		result = textlen > matchlen && !strncmp(match, text, matchlen);
 	}
-	
+
 	return result;
 }
 
@@ -537,7 +549,7 @@
  * @param pool memory pool to allocate queue from 
  * @return SWITCH_STATUS_SUCCESS if successful.  SWITCH_STATUS_FALSE if unable to allocate queue
  */
-static switch_status_t audio_queue_create(audio_queue_t **audio_queue, const char *name, switch_memory_pool_t *pool)
+static switch_status_t audio_queue_create(audio_queue_t ** audio_queue, const char *name, switch_memory_pool_t *pool)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	audio_queue_t *laudio_queue = NULL;
@@ -553,7 +565,7 @@
 		lname = switch_core_strdup(pool, name);
 	}
 
-	if ((laudio_queue = (audio_queue_t *)switch_core_alloc(pool, sizeof(audio_queue_t))) == NULL) {
+	if ((laudio_queue = (audio_queue_t *) switch_core_alloc(pool, sizeof(audio_queue_t))) == NULL) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) unable to create audio queue\n", lname);
 		status = SWITCH_STATUS_FALSE;
 		goto done;
@@ -565,7 +577,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) unable to create audio queue buffer\n", laudio_queue->name);
 		status = SWITCH_STATUS_FALSE;
 		goto done;
-    }
+	}
 
 	if (switch_mutex_init(&laudio_queue->mutex, SWITCH_MUTEX_UNNESTED, pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) unable to create audio queue mutex\n", laudio_queue->name);
@@ -578,10 +590,9 @@
 		status = SWITCH_STATUS_FALSE;
 		goto done;
 	}
-
 #ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
 	flags = SWITCH_FOPEN_CREATE | SWITCH_FOPEN_WRITE | SWITCH_FOPEN_TRUNCATE | SWITCH_FOPEN_BINARY;
-	strcpy(laudio_queue->file_read_name, "/tmp/mod_unimrcp_rx_XXXXXX");	
+	strcpy(laudio_queue->file_read_name, "/tmp/mod_unimrcp_rx_XXXXXX");
 	if (switch_file_mktemp(&laudio_queue->file_read, laudio_queue->file_read_name, flags, pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) unable to create audio queue read file\n", laudio_queue->name);
 		laudio_queue->file_read = NULL;
@@ -603,9 +614,9 @@
 	*audio_queue = laudio_queue;
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) audio queue created\n", laudio_queue->name);
 
- done:
+  done:
 
-	if(status != SWITCH_STATUS_SUCCESS) {
+	if (status != SWITCH_STATUS_SUCCESS) {
 		audio_queue_destroy(laudio_queue);
 	}
 	return status;
@@ -626,7 +637,7 @@
 
 #ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
 	switch_size_t len = *data_len;
-	if(queue->file_write) {
+	if (queue->file_write) {
 		switch_file_write(queue->file_write, data, &len);
 	}
 #endif
@@ -634,7 +645,8 @@
 	if (switch_buffer_write(queue->buffer, data, *data_len) > 0) {
 		queue->write_bytes = queue->write_bytes + *data_len;
 #ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) audio queue write total = %ld\trequested = %ld\n", queue->name, queue->write_bytes, *data_len);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) audio queue write total = %ld\trequested = %ld\n", queue->name, queue->write_bytes,
+						  *data_len);
 #endif
 		if (queue->waiting <= switch_buffer_inuse(queue->buffer)) {
 			switch_thread_cond_signal(queue->cond);
@@ -674,7 +686,7 @@
 		}
 		queue->waiting = 0;
 	}
-		
+
 	if (switch_buffer_inuse(queue->buffer) < requested) {
 		requested = switch_buffer_inuse(queue->buffer);
 	}
@@ -688,14 +700,15 @@
 	*data_len = switch_buffer_read(queue->buffer, data, requested);
 	queue->read_bytes = queue->read_bytes + *data_len;
 #ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) audio queue read total = %ld\tread = %ld\trequested = %ld\n", queue->name, queue->read_bytes, *data_len, requested);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) audio queue read total = %ld\tread = %ld\trequested = %ld\n", queue->name,
+					  queue->read_bytes, *data_len, requested);
 	switch_size_t len = *data_len;
 	if (queue->file_read) {
 		switch_file_write(queue->file_read, data, &len);
 	}
 #endif
 
- done:
+  done:
 
 	switch_mutex_unlock(queue->mutex);
 	return status;
@@ -766,13 +779,14 @@
  * @param pool the memory pool to use
  * @return SWITCH_STATUS_SUCCESS if successful.  SWITCH_STATUS_FALSE if the channel cannot be allocated.
  */
-static switch_status_t speech_channel_create(speech_channel_t **schannel, const char *name, speech_channel_type_t type, mod_unimrcp_application_t *app, uint16_t rate, switch_memory_pool_t *pool)
+static switch_status_t speech_channel_create(speech_channel_t ** schannel, const char *name, speech_channel_type_t type, mod_unimrcp_application_t *app,
+											 uint16_t rate, switch_memory_pool_t *pool)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	speech_channel_t *schan = NULL;
 	*schannel = NULL;
 
-	if ((schan = (speech_channel_t *)switch_core_alloc(pool, sizeof(speech_channel_t))) == NULL) {
+	if ((schan = (speech_channel_t *) switch_core_alloc(pool, sizeof(speech_channel_t))) == NULL) {
 		status = SWITCH_STATUS_FALSE;
 		goto done;
 	}
@@ -783,9 +797,10 @@
 	schan->memory_pool = pool;
 	schan->params = NULL;
 	schan->rate = rate;
-	schan->silence = 0; /* L16 silence sample */
+	schan->silence = 0;			/* L16 silence sample */
+	schan->channel_opened = 0;
 
-	if (switch_mutex_init(&schan->mutex, SWITCH_MUTEX_UNNESTED, pool) != SWITCH_STATUS_SUCCESS || 
+	if (switch_mutex_init(&schan->mutex, SWITCH_MUTEX_UNNESTED, pool) != SWITCH_STATUS_SUCCESS ||
 		switch_thread_cond_create(&schan->cond, pool) != SWITCH_STATUS_SUCCESS ||
 		audio_queue_create(&schan->audio_queue, name, pool) != SWITCH_STATUS_SUCCESS) {
 		status = SWITCH_STATUS_FALSE;
@@ -800,7 +815,7 @@
 	}
 	*schannel = schan;
 
- done:
+  done:
 
 	return status;
 }
@@ -816,8 +831,8 @@
 	/* destroy the channel and session if not already done */
 	switch_mutex_lock(schannel->mutex);
 	if (schannel->state != SPEECH_CHANNEL_CLOSED) {
-		mrcp_application_channel_remove(schannel->unimrcp_session, schannel->unimrcp_channel);
-		while(schannel->state != SPEECH_CHANNEL_CLOSED) {
+		mrcp_application_session_terminate(schannel->unimrcp_session);
+		while (schannel->state != SPEECH_CHANNEL_CLOSED) {
 			if (switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC) == SWITCH_STATUS_TIMEOUT) {
 				break;
 			}
@@ -864,7 +879,8 @@
 		sample_rates = MPF_SAMPLE_RATE_8000;
 	}
 	mpf_codec_capabilities_add(&capabilities->codecs, sample_rates, "LPCM");
-	termination = mrcp_application_audio_termination_create(schannel->unimrcp_session, &schannel->application->audio_stream_vtable, capabilities, schannel);
+	termination =
+		mrcp_application_audio_termination_create(schannel->unimrcp_session, &schannel->application->audio_stream_vtable, capabilities, schannel);
 
 	return termination;
 }
@@ -873,20 +889,21 @@
 {
 	mpf_termination_t *termination = NULL;
 	mpf_codec_descriptor_t *codec = NULL;
-	codec = (mpf_codec_descriptor_t *)apr_palloc(schannel->unimrcp_session->pool, sizeof(mpf_codec_descriptor_t));
+	codec = (mpf_codec_descriptor_t *) apr_palloc(schannel->unimrcp_session->pool, sizeof(mpf_codec_descriptor_t));
 	mpf_codec_descriptor_init(codec);
 	codec->channel_count = 1;
 	codec->payload_type = 96;
 	codec->sampling_rate = schannel->rate;
-	apt_string_set(&codec->name, "LPCM"); /* "LPCM" is UniMRCP's name for L16 host byte ordered */
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) requesting codec LPCM/%d/%d\n", schannel->name, codec->payload_type, codec->sampling_rate);
+	apt_string_set(&codec->name, "LPCM");	/* "LPCM" is UniMRCP's name for L16 host byte ordered */
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) requesting codec LPCM/%d/%d\n", schannel->name, codec->payload_type,
+					  codec->sampling_rate);
 
 	if (schannel->type == SPEECH_CHANNEL_SYNTHESIZER) {
 		termination = mrcp_application_sink_termination_create(schannel->unimrcp_session, &schannel->application->audio_stream_vtable, codec, schannel);
 	} else {
 		termination = mrcp_application_source_termination_create(schannel->unimrcp_session, &schannel->application->audio_stream_vtable, codec, schannel);
 	}
-	
+
 	return termination;
 }
 #endif
@@ -905,7 +922,7 @@
 	mrcp_resource_type_e resource_type;
 
 	switch_mutex_lock(schannel->mutex);
-	
+
 	/* make sure we can open channel */
 	if (schannel->state != SPEECH_CHANNEL_CLOSED) {
 		status = SWITCH_STATUS_FALSE;
@@ -915,13 +932,13 @@
 	schannel->profile = profile;
 
 	/* create MRCP session */
-	if ((schannel->unimrcp_session = mrcp_application_session_create(schannel->application->app, profile->name, schannel)) == NULL) {	
+	if ((schannel->unimrcp_session = mrcp_application_session_create(schannel->application->app, profile->name, schannel)) == NULL) {
 		/* profile doesn't exist? */
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Unable to create session with %s\n", schannel->name, profile->name);
 		status = SWITCH_STATUS_RESTART;
 		goto done;
 	}
-	
+
 	/* create audio termination and add to channel */
 	if ((termination = speech_channel_create_mpf_termination(schannel)) == NULL) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Unable to create termination with %s\n", schannel->name, profile->name);
@@ -957,14 +974,13 @@
 	}
 	if (schannel->state == SPEECH_CHANNEL_READY) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) channel is ready\n", schannel->name);
-	}
-	else if (schannel->state == SPEECH_CHANNEL_CLOSED) {
+	} else if (schannel->state == SPEECH_CHANNEL_CLOSED) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Timed out waiting for channel to be ready\n", schannel->name);
 		/* can't retry */
 		status = SWITCH_STATUS_FALSE;
 	} else if (schannel->state == SPEECH_CHANNEL_ERROR) {
 		/* Wait for session to be cleaned up */
-		while(schannel->state == SPEECH_CHANNEL_ERROR) {
+		while (schannel->state == SPEECH_CHANNEL_ERROR) {
 			if (switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC) == SWITCH_STATUS_TIMEOUT) {
 				break;
 			}
@@ -978,7 +994,7 @@
 		}
 	}
 
- done:
+  done:
 
 	switch_mutex_unlock(schannel->mutex);
 	return status;
@@ -1012,7 +1028,7 @@
 	}
 
 	/* set generic header fields (content-type) */
-	if ((generic_header = (mrcp_generic_header_t *)mrcp_generic_header_prepare(mrcp_message)) == NULL) {	
+	if ((generic_header = (mrcp_generic_header_t *) mrcp_generic_header_prepare(mrcp_message)) == NULL) {
 		status = SWITCH_STATUS_FALSE;
 		goto done;
 	}
@@ -1026,7 +1042,7 @@
 	mrcp_generic_header_property_add(mrcp_message, GENERIC_HEADER_CONTENT_TYPE);
 
 	/* set synthesizer header fields (voice, rate, etc.) */
-	if ((synth_header = (mrcp_synth_header_t *)mrcp_resource_header_prepare(mrcp_message)) == NULL) {
+	if ((synth_header = (mrcp_synth_header_t *) mrcp_resource_header_prepare(mrcp_message)) == NULL) {
 		status = SWITCH_STATUS_FALSE;
 		goto done;
 	}
@@ -1054,7 +1070,7 @@
 		goto done;
 	}
 
- done:
+  done:
 
 	switch_mutex_unlock(schannel->mutex);
 	return status;
@@ -1069,7 +1085,8 @@
  * @param synth_hdr the synthesizer headers to set
  * @return SWITCH_STATUS_SUCCESS
  */
-static switch_status_t synth_channel_set_params(speech_channel_t *schannel, mrcp_message_t *msg, mrcp_generic_header_t *gen_hdr, mrcp_synth_header_t *synth_hdr)
+static switch_status_t synth_channel_set_params(speech_channel_t *schannel, mrcp_message_t *msg, mrcp_generic_header_t *gen_hdr,
+												mrcp_synth_header_t *synth_hdr)
 {
 	/* loop through each param and add to synth header or vendor-specific-params */
 	switch_hash_index_t *hi = NULL;
@@ -1078,10 +1095,10 @@
 		const void *key;
 		void *val;
 		switch_hash_this(hi, &key, NULL, &val);
-		param_name = (char *)key;
-		param_val = (char *)val;
+		param_name = (char *) key;
+		param_val = (char *) val;
 		if (!zstr(param_name) && !zstr(param_val)) {
-			unimrcp_param_id_t *id = (unimrcp_param_id_t *)switch_core_hash_find(schannel->application->param_id_map, param_name);
+			unimrcp_param_id_t *id = (unimrcp_param_id_t *) switch_core_hash_find(schannel->application->param_id_map, param_name);
 			if (id) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) %s: %s\n", schannel->name, param_name, param_val);
 				synth_channel_set_header(schannel, id->id, param_val, msg, synth_hdr);
@@ -1091,7 +1108,7 @@
 
 				/* this is probably a vendor-specific MRCP param */
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) (vendor-specific value) %s: %s\n", schannel->name, param_name, param_val);
-				apt_string_set(&apt_param_name, param_name); /* copy isn't necessary since apt_pair_array_append will do it */
+				apt_string_set(&apt_param_name, param_name);	/* copy isn't necessary since apt_pair_array_append will do it */
 				apt_string_set(&apt_param_val, param_val);
 				if (!gen_hdr->vendor_specific_params) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) creating vendor specific pair array\n", schannel->name);
@@ -1101,7 +1118,7 @@
 			}
 		}
 	}
-	
+
 	if (gen_hdr->vendor_specific_params) {
 		mrcp_generic_header_property_add(msg, GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS);
 	}
@@ -1136,27 +1153,27 @@
 		mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_VOICE_GENDER);
 		break;
 
-	case SYNTHESIZER_HEADER_VOICE_AGE: {
-		int age = atoi(val);
-		if (age > 0 && age < 1000) {
-			synth_hdr->voice_param.age = age;
-			mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_VOICE_AGE);
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) ignoring invalid voice age, %s\n", schannel->name, val);
+	case SYNTHESIZER_HEADER_VOICE_AGE:{
+			int age = atoi(val);
+			if (age > 0 && age < 1000) {
+				synth_hdr->voice_param.age = age;
+				mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_VOICE_AGE);
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) ignoring invalid voice age, %s\n", schannel->name, val);
+			}
+			break;
 		}
-		break;
-	}
 
-	case SYNTHESIZER_HEADER_VOICE_VARIANT: {
-		int variant = atoi(val);
-		if (variant > 0) {
-			synth_hdr->voice_param.variant = variant;
-			mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_VOICE_VARIANT);
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) ignoring invalid voice variant, %s\n", schannel->name, val);
+	case SYNTHESIZER_HEADER_VOICE_VARIANT:{
+			int variant = atoi(val);
+			if (variant > 0) {
+				synth_hdr->voice_param.variant = variant;
+				mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_VOICE_VARIANT);
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) ignoring invalid voice variant, %s\n", schannel->name, val);
+			}
+			break;
 		}
-		break;
-	}
 
 	case SYNTHESIZER_HEADER_VOICE_NAME:
 		apt_string_assign(&synth_hdr->voice_param.name, val, msg->pool);
@@ -1171,10 +1188,10 @@
 	case SYNTHESIZER_HEADER_PROSODY_VOLUME:
 		if (switch_isdigit(*val) || *val == '.') {
 			synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_NUMERIC;
-			synth_hdr->prosody_param.volume.value.numeric = (float)atof(val);
+			synth_hdr->prosody_param.volume.value.numeric = (float) atof(val);
 		} else if (*val == '+' || *val == '-') {
 			synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_RELATIVE_CHANGE;
-			synth_hdr->prosody_param.volume.value.relative = (float)atof(val);
+			synth_hdr->prosody_param.volume.value.relative = (float) atof(val);
 		} else if (!strcasecmp("silent", val)) {
 			synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL;
 			synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_SILENT;
@@ -1206,7 +1223,7 @@
 	case SYNTHESIZER_HEADER_PROSODY_RATE:
 		if (switch_isdigit(*val) || *val == '.') {
 			synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_RELATIVE_CHANGE;
-			synth_hdr->prosody_param.rate.value.relative = (float)atof(val);
+			synth_hdr->prosody_param.rate.value.relative = (float) atof(val);
 		} else if (!strcasecmp("x-slow", val)) {
 			synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_LABEL;
 			synth_hdr->prosody_param.rate.value.label = PROSODY_RATE_XSLOW;
@@ -1237,7 +1254,7 @@
 		mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_SPEECH_LANGUAGE);
 		break;
 
-	/* unsupported by this module */
+		/* unsupported by this module */
 	case SYNTHESIZER_HEADER_JUMP_SIZE:
 	case SYNTHESIZER_HEADER_SPEAKER_PROFILE:
 	case SYNTHESIZER_HEADER_COMPLETION_CAUSE:
@@ -1263,7 +1280,7 @@
  * 
  * @param schannel the channel
  * @return SWITCH_STATUS_SUCCESS if successful
- */ 
+ */
 static switch_status_t speech_channel_stop(speech_channel_t *schannel)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -1276,7 +1293,7 @@
 			method = SYNTHESIZER_STOP;
 		} else {
 			method = RECOGNIZER_STOP;
-		} 
+		}
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Stopping %s\n", schannel->name, speech_channel_type_to_string(schannel->type));
 		/* Send STOP to MRCP server */
 		mrcp_message = mrcp_application_message_create(schannel->unimrcp_session, schannel->unimrcp_channel, method);
@@ -1306,7 +1323,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) %s stopped\n", schannel->name, speech_channel_type_to_string(schannel->type));
 	}
 
- done:
+  done:
 
 	switch_mutex_unlock(schannel->mutex);
 	return status;
@@ -1320,9 +1337,11 @@
  */
 static const char *speech_channel_type_to_string(speech_channel_type_t type)
 {
-	switch(type) {
-		case SPEECH_CHANNEL_SYNTHESIZER: return "SYNTHESIZER";
-		case SPEECH_CHANNEL_RECOGNIZER: return "RECOGNIZER";
+	switch (type) {
+	case SPEECH_CHANNEL_SYNTHESIZER:
+		return "SYNTHESIZER";
+	case SPEECH_CHANNEL_RECOGNIZER:
+		return "RECOGNIZER";
 	}
 
 	return "UNKNOWN";
@@ -1406,13 +1425,17 @@
  * @param state the channel state
  * @return string representation of the state
  */
-static const char *speech_channel_state_to_string(speech_channel_state_t state) 
+static const char *speech_channel_state_to_string(speech_channel_state_t state)
 {
-	switch(state) {
-		case SPEECH_CHANNEL_CLOSED: return "CLOSED";
-		case SPEECH_CHANNEL_READY: return "READY";
-		case SPEECH_CHANNEL_PROCESSING: return "PROCESSING";
-		case SPEECH_CHANNEL_ERROR: return "ERROR";
+	switch (state) {
+	case SPEECH_CHANNEL_CLOSED:
+		return "CLOSED";
+	case SPEECH_CHANNEL_READY:
+		return "READY";
+	case SPEECH_CHANNEL_PROCESSING:
+		return "PROCESSING";
+	case SPEECH_CHANNEL_ERROR:
+		return "ERROR";
 	}
 
 	return "UNKNOWN";
@@ -1446,10 +1469,11 @@
 {
 	if (schannel->state == SPEECH_CHANNEL_PROCESSING && state != SPEECH_CHANNEL_PROCESSING) {
 		/* wake anyone waiting for audio data */
-		audio_queue_clear(schannel->audio_queue);	
+		audio_queue_clear(schannel->audio_queue);
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) %s ==> %s\n", schannel->name, speech_channel_state_to_string(schannel->state), speech_channel_state_to_string(state));
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) %s ==> %s\n", schannel->name, speech_channel_state_to_string(schannel->state),
+					  speech_channel_state_to_string(state));
 	schannel->state = state;
 	switch_thread_cond_signal(schannel->cond);
 	return SWITCH_STATUS_SUCCESS;
@@ -1474,17 +1498,18 @@
 	profile_t *profile = NULL;
 	int speech_channel_number = get_next_speech_channel_number();
 	char name[200] = { 0 };
-	
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "speech_handle: name = %s, rate = %d, speed = %d, samples = %d, voice = %s, engine = %s, param = %s\n",
-						sh->name, sh->rate, sh->speed, sh->samples, sh->voice, sh->engine, sh->param); 
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
+					  "speech_handle: name = %s, rate = %d, speed = %d, samples = %d, voice = %s, engine = %s, param = %s\n", sh->name, sh->rate,
+					  sh->speed, sh->samples, sh->voice, sh->engine, sh->param);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "voice = %s, rate = %d\n", voice_name, rate);
 
 	/* It would be nice if FreeSWITCH let us know which session owns this handle, but it doesn't.  So, lets
-		make our own unique name */
+	   make our own unique name */
 	switch_snprintf(name, sizeof(name) - 1, "TTS-%d", speech_channel_number);
 	name[sizeof(name) - 1] = '\0';
-	
-	if (speech_channel_create(&schannel, name, SPEECH_CHANNEL_SYNTHESIZER, &globals.synth, (uint16_t)rate, sh->memory_pool) != SWITCH_STATUS_SUCCESS) {
+
+	if (speech_channel_create(&schannel, name, SPEECH_CHANNEL_SYNTHESIZER, &globals.synth, (uint16_t) rate, sh->memory_pool) != SWITCH_STATUS_SUCCESS) {
 		status = SWITCH_STATUS_FALSE;
 		goto done;
 	}
@@ -1494,7 +1519,7 @@
 	if (zstr(profile_name)) {
 		profile_name = globals.unimrcp_default_synth_profile;
 	}
-	profile = (profile_t *)switch_core_hash_find(globals.profiles, profile_name);
+	profile = (profile_t *) switch_core_hash_find(globals.profiles, profile_name);
 	if (!profile) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Can't find profile, %s\n", name, profile_name);
 		status = SWITCH_STATUS_FALSE;
@@ -1509,7 +1534,7 @@
 		speech_channel_set_param(schannel, "Voice-Name", voice_name);
 	}
 
- done:
+  done:
 
 	return status;
 }
@@ -1524,7 +1549,7 @@
  */
 static switch_status_t synth_speech_close(switch_speech_handle_t *sh, switch_speech_flag_t *flags)
 {
-	speech_channel_t *schannel = (speech_channel_t *)sh->private_info;
+	speech_channel_t *schannel = (speech_channel_t *) sh->private_info;
 	speech_channel_stop(schannel);
 	speech_channel_destroy(schannel);
 	return SWITCH_STATUS_SUCCESS;
@@ -1542,8 +1567,8 @@
 static switch_status_t synth_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	speech_channel_t *schannel = (speech_channel_t *)sh->private_info;
-	
+	speech_channel_t *schannel = (speech_channel_t *) sh->private_info;
+
 	if (zstr(text)) {
 		status = SWITCH_STATUS_FALSE;
 	} else {
@@ -1574,7 +1599,7 @@
 #ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) adding %ld bytes of padding\n", schannel->name, *datalen - bytes_read);
 #endif
-			memset((uint8_t *)data + bytes_read, schannel->silence, *datalen - bytes_read);
+			memset((uint8_t *) data + bytes_read, schannel->silence, *datalen - bytes_read);
 		}
 	} else {
 		*datalen = 0;
@@ -1595,7 +1620,7 @@
  */
 static void synth_speech_flush_tts(switch_speech_handle_t *sh)
 {
-	speech_channel_t *schannel = (speech_channel_t *)sh->private_info;
+	speech_channel_t *schannel = (speech_channel_t *) sh->private_info;
 	speech_channel_stop(schannel);
 }
 
@@ -1609,7 +1634,7 @@
  */
 static void synth_speech_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val)
 {
-	speech_channel_t *schannel = (speech_channel_t *)sh->private_info;
+	speech_channel_t *schannel = (speech_channel_t *) sh->private_info;
 	speech_channel_set_param(schannel, param, val);
 }
 
@@ -1623,7 +1648,7 @@
  */
 static void synth_speech_numeric_param_tts(switch_speech_handle_t *sh, char *param, int val)
 {
-	speech_channel_t *schannel = (speech_channel_t *)sh->private_info;
+	speech_channel_t *schannel = (speech_channel_t *) sh->private_info;
 	char *val_str = switch_mprintf("%d", val);
 	speech_channel_set_param(schannel, param, val_str);
 	switch_safe_free(val_str);
@@ -1639,7 +1664,7 @@
  */
 static void synth_speech_float_param_tts(switch_speech_handle_t *sh, char *param, double val)
 {
-	speech_channel_t *schannel = (speech_channel_t *)sh->private_info;
+	speech_channel_t *schannel = (speech_channel_t *) sh->private_info;
 	char *val_str = switch_mprintf("%f", val);
 	speech_channel_set_param(schannel, param, val_str);
 	switch_safe_free(val_str);
@@ -1666,9 +1691,25 @@
  */
 static apt_bool_t speech_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status)
 {
-	speech_channel_t *schannel = (speech_channel_t *)mrcp_application_session_object_get(session);
+	speech_channel_t *schannel = (speech_channel_t *) mrcp_application_session_object_get(session);
+	switch_event_t *event = NULL;
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Destroying MRCP session\n", schannel->name);
 	mrcp_application_session_destroy(session);
+
+	/* notify of channel close */
+	if (schannel->channel_opened && globals.enable_profile_events) {
+		switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_PROFILE_CLOSE);
+		if (event) {
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MRCP-Profile", schannel->profile->name);
+			if (schannel->type == SPEECH_CHANNEL_SYNTHESIZER) {
+				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MRCP-Resource-Type", "TTS");
+			} else {
+				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MRCP-Resource-Type", "ASR");
+			}
+			switch_event_fire(&event);
+		}
+	}
+
 	speech_channel_set_state(schannel, SPEECH_CHANNEL_CLOSED);
 
 	return TRUE;
@@ -1683,10 +1724,11 @@
  * @param status the result of the channel add request
  * @return TRUE
  */
-static apt_bool_t speech_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status)
+static apt_bool_t speech_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel,
+										mrcp_sig_status_code_e status)
 {
 	switch_event_t *event = NULL;
-	speech_channel_t *schannel =  (speech_channel_t *)mrcp_application_channel_object_get(channel);
+	speech_channel_t *schannel = (speech_channel_t *) mrcp_application_channel_object_get(channel);
 
 	/* check status */
 	if (session && schannel && status == MRCP_SIG_STATUS_CODE_SUCCESS) {
@@ -1695,7 +1737,7 @@
 		const mpf_codec_descriptor_t *descriptor;
 		/* what sample rate did we negotiate? */
 		if (schannel->type == SPEECH_CHANNEL_SYNTHESIZER) {
- 			descriptor = mrcp_application_sink_descriptor_get(channel);
+			descriptor = mrcp_application_sink_descriptor_get(channel);
 		} else {
 			descriptor = mrcp_application_source_descriptor_get(channel);
 		}
@@ -1703,10 +1745,12 @@
 		if (descriptor->name.length) {
 			strncpy(codec_name, descriptor->name.buf, sizeof(codec_name));
 		}
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) %s channel is ready, codec = %s, sample rate = %d\n", schannel->name, speech_channel_type_to_string(schannel->type), codec_name, schannel->rate);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) %s channel is ready, codec = %s, sample rate = %d\n", schannel->name,
+						  speech_channel_type_to_string(schannel->type), codec_name, schannel->rate);
 #else
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) %s channel is ready\n", schannel->name, speech_channel_type_to_string(schannel->type));
-#endif	
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) %s channel is ready\n", schannel->name,
+						  speech_channel_type_to_string(schannel->type));
+#endif
 		speech_channel_set_state(schannel, SPEECH_CHANNEL_READY);
 		/* notify of channel open */
 		if (globals.enable_profile_events && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_PROFILE_OPEN) == SWITCH_STATUS_SUCCESS) {
@@ -1718,9 +1762,11 @@
 			}
 			switch_event_fire(&event);
 		}
+		schannel->channel_opened = 1;
 	} else {
 		if (schannel) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) %s channel error!\n", schannel->name, speech_channel_type_to_string(schannel->type));
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) %s channel error!\n", schannel->name,
+							  speech_channel_type_to_string(schannel->type));
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(unknown) channel error!\n");
 		}
@@ -1743,27 +1789,13 @@
  * @param status the result of the channel remove request
  * @return TRUE
  */
-static apt_bool_t speech_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status)
+static apt_bool_t speech_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel,
+										   mrcp_sig_status_code_e status)
 {
-	switch_event_t *event = NULL;
-	speech_channel_t *schannel = (speech_channel_t *)mrcp_application_channel_object_get(channel);
+	speech_channel_t *schannel = (speech_channel_t *) mrcp_application_channel_object_get(channel);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "(%s) %s channel is removed\n", schannel->name, speech_channel_type_to_string(schannel->type));
 	schannel->unimrcp_channel = NULL;
 
-	/* notify of channel close */
-	if (globals.enable_profile_events) {
-		switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_PROFILE_CLOSE);
-		if (event) {
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MRCP-Profile", schannel->profile->name);
-			if (schannel->type == SPEECH_CHANNEL_SYNTHESIZER) {
-				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MRCP-Resource-Type", "TTS");
-			} else {
-				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MRCP-Resource-Type", "ASR");
-			}
-			switch_event_fire(&event);
-		}
-	}
-
 	if (session) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Terminating MRCP session\n", schannel->name);
 		mrcp_application_session_terminate(session);
@@ -1783,7 +1815,7 @@
  */
 static apt_bool_t synth_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
 {
-	speech_channel_t *schannel = (speech_channel_t *)mrcp_application_channel_object_get(channel);
+	speech_channel_t *schannel = (speech_channel_t *) mrcp_application_channel_object_get(channel);
 	if (message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
 		/* received MRCP response */
 		if (message->start_line.method_id == SYNTHESIZER_SPEAK) {
@@ -1794,7 +1826,8 @@
 				speech_channel_set_state(schannel, SPEECH_CHANNEL_PROCESSING);
 			} else {
 				/* received unexpected request_state */
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected SPEAK response, request_state = %d\n", schannel->name, message->start_line.request_state);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected SPEAK response, request_state = %d\n", schannel->name,
+								  message->start_line.request_state);
 				speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
 			}
 		} else if (message->start_line.method_id == SYNTHESIZER_STOP) {
@@ -1805,12 +1838,14 @@
 				speech_channel_set_state(schannel, SPEECH_CHANNEL_READY);
 			} else {
 				/* received unexpected request state */
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected STOP response, request_state = %d\n", schannel->name, message->start_line.request_state);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected STOP response, request_state = %d\n", schannel->name,
+								  message->start_line.request_state);
 				speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
 			}
 		} else {
 			/* received unexpected response */
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected response, method_id = %d\n", schannel->name, (int)message->start_line.method_id);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected response, method_id = %d\n", schannel->name,
+							  (int) message->start_line.method_id);
 			speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
 		}
 	} else if (message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
@@ -1820,11 +1855,13 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) SPEAK-COMPLETE\n", schannel->name);
 			speech_channel_set_state(schannel, SPEECH_CHANNEL_READY);
 		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected event, method_id = %d\n", schannel->name, (int)message->start_line.method_id);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected event, method_id = %d\n", schannel->name,
+							  (int) message->start_line.method_id);
 			speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
 		}
 	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected message type, message_type = %d\n", schannel->name, message->start_line.message_type);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected message type, message_type = %d\n", schannel->name,
+						  message->start_line.message_type);
 		speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
 	}
 
@@ -1841,7 +1878,7 @@
 static apt_bool_t synth_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame)
 {
 	switch_size_t size = frame->codec_frame.size;
-	speech_channel_t *schannel = (speech_channel_t *)stream->obj;
+	speech_channel_t *schannel = (speech_channel_t *) stream->obj;
 	speech_channel_write(schannel, frame->codec_frame.buffer, &size);
 	return TRUE;
 }
@@ -1857,7 +1894,7 @@
 {
 	/* link to FreeSWITCH ASR / TTS callbacks */
 	switch_speech_interface_t *speech_interface = NULL;
-	if ((speech_interface = (switch_speech_interface_t *)switch_loadable_module_create_interface(module_interface, SWITCH_SPEECH_INTERFACE)) == NULL) {
+	if ((speech_interface = (switch_speech_interface_t *) switch_loadable_module_create_interface(module_interface, SWITCH_SPEECH_INTERFACE)) == NULL) {
 		return SWITCH_STATUS_FALSE;
 	}
 	speech_interface->interface_name = MOD_UNIMRCP;
@@ -1871,7 +1908,7 @@
 	speech_interface->speech_float_param_tts = synth_speech_float_param_tts;
 
 	/* Create the synthesizer application and link its callbacks to UniMRCP */
-	if ((globals.synth.app = mrcp_application_create(synth_message_handler, (void *)0, pool)) == NULL) {
+	if ((globals.synth.app = mrcp_application_create(synth_message_handler, (void *) 0, pool)) == NULL) {
 		return SWITCH_STATUS_FALSE;
 	}
 	globals.synth.dispatcher.on_session_update = NULL;
@@ -1884,7 +1921,7 @@
 	globals.synth.audio_stream_vtable.close_rx = NULL;
 	globals.synth.audio_stream_vtable.read_frame = NULL;
 	globals.synth.audio_stream_vtable.open_tx = NULL;
-	globals.synth.audio_stream_vtable.close_tx =  NULL;
+	globals.synth.audio_stream_vtable.close_tx = NULL;
 	globals.synth.audio_stream_vtable.write_frame = synth_stream_write;
 	mrcp_client_application_register(globals.mrcp_client, globals.synth.app, "synth");
 
@@ -1924,7 +1961,7 @@
  *
  * @return SWITCH_STATUS_SUCCESS
  */
-static switch_status_t synth_shutdown() 
+static switch_status_t synth_shutdown()
 {
 	if (globals.synth.fs_param_map) {
 		switch_core_hash_destroy(&globals.synth.fs_param_map);
@@ -1945,10 +1982,10 @@
  * @param pool memory pool to allocate from
  * @return SWITCH_STATUS_SUCCESS if successful
  */
-static switch_status_t grammar_create(grammar_t **grammar, const char *name, grammar_type_t type, const char *data, switch_memory_pool_t *pool)
+static switch_status_t grammar_create(grammar_t ** grammar, const char *name, grammar_type_t type, const char *data, switch_memory_pool_t *pool)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	grammar_t *g = (grammar_t *)switch_core_alloc(pool, sizeof(grammar_t));
+	grammar_t *g = (grammar_t *) switch_core_alloc(pool, sizeof(grammar_t));
 	if (g == NULL) {
 		status = SWITCH_STATUS_FALSE;
 		*grammar = NULL;
@@ -1970,13 +2007,19 @@
  */
 static const char *grammar_type_to_mime(grammar_type_t type, profile_t *profile)
 {
-	switch(type) {
-		case GRAMMAR_TYPE_UNKNOWN: return "";
-		case GRAMMAR_TYPE_URI: return "text/uri-list";
-		case GRAMMAR_TYPE_SRGS: return profile->srgs_mime_type;
-		case GRAMMAR_TYPE_SRGS_XML: return profile->srgs_xml_mime_type;
-		case GRAMMAR_TYPE_NUANCE_GSL: return profile->gsl_mime_type;
-		case GRAMMAR_TYPE_JSGF: return profile->jsgf_mime_type;
+	switch (type) {
+	case GRAMMAR_TYPE_UNKNOWN:
+		return "";
+	case GRAMMAR_TYPE_URI:
+		return "text/uri-list";
+	case GRAMMAR_TYPE_SRGS:
+		return profile->srgs_mime_type;
+	case GRAMMAR_TYPE_SRGS_XML:
+		return profile->srgs_xml_mime_type;
+	case GRAMMAR_TYPE_NUANCE_GSL:
+		return profile->gsl_mime_type;
+	case GRAMMAR_TYPE_JSGF:
+		return profile->jsgf_mime_type;
 	}
 	return "";
 }
@@ -2009,19 +2052,19 @@
 		status = SWITCH_STATUS_FALSE;
 		goto done;
 	}
-	r = (recognizer_data_t *)schannel->data;
+	r = (recognizer_data_t *) schannel->data;
 	r->result = NULL;
 	r->start_of_input = 0;
 
 	/* input timers are started by default unless the start-input-timers=false param is set */
-	start_input_timers = (char *)switch_core_hash_find(schannel->params, "start-input-timers");
+	start_input_timers = (char *) switch_core_hash_find(schannel->params, "start-input-timers");
 	r->timers_started = zstr(start_input_timers) || strcasecmp(start_input_timers, "false");
-	
+
 	/* get the cached grammar */
 	if (zstr(name)) {
 		grammar = r->last_grammar;
 	} else {
-		grammar = (grammar_t *)switch_core_hash_find(r->grammars, name);
+		grammar = (grammar_t *) switch_core_hash_find(r->grammars, name);
 		r->last_grammar = grammar;
 	}
 	if (grammar == NULL) {
@@ -2042,7 +2085,7 @@
 	}
 
 	/* allocate generic header */
-	generic_header = (mrcp_generic_header_t *)mrcp_generic_header_prepare(mrcp_message);
+	generic_header = (mrcp_generic_header_t *) mrcp_generic_header_prepare(mrcp_message);
 	if (generic_header == NULL) {
 		status = SWITCH_STATUS_FALSE;
 		goto done;
@@ -2064,14 +2107,14 @@
 	}
 
 	/* allocate recognizer-specific header */
-	recog_header = (mrcp_recog_header_t *)mrcp_resource_header_prepare(mrcp_message);
+	recog_header = (mrcp_recog_header_t *) mrcp_resource_header_prepare(mrcp_message);
 	if (recog_header == NULL) {
 		status = SWITCH_STATUS_FALSE;
 		goto done;
 	}
 
 	/* set Cancel-If-Queue */
-	if (mrcp_message->start_line.version == MRCP_VERSION_2) {	
+	if (mrcp_message->start_line.version == MRCP_VERSION_2) {
 		recog_header->cancel_if_queue = FALSE;
 		mrcp_resource_header_property_add(mrcp_message, RECOGNIZER_HEADER_CANCEL_IF_QUEUE);
 	}
@@ -2099,7 +2142,7 @@
 		goto done;
 	}
 
- done:
+  done:
 
 	switch_mutex_unlock(schannel->mutex);
 	return status;
@@ -2140,9 +2183,9 @@
 			status = SWITCH_STATUS_FALSE;
 			goto done;
 		}
-	
+
 		/* set Content-Type and Content-ID in message */
-		generic_header = (mrcp_generic_header_t *)mrcp_generic_header_prepare(mrcp_message);
+		generic_header = (mrcp_generic_header_t *) mrcp_generic_header_prepare(mrcp_message);
 		if (generic_header == NULL) {
 			status = SWITCH_STATUS_FALSE;
 			goto done;
@@ -2156,7 +2199,7 @@
 		mrcp_generic_header_property_add(mrcp_message, GENERIC_HEADER_CONTENT_TYPE);
 		apt_string_assign(&generic_header->content_id, name, mrcp_message->pool);
 		mrcp_generic_header_property_add(mrcp_message, GENERIC_HEADER_CONTENT_ID);
-	
+
 		/* put grammar in message body */
 		apt_string_assign(&mrcp_message->body, data, mrcp_message->pool);
 
@@ -2185,12 +2228,12 @@
 
 	/* Create the grammar and save it */
 	if ((status = grammar_create(&g, name, type, data, schannel->memory_pool)) == SWITCH_STATUS_SUCCESS) {
-		recognizer_data_t *r = (recognizer_data_t *)schannel->data;
+		recognizer_data_t *r = (recognizer_data_t *) schannel->data;
 		switch_core_hash_insert(r->grammars, g->name, g);
 	}
 
- done:
-	
+  done:
+
 	switch_mutex_unlock(schannel->mutex);
 	switch_safe_free(ldata);
 
@@ -2211,7 +2254,7 @@
 	if (zstr(grammar_name)) {
 		status = SWITCH_STATUS_FALSE;
 	} else {
-		recognizer_data_t *r = (recognizer_data_t *)schannel->data;
+		recognizer_data_t *r = (recognizer_data_t *) schannel->data;
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Unloading grammar %s\n", schannel->name, grammar_name);
 		switch_core_hash_delete(r->grammars, grammar_name);
 	}
@@ -2224,12 +2267,12 @@
  *
  * @return SWITCH_STATUS_SUCCESS if results available or start of input
  */
-static switch_status_t recog_channel_check_results(speech_channel_t *schannel) 
+static switch_status_t recog_channel_check_results(speech_channel_t *schannel)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	recognizer_data_t *r;
 	switch_mutex_lock(schannel->mutex);
-	r = (recognizer_data_t *)schannel->data;
+	r = (recognizer_data_t *) schannel->data;
 	if (!zstr(r->result)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) SUCCESS, have result\n", schannel->name);
 	} else if (r->start_of_input) {
@@ -2250,7 +2293,7 @@
 static switch_status_t recog_channel_start_input_timers(speech_channel_t *schannel)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	recognizer_data_t *r = (recognizer_data_t *)schannel->data;
+	recognizer_data_t *r = (recognizer_data_t *) schannel->data;
 	switch_mutex_lock(schannel->mutex);
 
 	if (schannel->state == SPEECH_CHANNEL_PROCESSING && !r->timers_started) {
@@ -2267,7 +2310,7 @@
 		mrcp_application_message_send(schannel->unimrcp_session, schannel->unimrcp_channel, mrcp_message);
 	}
 
- done:
+  done:
 
 	switch_mutex_unlock(schannel->mutex);
 	return status;
@@ -2284,7 +2327,7 @@
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	recognizer_data_t *r;
 	switch_mutex_lock(schannel->mutex);
-	r = (recognizer_data_t *)schannel->data;
+	r = (recognizer_data_t *) schannel->data;
 	r->start_of_input = 1;
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) start of input\n", schannel->name);
 	switch_mutex_unlock(schannel->mutex);
@@ -2303,7 +2346,7 @@
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	recognizer_data_t *r;
 	switch_mutex_lock(schannel->mutex);
-	r = (recognizer_data_t *)schannel->data;
+	r = (recognizer_data_t *) schannel->data;
 	if (!zstr(r->result)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) result is already set\n", schannel->name);
 		status = SWITCH_STATUS_FALSE;
@@ -2317,7 +2360,7 @@
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) result:\n\n%s\n", schannel->name, result);
 	r->result = switch_core_strdup(schannel->memory_pool, result);
 
- done:
+  done:
 
 	switch_mutex_unlock(schannel->mutex);
 	return status;
@@ -2333,7 +2376,7 @@
 static switch_status_t recog_channel_get_results(speech_channel_t *schannel, char **result)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	recognizer_data_t *r = (recognizer_data_t *)schannel->data;
+	recognizer_data_t *r = (recognizer_data_t *) schannel->data;
 	switch_mutex_lock(schannel->mutex);
 	if (!zstr(r->result)) {
 		*result = strdup(r->result);
@@ -2347,7 +2390,7 @@
 	} else {
 		status = SWITCH_STATUS_FALSE;
 	}
-	
+
 	switch_mutex_unlock(schannel->mutex);
 	return status;
 }
@@ -2361,7 +2404,8 @@
  * @param recog_hdr the recognizer headers to set
  * @return SWITCH_STATUS_SUCCESS
  */
-static switch_status_t recog_channel_set_params(speech_channel_t *schannel, mrcp_message_t *msg, mrcp_generic_header_t *gen_hdr, mrcp_recog_header_t *recog_hdr)
+static switch_status_t recog_channel_set_params(speech_channel_t *schannel, mrcp_message_t *msg, mrcp_generic_header_t *gen_hdr,
+												mrcp_recog_header_t *recog_hdr)
 {
 	/* loop through each param and add to recog header or vendor-specific-params */
 	switch_hash_index_t *hi = NULL;
@@ -2370,10 +2414,10 @@
 		const void *key;
 		void *val;
 		switch_hash_this(hi, &key, NULL, &val);
-		param_name = (char *)key;
-		param_val = (char *)val;
+		param_name = (char *) key;
+		param_val = (char *) val;
 		if (!zstr(param_name) && !zstr(param_val)) {
-			unimrcp_param_id_t *id = (unimrcp_param_id_t *)switch_core_hash_find(schannel->application->param_id_map, param_name);
+			unimrcp_param_id_t *id = (unimrcp_param_id_t *) switch_core_hash_find(schannel->application->param_id_map, param_name);
 			if (id) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) \"%s\": \"%s\"\n", schannel->name, param_name, param_val);
 				recog_channel_set_header(schannel, id->id, param_val, msg, recog_hdr);
@@ -2382,7 +2426,7 @@
 				apt_str_t apt_param_name = { 0 };
 				apt_str_t apt_param_val = { 0 };
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) (vendor-specific value) %s: %s\n", schannel->name, param_name, param_val);
-				apt_string_set(&apt_param_name, param_name); /* copy isn't necessary since apt_pair_array_append will do it */
+				apt_string_set(&apt_param_name, param_name);	/* copy isn't necessary since apt_pair_array_append will do it */
 				apt_string_set(&apt_param_val, param_val);
 				if (!gen_hdr->vendor_specific_params) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) creating vendor specific pair array\n", schannel->name);
@@ -2392,7 +2436,7 @@
 			}
 		}
 	}
-	
+
 	if (gen_hdr->vendor_specific_params) {
 		mrcp_generic_header_property_add(msg, GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS);
 	}
@@ -2416,94 +2460,95 @@
 
 	switch (id) {
 	case RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD:
-		recog_hdr->confidence_threshold = (float)atof(val);
+		recog_hdr->confidence_threshold = (float) atof(val);
 		mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD);
 		break;
 
 	case RECOGNIZER_HEADER_SENSITIVITY_LEVEL:
-		recog_hdr->sensitivity_level = (float)atof(val);
+		recog_hdr->sensitivity_level = (float) atof(val);
 		mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SENSITIVITY_LEVEL);
 		break;
 
 	case RECOGNIZER_HEADER_SPEED_VS_ACCURACY:
-		recog_hdr->speed_vs_accuracy = (float)atof(val);
+		recog_hdr->speed_vs_accuracy = (float) atof(val);
 		mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SPEED_VS_ACCURACY);
 		break;
 
-	case RECOGNIZER_HEADER_N_BEST_LIST_LENGTH: {
-		int n_best_list_length = atoi(val);
-		if (n_best_list_length > 0) {
-			recog_hdr->n_best_list_length = n_best_list_length;
-			mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_N_BEST_LIST_LENGTH);
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid n best list length, \"%s\"\n", schannel->name, val);
+	case RECOGNIZER_HEADER_N_BEST_LIST_LENGTH:{
+			int n_best_list_length = atoi(val);
+			if (n_best_list_length > 0) {
+				recog_hdr->n_best_list_length = n_best_list_length;
+				mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_N_BEST_LIST_LENGTH);
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid n best list length, \"%s\"\n", schannel->name, val);
+			}
+			break;
 		}
-		break;
-	}
-	case RECOGNIZER_HEADER_NO_INPUT_TIMEOUT: {
-		int no_input_timeout = atoi(val);
-		if (no_input_timeout >= 0) {
-			recog_hdr->no_input_timeout = no_input_timeout;
-			mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_NO_INPUT_TIMEOUT);
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid no input timeout, \"%s\"\n", schannel->name, val);
+	case RECOGNIZER_HEADER_NO_INPUT_TIMEOUT:{
+			int no_input_timeout = atoi(val);
+			if (no_input_timeout >= 0) {
+				recog_hdr->no_input_timeout = no_input_timeout;
+				mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_NO_INPUT_TIMEOUT);
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid no input timeout, \"%s\"\n", schannel->name, val);
+			}
+			break;
 		}
-		break;
-	}
-	case RECOGNIZER_HEADER_RECOGNITION_TIMEOUT: { 
-		int recognition_timeout = atoi(val);
-		if (recognition_timeout >= 0) {
-			recog_hdr->recognition_timeout = recognition_timeout;
-			mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_RECOGNITION_TIMEOUT);
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid recognition timeout, \"%s\"\n", schannel->name, val);
+	case RECOGNIZER_HEADER_RECOGNITION_TIMEOUT:{
+			int recognition_timeout = atoi(val);
+			if (recognition_timeout >= 0) {
+				recog_hdr->recognition_timeout = recognition_timeout;
+				mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_RECOGNITION_TIMEOUT);
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid recognition timeout, \"%s\"\n", schannel->name, val);
+			}
+			break;
 		}
-		break;
-	}
 	case RECOGNIZER_HEADER_START_INPUT_TIMERS:
 		recog_hdr->start_input_timers = !strcasecmp("true", val);
 		mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_START_INPUT_TIMERS);
 		break;
-		case RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT: {
-		int speech_complete_timeout = atoi(val);
-		if (speech_complete_timeout >= 0) {
-			recog_hdr->speech_complete_timeout = speech_complete_timeout;
-			mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT);
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid speech complete timeout, \"%s\"\n", schannel->name, val);
+	case RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT:{
+			int speech_complete_timeout = atoi(val);
+			if (speech_complete_timeout >= 0) {
+				recog_hdr->speech_complete_timeout = speech_complete_timeout;
+				mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT);
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid speech complete timeout, \"%s\"\n", schannel->name, val);
+			}
+			break;
 		}
-		break;
-	}
-	case RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT: {
-		int speech_incomplete_timeout = atoi(val);
-		if (speech_incomplete_timeout >= 0) {
-			recog_hdr->speech_incomplete_timeout = speech_incomplete_timeout;
-			mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT);
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid speech incomplete timeout, \"%s\"\n", schannel->name, val);
+	case RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT:{
+			int speech_incomplete_timeout = atoi(val);
+			if (speech_incomplete_timeout >= 0) {
+				recog_hdr->speech_incomplete_timeout = speech_incomplete_timeout;
+				mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT);
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid speech incomplete timeout, \"%s\"\n", schannel->name,
+								  val);
+			}
+			break;
 		}
-		break;
-	}
-	case RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT: {
-		int dtmf_interdigit_timeout = atoi(val);
-		if (dtmf_interdigit_timeout >= 0) {
-			recog_hdr->dtmf_interdigit_timeout = dtmf_interdigit_timeout;
-			mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT);
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid dtmf interdigit timeout, \"%s\"\n", schannel->name, val);
+	case RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT:{
+			int dtmf_interdigit_timeout = atoi(val);
+			if (dtmf_interdigit_timeout >= 0) {
+				recog_hdr->dtmf_interdigit_timeout = dtmf_interdigit_timeout;
+				mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT);
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid dtmf interdigit timeout, \"%s\"\n", schannel->name, val);
+			}
+			break;
 		}
-		break;
-	}
-	case RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT: {
-		int dtmf_term_timeout = atoi(val);
-		if (dtmf_term_timeout >= 0) {
-			recog_hdr->dtmf_term_timeout = dtmf_term_timeout;
-			mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT);
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid dtmf term timeout, \"%s\"\n", schannel->name, val);
+	case RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT:{
+			int dtmf_term_timeout = atoi(val);
+			if (dtmf_term_timeout >= 0) {
+				recog_hdr->dtmf_term_timeout = dtmf_term_timeout;
+				mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT);
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid dtmf term timeout, \"%s\"\n", schannel->name, val);
+			}
+			break;
 		}
-		break;
-	}
 	case RECOGNIZER_HEADER_DTMF_TERM_CHAR:
 		if (strlen(val) == 1) {
 			recog_hdr->dtmf_term_char = *val;
@@ -2533,26 +2578,26 @@
 		mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_RECOGNITION_MODE);
 		break;
 
-	case RECOGNIZER_HEADER_HOTWORD_MAX_DURATION: {
-		int hotword_max_duration = atoi(val);
-		if (hotword_max_duration >= 0) {
-			recog_hdr->hotword_max_duration = hotword_max_duration;
-			mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_HOTWORD_MAX_DURATION);
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid hotword max duration, \"%s\"\n", schannel->name, val);
+	case RECOGNIZER_HEADER_HOTWORD_MAX_DURATION:{
+			int hotword_max_duration = atoi(val);
+			if (hotword_max_duration >= 0) {
+				recog_hdr->hotword_max_duration = hotword_max_duration;
+				mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_HOTWORD_MAX_DURATION);
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid hotword max duration, \"%s\"\n", schannel->name, val);
+			}
+			break;
 		}
-		break;
-	}
-	case RECOGNIZER_HEADER_HOTWORD_MIN_DURATION: {
-		int hotword_min_duration = atoi(val);
-		if (hotword_min_duration >= 0) {
-			recog_hdr->hotword_min_duration = hotword_min_duration;
-			mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_HOTWORD_MIN_DURATION);
-		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid hotword min duration, \"%s\"\n", schannel->name, val);
+	case RECOGNIZER_HEADER_HOTWORD_MIN_DURATION:{
+			int hotword_min_duration = atoi(val);
+			if (hotword_min_duration >= 0) {
+				recog_hdr->hotword_min_duration = hotword_min_duration;
+				mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_HOTWORD_MIN_DURATION);
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "(%s) Ignoring invalid hotword min duration, \"%s\"\n", schannel->name, val);
+			}
+			break;
 		}
-		break;
-	}
 	case RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER:
 		recog_hdr->clear_dtmf_buffer = !strcasecmp("true", val);
 		mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER);
@@ -2573,25 +2618,25 @@
 		mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_MEDIA_TYPE);
 		break;
 
-	/* Unsupported headers */
+		/* Unsupported headers */
 
-	/* MRCP server headers */
+		/* MRCP server headers */
 	case RECOGNIZER_HEADER_WAVEFORM_URI:
 	case RECOGNIZER_HEADER_COMPLETION_CAUSE:
 	case RECOGNIZER_HEADER_FAILED_URI:
 	case RECOGNIZER_HEADER_FAILED_URI_CAUSE:
 	case RECOGNIZER_HEADER_INPUT_TYPE:
 	case RECOGNIZER_HEADER_COMPLETION_REASON:
-	/* module handles this automatically */
+		/* module handles this automatically */
 	case RECOGNIZER_HEADER_CANCEL_IF_QUEUE:
-	/* GET-PARAMS method only */
+		/* GET-PARAMS method only */
 	case RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK:
 	case RECOGNIZER_HEADER_DTMF_BUFFER_TIME:
 
-	/* INTERPRET method only */
+		/* INTERPRET method only */
 	case RECOGNIZER_HEADER_INTERPRET_TEXT:
 
-	/* unknown */
+		/* unknown */
 	case RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE:
 
 	default:
@@ -2609,7 +2654,7 @@
 {
 	recognizer_data_t *r;
 	switch_mutex_lock(schannel->mutex);
-	r = (recognizer_data_t *)schannel->data;
+	r = (recognizer_data_t *) schannel->data;
 	r->timers_started = 1;
 	switch_mutex_unlock(schannel->mutex);
 	return SWITCH_STATUS_SUCCESS;
@@ -2636,24 +2681,24 @@
 	recognizer_data_t *r = NULL;
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "asr_handle: name = %s, codec = %s, rate = %d, grammar = %s, param = %s\n",
-		ah->name, ah->codec, ah->rate, ah->grammar, ah->param);
+					  ah->name, ah->codec, ah->rate, ah->grammar, ah->param);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "codec = %s, rate = %d, dest = %s\n", codec, rate, dest);
 
 	/* It would be nice if FreeSWITCH let us know which session owns this handle, but it doesn't.  So, lets
-		make our own unique name */
+	   make our own unique name */
 	switch_snprintf(name, sizeof(name) - 1, "ASR-%d", speech_channel_number);
 	name[sizeof(name) - 1] = '\0';
 
-	if (speech_channel_create(&schannel, name, SPEECH_CHANNEL_RECOGNIZER, &globals.recog, (uint16_t)rate, ah->memory_pool) != SWITCH_STATUS_SUCCESS) {
+	if (speech_channel_create(&schannel, name, SPEECH_CHANNEL_RECOGNIZER, &globals.recog, (uint16_t) rate, ah->memory_pool) != SWITCH_STATUS_SUCCESS) {
 		status = SWITCH_STATUS_FALSE;
 		goto done;
 	}
 	ah->private_info = schannel;
 
-	r = (recognizer_data_t *)switch_core_alloc(ah->memory_pool, sizeof(recognizer_data_t));
+	r = (recognizer_data_t *) switch_core_alloc(ah->memory_pool, sizeof(recognizer_data_t));
 	schannel->data = r;
 	memset(r, 0, sizeof(recognizer_data_t));
-	switch_core_hash_init(&r->grammars, ah->memory_pool); 
+	switch_core_hash_init(&r->grammars, ah->memory_pool);
 
 	/* try to open an MRCP channel */
 	if (!(profile_name = dest)) {
@@ -2662,7 +2707,7 @@
 		}
 	}
 
-	profile = (profile_t *)switch_core_hash_find(globals.profiles, profile_name);
+	profile = (profile_t *) switch_core_hash_find(globals.profiles, profile_name);
 
 	if (!profile) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Can't find profile, %s\n", name, profile_name);
@@ -2671,7 +2716,7 @@
 	}
 	status = speech_channel_open(schannel, profile);
 
- done:
+  done:
 
 	return status;
 }
@@ -2687,7 +2732,7 @@
 static switch_status_t recog_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *name)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
 	const char *grammar_data = NULL;
 	char *grammar_file_data = NULL;
 	switch_file_t *grammar_file = NULL;
@@ -2700,7 +2745,7 @@
 		status = SWITCH_STATUS_FALSE;
 		goto done;
 	}
-	
+
 	/* stop recognition */
 	if (speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS) {
 		status = SWITCH_STATUS_FALSE;
@@ -2708,7 +2753,8 @@
 	}
 
 	/* figure out what type of grammar this is */
-	if (text_starts_with(grammar, HTTP_ID) || text_starts_with(grammar, FILE_ID) || text_starts_with(grammar, SESSION_ID) || text_starts_with(grammar, BUILTIN_ID)) {
+	if (text_starts_with(grammar, HTTP_ID) || text_starts_with(grammar, FILE_ID) || text_starts_with(grammar, SESSION_ID)
+		|| text_starts_with(grammar, BUILTIN_ID)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Grammar is URI\n", schannel->name);
 		type = GRAMMAR_TYPE_URI;
 		grammar_data = grammar;
@@ -2747,7 +2793,7 @@
 			status = SWITCH_STATUS_FALSE;
 			goto done;
 		}
-		grammar_file_data = (char *)switch_core_alloc(schannel->memory_pool, grammar_file_size + 1);
+		grammar_file_data = (char *) switch_core_alloc(schannel->memory_pool, grammar_file_size + 1);
 		to_read = grammar_file_size;
 		if (switch_file_read(grammar_file, grammar_file_data, &to_read) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(%s) Grammar file read error: %s\n", schannel->name, filename);
@@ -2794,7 +2840,7 @@
 
 	status = recog_channel_start(schannel, name);
 
- done:
+  done:
 
 	switch_safe_free(filename);
 	if (grammar_file) {
@@ -2813,9 +2859,8 @@
 static switch_status_t recog_asr_unload_grammar(switch_asr_handle_t *ah, const char *name)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
-	if (zstr(name) || speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS ||
-		recog_channel_unload_grammar(schannel, name) != SWITCH_STATUS_SUCCESS) {
+	speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
+	if (zstr(name) || speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS || recog_channel_unload_grammar(schannel, name) != SWITCH_STATUS_SUCCESS) {
 		status = SWITCH_STATUS_FALSE;
 	}
 	return status;
@@ -2830,8 +2875,8 @@
  */
 static switch_status_t recog_asr_close(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
 {
-	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
-	recognizer_data_t *r = (recognizer_data_t *)schannel->data;
+	speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
+	recognizer_data_t *r = (recognizer_data_t *) schannel->data;
 	speech_channel_stop(schannel);
 	speech_channel_destroy(schannel);
 	switch_core_hash_destroy(&r->grammars);
@@ -2851,7 +2896,7 @@
 static switch_status_t recog_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags)
 {
 	switch_size_t slen = len;
-	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
 	return speech_channel_write(schannel, data, &slen);
 }
 
@@ -2861,11 +2906,11 @@
  * @param ah the FreeSWITCH speech recognition handle
  * @param name name of the grammar to use
  * @return SWITCH_STATUS_SUCCESS if successful
- */ 
+ */
 static switch_status_t recog_asr_start(switch_asr_handle_t *ah, const char *name)
 {
 	switch_status_t status;
-	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
 	status = recog_channel_start(schannel, name);
 	return status;
 }
@@ -2878,7 +2923,7 @@
  */
 static switch_status_t recog_asr_resume(switch_asr_handle_t *ah)
 {
-	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
 	return recog_channel_start(schannel, NULL);
 }
 
@@ -2889,7 +2934,7 @@
  */
 static switch_status_t recog_asr_pause(switch_asr_handle_t *ah)
 {
-	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
 	return speech_channel_stop(schannel);
 }
 
@@ -2903,7 +2948,7 @@
  */
 static switch_status_t recog_asr_check_results(switch_asr_handle_t *ah, switch_asr_flag_t *flags)
 {
-	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
 	return recog_channel_check_results(schannel);
 }
 
@@ -2916,7 +2961,7 @@
  */
 static switch_status_t recog_asr_get_results(switch_asr_handle_t *ah, char **xmlstr, switch_asr_flag_t *flags)
 {
-	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
 	return recog_channel_get_results(schannel, xmlstr);
 }
 
@@ -2927,7 +2972,7 @@
  */
 static switch_status_t recog_asr_start_input_timers(switch_asr_handle_t *ah)
 {
-	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
 	return recog_channel_start_input_timers(schannel);
 }
 
@@ -2941,7 +2986,7 @@
  */
 static void recog_asr_text_param(switch_asr_handle_t *ah, char *param, const char *val)
 {
-	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
 	speech_channel_set_param(schannel, param, val);
 }
 
@@ -2955,7 +3000,7 @@
  */
 static void recog_asr_numeric_param(switch_asr_handle_t *ah, char *param, int val)
 {
-	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
 	char *val_str = switch_mprintf("%d", val);
 	speech_channel_set_param(schannel, param, val_str);
 	switch_safe_free(val_str);
@@ -2971,7 +3016,7 @@
  */
 static void recog_asr_float_param(switch_asr_handle_t *ah, char *param, double val)
 {
-	speech_channel_t *schannel = (speech_channel_t *)ah->private_info;
+	speech_channel_t *schannel = (speech_channel_t *) ah->private_info;
 	char *val_str = switch_mprintf("%f", val);
 	speech_channel_set_param(schannel, param, val_str);
 	switch_safe_free(val_str);
@@ -2990,8 +3035,8 @@
  */
 static apt_bool_t recog_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message)
 {
-	speech_channel_t *schannel = (speech_channel_t *)mrcp_application_channel_object_get(channel);
-	mrcp_recog_header_t *recog_hdr = (mrcp_recog_header_t *)mrcp_resource_header_get(message);
+	speech_channel_t *schannel = (speech_channel_t *) mrcp_application_channel_object_get(channel);
+	mrcp_recog_header_t *recog_hdr = (mrcp_recog_header_t *) mrcp_resource_header_get(message);
 	if (message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) {
 		/* received MRCP response */
 		if (message->start_line.method_id == RECOGNIZER_RECOGNIZE) {
@@ -3003,9 +3048,11 @@
 			} else if (message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) {
 				/* RECOGNIZE failed to start */
 				if (recog_hdr->completion_cause == RECOGNIZER_COMPLETION_CAUSE_UNKNOWN) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) RECOGNIZE failed: status = %d\n", schannel->name, 	message->start_line.status_code);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) RECOGNIZE failed: status = %d\n", schannel->name,
+									  message->start_line.status_code);
 				} else {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) RECOGNIZE failed: status = %d, completion-cause = %03d\n", schannel->name, message->start_line.status_code, recog_hdr->completion_cause);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) RECOGNIZE failed: status = %d, completion-cause = %03d\n",
+									  schannel->name, message->start_line.status_code, recog_hdr->completion_cause);
 				}
 				speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
 			} else if (message->start_line.request_state == MRCP_REQUEST_STATE_PENDING) {
@@ -3013,7 +3060,8 @@
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) RECOGNIZE PENDING\n", schannel->name);
 			} else {
 				/* received unexpected request_state */
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected RECOGNIZE request state: %d\n", schannel->name, message->start_line.request_state);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected RECOGNIZE request state: %d\n", schannel->name,
+								  message->start_line.request_state);
 				speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
 			}
 		} else if (message->start_line.method_id == RECOGNIZER_STOP) {
@@ -3024,9 +3072,10 @@
 				speech_channel_set_state(schannel, SPEECH_CHANNEL_READY);
 			} else {
 				/* received unexpected request state */
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected STOP request state: %d\n", schannel->name, message->start_line.request_state);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected STOP request state: %d\n", schannel->name,
+								  message->start_line.request_state);
 				speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
-				}
+			}
 		} else if (message->start_line.method_id == RECOGNIZER_START_INPUT_TIMERS) {
 			/* received response to START-INPUT-TIMERS request */
 			if (message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) {
@@ -3034,7 +3083,8 @@
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) timers started\n", schannel->name);
 					recog_channel_set_timers_started(schannel);
 				} else {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) timers failed to start, status code = %d\n", schannel->name, message->start_line.status_code);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) timers failed to start, status code = %d\n", schannel->name,
+									  message->start_line.status_code);
 				}
 			}
 		} else if (message->start_line.method_id == RECOGNIZER_DEFINE_GRAMMAR) {
@@ -3044,26 +3094,30 @@
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) grammar loaded\n", schannel->name);
 					speech_channel_set_state(schannel, SPEECH_CHANNEL_READY);
 				} else {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) grammar failed to load, status code = %d\n", schannel->name, message->start_line.status_code);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) grammar failed to load, status code = %d\n", schannel->name,
+									  message->start_line.status_code);
 					speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
 				}
 			}
 		} else {
 			/* received unexpected response */
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected response, method_id = %d\n", schannel->name, (int)message->start_line.method_id);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected response, method_id = %d\n", schannel->name,
+							  (int) message->start_line.method_id);
 			speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
 		}
 	} else if (message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) {
 		/* received MRCP event */
 		if (message->start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) RECOGNITION COMPLETE, Completion-Cause: %03d\n", schannel->name, recog_hdr->completion_cause);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) RECOGNITION COMPLETE, Completion-Cause: %03d\n", schannel->name,
+							  recog_hdr->completion_cause);
 			if (message->body.length > 0) {
 				if (message->body.buf[message->body.length - 1] == '\0') {
 					recog_channel_set_results(schannel, message->body.buf);
 				} else {
 					/* string is not null terminated */
-					char *result = (char *)switch_core_alloc(schannel->memory_pool, message->body.length + 1);
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) Recognition result is not null-terminated.  Appending null terminator.\n", schannel->name);
+					char *result = (char *) switch_core_alloc(schannel->memory_pool, message->body.length + 1);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
+									  "(%s) Recognition result is not null-terminated.  Appending null terminator.\n", schannel->name);
 					strncpy(result, message->body.buf, message->body.length);
 					result[message->body.length] = '\0';
 					recog_channel_set_results(schannel, result);
@@ -3079,11 +3133,13 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) START OF INPUT\n", schannel->name);
 			recog_channel_set_start_of_input(schannel);
 		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected event, method_id = %d\n", schannel->name, (int)message->start_line.method_id);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected event, method_id = %d\n", schannel->name,
+							  (int) message->start_line.method_id);
 			speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
 		}
 	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected message type, message_type = %d\n", schannel->name, message->start_line.message_type);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) unexpected message type, message_type = %d\n", schannel->name,
+						  message->start_line.message_type);
 		speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR);
 	}
 
@@ -3099,13 +3155,13 @@
  */
 static apt_bool_t recog_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame)
 {
-	speech_channel_t *schannel = (speech_channel_t *)stream->obj;
+	speech_channel_t *schannel = (speech_channel_t *) stream->obj;
 	switch_size_t to_read = frame->codec_frame.size;
-	
+
 	/* grab the data.  pad it if there isn't enough */
 	if (speech_channel_read(schannel, frame->codec_frame.buffer, &to_read, 0) == SWITCH_STATUS_SUCCESS) {
 		if (to_read < frame->codec_frame.size) {
-			memset((uint8_t *)frame->codec_frame.buffer + to_read, schannel->silence, frame->codec_frame.size - to_read);
+			memset((uint8_t *) frame->codec_frame.buffer + to_read, schannel->silence, frame->codec_frame.size - to_read);
 		}
 		frame->type |= MEDIA_FRAME_TYPE_AUDIO;
 	}
@@ -3120,7 +3176,7 @@
 {
 	/* link to FreeSWITCH ASR / TTS callbacks */
 	switch_asr_interface_t *asr_interface = NULL;
-	if ((asr_interface = (switch_asr_interface_t *)switch_loadable_module_create_interface(module_interface, SWITCH_ASR_INTERFACE)) == NULL) {
+	if ((asr_interface = (switch_asr_interface_t *) switch_loadable_module_create_interface(module_interface, SWITCH_ASR_INTERFACE)) == NULL) {
 		return SWITCH_STATUS_FALSE;
 	}
 	asr_interface->interface_name = MOD_UNIMRCP;
@@ -3140,9 +3196,9 @@
 	asr_interface->asr_text_param = recog_asr_text_param;
 	asr_interface->asr_numeric_param = recog_asr_numeric_param;
 	asr_interface->asr_float_param = recog_asr_float_param;
-	
+
 	/* Create the recognizer application and link its callbacks */
-	if ((globals.recog.app = mrcp_application_create(recog_message_handler, (void *)0, pool)) == NULL) {
+	if ((globals.recog.app = mrcp_application_create(recog_message_handler, (void *) 0, pool)) == NULL) {
 		return SWITCH_STATUS_FALSE;
 	}
 	globals.recog.dispatcher.on_session_update = NULL;
@@ -3158,27 +3214,31 @@
 	globals.recog.audio_stream_vtable.close_tx = NULL;
 	globals.recog.audio_stream_vtable.write_frame = NULL;
 	mrcp_client_application_register(globals.mrcp_client, globals.recog.app, "recog");
-	
+
 	/* map FreeSWITCH params or old params to MRCPv2 param */
 	switch_core_hash_init_nocase(&globals.recog.fs_param_map, pool);
 	/* MRCPv1 param */
 	switch_core_hash_insert(globals.recog.fs_param_map, "recognizer-start-timers", "start-input-timers");
-	
+
 	/* map MRCP params to UniMRCP ID */
 	switch_core_hash_init_nocase(&globals.recog.param_id_map, pool);
 	switch_core_hash_insert(globals.recog.param_id_map, "Confidence-Threshold", unimrcp_param_id_create(RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD, pool));
 	switch_core_hash_insert(globals.recog.param_id_map, "Sensitivity-Level", unimrcp_param_id_create(RECOGNIZER_HEADER_SENSITIVITY_LEVEL, pool));
 	switch_core_hash_insert(globals.recog.param_id_map, "Speed-Vs-Accuracy", unimrcp_param_id_create(RECOGNIZER_HEADER_SPEED_VS_ACCURACY, pool));
-	switch_core_hash_insert(globals.recog.param_id_map, "N-Best-List-Length", unimrcp_param_id_create(RECOGNIZER_HEADER_N_BEST_LIST_LENGTH, pool));	
+	switch_core_hash_insert(globals.recog.param_id_map, "N-Best-List-Length", unimrcp_param_id_create(RECOGNIZER_HEADER_N_BEST_LIST_LENGTH, pool));
 	switch_core_hash_insert(globals.recog.param_id_map, "No-Input-Timeout", unimrcp_param_id_create(RECOGNIZER_HEADER_NO_INPUT_TIMEOUT, pool));
 	switch_core_hash_insert(globals.recog.param_id_map, "Recognition-Timeout", unimrcp_param_id_create(RECOGNIZER_HEADER_RECOGNITION_TIMEOUT, pool));
 	switch_core_hash_insert(globals.recog.param_id_map, "Waveform-Url", unimrcp_param_id_create(RECOGNIZER_HEADER_WAVEFORM_URI, pool));
 	switch_core_hash_insert(globals.recog.param_id_map, "Completion-Cause", unimrcp_param_id_create(RECOGNIZER_HEADER_COMPLETION_CAUSE, pool));
-	switch_core_hash_insert(globals.recog.param_id_map, "Recognizer-Context-Block", unimrcp_param_id_create(RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Recognizer-Context-Block",
+							unimrcp_param_id_create(RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK, pool));
 	switch_core_hash_insert(globals.recog.param_id_map, "Start-Input-Timers", unimrcp_param_id_create(RECOGNIZER_HEADER_START_INPUT_TIMERS, pool));
-	switch_core_hash_insert(globals.recog.param_id_map, "Speech-Complete-Timeout", unimrcp_param_id_create(RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT, pool));
-	switch_core_hash_insert(globals.recog.param_id_map, "Speech-Incomplete-Timeout", unimrcp_param_id_create(RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT, pool));
-	switch_core_hash_insert(globals.recog.param_id_map, "DTMF-Interdigit-Timeout", unimrcp_param_id_create(RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Speech-Complete-Timeout",
+							unimrcp_param_id_create(RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "Speech-Incomplete-Timeout",
+							unimrcp_param_id_create(RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT, pool));
+	switch_core_hash_insert(globals.recog.param_id_map, "DTMF-Interdigit-Timeout",
+							unimrcp_param_id_create(RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT, pool));
 	switch_core_hash_insert(globals.recog.param_id_map, "DTMF-Term-Timeout", unimrcp_param_id_create(RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT, pool));
 	switch_core_hash_insert(globals.recog.param_id_map, "DTMF-Term-Char", unimrcp_param_id_create(RECOGNIZER_HEADER_DTMF_TERM_CHAR, pool));
 	switch_core_hash_insert(globals.recog.param_id_map, "Failed-Uri", unimrcp_param_id_create(RECOGNIZER_HEADER_FAILED_URI, pool));
@@ -3236,12 +3296,13 @@
 
 	if ((settings = switch_xml_child(cfg, "settings"))) {
 		if (switch_xml_config_parse(switch_xml_child(settings, "param"), SWITCH_FALSE, instructions) == SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"Config parsed ok!\n");
-			globals.enable_profile_events = !zstr(globals.enable_profile_events_param) && (!strcasecmp(globals.enable_profile_events_param, "true") || 	!strcmp(globals.enable_profile_events_param, "1"));
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Config parsed ok!\n");
+			globals.enable_profile_events = !zstr(globals.enable_profile_events_param) && (!strcasecmp(globals.enable_profile_events_param, "true")
+																						   || !strcmp(globals.enable_profile_events_param, "1"));
 		}
 	}
 
- done:
+  done:
 
 	if (xml) {
 		switch_xml_free(xml);
@@ -3270,12 +3331,12 @@
  */
 static char *ip_addr_get(const char *value, apr_pool_t *pool)
 {
-	if(!value || strcasecmp(value,"auto") == 0) {
+	if (!value || strcasecmp(value, "auto") == 0) {
 		char *addr = DEFAULT_LOCAL_IP_ADDRESS;
-		apt_ip_get(&addr,pool);
+		apt_ip_get(&addr, pool);
 		return addr;
 	}
-	return apr_pstrdup(pool,value);
+	return apr_pstrdup(pool, value);
 }
 
 /**
@@ -3321,9 +3382,9 @@
 	} else if (strcasecmp(param, "rtp-ext-ip") == 0) {
 		apt_string_set(&rtp_config->ext_ip, ip_addr_get(val, pool));
 	} else if (strcasecmp(param, "rtp-port-min") == 0) {
-		rtp_config->rtp_port_min = (apr_port_t)atol(val);
+		rtp_config->rtp_port_min = (apr_port_t) atol(val);
 	} else if (strcasecmp(param, "rtp-port-max") == 0) {
-		rtp_config->rtp_port_max = (apr_port_t)atol(val);
+		rtp_config->rtp_port_max = (apr_port_t) atol(val);
 	} else if (strcasecmp(param, "playout-delay") == 0) {
 		rtp_config->jb_config.initial_playout_delay = atol(val);
 	} else if (strcasecmp(param, "min-playout-delay") == 0) {
@@ -3332,20 +3393,20 @@
 		rtp_config->jb_config.max_playout_delay = atol(val);
 	} else if (strcasecmp(param, "codecs") == 0) {
 		const mpf_codec_manager_t *codec_manager = mrcp_client_codec_manager_get(client);
-		if(codec_manager) {
+		if (codec_manager) {
 			mpf_codec_manager_codec_list_load(codec_manager, &rtp_config->codec_list, val, pool);
 		}
 	} else if (strcasecmp(param, "ptime") == 0) {
-		rtp_config->ptime = (apr_uint16_t)atol(val);
+		rtp_config->ptime = (apr_uint16_t) atol(val);
 #if UNI_VERSION_AT_LEAST(0,8,0)
-	} else if(strcasecmp(param, "rtcp") == 0) {
+	} else if (strcasecmp(param, "rtcp") == 0) {
 		rtp_config->rtcp = atoi(val);
-	} else if(strcasecmp(param, "rtcp-bye") == 0) {
+	} else if (strcasecmp(param, "rtcp-bye") == 0) {
 		rtp_config->rtcp_bye_policy = atoi(val);
-	} else if(strcasecmp(param, "rtcp-tx-interval") == 0) {
-		rtp_config->rtcp_tx_interval = (apr_uint16_t)atoi(val);
-	} else if(strcasecmp(param, "rtcp-rx-resolution") == 0) {
-		rtp_config->rtcp_rx_resolution = (apr_uint16_t)atol(val);
+	} else if (strcasecmp(param, "rtcp-tx-interval") == 0) {
+		rtp_config->rtcp_tx_interval = (apr_uint16_t) atoi(val);
+	} else if (strcasecmp(param, "rtcp-rx-resolution") == 0) {
+		rtp_config->rtcp_rx_resolution = (apr_uint16_t) atol(val);
 #endif
 	} else {
 		mine = 0;
@@ -3368,7 +3429,7 @@
 	if (strcasecmp(param, "server-ip") == 0) {
 		config->server_ip = ip_addr_get(val, pool);
 	} else if (strcasecmp(param, "server-port") == 0) {
-		config->server_port = (apr_port_t)atol(val);
+		config->server_port = (apr_port_t) atol(val);
 	} else if (strcasecmp(param, "resource-location") == 0) {
 		config->resource_location = apr_pstrdup(pool, val);
 	} else if (strcasecmp(param, "sdp-origin") == 0) {
@@ -3398,14 +3459,14 @@
 	int mine = 1;
 	if (strcasecmp(param, "client-ip") == 0) {
 		config->local_ip = ip_addr_get(val, pool);
-	} else if (strcasecmp(param,"client-ext-ip") == 0) {
+	} else if (strcasecmp(param, "client-ext-ip") == 0) {
 		config->ext_ip = ip_addr_get(val, pool);
-	} else if (strcasecmp(param,"client-port") == 0) {
-		config->local_port = (apr_port_t)atol(val);
+	} else if (strcasecmp(param, "client-port") == 0) {
+		config->local_port = (apr_port_t) atol(val);
 	} else if (strcasecmp(param, "server-ip") == 0) {
 		config->remote_ip = ip_addr_get(val, pool);
 	} else if (strcasecmp(param, "server-port") == 0) {
-		config->remote_port = (apr_port_t)atol(val);
+		config->remote_port = (apr_port_t) atol(val);
 	} else if (strcasecmp(param, "server-username") == 0) {
 		config->remote_user_name = apr_pstrdup(pool, val);
 	} else if (strcasecmp(param, "force-destination") == 0) {
@@ -3446,7 +3507,7 @@
 	mrcp_connection_agent_t *connection_agent;
 	mpf_engine_t *media_engine;
 	apt_dir_layout_t *dir_layout;
-	
+
 	/* create the client */
 	if ((dir_layout = apt_default_dir_layout_create("../", mod_pool)) == NULL) {
 		goto done;
@@ -3461,11 +3522,10 @@
 		client = NULL;
 		goto done;
 	}
-
 #if UNI_VERSION_AT_LEAST(0,8,0)
-	/* load the synthesizer and recognizer resources */	
+	/* load the synthesizer and recognizer resources */
 	resource_loader = mrcp_resource_loader_create(FALSE, pool);
-	if(resource_loader) {
+	if (resource_loader) {
 		apt_str_t synth_resource;
 		apt_str_t recog_resource;
 		apt_string_set(&synth_resource, "speechsynth");
@@ -3526,10 +3586,10 @@
 			/* a profile is a signaling agent + termination factory + media engine + connection agent (MRCPv2 only) */
 			mrcp_sig_agent_t *agent = NULL;
 			mpf_termination_factory_t *termination_factory = NULL;
-			mrcp_profile_t * mprofile = NULL;
+			mrcp_profile_t *mprofile = NULL;
 			mpf_rtp_config_t *rtp_config = NULL;
 			profile_t *mod_profile = NULL;
-			
+
 			/* get profile attributes */
 			const char *name = apr_pstrdup(pool, switch_xml_attr(profile, "name"));
 			const char *version = switch_xml_attr(profile, "version");
@@ -3548,7 +3608,7 @@
 			rtp_config->rtp_port_min = DEFAULT_RTP_PORT_MIN;
 			rtp_config->rtp_port_max = DEFAULT_RTP_PORT_MAX;
 			apt_string_set(&rtp_config->ip, DEFAULT_LOCAL_IP_ADDRESS);
-			
+
 			if (strcmp("1", version) == 0) {
 				/* MRCPv1 configuration */
 				rtsp_client_config_t *config = mrcp_unirtsp_client_config_alloc(pool);
@@ -3566,7 +3626,7 @@
 						goto done;
 					}
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading Param %s:%s\n", param_name, param_value);
-					if (!process_mrcpv1_config(config, param_name, param_value, pool) && 
+					if (!process_mrcpv1_config(config, param_name, param_value, pool) &&
 						!process_rtp_config(client, rtp_config, param_name, param_value, pool) &&
 						!process_profile_config(mod_profile, param_name, param_value, mod_pool)) {
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unknown param %s\n", param_name);
@@ -3607,7 +3667,7 @@
 				goto done;
 			}
 
-			termination_factory = mpf_rtp_termination_factory_create(rtp_config, pool); 
+			termination_factory = mpf_rtp_termination_factory_create(rtp_config, pool);
 			if (termination_factory) {
 				mrcp_client_rtp_factory_register(client, termination_factory, name);
 			}
@@ -3623,7 +3683,7 @@
 		}
 	}
 
- done:
+  done:
 
 	if (xml) {
 		switch_xml_free(xml);
@@ -3751,14 +3811,14 @@
 static apt_bool_t unimrcp_log(const char *file, int line, const char *id, apt_log_priority_e priority, const char *format, va_list arg_ptr)
 {
 	switch_log_level_t level;
-	char log_message[4096] = { 0 }; /* same size as MAX_LOG_ENTRY_SIZE in UniMRCP apt_log.c */
+	char log_message[4096] = { 0 };	/* same size as MAX_LOG_ENTRY_SIZE in UniMRCP apt_log.c */
 	size_t msglen;
 
 	if (zstr(format)) {
 		return TRUE;
 	}
 
-	switch(priority) {
+	switch (priority) {
 	case APT_PRIO_EMERGENCY:
 		/* pass through */
 	case APT_PRIO_ALERT:
@@ -3784,8 +3844,8 @@
 		level = SWITCH_LOG_DEBUG;
 		break;
 	}
-	
-	/* apr_vsnprintf supports format extensions required by UniMRCP */ 
+
+	/* apr_vsnprintf supports format extensions required by UniMRCP */
 	apr_vsnprintf(log_message, sizeof(log_message), format, arg_ptr);
 	msglen = strlen(log_message);
 	if (msglen >= 2 && log_message[msglen - 2] == '\\' && log_message[msglen - 1] == 'n') {
@@ -3795,7 +3855,7 @@
 		/* log message needs \n appended */
 		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, "", line, id, level, "%s\n", log_message);
 	}
-	
+
 	return TRUE;
 }
 
@@ -3825,7 +3885,7 @@
  */
 static unimrcp_param_id_t *unimrcp_param_id_create(int id, switch_memory_pool_t *pool)
 {
-	unimrcp_param_id_t *param = (unimrcp_param_id_t *)switch_core_alloc(pool, sizeof(unimrcp_param_id_t));
+	unimrcp_param_id_t *param = (unimrcp_param_id_t *) switch_core_alloc(pool, sizeof(unimrcp_param_id_t));
 	if (param) {
 		param->id = id;
 	}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_amr/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_amr/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_amr/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,7 +1,8 @@
 BASE=../../../..
 
-AMR_DIR=$(BASE)/libs/amr
-AMR_A=$(AMR_DIR)/libamr.a
+AMR_DIR=$(switch_srcdir)/libs/amr
+AMR_BUILDDIR=$(switch_builddir)/libs/amr
+AMR_A=$(AMR_BUILDDIR)/libamr.a
 
 LOCAL_INSERT_CFLAGS=if test -d $(AMR_DIR); then echo "-I$(AMR_DIR)" ; else echo "-DAMR_PASSTHROUGH" ; fi ;
 LOCAL_INSERT_LDFLAGS=test ! -d $(AMR_DIR) || echo "$(AMR_A)";

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_amr/mod_amr.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_amr/mod_amr.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_amr/mod_amr.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -250,7 +250,8 @@
 										 switch_codec_t *other_codec,
 										 void *decoded_data,
 										 uint32_t decoded_data_len,
-										 uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag)
+										 uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
+										 unsigned int *flag)
 {
 #ifdef AMR_PASSTHROUGH
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This codec is only usable in passthrough mode!\n");
@@ -272,7 +273,8 @@
 										 switch_codec_t *other_codec,
 										 void *encoded_data,
 										 uint32_t encoded_data_len,
-										 uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag)
+										 uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
+										 unsigned int *flag)
 {
 #ifdef AMR_PASSTHROUGH
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This codec is only usable in passthrough mode!\n");
@@ -319,24 +321,23 @@
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	SWITCH_ADD_CODEC(codec_interface, "AMR");
-	switch_core_codec_add_implementation(pool, codec_interface,
-										 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-										 96,						/* the IANA code number */
-										 "AMR",						/* the IANA code name */
-										 "octet-align=0",			/* default fmtp to send (can be overridden by the init function) */
-										 8000,						/* samples transferred per second */
-										 8000,						/* actual samples transferred per second */
-										 12200,						/* bits transferred per second */
-										 20000,						/* number of microseconds per frame */
-										 160,						/* number of samples per frame */
-										 320,						/* number of bytes per frame decompressed */
-										 0,							/* number of bytes per frame compressed */
-										 1,							/* number of channels represented */
-										 1, 						/* number of frames per network packet */
-										 switch_amr_init,			/* function to initialize a codec handle using this implementation */
-										 switch_amr_encode,			/* function to encode raw data into encoded data */
-										 switch_amr_decode,			/* function to decode encoded data into raw data */
-										 switch_amr_destroy);		/* deinitalize a codec handle using this implementation */
+	switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+										 96,	/* the IANA code number */
+										 "AMR",	/* the IANA code name */
+										 "octet-align=0",	/* default fmtp to send (can be overridden by the init function) */
+										 8000,	/* samples transferred per second */
+										 8000,	/* actual samples transferred per second */
+										 12200,	/* bits transferred per second */
+										 20000,	/* number of microseconds per frame */
+										 160,	/* number of samples per frame */
+										 320,	/* number of bytes per frame decompressed */
+										 0,	/* number of bytes per frame compressed */
+										 1,	/* number of channels represented */
+										 1,	/* number of frames per network packet */
+										 switch_amr_init,	/* function to initialize a codec handle using this implementation */
+										 switch_amr_encode,	/* function to encode raw data into encoded data */
+										 switch_amr_decode,	/* function to decode encoded data into raw data */
+										 switch_amr_destroy);	/* deinitalize a codec handle using this implementation */
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_amrwb/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_amrwb/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_amrwb/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,7 +1,8 @@
 BASE=../../../..
 
-AMR_DIR=$(BASE)/libs/amrwb
-AMR_A=$(AMR_DIR)/libamrwb.a
+AMR_DIR=$(switch_srcdir)/libs/amrwb
+AMR_BUILDDIR=$(switch_builddir)/libs/amrwb
+AMR_A=$(AMR_BUILDDIR)/libamrwb.a
 
 LOCAL_INSERT_CFLAGS=if test -d $(AMR_DIR); then echo "-I$(AMR_DIR)" ; else echo "-DAMRWB_PASSTHROUGH" ; fi ;
 LOCAL_INSERT_LDFLAGS=test ! -d $(AMR_DIR) || echo "$(AMR_A)";

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_amrwb/mod_amrwb.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_amrwb/mod_amrwb.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_amrwb/mod_amrwb.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthmct@yahoo.com>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthmct@yahoo.com>
  *
  * Version: MPL 1.1
  *
@@ -166,7 +166,8 @@
 			context->enc_mode = globals.default_bitrate;
 		}
 
-		switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d", switch_test_flag(context, AMRWB_OPT_OCTET_ALIGN) ? 1 : 0, context->enc_mode);
+		switch_snprintf(fmtptmp, sizeof(fmtptmp), "octet-align=%d; mode-set=%d", switch_test_flag(context, AMRWB_OPT_OCTET_ALIGN) ? 1 : 0,
+						context->enc_mode);
 		codec->fmtp_out = switch_core_strdup(codec->memory_pool, fmtptmp);
 
 		context->enc_mode = AMRWB_DEFAULT_BITRATE;
@@ -205,11 +206,11 @@
 }
 
 static switch_status_t switch_amrwb_encode(switch_codec_t *codec,
-										 switch_codec_t *other_codec,
-										 void *decoded_data,
-										 uint32_t decoded_data_len,
-										 uint32_t decoded_rate, void *encoded_data, uint32_t * encoded_data_len, uint32_t * encoded_rate,
-										 unsigned int *flag)
+										   switch_codec_t *other_codec,
+										   void *decoded_data,
+										   uint32_t decoded_data_len,
+										   uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
+										   unsigned int *flag)
 {
 #ifdef AMRWB_PASSTHROUGH
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This codec is only usable in passthrough mode!\n");
@@ -228,11 +229,11 @@
 }
 
 static switch_status_t switch_amrwb_decode(switch_codec_t *codec,
-										 switch_codec_t *other_codec,
-										 void *encoded_data,
-										 uint32_t encoded_data_len,
-										 uint32_t encoded_rate, void *decoded_data, uint32_t * decoded_data_len, uint32_t * decoded_rate,
-										 unsigned int *flag)
+										   switch_codec_t *other_codec,
+										   void *encoded_data,
+										   uint32_t encoded_data_len,
+										   uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
+										   unsigned int *flag)
 {
 #ifdef AMRWB_PASSTHROUGH
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This codec is only usable in passthrough mode!\n");
@@ -279,10 +280,9 @@
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	SWITCH_ADD_CODEC(codec_interface, "AMR-WB");
-    switch_core_codec_add_implementation(pool, codec_interface,
-                                         SWITCH_CODEC_TYPE_AUDIO, 100, "AMR-WB", "octet-align=0", 16000, 16000, 23850,
-                                         20000, 320, 640, 0, 1, 1,
-                                         switch_amrwb_init, switch_amrwb_encode, switch_amrwb_decode, switch_amrwb_destroy);
+	switch_core_codec_add_implementation(pool, codec_interface,
+										 SWITCH_CODEC_TYPE_AUDIO, 100, "AMR-WB", "octet-align=0", 16000, 16000, 23850,
+										 20000, 320, 640, 0, 1, 1, switch_amrwb_init, switch_amrwb_encode, switch_amrwb_decode, switch_amrwb_destroy);
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_bv/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_bv/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_bv/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,11 +1,13 @@
 BASE=../../../..
-BV_DIR=$(BASE)/libs/broadvoice
-LOCAL_CFLAGS=-I$(BV_DIR)/src 
-BV_LA=$(BV_DIR)/src/.libs/libbroadvoice.la
+
+BV_DIR=$(switch_srcdir)/libs/broadvoice
+BV_BUILDDIR=$(switch_builddir)/libs/broadvoice
+LOCAL_CFLAGS=-I$(BV_BUILDDIR)/src -I$(BV_DIR)/src 
+BV_LA=$(BV_BUILDDIR)/src/.libs/libbroadvoice.la
 LOCAL_LIBADD=$(BV_LA)
 include $(BASE)/build/modmake.rules
 
 $(BV_LA): $(BV_DIR)/.update	
-	cd $(BV_DIR) && $(MAKE)
+	cd $(BV_BUILDDIR) && $(MAKE)
 	$(TOUCH_TARGET)
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_bv/mod_bv.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_bv/mod_bv.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_bv/mod_bv.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -51,16 +51,16 @@
 
 	if (!(encoding || decoding) || (!(context = switch_core_alloc(codec->memory_pool, sizeof(*context))))) {
 		return SWITCH_STATUS_FALSE;
-	} 
+	}
 
 	if (encoding) {
 		context->encoder_object = bv16_encode_init(NULL);
 	}
-	
+
 	if (decoding) {
 		context->decoder_object = bv16_decode_init(NULL);
 	}
-	
+
 	codec->private_info = context;
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -68,7 +68,7 @@
 static switch_status_t switch_bv16_destroy(switch_codec_t *codec)
 {
 	struct bv16_context *context = codec->private_info;
-	
+
 	if (context->encoder_object) {
 		bv16_encode_free(context->encoder_object);
 	}
@@ -134,16 +134,16 @@
 
 	if (!(encoding || decoding) || (!(context = switch_core_alloc(codec->memory_pool, sizeof(*context))))) {
 		return SWITCH_STATUS_FALSE;
-	} 
+	}
 
 	if (encoding) {
 		context->encoder_object = bv32_encode_init(NULL);
 	}
-	
+
 	if (decoding) {
 		context->decoder_object = bv32_decode_init(NULL);
 	}
-	
+
 	codec->private_info = context;
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -180,7 +180,7 @@
 	}
 
 	*encoded_data_len = bv32_encode(context->encoder_object, (uint8_t *) encoded_data, (int16_t *) decoded_data, decoded_data_len / 2);
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -208,61 +208,57 @@
 SWITCH_MODULE_LOAD_FUNCTION(mod_bv_load)
 {
 	switch_codec_interface_t *codec_interface;
-	int mpf, spf, bpf, ebpf, count; 
+	int mpf, spf, bpf, ebpf, count;
 
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
-	
-	SWITCH_ADD_CODEC(codec_interface, "BroadVoice16 (BV16)"); 
 
+	SWITCH_ADD_CODEC(codec_interface, "BroadVoice16 (BV16)");
+
 	mpf = 10000, spf = 80, bpf = 160, ebpf = 20;
-	
-	for (count = 12; count > 0; count--) { 
-		switch_core_codec_add_implementation(pool,
-											 codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 106,						/* the IANA code number */
-											 "BV16",					/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 8000,						/* samples transferred per second */
-											 8000,						/* actual samples transferred per second */
-											 16000,						/* bits transferred per second */
-											 mpf * count,				/* number of microseconds per frame */
-											 spf * count,				/* number of samples per frame */
-											 bpf * count,				/* number of bytes per frame decompressed */
-											 ebpf * count,				/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 1,							/* number of frames per network packet */
-											 switch_bv16_init,			/* function to initialize a codec handle using this implementation */
-											 switch_bv16_encode,		/* function to encode raw data into encoded data */
-											 switch_bv16_decode,		/* function to decode encoded data into raw data */
-											 switch_bv16_destroy);		/* deinitalize a codec handle using this implementation */
+
+	for (count = 12; count > 0; count--) {
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 106,	/* the IANA code number */
+											 "BV16",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 8000,	/* samples transferred per second */
+											 8000,	/* actual samples transferred per second */
+											 16000,	/* bits transferred per second */
+											 mpf * count,	/* number of microseconds per frame */
+											 spf * count,	/* number of samples per frame */
+											 bpf * count,	/* number of bytes per frame decompressed */
+											 ebpf * count,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 1,	/* number of frames per network packet */
+											 switch_bv16_init,	/* function to initialize a codec handle using this implementation */
+											 switch_bv16_encode,	/* function to encode raw data into encoded data */
+											 switch_bv16_decode,	/* function to decode encoded data into raw data */
+											 switch_bv16_destroy);	/* deinitalize a codec handle using this implementation */
 	}
 
-	SWITCH_ADD_CODEC(codec_interface, "BroadVoice32 (BV32)"); 
+	SWITCH_ADD_CODEC(codec_interface, "BroadVoice32 (BV32)");
 
-	mpf = 10000, spf = 160, bpf = 320 , ebpf = 40;
+	mpf = 10000, spf = 160, bpf = 320, ebpf = 40;
 
-	for (count = 6; count > 0; count--) { 
-		switch_core_codec_add_implementation(pool,
-											 codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 127,						/* the IANA code number */
-											 "BV32",					/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 16000,						/* samples transferred per second */
-											 16000,						/* actual samples transferred per second */
-											 32000,						/* bits transferred per second */
-											 mpf * count,				/* number of microseconds per frame */
-											 spf * count,				/* number of samples per frame */
-											 bpf * count,				/* number of bytes per frame decompressed */
-											 ebpf * count,				/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 1,							/* number of frames per network packet */
-											 switch_bv32_init,			/* function to initialize a codec handle using this implementation */
-											 switch_bv32_encode,		/* function to encode raw data into encoded data */
-											 switch_bv32_decode,		/* function to decode encoded data into raw data */
-											 switch_bv32_destroy);		/* deinitalize a codec handle using this implementation */
+	for (count = 6; count > 0; count--) {
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 127,	/* the IANA code number */
+											 "BV32",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 16000,	/* samples transferred per second */
+											 16000,	/* actual samples transferred per second */
+											 32000,	/* bits transferred per second */
+											 mpf * count,	/* number of microseconds per frame */
+											 spf * count,	/* number of samples per frame */
+											 bpf * count,	/* number of bytes per frame decompressed */
+											 ebpf * count,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 1,	/* number of frames per network packet */
+											 switch_bv32_init,	/* function to initialize a codec handle using this implementation */
+											 switch_bv32_encode,	/* function to encode raw data into encoded data */
+											 switch_bv32_decode,	/* function to decode encoded data into raw data */
+											 switch_bv32_destroy);	/* deinitalize a codec handle using this implementation */
 	}
 
 	/* indicate that the module should continue to be loaded */

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_celt


Name: svn:ignore
   + mod_celt.loT

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_celt/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_celt/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_celt/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,20 +1,22 @@
 BASE=../../../..
 
-CELT=celt-0.7.0
+CELT=celt-0.7.1
 
-CELT_DIR=$(BASE)/libs/$(CELT)
+CELT_DIR=$(switch_srcdir)/libs/$(CELT)
+CELT_BUILDDIR=$(switch_builddir)/libs/$(CELT)
 LOCAL_CFLAGS=-I$(CELT_DIR)/libcelt
-CELT_LA=$(CELT_DIR)/libcelt/.libs/libcelt.la
+CELT_LA=$(CELT_BUILDDIR)/libcelt/.libs/libcelt0.la
 LOCAL_LIBADD=$(CELT_LA)
 include $(BASE)/build/modmake.rules
 
 $(CELT_DIR):
 	$(GETLIB) $(CELT).tar.gz
 
-$(CELT_DIR)/Makefile: $(CELT_DIR)
-	cd $(CELT_DIR) && CFLAGS=$(AM_CFLAGS) ./configure --disable-shared --with-pic
+$(CELT_BUILDDIR)/Makefile: $(CELT_DIR)
+	mkdir -p $(CELT_BUILDDIR)
+	cd $(CELT_BUILDDIR) && $(DEFAULT_VARS) $(CELT_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(CELT_DIR)
 
-$(CELT_LA): $(CELT_DIR)/Makefile
-	cd $(CELT_DIR) && $(MAKE)
+$(CELT_LA): $(CELT_BUILDDIR)/Makefile
+	cd $(CELT_BUILDDIR) && $(MAKE)
 	$(TOUCH_TARGET)
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_celt/mod_celt.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_celt/mod_celt.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_celt/mod_celt.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -51,43 +51,43 @@
 
 	if (!(encoding || decoding) || (!(context = switch_core_alloc(codec->memory_pool, sizeof(*context))))) {
 		return SWITCH_STATUS_FALSE;
-	} 
+	}
 
-	context->mode_object = celt_mode_create(codec->implementation->actual_samples_per_second, codec->implementation->samples_per_packet, NULL); 
+	context->mode_object = celt_mode_create(codec->implementation->actual_samples_per_second, codec->implementation->samples_per_packet, NULL);
 	celt_mode_info(context->mode_object, CELT_GET_FRAME_SIZE, &context->frame_size);
-	context->bytes_per_packet = (codec->implementation->bits_per_second * context->frame_size/codec->implementation->actual_samples_per_second + 4) / 8;
+	context->bytes_per_packet = (codec->implementation->bits_per_second * context->frame_size / codec->implementation->actual_samples_per_second + 4) / 8;
 
 	/*
-	if (codec->fmtp_in) {
-		int x, argc;
-		char *argv[10];
-		argc = switch_separate_string(codec->fmtp_in, ';', argv, (sizeof(argv) / sizeof(argv[0])));
-		for (x = 0; x < argc; x++) {
-			char *data = argv[x];
-			char *arg;
-			switch_assert(data);
-			while (*data == ' ') {
-				data++;
-			}
-			if ((arg = strchr(data, '='))) {
-				*arg++ = '\0';
-				if (!strcasecmp(data, "bitrate")) {
-					bit_rate = atoi(arg);
-				}
-			}
-		}
-	}
-	
-	codec->fmtp_out = switch_core_sprintf(codec->memory_pool, "bitrate=%d", bit_rate);
-	*/
+	   if (codec->fmtp_in) {
+	   int x, argc;
+	   char *argv[10];
+	   argc = switch_separate_string(codec->fmtp_in, ';', argv, (sizeof(argv) / sizeof(argv[0])));
+	   for (x = 0; x < argc; x++) {
+	   char *data = argv[x];
+	   char *arg;
+	   switch_assert(data);
+	   while (*data == ' ') {
+	   data++;
+	   }
+	   if ((arg = strchr(data, '='))) {
+	   *arg++ = '\0';
+	   if (!strcasecmp(data, "bitrate")) {
+	   bit_rate = atoi(arg);
+	   }
+	   }
+	   }
+	   }
+
+	   codec->fmtp_out = switch_core_sprintf(codec->memory_pool, "bitrate=%d", bit_rate);
+	 */
 	if (encoding) {
 		context->encoder_object = celt_encoder_create(context->mode_object, 1, NULL);
 	}
-	
+
 	if (decoding) {
 		context->decoder_object = celt_decoder_create(context->mode_object, 1, NULL);
 	}
-	
+
 	codec->private_info = context;
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -111,8 +111,8 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	*encoded_data_len = (uint32_t) celt_encode(context->encoder_object, (void *)decoded_data, NULL,
-											   (unsigned char *)encoded_data, context->bytes_per_packet);
+	*encoded_data_len = (uint32_t) celt_encode(context->encoder_object, (void *) decoded_data, NULL,
+											   (unsigned char *) encoded_data, context->bytes_per_packet);
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -149,52 +149,48 @@
 
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
-	
-	SWITCH_ADD_CODEC(codec_interface, "CELT ultra-low delay"); 
 
-	switch_core_codec_add_implementation(pool,
-										 codec_interface,
-										 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-										 114,						/* the IANA code number */
-										 "CELT",					/* the IANA code name */
-										 NULL,						/* default fmtp to send (can be overridden by the init function) */
-										 32000,						/* samples transferred per second */
-										 32000,						/* actual samples transferred per second */
-										 32000,						/* bits transferred per second */
-										 10000,						/* number of microseconds per frame */
-										 320,						/* number of samples per frame */
-										 640,						/* number of bytes per frame decompressed */
-										 0,							/* number of bytes per frame compressed */
-										 1,							/* number of channels represented */
-										 1,							/* number of frames per network packet */
-										 switch_celt_init,			/* function to initialize a codec handle using this implementation */
-										 switch_celt_encode,		/* function to encode raw data into encoded data */
-										 switch_celt_decode,		/* function to decode encoded data into raw data */
-										 switch_celt_destroy);		/* deinitalize a codec handle using this implementation */
+	SWITCH_ADD_CODEC(codec_interface, "CELT ultra-low delay");
+
+	switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+										 114,	/* the IANA code number */
+										 "CELT",	/* the IANA code name */
+										 NULL,	/* default fmtp to send (can be overridden by the init function) */
+										 32000,	/* samples transferred per second */
+										 32000,	/* actual samples transferred per second */
+										 32000,	/* bits transferred per second */
+										 10000,	/* number of microseconds per frame */
+										 320,	/* number of samples per frame */
+										 640,	/* number of bytes per frame decompressed */
+										 0,	/* number of bytes per frame compressed */
+										 1,	/* number of channels represented */
+										 1,	/* number of frames per network packet */
+										 switch_celt_init,	/* function to initialize a codec handle using this implementation */
+										 switch_celt_encode,	/* function to encode raw data into encoded data */
+										 switch_celt_decode,	/* function to decode encoded data into raw data */
+										 switch_celt_destroy);	/* deinitalize a codec handle using this implementation */
 	ms_per_frame = 2000;
 	samples_per_frame = 96;
 	bytes_per_frame = 192;
-	
+
 	for (x = 0; x < 5; x++) {
-		switch_core_codec_add_implementation(pool,
-											 codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 114,						/* the IANA code number */
-											 "CELT",					/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 48000,						/* samples transferred per second */
-											 48000,						/* actual samples transferred per second */
-											 48000,						/* bits transferred per second */
-											 ms_per_frame,				/* number of microseconds per frame */
-											 samples_per_frame,			/* number of samples per frame */
-											 bytes_per_frame,			/* number of bytes per frame decompressed */
-											 0,							/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 1,							/* number of frames per network packet */
-											 switch_celt_init,			/* function to initialize a codec handle using this implementation */
-											 switch_celt_encode,		/* function to encode raw data into encoded data */
-											 switch_celt_decode,		/* function to decode encoded data into raw data */
-											 switch_celt_destroy);		/* deinitalize a codec handle using this implementation */
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 114,	/* the IANA code number */
+											 "CELT",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 48000,	/* samples transferred per second */
+											 48000,	/* actual samples transferred per second */
+											 48000,	/* bits transferred per second */
+											 ms_per_frame,	/* number of microseconds per frame */
+											 samples_per_frame,	/* number of samples per frame */
+											 bytes_per_frame,	/* number of bytes per frame decompressed */
+											 0,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 1,	/* number of frames per network packet */
+											 switch_celt_init,	/* function to initialize a codec handle using this implementation */
+											 switch_celt_encode,	/* function to encode raw data into encoded data */
+											 switch_celt_decode,	/* function to decode encoded data into raw data */
+											 switch_celt_destroy);	/* deinitalize a codec handle using this implementation */
 		ms_per_frame += 2000;
 		samples_per_frame += 96;
 		bytes_per_frame += 192;

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_celt/mod_celt.vcproj (from rev 16612, freeswitch/trunk/src/mod/codecs/mod_celt/mod_celt.vcproj) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_celt/mod_celt.vcproj	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_celt/mod_celt.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,293 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="mod_celt"
+	ProjectGUID="{4D418176-3B33-47E6-A63E-01BA34ADD21C}"
+	RootNamespace="mod_celt"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="..\..\..\..\libs\celt-0.7.1\libcelt"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)Debug/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="..\..\..\..\libs\celt-0.7.1\libcelt"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="..\..\..\..\libs\celt-0.7.1\libcelt"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)Release/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			OutputDirectory="$(PlatformName)\$(ConfigurationName)"
+			IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="..\..\..\..\libs\celt-0.7.1\libcelt"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath="mod_celt.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -33,7 +33,7 @@
 #include <switch.h>
 #include <g711.h>
 #include <poll.h>
-#include <linux/types.h> /* __u32 */
+#include <linux/types.h>		/* __u32 */
 #include <sys/ioctl.h>
 #include <unistd.h>
 #include <fcntl.h>
@@ -75,8 +75,8 @@
 #define DAHDI_FORMAT_G729A   (1 << 8)
 
 struct dahdi_transcoder_formats {
-	__u32   srcfmt;
-	__u32   dstfmt;
+	__u32 srcfmt;
+	__u32 dstfmt;
 };
 
 struct dahdi_transcoder_info {
@@ -108,15 +108,11 @@
 	int32_t fdflags;
 	int32_t fd = open(transcoding_device, O_RDWR);
 	if (fd < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-				"Failed to open %s transcoder device: %s.\n", 
-				transcoder_name, strerror(errno));
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open %s transcoder device: %s.\n", transcoder_name, strerror(errno));
 		return -1;
 	}
 	if (ioctl(fd, DAHDI_TC_ALLOCATE, fmts)) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-				"Failed to attach to transcoder: %s.\n", 
-				strerror(errno));
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to attach to transcoder: %s.\n", strerror(errno));
 		close(fd);
 		return -1;
 	}
@@ -124,15 +120,14 @@
 	if (fdflags > -1) {
 		fdflags |= O_NONBLOCK;
 		if (fcntl(fd, F_SETFL, fdflags)) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not set non-block mode in %s transcoder FD: %s\n", 
-					transcoder_name, strerror(errno));
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not set non-block mode in %s transcoder FD: %s\n",
+							  transcoder_name, strerror(errno));
 			/* should we abort? this may cause channels to hangup when overruning the device 
 			 * see jira dahdi codec issue MODCODEC-8 (Hung Calls and Codec DAHDI G.729A 8.0k decoder error!)
 			 * */
 		}
 	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not get flags from %s transcoder FD: %s\n", 
-				transcoder_name, strerror(errno));
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not get flags from %s transcoder FD: %s\n", transcoder_name, strerror(errno));
 	}
 
 	if (fmts->srcfmt & DAHDI_FORMAT_ULAW) {
@@ -154,19 +149,17 @@
 	struct dahdi_context *context = codec->private_info;
 
 	fmts.srcfmt = DAHDI_FORMAT_ULAW;
-	fmts.dstfmt = (codec->implementation->ianacode == CODEC_G729_IANA_CODE) 
+	fmts.dstfmt = (codec->implementation->ianacode == CODEC_G729_IANA_CODE)
 		? DAHDI_FORMAT_G729A : DAHDI_FORMAT_G723_1;
 	context->encoding_fd = switch_dahdi_get_transcoder(&fmts);
 	if (context->encoding_fd < 0) {
 #ifdef DEBUG_DAHDI_CODEC
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "encoding requested and denied with %d/%d.\n",
-						  fmts.srcfmt, fmts.dstfmt);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "encoding requested and denied with %d/%d.\n", fmts.srcfmt, fmts.dstfmt);
 #endif
 		return SWITCH_STATUS_FALSE;
 	}
 #ifdef DEBUG_DAHDI_CODEC
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Encoding requested and granted with %d/%d.\n",
-					  fmts.srcfmt, fmts.dstfmt);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Encoding requested and granted with %d/%d.\n", fmts.srcfmt, fmts.dstfmt);
 #endif
 
 
@@ -176,23 +169,21 @@
 
 static switch_status_t init_decoder(switch_codec_t *codec)
 {
-    struct dahdi_transcoder_formats fmts;
-    struct dahdi_context *context = codec->private_info;
+	struct dahdi_transcoder_formats fmts;
+	struct dahdi_context *context = codec->private_info;
 
 	fmts.dstfmt = DAHDI_FORMAT_ULAW;
-	fmts.srcfmt = (codec->implementation->ianacode == CODEC_G729_IANA_CODE) 
+	fmts.srcfmt = (codec->implementation->ianacode == CODEC_G729_IANA_CODE)
 		? DAHDI_FORMAT_G729A : DAHDI_FORMAT_G723_1;
 	context->decoding_fd = switch_dahdi_get_transcoder(&fmts);
 	if (context->decoding_fd < 0) {
 #ifdef DEBUG_DAHDI_CODEC
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Decoding requested and denied with %d/%d.\n",
-				fmts.srcfmt, fmts.dstfmt);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Decoding requested and denied with %d/%d.\n", fmts.srcfmt, fmts.dstfmt);
 #endif
 		return SWITCH_STATUS_FALSE;
 	}
 #ifdef DEBUG_DAHDI_CODEC
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Decoding requested and granted with %d/%d.\n",
-				fmts.srcfmt, fmts.dstfmt);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Decoding requested and granted with %d/%d.\n", fmts.srcfmt, fmts.dstfmt);
 #endif
 
 	return SWITCH_STATUS_SUCCESS;
@@ -228,7 +219,7 @@
 	/* ulaw requires 8 times more storage than g729 and 12 times more than G723, right? 
 	 * this can be used to calculate the target buffer when encoding and decoding
 	 * */
-	context->codec_r = (codec->implementation->ianacode == CODEC_G729_IANA_CODE) 
+	context->codec_r = (codec->implementation->ianacode == CODEC_G729_IANA_CODE)
 		? 8 : 12;
 
 
@@ -238,7 +229,7 @@
 static int wait_for_transcoder(int fd)
 {
 	/* let's wait a bit for the transcoder, if in 20msthe driver does not notify us that its ready to give us something
-	then just bail out with 0 bytes encoded/decoded as result, I'd expect the card to hold that buffer and return it later */
+	   then just bail out with 0 bytes encoded/decoded as result, I'd expect the card to hold that buffer and return it later */
 	int res = 0;
 	struct pollfd readpoll;
 	memset(&readpoll, 0, sizeof(readpoll));
@@ -246,21 +237,21 @@
 	readpoll.events = POLLIN;
 	/* my testing shows that it does not take more than 1ms to encode a 160 bytes frame ulaw to g729,
 	   I dont think there is much difference decoding and for g723, waiting 10ms seems more than reasonable */
-	res = poll(&readpoll, 1, 10); 
+	res = poll(&readpoll, 1, 10);
 	return res;
 }
 
 static switch_status_t switch_dahdi_encode(switch_codec_t *codec,
-					   switch_codec_t *other_codec,
-					   void *decoded_data,
-					   uint32_t decoded_data_len,
-					   uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
-					   unsigned int *flag)
+										   switch_codec_t *other_codec,
+										   void *decoded_data,
+										   uint32_t decoded_data_len,
+										   uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
+										   unsigned int *flag)
 {
 	int32_t res;
 	short *dbuf_linear;
 	unsigned char *ebuf_g729;
-	unsigned char ebuf_ulaw[decoded_data_len/2];
+	unsigned char ebuf_ulaw[decoded_data_len / 2];
 	uint32_t i;
 	struct dahdi_context *context = NULL;
 	switch_status_t status;
@@ -290,7 +281,8 @@
 		return SWITCH_STATUS_FALSE;
 	}
 	if (i != res) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Requested to write %d bytes to %s encoder device, but only wrote %d bytes.\n", i, transcoder_name, res);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Requested to write %d bytes to %s encoder device, but only wrote %d bytes.\n", i,
+						  transcoder_name, res);
 		return SWITCH_STATUS_FALSE;
 	}
 	res = wait_for_transcoder(context->encoding_fd);
@@ -333,7 +325,7 @@
 	int32_t res;
 	short *dbuf_linear;
 	// we only can decode up to half ulaw bytes of whatever their destiny linear buffer is
-	unsigned char dbuf_ulaw[*decoded_data_len/2]; 
+	unsigned char dbuf_ulaw[*decoded_data_len / 2];
 	unsigned char *ebuf_g729;
 	uint32_t i;
 	struct dahdi_context *context;
@@ -360,7 +352,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Switch DAHDI decode in silence returned %d bytes.\n", *decoded_data_len);
 #endif
 		return SWITCH_STATUS_SUCCESS;
-	} 
+	}
 #ifdef DEBUG_DAHDI_CODEC
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Writing %d bytes to decode.\n", encoded_data_len);
 #endif
@@ -370,12 +362,12 @@
 		return SWITCH_STATUS_FALSE;
 	}
 	if (encoded_data_len != res) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Requested to write %d bytes to %s decoder device, but only wrote %d bytes.\n", encoded_data_len, transcoder_name, res);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Requested to write %d bytes to %s decoder device, but only wrote %d bytes.\n",
+						  encoded_data_len, transcoder_name, res);
 		return SWITCH_STATUS_FALSE;
 	}
 #ifdef DEBUG_DAHDI_CODEC
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Attempting to read from device %d bytes of decoded ulaw data.\n", 
-			sizeof(dbuf_ulaw));
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Attempting to read from device %d bytes of decoded ulaw data.\n", sizeof(dbuf_ulaw));
 #endif
 	res = wait_for_transcoder(context->decoding_fd);
 	if (-1 == res) {
@@ -386,7 +378,8 @@
 		memset(dbuf_linear, 0, codec->implementation->decoded_bytes_per_packet);
 		*decoded_data_len = codec->implementation->decoded_bytes_per_packet;
 #ifdef DEBUG_DAHDI_CODEC
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No output on %s decoder device, returning silence frame of %d bytes.\n", transcoder_name, *decoded_data_len);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No output on %s decoder device, returning silence frame of %d bytes.\n", transcoder_name,
+						  *decoded_data_len);
 #endif
 		return SWITCH_STATUS_SUCCESS;
 	}
@@ -437,10 +430,8 @@
 		return SWITCH_STATUS_SUCCESS;
 	}
 	switch_mutex_lock(transcoder_counter_mutex);
-	stream->write_function(stream, "Using %d encoders of a total of %d available.\n",
-			total_encoders_usage, total_encoders);
-	stream->write_function(stream, "Using %d decoders of a total of %d available.\n",
-			total_decoders_usage, total_decoders);
+	stream->write_function(stream, "Using %d encoders of a total of %d available.\n", total_encoders_usage, total_encoders);
+	stream->write_function(stream, "Using %d decoders of a total of %d available.\n", total_decoders_usage, total_decoders);
 	switch_mutex_unlock(transcoder_counter_mutex);
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -452,6 +443,11 @@
 	struct stat statbuf;
 	struct dahdi_transcoder_info info = { 0 };
 	int32_t fd, res;
+	int mpf = 20000;			/* Algorithmic delay of 15ms with 5ms of look-ahead delay */
+	int spf = 160;
+	int bpfd = 320;
+	int bpfc = 20;
+	int fpnp = 20;
 
 	total_encoders = 0;
 	total_encoders_usage = 0;
@@ -474,8 +470,7 @@
 
 	fd = open(transcoding_device, O_RDWR);
 	if (fd < 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open %s transcoder device: %s.\n", 
-				transcoder_name, strerror(errno));
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open %s transcoder device: %s.\n", transcoder_name, strerror(errno));
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -486,14 +481,13 @@
 			continue;
 		}
 		if ((info.dstfmts & DAHDI_FORMAT_ULAW) && (info.srcfmts & (DAHDI_FORMAT_G729A | DAHDI_FORMAT_G723_1))) {
-			total_decoders  += info.numchannels;
+			total_decoders += info.numchannels;
 			continue;
 		}
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, 
-				"Not using transcoder %s, we just support ULAW and G723.1/G729A", info.name);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Not using transcoder %s, we just support ULAW and G723.1/G729A", info.name);
 	}
 	close(fd);
-	
+
 	if (!total_encoders && !total_decoders) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No DAHDI transcoders found.\n");
 		return SWITCH_STATUS_FALSE;
@@ -505,83 +499,73 @@
 
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
-	
-	SWITCH_ADD_CODEC(codec_interface, "DAHDI G.729A 8.0k"); /* 8.0kbit */
-	int mpf = 20000; /* Algorithmic delay of 15ms with 5ms of look-ahead delay */
-	int spf = 160; 
-	int bpfd = 320; 
-	int bpfc = 20; 
-	int fpnp = 20; 
-	switch_core_codec_add_implementation(pool,
-	 codec_interface,
-	 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-	 18,				/* the IANA code number */
-	 "G729",  			/* the IANA code name */
-	 NULL,				/* default fmtp to send (can be overridden by the init function) */
-	 8000,				/* samples transferred per second */
-	 8000,				/* actual samples transferred per second */
-	 8000,				/* bits transferred per second */
-	 mpf,				/* number of microseconds per frame */
-	 spf,				/* number of samples per frame */
-	 bpfd,				/* number of bytes per frame decompressed */
-	 bpfc,				/* number of bytes per frame compressed */
-	 1,				/* number of channels represented */
-	 fpnp,				/* number of frames per network packet */
-	 switch_dahdi_init, 		/* function to initialize a codec handle using this implementation */
-	 switch_dahdi_encode,		/* function to encode raw data into encoded data */
-	 switch_dahdi_decode,		/* function to decode encoded data into raw data */
-	 switch_dahdi_destroy);		/* deinitalize a codec handle using this implementation */
 
-	mpf = 30000; 
-	spf = 240; 
-	bpfd = 480; 
-	bpfc = 30; 
-	fpnp = 30; 
-	switch_core_codec_add_implementation(pool,
-	 codec_interface,
-	 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-	 18,				/* the IANA code number */
-	 "G729",  			/* the IANA code name */
-	 NULL,				/* default fmtp to send (can be overridden by the init function) */
-	 8000,				/* samples transferred per second */
-	 8000,				/* actual samples transferred per second */
-	 8000,				/* bits transferred per second */
-	 mpf,				/* number of microseconds per frame */
-	 spf,				/* number of samples per frame */
-	 bpfd,				/* number of bytes per frame decompressed */
-	 bpfc,				/* number of bytes per frame compressed */
-	 1,				/* number of channels represented */
-	 fpnp,				/* number of frames per network packet */
-	 switch_dahdi_init, 		/* function to initialize a codec handle using this implementation */
-	 switch_dahdi_encode,		/* function to encode raw data into encoded data */
-	 switch_dahdi_decode,		/* function to decode encoded data into raw data */
-	 switch_dahdi_destroy);		/* deinitalize a codec handle using this implementation */
+	SWITCH_ADD_CODEC(codec_interface, "DAHDI G.729A 8.0k");	/* 8.0kbit */
 
-	SWITCH_ADD_CODEC(codec_interface, "DAHDI G.723.1 5.3k"); /* 5.3kbit */
-	mpf = 30000; /* Algorithmic delay of 37.5ms with 7.5ms of look-ahead delay */
+	switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+										 18,	/* the IANA code number */
+										 "G729",	/* the IANA code name */
+										 NULL,	/* default fmtp to send (can be overridden by the init function) */
+										 8000,	/* samples transferred per second */
+										 8000,	/* actual samples transferred per second */
+										 8000,	/* bits transferred per second */
+										 mpf,	/* number of microseconds per frame */
+										 spf,	/* number of samples per frame */
+										 bpfd,	/* number of bytes per frame decompressed */
+										 bpfc,	/* number of bytes per frame compressed */
+										 1,	/* number of channels represented */
+										 fpnp,	/* number of frames per network packet */
+										 switch_dahdi_init,	/* function to initialize a codec handle using this implementation */
+										 switch_dahdi_encode,	/* function to encode raw data into encoded data */
+										 switch_dahdi_decode,	/* function to decode encoded data into raw data */
+										 switch_dahdi_destroy);	/* deinitalize a codec handle using this implementation */
+
+	mpf = 30000;
 	spf = 240;
 	bpfd = 480;
+	bpfc = 30;
+	fpnp = 30;
+	switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+										 18,	/* the IANA code number */
+										 "G729",	/* the IANA code name */
+										 NULL,	/* default fmtp to send (can be overridden by the init function) */
+										 8000,	/* samples transferred per second */
+										 8000,	/* actual samples transferred per second */
+										 8000,	/* bits transferred per second */
+										 mpf,	/* number of microseconds per frame */
+										 spf,	/* number of samples per frame */
+										 bpfd,	/* number of bytes per frame decompressed */
+										 bpfc,	/* number of bytes per frame compressed */
+										 1,	/* number of channels represented */
+										 fpnp,	/* number of frames per network packet */
+										 switch_dahdi_init,	/* function to initialize a codec handle using this implementation */
+										 switch_dahdi_encode,	/* function to encode raw data into encoded data */
+										 switch_dahdi_decode,	/* function to decode encoded data into raw data */
+										 switch_dahdi_destroy);	/* deinitalize a codec handle using this implementation */
+
+	SWITCH_ADD_CODEC(codec_interface, "DAHDI G.723.1 5.3k");	/* 5.3kbit */
+	mpf = 30000;				/* Algorithmic delay of 37.5ms with 7.5ms of look-ahead delay */
+	spf = 240;
+	bpfd = 480;
 	bpfc = 20;
 	fpnp = 10;
-	switch_core_codec_add_implementation(pool,
-	 codec_interface,
-	 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-	 4,				/* the IANA code number */
-	 "G723",  			/* the IANA code name */
-	 NULL,				/* default fmtp to send (can be overridden by the init function) */
-	 8000,				/* samples transferred per second */
-	 8000,				/* actual samples transferred per second */
-	 8000,				/* bits transferred per second */
-	 mpf,				/* number of microseconds per frame */
-	 spf,				/* number of samples per frame */
-	 bpfd,				/* number of bytes per frame decompressed */
-	 bpfc,				/* number of bytes per frame compressed */
-	 1,				/* number of channels represented */
-	 fpnp,				/* number of frames per network packet */
-	 switch_dahdi_init, 		/* function to initialize a codec handle using this implementation */
-	 switch_dahdi_encode,		/* function to encode raw data into encoded data */
-	 switch_dahdi_decode,		/* function to decode encoded data into raw data */
-	 switch_dahdi_destroy);		/* deinitalize a codec handle using this implementation */
+	switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+										 4,	/* the IANA code number */
+										 "G723",	/* the IANA code name */
+										 NULL,	/* default fmtp to send (can be overridden by the init function) */
+										 8000,	/* samples transferred per second */
+										 8000,	/* actual samples transferred per second */
+										 8000,	/* bits transferred per second */
+										 mpf,	/* number of microseconds per frame */
+										 spf,	/* number of samples per frame */
+										 bpfd,	/* number of bytes per frame decompressed */
+										 bpfc,	/* number of bytes per frame compressed */
+										 1,	/* number of channels represented */
+										 fpnp,	/* number of frames per network packet */
+										 switch_dahdi_init,	/* function to initialize a codec handle using this implementation */
+										 switch_dahdi_encode,	/* function to encode raw data into encoded data */
+										 switch_dahdi_decode,	/* function to decode encoded data into raw data */
+										 switch_dahdi_destroy);	/* deinitalize a codec handle using this implementation */
 
 	SWITCH_ADD_API(api_interface, "dahdi_transcode", "DAHDI Transcode", dahdi_transcode_usage, NULL);
 	switch_console_set_complete("add dahdi_transcode");

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_g723_1/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_g723_1/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_g723_1/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,7 @@
 BASE=../../../..
-DIR=$(BASE)/libs/libg723_1
-A=$(DIR)/.libs/libg723.a
+DIR=$(switch_srcdir)/libs/libg723_1
+BUILDDIR=$(switch_bulddir)/libs/libg723_1
+A=$(BUILDDIR)/.libs/libg723.a
 
 LOCAL_INSERT_CFLAGS=if test -f $(A); then echo "-I$(DIR)/src/include" ; else echo "-DG723_PASSTHROUGH" ; fi ;
 LOCAL_INSERT_LDFLAGS=test ! -f $(A) || echo $(A) 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_g723_1/mod_g723_1.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_g723_1/mod_g723_1.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_g723_1/mod_g723_1.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -171,8 +171,8 @@
 {
 	switch_codec_interface_t *codec_interface;
 	int ompf = 30000, ospf = 240, obpf = 480, oebpf = 24, count = 0;
-	int mpf = ompf , spf = ospf , bpf = obpf , ebpf = oebpf ;
-	
+	int mpf = ompf, spf = ospf, bpf = obpf, ebpf = oebpf;
+
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	SWITCH_ADD_CODEC(codec_interface, "G.723.1 6.3k");
@@ -180,8 +180,7 @@
 	for (count = 0; count < 4; count++) {
 		switch_core_codec_add_implementation(pool, codec_interface,
 											 SWITCH_CODEC_TYPE_AUDIO, 4, "G723", NULL, 8000, 8000, 6300,
-											 mpf , spf , bpf , ebpf , 1, count,
-											 switch_g723_init, switch_g723_encode, switch_g723_decode, switch_g723_destroy);
+											 mpf, spf, bpf, ebpf, 1, count, switch_g723_init, switch_g723_encode, switch_g723_decode, switch_g723_destroy);
 		mpf += ompf;
 		spf += ospf;
 		bpf += obpf;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_g729/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_g729/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_g729/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,7 +1,9 @@
 BASE=../../../..
-DIR=$(BASE)/libs/libg729
-A=$(DIR)/.libs/libg729.a
 
+DIR=$(switch_srcdir)/libs/libg729
+BUILDDIR=$(switch_builddir)/libs/libg729
+A=$(BUILDDIR)/.libs/libg729.a
+
 LOCAL_INSERT_CFLAGS=if test -f $(A); then echo "-I$(DIR)/src/include" ; else echo "-DG729_PASSTHROUGH" ; fi ;
 LOCAL_INSERT_LDFLAGS=test ! -f $(A) || echo $(A) 
 include $(BASE)/build/modmake.rules

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_g729/mod_g729.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_g729/mod_g729.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_g729/mod_g729.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_h26x/mod_h26x.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_h26x/mod_h26x.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_h26x/mod_h26x.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_ilbc/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_ilbc/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_ilbc/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,11 +1,12 @@
 BASE=../../../..
-ILBC_DIR=$(BASE)/libs/ilbc
-ILBCLA=$(ILBC_DIR)/src/libilbc.la
-LOCAL_CFLAGS=-I$(ILBC_DIR)/src
+ILBC_DIR=$(switch_srcdir)/libs/ilbc
+ILBC_BUILDDIR=$(switch_builddir)/libs/ilbc
+ILBCLA=$(ILBC_BUILDDIR)/src/libilbc.la
+LOCAL_CFLAGS=-I$(ILBC_DIR)/src -I$(ILBC_BUILDDIR)/src
 LOCAL_LIBADD=$(ILBCLA)
 
 include $(BASE)/build/modmake.rules
 
 $(ILBCLA): $(ILBC_DIR) $(ILBC_DIR)/.update
-	cd $(ILBC_DIR) && $(MAKE)
+	cd $(ILBC_BUILDDIR) && $(MAKE)
 	$(TOUCH_TARGET)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_ilbc/mod_ilbc.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_ilbc/mod_ilbc.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_ilbc/mod_ilbc.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -46,10 +46,10 @@
 	int encoding = (flags & SWITCH_CODEC_FLAG_ENCODE);
 	int decoding = (flags & SWITCH_CODEC_FLAG_DECODE);
 	int mode = codec->implementation->microseconds_per_packet / 1000;
-	
+
 	if (!(encoding || decoding) || (!(context = switch_core_alloc(codec->memory_pool, sizeof(*context))))) {
 		return SWITCH_STATUS_FALSE;
-	} 
+	}
 
 	if (codec->fmtp_in) {
 		int x, argc;
@@ -70,9 +70,9 @@
 			}
 		}
 	}
-	
+
 	codec->fmtp_out = switch_core_sprintf(codec->memory_pool, "mode=%d", mode);
-	
+
 	if (encoding) {
 		ilbc_encode_init(&context->encoder_object, mode);
 	}
@@ -80,7 +80,7 @@
 	if (decoding) {
 		ilbc_decode_init(&context->decoder_object, mode, 0);
 	}
-	
+
 	codec->private_info = context;
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -122,7 +122,7 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	*decoded_data_len = (2 *ilbc_decode(&context->decoder_object, (int16_t *) decoded_data, (uint8_t *) encoded_data, encoded_data_len));
+	*decoded_data_len = (2 * ilbc_decode(&context->decoder_object, (int16_t *) decoded_data, (uint8_t *) encoded_data, encoded_data_len));
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -137,45 +137,41 @@
 
 	SWITCH_ADD_CODEC(codec_interface, "iLBC");
 
-	switch_core_codec_add_implementation(pool,
-										 codec_interface,
-										 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-										 98,						/* the IANA code number */
-										 "iLBC",					/* the IANA code name */
-										 "mode=20",					/* default fmtp to send (can be overridden by the init function) */
-										 8000,						/* samples transferred per second */
-										 8000,						/* actual samples transferred per second */
-										 15200,						/* bits transferred per second */
-										 20000,						/* number of microseconds per frame */
-										 ILBC_BLOCK_LEN_20MS,		/* number of samples per frame */
+	switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+										 98,	/* the IANA code number */
+										 "iLBC",	/* the IANA code name */
+										 "mode=20",	/* default fmtp to send (can be overridden by the init function) */
+										 8000,	/* samples transferred per second */
+										 8000,	/* actual samples transferred per second */
+										 15200,	/* bits transferred per second */
+										 20000,	/* number of microseconds per frame */
+										 ILBC_BLOCK_LEN_20MS,	/* number of samples per frame */
 										 ILBC_BLOCK_LEN_20MS * 2,	/* number of bytes per frame decompressed */
-										 ILBC_NO_OF_BYTES_20MS,		/* number of bytes per frame compressed */
-										 1,							/* number of channels represented */
-										 1,							/* number of frames per network packet */
-										 switch_ilbc_init,			/* function to initialize a codec handle using this implementation */
-										 switch_ilbc_encode,		/* function to encode raw data into encoded data */
-										 switch_ilbc_decode,		/* function to decode encoded data into raw data */
-										 switch_ilbc_destroy);		/* deinitalize a codec handle using this implementation */
+										 ILBC_NO_OF_BYTES_20MS,	/* number of bytes per frame compressed */
+										 1,	/* number of channels represented */
+										 1,	/* number of frames per network packet */
+										 switch_ilbc_init,	/* function to initialize a codec handle using this implementation */
+										 switch_ilbc_encode,	/* function to encode raw data into encoded data */
+										 switch_ilbc_decode,	/* function to decode encoded data into raw data */
+										 switch_ilbc_destroy);	/* deinitalize a codec handle using this implementation */
 
-	switch_core_codec_add_implementation(pool,
-										 codec_interface,
-										 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-										 97,						/* the IANA code number */
-										 "iLBC",					/* the IANA code name */
-										 "mode=30",					/* default fmtp to send (can be overridden by the init function) */
-										 8000,						/* samples transferred per second */
-										 8000,						/* actual samples transferred per second */
-										 13300,						/* bits transferred per second */
-										 30000,						/* number of microseconds per frame */
-										 ILBC_BLOCK_LEN_30MS,		/* number of samples per frame */
+	switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+										 97,	/* the IANA code number */
+										 "iLBC",	/* the IANA code name */
+										 "mode=30",	/* default fmtp to send (can be overridden by the init function) */
+										 8000,	/* samples transferred per second */
+										 8000,	/* actual samples transferred per second */
+										 13300,	/* bits transferred per second */
+										 30000,	/* number of microseconds per frame */
+										 ILBC_BLOCK_LEN_30MS,	/* number of samples per frame */
 										 ILBC_BLOCK_LEN_30MS * 2,	/* number of bytes per frame decompressed */
-										 ILBC_NO_OF_BYTES_30MS,		/* number of bytes per frame compressed */
-										 1,							/* number of channels represented */
-										 1,							/* number of frames per network packet */
-										 switch_ilbc_init,			/* function to initialize a codec handle using this implementation */
-										 switch_ilbc_encode,		/* function to encode raw data into encoded data */
-										 switch_ilbc_decode,		/* function to decode encoded data into raw data */
-										 switch_ilbc_destroy);		/* deinitalize a codec handle using this implementation */
+										 ILBC_NO_OF_BYTES_30MS,	/* number of bytes per frame compressed */
+										 1,	/* number of channels represented */
+										 1,	/* number of frames per network packet */
+										 switch_ilbc_init,	/* function to initialize a codec handle using this implementation */
+										 switch_ilbc_encode,	/* function to encode raw data into encoded data */
+										 switch_ilbc_decode,	/* function to decode encoded data into raw data */
+										 switch_ilbc_destroy);	/* deinitalize a codec handle using this implementation */
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_siren/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_siren/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_siren/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,10 +1,11 @@
 BASE=../../../..
-G722_1_DIR=$(BASE)/libs/libg722_1
-LOCAL_CFLAGS=-I$(G722_1_DIR)/src 
-G722_1_LA=$(G722_1_DIR)/src/.libs/libg722_1.la
+G722_1_DIR=$(switch_srcdir)/libs/libg722_1
+G722_1_BUILDDIR=$(switch_builddir)/libs/libg722_1
+LOCAL_CFLAGS=-I$(G722_1_DIR)/src  -I$(G722_1_BUILDDIR)/src
+G722_1_LA=$(G722_1_BUILDDIR)/src/.libs/libg722_1.la
 LOCAL_LIBADD=$(G722_1_LA)
 include $(BASE)/build/modmake.rules
 
 $(G722_1_LA): $(G722_1_DIR)/.update	
-	cd $(G722_1_DIR) && $(MAKE)
+	cd $(G722_1_BUILDDIR) && $(MAKE)
 	$(TOUCH_TARGET)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_siren/mod_siren.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_siren/mod_siren.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_siren/mod_siren.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -56,7 +56,7 @@
 
 	if (!(encoding || decoding) || (!(context = switch_core_alloc(codec->memory_pool, sizeof(*context))))) {
 		return SWITCH_STATUS_FALSE;
-	} 
+	}
 
 	if (codec->fmtp_in) {
 		int x, argc;
@@ -77,9 +77,9 @@
 			}
 		}
 	}
-	
+
 	codec->fmtp_out = switch_core_sprintf(codec->memory_pool, "bitrate=%d", bit_rate);
-	
+
 	if (encoding) {
 		g722_1_encode_init(&context->encoder_object, bit_rate, codec->implementation->samples_per_second);
 	}
@@ -87,7 +87,7 @@
 	if (decoding) {
 		g722_1_decode_init(&context->decoder_object, bit_rate, codec->implementation->samples_per_second);
 	}
-	
+
 	codec->private_info = context;
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -99,11 +99,11 @@
 }
 
 static switch_status_t switch_siren_encode(switch_codec_t *codec,
-										  switch_codec_t *other_codec,
-										  void *decoded_data,
-										  uint32_t decoded_data_len,
-										  uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
-										  unsigned int *flag)
+										   switch_codec_t *other_codec,
+										   void *decoded_data,
+										   uint32_t decoded_data_len,
+										   uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
+										   unsigned int *flag)
 {
 	struct siren_context *context = codec->private_info;
 
@@ -116,14 +116,14 @@
 }
 
 static switch_status_t switch_siren_decode(switch_codec_t *codec,
-										  switch_codec_t *other_codec,
-										  void *encoded_data,
-										  uint32_t encoded_data_len,
-										  uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
-										  unsigned int *flag)
+										   switch_codec_t *other_codec,
+										   void *encoded_data,
+										   uint32_t encoded_data_len,
+										   uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
+										   unsigned int *flag)
 {
 	struct siren_context *context = codec->private_info;
-	
+
 	if (!context) {
 		return SWITCH_STATUS_FALSE;
 	}
@@ -148,47 +148,43 @@
 
 	spf = 320, bpf = 640;
 	for (count = 3; count > 0; count--) {
-		switch_core_codec_add_implementation(pool,
-											 codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 107,						/* the IANA code number */
-											 "G7221",					/* the IANA code name */
-											 "bitrate=32000",			/* default fmtp to send (can be overridden by the init function) */
-											 16000,						/* samples transferred per second */
-											 16000,						/* actual samples transferred per second */
-											 32000,						/* bits transferred per second */
-											 mpf * count,				/* number of microseconds per frame */
-											 spf * count,				/* number of samples per frame */
-											 bpf * count,				/* number of bytes per frame decompressed */
-											 0,							/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 1,							/* number of frames per network packet */
-											 switch_siren_init,			/* function to initialize a codec handle using this implementation */
-											 switch_siren_encode,		/* function to encode raw data into encoded data */
-											 switch_siren_decode,		/* function to decode encoded data into raw data */
-											 switch_siren_destroy);		/* deinitalize a codec handle using this implementation */
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 107,	/* the IANA code number */
+											 "G7221",	/* the IANA code name */
+											 "bitrate=32000",	/* default fmtp to send (can be overridden by the init function) */
+											 16000,	/* samples transferred per second */
+											 16000,	/* actual samples transferred per second */
+											 32000,	/* bits transferred per second */
+											 mpf * count,	/* number of microseconds per frame */
+											 spf * count,	/* number of samples per frame */
+											 bpf * count,	/* number of bytes per frame decompressed */
+											 0,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 1,	/* number of frames per network packet */
+											 switch_siren_init,	/* function to initialize a codec handle using this implementation */
+											 switch_siren_encode,	/* function to encode raw data into encoded data */
+											 switch_siren_decode,	/* function to decode encoded data into raw data */
+											 switch_siren_destroy);	/* deinitalize a codec handle using this implementation */
 	}
 	spf = 640, bpf = 1280;
 	for (count = 3; count > 0; count--) {
-		switch_core_codec_add_implementation(pool,
-											 codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 115,						/* the IANA code number */
-											 "G7221",					/* the IANA code name */
-											 "bitrate=48000",			/* default fmtp to send (can be overridden by the init function) */
-											 32000,						/* samples transferred per second */
-											 32000,						/* actual samples transferred per second */
-											 48000,						/* bits transferred per second */
-											 mpf * count,				/* number of microseconds per frame */
-											 spf * count,				/* number of samples per frame */
-											 bpf * count,				/* number of bytes per frame decompressed */
-											 0,							/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 1,							/* number of frames per network packet */
-											 switch_siren_init,			/* function to initialize a codec handle using this implementation */
-											 switch_siren_encode,		/* function to encode raw data into encoded data */
-											 switch_siren_decode,		/* function to decode encoded data into raw data */
-											 switch_siren_destroy);		/* deinitalize a codec handle using this implementation */
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 115,	/* the IANA code number */
+											 "G7221",	/* the IANA code name */
+											 "bitrate=48000",	/* default fmtp to send (can be overridden by the init function) */
+											 32000,	/* samples transferred per second */
+											 32000,	/* actual samples transferred per second */
+											 48000,	/* bits transferred per second */
+											 mpf * count,	/* number of microseconds per frame */
+											 spf * count,	/* number of samples per frame */
+											 bpf * count,	/* number of bytes per frame decompressed */
+											 0,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 1,	/* number of frames per network packet */
+											 switch_siren_init,	/* function to initialize a codec handle using this implementation */
+											 switch_siren_encode,	/* function to encode raw data into encoded data */
+											 switch_siren_decode,	/* function to decode encoded data into raw data */
+											 switch_siren_destroy);	/* deinitalize a codec handle using this implementation */
 
 	}
 	/* indicate that the module should continue to be loaded */

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_skel_codec/mod_skel_codec.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_skel_codec/mod_skel_codec.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_skel_codec/mod_skel_codec.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -94,15 +94,14 @@
  * SWITCH_STATUS_NOOP, NOOP indicates that the audio in is already the same as the audio out, so no conversion was necessary.
  * SWITCH_STATUS_NOT_INITALIZED, failure to init, you can use this to init on first usage and no in switch_skel_init?
  * */
-static switch_status_t switch_skel_encode(switch_codec_t *codec,
-					   switch_codec_t *other_codec, /* codec that was used by the other side */
-					   void *decoded_data, /* decoded data that we must encode */
-					   uint32_t decoded_data_len /* decoded data length */,
-					   uint32_t decoded_rate /* rate of the decoded data */, 
-					   void *encoded_data, /* here we will store the encoded data */ 
-					   uint32_t *encoded_data_len, /* here we will set the length of the encoded data */ 
-					   uint32_t *encoded_rate /* here we will set the rate of the encoded data */,
-					   unsigned int *flag /* frame flag, see switch_frame_flag_enum_t */)
+static switch_status_t switch_skel_encode(switch_codec_t *codec, switch_codec_t *other_codec,	/* codec that was used by the other side */
+										  void *decoded_data,	/* decoded data that we must encode */
+										  uint32_t decoded_data_len /* decoded data length */ ,
+										  uint32_t decoded_rate /* rate of the decoded data */ ,
+										  void *encoded_data,	/* here we will store the encoded data */
+										  uint32_t *encoded_data_len,	/* here we will set the length of the encoded data */
+										  uint32_t *encoded_rate /* here we will set the rate of the encoded data */ ,
+										  unsigned int *flag /* frame flag, see switch_frame_flag_enum_t */ )
 {
 	struct skel_context *context = codec->private_info;
 	/* FS core checks the actual samples per second and microseconds per packet to determine the buffer size in the worst case scenario, no need to check
@@ -123,15 +122,15 @@
  * SWITCH_STATUS_NOOP, NOOP indicates that the audio in is already the same as the audio out, so no conversion was necessary.
  * SWITCH_STATUS_NOT_INITALIZED, failure to init, you can use this to init on first usage and no in switch_skel_init?
  * */
-static switch_status_t switch_skel_decode(switch_codec_t *codec, /* codec session handle */
-										   switch_codec_t *other_codec, /* what is this? */
-										   void *encoded_data, /* data that we must decode into slinear and put it in decoded_data */
-										   uint32_t encoded_data_len, /* length in bytes of the encoded data */
-										   uint32_t encoded_rate,  /* at which rate was the data encoded */
-										   void *decoded_data,  /* buffer where we must put the decoded data */
-										   uint32_t *decoded_data_len,  /* we must set this value to the size of the decoded data */
-										   uint32_t *decoded_rate, /* rate of the decoded data */
-										   unsigned int *flag /* frame flag, see switch_frame_flag_enum_t */)
+static switch_status_t switch_skel_decode(switch_codec_t *codec,	/* codec session handle */
+										  switch_codec_t *other_codec,	/* what is this? */
+										  void *encoded_data,	/* data that we must decode into slinear and put it in decoded_data */
+										  uint32_t encoded_data_len,	/* length in bytes of the encoded data */
+										  uint32_t encoded_rate,	/* at which rate was the data encoded */
+										  void *decoded_data,	/* buffer where we must put the decoded data */
+										  uint32_t *decoded_data_len,	/* we must set this value to the size of the decoded data */
+										  uint32_t *decoded_rate,	/* rate of the decoded data */
+										  unsigned int *flag /* frame flag, see switch_frame_flag_enum_t */ )
 {
 	struct skel_context *context = codec->private_info;
 	/* FS core checks the actual samples per second and microseconds per packet to determine the buffer size in the worst case scenario, no need to check
@@ -150,7 +149,7 @@
 	 * no need to free memory allocated from the pool though, the owner of the pool takes care of that */
 	struct skel_context *context = codec->private_info;
 	context->encodes = 0;
-	context->decodes = 0; /* silly, context was allocated in the pool and therefore will be destroyed soon, exact time is not guaranteed though */
+	context->decodes = 0;		/* silly, context was allocated in the pool and therefore will be destroyed soon, exact time is not guaranteed though */
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -180,32 +179,31 @@
 	/* SWITCH_ADD_CODEC allocates a codec interface structure from the pool the core gave us and adds it to the internal interface list the core keeps, 
 	 * gets a codec id and set the given codec name to it.
 	 * At this point there is an empty shell codec interface registered, but not yet implementations */
-	SWITCH_ADD_CODEC(codec_interface, "SKEL 8.0k"); /* 8.0kbit */
+	SWITCH_ADD_CODEC(codec_interface, "SKEL 8.0k");	/* 8.0kbit */
 
 	/* Now add as many codec implementations as needed, typically this is done inside a for loop where the packetization size is 
 	 * incremented (10ms, 20ms, 30ms etc) as needed */
-	switch_core_codec_add_implementation(pool,
-	 codec_interface, /* the codec interface we allocated and we want to register with the core */
-	 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-	 0,				    /* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */
-	 "SKEL",  			/* the IANA code name */
-	 NULL,				/* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */
-	 8000,				/* samples transferred per second */
-	 8000,				/* actual samples transferred per second */
-	 8000,				/* bits transferred per second */
-	 20000,				/* for 20ms (milliseconds) frames, 20,000 microseconds and so on, you can register the same codec with different packetization */
-	 160,				/* number of samples per frame, for this dummy implementation is 160, which is the number of samples in 20ms at 8000 samples per second */
-	 320,				/* number of bytes per frame decompressed */
-	 320,				/* number of bytes per frame compressed, since we dont really compress anything, is the same number as per frame decompressed */
-	 1,				    /* number of channels represented */
-	 20,				/* number of frames per network packet */
-	 switch_skel_init, 		/* function to initialize a codec session using this implementation */
-	 switch_skel_encode,		/* function to encode slinear data into encoded data */
-	 switch_skel_decode,		/* function to decode encoded data into slinear data */
-	 switch_skel_destroy);		/* deinitalize a codec handle using this implementation */
+	switch_core_codec_add_implementation(pool, codec_interface,	/* the codec interface we allocated and we want to register with the core */
+										 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+										 0,	/* the IANA code number, ie http://www.iana.org/assignments/rtp-parameters */
+										 "SKEL",	/* the IANA code name */
+										 NULL,	/* default fmtp to send (can be overridden by the init function), fmtp is used in SDP for format specific parameters */
+										 8000,	/* samples transferred per second */
+										 8000,	/* actual samples transferred per second */
+										 8000,	/* bits transferred per second */
+										 20000,	/* for 20ms (milliseconds) frames, 20,000 microseconds and so on, you can register the same codec with different packetization */
+										 160,	/* number of samples per frame, for this dummy implementation is 160, which is the number of samples in 20ms at 8000 samples per second */
+										 320,	/* number of bytes per frame decompressed */
+										 320,	/* number of bytes per frame compressed, since we dont really compress anything, is the same number as per frame decompressed */
+										 1,	/* number of channels represented */
+										 20,	/* number of frames per network packet */
+										 switch_skel_init,	/* function to initialize a codec session using this implementation */
+										 switch_skel_encode,	/* function to encode slinear data into encoded data */
+										 switch_skel_decode,	/* function to decode encoded data into slinear data */
+										 switch_skel_destroy);	/* deinitalize a codec handle using this implementation */
 
 	SWITCH_ADD_API(api_interface, "skel_sayhi", "Skel Codec Says Hi", skel_sayhi, NULL);
-	switch_console_set_complete("add skel_sayhi"); /* For CLI completion */
+	switch_console_set_complete("add skel_sayhi");	/* For CLI completion */
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_speex/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_speex/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_speex/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,17 +1,19 @@
 BASE=../../../..
 
-SPEEX_DIR=$(BASE)/libs/speex
-SPEEXLA=$(SPEEX_DIR)/libspeex/libspeex.la
-SPEEXDSPLA=$(SPEEX_DIR)/libspeex/libspeexdsp.la
+SPEEX_DIR=$(switch_srcdir)/libs/speex
+SPEEX_BUILDDIR=$(switch_builddir)/libs/speex
+SPEEXLA=$(SPEEX_BUILDDIR)/libspeex/libspeex.la
+SPEEXDSPLA=$(SPEEX_BUILDDIR)/libspeex/libspeexdsp.la
 
-LOCAL_CFLAGS=-I$(SPEEX_DIR)/include
+LOCAL_CFLAGS=-I$(SPEEX_DIR)/include -I$(SPEEX_BUILDDIR)/include
 LOCAL_LIBADD=$(SPEEXLA) $(SPEEXDSPLA)
 include $(BASE)/build/modmake.rules
 
 $(SPEEXLA): $(SPEEX_DIR) $(SPEEX_DIR)/.update
-	cd $(SPEEX_DIR)/libspeex && $(MAKE)
+	cd $(SPEEX_BUILDDIR)/libspeex && $(MAKE)
 	$(TOUCH_TARGET)
-	
+
 $(SPEEXDSPLA): $(SPEEX_DIR) $(SPEEX_DIR)/.update
-	cd $(SPEEX_DIR)/libspeex && $(MAKE)
-	$(TOUCH_TARGET)
\ No newline at end of file
+	cd $(SPEEX_BUILDDIR)/libspeex && $(MAKE)
+	$(TOUCH_TARGET)
+

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_speex/mod_speex.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_speex/mod_speex.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_speex/mod_speex.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -265,32 +265,30 @@
 {
 	switch_codec_interface_t *codec_interface;
 	int mpf = 20000, spf = 160, bpf = 320, rate = 8000, counta, countb;
-	switch_payload_t ianacode[4] = { 0, 98, 99, 103 };
+	switch_payload_t ianacode[4] = { 0, 99, 99, 99 };
 	int bps[4] = { 0, 24600, 42200, 44000 };
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	SWITCH_ADD_CODEC(codec_interface, "Speex");
 	for (counta = 1; counta <= 3; counta++) {
 		for (countb = 1; countb > 0; countb--) {
-			switch_core_codec_add_implementation(pool,
-												 codec_interface,
-												 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-												 ianacode[counta],			/* the IANA code number */
-												 "SPEEX",					/* the IANA code name */
-												 NULL,						/* default fmtp to send (can be overridden by the init function) */
-												 rate,						/* samples transferred per second */
-												 rate,						/* actual samples transferred per second */
-												 bps[counta],				/* bits transferred per second */
-												 mpf * countb,				/* number of microseconds per frame */
-												 spf * countb,				/* number of samples per frame */
-												 bpf * countb,				/* number of bytes per frame decompressed */
-												 0,							/* number of bytes per frame compressed */
-												 1,							/* number of channels represented */
-												 1,							/* number of frames per network packet */
-												 switch_speex_init,			/* function to initialize a codec handle using this implementation */
-												 switch_speex_encode,		/* function to encode raw data into encoded data */
-												 switch_speex_decode,		/* function to decode encoded data into raw data */
-												 switch_speex_destroy);		/* deinitalize a codec handle using this implementation */
+			switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+												 ianacode[counta],	/* the IANA code number */
+												 "SPEEX",	/* the IANA code name */
+												 NULL,	/* default fmtp to send (can be overridden by the init function) */
+												 rate,	/* samples transferred per second */
+												 rate,	/* actual samples transferred per second */
+												 bps[counta],	/* bits transferred per second */
+												 mpf * countb,	/* number of microseconds per frame */
+												 spf * countb,	/* number of samples per frame */
+												 bpf * countb,	/* number of bytes per frame decompressed */
+												 0,	/* number of bytes per frame compressed */
+												 1,	/* number of channels represented */
+												 1,	/* number of frames per network packet */
+												 switch_speex_init,	/* function to initialize a codec handle using this implementation */
+												 switch_speex_encode,	/* function to encode raw data into encoded data */
+												 switch_speex_decode,	/* function to decode encoded data into raw data */
+												 switch_speex_destroy);	/* deinitalize a codec handle using this implementation */
 		}
 		rate = rate * 2;
 		spf = spf * 2;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_voipcodecs/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_voipcodecs/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_voipcodecs/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,20 +1,23 @@
 BASE=../../../..
 
-TIFF_DIR=$(BASE)/libs/tiff-3.8.2
-TIFF_LA=$(TIFF_DIR)/libtiff/libtiff.la
+TIFF_DIR=$(switch_srcdir)/libs/tiff-3.8.2
+TIFF_BUILDDIR=$(switch_builddir)/libs/tiff-3.8.2
+TIFF_LA=$(TIFF_BUILDDIR)/libtiff/libtiff.la
 
-SPANDSP_DIR=$(BASE)/libs/spandsp
-SPANDSP_LA=$(SPANDSP_DIR)/src/libspandsp.la
+SPANDSP_DIR=$(switch_srcdir)/libs/spandsp
+SPANDSP_BUILDDIR=$(switch_builddir)/libs/spandsp
+SPANDSP_LA=$(SPANDSP_BUILDDIR)/src/libspandsp.la
 
-LOCAL_CFLAGS=-I$(SPANDSP_DIR)/src -I$(TIFF_DIR)/libtiff
+LOCAL_CFLAGS=-I$(SPANDSP_DIR)/src -I$(TIFF_DIR)/libtiff -I$(SPANDSP_BUILDDIR)/src -I$(TIFF_BUILDDIR)/libtiff
 LOCAL_LIBADD=$(SPANDSP_LA)
 
 include $(BASE)/build/modmake.rules
+$(MODNAME).lo: $(SPANDSP_LA) $(TIFF_LA)
 
 $(SPANDSP_LA): $(TIFF_LA) $(SPANDSP_DIR) $(SPANDSP_DIR)/.update
-	cd $(SPANDSP_DIR) && $(MAKE)
+	cd $(SPANDSP_BUILDDIR) && $(MAKE) -j1
 	$(TOUCH_TARGET)
 
 $(TIFF_LA): $(TIFF_DIR) $(TIFF_DIR)/.update
-	cd $(TIFF_DIR) && $(MAKE)
+	cd $(TIFF_BUILDDIR) && $(MAKE) -j1
 	$(TOUCH_TARGET)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -80,9 +80,11 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if (context->encoder_object) lpc10_encode_free(context->encoder_object);
+	if (context->encoder_object)
+		lpc10_encode_free(context->encoder_object);
 	context->encoder_object = NULL;
-	if (context->decoder_object) lpc10_decode_free(context->decoder_object);
+	if (context->decoder_object)
+		lpc10_decode_free(context->decoder_object);
 	context->decoder_object = NULL;
 
 	return SWITCH_STATUS_SUCCESS;
@@ -160,7 +162,8 @@
 										 switch_codec_t *other_codec,
 										 void *decoded_data,
 										 uint32_t decoded_data_len,
-										 uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag)
+										 uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
+										 unsigned int *flag)
 {
 	struct gsm_context *context = codec->private_info;
 
@@ -177,7 +180,8 @@
 										 switch_codec_t *other_codec,
 										 void *encoded_data,
 										 uint32_t encoded_data_len,
-										 uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag)
+										 uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
+										 unsigned int *flag)
 {
 	struct gsm_context *context = codec->private_info;
 
@@ -200,9 +204,11 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if (context->decoder_object) gsm0610_free(context->decoder_object);
+	if (context->decoder_object)
+		gsm0610_free(context->decoder_object);
 	context->decoder_object = NULL;
-	if (context->encoder_object) gsm0610_free(context->encoder_object);
+	if (context->encoder_object)
+		gsm0610_free(context->encoder_object);
 	context->encoder_object = NULL;
 
 	return SWITCH_STATUS_SUCCESS;
@@ -433,9 +439,11 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if (context->decoder_object) g722_decode_free(context->decoder_object);
+	if (context->decoder_object)
+		g722_decode_free(context->decoder_object);
 	context->decoder_object = NULL;
-	if (context->encoder_object) g722_encode_free(context->encoder_object);
+	if (context->encoder_object)
+		g722_encode_free(context->encoder_object);
 	context->encoder_object = NULL;
 
 	return SWITCH_STATUS_SUCCESS;
@@ -456,14 +464,14 @@
 
 	if (!(encoding || decoding)) {
 		return SWITCH_STATUS_FALSE;
-	} 
+	}
 
 	if ((flags & SWITCH_CODEC_FLAG_AAL2 || strstr(codec->implementation->iananame, "AAL2"))) {
 		packing = G726_PACKING_LEFT;
 	}
-	
+
 	context = g726_init(context, codec->implementation->bits_per_second, G726_ENCODING_LINEAR, packing);
-	
+
 	codec->private_info = context;
 	return SWITCH_STATUS_SUCCESS;
 
@@ -597,9 +605,11 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if (context->decoder_object) ima_adpcm_free(context->decoder_object);
+	if (context->decoder_object)
+		ima_adpcm_free(context->decoder_object);
 	context->decoder_object = NULL;
-	if (context->encoder_object) ima_adpcm_free(context->encoder_object);
+	if (context->encoder_object)
+		ima_adpcm_free(context->encoder_object);
 	context->encoder_object = NULL;
 
 	return SWITCH_STATUS_SUCCESS;
@@ -620,260 +630,238 @@
 	mpf = 10000, spf = 80, bpf = 160, ebpf = 80;
 	SWITCH_ADD_CODEC(codec_interface, "ADPCM (IMA)");
 	for (count = 12; count > 0; count--) {
-		switch_core_codec_add_implementation(pool,
-											 codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 5,							/* the IANA code number */
-											 "DVI4",					/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 8000,						/* samples transferred per second */
-											 8000,						/* actual samples transferred per second */
-											 32000,						/* bits transferred per second */
-											 mpf * count,				/* number of microseconds per frame */
-											 spf * count,				/* number of samples per frame */
-											 bpf * count,				/* number of bytes per frame decompressed */
-											 (ebpf * count) + 4,		/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 spf * count,				/* number of frames per network packet */
-											 switch_adpcm_init,			/* function to initialize a codec handle using this implementation */
-											 switch_adpcm_encode,		/* function to encode raw data into encoded data */
-											 switch_adpcm_decode,		/* function to decode encoded data into raw data */
-											 switch_adpcm_destroy);		/* deinitalize a codec handle using this implementation */
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 5,	/* the IANA code number */
+											 "DVI4",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 8000,	/* samples transferred per second */
+											 8000,	/* actual samples transferred per second */
+											 32000,	/* bits transferred per second */
+											 mpf * count,	/* number of microseconds per frame */
+											 spf * count,	/* number of samples per frame */
+											 bpf * count,	/* number of bytes per frame decompressed */
+											 (ebpf * count) + 4,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 spf * count,	/* number of frames per network packet */
+											 switch_adpcm_init,	/* function to initialize a codec handle using this implementation */
+											 switch_adpcm_encode,	/* function to encode raw data into encoded data */
+											 switch_adpcm_decode,	/* function to decode encoded data into raw data */
+											 switch_adpcm_destroy);	/* deinitalize a codec handle using this implementation */
 	}
 	mpf = 10000, spf = 160, bpf = 320, ebpf = 160;
 	for (count = 6; count > 0; count--) {
-		switch_core_codec_add_implementation(pool,
-											 codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 6,							/* the IANA code number */
-											 "DVI4",					/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 16000,						/* samples transferred per second */
-											 16000,						/* actual samples transferred per second */
-											 64000,						/* bits transferred per second */
-											 mpf * count,				/* number of microseconds per frame */
-											 spf * count,				/* number of samples per frame */
-											 bpf * count,				/* number of bytes per frame decompressed */
-											 (ebpf * count) + 4,		/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 spf * count,				/* number of frames per network packet */
-											 switch_adpcm_init,			/* function to initialize a codec handle using this implementation */
-											 switch_adpcm_encode,		/* function to encode raw data into encoded data */
-											 switch_adpcm_decode,		/* function to decode encoded data into raw data */
-											 switch_adpcm_destroy);		/* deinitalize a codec handle using this implementation */
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 6,	/* the IANA code number */
+											 "DVI4",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 16000,	/* samples transferred per second */
+											 16000,	/* actual samples transferred per second */
+											 64000,	/* bits transferred per second */
+											 mpf * count,	/* number of microseconds per frame */
+											 spf * count,	/* number of samples per frame */
+											 bpf * count,	/* number of bytes per frame decompressed */
+											 (ebpf * count) + 4,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 spf * count,	/* number of frames per network packet */
+											 switch_adpcm_init,	/* function to initialize a codec handle using this implementation */
+											 switch_adpcm_encode,	/* function to encode raw data into encoded data */
+											 switch_adpcm_decode,	/* function to decode encoded data into raw data */
+											 switch_adpcm_destroy);	/* deinitalize a codec handle using this implementation */
 	}
 
 	/* G726 */
 	mpf = 10000, spf = 80, bpf = 160, ebpf = 20;
 	SWITCH_ADD_CODEC(codec_interface, "G.726 16k (AAL2)");
 	for (count = 12; count > 0; count--) {
-		switch_core_codec_add_implementation(pool,
-											 codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 124,						/* the IANA code number */
-											 "AAL2-G726-16",			/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 8000,						/* samples transferred per second */
-											 8000,						/* actual samples transferred per second */
-											 16000,						/* bits transferred per second */
-											 mpf * count,				/* number of microseconds per frame */
-											 spf * count,				/* number of samples per frame */
-											 bpf * count,				/* number of bytes per frame decompressed */
-											 ebpf * count,				/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 count * 10,				/* number of frames per network packet */
-											 switch_g726_init,			/* function to initialize a codec handle using this implementation */
-											 switch_g726_encode,		/* function to encode raw data into encoded data */
-											 switch_g726_decode,		/* function to decode encoded data into raw data */
-											 switch_g726_destroy);		/* deinitalize a codec handle using this implementation */
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 124,	/* the IANA code number */
+											 "AAL2-G726-16",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 8000,	/* samples transferred per second */
+											 8000,	/* actual samples transferred per second */
+											 16000,	/* bits transferred per second */
+											 mpf * count,	/* number of microseconds per frame */
+											 spf * count,	/* number of samples per frame */
+											 bpf * count,	/* number of bytes per frame decompressed */
+											 ebpf * count,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 count * 10,	/* number of frames per network packet */
+											 switch_g726_init,	/* function to initialize a codec handle using this implementation */
+											 switch_g726_encode,	/* function to encode raw data into encoded data */
+											 switch_g726_decode,	/* function to decode encoded data into raw data */
+											 switch_g726_destroy);	/* deinitalize a codec handle using this implementation */
 	}
 	SWITCH_ADD_CODEC(codec_interface, "G.726 16k");
 	for (count = 12; count > 0; count--) {
-		switch_core_codec_add_implementation(pool,
-											 codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 127,						/* the IANA code number */
-											 "G726-16",					/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 8000,						/* samples transferred per second */
-											 8000,						/* actual samples transferred per second */
-											 16000,						/* bits transferred per second */
-											 mpf * count,				/* number of microseconds per frame */
-											 spf * count,				/* number of samples per frame */
-											 bpf * count,				/* number of bytes per frame decompressed */
-											 ebpf * count,				/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 count * 10,				/* number of frames per network packet */
-											 switch_g726_init,			/* function to initialize a codec handle using this implementation */
-											 switch_g726_encode,		/* function to encode raw data into encoded data */
-											 switch_g726_decode,		/* function to decode encoded data into raw data */
-											 switch_g726_destroy);		/* deinitalize a codec handle using this implementation */
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 124,	/* the IANA code number */
+											 "G726-16",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 8000,	/* samples transferred per second */
+											 8000,	/* actual samples transferred per second */
+											 16000,	/* bits transferred per second */
+											 mpf * count,	/* number of microseconds per frame */
+											 spf * count,	/* number of samples per frame */
+											 bpf * count,	/* number of bytes per frame decompressed */
+											 ebpf * count,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 count * 10,	/* number of frames per network packet */
+											 switch_g726_init,	/* function to initialize a codec handle using this implementation */
+											 switch_g726_encode,	/* function to encode raw data into encoded data */
+											 switch_g726_decode,	/* function to decode encoded data into raw data */
+											 switch_g726_destroy);	/* deinitalize a codec handle using this implementation */
 	}
 	/* Increase encoded bytes per frame by 10 */
 	ebpf = ebpf + 10;
 
 	SWITCH_ADD_CODEC(codec_interface, "G.726 24k (AAL2)");
 	for (count = 12; count > 0; count--) {
-		switch_core_codec_add_implementation(pool,
-											 codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 123,						/* the IANA code number */
-											 "AAL2-G726-24",			/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 8000,						/* samples transferred per second */
-											 8000,						/* actual samples transferred per second */
-											 24000,						/* bits transferred per second */
-											 mpf * count,				/* number of microseconds per frame */
-											 spf * count,				/* number of samples per frame */
-											 bpf * count,				/* number of bytes per frame decompressed */
-											 ebpf * count,				/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 count * 10,				/* number of frames per network packet */
-											 switch_g726_init,			/* function to initialize a codec handle using this implementation */
-											 switch_g726_encode,		/* function to encode raw data into encoded data */
-											 switch_g726_decode,		/* function to decode encoded data into raw data */
-											 switch_g726_destroy);		/* deinitalize a codec handle using this implementation */
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 123,	/* the IANA code number */
+											 "AAL2-G726-24",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 8000,	/* samples transferred per second */
+											 8000,	/* actual samples transferred per second */
+											 24000,	/* bits transferred per second */
+											 mpf * count,	/* number of microseconds per frame */
+											 spf * count,	/* number of samples per frame */
+											 bpf * count,	/* number of bytes per frame decompressed */
+											 ebpf * count,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 count * 10,	/* number of frames per network packet */
+											 switch_g726_init,	/* function to initialize a codec handle using this implementation */
+											 switch_g726_encode,	/* function to encode raw data into encoded data */
+											 switch_g726_decode,	/* function to decode encoded data into raw data */
+											 switch_g726_destroy);	/* deinitalize a codec handle using this implementation */
 	}
 
 	SWITCH_ADD_CODEC(codec_interface, "G.726 24k");
 	for (count = 12; count > 0; count--) {
-		switch_core_codec_add_implementation(pool,
-											 codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 123,						/* the IANA code number */
-											 "G726-24",					/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 8000,						/* samples transferred per second */
-											 8000,						/* actual samples transferred per second */
-											 24000,						/* bits transferred per second */
-											 mpf * count,				/* number of microseconds per frame */
-											 spf * count,				/* number of samples per frame */
-											 bpf * count,				/* number of bytes per frame decompressed */
-											 ebpf * count,				/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 count * 10,				/* number of frames per network packet */
-											 switch_g726_init,			/* function to initialize a codec handle using this implementation */
-											 switch_g726_encode,		/* function to encode raw data into encoded data */
-											 switch_g726_decode,		/* function to decode encoded data into raw data */
-											 switch_g726_destroy);		/* deinitalize a codec handle using this implementation */
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 123,	/* the IANA code number */
+											 "G726-24",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 8000,	/* samples transferred per second */
+											 8000,	/* actual samples transferred per second */
+											 24000,	/* bits transferred per second */
+											 mpf * count,	/* number of microseconds per frame */
+											 spf * count,	/* number of samples per frame */
+											 bpf * count,	/* number of bytes per frame decompressed */
+											 ebpf * count,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 count * 10,	/* number of frames per network packet */
+											 switch_g726_init,	/* function to initialize a codec handle using this implementation */
+											 switch_g726_encode,	/* function to encode raw data into encoded data */
+											 switch_g726_decode,	/* function to decode encoded data into raw data */
+											 switch_g726_destroy);	/* deinitalize a codec handle using this implementation */
 	}
 	/* Increase encoded bytes per frame by 10 */
 	ebpf = ebpf + 10;
 
 	SWITCH_ADD_CODEC(codec_interface, "G.726 32k (AAL2)");
 	for (count = 12; count > 0; count--) {
-		switch_core_codec_add_implementation(pool,
-											 codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 2,							/* the IANA code number */
-											 "AAL2-G726-32",			/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 8000,						/* samples transferred per second */
-											 8000,						/* actual samples transferred per second */
-											 32000,						/* bits transferred per second */
-											 mpf * count,				/* number of microseconds per frame */
-											 spf * count,				/* number of samples per frame */
-											 bpf * count,				/* number of bytes per frame decompressed */
-											 ebpf * count,				/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 count * 10,				/* number of frames per network packet */
-											 switch_g726_init,			/* function to initialize a codec handle using this implementation */
-											 switch_g726_encode,		/* function to encode raw data into encoded data */
-											 switch_g726_decode,		/* function to decode encoded data into raw data */
-											 switch_g726_destroy);		/* deinitalize a codec handle using this implementation */
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 122,	/* the IANA code number */
+											 "AAL2-G726-32",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 8000,	/* samples transferred per second */
+											 8000,	/* actual samples transferred per second */
+											 32000,	/* bits transferred per second */
+											 mpf * count,	/* number of microseconds per frame */
+											 spf * count,	/* number of samples per frame */
+											 bpf * count,	/* number of bytes per frame decompressed */
+											 ebpf * count,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 count * 10,	/* number of frames per network packet */
+											 switch_g726_init,	/* function to initialize a codec handle using this implementation */
+											 switch_g726_encode,	/* function to encode raw data into encoded data */
+											 switch_g726_decode,	/* function to decode encoded data into raw data */
+											 switch_g726_destroy);	/* deinitalize a codec handle using this implementation */
 	}
 	SWITCH_ADD_CODEC(codec_interface, "G.726 32k");
 	for (count = 12; count > 0; count--) {
-		switch_core_codec_add_implementation(pool,
-											 codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 2,							/* the IANA code number */
-											 "G726-32",					/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 8000,						/* samples transferred per second */
-											 8000,						/* actual samples transferred per second */
-											 32000,						/* bits transferred per second */
-											 mpf * count,				/* number of microseconds per frame */
-											 spf * count,				/* number of samples per frame */
-											 bpf * count,				/* number of bytes per frame decompressed */
-											 ebpf * count,				/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 count * 10,				/* number of frames per network packet */
-											 switch_g726_init,			/* function to initialize a codec handle using this implementation */
-											 switch_g726_encode,		/* function to encode raw data into encoded data */
-											 switch_g726_decode,		/* function to decode encoded data into raw data */
-											 switch_g726_destroy);		/* deinitalize a codec handle using this implementation */
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 122,	/* the IANA code number */
+											 "G726-32",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 8000,	/* samples transferred per second */
+											 8000,	/* actual samples transferred per second */
+											 32000,	/* bits transferred per second */
+											 mpf * count,	/* number of microseconds per frame */
+											 spf * count,	/* number of samples per frame */
+											 bpf * count,	/* number of bytes per frame decompressed */
+											 ebpf * count,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 count * 10,	/* number of frames per network packet */
+											 switch_g726_init,	/* function to initialize a codec handle using this implementation */
+											 switch_g726_encode,	/* function to encode raw data into encoded data */
+											 switch_g726_decode,	/* function to decode encoded data into raw data */
+											 switch_g726_destroy);	/* deinitalize a codec handle using this implementation */
 	}
 	/* Increase encoded bytes per frame by 10 */
 	ebpf = ebpf + 10;
 
 	SWITCH_ADD_CODEC(codec_interface, "G.726 40k (AAL2)");
 	for (count = 12; count > 0; count--) {
-		switch_core_codec_add_implementation(pool,
-											 codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 122,						/* the IANA code number */
-											 "AAL2-G726-40",			/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 8000,						/* samples transferred per second */
-											 8000,						/* actual samples transferred per second */
-											 40000,						/* bits transferred per second */
-											 mpf * count,				/* number of microseconds per frame */
-											 spf * count,				/* number of samples per frame */
-											 bpf * count,				/* number of bytes per frame decompressed */
-											 ebpf * count,				/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 count * 10,				/* number of frames per network packet */
-											 switch_g726_init,			/* function to initialize a codec handle using this implementation */
-											 switch_g726_encode,		/* function to encode raw data into encoded data */
-											 switch_g726_decode,		/* function to decode encoded data into raw data */
-											 switch_g726_destroy);		/* deinitalize a codec handle using this implementation */
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 121,	/* the IANA code number */
+											 "AAL2-G726-40",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 8000,	/* samples transferred per second */
+											 8000,	/* actual samples transferred per second */
+											 40000,	/* bits transferred per second */
+											 mpf * count,	/* number of microseconds per frame */
+											 spf * count,	/* number of samples per frame */
+											 bpf * count,	/* number of bytes per frame decompressed */
+											 ebpf * count,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 count * 10,	/* number of frames per network packet */
+											 switch_g726_init,	/* function to initialize a codec handle using this implementation */
+											 switch_g726_encode,	/* function to encode raw data into encoded data */
+											 switch_g726_decode,	/* function to decode encoded data into raw data */
+											 switch_g726_destroy);	/* deinitalize a codec handle using this implementation */
 	}
 	SWITCH_ADD_CODEC(codec_interface, "G.726 40k");
 	for (count = 12; count > 0; count--) {
-		switch_core_codec_add_implementation(pool,
-											 codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 125,						/* the IANA code number */
-											 "G726-40",					/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 8000,						/* samples transferred per second */
-											 8000,						/* actual samples transferred per second */
-											 40000,						/* bits transferred per second */
-											 mpf * count,				/* number of microseconds per frame */
-											 spf * count,				/* number of samples per frame */
-											 bpf * count,				/* number of bytes per frame decompressed */
-											 ebpf * count,				/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 count * 10,				/* number of frames per network packet */
-											 switch_g726_init,			/* function to initialize a codec handle using this implementation */
-											 switch_g726_encode,		/* function to encode raw data into encoded data */
-											 switch_g726_decode,		/* function to decode encoded data into raw data */
-											 switch_g726_destroy);		/* deinitalize a codec handle using this implementation */
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 121,	/* the IANA code number */
+											 "G726-40",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 8000,	/* samples transferred per second */
+											 8000,	/* actual samples transferred per second */
+											 40000,	/* bits transferred per second */
+											 mpf * count,	/* number of microseconds per frame */
+											 spf * count,	/* number of samples per frame */
+											 bpf * count,	/* number of bytes per frame decompressed */
+											 ebpf * count,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 count * 10,	/* number of frames per network packet */
+											 switch_g726_init,	/* function to initialize a codec handle using this implementation */
+											 switch_g726_encode,	/* function to encode raw data into encoded data */
+											 switch_g726_decode,	/* function to decode encoded data into raw data */
+											 switch_g726_destroy);	/* deinitalize a codec handle using this implementation */
 	}
 	/* G722 */
 	mpf = 10000, spf = 80, bpf = 320, ebpf = 80;
 	SWITCH_ADD_CODEC(codec_interface, "G.722");
 	for (count = 6; count > 0; count--) {
-		switch_core_codec_add_implementation(pool,
-											 codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 9,							/* the IANA code number */
-											 "G722",					/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 8000,						/* samples transferred per second */
-											 16000,						/* actual samples transferred per second */
-											 64000,						/* bits transferred per second */
-											 mpf * count,				/* number of microseconds per frame */
-											 spf * count,				/* number of samples per frame */
-											 bpf * count,				/* number of bytes per frame decompressed */
-											 ebpf * count,				/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 spf * count,				/* number of frames per network packet */
-											 switch_g722_init,			/* function to initialize a codec handle using this implementation */
-											 switch_g722_encode,		/* function to encode raw data into encoded data */
-											 switch_g722_decode,		/* function to decode encoded data into raw data */
-											 switch_g722_destroy);		/* deinitalize a codec handle using this implementation */
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 9,	/* the IANA code number */
+											 "G722",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 8000,	/* samples transferred per second */
+											 16000,	/* actual samples transferred per second */
+											 64000,	/* bits transferred per second */
+											 mpf * count,	/* number of microseconds per frame */
+											 spf * count,	/* number of samples per frame */
+											 bpf * count,	/* number of bytes per frame decompressed */
+											 ebpf * count,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 spf * count,	/* number of frames per network packet */
+											 switch_g722_init,	/* function to initialize a codec handle using this implementation */
+											 switch_g722_encode,	/* function to encode raw data into encoded data */
+											 switch_g722_decode,	/* function to decode encoded data into raw data */
+											 switch_g722_destroy);	/* deinitalize a codec handle using this implementation */
 	}
 
 #ifdef ENABLE_G711
@@ -881,48 +869,44 @@
 	mpf = 10000, spf = 80, bpf = 160, ebpf = 80;
 	SWITCH_ADD_CODEC(codec_interface, "G.711 ulaw");
 	for (count = 12; count > 0; count--) {
-		switch_core_codec_add_implementation(pool,
-											 codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 0,							/* the IANA code number */
-											 "PCMU",					/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 8000,						/* samples transferred per second */
-											 8000,						/* actual samples transferred per second */
-											 64000,						/* bits transferred per second */
-											 mpf * count,				/* number of microseconds per frame */
-											 spf * count,				/* number of samples per frame */
-											 bpf * count,				/* number of bytes per frame decompressed */
-											 ebpf * count,				/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 spf * count,				/* number of frames per network packet */
-											 switch_g711u_init,			/* function to initialize a codec handle using this implementation */
-											 switch_g711u_encode,		/* function to encode raw data into encoded data */
-											 switch_g711u_decode,		/* function to decode encoded data into raw data */
-											 switch_g711u_destroy);		/* deinitalize a codec handle using this implementation */
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 0,	/* the IANA code number */
+											 "PCMU",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 8000,	/* samples transferred per second */
+											 8000,	/* actual samples transferred per second */
+											 64000,	/* bits transferred per second */
+											 mpf * count,	/* number of microseconds per frame */
+											 spf * count,	/* number of samples per frame */
+											 bpf * count,	/* number of bytes per frame decompressed */
+											 ebpf * count,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 spf * count,	/* number of frames per network packet */
+											 switch_g711u_init,	/* function to initialize a codec handle using this implementation */
+											 switch_g711u_encode,	/* function to encode raw data into encoded data */
+											 switch_g711u_decode,	/* function to decode encoded data into raw data */
+											 switch_g711u_destroy);	/* deinitalize a codec handle using this implementation */
 	}
 
 	SWITCH_ADD_CODEC(codec_interface, "G.711 alaw");
 	for (count = 12; count > 0; count--) {
-		switch_core_codec_add_implementation(pool,
-											 codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 8,							/* the IANA code number */
-											 "PCMA",					/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 8000,						/* samples transferred per second */
-											 8000,						/* actual samples transferred per second */
-											 64000,						/* bits transferred per second */
-											 mpf * count,				/* number of microseconds per frame */
-											 spf * count,				/* number of samples per frame */
-											 bpf * count,				/* number of bytes per frame decompressed */
-											 ebpf * count,				/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 spf * count,				/* number of frames per network packet */
-											 switch_g711a_init,			/* function to initialize a codec handle using this implementation */
-											 switch_g711a_encode,		/* function to encode raw data into encoded data */
-											 switch_g711a_decode,		/* function to decode encoded data into raw data */
-											 switch_g711a_destroy);		/* deinitalize a codec handle using this implementation */
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 8,	/* the IANA code number */
+											 "PCMA",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 8000,	/* samples transferred per second */
+											 8000,	/* actual samples transferred per second */
+											 64000,	/* bits transferred per second */
+											 mpf * count,	/* number of microseconds per frame */
+											 spf * count,	/* number of samples per frame */
+											 bpf * count,	/* number of bytes per frame decompressed */
+											 ebpf * count,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 spf * count,	/* number of frames per network packet */
+											 switch_g711a_init,	/* function to initialize a codec handle using this implementation */
+											 switch_g711a_encode,	/* function to encode raw data into encoded data */
+											 switch_g711a_decode,	/* function to decode encoded data into raw data */
+											 switch_g711a_destroy);	/* deinitalize a codec handle using this implementation */
 	}
 #endif
 
@@ -930,47 +914,44 @@
 	mpf = 20000, spf = 160, bpf = 320, ebpf = 33;
 	SWITCH_ADD_CODEC(codec_interface, "GSM");
 	for (count = 6; count > 0; count--) {
-		switch_core_codec_add_implementation(pool,
-											 codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 3,							/* the IANA code number */
-											 "GSM",						/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 8000,						/* samples transferred per second */
-											 8000,						/* actual samples transferred per second */
-											 13200,						/* bits transferred per second */
-											 mpf * count,				/* number of microseconds per frame */
-											 spf * count,				/* number of samples per frame */
-											 bpf * count,				/* number of bytes per frame decompressed */
-											 ebpf * count,				/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 count,						/* number of frames per network packet */
-											 switch_gsm_init,			/* function to initialize a codec handle using this implementation */
-											 switch_gsm_encode,			/* function to encode raw data into encoded data */
-											 switch_gsm_decode,			/* function to decode encoded data into raw data */
-											 switch_gsm_destroy);		/* deinitalize a codec handle using this implementation */
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 3,	/* the IANA code number */
+											 "GSM",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 8000,	/* samples transferred per second */
+											 8000,	/* actual samples transferred per second */
+											 13200,	/* bits transferred per second */
+											 mpf * count,	/* number of microseconds per frame */
+											 spf * count,	/* number of samples per frame */
+											 bpf * count,	/* number of bytes per frame decompressed */
+											 ebpf * count,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 count,	/* number of frames per network packet */
+											 switch_gsm_init,	/* function to initialize a codec handle using this implementation */
+											 switch_gsm_encode,	/* function to encode raw data into encoded data */
+											 switch_gsm_decode,	/* function to decode encoded data into raw data */
+											 switch_gsm_destroy);	/* deinitalize a codec handle using this implementation */
 	}
 	/* LPC10 */
 #if SWITCH_MAX_INTERVAL >= 90
 	SWITCH_ADD_CODEC(codec_interface, "LPC-10");
-	switch_core_codec_add_implementation(pool, codec_interface,
-										 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-										 7,							/* the IANA code number */
-										 "LPC",						/* the IANA code name */
-										 NULL,						/* default fmtp to send (can be overridden by the init function) */
-										 8000,						/* samples transferred per second */
-										 8000,						/* actual samples transferred per second */
-										 2400,						/* bits transferred per second */
-										 90000,						/* number of microseconds per frame */
-										 720,						/* number of samples per frame */
-										 1440,						/* number of bytes per frame decompressed */
-										 28,						/* number of bytes per frame compressed */
-										 1,							/* number of channels represented */
-										 4,							/* number of frames per network packet */
-										 switch_lpc10_init,			/* function to initialize a codec handle using this implementation */
-										 switch_lpc10_encode,		/* function to encode raw data into encoded data */
-										 switch_lpc10_decode,		/* function to decode encoded data into raw data */
-										 switch_lpc10_destroy);		/* deinitalize a codec handle using this implementation */
+	switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+										 7,	/* the IANA code number */
+										 "LPC",	/* the IANA code name */
+										 NULL,	/* default fmtp to send (can be overridden by the init function) */
+										 8000,	/* samples transferred per second */
+										 8000,	/* actual samples transferred per second */
+										 2400,	/* bits transferred per second */
+										 90000,	/* number of microseconds per frame */
+										 720,	/* number of samples per frame */
+										 1440,	/* number of bytes per frame decompressed */
+										 28,	/* number of bytes per frame compressed */
+										 1,	/* number of channels represented */
+										 4,	/* number of frames per network packet */
+										 switch_lpc10_init,	/* function to initialize a codec handle using this implementation */
+										 switch_lpc10_encode,	/* function to encode raw data into encoded data */
+										 switch_lpc10_decode,	/* function to decode encoded data into raw data */
+										 switch_lpc10_destroy);	/* deinitalize a codec handle using this implementation */
 #endif
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -297,14 +297,16 @@
 switch_endpoint_interface_t *sip_endpoint_interface;
 static switch_call_cause_t sip_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 												switch_caller_profile_t *outbound_profile,
-												switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
+												switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+												switch_call_cause_t *cancel_cause);
 switch_io_routines_t sip_io_routines = {
 	/*.outgoing_channel */ sip_outgoing_channel
 };
 
 static switch_call_cause_t sip_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 												switch_caller_profile_t *outbound_profile,
-												switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
+												switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+												switch_call_cause_t *cancel_cause)
 {
 	const char *profile;
 
@@ -331,14 +333,16 @@
 switch_endpoint_interface_t *iax2_endpoint_interface;
 static switch_call_cause_t iax2_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 												 switch_caller_profile_t *outbound_profile,
-												 switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
+												 switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+												 switch_call_cause_t *cancel_cause);
 switch_io_routines_t iax2_io_routines = {
 	/*.outgoing_channel */ iax2_outgoing_channel
 };
 
 static switch_call_cause_t iax2_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 												 switch_caller_profile_t *outbound_profile,
-												 switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
+												 switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+												 switch_call_cause_t *cancel_cause)
 {
 	UNPROTECT_INTERFACE(iax2_endpoint_interface);
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/dialplans/mod_dialplan_directory/mod_dialplan_directory.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -150,7 +150,7 @@
 	switch_safe_free(globals.dn);
 	switch_safe_free(globals.pass);
 	switch_safe_free(globals.base);
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -161,7 +161,7 @@
 
 	memset(&globals, 0, sizeof(globals));
 	load_config();
-	
+
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	SWITCH_ADD_DIALPLAN(dp_interface, "directory", directory_dialplan_hunt);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/dialplans/mod_dialplan_xml/mod_dialplan_xml.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -72,10 +72,10 @@
 
 	switch_core_session_exec(session, application_interface, arg);
 
-done:
-	
+  done:
+
 	UNPROTECT_INTERFACE(application_interface);
-	
+
 	return status;
 }
 
@@ -100,12 +100,13 @@
 		int ovector[30];
 		switch_bool_t anti_action = SWITCH_TRUE;
 		break_t do_break_i = BREAK_ON_FALSE;
-		
+
 		const char *xyear = switch_xml_attr(xcond, "year");
 		const char *xyday = switch_xml_attr(xcond, "yday");
 		const char *xmon = switch_xml_attr(xcond, "mon");
 		const char *xmday = switch_xml_attr(xcond, "mday");
 		const char *xweek = switch_xml_attr(xcond, "week");
+		const char *xmweek = switch_xml_attr(xcond, "mweek");
 		const char *xwday = switch_xml_attr(xcond, "wday");
 		const char *xhour = switch_xml_attr(xcond, "hour");
 		const char *xminute = switch_xml_attr(xcond, "minute");
@@ -124,7 +125,7 @@
 		}
 
 		switch_time_exp_lt(&tm, ts);
-		
+
 		if (time_match && xyear) {
 			int test = tm.tm_year + 1900;
 			time_match = switch_number_cmp(xyear, test);
@@ -160,6 +161,16 @@
 							  "Dialplan: week of year[%d] =~ %s (%s)\n", test, xweek, time_match ? "PASS" : "FAIL");
 		}
 
+		if (time_match && xmweek) {
+			/* calculate the day of the week of the first of the month (0-6) */
+			int firstdow = (int) (7 - (tm.tm_mday - (tm.tm_wday + 1)) % 7) % 7;
+			/* calculate the week of the month (1-6) */
+			int test = (int) ceil((tm.tm_mday + firstdow) / 7.0);
+			time_match = switch_number_cmp(xmweek, test);
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+							  "Dialplan: week of month[%d] =~ %s (%s)\n", test, xmweek, time_match ? "PASS" : "FAIL");
+		}
+
 		if (time_match && xwday) {
 			int test = tm.tm_wday + 1;
 			time_match = switch_number_cmp(xwday, test);
@@ -187,7 +198,7 @@
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
 							  "Dialplan: minute of day[%d] =~ %s (%s)\n", test, xminday, time_match ? "PASS" : "FAIL");
 		}
-		
+
 		field = (char *) switch_xml_attr(xcond, "field");
 
 		if ((xexpression = switch_xml_child(xcond, "expression"))) {
@@ -218,13 +229,13 @@
 
 		if (time_match == 1) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
-					"Dialplan: %s Date/Time Match (PASS) [%s] break=%s\n",
-					switch_channel_get_name(channel), exten_name, do_break_a ? do_break_a : "on-false");
+							  "Dialplan: %s Date/Time Match (PASS) [%s] break=%s\n",
+							  switch_channel_get_name(channel), exten_name, do_break_a ? do_break_a : "on-false");
 			anti_action = SWITCH_FALSE;
 		} else if (time_match == 0) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
-					"Dialplan: %s Date/Time Match (FAIL) [%s] break=%s\n",
-					switch_channel_get_name(channel), exten_name, do_break_a ? do_break_a : "on-false");
+							  "Dialplan: %s Date/Time Match (FAIL) [%s] break=%s\n",
+							  switch_channel_get_name(channel), exten_name, do_break_a ? do_break_a : "on-false");
 		}
 
 		if (field) {
@@ -241,21 +252,20 @@
 			if (!field_data) {
 				field_data = "";
 			}
-			
+
 			if ((proceed = switch_regex_perform(field_data, expression, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG, 
-								  "Dialplan: %s Regex (PASS) [%s] %s(%s) =~ /%s/ break=%s\n", 
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+								  "Dialplan: %s Regex (PASS) [%s] %s(%s) =~ /%s/ break=%s\n",
 								  switch_channel_get_name(channel), exten_name, field, field_data, expression, do_break_a ? do_break_a : "on-false");
 				anti_action = SWITCH_FALSE;
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG, 
-								  "Dialplan: %s Regex (FAIL) [%s] %s(%s) =~ /%s/ break=%s\n", 
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+								  "Dialplan: %s Regex (FAIL) [%s] %s(%s) =~ /%s/ break=%s\n",
 								  switch_channel_get_name(channel), exten_name, field, field_data, expression, do_break_a ? do_break_a : "on-false");
 			}
 		} else if (time_match == -1) {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG, 
-							  "Dialplan: %s Absolute Condition [%s]\n", 
-							  switch_channel_get_name(channel), exten_name);
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+							  "Dialplan: %s Absolute Condition [%s]\n", switch_channel_get_name(channel), exten_name);
 			anti_action = SWITCH_FALSE;
 		}
 
@@ -264,7 +274,7 @@
 				const char *application = switch_xml_attr_soft(xaction, "application");
 				const char *data;
 				const char *inline_ = switch_xml_attr_soft(xaction, "inline");
-				int xinline = switch_true(inline_);				
+				int xinline = switch_true(inline_);
 
 				if (!zstr(xaction->txt)) {
 					data = xaction->txt;
@@ -273,8 +283,7 @@
 				}
 
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
-								  "Dialplan: %s ANTI-Action %s(%s) %s\n",
-								  switch_channel_get_name(channel), application, data, xinline ? "INLINE" : "");
+								  "Dialplan: %s ANTI-Action %s(%s) %s\n", switch_channel_get_name(channel), application, data, xinline ? "INLINE" : "");
 
 				if (!*extension) {
 					if ((*extension = switch_caller_extension_new(session, exten_name, caller_profile->destination_number)) == 0) {
@@ -329,9 +338,8 @@
 					}
 				}
 
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG, 
-								  "Dialplan: %s Action %s(%s) %s\n", 
-								  switch_channel_get_name(channel), application, app_data, xinline ? "INLINE" : "");
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+								  "Dialplan: %s Action %s(%s) %s\n", switch_channel_get_name(channel), application, app_data, xinline ? "INLINE" : "");
 
 
 				if (xinline) {
@@ -345,9 +353,8 @@
 		}
 		switch_regex_safe_free(re);
 
-		if (((anti_action == SWITCH_FALSE && do_break_i == BREAK_ON_TRUE) || 
-			 (anti_action == SWITCH_TRUE && do_break_i == BREAK_ON_FALSE))  ||
-			do_break_i == BREAK_ALWAYS) {
+		if (((anti_action == SWITCH_FALSE && do_break_i == BREAK_ON_TRUE) ||
+			 (anti_action == SWITCH_TRUE && do_break_i == BREAK_ON_FALSE)) || do_break_i == BREAK_ALWAYS) {
 			break;
 		}
 	}
@@ -359,7 +366,8 @@
 	return proceed;
 }
 
-static switch_status_t dialplan_xml_locate(switch_core_session_t *session, switch_caller_profile_t *caller_profile, switch_xml_t *root, switch_xml_t *node)
+static switch_status_t dialplan_xml_locate(switch_core_session_t *session, switch_caller_profile_t *caller_profile, switch_xml_t *root,
+										   switch_xml_t *node)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_status_t status = SWITCH_STATUS_GENERR;
@@ -446,8 +454,8 @@
 			exten_name = "UNKNOWN";
 		}
 
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG, 
-						  "Dialplan: %s parsing [%s->%s] continue=%s\n", 
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG,
+						  "Dialplan: %s parsing [%s->%s] continue=%s\n",
 						  switch_channel_get_name(channel), caller_profile->context, exten_name, cont ? cont : "false");
 
 		proceed = parse_exten(session, caller_profile, xexten, &extension);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/directories/mod_ldap/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/directories/mod_ldap/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/directories/mod_ldap/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,24 +1,29 @@
-switch_srcdir=../../../..
+BASE=../../../..
 
-LDAP=openldap-2.4.11
+LDAP=openldap-2.4.19
 LDAP_DIR=$(switch_srcdir)/libs/$(LDAP)
+LDAP_BUILDDIR=$(switch_builddir)/libs/$(LDAP)
 
-LDAPLA=$(LDAP_DIR)/libraries/libldap_r/libldap_r.la
-LIBLBERLA=$(LDAP_DIR)/libraries/liblber/liblber.la
+LDAPLA=$(LDAP_BUILDDIR)/libraries/libldap_r/libldap_r.la
+LIBLBERLA=$(LDAP_BUILDDIR)/libraries/liblber/liblber.la
 
+
 LOCAL_CFLAGS=-DWITH_OPENLDAP -DLDAP_DEPRECATED -I$(LDAP_DIR)/include
 
-DEFAULT_ARGS= --prefix=$(PREFIX) --disable-shared --with-pic --disable-slapd
-DEFAULT_ARGS+= --disable-bdb --disable-hdb
-
 LOCAL_LIBADD=$(LDAPLA) $(LIBLBERLA)
 
-include $(switch_srcdir)/build/modmake.rules
+include $(BASE)/build/modmake.rules
 
+DEFAULT_ARGS+= --disable-slapd --disable-bdb --disable-hdb
+
 $(LDAP_DIR):
 	$(GETLIB) $(LDAP).tar.gz
-	cd $(LDAP_DIR) && CFLAGS="`echo $(CFLAGS) | sed -e 's:-std=c99::'`" ./configure $(DEFAULT_ARGS)
 
-$(LDAPLA) $(LIBLBERLA): $(LDAP_DIR)
-	cd $(LDAP_DIR) && $(MAKE)
+$(LDAP_BUILDDIR)/Makefile: $(LDAP_DIR)
+	mkdir -p $(LDAP_BUILDDIR)
+	cd $(LDAP_BUILDDIR) && $(DEFAULT_VARS) $(LDAP_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(LDAP_DIR)
 	$(TOUCH_TARGET)
+
+$(LDAPLA) $(LIBLBERLA): $(LDAP_BUILDDIR)/Makefile
+	cd $(LDAP_BUILDDIR) && $(MAKE)
+	$(TOUCH_TARGET)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/directories/mod_ldap/mod_ldap.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/directories/mod_ldap/mod_ldap.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/directories/mod_ldap/mod_ldap.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_alsa/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_alsa/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_alsa/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -2,9 +2,7 @@
 
 LOCAL_CFLAGS=-I. -I$(PA_DIR)/include -D__EXTENSION__=1
 LOCAL_LDFLAGS=-lasound
-LOCAL_OBJS=
-LOCAL_SOURCES=
 
 include $(BASE)/build/modmake.rules
 
-$(LOCAL_OBJS): $(LOCAL_SOURCES)
+

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_alsa/mod_alsa.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_alsa/mod_alsa.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_alsa/mod_alsa.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -151,7 +151,8 @@
 static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
 static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
-													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
+													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+													switch_call_cause_t *cancel_cause);
 static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
 static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
 static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
@@ -730,12 +731,12 @@
 	/*.on_hangup */ channel_on_hangup,
 	/*.on_exchange_media */ channel_on_exchange_media,
 	/*.on_soft_execute */ channel_on_soft_execute,
-	/*.on_consume_media*/ NULL,
-    /*.on_hibernate*/ NULL,
-    /*.on_reset*/ NULL,
-    /*.on_park*/ NULL,
-    /*.on_reporting*/ NULL,
-    /*.on_destroy*/ channel_on_destroy
+	/*.on_consume_media */ NULL,
+	/*.on_hibernate */ NULL,
+	/*.on_reset */ NULL,
+	/*.on_park */ NULL,
+	/*.on_reporting */ NULL,
+	/*.on_destroy */ channel_on_destroy
 };
 
 static switch_io_routines_t channel_io_routines = {
@@ -761,7 +762,8 @@
 */
 static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
-													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
+													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+													switch_call_cause_t *cancel_cause)
 {
 
 	if ((*new_session = switch_core_session_request(&channel_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
@@ -799,7 +801,6 @@
 			return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
 		}
 
-		switch_channel_set_flag(channel, CF_OUTBOUND);
 		switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
 		switch_channel_set_state(channel, CS_INIT);
 		return SWITCH_CAUSE_SUCCESS;
@@ -824,8 +825,8 @@
 	alsa_endpoint_interface->state_handler = &channel_event_handlers;
 
 	SWITCH_ADD_API(api_interface, "alsa", "Alsa", pa_cmd, "<command> [<args>]");
-	
 
+
 	if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
 		return SWITCH_STATUS_TERM;
@@ -954,7 +955,7 @@
 		switch_core_codec_destroy(&globals.write_codec);
 	}
 	switch_core_hash_destroy(&globals.call_hash);
-	
+
 	switch_safe_free(globals.dialplan);
 	switch_safe_free(globals.cid_name);
 	switch_safe_free(globals.cid_num);
@@ -1013,7 +1014,8 @@
 	}
 
 	if (switch_core_timer_init(&globals.timer,
-							   globals.timer_name, codec_ms, globals.read_codec.implementation->samples_per_packet, module_pool) != SWITCH_STATUS_SUCCESS) {
+							   globals.timer_name, codec_ms, globals.read_codec.implementation->samples_per_packet,
+							   module_pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup timer failed!\n");
 		switch_core_codec_destroy(&globals.read_codec);
 		switch_core_codec_destroy(&globals.write_codec);
@@ -1523,12 +1525,6 @@
 	char *wcmd = NULL, *action = NULL;
 	char cmd_buf[1024] = "";
 	char *http = NULL;
-
-	if (stream->param_event) {
-		http = switch_event_get_header(stream->param_event, "http-host");
-	}
-
-
 	const char *usage_string = "USAGE:\n"
 		"--------------------------------------------------------------------------------\n"
 		"alsa help\n"
@@ -1540,6 +1536,10 @@
 		"alsa dtmf <digit string>\n"
 		"alsa flags [on|off] [ear] [mouth]\n" "--------------------------------------------------------------------------------\n";
 
+	if (stream->param_event) {
+		http = switch_event_get_header(stream->param_event, "http-host");
+	}
+
 	if (http) {
 #if 0
 		switch_event_header_t *hp;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_dingaling/mod_dingaling.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_dingaling/mod_dingaling.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_dingaling/mod_dingaling.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -206,7 +206,8 @@
 static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
 static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
-													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
+													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+													switch_call_cause_t *cancel_cause);
 static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
 static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
 static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
@@ -271,7 +272,7 @@
 
 	if (switch_odbc_available() && profile->odbc_dsn) {
 		switch_odbc_statement_handle_t stmt;
-		if (switch_odbc_handle_exec(profile->master_odbc, sql, &stmt) != SWITCH_ODBC_SUCCESS) {
+		if (switch_odbc_handle_exec(profile->master_odbc, sql, &stmt, NULL) != SWITCH_ODBC_SUCCESS) {
 			char *err_str;
 			err_str = switch_odbc_handle_get_error(profile->master_odbc, stmt);
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, switch_str_nil(err_str));
@@ -459,7 +460,8 @@
 	}
 
 	sql =
-		switch_mprintf("select sub_from, sub_to,'%q','%q','%q','%q' from jabber_subscriptions where sub_to = '%q%q'", type, rpid, status, proto, pstr, from);
+		switch_mprintf("select sub_from, sub_to,'%q','%q','%q','%q' from jabber_subscriptions where sub_to = '%q%q'", type, rpid, status, proto, pstr,
+					   from);
 
 	for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
 		switch_hash_this(hi, NULL, NULL, &val);
@@ -485,7 +487,7 @@
 }
 
 static switch_status_t chat_send(const char *proto, const char *from, const char *to, const char *subject,
-                                 const char *body, const char *type, const char *hint)
+								 const char *body, const char *type, const char *hint)
 {
 	char *user, *host, *f_user = NULL, *ffrom = NULL, *f_host = NULL, *f_resource = NULL;
 	mdl_profile_t *profile = NULL;
@@ -518,7 +520,7 @@
 					*p = '\0';
 				}
 			}
-			ldl_handle_send_msg(profile->handle, (char*)from, (char*)to, NULL, switch_str_nil(body));
+			ldl_handle_send_msg(profile->handle, (char *) from, (char *) to, NULL, switch_str_nil(body));
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Profile %s\n", f_host ? f_host : "NULL");
 			return SWITCH_STATUS_FALSE;
@@ -699,7 +701,8 @@
 		switch_channel_state_t state = switch_channel_get_state(channel);
 		struct private_object *tech_pvt = NULL;
 
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*session), SWITCH_LOG_DEBUG, "Terminate called from line %d state=%s\n", line, switch_channel_state_name(state));
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*session), SWITCH_LOG_DEBUG, "Terminate called from line %d state=%s\n", line,
+						  switch_channel_state_name(state));
 
 		tech_pvt = switch_core_session_get_private(*session);
 
@@ -874,10 +877,9 @@
 	switch_core_session_set_read_codec(tech_pvt->session, &tech_pvt->read_codec);
 	switch_core_session_set_write_codec(tech_pvt->session, &tech_pvt->write_codec);
 
-	if(globals.auto_nat && tech_pvt->profile->local_network && 
-	   !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) {
+	if (globals.auto_nat && tech_pvt->profile->local_network && !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) {
 		switch_port_t external_port = 0;
-		switch_nat_add_mapping((switch_port_t)tech_pvt->local_port, SWITCH_NAT_UDP, &external_port, SWITCH_FALSE);
+		switch_nat_add_mapping((switch_port_t) tech_pvt->local_port, SWITCH_NAT_UDP, &external_port, SWITCH_FALSE);
 		tech_pvt->local_port = external_port;
 	}
 
@@ -885,8 +887,8 @@
 					  tech_pvt->local_port, tech_pvt->remote_ip, tech_pvt->remote_port);
 
 	flags = SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_GOOGLEHACK | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_RAW_WRITE | SWITCH_RTP_FLAG_AUTO_CNG;
-	
 
+
 	if (switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) {
 		flags |= SWITCH_RTP_FLAG_USE_TIMER;
 	}
@@ -973,11 +975,13 @@
 				}
 
 				cand[0].address = tech_pvt->profile->ip;
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Stun Lookup Local %s:%d\n", cand[0].address, cand[0].port);
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Stun Lookup Local %s:%d\n", cand[0].address,
+								  cand[0].port);
 				if (switch_stun_lookup
 					(&cand[0].address, &cand[0].port, stun_ip, SWITCH_STUN_DEFAULT_PORT, &err,
 					 switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Stun Failed! %s:%d [%s]\n", stun_ip, SWITCH_STUN_DEFAULT_PORT, err);
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Stun Failed! %s:%d [%s]\n", stun_ip,
+									  SWITCH_STUN_DEFAULT_PORT, err);
 					switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 					return 0;
 				}
@@ -995,7 +999,8 @@
 		cand[0].password = tech_pvt->local_pass;
 		cand[0].pref = 1;
 		cand[0].protocol = "udp";
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Send Candidate %s:%d [%s]\n", cand[0].address, cand[0].port, cand[0].username);
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Send Candidate %s:%d [%s]\n", cand[0].address, cand[0].port,
+						  cand[0].username);
 		tech_pvt->cand_id = ldl_session_candidates(tech_pvt->dlsession, cand, 1);
 		switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT);
 		switch_set_flag_locked(tech_pvt, TFLAG_RTP_READY);
@@ -1232,9 +1237,8 @@
 			tech_pvt->rtp_session = NULL;
 		}
 
-		if(globals.auto_nat && tech_pvt->profile->local_network && 
-		   !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) {
-			switch_nat_del_mapping((switch_port_t)tech_pvt->local_port, SWITCH_NAT_UDP);
+		if (globals.auto_nat && tech_pvt->profile->local_network && !switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) {
+			switch_nat_del_mapping((switch_port_t) tech_pvt->local_port, SWITCH_NAT_UDP);
 		}
 
 		if (switch_core_codec_ready(&tech_pvt->read_codec)) {
@@ -1247,9 +1251,9 @@
 
 		switch_thread_rwlock_unlock(tech_pvt->profile->rwlock);
 
-		if(tech_pvt->profile->purge) {
+		if (tech_pvt->profile->purge) {
 			mdl_profile_t *profile = tech_pvt->profile;
-			if(switch_core_hash_delete(globals.profile_hash, profile->name) == SWITCH_STATUS_SUCCESS) {
+			if (switch_core_hash_delete(globals.profile_hash, profile->name) == SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Profile %s deleted successfully\n", profile->name);
 			}
 		}
@@ -1593,12 +1597,12 @@
 	/*.on_hangup */ channel_on_hangup,
 	/*.on_exchange_media */ channel_on_exchange_media,
 	/*.on_soft_execute */ channel_on_soft_execute,
-	/*.on_consume_media*/ NULL,
-    /*.on_hibernate*/ NULL,
-    /*.on_reset*/ NULL,
-    /*.on_park*/ NULL,
-    /*.on_reporting*/ NULL,
-    /*.on_destroy*/ channel_on_destroy
+	/*.on_consume_media */ NULL,
+	/*.on_hibernate */ NULL,
+	/*.on_reset */ NULL,
+	/*.on_park */ NULL,
+	/*.on_reporting */ NULL,
+	/*.on_destroy */ channel_on_destroy
 };
 
 switch_io_routines_t dingaling_io_routines = {
@@ -1618,7 +1622,8 @@
 */
 static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
-													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
+													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+													switch_call_cause_t *cancel_cause)
 {
 	if ((*new_session = switch_core_session_request(dingaling_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
 		struct private_object *tech_pvt;
@@ -1685,13 +1690,14 @@
 				}
 			}
 
-			if(mdl_profile->purge) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile '%s' is marked for deletion, disallowing outgoing call\n", mdl_profile->name);
+			if (mdl_profile->purge) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile '%s' is marked for deletion, disallowing outgoing call\n",
+								  mdl_profile->name);
 				terminate_session(new_session, __LINE__, SWITCH_CAUSE_NORMAL_UNSPECIFIED);
 				return SWITCH_CAUSE_NORMAL_UNSPECIFIED;
 			}
 
-			if(switch_thread_rwlock_tryrdlock(mdl_profile->rwlock) != SWITCH_STATUS_SUCCESS) {
+			if (switch_thread_rwlock_tryrdlock(mdl_profile->rwlock) != SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't do read lock on profile '%s'\n", mdl_profile->name);
 				terminate_session(new_session, __LINE__, SWITCH_CAUSE_NORMAL_UNSPECIFIED);
 				return SWITCH_CAUSE_NORMAL_UNSPECIFIED;
@@ -1754,7 +1760,6 @@
 			return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
 		}
 
-		switch_channel_set_flag(channel, CF_OUTBOUND);
 		switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
 
 		switch_stun_random_string(sess_id, 10, "0123456789");
@@ -1811,7 +1816,7 @@
 	switch_api_interface_t *api_interface;
 
 	module_pool = pool;
-	
+
 	memset(&globals, 0, sizeof(globals));
 
 	load_config();
@@ -1831,17 +1836,20 @@
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_IN, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL, &globals.in_node) != SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_IN, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL, &globals.in_node) !=
+		SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL, &globals.probe_node) != SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL, &globals.probe_node) !=
+		SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}
 
-	if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_OUT, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL, &globals.out_node) != SWITCH_STATUS_SUCCESS) {
+	if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_OUT, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL, &globals.out_node) !=
+		SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}
@@ -1857,7 +1865,7 @@
 		return SWITCH_STATUS_GENERR;
 	}
 
-	
+
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	dingaling_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
@@ -1903,13 +1911,10 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
 						  "Invalid Profile\n" "login[%s]\n" "pass[%s]\n" "dialplan[%s]\n"
 						  "message[%s]\n" "rtp-ip[%s]\n" "name[%s]\n" "exten[%s]\n",
-						  switch_str_nil(profile->login), 
-						  switch_str_nil(profile->password), 
-						  switch_str_nil(profile->dialplan), 
-						  switch_str_nil(profile->message), 
-						  switch_str_nil(profile->ip), 
-						  switch_str_nil(profile->name), 
-						  switch_str_nil(profile->exten));
+						  switch_str_nil(profile->login),
+						  switch_str_nil(profile->password),
+						  switch_str_nil(profile->dialplan),
+						  switch_str_nil(profile->message), switch_str_nil(profile->ip), switch_str_nil(profile->name), switch_str_nil(profile->exten));
 
 		return SWITCH_STATUS_FALSE;
 	}
@@ -1976,8 +1981,8 @@
 
 	switch_safe_free(globals.dialplan);
 	switch_safe_free(globals.codec_string);
-	switch_safe_free(globals.codec_rates_string);	
-	
+	switch_safe_free(globals.codec_rates_string);
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -2160,7 +2165,8 @@
 	switch_hash_index_t *hi;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
-	if (session) return status;
+	if (session)
+		return status;
 
 	if (zstr(cmd) || !(myarg = strdup(cmd))) {
 		stream->write_function(stream, "USAGE: %s\n", DINGALING_SYNTAX);
@@ -2179,9 +2185,9 @@
 			switch_hash_this(hi, NULL, NULL, &val);
 			profile = (mdl_profile_t *) val;
 			stream->write_function(stream, "%s	|	", profile->login);
-			if (profile->handle && ldl_handle_authorized(profile->handle)){
+			if (profile->handle && ldl_handle_authorized(profile->handle)) {
 				stream->write_function(stream, "AUTHORIZED");
-			} else if (profile->handle && ldl_handle_connected(profile->handle)){
+			} else if (profile->handle && ldl_handle_connected(profile->handle)) {
 				stream->write_function(stream, "CONNECTED");
 			} else {
 				stream->write_function(stream, "UNCONNECTED");
@@ -2195,7 +2201,7 @@
 		stream->write_function(stream, "USAGE: %s\n", DINGALING_SYNTAX);
 	}
 
-done:
+  done:
 	switch_safe_free(myarg);
 	return status;
 }
@@ -2261,7 +2267,7 @@
 	} else {
 		stream->write_function(stream, "FAIL\n");
 	}
- done:
+  done:
 	switch_safe_free(myarg);
 
 	return status;
@@ -2270,61 +2276,58 @@
 
 static switch_bool_t match_profile(mdl_profile_t *profile, mdl_profile_t *new_profile)
 {
-	if(profile == new_profile) {
+	if (profile == new_profile) {
 		return SWITCH_TRUE;
 	}
 
-	if(
-	((!new_profile->name && !profile->name) || 
-	 (new_profile->name && profile->name && !strcasecmp(new_profile->name, profile->name))) &&
-	((!new_profile->login && !profile->login) || 
-	 (new_profile->login && profile->login && !strcasecmp(new_profile->login, profile->login))) &&
-	((!new_profile->password && !profile->password) || 
-	 (new_profile->password && profile->password && !strcasecmp(new_profile->password, profile->password))) &&
-	((!new_profile->message && !profile->message) || 
-	 (new_profile->message && profile->message && !strcasecmp(new_profile->message, profile->message))) &&
-	((!new_profile->avatar && !profile->avatar) || 
-	 (new_profile->avatar && profile->avatar && !strcasecmp(new_profile->avatar, profile->avatar))) &&
+	if (((!new_profile->name && !profile->name) ||
+		 (new_profile->name && profile->name && !strcasecmp(new_profile->name, profile->name))) &&
+		((!new_profile->login && !profile->login) ||
+		 (new_profile->login && profile->login && !strcasecmp(new_profile->login, profile->login))) &&
+		((!new_profile->password && !profile->password) ||
+		 (new_profile->password && profile->password && !strcasecmp(new_profile->password, profile->password))) &&
+		((!new_profile->message && !profile->message) ||
+		 (new_profile->message && profile->message && !strcasecmp(new_profile->message, profile->message))) &&
+		((!new_profile->avatar && !profile->avatar) || (new_profile->avatar && profile->avatar && !strcasecmp(new_profile->avatar, profile->avatar))) &&
 #ifdef AUTO_REPLY
-	((!new_profile->auto_reply && !profile->auto_reply) || 
-	 (new_profile->auto_reply && profile->auto_reply && !strcasecmp(new_profile->auto_reply, profile->auto_reply))) &&
+		((!new_profile->auto_reply && !profile->auto_reply) ||
+		 (new_profile->auto_reply && profile->auto_reply && !strcasecmp(new_profile->auto_reply, profile->auto_reply))) &&
 #endif
-	((!new_profile->dialplan && !profile->dialplan) || 
-	 (new_profile->dialplan && profile->dialplan && !strcasecmp(new_profile->dialplan, profile->dialplan))) &&
-	((!new_profile->local_network && !profile->local_network) || 
-	 (new_profile->local_network && profile->local_network && !strcasecmp(new_profile->local_network, profile->local_network))) &&
-	((!new_profile->ip && !profile->ip) || 
-	 (new_profile->ip && profile->ip && !strcasecmp(new_profile->ip, profile->ip))) &&
-	((!new_profile->extip && !profile->extip) || 
-	 (new_profile->extip && profile->extip && !strcasecmp(new_profile->extip, profile->extip))) &&
-	((!new_profile->server && !profile->server) || 
-	 (new_profile->server && profile->server && !strcasecmp(new_profile->server, profile->server))) &&
-	((!new_profile->timer_name && !profile->timer_name) || 
-	 (new_profile->timer_name && profile->timer_name && !strcasecmp(new_profile->timer_name, profile->timer_name))) &&
-	((!new_profile->lanaddr && !profile->lanaddr) || 
-	 (new_profile->lanaddr && profile->lanaddr && !strcasecmp(new_profile->lanaddr, profile->lanaddr))) &&
-	((!new_profile->exten && !profile->exten) || 
-	 (new_profile->exten && profile->exten && !strcasecmp(new_profile->exten, profile->exten))) &&
-	((!new_profile->context && !profile->context) || 
-	 (new_profile->context && profile->context && !strcasecmp(new_profile->context, profile->context))) &&
-	(new_profile->user_flags == profile->user_flags) && (new_profile->acl_count == profile->acl_count)
-	) {
-		int i;
+		((!new_profile->dialplan && !profile->dialplan) ||
+		 (new_profile->dialplan && profile->dialplan && !strcasecmp(new_profile->dialplan, profile->dialplan))) &&
+		((!new_profile->local_network && !profile->local_network) ||
+		 (new_profile->local_network && profile->local_network && !strcasecmp(new_profile->local_network, profile->local_network))) &&
+		((!new_profile->ip && !profile->ip) ||
+		 (new_profile->ip && profile->ip && !strcasecmp(new_profile->ip, profile->ip))) &&
+		((!new_profile->extip && !profile->extip) ||
+		 (new_profile->extip && profile->extip && !strcasecmp(new_profile->extip, profile->extip))) &&
+		((!new_profile->server && !profile->server) ||
+		 (new_profile->server && profile->server && !strcasecmp(new_profile->server, profile->server))) &&
+		((!new_profile->timer_name && !profile->timer_name) ||
+		 (new_profile->timer_name && profile->timer_name && !strcasecmp(new_profile->timer_name, profile->timer_name))) &&
+		((!new_profile->lanaddr && !profile->lanaddr) ||
+		 (new_profile->lanaddr && profile->lanaddr && !strcasecmp(new_profile->lanaddr, profile->lanaddr))) &&
+		((!new_profile->exten && !profile->exten) ||
+		 (new_profile->exten && profile->exten && !strcasecmp(new_profile->exten, profile->exten))) &&
+		((!new_profile->context && !profile->context) ||
+		 (new_profile->context && profile->context && !strcasecmp(new_profile->context, profile->context))) &&
+		(new_profile->user_flags == profile->user_flags) && (new_profile->acl_count == profile->acl_count)
+		) {
+		uint32_t i;
 		if (switch_odbc_available()) {
-			if(!(
-			((!new_profile->odbc_dsn && !profile->odbc_dsn) || 
-			 (new_profile->odbc_dsn && profile->odbc_dsn && !strcasecmp(new_profile->odbc_dsn, profile->odbc_dsn))) &&
-			((!new_profile->odbc_user && !profile->odbc_user) || 
-			 (new_profile->odbc_user && profile->odbc_user && !strcasecmp(new_profile->odbc_user, profile->odbc_user))) &&
-			((!new_profile->odbc_pass && !profile->odbc_pass) || 
-			 (new_profile->odbc_pass && profile->odbc_pass && !strcasecmp(new_profile->odbc_pass, profile->odbc_pass)))
-			)) {
+			if (!(((!new_profile->odbc_dsn && !profile->odbc_dsn) ||
+				   (new_profile->odbc_dsn && profile->odbc_dsn && !strcasecmp(new_profile->odbc_dsn, profile->odbc_dsn))) &&
+				  ((!new_profile->odbc_user && !profile->odbc_user) ||
+				   (new_profile->odbc_user && profile->odbc_user && !strcasecmp(new_profile->odbc_user, profile->odbc_user))) &&
+				  ((!new_profile->odbc_pass && !profile->odbc_pass) ||
+				   (new_profile->odbc_pass && profile->odbc_pass && !strcasecmp(new_profile->odbc_pass, profile->odbc_pass)))
+				)) {
 				return SWITCH_FALSE;
 			}
 		}
 
-		for(i=0; i<new_profile->acl_count; i++) {
-			if(strcasecmp(new_profile->acl[i], profile->acl[i]) != 0) {
+		for (i = 0; i < new_profile->acl_count; i++) {
+			if (strcasecmp(new_profile->acl[i], profile->acl[i]) != 0) {
 				return SWITCH_FALSE;
 			}
 		}
@@ -2333,11 +2336,11 @@
 	return SWITCH_TRUE;
 }
 
-static switch_status_t destroy_profile(char *name) 
+static switch_status_t destroy_profile(char *name)
 {
 	mdl_profile_t *profile = NULL;
 
-	if((profile = switch_core_hash_find(globals.profile_hash, name))) {
+	if ((profile = switch_core_hash_find(globals.profile_hash, name))) {
 		if (profile->user_flags & LDL_FLAG_COMPONENT) {
 			if (switch_odbc_available() && profile->odbc_dsn && profile->master_odbc) {
 				switch_odbc_handle_disconnect(profile->master_odbc);
@@ -2347,21 +2350,21 @@
 			switch_mutex_destroy(profile->mutex);
 		}
 
-		if(switch_thread_rwlock_trywrlock(profile->rwlock) != SWITCH_STATUS_SUCCESS) {
+		if (switch_thread_rwlock_trywrlock(profile->rwlock) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Profile %s is busy\n", profile->name);
 			profile->purge = SWITCH_TRUE;
-			if(profile->handle) {
+			if (profile->handle) {
 				ldl_handle_stop(profile->handle);
 			}
 		} else {
 			switch_thread_rwlock_unlock(profile->rwlock);
 			profile->purge = SWITCH_TRUE;
 
-			if(profile->handle) {
+			if (profile->handle) {
 				ldl_handle_stop(profile->handle);
 			}
 
-			if(switch_core_hash_delete(globals.profile_hash, profile->name) == SWITCH_STATUS_SUCCESS) {
+			if (switch_core_hash_delete(globals.profile_hash, profile->name) == SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Profile %s deleted successfully\n", profile->name);
 			}
 		}
@@ -2374,7 +2377,7 @@
 {
 	char *cf = "dingaling.conf";
 	mdl_profile_t *profile = NULL, *old_profile = NULL;
-	switch_xml_t cfg, xml, /*settings,*/ param, xmlint;
+	switch_xml_t cfg, xml, /*settings, */ param, xmlint;
 
 	void *data = NULL;
 	switch_hash_t *name_hash;
@@ -2398,7 +2401,7 @@
 			char *var = (char *) switch_xml_attr_soft(param, "name");
 			char *val = (char *) switch_xml_attr_soft(param, "value");
 
-                        if (!profile) {
+			if (!profile) {
 				profile = switch_core_alloc(module_pool, sizeof(*profile));
 			}
 
@@ -2432,7 +2435,7 @@
 				}
 
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: %s\n", profile->odbc_dsn);
-				switch_odbc_handle_exec(profile->master_odbc, sub_sql, NULL);
+				switch_odbc_handle_exec(profile->master_odbc, sub_sql, NULL, NULL);
 				//mdl_execute_sql(profile, sub_sql, NULL);
 			} else {
 				if ((db = switch_core_db_open_file(profile->dbname))) {
@@ -2448,8 +2451,8 @@
 		if (profile) {
 			switch_core_hash_insert(name_hash, profile->name, profile->login);
 
-			if((old_profile = switch_core_hash_find(globals.profile_hash, profile->name))) {
-				if(match_profile(old_profile, profile)) {
+			if ((old_profile = switch_core_hash_find(globals.profile_hash, profile->name))) {
+				if (match_profile(old_profile, profile)) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found pre-existing profile %s [%s]\n", profile->name, profile->login);
 				} else {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Overwriting pre-existing profile %s [%s]\n", profile->name, profile->login);
@@ -2471,7 +2474,7 @@
 		switch_hash_this(hi, NULL, NULL, &data);
 		profile = (mdl_profile_t *) data;
 
-		if(switch_core_hash_find(name_hash, profile->name)) {
+		if (switch_core_hash_find(name_hash, profile->name)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "New profile %s [%s] activated\n", profile->name, profile->login);
 		} else {
 			switch_core_hash_insert(name_hash, profile->name, profile->name);
@@ -2481,7 +2484,7 @@
 	for (hi = switch_hash_first(NULL, name_hash); hi; hi = switch_hash_next(hi)) {
 		switch_hash_this(hi, NULL, NULL, &data);
 
-		if((profile = switch_core_hash_find(globals.profile_hash, (char*)data))) {
+		if ((profile = switch_core_hash_find(globals.profile_hash, (char *) data))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleting unused profile %s [%s]\n", profile->name, profile->login);
 			destroy_profile(profile->name);
 		}
@@ -2581,7 +2584,7 @@
 				}
 
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: %s\n", profile->odbc_dsn);
-				switch_odbc_handle_exec(profile->master_odbc, sub_sql, NULL);
+				switch_odbc_handle_exec(profile->master_odbc, sub_sql, NULL, NULL);
 				//mdl_execute_sql(profile, sub_sql, NULL);
 			} else {
 				if ((db = switch_core_db_open_file(profile->dbname))) {
@@ -2695,7 +2698,8 @@
 	switch_safe_free(xmlstr);
 }
 
-static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsession, ldl_signal_t dl_signal, char *to, char *from, char *subject, char *msg)
+static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsession, ldl_signal_t dl_signal, char *to, char *from, char *subject,
+									char *msg)
 {
 	mdl_profile_t *profile = NULL;
 	switch_core_session_t *session = NULL;
@@ -2730,7 +2734,8 @@
 
 			case LDL_SIGNAL_SUBSCRIBE:
 				if (profile->user_flags & LDL_FLAG_COMPONENT && ldl_jid_domcmp(from, to)) {
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Attempt to add presence from/to our own domain [%s][%s]\n", from, to);
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Attempt to add presence from/to our own domain [%s][%s]\n",
+									  from, to);
 				} else {
 					switch_mutex_lock(profile->mutex);
 					if ((sql = switch_mprintf("delete from jabber_subscriptions where sub_from='%q' and sub_to='%q'", from, to))) {
@@ -2839,9 +2844,9 @@
 
 		switch (dl_signal) {
 		case LDL_SIGNAL_MSG:{
-			char *proto = MDL_CHAT_PROTO;
-			char *pproto = NULL, *ffrom = NULL;
-			char *hint;
+				char *proto = MDL_CHAT_PROTO;
+				char *pproto = NULL, *ffrom = NULL;
+				char *hint;
 #ifdef AUTO_REPLY
 				if (profile->auto_reply) {
 					ldl_handle_send_msg(handle,
@@ -2867,8 +2872,8 @@
 					}
 					from = ffrom;
 				}
-				
-				if (strcasecmp(proto, MDL_CHAT_PROTO)) { /* yes no ! on purpose */
+
+				if (strcasecmp(proto, MDL_CHAT_PROTO)) {	/* yes no ! on purpose */
 					switch_core_chat_send(proto, MDL_CHAT_PROTO, from, to, subject, switch_str_nil(msg), NULL, hint);
 				}
 
@@ -2920,7 +2925,7 @@
 			status = LDL_STATUS_FALSE;
 			goto done;
 		}
-		
+
 	} else {
 		if (dl_signal != LDL_SIGNAL_INITIATE && !msg) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Session is already dead\n");
@@ -2928,13 +2933,13 @@
 			goto done;
 		}
 
-		if(profile->purge) {
+		if (profile->purge) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile '%s' is marked for deletion, disallowing incoming call\n", profile->name);
 			status = LDL_STATUS_FALSE;
 			goto done;
 		}
 
-		if(switch_thread_rwlock_tryrdlock(profile->rwlock) != SWITCH_STATUS_SUCCESS) {
+		if (switch_thread_rwlock_tryrdlock(profile->rwlock) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't do read lock on profile '%s'\n", profile->name);
 			status = LDL_STATUS_FALSE;
 			goto done;
@@ -3156,7 +3161,8 @@
 				unsigned int x, y;
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%u payloads\n", len);
 				for (x = 0; x < len; x++) {
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Available Payload %s %u\n", payloads[x].name, payloads[x].id);
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Available Payload %s %u\n", payloads[x].name,
+									  payloads[x].id);
 					for (y = 0; y < tech_pvt->num_codecs; y++) {
 						char *name = tech_pvt->codecs[y]->iananame;
 
@@ -3174,8 +3180,8 @@
 
 						if (match && payloads[x].rate == tech_pvt->codecs[y]->samples_per_second) {
 							tech_pvt->codec_index = y;
-							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Choosing Payload index %u %s %u\n", y, payloads[x].name,
-											  payloads[x].id);
+							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Choosing Payload index %u %s %u\n", y,
+											  payloads[x].name, payloads[x].id);
 							tech_pvt->codec_name = tech_pvt->codecs[y]->iananame;
 							tech_pvt->codec_num = tech_pvt->codecs[y]->ianacode;
 							tech_pvt->r_codec_num = (switch_payload_t) (payloads[x].id);
@@ -3252,7 +3258,8 @@
 						lanaddr = strncasecmp(candidates[x].address, profile->lanaddr, strlen(profile->lanaddr)) ? 0 : 1;
 					}
 
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidates %s:%d\n", candidates[x].address, candidates[x].port);
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "candidates %s:%d\n", candidates[x].address,
+									  candidates[x].port);
 
 					// 192.0.0.0 - 192.0.127.255 is marked as reserved, should we filter all of them?
 					if (!strcasecmp(candidates[x].protocol, "udp") &&

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_h323/changes.txt (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_h323/changes.txt	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_h323/changes.txt	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,5 +1,12 @@
-
-fix to build with trunk changes.
+add PI handling in Call Proceeding.
+add PI handling in alerting.
+fix slow start handling
+move faststart to callproceeding due to some broken hardware not anderstand 
+    correclty faststart in progress.
+fix rtp timer initialisation.
+implement alerting-indication option and channel variable.
+implement progress-indication option and channel variable.
+fix short DTMF warnings.
 remove SWITCH_RTP_FLAG_AUTOADJ because its not work correctly and not do anything reliable in our cases.
 fix faststart in progress handling
 fixxxxes

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_h323/h323.conf.xml (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_h323/h323.conf.xml	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_h323/h323.conf.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -12,6 +12,8 @@
     <param name="h245tunneling" value="true"/>  <!-- optional -->
     <param name="h245insetup" value="true"/>  <!-- optional -->
     <param name="jitter-size" value="60"/>  <!-- optional -->
+    <param name="progress-indication" value="8"/> <!-- optional - PI value in progress message-->
+    <param name="alerting-indication" value="8"/> <!-- optional - PI value in alerting message-->
   </settings>
   <listeners>
     <listener name="default">

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_h323/mod_h323.cpp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_h323/mod_h323.cpp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_h323/mod_h323.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,5 +1,5 @@
 /*
-	Version 0.0.13
+	Version 0.0.20
 */
 
 #include "mod_h323.h"
@@ -361,6 +361,8 @@
     }
 
     switch_xml_t xmlSettings = switch_xml_child(cfg, "settings");
+	m_pi = 8;
+	m_ai = 0;
     if (xmlSettings) {
         for (switch_xml_t xmlParam = switch_xml_child(xmlSettings, "param"); xmlParam != NULL; xmlParam = xmlParam->next) {
             const char *var = switch_xml_attr_soft(xmlParam, "name");
@@ -405,8 +407,11 @@
 				m_gkPrefixes.AppendString(val);
 			} else if (!strcasecmp(var, "gk-retry")) {
 				m_gkretry = atoi(val);
-			} 
-			
+			} else if (!strcasecmp(var, "progress-indication")) {
+				m_pi = atoi(val);
+			} else if (!strcasecmp(var, "alerting-indication")) {
+				m_ai = atoi(val);
+			}			
         }
     }
 
@@ -772,7 +777,63 @@
 	return true;
 }
 
+bool FSH323Connection::OnReceivedSignalSetup(const H323SignalPDU & setupPDU){
 
+	PTRACE(4, "mod_h323\t======>FSH323Connection::OnReceivedSignalSetup ["<<*this<<"]");
+	
+	if (!H323Connection::OnReceivedSignalSetup(setupPDU)) return false;
+	
+	H323SignalPDU callProceedingPDU;
+	H225_CallProceeding_UUIE & callProceeding = callProceedingPDU.BuildCallProceeding(*this);
+	
+	if (SendFastStartAcknowledge(callProceeding.m_fastStart)){
+					callProceeding.IncludeOptionalField(H225_CallProceeding_UUIE::e_fastStart);
+	} else {
+		PTRACE(2, "H323\tSendFastStartAcknowledge = FALSE ");
+		if (connectionState == ShuttingDownConnection){
+			return true;
+		}
+		earlyStart = TRUE;
+		if (!h245Tunneling && (controlChannel == NULL)) {
+			if (!StartControlChannel()){
+				return true;
+			}
+			callProceeding.IncludeOptionalField(H225_CallProceeding_UUIE::e_h245Address);
+			controlChannel->SetUpTransportPDU(callProceeding.m_h245Address, TRUE);
+		}
+	}
+					
+	if (!WriteSignalPDU(callProceedingPDU))
+        return false;
+		
+	return true;		
+}
+
+bool FSH323Connection::OnReceivedCallProceeding(const H323SignalPDU & pdu){
+	PTRACE(4, "mod_h323\t======>PFSH323Connection::OnReceivedCallProceeding ["<<*this<<"]");
+	unsigned pi;
+
+	
+	if (!pdu.GetQ931().GetProgressIndicator(pi))
+		pi = 0;
+	PTRACE(4, "mod_h323\t----------->OnAlerting PI = "<<pi);
+	if (pi > 0){
+		if ((m_rxChennel && m_txChennel) || (m_ChennelProgress && m_rxChennel))
+			switch_channel_mark_pre_answered(m_fsChannel);
+		else{
+			m_ChennelProgress = true;
+		}
+	}
+	return H323Connection::OnReceivedCallProceeding(pdu);
+}
+
+bool FSH323Connection::OnSendCallProceeding(H323SignalPDU & callProceedingPDU){
+	PTRACE(4, "mod_h323\t======>FSH323Connection::OnSendCallProceeding fastStartState = "<<FastStartStateNames[fastStartState]<<" ["<<*this<<"]");
+	
+	return false;
+//	return true;
+}
+
 bool FSH323Connection::OnSendReleaseComplete(H323SignalPDU & pdu)
 {
 	PTRACE(4, "mod_h323\t======>FSH323Connection::OnSendReleaseComplete cause = "<<pdu.GetQ931().GetCause()<<" value = "<<(switch_call_cause_t)pdu.GetQ931().GetCause());
@@ -814,13 +875,111 @@
 
 
 bool FSH323Connection::OnAlerting(const H323SignalPDU &alertingPDU, const PString &user){
-
+	
 	PTRACE(4, "mod_h323\t======>PFSH323Connection::OnAlerting user = "<<(const char *)user<<" ["<<*this<<"]");
+	unsigned pi;
 	switch_status_t status = switch_channel_mark_ring_ready(m_fsChannel);
 	PTRACE(4, "mod_h323\t----------->OnAlerting return = "<<status);
+	
+	if (!alertingPDU.GetQ931().GetProgressIndicator(pi))
+		pi = 0;
+	PTRACE(4, "mod_h323\t----------->OnAlerting PI = "<<pi);
+	if (pi > 0){
+		if ((m_rxChennel && m_txChennel) || (m_ChennelProgress && m_rxChennel))
+			switch_channel_mark_pre_answered(m_fsChannel);
+		else{
+			m_ChennelProgress = true;
+		}
+	}
 	return ( status == SWITCH_STATUS_SUCCESS);
 }
 
+void FSH323Connection::AnsweringCall(AnswerCallResponse response){
+
+	PTRACE(4, "mod_h323\t======>FSH323Connection::AnsweringCall ["<<*this<<"]");
+	
+	switch (response) {
+		case AnswerCallDeferredWithMedia:{
+			PTRACE(2, "H323\tAnswering call: " << response);
+			if (!Lock())
+				return;
+			if (!mediaWaitForConnect) {
+				// create a new facility PDU if doing AnswerDeferredWithMedia
+				H323SignalPDU want245PDU;
+				H225_Progress_UUIE & prog = want245PDU.BuildProgress(*this);
+				PBoolean sendPDU = TRUE;
+				PTRACE(2, "H323\tmediaWaitForConnect = FALSE ");
+/*				if (SendFastStartAcknowledge(prog.m_fastStart)){
+					PTRACE(2, "H323\tSendFastStartAcknowledge = TRUE ");
+					prog.IncludeOptionalField(H225_Progress_UUIE::e_fastStart);
+				} else {
+					PTRACE(2, "H323\tSendFastStartAcknowledge = FALSE ");
+					// See if aborted call
+					if (connectionState == ShuttingDownConnection){
+						Unlock();
+						return;
+					}
+					// Do early H.245 start
+					H225_Facility_UUIE & fac = *want245PDU.BuildFacility(*this, FALSE, H225_FacilityReason::e_startH245);
+					earlyStart = TRUE;
+					if (!h245Tunneling && (controlChannel == NULL)) {
+						if (!StartControlChannel()){
+							Unlock();
+							return;
+						}
+						fac.IncludeOptionalField(H225_Facility_UUIE::e_h245Address);
+						controlChannel->SetUpTransportPDU(fac.m_h245Address, TRUE);
+					} 
+					else
+						sendPDU = FALSE;
+				}
+*/				
+				const char *vpi = switch_channel_get_variable(m_fsChannel, "progress-indication"); 
+				unsigned pi = 8;
+				if (vpi){
+					pi = atoi(vpi); 
+				}
+				else pi = m_endpoint->m_pi;
+				if ((pi< 1) || (pi > 8)||(pi == 7)) pi = 8;
+				want245PDU.GetQ931().SetProgressIndicator(pi);
+				if (sendPDU) {
+					HandleTunnelPDU(&want245PDU);
+					WriteSignalPDU(want245PDU);
+				}
+			}
+			InternalEstablishedConnectionCheck();
+			Unlock();
+			return;
+		} 
+		case AnswerCallPending :{
+			if (alertingPDU != NULL) {
+				if (!Lock())
+					return;
+				// send Q931 Alerting PDU
+				PTRACE(3, "H225\tSending Alerting PDU");
+				
+				const char *vai = switch_channel_get_variable(m_fsChannel, "alerting-indication"); 
+				unsigned ai = 0;
+				if (vai){
+					ai = atoi(vai); 
+				}
+				else ai = m_endpoint->m_ai;
+				if ((ai< 0) || (ai > 8)||(ai == 7)) ai = 8;
+				if (ai > 0)
+					(*alertingPDU).GetQ931().SetProgressIndicator(ai);
+				
+				HandleTunnelPDU(alertingPDU);
+				WriteSignalPDU(*alertingPDU);
+				alertingTime = PTime();
+				InternalEstablishedConnectionCheck();
+				Unlock();
+				return;
+			}
+		}
+		default :H323Connection::AnsweringCall(response);
+	} 
+}
+
 void FSH323Connection::OnEstablished(){
 
 	PTRACE(4, "mod_h323\t======>PFSH323Connection::OnEstablished ["<<*this<<"]");
@@ -870,6 +1029,8 @@
         break;
     case SWITCH_SIG_KILL:
     default:
+		m_rxAudioOpened.Signal();
+		m_txAudioOpened.Signal();        
 		if (switch_rtp_ready(tech_pvt->rtp_session)) {
 			switch_rtp_kill_socket(tech_pvt->rtp_session);
 		}
@@ -924,37 +1085,48 @@
     }
 
     switch (msg->message_id) {
-		case SWITCH_MESSAGE_INDICATE_RINGING:{
+		case SWITCH_MESSAGE_INDICATE_RINGING:	{
 			 AnsweringCall(AnswerCallPending);
 			break;
 		}
-		case SWITCH_MESSAGE_INDICATE_DEFLECT:{
+		case SWITCH_MESSAGE_INDICATE_DEFLECT:	{
 			break;
 		}
-		case SWITCH_MESSAGE_INDICATE_PROGRESS:{		
+		case SWITCH_MESSAGE_INDICATE_PROGRESS:	{		
 			AnsweringCall(AnswerCallPending);
 			AnsweringCall(AnswerCallDeferredWithMedia);
 			
-			if (m_txChennel && m_rxChennel)
+			if (m_txChennel && m_rxChennel){
 				if (!switch_channel_test_flag(m_fsChannel, CF_EARLY_MEDIA)) {
 					switch_channel_mark_pre_answered(m_fsChannel);
 				}
-			else m_callOnPreAnswer = true;
+			} else { 
+				m_callOnPreAnswer = true;
+				if (fastStartState == FastStartDisabled){
+					m_txAudioOpened.Wait();
+				}
+			}
 			break;
 		}
-		case SWITCH_MESSAGE_INDICATE_ANSWER:{
+		case SWITCH_MESSAGE_INDICATE_ANSWER:	{
 			if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
 				return SWITCH_STATUS_FALSE;
 			}
 			AnsweringCall(H323Connection::AnswerCallNow);
 			PTRACE(4, "mod_h323\tMedia started on connection " << *this);
 		
-			if (m_txChennel && m_rxChennel)
+			if (m_txChennel && m_rxChennel){
 				if (!switch_channel_test_flag(m_fsChannel, CF_EARLY_MEDIA)) {
 					PTRACE(4, "mod_h323\t-------------------->switch_channel_mark_answered(m_fsChannel) " << *this);
 					switch_channel_mark_answered(m_fsChannel);
 				}
-			else m_ChennelAnswer =  true;
+			} else{
+				m_ChennelAnswer =  true;
+				if (fastStartState == FastStartDisabled){
+					m_txAudioOpened.Wait();
+					m_rxAudioOpened.Wait();
+				}
+			}
 			break;
 		}
 		default:{
@@ -1229,6 +1401,7 @@
                 m_switchCodec = NULL;
                 return false;
             }
+			switch_channel_set_variable(m_fsChannel,"timer_name","soft");
         } else {
             switch_core_session_set_video_read_codec(m_fsSession, m_switchCodec);
             switch_channel_set_flag(m_fsChannel, CF_VIDEO);
@@ -1278,11 +1451,13 @@
 	PTRACE(4, "mod_h323\t------------------->samples_per_packet = "<<m_switchCodec->implementation->samples_per_packet);
 	PTRACE(4, "mod_h323\t------------------->actual_samples_per_second = "<<m_switchCodec->implementation->actual_samples_per_second);
 	
-	if (!m_conn->m_startRTP) {			
-		flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_DATAWAIT|SWITCH_RTP_FLAG_AUTO_CNG|SWITCH_RTP_FLAG_RAW_WRITE);		
+	if ((!m_conn->m_startRTP)) {			
+		flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_DATAWAIT|SWITCH_RTP_FLAG_AUTO_CNG|SWITCH_RTP_FLAG_RAW_WRITE);
+		PTRACE(4, "mod_h323\t------------------->timer_name = "<<switch_channel_get_variable(m_fsChannel, "timer_name"));
 		if ((var = switch_channel_get_variable(m_fsChannel, "timer_name"))) {
 			timer_name = (char *) var;
 		}
+		PTRACE(4, "mod_h323\t------------------->timer_name = "<<timer_name);
 		tech_pvt->rtp_session = switch_rtp_new((const char *)m_RTPlocalIP,
 											   m_RTPlocalPort,
 											   (const char *)m_RTPremoteIP,
@@ -1308,6 +1483,10 @@
 	
     PTRACE(4, "mod_h323\t------------->External RTP address "<<m_RTPremoteIP<<":"<<m_RTPremotePort);
 	switch_mutex_unlock(tech_pvt->h323_mutex);
+	
+	if (GetDirection() == IsReceiver) m_conn->m_rxAudioOpened.Signal();
+	else m_conn->m_txAudioOpened.Signal();                             
+	
 	if ( m_conn->m_ChennelAnswer && m_conn->m_rxChennel &&  m_conn->m_txChennel)
 		switch_channel_mark_answered(m_fsChannel);
 		

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_h323/mod_h323.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_h323/mod_h323.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_h323/mod_h323.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -54,10 +54,10 @@
 } TFLAGS;
 
 struct mod_h323_globals {
-    int trace_level;
-    char *codec_string;
-    char *context;
-    char *dialplan;
+	int trace_level;
+	char *codec_string;
+	char *context;
+	char *dialplan;
 };
 
 extern struct mod_h323_globals mod_h323_globals;
@@ -67,19 +67,19 @@
 
 typedef struct {
 	unsigned int flags;
-    switch_timer_t read_timer;
-    switch_codec_t read_codec;
-    switch_codec_t write_codec;
+	switch_timer_t read_timer;
+	switch_codec_t read_codec;
+	switch_codec_t write_codec;
 	switch_frame_t read_frame;
-	
-    switch_timer_t vid_read_timer;
-    switch_codec_t vid_read_codec;
-    switch_codec_t vid_write_codec;
+
+	switch_timer_t vid_read_timer;
+	switch_codec_t vid_read_codec;
+	switch_codec_t vid_write_codec;
 	switch_rtp_t *rtp_session;
 	switch_mutex_t *flag_mutex;
 	switch_mutex_t *h323_mutex;
-	
-    FSH323Connection *me;
+
+	FSH323Connection *me;
 } h323_private_t;
 
 #define DECLARE_CALLBACK0(name)                           \
@@ -101,199 +101,181 @@
 switch_status_t name(type1 name1, type2 name2, type3 name3)
 
 class FSH323EndPoint;
-class FSProcess : public PLibraryProcess {
-    PCLASSINFO(FSProcess, PLibraryProcess);
+class FSProcess:public PLibraryProcess {
+	PCLASSINFO(FSProcess, PLibraryProcess);
 
- public:
-    FSProcess();
-    ~FSProcess();
+  public:
+	FSProcess();
+	~FSProcess();
 
-    bool Initialise(switch_loadable_module_interface_t *iface);
+	bool Initialise(switch_loadable_module_interface_t *iface);
 
-    FSH323EndPoint & GetH323EndPoint() const { return *m_h323endpoint; }
-
-  protected:
-    FSH323EndPoint * m_h323endpoint;
+	     FSH323EndPoint & GetH323EndPoint() const {
+		return *m_h323endpoint;
+  } protected:
+	      FSH323EndPoint * m_h323endpoint;
 };
 
 struct FSListener {
-    FSListener() {
-    }
-
-    PString name;
-    H323ListenerTCP *listenAddress;
-    PString localUserName;
-    PString gatekeeper;
+	FSListener() {
+	} PString name;
+	H323ListenerTCP *listenAddress;
+	PString localUserName;
+	PString gatekeeper;
 };
 class FSGkRegThread;
+
 class FSH323EndPoint:public H323EndPoint {
 
-    PCLASSINFO(FSH323EndPoint, H323EndPoint);
-	public:
-		FSH323EndPoint();
-		~FSH323EndPoint();
-		
-		
+	PCLASSINFO(FSH323EndPoint, H323EndPoint);
+  public:
+	FSH323EndPoint();
+	~FSH323EndPoint();
+
+
 	 /**Create a connection that uses the specified call.
       */
-	virtual H323Connection* CreateConnection(
-		unsigned callReference, 
-		void* userData,
-		H323Transport* transport, 
-		H323SignalPDU* setupPDU
-	);
+	virtual H323Connection *CreateConnection(unsigned callReference, void *userData, H323Transport * transport, H323SignalPDU * setupPDU);
 	virtual bool OnSetGatewayPrefixes(PStringList & prefixes) const;
-	
+
 	bool Initialise(switch_loadable_module_interface_t *iface);
-	
-    switch_status_t ReadConfig(int reload);
-	
-	void StartGkClient(int retry, PString* gkAddress,PString* gkIdentifer,PString* gkInterface);
+
+	switch_status_t ReadConfig(int reload);
+
+	void StartGkClient(int retry, PString * gkAddress, PString * gkIdentifer, PString * gkInterface);
 	void StopGkClient();
-	
+
 	switch_endpoint_interface_t *GetSwitchInterface() const {
-        return m_freeswitch;
-    }
-	FSH323Connection * FSMakeCall(const PString & dest,void *userData);
-	list <FSListener> m_listeners;
-	
-	protected:
-		PStringList m_gkPrefixes;
-		switch_endpoint_interface_t *m_freeswitch;
-		PString m_gkAddress;
-		PString m_gkIdentifer;
-		PString m_gkInterface;
-		bool m_faststart;
-		bool m_h245tunneling;
-		bool m_h245insetup;
-		int m_gkretry;
-		FSGkRegThread* m_thread;
-		
+		return m_freeswitch;
+	} FSH323Connection *FSMakeCall(const PString & dest, void *userData);
+	                 list < FSListener > m_listeners;
+	int m_ai;
+	int m_pi;
+  protected:
+	    PStringList m_gkPrefixes;
+	switch_endpoint_interface_t *m_freeswitch;
+	PString m_gkAddress;
+	PString m_gkIdentifer;
+	PString m_gkInterface;
+	bool m_faststart;
+	bool m_h245tunneling;
+	bool m_h245insetup;
+	int m_gkretry;
+	FSGkRegThread *m_thread;
 };
 
 
-class FSGkRegThread : public PThread
-{
-    PCLASSINFO(FSGkRegThread, PThread);
-public:
-    FSGkRegThread(FSH323EndPoint* endpoint, PString* gkAddress, PString* gkIdentifer, PString* gkInterface, int retry = 0)
-	: PThread(10000), m_ep(endpoint), m_retry(retry), m_gkAddress(gkAddress),m_gkIdentifer(gkIdentifer),m_gkInterface(gkInterface)
-	{ }
-    void Main()
-	{ m_ep->StartGkClient(m_retry,m_gkAddress,m_gkIdentifer,m_gkInterface); }
-protected:
-    FSH323EndPoint* m_ep;
-    int m_retry;
-    PString* m_gkAddress;
-	PString* m_gkIdentifer;
-	PString* m_gkInterface;
+class FSGkRegThread:public PThread {
+	PCLASSINFO(FSGkRegThread, PThread);
+  public:
+	FSGkRegThread(FSH323EndPoint * endpoint, PString * gkAddress, PString * gkIdentifer, PString * gkInterface, int retry = 0)
+  :	PThread(10000), m_ep(endpoint), m_retry(retry), m_gkAddress(gkAddress), m_gkIdentifer(gkIdentifer), m_gkInterface(gkInterface) {
+	} void Main() {
+		m_ep->StartGkClient(m_retry, m_gkAddress, m_gkIdentifer, m_gkInterface);
+	}
+  protected:
+	FSH323EndPoint * m_ep;
+	int m_retry;
+	PString *m_gkAddress;
+	PString *m_gkIdentifer;
+	PString *m_gkInterface;
 };
 
 
 class FSH323Connection:public H323Connection {
-    PCLASSINFO(FSH323Connection, H323Connection)
+	PCLASSINFO(FSH323Connection, H323Connection)
 
   public:
-	FSH323Connection(FSH323EndPoint& endpoint, 
-					H323Transport* transport, 
-					unsigned callReference, 
-					switch_caller_profile_t *outbound_profile,
-					switch_core_session_t *fsSession,
-					switch_channel_t *fsChannel);
+	FSH323Connection(FSH323EndPoint & endpoint,
+					 H323Transport * transport,
+					 unsigned callReference, switch_caller_profile_t *outbound_profile, switch_core_session_t *fsSession, switch_channel_t *fsChannel);
 
-	~FSH323Connection();				
+	                ~FSH323Connection();
 
-	virtual H323Channel* CreateRealTimeLogicalChannel(
-		const H323Capability& capability, 
-		H323Channel::Directions dir,
-		unsigned sessionID,
-		const H245_H2250LogicalChannelParameters* param,
-		RTP_QOS * rtpqos = NULL
-	);
-	virtual PBoolean OnStartLogicalChannel(H323Channel& channel);
-	virtual PBoolean OnCreateLogicalChannel(const H323Capability& capability, H323Channel::Directions dir, unsigned& errorCode);
+	virtual H323Channel *CreateRealTimeLogicalChannel(const H323Capability & capability,
+													  H323Channel::Directions dir,
+													  unsigned sessionID, const H245_H2250LogicalChannelParameters * param, RTP_QOS * rtpqos = NULL);
+	virtual PBoolean OnStartLogicalChannel(H323Channel & channel);
+	virtual PBoolean OnCreateLogicalChannel(const H323Capability & capability, H323Channel::Directions dir, unsigned &errorCode);
+	virtual bool OnReceivedSignalSetup(const H323SignalPDU & setupPDU);
+	virtual bool OnReceivedCallProceeding(const H323SignalPDU & pdu);
 	virtual void OnReceivedReleaseComplete(const H323SignalPDU & pdu);
-	virtual	bool OnReceivedProgress(const H323SignalPDU &);
+	virtual bool OnReceivedProgress(const H323SignalPDU &);
+	virtual bool OnSendCallProceeding(H323SignalPDU & callProceedingPDU);
 	virtual bool OnSendReleaseComplete(H323SignalPDU & pdu);
-	virtual PBoolean OpenLogicalChannel(const H323Capability& capability, unsigned sessionID, H323Channel::Directions dir);
-    void setRemoteAddress(const char* remoteIP, WORD remotePort);
+	virtual PBoolean OpenLogicalChannel(const H323Capability & capability, unsigned sessionID, H323Channel::Directions dir);
+	void setRemoteAddress(const char *remoteIP, WORD remotePort);
 	virtual void OnSetLocalCapabilities();
-	virtual bool OnAlerting(const H323SignalPDU &alertingPDU, const PString &user);
+	virtual bool OnAlerting(const H323SignalPDU & alertingPDU, const PString & user);
+	virtual void AnsweringCall(AnswerCallResponse response);
 	virtual void OnEstablished();
 	bool SetLocalCapabilities();
-	static bool decodeCapability(const H323Capability& capability, const char** dataFormat, int* payload = 0, PString* capabName = 0);
-	virtual H323Connection::AnswerCallResponse OnAnswerCall(const PString& caller,
-						const H323SignalPDU& signalPDU, H323SignalPDU& connectPDU);
+	static bool decodeCapability(const H323Capability & capability, const char **dataFormat, int *payload = 0, PString * capabName = 0);
+	virtual H323Connection::AnswerCallResponse OnAnswerCall(const PString & caller, const H323SignalPDU & signalPDU, H323SignalPDU & connectPDU);
 	virtual bool OnReceivedCapabilitySet(const H323Capabilities & remoteCaps,
-								const H245_MultiplexCapability * muxCap,
-								H245_TerminalCapabilitySetReject & reject);
+										 const H245_MultiplexCapability * muxCap, H245_TerminalCapabilitySetReject & reject);
 	switch_core_session_t *GetSession() const {
-        return m_fsSession;
-    }
-	virtual void SendUserInputTone(char tone, unsigned duration = 0, unsigned logicalChannel = 0, unsigned rtpTimestamp = 0);
+		return m_fsSession;
+	} virtual void SendUserInputTone(char tone, unsigned duration = 0, unsigned logicalChannel = 0, unsigned rtpTimestamp = 0);
 	virtual void OnUserInputTone(char, unsigned, unsigned, unsigned);
-	virtual void OnUserInputString(const PString &value);
-	DECLARE_CALLBACK0(on_init);
-    DECLARE_CALLBACK0(on_routing);
-    DECLARE_CALLBACK0(on_execute);
+	virtual void OnUserInputString(const PString & value);
+	      DECLARE_CALLBACK0(on_init);
+	      DECLARE_CALLBACK0(on_routing);
+	      DECLARE_CALLBACK0(on_execute);
 
-    DECLARE_CALLBACK0(on_exchange_media);
-    DECLARE_CALLBACK0(on_soft_execute);
+	      DECLARE_CALLBACK0(on_exchange_media);
+	      DECLARE_CALLBACK0(on_soft_execute);
 
-    DECLARE_CALLBACK1(kill_channel, int, sig);
-    DECLARE_CALLBACK1(send_dtmf, const switch_dtmf_t *, dtmf);
-    DECLARE_CALLBACK1(receive_message, switch_core_session_message_t *, msg);
-    DECLARE_CALLBACK1(receive_event, switch_event_t *, event);
-    DECLARE_CALLBACK0(state_change);
+	      DECLARE_CALLBACK1(kill_channel, int, sig);
+	    DECLARE_CALLBACK1(send_dtmf, const switch_dtmf_t *, dtmf);
+	              DECLARE_CALLBACK1(receive_message, switch_core_session_message_t *, msg);
+	                              DECLARE_CALLBACK1(receive_event, switch_event_t *, event);
+	               DECLARE_CALLBACK0(state_change);
 
-	DECLARE_CALLBACK3(read_audio_frame, switch_frame_t **, frame, switch_io_flag_t, flags, int, stream_id);
-    DECLARE_CALLBACK3(write_audio_frame, switch_frame_t *, frame, switch_io_flag_t, flags, int, stream_id);
-    DECLARE_CALLBACK3(read_video_frame, switch_frame_t **, frame, switch_io_flag_t, flag, int, stream_id);
-    DECLARE_CALLBACK3(write_video_frame, switch_frame_t *, frame, switch_io_flag_t, flag, int, stream_id);
-	
+	               DECLARE_CALLBACK3(read_audio_frame, switch_frame_t **, frame, switch_io_flag_t, flags, int, stream_id);
+	    DECLARE_CALLBACK3(write_audio_frame, switch_frame_t *, frame, switch_io_flag_t, flags, int, stream_id);
+	    DECLARE_CALLBACK3(read_video_frame, switch_frame_t **, frame, switch_io_flag_t, flag, int, stream_id);
+	    DECLARE_CALLBACK3(write_video_frame, switch_frame_t *, frame, switch_io_flag_t, flag, int, stream_id);
+
 	bool m_callOnPreAnswer;
 	bool m_startRTP;
 	bool m_rxChennel;
 	bool m_txChennel;
 	bool m_ChennelAnswer;
 	bool m_ChennelProgress;
+	PSyncPoint m_rxAudioOpened;
+	PSyncPoint m_txAudioOpened;
   protected:
-	FSH323EndPoint * m_endpoint;
+	           FSH323EndPoint * m_endpoint;
 	PString m_remoteAddr;
-    int m_remotePort;
+	int m_remotePort;
 	switch_core_session_t *m_fsSession;
-    switch_channel_t *m_fsChannel;
-	PIPSocket::Address m_RTPlocalIP;
+	switch_channel_t *m_fsChannel;
+	                 PIPSocket::Address m_RTPlocalIP;
 	WORD m_RTPlocalPort;
 	unsigned char m_buf[SWITCH_RECOMMENDED_BUFFER_SIZE];
 };
 
 
-class FSH323_ExternalRTPChannel : public H323_ExternalRTPChannel{
-    PCLASSINFO(FSH323_ExternalRTPChannel, H323_ExternalRTPChannel);
-public:
-    /* Create a new channel. */
-    FSH323_ExternalRTPChannel(
-		FSH323Connection& connection,
-		const H323Capability& capability,
-		Directions direction,
-		unsigned sessionID,
-		const PIPSocket::Address& ip, 
-		WORD dataPort
-	);
-    /* Destructor */
-    ~FSH323_ExternalRTPChannel();
+class FSH323_ExternalRTPChannel:public H323_ExternalRTPChannel {
+	PCLASSINFO(FSH323_ExternalRTPChannel, H323_ExternalRTPChannel);
+  public:
+	/* Create a new channel. */
+	FSH323_ExternalRTPChannel(FSH323Connection & connection,
+							  const H323Capability & capability, Directions direction, unsigned sessionID, const PIPSocket::Address & ip, WORD dataPort);
+	/* Destructor */
+	     ~FSH323_ExternalRTPChannel();
 
-    virtual PBoolean Start();
-    virtual PBoolean OnReceivedAckPDU(const H245_H2250LogicalChannelAckParameters& param);
-    virtual PBoolean OnSendingPDU(H245_H2250LogicalChannelParameters& param);
-    virtual PBoolean OnReceivedPDU(const H245_H2250LogicalChannelParameters& param,unsigned& errorCode);
-    virtual void OnSendOpenAck(H245_H2250LogicalChannelAckParameters& param);
-	
+	virtual PBoolean Start();
+	virtual PBoolean OnReceivedAckPDU(const H245_H2250LogicalChannelAckParameters & param);
+	virtual PBoolean OnSendingPDU(H245_H2250LogicalChannelParameters & param);
+	virtual PBoolean OnReceivedPDU(const H245_H2250LogicalChannelParameters & param, unsigned &errorCode);
+	virtual void OnSendOpenAck(H245_H2250LogicalChannelAckParameters & param);
 
-private:
-    FSH323Connection* m_conn;
-	const H323Capability* m_capability;
+
+  private:
+	     FSH323Connection * m_conn;
+	const H323Capability *m_capability;
 	switch_core_session_t *m_fsSession;
 	switch_channel_t *m_fsChannel;
 	switch_codec_t *m_switchCodec;
@@ -305,124 +287,95 @@
 	PString m_RTPlocalIP;
 	WORD m_RTPlocalPort;
 	BYTE payloadCode;
-	
+
 };
 
-class BaseG7231Capab : public H323AudioCapability
-{
-    PCLASSINFO(BaseG7231Capab, H323AudioCapability);
-public:
-    BaseG7231Capab(const char* fname, bool annexA = true)
-	: H323AudioCapability(7,4), m_name(fname), m_aa(annexA)
-	{ }
-	
-    virtual PObject* Clone() const{ 
-		return new BaseG7231Capab(*this); 
-	}
-	
-    virtual unsigned GetSubType() const{
-		return H245_AudioCapability::e_g7231; 
-	}
-	
-    virtual PString GetFormatName() const{
-		return m_name; 
-	}
-	
-    virtual H323Codec* CreateCodec(H323Codec::Direction direction) const{
-		return 0; 
-	}
-	
-    virtual Comparison Compare(const PObject& obj) const{
-	    Comparison res = H323AudioCapability::Compare(obj);
-	    if (res != EqualTo)
-			return res;
-	    bool aa = static_cast<const BaseG7231Capab&>(obj).m_aa;
-	    if (aa && !m_aa)
-			return LessThan;
-	    if (m_aa && !aa)
-			return GreaterThan;
-	    return EqualTo;
-	}
-	
-    virtual bool OnSendingPDU(H245_AudioCapability& pdu, unsigned packetSize) const	{
-	    pdu.SetTag(GetSubType());
-	    H245_AudioCapability_g7231& g7231 = pdu;
-	    g7231.m_maxAl_sduAudioFrames = packetSize;
-	    g7231.m_silenceSuppression = m_aa;
-	    return true;
-	}
-	
-    virtual bool OnReceivedPDU(const H245_AudioCapability& pdu, unsigned& packetSize){
-	    if (pdu.GetTag() != H245_AudioCapability::e_g7231)
+class BaseG7231Capab:public H323AudioCapability {
+	PCLASSINFO(BaseG7231Capab, H323AudioCapability);
+  public:
+	BaseG7231Capab(const char *fname, bool annexA = true)
+  :	H323AudioCapability(7, 4), m_name(fname), m_aa(annexA) {
+	} virtual PObject *Clone() const {
+		return new BaseG7231Capab(*this);
+	} virtual unsigned GetSubType() const {
+		return H245_AudioCapability::e_g7231;
+	} virtual PString GetFormatName() const {
+		return m_name;
+	} virtual H323Codec *CreateCodec(H323Codec::Direction direction) const {
+		return 0;
+	} virtual Comparison Compare(const PObject & obj) const {
+		Comparison res = H323AudioCapability::Compare(obj);
+		if         (res != EqualTo)
+			           return res;
+		bool aa = static_cast < const BaseG7231Capab & >(obj).m_aa;
+		if    (aa && !m_aa)
+			      return LessThan;
+		if    (m_aa && !aa)
+			      return GreaterThan;
+		      return EqualTo;
+	} virtual bool OnSendingPDU(H245_AudioCapability & pdu, unsigned packetSize) const {
+		pdu.SetTag(GetSubType());
+		H245_AudioCapability_g7231 & g7231 = pdu;
+		g7231.m_maxAl_sduAudioFrames = packetSize;
+		g7231.m_silenceSuppression = m_aa;
+		return true;
+	} virtual bool OnReceivedPDU(const H245_AudioCapability & pdu, unsigned &packetSize) {
+		if (pdu.GetTag() != H245_AudioCapability::e_g7231)
 			return false;
-	    const H245_AudioCapability_g7231& g7231 = pdu;
-	    packetSize = g7231.m_maxAl_sduAudioFrames;
-	    m_aa = (g7231.m_silenceSuppression != 0);
-	    return true;
+		const H245_AudioCapability_g7231 & g7231 = pdu;
+		packetSize = g7231.m_maxAl_sduAudioFrames;
+		m_aa = (g7231.m_silenceSuppression != 0);
+		return true;
 	}
 
-protected:
-    const char* m_name;
-    bool m_aa;
+  protected:
+	const char *m_name;
+	bool m_aa;
 };
 
-class BaseG729Capab : public H323AudioCapability
-{
-    PCLASSINFO(BaseG729Capab, H323AudioCapability);
-public:
-    BaseG729Capab(const char* fname, unsigned type = H245_AudioCapability::e_g729)
-	: H323AudioCapability(24,6), m_name(fname), m_type(type)
-	{ }
-    virtual PObject* Clone() const
-	// default copy constructor - take care!
-	{ return new BaseG729Capab(*this); }
-    virtual unsigned GetSubType() const
-	{ return m_type; }
-    virtual PString GetFormatName() const
-	{ return m_name; }
-    virtual H323Codec* CreateCodec(H323Codec::Direction direction) const
-	{ return 0; }
-protected:
-    const char* m_name;
-    unsigned m_type;
+class BaseG729Capab:public H323AudioCapability {
+	PCLASSINFO(BaseG729Capab, H323AudioCapability);
+  public:
+	BaseG729Capab(const char *fname, unsigned type = H245_AudioCapability::e_g729)
+  :	H323AudioCapability(24, 6), m_name(fname), m_type(type) {
+	} virtual PObject *Clone() const
+		// default copy constructor - take care!
+	{
+		return new BaseG729Capab(*this);
+	} virtual unsigned GetSubType() const {
+		return m_type;
+	} virtual PString GetFormatName() const {
+		return m_name;
+	} virtual H323Codec *CreateCodec(H323Codec::Direction direction) const {
+		return 0;
+  } protected:
+	const char *m_name;
+	unsigned m_type;
 };
 
-class BaseGSM0610Cap : public H323AudioCapability
-{
+class BaseGSM0610Cap:public H323AudioCapability {
 	PCLASSINFO(BaseGSM0610Cap, H323AudioCapability);
 
-public:
-	
-	BaseGSM0610Cap(const char* fname, unsigned type = H245_AudioCapability::e_gsmFullRate)
-	: H323AudioCapability(24,2), m_name(fname), m_type(type),m_comfortNoise(0),m_scrambled(0)
-	{ }
-	
-	virtual PObject * Clone() const{
-		return new BaseGSM0610Cap(*this);
-	}
+  public:
 
-	virtual H323Codec* CreateCodec(H323Codec::Direction direction) const{
+	BaseGSM0610Cap(const char *fname, unsigned type = H245_AudioCapability::e_gsmFullRate)
+  :	H323AudioCapability(24, 2), m_name(fname), m_type(type), m_comfortNoise(0), m_scrambled(0) {
+	} virtual PObject *Clone() const {
+		return new BaseGSM0610Cap(*this);
+	} virtual H323Codec *CreateCodec(H323Codec::Direction direction) const {
 		return 0;
-	}
-
-	virtual unsigned GetSubType() const{
+	} virtual unsigned GetSubType() const {
 		return H245_AudioCapability::e_gsmFullRate;
-	}
-
-	virtual PString GetFormatName() const{
+	} virtual PString GetFormatName() const {
 		return m_name;
-	}
-
-	virtual bool OnSendingPDU(H245_AudioCapability & pdu, unsigned packetSize) const{
+	} virtual bool OnSendingPDU(H245_AudioCapability & pdu, unsigned packetSize) const {
 		pdu.SetTag(H245_AudioCapability::e_gsmFullRate);
 		H245_GSMAudioCapability & gsm = pdu;
 		gsm.m_audioUnitSize = packetSize * 33;
 		gsm.m_comfortNoise = m_comfortNoise;
 		gsm.m_scrambled = m_scrambled;
 		return true;
-	}
-	
-	virtual bool OnReceivedPDU(const H245_AudioCapability & pdu, unsigned & packetSize){
+	} virtual bool OnReceivedPDU(const H245_AudioCapability & pdu, unsigned &packetSize) {
 		PTRACE(2, "mod_h323\t==============>BaseGSM0610Cap::OnReceivedPDU");
 		if (pdu.GetTag() != H245_AudioCapability::e_gsmFullRate)
 			return false;
@@ -433,8 +386,8 @@
 		return true;
 	}
 
-protected:
-	const char* m_name;
+  protected:
+	const char *m_name;
 	int m_comfortNoise;
 	int m_scrambled;
 	unsigned m_type;
@@ -451,15 +404,15 @@
 
 
 
-DEFINE_H323_CAPAB(FS_G7231_5,BaseG7231Capab,false,OPAL_G7231_5k3"{sw}")
-DEFINE_H323_CAPAB(FS_G7231_6,BaseG7231Capab,false,OPAL_G7231_6k3"{sw}")
-DEFINE_H323_CAPAB(FS_G7231A_5,BaseG7231Capab,true,OPAL_G7231A_5k3"{sw}")
-DEFINE_H323_CAPAB(FS_G7231A_6,BaseG7231Capab,true,OPAL_G7231A_6k3"{sw}")
-DEFINE_H323_CAPAB(FS_G729,BaseG729Capab,H245_AudioCapability::e_g729,OPAL_G729"{sw}")
-DEFINE_H323_CAPAB(FS_G729A,BaseG729Capab,H245_AudioCapability::e_g729AnnexA,OPAL_G729A"{sw}")
-DEFINE_H323_CAPAB(FS_G729B,BaseG729Capab,H245_AudioCapability::e_g729wAnnexB,OPAL_G729B"{sw}")
-DEFINE_H323_CAPAB(FS_G729AB,BaseG729Capab,H245_AudioCapability::e_g729AnnexAwAnnexB,OPAL_G729AB"{sw}")
-DEFINE_H323_CAPAB(FS_GSM,BaseGSM0610Cap,H245_AudioCapability::e_gsmFullRate,OPAL_GSM0610"{sw}")
+DEFINE_H323_CAPAB(FS_G7231_5, BaseG7231Capab, false, OPAL_G7231_5k3 "{sw}")
+	DEFINE_H323_CAPAB(FS_G7231_6, BaseG7231Capab, false, OPAL_G7231_6k3 "{sw}")
+	DEFINE_H323_CAPAB(FS_G7231A_5, BaseG7231Capab, true, OPAL_G7231A_5k3 "{sw}")
+	DEFINE_H323_CAPAB(FS_G7231A_6, BaseG7231Capab, true, OPAL_G7231A_6k3 "{sw}")
+	DEFINE_H323_CAPAB(FS_G729, BaseG729Capab, H245_AudioCapability::e_g729, OPAL_G729 "{sw}")
+	DEFINE_H323_CAPAB(FS_G729A, BaseG729Capab, H245_AudioCapability::e_g729AnnexA, OPAL_G729A "{sw}")
+	DEFINE_H323_CAPAB(FS_G729B, BaseG729Capab, H245_AudioCapability::e_g729wAnnexB, OPAL_G729B "{sw}")
+	DEFINE_H323_CAPAB(FS_G729AB, BaseG729Capab, H245_AudioCapability::e_g729AnnexAwAnnexB, OPAL_G729AB "{sw}")
+	DEFINE_H323_CAPAB(FS_GSM, BaseGSM0610Cap, H245_AudioCapability::e_gsmFullRate, OPAL_GSM0610 "{sw}")
 
 
-static FSProcess *h323_process = NULL;
+	 static FSProcess *h323_process = NULL;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_loopback/mod_loopback.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_loopback/mod_loopback.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_loopback/mod_loopback.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -97,7 +97,8 @@
 static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
 static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
-													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
+													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+													switch_call_cause_t *cancel_cause);
 static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
 static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
 static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
@@ -116,7 +117,7 @@
 		rate = codec->implementation->samples_per_second;
 		interval = codec->implementation->microseconds_per_packet / 1000;
 	}
-	
+
 	if (switch_core_codec_ready(&tech_pvt->read_codec)) {
 		switch_core_codec_destroy(&tech_pvt->read_codec);
 	}
@@ -125,17 +126,13 @@
 		switch_core_codec_destroy(&tech_pvt->write_codec);
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s setup codec %s/%d/%d\n", switch_channel_get_name(channel), iananame, rate, interval);
-	
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s setup codec %s/%d/%d\n", switch_channel_get_name(channel), iananame, rate,
+					  interval);
+
 	status = switch_core_codec_init(&tech_pvt->read_codec,
 									iananame,
 									NULL,
-									rate,
-									interval,
-									1, 
-									SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
-									NULL, 
-									switch_core_session_get_pool(session));
+									rate, interval, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(session));
 
 	if (status != SWITCH_STATUS_SUCCESS || !tech_pvt->read_codec.implementation || !switch_core_codec_ready(&tech_pvt->read_codec)) {
 		goto end;
@@ -144,14 +141,9 @@
 	status = switch_core_codec_init(&tech_pvt->write_codec,
 									iananame,
 									NULL,
-									rate,
-									interval,
-									1, 
-									SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
-									NULL, 
-									switch_core_session_get_pool(session));
-	
+									rate, interval, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(session));
 
+
 	if (status != SWITCH_STATUS_SUCCESS) {
 		switch_core_codec_destroy(&tech_pvt->read_codec);
 		goto end;
@@ -160,31 +152,29 @@
 	tech_pvt->read_frame.data = tech_pvt->databuf;
 	tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf);
 	tech_pvt->read_frame.codec = &tech_pvt->read_codec;
-	
 
+
 	tech_pvt->cng_frame.data = tech_pvt->cng_databuf;
 	tech_pvt->cng_frame.buflen = sizeof(tech_pvt->cng_databuf);
 	//switch_set_flag((&tech_pvt->cng_frame), SFF_CNG);
 	tech_pvt->cng_frame.datalen = 2;
 
-	tech_pvt->bowout_frame_count = (tech_pvt->read_codec.implementation->actual_samples_per_second / 
-							 tech_pvt->read_codec.implementation->samples_per_packet) * 3;
+	tech_pvt->bowout_frame_count = (tech_pvt->read_codec.implementation->actual_samples_per_second /
+									tech_pvt->read_codec.implementation->samples_per_packet) * 3;
 
 	switch_core_session_set_read_codec(session, &tech_pvt->read_codec);
 	switch_core_session_set_write_codec(session, &tech_pvt->write_codec);
-	
+
 	if (tech_pvt->flag_mutex) {
 		switch_core_timer_destroy(&tech_pvt->timer);
 	}
 
 	read_impl = tech_pvt->read_codec.implementation;
 
-	switch_core_timer_init(&tech_pvt->timer, "soft", 
-						   read_impl->microseconds_per_packet / 1000, 
-						   read_impl->samples_per_packet *4,
-						   switch_core_session_get_pool(session));
-	
+	switch_core_timer_init(&tech_pvt->timer, "soft",
+						   read_impl->microseconds_per_packet / 1000, read_impl->samples_per_packet * 4, switch_core_session_get_pool(session));
 
+
 	if (!tech_pvt->flag_mutex) {
 		switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
 		switch_mutex_init(&tech_pvt->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
@@ -194,7 +184,7 @@
 		tech_pvt->channel = switch_core_session_get_channel(session);
 	}
 
- end:
+  end:
 
 	return status;
 }
@@ -217,22 +207,22 @@
 
 	channel = switch_core_session_get_channel(session);
 	switch_assert(channel != NULL);
-	
 
 
+
 	if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND) && !switch_test_flag(tech_pvt, TFLAG_BLEG)) {
-		
+
 		if (!(b_session = switch_core_session_request(loopback_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL))) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Failure.\n");
 			goto end;
 		}
-	
+
 		if (switch_core_session_read_lock(b_session) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Failure.\n");
 			switch_core_session_destroy(&b_session);
 			goto end;
 		}
-		
+
 		switch_core_session_add_stream(b_session, NULL);
 		b_channel = switch_core_session_get_channel(b_session);
 		b_tech_pvt = (private_t *) switch_core_session_alloc(b_session, sizeof(*b_tech_pvt));
@@ -244,7 +234,7 @@
 			switch_core_session_destroy(&b_session);
 			goto end;
 		}
-		
+
 		caller_profile = switch_caller_profile_clone(b_session, tech_pvt->caller_profile);
 		caller_profile->source = switch_core_strdup(caller_profile->pool, modname);
 		switch_channel_set_caller_profile(b_channel, caller_profile);
@@ -260,16 +250,16 @@
 		//b_tech_pvt->other_channel = channel;
 
 		b_tech_pvt->other_uuid = switch_core_session_strdup(b_session, switch_core_session_get_uuid(session));
-		
+
 		switch_set_flag_locked(tech_pvt, TFLAG_LINKED);
 		switch_set_flag_locked(b_tech_pvt, TFLAG_LINKED);
 		switch_set_flag_locked(b_tech_pvt, TFLAG_BLEG);
 
-		
-		switch_channel_set_flag(channel, CF_ACCEPT_CNG);	
+
+		switch_channel_set_flag(channel, CF_ACCEPT_CNG);
 		//switch_ivr_transfer_variable(session, tech_pvt->other_session, "process_cdr");
 		switch_ivr_transfer_variable(session, tech_pvt->other_session, NULL);
-		
+
 		switch_channel_set_variable(channel, "other_loopback_leg_uuid", switch_channel_get_uuid(b_channel));
 		switch_channel_set_variable(b_channel, "other_loopback_leg_uuid", switch_channel_get_uuid(channel));
 
@@ -279,10 +269,10 @@
 			goto end;
 		}
 	} else if ((tech_pvt->other_session = switch_core_session_locate(tech_pvt->other_uuid))) {
-		tech_pvt->other_tech_pvt = 	switch_core_session_get_private(tech_pvt->other_session);
+		tech_pvt->other_tech_pvt = switch_core_session_get_private(tech_pvt->other_session);
 		tech_pvt->other_channel = switch_core_session_get_channel(tech_pvt->other_session);
 	}
-	
+
 	if (!tech_pvt->other_session) {
 		switch_clear_flag_locked(tech_pvt, TFLAG_LINKED);
 		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -292,7 +282,7 @@
 	switch_channel_set_variable(channel, "loopback_leg", switch_test_flag(tech_pvt, TFLAG_BLEG) ? "B" : "A");
 	switch_channel_set_state(channel, CS_ROUTING);
 
- end:
+  end:
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -301,7 +291,7 @@
 {
 	switch_clear_flag_locked(tech_pvt, TFLAG_WRITE);
 	switch_set_flag_locked(tech_pvt, TFLAG_CNG);
-	
+
 	switch_mutex_lock(tech_pvt->mutex);
 	if (tech_pvt->other_tech_pvt) {
 		switch_clear_flag_locked(tech_pvt->other_tech_pvt, TFLAG_WRITE);
@@ -333,14 +323,14 @@
 		extension = switch_caller_extension_new(session, app, app);
 		switch_caller_extension_add_application(session, extension, "pre_answer", NULL);
 		switch_caller_extension_add_application(session, extension, app, arg);
-		
+
 		switch_channel_set_caller_extension(channel, extension);
 		switch_channel_set_state(channel, CS_EXECUTE);
 		return SWITCH_STATUS_FALSE;
 	}
 
 
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -356,7 +346,7 @@
 	assert(tech_pvt != NULL);
 
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -373,11 +363,11 @@
 
 	if (tech_pvt) {
 		switch_core_timer_destroy(&tech_pvt->timer);
-		
+
 		if (switch_core_codec_ready(&tech_pvt->read_codec)) {
 			switch_core_codec_destroy(&tech_pvt->read_codec);
 		}
-		
+
 		if (switch_core_codec_ready(&tech_pvt->write_codec)) {
 			switch_core_codec_destroy(&tech_pvt->write_codec);
 		}
@@ -416,7 +406,7 @@
 		switch_clear_flag_locked(tech_pvt->other_tech_pvt, TFLAG_LINKED);
 		tech_pvt->other_tech_pvt = NULL;
 	}
-	
+
 	if (tech_pvt->other_session) {
 		switch_channel_hangup(tech_pvt->other_channel, switch_channel_get_cause(channel));
 		switch_core_session_rwunlock(tech_pvt->other_session);
@@ -424,7 +414,7 @@
 		tech_pvt->other_session = NULL;
 	}
 	switch_mutex_unlock(tech_pvt->mutex);
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -494,7 +484,8 @@
 	switch_assert(tech_pvt != NULL);
 
 	do_reset(tech_pvt);
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s RESET\n", switch_channel_get_name(switch_core_session_get_channel(session)));
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s RESET\n",
+					  switch_channel_get_name(switch_core_session_get_channel(session)));
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -503,7 +494,8 @@
 {
 	switch_assert(switch_core_session_get_private(session));
 
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s HIBERNATE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s HIBERNATE\n",
+					  switch_channel_get_name(switch_core_session_get_channel(session)));
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -555,15 +547,15 @@
 	if (!switch_test_flag(tech_pvt, TFLAG_LINKED)) {
 		goto end;
 	}
-	
+
 	*frame = NULL;
-	
+
 	if (!switch_channel_ready(channel)) {
 		goto end;
 	}
 
 	switch_core_timer_next(&tech_pvt->timer);
-	
+
 	mutex = tech_pvt->mutex;
 	switch_mutex_lock(mutex);
 
@@ -578,7 +570,7 @@
 	} else {
 		switch_set_flag(tech_pvt, TFLAG_CNG);
 	}
-	
+
 	if (switch_test_flag(tech_pvt, TFLAG_CNG)) {
 		unsigned char data[SWITCH_RECOMMENDED_BUFFER_SIZE];
 		uint32_t flag = 0;
@@ -590,25 +582,20 @@
 		tech_pvt->cng_frame.datalen = tech_pvt->read_codec.implementation->decoded_bytes_per_packet;
 
 		memset(tech_pvt->cng_frame.data, 0, tech_pvt->cng_frame.datalen);
-		memset(&data, 0, sizeof(data));
+		memset(&data, 0, tech_pvt->read_codec.implementation->decoded_bytes_per_packet);
 
 		if (strcasecmp(tech_pvt->read_codec.implementation->iananame, "L16")) {
 			encode_status = switch_core_codec_encode(&tech_pvt->read_codec,
-											  NULL,
-											  data,
-											  sizeof(data),
-											  tech_pvt->read_codec.implementation->actual_samples_per_second,
-
-											  tech_pvt->cng_frame.data,
-											  &tech_pvt->cng_frame.datalen,											  
-											  &rate,
-											  &flag);
+													 NULL,
+													 data,
+													 tech_pvt->read_codec.implementation->decoded_bytes_per_packet,
+													 tech_pvt->read_codec.implementation->actual_samples_per_second,
+													 tech_pvt->cng_frame.data, &tech_pvt->cng_frame.datalen, &rate, &flag);
 			if (encode_status != SWITCH_STATUS_SUCCESS) {
 				switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 			}
-													 
-		}
 
+		}
 		//switch_set_flag((&tech_pvt->cng_frame), SFF_CNG);
 		switch_clear_flag_locked(tech_pvt, TFLAG_CNG);
 	}
@@ -618,9 +605,9 @@
 		status = SWITCH_STATUS_SUCCESS;
 	} else {
 		status = SWITCH_STATUS_FALSE;
-	}	
+	}
 
- end:
+  end:
 
 	if (mutex) {
 		switch_mutex_unlock(mutex);
@@ -634,7 +621,7 @@
 	switch_channel_t *channel = NULL;
 	private_t *tech_pvt = NULL;
 	switch_status_t status = SWITCH_STATUS_FALSE;
-	
+
 	channel = switch_core_session_get_channel(session);
 	switch_assert(channel != NULL);
 
@@ -646,16 +633,14 @@
 	}
 
 	switch_mutex_lock(tech_pvt->mutex);
-	if (!switch_test_flag(tech_pvt, TFLAG_BOWOUT) && 
-		tech_pvt->other_tech_pvt && 
-		switch_test_flag(tech_pvt, TFLAG_BRIDGE) && 
-		switch_test_flag(tech_pvt->other_tech_pvt, TFLAG_BRIDGE) && 
+	if (!switch_test_flag(tech_pvt, TFLAG_BOWOUT) &&
+		tech_pvt->other_tech_pvt &&
+		switch_test_flag(tech_pvt, TFLAG_BRIDGE) &&
+		switch_test_flag(tech_pvt->other_tech_pvt, TFLAG_BRIDGE) &&
 		switch_channel_test_flag(tech_pvt->channel, CF_BRIDGED) &&
 		switch_channel_test_flag(tech_pvt->other_channel, CF_BRIDGED) &&
 		switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED) &&
-		switch_channel_test_flag(tech_pvt->other_channel, CF_ANSWERED) &&
-		!--tech_pvt->bowout_frame_count <= 0
-		) {
+		switch_channel_test_flag(tech_pvt->other_channel, CF_ANSWERED) && !--tech_pvt->bowout_frame_count <= 0) {
 		const char *a_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
 		const char *b_uuid = switch_channel_get_variable(tech_pvt->other_channel, SWITCH_SIGNAL_BOND_VARIABLE);
 		const char *vetoa, *vetob;
@@ -665,15 +650,15 @@
 
 		vetoa = switch_channel_get_variable(tech_pvt->channel, "loopback_bowout");
 		vetob = switch_channel_get_variable(tech_pvt->other_tech_pvt->channel, "loopback_bowout");
-		
+
 		if ((!vetoa || switch_true(vetoa)) && (!vetob || switch_true(vetob))) {
 			switch_clear_flag_locked(tech_pvt, TFLAG_WRITE);
 			switch_clear_flag_locked(tech_pvt->other_tech_pvt, TFLAG_WRITE);
-			
+
 			if (a_uuid && b_uuid) {
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
 								  "%s detected bridge on both ends, attempting direct connection.\n", switch_channel_get_name(channel));
-				
+
 				/* channel_masquerade eat your heart out....... */
 				switch_ivr_uuid_bridge(a_uuid, b_uuid);
 				switch_mutex_unlock(tech_pvt->mutex);
@@ -682,7 +667,7 @@
 		}
 	}
 
-	if (switch_test_flag(tech_pvt, TFLAG_LINKED) && tech_pvt->other_tech_pvt) { 
+	if (switch_test_flag(tech_pvt, TFLAG_LINKED) && tech_pvt->other_tech_pvt) {
 		switch_frame_t *clone;
 
 		if (frame->codec->implementation != tech_pvt->write_codec.implementation) {
@@ -702,7 +687,7 @@
 
 			switch_set_flag_locked(tech_pvt->other_tech_pvt, TFLAG_WRITE);
 		}
-		
+
 		status = SWITCH_STATUS_SUCCESS;
 	}
 
@@ -721,7 +706,7 @@
 
 	tech_pvt = switch_core_session_get_private(session);
 	switch_assert(tech_pvt != NULL);
-	
+
 	switch (msg->message_id) {
 	case SWITCH_MESSAGE_INDICATE_ANSWER:
 		if (tech_pvt->other_channel && !switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
@@ -735,7 +720,7 @@
 		break;
 	case SWITCH_MESSAGE_INDICATE_BRIDGE:
 		{
-			switch_set_flag_locked(tech_pvt, TFLAG_BRIDGE);			
+			switch_set_flag_locked(tech_pvt, TFLAG_BRIDGE);
 		}
 		break;
 	case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
@@ -768,17 +753,18 @@
 
 		}
 		break;
-    default:
-        break;
-    }
-	
+	default:
+		break;
+	}
 
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
-													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
+													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+													switch_call_cause_t *cancel_cause)
 {
 	char name[128];
 
@@ -809,7 +795,7 @@
 			switch_core_session_destroy(new_session);
 			return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
 		}
-		
+
 		if (outbound_profile) {
 			char *dialplan = NULL, *context = NULL;
 
@@ -834,7 +820,7 @@
 
 			if ((context = strchr(caller_profile->destination_number, '/'))) {
 				*context++ = '\0';
-				
+
 				if ((dialplan = strchr(context, '/'))) {
 					*dialplan++ = '\0';
 				}
@@ -847,7 +833,7 @@
 					caller_profile->dialplan = switch_core_strdup(caller_profile->pool, dialplan);
 				}
 			}
-			
+
 			if (zstr(caller_profile->context)) {
 				caller_profile->context = switch_core_strdup(caller_profile->pool, "default");
 			}
@@ -858,7 +844,6 @@
 
 			switch_snprintf(name, sizeof(name), "loopback/%s-a", caller_profile->destination_number);
 			switch_channel_set_name(channel, name);
-			switch_channel_set_flag(channel, CF_OUTBOUND);
 			switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
 			switch_channel_set_caller_profile(channel, caller_profile);
 			tech_pvt->caller_profile = caller_profile;
@@ -867,9 +852,9 @@
 			switch_core_session_destroy(new_session);
 			return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
 		}
-		
+
 		switch_channel_set_state(channel, CS_INIT);
-		
+
 		return SWITCH_CAUSE_SUCCESS;
 	}
 
@@ -886,10 +871,9 @@
 	/*.on_consume_media */ channel_on_consume_media,
 	/*.on_hibernate */ channel_on_hibernate,
 	/*.on_reset */ channel_on_reset,
-	/*.on_park*/ NULL,
-    /*.on_reporting*/ NULL,
-    /*.on_destroy*/ channel_on_destroy
-
+	/*.on_park */ NULL,
+	/*.on_reporting */ NULL,
+	/*.on_destroy */ channel_on_destroy
 };
 
 static switch_io_routines_t channel_io_routines = {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_opal/mod_opal.cpp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_opal/mod_opal.cpp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_opal/mod_opal.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,1487 +1,1487 @@
-/* Opal endpoint interface for Freeswitch Modular Media Switching Software Library /
- * Soft-Switch Application
- *
- * Version: MPL 1.1
- *
- * Copyright (c) 2007 Tuyan Ozipek (tuyanozipek@gmail.com)
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * Contributor(s):
- * Tuyan Ozipek   (tuyanozipek@gmail.com)
- * Lukasz Zwierko (lzwierko@gmail.com)
- * Robert Jongbloed (robertj@voxlucida.com.au)
- *
- */
-
-#include "mod_opal.h"
-#include <opal/patch.h>
-#include <rtp/rtp.h>
-#include <h323/h323pdu.h>
-#include <h323/gkclient.h>
-
-SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, mod_opal_globals.codec_string);
-SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_context, mod_opal_globals.context);
-SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, mod_opal_globals.dialplan);
-
-
-#define CF_NEED_FLUSH (1 << 1)
-
-struct mod_opal_globals mod_opal_globals = { 0 };
-
-
-static switch_call_cause_t create_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
-                                                   switch_caller_profile_t *outbound_profile, switch_core_session_t **new_session,
-                                                   switch_memory_pool_t **pool, switch_originate_flag_t flags);
-
-
-static FSProcess *opal_process = NULL;
-
-
-static const char ModuleName[] = "opal";
-
-
-static switch_status_t on_hangup(switch_core_session_t *session);
-static switch_status_t on_destroy(switch_core_session_t *session);
-
-
-static switch_io_routines_t opalfs_io_routines = {
-    /*.outgoing_channel */ create_outgoing_channel,
-    /*.read_frame */ FSConnection::read_audio_frame,
-    /*.write_frame */ FSConnection::write_audio_frame,
-    /*.kill_channel */ FSConnection::kill_channel,
-    /*.send_dtmf */ FSConnection::send_dtmf,
-    /*.receive_message */ FSConnection::receive_message,
-    /*.receive_event */ FSConnection::receive_event,
-    /*.state_change */ FSConnection::state_change,
-    /*.read_video_frame */ FSConnection::read_video_frame,
-    /*.write_video_frame */ FSConnection::write_video_frame
-};
-
-static switch_state_handler_table_t opalfs_event_handlers = {
-    /*.on_init */ FSConnection::on_init,
-    /*.on_routing */ FSConnection::on_routing,
-    /*.on_execute */ FSConnection::on_execute,
-    /*.on_hangup */ on_hangup,
-    /*.on_exchange_media */ FSConnection::on_exchange_media,
-    /*.on_soft_execute */ FSConnection::on_soft_execute,
-    /*.on_consume_media*/ NULL,
-    /*.on_hibernate*/ NULL,
-    /*.on_reset*/ NULL,
-    /*.on_park*/ NULL,
-    /*.on_reporting*/ NULL,
-    /*.on_destroy*/ on_destroy
-};
-
-
-SWITCH_BEGIN_EXTERN_C
-/*******************************************************************************/
-
-SWITCH_MODULE_LOAD_FUNCTION(mod_opal_load);
-SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_opal_shutdown);
-SWITCH_MODULE_DEFINITION(mod_opal, mod_opal_load, mod_opal_shutdown, NULL);
-
-SWITCH_MODULE_LOAD_FUNCTION(mod_opal_load) {
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Starting loading mod_opal\n");
-
-    /* Prevent the loading of OPAL codecs via "plug ins", this is a directory
-       full of DLLs that will be loaded automatically. */
-    putenv((char *)"PTLIBPLUGINDIR=/no/thanks");
-
-
-    *module_interface = switch_loadable_module_create_module_interface(pool, modname);
-    if (!*module_interface) {
-        return SWITCH_STATUS_MEMERR;
-    }
-
-    opal_process = new FSProcess();
-    if (opal_process == NULL) {
-        return SWITCH_STATUS_MEMERR;
-    }
-
-    if (opal_process->Initialise(*module_interface)) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Opal manager initialized and running\n");
-        //unloading causes a seg in linux
-        return SWITCH_STATUS_NOUNLOAD;
-        //return SWITCH_STATUS_SUCCESS;
-    }
-
-    delete opal_process;
-    opal_process = NULL;
-    return SWITCH_STATUS_FALSE;
-}
-
-
-SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_opal_shutdown) {
-    
-    switch_safe_free(mod_opal_globals.context);
-    switch_safe_free(mod_opal_globals.dialplan);
-    switch_safe_free(mod_opal_globals.codec_string);
-    delete opal_process;
-    opal_process = NULL;
-    return SWITCH_STATUS_SUCCESS;
-}
-
-SWITCH_END_EXTERN_C
-/*******************************************************************************/
-
-
-
-static switch_call_cause_t create_outgoing_channel(switch_core_session_t *session,
-                                                   switch_event_t *var_event,
-                                                   switch_caller_profile_t *outbound_profile,
-                                                   switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
-{
-    if (opal_process == NULL) {
-        return SWITCH_CAUSE_CRASH;
-    }
-
-    PString token;
-
-    FSManager & manager = opal_process->GetManager();
-    if (!manager.SetUpCall("local:", outbound_profile->destination_number, token, outbound_profile)) {
-        return SWITCH_CAUSE_INVALID_NUMBER_FORMAT;
-    }
-
-    PSafePtr < OpalCall > call = manager.FindCallWithLock(token);
-
-    if (call == NULL) {
-        return SWITCH_CAUSE_PROTOCOL_ERROR;
-    }
-
-    PSafePtr < FSConnection > connection = call->GetConnectionAs < FSConnection > (0);
-
-    if (connection == NULL) {
-        return SWITCH_CAUSE_PROTOCOL_ERROR;
-    }
-
-    *new_session = connection->GetSession();
-
-    return SWITCH_CAUSE_SUCCESS;
-}
-
-
-///////////////////////////////////////////////////////////////////////
-
-#if PTRACING
-
-class FSTrace : public ostream {
- public:
- FSTrace()
-     : ostream(&buffer)
-        {
-        }
-
- private:
- class Buffer : public streambuf {
-        char buffer[250];
-
-    public:
-        Buffer()
-            {
-                setg(buffer, buffer, &buffer[sizeof(buffer)-2]);
-                setp(buffer, &buffer[sizeof(buffer)-2]);
-            }
-
-        virtual int sync()
-        {
-            return overflow(EOF);
-        }
-
-        virtual int underflow()
-        {
-            return EOF;
-        }
-
-        virtual int overflow(int c)
-        {
-            const char *fmt = "%s";
-            char *func = NULL;
-
-            int bufSize = pptr() - pbase();
-
-            if (c != EOF) {
-                *pptr() = (char)c;
-                bufSize++;
-            }
-            
-            if (bufSize != 0) {
-                char *bufPtr = pbase();
-                char *bufEndPtr = NULL;
-                setp(bufPtr, epptr());
-                bufPtr[bufSize] = '\0';
-                int line = 0;
-                char *p;
-                
-                char *file = NULL;
-                switch_log_level_t level;
-
-                
-                switch (strtoul(bufPtr, &file, 10)) {
-                case 1 :
-                    level = SWITCH_LOG_INFO;
-                    break;
-                default :
-                    level = SWITCH_LOG_DEBUG;
-                    break;
-                }
-
-                if (file) {
-                    while (isspace(*file)) file++;
-                    
-                    if (file && (bufPtr = strchr(file, '(')) && (bufEndPtr = strchr(bufPtr, ')'))) {
-                        char *e;
-
-                        for(p = bufPtr; p && *p; p++) {
-                            if (*p == '\t') {
-                                *p = ' ';
-                            }
-                        }
-
-                        *bufPtr++ = '\0';
-                        line = atoi(bufPtr);
-                        while (bufEndPtr && isspace(*(++bufEndPtr)));
-                        bufPtr = bufEndPtr;
-                        if (bufPtr && (e = strchr(bufPtr, ' ')) || (e = strchr(bufPtr, '\t'))) {
-                            func = bufPtr;
-                            bufPtr = e;
-                            *bufPtr++ = '\0';
-                        }
-                    }
-                }
-                
-                switch_text_channel_t tchannel = SWITCH_CHANNEL_ID_LOG;
-
-                if (!bufPtr) {
-                    bufPtr = pbase();
-                    level = SWITCH_LOG_DEBUG;
-                }
-
-                if (bufPtr) {
-                    if (end_of(bufPtr) != '\n') {
-                        fmt = "%s\n";
-                    }
-                    if (!(file && func && line)) tchannel = SWITCH_CHANNEL_ID_LOG_CLEAN;
-
-                    switch_log_printf(tchannel, file, func, line, NULL, level, fmt, bufPtr);
-                }
-                
-            }
-
-            return 0;
-        }
-    } buffer;
-};
-
-#endif
-
-
-///////////////////////////////////////////////////////////////////////
-
-FSProcess::FSProcess()
-  : PLibraryProcess("Vox Lucida Pty. Ltd.", "mod_opal", 1, 0, AlphaCode, 1)
-  , m_manager(NULL)
-{
-}
-
-
-FSProcess::~FSProcess()
-{
-  delete m_manager;
-}
-
-
-bool FSProcess::Initialise(switch_loadable_module_interface_t *iface)
-{
-  m_manager = new FSManager();
-  return m_manager != NULL && m_manager->Initialise(iface);
-}
-
-
-///////////////////////////////////////////////////////////////////////
-
-FSManager::FSManager()
-{
-    // These are deleted by the OpalManager class, no need to have destructor
-    m_h323ep = new H323EndPoint(*this);
-    m_iaxep = new IAX2EndPoint(*this);
-    m_fsep = new FSEndPoint(*this);
-}
-
-
-bool FSManager::Initialise(switch_loadable_module_interface_t *iface)
-{
-    ReadConfig(false);
-
-#if PTRACING
-    PTrace::SetLevel(mod_opal_globals.trace_level);        //just for fun and eyecandy ;)
-    PTrace::SetOptions(PTrace::TraceLevel);
-    PTrace::SetStream(new FSTrace);
-#endif
-
-    m_FreeSwitch = (switch_endpoint_interface_t *) switch_loadable_module_create_interface(iface, SWITCH_ENDPOINT_INTERFACE);
-    m_FreeSwitch->interface_name = ModuleName;
-    m_FreeSwitch->io_routines = &opalfs_io_routines;
-    m_FreeSwitch->state_handler = &opalfs_event_handlers;
-
-    silenceDetectParams.m_mode = OpalSilenceDetector::NoSilenceDetection;
-
-    if (m_listeners.empty()) {
-        m_h323ep->StartListener("");
-    } else {
-        for (std::list < FSListener >::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it) {
-            if (!m_h323ep->StartListener(it->listenAddress)) {
-                PTRACE(3, "mod_opal\tCannot start listener for " << it->name);
-            }
-        }
-    }
-
-    AddRouteEntry("h323:.* = local:<da>");  // config option for direct routing
-    AddRouteEntry("iax2:.* = local:<da>");  // config option for direct routing
-    AddRouteEntry("local:.* = h323:<da>");  // config option for direct routing
-
-    // Make sure all known codecs are instantiated,
-    // these are ones we know how to translate into H.323 capabilities
-    GetOpalG728();
-    GetOpalG729();
-    GetOpalG729A();
-    GetOpalG729B();
-    GetOpalG729AB();
-    GetOpalG7231_6k3();
-    GetOpalG7231_5k3();
-    GetOpalG7231A_6k3();
-    GetOpalG7231A_5k3();
-    GetOpalGSM0610();
-    GetOpalGSMAMR();
-    GetOpaliLBC();
-
-    /* For compatibility with the algorithm in FSConnection::SetCodecs() we need
-       to set all audio media formats to be 1 frame per packet */
-    OpalMediaFormatList allCodecs = OpalMediaFormat::GetAllRegisteredMediaFormats();
-    for (OpalMediaFormatList::iterator it = allCodecs.begin(); it != allCodecs.end(); ++it) {
-      if (it->GetMediaType() == OpalMediaType::Audio()) {
-        it->SetOptionInteger(OpalAudioFormat::RxFramesPerPacketOption(), 1);
-        it->SetOptionInteger(OpalAudioFormat::TxFramesPerPacketOption(), 1);
-      }
-    }
-
-    if (!m_gkAddress.IsEmpty()) {
-      if (m_h323ep->UseGatekeeper(m_gkAddress, m_gkIdentifer, m_gkInterface))
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Started gatekeeper: %s\n",
-                          (const char *)m_h323ep->GetGatekeeper()->GetName());
-      else
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-                          "Could not start gatekeeper: addr=\"%s\", id=\"%s\", if=\"%s\"\n",
-                          (const char *)m_gkAddress,
-                          (const char *)m_gkIdentifer,
-                          (const char *)m_gkInterface);
-    }
-
-    return TRUE;
-}
-
-
-switch_status_t FSManager::ReadConfig(int reload)
-{
-    const char *cf = "opal.conf";
-    switch_status_t status = SWITCH_STATUS_SUCCESS;
-
-    switch_memory_pool_t *pool = NULL;
-    if ((status = switch_core_new_memory_pool(&pool)) != SWITCH_STATUS_SUCCESS) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
-        return status;
-    }
-
-    set_global_context("default");
-    set_global_dialplan("XML");
-
-    switch_event_t *params = NULL;
-    switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS);
-    switch_assert(params);
-    switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "profile", switch_str_nil(""));
-    switch_xml_t cfg;
-    switch_xml_t xml = switch_xml_open_cfg(cf, &cfg, params);
-    if (xml == NULL) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
-        return SWITCH_STATUS_FALSE;
-    }
-
-    switch_xml_t xmlSettings = switch_xml_child(cfg, "settings");
-    if (xmlSettings) {
-        for (switch_xml_t xmlParam = switch_xml_child(xmlSettings, "param"); xmlParam != NULL; xmlParam = xmlParam->next) {
-            const char *var = switch_xml_attr_soft(xmlParam, "name");
-            const char *val = switch_xml_attr_soft(xmlParam, "value");
-
-            if (!strcasecmp(var, "trace-level")) {
-                int level = atoi(val);
-                if (level > 0) {
-                    mod_opal_globals.trace_level = level;
-                }
-            } else if (!strcasecmp(var, "context")) {
-                set_global_context(val);
-            } else if (!strcasecmp(var, "dialplan")) {
-                set_global_dialplan(val);
-            } else if (!strcasecmp(var, "codec-prefs")) {
-                set_global_codec_string(val);
-            } else if (!strcasecmp(var, "jitter-size")) {
-                char * next;
-                unsigned minJitter = strtoul(val, &next, 10);
-                if (minJitter >= 10) {
-                    unsigned maxJitter = minJitter;
-                    if (*next == ',')
-                      maxJitter = atoi(next+1);
-                    SetAudioJitterDelay(minJitter, maxJitter); // In milliseconds
-                }
-            } else if (!strcasecmp(var, "gk-address")) {
-                m_gkAddress = val;
-            } else if (!strcasecmp(var, "gk-identifer")) {
-                m_gkIdentifer = val;
-            } else if (!strcasecmp(var, "gk-interface")) {
-                m_gkInterface = val;
-            }
-        }
-    }
-
-    switch_xml_t xmlListeners = switch_xml_child(cfg, "listeners");
-    if (xmlListeners != NULL) {
-        for (switch_xml_t xmlListener = switch_xml_child(xmlListeners, "listener"); xmlListener != NULL; xmlListener = xmlListener->next) {
-
-            m_listeners.push_back(FSListener());
-            FSListener & listener = m_listeners.back();
-
-            listener.name = switch_xml_attr_soft(xmlListener, "name");
-            if (listener.name.IsEmpty())
-                listener.name = "unnamed";
-
-            PIPSocket::Address ip;
-            WORD port = 1720;
-
-            for (switch_xml_t xmlParam = switch_xml_child(xmlListener, "param"); xmlParam != NULL; xmlParam = xmlParam->next) {
-                const char *var = switch_xml_attr_soft(xmlParam, "name");
-                const char *val = switch_xml_attr_soft(xmlParam, "value");
-                //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Var - '%s' and Val - '%s' \n", var, val);
-                if (!strcasecmp(var, "h323-ip"))
-                    ip = val;
-                else if (!strcasecmp(var, "h323-port"))
-                    port = (WORD) atoi(val);
-            }
-
-            listener.listenAddress = OpalTransportAddress(ip, port);
-            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created Listener '%s'\n", (const char *) listener.name);
-        }
-    }
-
-    switch_event_destroy(&params);
-
-    if (xml)
-        switch_xml_free(xml);
-
-    return status;
-}
-
-
-OpalCall * FSManager::CreateCall(void * /*userData*/)
-{
-  return new FSCall(*this);
-}
-
-
-///////////////////////////////////////////////////////////////////////
-
-FSEndPoint::FSEndPoint(FSManager & manager)
-:   OpalLocalEndPoint(manager)
-{
-    PTRACE(3, "mod_opal\t FSEndPoint Created!");
-}
-
-
-bool FSEndPoint::OnIncomingCall(OpalLocalConnection & connection)
-{
-    return ((FSConnection &) connection).OnIncoming();
-}
-
-
-OpalLocalConnection *FSEndPoint::CreateConnection(OpalCall & call, void *userData, unsigned options, OpalConnection::StringOptions* stringOptions)
-{
-    FSManager & mgr = (FSManager &) GetManager();
-    switch_core_session_t *fsSession = switch_core_session_request(mgr.GetSwitchInterface(), 
-                                       (switch_caller_profile_t *)userData ? SWITCH_CALL_DIRECTION_OUTBOUND : SWITCH_CALL_DIRECTION_INBOUND, NULL);
-    if (fsSession == NULL)
-        return NULL;
-
-    switch_channel_t *fsChannel = switch_core_session_get_channel(fsSession);
-
-    if (fsChannel == NULL) {
-        switch_core_session_destroy(&fsSession);
-        return NULL;
-    }
-
-    return new FSConnection(call, *this, userData, options, stringOptions, (switch_caller_profile_t *)userData, fsSession, fsChannel);
-}
-
-
-///////////////////////////////////////////////////////////////////////
-
-FSCall::FSCall(OpalManager & manager)
-  : OpalCall(manager)
-{
-}
-
-
-PBoolean FSCall::OnSetUp(OpalConnection & connection)
-{
-  // Transfer FS caller_id_number & caller_id_name from the FSConnection
-  // to the protocol connectionm (e.g. H.323) so gets sent correctly
-  // in outgoing packets
-  PSafePtr<FSConnection> local = GetConnectionAs<FSConnection>();
-  if (local != NULL) {
-    PSafePtr<OpalConnection> proto = local->GetOtherPartyConnection();
-    if (proto != NULL) {
-      proto->SetLocalPartyName(local->GetLocalPartyName());
-      proto->SetDisplayName(local->GetDisplayName());
-    }
-  }
-
-  return OpalCall::OnSetUp(connection);
-}
-
-
-///////////////////////////////////////////////////////////////////////
-
-
-FSConnection::FSConnection(OpalCall & call, FSEndPoint & endpoint, void* userData, unsigned options, OpalConnection::StringOptions* stringOptions, switch_caller_profile_t *outbound_profile, switch_core_session_t *fsSession, switch_channel_t *fsChannel)
-  : OpalLocalConnection(call, endpoint, userData, options, stringOptions)
-  , m_endpoint(endpoint)
-  , m_fsSession(fsSession)
-  , m_fsChannel(fsChannel)
-{
-    opal_private_t *tech_pvt;
-
-    tech_pvt = (opal_private_t *) switch_core_session_alloc(m_fsSession, sizeof(*tech_pvt));
-    tech_pvt->me = this;
-    switch_core_session_set_private(m_fsSession, tech_pvt);
-
-    if (outbound_profile != NULL) {
-        SetLocalPartyName(outbound_profile->caller_id_number);
-        SetDisplayName(outbound_profile->caller_id_name);
-
-        switch_caller_profile_t *caller_profile = switch_caller_profile_clone(m_fsSession, outbound_profile);
-        switch_channel_set_caller_profile(m_fsChannel, caller_profile);
-
-        PString name = "opal/";
-        name += outbound_profile->destination_number;
-        switch_channel_set_name(m_fsChannel, name);
-
-        switch_channel_set_flag(m_fsChannel, CF_OUTBOUND);
-        switch_channel_set_state(m_fsChannel, CS_INIT);
-    }
-}
-
-
-bool FSConnection::OnIncoming()
-{
-    if (m_fsSession == NULL) {
-        PTRACE(1, "mod_opal\tSession request failed.");
-        return false;
-    }
-
-    switch_core_session_add_stream(m_fsSession, NULL);
-
-    switch_channel_t *channel = switch_core_session_get_channel(m_fsSession);
-    if (channel == NULL) {
-        PTRACE(1, "mod_opal\tSession does not have a channel");
-        return false;
-    }
-
-    PURL url = GetRemotePartyURL();
-    switch_caller_profile_t *caller_profile = switch_caller_profile_new(switch_core_session_get_pool(m_fsSession),
-                                                                        url.GetUserName(),
-                                                                        /** username */
-                                                                        mod_opal_globals.dialplan,
-                                                                        /** dial plan */
-                                                                        GetRemotePartyName(),
-                                                                        /** caller_id_name */
-                                                                        GetRemotePartyNumber(),
-                                                                        /** caller_id_number */
-                                                                        url.GetHostName(),
-                                                                        /** network addr */
-                                                                        NULL,
-                                                                        /** ANI */
-                                                                        NULL,
-                                                                        /** ANI II */
-                                                                        NULL,
-                                                                        /** RDNIS */
-                                                                        ModuleName,
-                                                                        /** source */
-                                                                        mod_opal_globals.context,
-                                                                        /** set context  */
-                                                                        GetCalledPartyNumber()
-                                                                        /** destination_number */
-                                                                        );
-    if (caller_profile == NULL) {
-        PTRACE(1, "mod_opal\tCould not create caller profile");
-        return false;
-    }
-
-    PTRACE(4, "mod_opal\tCreated switch caller profile:\n"
-           "  username       = " << caller_profile->username << "\n"
-           "  dialplan       = " << caller_profile->dialplan << "\n"
-           "  caller_id_name     = " << caller_profile->caller_id_name << "\n"
-           "  caller_id_number   = " << caller_profile->caller_id_number << "\n"
-           "  network_addr   = " << caller_profile->network_addr << "\n"
-           "  source         = " << caller_profile->source << "\n"
-           "  context        = " << caller_profile->context << "\n" "  destination_number= " << caller_profile->destination_number);
-    switch_channel_set_caller_profile(channel, caller_profile);
-
-    char name[256] = "opal/in:";
-    switch_copy_string(name + 8, caller_profile->destination_number, sizeof(name)-8);
-    switch_channel_set_name(channel, name);
-    switch_channel_set_state(channel, CS_INIT);
-
-    if (switch_core_session_thread_launch(m_fsSession) != SWITCH_STATUS_SUCCESS) {
-        PTRACE(1, "mod_opal\tCould not launch session thread");
-        return false;
-    }
-
-    return true;
-}
-
-
-void FSConnection::OnReleased()
-{
-    opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(m_fsSession);
-    
-    /* so FS on_hangup will not try to deref a landmine */
-    tech_pvt->me = NULL;
-    
-    m_rxAudioOpened.Signal();   // Just in case
-    m_txAudioOpened.Signal();
-    H225_ReleaseCompleteReason dummy;
-    switch_channel_hangup(switch_core_session_get_channel(m_fsSession),
-                          (switch_call_cause_t)H323TranslateFromCallEndReason(GetCallEndReason(), dummy));    
-    OpalLocalConnection::OnReleased();
-}
-
-
-void FSConnection::OnAlerting()
-{
-    switch_channel_mark_ring_ready(m_fsChannel);
-    return OpalLocalConnection::OnAlerting();
-}
-
-PBoolean FSConnection::SetAlerting(const PString & calleeName, PBoolean withMedia)
-{
-    return OpalLocalConnection::SetAlerting(calleeName, withMedia);
-}
-
-
-void FSConnection::OnEstablished()
-{
-    OpalLocalConnection::OnEstablished();
-}
-
-
-PBoolean FSConnection::SendUserInputTone(char tone, unsigned duration)
-{
-    switch_dtmf_t dtmf = { tone, duration };
-    return switch_channel_queue_dtmf(m_fsChannel, &dtmf) == SWITCH_STATUS_SUCCESS;
-}
-
-
-PBoolean FSConnection::SendUserInputString(const PString & value)
-{
-  return OpalConnection::SendUserInputString(value);
-}
-
-
-OpalMediaFormatList FSConnection::GetMediaFormats() const
-{
-    if (m_switchMediaFormats.IsEmpty()) {
-        const_cast<FSConnection *>(this)->SetCodecs();
-    }
-    
-    return m_switchMediaFormats;
-}
-
-
-void FSConnection::SetCodecs()
-{
-    int numCodecs = 0;
-    const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];    
-    const char *codec_string = NULL, *abs, *ocodec;
-    char *tmp_codec_string = NULL;
-    char *codec_order[SWITCH_MAX_CODECS];
-    int codec_order_last;
-
-
-    if ((abs = switch_channel_get_variable(m_fsChannel, "absolute_codec_string"))) {
-        codec_string = abs;
-    } else {
-        if ((abs = switch_channel_get_variable(m_fsChannel, "codec_string"))) {
-            codec_string = abs;
-        }
-
-        if ((ocodec = switch_channel_get_variable(m_fsChannel, SWITCH_ORIGINATOR_CODEC_VARIABLE))) {
-            codec_string = switch_core_session_sprintf(m_fsSession, "%s,%s", ocodec, codec_string);
-        }
-    }
-    
-    if (!codec_string) {
-        codec_string = mod_opal_globals.codec_string;
-    }
-
-    if (codec_string) {
-        if ((tmp_codec_string = strdup(codec_string))) {
-            codec_order_last = switch_separate_string(tmp_codec_string, ',', codec_order, SWITCH_MAX_CODECS);
-            numCodecs = switch_loadable_module_get_codecs_sorted(codecs, SWITCH_MAX_CODECS, codec_order, codec_order_last);
-            
-        }
-    } else {
-        numCodecs = switch_loadable_module_get_codecs(codecs, sizeof(codecs) / sizeof(codecs[0]));
-    }
-    
-    for (int i = 0; i < numCodecs; i++) {
-        const switch_codec_implementation_t *codec = codecs[i];
-
-        // See if we have a match by PayloadType/rate/name
-        OpalMediaFormat switchFormat((RTP_DataFrame::PayloadTypes)codec->ianacode,
-                                     codec->samples_per_second,
-                                     codec->iananame);
-        if (!switchFormat.IsValid()) {
-            // See if we have a match by name alone
-            switchFormat = codec->iananame;
-            if (!switchFormat.IsValid()) {
-              PTRACE(2, "mod_opal\tCould not match FS codec " << codec->iananame << " to OPAL media format.");
-              continue;
-            }
-        }
-        
-
-        // Did we match or create a new media format?
-        if (switchFormat.IsValid() && codec->codec_type == SWITCH_CODEC_TYPE_AUDIO) {
-            PTRACE(2, "mod_opal\tMatched FS codec " << codec->iananame << " to OPAL media format " << switchFormat);
-
-            // Calculate frames per packet, do not use codec->codec_frames_per_packet as that field
-            // has slightly different semantics when used in streamed codecs such as G.711
-            int fpp = codec->samples_per_packet/switchFormat.GetFrameTime();
-
-            /* Set the frames/packet to maximum of what is in the FS table. The OPAL negotiations will
-               drop the value from there. This might fail if there are "holes" in the FS table, e.g.
-               if for some reason G.723.1 has 30ms and 90ms but not 60ms, then the OPAL negotiations
-               could end up with 60ms and the codec cannot be created. The "holes" are unlikely in
-               all but streamed codecs such as G.711, where it is theoretically possible for OPAL to
-               come up with 32ms and there is only 30ms and 40ms in the FS table. We deem these
-               scenarios succifiently rare that we can safely ignore them ... for now. */
-
-            if (fpp > switchFormat.GetOptionInteger(OpalAudioFormat::RxFramesPerPacketOption())) {
-                switchFormat.SetOptionInteger(OpalAudioFormat::RxFramesPerPacketOption(), fpp);
-            }
-
-            if (fpp > switchFormat.GetOptionInteger(OpalAudioFormat::TxFramesPerPacketOption())) {
-                switchFormat.SetOptionInteger(OpalAudioFormat::TxFramesPerPacketOption(), fpp);
-            }
-        }
-
-        m_switchMediaFormats += switchFormat;
-    }
-    
-    switch_safe_free(tmp_codec_string);
-}
-
-
-OpalMediaStream *FSConnection::CreateMediaStream(const OpalMediaFormat & mediaFormat, unsigned sessionID, PBoolean isSource)
-{
-    return new FSMediaStream(*this, mediaFormat, sessionID, isSource);
-}
-
-
-PBoolean FSConnection::OnOpenMediaStream(OpalMediaStream & stream)
-{
-    if (!OpalConnection::OnOpenMediaStream(stream)) {
-        return false;
-    }
-
-    if (stream.GetMediaFormat().GetMediaType() != OpalMediaType::Audio()) {
-        return true;
-    }
-
-    if (stream.IsSource()) {
-        m_rxAudioOpened.Signal();
-    } else {
-        m_txAudioOpened.Signal();
-    }
-
-    if (GetMediaStream(stream.GetSessionID(), stream.IsSink()) != NULL) {
-        // Have open media in both directions.
-        if (GetPhase() == AlertingPhase) {
-            switch_channel_mark_pre_answered(m_fsChannel);
-        } else if (GetPhase() < ReleasingPhase) {
-            switch_channel_mark_answered(m_fsChannel);
-        }
-    }
-
-    return true;
-}
-
-
-switch_status_t FSConnection::on_init()
-{
-    switch_channel_t *channel = switch_core_session_get_channel(m_fsSession);
-    if (channel == NULL) {
-        return SWITCH_STATUS_FALSE;
-    }
-
-    PTRACE(3, "mod_opal\tStarted routing for connection " << *this);
-    switch_channel_set_state(channel, CS_ROUTING);
-    return SWITCH_STATUS_SUCCESS;
-}
-
-
-switch_status_t FSConnection::on_routing()
-{
-    PTRACE(3, "mod_opal\tRouting connection " << *this);
-    return SWITCH_STATUS_SUCCESS;
-}
-
-
-switch_status_t FSConnection::on_execute()
-{
-    PTRACE(3, "mod_opal\tExecuting connection " << *this);
-    return SWITCH_STATUS_SUCCESS;
-}
-
-static switch_status_t on_destroy(switch_core_session_t *session)
-{
-    //switch_channel_t *channel = switch_core_session_get_channel(session);
-    opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(session);
-    
-    if (tech_pvt) {
-    if (tech_pvt->read_codec.implementation) {
-        switch_core_codec_destroy(&tech_pvt->read_codec);
-    }
-
-    if (tech_pvt->write_codec.implementation) {
-        switch_core_codec_destroy(&tech_pvt->write_codec);
-    }
-
-    if (tech_pvt->vid_read_codec.implementation) {
-        switch_core_codec_destroy(&tech_pvt->vid_read_codec);
-    }
-
-    if (tech_pvt->vid_write_codec.implementation) {
-        switch_core_codec_destroy(&tech_pvt->vid_write_codec);
-    }
-
-    if (tech_pvt->read_timer.timer_interface) {
-        switch_core_timer_destroy(&tech_pvt->read_timer);
-    }
-
-    if (tech_pvt->vid_read_timer.timer_interface) {
-        switch_core_timer_destroy(&tech_pvt->vid_read_timer);
-    }
-    }
-
-    return SWITCH_STATUS_SUCCESS;
-}
-
-/* this function has to be called with the original session beause the FSConnection might already be destroyed and we 
-   will can't have it be a method of a dead object
- */
-static switch_status_t on_hangup(switch_core_session_t *session)
-{
-    switch_channel_t *channel = switch_core_session_get_channel(session);
-    opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(session);
-    
-    /* if this is still here it was our idea to hangup not opal's */
-    if (tech_pvt->me) {
-        Q931::CauseValues cause = (Q931::CauseValues)switch_channel_get_cause_q850(channel);
-        tech_pvt->me->SetQ931Cause(cause);
-        tech_pvt->me->ClearCallSynchronous(NULL, H323TranslateToCallEndReason(cause, UINT_MAX));
-        tech_pvt->me = NULL;
-    }
-
-    return SWITCH_STATUS_SUCCESS;
-}
-
-
-switch_status_t FSConnection::on_exchange_media()
-{
-    PTRACE(3, "mod_opal\tLoopback on connection " << *this);
-    return SWITCH_STATUS_SUCCESS;
-}
-
-
-switch_status_t FSConnection::on_soft_execute()
-{
-    PTRACE(3, "mod_opal\tTransmit on connection " << *this);
-    return SWITCH_STATUS_SUCCESS;
-}
-
-
-switch_status_t FSConnection::kill_channel(int sig)
-{
-    PTRACE(3, "mod_opal\tKill " << sig << " on connection " << *this);
-
-    switch (sig) {
-    case SWITCH_SIG_BREAK:
-        break;
-    case SWITCH_SIG_KILL:
-        m_rxAudioOpened.Signal();
-        m_txAudioOpened.Signal();
-        break;
-    default:
-        break;
-    }
-
-    return SWITCH_STATUS_SUCCESS;
-}
-
-
-switch_status_t FSConnection::send_dtmf(const switch_dtmf_t *dtmf)
-{
-    OnUserInputTone(dtmf->digit, dtmf->duration);
-    return SWITCH_STATUS_SUCCESS;
-}
-
-
-switch_status_t FSConnection::receive_message(switch_core_session_message_t *msg)
-{
-    switch_channel_t *channel = switch_core_session_get_channel(m_fsSession);
-
-
-    /*
-      SWITCH_MESSAGE_INDICATE_PROGRESS:  establish early media now and return SWITCH_STATUS_FALSE if you can't
-      SWITCH_MESSAGE_INDICATE_ANSWER:  answer and set up media now if it's not already and return SWITCH_STATUS_FALSE if you can't
-
-      Neither message means anything on an outbound call....
-
-      It would only happen if someone called switch_channel_answer() instead of switch_channel_mark_answered() on an outbound call.
-      it should not do anything if someone does it by accident somewhere hense this in both cases:
-
-      if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
-      return SWITCH_STATUS_FALSE;
-      }
-
-
-      When we get these messages the core will trust that you have triggered FSMediaStream::Open and are ready for media if we do not
-      have media we MUST return SWITCH_STATUS_FALSE or it will cause a CRASH.
-
-
-
-    */
-    switch (msg->message_id) {
-    case SWITCH_MESSAGE_INDICATE_BRIDGE:
-    case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
-    case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC:
-        switch_channel_set_private_flag(channel, CF_NEED_FLUSH);
-        break;
-
-    case SWITCH_MESSAGE_INDICATE_RINGING:
-    case SWITCH_MESSAGE_INDICATE_PROGRESS:
-    case SWITCH_MESSAGE_INDICATE_ANSWER:
-        {
-            switch_caller_profile_t * profile = switch_channel_get_caller_profile(channel);
-            if (profile != NULL && profile->caller_extension != NULL)
-            {
-                PSafePtr<OpalConnection> other = GetOtherPartyConnection();
-                if (other != NULL) {
-                    other->SetLocalPartyName(profile->caller_extension->extension_number);
-                    other->SetDisplayName(profile->caller_extension->extension_name);
-                }
-                SetLocalPartyName(profile->caller_extension->extension_number);
-                SetDisplayName(profile->caller_extension->extension_name);
-            }
-        }
-        break;
-
-    default:
-        break;
-    }
-
-    switch (msg->message_id) {
-    case SWITCH_MESSAGE_INDICATE_RINGING:
-        SetPhase(OpalConnection::AlertingPhase);
-        OnAlerting();
-        break;
-
-    case SWITCH_MESSAGE_INDICATE_DEFLECT:
-    {
-        PSafePtr<OpalConnection> other = GetOtherPartyConnection();
-        if (other != NULL)
-          other->TransferConnection(msg->string_arg);
-        break;
-    }
-
-    case SWITCH_MESSAGE_INDICATE_PROGRESS:
-    case SWITCH_MESSAGE_INDICATE_ANSWER:
-        {
-            int fixed = 0;
-            
-            if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
-                return SWITCH_STATUS_FALSE;
-            }
-
-            if (msg->message_id == SWITCH_MESSAGE_INDICATE_PROGRESS) {
-                if (fixed) {
-                    /* this should send alerting + media and wait for it to be established and return SUCCESS or FAIL
-                       depending on if media was able to be established.  Need code to tell the other side we want early media here.
-                    */
-                    GetCall().OpenSourceMediaStreams(*this, OpalMediaType::Audio());
-                    SetPhase(OpalConnection::AlertingPhase);
-                    /* how do i say please establish early media ? */
-                    OnAlerting();
-                } else {
-                    /* hack to avoid getting stuck, pre_answer will imply answer */
-                    OnConnectedInternal();
-                }
-            } else {
-                OnConnectedInternal();
-            }
-
-            // Wait for media
-            PTRACE(2, "mod_opal\tAwaiting media start on connection " << *this);
-            m_rxAudioOpened.Wait();
-            m_txAudioOpened.Wait();
-            
-            if (GetPhase() >= ReleasingPhase) {
-                // Call got aborted
-                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(m_fsSession), SWITCH_LOG_ERROR, "Call abandoned!\n");
-                return SWITCH_STATUS_FALSE;
-            }
-
-            PTRACE(4, "mod_opal\tMedia started on connection " << *this);
-
-            if (msg->message_id == SWITCH_MESSAGE_INDICATE_PROGRESS) {
-                if (!switch_channel_test_flag(m_fsChannel, CF_EARLY_MEDIA)) {
-                    switch_channel_mark_pre_answered(m_fsChannel);
-                }
-            } else {
-                if (!switch_channel_test_flag(m_fsChannel, CF_EARLY_MEDIA)) {
-                    switch_channel_mark_answered(m_fsChannel);
-                }
-            }
-
-        }
-        break;
-
-    default:
-        PTRACE(3, "mod_opal\tReceived message " << msg->message_id << " on connection " << *this);
-    }
-
-    return SWITCH_STATUS_SUCCESS;
-}
-
-
-switch_status_t FSConnection::receive_event(switch_event_t *event)
-{
-    PTRACE(3, "mod_opal\tReceived event " << event->event_id << " on connection " << *this);
-    return SWITCH_STATUS_SUCCESS;
-}
-
-
-switch_status_t FSConnection::state_change()
-{
-    PTRACE(3, "mod_opal\tState changed on connection " << *this);
-    return SWITCH_STATUS_SUCCESS;
-}
-
-
-switch_status_t FSConnection::read_audio_frame(switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
-{
-    return read_frame(OpalMediaType::Audio(), frame, flags);
-}
-
-
-switch_status_t FSConnection::write_audio_frame(switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
-{
-    return write_frame(OpalMediaType::Audio(), frame, flags);
-}
-
-
-switch_status_t FSConnection::read_video_frame(switch_frame_t **frame, switch_io_flag_t flag, int stream_id)
-{
-    return read_frame(OpalMediaType::Video(), frame, flag);
-}
-
-
-switch_status_t FSConnection::write_video_frame(switch_frame_t *frame, switch_io_flag_t flag, int stream_id)
-{
-    return write_frame(OpalMediaType::Video(), frame, flag);
-}
-
-
-switch_status_t FSConnection::read_frame(const OpalMediaType & mediaType, switch_frame_t **frame, switch_io_flag_t flags)
-{
-    PSafePtr < FSMediaStream > stream = PSafePtrCast < OpalMediaStream, FSMediaStream > (GetMediaStream(mediaType, false));
-    return stream != NULL ? stream->read_frame(frame, flags) : SWITCH_STATUS_FALSE;
-}
-
-
-switch_status_t FSConnection::write_frame(const OpalMediaType & mediaType, const switch_frame_t *frame, switch_io_flag_t flags)
-{
-    PSafePtr < FSMediaStream > stream = PSafePtrCast < OpalMediaStream, FSMediaStream > (GetMediaStream(mediaType, true));
-    return stream != NULL ? stream->write_frame(frame, flags) : SWITCH_STATUS_FALSE;
-}
-
-
-///////////////////////////////////////////////////////////////////////
-
-FSMediaStream::FSMediaStream(FSConnection & conn, const OpalMediaFormat & mediaFormat, unsigned sessionID, bool isSource)
-    : OpalMediaStream(conn, mediaFormat, sessionID, isSource)
-    , m_fsSession(conn.GetSession())
-    , m_readRTP(0, 512)
-    , m_callOnStart(true)
-{
-    memset(&m_readFrame, 0, sizeof(m_readFrame));
-    m_readFrame.codec = m_switchCodec;
-    m_readFrame.flags = SFF_RAW_RTP;
-}
-
-
-PBoolean FSMediaStream::Open()
-{
-    opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(m_fsSession);
-
-    if (IsOpen()) {
-        return true;
-    }
-
-    bool isAudio;
-    if (mediaFormat.GetMediaType() == OpalMediaType::Audio()) {
-        isAudio = true;
-    } else if (mediaFormat.GetMediaType() == OpalMediaType::Video()) {
-        isAudio = false;
-    } else {
-        return OpalMediaStream::Open();
-    }
-
-    m_fsChannel = switch_core_session_get_channel(m_fsSession);
-    
-    int ptime = mediaFormat.GetOptionInteger(OpalAudioFormat::TxFramesPerPacketOption()) * mediaFormat.GetFrameTime() / mediaFormat.GetTimeUnits();
-
-
-    if (IsSink()) {
-        m_switchCodec = isAudio ? &tech_pvt->read_codec : &tech_pvt->vid_read_codec;
-        m_switchTimer = isAudio ? &tech_pvt->read_timer : &tech_pvt->vid_read_timer;
-    } else {
-        m_switchCodec = isAudio ? &tech_pvt->write_codec : &tech_pvt->vid_write_codec;
-    }
-
-    // The following is performed on two different instances of this object.
-    if (switch_core_codec_init(m_switchCodec, mediaFormat.GetEncodingName(), NULL, // FMTP
-                               mediaFormat.GetClockRate(), ptime, 1,  // Channels
-                               SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,   // Settings
-                               switch_core_session_get_pool(m_fsSession)) != SWITCH_STATUS_SUCCESS) {
-        // Could not select a codecs using negotiated frames/packet, so try using default.
-        if (switch_core_codec_init(m_switchCodec, mediaFormat.GetEncodingName(), NULL, // FMTP
-                                   mediaFormat.GetClockRate(), 0, 1,  // Channels
-                                   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,   // Settings
-                                   switch_core_session_get_pool(m_fsSession)) != SWITCH_STATUS_SUCCESS) {
-            PTRACE(1, "mod_opal  " << switch_channel_get_name(m_fsChannel)<< " Cannot initialise " << (IsSink()? "read" : "write") << ' '
-                   << mediaFormat.GetMediaType() << " codec " << mediaFormat << " for connection " << *this);
-            switch_channel_hangup(m_fsChannel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
-            return false;
-        }
-        PTRACE(2, "mod_opal " << switch_channel_get_name(m_fsChannel)<< " Unsupported ptime of " << ptime << " on " << (IsSink()? "read" : "write") << ' '
-               << mediaFormat.GetMediaType() << " codec " << mediaFormat << " for connection " << *this);
-    }
-
-    PTRACE(1, "mod_opal " << switch_channel_get_name(m_fsChannel)<< " initialise " << 
-           switch_channel_get_name(m_fsChannel) << (IsSink()? "read" : "write") << ' '
-           << mediaFormat.GetMediaType() << " codec " << mediaFormat << " for connection " << *this);
-
-    if (IsSink()) {
-        m_readFrame.rate = mediaFormat.GetClockRate();
-
-        if (isAudio) {
-            switch_core_session_set_read_codec(m_fsSession, m_switchCodec);
-            if (switch_core_timer_init(m_switchTimer,
-                                       "soft",
-                                       m_switchCodec->implementation->microseconds_per_packet / 1000,
-                                       m_switchCodec->implementation->samples_per_packet,
-                                       switch_core_session_get_pool(m_fsSession)) != SWITCH_STATUS_SUCCESS) {
-                switch_core_codec_destroy(m_switchCodec);
-                m_switchCodec = NULL;
-                return false;
-            }
-        } else {
-            switch_core_session_set_video_read_codec(m_fsSession, m_switchCodec);
-            switch_channel_set_flag(m_fsChannel, CF_VIDEO);
-        }
-    } else {
-        if (isAudio) {
-            switch_core_session_set_write_codec(m_fsSession, m_switchCodec);
-        } else {
-            switch_core_session_set_video_write_codec(m_fsSession, m_switchCodec);
-            switch_channel_set_flag(m_fsChannel, CF_VIDEO);
-        }
-    }
-
-    PTRACE(3, "mod_opal\tSet " << (IsSink()? "read" : "write") << ' '
-           << mediaFormat.GetMediaType() << " codec to << " << mediaFormat << " for connection " << *this);
-
-    return OpalMediaStream::Open();
-}
-
-
-PBoolean FSMediaStream::Close()
-{
-    if (!IsOpen())
-        return false;
-
-    /* forget these FS will properly destroy them for us */
-
-    m_switchTimer = NULL;
-    m_switchCodec = NULL;
-
-    return OpalMediaStream::Close();
-}
-
-
-PBoolean FSMediaStream::IsSynchronous() const
-{
-    return true;
-}
-
-
-PBoolean FSMediaStream::RequiresPatchThread(OpalMediaStream *) const
-{
-    return false;
-}
-
-bool FSMediaStream::CheckPatchAndLock()
-{
-    if (GetConnection().GetPhase() >= GetConnection().ReleasingPhase || !IsOpen())
-        return false;
-
-    if (LockReadWrite()) {
-        if (!GetPatch() || !IsOpen()) {
-            UnlockReadWrite();
-            return false;
-        }
-        return true;
-    } else {
-        return false;
-    }
-}
-
-switch_status_t FSMediaStream::read_frame(switch_frame_t **frame, switch_io_flag_t flags)
-{
-
-    if (!m_switchCodec) {
-        return SWITCH_STATUS_FALSE;
-    }
-
-    if (m_callOnStart) {
-        /*
-          There is a race here... sometimes we make it here and GetPatch() is NULL
-          if we wait it shows up in 1ms, maybe there is a better way to wait.
-          
-        */
-        while(!GetPatch()) {
-            if (!m_fsChannel || !switch_channel_up(m_fsChannel)) {
-                return SWITCH_STATUS_FALSE;
-            }
-            switch_cond_next();
-        }
-        if (CheckPatchAndLock()) {
-            GetPatch()->OnStartMediaPatch();
-            m_callOnStart = false;
-            UnlockReadWrite();
-        } else {
-            return SWITCH_STATUS_FALSE; 
-        }
-    }
-
-    m_readFrame.flags = 0;
-
-    /*
-    while (switch_channel_ready(m_fsChannel)) {
-        if (CheckPatchAndLock()) {
-            if (!GetPatch()->GetSource().ReadPacket(m_readRTP)) {
-                UnlockReadWrite();
-                return SWITCH_STATUS_FALSE;
-            }            
-            UnlockReadWrite();
-        } else {
-            return SWITCH_STATUS_FALSE; 
-        }
-        
-        if ((m_readFrame.datalen = m_readRTP.GetPayloadSize()) || switch_core_timer_check(&m_switchTimer, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
-            if (m_readFrame.datalen) {
-            } else {
-                m_readFrame.flags = SFF_CNG;
-            }
-            break;
-        }
-
-        switch_yield(1000);
-    }
-    */
-
-    if (switch_channel_test_private_flag(m_fsChannel, CF_NEED_FLUSH)) {
-        switch_channel_clear_private_flag(m_fsChannel, CF_NEED_FLUSH);
-        for(;;) {
-            if (CheckPatchAndLock()) {
-                if (!GetPatch()->GetSource().ReadPacket(m_readRTP)) {
-                    UnlockReadWrite();
-                    return SWITCH_STATUS_FALSE;
-                }            
-                UnlockReadWrite();
-            } else {
-                return SWITCH_STATUS_FALSE; 
-            }
-
-            if (!m_readRTP.GetPayloadSize()) {
-                m_readFrame.flags = SFF_CNG;
-                break;
-            }
-        }
-    } else {
-
-        if (CheckPatchAndLock()) {
-            if (!m_switchTimer || !GetPatch()->GetSource().ReadPacket(m_readRTP)) {
-                UnlockReadWrite();
-                return SWITCH_STATUS_FALSE;
-            }            
-            UnlockReadWrite();
-        } else {
-            return SWITCH_STATUS_FALSE; 
-        }
-    
-        switch_core_timer_next(m_switchTimer);
-    
-        if (!(m_readFrame.datalen = m_readRTP.GetPayloadSize())) {
-            m_readFrame.flags = SFF_CNG;
-        }
-    }
-
-    if (!switch_channel_ready(m_fsChannel)) {
-        return SWITCH_STATUS_FALSE;
-    }
-
-    if (!switch_core_codec_ready(m_switchCodec)) {
-        return SWITCH_STATUS_FALSE;
-    }
-
-    //switch_core_timer_step(&m_switchTimer);
-
-    if (m_readFrame.payload == RTP_DataFrame::CN || m_readFrame.payload == RTP_DataFrame::Cisco_CN) {
-        m_readFrame.flags = SFF_CNG;
-    }
-
-    if (m_readFrame.flags & SFF_CNG) {
-        m_readFrame.buflen = sizeof(m_buf);
-        m_readFrame.data = m_buf;
-        m_readFrame.packet = NULL;
-        m_readFrame.packetlen = 0;
-        m_readFrame.timestamp = 0;
-        m_readFrame.m = SWITCH_FALSE;
-        m_readFrame.seq = 0;
-        m_readFrame.ssrc = 0;
-        m_readFrame.codec = m_switchCodec;
-    } else {
-        m_readFrame.buflen = m_readRTP.GetSize();
-        m_readFrame.data = m_readRTP.GetPayloadPtr();
-        m_readFrame.packet = m_readRTP.GetPointer();
-        m_readFrame.packetlen = m_readRTP.GetHeaderSize() + m_readFrame.datalen;
-        m_readFrame.payload = (switch_payload_t) m_readRTP.GetPayloadType();
-        m_readFrame.timestamp = m_readRTP.GetTimestamp();
-        m_readFrame.m = (switch_bool_t) m_readRTP.GetMarker();
-        m_readFrame.seq = m_readRTP.GetSequenceNumber();
-        m_readFrame.ssrc = m_readRTP.GetSyncSource();
-        m_readFrame.codec = m_switchCodec;
-    }
-
-    *frame = &m_readFrame;
-
-    return SWITCH_STATUS_SUCCESS;
-}
-
-
-switch_status_t FSMediaStream::write_frame(const switch_frame_t *frame, switch_io_flag_t flags)
-{
-    if (!switch_channel_ready(m_fsChannel)) {
-        return SWITCH_STATUS_FALSE;
-    }
-
-    if (m_callOnStart) {
-        if (CheckPatchAndLock()) {
-            GetPatch()->OnStartMediaPatch();
-            m_callOnStart = false;
-            UnlockReadWrite();
-        } else {
-            return SWITCH_STATUS_FALSE; 
-        }
-    }
-
-    if ((frame->flags & SFF_CNG)) {
-        return SWITCH_STATUS_SUCCESS;
-    }
-
-    if ((frame->flags & SFF_RAW_RTP) != 0) {
-        RTP_DataFrame rtp((const BYTE *) frame->packet, frame->packetlen, false);
-
-        if (CheckPatchAndLock()) {
-            if (GetPatch()->PushFrame(rtp)) {
-                UnlockReadWrite();
-                return SWITCH_STATUS_SUCCESS;
-            }
-            UnlockReadWrite();
-        } else {
-            return SWITCH_STATUS_FALSE; 
-        }
-    } 
-    
-    /* If we reach this code it means a call to an ivr or something else that does not generate timestamps
-       Its possible that frame->timestamp is set but not guarenteed and is best ignored for the time being.
-       We are probably relying on the rtp stack to generate the timestamp and ssrc for us at this point.
-       As a quick hack I am going to keep a sample counter and increment it by frame->samples but it would be 
-       better if we could engage whatever it is in opal that makes it generate the timestamp.
-     */
-
-    RTP_DataFrame rtp(frame->datalen);
-    rtp.SetPayloadType(mediaFormat.GetPayloadType());
-
-    m_timeStamp += frame->samples;
-    rtp.SetTimestamp(m_timeStamp);
-    
-    //rtp.SetTimestamp(frame->timestamp);
-    //rtp.SetSyncSource(frame->ssrc);
-    //rtp.SetMarker(frame->m);
-
-    memcpy(rtp.GetPayloadPtr(), frame->data, frame->datalen);
-
-    if (CheckPatchAndLock()) {
-        if (GetPatch()->PushFrame(rtp)) {
-            UnlockReadWrite();
-            return SWITCH_STATUS_SUCCESS;
-        }
-        UnlockReadWrite();
-    } else {
-        return SWITCH_STATUS_FALSE; 
-    }
-
-
-    return SWITCH_STATUS_FALSE;
-}
-
-
-/* For Emacs:
- * Local Variables:
- * mode:c
- * indent-tabs-mode:nil
- * tab-width:4
- * c-basic-offset:4
- * End:
- * For VIM:
- * vim:set softtabstop=4 shiftwidth=4 tabstop=4:s:
- */
+/* Opal endpoint interface for Freeswitch Modular Media Switching Software Library /
+ * Soft-Switch Application
+ *
+ * Version: MPL 1.1
+ *
+ * Copyright (c) 2007 Tuyan Ozipek (tuyanozipek@gmail.com)
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Contributor(s):
+ * Tuyan Ozipek   (tuyanozipek@gmail.com)
+ * Lukasz Zwierko (lzwierko@gmail.com)
+ * Robert Jongbloed (robertj@voxlucida.com.au)
+ *
+ */
+
+#include "mod_opal.h"
+#include <opal/patch.h>
+#include <rtp/rtp.h>
+#include <h323/h323pdu.h>
+#include <h323/gkclient.h>
+
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, mod_opal_globals.codec_string);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_context, mod_opal_globals.context);
+SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, mod_opal_globals.dialplan);
+
+
+#define CF_NEED_FLUSH (1 << 1)
+
+struct mod_opal_globals mod_opal_globals = { 0 };
+
+
+static switch_call_cause_t create_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
+                                                   switch_caller_profile_t *outbound_profile, switch_core_session_t **new_session,
+                                                   switch_memory_pool_t **pool, switch_originate_flag_t flags);
+
+
+static FSProcess *opal_process = NULL;
+
+
+static const char ModuleName[] = "opal";
+
+
+static switch_status_t on_hangup(switch_core_session_t *session);
+static switch_status_t on_destroy(switch_core_session_t *session);
+
+
+static switch_io_routines_t opalfs_io_routines = {
+    /*.outgoing_channel */ create_outgoing_channel,
+    /*.read_frame */ FSConnection::read_audio_frame,
+    /*.write_frame */ FSConnection::write_audio_frame,
+    /*.kill_channel */ FSConnection::kill_channel,
+    /*.send_dtmf */ FSConnection::send_dtmf,
+    /*.receive_message */ FSConnection::receive_message,
+    /*.receive_event */ FSConnection::receive_event,
+    /*.state_change */ FSConnection::state_change,
+    /*.read_video_frame */ FSConnection::read_video_frame,
+    /*.write_video_frame */ FSConnection::write_video_frame
+};
+
+static switch_state_handler_table_t opalfs_event_handlers = {
+    /*.on_init */ FSConnection::on_init,
+    /*.on_routing */ FSConnection::on_routing,
+    /*.on_execute */ FSConnection::on_execute,
+    /*.on_hangup */ on_hangup,
+    /*.on_exchange_media */ FSConnection::on_exchange_media,
+    /*.on_soft_execute */ FSConnection::on_soft_execute,
+    /*.on_consume_media*/ NULL,
+    /*.on_hibernate*/ NULL,
+    /*.on_reset*/ NULL,
+    /*.on_park*/ NULL,
+    /*.on_reporting*/ NULL,
+    /*.on_destroy*/ on_destroy
+};
+
+
+SWITCH_BEGIN_EXTERN_C
+/*******************************************************************************/
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_opal_load);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_opal_shutdown);
+SWITCH_MODULE_DEFINITION(mod_opal, mod_opal_load, mod_opal_shutdown, NULL);
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_opal_load) {
+    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Starting loading mod_opal\n");
+
+    /* Prevent the loading of OPAL codecs via "plug ins", this is a directory
+       full of DLLs that will be loaded automatically. */
+    putenv((char *)"PTLIBPLUGINDIR=/no/thanks");
+
+
+    *module_interface = switch_loadable_module_create_module_interface(pool, modname);
+    if (!*module_interface) {
+        return SWITCH_STATUS_MEMERR;
+    }
+
+    opal_process = new FSProcess();
+    if (opal_process == NULL) {
+        return SWITCH_STATUS_MEMERR;
+    }
+
+    if (opal_process->Initialise(*module_interface)) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Opal manager initialized and running\n");
+        //unloading causes a seg in linux
+        return SWITCH_STATUS_NOUNLOAD;
+        //return SWITCH_STATUS_SUCCESS;
+    }
+
+    delete opal_process;
+    opal_process = NULL;
+    return SWITCH_STATUS_FALSE;
+}
+
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_opal_shutdown) {
+    
+    switch_safe_free(mod_opal_globals.context);
+    switch_safe_free(mod_opal_globals.dialplan);
+    switch_safe_free(mod_opal_globals.codec_string);
+    delete opal_process;
+    opal_process = NULL;
+    return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_END_EXTERN_C
+/*******************************************************************************/
+
+
+
+static switch_call_cause_t create_outgoing_channel(switch_core_session_t *session,
+                                                   switch_event_t *var_event,
+                                                   switch_caller_profile_t *outbound_profile,
+                                                   switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
+{
+    if (opal_process == NULL) {
+        return SWITCH_CAUSE_CRASH;
+    }
+
+    PString token;
+
+    FSManager & manager = opal_process->GetManager();
+    if (!manager.SetUpCall("local:", outbound_profile->destination_number, token, outbound_profile)) {
+        return SWITCH_CAUSE_INVALID_NUMBER_FORMAT;
+    }
+
+    PSafePtr < OpalCall > call = manager.FindCallWithLock(token);
+
+    if (call == NULL) {
+        return SWITCH_CAUSE_PROTOCOL_ERROR;
+    }
+
+    PSafePtr < FSConnection > connection = call->GetConnectionAs < FSConnection > (0);
+
+    if (connection == NULL) {
+        return SWITCH_CAUSE_PROTOCOL_ERROR;
+    }
+
+    *new_session = connection->GetSession();
+
+    return SWITCH_CAUSE_SUCCESS;
+}
+
+
+///////////////////////////////////////////////////////////////////////
+
+#if PTRACING
+
+class FSTrace : public ostream {
+ public:
+ FSTrace()
+     : ostream(&buffer)
+        {
+        }
+
+ private:
+ class Buffer : public streambuf {
+        char buffer[250];
+
+    public:
+        Buffer()
+            {
+                setg(buffer, buffer, &buffer[sizeof(buffer)-2]);
+                setp(buffer, &buffer[sizeof(buffer)-2]);
+            }
+
+        virtual int sync()
+        {
+            return overflow(EOF);
+        }
+
+        virtual int underflow()
+        {
+            return EOF;
+        }
+
+        virtual int overflow(int c)
+        {
+            const char *fmt = "%s";
+            char *func = NULL;
+
+            int bufSize = pptr() - pbase();
+
+            if (c != EOF) {
+                *pptr() = (char)c;
+                bufSize++;
+            }
+            
+            if (bufSize != 0) {
+                char *bufPtr = pbase();
+                char *bufEndPtr = NULL;
+                setp(bufPtr, epptr());
+                bufPtr[bufSize] = '\0';
+                int line = 0;
+                char *p;
+                
+                char *file = NULL;
+                switch_log_level_t level;
+
+                
+                switch (strtoul(bufPtr, &file, 10)) {
+                case 1 :
+                    level = SWITCH_LOG_INFO;
+                    break;
+                default :
+                    level = SWITCH_LOG_DEBUG;
+                    break;
+                }
+
+                if (file) {
+                    while (isspace(*file)) file++;
+                    
+                    if (file && (bufPtr = strchr(file, '(')) && (bufEndPtr = strchr(bufPtr, ')'))) {
+                        char *e;
+
+                        for(p = bufPtr; p && *p; p++) {
+                            if (*p == '\t') {
+                                *p = ' ';
+                            }
+                        }
+
+                        *bufPtr++ = '\0';
+                        line = atoi(bufPtr);
+                        while (bufEndPtr && isspace(*(++bufEndPtr)));
+                        bufPtr = bufEndPtr;
+                        if (bufPtr && (e = strchr(bufPtr, ' ')) || (e = strchr(bufPtr, '\t'))) {
+                            func = bufPtr;
+                            bufPtr = e;
+                            *bufPtr++ = '\0';
+                        }
+                    }
+                }
+                
+                switch_text_channel_t tchannel = SWITCH_CHANNEL_ID_LOG;
+
+                if (!bufPtr) {
+                    bufPtr = pbase();
+                    level = SWITCH_LOG_DEBUG;
+                }
+
+                if (bufPtr) {
+                    if (end_of(bufPtr) != '\n') {
+                        fmt = "%s\n";
+                    }
+                    if (!(file && func && line)) tchannel = SWITCH_CHANNEL_ID_LOG_CLEAN;
+
+                    switch_log_printf(tchannel, file, func, line, NULL, level, fmt, bufPtr);
+                }
+                
+            }
+
+            return 0;
+        }
+    } buffer;
+};
+
+#endif
+
+
+///////////////////////////////////////////////////////////////////////
+
+FSProcess::FSProcess()
+  : PLibraryProcess("Vox Lucida Pty. Ltd.", "mod_opal", 1, 0, AlphaCode, 1)
+  , m_manager(NULL)
+{
+}
+
+
+FSProcess::~FSProcess()
+{
+  delete m_manager;
+}
+
+
+bool FSProcess::Initialise(switch_loadable_module_interface_t *iface)
+{
+  m_manager = new FSManager();
+  return m_manager != NULL && m_manager->Initialise(iface);
+}
+
+
+///////////////////////////////////////////////////////////////////////
+
+FSManager::FSManager()
+{
+    // These are deleted by the OpalManager class, no need to have destructor
+    m_h323ep = new H323EndPoint(*this);
+    m_iaxep = new IAX2EndPoint(*this);
+    m_fsep = new FSEndPoint(*this);
+}
+
+
+bool FSManager::Initialise(switch_loadable_module_interface_t *iface)
+{
+    ReadConfig(false);
+
+#if PTRACING
+    PTrace::SetLevel(mod_opal_globals.trace_level);        //just for fun and eyecandy ;)
+    PTrace::SetOptions(PTrace::TraceLevel);
+    PTrace::SetStream(new FSTrace);
+#endif
+
+    m_FreeSwitch = (switch_endpoint_interface_t *) switch_loadable_module_create_interface(iface, SWITCH_ENDPOINT_INTERFACE);
+    m_FreeSwitch->interface_name = ModuleName;
+    m_FreeSwitch->io_routines = &opalfs_io_routines;
+    m_FreeSwitch->state_handler = &opalfs_event_handlers;
+
+    silenceDetectParams.m_mode = OpalSilenceDetector::NoSilenceDetection;
+
+    if (m_listeners.empty()) {
+        m_h323ep->StartListener("");
+    } else {
+        for (std::list < FSListener >::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it) {
+            if (!m_h323ep->StartListener(it->listenAddress)) {
+                PTRACE(3, "mod_opal\tCannot start listener for " << it->name);
+            }
+        }
+    }
+
+    AddRouteEntry("h323:.* = local:<da>");  // config option for direct routing
+    AddRouteEntry("iax2:.* = local:<da>");  // config option for direct routing
+    AddRouteEntry("local:.* = h323:<da>");  // config option for direct routing
+
+    // Make sure all known codecs are instantiated,
+    // these are ones we know how to translate into H.323 capabilities
+    GetOpalG728();
+    GetOpalG729();
+    GetOpalG729A();
+    GetOpalG729B();
+    GetOpalG729AB();
+    GetOpalG7231_6k3();
+    GetOpalG7231_5k3();
+    GetOpalG7231A_6k3();
+    GetOpalG7231A_5k3();
+    GetOpalGSM0610();
+    GetOpalGSMAMR();
+    GetOpaliLBC();
+
+    /* For compatibility with the algorithm in FSConnection::SetCodecs() we need
+       to set all audio media formats to be 1 frame per packet */
+    OpalMediaFormatList allCodecs = OpalMediaFormat::GetAllRegisteredMediaFormats();
+    for (OpalMediaFormatList::iterator it = allCodecs.begin(); it != allCodecs.end(); ++it) {
+      if (it->GetMediaType() == OpalMediaType::Audio()) {
+        it->SetOptionInteger(OpalAudioFormat::RxFramesPerPacketOption(), 1);
+        it->SetOptionInteger(OpalAudioFormat::TxFramesPerPacketOption(), 1);
+      }
+    }
+
+    if (!m_gkAddress.IsEmpty()) {
+      if (m_h323ep->UseGatekeeper(m_gkAddress, m_gkIdentifer, m_gkInterface))
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Started gatekeeper: %s\n",
+                          (const char *)m_h323ep->GetGatekeeper()->GetName());
+      else
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+                          "Could not start gatekeeper: addr=\"%s\", id=\"%s\", if=\"%s\"\n",
+                          (const char *)m_gkAddress,
+                          (const char *)m_gkIdentifer,
+                          (const char *)m_gkInterface);
+    }
+
+    return TRUE;
+}
+
+
+switch_status_t FSManager::ReadConfig(int reload)
+{
+    const char *cf = "opal.conf";
+    switch_status_t status = SWITCH_STATUS_SUCCESS;
+
+    switch_memory_pool_t *pool = NULL;
+    if ((status = switch_core_new_memory_pool(&pool)) != SWITCH_STATUS_SUCCESS) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+        return status;
+    }
+
+    set_global_context("default");
+    set_global_dialplan("XML");
+
+    switch_event_t *params = NULL;
+    switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS);
+    switch_assert(params);
+    switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "profile", switch_str_nil(""));
+    switch_xml_t cfg;
+    switch_xml_t xml = switch_xml_open_cfg(cf, &cfg, params);
+    if (xml == NULL) {
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "open of %s failed\n", cf);
+        return SWITCH_STATUS_FALSE;
+    }
+
+    switch_xml_t xmlSettings = switch_xml_child(cfg, "settings");
+    if (xmlSettings) {
+        for (switch_xml_t xmlParam = switch_xml_child(xmlSettings, "param"); xmlParam != NULL; xmlParam = xmlParam->next) {
+            const char *var = switch_xml_attr_soft(xmlParam, "name");
+            const char *val = switch_xml_attr_soft(xmlParam, "value");
+
+            if (!strcasecmp(var, "trace-level")) {
+                int level = atoi(val);
+                if (level > 0) {
+                    mod_opal_globals.trace_level = level;
+                }
+            } else if (!strcasecmp(var, "context")) {
+                set_global_context(val);
+            } else if (!strcasecmp(var, "dialplan")) {
+                set_global_dialplan(val);
+            } else if (!strcasecmp(var, "codec-prefs")) {
+                set_global_codec_string(val);
+            } else if (!strcasecmp(var, "jitter-size")) {
+                char * next;
+                unsigned minJitter = strtoul(val, &next, 10);
+                if (minJitter >= 10) {
+                    unsigned maxJitter = minJitter;
+                    if (*next == ',')
+                      maxJitter = atoi(next+1);
+                    SetAudioJitterDelay(minJitter, maxJitter); // In milliseconds
+                }
+            } else if (!strcasecmp(var, "gk-address")) {
+                m_gkAddress = val;
+            } else if (!strcasecmp(var, "gk-identifer")) {
+                m_gkIdentifer = val;
+            } else if (!strcasecmp(var, "gk-interface")) {
+                m_gkInterface = val;
+            }
+        }
+    }
+
+    switch_xml_t xmlListeners = switch_xml_child(cfg, "listeners");
+    if (xmlListeners != NULL) {
+        for (switch_xml_t xmlListener = switch_xml_child(xmlListeners, "listener"); xmlListener != NULL; xmlListener = xmlListener->next) {
+
+            m_listeners.push_back(FSListener());
+            FSListener & listener = m_listeners.back();
+
+            listener.name = switch_xml_attr_soft(xmlListener, "name");
+            if (listener.name.IsEmpty())
+                listener.name = "unnamed";
+
+            PIPSocket::Address ip;
+            WORD port = 1720;
+
+            for (switch_xml_t xmlParam = switch_xml_child(xmlListener, "param"); xmlParam != NULL; xmlParam = xmlParam->next) {
+                const char *var = switch_xml_attr_soft(xmlParam, "name");
+                const char *val = switch_xml_attr_soft(xmlParam, "value");
+                //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Var - '%s' and Val - '%s' \n", var, val);
+                if (!strcasecmp(var, "h323-ip"))
+                    ip = val;
+                else if (!strcasecmp(var, "h323-port"))
+                    port = (WORD) atoi(val);
+            }
+
+            listener.listenAddress = OpalTransportAddress(ip, port);
+            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created Listener '%s'\n", (const char *) listener.name);
+        }
+    }
+
+    switch_event_destroy(&params);
+
+    if (xml)
+        switch_xml_free(xml);
+
+    return status;
+}
+
+
+OpalCall * FSManager::CreateCall(void * /*userData*/)
+{
+  return new FSCall(*this);
+}
+
+
+///////////////////////////////////////////////////////////////////////
+
+FSEndPoint::FSEndPoint(FSManager & manager)
+:   OpalLocalEndPoint(manager)
+{
+    PTRACE(3, "mod_opal\t FSEndPoint Created!");
+}
+
+
+bool FSEndPoint::OnIncomingCall(OpalLocalConnection & connection)
+{
+    return ((FSConnection &) connection).OnIncoming();
+}
+
+
+OpalLocalConnection *FSEndPoint::CreateConnection(OpalCall & call, void *userData, unsigned options, OpalConnection::StringOptions* stringOptions)
+{
+    FSManager & mgr = (FSManager &) GetManager();
+    switch_core_session_t *fsSession = switch_core_session_request(mgr.GetSwitchInterface(), 
+                                       (switch_caller_profile_t *)userData ? SWITCH_CALL_DIRECTION_OUTBOUND : SWITCH_CALL_DIRECTION_INBOUND, NULL);
+    if (fsSession == NULL)
+        return NULL;
+
+    switch_channel_t *fsChannel = switch_core_session_get_channel(fsSession);
+
+    if (fsChannel == NULL) {
+        switch_core_session_destroy(&fsSession);
+        return NULL;
+    }
+
+    return new FSConnection(call, *this, userData, options, stringOptions, (switch_caller_profile_t *)userData, fsSession, fsChannel);
+}
+
+
+///////////////////////////////////////////////////////////////////////
+
+FSCall::FSCall(OpalManager & manager)
+  : OpalCall(manager)
+{
+}
+
+
+PBoolean FSCall::OnSetUp(OpalConnection & connection)
+{
+  // Transfer FS caller_id_number & caller_id_name from the FSConnection
+  // to the protocol connectionm (e.g. H.323) so gets sent correctly
+  // in outgoing packets
+  PSafePtr<FSConnection> local = GetConnectionAs<FSConnection>();
+  if (local != NULL) {
+    PSafePtr<OpalConnection> proto = local->GetOtherPartyConnection();
+    if (proto != NULL) {
+      proto->SetLocalPartyName(local->GetLocalPartyName());
+      proto->SetDisplayName(local->GetDisplayName());
+    }
+  }
+
+  return OpalCall::OnSetUp(connection);
+}
+
+
+///////////////////////////////////////////////////////////////////////
+
+
+FSConnection::FSConnection(OpalCall & call, FSEndPoint & endpoint, void* userData, unsigned options, OpalConnection::StringOptions* stringOptions, switch_caller_profile_t *outbound_profile, switch_core_session_t *fsSession, switch_channel_t *fsChannel)
+  : OpalLocalConnection(call, endpoint, userData, options, stringOptions)
+  , m_endpoint(endpoint)
+  , m_fsSession(fsSession)
+  , m_fsChannel(fsChannel)
+{
+    opal_private_t *tech_pvt;
+
+    tech_pvt = (opal_private_t *) switch_core_session_alloc(m_fsSession, sizeof(*tech_pvt));
+    tech_pvt->me = this;
+    switch_core_session_set_private(m_fsSession, tech_pvt);
+
+    if (outbound_profile != NULL) {
+        SetLocalPartyName(outbound_profile->caller_id_number);
+        SetDisplayName(outbound_profile->caller_id_name);
+
+        switch_caller_profile_t *caller_profile = switch_caller_profile_clone(m_fsSession, outbound_profile);
+        switch_channel_set_caller_profile(m_fsChannel, caller_profile);
+
+        PString name = "opal/";
+        name += outbound_profile->destination_number;
+        switch_channel_set_name(m_fsChannel, name);
+
+        switch_channel_set_flag(m_fsChannel, CF_OUTBOUND);
+        switch_channel_set_state(m_fsChannel, CS_INIT);
+    }
+}
+
+
+bool FSConnection::OnIncoming()
+{
+    if (m_fsSession == NULL) {
+        PTRACE(1, "mod_opal\tSession request failed.");
+        return false;
+    }
+
+    switch_core_session_add_stream(m_fsSession, NULL);
+
+    switch_channel_t *channel = switch_core_session_get_channel(m_fsSession);
+    if (channel == NULL) {
+        PTRACE(1, "mod_opal\tSession does not have a channel");
+        return false;
+    }
+
+    PURL url = GetRemotePartyURL();
+    switch_caller_profile_t *caller_profile = switch_caller_profile_new(switch_core_session_get_pool(m_fsSession),
+                                                                        url.GetUserName(),
+                                                                        /** username */
+                                                                        mod_opal_globals.dialplan,
+                                                                        /** dial plan */
+                                                                        GetRemotePartyName(),
+                                                                        /** caller_id_name */
+                                                                        GetRemotePartyNumber(),
+                                                                        /** caller_id_number */
+                                                                        url.GetHostName(),
+                                                                        /** network addr */
+                                                                        NULL,
+                                                                        /** ANI */
+                                                                        NULL,
+                                                                        /** ANI II */
+                                                                        NULL,
+                                                                        /** RDNIS */
+                                                                        ModuleName,
+                                                                        /** source */
+                                                                        mod_opal_globals.context,
+                                                                        /** set context  */
+                                                                        GetCalledPartyNumber()
+                                                                        /** destination_number */
+                                                                        );
+    if (caller_profile == NULL) {
+        PTRACE(1, "mod_opal\tCould not create caller profile");
+        return false;
+    }
+
+    PTRACE(4, "mod_opal\tCreated switch caller profile:\n"
+           "  username       = " << caller_profile->username << "\n"
+           "  dialplan       = " << caller_profile->dialplan << "\n"
+           "  caller_id_name     = " << caller_profile->caller_id_name << "\n"
+           "  caller_id_number   = " << caller_profile->caller_id_number << "\n"
+           "  network_addr   = " << caller_profile->network_addr << "\n"
+           "  source         = " << caller_profile->source << "\n"
+           "  context        = " << caller_profile->context << "\n" "  destination_number= " << caller_profile->destination_number);
+    switch_channel_set_caller_profile(channel, caller_profile);
+
+    char name[256] = "opal/in:";
+    switch_copy_string(name + 8, caller_profile->destination_number, sizeof(name)-8);
+    switch_channel_set_name(channel, name);
+    switch_channel_set_state(channel, CS_INIT);
+
+    if (switch_core_session_thread_launch(m_fsSession) != SWITCH_STATUS_SUCCESS) {
+        PTRACE(1, "mod_opal\tCould not launch session thread");
+        return false;
+    }
+
+    return true;
+}
+
+
+void FSConnection::OnReleased()
+{
+    opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(m_fsSession);
+    
+    /* so FS on_hangup will not try to deref a landmine */
+    tech_pvt->me = NULL;
+    
+    m_rxAudioOpened.Signal();   // Just in case
+    m_txAudioOpened.Signal();
+    H225_ReleaseCompleteReason dummy;
+    switch_channel_hangup(switch_core_session_get_channel(m_fsSession),
+                          (switch_call_cause_t)H323TranslateFromCallEndReason(GetCallEndReason(), dummy));    
+    OpalLocalConnection::OnReleased();
+}
+
+
+void FSConnection::OnAlerting()
+{
+    switch_channel_mark_ring_ready(m_fsChannel);
+    return OpalLocalConnection::OnAlerting();
+}
+
+PBoolean FSConnection::SetAlerting(const PString & calleeName, PBoolean withMedia)
+{
+    return OpalLocalConnection::SetAlerting(calleeName, withMedia);
+}
+
+
+void FSConnection::OnEstablished()
+{
+    OpalLocalConnection::OnEstablished();
+}
+
+
+PBoolean FSConnection::SendUserInputTone(char tone, unsigned duration)
+{
+    switch_dtmf_t dtmf = { tone, duration };
+    return switch_channel_queue_dtmf(m_fsChannel, &dtmf) == SWITCH_STATUS_SUCCESS;
+}
+
+
+PBoolean FSConnection::SendUserInputString(const PString & value)
+{
+  return OpalConnection::SendUserInputString(value);
+}
+
+
+OpalMediaFormatList FSConnection::GetMediaFormats() const
+{
+    if (m_switchMediaFormats.IsEmpty()) {
+        const_cast<FSConnection *>(this)->SetCodecs();
+    }
+    
+    return m_switchMediaFormats;
+}
+
+
+void FSConnection::SetCodecs()
+{
+    int numCodecs = 0;
+    const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];    
+    const char *codec_string = NULL, *abs, *ocodec;
+    char *tmp_codec_string = NULL;
+    char *codec_order[SWITCH_MAX_CODECS];
+    int codec_order_last;
+
+
+    if ((abs = switch_channel_get_variable(m_fsChannel, "absolute_codec_string"))) {
+        codec_string = abs;
+    } else {
+        if ((abs = switch_channel_get_variable(m_fsChannel, "codec_string"))) {
+            codec_string = abs;
+        }
+
+        if ((ocodec = switch_channel_get_variable(m_fsChannel, SWITCH_ORIGINATOR_CODEC_VARIABLE))) {
+            codec_string = switch_core_session_sprintf(m_fsSession, "%s,%s", ocodec, codec_string);
+        }
+    }
+    
+    if (!codec_string) {
+        codec_string = mod_opal_globals.codec_string;
+    }
+
+    if (codec_string) {
+        if ((tmp_codec_string = strdup(codec_string))) {
+            codec_order_last = switch_separate_string(tmp_codec_string, ',', codec_order, SWITCH_MAX_CODECS);
+            numCodecs = switch_loadable_module_get_codecs_sorted(codecs, SWITCH_MAX_CODECS, codec_order, codec_order_last);
+            
+        }
+    } else {
+        numCodecs = switch_loadable_module_get_codecs(codecs, sizeof(codecs) / sizeof(codecs[0]));
+    }
+    
+    for (int i = 0; i < numCodecs; i++) {
+        const switch_codec_implementation_t *codec = codecs[i];
+
+        // See if we have a match by PayloadType/rate/name
+        OpalMediaFormat switchFormat((RTP_DataFrame::PayloadTypes)codec->ianacode,
+                                     codec->samples_per_second,
+                                     codec->iananame);
+        if (!switchFormat.IsValid()) {
+            // See if we have a match by name alone
+            switchFormat = codec->iananame;
+            if (!switchFormat.IsValid()) {
+              PTRACE(2, "mod_opal\tCould not match FS codec " << codec->iananame << " to OPAL media format.");
+              continue;
+            }
+        }
+        
+
+        // Did we match or create a new media format?
+        if (switchFormat.IsValid() && codec->codec_type == SWITCH_CODEC_TYPE_AUDIO) {
+            PTRACE(2, "mod_opal\tMatched FS codec " << codec->iananame << " to OPAL media format " << switchFormat);
+
+            // Calculate frames per packet, do not use codec->codec_frames_per_packet as that field
+            // has slightly different semantics when used in streamed codecs such as G.711
+            int fpp = codec->samples_per_packet/switchFormat.GetFrameTime();
+
+            /* Set the frames/packet to maximum of what is in the FS table. The OPAL negotiations will
+               drop the value from there. This might fail if there are "holes" in the FS table, e.g.
+               if for some reason G.723.1 has 30ms and 90ms but not 60ms, then the OPAL negotiations
+               could end up with 60ms and the codec cannot be created. The "holes" are unlikely in
+               all but streamed codecs such as G.711, where it is theoretically possible for OPAL to
+               come up with 32ms and there is only 30ms and 40ms in the FS table. We deem these
+               scenarios succifiently rare that we can safely ignore them ... for now. */
+
+            if (fpp > switchFormat.GetOptionInteger(OpalAudioFormat::RxFramesPerPacketOption())) {
+                switchFormat.SetOptionInteger(OpalAudioFormat::RxFramesPerPacketOption(), fpp);
+            }
+
+            if (fpp > switchFormat.GetOptionInteger(OpalAudioFormat::TxFramesPerPacketOption())) {
+                switchFormat.SetOptionInteger(OpalAudioFormat::TxFramesPerPacketOption(), fpp);
+            }
+        }
+
+        m_switchMediaFormats += switchFormat;
+    }
+    
+    switch_safe_free(tmp_codec_string);
+}
+
+
+OpalMediaStream *FSConnection::CreateMediaStream(const OpalMediaFormat & mediaFormat, unsigned sessionID, PBoolean isSource)
+{
+    return new FSMediaStream(*this, mediaFormat, sessionID, isSource);
+}
+
+
+PBoolean FSConnection::OnOpenMediaStream(OpalMediaStream & stream)
+{
+    if (!OpalConnection::OnOpenMediaStream(stream)) {
+        return false;
+    }
+
+    if (stream.GetMediaFormat().GetMediaType() != OpalMediaType::Audio()) {
+        return true;
+    }
+
+    if (stream.IsSource()) {
+        m_rxAudioOpened.Signal();
+    } else {
+        m_txAudioOpened.Signal();
+    }
+
+    if (GetMediaStream(stream.GetSessionID(), stream.IsSink()) != NULL) {
+        // Have open media in both directions.
+        if (GetPhase() == AlertingPhase) {
+            switch_channel_mark_pre_answered(m_fsChannel);
+        } else if (GetPhase() < ReleasingPhase) {
+            switch_channel_mark_answered(m_fsChannel);
+        }
+    }
+
+    return true;
+}
+
+
+switch_status_t FSConnection::on_init()
+{
+    switch_channel_t *channel = switch_core_session_get_channel(m_fsSession);
+    if (channel == NULL) {
+        return SWITCH_STATUS_FALSE;
+    }
+
+    PTRACE(3, "mod_opal\tStarted routing for connection " << *this);
+    switch_channel_set_state(channel, CS_ROUTING);
+    return SWITCH_STATUS_SUCCESS;
+}
+
+
+switch_status_t FSConnection::on_routing()
+{
+    PTRACE(3, "mod_opal\tRouting connection " << *this);
+    return SWITCH_STATUS_SUCCESS;
+}
+
+
+switch_status_t FSConnection::on_execute()
+{
+    PTRACE(3, "mod_opal\tExecuting connection " << *this);
+    return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t on_destroy(switch_core_session_t *session)
+{
+    //switch_channel_t *channel = switch_core_session_get_channel(session);
+    opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(session);
+    
+    if (tech_pvt) {
+    if (tech_pvt->read_codec.implementation) {
+        switch_core_codec_destroy(&tech_pvt->read_codec);
+    }
+
+    if (tech_pvt->write_codec.implementation) {
+        switch_core_codec_destroy(&tech_pvt->write_codec);
+    }
+
+    if (tech_pvt->vid_read_codec.implementation) {
+        switch_core_codec_destroy(&tech_pvt->vid_read_codec);
+    }
+
+    if (tech_pvt->vid_write_codec.implementation) {
+        switch_core_codec_destroy(&tech_pvt->vid_write_codec);
+    }
+
+    if (tech_pvt->read_timer.timer_interface) {
+        switch_core_timer_destroy(&tech_pvt->read_timer);
+    }
+
+    if (tech_pvt->vid_read_timer.timer_interface) {
+        switch_core_timer_destroy(&tech_pvt->vid_read_timer);
+    }
+    }
+
+    return SWITCH_STATUS_SUCCESS;
+}
+
+/* this function has to be called with the original session beause the FSConnection might already be destroyed and we 
+   will can't have it be a method of a dead object
+ */
+static switch_status_t on_hangup(switch_core_session_t *session)
+{
+    switch_channel_t *channel = switch_core_session_get_channel(session);
+    opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(session);
+    
+    /* if this is still here it was our idea to hangup not opal's */
+    if (tech_pvt->me) {
+        Q931::CauseValues cause = (Q931::CauseValues)switch_channel_get_cause_q850(channel);
+        tech_pvt->me->SetQ931Cause(cause);
+        tech_pvt->me->ClearCallSynchronous(NULL, H323TranslateToCallEndReason(cause, UINT_MAX));
+        tech_pvt->me = NULL;
+    }
+
+    return SWITCH_STATUS_SUCCESS;
+}
+
+
+switch_status_t FSConnection::on_exchange_media()
+{
+    PTRACE(3, "mod_opal\tLoopback on connection " << *this);
+    return SWITCH_STATUS_SUCCESS;
+}
+
+
+switch_status_t FSConnection::on_soft_execute()
+{
+    PTRACE(3, "mod_opal\tTransmit on connection " << *this);
+    return SWITCH_STATUS_SUCCESS;
+}
+
+
+switch_status_t FSConnection::kill_channel(int sig)
+{
+    PTRACE(3, "mod_opal\tKill " << sig << " on connection " << *this);
+
+    switch (sig) {
+    case SWITCH_SIG_BREAK:
+        break;
+    case SWITCH_SIG_KILL:
+        m_rxAudioOpened.Signal();
+        m_txAudioOpened.Signal();
+        break;
+    default:
+        break;
+    }
+
+    return SWITCH_STATUS_SUCCESS;
+}
+
+
+switch_status_t FSConnection::send_dtmf(const switch_dtmf_t *dtmf)
+{
+    OnUserInputTone(dtmf->digit, dtmf->duration);
+    return SWITCH_STATUS_SUCCESS;
+}
+
+
+switch_status_t FSConnection::receive_message(switch_core_session_message_t *msg)
+{
+    switch_channel_t *channel = switch_core_session_get_channel(m_fsSession);
+
+
+    /*
+      SWITCH_MESSAGE_INDICATE_PROGRESS:  establish early media now and return SWITCH_STATUS_FALSE if you can't
+      SWITCH_MESSAGE_INDICATE_ANSWER:  answer and set up media now if it's not already and return SWITCH_STATUS_FALSE if you can't
+
+      Neither message means anything on an outbound call....
+
+      It would only happen if someone called switch_channel_answer() instead of switch_channel_mark_answered() on an outbound call.
+      it should not do anything if someone does it by accident somewhere hense this in both cases:
+
+      if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
+      return SWITCH_STATUS_FALSE;
+      }
+
+
+      When we get these messages the core will trust that you have triggered FSMediaStream::Open and are ready for media if we do not
+      have media we MUST return SWITCH_STATUS_FALSE or it will cause a CRASH.
+
+
+
+    */
+    switch (msg->message_id) {
+    case SWITCH_MESSAGE_INDICATE_BRIDGE:
+    case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
+    case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC:
+        switch_channel_set_private_flag(channel, CF_NEED_FLUSH);
+        break;
+
+    case SWITCH_MESSAGE_INDICATE_RINGING:
+    case SWITCH_MESSAGE_INDICATE_PROGRESS:
+    case SWITCH_MESSAGE_INDICATE_ANSWER:
+        {
+            switch_caller_profile_t * profile = switch_channel_get_caller_profile(channel);
+            if (profile != NULL && profile->caller_extension != NULL)
+            {
+                PSafePtr<OpalConnection> other = GetOtherPartyConnection();
+                if (other != NULL) {
+                    other->SetLocalPartyName(profile->caller_extension->extension_number);
+                    other->SetDisplayName(profile->caller_extension->extension_name);
+                }
+                SetLocalPartyName(profile->caller_extension->extension_number);
+                SetDisplayName(profile->caller_extension->extension_name);
+            }
+        }
+        break;
+
+    default:
+        break;
+    }
+
+    switch (msg->message_id) {
+    case SWITCH_MESSAGE_INDICATE_RINGING:
+        SetPhase(OpalConnection::AlertingPhase);
+        OnAlerting();
+        break;
+
+    case SWITCH_MESSAGE_INDICATE_DEFLECT:
+    {
+        PSafePtr<OpalConnection> other = GetOtherPartyConnection();
+        if (other != NULL)
+          other->TransferConnection(msg->string_arg);
+        break;
+    }
+
+    case SWITCH_MESSAGE_INDICATE_PROGRESS:
+    case SWITCH_MESSAGE_INDICATE_ANSWER:
+        {
+            int fixed = 0;
+            
+            if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
+                return SWITCH_STATUS_FALSE;
+            }
+
+            if (msg->message_id == SWITCH_MESSAGE_INDICATE_PROGRESS) {
+                if (fixed) {
+                    /* this should send alerting + media and wait for it to be established and return SUCCESS or FAIL
+                       depending on if media was able to be established.  Need code to tell the other side we want early media here.
+                    */
+                    GetCall().OpenSourceMediaStreams(*this, OpalMediaType::Audio());
+                    SetPhase(OpalConnection::AlertingPhase);
+                    /* how do i say please establish early media ? */
+                    OnAlerting();
+                } else {
+                    /* hack to avoid getting stuck, pre_answer will imply answer */
+                    OnConnectedInternal();
+                }
+            } else {
+                OnConnectedInternal();
+            }
+
+            // Wait for media
+            PTRACE(2, "mod_opal\tAwaiting media start on connection " << *this);
+            m_rxAudioOpened.Wait();
+            m_txAudioOpened.Wait();
+            
+            if (GetPhase() >= ReleasingPhase) {
+                // Call got aborted
+                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(m_fsSession), SWITCH_LOG_ERROR, "Call abandoned!\n");
+                return SWITCH_STATUS_FALSE;
+            }
+
+            PTRACE(4, "mod_opal\tMedia started on connection " << *this);
+
+            if (msg->message_id == SWITCH_MESSAGE_INDICATE_PROGRESS) {
+                if (!switch_channel_test_flag(m_fsChannel, CF_EARLY_MEDIA)) {
+                    switch_channel_mark_pre_answered(m_fsChannel);
+                }
+            } else {
+                if (!switch_channel_test_flag(m_fsChannel, CF_EARLY_MEDIA)) {
+                    switch_channel_mark_answered(m_fsChannel);
+                }
+            }
+
+        }
+        break;
+
+    default:
+        PTRACE(3, "mod_opal\tReceived message " << msg->message_id << " on connection " << *this);
+    }
+
+    return SWITCH_STATUS_SUCCESS;
+}
+
+
+switch_status_t FSConnection::receive_event(switch_event_t *event)
+{
+    PTRACE(3, "mod_opal\tReceived event " << event->event_id << " on connection " << *this);
+    return SWITCH_STATUS_SUCCESS;
+}
+
+
+switch_status_t FSConnection::state_change()
+{
+    PTRACE(3, "mod_opal\tState changed on connection " << *this);
+    return SWITCH_STATUS_SUCCESS;
+}
+
+
+switch_status_t FSConnection::read_audio_frame(switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
+{
+    return read_frame(OpalMediaType::Audio(), frame, flags);
+}
+
+
+switch_status_t FSConnection::write_audio_frame(switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
+{
+    return write_frame(OpalMediaType::Audio(), frame, flags);
+}
+
+
+switch_status_t FSConnection::read_video_frame(switch_frame_t **frame, switch_io_flag_t flag, int stream_id)
+{
+    return read_frame(OpalMediaType::Video(), frame, flag);
+}
+
+
+switch_status_t FSConnection::write_video_frame(switch_frame_t *frame, switch_io_flag_t flag, int stream_id)
+{
+    return write_frame(OpalMediaType::Video(), frame, flag);
+}
+
+
+switch_status_t FSConnection::read_frame(const OpalMediaType & mediaType, switch_frame_t **frame, switch_io_flag_t flags)
+{
+    PSafePtr < FSMediaStream > stream = PSafePtrCast < OpalMediaStream, FSMediaStream > (GetMediaStream(mediaType, false));
+    return stream != NULL ? stream->read_frame(frame, flags) : SWITCH_STATUS_FALSE;
+}
+
+
+switch_status_t FSConnection::write_frame(const OpalMediaType & mediaType, const switch_frame_t *frame, switch_io_flag_t flags)
+{
+    PSafePtr < FSMediaStream > stream = PSafePtrCast < OpalMediaStream, FSMediaStream > (GetMediaStream(mediaType, true));
+    return stream != NULL ? stream->write_frame(frame, flags) : SWITCH_STATUS_FALSE;
+}
+
+
+///////////////////////////////////////////////////////////////////////
+
+FSMediaStream::FSMediaStream(FSConnection & conn, const OpalMediaFormat & mediaFormat, unsigned sessionID, bool isSource)
+    : OpalMediaStream(conn, mediaFormat, sessionID, isSource)
+    , m_fsSession(conn.GetSession())
+    , m_readRTP(0, 512)
+    , m_callOnStart(true)
+{
+    memset(&m_readFrame, 0, sizeof(m_readFrame));
+    m_readFrame.codec = m_switchCodec;
+    m_readFrame.flags = SFF_RAW_RTP;
+}
+
+
+PBoolean FSMediaStream::Open()
+{
+    opal_private_t *tech_pvt = (opal_private_t *) switch_core_session_get_private(m_fsSession);
+
+    if (IsOpen()) {
+        return true;
+    }
+
+    bool isAudio;
+    if (mediaFormat.GetMediaType() == OpalMediaType::Audio()) {
+        isAudio = true;
+    } else if (mediaFormat.GetMediaType() == OpalMediaType::Video()) {
+        isAudio = false;
+    } else {
+        return OpalMediaStream::Open();
+    }
+
+    m_fsChannel = switch_core_session_get_channel(m_fsSession);
+    
+    int ptime = mediaFormat.GetOptionInteger(OpalAudioFormat::TxFramesPerPacketOption()) * mediaFormat.GetFrameTime() / mediaFormat.GetTimeUnits();
+
+
+    if (IsSink()) {
+        m_switchCodec = isAudio ? &tech_pvt->read_codec : &tech_pvt->vid_read_codec;
+        m_switchTimer = isAudio ? &tech_pvt->read_timer : &tech_pvt->vid_read_timer;
+    } else {
+        m_switchCodec = isAudio ? &tech_pvt->write_codec : &tech_pvt->vid_write_codec;
+    }
+
+    // The following is performed on two different instances of this object.
+    if (switch_core_codec_init(m_switchCodec, mediaFormat.GetEncodingName(), NULL, // FMTP
+                               mediaFormat.GetClockRate(), ptime, 1,  // Channels
+                               SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,   // Settings
+                               switch_core_session_get_pool(m_fsSession)) != SWITCH_STATUS_SUCCESS) {
+        // Could not select a codecs using negotiated frames/packet, so try using default.
+        if (switch_core_codec_init(m_switchCodec, mediaFormat.GetEncodingName(), NULL, // FMTP
+                                   mediaFormat.GetClockRate(), 0, 1,  // Channels
+                                   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,   // Settings
+                                   switch_core_session_get_pool(m_fsSession)) != SWITCH_STATUS_SUCCESS) {
+            PTRACE(1, "mod_opal  " << switch_channel_get_name(m_fsChannel)<< " Cannot initialise " << (IsSink()? "read" : "write") << ' '
+                   << mediaFormat.GetMediaType() << " codec " << mediaFormat << " for connection " << *this);
+            switch_channel_hangup(m_fsChannel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
+            return false;
+        }
+        PTRACE(2, "mod_opal " << switch_channel_get_name(m_fsChannel)<< " Unsupported ptime of " << ptime << " on " << (IsSink()? "read" : "write") << ' '
+               << mediaFormat.GetMediaType() << " codec " << mediaFormat << " for connection " << *this);
+    }
+
+    PTRACE(1, "mod_opal " << switch_channel_get_name(m_fsChannel)<< " initialise " << 
+           switch_channel_get_name(m_fsChannel) << (IsSink()? "read" : "write") << ' '
+           << mediaFormat.GetMediaType() << " codec " << mediaFormat << " for connection " << *this);
+
+    if (IsSink()) {
+        m_readFrame.rate = mediaFormat.GetClockRate();
+
+        if (isAudio) {
+            switch_core_session_set_read_codec(m_fsSession, m_switchCodec);
+            if (switch_core_timer_init(m_switchTimer,
+                                       "soft",
+                                       m_switchCodec->implementation->microseconds_per_packet / 1000,
+                                       m_switchCodec->implementation->samples_per_packet,
+                                       switch_core_session_get_pool(m_fsSession)) != SWITCH_STATUS_SUCCESS) {
+                switch_core_codec_destroy(m_switchCodec);
+                m_switchCodec = NULL;
+                return false;
+            }
+        } else {
+            switch_core_session_set_video_read_codec(m_fsSession, m_switchCodec);
+            switch_channel_set_flag(m_fsChannel, CF_VIDEO);
+        }
+    } else {
+        if (isAudio) {
+            switch_core_session_set_write_codec(m_fsSession, m_switchCodec);
+        } else {
+            switch_core_session_set_video_write_codec(m_fsSession, m_switchCodec);
+            switch_channel_set_flag(m_fsChannel, CF_VIDEO);
+        }
+    }
+
+    PTRACE(3, "mod_opal\tSet " << (IsSink()? "read" : "write") << ' '
+           << mediaFormat.GetMediaType() << " codec to << " << mediaFormat << " for connection " << *this);
+
+    return OpalMediaStream::Open();
+}
+
+
+PBoolean FSMediaStream::Close()
+{
+    if (!IsOpen())
+        return false;
+
+    /* forget these FS will properly destroy them for us */
+
+    m_switchTimer = NULL;
+    m_switchCodec = NULL;
+
+    return OpalMediaStream::Close();
+}
+
+
+PBoolean FSMediaStream::IsSynchronous() const
+{
+    return true;
+}
+
+
+PBoolean FSMediaStream::RequiresPatchThread(OpalMediaStream *) const
+{
+    return false;
+}
+
+bool FSMediaStream::CheckPatchAndLock()
+{
+    if (GetConnection().GetPhase() >= GetConnection().ReleasingPhase || !IsOpen())
+        return false;
+
+    if (LockReadWrite()) {
+        if (!GetPatch() || !IsOpen()) {
+            UnlockReadWrite();
+            return false;
+        }
+        return true;
+    } else {
+        return false;
+    }
+}
+
+switch_status_t FSMediaStream::read_frame(switch_frame_t **frame, switch_io_flag_t flags)
+{
+
+    if (!m_switchCodec) {
+        return SWITCH_STATUS_FALSE;
+    }
+
+    if (m_callOnStart) {
+        /*
+          There is a race here... sometimes we make it here and GetPatch() is NULL
+          if we wait it shows up in 1ms, maybe there is a better way to wait.
+          
+        */
+        while(!GetPatch()) {
+            if (!m_fsChannel || !switch_channel_up(m_fsChannel)) {
+                return SWITCH_STATUS_FALSE;
+            }
+            switch_cond_next();
+        }
+        if (CheckPatchAndLock()) {
+            GetPatch()->OnStartMediaPatch();
+            m_callOnStart = false;
+            UnlockReadWrite();
+        } else {
+            return SWITCH_STATUS_FALSE; 
+        }
+    }
+
+    m_readFrame.flags = 0;
+
+    /*
+    while (switch_channel_ready(m_fsChannel)) {
+        if (CheckPatchAndLock()) {
+            if (!GetPatch()->GetSource().ReadPacket(m_readRTP)) {
+                UnlockReadWrite();
+                return SWITCH_STATUS_FALSE;
+            }            
+            UnlockReadWrite();
+        } else {
+            return SWITCH_STATUS_FALSE; 
+        }
+        
+        if ((m_readFrame.datalen = m_readRTP.GetPayloadSize()) || switch_core_timer_check(&m_switchTimer, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
+            if (m_readFrame.datalen) {
+            } else {
+                m_readFrame.flags = SFF_CNG;
+            }
+            break;
+        }
+
+        switch_yield(1000);
+    }
+    */
+
+    if (switch_channel_test_private_flag(m_fsChannel, CF_NEED_FLUSH)) {
+        switch_channel_clear_private_flag(m_fsChannel, CF_NEED_FLUSH);
+        for(;;) {
+            if (CheckPatchAndLock()) {
+                if (!GetPatch()->GetSource().ReadPacket(m_readRTP)) {
+                    UnlockReadWrite();
+                    return SWITCH_STATUS_FALSE;
+                }            
+                UnlockReadWrite();
+            } else {
+                return SWITCH_STATUS_FALSE; 
+            }
+
+            if (!m_readRTP.GetPayloadSize()) {
+                m_readFrame.flags = SFF_CNG;
+                break;
+            }
+        }
+    } else {
+
+        if (CheckPatchAndLock()) {
+            if (!m_switchTimer || !GetPatch()->GetSource().ReadPacket(m_readRTP)) {
+                UnlockReadWrite();
+                return SWITCH_STATUS_FALSE;
+            }            
+            UnlockReadWrite();
+        } else {
+            return SWITCH_STATUS_FALSE; 
+        }
+    
+        switch_core_timer_next(m_switchTimer);
+    
+        if (!(m_readFrame.datalen = m_readRTP.GetPayloadSize())) {
+            m_readFrame.flags = SFF_CNG;
+        }
+    }
+
+    if (!switch_channel_ready(m_fsChannel)) {
+        return SWITCH_STATUS_FALSE;
+    }
+
+    if (!switch_core_codec_ready(m_switchCodec)) {
+        return SWITCH_STATUS_FALSE;
+    }
+
+    //switch_core_timer_step(&m_switchTimer);
+
+    if (m_readFrame.payload == RTP_DataFrame::CN || m_readFrame.payload == RTP_DataFrame::Cisco_CN) {
+        m_readFrame.flags = SFF_CNG;
+    }
+
+    if (m_readFrame.flags & SFF_CNG) {
+        m_readFrame.buflen = sizeof(m_buf);
+        m_readFrame.data = m_buf;
+        m_readFrame.packet = NULL;
+        m_readFrame.packetlen = 0;
+        m_readFrame.timestamp = 0;
+        m_readFrame.m = SWITCH_FALSE;
+        m_readFrame.seq = 0;
+        m_readFrame.ssrc = 0;
+        m_readFrame.codec = m_switchCodec;
+    } else {
+        m_readFrame.buflen = m_readRTP.GetSize();
+        m_readFrame.data = m_readRTP.GetPayloadPtr();
+        m_readFrame.packet = m_readRTP.GetPointer();
+        m_readFrame.packetlen = m_readRTP.GetHeaderSize() + m_readFrame.datalen;
+        m_readFrame.payload = (switch_payload_t) m_readRTP.GetPayloadType();
+        m_readFrame.timestamp = m_readRTP.GetTimestamp();
+        m_readFrame.m = (switch_bool_t) m_readRTP.GetMarker();
+        m_readFrame.seq = m_readRTP.GetSequenceNumber();
+        m_readFrame.ssrc = m_readRTP.GetSyncSource();
+        m_readFrame.codec = m_switchCodec;
+    }
+
+    *frame = &m_readFrame;
+
+    return SWITCH_STATUS_SUCCESS;
+}
+
+
+switch_status_t FSMediaStream::write_frame(const switch_frame_t *frame, switch_io_flag_t flags)
+{
+    if (!switch_channel_ready(m_fsChannel)) {
+        return SWITCH_STATUS_FALSE;
+    }
+
+    if (m_callOnStart) {
+        if (CheckPatchAndLock()) {
+            GetPatch()->OnStartMediaPatch();
+            m_callOnStart = false;
+            UnlockReadWrite();
+        } else {
+            return SWITCH_STATUS_FALSE; 
+        }
+    }
+
+    if ((frame->flags & SFF_CNG)) {
+        return SWITCH_STATUS_SUCCESS;
+    }
+
+    if ((frame->flags & SFF_RAW_RTP) != 0) {
+        RTP_DataFrame rtp((const BYTE *) frame->packet, frame->packetlen, false);
+
+        if (CheckPatchAndLock()) {
+            if (GetPatch()->PushFrame(rtp)) {
+                UnlockReadWrite();
+                return SWITCH_STATUS_SUCCESS;
+            }
+            UnlockReadWrite();
+        } else {
+            return SWITCH_STATUS_FALSE; 
+        }
+    } 
+    
+    /* If we reach this code it means a call to an ivr or something else that does not generate timestamps
+       Its possible that frame->timestamp is set but not guarenteed and is best ignored for the time being.
+       We are probably relying on the rtp stack to generate the timestamp and ssrc for us at this point.
+       As a quick hack I am going to keep a sample counter and increment it by frame->samples but it would be 
+       better if we could engage whatever it is in opal that makes it generate the timestamp.
+     */
+
+    RTP_DataFrame rtp(frame->datalen);
+    rtp.SetPayloadType(mediaFormat.GetPayloadType());
+
+    m_timeStamp += frame->samples;
+    rtp.SetTimestamp(m_timeStamp);
+    
+    //rtp.SetTimestamp(frame->timestamp);
+    //rtp.SetSyncSource(frame->ssrc);
+    //rtp.SetMarker(frame->m);
+
+    memcpy(rtp.GetPayloadPtr(), frame->data, frame->datalen);
+
+    if (CheckPatchAndLock()) {
+        if (GetPatch()->PushFrame(rtp)) {
+            UnlockReadWrite();
+            return SWITCH_STATUS_SUCCESS;
+        }
+        UnlockReadWrite();
+    } else {
+        return SWITCH_STATUS_FALSE; 
+    }
+
+
+    return SWITCH_STATUS_FALSE;
+}
+
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:nil
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:s:
+ */
Property changes on: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_opal/mod_opal.cpp
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_opal/mod_opal.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_opal/mod_opal.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_opal/mod_opal.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -54,101 +54,97 @@
 
 
 struct mod_opal_globals {
-    int trace_level;
-    char *codec_string;
-    char *context;
-    char *dialplan;
+	int trace_level;
+	char *codec_string;
+	char *context;
+	char *dialplan;
 };
 
 extern struct mod_opal_globals mod_opal_globals;
 
 
-class FSProcess : public PLibraryProcess {
-    PCLASSINFO(FSProcess, PLibraryProcess);
+class FSProcess:public PLibraryProcess {
+	PCLASSINFO(FSProcess, PLibraryProcess);
 
- public:
-    FSProcess();
-    ~FSProcess();
+  public:
+	FSProcess();
+	~FSProcess();
 
-    bool Initialise(switch_loadable_module_interface_t *iface);
+	bool Initialise(switch_loadable_module_interface_t *iface);
 
-    FSManager & GetManager() const { return *m_manager; }
-
-  protected:
-    FSManager * m_manager;
+	     FSManager & GetManager() const {
+		return *m_manager;
+  } protected:
+	      FSManager * m_manager;
 };
 
 
 struct FSListener {
-    FSListener() {
-    }
-
-    PString name;
-    OpalTransportAddress listenAddress;
-    PString localUserName;
-    PString gatekeeper;
+	FSListener() {
+	} PString name;
+	OpalTransportAddress listenAddress;
+	PString localUserName;
+	PString gatekeeper;
 };
 
 
-class FSCall : public OpalCall {
-    PCLASSINFO(FSCall, OpalCall);
+class FSCall:public OpalCall {
+	PCLASSINFO(FSCall, OpalCall);
   public:
-    FSCall(OpalManager & manager);
-    virtual PBoolean OnSetUp(OpalConnection & connection);
+	FSCall(OpalManager & manager);
+	virtual PBoolean OnSetUp(OpalConnection & connection);
 };
 
 
-class FSManager : public OpalManager {
-    PCLASSINFO(FSManager, OpalManager);
+class FSManager:public OpalManager {
+	PCLASSINFO(FSManager, OpalManager);
 
- public:
-    FSManager();
+  public:
+	FSManager();
 
-    bool Initialise(switch_loadable_module_interface_t *iface);
+	bool Initialise(switch_loadable_module_interface_t *iface);
 
-    switch_status_t ReadConfig(int reload);
+	switch_status_t ReadConfig(int reload);
 
-    switch_endpoint_interface_t *GetSwitchInterface() const {
-        return m_FreeSwitch;
-    }
+	switch_endpoint_interface_t *GetSwitchInterface() const {
+		return m_FreeSwitch;
+	} virtual OpalCall *CreateCall(void *userData);
 
-    virtual OpalCall * CreateCall(void * userData);
-
   private:
-    switch_endpoint_interface_t *m_FreeSwitch;
+	switch_endpoint_interface_t *m_FreeSwitch;
 
-    H323EndPoint *m_h323ep;
-    IAX2EndPoint *m_iaxep;
-    FSEndPoint   *m_fsep;
+	H323EndPoint *m_h323ep;
+	IAX2EndPoint *m_iaxep;
+	FSEndPoint *m_fsep;
 
-    PString m_gkAddress;
-    PString m_gkIdentifer;
-    PString m_gkInterface;
+	PString m_gkAddress;
+	PString m_gkIdentifer;
+	PString m_gkInterface;
 
-    list < FSListener > m_listeners;
+	        list < FSListener > m_listeners;
 };
 
 
 class FSConnection;
 typedef struct {
-    switch_timer_t read_timer;
-    switch_codec_t read_codec;
-    switch_codec_t write_codec;
+	switch_timer_t read_timer;
+	switch_codec_t read_codec;
+	switch_codec_t write_codec;
 
-    switch_timer_t vid_read_timer;
-    switch_codec_t vid_read_codec;
-    switch_codec_t vid_write_codec;
-    FSConnection *me;
+	switch_timer_t vid_read_timer;
+	switch_codec_t vid_read_codec;
+	switch_codec_t vid_write_codec;
+	FSConnection *me;
 } opal_private_t;
 
 
 class FSEndPoint:public OpalLocalEndPoint {
-    PCLASSINFO(FSEndPoint, OpalLocalEndPoint);
- public:
-    FSEndPoint(FSManager & manager);
+	PCLASSINFO(FSEndPoint, OpalLocalEndPoint);
+  public:
+	FSEndPoint(FSManager & manager);
 
-    virtual bool OnIncomingCall(OpalLocalConnection &);
-    virtual OpalLocalConnection *CreateConnection(OpalCall & call, void * userData, unsigned options, OpalConnection::StringOptions* stringOptions);
+	virtual bool OnIncomingCall(OpalLocalConnection &);
+	virtual OpalLocalConnection *CreateConnection(OpalCall & call, void *userData, unsigned options, OpalConnection::StringOptions * stringOptions);
 };
 
 
@@ -174,93 +170,89 @@
 
 
 class FSConnection:public OpalLocalConnection {
-    PCLASSINFO(FSConnection, OpalLocalConnection)
+	PCLASSINFO(FSConnection, OpalLocalConnection)
 
   public:
-    FSConnection(OpalCall & call,
-                 FSEndPoint & endpoint,
-                 void* userData,
-                 unsigned options,
-                 OpalConnection::StringOptions* stringOptions,
-                 switch_caller_profile_t *outbound_profile,
-                 switch_core_session_t *fsSession,
-                 switch_channel_t *fsChannel);
+	FSConnection(OpalCall & call,
+				 FSEndPoint & endpoint,
+				 void *userData,
+				 unsigned options,
+				 OpalConnection::StringOptions * stringOptions,
+				 switch_caller_profile_t *outbound_profile, switch_core_session_t *fsSession, switch_channel_t *fsChannel);
 
-    virtual bool OnIncoming();
-    virtual void OnReleased();
-    virtual PBoolean SetAlerting(const PString & calleeName, PBoolean withMedia);
-    virtual void OnAlerting();
-    virtual void OnEstablished();
-    virtual OpalMediaStream *CreateMediaStream(const OpalMediaFormat &, unsigned, PBoolean);
-    virtual PBoolean OnOpenMediaStream(OpalMediaStream & stream);
-    virtual OpalMediaFormatList GetMediaFormats() const;
-    virtual PBoolean SendUserInputTone(char tone, unsigned duration);
-    virtual PBoolean SendUserInputString(const PString & value);
+	virtual bool OnIncoming();
+	virtual void OnReleased();
+	virtual PBoolean SetAlerting(const PString & calleeName, PBoolean withMedia);
+	virtual void OnAlerting();
+	virtual void OnEstablished();
+	virtual OpalMediaStream *CreateMediaStream(const OpalMediaFormat &, unsigned, PBoolean);
+	virtual PBoolean OnOpenMediaStream(OpalMediaStream & stream);
+	virtual OpalMediaFormatList GetMediaFormats() const;
+	virtual PBoolean SendUserInputTone(char tone, unsigned duration);
+	virtual PBoolean SendUserInputString(const PString & value);
 
-    void SetCodecs();
+	void SetCodecs();
 
-    DECLARE_CALLBACK0(on_init);
-    DECLARE_CALLBACK0(on_routing);
-    DECLARE_CALLBACK0(on_execute);
+	     DECLARE_CALLBACK0(on_init);
+	     DECLARE_CALLBACK0(on_routing);
+	     DECLARE_CALLBACK0(on_execute);
 
-    DECLARE_CALLBACK0(on_exchange_media);
-    DECLARE_CALLBACK0(on_soft_execute);
+	     DECLARE_CALLBACK0(on_exchange_media);
+	     DECLARE_CALLBACK0(on_soft_execute);
 
-    DECLARE_CALLBACK1(kill_channel, int, sig);
-    DECLARE_CALLBACK1(send_dtmf, const switch_dtmf_t *, dtmf);
-    DECLARE_CALLBACK1(receive_message, switch_core_session_message_t *, msg);
-    DECLARE_CALLBACK1(receive_event, switch_event_t *, event);
-    DECLARE_CALLBACK0(state_change);
-    DECLARE_CALLBACK3(read_audio_frame, switch_frame_t **, frame, switch_io_flag_t, flags, int, stream_id);
-    DECLARE_CALLBACK3(write_audio_frame, switch_frame_t *, frame, switch_io_flag_t, flags, int, stream_id);
-    DECLARE_CALLBACK3(read_video_frame, switch_frame_t **, frame, switch_io_flag_t, flag, int, stream_id);
-    DECLARE_CALLBACK3(write_video_frame, switch_frame_t *, frame, switch_io_flag_t, flag, int, stream_id);
+	     DECLARE_CALLBACK1(kill_channel, int, sig);
+	    DECLARE_CALLBACK1(send_dtmf, const switch_dtmf_t *, dtmf);
+	              DECLARE_CALLBACK1(receive_message, switch_core_session_message_t *, msg);
+	                              DECLARE_CALLBACK1(receive_event, switch_event_t *, event);
+	               DECLARE_CALLBACK0(state_change);
+	               DECLARE_CALLBACK3(read_audio_frame, switch_frame_t **, frame, switch_io_flag_t, flags, int, stream_id);
+	    DECLARE_CALLBACK3(write_audio_frame, switch_frame_t *, frame, switch_io_flag_t, flags, int, stream_id);
+	    DECLARE_CALLBACK3(read_video_frame, switch_frame_t **, frame, switch_io_flag_t, flag, int, stream_id);
+	    DECLARE_CALLBACK3(write_video_frame, switch_frame_t *, frame, switch_io_flag_t, flag, int, stream_id);
 
-    switch_status_t read_frame(const OpalMediaType & mediaType, switch_frame_t **frame, switch_io_flag_t flags);
-    switch_status_t write_frame(const OpalMediaType & mediaType, const switch_frame_t *frame, switch_io_flag_t flags);
+	switch_status_t read_frame(const OpalMediaType & mediaType, switch_frame_t **frame, switch_io_flag_t flags);
+	switch_status_t write_frame(const OpalMediaType & mediaType, const switch_frame_t *frame, switch_io_flag_t flags);
 
-    switch_core_session_t *GetSession() const {
-        return m_fsSession;
-    }
-
-  private:
-    FSEndPoint & m_endpoint;
-    switch_core_session_t *m_fsSession;
-    switch_channel_t *m_fsChannel;
-    PSyncPoint m_rxAudioOpened;
-    PSyncPoint m_txAudioOpened;
-    OpalMediaFormatList m_switchMediaFormats;
+	switch_core_session_t *GetSession() const {
+		return m_fsSession;
+  } private:
+	      FSEndPoint & m_endpoint;
+	switch_core_session_t *m_fsSession;
+	switch_channel_t *m_fsChannel;
+	PSyncPoint m_rxAudioOpened;
+	PSyncPoint m_txAudioOpened;
+	OpalMediaFormatList m_switchMediaFormats;
 };
 
 
 class FSMediaStream:public OpalMediaStream {
-    PCLASSINFO(FSMediaStream, OpalMediaStream);
- public:
-    FSMediaStream(FSConnection & conn, const OpalMediaFormat & mediaFormat, ///<  Media format for stream
-                  unsigned sessionID,   ///<  Session number for stream
-                  bool isSource ///<  Is a source stream
-                  );
+	PCLASSINFO(FSMediaStream, OpalMediaStream);
+  public:
+	FSMediaStream(FSConnection & conn, const OpalMediaFormat & mediaFormat,	///<  Media format for stream
+				  unsigned sessionID,	///<  Session number for stream
+				  bool isSource	///<  Is a source stream
+		);
 
-    virtual PBoolean Open();
-    virtual PBoolean Close();
-    virtual PBoolean IsSynchronous() const;
-    virtual PBoolean RequiresPatchThread(OpalMediaStream *) const;
+	virtual PBoolean Open();
+	virtual PBoolean Close();
+	virtual PBoolean IsSynchronous() const;
+	virtual PBoolean RequiresPatchThread(OpalMediaStream *) const;
 
-    switch_status_t read_frame(switch_frame_t **frame, switch_io_flag_t flags);
-    switch_status_t write_frame(const switch_frame_t *frame, switch_io_flag_t flags);
+	switch_status_t read_frame(switch_frame_t **frame, switch_io_flag_t flags);
+	switch_status_t write_frame(const switch_frame_t *frame, switch_io_flag_t flags);
 
- private:
-    switch_core_session_t *m_fsSession;
-    switch_channel_t *m_fsChannel;
-    switch_timer_t *m_switchTimer;
-    switch_codec_t *m_switchCodec;
-    switch_frame_t m_readFrame;
-    unsigned char m_buf[SWITCH_RECOMMENDED_BUFFER_SIZE];
-    RTP_DataFrame m_readRTP;
-    bool m_callOnStart;
-    uint32_t m_timeStamp;
+  private:
+	switch_core_session_t *m_fsSession;
+	switch_channel_t *m_fsChannel;
+	switch_timer_t *m_switchTimer;
+	switch_codec_t *m_switchCodec;
+	switch_frame_t m_readFrame;
+	unsigned char m_buf[SWITCH_RECOMMENDED_BUFFER_SIZE];
+	RTP_DataFrame m_readRTP;
+	bool m_callOnStart;
+	uint32_t m_timeStamp;
 
-    bool CheckPatchAndLock();
+	bool CheckPatchAndLock();
 };
 
 
Property changes on: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_opal/mod_opal.h
___________________________________________________________________
Name: svn:eol-style
   + native

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_portaudio


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Win32
x64
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Win32
x64
Makefile.in
.deps
Makefile
mod_portaudio.log

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_portaudio/Makefile

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_portaudio/Makefile.am (from rev 16612, freeswitch/trunk/src/mod/endpoints/mod_portaudio/Makefile.am) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_portaudio/Makefile.am	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_portaudio/Makefile.am	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,25 @@
+include $(top_srcdir)/build/modmake.rulesam
+
+MODNAME=mod_portaudio
+PA_DIR=$(switch_srcdir)/libs/portaudio
+PALA=$(switch_builddir)/libs/portaudio/lib/libportaudio.la
+
+mod_LTLIBRARIES = mod_portaudio.la
+mod_portaudio_la_SOURCES = mod_portaudio.c pablio.c pa_ringbuffer.c
+mod_portaudio_la_CFLAGS  = $(AM_CFLAGS)
+mod_portaudio_la_CFLAGS += -I. -I$(PA_DIR)/include -D__EXTENSION__=1 
+mod_portaudio_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(PALA)
+mod_portaudio_la_LDFLAGS = -avoid-version -module -no-undefined -shared $(PA_LIBS)
+
+if ISMAC
+mod_portaudio_la_LDFLAGS += -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon
+endif
+
+BUILT_SOURCES = $(PALA)
+
+$(mod_portaudio_la_SOURCES) : $(BUILT_SOURCES)
+
+$(PALA): $(PA_DIR) $(PA_DIR)/.update
+	cd $(switch_builddir)/libs/portaudio && $(MAKE) PORTAUDIO_CFLAGS="$(SWITCH_AM_CFLAGS)"
+	$(TOUCH_TARGET)
+

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_portaudio/mod_portaudio.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_portaudio/mod_portaudio.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_portaudio/mod_portaudio.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -39,6 +39,9 @@
 #include <string.h>
 
 #define MY_EVENT_RINGING "portaudio::ringing"
+#define MY_EVENT_MAKE_CALL "portaudio::makecall"
+#define MY_EVENT_ERROR_AUDIO_DEV "portaudio::audio_dev_error"
+#define SWITCH_PA_CALL_ID_VARIABLE "pa_call_id"
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_portaudio_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_portaudio_shutdown);
@@ -156,7 +159,8 @@
 static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
 static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
-													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
+													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+													switch_call_cause_t *cancel_cause);
 static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
 static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
 static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
@@ -313,13 +317,15 @@
 
 static switch_status_t channel_on_routing(switch_core_session_t *session)
 {
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n", switch_channel_get_name(switch_core_session_get_channel(session)));
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n",
+					  switch_channel_get_name(switch_core_session_get_channel(session)));
 	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t channel_on_execute(switch_core_session_t *session)
 {
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n",
+					  switch_channel_get_name(switch_core_session_get_channel(session)));
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -347,7 +353,7 @@
 }
 
 
-static void destroy_codecs(void) 
+static void destroy_codecs(void)
 {
 
 	if (switch_core_codec_ready(&globals.read_codec)) {
@@ -401,6 +407,7 @@
 	if (*tech_pvt->call_id == '\0') {
 		switch_mutex_lock(globals.pa_mutex);
 		switch_snprintf(tech_pvt->call_id, sizeof(tech_pvt->call_id), "%d", ++globals.call_id);
+		switch_channel_set_variable(switch_core_session_get_channel(tech_pvt->session), SWITCH_PA_CALL_ID_VARIABLE, tech_pvt->call_id);
 		switch_core_hash_insert(globals.call_hash, tech_pvt->call_id, tech_pvt);
 		switch_core_session_set_read_codec(tech_pvt->session, &globals.read_codec);
 		switch_core_session_set_write_codec(tech_pvt->session, &globals.write_codec);
@@ -482,7 +489,7 @@
 {
 	private_t *tech_pvt = switch_core_session_get_private(session);
 	switch_assert(tech_pvt != NULL);
-	
+
 	switch_mutex_lock(globals.pa_mutex);
 	switch_core_hash_delete(globals.call_hash, tech_pvt->call_id);
 	switch_mutex_unlock(globals.pa_mutex);
@@ -494,7 +501,8 @@
 
 	tech_close_file(tech_pvt);
 
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(switch_core_session_get_channel(session)));
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n",
+					  switch_channel_get_name(switch_core_session_get_channel(session)));
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -559,11 +567,11 @@
 	if (!switch_test_flag(tech_pvt, TFLAG_IO)) {
 		goto cng_wait;
 	}
-	
+
 	if (!is_master(tech_pvt)) {
 		if (tech_pvt->hold_file) {
 			switch_size_t olen = globals.read_codec.implementation->samples_per_packet;
-			
+
 			if (!tech_pvt->hfh) {
 				int sample_rate = globals.sample_rate;
 				if (switch_core_file_open(&tech_pvt->fh,
@@ -608,12 +616,11 @@
 	if (tech_pvt->hfh) {
 		tech_close_file(tech_pvt);
 	}
-	
+
 	switch_mutex_lock(globals.device_lock);
-	samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data,
-							  globals.read_codec.implementation->samples_per_packet, &globals.read_timer);
+	samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data, globals.read_codec.implementation->samples_per_packet, &globals.read_timer);
 	switch_mutex_unlock(globals.device_lock);
-	
+
 	if (samples) {
 		globals.read_frame.datalen = samples * 2;
 		globals.read_frame.samples = samples;
@@ -627,19 +634,19 @@
 	} else {
 		goto cng_nowait;
 	}
-	
- normal_return:
+
+  normal_return:
 	return status;
 
- cng_nowait:
+  cng_nowait:
 	*frame = &globals.cng_frame;
 	return SWITCH_STATUS_SUCCESS;
 
- cng_wait:
+  cng_wait:
 	switch_core_timer_next(&globals.hold_timer);
 	*frame = &globals.cng_frame;
 	return SWITCH_STATUS_SUCCESS;
-	
+
 }
 
 static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
@@ -702,13 +709,12 @@
 	/*.on_hangup */ channel_on_hangup,
 	/*.on_exchange_media */ channel_on_exchange_media,
 	/*.on_soft_execute */ channel_on_soft_execute,
-	/*.on_consume_media*/ NULL,
-    /*.on_hibernate*/ NULL,
-    /*.on_reset*/ NULL,
-    /*.on_park*/ NULL,
-    /*.on_reporting*/ NULL,
-    /*.on_destroy*/ channel_on_destroy
-
+	/*.on_consume_media */ NULL,
+	/*.on_hibernate */ NULL,
+	/*.on_reset */ NULL,
+	/*.on_park */ NULL,
+	/*.on_reporting */ NULL,
+	/*.on_destroy */ channel_on_destroy
 };
 
 switch_io_routines_t portaudio_io_routines = {
@@ -725,7 +731,8 @@
 */
 static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
-													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
+													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+													switch_call_cause_t *cancel_cause)
 {
 
 	if ((*new_session = switch_core_session_request(portaudio_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
@@ -767,7 +774,6 @@
 			return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
 		}
 
-		switch_channel_set_flag(channel, CF_OUTBOUND);
 		switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
 		switch_channel_set_state(channel, CS_INIT);
 		return SWITCH_CAUSE_SUCCESS;
@@ -804,7 +810,7 @@
 #if defined(sun) || defined(__sun)
 	globals.dual_streams = 0;
 #endif
-	
+
 	if ((status = load_config()) != SWITCH_STATUS_SUCCESS) {
 		return status;
 	}
@@ -824,7 +830,17 @@
 		return SWITCH_STATUS_GENERR;
 	}
 
+	if (switch_event_reserve_subclass(MY_EVENT_MAKE_CALL) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass!\n");
+		return SWITCH_STATUS_GENERR;
+	}
 
+	if (switch_event_reserve_subclass(MY_EVENT_ERROR_AUDIO_DEV) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass!\n");
+		return SWITCH_STATUS_GENERR;
+	}
+
+
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	portaudio_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
@@ -933,9 +949,9 @@
 	}
 
 	if (!globals.dialplan) {
-		set_global_dialplan("default");
+		set_global_dialplan("XML");
 	}
-	
+
 	if (!globals.context) {
 		set_global_context("default");
 	}
@@ -994,12 +1010,14 @@
 	deactivate_audio_device();
 	deactivate_ring_device();
 	destroy_codecs();
-	
+
 	Pa_Terminate();
 	switch_core_hash_destroy(&globals.call_hash);
 
 	switch_event_free_subclass(MY_EVENT_RINGING);
-	
+	switch_event_free_subclass(MY_EVENT_MAKE_CALL);
+	switch_event_free_subclass(MY_EVENT_ERROR_AUDIO_DEV);
+
 	switch_safe_free(globals.dialplan);
 	switch_safe_free(globals.context);
 	switch_safe_free(globals.cid_name);
@@ -1119,21 +1137,22 @@
 		for (i = 0; i < numDevices; i++) {
 			deviceInfo = Pa_GetDeviceInfo(i);
 			hostApiInfo = Pa_GetHostApiInfo(deviceInfo->hostApi);
-			stream->write_function(stream, "\t\t<device id=\"%d\" name=\"%s\" hostapi=\"%s\" inputs=\"%d\" outputs=\"%d\" />\n", i, deviceInfo->name, hostApiInfo->name, deviceInfo->maxInputChannels, deviceInfo->maxOutputChannels);
+			stream->write_function(stream, "\t\t<device id=\"%d\" name=\"%s\" hostapi=\"%s\" inputs=\"%d\" outputs=\"%d\" />\n", i, deviceInfo->name,
+								   hostApiInfo->name, deviceInfo->maxInputChannels, deviceInfo->maxOutputChannels);
 		}
 
 		stream->write_function(stream, "\t</devices>\n\t<bindings>\n"
-				"\t\t<ring device=\"%d\" />\n"
-				"\t\t<input device=\"%d\" />\n"
-				"\t\t<output device=\"%d\" />\n"
-				"\t</bindings>\n</xml>\n", globals.ringdev, globals.indev, globals.outdev);
+							   "\t\t<ring device=\"%d\" />\n"
+							   "\t\t<input device=\"%d\" />\n"
+							   "\t\t<output device=\"%d\" />\n" "\t</bindings>\n</xml>\n", globals.ringdev, globals.indev, globals.outdev);
 	} else {
 
 		for (i = 0; i < numDevices; i++) {
 			deviceInfo = Pa_GetDeviceInfo(i);
 			hostApiInfo = Pa_GetHostApiInfo(deviceInfo->hostApi);
 
-			stream->write_function(stream, "%d;%s(%s);%d;%d;", i, deviceInfo->name, hostApiInfo->name, deviceInfo->maxInputChannels, deviceInfo->maxOutputChannels);
+			stream->write_function(stream, "%d;%s(%s);%d;%d;", i, deviceInfo->name, hostApiInfo->name, deviceInfo->maxInputChannels,
+								   deviceInfo->maxOutputChannels);
 
 			prev = 0;
 			if (globals.ringdev == i) {
@@ -1252,7 +1271,7 @@
 		inputParameters.sampleFormat = paInt16;
 		inputParameters.suggestedLatency = deviceInfo->defaultLowInputLatency;	/* ignored by Pa_IsFormatSupported() */
 		inputParameters.hostApiSpecificStreamInfo = NULL;
-		
+
 		outputParameters.device = i;
 		outputParameters.channelCount = deviceInfo->maxOutputChannels;
 		outputParameters.sampleFormat = paInt16;
@@ -1271,14 +1290,14 @@
 		}
 
 		if (inputParameters.channelCount > 0 && outputParameters.channelCount > 0) {
-			
+
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
 							  "full-duplex 16 bit %d channel input, %d channel output rates:", inputParameters.channelCount,
 							  outputParameters.channelCount);
 			PrintSupportedStandardSampleRates(&inputParameters, &outputParameters);
 		}
 	}
-	
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s", line);
 
 	return 0;
@@ -1296,6 +1315,7 @@
 	PaError err;
 	int sample_rate = globals.sample_rate;
 	int codec_ms = globals.codec_ms;
+	switch_event_t *event;
 
 	switch_mutex_lock(globals.device_lock);
 	while (globals.deactivate_timer > switch_epoch_time_now(NULL)) {
@@ -1338,8 +1358,7 @@
 		if (switch_core_codec_init(&globals.write_codec,
 								   "L16",
 								   NULL,
-								   sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
-								   NULL) != SWITCH_STATUS_SUCCESS) {
+								   sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
 			switch_core_codec_destroy(&globals.read_codec);
 			return SWITCH_STATUS_FALSE;
@@ -1411,7 +1430,7 @@
 	}
 
 	switch_mutex_unlock(globals.device_lock);
-		
+
 	if (err != paNoError) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open audio device\n");
 		switch_core_codec_destroy(&globals.read_codec);
@@ -1419,9 +1438,13 @@
 		switch_core_timer_destroy(&globals.read_timer);
 		switch_core_timer_destroy(&globals.write_timer);
 		switch_core_timer_destroy(&globals.hold_timer);
+		if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_ERROR_AUDIO_DEV) == SWITCH_STATUS_SUCCESS) {
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Reason", Pa_GetErrorText(err));
+			switch_event_fire(&event);
+		}
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Engage audio device rate: %d channels %d\n", sample_rate, outputParameters.channelCount);
 
 	engage_ring_device();
@@ -1431,7 +1454,7 @@
 
 static switch_status_t engage_ring_device(void)
 {
-	PaStreamParameters outputParameters = {0};
+	PaStreamParameters outputParameters = { 0 };
 	PaError err;
 	int sample_rate = globals.sample_rate;
 	int channels = 1;
@@ -1454,7 +1477,7 @@
 		outputParameters.sampleFormat = SAMPLE_TYPE;
 		outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency;
 		outputParameters.hostApiSpecificStreamInfo = NULL;
-		err = OpenAudioStream(&globals.ring_stream, NULL, 
+		err = OpenAudioStream(&globals.ring_stream, NULL,
 							  &outputParameters, sample_rate, paClipOff, globals.read_codec.implementation->samples_per_packet, globals.dual_streams);
 		/* UNLOCKED ************************************************************************************************* */
 		switch_mutex_unlock(globals.device_lock);
@@ -1469,7 +1492,7 @@
 	return SWITCH_STATUS_SUCCESS;
 
 
- error:
+  error:
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open ring device\n");
 	return SWITCH_STATUS_FALSE;
@@ -1505,8 +1528,8 @@
 	private_t *tp, *tech_pvt = NULL;
 	char *callid = argv[0];
 	uint8_t one_call = 0;
-	
 
+
 	switch_mutex_lock(globals.pvt_lock);
 	if (zstr(callid)) {
 		if (globals.call_list) {
@@ -1788,16 +1811,40 @@
 			switch_channel_mark_answered(channel);
 			switch_channel_set_state(channel, CS_INIT);
 			if (switch_core_session_thread_launch(tech_pvt->session) != SWITCH_STATUS_SUCCESS) {
+				switch_event_t *event;
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Error spawning thread\n");
 				switch_core_session_destroy(&session);
 				stream->write_function(stream, "FAIL:Thread Error!\n");
+				if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_MAKE_CALL) == SWITCH_STATUS_SUCCESS) {
+					char buf[512];
+					switch_channel_event_set_data(channel, event);
+					switch_snprintf(buf, sizeof(buf), "Thread error!.\n");
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "error", buf);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fail", "true");
+					switch_event_fire(&event);
+				}
 			} else {
+				switch_event_t *event;
 				add_pvt(tech_pvt, PA_MASTER);
 				stream->write_function(stream, "SUCCESS:%s:%s\n", tech_pvt->call_id, switch_core_session_get_uuid(tech_pvt->session));
+				if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_MAKE_CALL) == SWITCH_STATUS_SUCCESS) {
+					switch_channel_event_set_data(channel, event);
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fail", "false");
+					switch_event_fire(&event);
+				}
 			}
 		} else {
+			switch_event_t *event;
 			switch_core_session_destroy(&session);
 			stream->write_function(stream, "FAIL:Device Error!\n");
+			if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_MAKE_CALL) == SWITCH_STATUS_SUCCESS) {
+				char buf[512];
+				switch_channel_event_set_data(channel, event);
+				switch_snprintf(buf, sizeof(buf), "Device fail.\n");
+				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "error", buf);
+				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fail", "true");
+				switch_event_fire(&event);
+			}
 		}
 	}
 
@@ -1833,8 +1880,7 @@
 		"pa outdev #<num>|<partial name>\n"
 		"pa ringdev #<num>|<partial name>\n"
 		"pa play [ringtest|<filename>]\n"
-		"pa ringfile [filename]\n"
-		"pa looptest\n" "--------------------------------------------------------------------------------\n";
+		"pa ringfile [filename]\n" "pa looptest\n" "--------------------------------------------------------------------------------\n";
 
 
 	if (stream->param_event) {
@@ -1983,6 +2029,7 @@
 		char *playfile = NULL;
 		int samples = 0;
 		int seconds = 5;
+		int wrote = 0;
 
 		if (globals.call_list) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ERROR: Cannot use this command this while a call is in progress\n");
@@ -2004,30 +2051,35 @@
 									  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) == SWITCH_STATUS_SUCCESS) {
 				switch_size_t olen = globals.read_codec.implementation->samples_per_packet;
 				int16_t abuf[2048];
-				
+
 				if (argv[2]) {
 					int i = atoi(argv[2]);
-					if (i > 0) {
+					if (i >= 0) {
 						seconds = i;
 					}
 				}
 
 				samples = globals.read_codec.implementation->actual_samples_per_second * seconds;
-				stream->write_function(stream, "playback test [%s] %d second(s) %d samples @%dkhz", 
-									   playfile, seconds, samples, globals.read_codec.implementation->actual_samples_per_second);
-				
 				while (switch_core_file_read(&fh, abuf, &olen) == SWITCH_STATUS_SUCCESS) {
 					WriteAudioStream(globals.audio_stream, abuf, (long) olen, &globals.read_timer);
-					switch_core_timer_next(&globals.read_timer);
-					samples -= (int) olen;
-					if (samples <= 0) {
-						break;
+					wrote += (int) olen;
+					if (samples) {
+						samples -= (int) olen;
+						if (samples <= 0) {
+							break;
+						}
 					}
 					olen = globals.read_codec.implementation->samples_per_packet;
-				} 
+				}
 
 				switch_core_file_close(&fh);
 				deactivate_audio_device();
+
+				seconds = wrote / globals.read_codec.implementation->actual_samples_per_second;
+				stream->write_function(stream, "playback test [%s] %d second(s) %d samples @%dkhz",
+									   playfile, seconds, wrote, globals.read_codec.implementation->actual_samples_per_second);
+
+
 			} else {
 				stream->write_function(stream, "Cannot play requested file %s\n", argv[1]);
 			}
@@ -2045,9 +2097,9 @@
 			int samples = 0;
 			int success = 0;
 			int i;
-			for(i = 0; i < 400; i++) {
+			for (i = 0; i < 400; i++) {
 				if ((samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data,
-						globals.read_codec.implementation->samples_per_packet, &globals.read_timer))) {
+											   globals.read_codec.implementation->samples_per_packet, &globals.read_timer))) {
 					WriteAudioStream(globals.audio_stream, globals.read_frame.data, (long) samples, &globals.write_timer);
 					success = 1;
 				}
@@ -2066,10 +2118,10 @@
 			if (engage_device(0) == SWITCH_STATUS_SUCCESS) {
 				switch_file_handle_t fh = { 0 };
 				if (switch_core_file_open(&fh,
-							argv[1],
-							globals.read_codec.implementation->number_of_channels,
-							globals.read_codec.implementation->actual_samples_per_second,
-							SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) == SWITCH_STATUS_SUCCESS) {
+										  argv[1],
+										  globals.read_codec.implementation->number_of_channels,
+										  globals.read_codec.implementation->actual_samples_per_second,
+										  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) == SWITCH_STATUS_SUCCESS) {
 					switch_core_file_close(&fh);
 					set_global_ring_file(argv[1]);
 				} else {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_portaudio/pablio.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_portaudio/pablio.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_portaudio/pablio.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -56,12 +56,14 @@
 /************************************************************************/
 
 static int iblockingIOCallback(const void *inputBuffer, void *outputBuffer,
-							  unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo * timeInfo, PaStreamCallbackFlags statusFlags, void *userData);
-static int oblockingIOCallback(const void *inputBuffer, void *outputBuffer,
-							  unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo * timeInfo, PaStreamCallbackFlags statusFlags, void *userData);
+							   unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo * timeInfo, PaStreamCallbackFlags statusFlags,
+							   void *userData);
+static int oblockingIOCallback(const void *inputBuffer, void *outputBuffer, unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo * timeInfo,
+							   PaStreamCallbackFlags statusFlags, void *userData);
 
 static int ioblockingIOCallback(const void *inputBuffer, void *outputBuffer,
-								unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo * timeInfo, PaStreamCallbackFlags statusFlags, void *userData);
+								unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo * timeInfo, PaStreamCallbackFlags statusFlags,
+								void *userData);
 
 static PaError PABLIO_InitFIFO(PaUtilRingBuffer * rbuf, long numFrames, long bytesPerFrame);
 static PaError PABLIO_TermFIFO(PaUtilRingBuffer * rbuf);
@@ -74,7 +76,7 @@
  * Read and write data 
  */
 static int iblockingIOCallback(const void *inputBuffer, void *outputBuffer,
-							  unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo * timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
+							   unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo * timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
 {
 	PABLIO_Stream *data = (PABLIO_Stream *) userData;
 	long numBytes = data->bytesPerFrame * framesPerBuffer;
@@ -91,7 +93,7 @@
 }
 
 static int oblockingIOCallback(const void *inputBuffer, void *outputBuffer,
-							  unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo * timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
+							   unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo * timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
 {
 	PABLIO_Stream *data = (PABLIO_Stream *) userData;
 	long numBytes = data->bytesPerFrame * framesPerBuffer;
@@ -109,7 +111,8 @@
 }
 
 static int ioblockingIOCallback(const void *inputBuffer, void *outputBuffer,
-							  unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo * timeInfo, PaStreamCallbackFlags statusFlags, void *userData)
+								unsigned long framesPerBuffer, const PaStreamCallbackTimeInfo * timeInfo, PaStreamCallbackFlags statusFlags,
+								void *userData)
 {
 	iblockingIOCallback(inputBuffer, outputBuffer, framesPerBuffer, timeInfo, statusFlags, userData);
 	oblockingIOCallback(inputBuffer, outputBuffer, framesPerBuffer, timeInfo, statusFlags, userData);
@@ -151,7 +154,7 @@
 	bytesWritten = PaUtil_WriteRingBuffer(&aStream->outFIFO, p, numBytes);
 	numBytes -= bytesWritten;
 	p += bytesWritten;
-	
+
 	if (numBytes > 0) {
 		PaUtil_FlushRingBuffer(&aStream->outFIFO);
 		return 0;
@@ -172,7 +175,7 @@
 
 	switch_core_timer_next(timer);
 
-	while(totalBytes < neededBytes && --max > 0) {
+	while (totalBytes < neededBytes && --max > 0) {
 
 		avail = PaUtil_GetRingBufferReadAvailable(&aStream->inFIFO);
 		//printf("AVAILABLE BYTES %ld pass %d\n", avail, 5000 - max);
@@ -182,7 +185,7 @@
 		} else {
 
 			bytesRead = 0;
-			
+
 			if (totalBytes < neededBytes && avail >= neededBytes) {
 				bytesRead = PaUtil_ReadRingBuffer(&aStream->inFIFO, p, neededBytes);
 				totalBytes += bytesRead;
@@ -241,10 +244,7 @@
  */
 PaError OpenAudioStream(PABLIO_Stream ** rwblPtr,
 						const PaStreamParameters * inputParameters,
-						const PaStreamParameters * outputParameters, 
-						double sampleRate, PaStreamFlags streamFlags, 
-						long samples_per_packet,
-						int do_dual)
+						const PaStreamParameters * outputParameters, double sampleRate, PaStreamFlags streamFlags, long samples_per_packet, int do_dual)
 {
 	long bytesPerSample = 2;
 	PaError err;
@@ -261,7 +261,7 @@
 	aStream = (PABLIO_Stream *) malloc(sizeof(PABLIO_Stream));
 	switch_assert(aStream);
 	memset(aStream, 0, sizeof(PABLIO_Stream));
-	
+
 	if (inputParameters) {
 		channels = inputParameters->channelCount;
 	} else if (outputParameters) {
@@ -278,7 +278,7 @@
 		if (err != paNoError) {
 			goto error;
 		}
-		aStream-> has_in = 1;
+		aStream->has_in = 1;
 	}
 
 	if (outputParameters) {
@@ -286,13 +286,13 @@
 		if (err != paNoError) {
 			goto error;
 		}
-		aStream-> has_out = 1;
+		aStream->has_out = 1;
 	}
 
 	/* Open a PortAudio stream that we will use to communicate with the underlying
 	 * audio drivers. */
 
-	aStream->do_dual = do_dual;	
+	aStream->do_dual = do_dual;
 
 	if (aStream->do_dual) {
 		err = Pa_OpenStream(&aStream->istream, inputParameters, NULL, sampleRate, samples_per_packet, streamFlags, iblockingIOCallback, aStream);
@@ -304,16 +304,18 @@
 			goto error;
 		}
 	} else {
-		err = Pa_OpenStream(&aStream->iostream, inputParameters, outputParameters, sampleRate, samples_per_packet, streamFlags, ioblockingIOCallback, aStream);
+		err =
+			Pa_OpenStream(&aStream->iostream, inputParameters, outputParameters, sampleRate, samples_per_packet, streamFlags, ioblockingIOCallback,
+						  aStream);
 	}
 
 	if (err != paNoError) {
 		goto error;
 	}
-	
+
 	if (aStream->do_dual) {
 		err = Pa_StartStream(aStream->istream);
-		
+
 		if (err != paNoError) {
 			goto error;
 		}
@@ -335,7 +337,7 @@
 	*rwblPtr = aStream;
 
 	switch_yield(500000);
-	
+
 	return paNoError;
 
   error:
@@ -352,7 +354,7 @@
 	int bytesEmpty;
 	int byteSize;
 
-	
+
 	byteSize = aStream->outFIFO.bufferSize;
 
 	if (aStream->has_out) {
@@ -375,7 +377,7 @@
 			Pa_CloseStream(aStream->istream);
 			aStream->istream = NULL;
 		}
-		
+
 		if (aStream->has_out && aStream->ostream) {
 			if (Pa_IsStreamActive(aStream->ostream)) {
 				Pa_StopStream(aStream->ostream);
@@ -384,7 +386,7 @@
 			Pa_CloseStream(aStream->ostream);
 			aStream->ostream = NULL;
 		}
-		
+
 	} else {
 		if (aStream->iostream) {
 			if (Pa_IsStreamActive(aStream->iostream)) {
@@ -396,10 +398,10 @@
 		}
 	}
 
-	if (aStream->has_in) {	
+	if (aStream->has_in) {
 		PABLIO_TermFIFO(&aStream->inFIFO);
 	}
-	
+
 	if (aStream->has_out) {
 		PABLIO_TermFIFO(&aStream->outFIFO);
 	}
@@ -409,4 +411,3 @@
 
 	return paNoError;
 }
-

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_portaudio/pablio.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_portaudio/pablio.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_portaudio/pablio.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -109,7 +109,7 @@
  */
 	PaError OpenAudioStream(PABLIO_Stream ** rwblPtr,
 							const PaStreamParameters * inputParameters,
-							const PaStreamParameters * outputParameters, 
+							const PaStreamParameters * outputParameters,
 							double sampleRate, PaStreamCallbackFlags statusFlags, long samples_per_packet, int do_dual);
 
 	PaError CloseAudioStream(PABLIO_Stream * aStream);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_reference/mod_reference.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_reference/mod_reference.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_reference/mod_reference.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -106,7 +106,8 @@
 static switch_status_t channel_on_soft_execute(switch_core_session_t *session);
 static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
-													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
+													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+													switch_call_cause_t *cancel_cause);
 static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
 static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
 static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
@@ -200,7 +201,7 @@
 		if (switch_core_codec_ready(&tech_pvt->read_codec)) {
 			switch_core_codec_destroy(&tech_pvt->read_codec);
 		}
-		
+
 		if (switch_core_codec_ready(&tech_pvt->write_codec)) {
 			switch_core_codec_destroy(&tech_pvt->write_codec);
 		}
@@ -414,7 +415,8 @@
 */
 static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
-													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
+													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+													switch_call_cause_t *cancel_cause)
 {
 	if ((*new_session = switch_core_session_request(reference_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
 		private_t *tech_pvt;
@@ -447,8 +449,6 @@
 		}
 
 
-
-		switch_channel_set_flag(channel, CF_OUTBOUND);
 		switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
 		switch_channel_set_state(channel, CS_INIT);
 		return SWITCH_CAUSE_SUCCESS;
@@ -480,13 +480,12 @@
 	/*.on_hangup */ channel_on_hangup,
 	/*.on_exchange_media */ channel_on_exchange_media,
 	/*.on_soft_execute */ channel_on_soft_execute,
-	/*.on_consume_media*/ NULL,
-    /*.on_hibernate*/ NULL,
-    /*.on_reset*/ NULL,
-    /*.on_park*/ NULL,
-    /*.on_reporting*/ NULL,
-    /*.on_destroy*/ channel_on_destroy
-
+	/*.on_consume_media */ NULL,
+	/*.on_hibernate */ NULL,
+	/*.on_reset */ NULL,
+	/*.on_park */ NULL,
+	/*.on_reporting */ NULL,
+	/*.on_destroy */ channel_on_destroy
 };
 
 switch_io_routines_t reference_io_routines = {
@@ -591,13 +590,13 @@
 		}
 		switch_yield(20000);
 	}
-	
+
 	/* Free dynamically allocated strings */
 	switch_safe_free(globals.dialplan);
 	switch_safe_free(globals.codec_string);
 	switch_safe_free(globals.codec_rates_string);
 	switch_safe_free(globals.ip);
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax


Name: svn:ignore
   - Win32
*.user
   + Win32
*.user
Makefile.in
.deps
Makefile
mod_skypiax.log

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/Makefile

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/Makefile.am (from rev 16612, freeswitch/trunk/src/mod/endpoints/mod_skypiax/Makefile.am) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/Makefile.am	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/Makefile.am	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,7 @@
+include $(top_srcdir)/build/modmake.rulesam
+MODNAME=mod_skypiax
+mod_LTLIBRARIES = mod_skypiax.la
+mod_skypiax_la_SOURCES  = mod_skypiax.c skypiax_protocol.c
+mod_skypiax_la_CFLAGS   = $(AM_CFLAGS) -DSKYPIAX_SVN_VERSION=\"`cat $(switch_builddir)/.version`\"
+mod_skypiax_la_LIBADD   = $(switch_builddir)/libfreeswitch.la
+mod_skypiax_la_LDFLAGS  = -avoid-version -module -no-undefined -shared -lX11

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/alsa/dummy.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/alsa/dummy.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/alsa/dummy.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -18,7 +18,7 @@
  *
  */
 
-#include <sound/driver.h> //giova
+#include <sound/driver.h>		//giova
 #include <linux/init.h>
 #include <linux/err.h>
 #include <linux/platform_device.h>
@@ -44,7 +44,7 @@
 #define MAX_PCM_SUBSTREAMS	128
 #define MAX_MIDI_DEVICES	2
 
-#if 0 /* emu10k1 emulation */
+#if 0							/* emu10k1 emulation */
 #define MAX_BUFFER_SIZE		(128 * 1024)
 static int emu10k1_playback_constraints(struct snd_pcm_runtime *runtime)
 {
@@ -57,10 +57,11 @@
 		return err;
 	return 0;
 }
+
 #define add_playback_constraints emu10k1_playback_constraints
 #endif
 
-#if 0 /* RME9652 emulation */
+#if 0							/* RME9652 emulation */
 #define MAX_BUFFER_SIZE		(26 * 64 * 1024)
 #define USE_FORMATS		SNDRV_PCM_FMTBIT_S32_LE
 #define USE_CHANNELS_MIN	26
@@ -69,7 +70,7 @@
 #define USE_PERIODS_MAX		2
 #endif
 
-#if 0 /* ICE1712 emulation */
+#if 0							/* ICE1712 emulation */
 #define MAX_BUFFER_SIZE		(256 * 1024)
 #define USE_FORMATS		SNDRV_PCM_FMTBIT_S32_LE
 #define USE_CHANNELS_MIN	10
@@ -78,7 +79,7 @@
 #define USE_PERIODS_MAX		1024
 #endif
 
-#if 0 /* UDA1341 emulation */
+#if 0							/* UDA1341 emulation */
 #define MAX_BUFFER_SIZE		(16380)
 #define USE_FORMATS		SNDRV_PCM_FMTBIT_S16_LE
 #define USE_CHANNELS_MIN	2
@@ -87,7 +88,7 @@
 #define USE_PERIODS_MAX		255
 #endif
 
-#if 0 /* simple AC97 bridge (intel8x0) with 48kHz AC97 only codec */
+#if 0							/* simple AC97 bridge (intel8x0) with 48kHz AC97 only codec */
 #define USE_FORMATS		SNDRV_PCM_FMTBIT_S16_LE
 #define USE_CHANNELS_MIN	2
 #define USE_CHANNELS_MAX	2
@@ -96,12 +97,12 @@
 #define USE_RATE_MAX		48000
 #endif
 
-#if 0 /* CA0106 */
+#if 0							/* CA0106 */
 #define USE_FORMATS		SNDRV_PCM_FMTBIT_S16_LE
 #define USE_CHANNELS_MIN	2
 #define USE_CHANNELS_MAX	2
-#define USE_RATE		(SNDRV_PCM_RATE_48000|SNDRV_PCM_RATE_96000|SNDRV_PCM_RATE_192000) 
-#define USE_RATE_MIN		48000 
+#define USE_RATE		(SNDRV_PCM_RATE_48000|SNDRV_PCM_RATE_96000|SNDRV_PCM_RATE_192000)
+#define USE_RATE_MIN		48000
 #define USE_RATE_MAX		192000
 #define MAX_BUFFER_SIZE		((65536-64)*8)
 #define MAX_PERIOD_SIZE		(65536-64)
@@ -146,9 +147,10 @@
 
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;	/* Index 0-MAX */
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;	/* ID for this card */
-static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0};
-static int pcm_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
-static int pcm_substreams[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128};
+static int enable[SNDRV_CARDS] = { 1,[1...(SNDRV_CARDS - 1)] = 0 };
+static int pcm_devs[SNDRV_CARDS] = {[0...(SNDRV_CARDS - 1)] = 1 };
+static int pcm_substreams[SNDRV_CARDS] = {[0...(SNDRV_CARDS - 1)] = 128 };
+
 //static int midi_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
 
 module_param_array(index, int, NULL, 0444);
@@ -165,14 +167,14 @@
 //MODULE_PARM_DESC(midi_devs, "MIDI devices # (0-2) for dummy driver.");
 
 static struct platform_device *devices[SNDRV_CARDS];
-static struct timer_list giovatimer; //giova
-static int giovastarted=0;
-static int giovaindex=0;
+static struct timer_list giovatimer;	//giova
+static int giovastarted = 0;
+static int giovaindex = 0;
 static spinlock_t giovalock;
 struct giovadpcm {
 	struct snd_pcm_substream *substream;
 	struct snd_dummy_pcm *dpcm;
-	int	started;
+	int started;
 };
 static struct giovadpcm giovadpcms[MAX_PCM_SUBSTREAMS];
 
@@ -188,8 +190,8 @@
 	struct snd_card *card;
 	struct snd_pcm *pcm;
 	spinlock_t mixer_lock;
-	int mixer_volume[MIXER_ADDR_LAST+1][2];
-	int capture_source[MIXER_ADDR_LAST+1][2];
+	int mixer_volume[MIXER_ADDR_LAST + 1][2];
+	int capture_source[MIXER_ADDR_LAST + 1][2];
 };
 
 struct snd_dummy_pcm {
@@ -208,50 +210,48 @@
 
 static inline void snd_card_dummy_pcm_timer_start(struct snd_dummy_pcm *dpcm)
 {
-int i;
-int found=0;
+	int i;
+	int found = 0;
 
 
 //printk("giova: 1 timer_start %d %p\n", __LINE__, dpcm);
-for(i=0; i<giovaindex+1; i++){
-	if(i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS){
-		printk("giova, %s:%d, i=%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, i, giovaindex, dpcm);
+	for (i = 0; i < giovaindex + 1; i++) {
+		if (i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS) {
+			printk("giova, %s:%d, i=%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, i, giovaindex, dpcm);
+		}
+
+		if (giovadpcms[i].dpcm == dpcm) {
+			giovadpcms[i].started = 1;
+			found = 1;
+		}
 	}
+	if (!found) {
+		printk("skypiax: start, NOT found?\n");
+	}
 
-if(giovadpcms[i].dpcm == dpcm){
-	giovadpcms[i].started=1;
-	found=1;
-}
-}
-if(!found){
-	printk("skypiax: start, NOT found?\n");
-}
-
-
-
 //printk("giova: 2 timer_start %d %p\n", __LINE__, dpcm);
 }
 
 static inline void snd_card_dummy_pcm_timer_stop(struct snd_dummy_pcm *dpcm)
 {
 	//del_timer(&dpcm->timer);
-int i;
-int found=0;
+	int i;
+	int found = 0;
 
 //printk("giova: 1 timer_stop %d %p\n", __LINE__, dpcm);
-for(i=0; i<giovaindex +1; i++){
+	for (i = 0; i < giovaindex + 1; i++) {
 
-	if(i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS){
-		printk("giova, %s:%d, i=%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, i, giovaindex, dpcm);
+		if (i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS) {
+			printk("giova, %s:%d, i=%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, i, giovaindex, dpcm);
+		}
+		if (giovadpcms[i].dpcm == dpcm) {
+			giovadpcms[i].started = 0;
+			found = 1;
+		}
 	}
-if(giovadpcms[i].dpcm == dpcm){
-	giovadpcms[i].started=0;
-	found=1;
-}
-}
-if(!found){
-	//printk("skypiax: stop, NOT found?\n");
-	} else { 
+	if (!found) {
+		//printk("skypiax: stop, NOT found?\n");
+	} else {
 		//printk("skypiax: stop, YES found!\n"); 
 	}
 
@@ -294,8 +294,7 @@
 	struct snd_dummy_pcm *dpcm = runtime->private_data;
 	int bps;
 
-	bps = snd_pcm_format_width(runtime->format) * runtime->rate *
-		runtime->channels / 8;
+	bps = snd_pcm_format_width(runtime->format) * runtime->rate * runtime->channels / 8;
 
 	if (bps <= 0)
 		return -EINVAL;
@@ -306,8 +305,7 @@
 	dpcm->pcm_period_size = snd_pcm_lib_period_bytes(substream);
 	dpcm->pcm_irq_pos = 0;
 	dpcm->pcm_buf_pos = 0;
-	snd_pcm_format_set_silence(runtime->format, runtime->dma_area,
-			bytes_to_samples(runtime, runtime->dma_bytes));
+	snd_pcm_format_set_silence(runtime->format, runtime->dma_area, bytes_to_samples(runtime, runtime->dma_bytes));
 
 //printk("giova: prepare %d %p\n", __LINE__, dpcm);
 	return 0;
@@ -316,49 +314,49 @@
 static void snd_card_dummy_pcm_timer_function(unsigned long data)
 {
 	//struct snd_dummy_pcm *dpcm = (struct snd_dummy_pcm *)data;
-	struct snd_dummy_pcm *dpcm=NULL;
+	struct snd_dummy_pcm *dpcm = NULL;
 	//unsigned long flags;
-int i;
-	
+	int i;
 
-	giovatimer.expires = (HZ/100) + jiffies;
+
+	giovatimer.expires = (HZ / 100) + jiffies;
 	add_timer(&giovatimer);
 
-for(i=0; i< giovaindex +1; i++) {
+	for (i = 0; i < giovaindex + 1; i++) {
 
-	if(i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS){
-		printk("giova, %s:%d, i=%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, i, giovaindex, dpcm);
-	}
+		if (i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS) {
+			printk("giova, %s:%d, i=%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, i, giovaindex, dpcm);
+		}
 //printk("giova: timer_func %d i=%d\n", __LINE__, i);
 
-if(giovadpcms[i].started != 1)
-	continue; 
-dpcm = giovadpcms[i].dpcm;
-if(dpcm==NULL){
-	printk("giova: timer_func %d %d NULL: continue\n", __LINE__, i);
-	continue;
-	}
-	if(in_irq())
-		printk("giova: timer_func %d %d we are in HARDWARE IRQ\n", __LINE__, i);
-	//if(in_softirq())
+		if (giovadpcms[i].started != 1)
+			continue;
+		dpcm = giovadpcms[i].dpcm;
+		if (dpcm == NULL) {
+			printk("giova: timer_func %d %d NULL: continue\n", __LINE__, i);
+			continue;
+		}
+		if (in_irq())
+			printk("giova: timer_func %d %d we are in HARDWARE IRQ\n", __LINE__, i);
+		//if(in_softirq())
 		//printk("giova: timer_func %d %d we are in SOFT IRQ\n", __LINE__, i);
 //printk("giova: timer_func %d %d\n", __LINE__, i);
-	//spin_lock_irqsave(&dpcm->lock, flags);
-	spin_lock_bh(&dpcm->lock);
-	dpcm->pcm_irq_pos += dpcm->pcm_bps * (HZ/100);
-	dpcm->pcm_buf_pos += dpcm->pcm_bps * (HZ/100);
-	dpcm->pcm_buf_pos %= dpcm->pcm_buffer_size * dpcm->pcm_hz;
-	if (dpcm->pcm_irq_pos >= dpcm->pcm_period_size * dpcm->pcm_hz) {
-		dpcm->pcm_irq_pos %= dpcm->pcm_period_size * dpcm->pcm_hz;
-		//spin_unlock_irqrestore(&dpcm->lock, flags);
-		spin_unlock_bh(&dpcm->lock);
-		snd_pcm_period_elapsed(dpcm->substream);
-	} else {
-		//spin_unlock_irqrestore(&dpcm->lock, flags);
-		spin_unlock_bh(&dpcm->lock);
+		//spin_lock_irqsave(&dpcm->lock, flags);
+		spin_lock_bh(&dpcm->lock);
+		dpcm->pcm_irq_pos += dpcm->pcm_bps * (HZ / 100);
+		dpcm->pcm_buf_pos += dpcm->pcm_bps * (HZ / 100);
+		dpcm->pcm_buf_pos %= dpcm->pcm_buffer_size * dpcm->pcm_hz;
+		if (dpcm->pcm_irq_pos >= dpcm->pcm_period_size * dpcm->pcm_hz) {
+			dpcm->pcm_irq_pos %= dpcm->pcm_period_size * dpcm->pcm_hz;
+			//spin_unlock_irqrestore(&dpcm->lock, flags);
+			spin_unlock_bh(&dpcm->lock);
+			snd_pcm_period_elapsed(dpcm->substream);
+		} else {
+			//spin_unlock_irqrestore(&dpcm->lock, flags);
+			spin_unlock_bh(&dpcm->lock);
+		}
 	}
 }
-}
 
 static snd_pcm_uframes_t snd_card_dummy_pcm_pointer(struct snd_pcm_substream *substream)
 {
@@ -367,76 +365,71 @@
 
 //printk("giova: pointer %d %p\n", __LINE__, dpcm);
 	//return bytes_to_frames(runtime, dpcm->pcm_buf_pos / dpcm->pcm_hz);
-	return (dpcm->pcm_buf_pos / dpcm->pcm_hz)/2;
+	return (dpcm->pcm_buf_pos / dpcm->pcm_hz) / 2;
 }
 
-static struct snd_pcm_hardware snd_card_dummy_playback =
-{
-	.info =			(SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
-				 SNDRV_PCM_INFO_RESUME | SNDRV_PCM_INFO_MMAP_VALID),
-	.formats =		USE_FORMATS,
-	.rates =		USE_RATE,
-	.rate_min =		USE_RATE_MIN,
-	.rate_max =		USE_RATE_MAX,
-	.channels_min =		USE_CHANNELS_MIN,
-	.channels_max =		USE_CHANNELS_MAX,
-	.buffer_bytes_max =	MAX_BUFFER_SIZE,
-	.period_bytes_min =	64,
-	.period_bytes_max =	MAX_PERIOD_SIZE,
-	.periods_min =		USE_PERIODS_MIN,
-	.periods_max =		USE_PERIODS_MAX,
-	.fifo_size =		0,
+static struct snd_pcm_hardware snd_card_dummy_playback = {
+	.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_RESUME | SNDRV_PCM_INFO_MMAP_VALID),
+	.formats = USE_FORMATS,
+	.rates = USE_RATE,
+	.rate_min = USE_RATE_MIN,
+	.rate_max = USE_RATE_MAX,
+	.channels_min = USE_CHANNELS_MIN,
+	.channels_max = USE_CHANNELS_MAX,
+	.buffer_bytes_max = MAX_BUFFER_SIZE,
+	.period_bytes_min = 64,
+	.period_bytes_max = MAX_PERIOD_SIZE,
+	.periods_min = USE_PERIODS_MIN,
+	.periods_max = USE_PERIODS_MAX,
+	.fifo_size = 0,
 };
 
-static struct snd_pcm_hardware snd_card_dummy_capture =
-{
-	.info =			(SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
-				 SNDRV_PCM_INFO_RESUME | SNDRV_PCM_INFO_MMAP_VALID),
-	.formats =		USE_FORMATS,
-	.rates =		USE_RATE,
-	.rate_min =		USE_RATE_MIN,
-	.rate_max =		USE_RATE_MAX,
-	.channels_min =		USE_CHANNELS_MIN,
-	.channels_max =		USE_CHANNELS_MAX,
-	.buffer_bytes_max =	MAX_BUFFER_SIZE,
-	.period_bytes_min =	64,
-	.period_bytes_max =	MAX_PERIOD_SIZE,
-	.periods_min =		USE_PERIODS_MIN,
-	.periods_max =		USE_PERIODS_MAX,
-	.fifo_size =		0,
+static struct snd_pcm_hardware snd_card_dummy_capture = {
+	.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_RESUME | SNDRV_PCM_INFO_MMAP_VALID),
+	.formats = USE_FORMATS,
+	.rates = USE_RATE,
+	.rate_min = USE_RATE_MIN,
+	.rate_max = USE_RATE_MAX,
+	.channels_min = USE_CHANNELS_MIN,
+	.channels_max = USE_CHANNELS_MAX,
+	.buffer_bytes_max = MAX_BUFFER_SIZE,
+	.period_bytes_min = 64,
+	.period_bytes_max = MAX_PERIOD_SIZE,
+	.periods_min = USE_PERIODS_MIN,
+	.periods_max = USE_PERIODS_MAX,
+	.fifo_size = 0,
 };
 
 static void snd_card_dummy_runtime_free(struct snd_pcm_runtime *runtime)
 {
-int i;
+	int i;
 //int found=0;
 
 //printk("snd_card_dummy_runtime_free giova 1 giovaindex=%d dpcm=%p runtime=%p\n", giovaindex, runtime->private_data, runtime);
 	spin_lock_bh(&giovalock);
 
-for(i=0; i < giovaindex; i++) {
+	for (i = 0; i < giovaindex; i++) {
 
-	if(i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS){
-		printk("giova, %s:%d, i=%d, giovaindex=%d \n", __FILE__, __LINE__, i, giovaindex);
+		if (i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS) {
+			printk("giova, %s:%d, i=%d, giovaindex=%d \n", __FILE__, __LINE__, i, giovaindex);
+		}
+		//if((giovadpcms[i].substream == substream)  && (giovadpcms[i].dpcm == dpcm)){
+		if ((giovadpcms[i].dpcm == runtime->private_data)) {
+			//printk("giova, %s:%d, i=%d, giovaindex=%d %p==%p YES I AM!!!!\n", __FILE__, __LINE__, i, giovaindex, giovadpcms[i].dpcm , runtime->private_data);
+			//giovadpcms[i].dpcm = NULL;
+			//giovadpcms[i].substream = NULL;
+			giovadpcms[i].started = 0;
+			//break;
+		} else {
+			//printk("giova, %s:%d, i=%d, giovaindex=%d %p!=%p NOT ME\n", __FILE__, __LINE__, i, giovaindex, giovadpcms[i].dpcm , runtime->private_data);
+		}
 	}
-	//if((giovadpcms[i].substream == substream)  && (giovadpcms[i].dpcm == dpcm)){
-	if((giovadpcms[i].dpcm == runtime->private_data)){
-		//printk("giova, %s:%d, i=%d, giovaindex=%d %p==%p YES I AM!!!!\n", __FILE__, __LINE__, i, giovaindex, giovadpcms[i].dpcm , runtime->private_data);
-		//giovadpcms[i].dpcm = NULL;
-		//giovadpcms[i].substream = NULL;
-		giovadpcms[i].started = 0;
-		//break;
-	} else {
-		//printk("giova, %s:%d, i=%d, giovaindex=%d %p!=%p NOT ME\n", __FILE__, __LINE__, i, giovaindex, giovadpcms[i].dpcm , runtime->private_data);
-	}
-}
 
 	spin_unlock_bh(&giovalock);
 	kfree(runtime->private_data);
 }
 
-static int snd_card_dummy_hw_params(struct snd_pcm_substream *substream,
-				    struct snd_pcm_hw_params *hw_params)
+static int snd_card_dummy_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params)
 {
 	return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
 }
@@ -450,13 +443,13 @@
 {
 	struct snd_dummy_pcm *dpcm;
 	int i;
-	int found=0;
+	int found = 0;
 
 	//printk("giova, %s:%d, i=%d, giovaindex=%d %p==%p YES I AM!!!!\n", __FILE__, __LINE__, i, giovaindex, giovadpcms[i].dpcm , runtime->private_data);
 	//printk("giova, %s:%d, giovaindex=%d\n", __FILE__, __LINE__, giovaindex);
 	dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);
 	//printk("giova, %s:%d, giovaindex=%d\n", __FILE__, __LINE__, giovaindex);
-	if (! dpcm){
+	if (!dpcm) {
 		//spin_unlock_bh(&giovalock);
 		printk("giova, %s:%d, giovaindex=%d NO MEMORY!!!!\n", __FILE__, __LINE__, giovaindex);
 		return dpcm;
@@ -470,49 +463,48 @@
 
 	spin_lock_bh(&giovalock);
 	//printk("giova 1 giovaindex=%d dpcm=%p substream=%p sizeof=%lu\n", giovaindex, dpcm, substream, sizeof(*dpcm));
-	for(i=0; i < giovaindex; i++) {
+	for (i = 0; i < giovaindex; i++) {
 
-	if(i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS){
-		printk("giova, %s:%d, i=%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, i, giovaindex, dpcm);
-	}
+		if (i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS) {
+			printk("giova, %s:%d, i=%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, i, giovaindex, dpcm);
+		}
 		//if((giovadpcms[i].substream == substream)  && (giovadpcms[i].dpcm == dpcm))
-		if((giovadpcms[i].substream == substream)){
-			found=1;
+		if ((giovadpcms[i].substream == substream)) {
+			found = 1;
 			break;
 		}
 
 	}
 
-	if(!found){
+	if (!found) {
 
-		giovadpcms[giovaindex].substream=substream;
+		giovadpcms[giovaindex].substream = substream;
 		giovaindex++;
 		//printk("giova 2 giovaindex=%d dpcm=%p substream=%p\n", giovaindex, dpcm, substream);
 	}
 
 
 
-	found =0;
-	for(i=0; i < giovaindex; i++) {
+	found = 0;
+	for (i = 0; i < giovaindex; i++) {
 
-	if(i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS){
-		printk("giova, %s:%d, i=%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, i, giovaindex, dpcm);
-	}
-		if(giovadpcms[i].substream == substream){
-			giovadpcms[i].dpcm=dpcm;
-			giovadpcms[i].started=0;
+		if (i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS) {
+			printk("giova, %s:%d, i=%d, giovaindex=%d dpcm=%p\n", __FILE__, __LINE__, i, giovaindex, dpcm);
+		}
+		if (giovadpcms[i].substream == substream) {
+			giovadpcms[i].dpcm = dpcm;
+			giovadpcms[i].started = 0;
 			found = 1;
 			//printk("giova 3 giovaindex=%d dpcm=%p substream=%p\n", giovaindex, dpcm, substream);
 			break;
-		} 
+		}
 
 	}
 
 	spin_unlock_bh(&giovalock);
-	if(!found) {
+	if (!found) {
 		printk("skypiax giovaindex=%d NOT found????\n", giovaindex);
 	}
-
 	//printk("giova, %s:%d, giovaindex=%d\n", __FILE__, __LINE__, giovaindex);
 	return dpcm;
 }
@@ -535,7 +527,7 @@
 		runtime->hw.info |= SNDRV_PCM_INFO_NONINTERLEAVED;
 	}
 	if (substream->pcm->device & 2)
-		runtime->hw.info &= ~(SNDRV_PCM_INFO_MMAP|SNDRV_PCM_INFO_MMAP_VALID);
+		runtime->hw.info &= ~(SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID);
 	err = add_playback_constraints(runtime);
 	if (err < 0)
 		return err;
@@ -561,7 +553,7 @@
 		runtime->hw.info |= SNDRV_PCM_INFO_NONINTERLEAVED;
 	}
 	if (substream->pcm->device & 2)
-		runtime->hw.info &= ~(SNDRV_PCM_INFO_MMAP|SNDRV_PCM_INFO_MMAP_VALID);
+		runtime->hw.info &= ~(SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID);
 	err = add_capture_constraints(runtime);
 	if (err < 0)
 		return err;
@@ -584,35 +576,33 @@
 }
 
 static struct snd_pcm_ops snd_card_dummy_playback_ops = {
-	.open =			snd_card_dummy_playback_open,
-	.close =		snd_card_dummy_playback_close,
-	.ioctl =		snd_pcm_lib_ioctl,
-	.hw_params =		snd_card_dummy_hw_params,
-	.hw_free =		snd_card_dummy_hw_free,
-	.prepare =		snd_card_dummy_pcm_prepare,
-	.trigger =		snd_card_dummy_pcm_trigger,
-	.pointer =		snd_card_dummy_pcm_pointer,
+	.open = snd_card_dummy_playback_open,
+	.close = snd_card_dummy_playback_close,
+	.ioctl = snd_pcm_lib_ioctl,
+	.hw_params = snd_card_dummy_hw_params,
+	.hw_free = snd_card_dummy_hw_free,
+	.prepare = snd_card_dummy_pcm_prepare,
+	.trigger = snd_card_dummy_pcm_trigger,
+	.pointer = snd_card_dummy_pcm_pointer,
 };
 
 static struct snd_pcm_ops snd_card_dummy_capture_ops = {
-	.open =			snd_card_dummy_capture_open,
-	.close =		snd_card_dummy_capture_close,
-	.ioctl =		snd_pcm_lib_ioctl,
-	.hw_params =		snd_card_dummy_hw_params,
-	.hw_free =		snd_card_dummy_hw_free,
-	.prepare =		snd_card_dummy_pcm_prepare,
-	.trigger =		snd_card_dummy_pcm_trigger,
-	.pointer =		snd_card_dummy_pcm_pointer,
+	.open = snd_card_dummy_capture_open,
+	.close = snd_card_dummy_capture_close,
+	.ioctl = snd_pcm_lib_ioctl,
+	.hw_params = snd_card_dummy_hw_params,
+	.hw_free = snd_card_dummy_hw_free,
+	.prepare = snd_card_dummy_pcm_prepare,
+	.trigger = snd_card_dummy_pcm_trigger,
+	.pointer = snd_card_dummy_pcm_pointer,
 };
 
-static int __devinit snd_card_dummy_pcm(struct snd_dummy *dummy, int device,
-					int substreams)
+static int __devinit snd_card_dummy_pcm(struct snd_dummy *dummy, int device, int substreams)
 {
 	struct snd_pcm *pcm;
 	int err;
 
-	err = snd_pcm_new(dummy->card, "Dummy PCM", device,
-			       substreams, substreams, &pcm);
+	err = snd_pcm_new(dummy->card, "Dummy PCM", device, substreams, substreams, &pcm);
 	if (err < 0)
 		return err;
 	dummy->pcm = pcm;
@@ -621,9 +611,7 @@
 	pcm->private_data = dummy;
 	pcm->info_flags = 0;
 	strcpy(pcm->name, "Dummy PCM");
-	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
-					      snd_dma_continuous_data(GFP_KERNEL),
-					      128*1024, 1024*1024);
+	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, snd_dma_continuous_data(GFP_KERNEL), 128 * 1024, 1024 * 1024);
 
 	return 0;
 }
@@ -637,8 +625,7 @@
   .private_value = addr, \
   .tlv = { .p = db_scale_dummy } }
 
-static int snd_dummy_volume_info(struct snd_kcontrol *kcontrol,
-				 struct snd_ctl_elem_info *uinfo)
+static int snd_dummy_volume_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 {
 	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
 	uinfo->count = 2;
@@ -646,15 +633,14 @@
 	uinfo->value.integer.max = 100;
 	return 0;
 }
- 
-static int snd_dummy_volume_get(struct snd_kcontrol *kcontrol,
-				struct snd_ctl_elem_value *ucontrol)
+
+static int snd_dummy_volume_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
 	struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol);
 	int addr = kcontrol->private_value;
 	//unsigned long flags;
 
-	if(in_irq())
+	if (in_irq())
 		printk("giova: line %d we are in HARDWARE IRQ\n", __LINE__);
 //printk("giova: volume get %d %d\n", __LINE__, addr);
 	//spin_lock_irq(&dummy->mixer_lock);
@@ -667,15 +653,14 @@
 	return 0;
 }
 
-static int snd_dummy_volume_put(struct snd_kcontrol *kcontrol,
-				struct snd_ctl_elem_value *ucontrol)
+static int snd_dummy_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
 	struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol);
 	int change, addr = kcontrol->private_value;
 	int left, right;
 	//unsigned long flags;
 
-	if(in_irq())
+	if (in_irq())
 		printk("giova: line %d we are in HARDWARE IRQ\n", __LINE__);
 	left = ucontrol->value.integer.value[0];
 	if (left < -50)
@@ -691,8 +676,7 @@
 	//spin_lock_irq(&dummy->mixer_lock);
 	//spin_lock_irqsave(&dummy->mixer_lock, flags);
 	spin_lock_bh(&dummy->mixer_lock);
-	change = dummy->mixer_volume[addr][0] != left ||
-	         dummy->mixer_volume[addr][1] != right;
+	change = dummy->mixer_volume[addr][0] != left || dummy->mixer_volume[addr][1] != right;
 	dummy->mixer_volume[addr][0] = left;
 	dummy->mixer_volume[addr][1] = right;
 	//spin_unlock_irq(&dummy->mixer_lock);
@@ -710,15 +694,14 @@
   .private_value = addr }
 
 #define snd_dummy_capsrc_info	snd_ctl_boolean_stereo_info
- 
-static int snd_dummy_capsrc_get(struct snd_kcontrol *kcontrol,
-				struct snd_ctl_elem_value *ucontrol)
+
+static int snd_dummy_capsrc_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
 	struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol);
 	int addr = kcontrol->private_value;
 	//unsigned long flags;
 
-	if(in_irq())
+	if (in_irq())
 		printk("giova: line %d we are in HARDWARE IRQ\n", __LINE__);
 	//spin_lock_irq(&dummy->mixer_lock);
 	//spin_lock_irqsave(&dummy->mixer_lock, flags);
@@ -739,15 +722,14 @@
 	int left, right;
 	//unsigned long flags;
 
-	if(in_irq())
+	if (in_irq())
 		printk("giova: line %d we are in HARDWARE IRQ\n", __LINE__);
 	left = ucontrol->value.integer.value[0] & 1;
 	right = ucontrol->value.integer.value[1] & 1;
 	//spin_lock_irq(&dummy->mixer_lock);
 	//spin_lock_irqsave(&dummy->mixer_lock, flags);
 	spin_lock_bh(&dummy->mixer_lock);
-	change = dummy->capture_source[addr][0] != left &&
-	         dummy->capture_source[addr][1] != right;
+	change = dummy->capture_source[addr][0] != left && dummy->capture_source[addr][1] != right;
 	dummy->capture_source[addr][0] = left;
 	dummy->capture_source[addr][1] = right;
 	//spin_unlock_irq(&dummy->mixer_lock);
@@ -758,16 +740,16 @@
 }
 
 static struct snd_kcontrol_new snd_dummy_controls[] = {
-DUMMY_VOLUME("Master Volume", 0, MIXER_ADDR_MASTER),
-DUMMY_CAPSRC("Master Capture Switch", 0, MIXER_ADDR_MASTER),
-DUMMY_VOLUME("Synth Volume", 0, MIXER_ADDR_SYNTH),
-DUMMY_CAPSRC("Synth Capture Switch", 0, MIXER_ADDR_SYNTH),
-DUMMY_VOLUME("Line Volume", 0, MIXER_ADDR_LINE),
-DUMMY_CAPSRC("Line Capture Switch", 0, MIXER_ADDR_LINE),
-DUMMY_VOLUME("Mic Volume", 0, MIXER_ADDR_MIC),
-DUMMY_CAPSRC("Mic Capture Switch", 0, MIXER_ADDR_MIC),
-DUMMY_VOLUME("CD Volume", 0, MIXER_ADDR_CD),
-DUMMY_CAPSRC("CD Capture Switch", 0, MIXER_ADDR_CD)
+	DUMMY_VOLUME("Master Volume", 0, MIXER_ADDR_MASTER),
+	DUMMY_CAPSRC("Master Capture Switch", 0, MIXER_ADDR_MASTER),
+	DUMMY_VOLUME("Synth Volume", 0, MIXER_ADDR_SYNTH),
+	DUMMY_CAPSRC("Synth Capture Switch", 0, MIXER_ADDR_SYNTH),
+	DUMMY_VOLUME("Line Volume", 0, MIXER_ADDR_LINE),
+	DUMMY_CAPSRC("Line Capture Switch", 0, MIXER_ADDR_LINE),
+	DUMMY_VOLUME("Mic Volume", 0, MIXER_ADDR_MIC),
+	DUMMY_CAPSRC("Mic Capture Switch", 0, MIXER_ADDR_MIC),
+	DUMMY_VOLUME("CD Volume", 0, MIXER_ADDR_CD),
+	DUMMY_CAPSRC("CD Capture Switch", 0, MIXER_ADDR_CD)
 };
 
 static int __devinit snd_card_dummy_new_mixer(struct snd_dummy *dummy)
@@ -777,11 +759,11 @@
 	int err;
 
 	//giova if (snd_BUG_ON(!dummy))
-		//giova return -EINVAL;
+	//giova return -EINVAL;
 	spin_lock_init(&dummy->mixer_lock);
 	strcpy(card->mixername, "Dummy Mixer");
 //printk("giova: new_mixer %d\n", __LINE__);
-	return 0; //giova no mixer
+	return 0;					//giova no mixer
 
 	for (idx = 0; idx < ARRAY_SIZE(snd_dummy_controls); idx++) {
 		err = snd_ctl_add(card, snd_ctl_new1(&snd_dummy_controls[idx], dummy));
@@ -798,15 +780,14 @@
 	int idx, err;
 	int dev = devptr->id;
 
-        card = snd_card_new(index[dev], id[dev], THIS_MODULE,
-                            sizeof(struct snd_dummy));
-        if (card == NULL)
-                return -ENOMEM;
+	card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct snd_dummy));
+	if (card == NULL)
+		return -ENOMEM;
 
 	//giova err = snd_card_create(index[dev], id[dev], THIS_MODULE,
-			      //giova sizeof(struct snd_dummy), &card);
+	//giova sizeof(struct snd_dummy), &card);
 	//giova if (err < 0)
-		//giova return err;
+	//giova return err;
 	dummy = card->private_data;
 	dummy->card = card;
 	for (idx = 0; idx < MAX_PCM_DEVICES && idx < pcm_devs[dev]; idx++) {
@@ -832,7 +813,7 @@
 		platform_set_drvdata(devptr, card);
 		return 0;
 	}
-      __nodev:
+  __nodev:
 	snd_card_free(card);
 	return err;
 }
@@ -856,7 +837,7 @@
 	snd_pcm_suspend_all(dummy->pcm);
 	return 0;
 }
-	
+
 static int snd_dummy_resume(struct platform_device *pdev)
 {
 	struct snd_card *card = platform_get_drvdata(pdev);
@@ -869,15 +850,14 @@
 #define SND_DUMMY_DRIVER	"snd_dummy"
 
 static struct platform_driver snd_dummy_driver = {
-	.probe		= snd_dummy_probe,
-	.remove		= __devexit_p(snd_dummy_remove),
+	.probe = snd_dummy_probe,
+	.remove = __devexit_p(snd_dummy_remove),
 #ifdef CONFIG_PM
-	.suspend	= snd_dummy_suspend,
-	.resume		= snd_dummy_resume,
+	.suspend = snd_dummy_suspend,
+	.resume = snd_dummy_resume,
 #endif
-	.driver		= {
-		.name	= SND_DUMMY_DRIVER
-	},
+	.driver = {
+			   .name = SND_DUMMY_DRIVER},
 };
 
 static void snd_dummy_unregister_all(void)
@@ -897,38 +877,37 @@
 	if (err < 0)
 		return err;
 
-if(!giovastarted){
-giovastarted=1;
-	spin_lock_init(&giovalock);
+	if (!giovastarted) {
+		giovastarted = 1;
+		spin_lock_init(&giovalock);
 
-	spin_lock_bh(&giovalock);
-for(i=0; i<MAX_PCM_SUBSTREAMS;i++){
+		spin_lock_bh(&giovalock);
+		for (i = 0; i < MAX_PCM_SUBSTREAMS; i++) {
 
-	if(i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS){
-		printk("giova, %s:%d, i=%d, giovaindex=%d \n", __FILE__, __LINE__, i, giovaindex);
+			if (i > MAX_PCM_SUBSTREAMS || giovaindex > MAX_PCM_SUBSTREAMS) {
+				printk("giova, %s:%d, i=%d, giovaindex=%d \n", __FILE__, __LINE__, i, giovaindex);
+			}
+			giovadpcms[i].substream = NULL;
+			giovadpcms[i].dpcm = NULL;
+			giovadpcms[i].started = 0;
+		}
+		init_timer(&giovatimer);
+		//giovatimer.data = (unsigned long) dpcm;
+		giovatimer.data = (unsigned long) &giovadpcms;
+		giovatimer.function = snd_card_dummy_pcm_timer_function;
+		giovatimer.expires = (HZ / 100) + jiffies;
+		add_timer(&giovatimer);
+		printk("snd-dummy skypiax driver, %s:%d working on a machine with %dHZ kernel\n", __FILE__, __LINE__, HZ);
+		spin_unlock_bh(&giovalock);
 	}
-giovadpcms[i].substream=NULL;
-giovadpcms[i].dpcm=NULL;
-giovadpcms[i].started=0;
-}
-	init_timer(&giovatimer);
-	//giovatimer.data = (unsigned long) dpcm;
-	giovatimer.data = (unsigned long) &giovadpcms;
-	giovatimer.function = snd_card_dummy_pcm_timer_function;
-	giovatimer.expires = (HZ/100) + jiffies;
-	add_timer(&giovatimer);
-printk("snd-dummy skypiax driver, %s:%d working on a machine with %dHZ kernel\n", __FILE__, __LINE__, HZ);
-	spin_unlock_bh(&giovalock);
-}
 
 
 	cards = 0;
 	for (i = 0; i < SNDRV_CARDS; i++) {
 		struct platform_device *device;
-		if (! enable[i])
+		if (!enable[i])
 			continue;
-		device = platform_device_register_simple(SND_DUMMY_DRIVER,
-							 i, NULL, 0);
+		device = platform_device_register_simple(SND_DUMMY_DRIVER, i, NULL, 0);
 		if (IS_ERR(device))
 			continue;
 		if (!platform_get_drvdata(device)) {
@@ -955,4 +934,4 @@
 }
 
 module_init(alsa_card_dummy_init)
-module_exit(alsa_card_dummy_exit)
+	module_exit(alsa_card_dummy_exit)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/asterisk/chan_skypiax.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/asterisk/chan_skypiax.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/asterisk/chan_skypiax.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -12,7 +12,7 @@
 
 /* GLOBAL VARIABLES */
 int running = 1;
-int skypiax_dir_entry_extension = 1;    //FIXME one var for each interface!
+int skypiax_dir_entry_extension = 1;	//FIXME one var for each interface!
 char skypiax_console_active_array[50] = "";
 char *skypiax_console_active = skypiax_console_active_array;
 /*! \brief Count of active channels for this module */
@@ -32,97 +32,93 @@
 const char skypiax_config[] = "skypiax.conf";
 
 char skypiax_console_skypiax_usage[] =
-  "       \n" "chan_skypiax commands info\n" "       \n"
-  "       chan_skypiax adds to Asterisk the following CLI commands:\n" "       \n"
-  "       CLI COMMANDS:\n" "          skypiax_hangup\n" "          skypiax_dial\n"
-  "          skypiax_console\n" "          skypiax_playback_boost\n"
-  "          skypiax_capture_boost\n" "          skypiax_skype\n"
-  "          skypiax_dir_import\n" "\n"
-  "       You can type 'help [command]' to obtain more specific info on usage.\n"
-  "       \n";
+	"       \n" "chan_skypiax commands info\n" "       \n"
+	"       chan_skypiax adds to Asterisk the following CLI commands:\n" "       \n"
+	"       CLI COMMANDS:\n" "          skypiax_hangup\n" "          skypiax_dial\n"
+	"          skypiax_console\n" "          skypiax_playback_boost\n"
+	"          skypiax_capture_boost\n" "          skypiax_skype\n"
+	"          skypiax_dir_import\n" "\n" "       You can type 'help [command]' to obtain more specific info on usage.\n" "       \n";
 char skypiax_console_hangup_usage[] =
-  "Usage: skypiax_hangup\n"
-  "       Hangs up any call currently placed on the \"current\" skypiax_console (Skypiax) channel.\n"
-  "       Enter 'help skypiax_console' on how to change the \"current\" skypiax_console\n";
+	"Usage: skypiax_hangup\n"
+	"       Hangs up any call currently placed on the \"current\" skypiax_console (Skypiax) channel.\n"
+	"       Enter 'help skypiax_console' on how to change the \"current\" skypiax_console\n";
 char skypiax_console_playback_boost_usage[] =
-  "Usage: skypiax_playback_boost [value]\n"
-  "       Shows or set the value of boost applied to the outgoing sound (voice). Possible values are: 0 (no boost applied), -40 to 40 (negative to positive range, in db). Without specifying a value, it just shows the current value. The value is for the  \"current\" skypiax_console (Skypiax) channel.\n"
-  "       Enter 'help skypiax_console' on how to change the \"current\" skypiax_console\n";
+	"Usage: skypiax_playback_boost [value]\n"
+	"       Shows or set the value of boost applied to the outgoing sound (voice). Possible values are: 0 (no boost applied), -40 to 40 (negative to positive range, in db). Without specifying a value, it just shows the current value. The value is for the  \"current\" skypiax_console (Skypiax) channel.\n"
+	"       Enter 'help skypiax_console' on how to change the \"current\" skypiax_console\n";
 char skypiax_console_capture_boost_usage[] =
-  "Usage: skypiax_capture_boost [value]\n"
-  "       Shows or set the value of boost applied to the incoming sound (voice). Possible values are: 0 (no boost applied), -40 to 40 (negative to positive range, in db). Without specifying a value, it just shows the current value. The value is for the  \"current\" skypiax_console (Skypiax) channel.\n"
-  "       Enter 'help skypiax_console' on how to change the \"current\" skypiax_console\n";
+	"Usage: skypiax_capture_boost [value]\n"
+	"       Shows or set the value of boost applied to the incoming sound (voice). Possible values are: 0 (no boost applied), -40 to 40 (negative to positive range, in db). Without specifying a value, it just shows the current value. The value is for the  \"current\" skypiax_console (Skypiax) channel.\n"
+	"       Enter 'help skypiax_console' on how to change the \"current\" skypiax_console\n";
 
 char skypiax_console_dial_usage[] =
-  "Usage: skypiax_dial [DTMFs]\n"
-  "       Dials a given DTMF string in the call currently placed on the\n"
-  "       \"current\" skypiax_console (Skypiax) channel.\n"
-  "       Enter 'help skypiax_console' on how to change the \"current\" skypiax_console\n";
+	"Usage: skypiax_dial [DTMFs]\n"
+	"       Dials a given DTMF string in the call currently placed on the\n"
+	"       \"current\" skypiax_console (Skypiax) channel.\n" "       Enter 'help skypiax_console' on how to change the \"current\" skypiax_console\n";
 
 char skypiax_console_skypiax_console_usage[] =
-  "Usage: skypiax_console [interface] | [show]\n"
-  "       If used without a parameter, displays which interface is the \"current\"\n"
-  "       skypiax_console.  If a device is specified, the \"current\" skypiax_console is changed to\n"
-  "       the interface specified.\n"
-  "       If the parameter is \"show\", the available interfaces are listed\n";
+	"Usage: skypiax_console [interface] | [show]\n"
+	"       If used without a parameter, displays which interface is the \"current\"\n"
+	"       skypiax_console.  If a device is specified, the \"current\" skypiax_console is changed to\n"
+	"       the interface specified.\n" "       If the parameter is \"show\", the available interfaces are listed\n";
 
 char skypiax_console_skype_usage[] =
-  "Usage: skypiax_skype [command string]\n"
-  "       Send the 'command string' skype_msg to the Skype client connected to the  \"current\" skypiax_console (Skypiax) channel.\n"
-  "       Enter 'help skypiax_console' on how to change the \"current\" skypiax_console\n";
+	"Usage: skypiax_skype [command string]\n"
+	"       Send the 'command string' skype_msg to the Skype client connected to the  \"current\" skypiax_console (Skypiax) channel.\n"
+	"       Enter 'help skypiax_console' on how to change the \"current\" skypiax_console\n";
 
 char skypiax_console_skypiax_dir_import_usage[] =
-  "Usage: skypiax_dir_import [add | replace]\n"
-  "       Write in the directoriax.conf config file all the entries found in 'Contacts' list of the Skype client connected to the \"current\" skypiax_console.\n"
-  "       You can choose between 'add' to the end of the directoriax.conf file, or 'replace' the whole file with this new content.\n"
-  "       Enter 'help skypiax_console' on how to change the \"current\" skypiax_console\n";
+	"Usage: skypiax_dir_import [add | replace]\n"
+	"       Write in the directoriax.conf config file all the entries found in 'Contacts' list of the Skype client connected to the \"current\" skypiax_console.\n"
+	"       You can choose between 'add' to the end of the directoriax.conf file, or 'replace' the whole file with this new content.\n"
+	"       Enter 'help skypiax_console' on how to change the \"current\" skypiax_console\n";
 
 /*! \brief Definition of this channel for PBX channel registration */
 const struct ast_channel_tech skypiax_tech = {
-  .type = skypiax_type,
-  .description = skypiax_desc,
-  .capabilities = AST_FORMAT_SLINEAR,
-  .requester = skypiax_request,
-  .hangup = skypiax_hangup,
-  .answer = skypiax_answer,
-  .read = skypiax_read,
-  .call = skypiax_originate_call,
-  .write = skypiax_write,
-  .indicate = skypiax_indicate,
-  .fixup = skypiax_fixup,
-  .devicestate = skypiax_devicestate,
+	.type = skypiax_type,
+	.description = skypiax_desc,
+	.capabilities = AST_FORMAT_SLINEAR,
+	.requester = skypiax_request,
+	.hangup = skypiax_hangup,
+	.answer = skypiax_answer,
+	.read = skypiax_read,
+	.call = skypiax_originate_call,
+	.write = skypiax_write,
+	.indicate = skypiax_indicate,
+	.fixup = skypiax_fixup,
+	.devicestate = skypiax_devicestate,
 #ifdef ASTERISK_VERSION_1_4
-  .send_digit_begin = skypiax_digitsend_begin,
-  .send_digit_end = skypiax_digitsend_end,
+	.send_digit_begin = skypiax_digitsend_begin,
+	.send_digit_end = skypiax_digitsend_end,
 #else /* ASTERISK_VERSION_1_4 */
-  .send_digit = skypiax_digitsend,
+	.send_digit = skypiax_digitsend,
 #endif /* ASTERISK_VERSION_1_4 */
 };
 
 /*! \brief fake skypiax_pvt structure values, 
  * just for logging purposes */
 struct skypiax_pvt skypiax_log_struct = {
-  .name = "none",
+	.name = "none",
 };
 
 /*! \brief Default skypiax_pvt structure values, 
  * used by skypiax_mkif to initialize the interfaces */
 struct skypiax_pvt skypiax_default = {
-  .interface_state = SKYPIAX_STATE_DOWN,
-  .skype_callflow = 0,
-  .context = "default",
-  .language = "en",
-  .exten = "s",
-  .next = NULL,
-  .owner = NULL,
-  .controldev_thread = AST_PTHREADT_NULL,
-  .skypiax_sound_rate = 8000,
-  .skypiax_sound_capt_fd = -1,
-  .capture_boost = 0,
-  .playback_boost = 0,
-  .stripmsd = 0,
-  .skype = 0,
-  .skypiax_dir_entry_extension_prefix = 6,
+	.interface_state = SKYPIAX_STATE_DOWN,
+	.skype_callflow = 0,
+	.context = "default",
+	.language = "en",
+	.exten = "s",
+	.next = NULL,
+	.owner = NULL,
+	.controldev_thread = AST_PTHREADT_NULL,
+	.skypiax_sound_rate = 8000,
+	.skypiax_sound_capt_fd = -1,
+	.capture_boost = 0,
+	.playback_boost = 0,
+	.stripmsd = 0,
+	.skype = 0,
+	.skypiax_dir_entry_extension_prefix = 6,
 };
 
 /*! 
@@ -136,38 +132,38 @@
  * CLI do not works since some time on 1.6, they changed the CLI mechanism
  */
 #if 0
-  AST_CLI_DEFINE(skypiax_console_hangup, "Hangup a call on the console"),
-  AST_CLI_DEFINE(skypiax_console_dial, "Dial an extension on the console"),
-  AST_CLI_DEFINE(skypiax_console_playback_boost, "Sets/displays spk boost in dB"),
-  AST_CLI_DEFINE(skypiax_console_capture_boost, "Sets/displays mic boost in dB"),
-  AST_CLI_DEFINE(skypiax_console_set_active, "Sets/displays active console"),
-  AST_CLI_DEFINE(skypiax_console_skype, "Sends a Skype command"),
-  AST_CLI_DEFINE(skypiax_console_skypiax_dir_import, "imports entries from cellphone"),
-  AST_CLI_DEFINE(skypiax_console_skypiax, "all things skypiax"),
+	AST_CLI_DEFINE(skypiax_console_hangup, "Hangup a call on the console"),
+	AST_CLI_DEFINE(skypiax_console_dial, "Dial an extension on the console"),
+	AST_CLI_DEFINE(skypiax_console_playback_boost, "Sets/displays spk boost in dB"),
+	AST_CLI_DEFINE(skypiax_console_capture_boost, "Sets/displays mic boost in dB"),
+	AST_CLI_DEFINE(skypiax_console_set_active, "Sets/displays active console"),
+	AST_CLI_DEFINE(skypiax_console_skype, "Sends a Skype command"),
+	AST_CLI_DEFINE(skypiax_console_skypiax_dir_import, "imports entries from cellphone"),
+	AST_CLI_DEFINE(skypiax_console_skypiax, "all things skypiax"),
 #endif
 };
 #else
 struct ast_cli_entry myclis[] = {
-  {{"skypiax_hangup", NULL}, skypiax_console_hangup,
-   "Hangup a call on the skypiax_console",
-   skypiax_console_hangup_usage},
-  {{"skypiax_playback_boost", NULL}, skypiax_console_playback_boost, "playback boost",
-   skypiax_console_playback_boost_usage},
-  {{"skypiax_capture_boost", NULL}, skypiax_console_capture_boost, "capture boost",
-   skypiax_console_capture_boost_usage},
-  {{"skypiax_usage", NULL}, skypiax_console_skypiax, "chan_skypiax commands info",
-   skypiax_console_skypiax_usage},
-  {{"skypiax_skype", NULL}, skypiax_console_skype, "Skype msg",
-   skypiax_console_skype_usage},
-  {{"skypiax_dial", NULL}, skypiax_console_dial,
-   "Dial an extension on the skypiax_console",
-   skypiax_console_dial_usage},
-  {{"skypiax_console", NULL}, skypiax_console_set_active,
-   "Sets/displays active skypiax_console",
-   skypiax_console_skypiax_console_usage},
-  {{"skypiax_dir_import", NULL}, skypiax_console_skypiax_dir_import,
-   "Write the directoriax.conf file, used by directoriax app",
-   skypiax_console_skypiax_dir_import_usage},
+	{{"skypiax_hangup", NULL}, skypiax_console_hangup,
+	 "Hangup a call on the skypiax_console",
+	 skypiax_console_hangup_usage},
+	{{"skypiax_playback_boost", NULL}, skypiax_console_playback_boost, "playback boost",
+	 skypiax_console_playback_boost_usage},
+	{{"skypiax_capture_boost", NULL}, skypiax_console_capture_boost, "capture boost",
+	 skypiax_console_capture_boost_usage},
+	{{"skypiax_usage", NULL}, skypiax_console_skypiax, "chan_skypiax commands info",
+	 skypiax_console_skypiax_usage},
+	{{"skypiax_skype", NULL}, skypiax_console_skype, "Skype msg",
+	 skypiax_console_skype_usage},
+	{{"skypiax_dial", NULL}, skypiax_console_dial,
+	 "Dial an extension on the skypiax_console",
+	 skypiax_console_dial_usage},
+	{{"skypiax_console", NULL}, skypiax_console_set_active,
+	 "Sets/displays active skypiax_console",
+	 skypiax_console_skypiax_console_usage},
+	{{"skypiax_dir_import", NULL}, skypiax_console_skypiax_dir_import,
+	 "Write the directoriax.conf file, used by directoriax app",
+	 skypiax_console_skypiax_dir_import_usage},
 };
 #endif
 
@@ -175,88 +171,83 @@
 
 void skypiax_unlocka_log(void *x)
 {
-  ast_mutex_t *y;
-  y = x;
-  int i;
+	ast_mutex_t *y;
+	y = x;
+	int i;
 
-  for (i = 0; i < 5; i++) {     //let's be generous
+	for (i = 0; i < 5; i++) {	//let's be generous
 
-    ast_log(LOG_DEBUG,
-            SKYPIAX_SVN_VERSION
-            "[%-7lx] I'm a dying thread, and I'm to go unlocking mutex %p for the %dth time\n",
-            (unsigned long int) pthread_self(), y, i);
+		ast_log(LOG_DEBUG,
+				SKYPIAX_SVN_VERSION
+				"[%-7lx] I'm a dying thread, and I'm to go unlocking mutex %p for the %dth time\n", (unsigned long int) pthread_self(), y, i);
 
-    ast_mutex_unlock(y);
-  }
-  ast_log(LOG_DEBUG,
-          SKYPIAX_SVN_VERSION
-          "[%-7lx] I'm a dying thread, I've finished unlocking mutex %p\n",
-          (unsigned long int) pthread_self(), y);
+		ast_mutex_unlock(y);
+	}
+	ast_log(LOG_DEBUG, SKYPIAX_SVN_VERSION "[%-7lx] I'm a dying thread, I've finished unlocking mutex %p\n", (unsigned long int) pthread_self(), y);
 }
 
 int skypiax_queue_control(struct ast_channel *c, int control)
 {
-  struct skypiax_pvt *p = c->tech_pvt;
+	struct skypiax_pvt *p = c->tech_pvt;
 
 /* queue the frame */
-  if (p)
-    p->control_to_send = control;
-  else {
-    return 0;
-  }
-  DEBUGA_PBX("Queued CONTROL FRAME %d\n", SKYPIAX_P_LOG, control);
+	if (p)
+		p->control_to_send = control;
+	else {
+		return 0;
+	}
+	DEBUGA_PBX("Queued CONTROL FRAME %d\n", SKYPIAX_P_LOG, control);
 
 /* wait for the frame to be sent */
-  while (p->control_to_send)
-    usleep(1);
+	while (p->control_to_send)
+		usleep(1);
 
-  return 0;
+	return 0;
 }
 
 int skypiax_devicestate(void *data)
 {
-  struct skypiax_pvt *p = NULL;
-  char *name = data;
-  int res = AST_DEVICE_INVALID;
+	struct skypiax_pvt *p = NULL;
+	char *name = data;
+	int res = AST_DEVICE_INVALID;
 
-  if (!data) {
-    ERRORA("Devicestate requested with no data\n", SKYPIAX_P_LOG);
-    return res;
-  }
+	if (!data) {
+		ERRORA("Devicestate requested with no data\n", SKYPIAX_P_LOG);
+		return res;
+	}
 
-  /* lock the interfaces' list */
-  LOKKA(&skypiax_iflock);
-  /* make a pointer to the first interface in the interfaces list */
-  p = skypiax_iflist;
-  /* Search for the requested interface and verify if is unowned */
-  while (p) {
-    size_t length = strlen(p->name);
-    /* is this the requested interface? */
-    if (strncmp(name, p->name, length) == 0) {
-      /* is this interface unowned? */
-      if (!p->owner) {
-        res = AST_DEVICE_NOT_INUSE;
-        DEBUGA_PBX("Interface is NOT OWNED by a channel\n", SKYPIAX_P_LOG);
-      } else {
-        /* interface owned by a channel */
-        res = AST_DEVICE_INUSE;
-        DEBUGA_PBX("Interface is OWNED by a channel\n", SKYPIAX_P_LOG);
-      }
+	/* lock the interfaces' list */
+	LOKKA(&skypiax_iflock);
+	/* make a pointer to the first interface in the interfaces list */
+	p = skypiax_iflist;
+	/* Search for the requested interface and verify if is unowned */
+	while (p) {
+		size_t length = strlen(p->name);
+		/* is this the requested interface? */
+		if (strncmp(name, p->name, length) == 0) {
+			/* is this interface unowned? */
+			if (!p->owner) {
+				res = AST_DEVICE_NOT_INUSE;
+				DEBUGA_PBX("Interface is NOT OWNED by a channel\n", SKYPIAX_P_LOG);
+			} else {
+				/* interface owned by a channel */
+				res = AST_DEVICE_INUSE;
+				DEBUGA_PBX("Interface is OWNED by a channel\n", SKYPIAX_P_LOG);
+			}
 
-      /* we found the requested interface, bail out from the while loop */
-      break;
-    }
-    /* not yet found, next please */
-    p = p->next;
-  }
-  /* unlock the interfaces' list */
-  UNLOCKA(&skypiax_iflock);
+			/* we found the requested interface, bail out from the while loop */
+			break;
+		}
+		/* not yet found, next please */
+		p = p->next;
+	}
+	/* unlock the interfaces' list */
+	UNLOCKA(&skypiax_iflock);
 
-  if (res == AST_DEVICE_INVALID) {
-    ERRORA("Checking device state for interface [%s] returning AST_DEVICE_INVALID\n",
-           SKYPIAX_P_LOG, name);
-  }
-  return res;
+	if (res == AST_DEVICE_INVALID) {
+		ERRORA("Checking device state for interface [%s] returning AST_DEVICE_INVALID\n", SKYPIAX_P_LOG, name);
+	}
+	return res;
 }
 
 #ifndef ASTERISK_VERSION_1_4
@@ -265,129 +256,126 @@
 int skypiax_indicate(struct ast_channel *c, int cond, const void *data, size_t datalen)
 #endif
 {
-  struct skypiax_pvt *p = c->tech_pvt;
-  int res = 0;
+	struct skypiax_pvt *p = c->tech_pvt;
+	int res = 0;
 
-  NOTICA("Let's INDICATE %d\n", SKYPIAX_P_LOG, cond);
+	NOTICA("Let's INDICATE %d\n", SKYPIAX_P_LOG, cond);
 
-  switch (cond) {
-  case AST_CONTROL_BUSY:
-  case AST_CONTROL_CONGESTION:
-  case AST_CONTROL_RINGING:
-  case -1:
-    res = -1;                   /* Ask for inband indications */
-    break;
-  case AST_CONTROL_PROGRESS:
-  case AST_CONTROL_PROCEEDING:
-  case AST_CONTROL_VIDUPDATE:
-  case AST_CONTROL_HOLD:
-  case AST_CONTROL_UNHOLD:
+	switch (cond) {
+	case AST_CONTROL_BUSY:
+	case AST_CONTROL_CONGESTION:
+	case AST_CONTROL_RINGING:
+	case -1:
+		res = -1;				/* Ask for inband indications */
+		break;
+	case AST_CONTROL_PROGRESS:
+	case AST_CONTROL_PROCEEDING:
+	case AST_CONTROL_VIDUPDATE:
+	case AST_CONTROL_HOLD:
+	case AST_CONTROL_UNHOLD:
 #ifdef ASTERISK_VERSION_1_4
-  case AST_CONTROL_SRCUPDATE:
+	case AST_CONTROL_SRCUPDATE:
 #endif /* ASTERISK_VERSION_1_4 */
-    break;
-  default:
-    WARNINGA("Don't know how to display condition %d on %s\n", SKYPIAX_P_LOG, cond,
-             c->name);
-    /* The core will play inband indications for us if appropriate */
-    res = -1;
-  }
+		break;
+	default:
+		WARNINGA("Don't know how to display condition %d on %s\n", SKYPIAX_P_LOG, cond, c->name);
+		/* The core will play inband indications for us if appropriate */
+		res = -1;
+	}
 
-  return res;
+	return res;
 }
 
 /*! \brief PBX interface function -build skypiax pvt structure 
  *         skypiax calls initiated by the PBX arrive here */
 struct ast_channel *skypiax_request(const char *type, int format, void *data, int *cause)
 {
-  struct skypiax_pvt *p = NULL;
-  struct ast_channel *tmp = NULL;
-  char *name = data;
-  int found = 0;
+	struct skypiax_pvt *p = NULL;
+	struct ast_channel *tmp = NULL;
+	char *name = data;
+	int found = 0;
 
-  DEBUGA_PBX("Try to request type: %s, name: %s, cause: %d," " format: %d\n",
-             SKYPIAX_P_LOG, type, name, *cause, format);
+	DEBUGA_PBX("Try to request type: %s, name: %s, cause: %d," " format: %d\n", SKYPIAX_P_LOG, type, name, *cause, format);
 
-  if (!data) {
-    ERRORA("Channel requested with no data\n", SKYPIAX_P_LOG);
-    return NULL;
-  }
+	if (!data) {
+		ERRORA("Channel requested with no data\n", SKYPIAX_P_LOG);
+		return NULL;
+	}
 
-  char interface[256];
-  int i;
-  memset(interface, '\0', sizeof(interface));
+	char interface[256];
+	int i;
+	memset(interface, '\0', sizeof(interface));
 
-  for (i = 0; i < sizeof(interface); i++) {
-    if (name[i] == '/')
-      break;
-    interface[i] = name[i];
-  }
-  /* lock the interfaces' list */
-  LOKKA(&skypiax_iflock);
-  /* make a pointer to the first interface in the interfaces list */
-  p = skypiax_iflist;
+	for (i = 0; i < sizeof(interface); i++) {
+		if (name[i] == '/')
+			break;
+		interface[i] = name[i];
+	}
+	/* lock the interfaces' list */
+	LOKKA(&skypiax_iflock);
+	/* make a pointer to the first interface in the interfaces list */
+	p = skypiax_iflist;
 
-  if (strcmp("ANY", interface) == 0) {
-    /* we've been asked for the "ANY" interface, let's find the first idle interface */
-    DEBUGA_SKYPE("Finding one available skype interface\n", SKYPIAX_P_LOG);
-    p = find_available_skypiax_interface();
-    if (p) {
-      found = 1;
+	if (strcmp("ANY", interface) == 0) {
+		/* we've been asked for the "ANY" interface, let's find the first idle interface */
+		DEBUGA_SKYPE("Finding one available skype interface\n", SKYPIAX_P_LOG);
+		p = find_available_skypiax_interface();
+		if (p) {
+			found = 1;
 
-      /* create a new channel owning this interface */
-      tmp = skypiax_new(p, SKYPIAX_STATE_DOWN, p->context);
-      if (!tmp) {
-        /* the channel was not created, probable memory allocation error */
-        *cause = AST_CAUSE_SWITCH_CONGESTION;
-      }
+			/* create a new channel owning this interface */
+			tmp = skypiax_new(p, SKYPIAX_STATE_DOWN, p->context);
+			if (!tmp) {
+				/* the channel was not created, probable memory allocation error */
+				*cause = AST_CAUSE_SWITCH_CONGESTION;
+			}
 
-    }
+		}
 
-  }
+	}
 
-  /* Search for the requested interface and verify if is unowned and format compatible */
-  while (p && !found) {
-    //size_t length = strlen(p->name);
-    /* is this the requested interface? */
-    if (strcmp(interface, p->name) == 0) {
-      /* is the requested format supported by this interface? */
-      if ((format & AST_FORMAT_SLINEAR) != 0) {
-        /* is this interface unowned? */
-        if (!p->owner) {
-          DEBUGA_PBX("Requesting: %s, name: %s, format: %d\n", SKYPIAX_P_LOG, type, name,
-                     format);
-          /* create a new channel owning this interface */
-          tmp = skypiax_new(p, SKYPIAX_STATE_DOWN, p->context);
-          if (!tmp) {
-            /* the channel was not created, probable memory allocation error */
-            *cause = AST_CAUSE_SWITCH_CONGESTION;
-          }
-        } else {
-          /* interface owned by another channel */
-          WARNINGA("owned by another channel\n", SKYPIAX_P_LOG);
-          *cause = AST_CAUSE_REQUESTED_CHAN_UNAVAIL;
-        }
-      } else {
-        /* requested format not supported */
-        WARNINGA("format %d not supported\n", SKYPIAX_P_LOG, format);
-        *cause = AST_CAUSE_BEARERCAPABILITY_NOTAVAIL;
-      }
-      /* we found the requested interface, bail out from the while loop */
-      break;
-    }
-    /* not yet found, next please */
-    p = p->next;
-  }
-  /* unlock the interfaces' list */
-  UNLOCKA(&skypiax_iflock);
-  /* restart the monitor so it will watch only the remaining unowned interfaces  */
-  skypiax_restart_monitor();
-  if (tmp == NULL) {
-    /* new channel was not created */
-    WARNINGA("Unable to create new Skypiax channel %s\n", SKYPIAX_P_LOG, name);
-  }
-  /* return the newly created channel */
-  return tmp;
+	/* Search for the requested interface and verify if is unowned and format compatible */
+	while (p && !found) {
+		//size_t length = strlen(p->name);
+		/* is this the requested interface? */
+		if (strcmp(interface, p->name) == 0) {
+			/* is the requested format supported by this interface? */
+			if ((format & AST_FORMAT_SLINEAR) != 0) {
+				/* is this interface unowned? */
+				if (!p->owner) {
+					DEBUGA_PBX("Requesting: %s, name: %s, format: %d\n", SKYPIAX_P_LOG, type, name, format);
+					/* create a new channel owning this interface */
+					tmp = skypiax_new(p, SKYPIAX_STATE_DOWN, p->context);
+					if (!tmp) {
+						/* the channel was not created, probable memory allocation error */
+						*cause = AST_CAUSE_SWITCH_CONGESTION;
+					}
+				} else {
+					/* interface owned by another channel */
+					WARNINGA("owned by another channel\n", SKYPIAX_P_LOG);
+					*cause = AST_CAUSE_REQUESTED_CHAN_UNAVAIL;
+				}
+			} else {
+				/* requested format not supported */
+				WARNINGA("format %d not supported\n", SKYPIAX_P_LOG, format);
+				*cause = AST_CAUSE_BEARERCAPABILITY_NOTAVAIL;
+			}
+			/* we found the requested interface, bail out from the while loop */
+			break;
+		}
+		/* not yet found, next please */
+		p = p->next;
+	}
+	/* unlock the interfaces' list */
+	UNLOCKA(&skypiax_iflock);
+	/* restart the monitor so it will watch only the remaining unowned interfaces  */
+	skypiax_restart_monitor();
+	if (tmp == NULL) {
+		/* new channel was not created */
+		WARNINGA("Unable to create new Skypiax channel %s\n", SKYPIAX_P_LOG, name);
+	}
+	/* return the newly created channel */
+	return tmp;
 }
 
 /*! \brief  Hangup skypiax call
@@ -395,144 +383,142 @@
 
 int skypiax_hangup(struct ast_channel *c)
 {
-  struct skypiax_pvt *p;
+	struct skypiax_pvt *p;
 
-  /* get our skypiax pvt interface from channel */
-  p = c->tech_pvt;
-  /* if there is not skypiax pvt why we are here ? */
-  if (!p) {
-    ERRORA("Asked to hangup channel not connected\n", SKYPIAX_P_LOG);
-    return 0;
-  }
+	/* get our skypiax pvt interface from channel */
+	p = c->tech_pvt;
+	/* if there is not skypiax pvt why we are here ? */
+	if (!p) {
+		ERRORA("Asked to hangup channel not connected\n", SKYPIAX_P_LOG);
+		return 0;
+	}
 
-  if (p->skype && p->interface_state != SKYPIAX_STATE_DOWN) {
-    char msg_to_skype[1024];
-    p->interface_state = SKYPIAX_STATE_HANGUP_REQUESTED;
-    DEBUGA_SKYPE("hanging up skype call: %s\n", SKYPIAX_P_LOG, p->skype_call_id);
-    //sprintf(msg_to_skype, "SET CALL %s STATUS FINISHED", p->skype_call_id);
-    sprintf(msg_to_skype, "ALTER CALL %s HANGUP", p->skype_call_id);
-    skypiax_signaling_write(p, msg_to_skype);
-  }
+	if (p->skype && p->interface_state != SKYPIAX_STATE_DOWN) {
+		char msg_to_skype[1024];
+		p->interface_state = SKYPIAX_STATE_HANGUP_REQUESTED;
+		DEBUGA_SKYPE("hanging up skype call: %s\n", SKYPIAX_P_LOG, p->skype_call_id);
+		//sprintf(msg_to_skype, "SET CALL %s STATUS FINISHED", p->skype_call_id);
+		sprintf(msg_to_skype, "ALTER CALL %s HANGUP", p->skype_call_id);
+		skypiax_signaling_write(p, msg_to_skype);
+	}
 
-  while (p->interface_state != SKYPIAX_STATE_DOWN) {
-    usleep(10000);
-  }
-  DEBUGA_SKYPE("Now is really DOWN\n", SKYPIAX_P_LOG);
-  /* shutdown the serial monitoring thread */
-  if (p->controldev_thread && (p->controldev_thread != AST_PTHREADT_NULL)
-      && (p->controldev_thread != AST_PTHREADT_STOP)) {
-    if (pthread_cancel(p->controldev_thread)) {
-      ERRORA("controldev_thread pthread_cancel failed, maybe he killed himself?\n",
-             SKYPIAX_P_LOG);
-    }
-    /* push it, maybe is stuck in a select or so */
-    if (pthread_kill(p->controldev_thread, SIGURG)) {
-      DEBUGA_SERIAL("controldev_thread pthread_kill failed, no problem\n", SKYPIAX_P_LOG);
-    }
-#ifndef __CYGWIN__              /* under cygwin, this seems to be not reliable, get stuck at times */
-    /* wait for it to die */
-    if (pthread_join(p->controldev_thread, NULL)) {
-      ERRORA("controldev_thread pthread_join failed, BAD\n", SKYPIAX_P_LOG);
-    }
+	while (p->interface_state != SKYPIAX_STATE_DOWN) {
+		usleep(10000);
+	}
+	DEBUGA_SKYPE("Now is really DOWN\n", SKYPIAX_P_LOG);
+	/* shutdown the serial monitoring thread */
+	if (p->controldev_thread && (p->controldev_thread != AST_PTHREADT_NULL)
+		&& (p->controldev_thread != AST_PTHREADT_STOP)) {
+		if (pthread_cancel(p->controldev_thread)) {
+			ERRORA("controldev_thread pthread_cancel failed, maybe he killed himself?\n", SKYPIAX_P_LOG);
+		}
+		/* push it, maybe is stuck in a select or so */
+		if (pthread_kill(p->controldev_thread, SIGURG)) {
+			DEBUGA_SERIAL("controldev_thread pthread_kill failed, no problem\n", SKYPIAX_P_LOG);
+		}
+#ifndef __CYGWIN__				/* under cygwin, this seems to be not reliable, get stuck at times */
+		/* wait for it to die */
+		if (pthread_join(p->controldev_thread, NULL)) {
+			ERRORA("controldev_thread pthread_join failed, BAD\n", SKYPIAX_P_LOG);
+		}
 #else /* __CYGWIN__ */
 /* allow the serial thread to die */
-    usleep(300000);             //300msecs
+		usleep(300000);			//300msecs
 #endif /* __CYGWIN__ */
-  }
-  p->controldev_thread = AST_PTHREADT_NULL;
+	}
+	p->controldev_thread = AST_PTHREADT_NULL;
 
-  p->interface_state = SKYPIAX_STATE_DOWN;
-  p->skype_callflow = CALLFLOW_CALL_IDLE;
+	p->interface_state = SKYPIAX_STATE_DOWN;
+	p->skype_callflow = CALLFLOW_CALL_IDLE;
 
-  DEBUGA_PBX("I'll send AST_CONTROL_HANGUP\n", SKYPIAX_P_LOG);
-  ast_queue_control(p->owner, AST_CONTROL_HANGUP);
-  DEBUGA_PBX("I've sent AST_CONTROL_HANGUP\n", SKYPIAX_P_LOG);
+	DEBUGA_PBX("I'll send AST_CONTROL_HANGUP\n", SKYPIAX_P_LOG);
+	ast_queue_control(p->owner, AST_CONTROL_HANGUP);
+	DEBUGA_PBX("I've sent AST_CONTROL_HANGUP\n", SKYPIAX_P_LOG);
 
-  /* subtract one to the usage count of Skypiax-type channels */
-  LOKKA(&skypiax_usecnt_lock);
-  skypiax_usecnt--;
-  if (skypiax_usecnt < 0)
-    ERRORA("Usecnt < 0???\n", SKYPIAX_P_LOG);
-  UNLOCKA(&skypiax_usecnt_lock);
-  ast_update_use_count();
+	/* subtract one to the usage count of Skypiax-type channels */
+	LOKKA(&skypiax_usecnt_lock);
+	skypiax_usecnt--;
+	if (skypiax_usecnt < 0)
+		ERRORA("Usecnt < 0???\n", SKYPIAX_P_LOG);
+	UNLOCKA(&skypiax_usecnt_lock);
+	ast_update_use_count();
 
-  /* our skypiax pvt interface is no more part of a channel */
-  p->owner = NULL;
-  /* our channel has no more this skypiax pvt interface to manage */
-  c->tech_pvt = NULL;
-  /* set the channel state to DOWN, eg. available, not in active use */
-  if (ast_setstate(c, SKYPIAX_STATE_DOWN)) {
-    ERRORA("ast_setstate failed, BAD\n", SKYPIAX_P_LOG);
-    return -1;
-  }
+	/* our skypiax pvt interface is no more part of a channel */
+	p->owner = NULL;
+	/* our channel has no more this skypiax pvt interface to manage */
+	c->tech_pvt = NULL;
+	/* set the channel state to DOWN, eg. available, not in active use */
+	if (ast_setstate(c, SKYPIAX_STATE_DOWN)) {
+		ERRORA("ast_setstate failed, BAD\n", SKYPIAX_P_LOG);
+		return -1;
+	}
 
-  /* restart the monitor thread, so it can recheck which interfaces it have to watch during its loop (the interfaces that are not owned by channels) */
-  if (skypiax_restart_monitor()) {
-    ERRORA("skypiax_restart_monitor failed, BAD\n", SKYPIAX_P_LOG);
-    return -1;
-  }
+	/* restart the monitor thread, so it can recheck which interfaces it have to watch during its loop (the interfaces that are not owned by channels) */
+	if (skypiax_restart_monitor()) {
+		ERRORA("skypiax_restart_monitor failed, BAD\n", SKYPIAX_P_LOG);
+		return -1;
+	}
 
-  return 0;
+	return 0;
 }
 
 /*! \brief  Answer incoming call,
  * Part of PBX interface */
 int skypiax_answer(struct ast_channel *c)
 {
-  struct skypiax_pvt *p = c->tech_pvt;
-  int res;
+	struct skypiax_pvt *p = c->tech_pvt;
+	int res;
 
-  /* whle ringing, we just wait, the skype thread will answer */
-  while (p->interface_state == SKYPIAX_STATE_RING) {
-    usleep(10000);              //10msec
-  }
-  if (p->interface_state != SKYPIAX_STATE_UP) {
-    ERRORA("call answering failed, we want it to be into interface_state=%d, got %d\n",
-           SKYPIAX_P_LOG, SKYPIAX_STATE_UP, p->interface_state);
-    res = -1;
-  } else {
-    DEBUGA_PBX("call answered\n", SKYPIAX_P_LOG);
-    res = 0;
-  }
-  return res;
+	/* whle ringing, we just wait, the skype thread will answer */
+	while (p->interface_state == SKYPIAX_STATE_RING) {
+		usleep(10000);			//10msec
+	}
+	if (p->interface_state != SKYPIAX_STATE_UP) {
+		ERRORA("call answering failed, we want it to be into interface_state=%d, got %d\n", SKYPIAX_P_LOG, SKYPIAX_STATE_UP, p->interface_state);
+		res = -1;
+	} else {
+		DEBUGA_PBX("call answered\n", SKYPIAX_P_LOG);
+		res = 0;
+	}
+	return res;
 }
 
 #ifdef ASTERISK_VERSION_1_4
 int skypiax_digitsend_begin(struct ast_channel *c, char digit)
 {
-  struct skypiax_pvt *p = c->tech_pvt;
+	struct skypiax_pvt *p = c->tech_pvt;
 
-  DEBUGA_PBX("DIGIT BEGIN received: %c\n", SKYPIAX_P_LOG, digit);
+	DEBUGA_PBX("DIGIT BEGIN received: %c\n", SKYPIAX_P_LOG, digit);
 
-  return 0;
+	return 0;
 }
 
 int skypiax_digitsend_end(struct ast_channel *c, char digit, unsigned int duration)
 {
-  struct skypiax_pvt *p = c->tech_pvt;
-  char msg_to_skype[1024];
+	struct skypiax_pvt *p = c->tech_pvt;
+	char msg_to_skype[1024];
 
-  NOTICA("DIGIT END received: %c %d\n", SKYPIAX_P_LOG, digit, duration);
+	NOTICA("DIGIT END received: %c %d\n", SKYPIAX_P_LOG, digit, duration);
 
-  sprintf(msg_to_skype, "SET CALL %s DTMF %c", p->skype_call_id, digit);
+	sprintf(msg_to_skype, "SET CALL %s DTMF %c", p->skype_call_id, digit);
 
-  skypiax_signaling_write(p, msg_to_skype);
+	skypiax_signaling_write(p, msg_to_skype);
 
-  return 0;
+	return 0;
 }
 #else /* ASTERISK_VERSION_1_4 */
 int skypiax_digitsend(struct ast_channel *c, char digit)
 {
-  struct skypiax_pvt *p = c->tech_pvt;
-  char msg_to_skype[1024];
+	struct skypiax_pvt *p = c->tech_pvt;
+	char msg_to_skype[1024];
 
-  NOTICA("DIGIT received: %c\n", SKYPIAX_P_LOG, digit);
+	NOTICA("DIGIT received: %c\n", SKYPIAX_P_LOG, digit);
 
-  sprintf(msg_to_skype, "SET CALL %s DTMF %c", p->skype_call_id, digit);
+	sprintf(msg_to_skype, "SET CALL %s DTMF %c", p->skype_call_id, digit);
 
-  skypiax_signaling_write(p, msg_to_skype);
+	skypiax_signaling_write(p, msg_to_skype);
 
-  return 0;
+	return 0;
 }
 
 #endif /* ASTERISK_VERSION_1_4 */
@@ -541,62 +527,61 @@
 /*! \brief Read audio frames from channel */
 struct ast_frame *skypiax_read(struct ast_channel *c)
 {
-  struct skypiax_pvt *p = c->tech_pvt;
-  static struct ast_frame f;
-  static short __buf[SKYPIAX_FRAME_SIZE + AST_FRIENDLY_OFFSET / 2];
-  short *buf;
-  int samples;
+	struct skypiax_pvt *p = c->tech_pvt;
+	static struct ast_frame f;
+	static short __buf[SKYPIAX_FRAME_SIZE + AST_FRIENDLY_OFFSET / 2];
+	short *buf;
+	int samples;
 
 /* if there are control frames queued to be sent by skypiax_queue_control, send it the first */
 //TODO maybe better a real queue?
-  if (p && p->owner && p->control_to_send) {
-    ast_queue_control(p->owner, p->control_to_send);
-    DEBUGA_PBX("Sent CONTROL FRAME %d\n", SKYPIAX_P_LOG, p->control_to_send);
-    p->control_to_send = 0;
-  }
+	if (p && p->owner && p->control_to_send) {
+		ast_queue_control(p->owner, p->control_to_send);
+		DEBUGA_PBX("Sent CONTROL FRAME %d\n", SKYPIAX_P_LOG, p->control_to_send);
+		p->control_to_send = 0;
+	}
 
-  memset(__buf, '\0', (SKYPIAX_FRAME_SIZE + AST_FRIENDLY_OFFSET / 2));
+	memset(__buf, '\0', (SKYPIAX_FRAME_SIZE + AST_FRIENDLY_OFFSET / 2));
 
-  buf = __buf + AST_FRIENDLY_OFFSET / 2;
+	buf = __buf + AST_FRIENDLY_OFFSET / 2;
 
-  f.frametype = AST_FRAME_NULL;
-  f.subclass = 0;
-  f.samples = 0;
-  f.datalen = 0;
-  f.data = NULL;
-  f.offset = 0;
-  f.src = skypiax_type;
-  f.mallocd = 0;
-  f.delivery.tv_sec = 0;
-  f.delivery.tv_usec = 0;
+	f.frametype = AST_FRAME_NULL;
+	f.subclass = 0;
+	f.samples = 0;
+	f.datalen = 0;
+	f.data = NULL;
+	f.offset = 0;
+	f.src = skypiax_type;
+	f.mallocd = 0;
+	f.delivery.tv_sec = 0;
+	f.delivery.tv_usec = 0;
 
 /* if the call is not active (ie: answered), do not send audio frames, they would pile up in a lag queue */
-  if (p->owner && p->owner->_state != SKYPIAX_STATE_UP) {
-    return &f;
-  }
+	if (p->owner && p->owner->_state != SKYPIAX_STATE_UP) {
+		return &f;
+	}
 
-  if ((samples = read(p->audiopipe[0], buf, SAMPLES_PER_FRAME * sizeof(short))) != 320) {
-    DEBUGA_SOUND("read=====> NOT GOOD samples=%d expected=%d\n", SKYPIAX_P_LOG, samples,
-                 SAMPLES_PER_FRAME * sizeof(short));
-    usleep(100);
-    //do nothing
-  } else {
-    //DEBUGA_SOUND("read=====> GOOD samples=%d\n", SKYPIAX_P_LOG, samples);
-    /* A real frame */
-    f.frametype = AST_FRAME_VOICE;
-    f.subclass = AST_FORMAT_SLINEAR;
-    f.samples = SKYPIAX_FRAME_SIZE;
-    f.datalen = SKYPIAX_FRAME_SIZE * 2;
-    f.data = buf;
-    f.offset = AST_FRIENDLY_OFFSET;
-    f.src = skypiax_type;
-    f.mallocd = 0;
+	if ((samples = read(p->audiopipe[0], buf, SAMPLES_PER_FRAME * sizeof(short))) != 320) {
+		DEBUGA_SOUND("read=====> NOT GOOD samples=%d expected=%d\n", SKYPIAX_P_LOG, samples, SAMPLES_PER_FRAME * sizeof(short));
+		usleep(100);
+		//do nothing
+	} else {
+		//DEBUGA_SOUND("read=====> GOOD samples=%d\n", SKYPIAX_P_LOG, samples);
+		/* A real frame */
+		f.frametype = AST_FRAME_VOICE;
+		f.subclass = AST_FORMAT_SLINEAR;
+		f.samples = SKYPIAX_FRAME_SIZE;
+		f.datalen = SKYPIAX_FRAME_SIZE * 2;
+		f.data = buf;
+		f.offset = AST_FRIENDLY_OFFSET;
+		f.src = skypiax_type;
+		f.mallocd = 0;
 
-    if (p->capture_boost)
-      skypiax_sound_boost(&f, p->capture_boost);
-  }
+		if (p->capture_boost)
+			skypiax_sound_boost(&f, p->capture_boost);
+	}
 
-  return &f;
+	return &f;
 }
 
 /*! \brief Initiate skypiax call from PBX 
@@ -604,210 +589,199 @@
  */
 int skypiax_originate_call(struct ast_channel *c, char *idest, int timeout)
 {
-  struct skypiax_pvt *p = NULL;
-  p = c->tech_pvt;
-  char rdest[80], *where, dstr[100] = "";
-  char *stringp = NULL;
-  int status;
+	struct skypiax_pvt *p = NULL;
+	p = c->tech_pvt;
+	char rdest[80], *where, dstr[100] = "";
+	char *stringp = NULL;
+	int status;
 
-  if ((c->_state != SKYPIAX_STATE_DOWN)
-      && (c->_state != SKYPIAX_STATE_RESERVED)) {
-    ERRORA("skypiax_originate_call called on %s, neither down nor reserved\n",
-           SKYPIAX_P_LOG, c->name);
-    return -1;
-  }
+	if ((c->_state != SKYPIAX_STATE_DOWN)
+		&& (c->_state != SKYPIAX_STATE_RESERVED)) {
+		ERRORA("skypiax_originate_call called on %s, neither down nor reserved\n", SKYPIAX_P_LOG, c->name);
+		return -1;
+	}
 
-  DEBUGA_PBX("skypiax_originate_call to call idest: %s, timeout: %d!\n", SKYPIAX_P_LOG,
-             idest, timeout);
+	DEBUGA_PBX("skypiax_originate_call to call idest: %s, timeout: %d!\n", SKYPIAX_P_LOG, idest, timeout);
 
-  strncpy(rdest, idest, sizeof(rdest) - 1);
-  stringp = rdest;
-  strsep(&stringp, "/");
-  where = strsep(&stringp, "/");
-  if (!where) {
-    ERRORA("Destination %s requires an actual destination (Skypiax/device/destination)\n",
-           SKYPIAX_P_LOG, idest);
-    return -1;
-  }
+	strncpy(rdest, idest, sizeof(rdest) - 1);
+	stringp = rdest;
+	strsep(&stringp, "/");
+	where = strsep(&stringp, "/");
+	if (!where) {
+		ERRORA("Destination %s requires an actual destination (Skypiax/device/destination)\n", SKYPIAX_P_LOG, idest);
+		return -1;
+	}
 
-  strncpy(dstr, where + p->stripmsd, sizeof(dstr) - 1);
-  DEBUGA_PBX("skypiax_originate_call dialing idest: %s, timeout: %d, dstr: %s!\n",
-             SKYPIAX_P_LOG, idest, timeout, dstr);
+	strncpy(dstr, where + p->stripmsd, sizeof(dstr) - 1);
+	DEBUGA_PBX("skypiax_originate_call dialing idest: %s, timeout: %d, dstr: %s!\n", SKYPIAX_P_LOG, idest, timeout, dstr);
 
-  strcpy(p->session_uuid_str, "dialing");
-  status = skypiax_call(p, dstr, timeout);
-  if (status) {
-    WARNINGA("skypiax_originate_call dialing failed: %d!\n", SKYPIAX_P_LOG, status);
-    return -1;
-  }
+	strcpy(p->session_uuid_str, "dialing");
+	status = skypiax_call(p, dstr, timeout);
+	if (status) {
+		WARNINGA("skypiax_originate_call dialing failed: %d!\n", SKYPIAX_P_LOG, status);
+		return -1;
+	}
 
-  DEBUGA_PBX("skypiax_originate_call dialed idest: %s, timeout: %d, dstr: %s!\n",
-             SKYPIAX_P_LOG, idest, timeout, dstr);
+	DEBUGA_PBX("skypiax_originate_call dialed idest: %s, timeout: %d, dstr: %s!\n", SKYPIAX_P_LOG, idest, timeout, dstr);
 
-  ast_setstate(p->owner, SKYPIAX_STATE_DIALING);
-  return 0;
+	ast_setstate(p->owner, SKYPIAX_STATE_DIALING);
+	return 0;
 }
 
 int skypiax_sound_boost(struct ast_frame *f, double boost)
 {
 /* LUIGI RIZZO's magic */
-  if (boost != 0) {             /* scale and clip values */
-    int i, x;
-    int16_t *ptr = (int16_t *) f->data;
-    for (i = 0; i < f->samples; i++) {
-      x = (ptr[i] * boost) / BOOST_SCALE;
-      if (x > 32767) {
-        x = 32767;
-      } else if (x < -32768) {
-        x = -32768;
-      }
-      ptr[i] = x;
-    }
-  }
-  return 0;
+	if (boost != 0) {			/* scale and clip values */
+		int i, x;
+		int16_t *ptr = (int16_t *) f->data;
+		for (i = 0; i < f->samples; i++) {
+			x = (ptr[i] * boost) / BOOST_SCALE;
+			if (x > 32767) {
+				x = 32767;
+			} else if (x < -32768) {
+				x = -32768;
+			}
+			ptr[i] = x;
+		}
+	}
+	return 0;
 }
 
 /*! \brief Send audio frame to channel */
 int skypiax_write(struct ast_channel *c, struct ast_frame *f)
 {
-  struct skypiax_pvt *p = c->tech_pvt;
-  int sent;
+	struct skypiax_pvt *p = c->tech_pvt;
+	int sent;
 
-  if (p->owner && p->owner->_state != SKYPIAX_STATE_UP) {
-    return 0;
-  }
-  if (p->playback_boost)
-    skypiax_sound_boost(f, p->playback_boost);
+	if (p->owner && p->owner->_state != SKYPIAX_STATE_UP) {
+		return 0;
+	}
+	if (p->playback_boost)
+		skypiax_sound_boost(f, p->playback_boost);
 
-  sent = write(p->audioskypepipe[1], (short *) f->data, f->datalen);
-  //skypiax_sound_write(p, f);
+	sent = write(p->audioskypepipe[1], (short *) f->data, f->datalen);
+	//skypiax_sound_write(p, f);
 
-  return 0;
+	return 0;
 }
 
 /*! \brief  Fix up a channel:  If a channel is consumed, this is called.
  * Basically update any ->owner links */
 int skypiax_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
 {
-  struct skypiax_pvt *p = newchan->tech_pvt;
+	struct skypiax_pvt *p = newchan->tech_pvt;
 
-  if (!p) {
-    ERRORA("No pvt after masquerade. Strange things may happen\n", SKYPIAX_P_LOG);
-    return -1;
-  }
+	if (!p) {
+		ERRORA("No pvt after masquerade. Strange things may happen\n", SKYPIAX_P_LOG);
+		return -1;
+	}
 
-  if (p->owner != oldchan) {
-    ERRORA("old channel wasn't %p but was %p\n", SKYPIAX_P_LOG, oldchan, p->owner);
-    return -1;
-  }
+	if (p->owner != oldchan) {
+		ERRORA("old channel wasn't %p but was %p\n", SKYPIAX_P_LOG, oldchan, p->owner);
+		return -1;
+	}
 
-  p->owner = newchan;
-  return 0;
+	p->owner = newchan;
+	return 0;
 }
 
 struct ast_channel *skypiax_new(struct skypiax_pvt *p, int state, char *context)
 {
-  struct ast_channel *tmp;
+	struct ast_channel *tmp;
 
-  /* alloc a generic channel struct */
+	/* alloc a generic channel struct */
 #ifndef ASTERISK_VERSION_1_4
-  tmp = ast_channel_alloc(1);
+	tmp = ast_channel_alloc(1);
 #else
-  //tmp = ast_channel_alloc(1, state, 0, 0, "", p->exten, p->context, 0, "");
-  //tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, i->amaflags, "Skypiax/%s", p->name);
-  tmp =
-    ast_channel_alloc(1, state, 0, 0, "", p->exten, p->context, 0, "Skypiax/%s", p->name);
+	//tmp = ast_channel_alloc(1, state, 0, 0, "", p->exten, p->context, 0, "");
+	//tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, i->amaflags, "Skypiax/%s", p->name);
+	tmp = ast_channel_alloc(1, state, 0, 0, "", p->exten, p->context, 0, "Skypiax/%s", p->name);
 
 #endif /* ASTERISK_VERSION_1_4 */
-  if (tmp) {
+	if (tmp) {
 
-    /* give a name to the newly created channel */
+		/* give a name to the newly created channel */
 #ifndef ASTERISK_VERSION_1_4
-    snprintf(tmp->name, sizeof(tmp->name), "Skypiax/%s", p->name);
-    tmp->type = skypiax_type;
+		snprintf(tmp->name, sizeof(tmp->name), "Skypiax/%s", p->name);
+		tmp->type = skypiax_type;
 #else /* ASTERISK_VERSION_1_4 */
-    ast_string_field_build(tmp, name, "Skypiax/%s", p->name);
+		ast_string_field_build(tmp, name, "Skypiax/%s", p->name);
 #endif /* ASTERISK_VERSION_1_4 */
 
-    DEBUGA_PBX("new channel: name=%s requested_state=%d\n", SKYPIAX_P_LOG, tmp->name,
-               state);
+		DEBUGA_PBX("new channel: name=%s requested_state=%d\n", SKYPIAX_P_LOG, tmp->name, state);
 
-    /* fd for the channel to poll for incoming audio */
-    tmp->fds[0] = p->skypiax_sound_capt_fd;
+		/* fd for the channel to poll for incoming audio */
+		tmp->fds[0] = p->skypiax_sound_capt_fd;
 
-    /* audio formats managed */
-    tmp->nativeformats = AST_FORMAT_SLINEAR;
-    tmp->readformat = AST_FORMAT_SLINEAR;
-    tmp->writeformat = AST_FORMAT_SLINEAR;
-    /* the technology description (eg. the interface type) of the newly created channel is the Skypiax's one */
-    tmp->tech = &skypiax_tech;
-    /* the technology pvt (eg. the interface) of the newly created channel is this interface pvt */
-    tmp->tech_pvt = p;
+		/* audio formats managed */
+		tmp->nativeformats = AST_FORMAT_SLINEAR;
+		tmp->readformat = AST_FORMAT_SLINEAR;
+		tmp->writeformat = AST_FORMAT_SLINEAR;
+		/* the technology description (eg. the interface type) of the newly created channel is the Skypiax's one */
+		tmp->tech = &skypiax_tech;
+		/* the technology pvt (eg. the interface) of the newly created channel is this interface pvt */
+		tmp->tech_pvt = p;
 
-    /* copy this interface default context, extension, language to the newly created channel */
-    if (strlen(p->context))
-      strncpy(tmp->context, p->context, sizeof(tmp->context) - 1);
-    if (strlen(p->exten))
-      strncpy(tmp->exten, p->exten, sizeof(tmp->exten) - 1);
+		/* copy this interface default context, extension, language to the newly created channel */
+		if (strlen(p->context))
+			strncpy(tmp->context, p->context, sizeof(tmp->context) - 1);
+		if (strlen(p->exten))
+			strncpy(tmp->exten, p->exten, sizeof(tmp->exten) - 1);
 #ifndef ASTERISK_VERSION_1_4
-    if (strlen(p->language))
-      strncpy(tmp->language, p->language, sizeof(tmp->language) - 1);
+		if (strlen(p->language))
+			strncpy(tmp->language, p->language, sizeof(tmp->language) - 1);
 #else
-    if (strlen(p->language))
-      ast_string_field_set(tmp, language, p->language);
+		if (strlen(p->language))
+			ast_string_field_set(tmp, language, p->language);
 #endif /* ASTERISK_VERSION_1_4 */
-    /* copy the requested context (not necessarily the interface default) to the newly created channel */
-    if (strlen(context))
-      strncpy(tmp->context, context, sizeof(tmp->context) - 1);
+		/* copy the requested context (not necessarily the interface default) to the newly created channel */
+		if (strlen(context))
+			strncpy(tmp->context, context, sizeof(tmp->context) - 1);
 
-    /* copy this interface default callerid in the newly created channel */
-    ast_set_callerid(tmp, !ast_strlen_zero(p->callid_number) ? p->callid_number : NULL,
-                     !ast_strlen_zero(p->callid_name) ? p->callid_name : NULL,
-                     !ast_strlen_zero(p->callid_number) ? p->callid_number : NULL);
+		/* copy this interface default callerid in the newly created channel */
+		ast_set_callerid(tmp, !ast_strlen_zero(p->callid_number) ? p->callid_number : NULL,
+						 !ast_strlen_zero(p->callid_name) ? p->callid_name : NULL, !ast_strlen_zero(p->callid_number) ? p->callid_number : NULL);
 
-    DEBUGA_PBX("callid_number=%s, callid_name=%s\n", SKYPIAX_P_LOG, p->callid_number,
-               p->callid_name);
+		DEBUGA_PBX("callid_number=%s, callid_name=%s\n", SKYPIAX_P_LOG, p->callid_number, p->callid_name);
 
-    /* the owner of this interface pvt is the newly created channel */
-    p->owner = tmp;
-    /* set the newly created channel state to the requested state */
-    if (ast_setstate(tmp, state)) {
-      ERRORA("ast_setstate failed, BAD\n", SKYPIAX_P_LOG);
-      //ast_dsp_free(p->dsp);
-      ast_channel_free(tmp);
-      return NULL;
-    }
-    /* if the requested state is different from DOWN, let the pbx manage this interface (now part of the newly created channel) */
-    if (state != SKYPIAX_STATE_DOWN) {
-      DEBUGA_PBX("Try to start PBX on %s, state=%d\n", SKYPIAX_P_LOG, tmp->name, state);
-      if (ast_pbx_start(tmp)) {
-        ERRORA("Unable to start PBX on %s\n", SKYPIAX_P_LOG, tmp->name);
-        ast_channel_free(tmp);
-        return NULL;
-      }
-    }
-    /* let's start the serial monitoring thread too, so we can have serial signaling */
-    if (ast_pthread_create(&p->controldev_thread, NULL, skypiax_do_controldev_thread, p) <
-        0) {
-      ERRORA("Unable to start controldev thread.\n", SKYPIAX_P_LOG);
-      ast_channel_free(tmp);
-      tmp = NULL;
-    }
-    DEBUGA_SERIAL("STARTED controldev_thread=%lu STOP=%lu NULL=%lu\n", SKYPIAX_P_LOG,
-                  (unsigned long) p->controldev_thread, (unsigned long) AST_PTHREADT_STOP,
-                  (unsigned long) AST_PTHREADT_NULL);
+		/* the owner of this interface pvt is the newly created channel */
+		p->owner = tmp;
+		/* set the newly created channel state to the requested state */
+		if (ast_setstate(tmp, state)) {
+			ERRORA("ast_setstate failed, BAD\n", SKYPIAX_P_LOG);
+			//ast_dsp_free(p->dsp);
+			ast_channel_free(tmp);
+			return NULL;
+		}
+		/* if the requested state is different from DOWN, let the pbx manage this interface (now part of the newly created channel) */
+		if (state != SKYPIAX_STATE_DOWN) {
+			DEBUGA_PBX("Try to start PBX on %s, state=%d\n", SKYPIAX_P_LOG, tmp->name, state);
+			if (ast_pbx_start(tmp)) {
+				ERRORA("Unable to start PBX on %s\n", SKYPIAX_P_LOG, tmp->name);
+				ast_channel_free(tmp);
+				return NULL;
+			}
+		}
+		/* let's start the serial monitoring thread too, so we can have serial signaling */
+		if (ast_pthread_create(&p->controldev_thread, NULL, skypiax_do_controldev_thread, p) < 0) {
+			ERRORA("Unable to start controldev thread.\n", SKYPIAX_P_LOG);
+			ast_channel_free(tmp);
+			tmp = NULL;
+		}
+		DEBUGA_SERIAL("STARTED controldev_thread=%lu STOP=%lu NULL=%lu\n", SKYPIAX_P_LOG,
+					  (unsigned long) p->controldev_thread, (unsigned long) AST_PTHREADT_STOP, (unsigned long) AST_PTHREADT_NULL);
 
-    /* add one to the usage count of Skypiax-type channels */
-    LOKKA(&skypiax_usecnt_lock);
-    skypiax_usecnt++;
-    UNLOCKA(&skypiax_usecnt_lock);
-    ast_update_use_count();
+		/* add one to the usage count of Skypiax-type channels */
+		LOKKA(&skypiax_usecnt_lock);
+		skypiax_usecnt++;
+		UNLOCKA(&skypiax_usecnt_lock);
+		ast_update_use_count();
 
-    /* return the newly created channel */
-    return tmp;
-  }
-  ERRORA("failed memory allocation for Skypiax channel\n", SKYPIAX_P_LOG);
-  return NULL;
+		/* return the newly created channel */
+		return tmp;
+	}
+	ERRORA("failed memory allocation for Skypiax channel\n", SKYPIAX_P_LOG);
+	return NULL;
 }
 
 /*!
@@ -824,108 +798,103 @@
  */
 int load_module(void)
 {
-  int i;
-  struct ast_config *cfg;
-  struct skypiax_pvt *tmp;
-  struct skypiax_pvt *p = NULL;
-  struct skypiax_pvt *p2 = NULL;
+	int i;
+	struct ast_config *cfg;
+	struct skypiax_pvt *tmp;
+	struct skypiax_pvt *p = NULL;
+	struct skypiax_pvt *p2 = NULL;
 #ifdef ASTERISK_VERSION_1_6
-  struct ast_flags config_flags = { 0 };
+	struct ast_flags config_flags = { 0 };
 #endif /* ASTERISK_VERSION_1_6 */
 
 #if defined(WANT_SKYPE_X11) || defined(__CYGWIN__)
 #ifndef __CYGWIN__
-  if (!XInitThreads())
-    ast_log(LOG_ERROR, "Not initialized XInitThreads!\n");
+	if (!XInitThreads())
+		ast_log(LOG_ERROR, "Not initialized XInitThreads!\n");
 #endif /* __CYGWIN__ */
 #if 0
-  ast_register_atexit(skypiax_disconnect);
-  ast_register_application(skype2skypiaxapp, skype2skypiax, skype2skypiaxsynopsis,
-                           skype2skypiaxdescrip);
-  ast_register_application(skypiax2skypeapp, skypiax2skype, skypiax2skypesynopsis,
-                           skypiax2skypedescrip);
+	ast_register_atexit(skypiax_disconnect);
+	ast_register_application(skype2skypiaxapp, skype2skypiax, skype2skypiaxsynopsis, skype2skypiaxdescrip);
+	ast_register_application(skypiax2skypeapp, skypiax2skype, skypiax2skypesynopsis, skypiax2skypedescrip);
 #endif
 #endif /* defined(WANT_SKYPE_X11) || defined(__CYGWIN__) */
 
-  /* make sure we can register our channel type with Asterisk */
-  i = ast_channel_register(&skypiax_tech);
-  if (i < 0) {
-    ERRORA("Unable to register channel type '%s'\n", SKYPIAX_P_LOG, skypiax_type);
-    return -1;
-  }
-  /* load skypiax.conf config file */
+	/* make sure we can register our channel type with Asterisk */
+	i = ast_channel_register(&skypiax_tech);
+	if (i < 0) {
+		ERRORA("Unable to register channel type '%s'\n", SKYPIAX_P_LOG, skypiax_type);
+		return -1;
+	}
+	/* load skypiax.conf config file */
 #ifdef ASTERISK_VERSION_1_6
-  cfg = ast_config_load(skypiax_config, config_flags);
+	cfg = ast_config_load(skypiax_config, config_flags);
 #else
-  cfg = ast_config_load(skypiax_config);
+	cfg = ast_config_load(skypiax_config);
 #endif /* ASTERISK_VERSION_1_6 */
-  if (cfg != NULL) {
-    char *ctg = NULL;
-    int is_first_category = 1;
-    while ((ctg = ast_category_browse(cfg, ctg)) != NULL) {
-      /* create one interface for each category in skypiax.conf config file, first one set the defaults */
-      tmp = skypiax_mkif(cfg, ctg, is_first_category);
-      if (tmp) {
-        DEBUGA_PBX
-          ("Created channel Skypiax: skypiax.conf category '[%s]', channel name '%s'"
-           "\n", SKYPIAX_P_LOG, ctg, tmp->name);
-        /* add interface to skypiax_iflist */
-        tmp->next = skypiax_iflist;
-        skypiax_iflist = tmp;
-        /* next one will not be the first ;) */
-        if (is_first_category == 1) {
-          is_first_category = 0;
-          skypiax_console_active = tmp->name;
-        }
-      } else {
-        ERRORA("Unable to create channel Skypiax from skypiax.conf category '[%s]'\n",
-               SKYPIAX_P_LOG, ctg);
-        /* if error, unload config from memory and return */
-        ast_config_destroy(cfg);
-        ast_channel_unregister(&skypiax_tech);
-        return -1;
-      }
-      /* do it for each category described in config */
-    }
+	if (cfg != NULL) {
+		char *ctg = NULL;
+		int is_first_category = 1;
+		while ((ctg = ast_category_browse(cfg, ctg)) != NULL) {
+			/* create one interface for each category in skypiax.conf config file, first one set the defaults */
+			tmp = skypiax_mkif(cfg, ctg, is_first_category);
+			if (tmp) {
+				DEBUGA_PBX("Created channel Skypiax: skypiax.conf category '[%s]', channel name '%s'" "\n", SKYPIAX_P_LOG, ctg, tmp->name);
+				/* add interface to skypiax_iflist */
+				tmp->next = skypiax_iflist;
+				skypiax_iflist = tmp;
+				/* next one will not be the first ;) */
+				if (is_first_category == 1) {
+					is_first_category = 0;
+					skypiax_console_active = tmp->name;
+				}
+			} else {
+				ERRORA("Unable to create channel Skypiax from skypiax.conf category '[%s]'\n", SKYPIAX_P_LOG, ctg);
+				/* if error, unload config from memory and return */
+				ast_config_destroy(cfg);
+				ast_channel_unregister(&skypiax_tech);
+				return -1;
+			}
+			/* do it for each category described in config */
+		}
 
-    /* we finished, unload config from memory */
-    ast_config_destroy(cfg);
-  } else {
-    ERRORA("Unable to load skypiax_config skypiax.conf\n", SKYPIAX_P_LOG);
-    ast_channel_unregister(&skypiax_tech);
-    return -1;
-  }
+		/* we finished, unload config from memory */
+		ast_config_destroy(cfg);
+	} else {
+		ERRORA("Unable to load skypiax_config skypiax.conf\n", SKYPIAX_P_LOG);
+		ast_channel_unregister(&skypiax_tech);
+		return -1;
+	}
 #ifndef ASTERISK_VERSION_1_6
-  ast_cli_register_multiple(myclis, sizeof(myclis) / sizeof(struct ast_cli_entry));
+	ast_cli_register_multiple(myclis, sizeof(myclis) / sizeof(struct ast_cli_entry));
 #endif /* ASTERISK_VERSION_1_6 */
-  /* start to monitor the interfaces (skypiax_iflist) for the first time */
-  if (skypiax_restart_monitor()) {
-    ERRORA("skypiax_restart_monitor failed, BAD\n", SKYPIAX_P_LOG);
-    return -1;
-  }
-  /* go through the interfaces list (skypiax_iflist) WITHOUT locking */
-  p = skypiax_iflist;
-  while (p) {
-    int i;
-    /* for each interface in list */
-    p2 = p->next;
-    NOTICA("STARTING interface %s, please be patient\n", SKYPIAX_P_LOG, p->name);
-    i = 0;
-    while (p->SkypiaxHandles.api_connected == 0 && running && i < 60000) {  // 60sec FIXME
-      usleep(1000);
-      i++;
-    }
-    if (p->SkypiaxHandles.api_connected) {
-      NOTICA("STARTED interface %s\n", SKYPIAX_P_LOG, p->name);
-    } else {
-      ERRORA("Interface %s FAILED to start\n", SKYPIAX_P_LOG, p->name);
-      running = 0;
-      return -1;
-    }
-    /* next one, please */
-    p = p2;
-  }
-  return 0;
+	/* start to monitor the interfaces (skypiax_iflist) for the first time */
+	if (skypiax_restart_monitor()) {
+		ERRORA("skypiax_restart_monitor failed, BAD\n", SKYPIAX_P_LOG);
+		return -1;
+	}
+	/* go through the interfaces list (skypiax_iflist) WITHOUT locking */
+	p = skypiax_iflist;
+	while (p) {
+		int i;
+		/* for each interface in list */
+		p2 = p->next;
+		NOTICA("STARTING interface %s, please be patient\n", SKYPIAX_P_LOG, p->name);
+		i = 0;
+		while (p->SkypiaxHandles.api_connected == 0 && running && i < 60000) {	// 60sec FIXME
+			usleep(1000);
+			i++;
+		}
+		if (p->SkypiaxHandles.api_connected) {
+			NOTICA("STARTED interface %s\n", SKYPIAX_P_LOG, p->name);
+		} else {
+			ERRORA("Interface %s FAILED to start\n", SKYPIAX_P_LOG, p->name);
+			running = 0;
+			return -1;
+		}
+		/* next one, please */
+		p = p2;
+	}
+	return 0;
 }
 
 /*!
@@ -940,94 +909,94 @@
  */
 int unload_module(void)
 {
-  struct skypiax_pvt *p = NULL, *p2 = NULL;
-  int res;
+	struct skypiax_pvt *p = NULL, *p2 = NULL;
+	int res;
 
-  /* unregister our channel type with Asterisk */
-  ast_channel_unregister(&skypiax_tech);
-  ast_cli_unregister_multiple(myclis, sizeof(myclis) / sizeof(struct ast_cli_entry));
+	/* unregister our channel type with Asterisk */
+	ast_channel_unregister(&skypiax_tech);
+	ast_cli_unregister_multiple(myclis, sizeof(myclis) / sizeof(struct ast_cli_entry));
 
 #if defined(WANT_SKYPE_X11) || defined(__CYGWIN__)
 #ifndef __CYGWIN__
-  //FIXME what to do? if (!XInitThreads())
-  //FIXME what to do? ast_log(LOG_ERROR, "Not initialized XInitThreads!\n");
+	//FIXME what to do? if (!XInitThreads())
+	//FIXME what to do? ast_log(LOG_ERROR, "Not initialized XInitThreads!\n");
 #endif /* __CYGWIN__ */
 #if 0
-  ast_unregister_atexit(skypiax_disconnect);
-  ast_unregister_application(skype2skypiaxapp);
-  ast_unregister_application(skypiax2skypeapp);
+	ast_unregister_atexit(skypiax_disconnect);
+	ast_unregister_application(skype2skypiaxapp);
+	ast_unregister_application(skypiax2skypeapp);
 #endif
 #endif /* defined(WANT_SKYPE_X11) || defined(__CYGWIN__) */
 
-  /* lock the skypiax_monlock, kill the monitor thread, unlock the skypiax_monlock */
-  LOKKA(&skypiax_monlock);
-  if (skypiax_monitor_thread && (skypiax_monitor_thread != AST_PTHREADT_NULL)
-      && (skypiax_monitor_thread != AST_PTHREADT_STOP)) {
-    if (pthread_cancel(skypiax_monitor_thread)) {
-      ERRORA("pthread_cancel failed, BAD\n", SKYPIAX_P_LOG);
-      return -1;
-    }
-    if (pthread_kill(skypiax_monitor_thread, SIGURG)) {
-      DEBUGA_PBX("pthread_kill failed\n", SKYPIAX_P_LOG);   //maybe it just died
-    }
-#ifndef __CYGWIN__              /* under cygwin, this seems to be not reliable, get stuck at times */
-    if (pthread_join(skypiax_monitor_thread, NULL)) {
-      ERRORA("pthread_join failed, BAD\n", SKYPIAX_P_LOG);
-      return -1;
-    }
+	/* lock the skypiax_monlock, kill the monitor thread, unlock the skypiax_monlock */
+	LOKKA(&skypiax_monlock);
+	if (skypiax_monitor_thread && (skypiax_monitor_thread != AST_PTHREADT_NULL)
+		&& (skypiax_monitor_thread != AST_PTHREADT_STOP)) {
+		if (pthread_cancel(skypiax_monitor_thread)) {
+			ERRORA("pthread_cancel failed, BAD\n", SKYPIAX_P_LOG);
+			return -1;
+		}
+		if (pthread_kill(skypiax_monitor_thread, SIGURG)) {
+			DEBUGA_PBX("pthread_kill failed\n", SKYPIAX_P_LOG);	//maybe it just died
+		}
+#ifndef __CYGWIN__				/* under cygwin, this seems to be not reliable, get stuck at times */
+		if (pthread_join(skypiax_monitor_thread, NULL)) {
+			ERRORA("pthread_join failed, BAD\n", SKYPIAX_P_LOG);
+			return -1;
+		}
 #endif /* __CYGWIN__ */
-  }
-  skypiax_monitor_thread = AST_PTHREADT_STOP;
-  UNLOCKA(&skypiax_monlock);
+	}
+	skypiax_monitor_thread = AST_PTHREADT_STOP;
+	UNLOCKA(&skypiax_monlock);
 
-  if (skypiax_monitor_audio_thread && (skypiax_monitor_audio_thread != AST_PTHREADT_NULL)
-      && (skypiax_monitor_audio_thread != AST_PTHREADT_STOP)) {
+	if (skypiax_monitor_audio_thread && (skypiax_monitor_audio_thread != AST_PTHREADT_NULL)
+		&& (skypiax_monitor_audio_thread != AST_PTHREADT_STOP)) {
 
-    if (pthread_cancel(skypiax_monitor_audio_thread)) {
-      ERRORA("pthread_cancel skypiax_monitor_audio_thread failed, BAD\n", SKYPIAX_P_LOG);
-    }
-    if (pthread_kill(skypiax_monitor_audio_thread, SIGURG)) {
-      DEBUGA_PBX("pthread_kill skypiax_monitor_audio_thread failed, no problem\n", SKYPIAX_P_LOG);  //maybe it just died
-    }
+		if (pthread_cancel(skypiax_monitor_audio_thread)) {
+			ERRORA("pthread_cancel skypiax_monitor_audio_thread failed, BAD\n", SKYPIAX_P_LOG);
+		}
+		if (pthread_kill(skypiax_monitor_audio_thread, SIGURG)) {
+			DEBUGA_PBX("pthread_kill skypiax_monitor_audio_thread failed, no problem\n", SKYPIAX_P_LOG);	//maybe it just died
+		}
 
-    if (pthread_join(skypiax_monitor_audio_thread, NULL)) {
-      ERRORA("pthread_join failed, BAD\n", SKYPIAX_P_LOG);
-    }
-  }
-  /* lock the skypiax_iflock, and go through the interfaces list (skypiax_iflist) */
-  LOKKA(&skypiax_iflock);
-  p = skypiax_iflist;
-  while (p) {
-    /* for each interface in list */
-    p2 = p->next;
-    /* shutdown the sound system, close sound fds, and if exist shutdown the sound managing threads */
-    DEBUGA_SOUND("shutting down sound\n", SKYPIAX_P_LOG);
-    res = skypiax_sound_shutdown(p);
-    if (res == -1) {
-      ERRORA("Failed to shutdown sound\n", SKYPIAX_P_LOG);
-    }
+		if (pthread_join(skypiax_monitor_audio_thread, NULL)) {
+			ERRORA("pthread_join failed, BAD\n", SKYPIAX_P_LOG);
+		}
+	}
+	/* lock the skypiax_iflock, and go through the interfaces list (skypiax_iflist) */
+	LOKKA(&skypiax_iflock);
+	p = skypiax_iflist;
+	while (p) {
+		/* for each interface in list */
+		p2 = p->next;
+		/* shutdown the sound system, close sound fds, and if exist shutdown the sound managing threads */
+		DEBUGA_SOUND("shutting down sound\n", SKYPIAX_P_LOG);
+		res = skypiax_sound_shutdown(p);
+		if (res == -1) {
+			ERRORA("Failed to shutdown sound\n", SKYPIAX_P_LOG);
+		}
 #if 0
-    /* if a dsp struct has been allocated, free it */
-    if (p->dsp) {
-      ast_dsp_free(p->dsp);
-      p->dsp = NULL;
-    }
+		/* if a dsp struct has been allocated, free it */
+		if (p->dsp) {
+			ast_dsp_free(p->dsp);
+			p->dsp = NULL;
+		}
 #endif
-    DEBUGA_PBX("freeing PVT\n", SKYPIAX_P_LOG);
-    /* free the pvt allocated memory */
-    free(p);
-    /* next one, please */
-    p = p2;
-  }
-  /* finished with the interfaces list, unlock the skypiax_iflock */
-  UNLOCKA(&skypiax_iflock);
+		DEBUGA_PBX("freeing PVT\n", SKYPIAX_P_LOG);
+		/* free the pvt allocated memory */
+		free(p);
+		/* next one, please */
+		p = p2;
+	}
+	/* finished with the interfaces list, unlock the skypiax_iflock */
+	UNLOCKA(&skypiax_iflock);
 
 #ifdef __CYGWIN__
-  NOTICA("Sleping 5 secs, please wait...\n", SKYPIAX_P_LOG);
-  sleep(5);                     /* without this pause, for some unknown (to me) reason it crashes on cygwin */
+	NOTICA("Sleping 5 secs, please wait...\n", SKYPIAX_P_LOG);
+	sleep(5);					/* without this pause, for some unknown (to me) reason it crashes on cygwin */
 #endif /* __CYGWIN__ */
-  NOTICA("Unloaded Skypiax Module\n", SKYPIAX_P_LOG);
-  return 0;
+	NOTICA("Unloaded Skypiax Module\n", SKYPIAX_P_LOG);
+	return 0;
 }
 
 /*!
@@ -1037,16 +1006,16 @@
  */
 int usecount()
 {
-  int res;
-  static struct skypiax_pvt *p = &skypiax_log_struct;
+	int res;
+	static struct skypiax_pvt *p = &skypiax_log_struct;
 /* lock the skypiax_usecnt lock */
-  LOKKA(&skypiax_usecnt_lock);
-  /* retrieve the skypiax_usecnt */
-  res = skypiax_usecnt;
+	LOKKA(&skypiax_usecnt_lock);
+	/* retrieve the skypiax_usecnt */
+	res = skypiax_usecnt;
 /* unlock the skypiax_usecnt lock */
-  UNLOCKA(&skypiax_usecnt_lock);
-  /* return the skypiax_usecnt */
-  return res;
+	UNLOCKA(&skypiax_usecnt_lock);
+	/* return the skypiax_usecnt */
+	return res;
 }
 
 /*!
@@ -1056,7 +1025,7 @@
  */
 char *description()
 {
-  return (char *) skypiax_desc;
+	return (char *) skypiax_desc;
 }
 
 /*!
@@ -1066,11 +1035,11 @@
  */
 char *key()
 {
-  struct skypiax_pvt *p = NULL;
+	struct skypiax_pvt *p = NULL;
 
-  NOTICA("Returning Key\n", SKYPIAX_P_LOG);
+	NOTICA("Returning Key\n", SKYPIAX_P_LOG);
 
-  return ASTERISK_GPL_KEY;
+	return ASTERISK_GPL_KEY;
 }
 
 /*!
@@ -1085,321 +1054,313 @@
  */
 struct skypiax_pvt *skypiax_mkif(struct ast_config *cfg, char *ctg, int is_first_category)
 {
-  struct skypiax_pvt *tmp;
-  struct ast_variable *v;
-  int res;
+	struct skypiax_pvt *tmp;
+	struct ast_variable *v;
+	int res;
 
-  int debug_all = 0;
-  int debug_at = 0;
-  int debug_fbus2 = 0;
-  int debug_serial = 0;
-  int debug_sound = 0;
-  int debug_pbx = 0;
-  int debug_skype = 0;
-  int debug_call = 0;
-  int debug_locks = 0;
-  int debug_monitorlocks = 0;
+	int debug_all = 0;
+	int debug_at = 0;
+	int debug_fbus2 = 0;
+	int debug_serial = 0;
+	int debug_sound = 0;
+	int debug_pbx = 0;
+	int debug_skype = 0;
+	int debug_call = 0;
+	int debug_locks = 0;
+	int debug_monitorlocks = 0;
 
-  ast_log(LOG_DEBUG, "ENTERING FUNC\n");
-  /* alloc memory for PVT */
-  tmp = malloc(sizeof(struct skypiax_pvt));
-  if (tmp == NULL) {            /* fail */
-    return NULL;
-  }
-  /* clear memory for PVT */
-  memset(tmp, 0, sizeof(struct skypiax_pvt));
+	ast_log(LOG_DEBUG, "ENTERING FUNC\n");
+	/* alloc memory for PVT */
+	tmp = malloc(sizeof(struct skypiax_pvt));
+	if (tmp == NULL) {			/* fail */
+		return NULL;
+	}
+	/* clear memory for PVT */
+	memset(tmp, 0, sizeof(struct skypiax_pvt));
 
-  /* if we are reading the "first" category of the config file, take SELECTED values as defaults, overriding the values in skypiax_default */
-  if (is_first_category == 1) {
-    /* for each variable in category, copy it in the skypiax_default struct */
-    for (v = ast_variable_browse(cfg, ctg); v; v = v->next) {
-      M_START(v->name, v->value);
+	/* if we are reading the "first" category of the config file, take SELECTED values as defaults, overriding the values in skypiax_default */
+	if (is_first_category == 1) {
+		/* for each variable in category, copy it in the skypiax_default struct */
+		for (v = ast_variable_browse(cfg, ctg); v; v = v->next) {
+			M_START(v->name, v->value);
 
-      M_STR("context", skypiax_default.context)
-        M_STR("language", skypiax_default.language)
-        M_STR("extension", skypiax_default.exten)
-        M_F("playback_boost",
-            skypiax_store_boost(v->value, &skypiax_default.playback_boost))
-        M_F("capture_boost",
-            skypiax_store_boost(v->value, &skypiax_default.capture_boost))
-        M_UINT("skypiax_dir_entry_extension_prefix",
-               skypiax_default.skypiax_dir_entry_extension_prefix)
-        M_END(;);
-    }
-  }
+			M_STR("context", skypiax_default.context)
+				M_STR("language", skypiax_default.language)
+				M_STR("extension", skypiax_default.exten)
+				M_F("playback_boost", skypiax_store_boost(v->value, &skypiax_default.playback_boost))
+				M_F("capture_boost", skypiax_store_boost(v->value, &skypiax_default.capture_boost))
+				M_UINT("skypiax_dir_entry_extension_prefix", skypiax_default.skypiax_dir_entry_extension_prefix)
+				M_END(;
+				);
+		}
+	}
 
-  /* initialize the newly created PVT from the skypiax_default values */
-  *tmp = skypiax_default;
+	/* initialize the newly created PVT from the skypiax_default values */
+	*tmp = skypiax_default;
 
-  /* the category name becomes the interface name */
-  tmp->name = strdup(ctg);
+	/* the category name becomes the interface name */
+	tmp->name = strdup(ctg);
 
-  /* for each category in config file, "first" included, read in ALL the values */
-  for (v = ast_variable_browse(cfg, ctg); v; v = v->next) {
-    M_START(v->name, v->value);
+	/* for each category in config file, "first" included, read in ALL the values */
+	for (v = ast_variable_browse(cfg, ctg); v; v = v->next) {
+		M_START(v->name, v->value);
 
-    M_BOOL("debug_all", debug_all)
-      M_BOOL("debug_at", debug_at)
-      M_BOOL("debug_fbus2", debug_fbus2)
-      M_BOOL("debug_serial", debug_serial)
-      M_BOOL("debug_sound", debug_sound)
-      M_BOOL("debug_pbx", debug_pbx)
-      M_BOOL("debug_skype", debug_skype)
-      M_BOOL("debug_call", debug_call)
-      M_BOOL("debug_locks", debug_locks)
-      M_BOOL("debug_monitorlocks", debug_monitorlocks)
-      M_BOOL("skype", tmp->skype)
-      M_STR("context", tmp->context)
-      M_STR("language", tmp->language)
-      M_STR("extension", tmp->exten)
-      M_STR("X11_display", tmp->X11_display)
-      M_UINT("tcp_cli_port", tmp->tcp_cli_port)
-      M_UINT("tcp_srv_port", tmp->tcp_srv_port)
-      M_F("playback_boost", skypiax_store_boost(v->value, &tmp->playback_boost))
-      M_F("capture_boost", skypiax_store_boost(v->value, &tmp->capture_boost))
-      M_STR("skype_user", tmp->skype_user)
-      M_UINT("skypiax_dir_entry_extension_prefix",
-             tmp->skypiax_dir_entry_extension_prefix)
-      M_END(;);
-  }
+		M_BOOL("debug_all", debug_all)
+			M_BOOL("debug_at", debug_at)
+			M_BOOL("debug_fbus2", debug_fbus2)
+			M_BOOL("debug_serial", debug_serial)
+			M_BOOL("debug_sound", debug_sound)
+			M_BOOL("debug_pbx", debug_pbx)
+			M_BOOL("debug_skype", debug_skype)
+			M_BOOL("debug_call", debug_call)
+			M_BOOL("debug_locks", debug_locks)
+			M_BOOL("debug_monitorlocks", debug_monitorlocks)
+			M_BOOL("skype", tmp->skype)
+			M_STR("context", tmp->context)
+			M_STR("language", tmp->language)
+			M_STR("extension", tmp->exten)
+			M_STR("X11_display", tmp->X11_display)
+			M_UINT("tcp_cli_port", tmp->tcp_cli_port)
+			M_UINT("tcp_srv_port", tmp->tcp_srv_port)
+			M_F("playback_boost", skypiax_store_boost(v->value, &tmp->playback_boost))
+			M_F("capture_boost", skypiax_store_boost(v->value, &tmp->capture_boost))
+			M_STR("skype_user", tmp->skype_user)
+			M_UINT("skypiax_dir_entry_extension_prefix", tmp->skypiax_dir_entry_extension_prefix)
+			M_END(;
+			);
+	}
 
-  if (debug_all) {
-    skypiax_debug = skypiax_debug | DEBUG_ALL;
-    if (!option_debug) {
-      WARNINGA
-        ("DEBUG_ALL activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_ALL debugging output.\n",
-         SKYPIAX_TMP_LOG);
-    } else {
-      NOTICA("DEBUG_ALL activated. \n", SKYPIAX_TMP_LOG);
-    }
-  }
+	if (debug_all) {
+		skypiax_debug = skypiax_debug | DEBUG_ALL;
+		if (!option_debug) {
+			WARNINGA
+				("DEBUG_ALL activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_ALL debugging output.\n",
+				 SKYPIAX_TMP_LOG);
+		} else {
+			NOTICA("DEBUG_ALL activated. \n", SKYPIAX_TMP_LOG);
+		}
+	}
 
-  if (debug_fbus2) {
-    skypiax_debug = skypiax_debug | DEBUG_FBUS2;
-    if (!option_debug) {
-      WARNINGA
-        ("DEBUG_FBUS2 activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_FBUS2 debugging output.\n",
-         SKYPIAX_TMP_LOG);
-    } else {
-      NOTICA("DEBUG_FBUS2 activated. \n", SKYPIAX_TMP_LOG);
-    }
-  }
+	if (debug_fbus2) {
+		skypiax_debug = skypiax_debug | DEBUG_FBUS2;
+		if (!option_debug) {
+			WARNINGA
+				("DEBUG_FBUS2 activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_FBUS2 debugging output.\n",
+				 SKYPIAX_TMP_LOG);
+		} else {
+			NOTICA("DEBUG_FBUS2 activated. \n", SKYPIAX_TMP_LOG);
+		}
+	}
 
-  if (debug_serial) {
-    skypiax_debug = skypiax_debug | DEBUG_SERIAL;
-    if (!option_debug) {
-      WARNINGA
-        ("DEBUG_SERIAL activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_SERIAL debugging output.\n",
-         SKYPIAX_TMP_LOG);
-    } else {
-      NOTICA("DEBUG_SERIAL activated. \n", SKYPIAX_TMP_LOG);
-    }
-  }
+	if (debug_serial) {
+		skypiax_debug = skypiax_debug | DEBUG_SERIAL;
+		if (!option_debug) {
+			WARNINGA
+				("DEBUG_SERIAL activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_SERIAL debugging output.\n",
+				 SKYPIAX_TMP_LOG);
+		} else {
+			NOTICA("DEBUG_SERIAL activated. \n", SKYPIAX_TMP_LOG);
+		}
+	}
 
-  if (debug_sound) {
-    skypiax_debug = skypiax_debug | DEBUG_SOUND;
-    if (!option_debug) {
-      WARNINGA
-        ("DEBUG_SOUND activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_SOUND debugging output.\n",
-         SKYPIAX_TMP_LOG);
-    } else {
-      NOTICA("DEBUG_SOUND activated. \n", SKYPIAX_TMP_LOG);
-    }
-  }
+	if (debug_sound) {
+		skypiax_debug = skypiax_debug | DEBUG_SOUND;
+		if (!option_debug) {
+			WARNINGA
+				("DEBUG_SOUND activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_SOUND debugging output.\n",
+				 SKYPIAX_TMP_LOG);
+		} else {
+			NOTICA("DEBUG_SOUND activated. \n", SKYPIAX_TMP_LOG);
+		}
+	}
 
-  if (debug_pbx) {
-    skypiax_debug = skypiax_debug | DEBUG_PBX;
-    if (!option_debug) {
-      WARNINGA
-        ("DEBUG_PBX activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_PBX debugging output.\n",
-         SKYPIAX_TMP_LOG);
-    } else {
-      NOTICA("DEBUG_PBX activated. \n", SKYPIAX_TMP_LOG);
-    }
-  }
+	if (debug_pbx) {
+		skypiax_debug = skypiax_debug | DEBUG_PBX;
+		if (!option_debug) {
+			WARNINGA
+				("DEBUG_PBX activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_PBX debugging output.\n",
+				 SKYPIAX_TMP_LOG);
+		} else {
+			NOTICA("DEBUG_PBX activated. \n", SKYPIAX_TMP_LOG);
+		}
+	}
 
-  if (debug_skype) {
-    skypiax_debug = skypiax_debug | DEBUG_SKYPE;
-    if (!option_debug) {
-      WARNINGA
-        ("DEBUG_SKYPE activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_SKYPE debugging output.\n",
-         SKYPIAX_TMP_LOG);
-    } else {
-      NOTICA("DEBUG_SKYPE activated. \n", SKYPIAX_TMP_LOG);
-    }
-  }
+	if (debug_skype) {
+		skypiax_debug = skypiax_debug | DEBUG_SKYPE;
+		if (!option_debug) {
+			WARNINGA
+				("DEBUG_SKYPE activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_SKYPE debugging output.\n",
+				 SKYPIAX_TMP_LOG);
+		} else {
+			NOTICA("DEBUG_SKYPE activated. \n", SKYPIAX_TMP_LOG);
+		}
+	}
 
-  if (debug_call) {
-    skypiax_debug = skypiax_debug | DEBUG_CALL;
-    if (!option_debug) {
-      WARNINGA
-        ("DEBUG_CALL activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_CALL debugging output.\n",
-         SKYPIAX_TMP_LOG);
-    } else {
-      NOTICA("DEBUG_CALL activated. \n", SKYPIAX_TMP_LOG);
-    }
-  }
+	if (debug_call) {
+		skypiax_debug = skypiax_debug | DEBUG_CALL;
+		if (!option_debug) {
+			WARNINGA
+				("DEBUG_CALL activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_CALL debugging output.\n",
+				 SKYPIAX_TMP_LOG);
+		} else {
+			NOTICA("DEBUG_CALL activated. \n", SKYPIAX_TMP_LOG);
+		}
+	}
 
-  if (debug_locks) {
-    skypiax_debug = skypiax_debug | DEBUG_LOCKS;
-    if (!option_debug) {
-      WARNINGA
-        ("DEBUG_LOCKS activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_LOCKS debugging output.\n",
-         SKYPIAX_TMP_LOG);
-    } else {
-      NOTICA("DEBUG_LOCKS activated. \n", SKYPIAX_TMP_LOG);
-    }
-  }
+	if (debug_locks) {
+		skypiax_debug = skypiax_debug | DEBUG_LOCKS;
+		if (!option_debug) {
+			WARNINGA
+				("DEBUG_LOCKS activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_LOCKS debugging output.\n",
+				 SKYPIAX_TMP_LOG);
+		} else {
+			NOTICA("DEBUG_LOCKS activated. \n", SKYPIAX_TMP_LOG);
+		}
+	}
 
-  if (debug_monitorlocks) {
-    skypiax_debug = skypiax_debug | DEBUG_MONITORLOCKS;
-    if (!option_debug) {
-      WARNINGA
-        ("DEBUG_MONITORLOCKS activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_MONITORLOCKS debugging output.\n",
-         SKYPIAX_TMP_LOG);
-    } else {
-      NOTICA("DEBUG_MONITORLOCKS activated. \n", SKYPIAX_TMP_LOG);
-    }
-  }
+	if (debug_monitorlocks) {
+		skypiax_debug = skypiax_debug | DEBUG_MONITORLOCKS;
+		if (!option_debug) {
+			WARNINGA
+				("DEBUG_MONITORLOCKS activated, but option_debug is 0. You have to set debug level higher than zero to see some debugging output. Please use the command \"set debug 10\" or start Asterisk with \"-dddddddddd\" option for full DEBUG_MONITORLOCKS debugging output.\n",
+				 SKYPIAX_TMP_LOG);
+		} else {
+			NOTICA("DEBUG_MONITORLOCKS activated. \n", SKYPIAX_TMP_LOG);
+		}
+	}
 
-  if (option_debug > 1) {
-    DEBUGA_SOUND("playback_boost is %f\n", SKYPIAX_TMP_LOG, tmp->playback_boost);
-    DEBUGA_SOUND("capture_boost is %f\n", SKYPIAX_TMP_LOG, tmp->capture_boost);
-  }
+	if (option_debug > 1) {
+		DEBUGA_SOUND("playback_boost is %f\n", SKYPIAX_TMP_LOG, tmp->playback_boost);
+		DEBUGA_SOUND("capture_boost is %f\n", SKYPIAX_TMP_LOG, tmp->capture_boost);
+	}
 /* initialize the soundcard channels (input and output) used by this interface (a multichannel soundcard can be used by multiple interfaces), optionally starting the sound managing threads */
-  res = skypiax_sound_init(tmp);
-  if (res == -1) {
-    ERRORA("Failed initializing sound device\n", SKYPIAX_TMP_LOG);
-    /* we failed, free the PVT */
-    free(tmp);
-    return NULL;
-  }
-  /*
-     res = pipe(tmp->SkypiaxHandles.fdesc);
-     if (res) {
-     ast_log(LOG_ERROR, "Unable to create skype pipe\n");
-     if (option_debug > 10) {
-     DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
-     }
-     free(tmp);
-     return NULL;
-     }
-     fcntl(tmp->SkypiaxHandles.fdesc[0], F_SETFL, O_NONBLOCK);
-     fcntl(tmp->SkypiaxHandles.fdesc[1], F_SETFL, O_NONBLOCK);
-   */
-  tmp->skype_thread = AST_PTHREADT_NULL;
+	res = skypiax_sound_init(tmp);
+	if (res == -1) {
+		ERRORA("Failed initializing sound device\n", SKYPIAX_TMP_LOG);
+		/* we failed, free the PVT */
+		free(tmp);
+		return NULL;
+	}
+	/*
+	   res = pipe(tmp->SkypiaxHandles.fdesc);
+	   if (res) {
+	   ast_log(LOG_ERROR, "Unable to create skype pipe\n");
+	   if (option_debug > 10) {
+	   DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
+	   }
+	   free(tmp);
+	   return NULL;
+	   }
+	   fcntl(tmp->SkypiaxHandles.fdesc[0], F_SETFL, O_NONBLOCK);
+	   fcntl(tmp->SkypiaxHandles.fdesc[1], F_SETFL, O_NONBLOCK);
+	 */
+	tmp->skype_thread = AST_PTHREADT_NULL;
 
-  if (tmp->skype) {
-    ast_log(LOG_DEBUG, "TO BE started skype_thread=%lu STOP=%lu NULL=%lu\n",
-            (unsigned long) tmp->skype_thread, (unsigned long) AST_PTHREADT_STOP,
-            (unsigned long) AST_PTHREADT_NULL);
+	if (tmp->skype) {
+		ast_log(LOG_DEBUG, "TO BE started skype_thread=%lu STOP=%lu NULL=%lu\n",
+				(unsigned long) tmp->skype_thread, (unsigned long) AST_PTHREADT_STOP, (unsigned long) AST_PTHREADT_NULL);
 #ifdef __CYGWIN__
-    if (ast_pthread_create(&tmp->skype_thread, NULL, do_skypeapi_thread, tmp) < 0) {
-      ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
-      free(tmp);
-      return NULL;
-    }
+		if (ast_pthread_create(&tmp->skype_thread, NULL, do_skypeapi_thread, tmp) < 0) {
+			ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
+			free(tmp);
+			return NULL;
+		}
 #else /* __CYGWIN__ */
 #ifdef WANT_SKYPE_X11
-    ast_log(LOG_DEBUG, "AsteriskHandlesfd: %d\n", tmp->SkypiaxHandles.fdesc[1]);
-    if (ast_pthread_create(&tmp->skype_thread, NULL, do_skypeapi_thread, tmp) < 0) {
-      ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
-      free(tmp);
-      return NULL;
-    }
+		ast_log(LOG_DEBUG, "AsteriskHandlesfd: %d\n", tmp->SkypiaxHandles.fdesc[1]);
+		if (ast_pthread_create(&tmp->skype_thread, NULL, do_skypeapi_thread, tmp) < 0) {
+			ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
+			free(tmp);
+			return NULL;
+		}
 #endif /* WANT_SKYPE_X11 */
 #endif /* __CYGWIN__ */
-    usleep(100000);             //0.1 sec
-    if (tmp->skype_thread == AST_PTHREADT_NULL) {
-      ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
-      free(tmp);
-      return NULL;
-    }
-    ast_log(LOG_DEBUG, "STARTED skype_thread=%lu STOP=%lu NULL=%lu\n",
-            (unsigned long) tmp->skype_thread, (unsigned long) AST_PTHREADT_STOP,
-            (unsigned long) AST_PTHREADT_NULL);
-  }
+		usleep(100000);			//0.1 sec
+		if (tmp->skype_thread == AST_PTHREADT_NULL) {
+			ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
+			free(tmp);
+			return NULL;
+		}
+		ast_log(LOG_DEBUG, "STARTED skype_thread=%lu STOP=%lu NULL=%lu\n",
+				(unsigned long) tmp->skype_thread, (unsigned long) AST_PTHREADT_STOP, (unsigned long) AST_PTHREADT_NULL);
+	}
 #if 0
-  if (tmp->skype) {
+	if (tmp->skype) {
 #if 0
-    if (option_debug > 1)
-      ast_log(LOG_DEBUG, "TO BE started skype_thread=%lu STOP=%lu NULL=%lu\n",
-              (unsigned long) tmp->skype_thread, (unsigned long) AST_PTHREADT_STOP,
-              (unsigned long) AST_PTHREADT_NULL);
+		if (option_debug > 1)
+			ast_log(LOG_DEBUG, "TO BE started skype_thread=%lu STOP=%lu NULL=%lu\n",
+					(unsigned long) tmp->skype_thread, (unsigned long) AST_PTHREADT_STOP, (unsigned long) AST_PTHREADT_NULL);
 #endif
 #ifdef __CYGWIN__
-    if (ast_pthread_create
-        (&tmp->skype_thread, NULL, do_skypeapi_thread, &tmp->SkypiaxHandles) < 0) {
-      ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
-      if (option_debug > 10) {
-        DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
-      }
-      free(tmp);
-      return NULL;
-    }
+		if (ast_pthread_create(&tmp->skype_thread, NULL, do_skypeapi_thread, &tmp->SkypiaxHandles) < 0) {
+			ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
+			if (option_debug > 10) {
+				DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
+			}
+			free(tmp);
+			return NULL;
+		}
 #else /* __CYGWIN__ */
 #ifdef WANT_SKYPE_X11
-    if (ast_pthread_create(&tmp->signaling_thread, NULL, do_signaling_thread_fnc, tmp) <
-        0) {
-      ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
-      if (option_debug > 10) {
-        DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
-      }
-      free(tmp);
-      return NULL;
-    }
+		if (ast_pthread_create(&tmp->signaling_thread, NULL, do_signaling_thread_fnc, tmp) < 0) {
+			ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
+			if (option_debug > 10) {
+				DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
+			}
+			free(tmp);
+			return NULL;
+		}
 #endif /* WANT_SKYPE_X11 */
 #endif /* __CYGWIN__ */
-    usleep(100000);             //0.1 sec
-    if (tmp->skype_thread == AST_PTHREADT_NULL) {
-      ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
-      if (option_debug > 10) {
-        DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
-      }
-      free(tmp);
-      return NULL;
-    }
-    if (option_debug > 1)
-      ast_log(LOG_DEBUG, "STARTED signaling_thread=%lu STOP=%lu NULL=%lu\n",
-              (unsigned long) tmp->signaling_thread, (unsigned long) AST_PTHREADT_STOP,
-              (unsigned long) AST_PTHREADT_NULL);
-  }
+		usleep(100000);			//0.1 sec
+		if (tmp->skype_thread == AST_PTHREADT_NULL) {
+			ast_log(LOG_ERROR, "Unable to start skype_main thread.\n");
+			if (option_debug > 10) {
+				DEBUGA_PBX("EXITING FUNC\n", SKYPIAX_TMP_LOG);
+			}
+			free(tmp);
+			return NULL;
+		}
+		if (option_debug > 1)
+			ast_log(LOG_DEBUG, "STARTED signaling_thread=%lu STOP=%lu NULL=%lu\n",
+					(unsigned long) tmp->signaling_thread, (unsigned long) AST_PTHREADT_STOP, (unsigned long) AST_PTHREADT_NULL);
+	}
 #endif
 
-  /* return the newly created skypiax_pvt */
-  return tmp;
+	/* return the newly created skypiax_pvt */
+	return tmp;
 }
 
 /*! \brief (Re)Start the module main monitor thread, watching for incoming calls on the interfaces */
 int skypiax_restart_monitor(void)
 {
-  static struct skypiax_pvt *p = &skypiax_log_struct;
+	static struct skypiax_pvt *p = &skypiax_log_struct;
 
-  /* If we're supposed to be stopped -- stay stopped */
-  if (skypiax_monitor_thread == AST_PTHREADT_STOP) {
-    return 0;
-  }
-  LOKKA(&skypiax_monlock);
-  /* Do not seems possible to me that this function can be called by the very same monitor thread, but let's be paranoid */
-  if (skypiax_monitor_thread == pthread_self()) {
-    UNLOCKA(&skypiax_monlock);
-    ERRORA("Cannot kill myself\n", SKYPIAX_P_LOG);
-    return -1;
-  }
-  /* if the monitor thread exists */
-  if (skypiax_monitor_thread != AST_PTHREADT_NULL) {
-    /* Wake up the thread, it can be stuck waiting in a select or so */
-    pthread_kill(skypiax_monitor_thread, SIGURG);
-  } else {
-    /* the monitor thread does not exists, start a new monitor */
-    if (ast_pthread_create(&skypiax_monitor_thread, NULL, skypiax_do_monitor, NULL) < 0) {
-      UNLOCKA(&skypiax_monlock);
-      ERRORA("Unable to start monitor thread.\n", SKYPIAX_P_LOG);
-      return -1;
-    }
-  }
-  UNLOCKA(&skypiax_monlock);
-  return 0;
+	/* If we're supposed to be stopped -- stay stopped */
+	if (skypiax_monitor_thread == AST_PTHREADT_STOP) {
+		return 0;
+	}
+	LOKKA(&skypiax_monlock);
+	/* Do not seems possible to me that this function can be called by the very same monitor thread, but let's be paranoid */
+	if (skypiax_monitor_thread == pthread_self()) {
+		UNLOCKA(&skypiax_monlock);
+		ERRORA("Cannot kill myself\n", SKYPIAX_P_LOG);
+		return -1;
+	}
+	/* if the monitor thread exists */
+	if (skypiax_monitor_thread != AST_PTHREADT_NULL) {
+		/* Wake up the thread, it can be stuck waiting in a select or so */
+		pthread_kill(skypiax_monitor_thread, SIGURG);
+	} else {
+		/* the monitor thread does not exists, start a new monitor */
+		if (ast_pthread_create(&skypiax_monitor_thread, NULL, skypiax_do_monitor, NULL) < 0) {
+			UNLOCKA(&skypiax_monlock);
+			ERRORA("Unable to start monitor thread.\n", SKYPIAX_P_LOG);
+			return -1;
+		}
+	}
+	UNLOCKA(&skypiax_monlock);
+	return 0;
 }
 
 /*! \brief The skypiax monitoring thread 
@@ -1408,117 +1369,116 @@
  *         */
 void *skypiax_do_monitor(void *data)
 {
-  fd_set rfds;
-  int res;
-  struct skypiax_pvt *p = NULL;
-  int max = -1;
-  struct timeval to;
-  time_t now_timestamp;
+	fd_set rfds;
+	int res;
+	struct skypiax_pvt *p = NULL;
+	int max = -1;
+	struct timeval to;
+	time_t now_timestamp;
 
-  if (pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL)) {
-    ERRORA("Unable to set cancel type to deferred\n", SKYPIAX_P_LOG);
-    return NULL;
-  }
+	if (pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL)) {
+		ERRORA("Unable to set cancel type to deferred\n", SKYPIAX_P_LOG);
+		return NULL;
+	}
 
-  for (;;) {
-    pthread_testcancel();
-    /* Don't let anybody kill us right away.  Nobody should lock the interface list
-       and wait for the monitor list, but the other way around is okay. */
-    PUSHA_UNLOCKA(&skypiax_monlock);
-    MONITORLOKKA(&skypiax_monlock);
-    /* Lock the interface list */
-    PUSHA_UNLOCKA(&skypiax_iflock);
-    MONITORLOKKA(&skypiax_iflock);
-    /* Build the stuff we're going to select on, that is the skypiax_serial_fd of every
-       skypiax_pvt that does not have an associated owner channel. In the case of FBUS2 3310
-       and in the case of PROTOCOL_NO_SERIAL we add the audio_fd as well, because there is not serial signaling of incoming calls */
-    FD_ZERO(&rfds);
+	for (;;) {
+		pthread_testcancel();
+		/* Don't let anybody kill us right away.  Nobody should lock the interface list
+		   and wait for the monitor list, but the other way around is okay. */
+		PUSHA_UNLOCKA(&skypiax_monlock);
+		MONITORLOKKA(&skypiax_monlock);
+		/* Lock the interface list */
+		PUSHA_UNLOCKA(&skypiax_iflock);
+		MONITORLOKKA(&skypiax_iflock);
+		/* Build the stuff we're going to select on, that is the skypiax_serial_fd of every
+		   skypiax_pvt that does not have an associated owner channel. In the case of FBUS2 3310
+		   and in the case of PROTOCOL_NO_SERIAL we add the audio_fd as well, because there is not serial signaling of incoming calls */
+		FD_ZERO(&rfds);
 
-    time(&now_timestamp);
-    p = skypiax_iflist;
-    while (p) {
-      if (!p->owner) {
-        /* This interface needs to be watched, as it lacks an owner */
+		time(&now_timestamp);
+		p = skypiax_iflist;
+		while (p) {
+			if (!p->owner) {
+				/* This interface needs to be watched, as it lacks an owner */
 
-        if (p->skype) {
-          if (FD_ISSET(p->SkypiaxHandles.fdesc[0], &rfds))
-            ERRORA("Descriptor %d (SkypiaxHandles.fdesc[0]) appears twice ?\n",
-                   SKYPIAX_P_LOG, p->SkypiaxHandles.fdesc[0]);
+				if (p->skype) {
+					if (FD_ISSET(p->SkypiaxHandles.fdesc[0], &rfds))
+						ERRORA("Descriptor %d (SkypiaxHandles.fdesc[0]) appears twice ?\n", SKYPIAX_P_LOG, p->SkypiaxHandles.fdesc[0]);
 
-          if (p->SkypiaxHandles.fdesc[0] > 0) {
-            FD_SET(p->SkypiaxHandles.fdesc[0], &rfds);
-            if (p->SkypiaxHandles.fdesc[0] > max)
-              max = p->SkypiaxHandles.fdesc[0];
+					if (p->SkypiaxHandles.fdesc[0] > 0) {
+						FD_SET(p->SkypiaxHandles.fdesc[0], &rfds);
+						if (p->SkypiaxHandles.fdesc[0] > max)
+							max = p->SkypiaxHandles.fdesc[0];
 
-          }
-        }
+					}
+				}
 
-      }
-      /* next interface, please */
-      p = p->next;
-    }
-    /* Okay, now that we know what to do, release the interface lock */
-    MONITORUNLOCKA(&skypiax_iflock);
-    POPPA_UNLOCKA(&skypiax_iflock);
-    /* And from now on, we're okay to be killed, so release the monitor lock as well */
-    MONITORUNLOCKA(&skypiax_monlock);
-    POPPA_UNLOCKA(&skypiax_monlock);
+			}
+			/* next interface, please */
+			p = p->next;
+		}
+		/* Okay, now that we know what to do, release the interface lock */
+		MONITORUNLOCKA(&skypiax_iflock);
+		POPPA_UNLOCKA(&skypiax_iflock);
+		/* And from now on, we're okay to be killed, so release the monitor lock as well */
+		MONITORUNLOCKA(&skypiax_monlock);
+		POPPA_UNLOCKA(&skypiax_monlock);
 
-    /* you want me to die? */
-    pthread_testcancel();
+		/* you want me to die? */
+		pthread_testcancel();
 
-    /* Wait for something to happen */
-    to.tv_sec = 0;
-    to.tv_usec = 500000;        /* we select with this timeout because under cygwin we avoid the signal usage, so there is no way to end the thread if it is stuck waiting for select */
-    res = ast_select(max + 1, &rfds, NULL, NULL, &to);
+		/* Wait for something to happen */
+		to.tv_sec = 0;
+		to.tv_usec = 500000;	/* we select with this timeout because under cygwin we avoid the signal usage, so there is no way to end the thread if it is stuck waiting for select */
+		res = ast_select(max + 1, &rfds, NULL, NULL, &to);
 
-    /* you want me to die? */
-    pthread_testcancel();
+		/* you want me to die? */
+		pthread_testcancel();
 
-    /* Okay, select has finished.  Let's see what happened.  */
+		/* Okay, select has finished.  Let's see what happened.  */
 
-    /* If there are errors...  */
-    if (res < 0) {
-      if (errno == EINTR)       /* EINTR is just the select 
-                                   being interrupted by a SIGURG, or so */
-        continue;
-      else {
-        ERRORA("select returned %d: %s\n", SKYPIAX_P_LOG, res, strerror(errno));
-        return NULL;
-      }
-    }
+		/* If there are errors...  */
+		if (res < 0) {
+			if (errno == EINTR)	/* EINTR is just the select 
+								   being interrupted by a SIGURG, or so */
+				continue;
+			else {
+				ERRORA("select returned %d: %s\n", SKYPIAX_P_LOG, res, strerror(errno));
+				return NULL;
+			}
+		}
 
-    /* must not be killed while skypiax_iflist is locked */
-    PUSHA_UNLOCKA(&skypiax_monlock);
-    MONITORLOKKA(&skypiax_monlock);
-    /* Alright, lock the interface list again, and let's look and see what has
-       happened */
-    PUSHA_UNLOCKA(&skypiax_iflock);
-    MONITORLOKKA(&skypiax_iflock);
+		/* must not be killed while skypiax_iflist is locked */
+		PUSHA_UNLOCKA(&skypiax_monlock);
+		MONITORLOKKA(&skypiax_monlock);
+		/* Alright, lock the interface list again, and let's look and see what has
+		   happened */
+		PUSHA_UNLOCKA(&skypiax_iflock);
+		MONITORLOKKA(&skypiax_iflock);
 
-    p = skypiax_iflist;
-    for (; p; p = p->next) {
+		p = skypiax_iflist;
+		for (; p; p = p->next) {
 
-      if (p->skype) {
-        if (FD_ISSET(p->SkypiaxHandles.fdesc[0], &rfds)) {
-          res = skypiax_signaling_read(p);
-          if (res == CALLFLOW_INCOMING_CALLID || res == CALLFLOW_INCOMING_RING) {
-            //ast_log(LOG_NOTICE, "CALLFLOW_INCOMING_RING SKYPE\n");
-            DEBUGA_SKYPE("CALLFLOW_INCOMING_RING\n", SKYPIAX_P_LOG);
-            skypiax_new(p, SKYPIAX_STATE_RING, p->context /* p->context */ );
-          }
-        }
-      }
+			if (p->skype) {
+				if (FD_ISSET(p->SkypiaxHandles.fdesc[0], &rfds)) {
+					res = skypiax_signaling_read(p);
+					if (res == CALLFLOW_INCOMING_CALLID || res == CALLFLOW_INCOMING_RING) {
+						//ast_log(LOG_NOTICE, "CALLFLOW_INCOMING_RING SKYPE\n");
+						DEBUGA_SKYPE("CALLFLOW_INCOMING_RING\n", SKYPIAX_P_LOG);
+						skypiax_new(p, SKYPIAX_STATE_RING, p->context /* p->context */ );
+					}
+				}
+			}
 
-    }
-    MONITORUNLOCKA(&skypiax_iflock);
-    POPPA_UNLOCKA(&skypiax_iflock);
-    MONITORUNLOCKA(&skypiax_monlock);
-    POPPA_UNLOCKA(&skypiax_monlock);
-    pthread_testcancel();
-  }
+		}
+		MONITORUNLOCKA(&skypiax_iflock);
+		POPPA_UNLOCKA(&skypiax_iflock);
+		MONITORUNLOCKA(&skypiax_monlock);
+		POPPA_UNLOCKA(&skypiax_monlock);
+		pthread_testcancel();
+	}
 /* Never reached */
-  return NULL;
+	return NULL;
 
 }
 
@@ -1533,7 +1493,7 @@
 
 int skypiax_sound_init(struct skypiax_pvt *p)
 {
-  return skypiax_audio_init(p);
+	return skypiax_audio_init(p);
 }
 
 /*!
@@ -1548,29 +1508,29 @@
 int skypiax_sound_shutdown(struct skypiax_pvt *p)
 {
 
-  //return skypiax_portaudio_shutdown(p);
+	//return skypiax_portaudio_shutdown(p);
 
-  return -1;
+	return -1;
 }
 
 /*! \brief Read audio frames from interface */
 struct ast_frame *skypiax_sound_read(struct skypiax_pvt *p)
 {
-  struct ast_frame *f = NULL;
-  int res;
+	struct ast_frame *f = NULL;
+	int res;
 
-  res = skypiax_audio_read(p);
-  f = &p->read_frame;
-  return f;
+	res = skypiax_audio_read(p);
+	f = &p->read_frame;
+	return f;
 }
 
 /*! \brief Send audio frame to interface */
 int skypiax_sound_write(struct skypiax_pvt *p, struct ast_frame *f)
 {
-  int ret = -1;
+	int ret = -1;
 
-  ret = skypiax_audio_write(p, f);
-  return ret;
+	ret = skypiax_audio_write(p, f);
+	return ret;
 }
 
 /*!
@@ -1579,32 +1539,32 @@
  */
 void *skypiax_do_controldev_thread(void *data)
 {
-  struct skypiax_pvt *p = data;
-  int res;
+	struct skypiax_pvt *p = data;
+	int res;
 
-  DEBUGA_SERIAL("In skypiax_do_controldev_thread: started, p=%p\n", SKYPIAX_P_LOG, p);
+	DEBUGA_SERIAL("In skypiax_do_controldev_thread: started, p=%p\n", SKYPIAX_P_LOG, p);
 
-  if (pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL)) {
-    ERRORA("Unable to set cancel type to deferred\n", SKYPIAX_P_LOG);
-    return NULL;
-  }
+	if (pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL)) {
+		ERRORA("Unable to set cancel type to deferred\n", SKYPIAX_P_LOG);
+		return NULL;
+	}
 
-  while (1) {
-    usleep(1000);
-    pthread_testcancel();
-    if (p->skype) {
-      res = skypiax_signaling_read(p);
-      if (res == CALLFLOW_INCOMING_HANGUP) {
-        DEBUGA_SKYPE("skype call ended\n", SKYPIAX_P_LOG);
-        if (p->owner) {
-          pthread_testcancel();
-          ast_queue_control(p->owner, AST_CONTROL_HANGUP);
-        }
-      }
-    }
-  }
+	while (1) {
+		usleep(1000);
+		pthread_testcancel();
+		if (p->skype) {
+			res = skypiax_signaling_read(p);
+			if (res == CALLFLOW_INCOMING_HANGUP) {
+				DEBUGA_SKYPE("skype call ended\n", SKYPIAX_P_LOG);
+				if (p->owner) {
+					pthread_testcancel();
+					ast_queue_control(p->owner, AST_CONTROL_HANGUP);
+				}
+			}
+		}
+	}
 
-  return NULL;
+	return NULL;
 
 }
 
@@ -1618,23 +1578,23 @@
 void skypiax_store_boost(const char *s, double *boost)
 #else
 void skypiax_store_boost(char *s, double *boost)
-#endif                          /* ASTERISK_VERSION_1_6 */
+#endif							/* ASTERISK_VERSION_1_6 */
 {
-  struct skypiax_pvt *p = NULL;
+	struct skypiax_pvt *p = NULL;
 
-  if (sscanf(s, "%lf", boost) != 1) {
-    ERRORA("invalid boost <%s>\n", SKYPIAX_P_LOG, s);
-    return;
-  }
-  if (*boost < -BOOST_MAX) {
-    WARNINGA("boost %s too small, using %d\n", SKYPIAX_P_LOG, s, -BOOST_MAX);
-    *boost = -BOOST_MAX;
-  } else if (*boost > BOOST_MAX) {
-    WARNINGA("boost %s too large, using %d\n", SKYPIAX_P_LOG, s, BOOST_MAX);
-    *boost = BOOST_MAX;
-  }
-  *boost = exp(log(10) * *boost / 20) * BOOST_SCALE;
-  DEBUGA_SOUND("setting boost %s to %f\n", SKYPIAX_P_LOG, s, *boost);
+	if (sscanf(s, "%lf", boost) != 1) {
+		ERRORA("invalid boost <%s>\n", SKYPIAX_P_LOG, s);
+		return;
+	}
+	if (*boost < -BOOST_MAX) {
+		WARNINGA("boost %s too small, using %d\n", SKYPIAX_P_LOG, s, -BOOST_MAX);
+		*boost = -BOOST_MAX;
+	} else if (*boost > BOOST_MAX) {
+		WARNINGA("boost %s too large, using %d\n", SKYPIAX_P_LOG, s, BOOST_MAX);
+		*boost = BOOST_MAX;
+	}
+	*boost = exp(log(10) * *boost / 20) * BOOST_SCALE;
+	DEBUGA_SOUND("setting boost %s to %f\n", SKYPIAX_P_LOG, s, *boost);
 }
 
 /*
@@ -1642,735 +1602,705 @@
  */
 struct skypiax_pvt *skypiax_console_find_desc(char *dev)
 {
-  struct skypiax_pvt *p = NULL;
+	struct skypiax_pvt *p = NULL;
 
-  for (p = skypiax_iflist; p && strcmp(p->name, dev) != 0; p = p->next);
-  if (p == NULL)
-    WARNINGA("could not find <%s>\n", SKYPIAX_P_LOG, dev);
+	for (p = skypiax_iflist; p && strcmp(p->name, dev) != 0; p = p->next);
+	if (p == NULL)
+		WARNINGA("could not find <%s>\n", SKYPIAX_P_LOG, dev);
 
-  return p;
+	return p;
 }
 int skypiax_console_playback_boost(int fd, int argc, char *argv[])
 {
-  struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
+	struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
 
-  if (argc > 2) {
-    return RESULT_SHOWUSAGE;
-  }
-  if (!p) {
-    ast_cli(fd,
-            "No \"current\" skypiax_console for playback_boost, please enter 'help skypiax_console'\n");
-    return RESULT_SUCCESS;
-  }
+	if (argc > 2) {
+		return RESULT_SHOWUSAGE;
+	}
+	if (!p) {
+		ast_cli(fd, "No \"current\" skypiax_console for playback_boost, please enter 'help skypiax_console'\n");
+		return RESULT_SUCCESS;
+	}
 
-  if (argc == 1) {
-    ast_cli(fd, "playback_boost on the active skypiax_console, that is [%s], is: %5.1f\n",
-            skypiax_console_active,
-            20 * log10(((double) p->playback_boost / (double) BOOST_SCALE)));
-  } else if (argc == 2) {
-    skypiax_store_boost(argv[1], &p->playback_boost);
+	if (argc == 1) {
+		ast_cli(fd, "playback_boost on the active skypiax_console, that is [%s], is: %5.1f\n",
+				skypiax_console_active, 20 * log10(((double) p->playback_boost / (double) BOOST_SCALE)));
+	} else if (argc == 2) {
+		skypiax_store_boost(argv[1], &p->playback_boost);
 
-    ast_cli(fd,
-            "playback_boost on the active skypiax_console, that is [%s], is now: %5.1f\n",
-            skypiax_console_active,
-            20 * log10(((double) p->playback_boost / (double) BOOST_SCALE)));
-  }
+		ast_cli(fd,
+				"playback_boost on the active skypiax_console, that is [%s], is now: %5.1f\n",
+				skypiax_console_active, 20 * log10(((double) p->playback_boost / (double) BOOST_SCALE)));
+	}
 
-  return RESULT_SUCCESS;
+	return RESULT_SUCCESS;
 }
 int skypiax_console_capture_boost(int fd, int argc, char *argv[])
 {
-  struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
+	struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
 
-  if (argc > 2) {
-    return RESULT_SHOWUSAGE;
-  }
-  if (!p) {
-    ast_cli(fd,
-            "No \"current\" skypiax_console for capture_boost, please enter 'help skypiax_console'\n");
-    return RESULT_SUCCESS;
-  }
+	if (argc > 2) {
+		return RESULT_SHOWUSAGE;
+	}
+	if (!p) {
+		ast_cli(fd, "No \"current\" skypiax_console for capture_boost, please enter 'help skypiax_console'\n");
+		return RESULT_SUCCESS;
+	}
 
-  if (argc == 1) {
-    ast_cli(fd, "capture_boost on the active skypiax_console, that is [%s], is: %5.1f\n",
-            skypiax_console_active,
-            20 * log10(((double) p->capture_boost / (double) BOOST_SCALE)));
-  } else if (argc == 2) {
-    skypiax_store_boost(argv[1], &p->capture_boost);
+	if (argc == 1) {
+		ast_cli(fd, "capture_boost on the active skypiax_console, that is [%s], is: %5.1f\n",
+				skypiax_console_active, 20 * log10(((double) p->capture_boost / (double) BOOST_SCALE)));
+	} else if (argc == 2) {
+		skypiax_store_boost(argv[1], &p->capture_boost);
 
-    ast_cli(fd,
-            "capture_boost on the active skypiax_console, that is [%s], is now: %5.1f\n",
-            skypiax_console_active,
-            20 * log10(((double) p->capture_boost / (double) BOOST_SCALE)));
-  }
+		ast_cli(fd,
+				"capture_boost on the active skypiax_console, that is [%s], is now: %5.1f\n",
+				skypiax_console_active, 20 * log10(((double) p->capture_boost / (double) BOOST_SCALE)));
+	}
 
-  return RESULT_SUCCESS;
+	return RESULT_SUCCESS;
 }
 
 int skypiax_console_hangup(int fd, int argc, char *argv[])
 {
-  struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
+	struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
 
-  if (argc != 1) {
-    return RESULT_SHOWUSAGE;
-  }
-  if (!p) {
-    ast_cli(fd,
-            "No \"current\" skypiax_console for hanging up, please enter 'help skypiax_console'\n");
-    return RESULT_SUCCESS;
-  }
-  if (!p->owner) {
-    ast_cli(fd, "No call to hangup on the active skypiax_console, that is [%s]\n",
-            skypiax_console_active);
-    return RESULT_FAILURE;
-  }
-  if (p->owner)
-    ast_queue_hangup(p->owner);
-  return RESULT_SUCCESS;
+	if (argc != 1) {
+		return RESULT_SHOWUSAGE;
+	}
+	if (!p) {
+		ast_cli(fd, "No \"current\" skypiax_console for hanging up, please enter 'help skypiax_console'\n");
+		return RESULT_SUCCESS;
+	}
+	if (!p->owner) {
+		ast_cli(fd, "No call to hangup on the active skypiax_console, that is [%s]\n", skypiax_console_active);
+		return RESULT_FAILURE;
+	}
+	if (p->owner)
+		ast_queue_hangup(p->owner);
+	return RESULT_SUCCESS;
 }
 
 int skypiax_console_dial(int fd, int argc, char *argv[])
 {
-  char *s = NULL;
-  struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
+	char *s = NULL;
+	struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
 
-  if (argc != 2) {
-    return RESULT_SHOWUSAGE;
-  }
-  if (!p) {
-    ast_cli(fd,
-            "No \"current\" skypiax_console for dialing, please enter 'help skypiax_console'\n");
-    return RESULT_SUCCESS;
-  }
+	if (argc != 2) {
+		return RESULT_SHOWUSAGE;
+	}
+	if (!p) {
+		ast_cli(fd, "No \"current\" skypiax_console for dialing, please enter 'help skypiax_console'\n");
+		return RESULT_SUCCESS;
+	}
 
-  if (p->owner) {               /* already in a call */
-    int i;
-    struct ast_frame f = { AST_FRAME_DTMF, 0 };
+	if (p->owner) {				/* already in a call */
+		int i;
+		struct ast_frame f = { AST_FRAME_DTMF, 0 };
 
-    s = argv[1];
-    /* send the string one char at a time */
-    for (i = 0; i < strlen(s); i++) {
-      f.subclass = s[i];
-      ast_queue_frame(p->owner, &f);
-    }
-    return RESULT_SUCCESS;
-  } else
-    ast_cli(fd,
-            "No call in which to dial on the \"current\" skypiax_console, that is [%s]\n",
-            skypiax_console_active);
-  if (s)
-    free(s);
-  return RESULT_SUCCESS;
+		s = argv[1];
+		/* send the string one char at a time */
+		for (i = 0; i < strlen(s); i++) {
+			f.subclass = s[i];
+			ast_queue_frame(p->owner, &f);
+		}
+		return RESULT_SUCCESS;
+	} else
+		ast_cli(fd, "No call in which to dial on the \"current\" skypiax_console, that is [%s]\n", skypiax_console_active);
+	if (s)
+		free(s);
+	return RESULT_SUCCESS;
 }
 int skypiax_console_set_active(int fd, int argc, char *argv[])
 {
-  if (argc == 1)
-    ast_cli(fd,
-            "\"current\" skypiax_console is [%s]\n    Enter 'skypiax_console show' to see the available interfaces.\n    Enter 'skypiax_console interfacename' to change the \"current\" skypiax_console.\n",
-            skypiax_console_active);
-  else if (argc != 2) {
-    return RESULT_SHOWUSAGE;
-  } else {
-    struct skypiax_pvt *p;
-    if (strcmp(argv[1], "show") == 0) {
-      ast_cli(fd, "Available interfaces:\n");
-      for (p = skypiax_iflist; p; p = p->next)
-        ast_cli(fd, "     [%s]\n", p->name);
-      return RESULT_SUCCESS;
-    }
-    p = skypiax_console_find_desc(argv[1]);
-    if (p == NULL)
-      ast_cli(fd, "Interface [%s] do not exists!\n", argv[1]);
-    else {
-      skypiax_console_active = p->name;
-      ast_cli(fd, "\"current\" skypiax_console is now: [%s]\n", argv[1]);
-    }
-  }
-  return RESULT_SUCCESS;
+	if (argc == 1)
+		ast_cli(fd,
+				"\"current\" skypiax_console is [%s]\n    Enter 'skypiax_console show' to see the available interfaces.\n    Enter 'skypiax_console interfacename' to change the \"current\" skypiax_console.\n",
+				skypiax_console_active);
+	else if (argc != 2) {
+		return RESULT_SHOWUSAGE;
+	} else {
+		struct skypiax_pvt *p;
+		if (strcmp(argv[1], "show") == 0) {
+			ast_cli(fd, "Available interfaces:\n");
+			for (p = skypiax_iflist; p; p = p->next)
+				ast_cli(fd, "     [%s]\n", p->name);
+			return RESULT_SUCCESS;
+		}
+		p = skypiax_console_find_desc(argv[1]);
+		if (p == NULL)
+			ast_cli(fd, "Interface [%s] do not exists!\n", argv[1]);
+		else {
+			skypiax_console_active = p->name;
+			ast_cli(fd, "\"current\" skypiax_console is now: [%s]\n", argv[1]);
+		}
+	}
+	return RESULT_SUCCESS;
 }
 
 int skypiax_console_skypiax(int fd, int argc, char *argv[])
 {
-  return RESULT_SHOWUSAGE;
+	return RESULT_SHOWUSAGE;
 }
 
 void *do_skypeapi_thread(void *obj)
 {
-  return skypiax_do_skypeapi_thread_func(obj);
+	return skypiax_do_skypeapi_thread_func(obj);
 }
 
 int dtmf_received(private_t * p, char *value)
 {
 
-  struct ast_frame f2 = { AST_FRAME_DTMF, value[0], };
-  DEBUGA_SKYPE("Received DTMF: %s\n", SKYPIAX_P_LOG, value);
-  ast_queue_frame(p->owner, &f2);
+	struct ast_frame f2 = { AST_FRAME_DTMF, value[0], };
+	DEBUGA_SKYPE("Received DTMF: %s\n", SKYPIAX_P_LOG, value);
+	ast_queue_frame(p->owner, &f2);
 
-  return 0;
+	return 0;
 
 }
 
 int start_audio_threads(private_t * p)
 {
-  //if (!p->tcp_srv_thread) {
-  if (ast_pthread_create(&p->tcp_srv_thread, NULL, skypiax_do_tcp_srv_thread, p) < 0) {
-    ERRORA("Unable to start tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
-    return -1;
-  } else {
-    DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
-  }
-  //}
-  //if (!p->tcp_cli_thread) {
-  if (ast_pthread_create(&p->tcp_cli_thread, NULL, skypiax_do_tcp_cli_thread, p) < 0) {
-    ERRORA("Unable to start tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
-    return -1;
-  } else {
-    DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
-  }
-  //}
+	//if (!p->tcp_srv_thread) {
+	if (ast_pthread_create(&p->tcp_srv_thread, NULL, skypiax_do_tcp_srv_thread, p) < 0) {
+		ERRORA("Unable to start tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
+		return -1;
+	} else {
+		DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
+	}
+	//}
+	//if (!p->tcp_cli_thread) {
+	if (ast_pthread_create(&p->tcp_cli_thread, NULL, skypiax_do_tcp_cli_thread, p) < 0) {
+		ERRORA("Unable to start tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
+		return -1;
+	} else {
+		DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
+	}
+	//}
 
 #ifdef NOTDEF
-  switch_threadattr_t *thd_attr = NULL;
+	switch_threadattr_t *thd_attr = NULL;
 
-  switch_threadattr_create(&thd_attr, skypiax_module_pool);
-  switch_threadattr_detach_set(thd_attr, 1);
-  switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-  switch_thread_create(&tech_pvt->tcp_srv_thread, thd_attr, skypiax_do_tcp_srv_thread,
-                       tech_pvt, skypiax_module_pool);
-  DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
+	switch_threadattr_create(&thd_attr, skypiax_module_pool);
+	switch_threadattr_detach_set(thd_attr, 1);
+	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+	switch_thread_create(&tech_pvt->tcp_srv_thread, thd_attr, skypiax_do_tcp_srv_thread, tech_pvt, skypiax_module_pool);
+	DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPIAX_P_LOG);
 
-  switch_threadattr_create(&thd_attr, skypiax_module_pool);
-  switch_threadattr_detach_set(thd_attr, 1);
-  switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-  switch_thread_create(&tech_pvt->tcp_cli_thread, thd_attr, skypiax_do_tcp_cli_thread,
-                       tech_pvt, skypiax_module_pool);
-  DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
-  switch_sleep(100000);
+	switch_threadattr_create(&thd_attr, skypiax_module_pool);
+	switch_threadattr_detach_set(thd_attr, 1);
+	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+	switch_thread_create(&tech_pvt->tcp_cli_thread, thd_attr, skypiax_do_tcp_cli_thread, tech_pvt, skypiax_module_pool);
+	DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPIAX_P_LOG);
+	switch_sleep(100000);
 
 #endif
 
-  return 0;
+	return 0;
 }
 
 int new_inbound_channel(private_t * p)
 {
 
 #ifdef NOTDEF
-  switch_core_session_t *session = NULL;
-  switch_channel_t *channel = NULL;
+	switch_core_session_t *session = NULL;
+	switch_channel_t *channel = NULL;
 
-  if ((session =
-       switch_core_session_request(skypiax_endpoint_interface,
-                                   SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
-    switch_core_session_add_stream(session, NULL);
-    channel = switch_core_session_get_channel(session);
-    skypiax_tech_init(tech_pvt, session);
+	if ((session = switch_core_session_request(skypiax_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)) != 0) {
+		switch_core_session_add_stream(session, NULL);
+		channel = switch_core_session_get_channel(session);
+		skypiax_tech_init(tech_pvt, session);
 
-    if ((tech_pvt->caller_profile =
-         switch_caller_profile_new(switch_core_session_get_pool(session), "skypiax",
-                                   tech_pvt->dialplan, tech_pvt->callid_name,
-                                   tech_pvt->callid_number, NULL, NULL, NULL, NULL,
-                                   "mod_skypiax", tech_pvt->context,
-                                   tech_pvt->destination)) != 0) {
-      char name[128];
-      //switch_snprintf(name, sizeof(name), "skypiax/%s/%s", tech_pvt->name, tech_pvt->caller_profile->destination_number);
-      switch_snprintf(name, sizeof(name), "skypiax/%s", tech_pvt->name);
-      switch_channel_set_name(channel, name);
-      switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
-    }
-    switch_channel_set_state(channel, CS_INIT);
-    if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) {
-      ERRORA("Error spawning thread\n", SKYPIAX_P_LOG);
-      switch_core_session_destroy(&session);
-    }
-  }
-  switch_channel_mark_answered(channel);
+		if ((tech_pvt->caller_profile =
+			 switch_caller_profile_new(switch_core_session_get_pool(session), "skypiax",
+									   tech_pvt->dialplan, tech_pvt->callid_name,
+									   tech_pvt->callid_number, NULL, NULL, NULL, NULL, "mod_skypiax", tech_pvt->context, tech_pvt->destination)) != 0) {
+			char name[128];
+			//switch_snprintf(name, sizeof(name), "skypiax/%s/%s", tech_pvt->name, tech_pvt->caller_profile->destination_number);
+			switch_snprintf(name, sizeof(name), "skypiax/%s", tech_pvt->name);
+			switch_channel_set_name(channel, name);
+			switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
+		}
+		switch_channel_set_state(channel, CS_INIT);
+		if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) {
+			ERRORA("Error spawning thread\n", SKYPIAX_P_LOG);
+			switch_core_session_destroy(&session);
+		}
+	}
+	switch_channel_mark_answered(channel);
 
 #endif
-  return 0;
+	return 0;
 }
 
 int remote_party_is_ringing(private_t * p)
 {
-  if (p->owner) {
-    ast_queue_control(p->owner, AST_CONTROL_RINGING);
-  }
+	if (p->owner) {
+		ast_queue_control(p->owner, AST_CONTROL_RINGING);
+	}
 
-  return 0;
+	return 0;
 }
 
 int remote_party_is_early_media(private_t * p)
 {
-  if (p->owner) {
-    ast_queue_control(p->owner, AST_CONTROL_RINGING);
-  }
+	if (p->owner) {
+		ast_queue_control(p->owner, AST_CONTROL_RINGING);
+	}
 
-  return 0;
+	return 0;
 }
 
 int outbound_channel_answered(private_t * p)
 {
 
-  if (p->owner) {
-    ast_queue_control(p->owner, AST_CONTROL_ANSWER);
-  }
+	if (p->owner) {
+		ast_queue_control(p->owner, AST_CONTROL_ANSWER);
+	}
 
-  return 0;
+	return 0;
 }
 void *skypiax_do_tcp_srv_thread(void *obj)
 {
-  return skypiax_do_tcp_srv_thread_func(obj);
+	return skypiax_do_tcp_srv_thread_func(obj);
 }
 void *skypiax_do_tcp_cli_thread(void *obj)
 {
-  return skypiax_do_tcp_cli_thread_func(obj);
+	return skypiax_do_tcp_cli_thread_func(obj);
 }
 
 int skypiax_audio_write(struct skypiax_pvt *p, struct ast_frame *f)
 {
-  int sent;
+	int sent;
 
-  sent = write(p->audioskypepipe[1], (short *) f->data, f->datalen);
+	sent = write(p->audioskypepipe[1], (short *) f->data, f->datalen);
 
-  return 0;
+	return 0;
 }
 int skypiax_console_skype(int fd, int argc, char *argv[])
 {
-  struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
-  char skype_msg[1024];
-  int i, a, c;
+	struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
+	char skype_msg[1024];
+	int i, a, c;
 
-  if (argc == 1) {
-    return RESULT_SHOWUSAGE;
-  }
-  if (!p) {
-    ast_cli(fd, "No \"current\" console for skypiax_, please enter 'help console'\n");
-    return RESULT_SUCCESS;
-  }
-  if (!p->skype) {
-    ast_cli(fd, "The \"current\" console is not connected to a Skype client'\n");
-    return RESULT_SUCCESS;
-  }
+	if (argc == 1) {
+		return RESULT_SHOWUSAGE;
+	}
+	if (!p) {
+		ast_cli(fd, "No \"current\" console for skypiax_, please enter 'help console'\n");
+		return RESULT_SUCCESS;
+	}
+	if (!p->skype) {
+		ast_cli(fd, "The \"current\" console is not connected to a Skype client'\n");
+		return RESULT_SUCCESS;
+	}
 
-  memset(skype_msg, 0, sizeof(skype_msg));
-  c = 0;
-  for (i = 1; i < argc; i++) {
-    for (a = 0; a < strlen(argv[i]); a++) {
-      skype_msg[c] = argv[i][a];
-      c++;
-      if (c == 1022)
-        break;
-    }
-    if (i != argc - 1) {
-      skype_msg[c] = ' ';
-      c++;
-    }
-    if (c == 1023)
-      break;
-  }
-  skypiax_signaling_write(p, skype_msg);
-  return RESULT_SUCCESS;
+	memset(skype_msg, 0, sizeof(skype_msg));
+	c = 0;
+	for (i = 1; i < argc; i++) {
+		for (a = 0; a < strlen(argv[i]); a++) {
+			skype_msg[c] = argv[i][a];
+			c++;
+			if (c == 1022)
+				break;
+		}
+		if (i != argc - 1) {
+			skype_msg[c] = ' ';
+			c++;
+		}
+		if (c == 1023)
+			break;
+	}
+	skypiax_signaling_write(p, skype_msg);
+	return RESULT_SUCCESS;
 }
 
 int skypiax_console_skypiax_dir_import(int fd, int argc, char *argv[])
 {
-  //int res;
-  struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
-  //char list_command[64];
-  char fn[256];
-  char date[256] = "";
-  time_t t;
-  char *configfile = SKYPIAX_DIR_CONFIG;
-  int add_to_skypiax_dir_conf = 1;
-  //int fromskype = 0;
-  //int fromcell = 0;
+	//int res;
+	struct skypiax_pvt *p = skypiax_console_find_desc(skypiax_console_active);
+	//char list_command[64];
+	char fn[256];
+	char date[256] = "";
+	time_t t;
+	char *configfile = SKYPIAX_DIR_CONFIG;
+	int add_to_skypiax_dir_conf = 1;
+	//int fromskype = 0;
+	//int fromcell = 0;
 
 #if 0
-  if (directoriax_entry_extension) {
-    skypiax_dir_entry_extension = directoriax_entry_extension;
-  } else {
-    ast_cli(fd,
-            "No 'directoriax_entry_extension', you MUST have loaded directoriax.so\n");
-    return RESULT_SUCCESS;
-  }
+	if (directoriax_entry_extension) {
+		skypiax_dir_entry_extension = directoriax_entry_extension;
+	} else {
+		ast_cli(fd, "No 'directoriax_entry_extension', you MUST have loaded directoriax.so\n");
+		return RESULT_SUCCESS;
+	}
 #endif
 
-  if (argc != 2)
-    return RESULT_SHOWUSAGE;
-  if (!p) {
-    ast_cli(fd, "No \"current\" console ???, please enter 'help skypiax_console'\n");
-    return RESULT_SUCCESS;
-  }
+	if (argc != 2)
+		return RESULT_SHOWUSAGE;
+	if (!p) {
+		ast_cli(fd, "No \"current\" console ???, please enter 'help skypiax_console'\n");
+		return RESULT_SUCCESS;
+	}
 
-  if (!strcasecmp(argv[1], "add"))
-    add_to_skypiax_dir_conf = 1;
-  else if (!strcasecmp(argv[1], "replace"))
-    add_to_skypiax_dir_conf = 0;
-  else {
-    ast_cli(fd, "\n\nYou have neither specified 'add' nor 'replace'\n\n");
-    return RESULT_SHOWUSAGE;
-  }
+	if (!strcasecmp(argv[1], "add"))
+		add_to_skypiax_dir_conf = 1;
+	else if (!strcasecmp(argv[1], "replace"))
+		add_to_skypiax_dir_conf = 0;
+	else {
+		ast_cli(fd, "\n\nYou have neither specified 'add' nor 'replace'\n\n");
+		return RESULT_SHOWUSAGE;
+	}
 
 #if 0
-  if (!strcasecmp(argv[2], "fromskype"))
-    fromskype = 1;
-  else if (!strcasecmp(argv[2], "fromcell"))
-    fromcell = 1;
-  else {
-    ast_cli(fd, "\n\nYou have neither specified 'fromskype' nor 'fromcell'\n\n");
-    return RESULT_SHOWUSAGE;
-  }
+	if (!strcasecmp(argv[2], "fromskype"))
+		fromskype = 1;
+	else if (!strcasecmp(argv[2], "fromcell"))
+		fromcell = 1;
+	else {
+		ast_cli(fd, "\n\nYou have neither specified 'fromskype' nor 'fromcell'\n\n");
+		return RESULT_SHOWUSAGE;
+	}
 
-  if (fromcell) {
-    ast_cli(fd,
-            "Importing from cellphone is currently supported only on \"AT\" cellphones :( !\n");
-    //fclose(p->phonebook_writing_fp);
-    //skypiax_dir_create_extensions();
-    return RESULT_SUCCESS;
-  }
+	if (fromcell) {
+		ast_cli(fd, "Importing from cellphone is currently supported only on \"AT\" cellphones :( !\n");
+		//fclose(p->phonebook_writing_fp);
+		//skypiax_dir_create_extensions();
+		return RESULT_SUCCESS;
+	}
 
-  if (fromskype)
-    if (!p->skype) {
-      ast_cli(fd, "Importing from skype is supported by skypiax_dir on chan_skypiax!\n");
-      //fclose(p->phonebook_writing_fp);
-      //skypiax_dir_create_extensions();
-      return RESULT_SUCCESS;
-    }
+	if (fromskype)
+		if (!p->skype) {
+			ast_cli(fd, "Importing from skype is supported by skypiax_dir on chan_skypiax!\n");
+			//fclose(p->phonebook_writing_fp);
+			//skypiax_dir_create_extensions();
+			return RESULT_SUCCESS;
+		}
 
-  if (fromcell || fromskype)
-    if (argc != 3) {
-      ast_cli(fd,
-              "\n\nYou don't have to specify a filename with 'fromcell' or with 'fromskype'\n\n");
-      return RESULT_SHOWUSAGE;
-    }
+	if (fromcell || fromskype)
+		if (argc != 3) {
+			ast_cli(fd, "\n\nYou don't have to specify a filename with 'fromcell' or with 'fromskype'\n\n");
+			return RESULT_SHOWUSAGE;
+		}
 #endif
 
   /*******************************************************************************************/
 
-  if (configfile[0] == '/') {
-    ast_copy_string(fn, configfile, sizeof(fn));
-  } else {
-    snprintf(fn, sizeof(fn), "%s/%s", ast_config_AST_CONFIG_DIR, configfile);
-  }
-  NOTICA("Opening '%s'\n", SKYPIAX_P_LOG, fn);
-  time(&t);
-  ast_copy_string(date, ctime(&t), sizeof(date));
+	if (configfile[0] == '/') {
+		ast_copy_string(fn, configfile, sizeof(fn));
+	} else {
+		snprintf(fn, sizeof(fn), "%s/%s", ast_config_AST_CONFIG_DIR, configfile);
+	}
+	NOTICA("Opening '%s'\n", SKYPIAX_P_LOG, fn);
+	time(&t);
+	ast_copy_string(date, ctime(&t), sizeof(date));
 
-  if (add_to_skypiax_dir_conf)
-    p->phonebook_writing_fp = fopen(fn, "a+");
-  else
-    p->phonebook_writing_fp = fopen(fn, "w+");
+	if (add_to_skypiax_dir_conf)
+		p->phonebook_writing_fp = fopen(fn, "a+");
+	else
+		p->phonebook_writing_fp = fopen(fn, "w+");
 
-  if (p->phonebook_writing_fp) {
-    if (add_to_skypiax_dir_conf) {
-      NOTICA("Opened '%s' for appending \n", SKYPIAX_P_LOG, fn);
-      fprintf(p->phonebook_writing_fp, ";!\n");
-      fprintf(p->phonebook_writing_fp, ";! Update Date: %s", date);
-      fprintf(p->phonebook_writing_fp, ";! Updated by: %s, %d\n", __FILE__, __LINE__);
-      fprintf(p->phonebook_writing_fp, ";!\n");
-    } else {
-      NOTICA("Opened '%s' for writing \n", SKYPIAX_P_LOG, fn);
-      fprintf(p->phonebook_writing_fp, ";!\n");
-      fprintf(p->phonebook_writing_fp, ";! Automatically generated configuration file\n");
-      fprintf(p->phonebook_writing_fp, ";! Filename: %s (%s)\n", configfile, fn);
-      fprintf(p->phonebook_writing_fp, ";! Creation Date: %s", date);
-      fprintf(p->phonebook_writing_fp, ";! Generated by: %s, %d\n", __FILE__, __LINE__);
-      fprintf(p->phonebook_writing_fp, ";!\n");
-      fprintf(p->phonebook_writing_fp, "[general]\n\n");
-      fprintf(p->phonebook_writing_fp, "[default]\n");
-    }
+	if (p->phonebook_writing_fp) {
+		if (add_to_skypiax_dir_conf) {
+			NOTICA("Opened '%s' for appending \n", SKYPIAX_P_LOG, fn);
+			fprintf(p->phonebook_writing_fp, ";!\n");
+			fprintf(p->phonebook_writing_fp, ";! Update Date: %s", date);
+			fprintf(p->phonebook_writing_fp, ";! Updated by: %s, %d\n", __FILE__, __LINE__);
+			fprintf(p->phonebook_writing_fp, ";!\n");
+		} else {
+			NOTICA("Opened '%s' for writing \n", SKYPIAX_P_LOG, fn);
+			fprintf(p->phonebook_writing_fp, ";!\n");
+			fprintf(p->phonebook_writing_fp, ";! Automatically generated configuration file\n");
+			fprintf(p->phonebook_writing_fp, ";! Filename: %s (%s)\n", configfile, fn);
+			fprintf(p->phonebook_writing_fp, ";! Creation Date: %s", date);
+			fprintf(p->phonebook_writing_fp, ";! Generated by: %s, %d\n", __FILE__, __LINE__);
+			fprintf(p->phonebook_writing_fp, ";!\n");
+			fprintf(p->phonebook_writing_fp, "[general]\n\n");
+			fprintf(p->phonebook_writing_fp, "[default]\n");
+		}
 
   /*******************************************************************************************/
-    //if (fromskype) {
-    if (p->skype) {
-      WARNINGA
-        ("About to querying the Skype client 'Contacts', it may take some moments... Don't worry.\n",
-         SKYPIAX_P_LOG);
-      if (p->skype_thread != AST_PTHREADT_NULL) {
-        char msg_to_skype[1024];
+		//if (fromskype) {
+		if (p->skype) {
+			WARNINGA("About to querying the Skype client 'Contacts', it may take some moments... Don't worry.\n", SKYPIAX_P_LOG);
+			if (p->skype_thread != AST_PTHREADT_NULL) {
+				char msg_to_skype[1024];
 
-        p->skype_friends[0] = '\0';
-        sprintf(msg_to_skype, "#333 SEARCH FRIENDS");
-        if (skypiax_signaling_write(p, msg_to_skype) < 0) {
-          return -1;
-        }
+				p->skype_friends[0] = '\0';
+				sprintf(msg_to_skype, "#333 SEARCH FRIENDS");
+				if (skypiax_signaling_write(p, msg_to_skype) < 0) {
+					return -1;
+				}
 
-        int friends_count = 0;
-        while (p->skype_friends[0] == '\0') {
-          /* FIXME needs a timeout, can't wait forever! 
-           * eg. when skype is running but not connected! */
-          usleep(100);
-          friends_count++;
-          if (friends_count > 20000) {
-            return -1;          /* FIXME */
-          }
-        }
+				int friends_count = 0;
+				while (p->skype_friends[0] == '\0') {
+					/* FIXME needs a timeout, can't wait forever! 
+					 * eg. when skype is running but not connected! */
+					usleep(100);
+					friends_count++;
+					if (friends_count > 20000) {
+						return -1;	/* FIXME */
+					}
+				}
 
-      }
+			}
 
-      if (p->skype_thread != AST_PTHREADT_NULL) {
-        char msg_to_skype[1024];
+			if (p->skype_thread != AST_PTHREADT_NULL) {
+				char msg_to_skype[1024];
 
-        if (p->skype_friends[0] != '\0') {
-          char *buf, *where;
-          char **stringp;
-          int skype_dir_file_written = 0;
+				if (p->skype_friends[0] != '\0') {
+					char *buf, *where;
+					char **stringp;
+					int skype_dir_file_written = 0;
 
-          buf = p->skype_friends;
-          stringp = &buf;
-          where = strsep(stringp, ", ");
-          while (where) {
-            if (where[0] != '\0') {
-              /*
-               * So, we have the Skype username (the HANDLE, I think is called).
-               * But we want to call the names we see in the Skype contact list
-               * So, let's check the DISPLAYNAME (the end user modified contact name)
-               * Then, we check the FULLNAME (that appears as it was the DISPLAYNAME 
-               * if the end user has not modify it)
-               * If we still have neither DISPLAYNAME nor FULLNAME, we'll use the 
-               * Skipe username (the HANDLE)
-               */
+					buf = p->skype_friends;
+					stringp = &buf;
+					where = strsep(stringp, ", ");
+					while (where) {
+						if (where[0] != '\0') {
+							/*
+							 * So, we have the Skype username (the HANDLE, I think is called).
+							 * But we want to call the names we see in the Skype contact list
+							 * So, let's check the DISPLAYNAME (the end user modified contact name)
+							 * Then, we check the FULLNAME (that appears as it was the DISPLAYNAME 
+							 * if the end user has not modify it)
+							 * If we still have neither DISPLAYNAME nor FULLNAME, we'll use the 
+							 * Skipe username (the HANDLE)
+							 */
 
-              p->skype_displayname[0] = '\0';
-              sprintf(msg_to_skype, "#765 GET USER %s DISPLAYNAME", where);
-              skypiax_signaling_write(p, msg_to_skype);
-              int displayname_count = 0;
-              while (p->skype_displayname[0] == '\0') {
-                /* FIXME needs a timeout, can't wait forever! 
-                 * eg. when skype is running but not connected! */
-                usleep(100);
-                displayname_count++;
-                if (displayname_count > 20000)
-                  return -1;    /* FIXME */
-              }
-              if (p->skype_displayname[0] != '\0') {
-                char *where2;
-                char sanitized[300];
+							p->skype_displayname[0] = '\0';
+							sprintf(msg_to_skype, "#765 GET USER %s DISPLAYNAME", where);
+							skypiax_signaling_write(p, msg_to_skype);
+							int displayname_count = 0;
+							while (p->skype_displayname[0] == '\0') {
+								/* FIXME needs a timeout, can't wait forever! 
+								 * eg. when skype is running but not connected! */
+								usleep(100);
+								displayname_count++;
+								if (displayname_count > 20000)
+									return -1;	/* FIXME */
+							}
+							if (p->skype_displayname[0] != '\0') {
+								char *where2;
+								char sanitized[300];
 
-                sanitized[0] = '\0';
+								sanitized[0] = '\0';
 
-                where2 = strstr(p->skype_displayname, "DISPLAYNAME ");
-                if (where2) {
+								where2 = strstr(p->skype_displayname, "DISPLAYNAME ");
+								if (where2) {
 
-                  /* there can be some *smart* that makes a displayname 
-                   * that is different than first<space>last, */
-                  /* maybe initials, simbols, slashes, 
-                   * something smartish... let's check */
+									/* there can be some *smart* that makes a displayname 
+									 * that is different than first<space>last, */
+									/* maybe initials, simbols, slashes, 
+									 * something smartish... let's check */
 
-                  if (where2[12] != '\0') {
-                    int i = 12;
-                    int x = 0;
-                    int spaces = 0;
-                    int last_char_was_space = 0;
+									if (where2[12] != '\0') {
+										int i = 12;
+										int x = 0;
+										int spaces = 0;
+										int last_char_was_space = 0;
 
-                    for (i = 12; i < strlen(where2) && x < 299; i++) {
-                      if (!isalnum(where2[i])) {
-                        if (!isblank(where2[i])) {
-                          /* bad char */
-                          continue;
-                        }
-                        /* is a space */
-                        if (last_char_was_space == 1)   /* do not write 2 consecutive spaces */
-                          continue;
-                        last_char_was_space = 1;
-                        sanitized[x] = ' ';
-                        x++;
-                        continue;
-                      }
-                      /* is alphanum */
-                      last_char_was_space = 0;
-                      sanitized[x] = where2[i];
-                      x++;
-                      continue;
-                    }
+										for (i = 12; i < strlen(where2) && x < 299; i++) {
+											if (!isalnum(where2[i])) {
+												if (!isblank(where2[i])) {
+													/* bad char */
+													continue;
+												}
+												/* is a space */
+												if (last_char_was_space == 1)	/* do not write 2 consecutive spaces */
+													continue;
+												last_char_was_space = 1;
+												sanitized[x] = ' ';
+												x++;
+												continue;
+											}
+											/* is alphanum */
+											last_char_was_space = 0;
+											sanitized[x] = where2[i];
+											x++;
+											continue;
+										}
 
-                    sanitized[x] = '\0';
-                    if (spaces == 0) {
-                    }
-                    DEBUGA_SKYPE("sanitized=|%s|, where=|%s|, where2=|%s|\n",
-                                 SKYPIAX_P_LOG, sanitized, where, &where2[12]);
-                  }
+										sanitized[x] = '\0';
+										if (spaces == 0) {
+										}
+										DEBUGA_SKYPE("sanitized=|%s|, where=|%s|, where2=|%s|\n", SKYPIAX_P_LOG, sanitized, where, &where2[12]);
+									}
 
-                  if (where2[12] != '\0') {
-                    skypiax_dir_entry_extension++;
-                    if (where[0] == '+' || isdigit(where[0])) { /* is a skypeout number */
-                      fprintf(p->phonebook_writing_fp,
-                              "%s  => ,%sSKO,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
-                              where, sanitized, "no",
-                              p->skypiax_dir_entry_extension_prefix, "2",
-                              skypiax_dir_entry_extension, "yes", "not_specified");
-                    } else {    /* is a skype name */
-                      fprintf(p->phonebook_writing_fp,
-                              "%s  => ,%sSKY,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
-                              where, sanitized, "no",
-                              p->skypiax_dir_entry_extension_prefix, "1",
-                              skypiax_dir_entry_extension, "yes", "not_specified");
-                    }
-                    skype_dir_file_written = 1;
+									if (where2[12] != '\0') {
+										skypiax_dir_entry_extension++;
+										if (where[0] == '+' || isdigit(where[0])) {	/* is a skypeout number */
+											fprintf(p->phonebook_writing_fp,
+													"%s  => ,%sSKO,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
+													where, sanitized, "no",
+													p->skypiax_dir_entry_extension_prefix, "2", skypiax_dir_entry_extension, "yes", "not_specified");
+										} else {	/* is a skype name */
+											fprintf(p->phonebook_writing_fp,
+													"%s  => ,%sSKY,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
+													where, sanitized, "no",
+													p->skypiax_dir_entry_extension_prefix, "1", skypiax_dir_entry_extension, "yes", "not_specified");
+										}
+										skype_dir_file_written = 1;
 
-                  }
-                }
-              }
-              p->skype_displayname[0] = '\0';
+									}
+								}
+							}
+							p->skype_displayname[0] = '\0';
 
-              p->skype_fullname[0] = '\0';
-              sprintf(msg_to_skype, "#222 GET USER %s FULLNAME", where);
-              skypiax_signaling_write(p, msg_to_skype);
-              int fullname_count = 0;
-              while (p->skype_fullname[0] == '\0') {
-                /* FIXME needs a timeout, can't wait forever! 
-                 * eg. when skype is running but not connected! */
-                usleep(100);
-                fullname_count++;
-                if (fullname_count > 20000)
-                  return -1;    /* FIXME */
-              }
-              if (p->skype_fullname[0] != '\0') {
-                char *where2;
-                char sanitized[300];
+							p->skype_fullname[0] = '\0';
+							sprintf(msg_to_skype, "#222 GET USER %s FULLNAME", where);
+							skypiax_signaling_write(p, msg_to_skype);
+							int fullname_count = 0;
+							while (p->skype_fullname[0] == '\0') {
+								/* FIXME needs a timeout, can't wait forever! 
+								 * eg. when skype is running but not connected! */
+								usleep(100);
+								fullname_count++;
+								if (fullname_count > 20000)
+									return -1;	/* FIXME */
+							}
+							if (p->skype_fullname[0] != '\0') {
+								char *where2;
+								char sanitized[300];
 
-                where2 = strstr(p->skype_fullname, "FULLNAME ");
-                if (where2) {
+								where2 = strstr(p->skype_fullname, "FULLNAME ");
+								if (where2) {
 
-                  /* there can be some *smart* that makes a fullname 
-                   * that is different than first<space>last, */
-                  /* maybe initials, simbols, slashes,
-                   *  something smartish... let's check */
+									/* there can be some *smart* that makes a fullname 
+									 * that is different than first<space>last, */
+									/* maybe initials, simbols, slashes,
+									 *  something smartish... let's check */
 
-                  if (where2[9] != '\0') {
-                    int i = 9;
-                    int x = 0;
-                    int spaces = 0;
-                    int last_char_was_space = 0;
+									if (where2[9] != '\0') {
+										int i = 9;
+										int x = 0;
+										int spaces = 0;
+										int last_char_was_space = 0;
 
-                    for (i = 9; i < strlen(where2) && x < 299; i++) {
-                      if (!isalnum(where2[i])) {
-                        if (!isblank(where2[i])) {
-                          /* bad char */
-                          continue;
-                        }
-                        /* is a space */
-                        if (last_char_was_space == 1)   /* do not write 2 consecutive spaces */
-                          continue;
-                        last_char_was_space = 1;
-                        sanitized[x] = ' ';
-                        x++;
-                        continue;
-                      }
-                      /* alphanum */
-                      last_char_was_space = 0;
-                      sanitized[x] = where2[i];
-                      x++;
-                      continue;
-                    }
+										for (i = 9; i < strlen(where2) && x < 299; i++) {
+											if (!isalnum(where2[i])) {
+												if (!isblank(where2[i])) {
+													/* bad char */
+													continue;
+												}
+												/* is a space */
+												if (last_char_was_space == 1)	/* do not write 2 consecutive spaces */
+													continue;
+												last_char_was_space = 1;
+												sanitized[x] = ' ';
+												x++;
+												continue;
+											}
+											/* alphanum */
+											last_char_was_space = 0;
+											sanitized[x] = where2[i];
+											x++;
+											continue;
+										}
 
-                    sanitized[x] = '\0';
-                    if (spaces == 0) {
-                    }
-                    DEBUGA_SKYPE("sanitized=|%s|, where=|%s|, where2=|%s|\n",
-                                 SKYPIAX_P_LOG, sanitized, where, &where2[9]);
-                  }
+										sanitized[x] = '\0';
+										if (spaces == 0) {
+										}
+										DEBUGA_SKYPE("sanitized=|%s|, where=|%s|, where2=|%s|\n", SKYPIAX_P_LOG, sanitized, where, &where2[9]);
+									}
 
-                  if (skype_dir_file_written == 0) {
-                    skypiax_dir_entry_extension++;
-                    if (where2[9] != '\0') {
-                      if (where[0] == '+' || isdigit(where[0])) {   /* is a skypeout number */
-                        fprintf(p->phonebook_writing_fp,
-                                "%s  => ,%sSKO,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
-                                where, sanitized, "no",
-                                p->skypiax_dir_entry_extension_prefix, "2",
-                                skypiax_dir_entry_extension, "yes", "not_specified");
-                      } else {  /* is a skype name */
-                        fprintf(p->phonebook_writing_fp,
-                                "%s  => ,%sSKY,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
-                                where, sanitized, "no",
-                                p->skypiax_dir_entry_extension_prefix, "1",
-                                skypiax_dir_entry_extension, "yes", "not_specified");
+									if (skype_dir_file_written == 0) {
+										skypiax_dir_entry_extension++;
+										if (where2[9] != '\0') {
+											if (where[0] == '+' || isdigit(where[0])) {	/* is a skypeout number */
+												fprintf(p->phonebook_writing_fp,
+														"%s  => ,%sSKO,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
+														where, sanitized, "no",
+														p->skypiax_dir_entry_extension_prefix, "2", skypiax_dir_entry_extension, "yes", "not_specified");
+											} else {	/* is a skype name */
+												fprintf(p->phonebook_writing_fp,
+														"%s  => ,%sSKY,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
+														where, sanitized, "no",
+														p->skypiax_dir_entry_extension_prefix, "1", skypiax_dir_entry_extension, "yes", "not_specified");
 
-                      }
+											}
 
-                    } else {
-                      if (where[0] == '+' || isdigit(where[0])) {   /* is a skypeout number */
-                        fprintf(p->phonebook_writing_fp,
-                                "%s  => ,%sSKO,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
-                                where, where, "no", p->skypiax_dir_entry_extension_prefix,
-                                "2", skypiax_dir_entry_extension, "yes", "not_specified");
-                      } else {  /* is a skype name */
-                        fprintf(p->phonebook_writing_fp,
-                                "%s  => ,%sSKY,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
-                                where, where, "no", p->skypiax_dir_entry_extension_prefix,
-                                "1", skypiax_dir_entry_extension, "yes", "not_specified");
+										} else {
+											if (where[0] == '+' || isdigit(where[0])) {	/* is a skypeout number */
+												fprintf(p->phonebook_writing_fp,
+														"%s  => ,%sSKO,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
+														where, where, "no", p->skypiax_dir_entry_extension_prefix,
+														"2", skypiax_dir_entry_extension, "yes", "not_specified");
+											} else {	/* is a skype name */
+												fprintf(p->phonebook_writing_fp,
+														"%s  => ,%sSKY,,,hidefromdir=%s|phonebook_direct_calling_ext=%d%s%.4d|phonebook_entry_fromskype=%s|phonebook_entry_owner=%s\n",
+														where, where, "no", p->skypiax_dir_entry_extension_prefix,
+														"1", skypiax_dir_entry_extension, "yes", "not_specified");
 
-                      }
-                    }
-                  }
+											}
+										}
+									}
 
-                  skype_dir_file_written = 0;
+									skype_dir_file_written = 0;
 
-                }
+								}
 
-              }
-              p->skype_fullname[0] = '\0';
+							}
+							p->skype_fullname[0] = '\0';
 
-            }
-            where = strsep(stringp, ", ");
-          }
+						}
+						where = strsep(stringp, ", ");
+					}
 
-          p->skype_friends[0] = '\0';
-        }
-      }
-    } else {
+					p->skype_friends[0] = '\0';
+				}
+			}
+		} else {
 
-      ast_cli(fd,
-              "Skype not configured on the 'current' console, not importing from Skype client!\n");
-    }
-    //}
+			ast_cli(fd, "Skype not configured on the 'current' console, not importing from Skype client!\n");
+		}
+		//}
   /*******************************************************************************************/
   /*******************************************************************************************/
-  } else {
-    ast_cli(fd, "\n\nfailed to open the skypiax_dir.conf configuration file: %s\n", fn);
-    ERRORA("failed to open the skypiax_dir.conf configuration file: %s\n", SKYPIAX_P_LOG,
-           fn);
-    return RESULT_FAILURE;
-  }
+	} else {
+		ast_cli(fd, "\n\nfailed to open the skypiax_dir.conf configuration file: %s\n", fn);
+		ERRORA("failed to open the skypiax_dir.conf configuration file: %s\n", SKYPIAX_P_LOG, fn);
+		return RESULT_FAILURE;
+	}
 
-  fclose(p->phonebook_writing_fp);
-  //skypiax_dir_create_extensions();
+	fclose(p->phonebook_writing_fp);
+	//skypiax_dir_create_extensions();
 
-  return RESULT_SUCCESS;
+	return RESULT_SUCCESS;
 }
 
 private_t *find_available_skypiax_interface(void)
 {
-  private_t *p;
-  int found = 0;
+	private_t *p;
+	int found = 0;
 
-  /* lock the interfaces' list */
-  LOKKA(&skypiax_iflock);
-  /* make a pointer to the first interface in the interfaces list */
-  p = skypiax_iflist;
-  /* Search for the requested interface and verify if is unowned */
-  while (p) {
-    if (!p->owner) {
-      DEBUGA_PBX("Interface is NOT OWNED by a channel\n", SKYPIAX_P_LOG);
-      found = 1;
-      /* we found the requested interface, bail out from the while loop */
-      break;
-    } else {
-      /* interface owned by a channel */
-      DEBUGA_PBX("Interface is OWNED by a channel\n", SKYPIAX_P_LOG);
-    }
-    /* not yet found, next please */
-    p = p->next;
-  }
+	/* lock the interfaces' list */
+	LOKKA(&skypiax_iflock);
+	/* make a pointer to the first interface in the interfaces list */
+	p = skypiax_iflist;
+	/* Search for the requested interface and verify if is unowned */
+	while (p) {
+		if (!p->owner) {
+			DEBUGA_PBX("Interface is NOT OWNED by a channel\n", SKYPIAX_P_LOG);
+			found = 1;
+			/* we found the requested interface, bail out from the while loop */
+			break;
+		} else {
+			/* interface owned by a channel */
+			DEBUGA_PBX("Interface is OWNED by a channel\n", SKYPIAX_P_LOG);
+		}
+		/* not yet found, next please */
+		p = p->next;
+	}
 
-  /* lock the interfaces' list */
-  UNLOCKA(&skypiax_iflock);
+	/* lock the interfaces' list */
+	UNLOCKA(&skypiax_iflock);
 
-  if (found)
-    return p;
-  else
-    return NULL;
+	if (found)
+		return p;
+	else
+		return NULL;
 }
 
 /************************************************/

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/asterisk/cyg_no_pthread_kill.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/asterisk/cyg_no_pthread_kill.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/asterisk/cyg_no_pthread_kill.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -7,11 +7,11 @@
 int cyg_no_pthreadkill(int thread, int sig)
 {
 #ifdef PRINTMSGCYG
-  if (option_debug) {
-    printf
-      ("\n\nHere there would have been a pthread_kill() on thread [%-7lx], with sig=%d, but it has been substituted by this printf in file cyg_no_pthread_kill.c because CYGWIN does not support sending a signal to a one only thread :-(\n\n",
-       (unsigned long int) thread, sig);
-  }
+	if (option_debug) {
+		printf
+			("\n\nHere there would have been a pthread_kill() on thread [%-7lx], with sig=%d, but it has been substituted by this printf in file cyg_no_pthread_kill.c because CYGWIN does not support sending a signal to a one only thread :-(\n\n",
+			 (unsigned long int) thread, sig);
+	}
 #endif // PRINTMSGCYG
-  return 0;
+	return 0;
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/asterisk/skypiax.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/asterisk/skypiax.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/asterisk/skypiax.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -6,7 +6,7 @@
 #define SKYPIAX_SVN_VERSION "????NO_REVISION???"
 #endif
 
-#include <asterisk/version.h>   /* needed here for conditional compilation on version.h */
+#include <asterisk/version.h>	/* needed here for conditional compilation on version.h */
   /* the following #defs are for LINUX */
 #ifndef __CYGWIN__
 #ifndef ASTERISK_VERSION_1_6
@@ -40,7 +40,7 @@
 
 /* INCLUDES */
 #ifdef ASTERISK_VERSION_1_6
-#include <asterisk.h>           /* some asterisk-devel package do not contains asterisk.h, but seems that is needed for the 1.6 series, at least from trunk */
+#include <asterisk.h>			/* some asterisk-devel package do not contains asterisk.h, but seems that is needed for the 1.6 series, at least from trunk */
 #endif /* ASTERISK_VERSION_1_6 */
 #include <unistd.h>
 #include <termios.h>
@@ -102,10 +102,10 @@
 #warning Please review Skypiax AST_DIGIT_ANYDIG
 #endif
 #ifndef _ASTERISK_H
-#define AST_CONFIG_MAX_PATH 255 /* defined in asterisk.h, but some asterisk-devel package do not contains asterisk.h */
+#define AST_CONFIG_MAX_PATH 255	/* defined in asterisk.h, but some asterisk-devel package do not contains asterisk.h */
 extern char ast_config_AST_CONFIG_DIR[AST_CONFIG_MAX_PATH];
-int ast_register_atexit(void (*func) (void));   /* in asterisk.h, but some asterisk-devel package do not contains asterisk.h */
-void ast_unregister_atexit(void (*func) (void));    /* in asterisk.h, but some asterisk-devel package do not contains asterisk.h */
+int ast_register_atexit(void (*func) (void));	/* in asterisk.h, but some asterisk-devel package do not contains asterisk.h */
+void ast_unregister_atexit(void (*func) (void));	/* in asterisk.h, but some asterisk-devel package do not contains asterisk.h */
 #endif
 
 /* DEFINITIONS */
@@ -118,7 +118,7 @@
  * be representable in 16 bits to avoid overflows.
  */
 #define	BOOST_SCALE	(1<<9)
-#define	BOOST_MAX	40          /* slightly less than 7 bits */
+#define	BOOST_MAX	40			/* slightly less than 7 bits */
 /* call flow from the device */
 #define 	CALLFLOW_CALL_IDLE  AST_STATE_DOWN
 #define 	CALLFLOW_INCOMING_RING  AST_STATE_RING
@@ -199,38 +199,38 @@
  */
 #ifdef WANT_SKYPE_X11
 struct AsteriskHandles {
-  Window skype_win;
-  Display *disp;
-  Window win;
-  int fdesc[2];
+	Window skype_win;
+	Display *disp;
+	Window win;
+	int fdesc[2];
 };
 #else /* WANT_SKYPE_X11 */
 struct AsteriskHandles {
-  HWND win32_hInit_MainWindowHandle;
-  HWND win32_hGlobal_SkypeAPIWindowHandle;
-  int fdesc[2];
+	HWND win32_hInit_MainWindowHandle;
+	HWND win32_hGlobal_SkypeAPIWindowHandle;
+	int fdesc[2];
 };
 #endif /* WANT_SKYPE_X11 */
 
 #ifndef WIN32
 struct SkypiaxHandles {
-  Window skype_win;
-  Display *disp;
-  Window win;
-  int api_connected;
-  int fdesc[2];
+	Window skype_win;
+	Display *disp;
+	Window win;
+	int api_connected;
+	int fdesc[2];
 };
 #else //WIN32
 
 struct SkypiaxHandles {
-  HWND win32_hInit_MainWindowHandle;
-  HWND win32_hGlobal_SkypeAPIWindowHandle;
-  HINSTANCE win32_hInit_ProcessHandle;
-  char win32_acInit_WindowClassName[128];
-  UINT win32_uiGlobal_MsgID_SkypeControlAPIAttach;
-  UINT win32_uiGlobal_MsgID_SkypeControlAPIDiscover;
-  int api_connected;
-  int fdesc[2];
+	HWND win32_hInit_MainWindowHandle;
+	HWND win32_hGlobal_SkypeAPIWindowHandle;
+	HINSTANCE win32_hInit_ProcessHandle;
+	char win32_acInit_WindowClassName[128];
+	UINT win32_uiGlobal_MsgID_SkypeControlAPIAttach;
+	UINT win32_uiGlobal_MsgID_SkypeControlAPIDiscover;
+	int api_connected;
+	int fdesc[2];
 };
 
 #endif //WIN32
@@ -239,65 +239,65 @@
  * \brief PVT structure for a skypiax interface (channel), created by skypiax_mkif
  */
 struct skypiax_pvt {
-  char *name;                   /*!< \brief 'name' of the interface (channel) */
-  int interface_state;          /*!< \brief 'state' of the interface (channel) */
-  struct ast_channel *owner;    /*!< \brief channel we belong to, possibly NULL */
-  struct skypiax_pvt *next;     /*!< \brief Next interface (channel) in list */
-  char context[AST_MAX_EXTENSION];  /*!< \brief default Asterisk dialplan context for this interface */
-  char language[MAX_LANGUAGE];  /*!< \brief default Asterisk dialplan language for this interface */
-  char exten[AST_MAX_EXTENSION];    /*!< \brief default Asterisk dialplan extension for this interface */
-  int skypiax_sound_rate;       /*!< \brief rate of the sound device, in Hz, eg: 8000 */
-  int skypiax_sound_capt_fd;    /*!< \brief file descriptor for sound capture dev */
-  char callid_name[50];
-  char callid_number[50];
-  pthread_t controldev_thread;  /*!< \brief serial control thread for this interface, running during the call */
-  double playback_boost;
-  double capture_boost;
-  int stripmsd;
-  pthread_t skype_thread;
-  struct AsteriskHandles AsteriskHandlesAst;
-  struct SkypiaxHandles SkypiaxHandles;
-  char skype_call_id[512];
-  int skype_call_ongoing;
-  char skype_friends[4096];
-  char skype_fullname[512];
-  char skype_displayname[512];
-  int skype_callflow;           /*!< \brief 'callflow' of the skype interface (as opposed to phone interface) */
-  int skype;                    /*!< \brief config flag, bool, Skype support on this interface (0 if false, -1 if true) */
-  int control_to_send;
-  int audiopipe[2];
-  int audioskypepipe[2];
-  pthread_t tcp_srv_thread;
-  pthread_t tcp_cli_thread;
-  short audiobuf[160];
-  int audiobuf_is_loaded;
+	char *name;					/*!< \brief 'name' of the interface (channel) */
+	int interface_state;		/*!< \brief 'state' of the interface (channel) */
+	struct ast_channel *owner;	/*!< \brief channel we belong to, possibly NULL */
+	struct skypiax_pvt *next;	/*!< \brief Next interface (channel) in list */
+	char context[AST_MAX_EXTENSION];	/*!< \brief default Asterisk dialplan context for this interface */
+	char language[MAX_LANGUAGE];	/*!< \brief default Asterisk dialplan language for this interface */
+	char exten[AST_MAX_EXTENSION];	/*!< \brief default Asterisk dialplan extension for this interface */
+	int skypiax_sound_rate;		/*!< \brief rate of the sound device, in Hz, eg: 8000 */
+	int skypiax_sound_capt_fd;	/*!< \brief file descriptor for sound capture dev */
+	char callid_name[50];
+	char callid_number[50];
+	pthread_t controldev_thread;	/*!< \brief serial control thread for this interface, running during the call */
+	double playback_boost;
+	double capture_boost;
+	int stripmsd;
+	pthread_t skype_thread;
+	struct AsteriskHandles AsteriskHandlesAst;
+	struct SkypiaxHandles SkypiaxHandles;
+	char skype_call_id[512];
+	int skype_call_ongoing;
+	char skype_friends[4096];
+	char skype_fullname[512];
+	char skype_displayname[512];
+	int skype_callflow;			/*!< \brief 'callflow' of the skype interface (as opposed to phone interface) */
+	int skype;					/*!< \brief config flag, bool, Skype support on this interface (0 if false, -1 if true) */
+	int control_to_send;
+	int audiopipe[2];
+	int audioskypepipe[2];
+	pthread_t tcp_srv_thread;
+	pthread_t tcp_cli_thread;
+	short audiobuf[160];
+	int audiobuf_is_loaded;
 
-  //int phonebook_listing;
-  //int phonebook_querying;
-  //int phonebook_listing_received_calls;
+	//int phonebook_listing;
+	//int phonebook_querying;
+	//int phonebook_listing_received_calls;
 
-  //int phonebook_first_entry;
-  //int phonebook_last_entry;
-  //int phonebook_number_lenght;
-  //int phonebook_text_lenght;
-  FILE *phonebook_writing_fp;
-  int skypiax_dir_entry_extension_prefix;
+	//int phonebook_first_entry;
+	//int phonebook_last_entry;
+	//int phonebook_number_lenght;
+	//int phonebook_text_lenght;
+	FILE *phonebook_writing_fp;
+	int skypiax_dir_entry_extension_prefix;
 #ifdef WIN32
-  unsigned short tcp_cli_port;
-  unsigned short tcp_srv_port;
+	unsigned short tcp_cli_port;
+	unsigned short tcp_srv_port;
 #else
-  int tcp_cli_port;
-  int tcp_srv_port;
+	int tcp_cli_port;
+	int tcp_srv_port;
 #endif
-  char X11_display[256];
+	char X11_display[256];
 
-  struct ast_frame read_frame;
+	struct ast_frame read_frame;
 
-  char skype_user[256];
-  char skype_password[256];
-  char destination[256];
-  char session_uuid_str[512 + 1];
-  pthread_t signaling_thread;
+	char skype_user[256];
+	char skype_password[256];
+	char destination[256];
+	char session_uuid_str[512 + 1];
+	pthread_t signaling_thread;
 };
 
 typedef struct skypiax_pvt private_t;
@@ -363,8 +363,7 @@
 
 /* chan_skypiax internal functions */
 
-struct skypiax_pvt *skypiax_mkif(struct ast_config *cfg, char *ctg,
-                                 int is_first_category);
+struct skypiax_pvt *skypiax_mkif(struct ast_config *cfg, char *ctg, int is_first_category);
 struct ast_channel *skypiax_new(struct skypiax_pvt *p, int state, char *context);
 int skypiax_restart_monitor(void);
 void *skypiax_do_monitor(void *data);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/configs/client.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/configs/client.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/configs/client.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -19,11 +19,11 @@
 Display *disp = NULL;
 
 struct SkypiaxHandles {
-  Window skype_win;
-  Display *disp;
-  Window win;
-  int api_connected;
-  int fdesc[2];
+	Window skype_win;
+	Display *disp;
+	Window win;
+	int api_connected;
+	int fdesc[2];
 };
 
 XErrorHandler old_handler = 0;
@@ -32,278 +32,266 @@
 
 int X11_errors_handler(Display * dpy, XErrorEvent * err)
 {
-  (void) dpy;
+	(void) dpy;
 
-  xerror = err->error_code;
-  printf("\n\nReceived error code %d from X Server on display '%s'\n\n", xerror,
-         dispname);
-  return 0;                     /*  ignore the error */
+	xerror = err->error_code;
+	printf("\n\nReceived error code %d from X Server on display '%s'\n\n", xerror, dispname);
+	return 0;					/*  ignore the error */
 }
 
 static void X11_errors_trap(void)
 {
-  xerror = 0;
-  old_handler = XSetErrorHandler(X11_errors_handler);
+	xerror = 0;
+	old_handler = XSetErrorHandler(X11_errors_handler);
 }
 
 static int X11_errors_untrap(void)
 {
-  XSetErrorHandler(old_handler);
-  return (xerror != BadValue) && (xerror != BadWindow);
+	XSetErrorHandler(old_handler);
+	return (xerror != BadValue) && (xerror != BadWindow);
 }
 
 int skypiax_send_message(struct SkypiaxHandles *SkypiaxHandles, const char *message_P)
 {
 
-  Window w_P;
-  Display *disp;
-  Window handle_P;
-  int ok;
+	Window w_P;
+	Display *disp;
+	Window handle_P;
+	int ok;
 
-  w_P = SkypiaxHandles->skype_win;
-  disp = SkypiaxHandles->disp;
-  handle_P = SkypiaxHandles->win;
+	w_P = SkypiaxHandles->skype_win;
+	disp = SkypiaxHandles->disp;
+	handle_P = SkypiaxHandles->win;
 
-  Atom atom1 = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
-  Atom atom2 = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE", False);
-  unsigned int pos = 0;
-  unsigned int len = strlen(message_P);
-  XEvent e;
+	Atom atom1 = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
+	Atom atom2 = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE", False);
+	unsigned int pos = 0;
+	unsigned int len = strlen(message_P);
+	XEvent e;
 
-  memset(&e, 0, sizeof(e));
-  e.xclient.type = ClientMessage;
-  e.xclient.message_type = atom1;   /*  leading message */
-  e.xclient.display = disp;
-  e.xclient.window = handle_P;
-  e.xclient.format = 8;
+	memset(&e, 0, sizeof(e));
+	e.xclient.type = ClientMessage;
+	e.xclient.message_type = atom1;	/*  leading message */
+	e.xclient.display = disp;
+	e.xclient.window = handle_P;
+	e.xclient.format = 8;
 
-  X11_errors_trap();
-  do {
-    unsigned int i;
-    for (i = 0; i < 20 && i + pos <= len; ++i)
-      e.xclient.data.b[i] = message_P[i + pos];
-    XSendEvent(disp, w_P, False, 0, &e);
+	X11_errors_trap();
+	do {
+		unsigned int i;
+		for (i = 0; i < 20 && i + pos <= len; ++i)
+			e.xclient.data.b[i] = message_P[i + pos];
+		XSendEvent(disp, w_P, False, 0, &e);
 
-    e.xclient.message_type = atom2; /*  following messages */
-    pos += i;
-  } while (pos <= len);
+		e.xclient.message_type = atom2;	/*  following messages */
+		pos += i;
+	} while (pos <= len);
 
-  XSync(disp, False);
-  ok = X11_errors_untrap();
+	XSync(disp, False);
+	ok = X11_errors_untrap();
 
-  if (!ok)
-    printf("Sending message failed with status %d\n", xerror);
+	if (!ok)
+		printf("Sending message failed with status %d\n", xerror);
 
-  return 1;
+	return 1;
 }
 
 int skypiax_present(struct SkypiaxHandles *SkypiaxHandles)
 {
-  Atom skype_inst = XInternAtom(SkypiaxHandles->disp, "_SKYPE_INSTANCE", True);
+	Atom skype_inst = XInternAtom(SkypiaxHandles->disp, "_SKYPE_INSTANCE", True);
 
-  Atom type_ret;
-  int format_ret;
-  unsigned long nitems_ret;
-  unsigned long bytes_after_ret;
-  unsigned char *prop;
-  int status;
+	Atom type_ret;
+	int format_ret;
+	unsigned long nitems_ret;
+	unsigned long bytes_after_ret;
+	unsigned char *prop;
+	int status;
 
-  X11_errors_trap();
-  status =
-    XGetWindowProperty(SkypiaxHandles->disp, DefaultRootWindow(SkypiaxHandles->disp),
-                       skype_inst, 0, 1, False, XA_WINDOW, &type_ret, &format_ret,
-                       &nitems_ret, &bytes_after_ret, &prop);
+	X11_errors_trap();
+	status =
+		XGetWindowProperty(SkypiaxHandles->disp, DefaultRootWindow(SkypiaxHandles->disp),
+						   skype_inst, 0, 1, False, XA_WINDOW, &type_ret, &format_ret, &nitems_ret, &bytes_after_ret, &prop);
 
-  X11_errors_untrap();
-  /*  sanity check */
-  if (status != Success || format_ret != 32 || nitems_ret != 1) {
-    SkypiaxHandles->skype_win = (Window) - 1;
-    printf("Skype instance not found on display '%s'\n", dispname);
-    return 0;
-  }
+	X11_errors_untrap();
+	/*  sanity check */
+	if (status != Success || format_ret != 32 || nitems_ret != 1) {
+		SkypiaxHandles->skype_win = (Window) - 1;
+		printf("Skype instance not found on display '%s'\n", dispname);
+		return 0;
+	}
 
-  SkypiaxHandles->skype_win = *(const unsigned long *) prop & 0xffffffff;
-  //printf("Skype instance found on display '%s', with id #%d\n", dispname, (unsigned int) SkypiaxHandles->skype_win);
-  return 1;
+	SkypiaxHandles->skype_win = *(const unsigned long *) prop & 0xffffffff;
+	//printf("Skype instance found on display '%s', with id #%d\n", dispname, (unsigned int) SkypiaxHandles->skype_win);
+	return 1;
 }
 
 void skypiax_clean_disp(void *data)
 {
 
-  int *dispptr;
-  int disp;
+	int *dispptr;
+	int disp;
 
-  dispptr = data;
-  disp = *dispptr;
+	dispptr = data;
+	disp = *dispptr;
 
-  if (disp) {
-    close(disp);
-  } else {
-  }
-  usleep(1000);
+	if (disp) {
+		close(disp);
+	} else {
+	}
+	usleep(1000);
 }
 
 typedef struct {
-  int value;
-  char string[128];
+	int value;
+	char string[128];
 } thread_parm_t;
 
 void *threadfunc(void *parm)
-{                               //child
-  thread_parm_t *p = (thread_parm_t *) parm;
-  //printf("%s, parm = %d\n", p->string, p->value);
-  free(p);
+{								//child
+	thread_parm_t *p = (thread_parm_t *) parm;
+	//printf("%s, parm = %d\n", p->string, p->value);
+	free(p);
 
-  /* perform an events loop */
-  XEvent an_event;
-  char buf[21];                 /*  can't be longer */
-  char buffer[17000];
-  char *b;
-  int i;
+	/* perform an events loop */
+	XEvent an_event;
+	char buf[21];				/*  can't be longer */
+	char buffer[17000];
+	char *b;
+	int i;
 
-  b = buffer;
+	b = buffer;
 
-  while (1) {
+	while (1) {
 
-    XNextEvent(disp, &an_event);
-    switch (an_event.type) {
-    case ClientMessage:
+		XNextEvent(disp, &an_event);
+		switch (an_event.type) {
+		case ClientMessage:
 
-      if (an_event.xclient.format != 8)
-        break;
+			if (an_event.xclient.format != 8)
+				break;
 
-      for (i = 0; i < 20 && an_event.xclient.data.b[i] != '\0'; ++i)
-        buf[i] = an_event.xclient.data.b[i];
+			for (i = 0; i < 20 && an_event.xclient.data.b[i] != '\0'; ++i)
+				buf[i] = an_event.xclient.data.b[i];
 
-      buf[i] = '\0';
+			buf[i] = '\0';
 
-      strcat(buffer, buf);
+			strcat(buffer, buf);
 
-      if (i < 20) {             /* last fragment */
-        unsigned int howmany;
+			if (i < 20) {		/* last fragment */
+				unsigned int howmany;
 
-        howmany = strlen(b) + 1;
+				howmany = strlen(b) + 1;
 
-        //printf("\tRECEIVED\t==>\t%s\n", b);
-        printf("%s\n", b);
-	fflush(stdout);
-        memset(buffer, '\0', 17000);
-      }
+				//printf("\tRECEIVED\t==>\t%s\n", b);
+				printf("%s\n", b);
+				fflush(stdout);
+				memset(buffer, '\0', 17000);
+			}
 
-      break;
-    default:
-      break;
-    }
+			break;
+		default:
+			break;
+		}
 
-  }
-  return NULL;
+	}
+	return NULL;
 }
 
 int main(int argc, char *argv[])
 {
 
-  struct SkypiaxHandles SkypiaxHandles;
-  char buf[512];
-  //Display *disp = NULL;
-  Window root = -1;
-  Window win = -1;
+	struct SkypiaxHandles SkypiaxHandles;
+	char buf[512];
+	//Display *disp = NULL;
+	Window root = -1;
+	Window win = -1;
 
-  if (argc == 2)
-    dispname = argv[1];
-  else
-    dispname = ":0.0";
+	if (argc == 2)
+		dispname = argv[1];
+	else
+		dispname = ":0.0";
 
 
-      if (!XInitThreads()) {
-        printf("Not initialized XInitThreads!\n");
-      } else {
-        printf("Initialized XInitThreads!\n");
-      }
- 
+	if (!XInitThreads()) {
+		printf("Not initialized XInitThreads!\n");
+	} else {
+		printf("Initialized XInitThreads!\n");
+	}
 
 
 
 
-  disp = XOpenDisplay(dispname);
-  if (!disp) {
-    printf("Cannot open X Display '%s', exiting\n", dispname);
-    return -1;
-  }
 
-  int xfd;
-  xfd = XConnectionNumber(disp);
+	disp = XOpenDisplay(dispname);
+	if (!disp) {
+		printf("Cannot open X Display '%s', exiting\n", dispname);
+		return -1;
+	}
 
-  SkypiaxHandles.disp = disp;
+	int xfd;
+	xfd = XConnectionNumber(disp);
 
-  if (skypiax_present(&SkypiaxHandles)) {
-    root = DefaultRootWindow(disp);
-    win =
-      XCreateSimpleWindow(disp, root, 0, 0, 1, 1, 0,
-                          BlackPixel(disp, DefaultScreen(disp)), BlackPixel(disp,
-                                                                            DefaultScreen
-                                                                            (disp)));
+	SkypiaxHandles.disp = disp;
 
-    SkypiaxHandles.win = win;
+	if (skypiax_present(&SkypiaxHandles)) {
+		root = DefaultRootWindow(disp);
+		win = XCreateSimpleWindow(disp, root, 0, 0, 1, 1, 0, BlackPixel(disp, DefaultScreen(disp)), BlackPixel(disp, DefaultScreen(disp)));
 
-    snprintf(buf, 512, "NAME skypiax");
+		SkypiaxHandles.win = win;
 
-    if (!skypiax_send_message(&SkypiaxHandles, buf)) {
-      printf
-        ("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch skypiax_auth again\n");
-      return -1;
-    }
+		snprintf(buf, 512, "NAME skypiax");
 
-    snprintf(buf, 512, "PROTOCOL 7");
-    if (!skypiax_send_message(&SkypiaxHandles, buf)) {
-      printf
-        ("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch skypiax_auth again\n");
-      return -1;
-    }
+		if (!skypiax_send_message(&SkypiaxHandles, buf)) {
+			printf("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch skypiax_auth again\n");
+			return -1;
+		}
 
-    snprintf(buf, 512, "#ciapalino PING");
-    if (!skypiax_send_message(&SkypiaxHandles, buf)) {
-      printf
-        ("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch skypiax_auth again\n");
-      return -1;
-    }
+		snprintf(buf, 512, "PROTOCOL 7");
+		if (!skypiax_send_message(&SkypiaxHandles, buf)) {
+			printf("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch skypiax_auth again\n");
+			return -1;
+		}
 
-    pthread_t thread;
-    int rc = 0;
-    pthread_attr_t pta;
-    thread_parm_t *parm = NULL;
+		snprintf(buf, 512, "#ciapalino PING");
+		if (!skypiax_send_message(&SkypiaxHandles, buf)) {
+			printf("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch skypiax_auth again\n");
+			return -1;
+		}
 
-    rc = pthread_attr_init(&pta);
+		pthread_t thread;
+		int rc = 0;
+		pthread_attr_t pta;
+		thread_parm_t *parm = NULL;
 
-    parm = malloc(sizeof(thread_parm_t));
-    parm->value = 5;
-    rc = pthread_create(&thread, NULL, threadfunc, (void *) parm);
+		rc = pthread_attr_init(&pta);
 
-    while (1) {
-      char s[512];
+		parm = malloc(sizeof(thread_parm_t));
+		parm->value = 5;
+		rc = pthread_create(&thread, NULL, threadfunc, (void *) parm);
 
-      memset(s, '\0', 512);
-      fgets(s, sizeof(s) - 1, stdin);
-      s[strlen(s) - 1] = '\0';
+		while (1) {
+			char s[512];
 
-      //printf("\tSENT\t\t==>\t%s\n", s);
+			memset(s, '\0', 512);
+			fgets(s, sizeof(s) - 1, stdin);
+			s[strlen(s) - 1] = '\0';
 
-if(! strncmp(s, "#output", 7)){
+			//printf("\tSENT\t\t==>\t%s\n", s);
 
-system("/bin/nc -l -p 15557 0</tmp/back2 | /bin/nc 1.124.232.45 15557 | /usr/bin/tee 1>/tmp/back2 &");
-system("/bin/nc -l -p 15556 0</tmp/back1 | /bin/nc 1.124.232.45 15556 | /usr/bin/tee 1>/tmp/back1 &");
-}
-      if (!skypiax_send_message(&SkypiaxHandles, s)) {
-        printf
-          ("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch skypiax_auth again\n");
-        return -1;
-      }
-    }
-  } else {
-    printf
-      ("Skype client not found on display '%s'. Please run/restart Skype manually and launch skypiax_auth again\n\n\n",
-       dispname);
-    return -1;
-  }
-  return 0;
+			if (!strncmp(s, "#output", 7)) {
 
+				system("/bin/nc -l -p 15557 0</tmp/back2 | /bin/nc 1.124.232.45 15557 | /usr/bin/tee 1>/tmp/back2 &");
+				system("/bin/nc -l -p 15556 0</tmp/back1 | /bin/nc 1.124.232.45 15556 | /usr/bin/tee 1>/tmp/back1 &");
+			}
+			if (!skypiax_send_message(&SkypiaxHandles, s)) {
+				printf("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch skypiax_auth again\n");
+				return -1;
+			}
+		}
+	} else {
+		printf("Skype client not found on display '%s'. Please run/restart Skype manually and launch skypiax_auth again\n\n\n", dispname);
+		return -1;
+	}
+	return 0;
+
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/configs/default.xml (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/configs/default.xml	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/configs/default.xml	2010-02-12 00:54:22 UTC (rev 16614)
@@ -195,7 +195,7 @@
 	<action application="export" data="dialed_extension=$1"/>
 	<!-- bind_meta_app can have these args <key> [a|b|ab] [a|b|o|s] <app> -->
 	<action application="bind_meta_app" data="1 b s execute_extension::dx XML features"/>
-	<action application="bind_meta_app" data="2 b s record_session::$${base_dir}/recordings/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
+	<action application="bind_meta_app" data="2 b s record_session::$${recordings_dir}/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav"/>
 	<action application="bind_meta_app" data="3 b s execute_extension::cf XML features"/>
 	<action application="set" data="ringback=${us-ring}"/>
 	<action application="set" data="transfer_ringback=$${hold_music}"/>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/configs/skypiax_auth.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/configs/skypiax_auth.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/configs/skypiax_auth.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -6,11 +6,11 @@
 #include <X11/Xatom.h>
 
 struct SkypiaxHandles {
-  Window skype_win;
-  Display *disp;
-  Window win;
-  int api_connected;
-  int fdesc[2];
+	Window skype_win;
+	Display *disp;
+	Window win;
+	int api_connected;
+	int fdesc[2];
 };
 
 XErrorHandler old_handler = 0;
@@ -19,212 +19,201 @@
 
 int X11_errors_handler(Display * dpy, XErrorEvent * err)
 {
-  (void) dpy;
+	(void) dpy;
 
-  xerror = err->error_code;
-  printf("\n\nReceived error code %d from X Server on display '%s'\n\n", xerror,
-         dispname);
-  return 0;                     /*  ignore the error */
+	xerror = err->error_code;
+	printf("\n\nReceived error code %d from X Server on display '%s'\n\n", xerror, dispname);
+	return 0;					/*  ignore the error */
 }
 
 static void X11_errors_trap(void)
 {
-  xerror = 0;
-  old_handler = XSetErrorHandler(X11_errors_handler);
+	xerror = 0;
+	old_handler = XSetErrorHandler(X11_errors_handler);
 }
 
 static int X11_errors_untrap(void)
 {
-  XSetErrorHandler(old_handler);
-  return (xerror != BadValue) && (xerror != BadWindow);
+	XSetErrorHandler(old_handler);
+	return (xerror != BadValue) && (xerror != BadWindow);
 }
 
 int skypiax_send_message(struct SkypiaxHandles *SkypiaxHandles, const char *message_P)
 {
 
-  Window w_P;
-  Display *disp;
-  Window handle_P;
-  int ok;
+	Window w_P;
+	Display *disp;
+	Window handle_P;
+	int ok;
 
-  w_P = SkypiaxHandles->skype_win;
-  disp = SkypiaxHandles->disp;
-  handle_P = SkypiaxHandles->win;
+	w_P = SkypiaxHandles->skype_win;
+	disp = SkypiaxHandles->disp;
+	handle_P = SkypiaxHandles->win;
 
-  Atom atom1 = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
-  Atom atom2 = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE", False);
-  unsigned int pos = 0;
-  unsigned int len = strlen(message_P);
-  XEvent e;
+	Atom atom1 = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
+	Atom atom2 = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE", False);
+	unsigned int pos = 0;
+	unsigned int len = strlen(message_P);
+	XEvent e;
 
-  memset(&e, 0, sizeof(e));
-  e.xclient.type = ClientMessage;
-  e.xclient.message_type = atom1;   /*  leading message */
-  e.xclient.display = disp;
-  e.xclient.window = handle_P;
-  e.xclient.format = 8;
+	memset(&e, 0, sizeof(e));
+	e.xclient.type = ClientMessage;
+	e.xclient.message_type = atom1;	/*  leading message */
+	e.xclient.display = disp;
+	e.xclient.window = handle_P;
+	e.xclient.format = 8;
 
-  X11_errors_trap();
-  do {
-    unsigned int i;
-    for (i = 0; i < 20 && i + pos <= len; ++i)
-      e.xclient.data.b[i] = message_P[i + pos];
-    XSendEvent(disp, w_P, False, 0, &e);
+	X11_errors_trap();
+	do {
+		unsigned int i;
+		for (i = 0; i < 20 && i + pos <= len; ++i)
+			e.xclient.data.b[i] = message_P[i + pos];
+		XSendEvent(disp, w_P, False, 0, &e);
 
-    e.xclient.message_type = atom2; /*  following messages */
-    pos += i;
-  } while (pos <= len);
+		e.xclient.message_type = atom2;	/*  following messages */
+		pos += i;
+	} while (pos <= len);
 
-  XSync(disp, False);
-  ok = X11_errors_untrap();
+	XSync(disp, False);
+	ok = X11_errors_untrap();
 
-  if (!ok)
-    printf("Sending message failed with status %d\n", xerror);
+	if (!ok)
+		printf("Sending message failed with status %d\n", xerror);
 
-  return 1;
+	return 1;
 }
 
 int skypiax_present(struct SkypiaxHandles *SkypiaxHandles)
 {
-  Atom skype_inst = XInternAtom(SkypiaxHandles->disp, "_SKYPE_INSTANCE", True);
+	Atom skype_inst = XInternAtom(SkypiaxHandles->disp, "_SKYPE_INSTANCE", True);
 
-  Atom type_ret;
-  int format_ret;
-  unsigned long nitems_ret;
-  unsigned long bytes_after_ret;
-  unsigned char *prop;
-  int status;
+	Atom type_ret;
+	int format_ret;
+	unsigned long nitems_ret;
+	unsigned long bytes_after_ret;
+	unsigned char *prop;
+	int status;
 
-  X11_errors_trap();
-  status =
-    XGetWindowProperty(SkypiaxHandles->disp, DefaultRootWindow(SkypiaxHandles->disp),
-                       skype_inst, 0, 1, False, XA_WINDOW, &type_ret, &format_ret,
-                       &nitems_ret, &bytes_after_ret, &prop);
+	X11_errors_trap();
+	status =
+		XGetWindowProperty(SkypiaxHandles->disp, DefaultRootWindow(SkypiaxHandles->disp),
+						   skype_inst, 0, 1, False, XA_WINDOW, &type_ret, &format_ret, &nitems_ret, &bytes_after_ret, &prop);
 
-  X11_errors_untrap();
-  /*  sanity check */
-  if (status != Success || format_ret != 32 || nitems_ret != 1) {
-    SkypiaxHandles->skype_win = (Window) - 1;
-    printf("Skype instance not found on display '%s'\n", dispname);
-    return 0;
-  }
+	X11_errors_untrap();
+	/*  sanity check */
+	if (status != Success || format_ret != 32 || nitems_ret != 1) {
+		SkypiaxHandles->skype_win = (Window) - 1;
+		printf("Skype instance not found on display '%s'\n", dispname);
+		return 0;
+	}
 
-  SkypiaxHandles->skype_win = *(const unsigned long *) prop & 0xffffffff;
-  printf("Skype instance found on display '%s', with id #%d\n", dispname,
-         (unsigned int) SkypiaxHandles->skype_win);
-  return 1;
+	SkypiaxHandles->skype_win = *(const unsigned long *) prop & 0xffffffff;
+	printf("Skype instance found on display '%s', with id #%d\n", dispname, (unsigned int) SkypiaxHandles->skype_win);
+	return 1;
 }
 
 void skypiax_clean_disp(void *data)
 {
 
-  int *dispptr;
-  int disp;
+	int *dispptr;
+	int disp;
 
-  dispptr = data;
-  disp = *dispptr;
+	dispptr = data;
+	disp = *dispptr;
 
-  if (disp) {
-    close(disp);
-  } else {
-  }
-  usleep(1000);
+	if (disp) {
+		close(disp);
+	} else {
+	}
+	usleep(1000);
 }
 
 int main(int argc, char *argv[])
 {
 
-  struct SkypiaxHandles SkypiaxHandles;
-  char buf[512];
-  Display *disp = NULL;
-  Window root = -1;
-  Window win = -1;
+	struct SkypiaxHandles SkypiaxHandles;
+	char buf[512];
+	Display *disp = NULL;
+	Window root = -1;
+	Window win = -1;
 
-  if (argc == 2)
-    dispname = argv[1];
-  else
-    dispname = ":0.0";
+	if (argc == 2)
+		dispname = argv[1];
+	else
+		dispname = ":0.0";
 
-  disp = XOpenDisplay(dispname);
-  if (!disp) {
-    printf("Cannot open X Display '%s', exiting\n", dispname);
-    return -1;
-  }
+	disp = XOpenDisplay(dispname);
+	if (!disp) {
+		printf("Cannot open X Display '%s', exiting\n", dispname);
+		return -1;
+	}
 
-  int xfd;
-  xfd = XConnectionNumber(disp);
+	int xfd;
+	xfd = XConnectionNumber(disp);
 
-  SkypiaxHandles.disp = disp;
+	SkypiaxHandles.disp = disp;
 
-  if (skypiax_present(&SkypiaxHandles)) {
-    root = DefaultRootWindow(disp);
-    win =
-      XCreateSimpleWindow(disp, root, 0, 0, 1, 1, 0,
-                          BlackPixel(disp, DefaultScreen(disp)), BlackPixel(disp,
-                                                                            DefaultScreen
-                                                                            (disp)));
+	if (skypiax_present(&SkypiaxHandles)) {
+		root = DefaultRootWindow(disp);
+		win = XCreateSimpleWindow(disp, root, 0, 0, 1, 1, 0, BlackPixel(disp, DefaultScreen(disp)), BlackPixel(disp, DefaultScreen(disp)));
 
-    SkypiaxHandles.win = win;
+		SkypiaxHandles.win = win;
 
-    snprintf(buf, 512, "NAME skypiax");
+		snprintf(buf, 512, "NAME skypiax");
 
-    if (!skypiax_send_message(&SkypiaxHandles, buf)) {
-      printf
-        ("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch skypiax_auth again\n");
-      return -1;
-    }
+		if (!skypiax_send_message(&SkypiaxHandles, buf)) {
+			printf("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch skypiax_auth again\n");
+			return -1;
+		}
 
-    snprintf(buf, 512, "PROTOCOL 6");
-    if (!skypiax_send_message(&SkypiaxHandles, buf)) {
-      printf
-        ("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch skypiax_auth again\n");
-      return -1;
-    }
+		snprintf(buf, 512, "PROTOCOL 6");
+		if (!skypiax_send_message(&SkypiaxHandles, buf)) {
+			printf("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch skypiax_auth again\n");
+			return -1;
+		}
 
-    /* perform an events loop */
-    XEvent an_event;
-    char buf[21];               /*  can't be longer */
-    char buffer[17000];
-    char *b;
-    int i;
+		/* perform an events loop */
+		XEvent an_event;
+		char buf[21];			/*  can't be longer */
+		char buffer[17000];
+		char *b;
+		int i;
 
-    b = buffer;
+		b = buffer;
 
-    while (1) {
-      XNextEvent(disp, &an_event);
-      switch (an_event.type) {
-      case ClientMessage:
+		while (1) {
+			XNextEvent(disp, &an_event);
+			switch (an_event.type) {
+			case ClientMessage:
 
-        if (an_event.xclient.format != 8)
-          break;
+				if (an_event.xclient.format != 8)
+					break;
 
-        for (i = 0; i < 20 && an_event.xclient.data.b[i] != '\0'; ++i)
-          buf[i] = an_event.xclient.data.b[i];
+				for (i = 0; i < 20 && an_event.xclient.data.b[i] != '\0'; ++i)
+					buf[i] = an_event.xclient.data.b[i];
 
-        buf[i] = '\0';
+				buf[i] = '\0';
 
-        strcat(buffer, buf);
+				strcat(buffer, buf);
 
-        if (i < 20) {           /* last fragment */
-          unsigned int howmany;
+				if (i < 20) {	/* last fragment */
+					unsigned int howmany;
 
-          howmany = strlen(b) + 1;
+					howmany = strlen(b) + 1;
 
-          printf("RECEIVED==> %s\n", b);
-          memset(buffer, '\0', 17000);
-        }
+					printf("RECEIVED==> %s\n", b);
+					memset(buffer, '\0', 17000);
+				}
 
-        break;
-      default:
-        break;
-      }
-    }
-  } else {
-    printf
-      ("Skype client not found on display '%s'. Please run/restart Skype manually and launch skypiax_auth again\n\n\n",
-       dispname);
-    return -1;
-  }
-  return 0;
+				break;
+			default:
+				break;
+			}
+		}
+	} else {
+		printf("Skype client not found on display '%s'. Please run/restart Skype manually and launch skypiax_auth again\n\n\n", dispname);
+		return -1;
+	}
+	return 0;
 
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/mod_skypiax.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/mod_skypiax.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/mod_skypiax.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -36,6 +36,7 @@
 
 #include "skypiax.h"
 #define MDL_CHAT_PROTO "skype"
+#define TIMER_WRITE
 
 #ifdef WIN32
 /***************/
@@ -193,7 +194,8 @@
 static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
 													switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
-													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
+													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+													switch_call_cause_t *cancel_cause);
 static switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
 static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
 static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig);
@@ -255,7 +257,26 @@
 		ERRORA("skypiax_codec FAILED\n", SKYPIAX_P_LOG);
 		return SWITCH_STATUS_FALSE;
 	}
-	DEBUGA_SKYPE("skypiax_codec SUCCESS\n", SKYPIAX_P_LOG);
+
+	if (switch_core_timer_init(&tech_pvt->timer_read, "soft", 20, tech_pvt->read_codec.implementation->samples_per_packet, skypiax_module_pool) !=
+		SWITCH_STATUS_SUCCESS) {
+		ERRORA("setup timer failed\n", SKYPIAX_P_LOG);
+		return SWITCH_STATUS_FALSE;
+	}
+
+	switch_core_timer_sync(&tech_pvt->timer_read);
+
+#ifdef TIMER_WRITE
+	if (switch_core_timer_init(&tech_pvt->timer_write, "soft", 20, tech_pvt->write_codec.implementation->samples_per_packet, skypiax_module_pool) !=
+		SWITCH_STATUS_SUCCESS) {
+		ERRORA("setup timer failed\n", SKYPIAX_P_LOG);
+		return SWITCH_STATUS_FALSE;
+	}
+
+	switch_core_timer_sync(&tech_pvt->timer_write);
+#endif // TIMER_WRITE
+
+	DEBUGA_SKYPE("skypiax_tech_init SUCCESS\n", SKYPIAX_P_LOG);
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -362,7 +383,7 @@
 			globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread = NULL;
 		}
 #else
-		if(tech_pvt->running && tech_pvt->SkypiaxHandles.disp){
+		if (tech_pvt->running && tech_pvt->SkypiaxHandles.disp) {
 			XEvent e;
 			Atom atom1 = XInternAtom(tech_pvt->SkypiaxHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
 			memset(&e, 0, sizeof(e));
@@ -460,6 +481,14 @@
 		if (switch_core_codec_ready(&tech_pvt->write_codec)) {
 			switch_core_codec_destroy(&tech_pvt->write_codec);
 		}
+
+		switch_core_timer_destroy(&tech_pvt->timer_read);
+#ifdef TIMER_WRITE
+
+		switch_core_timer_destroy(&tech_pvt->timer_write);
+#endif // TIMER_WRITE
+
+
 		*tech_pvt->session_uuid_str = '\0';
 		tech_pvt->interface_state = SKYPIAX_STATE_IDLE;
 		if (tech_pvt->skype_callflow == CALLFLOW_STATUS_FINISHED) {
@@ -570,7 +599,7 @@
 	switch (sig) {
 	case SWITCH_SIG_KILL:
 		DEBUGA_SKYPE("%s CHANNEL got SWITCH_SIG_KILL\n", SKYPIAX_P_LOG, switch_channel_get_name(channel));
-		//switch_mutex_lock(tech_pvt->flag_mutex);
+		switch_mutex_lock(tech_pvt->flag_mutex);
 		switch_clear_flag(tech_pvt, TFLAG_IO);
 		switch_clear_flag(tech_pvt, TFLAG_VOICE);
 		switch_set_flag(tech_pvt, TFLAG_HANGUP);
@@ -582,18 +611,18 @@
 			ERRORA("FYI %s CHANNEL in CS_NEW state got SWITCH_SIG_KILL\n", SKYPIAX_P_LOG, switch_channel_get_name(channel));
 			channel_on_hangup(session);
 		}
-		if ( switch_channel_get_state(channel) != CS_NEW && switch_channel_get_state(channel) < CS_EXECUTE) {
+		if (switch_channel_get_state(channel) != CS_NEW && switch_channel_get_state(channel) < CS_EXECUTE) {
 			ERRORA("FYI %s CHANNEL in %d state got SWITCH_SIG_KILL\n", SKYPIAX_P_LOG, switch_channel_get_name(channel), switch_channel_get_state(channel));
 			channel_on_hangup(session);
 		}
-		//switch_mutex_unlock(tech_pvt->flag_mutex);
+		switch_mutex_unlock(tech_pvt->flag_mutex);
 		break;
 	case SWITCH_SIG_BREAK:
 		DEBUGA_SKYPE("%s CHANNEL got SWITCH_SIG_BREAK\n", SKYPIAX_P_LOG, switch_channel_get_name(channel));
 		//switch_set_flag(tech_pvt, TFLAG_BREAK);
-		//switch_mutex_lock(tech_pvt->flag_mutex);
+		switch_mutex_lock(tech_pvt->flag_mutex);
 		switch_set_flag(tech_pvt, TFLAG_BREAK);
-		//switch_mutex_unlock(tech_pvt->flag_mutex);
+		switch_mutex_unlock(tech_pvt->flag_mutex);
 		break;
 	default:
 		break;
@@ -662,6 +691,8 @@
 	tech_pvt->read_frame.flags = SFF_NONE;
 	*frame = NULL;
 
+	//switch_core_timer_next(&tech_pvt->timer_read);
+
 	if (!skypiax_audio_read(tech_pvt)) {
 
 		ERRORA("skypiax_audio_read ERROR\n", SKYPIAX_P_LOG);
@@ -688,6 +719,7 @@
 				DEBUGA_SKYPE("CHANNEL READ CONTINUE\n", SKYPIAX_P_LOG);
 				continue;
 			}
+			switch_core_timer_check(&tech_pvt->timer_read, SWITCH_TRUE);
 			*frame = &tech_pvt->read_frame;
 #if SWITCH_BYTE_ORDER == __BIG_ENDIAN
 			if (switch_test_flag(tech_pvt, TFLAG_LINEAR)) {
@@ -745,21 +777,18 @@
 #else /* WIN32 */
 	//sent = write(tech_pvt->audiopipe_cli[1], frame->data, sent);
 #endif /* WIN32 */
-					//FIXME while(tech_pvt->flag_audio_cli == 1){
-						//FIXME switch_sleep(100); //1 millisec
-						//NOTICA("write now is 1\n", SKYPIAX_P_LOG);
-						//FIXME }
-						//WARNINGA("write is now 0\n", SKYPIAX_P_LOG);
+	if (tech_pvt->flag_audio_cli == 1) {
+		switch_sleep(1000);		//1 millisec
+	}
+	if (tech_pvt->flag_audio_cli == 0) {
+#ifdef TIMER_WRITE
 
+		switch_core_timer_next(&tech_pvt->timer_write);
+#endif // TIMER_WRITE
 
-	//memcpy(tech_pvt->audiobuf_cli, frame->data, frame->datalen);
-								if(tech_pvt->flag_audio_cli == 1){
-									switch_sleep(1000); //1 millisec
-								}
-								if(tech_pvt->flag_audio_cli == 0){
-	memcpy(tech_pvt->audiobuf_cli, frame->data, frame->datalen);
-	tech_pvt->flag_audio_cli = 1;
-								}
+		memcpy(tech_pvt->audiobuf_cli, frame->data, frame->datalen);
+		tech_pvt->flag_audio_cli = 1;
+	}
 	//NOTICA("write \n", SKYPIAX_P_LOG);
 
 	if (sent != frame->datalen && sent != -1) {
@@ -798,29 +827,38 @@
 	switch_assert(tech_pvt != NULL);
 
 	switch (msg->message_id) {
-		case SWITCH_MESSAGE_INDICATE_ANSWER:
-			{
-				DEBUGA_SKYPE("MSG_ID=%d, TO BE ANSWERED!\n", SKYPIAX_P_LOG, msg->message_id);
-				channel_answer_channel(session);
-			}
-			break;
-		case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC:
+	case SWITCH_MESSAGE_INDICATE_ANSWER:
+		{
+			DEBUGA_SKYPE("MSG_ID=%d, TO BE ANSWERED!\n", SKYPIAX_P_LOG, msg->message_id);
 
-			DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_AUDIO_SYNC\n", SKYPIAX_P_LOG, switch_channel_get_name(channel));
+			switch_core_timer_sync(&tech_pvt->timer_read);
+#ifdef TIMER_WRITE
+			switch_core_timer_sync(&tech_pvt->timer_write);
+#endif // TIMER_WRITE
+			channel_answer_channel(session);
+		}
+		break;
+	case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC:
 
-			//for (i=0; i<50; i++) {
-			//skypiax_audio_read(tech_pvt);
-			//WARNINGA("read samples\n", SKYPIAX_P_LOG);
-			//}
-			//switch_core_timer_sync(&tech_pvt->timer_read);
-			//switch_core_timer_sync(&tech_pvt->timer_write);
+		DEBUGA_SKYPE("%s CHANNEL got SWITCH_MESSAGE_INDICATE_AUDIO_SYNC\n", SKYPIAX_P_LOG, switch_channel_get_name(channel));
 
-			break;
-		default:
-			{
-				DEBUGA_SKYPE("MSG_ID=%d\n", SKYPIAX_P_LOG, msg->message_id);
-			}
-			break;
+		switch_core_timer_sync(&tech_pvt->timer_read);
+#ifdef TIMER_WRITE
+		switch_core_timer_sync(&tech_pvt->timer_write);
+#endif // TIMER_WRITE
+		break;
+	default:
+		{
+
+			switch_core_timer_sync(&tech_pvt->timer_read);
+#ifdef TIMER_WRITE
+
+			switch_core_timer_sync(&tech_pvt->timer_write);
+#endif // TIMER_WRITE
+
+			DEBUGA_SKYPE("MSG_ID=%d\n", SKYPIAX_P_LOG, msg->message_id);
+		}
+		break;
 	}
 
 	return SWITCH_STATUS_SUCCESS;
@@ -869,7 +907,8 @@
 static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session,
 													switch_event_t *var_event,
 													switch_caller_profile_t *outbound_profile,
-													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
+													switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags,
+													switch_call_cause_t *cancel_cause)
 {
 	private_t *tech_pvt = NULL;
 	if ((*new_session = switch_core_session_request(skypiax_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) != 0) {
@@ -961,10 +1000,10 @@
 		if (outbound_profile) {
 			char name[128];
 
-			if (strncmp("ANY", outbound_profile->destination_number, 3 ) == 0) {
-				snprintf(name, sizeof(name), "skypiax/ANY/%s%s", tech_pvt->name, outbound_profile->destination_number+3);
+			if (strncmp("ANY", outbound_profile->destination_number, 3) == 0) {
+				snprintf(name, sizeof(name), "skypiax/ANY/%s%s", tech_pvt->name, outbound_profile->destination_number + 3);
 			} else if (strncmp("RR", outbound_profile->destination_number, 2) == 0) {
-				snprintf(name, sizeof(name), "skypiax/RR/%s%s", tech_pvt->name, outbound_profile->destination_number+2);
+				snprintf(name, sizeof(name), "skypiax/RR/%s%s", tech_pvt->name, outbound_profile->destination_number + 2);
 			} else {
 				snprintf(name, sizeof(name), "skypiax/%s", outbound_profile->destination_number);
 			}
@@ -1261,7 +1300,7 @@
 			} else {
 				DEBUGA_SKYPE("Initialized XInitThreads!\n", SKYPIAX_P_LOG);
 			}
-			switch_sleep(100);
+			switch_sleep(1000);
 #endif /* WIN32 */
 
 			if (interface_id && interface_id < SKYPIAX_MAX_INTERFACES) {
@@ -1297,10 +1336,10 @@
 				switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].destination, destination);
 				switch_set_string(globals.SKYPIAX_INTERFACES[interface_id].context, context);
 
-				if(!strcmp(report_incoming_chatmessages, "true") || !strcmp(report_incoming_chatmessages, "1")){
+				if (!strcmp(report_incoming_chatmessages, "true") || !strcmp(report_incoming_chatmessages, "1")) {
 					globals.SKYPIAX_INTERFACES[interface_id].report_incoming_chatmessages = 1;
-				}else {
-					globals.SKYPIAX_INTERFACES[interface_id].report_incoming_chatmessages = 0; //redundant, just in case
+				} else {
+					globals.SKYPIAX_INTERFACES[interface_id].report_incoming_chatmessages = 0;	//redundant, just in case
 
 				}
 
@@ -1424,7 +1463,8 @@
 				DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].dialplan=%s\n", SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].dialplan);
 				DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].destination=%s\n", SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].destination);
 				DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].context=%s\n", SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].context);
-				DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].report_incoming_chatmessages=%d\n", SKYPIAX_P_LOG, i, i, globals.SKYPIAX_INTERFACES[i].report_incoming_chatmessages);
+				DEBUGA_SKYPE("i=%d globals.SKYPIAX_INTERFACES[%d].report_incoming_chatmessages=%d\n", SKYPIAX_P_LOG, i, i,
+							 globals.SKYPIAX_INTERFACES[i].report_incoming_chatmessages);
 			}
 		}
 	}
@@ -1434,25 +1474,27 @@
 
 	return SWITCH_STATUS_SUCCESS;
 }
-static switch_status_t chat_send(const char *proto, const char *from, const char *to, const char *subject, const char *body, const char *type, const char *hint)
+static switch_status_t chat_send(const char *proto, const char *from, const char *to, const char *subject, const char *body, const char *type,
+								 const char *hint)
 {
 	//char *user, *host, *f_user = NULL, *ffrom = NULL, *f_host = NULL, *f_resource = NULL;
-	char *user=NULL, *host, *f_user = NULL, *f_host = NULL, *f_resource = NULL;
+	char *user = NULL, *host, *f_user = NULL, *f_host = NULL, *f_resource = NULL;
 	//mdl_profile_t *profile = NULL;
-	private_t * tech_pvt=NULL;
-	int i=0, found=0, tried=0;
+	private_t *tech_pvt = NULL;
+	int i = 0, found = 0, tried = 0;
 	char skype_msg[1024];
 
 	switch_assert(proto != NULL);
 
-	DEBUGA_SKYPE("chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=%s, hint=%s)\n", SKYPIAX_P_LOG, proto, from, to, subject, body, type, hint?hint:"NULL");
+	DEBUGA_SKYPE("chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=%s, hint=%s)\n", SKYPIAX_P_LOG, proto, from, to, subject, body, type,
+				 hint ? hint : "NULL");
 
 	if (!to || !strlen(to)) {
 		ERRORA("Missing To: header.\n", SKYPIAX_P_LOG);
 		return SWITCH_STATUS_SUCCESS;
 	}
 
-	if ((!from && !hint) || (!strlen(from) && !strlen(hint)) ) {
+	if ((!from && !hint) || (!strlen(from) && !strlen(hint))) {
 		ERRORA("Missing From: AND Hint: headers.\n", SKYPIAX_P_LOG);
 		return SWITCH_STATUS_SUCCESS;
 	}
@@ -1470,70 +1512,71 @@
 		if ((host = strchr(user, '@'))) {
 			*host++ = '\0';
 		}
-
 		//if (!strcmp(proto, MDL_CHAT_PROTO)) {
 
-	DEBUGA_SKYPE("chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=%s, hint=%s)\n", SKYPIAX_P_LOG, proto, from, to, subject, body, type, hint?hint:"NULL");
-			if (hint && strlen(hint)) {
-				//in hint we receive the interface name to use
-				for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
-					if (strlen(globals.SKYPIAX_INTERFACES[i].name)
-							&& (strncmp(globals.SKYPIAX_INTERFACES[i].name, hint, strlen(hint)) == 0)) {
-						tech_pvt = &globals.SKYPIAX_INTERFACES[i];
-						DEBUGA_SKYPE("Using interface: globals.SKYPIAX_INTERFACES[%d].name=|||%s|||\n", SKYPIAX_P_LOG, i, globals.SKYPIAX_INTERFACES[i].name);
-						found = 1;
-						break;
-					}
+		DEBUGA_SKYPE("chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=%s, hint=%s)\n", SKYPIAX_P_LOG, proto, from, to, subject, body, type,
+					 hint ? hint : "NULL");
+		if (hint && strlen(hint)) {
+			//in hint we receive the interface name to use
+			for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
+				if (strlen(globals.SKYPIAX_INTERFACES[i].name)
+					&& (strncmp(globals.SKYPIAX_INTERFACES[i].name, hint, strlen(hint)) == 0)) {
+					tech_pvt = &globals.SKYPIAX_INTERFACES[i];
+					DEBUGA_SKYPE("Using interface: globals.SKYPIAX_INTERFACES[%d].name=|||%s|||\n", SKYPIAX_P_LOG, i, globals.SKYPIAX_INTERFACES[i].name);
+					found = 1;
+					break;
 				}
-			} else {
-				//we have no a predefined interface name to use (hint is NULL), so let's choose an interface from the username (from)
-				for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
-					if (strlen(globals.SKYPIAX_INTERFACES[i].name)
-							&& (strncmp(globals.SKYPIAX_INTERFACES[i].skype_user, from, strlen(from)) == 0)) {
-						tech_pvt = &globals.SKYPIAX_INTERFACES[i];
-						DEBUGA_SKYPE("Using interface: globals.SKYPIAX_INTERFACES[%d].name=|||%s|||\n", SKYPIAX_P_LOG, i, globals.SKYPIAX_INTERFACES[i].name);
-						found = 1;
-						break;
-					}
+			}
+		} else {
+			//we have no a predefined interface name to use (hint is NULL), so let's choose an interface from the username (from)
+			for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
+				if (strlen(globals.SKYPIAX_INTERFACES[i].name)
+					&& (strncmp(globals.SKYPIAX_INTERFACES[i].skype_user, from, strlen(from)) == 0)) {
+					tech_pvt = &globals.SKYPIAX_INTERFACES[i];
+					DEBUGA_SKYPE("Using interface: globals.SKYPIAX_INTERFACES[%d].name=|||%s|||\n", SKYPIAX_P_LOG, i, globals.SKYPIAX_INTERFACES[i].name);
+					found = 1;
+					break;
 				}
 			}
-			if (!found) {
-				ERRORA("ERROR: A Skypiax interface with name='%s' or one with skypeuser='%s' was not found\n", SKYPIAX_P_LOG, hint?hint:"NULL", from?from:"NULL");
-				goto end;
-			} else {
+		}
+		if (!found) {
+			ERRORA("ERROR: A Skypiax interface with name='%s' or one with skypeuser='%s' was not found\n", SKYPIAX_P_LOG, hint ? hint : "NULL",
+				   from ? from : "NULL");
+			goto end;
+		} else {
 
-				snprintf(skype_msg, sizeof(skype_msg), "CHAT CREATE %s", to);
-				skypiax_signaling_write(tech_pvt, skype_msg);
-				switch_sleep(100);
-			}
+			snprintf(skype_msg, sizeof(skype_msg), "CHAT CREATE %s", to);
+			skypiax_signaling_write(tech_pvt, skype_msg);
+			switch_sleep(1000);
+		}
 		//} else {
-			//FIXME don't know how to do here, let's hope this is correct
-			//char *p;
-			//ffrom = switch_mprintf("%s+%s", proto, from);
-			//from = ffrom;
-			//if ((p = strchr(from, '/'))) {
-				//*p = '\0';
-			//}
-	//NOTICA("chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=%s, hint=%s)\n", SKYPIAX_P_LOG, proto, from, to, subject, body, type, hint?hint:"NULL");
-			//switch_core_chat_send(proto, proto, from, to, subject, body, type, hint);
-			//return SWITCH_STATUS_SUCCESS;
+		//FIXME don't know how to do here, let's hope this is correct
+		//char *p;
+		//ffrom = switch_mprintf("%s+%s", proto, from);
+		//from = ffrom;
+		//if ((p = strchr(from, '/'))) {
+		//*p = '\0';
 		//}
+		//NOTICA("chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=%s, hint=%s)\n", SKYPIAX_P_LOG, proto, from, to, subject, body, type, hint?hint:"NULL");
+		//switch_core_chat_send(proto, proto, from, to, subject, body, type, hint);
+		//return SWITCH_STATUS_SUCCESS;
+		//}
 
-		found=0;
+		found = 0;
 
-		while(!found){
-			for(i=0; i<MAX_CHATS; i++){
-				if(!strcmp(tech_pvt->chats[i].dialog_partner, to) ){
+		while (!found) {
+			for (i = 0; i < MAX_CHATS; i++) {
+				if (!strcmp(tech_pvt->chats[i].dialog_partner, to)) {
 					snprintf(skype_msg, sizeof(skype_msg), "CHATMESSAGE %s %s", tech_pvt->chats[i].chatname, body);
 					skypiax_signaling_write(tech_pvt, skype_msg);
-					found=1;
+					found = 1;
 					break;
 				}
 			}
-			if(found){
+			if (found) {
 				break;
 			}
-			if(tried > 1000){
+			if (tried > 1000) {
 				ERRORA("No chat with dialog_partner='%s' was found\n", SKYPIAX_P_LOG, to);
 				break;
 			}
@@ -1541,7 +1584,7 @@
 		}
 
 	}
-end:
+  end:
 	switch_safe_free(user);
 	switch_safe_free(f_user);
 	return SWITCH_STATUS_SUCCESS;
@@ -1563,10 +1606,10 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-        if (switch_event_reserve_subclass(MY_EVENT_INCOMING_CHATMESSAGE) != SWITCH_STATUS_SUCCESS) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass!\n");
-                return SWITCH_STATUS_GENERR;
-        }
+	if (switch_event_reserve_subclass(MY_EVENT_INCOMING_CHATMESSAGE) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass!\n");
+		return SWITCH_STATUS_GENERR;
+	}
 
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	skypiax_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
@@ -1617,10 +1660,10 @@
 					globals.SKYPIAX_INTERFACES[interface_id].skypiax_api_thread = NULL;
 				}
 #else
-				if(tech_pvt->SkypiaxHandles.disp){
+				if (tech_pvt->SkypiaxHandles.disp) {
 					XEvent e;
 					Atom atom1 = XInternAtom(tech_pvt->SkypiaxHandles.disp, "SKYPECONTROLAPI_MESSAGE_BEGIN",
-							False);
+											 False);
 					memset(&e, 0, sizeof(e));
 					e.xclient.type = ClientMessage;
 					e.xclient.message_type = atom1;	/*  leading message */
@@ -1662,7 +1705,7 @@
 		}
 
 	}
-        switch_event_free_subclass(MY_EVENT_INCOMING_CHATMESSAGE);
+	switch_event_free_subclass(MY_EVENT_INCOMING_CHATMESSAGE);
 
 	switch_safe_free(globals.dialplan);
 	switch_safe_free(globals.context);
@@ -1997,7 +2040,7 @@
 
 		}
 		stream->write_function(stream, "\nTotal Interfaces: %d  IB Calls(Failed/Total): %ld/%ld  OB Calls(Failed/Total): %ld/%ld\n",
-		       globals.real_interfaces > 0 ? globals.real_interfaces - 1 : 0, ib_failed, ib, ob_failed, ob);
+							   globals.real_interfaces > 0 ? globals.real_interfaces - 1 : 0, ib_failed, ib, ob_failed, ob);
 
 	} else if (!strcasecmp(argv[0], "console")) {
 		int i;
@@ -2316,7 +2359,7 @@
 
 	DEBUGA_SKYPE("received CHATMESSAGE on interface %s\n", SKYPIAX_P_LOG, tech_pvt->name);
 
-	if(!tech_pvt->report_incoming_chatmessages){
+	if (!tech_pvt->report_incoming_chatmessages) {
 		DEBUGA_SKYPE("I will not generate an Event, report_incoming_chatmessages is %d\n", SKYPIAX_P_LOG, tech_pvt->report_incoming_chatmessages);
 		return 0;
 	}
@@ -2333,23 +2376,23 @@
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "chatname", tech_pvt->chatmessages[which].chatname);
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "id", tech_pvt->chatmessages[which].id);
 		switch_event_add_body(event, "%s", tech_pvt->chatmessages[which].body);
-		if(session){
+		if (session) {
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "during-call", "true");
 			if (switch_core_session_queue_event(session, &event) != SWITCH_STATUS_SUCCESS) {
 				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "delivery-failure", "true");
 				switch_event_fire(&event);
 			}
-		} else { //no session
+		} else {				//no session
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "during-call", "false");
 			switch_event_fire(&event);
-			event_sent_to_esl=1;
+			event_sent_to_esl = 1;
 		}
 
-	}else{
+	} else {
 		ERRORA("cannot create event on interface %s. WHY?????\n", SKYPIAX_P_LOG, tech_pvt->name);
 	}
 
-	if(!event_sent_to_esl){
+	if (!event_sent_to_esl) {
 
 		if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) {
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO);
@@ -2360,21 +2403,21 @@
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "chatname", tech_pvt->chatmessages[which].chatname);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "id", tech_pvt->chatmessages[which].id);
 			switch_event_add_body(event, "%s", tech_pvt->chatmessages[which].body);
-			if(session){
+			if (session) {
 				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "during-call", "true");
-			} else { //no session
+			} else {			//no session
 				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "during-call", "false");
 			}
 			switch_event_fire(&event);
-		} else{
+		} else {
 			ERRORA("cannot create event on interface %s. WHY?????\n", SKYPIAX_P_LOG, tech_pvt->name);
 		}
 	}
 
-	if(session){
+	if (session) {
 		switch_core_session_rwunlock(session);
 	}
-	memset(&tech_pvt->chatmessages[which], '\0', sizeof(&tech_pvt->chatmessages[which]) );
+	memset(&tech_pvt->chatmessages[which], '\0', sizeof(&tech_pvt->chatmessages[which]));
 	return 0;
 }
 
@@ -2407,7 +2450,7 @@
 		for (i = 0; !found && i < SKYPIAX_MAX_INTERFACES; i++) {
 			/* we've been asked for a normal interface name, or we have not found idle interfaces to serve as the "ANY" interface */
 			if (strlen(globals.SKYPIAX_INTERFACES[i].name)
-					&& (strncmp(globals.SKYPIAX_INTERFACES[i].name, argv[0], strlen(argv[0])) == 0)) {
+				&& (strncmp(globals.SKYPIAX_INTERFACES[i].name, argv[0], strlen(argv[0])) == 0)) {
 				tech_pvt = &globals.SKYPIAX_INTERFACES[i];
 				stream->write_function(stream, "Using interface: globals.SKYPIAX_INTERFACES[%d].name=|||%s|||\n", i, globals.SKYPIAX_INTERFACES[i].name);
 				found = 1;
@@ -2424,9 +2467,11 @@
 			//chat_send(p*roto, const char *from, const char *to, const char *subject, const char *body, const char *type, const char *hint);
 			//chat_send(MDL_CHAT_PROTO, tech_pvt->skype_user, argv[1], "SIMPLE MESSAGE", switch_str_nil((char *) &cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]), NULL, hint);
 
-			NOTICA("chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=NULL, hint=%s)\n", SKYPIAX_P_LOG, MDL_CHAT_PROTO, tech_pvt->skype_user, argv[1], "SIMPLE MESSAGE", switch_str_nil((char *) &cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]), tech_pvt->name);
+			NOTICA("chat_send(proto=%s, from=%s, to=%s, subject=%s, body=%s, type=NULL, hint=%s)\n", SKYPIAX_P_LOG, MDL_CHAT_PROTO, tech_pvt->skype_user,
+				   argv[1], "SIMPLE MESSAGE", switch_str_nil((char *) &cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]), tech_pvt->name);
 
-			chat_send(MDL_CHAT_PROTO, tech_pvt->skype_user, argv[1], "SIMPLE MESSAGE", switch_str_nil((char *) &cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]), NULL, tech_pvt->name);
+			chat_send(MDL_CHAT_PROTO, tech_pvt->skype_user, argv[1], "SIMPLE MESSAGE",
+					  switch_str_nil((char *) &cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]), NULL, tech_pvt->name);
 
 			//NOTICA("TEXT is: %s\n", SKYPIAX_P_LOG, (char *) &cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1] );
 			//snprintf(skype_msg, sizeof(skype_msg), "CHAT CREATE %s", argv[1]);
@@ -2440,21 +2485,22 @@
 
 #ifdef NOTDEF
 
-	found=0;
+	found = 0;
 
-	while(!found){
-		for(i=0; i<MAX_CHATS; i++){
-			if(!strcmp(tech_pvt->chats[i].dialog_partner, argv[1]) ){
-				snprintf(skype_msg, sizeof(skype_msg), "CHATMESSAGE %s %s", tech_pvt->chats[i].chatname, (char *) &cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]);
+	while (!found) {
+		for (i = 0; i < MAX_CHATS; i++) {
+			if (!strcmp(tech_pvt->chats[i].dialog_partner, argv[1])) {
+				snprintf(skype_msg, sizeof(skype_msg), "CHATMESSAGE %s %s", tech_pvt->chats[i].chatname,
+						 (char *) &cmd[strlen(argv[0]) + 1 + strlen(argv[1]) + 1]);
 				skypiax_signaling_write(tech_pvt, skype_msg);
-				found=1;
+				found = 1;
 				break;
 			}
 		}
-		if(found){
+		if (found) {
 			break;
 		}
-		if(tried > 1000){
+		if (tried > 1000) {
 			stream->write_function(stream, "ERROR: no chat with dialog_partner='%s' was found\n", argv[1]);
 			break;
 		}
@@ -2462,7 +2508,7 @@
 	}
 #endif //NOTDEF
 
-end:
+  end:
 	switch_safe_free(mycmd);
 
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/skypiax.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/skypiax.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/skypiax.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -277,6 +277,8 @@
 	chatmessage_t chatmessages[MAX_CHATMESSAGES];
 	chat_t chats[MAX_CHATS];
 	uint32_t report_incoming_chatmessages;
+	switch_timer_t timer_read;
+	switch_timer_t timer_write;
 };
 
 typedef struct private_object private_t;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/skypiax_protocol.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/skypiax_protocol.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_skypiax/skypiax_protocol.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -29,16 +29,16 @@
 int skypiax_socket_create_and_bind(private_t * tech_pvt, int *which_port)
 #else
 int skypiax_socket_create_and_bind(private_t * tech_pvt, unsigned short *which_port)
-#endif //WIN32
+#endif							//WIN32
 {
 	int s = -1;
 	struct sockaddr_in my_addr;
 #ifndef WIN32
 	int start_port = 6001;
 #else
-unsigned short start_port = 6001;
+	unsigned short start_port = 6001;
 #endif //WIN32
-	int sockbufsize=0;
+	int sockbufsize = 0;
 	unsigned int size = sizeof(int);
 
 
@@ -78,34 +78,50 @@
 	DEBUGA_SKYPE("SUCCESS! *which_port=%d, tech_pvt->tcp_cli_port=%d, tech_pvt->tcp_srv_port=%d\n", SKYPIAX_P_LOG, *which_port, tech_pvt->tcp_cli_port,
 				 tech_pvt->tcp_srv_port);
 
-	sockbufsize=0;
+	sockbufsize = 0;
 	size = sizeof(int);
-	getsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&sockbufsize, &size);
+	getsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *) &sockbufsize, &size);
 	DEBUGA_SKYPE("1 SO_RCVBUF is %d, size is %d\n", SKYPIAX_P_LOG, sockbufsize, size);
-	sockbufsize=0;
+	sockbufsize = 0;
 	size = sizeof(int);
-	getsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&sockbufsize, &size);
+	getsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *) &sockbufsize, &size);
 	DEBUGA_SKYPE("1 SO_SNDBUF is %d, size is %d\n", SKYPIAX_P_LOG, sockbufsize, size);
 
 
 
-	sockbufsize=SAMPLES_PER_FRAME * 8 * 3;
+/* for virtual machines, eg: Linux domU-12-31-39-02-68-28 2.6.18-xenU-ec2-v1.0 #2 SMP Tue Feb 19 10:51:53 EST 2008 i686 athlon i386 GNU/Linux
+ * use:
+ * sockbufsize=SAMPLES_PER_FRAME * 8;
+ */
+#ifdef WIN32
+	sockbufsize = SAMPLES_PER_FRAME * 8 * 3;
+#else
+	sockbufsize = SAMPLES_PER_FRAME * 8;
+#endif //WIN32
 	size = sizeof(int);
-	setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&sockbufsize, size);
+	setsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *) &sockbufsize, size);
 
-	sockbufsize=0;
+	sockbufsize = 0;
 	size = sizeof(int);
-	getsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&sockbufsize, &size);
+	getsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *) &sockbufsize, &size);
 	DEBUGA_SKYPE("2 SO_RCVBUF is %d, size is %d\n", SKYPIAX_P_LOG, sockbufsize, size);
 
-	sockbufsize=SAMPLES_PER_FRAME * 8 * 3;
+/* for virtual machines, eg: Linux domU-12-31-39-02-68-28 2.6.18-xenU-ec2-v1.0 #2 SMP Tue Feb 19 10:51:53 EST 2008 i686 athlon i386 GNU/Linux
+ * use:
+ * sockbufsize=SAMPLES_PER_FRAME * 8;
+ */
+#ifdef WIN32
+	sockbufsize = SAMPLES_PER_FRAME * 8 * 3;
+#else
+	sockbufsize = SAMPLES_PER_FRAME * 8;
+#endif //WIN32
 	size = sizeof(int);
-	setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&sockbufsize, size);
+	setsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *) &sockbufsize, size);
 
 
-	sockbufsize=0;
+	sockbufsize = 0;
 	size = sizeof(int);
-	getsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&sockbufsize, &size);
+	getsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *) &sockbufsize, &size);
 	DEBUGA_SKYPE("2 SO_SNDBUF is %d, size is %d\n", SKYPIAX_P_LOG, sockbufsize, size);
 
 
@@ -279,20 +295,21 @@
 
 				if (!strcasecmp(prop, "DIALOG_PARTNER")) {
 					DEBUGA_SKYPE("CHAT %s has DIALOG_PARTNER %s\n", SKYPIAX_P_LOG, id, value);
-					found=0;
-					for(i=0; i<MAX_CHATS; i++){
-						if(strlen(tech_pvt->chats[i].chatname) == 0 || !strcmp(tech_pvt->chats[i].chatname, id) ){
+					found = 0;
+					for (i = 0; i < MAX_CHATS; i++) {
+						if (strlen(tech_pvt->chats[i].chatname) == 0 || !strcmp(tech_pvt->chats[i].chatname, id)) {
 							strncpy(tech_pvt->chats[i].chatname, id, sizeof(tech_pvt->chats[i].chatname));
 							strncpy(tech_pvt->chats[i].dialog_partner, value, sizeof(tech_pvt->chats[i].dialog_partner));
-							found=1;
+							found = 1;
 							break;
 						}
 					}
-					if(!found){
-						ERRORA("why we do not have a chats slot free? we have more than %d chats in parallel?\n", SKYPIAX_P_LOG, MAX_CHATS);
-					} 
+					if (!found) {
+						DEBUGA_SKYPE("why we do not have a chats slot free? we have more than %d chats in parallel?\n", SKYPIAX_P_LOG, MAX_CHATS);
+					}
 
-					DEBUGA_SKYPE("CHAT %s is in position %d in the chats array, chatname=%s, dialog_partner=%s\n", SKYPIAX_P_LOG, id, i, tech_pvt->chats[i].chatname, tech_pvt->chats[i].dialog_partner);
+					DEBUGA_SKYPE("CHAT %s is in position %d in the chats array, chatname=%s, dialog_partner=%s\n", SKYPIAX_P_LOG, id, i,
+								 tech_pvt->chats[i].chatname, tech_pvt->chats[i].dialog_partner);
 				}
 
 			}
@@ -318,28 +335,30 @@
 
 				if (!strcasecmp(prop, "TYPE") && !strcasecmp(value, "SAID")) {
 					DEBUGA_SKYPE("CHATMESSAGE %s is of type SAID, let's get the other infos\n", SKYPIAX_P_LOG, id);
-					found=0;
-					for(i=0; i<MAX_CHATMESSAGES; i++){
-						if(strlen(tech_pvt->chatmessages[i].id) == 0){
+					found = 0;
+					for (i = 0; i < MAX_CHATMESSAGES; i++) {
+						if (strlen(tech_pvt->chatmessages[i].id) == 0) {
 							strncpy(tech_pvt->chatmessages[i].id, id, sizeof(tech_pvt->chatmessages[i].id));
 							strncpy(tech_pvt->chatmessages[i].type, value, sizeof(tech_pvt->chatmessages[i].type));
-							found=1;
+							found = 1;
 							break;
 						}
 					}
-					if(!found){
-						ERRORA("why we do not have a chatmessages slot free? we have more than %d chatmessages in parallel?\n", SKYPIAX_P_LOG, MAX_CHATMESSAGES);
+					if (!found) {
+						DEBUGA_SKYPE("why we do not have a chatmessages slot free? we have more than %d chatmessages in parallel?\n", SKYPIAX_P_LOG,
+									 MAX_CHATMESSAGES);
 					} else {
-						DEBUGA_SKYPE("CHATMESSAGE %s is in position %d in the chatmessages array, type=%s, id=%s\n", SKYPIAX_P_LOG, id, i, tech_pvt->chatmessages[i].type, tech_pvt->chatmessages[i].id);
+						DEBUGA_SKYPE("CHATMESSAGE %s is in position %d in the chatmessages array, type=%s, id=%s\n", SKYPIAX_P_LOG, id, i,
+									 tech_pvt->chatmessages[i].type, tech_pvt->chatmessages[i].id);
 						sprintf(msg_to_skype, "GET CHATMESSAGE %s CHATNAME", id);
 						skypiax_signaling_write(tech_pvt, msg_to_skype);
-						skypiax_sleep(100);
+						skypiax_sleep(1000);
 						sprintf(msg_to_skype, "GET CHATMESSAGE %s FROM_HANDLE", id);
 						skypiax_signaling_write(tech_pvt, msg_to_skype);
-						skypiax_sleep(100);
+						skypiax_sleep(1000);
 						sprintf(msg_to_skype, "GET CHATMESSAGE %s FROM_DISPNAME", id);
 						skypiax_signaling_write(tech_pvt, msg_to_skype);
-						skypiax_sleep(100);
+						skypiax_sleep(1000);
 						sprintf(msg_to_skype, "GET CHATMESSAGE %s BODY", id);
 						skypiax_signaling_write(tech_pvt, msg_to_skype);
 					}
@@ -347,63 +366,66 @@
 
 				if (!strcasecmp(prop, "CHATNAME")) {
 					DEBUGA_SKYPE("CHATMESSAGE %s belongs to the CHAT %s\n", SKYPIAX_P_LOG, id, value);
-					found=0;
-					for(i=0; i<MAX_CHATMESSAGES; i++){
-						if(!strcmp(tech_pvt->chatmessages[i].id, id)){
+					found = 0;
+					for (i = 0; i < MAX_CHATMESSAGES; i++) {
+						if (!strcmp(tech_pvt->chatmessages[i].id, id)) {
 							strncpy(tech_pvt->chatmessages[i].chatname, value, sizeof(tech_pvt->chatmessages[i].chatname));
-							found=1;
+							found = 1;
 							break;
 						}
 					}
-					if(!found){
-						ERRORA("why chatmessage %s was not found in the chatmessages array??\n", SKYPIAX_P_LOG, id);
-					} 
+					if (!found) {
+						DEBUGA_SKYPE("why chatmessage %s was not found in the chatmessages array??\n", SKYPIAX_P_LOG, id);
+					}
 				}
 				if (!strcasecmp(prop, "FROM_HANDLE")) {
 					DEBUGA_SKYPE("CHATMESSAGE %s was sent by FROM_HANDLE %s\n", SKYPIAX_P_LOG, id, value);
-					found=0;
-					for(i=0; i<MAX_CHATMESSAGES; i++){
-						if(!strcmp(tech_pvt->chatmessages[i].id, id)){
+					found = 0;
+					for (i = 0; i < MAX_CHATMESSAGES; i++) {
+						if (!strcmp(tech_pvt->chatmessages[i].id, id)) {
 							strncpy(tech_pvt->chatmessages[i].from_handle, value, sizeof(tech_pvt->chatmessages[i].from_handle));
-							found=1;
+							found = 1;
 							break;
 						}
 					}
-					if(!found){
-						ERRORA("why chatmessage %s was not found in the chatmessages array??\n", SKYPIAX_P_LOG, id);
-					} 
+					if (!found) {
+						DEBUGA_SKYPE("why chatmessage %s was not found in the chatmessages array??\n", SKYPIAX_P_LOG, id);
+					}
 
 				}
 				if (!strcasecmp(prop, "FROM_DISPNAME")) {
 					DEBUGA_SKYPE("CHATMESSAGE %s was sent by FROM_DISPNAME %s\n", SKYPIAX_P_LOG, id, value);
-					found=0;
-					for(i=0; i<MAX_CHATMESSAGES; i++){
-						if(!strcmp(tech_pvt->chatmessages[i].id, id)){
+					found = 0;
+					for (i = 0; i < MAX_CHATMESSAGES; i++) {
+						if (!strcmp(tech_pvt->chatmessages[i].id, id)) {
 							strncpy(tech_pvt->chatmessages[i].from_dispname, value, sizeof(tech_pvt->chatmessages[i].from_dispname));
-							found=1;
+							found = 1;
 							break;
 						}
 					}
-					if(!found){
-						ERRORA("why chatmessage %s was not found in the chatmessages array??\n", SKYPIAX_P_LOG, id);
-					} 
+					if (!found) {
+						DEBUGA_SKYPE("why chatmessage %s was not found in the chatmessages array??\n", SKYPIAX_P_LOG, id);
+					}
 
 				}
 				if (!strcasecmp(prop, "BODY")) {
 					DEBUGA_SKYPE("CHATMESSAGE %s has BODY %s\n", SKYPIAX_P_LOG, id, value);
-					found=0;
-					for(i=0; i<MAX_CHATMESSAGES; i++){
-						if(!strcmp(tech_pvt->chatmessages[i].id, id)){
+					found = 0;
+					for (i = 0; i < MAX_CHATMESSAGES; i++) {
+						if (!strcmp(tech_pvt->chatmessages[i].id, id)) {
 							strncpy(tech_pvt->chatmessages[i].body, value, sizeof(tech_pvt->chatmessages[i].body));
-							found=1;
+							found = 1;
 							break;
 						}
 					}
-					if(!found){
-						ERRORA("why chatmessage %s was not found in the chatmessages array??\n", SKYPIAX_P_LOG, id);
-					}else {
-						DEBUGA_SKYPE("CHATMESSAGE %s is in position %d in the chatmessages array, type=%s, id=%s, chatname=%s, from_handle=%s, from_dispname=%s, body=%s\n", SKYPIAX_P_LOG, id, i, tech_pvt->chatmessages[i].type, tech_pvt->chatmessages[i].id, tech_pvt->chatmessages[i].chatname, tech_pvt->chatmessages[i].from_handle, tech_pvt->chatmessages[i].from_dispname, tech_pvt->chatmessages[i].body);
-						if(strcmp(tech_pvt->chatmessages[i].from_handle, tech_pvt->skype_user)){ //if the message was not sent by myself
+					if (!found) {
+						DEBUGA_SKYPE("why chatmessage %s was not found in the chatmessages array??\n", SKYPIAX_P_LOG, id);
+					} else {
+						DEBUGA_SKYPE
+							("CHATMESSAGE %s is in position %d in the chatmessages array, type=%s, id=%s, chatname=%s, from_handle=%s, from_dispname=%s, body=%s\n",
+							 SKYPIAX_P_LOG, id, i, tech_pvt->chatmessages[i].type, tech_pvt->chatmessages[i].id, tech_pvt->chatmessages[i].chatname,
+							 tech_pvt->chatmessages[i].from_handle, tech_pvt->chatmessages[i].from_dispname, tech_pvt->chatmessages[i].body);
+						if (strcmp(tech_pvt->chatmessages[i].from_handle, tech_pvt->skype_user)) {	//if the message was not sent by myself
 							incoming_chatmessage(tech_pvt, i);
 						}
 					}
@@ -519,7 +541,7 @@
 						tech_pvt->skype_callflow = CALLFLOW_STATUS_EARLYMEDIA;
 						tech_pvt->interface_state = SKYPIAX_STATE_DIALING;
 						DEBUGA_SKYPE("Our remote party in skype_call %s is EARLYMEDIA\n", SKYPIAX_P_LOG, id);
-						if(tech_pvt->tcp_cli_thread == NULL){
+						if (tech_pvt->tcp_cli_thread == NULL) {
 							DEBUGA_SKYPE("START start_audio_threads\n", SKYPIAX_P_LOG);
 							if (start_audio_threads(tech_pvt)) {
 								ERRORA("start_audio_threads FAILED\n", SKYPIAX_P_LOG);
@@ -611,7 +633,7 @@
 									tech_pvt->skype_callflow = CALLFLOW_STATUS_INPROGRESS;
 									tech_pvt->interface_state = SKYPIAX_STATE_UP;
 
-									if(tech_pvt->tcp_cli_thread == NULL){
+									if (tech_pvt->tcp_cli_thread == NULL) {
 										DEBUGA_SKYPE("START start_audio_threads\n", SKYPIAX_P_LOG);
 										if (start_audio_threads(tech_pvt)) {
 											ERRORA("start_audio_threads FAILED\n", SKYPIAX_P_LOG);
@@ -717,7 +739,7 @@
 	unsigned int kill_cli_size;
 	short kill_cli_buff[SAMPLES_PER_FRAME];
 	short totalbuf[SAMPLES_PER_FRAME];
-	int sockbufsize=0;
+	int sockbufsize = 0;
 	unsigned int size = sizeof(int);
 
 	s = skypiax_socket_create_and_bind(tech_pvt, &tech_pvt->tcp_srv_port);
@@ -759,14 +781,14 @@
 			while (s > 0 && (fd = accept(s, (struct sockaddr *) &remote_addr, &sin_size)) > 0) {
 				DEBUGA_SKYPE("ACCEPTED here I send you %d\n", SKYPIAX_P_LOG, tech_pvt->tcp_srv_port);
 
-	sockbufsize=0;
-	size = sizeof(int);
-	getsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&sockbufsize, &size);
-	DEBUGA_SKYPE("3 SO_RCVBUF is %d, size is %d\n", SKYPIAX_P_LOG, sockbufsize, size);
-	sockbufsize=0;
-	size = sizeof(int);
-	getsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&sockbufsize, &size);
-	DEBUGA_SKYPE("3 SO_SNDBUF is %d, size is %d\n", SKYPIAX_P_LOG, sockbufsize, size);
+				sockbufsize = 0;
+				size = sizeof(int);
+				getsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *) &sockbufsize, &size);
+				DEBUGA_SKYPE("3 SO_RCVBUF is %d, size is %d\n", SKYPIAX_P_LOG, sockbufsize, size);
+				sockbufsize = 0;
+				size = sizeof(int);
+				getsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *) &sockbufsize, &size);
+				DEBUGA_SKYPE("3 SO_SNDBUF is %d, size is %d\n", SKYPIAX_P_LOG, sockbufsize, size);
 
 
 				if (!(running && tech_pvt->running))
@@ -837,20 +859,20 @@
 								}
 								/* send the complete frame through the pipe to our code waiting for incoming audio */
 								//howmany = skypiax_pipe_write(tech_pvt->audiopipe_srv[1], totalbuf, SAMPLES_PER_FRAME * sizeof(short));
-					//FIXME while(tech_pvt->flag_audio_srv == 1){
-						//FIXME switch_sleep(100); //1 millisec
-						//NOTICA("read now is 1\n", SKYPIAX_P_LOG);
-						//FIXME }
-						//WARNINGA("read is now 0\n", SKYPIAX_P_LOG);
+								//FIXME while(tech_pvt->flag_audio_srv == 1){
+								//FIXME switch_sleep(100); //1 millisec
+								//NOTICA("read now is 1\n", SKYPIAX_P_LOG);
+								//FIXME }
+								//WARNINGA("read is now 0\n", SKYPIAX_P_LOG);
 
 
 								howmany = SAMPLES_PER_FRAME * sizeof(short);
-								if(tech_pvt->flag_audio_srv == 1){
-									switch_sleep(1000); //1 millisec
+								if (tech_pvt->flag_audio_srv == 1) {
+									switch_sleep(1000);	//1 millisec
 								}
-								if(tech_pvt->flag_audio_srv == 0){
-								memcpy(tech_pvt->audiobuf_srv, totalbuf, SAMPLES_PER_FRAME * sizeof(short));
-								tech_pvt->flag_audio_srv = 1;
+								if (tech_pvt->flag_audio_srv == 0) {
+									memcpy(tech_pvt->audiobuf_srv, totalbuf, SAMPLES_PER_FRAME * sizeof(short));
+									tech_pvt->flag_audio_srv = 1;
 								}
 								//NOTICA("read \n", SKYPIAX_P_LOG);
 								if (howmany != SAMPLES_PER_FRAME * sizeof(short)) {
@@ -886,15 +908,15 @@
 				kill_cli_size = SAMPLES_PER_FRAME * sizeof(short);
 				len = skypiax_pipe_write(tech_pvt->audiopipe_cli[1], kill_cli_buff, kill_cli_size);
 
-				tech_pvt->flag_audio_cli = 1; //let's send some frame in the pipes, so both tcp_cli and tcp_srv will have an occasion to die
-				skypiax_sleep(200);
-				tech_pvt->flag_audio_srv = 1; //let's send some frame in the pipes, so both tcp_cli and tcp_srv will have an occasion to die
-				skypiax_sleep(200);
+				tech_pvt->flag_audio_cli = 1;	//let's send some frame in the pipes, so both tcp_cli and tcp_srv will have an occasion to die
+				skypiax_sleep(2000);
+				tech_pvt->flag_audio_srv = 1;	//let's send some frame in the pipes, so both tcp_cli and tcp_srv will have an occasion to die
+				skypiax_sleep(2000);
 				tech_pvt->interface_state = SKYPIAX_STATE_DOWN;
-				tech_pvt->flag_audio_cli = 1; //let's send some frame in the pipes, so both tcp_cli and tcp_srv will have an occasion to die
-				skypiax_sleep(200);
-				tech_pvt->flag_audio_srv = 1; //let's send some frame in the pipes, so both tcp_cli and tcp_srv will have an occasion to die
-				skypiax_sleep(200);
+				tech_pvt->flag_audio_cli = 1;	//let's send some frame in the pipes, so both tcp_cli and tcp_srv will have an occasion to die
+				skypiax_sleep(2000);
+				tech_pvt->flag_audio_srv = 1;	//let's send some frame in the pipes, so both tcp_cli and tcp_srv will have an occasion to die
+				skypiax_sleep(2000);
 				DEBUGA_SKYPE("Skype incoming audio GONE\n", SKYPIAX_P_LOG);
 				skypiax_close_socket(fd);
 			}
@@ -903,7 +925,7 @@
 
 	DEBUGA_SKYPE("incoming audio server (I am it) EXITING\n", SKYPIAX_P_LOG);
 	skypiax_close_socket(s);
-	s=-1;
+	s = -1;
 	return NULL;
 }
 
@@ -925,7 +947,7 @@
 #else
 	unsigned int sin_size;
 #endif /* WIN32 */
-	int sockbufsize=0;
+	int sockbufsize = 0;
 	unsigned int size = sizeof(int);
 
 	s = skypiax_socket_create_and_bind(tech_pvt, &tech_pvt->tcp_cli_port);
@@ -970,14 +992,14 @@
 			while (s > 0 && (fd = accept(s, (struct sockaddr *) &remote_addr, &sin_size)) > 0) {
 				DEBUGA_SKYPE("ACCEPTED here you send me %d\n", SKYPIAX_P_LOG, tech_pvt->tcp_cli_port);
 
-	sockbufsize=0;
-	size = sizeof(int);
-	getsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *)&sockbufsize, &size);
-	DEBUGA_SKYPE("4 SO_RCVBUF is %d, size is %d\n", SKYPIAX_P_LOG, sockbufsize, size);
-	sockbufsize=0;
-	size = sizeof(int);
-	getsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *)&sockbufsize, &size);
-	DEBUGA_SKYPE("4 SO_SNDBUF is %d, size is %d\n", SKYPIAX_P_LOG, sockbufsize, size);
+				sockbufsize = 0;
+				size = sizeof(int);
+				getsockopt(s, SOL_SOCKET, SO_RCVBUF, (char *) &sockbufsize, &size);
+				DEBUGA_SKYPE("4 SO_RCVBUF is %d, size is %d\n", SKYPIAX_P_LOG, sockbufsize, size);
+				sockbufsize = 0;
+				size = sizeof(int);
+				getsockopt(s, SOL_SOCKET, SO_SNDBUF, (char *) &sockbufsize, &size);
+				DEBUGA_SKYPE("4 SO_SNDBUF is %d, size is %d\n", SKYPIAX_P_LOG, sockbufsize, size);
 
 
 
@@ -1019,11 +1041,15 @@
 					FD_SET(fdselect, &fs);
 
 					//FIXME rt = select(fdselect + 1, NULL, &fs, NULL, &to);
-					while(tech_pvt->flag_audio_cli == 0){
-						skypiax_sleep(100); //1 millisec
+					while (tech_pvt->flag_audio_cli == 0) {
+#ifdef WIN32
+						skypiax_sleep(100);	//0.1 millisec
+#else
+						skypiax_sleep(1000);	//1 millisec
+#endif //WIN32
 						//WARNINGA("write now is 0\n", SKYPIAX_P_LOG);
-						 }
-						//ERRORA("write is now 1\n", SKYPIAX_P_LOG);
+					}
+					//ERRORA("write is now 1\n", SKYPIAX_P_LOG);
 
 					rt = 1;
 
@@ -1075,7 +1101,7 @@
 								/* send the 16khz frame to the Skype client waiting for incoming audio to be sent to the remote party */
 								if (tech_pvt->skype_callflow != CALLFLOW_STATUS_REMOTEHOLD) {
 									len = send(fd, (char *) cli_out, got, 0);
-									skypiax_sleep(5000);	//5 msec
+									//skypiax_sleep(5000);  //5 msec
 
 									if (len == -1) {
 										break;
@@ -1117,7 +1143,7 @@
 
 	DEBUGA_SKYPE("outbound audio server (I am it) EXITING\n", SKYPIAX_P_LOG);
 	skypiax_close_socket(s);
-	s=-1;
+	s = -1;
 	return NULL;
 }
 
@@ -1125,11 +1151,16 @@
 {
 	unsigned int samples;
 
-	while(tech_pvt->flag_audio_srv == 0){
-		skypiax_sleep(100); //1 millisec
+	while (tech_pvt->flag_audio_srv == 0) {
+#ifdef WIN32
+		skypiax_sleep(100);		//0.1 millisec
+#else
+		skypiax_sleep(1000);	//1 millisec
+#endif //WIN32
+
 		//WARNINGA("read now is 0\n", SKYPIAX_P_LOG);
-		}
-		//ERRORA("read is now 1\n", SKYPIAX_P_LOG);
+	}
+	//ERRORA("read is now 1\n", SKYPIAX_P_LOG);
 	//samples = skypiax_pipe_read(tech_pvt->audiopipe_srv[0], tech_pvt->read_frame.data, SAMPLES_PER_FRAME * sizeof(short));
 	samples = SAMPLES_PER_FRAME * sizeof(short);
 	memcpy(tech_pvt->read_frame.data, tech_pvt->audiobuf_srv, SAMPLES_PER_FRAME * sizeof(short));
@@ -1231,7 +1262,7 @@
 
 int skypiax_pipe_write(int pipe, short *buf, int howmany)
 {
-	if(buf){
+	if (buf) {
 		howmany = write(pipe, buf, howmany);
 		return howmany;
 	} else {
@@ -1544,8 +1575,8 @@
 #else /* NOT WIN32 */
 int X11_errors_handler(Display * dpy, XErrorEvent * err)
 {
+	private_t *tech_pvt = NULL;
 	(void) dpy;
-	private_t *tech_pvt = NULL;
 
 	xerror = err->error_code;
 	ERRORA("Received error code %d from X Server\n\n", SKYPIAX_P_LOG, xerror);	///FIXME why crash the entire skypiax? just crash the interface, instead
@@ -1567,17 +1598,13 @@
 
 int skypiax_send_message(private_t * tech_pvt, const char *message_P)
 {
-	struct SkypiaxHandles *SkypiaxHandles;
-	Window w_P;
-	Display *disp;
-	Window handle_P;
+	struct SkypiaxHandles *SkypiaxHandles = &tech_pvt->SkypiaxHandles;
+	Window w_P = SkypiaxHandles->skype_win;
+	Display *disp = SkypiaxHandles->disp;
+	Window handle_P = SkypiaxHandles->win;
 	int ok;
 	//private_t *tech_pvt = NULL;
 
-	SkypiaxHandles = &tech_pvt->SkypiaxHandles;
-	w_P = SkypiaxHandles->skype_win;
-	disp = SkypiaxHandles->disp;
-	handle_P = SkypiaxHandles->win;
 
 	Atom atom1 = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
 	Atom atom2 = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE", False);
@@ -1607,7 +1634,7 @@
 	XSync(disp, False);
 	ok = X11_errors_untrap();
 
-	if (!ok){
+	if (!ok) {
 		ERRORA("Sending message failed with status %d\n", SKYPIAX_P_LOG, xerror);
 		tech_pvt->running = 0;
 		return 0;
@@ -1699,6 +1726,7 @@
 	Display *disp = NULL;
 	Window root = -1;
 	Window win = -1;
+	int xfd;
 
 	if (!strlen(tech_pvt->X11_display))
 		strcpy(tech_pvt->X11_display, getenv("DISPLAY"));
@@ -1723,7 +1751,6 @@
 		DEBUGA_SKYPE("X Display '%s' opened\n", SKYPIAX_P_LOG, tech_pvt->X11_display);
 	}
 
-	int xfd;
 	xfd = XConnectionNumber(disp);
 	fcntl(xfd, F_SETFD, FD_CLOEXEC);
 
@@ -1741,7 +1768,7 @@
 			ERRORA("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n", SKYPIAX_P_LOG);
 			running = 0;
 			//if(disp)
-				//XCloseDisplay(disp);
+			//XCloseDisplay(disp);
 			return NULL;
 		}
 
@@ -1750,113 +1777,124 @@
 			ERRORA("Sending message failed - probably Skype crashed. Please run/restart Skype manually and launch Skypiax again\n", SKYPIAX_P_LOG);
 			running = 0;
 			//if(disp)
-				//XCloseDisplay(disp);
+			//XCloseDisplay(disp);
 			return NULL;
 		}
 
-		/* perform an events loop */
-		XEvent an_event;
-		char buf[21];			/*  can't be longer */
-		char buffer[17000];
-		char continuebuffer[17000];
-		char *b;
-		int i;
-		int continue_is_broken = 0;
-		int there_were_continues = 0;
-		Atom atom_begin = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
-		Atom atom_continue = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE", False);
+		{
+			/* perform an events loop */
+			XEvent an_event;
+			char buf[21];		/*  can't be longer */
+			char buffer[17000];
+			char continuebuffer[17000];
+			char *b;
+			int i;
+			int continue_is_broken = 0;
+			int there_were_continues = 0;
+			Atom atom_begin = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE_BEGIN", False);
+			Atom atom_continue = XInternAtom(disp, "SKYPECONTROLAPI_MESSAGE", False);
 
-		memset(buffer, '\0', 17000);
-		memset(continuebuffer, '\0', 17000);
-		b = buffer;
+			memset(buffer, '\0', 17000);
+			memset(continuebuffer, '\0', 17000);
+			b = buffer;
 
-		while (running && tech_pvt->running) {
-			XNextEvent(disp, &an_event);
-			if (!(running && tech_pvt->running))
-				break;
-			switch (an_event.type) {
-			case ClientMessage:
-
-				if (an_event.xclient.format != 8)
+			while (running && tech_pvt->running) {
+				XNextEvent(disp, &an_event);
+				if (!(running && tech_pvt->running))
 					break;
+				switch (an_event.type) {
+				case ClientMessage:
 
-				for (i = 0; i < 20 && an_event.xclient.data.b[i] != '\0'; ++i)
-					buf[i] = an_event.xclient.data.b[i];
+					if (an_event.xclient.format != 8) {
+						skypiax_sleep(1000);	//0.1 msec
+						break;
+					}
 
-				buf[i] = '\0';
+					for (i = 0; i < 20 && an_event.xclient.data.b[i] != '\0'; ++i)
+						buf[i] = an_event.xclient.data.b[i];
 
-				//DEBUGA_SKYPE ("BUF=|||%s|||\n", SKYPIAX_P_LOG, buf);
+					buf[i] = '\0';
 
-				if (an_event.xclient.message_type == atom_begin) {
-					//DEBUGA_SKYPE ("BEGIN BUF=|||%s|||\n", SKYPIAX_P_LOG, buf);
+					//DEBUGA_SKYPE ("BUF=|||%s|||\n", SKYPIAX_P_LOG, buf);
 
-					if (strlen(buffer)) {
-						unsigned int howmany;
-						howmany = strlen(b) + 1;
-						howmany = write(SkypiaxHandles->fdesc[1], b, howmany);
-						WARNINGA("A begin atom while the previous message is not closed???? value of previous message (between vertical bars) is=|||%s|||, will be lost\n", SKYPIAX_P_LOG, buffer);
-						memset(buffer, '\0', 17000);
+					if (an_event.xclient.message_type == atom_begin) {
+						//DEBUGA_SKYPE ("BEGIN BUF=|||%s|||\n", SKYPIAX_P_LOG, buf);
+
+						if (strlen(buffer)) {
+							unsigned int howmany;
+							howmany = strlen(b) + 1;
+							howmany = write(SkypiaxHandles->fdesc[1], b, howmany);
+							WARNINGA
+								("A begin atom while the previous message is not closed???? value of previous message (between vertical bars) is=|||%s|||, will be lost\n",
+								 SKYPIAX_P_LOG, buffer);
+							memset(buffer, '\0', 17000);
+						}
+						if (continue_is_broken) {
+							continue_is_broken = 0;
+							there_were_continues = 1;
+						}
 					}
-					if(continue_is_broken){
-						continue_is_broken=0;
-						there_were_continues = 1;
-					}
-				}
-				if (an_event.xclient.message_type == atom_continue) {
-					//DEBUGA_SKYPE ("CONTINUE BUF=|||%s|||\n", SKYPIAX_P_LOG, buf);
+					if (an_event.xclient.message_type == atom_continue) {
+						//DEBUGA_SKYPE ("CONTINUE BUF=|||%s|||\n", SKYPIAX_P_LOG, buf);
 
-					if (!strlen(buffer)) {
-						DEBUGA_SKYPE
-							("Got a 'continue' XAtom without a previous 'begin'. It's value (between vertical bars) is=|||%s|||, let's store it and hope next 'begin' will be the good one\n", SKYPIAX_P_LOG, buf);
-						strcat(continuebuffer, buf);
-						continue_is_broken = 1;
-						if (!strncmp(buf, "ognised identity", 15)) {
-							WARNINGA
-								("Got a 'continue' XAtom without a previous 'begin'. It's value (between vertical bars) is=|||%s|||. Let's introduce a 1 second delay.\n",
+						if (!strlen(buffer)) {
+							DEBUGA_SKYPE
+								("Got a 'continue' XAtom without a previous 'begin'. It's value (between vertical bars) is=|||%s|||, let's store it and hope next 'begin' will be the good one\n",
 								 SKYPIAX_P_LOG, buf);
-							skypiax_sleep(1000000);	//1 sec
+							strcat(continuebuffer, buf);
+							continue_is_broken = 1;
+							if (!strncmp(buf, "ognised identity", 15)) {
+								WARNINGA
+									("Got a 'continue' XAtom without a previous 'begin'. It's value (between vertical bars) is=|||%s|||. Let's introduce a 1 second delay.\n",
+									 SKYPIAX_P_LOG, buf);
+								skypiax_sleep(1000000);	//1 sec
+							}
+							skypiax_sleep(1000);	//0.1 msec
+							break;
 						}
-						break;
 					}
-				}
-				if(continue_is_broken){
-					continue;
-				}
+					if (continue_is_broken) {
+						XFlush(disp);
+						skypiax_sleep(1000);	//0.1 msec
+						continue;
+					}
+					//DEBUGA_SKYPE ("i=%d, buffer=|||%s|||\n", SKYPIAX_P_LOG, i, buffer);
+					strcat(buffer, buf);
+					//DEBUGA_SKYPE ("i=%d, buffer=|||%s|||\n", SKYPIAX_P_LOG, i, buffer);
+					strcat(buffer, continuebuffer);
+					//DEBUGA_SKYPE ("i=%d, buffer=|||%s|||\n", SKYPIAX_P_LOG, i, buffer);
+					memset(continuebuffer, '\0', 17000);
 
-				//DEBUGA_SKYPE ("i=%d, buffer=|||%s|||\n", SKYPIAX_P_LOG, i, buffer);
-				strcat(buffer, buf);
-				//DEBUGA_SKYPE ("i=%d, buffer=|||%s|||\n", SKYPIAX_P_LOG, i, buffer);
-				strcat(buffer, continuebuffer);
-				//DEBUGA_SKYPE ("i=%d, buffer=|||%s|||\n", SKYPIAX_P_LOG, i, buffer);
-				memset(continuebuffer, '\0', 17000);
+					if (i < 20 || there_were_continues) {	/* last fragment */
+						unsigned int howmany;
 
-				if (i < 20 || there_were_continues) {	/* last fragment */
-					unsigned int howmany;
+						howmany = strlen(b) + 1;
 
-					howmany = strlen(b) + 1;
+						howmany = write(SkypiaxHandles->fdesc[1], b, howmany);
+						//DEBUGA_SKYPE ("RECEIVED=|||%s|||\n", SKYPIAX_P_LOG, buffer);
+						memset(buffer, '\0', 17000);
+						XFlush(disp);
+						there_were_continues = 0;
+					}
 
-					howmany = write(SkypiaxHandles->fdesc[1], b, howmany);
-					//DEBUGA_SKYPE ("RECEIVED=|||%s|||\n", SKYPIAX_P_LOG, buffer);
-					memset(buffer, '\0', 17000);
-					XFlush(disp);
-					there_were_continues = 0;
+					skypiax_sleep(1000);	//0.1 msec
+					break;
+				default:
+					skypiax_sleep(1000);	//0.1 msec
+					break;
 				}
-
-				break;
-			default:
-				break;
 			}
 		}
 	} else {
 		ERRORA("Skype is not running, maybe crashed. Please run/restart Skype and relaunch Skypiax\n", SKYPIAX_P_LOG);
 		running = 0;
 		//if(disp)
-			//XCloseDisplay(disp);
+		//XCloseDisplay(disp);
 		return NULL;
 	}
 	//running = 0;
 	//if(disp)
-		//XCloseDisplay(disp);
+	//XCloseDisplay(disp);
 	return NULL;
 
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/Makefile.am (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/Makefile.am	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/Makefile.am	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,40 +1,37 @@
-AM_CFLAGS   = $(SWITCH_AM_CFLAGS)
-AM_CPPFLAGS = $(SWITCH_AM_CXXFLAGS)
-#AM_LDFLAGS  = $(SWITCH_AM_LDFLAGS)
-#we should set all these vars from configure, no reason to have these in each Makefile.am
-LIBTOOL = echo "`link=\`echo $@|grep .la;echo $@|grep .so;echo $@|grep .dll\`;if test -n "$$link"; then echo Creating $@;fi`";`if test -z "$(VERBOSE)" ; \
-then echo $(SHELL) $(switch_builddir)/quiet_libtool ;else echo $(SHELL) $(switch_builddir)/libtool;  fi`
-AM_MAKEFLAGS=`test -n "$(VERBOSE)" || echo -s`
-# Dirty trick to override the link output
-LIBS+=> $(MODNAME).log || error="yes";if test -n "$(VERBOSE)" -o "$$error" = "yes";then cat $(MODNAME).log;fi;if test "$$error" = "yes";then exit 1;fi
+include $(top_srcdir)/build/modmake.rulesam
 
-moddir=@modinstdir@
-
 MODNAME=mod_sofia
 
-SOFIA_DIR=$(switch_builddir)/libs/sofia-sip
+SOFIA_DIR=$(switch_srcdir)/libs/sofia-sip
+SOFIA_BUILDDIR=$(switch_builddir)/libs/sofia-sip
 SOFIAUA_DIR=$(SOFIA_DIR)/libsofia-sip-ua
-SOFIALA=$(SOFIAUA_DIR)/libsofia-sip-ua.la
+SOFIAUA_BUILDDIR=$(SOFIA_BUILDDIR)/libsofia-sip-ua
+SOFIALA=$(SOFIAUA_BUILDDIR)/libsofia-sip-ua.la
 
 mod_LTLIBRARIES = mod_sofia.la
 mod_sofia_la_SOURCES = mod_sofia.c sofia.c sofia_glue.c sofia_presence.c sofia_reg.c sofia_sla.c  mod_sofia.h
-mod_sofia_la_CFLAGS  = $(AM_CFLAGS) 
-mod_sofia_la_CFLAGS += -I. -I$(SOFIAUA_DIR)/bnf  -I$(SOFIAUA_DIR)/features
-mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/http -I$(SOFIAUA_DIR)/ipt
-mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/iptsec -I$(SOFIAUA_DIR)/msg
-mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/nea -I$(SOFIAUA_DIR)/nta
-mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/nth -I$(SOFIAUA_DIR)/nua
-mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/sdp -I$(SOFIAUA_DIR)/sip
-mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/soa -I$(SOFIAUA_DIR)/sresolv
-mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/stun -I$(SOFIAUA_DIR)/su
-mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/tport -I$(SOFIAUA_DIR)/url
+mod_sofia_la_CFLAGS  = $(AM_CFLAGS) -I.
+mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/bnf -I$(SOFIAUA_BUILDDIR)/bnf
+mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/http -I$(SOFIAUA_BUILDDIR)/http
+mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/iptsec -I$(SOFIAUA_BUILDDIR)/iptsec
+mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/nea -I$(SOFIAUA_BUILDDIR)/nea
+mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/nth -I$(SOFIAUA_BUILDDIR)/nth
+mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/sdp -I$(SOFIAUA_BUILDDIR)/sdp
+mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/soa -I$(SOFIAUA_BUILDDIR)/soa
+mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/stun -I$(SOFIAUA_BUILDDIR)/stun
+mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/tport -I$(SOFIAUA_BUILDDIR)/tport
+mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/features -I$(SOFIAUA_BUILDDIR)/features
+mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/ipt -I$(SOFIAUA_BUILDDIR)/ipt
+mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/msg -I$(SOFIAUA_BUILDDIR)/msg
+mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/nta -I$(SOFIAUA_BUILDDIR)/nta
+mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/nua -I$(SOFIAUA_BUILDDIR)/nua
+mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/sip -I$(SOFIAUA_BUILDDIR)/sip
+mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/sresolv -I$(SOFIAUA_BUILDDIR)/sresolv
+mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/su -I$(SOFIAUA_BUILDDIR)/su
+mod_sofia_la_CFLAGS += -I$(SOFIAUA_DIR)/url -I$(SOFIAUA_BUILDDIR)/url
 mod_sofia_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(SOFIALA)
-mod_sofia_la_LDFLAGS = -avoid-version -module -no-undefined
+mod_sofia_la_LDFLAGS = -avoid-version -module -no-undefined -shared
 
-if ADD_ODBC
-mod_sofia_la_CFLAGS += -DSWITCH_HAVE_ODBC
-endif
-
 if ISMAC
 mod_sofia_la_LDFLAGS += -framework CoreFoundation -framework SystemConfiguration
 endif
@@ -44,8 +41,8 @@
 $(mod_sofia_la_SOURCES) : $(BUILT_SOURCES)
 
 $(SOFIALA): $(SOFIA_DIR) $(SOFIA_DIR)/.update
-	cd $(SOFIA_DIR) && $(MAKE) SOFIA_CFLAGS="$(AM_CFLAGS)"
+	cd $(SOFIA_BUILDDIR) && $(MAKE) SOFIA_CFLAGS="$(SWITCH_AM_CFLAGS)"
 	$(TOUCH_TARGET)
 
-../../../../libs/sofia-sip/libsofia-sip-ua/nua/sofia-sip/nua_tag.h: $(SOFIALA)
+$(SOFIAUA_BUILDDIR)/nua/sofia-sip/nua_tag.h: $(SOFIALA)
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/mod_sofia.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/mod_sofia.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/mod_sofia.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -85,7 +85,7 @@
 		sofia_glue_tech_absorb_sdp(tech_pvt);
 	}
 
-	if (sofia_test_flag(tech_pvt, TFLAG_OUTBOUND)) {
+	if (sofia_test_flag(tech_pvt, TFLAG_OUTBOUND) || sofia_test_flag(tech_pvt, TFLAG_RECOVERING)) {
 		const char *var;
 
 		if ((var = switch_channel_get_variable(channel, SOFIA_SECURE_MEDIA_VARIABLE)) && !zstr(var)) {
@@ -107,12 +107,20 @@
 		}
 	}
 
-	/* Move channel's state machine to ROUTING */
-	switch_channel_set_state(channel, CS_ROUTING);
-	assert(switch_channel_get_state(channel) != CS_INIT);
 
- end:
 
+	if (!sofia_test_flag(tech_pvt, TFLAG_RECOVERING_BRIDGE)) {
+		if (sofia_test_flag(tech_pvt, TFLAG_RECOVERING)) {
+			switch_channel_set_state(channel, CS_EXECUTE);
+		} else {
+			/* Move channel's state machine to ROUTING */
+			switch_channel_set_state(channel, CS_ROUTING);
+			assert(switch_channel_get_state(channel) != CS_INIT);
+		}
+	}
+
+  end:
+
 	switch_mutex_unlock(tech_pvt->sofia_mutex);
 
 	return status;
@@ -129,7 +137,8 @@
 		switch_channel_clear_flag(channel, CF_LEG_HOLDING);
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA ROUTING\n", switch_channel_get_name(switch_core_session_get_channel(session)));
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA ROUTING\n",
+					  switch_channel_get_name(switch_core_session_get_channel(session)));
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -146,8 +155,40 @@
 		switch_channel_clear_flag(channel, CF_LEG_HOLDING);
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA RESET\n", switch_channel_get_name(switch_core_session_get_channel(session)));
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA RESET\n",
+					  switch_channel_get_name(switch_core_session_get_channel(session)));
 
+
+	if (sofia_test_flag(tech_pvt, TFLAG_RECOVERING_BRIDGE)) {
+		switch_core_session_t *other_session;
+		const char *uuid = switch_core_session_get_uuid(session);
+
+		if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
+			const char *other_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
+
+			if (other_uuid && (other_session = switch_core_session_locate(other_uuid))) {
+				switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
+
+				switch_channel_clear_flag(channel, CF_BRIDGE_ORIGINATOR);
+				switch_channel_wait_for_state_timeout(other_channel, CS_RESET, 5000);
+				switch_channel_wait_for_flag(channel, CF_REQ_MEDIA, SWITCH_FALSE, 10000, NULL);
+				switch_channel_wait_for_flag(channel, CF_MEDIA_ACK, SWITCH_TRUE, 10000, NULL);
+				switch_channel_wait_for_flag(other_channel, CF_REQ_MEDIA, SWITCH_FALSE, 10000, NULL);
+				switch_channel_wait_for_flag(other_channel, CF_MEDIA_ACK, SWITCH_TRUE, 10000, NULL);
+
+				if (switch_channel_test_flag(channel, CF_PROXY_MODE) && switch_channel_test_flag(other_channel, CF_PROXY_MODE)) {
+					switch_ivr_signal_bridge(session, other_session);
+				} else {
+					switch_ivr_uuid_bridge(uuid, other_uuid);
+				}
+				switch_core_session_rwunlock(other_session);
+			}
+		}
+
+		sofia_clear_flag(tech_pvt, TFLAG_RECOVERING_BRIDGE);
+	}
+
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -163,8 +204,10 @@
 		switch_channel_clear_flag(channel, CF_LEG_HOLDING);
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA HIBERNATE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA HIBERNATE\n",
+					  switch_channel_get_name(switch_core_session_get_channel(session)));
 
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -174,16 +217,19 @@
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_assert(tech_pvt != NULL);
 
+	sofia_clear_flag(tech_pvt, TFLAG_RECOVERING);
+
 	if (!sofia_test_flag(tech_pvt, TFLAG_HOLD_LOCK)) {
 		sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
 		switch_channel_clear_flag(channel, CF_LEG_HOLDING);
 	}
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA EXECUTE\n", switch_channel_get_name(switch_core_session_get_channel(session)));
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s SOFIA EXECUTE\n",
+					  switch_channel_get_name(switch_core_session_get_channel(session)));
 
 	return SWITCH_STATUS_SUCCESS;
 }
 
-char *generate_pai_str(switch_core_session_t *session) 
+char *generate_pai_str(switch_core_session_t *session)
 {
 	private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
 	const char *callee_name = NULL, *callee_number = NULL;
@@ -194,7 +240,7 @@
 		zstr((callee_name = switch_channel_get_variable(tech_pvt->channel, "sip_callee_id_name")))) {
 		callee_name = switch_channel_get_variable(tech_pvt->channel, "callee_id_name");
 	}
-	
+
 	if (zstr((callee_number = switch_channel_get_variable(tech_pvt->channel, "effective_callee_id_number"))) &&
 		zstr((callee_number = switch_channel_get_variable(tech_pvt->channel, "sip_callee_id_number")))) {
 		callee_number = tech_pvt->caller_profile->destination_number;
@@ -210,17 +256,16 @@
 	if (!zstr(callee_number) && (zstr(ua) || !switch_stristr("polycom", ua))) {
 		callee_number = switch_core_session_sprintf(session, "sip:%s@%s", callee_number, tech_pvt->profile->sipip);
 	}
-	
-	header = (tech_pvt->cid_type == CID_TYPE_RPID) ? "Remote-Party-ID" : "P-Asserted-Identity";
 
+	header = (tech_pvt->cid_type == CID_TYPE_RPID && !switch_stristr("aastra", ua)) ? "Remote-Party-ID" : "P-Asserted-Identity";
+
 	if (!zstr(callee_name) && !zstr(callee_number)) {
 		if (switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote)) {
 			pai = switch_core_session_sprintf(tech_pvt->session, "%s: \"%s\" <%s>\n"
-											  "X-FS-Display-Name: %s\nX-FS-Display-Number: %s\n", 
+											  "X-FS-Display-Name: %s\nX-FS-Display-Number: %s\n",
 											  header, callee_name, callee_number, callee_name, callee_number);
 		} else {
-			pai = switch_core_session_sprintf(tech_pvt->session, "%s: \"%s\" <%s>\n", 
-											  header, callee_name, callee_number);
+			pai = switch_core_session_sprintf(tech_pvt->session, "%s: \"%s\" <%s>\n", header, callee_name, callee_number);
 		}
 
 	}
@@ -296,7 +341,7 @@
 		if (switch_core_codec_ready(&tech_pvt->read_codec)) {
 			switch_core_codec_destroy(&tech_pvt->read_codec);
 		}
-		
+
 		if (switch_core_codec_ready(&tech_pvt->write_codec)) {
 			switch_core_codec_destroy(&tech_pvt->write_codec);
 		}
@@ -304,7 +349,7 @@
 		if (switch_core_codec_ready(&tech_pvt->video_read_codec)) {
 			switch_core_codec_destroy(&tech_pvt->video_read_codec);
 		}
-		
+
 		if (switch_core_codec_ready(&tech_pvt->video_write_codec)) {
 			switch_core_codec_destroy(&tech_pvt->video_write_codec);
 		}
@@ -334,6 +379,9 @@
 
 	switch_mutex_lock(tech_pvt->sofia_mutex);
 
+	sofia_clear_flag(tech_pvt, TFLAG_RECOVERING);
+	sofia_glue_tech_untrack(tech_pvt->profile, session, SWITCH_TRUE);
+
 	if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
 		if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
 			tech_pvt->profile->ob_failed_calls++;
@@ -365,7 +413,7 @@
 	if (session && tech_pvt->profile->pres_type) {
 		char *sql = switch_mprintf("delete from sip_dialogs where call_id='%q'", tech_pvt->call_id);
 		switch_assert(sql);
-		sofia_glue_execute_sql(tech_pvt->profile, &sql, SWITCH_TRUE);
+		sofia_glue_execute_sql_now(tech_pvt->profile, &sql, SWITCH_TRUE);
 	}
 
 	if (tech_pvt->kick && (a_session = switch_core_session_locate(tech_pvt->kick))) {
@@ -377,29 +425,32 @@
 	if (tech_pvt->nh && !sofia_test_flag(tech_pvt, TFLAG_BYE)) {
 		char reason[128] = "";
 		char *bye_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_BYE_HEADER_PREFIX);
-		
-		if (cause > 0 && cause < 128) {
-			switch_snprintf(reason, sizeof(reason), "Q.850;cause=%d;text=\"%s\"", cause, switch_channel_cause2str(cause));
-		} else if (cause == SWITCH_CAUSE_PICKED_OFF || cause == SWITCH_CAUSE_LOSE_RACE) {
-			switch_snprintf(reason, sizeof(reason), "SIP;cause=200;text=\"Call completed elsewhere\"");
-		} else {
-			switch_snprintf(reason, sizeof(reason), "%s;cause=%d;text=\"%s\"",
-					tech_pvt->profile->username, 
-					cause,
-					switch_channel_cause2str(cause));
+		const char *val = NULL;
+
+		val = switch_channel_get_variable(tech_pvt->channel, "disable_q850_reason");
+		if (!val || switch_true(val)) {
+			if (cause > 0 && cause < 128) {
+				switch_snprintf(reason, sizeof(reason), "Q.850;cause=%d;text=\"%s\"", cause, switch_channel_cause2str(cause));
+			} else if (cause == SWITCH_CAUSE_PICKED_OFF || cause == SWITCH_CAUSE_LOSE_RACE) {
+				switch_snprintf(reason, sizeof(reason), "SIP;cause=200;text=\"Call completed elsewhere\"");
+			} else {
+				switch_snprintf(reason, sizeof(reason), "%s;cause=%d;text=\"%s\"", tech_pvt->profile->username, cause, switch_channel_cause2str(cause));
+			}
 		}
 
-		if (switch_channel_test_flag(channel, CF_ANSWERED)) {
+		if (switch_channel_test_flag(channel, CF_ANSWERED) || sofia_test_flag(tech_pvt, TFLAG_ANS)) {
+			const char *call_info = switch_channel_get_variable(channel, "presence_call_info_full");
+
 			if (!tech_pvt->got_bye) {
 				switch_channel_set_variable(channel, "sip_hangup_disposition", "send_bye");
 			}
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Sending BYE to %s\n", switch_channel_get_name(channel));
 			if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
-				nua_bye(tech_pvt->nh, 
-						SIPTAG_REASON_STR(reason),
+				nua_bye(tech_pvt->nh,
+						TAG_IF(!zstr(reason), SIPTAG_REASON_STR(reason)),
+						TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
 						TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
-						TAG_IF(!zstr(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
-						TAG_END());
+						TAG_IF(!zstr(bye_headers), SIPTAG_HEADER_STR(bye_headers)), TAG_END());
 			}
 		} else {
 			if (switch_channel_test_flag(channel, CF_OUTBOUND)) {
@@ -408,10 +459,8 @@
 					switch_channel_set_variable(channel, "sip_hangup_disposition", "send_cancel");
 				}
 				if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
-					nua_cancel(tech_pvt->nh, 
-							   SIPTAG_REASON_STR(reason), 
-							   TAG_IF(!zstr(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
-							   TAG_END());
+					nua_cancel(tech_pvt->nh,
+							   TAG_IF(!zstr(reason), SIPTAG_REASON_STR(reason)), TAG_IF(!zstr(bye_headers), SIPTAG_HEADER_STR(bye_headers)), TAG_END());
 				}
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Responding to INVITE with: %d\n", sip_cause);
@@ -419,11 +468,9 @@
 					switch_channel_set_variable(channel, "sip_hangup_disposition", "send_refuse");
 				}
 				if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
-					nua_respond(tech_pvt->nh, sip_cause, sip_status_phrase(sip_cause), 
-								SIPTAG_REASON_STR(reason), 
-								SIPTAG_HEADER_STR(generate_pai_str(session)),
-								TAG_IF(!zstr(bye_headers), SIPTAG_HEADER_STR(bye_headers)),
-								TAG_END());
+					nua_respond(tech_pvt->nh, sip_cause, sip_status_phrase(sip_cause),
+								TAG_IF(!zstr(reason), SIPTAG_REASON_STR(reason)),
+								SIPTAG_HEADER_STR(generate_pai_str(session)), TAG_IF(!zstr(bye_headers), SIPTAG_HEADER_STR(bye_headers)), TAG_END());
 				}
 			}
 		}
@@ -437,8 +484,8 @@
 	if (tech_pvt->sofia_private) {
 		*tech_pvt->sofia_private->uuid = '\0';
 	}
-	
 
+
 	sofia_glue_set_rtp_stats(tech_pvt);
 
 	switch_mutex_unlock(tech_pvt->sofia_mutex);
@@ -448,13 +495,13 @@
 
 static switch_status_t sofia_on_exchange_media(switch_core_session_t *session)
 {
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "SOFIA LOOPBACK\n");
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "SOFIA EXCHANGE_MEDIA\n");
 	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t sofia_on_soft_execute(switch_core_session_t *session)
 {
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "SOFIA TRANSMIT\n");
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "SOFIA SOFT_EXECUTE\n");
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -468,6 +515,7 @@
 	const char *b_sdp = NULL;
 	int is_proxy = 0;
 	char *sticky = NULL;
+	const char *call_info = switch_channel_get_variable(channel, "presence_call_info_full");
 
 	if (sofia_test_flag(tech_pvt, TFLAG_ANS) || switch_channel_test_flag(channel, CF_OUTBOUND)) {
 		return SWITCH_STATUS_SUCCESS;
@@ -495,19 +543,31 @@
 			tech_pvt->local_sdp_str = NULL;
 			sofia_glue_tech_choose_port(tech_pvt, 0);
 			sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
-			
+
 			/* Send the 200 OK */
 			if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
-				char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX);
-				nua_respond(tech_pvt->nh, SIP_200_OK,
-							SIPTAG_CONTACT_STR(tech_pvt->profile->url),
-							SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-							SOATAG_REUSE_REJECTED(1),
-							SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), 
-							TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
-							TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote), 
-								   SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT)),
-							TAG_END());
+				char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_RESPONSE_HEADER_PREFIX);
+				if (sofia_use_soa(tech_pvt)) {
+					nua_respond(tech_pvt->nh, SIP_200_OK,
+								SIPTAG_CONTACT_STR(tech_pvt->profile->url),
+								SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+								TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
+								SOATAG_REUSE_REJECTED(1),
+								SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
+								TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+								TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
+									   SIPTAG_HEADER_STR("X-FS-Support: " FREESWITCH_SUPPORT)), TAG_END());
+				} else {
+					nua_respond(tech_pvt->nh, SIP_200_OK,
+								NUTAG_MEDIA_ENABLE(0),
+								SIPTAG_CONTACT_STR(tech_pvt->profile->url),
+								TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+								TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
+								SIPTAG_CONTENT_TYPE_STR("application/sdp"),
+								SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str),
+								TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
+									   SIPTAG_HEADER_STR("X-FS-Support: " FREESWITCH_SUPPORT)), TAG_END());
+				}
 
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Sent a 200 OK, waiting for ACK\n");
 				switch_safe_free(extra_headers);
@@ -516,14 +576,14 @@
 			/* Unlock the session signal to allow the ack to make it in */
 			// Maybe we should timeout?
 			switch_mutex_unlock(tech_pvt->sofia_mutex);
-			
-			while(switch_channel_ready(channel) && !sofia_test_flag(tech_pvt, TFLAG_3PCC_HAS_ACK)) {
+
+			while (switch_channel_ready(channel) && !sofia_test_flag(tech_pvt, TFLAG_3PCC_HAS_ACK)) {
 				switch_cond_next();
 			}
-			
+
 			/*  Regain lock on sofia */
 			switch_mutex_lock(tech_pvt->sofia_mutex);
-			
+
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Done waiting for ACK\n");
 			return SWITCH_STATUS_SUCCESS;
 		}
@@ -556,7 +616,7 @@
 			switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 			return status;
 		}
-		
+
 		sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
 		if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
 			switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -564,7 +624,8 @@
 
 		if (tech_pvt->nh) {
 			if (tech_pvt->local_sdp_str) {
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Local SDP %s:\n%s\n", switch_channel_get_name(channel), tech_pvt->local_sdp_str);
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Local SDP %s:\n%s\n", switch_channel_get_name(channel),
+								  tech_pvt->local_sdp_str);
 			}
 		}
 	}
@@ -586,19 +647,36 @@
 
 	if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
 		char *extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX);
-		nua_respond(tech_pvt->nh, SIP_200_OK,
-					NUTAG_AUTOANSWER(0),
-					TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
-					SIPTAG_HEADER_STR(generate_pai_str(session)),
-					NUTAG_SESSION_TIMER(session_timeout),
-					SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-					SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")),
-					SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-					SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), 
-					TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
-					TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote), 
-						   SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT)),
-					TAG_END());
+		if (sofia_use_soa(tech_pvt)) {
+			nua_respond(tech_pvt->nh, SIP_200_OK,
+						NUTAG_AUTOANSWER(0),
+						TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
+						TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
+						SIPTAG_HEADER_STR(generate_pai_str(session)),
+						NUTAG_SESSION_TIMER(session_timeout),
+						SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+						SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")),
+						SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+						SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
+						TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+						TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
+							   SIPTAG_HEADER_STR("X-FS-Support: " FREESWITCH_SUPPORT)), TAG_END());
+		} else {
+			nua_respond(tech_pvt->nh, SIP_200_OK,
+						NUTAG_AUTOANSWER(0),
+						NUTAG_MEDIA_ENABLE(0),
+						TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
+						TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
+						SIPTAG_HEADER_STR(generate_pai_str(session)),
+						NUTAG_SESSION_TIMER(session_timeout),
+						SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+						SIPTAG_CALL_INFO_STR(switch_channel_get_variable(tech_pvt->channel, SOFIA_SIP_HEADER_PREFIX "call_info")),
+						SIPTAG_CONTENT_TYPE_STR("application/sdp"),
+						SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str),
+						TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+						TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
+							   SIPTAG_HEADER_STR("X-FS-Support: " FREESWITCH_SUPPORT)), TAG_END());
+		}
 		switch_safe_free(extra_headers);
 		sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
 	}
@@ -737,7 +815,7 @@
 	tech_pvt->read_frame.datalen = 0;
 	sofia_set_flag_locked(tech_pvt, TFLAG_READING);
 
-	if (sofia_test_flag(tech_pvt, TFLAG_HUP) || sofia_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation || 
+	if (sofia_test_flag(tech_pvt, TFLAG_HUP) || sofia_test_flag(tech_pvt, TFLAG_BYE) || !tech_pvt->read_codec.implementation ||
 		!switch_core_codec_ready(&tech_pvt->read_codec)) {
 		return SWITCH_STATUS_FALSE;
 	}
@@ -751,7 +829,7 @@
 
 		switch_assert(tech_pvt->rtp_session != NULL);
 		tech_pvt->read_frame.datalen = 0;
-		
+
 		while (sofia_test_flag(tech_pvt, TFLAG_IO) && tech_pvt->read_frame.datalen == 0) {
 			tech_pvt->read_frame.flags = SFF_NONE;
 
@@ -759,13 +837,13 @@
 
 			if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
 				if (status == SWITCH_STATUS_TIMEOUT) {
-					
+
 					if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
 						sofia_glue_toggle_hold(tech_pvt, 0);
 						sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
 						switch_channel_clear_flag(channel, CF_LEG_HOLDING);
 					}
-					
+
 					switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_MEDIA_TIMEOUT);
 				}
 				return status;
@@ -789,30 +867,32 @@
 			if (tech_pvt->read_frame.datalen > 0) {
 				uint32_t bytes = 0;
 				int frames = 1;
-				
+
 				if (!switch_test_flag((&tech_pvt->read_frame), SFF_CNG)) {
 					if (!tech_pvt->read_codec.implementation || !switch_core_codec_ready(&tech_pvt->read_codec)) {
 						*frame = NULL;
 						return SWITCH_STATUS_GENERR;
 					}
-					
+
 					if ((tech_pvt->read_frame.datalen % 10) == 0 &&
 						sofia_test_pflag(tech_pvt->profile, PFLAG_AUTOFIX_TIMING) && tech_pvt->check_frames < MAX_CODEC_CHECK_FRAMES) {
 						tech_pvt->check_frames++;
-						
+
 						if (!tech_pvt->read_impl.encoded_bytes_per_packet) {
 							tech_pvt->check_frames = MAX_CODEC_CHECK_FRAMES;
 							goto skip;
 						}
-						
+
 						if (tech_pvt->last_ts && tech_pvt->read_frame.datalen != tech_pvt->read_impl.encoded_bytes_per_packet) {
-							uint32_t codec_ms = (int)(tech_pvt->read_frame.timestamp - 
-														   tech_pvt->last_ts) / (tech_pvt->read_impl.samples_per_second / 1000);
-							if ((codec_ms % 10) != 0) {
-								tech_pvt->check_frames = MAX_CODEC_CHECK_FRAMES;
+							uint32_t codec_ms = (int) (tech_pvt->read_frame.timestamp -
+													   tech_pvt->last_ts) / (tech_pvt->read_impl.samples_per_second / 1000);
+
+							if ((codec_ms % 10) != 0 || codec_ms > tech_pvt->read_impl.samples_per_packet * 10) {
+								tech_pvt->last_ts = 0;
 								goto skip;
 							}
-							
+
+
 							if (tech_pvt->last_codec_ms && tech_pvt->last_codec_ms == codec_ms) {
 								tech_pvt->mismatch_count++;
 							}
@@ -824,87 +904,83 @@
 									const char *val;
 									int rtp_timeout_sec = 0;
 									int rtp_hold_timeout_sec = 0;
-								
-									if (codec_ms > 120) { /* yeah right */
-										switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, 
+
+									if (codec_ms > 120) {	/* yeah right */
+										switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
 														  "Your phone is trying to send timestamps that suggest an increment of %dms per packet\n"
-														  "That seems hard to believe so I am going to go on ahead and um ignore that, mmkay?", (int)codec_ms);
+														  "That seems hard to believe so I am going to go on ahead and um ignore that, mmkay?",
+														  (int) codec_ms);
 										tech_pvt->check_frames = MAX_CODEC_CHECK_FRAMES;
 										goto skip;
 									}
 
 									tech_pvt->read_frame.datalen = 0;
-									switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, 
+									switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
 													  "We were told to use ptime %d but what they meant to say was %d\n"
-													  "This issue has so far been identified to happen on the following broken platforms/devices:\n" 
+													  "This issue has so far been identified to happen on the following broken platforms/devices:\n"
 													  "Linksys/Sipura aka Cisco\n"
 													  "ShoreTel\n"
-													  "Sonus/L3 (If you're really lucky, you may even get this message twice once they "
-													  "answer and change it back again!! Go Sonus!)\n"
-													  "We will try to fix it but some of the devices on this list are so broken who knows what will happen..\n"
-													  , 
-													  (int)tech_pvt->codec_ms, (int)codec_ms);
+													  "Sonus/L3\n"
+													  "We will try to fix it but some of the devices on this list are so broken who knows what will happen..\n",
+													  (int) tech_pvt->codec_ms, (int) codec_ms);
+
+									switch_channel_set_variable_printf(channel, "sip_h_X-Broken-PTIME", "Adv=%d;Sent=%d",
+																	   (int) tech_pvt->codec_ms, (int) codec_ms);
+
 									tech_pvt->codec_ms = codec_ms;
-									switch_core_session_lock_codec_write(session);
-									switch_core_session_lock_codec_read(session);
 
-									switch_core_codec_destroy(&tech_pvt->read_codec);									
-									switch_core_codec_destroy(&tech_pvt->write_codec);
-									
 									if (sofia_glue_tech_set_codec(tech_pvt, 2) != SWITCH_STATUS_SUCCESS) {
 										*frame = NULL;
-										switch_core_session_unlock_codec_write(session);
-										switch_core_session_unlock_codec_read(session);
 										return SWITCH_STATUS_GENERR;
 									}
-									
+
 									if ((val = switch_channel_get_variable(tech_pvt->channel, "rtp_timeout_sec"))) {
 										int v = atoi(val);
 										if (v >= 0) {
 											rtp_timeout_sec = v;
 										}
 									}
-									
+
 									if ((val = switch_channel_get_variable(tech_pvt->channel, "rtp_hold_timeout_sec"))) {
 										int v = atoi(val);
 										if (v >= 0) {
 											rtp_hold_timeout_sec = v;
 										}
 									}
-									
+
 									if (rtp_timeout_sec) {
 										tech_pvt->max_missed_packets = (tech_pvt->read_impl.samples_per_second * rtp_timeout_sec) /
 											tech_pvt->read_impl.samples_per_packet;
-										
+
 										switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets);
 										if (!rtp_hold_timeout_sec) {
 											rtp_hold_timeout_sec = rtp_timeout_sec * 10;
 										}
 									}
-									
+
 									if (rtp_hold_timeout_sec) {
 										tech_pvt->max_missed_hold_packets = (tech_pvt->read_impl.samples_per_second * rtp_hold_timeout_sec) /
 											tech_pvt->read_impl.samples_per_packet;
 									}
-									
-									if (switch_rtp_change_interval(tech_pvt->rtp_session, 
-																   tech_pvt->codec_ms * 1000,
-																   tech_pvt->read_impl.samples_per_packet
-																   ) != SWITCH_STATUS_SUCCESS) {
-										switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
-										
-									}
 
-									tech_pvt->check_frames = MAX_CODEC_CHECK_FRAMES;
+
+									tech_pvt->check_frames = 0;
+									tech_pvt->last_ts = 0;
+
 									/* inform them of the codec they are actually sending */
-									sofia_glue_do_invite(session);
-									switch_core_session_unlock_codec_write(session);
-									switch_core_session_unlock_codec_read(session);
+									if (++tech_pvt->codec_reinvites > 2) {
+										switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
+														  "Ok, some devices *cough* X-lite *cough*\n"
+														  "seem to continue to lie over and over again so I guess we'll\n"
+														  "leave well-enough alone and let them lie\n");
+									} else {
+										sofia_glue_do_invite(session);
+									}
 
 								}
-							
+
 							}
-							
+
 						} else {
 							tech_pvt->mismatch_count = 0;
 						}
@@ -913,8 +989,8 @@
 						tech_pvt->mismatch_count = 0;
 						tech_pvt->last_ts = 0;
 					}
-				skip:
-					
+				  skip:
+
 					if ((bytes = tech_pvt->read_impl.encoded_bytes_per_packet)) {
 						frames = (tech_pvt->read_frame.datalen / bytes);
 					}
@@ -1082,6 +1158,22 @@
 
 	/* ones that do not need to lock sofia mutex */
 	switch (msg->message_id) {
+	case SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC:
+		{
+			sofia_glue_tech_track(tech_pvt->profile, session);
+		}
+		break;
+	case SWITCH_MESSAGE_INDICATE_PROXY_MEDIA:
+		{
+			if (switch_rtp_ready(tech_pvt->rtp_session)) {
+				if (msg->numeric_arg) {
+					switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA);
+				} else {
+					switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA);
+				}
+			}
+		}
+		break;
 	case SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO:
 		{
 			if (switch_rtp_ready(tech_pvt->rtp_session) && !zstr(msg->string_array_arg[0]) && !zstr(msg->string_array_arg[1])) {
@@ -1114,26 +1206,66 @@
 		goto end;
 
 	case SWITCH_MESSAGE_INDICATE_BRIDGE:
-		if (switch_rtp_ready(tech_pvt->rtp_session)) {
-			const char *val;
-			int ok = 0;
+		{
+			const char *network_addr_a, *network_addr_b, *simplify_a, *simplify_b;
+			int s_ok = 0;
+			int do_s = 0;
 
-			if (sofia_test_flag(tech_pvt, TFLAG_PASS_RFC2833) && switch_channel_test_flag_partner(channel, CF_FS_RTP)) {
-				switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833);
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s activate passthru 2833 mode.\n", switch_channel_get_name(channel));
+			simplify_a = switch_channel_get_variable(channel, "sip_auto_simplify");
+			simplify_b = switch_channel_get_variable_partner(channel, "sip_auto_simplify");
+
+			if (switch_true(simplify_a)) {
+				if (switch_true(simplify_b) && !switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
+					s_ok = 0;
+				} else {
+					s_ok = 1;
+				}
 			}
 
-			if ((val = switch_channel_get_variable(channel, "rtp_autoflush_during_bridge"))) {
-				ok = switch_true(val);
-			} else {
-				ok = sofia_test_pflag(tech_pvt->profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
+			if (s_ok) {
+				network_addr_a = switch_channel_get_variable(channel, "network_addr");
+				network_addr_b = switch_channel_get_variable_partner(channel, "network_addr");
+
+				if (!zstr(network_addr_a) && !zstr(network_addr_b) && !strcmp(network_addr_a, network_addr_b)) {
+					if (strcmp(network_addr_a, switch_str_nil(tech_pvt->profile->sipip)) &&
+						strcmp(network_addr_a, switch_str_nil(tech_pvt->profile->extsipip))) {
+						switch_core_session_message_t smsg = { 0 };
+
+						smsg.message_id = SWITCH_MESSAGE_INDICATE_SIMPLIFY;
+						smsg.from = __FILE__;
+
+						status = switch_core_session_receive_message(session, &smsg);
+						do_s = 1;
+					}
+				}
 			}
-			
-			if (ok) {
-				rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_STICK);
-			} else {
-				rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_ONCE);
+
+			if (!do_s) {
+				sofia_glue_tech_track(tech_pvt->profile, session);
 			}
+
+			if (switch_rtp_ready(tech_pvt->rtp_session)) {
+				const char *val;
+				int ok = 0;
+
+				if (sofia_test_flag(tech_pvt, TFLAG_PASS_RFC2833) && switch_channel_test_flag_partner(channel, CF_FS_RTP)) {
+					switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833);
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+									  "%s activate passthru 2833 mode.\n", switch_channel_get_name(channel));
+				}
+
+				if ((val = switch_channel_get_variable(channel, "rtp_autoflush_during_bridge"))) {
+					ok = switch_true(val);
+				} else {
+					ok = sofia_test_pflag(tech_pvt->profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
+				}
+
+				if (ok) {
+					rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_STICK);
+				} else {
+					rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_ONCE);
+				}
+			}
 		}
 		goto end;
 	case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
@@ -1142,7 +1274,8 @@
 			int ok = 0;
 
 			if (switch_rtp_test_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833)) {
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s deactivate passthru 2833 mode.\n", switch_channel_get_name(channel));
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s deactivate passthru 2833 mode.\n",
+								  switch_channel_get_name(channel));
 				switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833);
 			}
 
@@ -1151,13 +1284,15 @@
 			} else {
 				ok = sofia_test_pflag(tech_pvt->profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
 			}
-			
+
 			if (ok) {
 				rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_UNSTICK);
 			} else {
 				rtp_flush_read_buffer(tech_pvt->rtp_session, SWITCH_RTP_FLUSH_ONCE);
 			}
 
+			//sofia_glue_tech_untrack(tech_pvt->profile, session);
+
 		}
 		goto end;
 	case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC:
@@ -1172,20 +1307,34 @@
 			const char *var;
 			const char *presence_data = switch_channel_get_variable(channel, "presence_data");
 			const char *presence_id = switch_channel_get_variable(channel, "presence_id");
-			
+
+
+			if ((var = switch_channel_get_variable(channel, "sip_enable_soa"))) {
+				if (switch_true(var)) {
+					sofia_set_flag(tech_pvt, TFLAG_ENABLE_SOA);
+				} else {
+					sofia_clear_flag(tech_pvt, TFLAG_ENABLE_SOA);
+				}
+			}
+
+
 			if (presence_id || presence_data) {
 				char *sql = switch_mprintf("update sip_dialogs set presence_id='%q',presence_data='%q' "
-									 "where uuid='%s';\n", switch_str_nil(presence_id), switch_str_nil(presence_data), 
-									 switch_core_session_get_uuid(session));
+										   "where uuid='%s';\n", switch_str_nil(presence_id), switch_str_nil(presence_data),
+										   switch_core_session_get_uuid(session));
 				switch_assert(sql);
-				sofia_glue_execute_sql(tech_pvt->profile, &sql, SWITCH_TRUE);
+				sofia_glue_execute_sql_now(tech_pvt->profile, &sql, SWITCH_TRUE);
 			}
 
 
-
 			if ((var = switch_channel_get_variable(channel, SOFIA_SECURE_MEDIA_VARIABLE)) && switch_true(var)) {
 				sofia_set_flag_locked(tech_pvt, TFLAG_SECURE);
 			}
+
+			if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTOFIX_TIMING)) {
+				tech_pvt->check_frames = 0;
+				tech_pvt->last_ts = 0;
+			}
 		}
 		break;
 	default:
@@ -1208,11 +1357,7 @@
 				" <media_control>\r\n"
 				"  <vc_primitive>\r\n"
 				"   <to_encoder>\r\n"
-				"    <picture_fast_update>\r\n" 
-				"    </picture_fast_update>\r\n" 
-				"   </to_encoder>\r\n" 
-				"  </vc_primitive>\r\n" 
-				" </media_control>\r\n";
+				"    <picture_fast_update>\r\n" "    </picture_fast_update>\r\n" "   </to_encoder>\r\n" "  </vc_primitive>\r\n" " </media_control>\r\n";
 
 			nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("application/media_control+xml"), SIPTAG_PAYLOAD_STR(pl), TAG_END());
 
@@ -1228,10 +1373,18 @@
 			}
 
 			if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
-				nua_respond(tech_pvt->nh, SIP_200_OK,
-							SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-							SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-							SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), TAG_END());
+				if (sofia_use_soa(tech_pvt)) {
+					nua_respond(tech_pvt->nh, SIP_200_OK,
+								SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+								SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+								SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
+								TAG_END());
+				} else {
+					nua_respond(tech_pvt->nh, SIP_200_OK,
+								NUTAG_MEDIA_ENABLE(0),
+								SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+								SIPTAG_CONTENT_TYPE_STR("application/sdp"), SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str), TAG_END());
+				}
 				switch_channel_mark_answered(channel);
 			}
 		}
@@ -1261,17 +1414,19 @@
 			if (!tech_pvt->local_sdp_str) {
 				sofia_glue_tech_absorb_sdp(tech_pvt);
 			}
+
 			sofia_glue_do_invite(session);
 		}
 		break;
 
 	case SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT:
 		{
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Sending media re-direct:\n%s\n", 
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Sending media re-direct:\n%s\n",
 							  switch_channel_get_name(channel), msg->string_arg);
 			sofia_glue_tech_set_local_sdp(tech_pvt, msg->string_arg, SWITCH_TRUE);
 
 			sofia_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
+			switch_channel_set_flag(channel, CF_REQ_MEDIA);
 			sofia_glue_do_invite(session);
 		}
 		break;
@@ -1283,10 +1438,10 @@
 
 			sofia_glue_set_image_sdp(tech_pvt, t38_options);
 
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Sending request for image media. %s\n", 
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Sending request for image media. %s\n",
 							  switch_channel_get_name(channel), tech_pvt->local_sdp_str);
-							  
-			
+
+			switch_channel_set_flag(channel, CF_REQ_MEDIA);
 			sofia_set_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
 			sofia_glue_do_invite(session);
 		}
@@ -1330,26 +1485,49 @@
 		}
 		break;
 
-	case SWITCH_MESSAGE_INDICATE_WARNING:
+	case SWITCH_MESSAGE_INDICATE_SIMPLIFY:
 		{
-			char *message;
-			if (!zstr(msg->string_arg)) {
-				const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent");
-				
-				if (!sofia_test_flag(tech_pvt, TFLAG_UPDATING_DISPLAY)) {
-						
-					if ((ua && (switch_stristr("polycom", ua)))) {
-						message = switch_mprintf("Warning: 399 devnull \"%s\"", msg->string_arg);
-						sofia_set_flag_locked(tech_pvt, TFLAG_UPDATING_DISPLAY);
-						nua_update(tech_pvt->nh, 
-								   TAG_IF(!zstr(message), SIPTAG_HEADER_STR(message)),
-								   TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
-								   TAG_END());
-						free(message);
+			char *ref_to, *ref_by;
+			const char *uuid;
+			const char *call_id = NULL, *to_user = NULL, *to_host = NULL, *to_tag = NULL, *from_tag = NULL, *from_user = NULL, *from_host = NULL;
+
+			if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
+				switch_core_session_t *rsession;
+				if ((rsession = switch_core_session_locate(uuid))) {
+					switch_channel_t *rchannel = switch_core_session_get_channel(rsession);
+					call_id = switch_channel_get_variable(rchannel, "sip_call_id");
+
+					to_user = switch_channel_get_variable(rchannel, "sip_to_user");
+
+					if (switch_channel_direction(rchannel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
+						to_host = switch_channel_get_variable(rchannel, "sip_to_host");
+						from_user = switch_channel_get_variable(channel, "sip_from_user");
+						from_host = switch_channel_get_variable(channel, "sip_from_host");
+					} else {
+						to_host = switch_channel_get_variable(channel, "sip_to_host");
+						from_user = switch_channel_get_variable(rchannel, "sip_from_user");
+						from_host = switch_channel_get_variable(rchannel, "sip_from_host");
 					}
 
+					to_tag = switch_channel_get_variable(rchannel, "sip_to_tag");
+					from_tag = switch_channel_get_variable(rchannel, "sip_from_tag");
+					switch_core_session_rwunlock(rsession);
 				}
 			}
+
+			if (to_user && to_host && from_user && from_host && call_id && to_tag && from_tag) {
+				char in[512] = "", out[1536] = "";
+
+				switch_snprintf(in, sizeof(in), "%s;to-tag=%s;from-tag=%s", call_id, to_tag, from_tag);
+				switch_url_encode(in, out, sizeof(out));
+
+				ref_to = switch_mprintf("<sip:%s@%s?Replaces=%s>", to_user, to_host, out);
+				ref_by = switch_mprintf("<sip:%s@%s>", from_user, from_host);
+
+				nua_refer(tech_pvt->nh, SIPTAG_REFER_TO_STR(ref_to), SIPTAG_REFERRED_BY_STR(ref_by), TAG_END());
+				switch_safe_free(ref_to);
+				switch_safe_free(ref_by);
+			}
 		}
 		break;
 	case SWITCH_MESSAGE_INDICATE_DISPLAY:
@@ -1358,7 +1536,7 @@
 			char *arg = NULL;
 			char *argv[2] = { 0 };
 			int argc;
-			
+
 			if (zstr(name) && !zstr(msg->string_arg)) {
 				arg = strdup(msg->string_arg);
 				switch_assert(arg);
@@ -1368,7 +1546,7 @@
 				number = argv[1];
 
 			}
-			
+
 			if (!zstr(name)) {
 				char message[256] = "";
 				const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent");
@@ -1381,31 +1559,35 @@
 				if (!sofia_test_flag(tech_pvt, TFLAG_UPDATING_DISPLAY)) {
 					if (zstr(tech_pvt->last_sent_callee_id_name) || strcmp(tech_pvt->last_sent_callee_id_name, name) ||
 						zstr(tech_pvt->last_sent_callee_id_number) || strcmp(tech_pvt->last_sent_callee_id_number, number)) {
-						
+
 						if (switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote)) {
 							snprintf(message, sizeof(message), "X-FS-Display-Name: %s\nX-FS-Display-Number: %s\n", name, number);
 
 							nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/update_display"),
 									 TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
-									 TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
-									 TAG_END());
+									 TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_END());
 						} else if (ua && switch_stristr("snom", ua)) {
 							snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", name, number);
 							nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
-									 TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
-									 SIPTAG_PAYLOAD_STR(message), TAG_END());
+									 TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), SIPTAG_PAYLOAD_STR(message), TAG_END());
 						} else if ((ua && (switch_stristr("polycom", ua)))) {
 							snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", name, number);
 							sofia_set_flag_locked(tech_pvt, TFLAG_UPDATING_DISPLAY);
 							nua_update(tech_pvt->nh,
 									   TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
-									   TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
-									   TAG_END());
+									   TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_END());
+						} else if ((ua && (switch_stristr("aastra", ua)))) {
+							snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <sip:%s@%s>", name, number, tech_pvt->profile->sipip);
+
+							sofia_set_flag_locked(tech_pvt, TFLAG_UPDATING_DISPLAY);
+							nua_update(tech_pvt->nh,
+									   TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
+									   TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_END());
 						}
 
 						tech_pvt->last_sent_callee_id_name = switch_core_session_strdup(tech_pvt->session, name);
 						tech_pvt->last_sent_callee_id_number = switch_core_session_strdup(tech_pvt->session, number);
-					
+
 						if (switch_event_create(&event, SWITCH_EVENT_CALL_UPDATE) == SWITCH_STATUS_SUCCESS) {
 							const char *uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
 							switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Direction", "SEND");
@@ -1439,14 +1621,12 @@
 				if (ua && switch_stristr("snom", ua)) {
 					snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", msg->string_arg, tech_pvt->caller_profile->destination_number);
 					nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
-							 TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
-							 SIPTAG_PAYLOAD_STR(message), TAG_END());
+							 TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), SIPTAG_PAYLOAD_STR(message), TAG_END());
 				} else if (ua && switch_stristr("polycom", ua)) {
 					snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", msg->string_arg, tech_pvt->caller_profile->destination_number);
 					nua_update(tech_pvt->nh,
 							   TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
-							   TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
-							   TAG_END());
+							   TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_END());
 				}
 			}
 		}
@@ -1468,16 +1648,16 @@
 				if (!strchr(msg->string_arg, '<') && !strchr(msg->string_arg, '>')) {
 					dest = switch_core_session_sprintf(session, "\"unknown\" <%s>", msg->string_arg);
 				}
-				
+
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Redirecting to %s\n", dest);
 
 				nua_respond(tech_pvt->nh, SIP_302_MOVED_TEMPORARILY, SIPTAG_CONTACT_STR(dest),
-							TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
-							TAG_END());
+							TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
 				sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
 				switch_safe_free(extra_headers);
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Too late for redirecting to %s, already answered\n", msg->string_arg);
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Too late for redirecting to %s, already answered\n",
+								  msg->string_arg);
 			}
 		}
 		break;
@@ -1497,7 +1677,7 @@
 			sofia_wait_for_reply(tech_pvt, 9999, 300);
 			switch_mutex_lock(tech_pvt->sofia_mutex);
 			if ((var = switch_channel_get_variable(tech_pvt->channel, "sip_refer_reply"))) {
-				msg->string_reply = switch_core_session_strdup(session, var); 
+				msg->string_reply = switch_core_session_strdup(session, var);
 			} else {
 				msg->string_reply = "no reply";
 			}
@@ -1508,7 +1688,7 @@
 		if (msg->numeric_arg || msg->string_arg) {
 			int code = msg->numeric_arg;
 			const char *reason = NULL;
-			
+
 			if (code) {
 				reason = msg->string_arg;
 			} else {
@@ -1530,7 +1710,7 @@
 					goto end_lock;
 				}
 			}
-			
+
 			if (zstr(reason) && code != 407 && code != 302) {
 				reason = sip_status_phrase(code);
 				if (zstr(reason)) {
@@ -1571,7 +1751,7 @@
 								SIPTAG_HEADER_STR(generate_pai_str(session)),
 								TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
 								TAG_IF(!zstr(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)), TAG_END());
-					
+
 					sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
 					switch_safe_free(extra_headers);
 				}
@@ -1582,7 +1762,7 @@
 					*p = '\0';
 					msg->string_arg = p;
 				}
-				
+
 				msg->message_id = SWITCH_MESSAGE_INDICATE_REDIRECT;
 				switch_core_session_receive_message(session, msg);
 				goto end_lock;
@@ -1592,21 +1772,27 @@
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Responding with %d [%s]\n", code, reason);
 					if (!zstr(((char *) msg->pointer_arg))) {
 						sofia_glue_tech_set_local_sdp(tech_pvt, (char *) msg->pointer_arg, SWITCH_TRUE);
-						
+
 						if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
 							sofia_glue_tech_patch_sdp(tech_pvt);
 							sofia_glue_tech_proxy_remote_addr(tech_pvt);
 						}
+						if (sofia_use_soa(tech_pvt)) {
+							nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+										SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+										SOATAG_REUSE_REJECTED(1),
+										SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1),
+										TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
+						} else {
+							nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+										NUTAG_MEDIA_ENABLE(0),
+										SIPTAG_CONTENT_TYPE_STR("application/sdp"),
+										SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str),
+										TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
+						}
+					} else {
 						nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-									SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-									SOATAG_REUSE_REJECTED(1),
-									SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), 
-									TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
-									TAG_END());
-					} else {
-						nua_respond(tech_pvt->nh, code, su_strdup(nua_handle_home(tech_pvt->nh), reason), SIPTAG_CONTACT_STR(tech_pvt->reply_contact), 
-									TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
-									TAG_END());
+									TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
 					}
 					switch_safe_free(extra_headers);
 				}
@@ -1619,7 +1805,7 @@
 		if (sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY) && sofia_test_flag(tech_pvt, TFLAG_3PCC)) {
 			switch_channel_mark_ring_ready(channel);
 			status = SWITCH_STATUS_SUCCESS;
-			switch_log_printf(SWITCH_CHANNEL_ID_LOG, msg->_file, msg->_func, msg->_line, NULL, SWITCH_LOG_INFO, 
+			switch_log_printf(SWITCH_CHANNEL_ID_LOG, msg->_file, msg->_func, msg->_line, NULL, SWITCH_LOG_INFO,
 							  "Pretending to send ringing.  Not available for 3pcc calls\n");
 			goto end_lock;
 		}
@@ -1627,13 +1813,15 @@
 		if (!switch_channel_test_flag(channel, CF_RING_READY) && !sofia_test_flag(tech_pvt, TFLAG_BYE) &&
 			!switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_ANSWERED)) {
 			char *extra_header = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX);
+			const char *call_info = switch_channel_get_variable(channel, "presence_call_info_full");
+
 			nua_respond(tech_pvt->nh, SIP_180_RINGING,
 						SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-						SIPTAG_HEADER_STR(generate_pai_str(session)), 
+						SIPTAG_HEADER_STR(generate_pai_str(session)),
+						TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
 						TAG_IF(!zstr(extra_header), SIPTAG_HEADER_STR(extra_header)),
-						TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote), 
-							   SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT)),
-						TAG_END());
+						TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
+							   SIPTAG_HEADER_STR("X-FS-Support: " FREESWITCH_SUPPORT)), TAG_END());
 			switch_safe_free(extra_header);
 			switch_channel_mark_ring_ready(channel);
 		}
@@ -1645,12 +1833,13 @@
 		{
 			char *sticky = NULL;
 			const char *val = NULL;
+			const char *call_info = switch_channel_get_variable(channel, "presence_call_info_full");
 
 			if (sofia_test_pflag(tech_pvt->profile, PFLAG_3PCC_PROXY) && sofia_test_flag(tech_pvt, TFLAG_3PCC)) {
 				sofia_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA);
 				switch_channel_mark_pre_answered(channel);
 				status = SWITCH_STATUS_SUCCESS;
-				switch_log_printf(SWITCH_CHANNEL_ID_LOG, msg->_file, msg->_func, msg->_line, NULL, SWITCH_LOG_INFO, 
+				switch_log_printf(SWITCH_CHANNEL_ID_LOG, msg->_file, msg->_func, msg->_line, NULL, SWITCH_LOG_INFO,
 								  "Pretending to send early media.  Not available for 3pcc calls\n");
 				goto end_lock;
 			}
@@ -1667,9 +1856,9 @@
 						sofia_glue_tech_set_local_sdp(tech_pvt, sdp, SWITCH_TRUE);
 					}
 					if (switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
-						
+
 						sofia_glue_tech_patch_sdp(tech_pvt);
-						
+
 						if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
 							status = SWITCH_STATUS_FALSE;
 							goto end_lock;
@@ -1684,8 +1873,8 @@
 							tech_pvt->num_codecs = 0;
 							sofia_glue_tech_prepare_codecs(tech_pvt);
 							if (zstr(r_sdp) || sofia_glue_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
-								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, 
-												  "CODEC NEGOTIATION ERROR.  SDP:\n%s\n", r_sdp ? r_sdp : "NO SDP!"); 
+								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR,
+												  "CODEC NEGOTIATION ERROR.  SDP:\n%s\n", r_sdp ? r_sdp : "NO SDP!");
 								switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
 								//nua_respond(tech_pvt->nh, SIP_488_NOT_ACCEPTABLE, TAG_END());
 								status = SWITCH_STATUS_FALSE;
@@ -1718,20 +1907,37 @@
 
 				if (!sofia_test_flag(tech_pvt, TFLAG_BYE)) {
 					char *extra_header = sofia_glue_get_extra_headers(channel, SOFIA_SIP_PROGRESS_HEADER_PREFIX);
-					nua_respond(tech_pvt->nh,
-								SIP_183_SESSION_PROGRESS,
-								NUTAG_AUTOANSWER(0),
-								TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
-								SIPTAG_HEADER_STR(generate_pai_str(session)),
-								SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-								SOATAG_REUSE_REJECTED(1),
-								SOATAG_ORDERED_USER(1),
-								SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip),
-								SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), 
-								TAG_IF(!zstr(extra_header), SIPTAG_HEADER_STR(extra_header)),
-								TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote), 
-									   SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT)),
-								TAG_END());
+
+					if (sofia_use_soa(tech_pvt)) {
+						nua_respond(tech_pvt->nh,
+									SIP_183_SESSION_PROGRESS,
+									NUTAG_AUTOANSWER(0),
+									TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
+									SIPTAG_HEADER_STR(generate_pai_str(session)),
+									SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+									SOATAG_REUSE_REJECTED(1),
+									SOATAG_ORDERED_USER(1),
+									SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip),
+									SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"),
+									TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
+									TAG_IF(!zstr(extra_header), SIPTAG_HEADER_STR(extra_header)),
+									TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
+										   SIPTAG_HEADER_STR("X-FS-Support: " FREESWITCH_SUPPORT)), TAG_END());
+					} else {
+						nua_respond(tech_pvt->nh,
+									SIP_183_SESSION_PROGRESS,
+									NUTAG_AUTOANSWER(0),
+									NUTAG_MEDIA_ENABLE(0),
+									TAG_IF(sticky, NUTAG_PROXY(tech_pvt->record_route)),
+									SIPTAG_HEADER_STR(generate_pai_str(session)),
+									SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+									SIPTAG_CONTENT_TYPE_STR("application/sdp"),
+									SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str),
+									TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
+									TAG_IF(!zstr(extra_header), SIPTAG_HEADER_STR(extra_header)),
+									TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote),
+										   SIPTAG_HEADER_STR("X-FS-Support: " FREESWITCH_SUPPORT)), TAG_END());
+					}
 					switch_safe_free(extra_header);
 				}
 			}
@@ -1741,7 +1947,7 @@
 		break;
 	}
 
- end_lock:
+  end_lock:
 
 	if (msg->message_id == SWITCH_MESSAGE_INDICATE_ANSWER || msg->message_id == SWITCH_MESSAGE_INDICATE_PROGRESS) {
 		sofia_send_callee_id(session, NULL, NULL);
@@ -1786,7 +1992,7 @@
 
 typedef switch_status_t (*sofia_command_t) (char **argv, int argc, switch_stream_handle_t *stream);
 
-static const char *sofia_state_names[] = { 
+static const char *sofia_state_names[] = {
 	"UNREGED",
 	"TRYING",
 	"REGISTER",
@@ -1799,7 +2005,7 @@
 	NULL
 };
 
-const char * sofia_state_string(int state) 
+const char *sofia_state_string(int state)
 {
 	return sofia_state_names[state];
 }
@@ -1851,7 +2057,7 @@
 	switch_time_exp_t tm;
 	const int buflen = 2048;
 	char xmlbuf[2048];
-  
+
 	if (argv[6]) {
 		switch_time_t etime = atoi(argv[6]);
 		switch_size_t retsize;
@@ -1873,9 +2079,9 @@
 							   "        <sip-auth-user>%s</sip-auth-user>\n"
 							   "        <sip-auth-realm>%s</sip-auth-realm>\n"
 							   "        <mwi-account>%s@%s</mwi-account>\n"
-							   "    </registration>\n", 
-							   switch_str_nil(argv[0]), switch_str_nil(argv[1]), switch_str_nil(argv[2]), 
-							   switch_amp_encode(switch_str_nil(argv[3]),xmlbuf,buflen),
+							   "    </registration>\n",
+							   switch_str_nil(argv[0]), switch_str_nil(argv[1]), switch_str_nil(argv[2]),
+							   switch_amp_encode(switch_str_nil(argv[3]), xmlbuf, buflen),
 							   switch_str_nil(argv[7]), switch_str_nil(argv[4]), switch_str_nil(argv[5]), exp_buf, switch_str_nil(argv[11]),
 							   switch_str_nil(argv[12]), switch_str_nil(argv[13]), switch_str_nil(argv[14]), switch_str_nil(argv[15]),
 							   switch_str_nil(argv[16]), switch_str_nil(argv[17]));
@@ -1884,6 +2090,7 @@
 
 static const char *status_names[] = { "DOWN", "UP", NULL };
 
+
 static switch_status_t cmd_status(char **argv, int argc, switch_stream_handle_t *stream)
 {
 	sofia_profile_t *profile = NULL;
@@ -1900,6 +2107,7 @@
 			stream->write_function(stream, "Invalid Syntax!\n");
 			return SWITCH_STATUS_SUCCESS;
 		}
+
 		if (!strcasecmp(argv[0], "gateway")) {
 			if ((gp = sofia_reg_find_gateway(argv[1]))) {
 				switch_assert(gp->state < REG_STATE_LAST);
@@ -1941,28 +2149,28 @@
 					stream->write_function(stream, "Name             \t%s\n", switch_str_nil(argv[1]));
 					stream->write_function(stream, "Domain Name      \t%s\n", profile->domain_name ? profile->domain_name : "N/A");
 					if (strcasecmp(argv[1], profile->name)) {
-					stream->write_function(stream, "Alias Of         \t%s\n", switch_str_nil(profile->name));
+						stream->write_function(stream, "Alias Of         \t%s\n", switch_str_nil(profile->name));
 					}
-					stream->write_function(stream, "DBName           \t%s\n", switch_str_nil(profile->dbname));
+					stream->write_function(stream, "Auto-NAT         \t%s\n", sofia_test_pflag(profile, PFLAG_AUTO_NAT) ? "true" : "false");
+					stream->write_function(stream, "DBName           \t%s\n", profile->dbname ? profile->dbname : switch_str_nil(profile->odbc_dsn));
 					stream->write_function(stream, "Pres Hosts       \t%s\n", switch_str_nil(profile->presence_hosts));
 					stream->write_function(stream, "Dialplan         \t%s\n", switch_str_nil(profile->dialplan));
 					stream->write_function(stream, "Context          \t%s\n", switch_str_nil(profile->context));
-					stream->write_function(stream, "Challenge Realm  \t%s\n", 
-										   zstr(profile->challenge_realm) ? "auto_to" : profile->challenge_realm);
+					stream->write_function(stream, "Challenge Realm  \t%s\n", zstr(profile->challenge_realm) ? "auto_to" : profile->challenge_realm);
 					stream->write_function(stream, "RTP-IP           \t%s\n", switch_str_nil(profile->rtpip));
 					if (profile->extrtpip) {
-					stream->write_function(stream, "Ext-RTP-IP       \t%s\n", profile->extrtpip);
+						stream->write_function(stream, "Ext-RTP-IP       \t%s\n", profile->extrtpip);
 					}
 
 					stream->write_function(stream, "SIP-IP           \t%s\n", switch_str_nil(profile->sipip));
 					if (profile->extsipip) {
-					stream->write_function(stream, "Ext-SIP-IP       \t%s\n", profile->extsipip);
+						stream->write_function(stream, "Ext-SIP-IP       \t%s\n", profile->extsipip);
 					}
 					stream->write_function(stream, "URL              \t%s\n", switch_str_nil(profile->url));
 					stream->write_function(stream, "BIND-URL         \t%s\n", switch_str_nil(profile->bindurl));
 					if (sofia_test_pflag(profile, PFLAG_TLS)) {
-					stream->write_function(stream, "TLS-URL          \t%s\n", switch_str_nil(profile->tls_url));
-					stream->write_function(stream, "TLS-BIND-URL     \t%s\n", switch_str_nil(profile->tls_bindurl));
+						stream->write_function(stream, "TLS-URL          \t%s\n", switch_str_nil(profile->tls_url));
+						stream->write_function(stream, "TLS-BIND-URL     \t%s\n", switch_str_nil(profile->tls_bindurl));
 					}
 					stream->write_function(stream, "HOLD-MUSIC       \t%s\n", zstr(profile->hold_music) ? "N/A" : profile->hold_music);
 					stream->write_function(stream, "OUTBOUND-PROXY   \t%s\n", zstr(profile->outbound_proxy) ? "N/A" : profile->outbound_proxy);
@@ -1971,11 +2179,11 @@
 
 					stream->write_function(stream, "TEL-EVENT        \t%d\n", profile->te);
 					if (profile->dtmf_type == DTMF_2833) {
-					stream->write_function(stream, "DTMF-MODE        \trfc2833\n");
+						stream->write_function(stream, "DTMF-MODE        \trfc2833\n");
 					} else if (profile->dtmf_type == DTMF_INFO) {
-					stream->write_function(stream, "DTMF-MODE        \tinfo\n");
+						stream->write_function(stream, "DTMF-MODE        \tinfo\n");
 					} else {
-					stream->write_function(stream, "DTMF-MODE        \tnone\n");
+						stream->write_function(stream, "DTMF-MODE        \tnone\n");
 					}
 					stream->write_function(stream, "CNG              \t%d\n", profile->cng_pt);
 					stream->write_function(stream, "SESSION-TO       \t%d\n", profile->session_timeout);
@@ -1983,9 +2191,16 @@
 					stream->write_function(stream, "NOMEDIA          \t%s\n", sofia_test_flag(profile, TFLAG_INB_NOMEDIA) ? "true" : "false");
 					stream->write_function(stream, "LATE-NEG         \t%s\n", sofia_test_flag(profile, TFLAG_LATE_NEGOTIATION) ? "true" : "false");
 					stream->write_function(stream, "PROXY-MEDIA      \t%s\n", sofia_test_flag(profile, TFLAG_PROXY_MEDIA) ? "true" : "false");
-					stream->write_function(stream, "AGGRESSIVENAT    \t%s\n", sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ? "true" : "false");
+					stream->write_function(stream, "AGGRESSIVENAT    \t%s\n",
+										   sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ? "true" : "false");
 					stream->write_function(stream, "STUN-ENABLED     \t%s\n", sofia_test_pflag(profile, PFLAG_STUN_ENABLED) ? "true" : "false");
 					stream->write_function(stream, "STUN-AUTO-DISABLE\t%s\n", sofia_test_pflag(profile, PFLAG_STUN_AUTO_DISABLE) ? "true" : "false");
+					if (profile->user_agent_filter) {
+						stream->write_function(stream, "USER-AGENT-FILTER\t%s\n", switch_str_nil(profile->user_agent_filter));
+					}
+					if (profile->max_registrations_perext > 0) {
+						stream->write_function(stream, "MAX-REG-PEREXT   \t%d\n", profile->max_registrations_perext);
+					}
 					stream->write_function(stream, "CALLS-IN         \t%d\n", profile->ib_calls);
 					stream->write_function(stream, "FAILED-CALLS-IN  \t%d\n", profile->ib_failed_calls);
 					stream->write_function(stream, "CALLS-OUT        \t%d\n", profile->ob_calls);
@@ -1995,20 +2210,18 @@
 
 				cb.profile = profile;
 				cb.stream = stream;
-				
+
 				if (!sql && argv[2] && !strcasecmp(argv[2], "pres") && argv[3]) {
 					sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,"
-							"rpid,expires,user_agent,server_user,server_host,profile_name,hostname,"
-							"network_ip,network_port,sip_username,sip_realm,mwi_user,mwi_host"
-							" from sip_registrations where profile_name='%q' and presence_hosts like '%%%q%%'", 
-							profile->name, argv[3]);
+										 "rpid,expires,user_agent,server_user,server_host,profile_name,hostname,"
+										 "network_ip,network_port,sip_username,sip_realm,mwi_user,mwi_host"
+										 " from sip_registrations where profile_name='%q' and presence_hosts like '%%%q%%'", profile->name, argv[3]);
 				}
 				if (!sql && argv[2] && !strcasecmp(argv[2], "reg") && argv[3]) {
 					sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,"
-							"rpid,expires,user_agent,server_user,server_host,profile_name,hostname,"
-							"network_ip,network_port,sip_username,sip_realm,mwi_user,mwi_host"
-							" from sip_registrations where profile_name='%q' and contact like '%%%q%%'", 
-							profile->name, argv[3]);
+										 "rpid,expires,user_agent,server_user,server_host,profile_name,hostname,"
+										 "network_ip,network_port,sip_username,sip_realm,mwi_user,mwi_host"
+										 " from sip_registrations where profile_name='%q' and contact like '%%%q%%'", profile->name, argv[3]);
 				}
 				if (!sql && argv[2] && !strcasecmp(argv[2], "user") && argv[3]) {
 					char *dup = strdup(argv[3]);
@@ -2024,7 +2237,7 @@
 						host = dup;
 					}
 
-					if (zstr(user) ) {
+					if (zstr(user)) {
 						sqlextra = switch_mprintf("(sip_host='%q')", host);
 					} else if (zstr(host)) {
 						sqlextra = switch_mprintf("(sip_user='%q')", user);
@@ -2033,10 +2246,9 @@
 					}
 
 					sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,"
-							"rpid,expires,user_agent,server_user,server_host,profile_name,hostname,"
-							"network_ip,network_port,sip_username,sip_realm,mwi_user,mwi_host"
-							" from sip_registrations where profile_name='%q' and %s",
-							profile->name, sqlextra);
+										 "rpid,expires,user_agent,server_user,server_host,profile_name,hostname,"
+										 "network_ip,network_port,sip_username,sip_realm,mwi_user,mwi_host"
+										 " from sip_registrations where profile_name='%q' and %s", profile->name, sqlextra);
 					switch_safe_free(dup);
 					switch_safe_free(sqlextra);
 				}
@@ -2045,8 +2257,7 @@
 					sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,"
 										 "rpid,expires,user_agent,server_user,server_host,profile_name,hostname,"
 										 "network_ip,network_port,sip_username,sip_realm,mwi_user,mwi_host"
-										 " from sip_registrations where profile_name='%q'", 
-										 profile->name);
+										 " from sip_registrations where profile_name='%q'", profile->name);
 				}
 
 				sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, show_reg_callback, &cb);
@@ -2120,9 +2331,9 @@
 	char xmlbuf[2096];
 	int c = 0;
 	int ac = 0;
-  const char *header = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
-	
-  if (argc > 0) {
+	const char *header = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>";
+
+	if (argc > 0) {
 		if (argc == 1) {
 			stream->write_function(stream, "Invalid Syntax!\n");
 			return SWITCH_STATUS_SUCCESS;
@@ -2138,9 +2349,9 @@
 				stream->write_function(stream, "    <realm>%s</realm>\n", switch_str_nil(gp->register_realm));
 				stream->write_function(stream, "    <username>%s</username>\n", switch_str_nil(gp->register_username));
 				stream->write_function(stream, "    <password>%s</password>\n", zstr(gp->register_password) ? "no" : "yes");
-				stream->write_function(stream, "    <from>%s</from>\n", switch_amp_encode(switch_str_nil(gp->register_from),xmlbuf,buflen));
-				stream->write_function(stream, "    <contact>%s</contact>\n", switch_amp_encode(switch_str_nil(gp->register_contact),xmlbuf,buflen));
-				stream->write_function(stream, "    <exten>%s</exten>\n", switch_amp_encode(switch_str_nil(gp->extension),xmlbuf,buflen));
+				stream->write_function(stream, "    <from>%s</from>\n", switch_amp_encode(switch_str_nil(gp->register_from), xmlbuf, buflen));
+				stream->write_function(stream, "    <contact>%s</contact>\n", switch_amp_encode(switch_str_nil(gp->register_contact), xmlbuf, buflen));
+				stream->write_function(stream, "    <exten>%s</exten>\n", switch_amp_encode(switch_str_nil(gp->extension), xmlbuf, buflen));
 				stream->write_function(stream, "    <to>%s</to>\n", switch_str_nil(gp->register_to));
 				stream->write_function(stream, "    <proxy>%s</proxy>\n", switch_str_nil(gp->register_proxy));
 				stream->write_function(stream, "    <context>%s</context>\n", switch_str_nil(gp->register_context));
@@ -2172,11 +2383,12 @@
 					if (strcasecmp(argv[1], profile->name)) {
 						stream->write_function(stream, "    <alias-of>%s</alias-of>\n", switch_str_nil(profile->name));
 					}
-					stream->write_function(stream, "    <db-name>%s</db-name>\n", switch_str_nil(profile->dbname));
+					stream->write_function(stream, "    <auto-nat>%s</auto-nat>\n", sofia_test_pflag(profile, PFLAG_AUTO_NAT) ? "true" : "false");
+					stream->write_function(stream, "    <db-name>%s</db-name>\n", profile->dbname ? profile->dbname : switch_str_nil(profile->odbc_dsn));
 					stream->write_function(stream, "    <pres-hosts>%s</pres-hosts>\n", switch_str_nil(profile->presence_hosts));
 					stream->write_function(stream, "    <dialplan>%s</dialplan>\n", switch_str_nil(profile->dialplan));
 					stream->write_function(stream, "    <context>%s</context>\n", switch_str_nil(profile->context));
-					stream->write_function(stream, "    <challenge-realm>%s</challenge-realm>\n", 
+					stream->write_function(stream, "    <challenge-realm>%s</challenge-realm>\n",
 										   zstr(profile->challenge_realm) ? "auto_to" : profile->challenge_realm);
 					stream->write_function(stream, "    <rtp-ip>%s</rtp-ip>\n", switch_str_nil(profile->rtpip));
 					stream->write_function(stream, "    <ext-rtp-ip>%s</ext-rtp-ip>\n", profile->extrtpip);
@@ -2187,7 +2399,8 @@
 					stream->write_function(stream, "    <tls-url>%s</tls-url>\n", switch_str_nil(profile->tls_url));
 					stream->write_function(stream, "    <tls-bind-url>%s</tls-bind-url>\n", switch_str_nil(profile->tls_bindurl));
 					stream->write_function(stream, "    <hold-music>%s</hold-music>\n", zstr(profile->hold_music) ? "N/A" : profile->hold_music);
-					stream->write_function(stream, "    <outbound-proxy>%s</outbound-proxy>\n", zstr(profile->outbound_proxy) ? "N/A" : profile->outbound_proxy);
+					stream->write_function(stream, "    <outbound-proxy>%s</outbound-proxy>\n",
+										   zstr(profile->outbound_proxy) ? "N/A" : profile->outbound_proxy);
 					stream->write_function(stream, "    <inbound-codecs>%s</inbound-codecs>\n", switch_str_nil(profile->inbound_codec_string));
 					stream->write_function(stream, "    <outbound-codecs>%s</outbound-codecs>\n", switch_str_nil(profile->outbound_codec_string));
 
@@ -2201,11 +2414,15 @@
 					stream->write_function(stream, "    <nomedia>%s</nomedia>\n", sofia_test_flag(profile, TFLAG_INB_NOMEDIA) ? "true" : "false");
 					stream->write_function(stream, "    <late-neg>%s</late-neg>\n", sofia_test_flag(profile, TFLAG_LATE_NEGOTIATION) ? "true" : "false");
 					stream->write_function(stream, "    <proxy-media>%s</proxy-media>\n", sofia_test_flag(profile, TFLAG_PROXY_MEDIA) ? "true" : "false");
-					stream->write_function(stream, "    <aggressive-nat>%s</aggressive-nat>\n", 
+					stream->write_function(stream, "    <aggressive-nat>%s</aggressive-nat>\n",
 										   sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION) ? "true" : "false");
-					stream->write_function(stream, "    <stun-enabled>%s</stun-enabled>\n", sofia_test_pflag(profile, PFLAG_STUN_ENABLED) ? "true" : "false");
-					stream->write_function(stream, "    <stun-auto-disable>%s</stun-auto-disable>\n", 
+					stream->write_function(stream, "    <stun-enabled>%s</stun-enabled>\n",
+										   sofia_test_pflag(profile, PFLAG_STUN_ENABLED) ? "true" : "false");
+					stream->write_function(stream, "    <stun-auto-disable>%s</stun-auto-disable>\n",
 										   sofia_test_pflag(profile, PFLAG_STUN_AUTO_DISABLE) ? "true" : "false");
+					stream->write_function(stream, "    <user-agent-filter>%s</user-agent-filter>\n", switch_str_nil(profile->user_agent_filter));
+					stream->write_function(stream, "    <max-registrations-per-extension>%d</max-registrations-per-extension>\n",
+										   profile->max_registrations_perext);
 					stream->write_function(stream, "    <calls-in>%d</calls-in>\n", profile->ib_calls);
 					stream->write_function(stream, "    <calls-out>%d</calls-out>\n", profile->ob_calls);
 					stream->write_function(stream, "    <failed-calls-in>%d</failed-calls-in>\n", profile->ib_failed_calls);
@@ -2220,18 +2437,16 @@
 				if (!sql && argv[2] && !strcasecmp(argv[2], "pres") && argv[3]) {
 
 					sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,"
-							"rpid,expires,user_agent,server_user,server_host,profile_name,hostname,"
-							"network_ip,network_port,sip_username,sip_realm,mwi_user,mwi_host"
-							" from sip_registrations where profile_name='%q' and presence_hosts like '%%%q%%'", 
-							profile->name, argv[3]);
+										 "rpid,expires,user_agent,server_user,server_host,profile_name,hostname,"
+										 "network_ip,network_port,sip_username,sip_realm,mwi_user,mwi_host"
+										 " from sip_registrations where profile_name='%q' and presence_hosts like '%%%q%%'", profile->name, argv[3]);
 				}
 				if (!sql && argv[2] && !strcasecmp(argv[2], "reg") && argv[3]) {
 
 					sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,"
-							"rpid,expires,user_agent,server_user,server_host,profile_name,hostname,"
-							"network_ip,network_port,sip_username,sip_realm,mwi_user,mwi_host"
-							" from sip_registrations where profile_name='%q' and contact like '%%%q%%'", 
-							profile->name, argv[3]);
+										 "rpid,expires,user_agent,server_user,server_host,profile_name,hostname,"
+										 "network_ip,network_port,sip_username,sip_realm,mwi_user,mwi_host"
+										 " from sip_registrations where profile_name='%q' and contact like '%%%q%%'", profile->name, argv[3]);
 				}
 				if (!sql && argv[2] && !strcasecmp(argv[2], "user") && argv[3]) {
 					char *dup = strdup(argv[3]);
@@ -2256,10 +2471,9 @@
 					}
 
 					sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,"
-							"rpid,expires,user_agent,server_user,server_host,profile_name,hostname,"
-							"network_ip,network_port,sip_username,sip_realm,mwi_user,mwi_host"
-							" from sip_registrations where profile_name='%q' and %s",
-							profile->name, sqlextra);
+										 "rpid,expires,user_agent,server_user,server_host,profile_name,hostname,"
+										 "network_ip,network_port,sip_username,sip_realm,mwi_user,mwi_host"
+										 " from sip_registrations where profile_name='%q' and %s", profile->name, sqlextra);
 					switch_safe_free(dup);
 					switch_safe_free(sqlextra);
 				}
@@ -2268,8 +2482,7 @@
 					sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,"
 										 "rpid,expires,user_agent,server_user,server_host,profile_name,hostname,"
 										 "network_ip,network_port,sip_username,sip_realm,mwi_user,mwi_host"
-										 " from sip_registrations where profile_name='%q'", 
-										 profile->name);
+										 " from sip_registrations where profile_name='%q'", profile->name);
 				}
 
 				sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, show_reg_callback_xml, &cb);
@@ -2289,8 +2502,8 @@
 		return SWITCH_STATUS_SUCCESS;
 	}
 
-  stream->write_function(stream, "%s\n", header);
-  stream->write_function(stream, "<profiles>\n");
+	stream->write_function(stream, "%s\n", header);
+	stream->write_function(stream, "<profiles>\n");
 	switch_mutex_lock(mod_sofia_globals.hash_mutex);
 	for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
 		switch_hash_this(hi, &vvar, NULL, &val);
@@ -2299,21 +2512,26 @@
 
 			if (strcmp(vvar, profile->name)) {
 				ac++;
-				stream->write_function(stream, "<alias>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s</state>\n</alias>\n", vvar, "alias", profile->name, "ALIASED");
+				stream->write_function(stream, "<alias>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s</state>\n</alias>\n", vvar, "alias",
+									   profile->name, "ALIASED");
 			} else {
-				stream->write_function(stream, "<profile>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s (%u)</state>\n</profile>\n", profile->name, "profile", profile->url,
-									   sofia_test_pflag(profile, PFLAG_RUNNING) ? "RUNNING" : "DOWN", profile->inuse);
+				stream->write_function(stream, "<profile>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s (%u)</state>\n</profile>\n",
+									   profile->name, "profile", profile->url, sofia_test_pflag(profile, PFLAG_RUNNING) ? "RUNNING" : "DOWN",
+									   profile->inuse);
 
 				if (sofia_test_pflag(profile, PFLAG_TLS)) {
-					stream->write_function(stream, "<profile>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s (%u) (TLS)</state>\n</profile>\n", profile->name, "profile", profile->tls_url,
-										   sofia_test_pflag(profile, PFLAG_RUNNING) ? "RUNNING" : "DOWN", profile->inuse);
+					stream->write_function(stream,
+										   "<profile>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s (%u) (TLS)</state>\n</profile>\n",
+										   profile->name, "profile", profile->tls_url, sofia_test_pflag(profile, PFLAG_RUNNING) ? "RUNNING" : "DOWN",
+										   profile->inuse);
 				}
 
 				c++;
 
 				for (gp = profile->gateways; gp; gp = gp->next) {
 					switch_assert(gp->state < REG_STATE_LAST);
-					stream->write_function(stream, "<gateway>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s</state>\n</gateway>\n", gp->name, "gateway", gp->register_to, sofia_state_names[gp->state]);
+					stream->write_function(stream, "<gateway>\n<name>%s</name>\n<type>%s</type>\n<data>%s</data>\n<state>%s</state>\n</gateway>\n",
+										   gp->name, "gateway", gp->register_to, sofia_state_names[gp->state]);
 					if (gp->state == REG_STATE_FAILED || gp->state == REG_STATE_TRYING) {
 						time_t now = switch_epoch_time_now(NULL);
 						if (gp->retry > now) {
@@ -2363,7 +2581,7 @@
 		sofia_glue_restart_all_profiles();
 		return SWITCH_STATUS_SUCCESS;
 	}
-	
+
 	if (zstr(profile_name) || !(profile = sofia_glue_find_profile(profile_name))) {
 		stream->write_function(stream, "Invalid Profile [%s]", switch_str_nil(profile_name));
 		return SWITCH_STATUS_SUCCESS;
@@ -2376,7 +2594,7 @@
 			goto done;
 		}
 
-		if ((gateway_ptr = sofia_reg_find_gateway(argv[2]))) { 			
+		if ((gateway_ptr = sofia_reg_find_gateway(argv[2]))) {
 			sofia_glue_del_gateway(gateway_ptr);
 			sofia_reg_release_gateway(gateway_ptr);
 			stream->write_function(stream, "+OK gateway marked for deletion.\n");
@@ -2398,7 +2616,7 @@
 		}
 
 		stream->write_function(stream, "+OK stun-auto-disable=%s", sofia_test_pflag(profile, PFLAG_STUN_AUTO_DISABLE) ? "true" : "false");
-		
+
 		goto done;
 	}
 
@@ -2413,7 +2631,7 @@
 		}
 
 		stream->write_function(stream, "+OK stun-enabled=%s", sofia_test_pflag(profile, PFLAG_STUN_ENABLED) ? "true" : "false");
-		
+
 		goto done;
 	}
 
@@ -2426,7 +2644,7 @@
 			}
 			stream->write_function(stream, "Reload XML [%s]\n", err);
 		}
-			
+
 		if (reconfig_sofia(profile) == SWITCH_STATUS_SUCCESS) {
 			stream->write_function(stream, "+OK scan complete\n");
 		} else {
@@ -2540,7 +2758,7 @@
 		}
 		goto done;
 	}
-	
+
 	if (!strcasecmp(argv[1], "siptrace")) {
 		if (argc > 2) {
 			int value = switch_true(argv[2]);
@@ -2567,7 +2785,7 @@
 	struct cb_helper *cb = (struct cb_helper *) pArg;
 	char *contact;
 
-	if (!zstr(argv[0]) && (contact = sofia_glue_get_url_from_contact(argv[0], 1)) ) {
+	if (!zstr(argv[0]) && (contact = sofia_glue_get_url_from_contact(argv[0], 1))) {
 		cb->stream->write_function(cb->stream, "%ssofia/%s/sip:%s,", argv[2], argv[1], sofia_glue_strip_proto(contact));
 		free(contact);
 	}
@@ -2586,7 +2804,7 @@
 	sofia_profile_t *profile = NULL;
 	const char *exclude_contact = NULL;
 	char *reply = "error/facility_not_subscribed";
-	
+
 	if (!cmd) {
 		stream->write_function(stream, "%s", "");
 		return SWITCH_STATUS_SUCCESS;
@@ -2611,13 +2829,12 @@
 
 	if ((domain = strchr(user, '@'))) {
 		*domain++ = '\0';
-		if ( (concat = strchr( domain, '/')) ) {
-		    *concat++ = '\0';
+		if ((concat = strchr(domain, '/'))) {
+			*concat++ = '\0';
 		}
-	}
-	else {
-		if ( (concat = strchr( user, '/')) ) {
-		    *concat++ = '\0';
+	} else {
+		if ((concat = strchr(user, '/'))) {
+			*concat++ = '\0';
 		}
 	}
 
@@ -2653,12 +2870,11 @@
 			if (exclude_contact) {
 				sql = switch_mprintf("select contact, profile_name, '%q' "
 									 "from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%') "
-									 "and contact not like '%%%s%%'",
-									 ( concat != NULL ) ? concat : "", user, domain, domain, exclude_contact);
+									 "and contact not like '%%%s%%'", (concat != NULL) ? concat : "", user, domain, domain, exclude_contact);
 			} else {
 				sql = switch_mprintf("select contact, profile_name, '%q' "
-									 "from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')", 
-									 ( concat != NULL ) ? concat : "", user, domain, domain);
+									 "from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')",
+									 (concat != NULL) ? concat : "", user, domain, domain);
 			}
 
 			switch_assert(sql);
@@ -2675,7 +2891,7 @@
 
 			stream->write_function(stream, "%s", reply);
 			reply = NULL;
-			
+
 			switch_safe_free(mystream.data);
 		}
 	}
@@ -2702,7 +2918,7 @@
 	sofia_gateway_t *gateway;
 	char *gwname, *param, *varname;
 	const char *val = NULL;
-	
+
 	if (zstr(cmd)) {
 		stream->write_function(stream, "-ERR Parameter missing\n");
 		return SWITCH_STATUS_SUCCESS;
@@ -2710,27 +2926,27 @@
 	if (!(mydata = strdup(cmd))) {
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	if (!(argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) || !argv[0]) {
 		goto end;
 	}
-	
+
 	gwname = argv[0];
 	param = argv[1];
 	varname = argv[2];
-	
+
 	if (zstr(gwname) || zstr(param) || zstr(varname)) {
 		goto end;
 	}
-	
+
 	if (!(gateway = sofia_reg_find_gateway(gwname))) {
 		goto end;
 	}
-	
+
 	if (!strcasecmp(param, "ivar") && gateway->ib_vars && (val = switch_event_get_header(gateway->ib_vars, varname))) {
 		stream->write_function(stream, "%s", val);
 	} else if (!strcasecmp(param, "ovar") && gateway->ob_vars && (val = switch_event_get_header(gateway->ob_vars, varname))) {
-		stream->write_function(stream, "%s", val);		
+		stream->write_function(stream, "%s", val);
 	} else if (!strcasecmp(param, "var")) {
 		if (gateway->ib_vars && (val = switch_event_get_header(gateway->ib_vars, varname))) {
 			stream->write_function(stream, "%s", val);
@@ -2738,10 +2954,10 @@
 			stream->write_function(stream, "%s", val);
 		}
 	}
-	
+
 	sofia_reg_release_gateway(gateway);
-	
-end:
+
+  end:
 	switch_safe_free(mydata);
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -2758,9 +2974,10 @@
 		"--------------------------------------------------------------------------------\n"
 		"sofia help\n"
 		"sofia profile <profile_name> [[start|stop|restart|rescan] [reloadxml]|flush_inbound_reg [<call_id>] [reboot]|[register|unregister] [<gateway name>|all]|killgw <gateway name>|[stun-auto-disable|stun-enabled] [true|false]]|siptrace [on|off]\n"
-		"sofia status profile <name> [ reg <contact str> ] | [ pres <pres str> ] | [ user <user@domain> ]\n"
-		"sofia status gateway <name>\n"
+		"sofia status|xmlstatus profile <name> [ reg <contact str> ] | [ pres <pres str> ] | [ user <user@domain> ]\n"
+		"sofia status|xmlstatus gateway <name>\n"
 		"sofia loglevel <all|default|tport|iptsec|nea|nta|nth_client|nth_server|nua|soa|sresolv|stun> [0-9]\n"
+		"sofia tracelevel <console|alert|crit|err|warning|notice|info|debug>\n"
 		"--------------------------------------------------------------------------------\n";
 
 	if (session) {
@@ -2793,7 +3010,7 @@
 			mod_sofia_globals.tracelevel = switch_log_str2level(argv[1]);
 		}
 		stream->write_function(stream, "+OK tracelevel is %s", switch_log_level2str(mod_sofia_globals.tracelevel));
-        goto done;
+		goto done;
 	} else if (!strcasecmp(argv[0], "loglevel")) {
 		if (argc > 2 && argv[2] && switch_is_number(argv[2])) {
 			int level = atoi(argv[2]);
@@ -2816,6 +3033,20 @@
 	} else if (!strcasecmp(argv[0], "help")) {
 		stream->write_function(stream, "%s", usage_string);
 		goto done;
+	} else if (!strcasecmp(argv[0], "recover")) {
+		if (argv[1] && !strcasecmp(argv[1], "flush")) {
+			sofia_glue_recover(SWITCH_TRUE);
+			stream->write_function(stream, "Flushing recovery database.\n");
+		} else {
+			int x = sofia_glue_recover(SWITCH_FALSE);
+			if (x) {
+				stream->write_function(stream, "Recovered %d call(s)\n", x);
+			} else {
+				stream->write_function(stream, "No calls to recover.\n");
+			}
+		}
+
+		goto done;
 	}
 
 	if (func) {
@@ -2852,9 +3083,9 @@
 	/*.on_consume_media */ NULL,
 	/*.on_hibernate */ sofia_on_hibernate,
 	/*.on_reset */ sofia_on_reset,
-	/*.on_park*/ NULL,
-	/*.on_reporting*/ NULL,
-	/*.on_destroy*/ sofia_on_destroy
+	/*.on_park */ NULL,
+	/*.on_reporting */ NULL,
+	/*.on_destroy */ sofia_on_destroy
 };
 
 static switch_status_t sofia_manage(char *relative_oid, switch_management_action_t action, char *data, switch_size_t datalen)
@@ -2868,7 +3099,7 @@
 {
 	switch_call_cause_t cause = SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
 	switch_core_session_t *nsession = NULL;
-	char *data, *profile_name, *dest;//, *dest_num = NULL;
+	char *data, *profile_name, *dest;	//, *dest_num = NULL;
 	sofia_profile_t *profile = NULL;
 	switch_caller_profile_t *caller_profile = NULL;
 	private_object_t *tech_pvt = NULL;
@@ -2876,7 +3107,7 @@
 	char *host = NULL, *dest_to = NULL;
 	const char *hval = NULL;
 	char *not_const = NULL;
-		
+
 	*new_session = NULL;
 
 	if (!outbound_profile || zstr(outbound_profile->destination_number)) {
@@ -2991,7 +3222,7 @@
 		if ((host = switch_core_session_strdup(nsession, tech_pvt->dest))) {
 			char *pp = strchr(host, '@');
 			if (pp) {
-				host = pp+1;
+				host = pp + 1;
 			} else {
 				host = NULL;
 				dest_to = NULL;
@@ -3003,9 +3234,9 @@
 		} else {
 			tech_pvt->invite_contact = switch_core_session_strdup(nsession, gateway_ptr->register_contact);
 		}
-		
+
 		gateway_ptr->ob_calls++;
-		
+
 		if (!zstr(gateway_ptr->from_domain) && !switch_channel_get_variable(nchannel, "sip_invite_domain")) {
 			switch_channel_set_variable(nchannel, "sip_invite_domain", gateway_ptr->from_domain);
 		}
@@ -3013,10 +3244,10 @@
 		if (!zstr(gateway_ptr->outbound_sticky_proxy) && !switch_channel_get_variable(nchannel, "sip_route_uri")) {
 			switch_channel_set_variable(nchannel, "sip_route_uri", gateway_ptr->outbound_sticky_proxy);
 		}
-		
+
 		if (gateway_ptr->ob_vars) {
 			switch_event_header_t *hp;
-			for(hp = gateway_ptr->ob_vars->headers; hp; hp = hp->next) {
+			for (hp = gateway_ptr->ob_vars->headers; hp; hp = hp->next) {
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s setting variable [%s]=[%s]\n",
 								  switch_channel_get_name(nchannel), hp->name, hp->value);
 				switch_channel_set_variable(nchannel, hp->name, hp->value);
@@ -3104,29 +3335,28 @@
 	dest_num = switch_core_session_strdup(nsession, dest);
 	if ((p = strchr(dest_num, '@'))) {
 		*p = '\0';
-		
+
 		if ((p = strrchr(dest_num, '/'))) {
 			dest_num = p + 1;
-		} else if ((p = (char *)switch_stristr("sip:", dest_num))) {
+		} else if ((p = (char *) switch_stristr("sip:", dest_num))) {
 			dest_num = p + 4;
-		} else if ((p = (char *)switch_stristr("sips:", dest_num))) {
+		} else if ((p = (char *) switch_stristr("sips:", dest_num))) {
 			dest_num = p + 5;
 		}
 	}
 #endif
 
 	caller_profile = switch_caller_profile_clone(nsession, outbound_profile);
-	
-	
+
+
 	caller_profile->destination_number = switch_sanitize_number(caller_profile->destination_number);
-	not_const = (char *)caller_profile->caller_id_name;
+	not_const = (char *) caller_profile->caller_id_name;
 	caller_profile->caller_id_name = switch_sanitize_number(not_const);
-	not_const = (char *)caller_profile->caller_id_number;
+	not_const = (char *) caller_profile->caller_id_number;
 	caller_profile->caller_id_number = switch_sanitize_number(not_const);
-	
+
 	//caller_profile->destination_number = switch_core_strdup(caller_profile->pool, dest_num);
 	switch_channel_set_caller_profile(nchannel, caller_profile);
-	switch_channel_set_flag(nchannel, CF_OUTBOUND);
 	sofia_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
 	sofia_clear_flag_locked(tech_pvt, TFLAG_LATE_NEGOTIATION);
 	if (switch_channel_get_state(nchannel) == CS_NEW) {
@@ -3136,17 +3366,25 @@
 	*new_session = nsession;
 	cause = SWITCH_CAUSE_SUCCESS;
 
+	if ((hval = switch_event_get_header(var_event, "sip_enable_soa"))) {
+		if (switch_true(hval)) {
+			sofia_set_flag(tech_pvt, TFLAG_ENABLE_SOA);
+		} else {
+			sofia_clear_flag(tech_pvt, TFLAG_ENABLE_SOA);
+		}
+	}
+
 	if ((hval = switch_event_get_header(var_event, "sip_auto_answer")) && switch_true(hval)) {
 		switch_channel_set_variable_printf(nchannel, "sip_h_Call-Info", "<sip:%s>;answer-after=0", profile->sipip);
 		switch_channel_set_variable(nchannel, "sip_invite_params", "intercom=true");
 	}
 
-	if (((hval = switch_event_get_header(var_event, "effective_callee_id_name")) || 
+	if (((hval = switch_event_get_header(var_event, "effective_callee_id_name")) ||
 		 (hval = switch_event_get_header(var_event, "sip_callee_id_name"))) && !zstr(hval)) {
 		caller_profile->callee_id_name = switch_core_strdup(caller_profile->pool, hval);
 	}
 
-	if (((hval = switch_event_get_header(var_event, "effective_callee_id_number")) || 
+	if (((hval = switch_event_get_header(var_event, "effective_callee_id_number")) ||
 		 (hval = switch_event_get_header(var_event, "sip_callee_id_number"))) && !zstr(hval)) {
 		caller_profile->callee_id_number = switch_core_strdup(caller_profile->pool, hval);
 	}
@@ -3159,15 +3397,17 @@
 			switch_channel_set_variable_printf(nchannel, "sip_h_Call-Info", "<sip:%s>;answer-after=0", profile->sipip);
 			switch_channel_set_variable(nchannel, "sip_invite_params", "intercom=true");
 		}
-		
+
 		switch_ivr_transfer_variable(session, nsession, SOFIA_REPLACES_HEADER);
 		switch_ivr_transfer_variable(session, nsession, "sip_auto_answer");
-		switch_ivr_transfer_variable(session, nsession, SOFIA_SIP_HEADER_PREFIX_T);
+		if (!(vval = switch_channel_get_variable(o_channel, "sip_copy_custom_headers")) || switch_true(vval)) {
+			switch_ivr_transfer_variable(session, nsession, SOFIA_SIP_HEADER_PREFIX_T);
+		}
 		switch_ivr_transfer_variable(session, nsession, "sip_video_fmtp");
 		switch_ivr_transfer_variable(session, nsession, "sip-force-contact");
 		switch_ivr_transfer_variable(session, nsession, "sip_sticky_contact");
 		switch_ivr_transfer_variable(session, nsession, "sip_cid_type");
-		
+
 		if (switch_core_session_compare(session, nsession)) {
 			/* It's another sofia channel! so lets cache what they use as a pt for telephone event so 
 			   we can keep it the same
@@ -3178,6 +3418,12 @@
 			tech_pvt->bte = ctech_pvt->te;
 			tech_pvt->bcng_pt = ctech_pvt->cng_pt;
 			tech_pvt->cid_type = ctech_pvt->cid_type;
+
+			if (sofia_test_flag(tech_pvt, TFLAG_ENABLE_SOA)) {
+				sofia_set_flag(ctech_pvt, TFLAG_ENABLE_SOA);
+			} else {
+				sofia_clear_flag(ctech_pvt, TFLAG_ENABLE_SOA);
+			}
 		}
 
 		if (switch_channel_test_flag(o_channel, CF_PROXY_MEDIA)) {
@@ -3229,47 +3475,36 @@
 	char *es = argv[5];
 	char *body = argv[6];
 	char *id = NULL;
-	char *p , *contact;
+	char *p, *contact;
 
-	
+
 	if (profile_name && strcasecmp(profile_name, profile->name)) {
-        if ((ext_profile = sofia_glue_find_profile(profile_name))) {
-            profile = ext_profile;
-        }
-    }
+		if ((ext_profile = sofia_glue_find_profile(profile_name))) {
+			profile = ext_profile;
+		}
+	}
 
 	id = switch_mprintf("sip:%s@%s", user, host);
 	switch_assert(id);
 	contact = sofia_glue_get_url_from_contact(contact_in, 1);
-				
+
 	if ((p = strstr(contact, ";fs_"))) {
 		*p = '\0';
 	}
 
-	nh = nua_handle(profile->nua, 
-					NULL, 
-					NUTAG_URL(contact), 
-					SIPTAG_FROM_STR(id), 
-					SIPTAG_TO_STR(id), 
-					SIPTAG_CONTACT_STR(profile->url), 
-					TAG_END());
-				
+	nh = nua_handle(profile->nua, NULL, NUTAG_URL(contact), SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id), SIPTAG_CONTACT_STR(profile->url), TAG_END());
+
 	nua_handle_bind(nh, &mod_sofia_globals.destroy_private);
 
-	nua_notify(nh,
-			   NUTAG_NEWSUB(1),
-			   SIPTAG_EVENT_STR(es), 
-			   SIPTAG_CONTENT_TYPE_STR(ct), 
-			   TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)),
-			   TAG_END());
+	nua_notify(nh, NUTAG_NEWSUB(1), SIPTAG_EVENT_STR(es), SIPTAG_CONTENT_TYPE_STR(ct), TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)), TAG_END());
 
-				
+
 	free(id);
 	free(contact);
 
 	if (ext_profile) {
 		sofia_glue_release_profile(ext_profile);
-	}	
+	}
 
 	return 0;
 }
@@ -3293,17 +3528,17 @@
 
 
 			if (to_uri || from_uri) {
-				
+
 				if (!to_uri) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing To-URI header\n");
 					return;
 				}
-				
+
 				if (!from_uri) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing From-URI header\n");
 					return;
 				}
-				
+
 				if (!es) {
 					es = "message-summary";
 				}
@@ -3315,32 +3550,29 @@
 				if (!profile_name) {
 					profile_name = "default";
 				}
-				
+
 				if (!(profile = sofia_glue_find_profile(profile_name))) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find profile %s\n", profile_name);
 					return;
 				}
 
-				
+
 				if (to_uri && from_uri && ct && es && profile_name && (profile = sofia_glue_find_profile(profile_name))) {
-					nua_handle_t *nh = nua_handle(profile->nua, 
-												  NULL, 
-												  NUTAG_URL(to_uri), 
-												  SIPTAG_FROM_STR(from_uri), 
-												  SIPTAG_TO_STR(to_uri), 
-												  SIPTAG_CONTACT_STR(profile->url), 
+					nua_handle_t *nh = nua_handle(profile->nua,
+												  NULL,
+												  NUTAG_URL(to_uri),
+												  SIPTAG_FROM_STR(from_uri),
+												  SIPTAG_TO_STR(to_uri),
+												  SIPTAG_CONTACT_STR(profile->url),
 												  TAG_END());
-				
+
 					nua_handle_bind(nh, &mod_sofia_globals.destroy_private);
-				
+
 					nua_notify(nh,
 							   NUTAG_NEWSUB(1),
 							   NUTAG_WITH_THIS(profile->nua),
-							   SIPTAG_EVENT_STR(es), 
-							   TAG_IF(ct, SIPTAG_CONTENT_TYPE_STR(ct)),
-							   TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)),
-							   TAG_END());
-				
+							   SIPTAG_EVENT_STR(es), TAG_IF(ct, SIPTAG_CONTENT_TYPE_STR(ct)), TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)), TAG_END());
+
 					sofia_glue_release_profile(profile);
 				}
 
@@ -3355,10 +3587,7 @@
 					if ((tech_pvt = switch_core_session_get_private(session))) {
 						nua_notify(tech_pvt->nh,
 								   NUTAG_NEWSUB(1),
-								   SIPTAG_EVENT_STR(es), 
-								   SIPTAG_CONTENT_TYPE_STR(ct), 
-								   TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)),
-								   TAG_END());
+								   SIPTAG_EVENT_STR(es), SIPTAG_CONTENT_TYPE_STR(ct), TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)), TAG_END());
 					}
 					switch_core_session_rwunlock(session);
 				}
@@ -3367,24 +3596,23 @@
 
 				if (call_id) {
 					sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,'%q','%q','%q' "
-										 "from sip_registrations where call_id='%q'", ct, es, switch_str_nil(body), call_id
-										 );
+										 "from sip_registrations where call_id='%q'", ct, es, switch_str_nil(body), call_id);
 				} else {
 					if (!strcasecmp(es, "message-summary")) {
 						sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,'%q','%q','%q' "
-								"from sip_registrations where mwi_user='%s' and mwi_host='%q'",
-								ct, es, switch_str_nil(body), switch_str_nil(user), switch_str_nil(host)
-								);
+											 "from sip_registrations where mwi_user='%s' and mwi_host='%q'",
+											 ct, es, switch_str_nil(body), switch_str_nil(user), switch_str_nil(host)
+							);
 					} else {
 						sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,'%q','%q','%q' "
-								"from sip_registrations where sip_user='%s' and sip_host='%q'",
-								ct, es, switch_str_nil(body), switch_str_nil(user), switch_str_nil(host)
-								);
+											 "from sip_registrations where sip_user='%s' and sip_host='%q'",
+											 ct, es, switch_str_nil(body), switch_str_nil(user), switch_str_nil(host)
+							);
 
 					}
 				}
-				
 
+
 				switch_mutex_lock(profile->ireg_mutex);
 				sofia_glue_execute_sql_callback(profile, NULL, sql, notify_callback, profile);
 				switch_mutex_unlock(profile->ireg_mutex);
@@ -3392,7 +3620,7 @@
 
 				free(sql);
 			}
-			
+
 		}
 		break;
 	case SWITCH_EVENT_SEND_MESSAGE:
@@ -3425,26 +3653,17 @@
 
 				switch_assert(id);
 				contact = sofia_glue_get_url_from_contact(buf, 0);
-				
+
 				if ((p = strstr(contact, ";fs_"))) {
 					*p = '\0';
 				}
-				
-				nh = nua_handle(profile->nua, 
-								NULL, 
-								NUTAG_URL(contact), 
-								SIPTAG_FROM_STR(id), 
-								SIPTAG_TO_STR(id), 
-								SIPTAG_CONTACT_STR(profile->url), 
-								TAG_END());
-				
-				nua_message(nh,
-							NUTAG_NEWSUB(1),
- 							SIPTAG_CONTENT_TYPE_STR(ct), 
-							TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)),
-							TAG_END());
 
-				
+				nh = nua_handle(profile->nua,
+								NULL, NUTAG_URL(contact), SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id), SIPTAG_CONTACT_STR(profile->url), TAG_END());
+
+				nua_message(nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR(ct), TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)), TAG_END());
+
+
 				free(id);
 				sofia_glue_release_profile(profile);
 			}
@@ -3471,25 +3690,25 @@
 			char *p;
 
 			if (!profile_name) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Profile Name\n");
-                goto done;
-            }
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Profile Name\n");
+				goto done;
+			}
 
-            if (!call_id && !to_uri && !local_user_full) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing To-URI header\n");
-                goto done;
-            }
+			if (!call_id && !to_uri && !local_user_full) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing To-URI header\n");
+				goto done;
+			}
 
-            if (!call_id && !from_uri) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing From-URI header\n");
-                goto done;
-            }
+			if (!call_id && !from_uri) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing From-URI header\n");
+				goto done;
+			}
 
 
-            if (!(profile = sofia_glue_find_profile(profile_name))) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find profile %s\n", profile_name);
-                goto done;
-            }
+			if (!(profile = sofia_glue_find_profile(profile_name))) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find profile %s\n", profile_name);
+				goto done;
+			}
 
 			if (call_id) {
 				nh = nua_handle_by_call_id(profile->nua, call_id);
@@ -3505,28 +3724,23 @@
 					if ((local_host = strchr(local_user, '@'))) {
 						*local_host++ = '\0';
 					}
-					
+
 					if (!local_user || !local_host || !sofia_reg_find_reg_url(profile, local_user, local_host, buf, sizeof(buf))) {
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find local user\n");
 						goto done;
 					}
-					
+
 					to_uri = sofia_glue_get_url_from_contact(buf, 0);
-					
+
 					if ((p = strstr(to_uri, ";fs_"))) {
 						*p = '\0';
 					}
-					
+
 				}
 
-				nh = nua_handle(profile->nua, 
-								NULL, 
-								NUTAG_URL(to_uri), 
-								SIPTAG_FROM_STR(from_uri), 
-								SIPTAG_TO_STR(to_uri), 
-								SIPTAG_CONTACT_STR(profile->url), 
-								TAG_END());
-				
+				nh = nua_handle(profile->nua,
+								NULL, NUTAG_URL(to_uri), SIPTAG_FROM_STR(from_uri), SIPTAG_TO_STR(to_uri), SIPTAG_CONTACT_STR(profile->url), TAG_END());
+
 				nua_handle_bind(nh, &mod_sofia_globals.destroy_private);
 			}
 
@@ -3535,9 +3749,7 @@
 					 TAG_IF(ct, SIPTAG_CONTENT_TYPE_STR(ct)),
 					 TAG_IF(cd, SIPTAG_CONTENT_DISPOSITION_STR(cd)),
 					 TAG_IF(alert_info, SIPTAG_ALERT_INFO_STR(alert_info)),
-					 TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)),
-					 TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)),
-					 TAG_END());
+					 TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)), TAG_IF(!zstr(body), SIPTAG_PAYLOAD_STR(body)), TAG_END());
 
 			if (call_id && nh) {
 				nua_handle_unref(nh);
@@ -3546,11 +3758,11 @@
 			if (profile) {
 				sofia_glue_release_profile(profile);
 			}
-			
-		done:
 
+		  done:
+
 			switch_safe_free(local_dup);
-			
+
 		}
 		break;
 	case SWITCH_EVENT_TRAP:
@@ -3604,7 +3816,7 @@
 				switch_mutex_unlock(mod_sofia_globals.hash_mutex);
 				sofia_glue_restart_all_profiles();
 			}
-			
+
 		}
 		break;
 	default:
@@ -3612,6 +3824,105 @@
 	}
 }
 
+static switch_status_t list_profiles(const char *line, const char *cursor, switch_console_callback_match_t **matches)
+{
+	sofia_profile_t *profile = NULL;
+	switch_hash_index_t *hi;
+	void *val;
+	const void *vvar;
+	switch_console_callback_match_t *my_matches = NULL;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	switch_mutex_lock(mod_sofia_globals.hash_mutex);
+	for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+		switch_hash_this(hi, &vvar, NULL, &val);
+		profile = (sofia_profile_t *) val;
+		if (sofia_test_pflag(profile, PFLAG_RUNNING)) {
+			switch_console_push_match(&my_matches, (const char *) vvar);
+		}
+	}
+	switch_mutex_unlock(mod_sofia_globals.hash_mutex);
+
+	if (my_matches) {
+		*matches = my_matches;
+		status = SWITCH_STATUS_SUCCESS;
+	}
+
+
+	return status;
+}
+
+static switch_status_t list_gateways(const char *line, const char *cursor, switch_console_callback_match_t **matches)
+{
+	sofia_profile_t *profile = NULL;
+	switch_hash_index_t *hi;
+	void *val;
+	const void *vvar;
+	switch_console_callback_match_t *my_matches = NULL;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	switch_mutex_lock(mod_sofia_globals.hash_mutex);
+	for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+		switch_hash_this(hi, &vvar, NULL, &val);
+		profile = (sofia_profile_t *) val;
+		if (sofia_test_pflag(profile, PFLAG_RUNNING)) {
+			sofia_gateway_t *gp;
+			for (gp = profile->gateways; gp; gp = gp->next) {
+				switch_console_push_match(&my_matches, gp->name);
+			}
+		}
+	}
+	switch_mutex_unlock(mod_sofia_globals.hash_mutex);
+
+	if (my_matches) {
+		*matches = my_matches;
+		status = SWITCH_STATUS_SUCCESS;
+	}
+
+	return status;
+}
+
+
+static switch_status_t list_profile_gateway(const char *line, const char *cursor, switch_console_callback_match_t **matches)
+{
+	sofia_profile_t *profile = NULL;
+	switch_console_callback_match_t *my_matches = NULL;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+	char *dup = NULL;
+	int argc;
+	char *argv[4] = { 0 };
+
+	if (zstr(line)) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	dup = strdup(line);
+	argc = switch_split(dup, ' ', argv);
+
+	if (zstr(argv[2]) || !strcmp(argv[2], " ")) {
+		goto end;
+	}
+
+	if ((profile = sofia_glue_find_profile(argv[2]))) {
+		sofia_gateway_t *gp;
+		for (gp = profile->gateways; gp; gp = gp->next) {
+			switch_console_push_match(&my_matches, gp->name);
+		}
+		sofia_glue_release_profile(profile);
+	}
+
+	if (my_matches) {
+		*matches = my_matches;
+		status = SWITCH_STATUS_SUCCESS;
+	}
+
+  end:
+
+	switch_safe_free(dup);
+
+	return status;
+}
+
 SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load)
 {
 	switch_chat_interface_t *chat_interface;
@@ -3726,13 +4037,40 @@
 	management_interface->management_function = sofia_manage;
 
 	SWITCH_ADD_API(api_interface, "sofia", "Sofia Controls", sofia_function, "<cmd> <args>");
-	SWITCH_ADD_API(api_interface, "sofia_gateway_data", "Get data from a sofia gateway", sofia_gateway_data_function, "<gateway_name> [ivar|ovar|var] <name>");
+	SWITCH_ADD_API(api_interface, "sofia_gateway_data", "Get data from a sofia gateway", sofia_gateway_data_function,
+				   "<gateway_name> [ivar|ovar|var] <name>");
 	switch_console_set_complete("add sofia help");
 	switch_console_set_complete("add sofia status");
+	switch_console_set_complete("add sofia xmlstatus");
 	switch_console_set_complete("add sofia loglevel");
+	switch_console_set_complete("add sofia tracelevel");
 	switch_console_set_complete("add sofia profile");
 	switch_console_set_complete("add sofia profile restart all");
 
+	switch_console_set_complete("add sofia profile ::sofia::list_profiles start reloadxml");
+	switch_console_set_complete("add sofia profile ::sofia::list_profiles stop reloadxml");
+	switch_console_set_complete("add sofia profile ::sofia::list_profiles rescan reloadxml");
+	switch_console_set_complete("add sofia profile ::sofia::list_profiles restart reloadxml");
+
+	switch_console_set_complete("add sofia profile ::sofia::list_profiles flush_inbound_reg");
+	switch_console_set_complete("add sofia profile ::sofia::list_profiles register ::sofia::list_profile_gateway");
+	switch_console_set_complete("add sofia profile ::sofia::list_profiles unregister ::sofia::list_profile_gateway");
+	switch_console_set_complete("add sofia profile ::sofia::list_profiles killgw ::sofia::list_profile_gateway");
+	switch_console_set_complete("add sofia profile ::sofia::list_profiles siptrace on");
+	switch_console_set_complete("add sofia profile ::sofia::list_profiles siptrace off");
+
+	switch_console_set_complete("add sofia status profile ::sofia::list_profiles");
+	switch_console_set_complete("add sofia status profile ::sofia::list_profiles reg");
+	switch_console_set_complete("add sofia status gateway ::sofia::list_gateways");
+	switch_console_set_complete("add sofia xmlstatus profile ::sofia::list_profiles");
+	switch_console_set_complete("add sofia xmlstatus profile ::sofia::list_profiles reg");
+	switch_console_set_complete("add sofia xmlstatus gateway ::sofia::list_gateways");
+
+	switch_console_add_complete_func("::sofia::list_profiles", list_profiles);
+	switch_console_add_complete_func("::sofia::list_gateways", list_gateways);
+	switch_console_add_complete_func("::sofia::list_profile_gateway", list_profile_gateway);
+
+
 	SWITCH_ADD_API(api_interface, "sofia_contact", "Sofia Contacts", sofia_contact_function, "[profile/]<user>@<domain>");
 	SWITCH_ADD_CHAT(chat_interface, SOFIA_CHAT_PROTO, sofia_presence_chat_send);
 
@@ -3744,6 +4082,9 @@
 {
 	int sanity = 0;
 
+	switch_console_del_complete_func("::sofia::list_profiles");
+	switch_console_set_complete("del sofia");
+
 	switch_mutex_lock(mod_sofia_globals.mutex);
 	if (mod_sofia_globals.running == 1) {
 		mod_sofia_globals.running = 0;
@@ -3757,7 +4098,7 @@
 	switch_event_unbind(&mod_sofia_globals.custom_node);
 	switch_event_unbind(&mod_sofia_globals.mwi_node);
 	switch_event_unbind_callback(general_event_handler);
-	
+
 	while (mod_sofia_globals.threads) {
 		switch_cond_next();
 		if (++sanity >= 60000) {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/mod_sofia.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/mod_sofia.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/mod_sofia.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -81,6 +81,8 @@
 #define MY_EVENT_GATEWAY_STATE "sofia::gateway_state"
 #define MY_EVENT_NOTIFY_REFER "sofia::notify_refer"
 #define MY_EVENT_REINVITE "sofia::reinvite"
+#define MY_EVENT_GATEWAY_ADD "sofia::gateway_add"
+#define MY_EVENT_GATEWAY_DEL "sofia::gateway_delete"
 
 #define MULTICAST_EVENT "multicast::event"
 #define SOFIA_REPLACES_HEADER "_sofia_replaces_"
@@ -188,6 +190,7 @@
 	PFLAG_UUID_AS_CALLID,
 	PFLAG_SCROOGE,
 	PFLAG_MANAGE_SHARED_APPEARANCE,
+	PFLAG_MANAGE_SHARED_APPEARANCE_SYLANTRO,
 	PFLAG_DISABLE_SRV,
 	PFLAG_DISABLE_NAPTR,
 	PFLAG_AUTOFLUSH,
@@ -202,6 +205,7 @@
 	PFLAG_SQL_IN_TRANS,
 	PFLAG_PASS_CALLEE_ID,
 	PFLAG_LOG_AUTH_FAIL,
+	PFLAG_TRACK_CALLS,
 	/* No new flags below this line */
 	PFLAG_MAX
 } PFLAGS;
@@ -254,6 +258,10 @@
 	TFLAG_3PCC_HAS_ACK,
 	TFLAG_PASS_RFC2833,
 	TFLAG_UPDATING_DISPLAY,
+	TFLAG_ENABLE_SOA,
+	TFLAG_TRACKED,
+	TFLAG_RECOVERING,
+	TFLAG_RECOVERING_BRIDGE,
 	/* No new flags below this line */
 	TFLAG_MAX
 } TFLAGS;
@@ -282,6 +290,7 @@
 	int guess_mask;
 	char guess_mask_str[16];
 	int debug_presence;
+	int debug_sla;
 	int auto_restart;
 	int auto_nat;
 	int tracelevel;
@@ -338,8 +347,8 @@
 struct sofia_gateway_subscription {
 	sofia_gateway_t *gateway;
 	char *expires_str;
-	char *event;  /* eg, 'message-summary' to subscribe to MWI events */
-	char *content_type;  /* eg, application/simple-message-summary in the case of MWI events */
+	char *event;				/* eg, 'message-summary' to subscribe to MWI events */
+	char *content_type;			/* eg, application/simple-message-summary in the case of MWI events */
 	uint32_t freq;
 	int32_t retry_seconds;
 	time_t expires;
@@ -383,6 +392,7 @@
 	int ping_min;
 	uint8_t flags[REG_FLAG_MAX];
 	int32_t retry_seconds;
+	int32_t failure_status;
 	reg_state_t state;
 	switch_memory_pool_t *pool;
 	int deleted;
@@ -422,6 +432,7 @@
 	char *dbname;
 	char *dialplan;
 	char *context;
+	char *shutdown_type;
 	char *extrtpip;
 	char *rtpip;
 	char *sipip;
@@ -494,7 +505,7 @@
 	char *odbc_dsn;
 	char *odbc_user;
 	char *odbc_pass;
-	//	switch_odbc_handle_t *master_odbc;
+	//  switch_odbc_handle_t *master_odbc;
 	switch_queue_t *sql_queue;
 	char *acl[SOFIA_MAX_ACL];
 	uint32_t acl_count;
@@ -508,6 +519,8 @@
 	sofia_presence_type_t pres_type;
 	sofia_media_options_t media_options;
 	uint32_t force_subscription_expires;
+	char *user_agent_filter;
+	uint32_t max_registrations_perext;
 	switch_rtp_bug_flag_t auto_rtp_bugs;
 	uint32_t ib_calls;
 	uint32_t ob_calls;
@@ -519,6 +532,7 @@
 	uint32_t timer_t4;
 	char *contact_user;
 	char *local_network;
+	uint32_t trans_timeout;
 };
 
 struct private_object {
@@ -538,7 +552,8 @@
 	switch_caller_profile_t *caller_profile;
 	uint32_t timestamp_send;
 	switch_rtp_t *rtp_session;
-	int ssrc;
+	uint32_t ssrc;
+	uint32_t video_ssrc;
 	sofia_profile_t *profile;
 	char *local_sdp_audio_ip;
 	switch_port_t local_sdp_audio_port;
@@ -573,6 +588,7 @@
 	switch_rtp_crypto_key_type_t crypto_recv_type;
 	switch_rtp_crypto_key_type_t crypto_type;
 	char *local_sdp_str;
+	char *last_sdp_str;
 	char *dest;
 	char *dest_to;
 	char *key;
@@ -643,6 +659,7 @@
 	uint32_t check_frames;
 	uint32_t mismatch_count;
 	uint32_t last_codec_ms;
+	uint8_t codec_reinvites;
 	nua_event_t want_event;
 	switch_rtp_bug_flag_t rtp_bugs;
 	switch_codec_implementation_t read_impl;
@@ -671,10 +688,10 @@
 } auth_res_t;
 
 typedef struct {
-        char *to;
-        char *contact;
-        char *route;
-        char *route_uri;
+	char *to;
+	char *contact;
+	char *route;
+	char *route_uri;
 } sofia_destination_t;
 
 #define sofia_test_pflag(obj, flag) ((obj)->pflags[flag] ? 1 : 0)
@@ -722,21 +739,23 @@
 
 void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[]);
 
-void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
+void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+							   tagi_t tags[]);
 
-void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
+void sofia_reg_handle_sip_i_register(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+									 tagi_t tags[]);
 
 void sofia_event_callback(nua_event_t event,
-					int status,
-					char const *phrase,
-					nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
+						  int status,
+						  char const *phrase,
+						  nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
 
 void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void *obj);
 
 void launch_sofia_profile_thread(sofia_profile_t *profile);
 
 switch_status_t sofia_presence_chat_send(const char *proto, const char *from, const char *to, const char *subject,
-						  const char *body, const char *type, const char *hint);
+										 const char *body, const char *type, const char *hint);
 void sofia_glue_tech_absorb_sdp(private_object_t *tech_pvt);
 
 /*
@@ -754,47 +773,47 @@
 void sofia_presence_cancel(void);
 switch_status_t config_sofia(int reload, char *profile_name);
 void sofia_reg_auth_challenge(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_regtype_t regtype, const char *realm, int stale);
-auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization, 
-								sip_t const *sip, const char *regstr, char *np, size_t nplen, char *ip, switch_event_t **v_event, 
+auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, sip_authorization_t const *authorization,
+								sip_t const *sip, const char *regstr, char *np, size_t nplen, char *ip, switch_event_t **v_event,
 								long exptime, sofia_regtype_t regtype, const char *to_user, switch_event_t **auth_params, long *reg_count);
-								
 
+
 void sofia_reg_handle_sip_r_challenge(int status,
 									  char const *phrase,
 									  nua_t *nua, sofia_profile_t *profile,
 									  nua_handle_t *nh, sofia_private_t *sofia_private,
 									  switch_core_session_t *session, sofia_gateway_t *gateway, sip_t const *sip, tagi_t tags[]);
 void sofia_reg_handle_sip_r_register(int status,
-					char const *phrase,
-					nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
-void sofia_handle_sip_i_options(int status,
-				   char const *phrase,
-				   nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
-void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
-void sofia_presence_handle_sip_i_message(int status,
-				   char const *phrase,
-				   nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
-void sofia_presence_handle_sip_r_subscribe(int status,
-					 char const *phrase,
-					 nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
-void sofia_presence_handle_sip_i_subscribe(int status,
-					 char const *phrase,
-					 nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
+									 char const *phrase,
+									 nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+									 tagi_t tags[]);
+void sofia_handle_sip_i_options(int status, char const *phrase, nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private,
+								sip_t const *sip, tagi_t tags[]);
+void sofia_presence_handle_sip_i_publish(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+										 tagi_t tags[]);
+void sofia_presence_handle_sip_i_message(int status, char const *phrase, nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh,
+										 sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
+void sofia_presence_handle_sip_r_subscribe(int status, char const *phrase, nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh,
+										   sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
+void sofia_presence_handle_sip_i_subscribe(int status, char const *phrase, nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh,
+										   sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
 
 void sofia_glue_execute_sql(sofia_profile_t *profile, char **sqlp, switch_bool_t sql_already_dynamic);
 void sofia_glue_actually_execute_sql(sofia_profile_t *profile, char *sql, switch_mutex_t *mutex);
 void sofia_glue_actually_execute_sql_trans(sofia_profile_t *profile, char *sql, switch_mutex_t *mutex);
+void sofia_glue_execute_sql_now(sofia_profile_t *profile, char **sqlp, switch_bool_t sql_already_dynamic);
 void sofia_reg_check_expire(sofia_profile_t *profile, time_t now, int reboot);
 void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now);
 void sofia_sub_check_gateway(sofia_profile_t *profile, time_t now);
 void sofia_reg_unregister(sofia_profile_t *profile);
-switch_status_t sofia_glue_ext_address_lookup(sofia_profile_t *profile, private_object_t *tech_pvt, char **ip, switch_port_t *port, const char *sourceip, switch_memory_pool_t *pool);
+switch_status_t sofia_glue_ext_address_lookup(sofia_profile_t *profile, private_object_t *tech_pvt, char **ip, switch_port_t *port,
+											  const char *sourceip, switch_memory_pool_t *pool);
 
 void sofia_glue_pass_sdp(private_object_t *tech_pvt, char *sdp);
 int sofia_glue_get_user_host(char *in, char **user, char **host);
 switch_call_cause_t sofia_glue_sip_cause_to_freeswitch(int status);
 void sofia_glue_do_xfer_invite(switch_core_session_t *session);
-uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip, 
+uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip,
 								  sofia_regtype_t regtype, char *key, uint32_t keylen, switch_event_t **v_event, const char *is_nat);
 extern switch_endpoint_interface_t *sofia_endpoint_interface;
 void sofia_presence_set_chat_hash(private_object_t *tech_pvt, sip_t const *sip);
@@ -803,11 +822,9 @@
 void sofia_presence_set_hash_key(char *hash_key, int32_t len, sip_t const *sip);
 void sofia_glue_sql_close(sofia_profile_t *profile, time_t prune);
 int sofia_glue_init_sql(sofia_profile_t *profile);
-char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char *uri, const sofia_transport_t transport, switch_bool_t uri_only, const char *params);
-switch_bool_t sofia_glue_execute_sql_callback(sofia_profile_t *profile,
-											  switch_mutex_t *mutex,
-											  char *sql,
-											  switch_core_db_callback_func_t callback,
+char *sofia_overcome_sip_uri_weakness(switch_core_session_t *session, const char *uri, const sofia_transport_t transport, switch_bool_t uri_only,
+									  const char *params);
+switch_bool_t sofia_glue_execute_sql_callback(sofia_profile_t *profile, switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback,
 											  void *pdata);
 char *sofia_glue_execute_sql2str(sofia_profile_t *profile, switch_mutex_t *mutex, char *sql, char *resbuf, size_t len);
 void sofia_glue_check_video_codecs(private_object_t *tech_pvt);
@@ -832,6 +849,8 @@
 void sofia_reg_release_gateway__(const char *file, const char *func, int line, sofia_gateway_t *gateway);
 #define sofia_reg_release_gateway(x) sofia_reg_release_gateway__(__FILE__, __SWITCH_FUNC__, __LINE__, x);
 
+#define sofia_use_soa(_t) sofia_test_flag(_t, TFLAG_ENABLE_SOA)
+
 #define check_decode(_var, _session) do {								\
 		assert(_session);												\
 		if (!zstr(_var)) {								\
@@ -869,14 +888,15 @@
 sofia_transport_t sofia_glue_str2transport(const char *str);
 
 const char *sofia_glue_transport2str(const sofia_transport_t tp);
-char * sofia_glue_find_parameter(const char *str, const char *param);
+char *sofia_glue_find_parameter(const char *str, const char *param);
 char *sofia_glue_create_via(switch_core_session_t *session, const char *ip, switch_port_t port, sofia_transport_t transport);
 char *sofia_glue_create_external_via(switch_core_session_t *session, sofia_profile_t *profile, sofia_transport_t transport);
 char *sofia_glue_strip_uri(const char *str);
 int sofia_glue_check_nat(sofia_profile_t *profile, const char *network_ip);
 int sofia_glue_transport_has_tls(const sofia_transport_t tp);
 const char *sofia_glue_get_unknown_header(sip_t const *sip, const char *name);
-switch_status_t sofia_glue_build_crypto(private_object_t *tech_pvt, int index, switch_rtp_crypto_key_type_t type, switch_rtp_crypto_direction_t direction);
+switch_status_t sofia_glue_build_crypto(private_object_t *tech_pvt, int index, switch_rtp_crypto_key_type_t type,
+										switch_rtp_crypto_direction_t direction);
 void sofia_glue_tech_patch_sdp(private_object_t *tech_pvt);
 switch_status_t sofia_glue_tech_proxy_remote_addr(private_object_t *tech_pvt);
 void sofia_presence_event_thread_start(void);
@@ -886,10 +906,11 @@
 const char *sofia_glue_strip_proto(const char *uri);
 switch_status_t reconfig_sofia(sofia_profile_t *profile);
 void sofia_glue_del_gateway(sofia_gateway_t *gp);
-void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent, const char *network_ip);
+void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent,
+						   const char *network_ip);
 void sofia_glue_restart_all_profiles(void);
 void sofia_glue_toggle_hold(private_object_t *tech_pvt, int sendonly);
-const char * sofia_state_string(int state);
+const char *sofia_state_string(int state);
 switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force);
 void sofia_wait_for_reply(struct private_object *tech_pvt, nua_event_t event, uint32_t timeout);
 void sofia_glue_set_image_sdp(private_object_t *tech_pvt, switch_t38_options_t *t38_options);
@@ -903,7 +924,8 @@
 void sofia_sla_handle_sip_i_subscribe(nua_t *nua, const char *contact_str, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip, tagi_t tags[]);
 void sofia_sla_handle_sip_r_subscribe(int status,
 									  char const *phrase,
-									  nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]);
+									  nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+									  tagi_t tags[]);
 void sofia_sla_handle_sip_i_notify(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sip_t const *sip, tagi_t tags[]);
 
 /* 
@@ -929,12 +951,16 @@
 void sofia_glue_tech_set_local_sdp(private_object_t *tech_pvt, const char *sdp_str, switch_bool_t dup);
 void sofia_glue_set_rtp_stats(private_object_t *tech_pvt);
 void sofia_glue_get_addr(msg_t *msg, char *buf, size_t buflen, int *port);
-sofia_destination_t* sofia_glue_get_destination(char *data);
+sofia_destination_t *sofia_glue_get_destination(char *data);
 void sofia_glue_free_destination(sofia_destination_t *dst);
-switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *user, const char *host, const char *event, const char *contenttype, const char *body, const char *o_contact, const char *network_ip);
+switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *user, const char *host, const char *event, const char *contenttype,
+									   const char *body, const char *o_contact, const char *network_ip);
 char *sofia_glue_get_extra_headers(switch_channel_t *channel, const char *prefix);
 void sofia_glue_set_extra_headers(switch_channel_t *channel, sip_t const *sip, const char *prefix);
 void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t *bleg);
 void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *profile, sip_t const *sip, switch_bool_t send);
 void sofia_send_callee_id(switch_core_session_t *session, const char *name, const char *number);
 int sofia_sla_supported(sip_t const *sip);
+void sofia_glue_tech_untrack(sofia_profile_t *profile, switch_core_session_t *session, switch_bool_t force);
+void sofia_glue_tech_track(sofia_profile_t *profile, switch_core_session_t *session);
+int sofia_glue_recover(switch_bool_t flush);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/sofia.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/sofia.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/sofia.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -51,6 +51,11 @@
 extern su_log_t stun_log[];
 extern su_log_t su_log_default[];
 
+
+void sofia_handle_sip_i_reinvite(switch_core_session_t *session,
+								 nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+								 tagi_t tags[]);
+
 static void set_variable_sip_param(switch_channel_t *channel, char *header_type, sip_param_t const *params);
 
 
@@ -81,6 +86,154 @@
 #endif
 }
 
+#define url_set_chanvars(session, url, varprefix) _url_set_chanvars(session, url, #varprefix "_user", #varprefix "_host", #varprefix "_port", #varprefix "_uri", #varprefix "_params")
+
+static const char *_url_set_chanvars(switch_core_session_t *session, url_t *url, const char *user_var,
+									 const char *host_var, const char *port_var, const char *uri_var, const char *params_var)
+{
+	const char *user = NULL, *host = NULL, *port = NULL;
+	char *uri = NULL;
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	char new_port[25] = "";
+
+	if (url) {
+		user = url->url_user;
+		host = url->url_host;
+		port = url->url_port;
+		if (!zstr(url->url_params)) {
+			switch_channel_set_variable(channel, params_var, url->url_params);
+		}
+	}
+
+	if (zstr(user)) {
+		user = "nobody";
+	}
+
+	if (zstr(host)) {
+		host = "nowhere";
+	}
+
+	check_decode(user, session);
+
+	if (user) {
+		switch_channel_set_variable(channel, user_var, user);
+	}
+
+
+	if (port) {
+		switch_snprintf(new_port, sizeof(new_port), ":%s", port);
+	}
+
+	switch_channel_set_variable(channel, port_var, port);
+	if (host) {
+		if (user) {
+			uri = switch_core_session_sprintf(session, "%s@%s%s", user, host, new_port);
+		} else {
+			uri = switch_core_session_sprintf(session, "%s%s", host, new_port);
+		}
+		switch_channel_set_variable(channel, uri_var, uri);
+		switch_channel_set_variable(channel, host_var, host);
+	}
+
+	return uri;
+}
+
+static char *strip_quotes(const char *in)
+{
+	char *t = (char *) in;
+	char *r = (char *) in;
+
+	if (t && *t == '"') {
+		t++;
+
+		if (end_of(t) == '"') {
+			r = strdup(t);
+			end_of(r) = '\0';
+		}
+	}
+
+	return r;
+}
+
+static void extract_header_vars(sofia_profile_t *profile, sip_t const *sip, switch_core_session_t *session)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	char *full;
+
+	if (sip) {
+		if (sip->sip_via) {
+			if ((full = sip_header_as_string(profile->home, (void *) sip->sip_via))) {
+				const char *v = switch_channel_get_variable(channel, "sip_full_via");
+				if (!v) {
+					switch_channel_set_variable(channel, "sip_full_via", full);
+				}
+				su_free(profile->home, full);
+			}
+		}
+		if (sip->sip_from) {
+			char *p = strip_quotes(sip->sip_from->a_display);
+
+			if (p) {
+				switch_channel_set_variable(channel, "sip_from_display", p);
+			}
+			if (p != sip->sip_from->a_display) free(p);
+			if ((full = sip_header_as_string(profile->home, (void *) sip->sip_from))) {
+				switch_channel_set_variable(channel, "sip_full_from", full);
+				su_free(profile->home, full);
+			}
+		}
+		if (sip->sip_to) {
+			char *p = strip_quotes(sip->sip_to->a_display);
+
+			if (p) {
+				switch_channel_set_variable(channel, "sip_to_display", p);
+			}
+
+			if (p != sip->sip_to->a_display) free(p);
+
+			if ((full = sip_header_as_string(profile->home, (void *) sip->sip_to))) {
+				switch_channel_set_variable(channel, "sip_full_to", full);
+				su_free(profile->home, full);
+			}
+		}
+
+	}
+}
+
+static void extract_vars(sofia_profile_t *profile, sip_t const *sip, switch_core_session_t *session)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+
+	if (sip) {
+		if (sip->sip_from && sip->sip_from->a_url)
+			url_set_chanvars(session, sip->sip_from->a_url, sip_from);
+		if (sip->sip_request && sip->sip_request->rq_url)
+			url_set_chanvars(session, sip->sip_request->rq_url, sip_req);
+		if (sip->sip_to && sip->sip_to->a_url)
+			url_set_chanvars(session, sip->sip_to->a_url, sip_to);
+		if (sip->sip_contact && sip->sip_contact->m_url)
+			url_set_chanvars(session, sip->sip_contact->m_url, sip_contact);
+		if (sip->sip_referred_by && sip->sip_referred_by->b_url)
+			url_set_chanvars(session, sip->sip_referred_by->b_url, sip_referred_by);
+		if (sip->sip_to && sip->sip_to->a_tag) {
+			switch_channel_set_variable(channel, "sip_to_tag", sip->sip_to->a_tag);
+		}
+		if (sip->sip_from && sip->sip_from->a_tag) {
+			switch_channel_set_variable(channel, "sip_from_tag", sip->sip_from->a_tag);
+		}
+		if (sip->sip_cseq && sip->sip_cseq->cs_seq) {
+			char sip_cseq[40] = "";
+			switch_snprintf(sip_cseq, sizeof(sip_cseq), "%d", sip->sip_cseq->cs_seq);
+			switch_channel_set_variable(channel, "sip_cseq", sip_cseq);
+		}
+		if (sip->sip_call_id && sip->sip_call_id->i_id) {
+			switch_channel_set_variable(channel, "sip_call_id", sip->sip_call_id->i_id);
+		}
+	}
+}
+
+
+
 void sofia_handle_sip_i_notify(switch_core_session_t *session, int status,
 							   char const *phrase,
 							   nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
@@ -104,9 +257,9 @@
 	 * nua, and also pick them off special elsewhere here in sofia.c - MTK
 	 * *and* for Linksys, I believe they use "sa" as their magic appearance agent name for those blind notifies, so
 	 * we'll probably have to change to match
-	*/
+	 */
 	if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) {
-		
+
 		if (sip->sip_request->rq_url->url_user && !strncmp(sip->sip_request->rq_url->url_user, "sla-agent", sizeof("sla-agent"))) {
 			sofia_sla_handle_sip_i_notify(nua, profile, nh, sip, tags);
 			goto end;
@@ -129,10 +282,7 @@
 
 	/* For additional NOTIFY event packages see http://www.iana.org/assignments/sip-events. */
 	if (sip->sip_content_type &&
-		sip->sip_content_type->c_type &&
-		sip->sip_payload &&
-		sip->sip_payload->pl_data &&
-		!strcasecmp(sip->sip_event->o_type, "refer")) {
+		sip->sip_content_type->c_type && sip->sip_payload && sip->sip_payload->pl_data && !strcasecmp(sip->sip_event->o_type, "refer")) {
 		if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_NOTIFY_REFER) == SWITCH_STATUS_SUCCESS) {
 			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "content-type", sip->sip_content_type->c_type);
 			switch_event_add_body(s_event, "%s", sip->sip_payload->pl_data);
@@ -144,13 +294,14 @@
 		switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "event-package", sip->sip_event->o_type);
 		switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "event-id", sip->sip_event->o_id);
 
-		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "contact", "%s@%s", 
-								sip->sip_contact->m_url->url_user, sip->sip_contact->m_url->url_host);
-		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", 
-								sip->sip_from->a_url->url_user, sip->sip_from->a_url->url_host);
+		if (sip->sip_contact && sip->sip_contact->m_url) {
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "contact", "%s@%s",
+									sip->sip_contact->m_url->url_user, sip->sip_contact->m_url->url_host);
+		}
+
+		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", sip->sip_from->a_url->url_user, sip->sip_from->a_url->url_host);
 		switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "from-tag", sip->sip_from->a_tag);
-		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "to", "%s@%s", 
-								sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host);
+		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "to", "%s@%s", sip->sip_to->a_url->url_user, sip->sip_to->a_url->url_host);
 		switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "to-tag", sip->sip_to->a_tag);
 
 		if (sip->sip_call_id && sip->sip_call_id->i_id) {
@@ -214,27 +365,26 @@
 			goto end;
 		}
 	}
-	
+
 	if (!sofia_private || !sofia_private->gateway) {
 		if (profile->debug) {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Gateway information missing Subscription Event: %s\n", sip->sip_event->o_type);
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Gateway information missing Subscription Event: %s\n",
+							  sip->sip_event->o_type);
 		}
-		goto error;	
+		goto error;
 	}
-				
+
 	/* find the corresponding gateway subscription (if any) */
 	if (!(gw_sub_ptr = sofia_find_gateway_subscription(sofia_private->gateway, sip->sip_event->o_type))) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
 						  "Could not find gateway subscription.  Gateway: %s.  Subscription Event: %s\n",
 						  sofia_private->gateway->name, sip->sip_event->o_type);
-		goto error;	
+		goto error;
 	}
 
 	if (!(gw_sub_ptr->state == SUB_STATE_SUBED || gw_sub_ptr->state == SUB_STATE_SUBSCRIBE)) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
-						  "Ignoring notify due to subscription state: %d\n",
-						  gw_sub_ptr->state);
-		goto error;	
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Ignoring notify due to subscription state: %d\n", gw_sub_ptr->state);
+		goto error;
 	}
 
 	/* dispatch freeswitch event */
@@ -251,7 +401,7 @@
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "dispatched freeswitch event for message-summary NOTIFY\n");
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failed to create event\n");
-		goto error;	
+		goto error;
 	}
 
 	goto end;
@@ -265,10 +415,10 @@
 	} else {
 		nua_respond(nh, 481, "Subscription Does Not Exist", NUTAG_WITH_THIS(nua), TAG_END());
 	}
-	
- end:
-	
-	if (sub_state == nua_substate_terminated && sofia_private && sofia_private != &mod_sofia_globals.destroy_private && 
+
+  end:
+
+	if (sub_state == nua_substate_terminated && sofia_private && sofia_private != &mod_sofia_globals.destroy_private &&
 		sofia_private != &mod_sofia_globals.keep_private) {
 		sofia_private->destroy_nh = 1;
 		sofia_private->destroy_me = 1;
@@ -284,6 +434,7 @@
 	switch_channel_t *channel;
 	private_object_t *tech_pvt;
 	char *extra_headers;
+	const char *call_info = NULL;
 #ifdef MANUAL_BYE
 	int cause;
 	char st[80] = "";
@@ -295,17 +446,16 @@
 	channel = switch_core_session_get_channel(session);
 	tech_pvt = switch_core_session_get_private(session);
 
-
 #ifdef MANUAL_BYE
 	status = 200;
 	phrase = "OK";
-	
+
 	sofia_set_flag_locked(tech_pvt, TFLAG_BYE);
+	call_info = switch_channel_get_variable(channel, "presence_call_info_full");
 
-	if (sip->sip_reason && sip->sip_reason->re_protocol &&
-		(!strcasecmp(sip->sip_reason->re_protocol, "Q.850") 
-			|| !strcasecmp(sip->sip_reason->re_protocol, "FreeSWITCH")
-			|| !strcasecmp(sip->sip_reason->re_protocol, profile->username)) && sip->sip_reason->re_cause) {
+	if (sip->sip_reason && sip->sip_reason->re_protocol && (!strcasecmp(sip->sip_reason->re_protocol, "Q.850")
+															|| !strcasecmp(sip->sip_reason->re_protocol, "FreeSWITCH")
+															|| !strcasecmp(sip->sip_reason->re_protocol, profile->username)) && sip->sip_reason->re_cause) {
 		tech_pvt->q850_cause = atoi(sip->sip_reason->re_cause);
 		cause = tech_pvt->q850_cause;
 	} else {
@@ -322,20 +472,20 @@
 
 	switch_snprintf(st, sizeof(st), "%d", cause);
 	switch_channel_set_variable(channel, "sip_term_cause", st);
-	
+
 	extra_headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_BYE_HEADER_PREFIX);
 	sofia_glue_set_extra_headers(channel, sip, SOFIA_SIP_BYE_HEADER_PREFIX);
-	
+
 	switch_channel_hangup(channel, cause);
-	nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), 
-		TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
-		
+	nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua),
+				TAG_IF(call_info, SIPTAG_CALL_INFO_STR(call_info)), TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)), TAG_END());
+
 	switch_safe_free(extra_headers);
 
 	if (sofia_private) {
-        sofia_private->destroy_me = 1;
-        sofia_private->destroy_nh = 1;
-    }
+		sofia_private->destroy_me = 1;
+		sofia_private->destroy_nh = 1;
+	}
 #endif
 
 
@@ -354,9 +504,9 @@
 	if ((tmp = sofia_glue_get_unknown_header(sip, "P-RTP-Stat"))) {
 		switch_channel_set_variable(channel, "sip_p_rtp_stat", tmp);
 	}
-	
+
 	tech_pvt->got_bye = 1;
-	switch_channel_set_variable(channel, "sip_hangup_disposition", "recv_bye");	
+	switch_channel_set_variable(channel, "sip_hangup_disposition", "recv_bye");
 
 	return;
 }
@@ -368,16 +518,16 @@
 void sofia_wait_for_reply(struct private_object *tech_pvt, nua_event_t event, uint32_t timeout)
 {
 	time_t exp = switch_epoch_time_now(NULL) + timeout;
-	
+
 	tech_pvt->want_event = event;
 
-	while(switch_channel_ready(tech_pvt->channel) && tech_pvt->want_event && switch_epoch_time_now(NULL) < exp) {
+	while (switch_channel_ready(tech_pvt->channel) && tech_pvt->want_event && switch_epoch_time_now(NULL) < exp) {
 		switch_yield(100000);
 	}
-	
+
 }
 
-void sofia_send_callee_id(switch_core_session_t *session, const char *name, const char *number) 
+void sofia_send_callee_id(switch_core_session_t *session, const char *name, const char *number)
 {
 	const char *uuid;
 	switch_core_session_t *session_b;
@@ -396,7 +546,7 @@
 	if (zstr(name)) {
 		name = number;
 	}
-	
+
 	if (zstr(number)) {
 		number = caller_profile->destination_number;
 	}
@@ -445,7 +595,7 @@
 	}
 
 	if ((val = sofia_glue_get_unknown_header(sip, "X-FS-Display-Name"))) {
-		name = (char *)val;
+		name = (char *) val;
 		fs++;
 	}
 
@@ -469,18 +619,19 @@
 	}
 
 	if (((tmp = switch_channel_get_variable(channel, "effective_callee_id_name")) ||
-		(tmp = switch_channel_get_variable(channel, "sip_callee_id_name")) ||
+		 (tmp = switch_channel_get_variable(channel, "sip_callee_id_name")) ||
 		 (tmp = switch_channel_get_variable(channel, "callee_id_name"))) && !zstr(tmp)) {
-		name = (char *)tmp;
+		name = (char *) tmp;
 	}
 
 	if (((tmp = switch_channel_get_variable(channel, "effective_callee_id_number")) ||
-		(tmp = switch_channel_get_variable(channel, "sip_callee_id_number")) ||
+		 (tmp = switch_channel_get_variable(channel, "sip_callee_id_number")) ||
 		 (tmp = switch_channel_get_variable(channel, "callee_id_number"))) && !zstr(tmp)) {
 		number = tmp;
 	}
 
-	if (zstr(name)) name = (char *) number;
+	if (zstr(name))
+		name = (char *) number;
 
 	if (zstr(name) && zstr(number)) {
 		goto end;
@@ -497,19 +648,23 @@
 		switch_channel_event_set_data(channel, event);
 		switch_event_fire(&event);
 	}
-	
+
 	caller_profile = switch_channel_get_caller_profile(channel);
 
-	caller_profile->callee_id_name = switch_sanitize_number(switch_core_strdup(caller_profile->pool, name));
-	caller_profile->callee_id_number = switch_sanitize_number(switch_core_strdup(caller_profile->pool, number));
+	if (!strcmp(caller_profile->callee_id_name, name) && !strcmp(caller_profile->callee_id_number, number)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Same Callee ID \"%s\" <%s>\n", name, number);
+		send = 0;
+	} else {
+		caller_profile->callee_id_name = switch_sanitize_number(switch_core_strdup(caller_profile->pool, name));
+		caller_profile->callee_id_number = switch_sanitize_number(switch_core_strdup(caller_profile->pool, number));
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Update Callee ID to \"%s\" <%s>\n", name, number);
+	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Update Callee ID to \"%s\" <%s>\n", name, number);
-	
 	if (send) {
 		sofia_send_callee_id(session, NULL, NULL);
 	}
 
-	end:
+  end:
 	switch_safe_free(dup);
 }
 
@@ -547,7 +702,7 @@
 				channel = switch_core_session_get_channel(session);
 				if (tech_pvt) {
 					switch_mutex_lock(tech_pvt->sofia_mutex);
-					locked = 1;										
+					locked = 1;
 				} else {
 					switch_core_session_rwunlock(session);
 					return;
@@ -590,12 +745,12 @@
 
 		if (authorization) {
 			char network_ip[80];
-			sofia_glue_get_addr(nua_current_request(nua), network_ip,  sizeof(network_ip), NULL);
+			sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), NULL);
 			auth_res = sofia_reg_parse_auth(profile, authorization, sip,
 											(char *) sip->sip_request->rq_method_name, tech_pvt->key, strlen(tech_pvt->key), network_ip, NULL, 0,
 											REG_INVITE, NULL, NULL, NULL);
 		}
-		
+
 		if (auth_res != AUTH_OK) {
 			//switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 			nua_respond(nh, SIP_401_UNAUTHORIZED, TAG_END());
@@ -631,11 +786,37 @@
 	case nua_r_prack:
 		break;
 	case nua_i_ack:
+		{
+			if (channel && sip) {
+				if (sip->sip_to && sip->sip_to->a_tag) {
+					switch_channel_set_variable(channel, "sip_to_tag", sip->sip_to->a_tag);
+				}
+
+				if (sip->sip_from && sip->sip_from->a_tag) {
+					switch_channel_set_variable(channel, "sip_from_tag", sip->sip_from->a_tag);
+				}
+
+				if (sip->sip_cseq && sip->sip_cseq->cs_seq) {
+					char sip_cseq[40] = "";
+					switch_snprintf(sip_cseq, sizeof(sip_cseq), "%d", sip->sip_cseq->cs_seq);
+					switch_channel_set_variable(channel, "sip_cseq", sip_cseq);
+				}
+
+				if (sip->sip_call_id && sip->sip_call_id->i_id) {
+					switch_channel_set_variable(channel, "sip_call_id", sip->sip_call_id->i_id);
+				}
+
+				extract_header_vars(profile, sip, session);
+				sofia_glue_tech_track(tech_pvt->profile, session);
+			}
+		}
 	case nua_r_ack:
-		if (channel) switch_channel_set_flag(channel, CF_MEDIA_ACK);
+		if (channel)
+			switch_channel_set_flag(channel, CF_MEDIA_ACK);
 		break;
 	case nua_r_shutdown:
-		if (status >= 200) su_root_break(profile->s_root);
+		if (status >= 200)
+			su_root_break(profile->s_root);
 		break;
 	case nua_r_message:
 		sofia_handle_sip_r_message(status, profile, nh, sip);
@@ -662,7 +843,11 @@
 		sofia_handle_sip_i_options(status, phrase, nua, profile, nh, sofia_private, sip, tags);
 		break;
 	case nua_i_invite:
-		if (!session) sofia_handle_sip_i_invite(nua, profile, nh, sofia_private, sip, tags);
+		if (session) {
+			sofia_handle_sip_i_reinvite(session, nua, profile, nh, sofia_private, sip, tags);
+		} else {
+			sofia_handle_sip_i_invite(nua, profile, nh, sofia_private, sip, tags);
+		}
 		break;
 	case nua_i_publish:
 		sofia_presence_handle_sip_i_publish(nua, profile, nh, sofia_private, sip, tags);
@@ -691,7 +876,8 @@
 	case nua_r_refer:
 		break;
 	case nua_i_refer:
-		if (session) sofia_handle_sip_i_refer(nua, profile, nh, session, sip, tags);
+		if (session)
+			sofia_handle_sip_i_refer(nua, profile, nh, session, sip, tags);
 		break;
 	case nua_r_subscribe:
 		sofia_presence_handle_sip_r_subscribe(status, phrase, nua, profile, nh, sofia_private, sip, tags);
@@ -701,7 +887,8 @@
 		break;
 	default:
 		if (status > 100) {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s: unknown event %d: %03d %s\n", nua_event_name(event), event, status, phrase);
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s: unknown event %d: %03d %s\n", nua_event_name(event), event,
+							  status, phrase);
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s: unknown event %d\n", nua_event_name(event), event);
 		}
@@ -721,7 +908,7 @@
 		break;
 
 	case nua_i_notify:
-		
+
 		if (sip && sip->sip_event && !strcmp(sip->sip_event->o_type, "dialog") && sip->sip_event->o_params && !strcmp(sip->sip_event->o_params[0], "sla")) {
 			check_destroy = 0;
 		}
@@ -746,11 +933,11 @@
 			nh = NULL;
 		}
 	}
-	
+
 	if (sofia_private && sofia_private->destroy_me) {
 		if (tech_pvt) {
-            tech_pvt->sofia_private = NULL;
-        }
+			tech_pvt->sofia_private = NULL;
+		}
 
 		if (nh) {
 			nua_handle_bind(nh, NULL);
@@ -766,7 +953,7 @@
 	if (locked && tech_pvt) {
 		switch_mutex_unlock(tech_pvt->sofia_mutex);
 	}
-	
+
 	if (session) {
 		switch_core_session_rwunlock(session);
 	}
@@ -775,24 +962,63 @@
 void event_handler(switch_event_t *event)
 {
 	char *subclass, *sql;
+	char *class;
+	switch_event_t *pevent;
 
-	if ((subclass = switch_event_get_header(event, "orig-event-subclass")) && !strcasecmp(subclass, MY_EVENT_REGISTER)) {
-		char *from_user = switch_event_get_header(event, "orig-from-user");
-		char *from_host = switch_event_get_header(event, "orig-from-host");
-		char *to_host = switch_event_get_header(event, "orig-to-host");
-		char *contact_str = switch_event_get_header(event, "orig-contact");
-		char *exp_str = switch_event_get_header(event, "orig-expires");
-		char *rpid = switch_event_get_header(event, "orig-rpid");
-		char *call_id = switch_event_get_header(event, "orig-call-id");
-		char *user_agent = switch_event_get_header(event, "orig-user-agent");
+	/* Get Original Event Name */
+	class = switch_event_get_header_nil(event, "orig-event-name");
+	if (!strcasecmp(class, "PRESENCE_IN")) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\nGot Presence IN event via MultiCast\n");
+		if (switch_event_create(&pevent, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
+		        		switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "proto", switch_event_get_header_nil(event, "orig-proto"));
+                        switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "login", switch_event_get_header_nil(event, "orig-login"));
+                        switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "from", switch_event_get_header_nil(event, "orig-from"));
+                        switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "rpid", switch_event_get_header_nil(event, "orig-rpid"));
+                        switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "status", switch_event_get_header_nil(event, "orig-status"));
+                        switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "answer-state", switch_event_get_header_nil(event, "orig-answer-state"));
+                        switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "alt_event_type", switch_event_get_header_nil(event, "orig-alt_event_type"));
+                        switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "presence-call-direction", switch_event_get_header_nil(event, "orig-presence-call-direction"));
+                        switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "channel-state", switch_event_get_header_nil(event, "orig-channel-state"));
+                        switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "call-direction", switch_event_get_header_nil(event, "orig-call-direction"));
+			/* we cannot use switch_event_fire, or otherwise we'll start an endless loop */
+			sofia_presence_event_handler(pevent);
+			return;
+		} else {		
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\nCannot inject PRESENCE_IN event\n");
+			return;
+		}
+	} else if (!strcasecmp(class, "MESSAGE_WAITING")) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\nGot MWI event via MultiCast\n");
+		if (switch_event_create(&pevent, SWITCH_EVENT_MESSAGE_WAITING) == SWITCH_STATUS_SUCCESS) {
+			switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "MWI-Messages-Waiting", switch_event_get_header_nil(event, "orig-MWI-Messages-Waiting"));
+			switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "MWI-Message-Account", switch_event_get_header_nil(event, "orig-MWI-Message-Account"));
+			switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "MWI-Voice-Message", switch_event_get_header_nil(event, "orig-MWI-Voice-Message"));
+			/* we cannot use switch_event_fire, or otherwise we'll start an endless loop */
+			sofia_presence_mwi_event_handler(pevent);
+			return;
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\nCannot inject MWI event\n");
+			return;
+		}
+	} else if ((subclass = switch_event_get_header_nil(event, "orig-event-subclass")) && !strcasecmp(subclass, MY_EVENT_REGISTER)) {
+		char *from_user = switch_event_get_header_nil(event, "orig-from-user");
+		char *from_host = switch_event_get_header_nil(event, "orig-from-host");
+		char *to_host = switch_event_get_header_nil(event, "orig-to-host");
+		char *contact_str = switch_event_get_header_nil(event, "orig-contact");
+		char *exp_str = switch_event_get_header_nil(event, "orig-expires");
+		char *rpid = switch_event_get_header_nil(event, "orig-rpid");
+		char *call_id = switch_event_get_header_nil(event, "orig-call-id");
+		char *user_agent = switch_event_get_header_nil(event, "orig-user-agent");
 		long expires = (long) switch_epoch_time_now(NULL);
-		char *profile_name = switch_event_get_header(event, "orig-profile-name");
-		char *to_user = switch_event_get_header(event, "orig-to-user");
-		char *presence_hosts = switch_event_get_header(event, "orig-presence-hosts");
-		char *network_ip = switch_event_get_header(event, "orig-network-ip");
-		char *network_port = switch_event_get_header(event, "orig-network-port");
-		char *username = switch_event_get_header(event, "orig-username");
-		char *realm = switch_event_get_header(event, "orig-realm");
+		char *profile_name = switch_event_get_header_nil(event, "orig-profile-name");
+		char *to_user = switch_event_get_header_nil(event, "orig-to-user");
+		char *presence_hosts = switch_event_get_header_nil(event, "orig-presence-hosts");
+		char *network_ip = switch_event_get_header_nil(event, "orig-network-ip");
+		char *network_port = switch_event_get_header_nil(event, "orig-network-port");
+		char *username = switch_event_get_header_nil(event, "orig-username");
+		char *realm = switch_event_get_header_nil(event, "orig-realm");
+		char *orig_server_host = switch_event_get_header_nil(event, "orig-FreeSWITCH-IPv4");
+		char *orig_hostname = switch_event_get_header_nil(event, "orig-FreeSWITCH-Hostname");
 		char *fixed_contact_str = NULL;
 
 		sofia_profile_t *profile = NULL;
@@ -803,7 +1029,7 @@
 		char *mwi_user = NULL;
 		char *mwi_host = NULL;
 
-		if ((mwi_account = switch_event_get_header(event, "orig-mwi-account"))) {
+		if ((mwi_account = switch_event_get_header_nil(event, "orig-mwi-account"))) {
 			dup_mwi_account = strdup(mwi_account);
 			switch_assert(dup_mwi_account != NULL);
 			sofia_glue_get_user_host(dup_mwi_account, &mwi_user, &mwi_host);
@@ -842,7 +1068,7 @@
 			fixed_contact_str = malloc(len);
 			switch_assert(fixed_contact_str);
 			switch_copy_string(fixed_contact_str, contact_str, len);
-	
+
 			if ((sptr = strstr(fixed_contact_str, needle))) {
 				char *origsptr = strstr(contact_str, needle);
 				eptr = strchr(++origsptr, ';');
@@ -850,7 +1076,20 @@
 				sptr = strchr(fixed_contact_str, '\0') - 1;
 			}
 
-			switch_snprintf(sptr, len - (sptr - fixed_contact_str), ";fs_path=sip:%s%s", to_host, eptr ? eptr : ">");
+			switch (mod_sofia_globals.rewrite_multicasted_fs_path) {
+				case 1:
+					switch_snprintf(sptr, len - (sptr - fixed_contact_str), ";fs_path=sip:%s%s", to_host, eptr ? eptr : ">");
+				break;
+				case 2:
+					switch_snprintf(sptr, len - (sptr - fixed_contact_str), ";fs_path=sip:%s%s", orig_server_host, eptr ? eptr : ">");
+				break;
+				case 3:
+					switch_snprintf(sptr, len - (sptr - fixed_contact_str), ";fs_path=sip:%s%s", orig_hostname, eptr ? eptr : ">");
+				break;
+				default:
+					switch_snprintf(sptr, len - (sptr - fixed_contact_str), ";fs_path=sip:%s%s", to_host, eptr ? eptr : ">");
+				break;
+			}
 
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Rewrote contact string from '%s' to '%s'\n", contact_str, fixed_contact_str);
 			contact_str = fixed_contact_str;
@@ -858,14 +1097,16 @@
 
 		switch_mutex_lock(profile->ireg_mutex);
 		sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
-		
+
 		switch_find_local_ip(guess_ip4, sizeof(guess_ip4), NULL, AF_INET);
 		sql = switch_mprintf("insert into sip_registrations "
 							 "(call_id, sip_user, sip_host, presence_hosts, contact, status, rpid, expires,"
-							 "user_agent, server_user, server_host, profile_name, hostname, network_ip, network_port, sip_username, sip_realm, mwi_user, mwi_host) "
-							 "values ('%q','%q','%q','%q','%q','Registered','%q',%ld, '%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q')",
-							 call_id, from_user, from_host, presence_hosts, contact_str, rpid, expires, user_agent, to_user, guess_ip4, 
-							 profile_name, mod_sofia_globals.hostname, network_ip, network_port, username, realm, mwi_user, mwi_host);
+							 "user_agent, server_user, server_host, profile_name, hostname, network_ip, network_port, sip_username, sip_realm," 
+							 "mwi_user, mwi_host, orig_server_host, orig_hostname) "
+							 "values ('%q','%q','%q','%q','%q','Registered','%q',%ld, '%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q')",
+							 call_id, from_user, from_host, presence_hosts, contact_str, rpid, expires, user_agent, to_user, guess_ip4,
+							 profile_name, mod_sofia_globals.hostname, network_ip, network_port, username, realm, mwi_user, mwi_host,
+							 orig_server_host, orig_hostname);
 
 		if (sql) {
 			sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
@@ -876,12 +1117,48 @@
 		if (profile) {
 			sofia_glue_release_profile(profile);
 		}
-end:
+	  end:
 		switch_safe_free(fixed_contact_str);
 		switch_safe_free(dup_mwi_account);
 	}
 }
 
+static void sofia_perform_profile_start_failure(sofia_profile_t *profile, char *profile_name, char *file, int line)
+{
+	int arg = 0;
+	switch_event_t *s_event;
+
+	if (profile) {
+		if (!strcasecmp(profile->shutdown_type, "true")) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Profile %s could not load! Shutting down!\n", profile->name);
+			switch_core_session_ctl(SCSC_SHUTDOWN, &arg);
+		} else if (!strcasecmp(profile->shutdown_type, "elegant")) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Profile %s could not load! Waiting for calls to finish, then shutting down!\n",
+							  profile->name);
+			switch_core_session_ctl(SCSC_SHUTDOWN_ELEGANT, &arg);
+		} else if (!strcasecmp(profile->shutdown_type, "asap")) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Profile %s could not load! Shutting down ASAP!\n", profile->name);
+			switch_core_session_ctl(SCSC_SHUTDOWN_ASAP, &arg);
+		}
+	}
+
+	if ((switch_event_create(&s_event, SWITCH_EVENT_FAILURE) == SWITCH_STATUS_SUCCESS)) {
+		switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "module_name", "mod_sofia");
+		switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile_name", profile_name);
+		if (profile) {
+			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile_uri", profile->url);
+		}
+		switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "failure_message", "Profile failed to start.");
+		switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "file", file);
+		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "line", "%d", line);
+
+		switch_event_fire(&s_event);
+	}
+}
+
+#define sofia_profile_start_failure(p, xp) sofia_perform_profile_start_failure(p, xp, __FILE__, __LINE__)
+
+
 #define SQLLEN 1024 * 64
 void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread, void *obj)
 {
@@ -910,20 +1187,20 @@
 
 	while ((mod_sofia_globals.running == 1 && sofia_test_pflag(profile, PFLAG_RUNNING)) || qsize) {
 		if (sofia_test_pflag(profile, PFLAG_SQL_IN_TRANS)) {
-			if (qsize > 0 && (qsize >= 500 || ++loop_count >= 500)) {
+			if (qsize > 0 && (qsize >= 1024 || ++loop_count >= profile->trans_timeout)) {
 				switch_size_t newlen;
 				uint32_t itterations = 0;
 				switch_size_t len = 0;
 
-				switch_mutex_lock(profile->ireg_mutex);
-			
+				//switch_mutex_lock(profile->ireg_mutex);
+
 				//sofia_glue_actually_execute_sql(profile, "begin;\n", NULL);
 
 				while (switch_queue_trypop(profile->sql_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
 					char *sql = (char *) pop;
-				
+
 					newlen = strlen(sql) + 2;
-				
+
 					if (newlen + 10 < SQLLEN) {
 						itterations++;
 						if (len + newlen + 10 > sql_len) {
@@ -942,24 +1219,22 @@
 				}
 
 				//printf("TRANS:\n%s\n", sqlbuf);
-				sofia_glue_actually_execute_sql_trans(profile, sqlbuf, NULL);
+				sofia_glue_actually_execute_sql_trans(profile, sqlbuf, profile->ireg_mutex);
 				//sofia_glue_actually_execute_sql(profile, "commit;\n", NULL);
-
-
-				switch_mutex_unlock(profile->ireg_mutex);
+				//switch_mutex_unlock(profile->ireg_mutex);
 				loop_count = 0;
 			}
 		} else {
 			if (qsize) {
-				switch_mutex_lock(profile->ireg_mutex);
+				//switch_mutex_lock(profile->ireg_mutex);
 				while (switch_queue_trypop(profile->sql_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
-					sofia_glue_actually_execute_sql(profile, (char *) pop, NULL);
+					sofia_glue_actually_execute_sql(profile, (char *) pop, profile->ireg_mutex);
 					free(pop);
 				}
-				switch_mutex_unlock(profile->ireg_mutex);
+				//switch_mutex_unlock(profile->ireg_mutex);
 			}
 		}
-		
+
 		if (++loops >= 1000) {
 			if (++ireg_loops >= IREG_SECONDS) {
 				time_t now = switch_epoch_time_now(NULL);
@@ -1026,8 +1301,6 @@
 	switch_thread_t *worker_thread;
 	switch_status_t st;
 
-	
-
 	switch_mutex_lock(mod_sofia_globals.mutex);
 	mod_sofia_globals.threads++;
 	switch_mutex_unlock(mod_sofia_globals.mutex);
@@ -1039,14 +1312,12 @@
 
 	if (!sofia_glue_init_sql(profile)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open SQL Database [%s]!\n", profile->name);
+		sofia_profile_start_failure(profile, profile->name);
 		sofia_glue_del_profile(profile);
 		goto end;
 	}
 
-	supported = switch_core_sprintf(profile->pool, "%s%sprecondition, path, replaces", 
-									use_100rel ? "100rel, " : "",
-									use_timer ? "timer, " : ""
-									);
+	supported = switch_core_sprintf(profile->pool, "%s%sprecondition, path, replaces", use_100rel ? "100rel, " : "", use_timer ? "timer, " : "");
 
 	if (sofia_test_pflag(profile, PFLAG_AUTO_NAT) && switch_core_get_variable("nat_type")) {
 		if (switch_nat_add_mapping(profile->sip_port, SWITCH_NAT_UDP, NULL, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
@@ -1055,7 +1326,8 @@
 		if (switch_nat_add_mapping(profile->sip_port, SWITCH_NAT_TCP, NULL, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created TCP nat mapping for %s port %d\n", profile->name, profile->sip_port);
 		}
-		if(sofia_test_pflag(profile, PFLAG_TLS) && switch_nat_add_mapping(profile->tls_sip_port, SWITCH_NAT_TCP, NULL, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
+		if (sofia_test_pflag(profile, PFLAG_TLS)
+			&& switch_nat_add_mapping(profile->tls_sip_port, SWITCH_NAT_TCP, NULL, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created TCP/TLS nat mapping for %s port %d\n", profile->name, profile->tls_sip_port);
 		}
 	}
@@ -1063,30 +1335,11 @@
 	profile->nua = nua_create(profile->s_root,	/* Event loop */
 							  sofia_event_callback,	/* Callback for processing events */
 							  profile,	/* Additional data to pass to callback */
-							  NUTAG_URL(profile->bindurl),
-							  NTATAG_USER_VIA(1),
-							  TAG_IF(!strchr(profile->sipip, ':'), SOATAG_AF(SOA_AF_IP4_ONLY)),
-							  TAG_IF(strchr(profile->sipip, ':'), SOATAG_AF(SOA_AF_IP6_ONLY)),
-							  TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_SIPS_URL(profile->tls_bindurl)), 
-							  TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_CERTIFICATE_DIR(profile->tls_cert_dir)), 
-							  TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_TLS_VERIFY_POLICY(0)),
-							  TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_TLS_VERSION(profile->tls_version)), 
-							  TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_KEEPALIVE(20000)),
-							  TAG_IF(!strchr(profile->sipip, ':'), NTATAG_UDP_MTU(65535)), 
- 							  TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_SRV), NTATAG_USE_SRV(0)),
- 							  TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_NAPTR), NTATAG_USE_NAPTR(0)),
-							  NTATAG_DEFAULT_PROXY(profile->outbound_proxy),
-							  NTATAG_SERVER_RPORT(profile->rport_level),
-							  TPTAG_LOG(sofia_test_flag(profile, TFLAG_TPORT_LOG)), 
- 							  TAG_IF(sofia_test_pflag(profile, PFLAG_SIPCOMPACT), NTATAG_SIPFLAGS(MSG_DO_COMPACT)),
-							  TAG_IF(profile->timer_t1, NTATAG_SIP_T1(profile->timer_t1)),
-							  TAG_IF(profile->timer_t1x64, NTATAG_SIP_T1X64(profile->timer_t1x64)),
-							  TAG_IF(profile->timer_t2, NTATAG_SIP_T2(profile->timer_t2)),
-							  TAG_IF(profile->timer_t4, NTATAG_SIP_T4(profile->timer_t4)),
-							  TAG_END());	/* Last tag should always finish the sequence */
+							  NUTAG_URL(profile->bindurl), NTATAG_USER_VIA(1), TAG_IF(!strchr(profile->sipip, ':'), SOATAG_AF(SOA_AF_IP4_ONLY)), TAG_IF(strchr(profile->sipip, ':'), SOATAG_AF(SOA_AF_IP6_ONLY)), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_SIPS_URL(profile->tls_bindurl)), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), NUTAG_CERTIFICATE_DIR(profile->tls_cert_dir)), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_TLS_VERIFY_POLICY(0)), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_TLS_VERSION(profile->tls_version)), TAG_IF(sofia_test_pflag(profile, PFLAG_TLS), TPTAG_KEEPALIVE(20000)), TAG_IF(!strchr(profile->sipip, ':'), NTATAG_UDP_MTU(65535)), TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_SRV), NTATAG_USE_SRV(0)), TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_NAPTR), NTATAG_USE_NAPTR(0)), NTATAG_DEFAULT_PROXY(profile->outbound_proxy), NTATAG_SERVER_RPORT(profile->rport_level), TPTAG_LOG(sofia_test_flag(profile, TFLAG_TPORT_LOG)), TAG_IF(sofia_test_pflag(profile, PFLAG_SIPCOMPACT), NTATAG_SIPFLAGS(MSG_DO_COMPACT)), TAG_IF(profile->timer_t1, NTATAG_SIP_T1(profile->timer_t1)), TAG_IF(profile->timer_t1x64, NTATAG_SIP_T1X64(profile->timer_t1x64)), TAG_IF(profile->timer_t2, NTATAG_SIP_T2(profile->timer_t2)), TAG_IF(profile->timer_t4, NTATAG_SIP_T4(profile->timer_t4)), TAG_END());	/* Last tag should always finish the sequence */
 
 	if (!profile->nua) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Creating SIP UA for profile: %s\n", profile->name);
+		sofia_profile_start_failure(profile, profile->name);
 		sofia_glue_del_profile(profile);
 		goto end;
 	}
@@ -1098,10 +1351,7 @@
 				   NUTAG_APPL_METHOD("OPTIONS"),
 				   NUTAG_APPL_METHOD("REFER"),
 				   NUTAG_APPL_METHOD("REGISTER"),
-				   NUTAG_APPL_METHOD("NOTIFY"),
-				   NUTAG_APPL_METHOD("INFO"),
-				   NUTAG_APPL_METHOD("ACK"),
-				   NUTAG_APPL_METHOD("SUBSCRIBE"),
+				   NUTAG_APPL_METHOD("NOTIFY"), NUTAG_APPL_METHOD("INFO"), NUTAG_APPL_METHOD("ACK"), NUTAG_APPL_METHOD("SUBSCRIBE"),
 #ifdef MANUAL_BYE
 				   NUTAG_APPL_METHOD("BYE"),
 #endif
@@ -1116,20 +1366,19 @@
 				   NUTAG_ALLOW("NOTIFY"),
 				   NUTAG_ALLOW_EVENTS("talk"),
 				   NUTAG_SESSION_TIMER(profile->session_timeout),
-				   TAG_IF(profile->minimum_session_expires, NUTAG_MIN_SE(profile->minimum_session_expires)),
 				   NTATAG_MAX_PROCEEDING(profile->max_proceeding),
 				   TAG_IF(profile->pres_type, NUTAG_ALLOW("PUBLISH")),
 				   TAG_IF(profile->pres_type, NUTAG_ALLOW("SUBSCRIBE")),
 				   TAG_IF(profile->pres_type, NUTAG_ENABLEMESSAGE(1)),
 				   TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("presence")),
 				   TAG_IF((profile->pres_type || sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)), NUTAG_ALLOW_EVENTS("dialog")),
+				   TAG_IF((profile->pres_type || sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)), NUTAG_ALLOW_EVENTS("line-seize")),
 				   TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("call-info")),
 				   TAG_IF((profile->pres_type || sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)), NUTAG_ALLOW_EVENTS("sla")),
 				   TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("include-session-description")),
 				   TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("presence.winfo")),
 				   TAG_IF(profile->pres_type, NUTAG_ALLOW_EVENTS("message-summary")),
-				   NUTAG_ALLOW_EVENTS("refer"),
-				   SIPTAG_SUPPORTED_STR(supported), SIPTAG_USER_AGENT_STR(profile->user_agent), TAG_END());
+				   NUTAG_ALLOW_EVENTS("refer"), SIPTAG_SUPPORTED_STR(supported), SIPTAG_USER_AGENT_STR(profile->user_agent), TAG_END());
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set params for %s\n", profile->name);
 
@@ -1190,6 +1439,7 @@
 
 	switch_yield(1000000);
 
+
 	while (mod_sofia_globals.running == 1 && sofia_test_pflag(profile, PFLAG_RUNNING) && sofia_test_pflag(profile, PFLAG_WORKER_RUNNING)) {
 		su_root_step(profile->s_root, 1000);
 	}
@@ -1213,12 +1463,12 @@
 	sofia_reg_unregister(profile);
 	nua_shutdown(profile->nua);
 	su_root_run(profile->s_root);
-	
+
 	sofia_clear_pflag_locked(profile, PFLAG_RUNNING);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Waiting for worker thread\n");
 
 	switch_thread_join(&st, worker_thread);
-	
+
 	sanity = 4;
 	while (profile->inuse) {
 		switch_core_session_hupall_matching_var("sofia_profile_name", profile->name, SWITCH_CAUSE_MANAGER_REQUEST);
@@ -1229,7 +1479,7 @@
 		}
 	}
 	nua_destroy(profile->nua);
-	
+
 	switch_mutex_lock(profile->ireg_mutex);
 	switch_mutex_unlock(profile->ireg_mutex);
 
@@ -1259,7 +1509,7 @@
 		if (switch_nat_del_mapping(profile->sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted TCP nat mapping for %s port %d\n", profile->name, profile->sip_port);
 		}
-		if(sofia_test_pflag(profile, PFLAG_TLS) && switch_nat_del_mapping(profile->tls_sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) {
+		if (sofia_test_pflag(profile, PFLAG_TLS) && switch_nat_del_mapping(profile->tls_sip_port, SWITCH_NAT_TCP) == SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleted TCP/TLS nat mapping for %s port %d\n", profile->name, profile->tls_sip_port);
 		}
 	}
@@ -1302,14 +1552,17 @@
 
 static void logger(void *logarg, char const *fmt, va_list ap)
 {
-	if (fmt && ap) {
+	if (!fmt)
+		return;
+
+	if (ap) {
 		switch_log_vprintf(SWITCH_CHANNEL_LOG_CLEAN, mod_sofia_globals.tracelevel, fmt, ap);
-	} else if (fmt && !ap) {
+	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, mod_sofia_globals.tracelevel, "%s", fmt);
 	}
 }
 
-static su_log_t *sofia_get_logger(const char *name) 
+static su_log_t *sofia_get_logger(const char *name)
 {
 	if (!strcasecmp(name, "tport")) {
 		return tport_log;
@@ -1325,6 +1578,8 @@
 		return nth_server_log;
 	} else if (!strcasecmp(name, "nua")) {
 		return nua_log;
+	} else if (!strcasecmp(name, "soa")) {
+		return soa_log;
 	} else if (!strcasecmp(name, "sresolv")) {
 		return sresolv_log;
 	} else if (!strcasecmp(name, "stun")) {
@@ -1339,11 +1594,11 @@
 switch_status_t sofia_set_loglevel(const char *name, int level)
 {
 	su_log_t *log = NULL;
-	
+
 	if (level < 0 || level > 9) {
 		return SWITCH_STATUS_FALSE;
 	}
-		
+
 	if (!strcasecmp(name, "all")) {
 		su_log_set_level(su_log_default, level);
 		su_log_set_level(tport_log, level);
@@ -1358,20 +1613,20 @@
 		su_log_set_level(stun_log, level);
 		return SWITCH_STATUS_SUCCESS;
 	}
-	
+
 	if (!(log = sofia_get_logger(name))) {
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	su_log_set_level(log, level);
-		
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
 int sofia_get_loglevel(const char *name)
 {
 	su_log_t *log = NULL;
-	
+
 	if ((log = sofia_get_logger(name))) {
 		return log->log_level;
 	} else {
@@ -1389,10 +1644,10 @@
 		if ((gw_sub = switch_core_alloc(profile->pool, sizeof(*gw_sub)))) {
 			char *expire_seconds = "3600", *retry_seconds = "30", *content_type = "NO_CONTENT_TYPE";
 			char *event = (char *) switch_xml_attr_soft(subscription_tag, "event");
-			gw_sub->event = switch_core_strdup(gateway->pool, event);			
+			gw_sub->event = switch_core_strdup(gateway->pool, event);
 			gw_sub->gateway = gateway;
 			gw_sub->next = NULL;
-			
+
 			for (param = switch_xml_child(subscription_tag, "param"); param; param = param->next) {
 				char *var = (char *) switch_xml_attr_soft(param, "name");
 				char *val = (char *) switch_xml_attr_soft(param, "value");
@@ -1404,23 +1659,22 @@
 					content_type = val;
 				}
 			}
-			
+
 			gw_sub->retry_seconds = atoi(retry_seconds);
 			if (gw_sub->retry_seconds < 10) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "INVALID: retry_seconds correcting the value to 30\n");
 				gw_sub->retry_seconds = 30;
 			}
-			
-			gw_sub->expires_str = switch_core_strdup(gateway->pool, expire_seconds);  
-			
+
+			gw_sub->expires_str = switch_core_strdup(gateway->pool, expire_seconds);
+
 			if ((gw_sub->freq = atoi(gw_sub->expires_str)) < 5) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-				"Invalid Freq: %d.  Setting Register-Frequency to 3600\n", gw_sub->freq);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid Freq: %d.  Setting Register-Frequency to 3600\n", gw_sub->freq);
 				gw_sub->freq = 3600;
 			}
 			gw_sub->freq -= 2;
 			gw_sub->content_type = switch_core_strdup(gateway->pool, content_type);
-			gw_sub->next = gateway->subscriptions;		
+			gw_sub->next = gateway->subscriptions;
 		}
 		gateway->subscriptions = gw_sub;
 	}
@@ -1451,7 +1705,7 @@
 			const char *sipip, *format;
 			switch_uuid_t uuid;
 			uint32_t ping_freq = 0, extension_in_contact = 0, distinct_to = 0;
-			int ping_max = 0, ping_min = 0;
+			int ping_max = 1, ping_min = -1;
 			char *register_str = "true", *scheme = "Digest",
 				*realm = NULL,
 				*username = NULL,
@@ -1465,14 +1719,14 @@
 				*retry_seconds = "30",
 				*from_user = "", *from_domain = NULL, *outbound_proxy = NULL, *register_proxy = NULL, *contact_host = NULL,
 				*contact_params = NULL, *params = NULL, *register_transport = NULL;
-			
+
 			if (!context) {
 				context = "default";
 			}
-			
+
 			switch_uuid_get(&uuid);
 			switch_uuid_format(gateway->uuid_str, &uuid);
-			
+
 			gateway->register_transport = SOFIA_TRANSPORT_UDP;
 			gateway->pool = profile->pool;
 			gateway->profile = profile;
@@ -1481,23 +1735,23 @@
 			gateway->next = NULL;
 			gateway->ping = 0;
 			gateway->ping_freq = 0;
-			gateway->ping_max = 1;
-			gateway->ping_min = -1;
+			gateway->ping_max = 0;
+			gateway->ping_min = 0;
 			gateway->ping_count = 0;
-			
+
 			if ((x_params = switch_xml_child(gateway_tag, "variables"))) {
 				param = switch_xml_child(x_params, "variable");
 			} else {
 				param = switch_xml_child(gateway_tag, "variable");
 			}
-			
-			
+
+
 			for (; param; param = param->next) {
 				const char *var = switch_xml_attr(param, "name");
 				const char *val = switch_xml_attr(param, "value");
 				const char *direction = switch_xml_attr(param, "direction");
 				int in = 0, out = 0;
-				
+
 				if (var && val) {
 					if (direction) {
 						if (!strcasecmp(direction, "inbound")) {
@@ -1530,11 +1784,11 @@
 			} else {
 				param = switch_xml_child(gateway_tag, "param");
 			}
-			
+
 			for (; param; param = param->next) {
 				char *var = (char *) switch_xml_attr_soft(param, "name");
 				char *val = (char *) switch_xml_attr_soft(param, "value");
-				
+
 				if (!strcmp(var, "register")) {
 					register_str = val;
 				} else if (!strcmp(var, "scheme")) {
@@ -1567,7 +1821,7 @@
 					expire_seconds = val;
 				} else if (!strcmp(var, "retry-seconds")) {
 					retry_seconds = val;
-				} else if (!strcmp(var, "retry_seconds")) { // support typo for back compat
+				} else if (!strcmp(var, "retry_seconds")) {	// support typo for back compat
 					retry_seconds = val;
 				} else if (!strcmp(var, "from-user")) {
 					from_user = val;
@@ -1609,7 +1863,7 @@
 			if ((gw_subs_tag = switch_xml_child(gateway_tag, "subscriptions"))) {
 				parse_gateway_subscriptions(profile, gateway, gw_subs_tag);
 			}
-			
+
 			if (zstr(realm)) {
 				if (zstr(proxy)) {
 					realm = name;
@@ -1648,7 +1902,7 @@
 			if (zstr(auth_username)) {
 				auth_username = username;
 			}
-			
+
 			if (!zstr(register_proxy)) {
 				if (strncasecmp(register_proxy, "sip:", 4) && strncasecmp(register_proxy, "sips:", 5)) {
 					gateway->register_sticky_proxy = switch_core_sprintf(gateway->pool, "sip:%s", register_proxy);
@@ -1702,10 +1956,10 @@
 			}
 
 			gateway->register_url = switch_core_sprintf(gateway->pool, "sip:%s", proxy);
-			gateway->register_from = switch_core_sprintf(gateway->pool, "<sip:%s@%s;transport=%s>", 
+			gateway->register_from = switch_core_sprintf(gateway->pool, "<sip:%s@%s;transport=%s>",
 														 from_user, !zstr(from_domain) ? from_domain : proxy, register_transport);
 
-			sipip = contact_host ? contact_host : profile->extsipip ?  profile->extsipip : profile->sipip;
+			sipip = contact_host ? contact_host : profile->extsipip ? profile->extsipip : profile->sipip;
 
 			if (extension_in_contact) {
 				format = strchr(sipip, ':') ? "<sip:%s@[%s]:%d%s>" : "<sip:%s@%s:%d%s>";
@@ -1722,7 +1976,7 @@
 			}
 
 			gateway->extension = switch_core_strdup(gateway->pool, extension);
-			
+
 			if (!strncasecmp(proxy, "sip:", 4)) {
 				gateway->register_proxy = switch_core_strdup(gateway->pool, proxy);
 				gateway->register_to = switch_core_sprintf(gateway->pool, "sip:%s@%s", username, proxy + 4);
@@ -1734,8 +1988,8 @@
 			gateway->expires_str = switch_core_strdup(gateway->pool, expire_seconds);
 
 			if ((gateway->freq = atoi(gateway->expires_str)) < 5) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid register-frequency of %d on gateway %s, using the value of 3600 instead\n",
-								  gateway->freq, name);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+								  "Invalid register-frequency of %d on gateway %s, using the value of 3600 instead\n", gateway->freq, name);
 				gateway->freq = 3600;
 			}
 
@@ -1755,8 +2009,7 @@
 		if (sofia_glue_add_profile(switch_core_strdup(profile->pool, dname), profile) == SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Alias [%s] for profile [%s]\n", dname, profile->name);
 		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Alias [%s] for profile [%s] (already exists)\n",                         
-							  dname, profile->name);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Alias [%s] for profile [%s] (already exists)\n", dname, profile->name);
 		}
 	}
 
@@ -1796,7 +2049,7 @@
 	if (switch_stristr("~CISCO_SKIP_MARK_BIT_2833", str)) {
 		profile->auto_rtp_bugs &= ~RTP_BUG_CISCO_SKIP_MARK_BIT_2833;
 	}
-	
+
 	if (switch_stristr("SONUS_SEND_INVALID_TIMESTAMP_2833", str)) {
 		profile->auto_rtp_bugs |= RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833;
 	}
@@ -1825,7 +2078,7 @@
 		status = SWITCH_STATUS_FALSE;
 		goto done;
 	}
-	
+
 	if ((profiles = switch_xml_child(cfg, "profiles"))) {
 		for (xprofile = switch_xml_child(profiles, "profile"); xprofile; xprofile = xprofile->next) {
 			char *xprofilename = (char *) switch_xml_attr_soft(xprofile, "name");
@@ -1836,7 +2089,7 @@
 			}
 
 			/* you could change profile->foo here if it was a minor change like context or dialplan ... */
-			profile->rport_level = 1; /* default setting */
+			profile->rport_level = 1;	/* default setting */
 			profile->acl_count = 0;
 			profile->reg_acl_count = 0;
 			profile->proxy_acl_count = 0;
@@ -1845,7 +2098,8 @@
 			profile->ib_calls = 0;
 			profile->ob_calls = 0;
 			profile->ib_failed_calls = 0;
-			profile->ob_failed_calls = 0;		
+			profile->ob_failed_calls = 0;
+			profile->shutdown_type = "false";
 
 			if (xprofiledomain) {
 				profile->domain_name = switch_core_strdup(profile->pool, xprofiledomain);
@@ -1857,6 +2111,8 @@
 					char *val = (char *) switch_xml_attr_soft(param, "value");
 					if (!strcasecmp(var, "debug")) {
 						profile->debug = atoi(val);
+					} else if (!strcasecmp(var, "shutdown-on-fail")) {
+						profile->shutdown_type = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "tracelevel")) {
 						mod_sofia_globals.tracelevel = switch_log_str2level(val);
 					} else if (!strcasecmp(var, "pass-callee-id")) {
@@ -1880,15 +2136,16 @@
 							sofia_set_pflag(profile, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER);
 						} else {
 							sofia_clear_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER);
+							sofia_clear_pflag(profile, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER);
 						}
 					} else if (!strcasecmp(var, "auto-rtp-bugs")) {
 						parse_rtp_bugs(profile, val);
-					} else if (!strcasecmp(var, "user-agent-string")) { 
+					} else if (!strcasecmp(var, "user-agent-string")) {
 						profile->user_agent = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "auto-restart")) {
 						profile->auto_restart = switch_true(val);
 					} else if (!strcasecmp(var, "log-auth-failures")) {
-						if (switch_true(val)) { 
+						if (switch_true(val)) {
 							sofia_set_pflag(profile, PFLAG_LOG_AUTH_FAIL);
 						} else {
 							sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL);
@@ -1929,7 +2186,7 @@
 							sofia_clear_flag(profile, TFLAG_LATE_NEGOTIATION);
 						}
 					} else if (!strcasecmp(var, "inbound-proxy-media")) {
-						if (switch_true(val)) { 
+						if (switch_true(val)) {
 							sofia_set_flag(profile, TFLAG_PROXY_MEDIA);
 						} else {
 							sofia_clear_flag(profile, TFLAG_PROXY_MEDIA);
@@ -1971,7 +2228,7 @@
 							profile->ndlb &= ~PFLAG_NDLB_ALLOW_BAD_IANANAME;
 						}
 					} else if (!strcasecmp(var, "aggressive-nat-detection")) {
-						if (switch_true(val)) { 
+						if (switch_true(val)) {
 							sofia_set_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION);
 						} else {
 							sofia_clear_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION);
@@ -1984,15 +2241,15 @@
 						}
 					} else if (!strcasecmp(var, "NDLB-support-asterisk-missing-srtp-auth")) {
 						if (switch_true(val)) {
-							sofia_set_pflag(profile, PFLAG_DISABLE_SRTP_AUTH); 
+							sofia_set_pflag(profile, PFLAG_DISABLE_SRTP_AUTH);
 						} else {
-							sofia_clear_pflag(profile, PFLAG_DISABLE_SRTP_AUTH); 
+							sofia_clear_pflag(profile, PFLAG_DISABLE_SRTP_AUTH);
 						}
 					} else if (!strcasecmp(var, "NDLB-funny-stun")) {
 						if (switch_true(val)) {
-							sofia_set_pflag(profile, PFLAG_FUNNY_STUN); 
+							sofia_set_pflag(profile, PFLAG_FUNNY_STUN);
 						} else {
-							sofia_clear_pflag(profile, PFLAG_FUNNY_STUN); 
+							sofia_clear_pflag(profile, PFLAG_FUNNY_STUN);
 						}
 					} else if (!strcasecmp(var, "stun-enabled")) {
 						if (switch_true(val)) {
@@ -2004,7 +2261,7 @@
 						if (switch_true(val)) {
 							sofia_set_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
 						} else {
-							sofia_clear_pflag(profile, PFLAG_STUN_AUTO_DISABLE); 
+							sofia_clear_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
 						}
 					} else if (!strcasecmp(var, "apply-nat-acl")) {
 						if (profile->acl_count < SOFIA_MAX_ACL) {
@@ -2035,6 +2292,10 @@
 						} else {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Max acl records of %d reached\n", SOFIA_MAX_ACL);
 						}
+					} else if (!strcasecmp(var, "user-agent-filter")) {
+						profile->user_agent_filter = switch_core_strdup(profile->pool, val);
+					} else if (!strcasecmp(var, "max-registrations-per-extension")) {
+						profile->max_registrations_perext = atoi(val);
 					} else if (!strcasecmp(var, "rfc2833-pt")) {
 						profile->te = (switch_payload_t) atoi(val);
 					} else if (!strcasecmp(var, "cng-pt") && !(sofia_test_pflag(profile, PFLAG_SUPPRESS_CNG))) {
@@ -2146,7 +2407,11 @@
 					} else if (!strcasecmp(var, "context")) {
 						profile->context = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "local-network-acl")) {
-						profile->local_network = switch_core_strdup(profile->pool, val);
+						if (!strcasecmp(var, "none")) {
+							profile->local_network = NULL;
+						} else {
+							profile->local_network = switch_core_strdup(profile->pool, val);
+						}
 					} else if (!strcasecmp(var, "force-register-domain")) {
 						profile->reg_domain = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "force-subscription-domain")) {
@@ -2193,7 +2458,8 @@
 							profile->dtmf_duration = dur;
 						} else {
 							profile->dtmf_duration = SWITCH_DEFAULT_DTMF_DURATION;
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Duration out of bounds, using default of %d!\n", SWITCH_DEFAULT_DTMF_DURATION);
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Duration out of bounds, using default of %d!\n",
+											  SWITCH_DEFAULT_DTMF_DURATION);
 						}
 					} else if (!strcasecmp(var, "timer-T1")) {
 						int v = atoi(val);
@@ -2234,7 +2500,7 @@
 			if ((gateways_tag = switch_xml_child(xprofile, "gateways"))) {
 				parse_gateways(profile, gateways_tag);
 			}
-			
+
 			status = SWITCH_STATUS_SUCCESS;
 
 			if ((domains_tag = switch_xml_child(xprofile, "domains"))) {
@@ -2243,7 +2509,7 @@
 				switch_assert(xml_params);
 				switch_event_add_header_string(xml_params, SWITCH_STACK_BOTTOM, "purpose", "gateways");
 				switch_event_add_header_string(xml_params, SWITCH_STACK_BOTTOM, "profile", profile->name);
-				
+
 				for (domain_tag = switch_xml_child(domains_tag, "domain"); domain_tag; domain_tag = domain_tag->next) {
 					switch_xml_t droot, x_domain_tag;
 					const char *dname = switch_xml_attr_soft(domain_tag, "name");
@@ -2266,7 +2532,7 @@
 						}
 					}
 				}
-				
+
 				switch_event_destroy(&xml_params);
 			}
 
@@ -2274,7 +2540,7 @@
 				for (alias_tag = switch_xml_child(aliases_tag, "alias"); alias_tag; alias_tag = alias_tag->next) {
 					char *aname = (char *) switch_xml_attr_soft(alias_tag, "name");
 					if (!zstr(aname)) {
-						
+
 						if (sofia_glue_add_profile(switch_core_strdup(profile->pool, aname), profile) == SWITCH_STATUS_SUCCESS) {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding Alias [%s] for profile [%s]\n", aname, profile->name);
 						} else {
@@ -2287,11 +2553,11 @@
 		}
 	}
 
- done:
+  done:
 
 	if (xml) {
-        switch_xml_free(xml);
-    }
+		switch_xml_free(xml);
+	}
 
 	switch_event_destroy(&params);
 
@@ -2314,7 +2580,7 @@
 			su_deinit();
 			return SWITCH_STATUS_FALSE;
 		}
-		
+
 		/* Redirect loggers in sofia */
 		su_log_redirect(su_log_default, logger, NULL);
 		su_log_redirect(tport_log, logger, NULL);
@@ -2357,21 +2623,33 @@
 				su_log_set_level(NULL, atoi(val));
 			} else if (!strcasecmp(var, "debug-presence")) {
 				mod_sofia_globals.debug_presence = atoi(val);
+			} else if (!strcasecmp(var, "debug-sla")) {
+				mod_sofia_globals.debug_sla = atoi(val);
 			} else if (!strcasecmp(var, "auto-restart")) {
 				mod_sofia_globals.auto_restart = switch_true(val);
 			} else if (!strcasecmp(var, "rewrite-multicasted-fs-path")) {
-				mod_sofia_globals.rewrite_multicasted_fs_path = switch_true(val);
+				if( (!strcasecmp(val, "to_host")) || (!strcasecmp(val, "1")) ) {
+					/* old behaviour */
+                                	mod_sofia_globals.rewrite_multicasted_fs_path = 1;
+				} else if (!strcasecmp(val, "original_server_host")) {
+                                	mod_sofia_globals.rewrite_multicasted_fs_path = 2;
+				} else if (!strcasecmp(val, "original_hostname")) {
+                                	mod_sofia_globals.rewrite_multicasted_fs_path = 3;
+				} else {
+					mod_sofia_globals.rewrite_multicasted_fs_path = SWITCH_FALSE;
+				}
 			}
 		}
 	}
 
 	if ((profiles = switch_xml_child(cfg, "profiles"))) {
 		for (xprofile = switch_xml_child(profiles, "profile"); xprofile; xprofile = xprofile->next) {
+			char *xprofilename = (char *) switch_xml_attr_soft(xprofile, "name");
+			char *xprofiledomain = (char *) switch_xml_attr(xprofile, "domain");
 			if (!(settings = switch_xml_child(xprofile, "settings"))) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Settings, check the new config!\n");
+				sofia_profile_start_failure(NULL, xprofilename);
 			} else {
-				char *xprofilename = (char *) switch_xml_attr_soft(xprofile, "name");
-				char *xprofiledomain = (char *) switch_xml_attr(xprofile, "domain");
 				switch_memory_pool_t *pool = NULL;
 
 				if (!xprofilename) {
@@ -2389,14 +2667,18 @@
 				/* Setup the pool */
 				if ((status = switch_core_new_memory_pool(&pool)) != SWITCH_STATUS_SUCCESS) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+					sofia_profile_start_failure(NULL, xprofilename);
 					goto done;
 				}
 
 				if (!(profile = (sofia_profile_t *) switch_core_alloc(pool, sizeof(*profile)))) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
+					sofia_profile_start_failure(NULL, xprofilename);
 					goto done;
 				}
 
+				profile->trans_timeout = 500;
+
 				profile->auto_rtp_bugs = RTP_BUG_CISCO_SKIP_MARK_BIT_2833 | RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833;
 
 				profile->pool = pool;
@@ -2426,6 +2708,9 @@
 				sofia_set_pflag(profile, PFLAG_PASS_CALLEE_ID);
 				sofia_set_pflag(profile, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER);
 				sofia_set_pflag(profile, PFLAG_SQL_IN_TRANS);
+				profile->shutdown_type = "false";
+				profile->local_network = "localnet.auto";
+				sofia_set_flag(profile, TFLAG_ENABLE_SOA);
 
 				for (param = switch_xml_child(settings, "param"); param; param = param->next) {
 					char *var = (char *) switch_xml_attr_soft(param, "name");
@@ -2435,6 +2720,8 @@
 
 					if (!strcasecmp(var, "debug")) {
 						profile->debug = atoi(val);
+					} else if (!strcasecmp(var, "shutdown-on-fail")) {
+						profile->shutdown_type = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "sip-trace") && switch_true(val)) {
 						sofia_set_flag(profile, TFLAG_TPORT_LOG);
 					} else if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
@@ -2454,7 +2741,7 @@
 					} else if (!strcasecmp(var, "auto-restart")) {
 						profile->auto_restart = switch_true(val);
 					} else if (!strcasecmp(var, "log-auth-failures")) {
-						if (switch_true(val)) { 
+						if (switch_true(val)) {
 							sofia_set_pflag(profile, PFLAG_LOG_AUTH_FAIL);
 						} else {
 							sofia_clear_pflag(profile, PFLAG_LOG_AUTH_FAIL);
@@ -2514,6 +2801,7 @@
 							sofia_set_pflag(profile, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER);
 						} else {
 							sofia_clear_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER);
+							sofia_clear_pflag(profile, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER);
 						}
 					} else if (!strcasecmp(var, "inbound-use-callid-as-uuid")) {
 						if (switch_true(val)) {
@@ -2527,6 +2815,8 @@
 						} else {
 							sofia_clear_pflag(profile, PFLAG_UUID_AS_CALLID);
 						}
+					} else if (!strcasecmp(var, "track-calls") && switch_true(val)) {
+						sofia_set_pflag(profile, PFLAG_TRACK_CALLS);
 					} else if (!strcasecmp(var, "NDLB-received-in-nat-reg-contact") && switch_true(val)) {
 						sofia_set_pflag(profile, PFLAG_RECIEVED_IN_NAT_REG_CONTACT);
 					} else if (!strcasecmp(var, "aggressive-nat-detection") && switch_true(val)) {
@@ -2537,28 +2827,32 @@
 						sofia_set_pflag(profile, PFLAG_DISABLE_SRTP_AUTH);
 					} else if (!strcasecmp(var, "NDLB-funny-stun")) {
 						if (switch_true(val)) {
-							sofia_set_pflag(profile, PFLAG_FUNNY_STUN); 
+							sofia_set_pflag(profile, PFLAG_FUNNY_STUN);
 						} else {
-							sofia_clear_pflag(profile, PFLAG_FUNNY_STUN); 
+							sofia_clear_pflag(profile, PFLAG_FUNNY_STUN);
 						}
 					} else if (!strcasecmp(var, "stun-enabled")) {
 						if (switch_true(val)) {
 							sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
 						} else {
-							sofia_clear_pflag(profile, PFLAG_STUN_ENABLED); 
+							sofia_clear_pflag(profile, PFLAG_STUN_ENABLED);
 						}
 					} else if (!strcasecmp(var, "stun-auto-disable")) {
 						if (switch_true(val)) {
 							sofia_set_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
 						} else {
-							sofia_clear_pflag(profile, PFLAG_STUN_AUTO_DISABLE); 
+							sofia_clear_pflag(profile, PFLAG_STUN_AUTO_DISABLE);
 						}
+					} else if (!strcasecmp(var, "user-agent-filter")) {
+						profile->user_agent_filter = switch_core_strdup(profile->pool, val);
+					} else if (!strcasecmp(var, "max-registrations-per-extension")) {
+						profile->max_registrations_perext = atoi(val);
 					} else if (!strcasecmp(var, "rfc2833-pt")) {
 						profile->te = (switch_payload_t) atoi(val);
 					} else if (!strcasecmp(var, "cng-pt") && !sofia_test_pflag(profile, PFLAG_SUPPRESS_CNG)) {
 						profile->cng_pt = (switch_payload_t) atoi(val);
 					} else if (!strcasecmp(var, "sip-port")) {
-						profile->sip_port = (switch_port_t)atoi(val);
+						profile->sip_port = (switch_port_t) atoi(val);
 					} else if (!strcasecmp(var, "vad")) {
 						if (!strcasecmp(val, "in")) {
 							sofia_set_flag(profile, TFLAG_VAD_IN);
@@ -2573,22 +2867,30 @@
 					} else if (!strcasecmp(var, "ext-rtp-ip")) {
 						if (!zstr(val)) {
 							char *ip = mod_sofia_globals.guess_ip;
-							
+
 							if (!strcmp(val, "0.0.0.0")) {
-								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid IP 0.0.0.0 replaced with %s\n", mod_sofia_globals.guess_ip);
+								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid IP 0.0.0.0 replaced with %s\n",
+												  mod_sofia_globals.guess_ip);
 							} else if (!strcasecmp(val, "auto-nat")) {
-								ip = mod_sofia_globals.auto_nat ? switch_core_get_variable("nat_public_addr") : mod_sofia_globals.guess_ip; 
+								ip = NULL;
 							} else {
 								ip = strcasecmp(val, "auto") ? val : mod_sofia_globals.guess_ip;
+								sofia_clear_pflag(profile, PFLAG_AUTO_NAT);
 							}
-							sofia_set_pflag(profile, PFLAG_AUTO_NAT);
-							profile->extrtpip = switch_core_strdup(profile->pool, ip);
+							if (ip) {
+								if (!strncasecmp(ip, "autonat:", 8)) {
+									profile->extrtpip = switch_core_strdup(profile->pool, ip + 8);
+									sofia_set_pflag(profile, PFLAG_AUTO_NAT);
+								} else {
+									profile->extrtpip = switch_core_strdup(profile->pool, ip);
+								}
+							}
 						} else {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid ext-rtp-ip\n");
 						}
 					} else if (!strcasecmp(var, "rtp-ip")) {
 						char *ip = mod_sofia_globals.guess_ip;
-						
+
 						if (!strcmp(val, "0.0.0.0")) {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid IP 0.0.0.0 replaced with %s\n", mod_sofia_globals.guess_ip);
 						} else {
@@ -2609,28 +2911,40 @@
 							char *ip = mod_sofia_globals.guess_ip;
 							char stun_ip[50] = "";
 							char *myip = stun_ip;
-							
+
 							switch_copy_string(stun_ip, ip, sizeof(stun_ip));
-							
+
 							if (!strcasecmp(val, "0.0.0.0")) {
-								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid IP 0.0.0.0 replaced with %s\n", mod_sofia_globals.guess_ip);
+								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid IP 0.0.0.0 replaced with %s\n",
+												  mod_sofia_globals.guess_ip);
 							} else if (!strcasecmp(val, "auto-nat")) {
-								ip = mod_sofia_globals.auto_nat ? switch_core_get_variable("nat_public_addr") : mod_sofia_globals.guess_ip;
+								ip = NULL;
 							} else if (strcasecmp(val, "auto")) {
 								switch_port_t port = 0;
 								if (sofia_glue_ext_address_lookup(profile, NULL, &myip, &port, val, profile->pool) == SWITCH_STATUS_SUCCESS) {
 									ip = myip;
+									sofia_clear_pflag(profile, PFLAG_AUTO_NAT);
 								} else {
 									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to get external ip.\n");
 								}
 							}
-							sofia_set_pflag(profile, PFLAG_AUTO_NAT);
-							profile->extsipip = switch_core_strdup(profile->pool, ip);
+							if (ip) {
+								if (!strncasecmp(ip, "autonat:", 8)) {
+									profile->extsipip = switch_core_strdup(profile->pool, ip + 8);
+									sofia_set_pflag(profile, PFLAG_AUTO_NAT);
+								} else {
+									profile->extsipip = switch_core_strdup(profile->pool, ip);
+								}
+							}
 						} else {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid ext-sip-ip\n");
 						}
 					} else if (!strcasecmp(var, "local-network-acl")) {
-						profile->local_network = switch_core_strdup(profile->pool, val);
+						if (!strcasecmp(var, "none")) {
+							profile->local_network = NULL;
+						} else {
+							profile->local_network = switch_core_strdup(profile->pool, val);
+						}
 					} else if (!strcasecmp(var, "force-register-domain")) {
 						profile->reg_domain = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "force-register-db-domain")) {
@@ -2678,15 +2992,19 @@
 					} else if (!strcasecmp(var, "manage-presence")) {
 						if (!strcasecmp(val, "passive")) {
 							profile->pres_type = PRES_TYPE_PASSIVE;
-						
+
 						} else if (switch_true(val)) {
 							profile->pres_type = PRES_TYPE_FULL;
-						} 
+						}
 					} else if (!strcasecmp(var, "manage-shared-appearance")) {
 						if (switch_true(val)) {
 							sofia_set_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE);
 							profile->pres_type = PRES_TYPE_FULL;
+							sofia_set_pflag(profile, PFLAG_MULTIREG);
+
+						} else if (!strcasecmp(val, "sylantro")) {
 							profile->sla_contact = switch_core_sprintf(profile->pool, "sla-agent");
+							sofia_set_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE_SYLANTRO);
 						}
 					} else if (!strcasecmp(var, "disable-srv")) {
 						if (switch_true(val)) {
@@ -2834,11 +3152,25 @@
 							sofia_clear_pflag(profile, PFLAG_PASS_CALLEE_ID);
 						}
 					} else if (!strcasecmp(var, "sql-in-transactions")) {
+						int tmp = atoi(val);
+
 						if (switch_true(val)) {
+							tmp = 500;
+						}
+
+						if (tmp > 0) {
+							profile->trans_timeout = tmp;
 							sofia_set_pflag(profile, PFLAG_SQL_IN_TRANS);
 						} else {
 							sofia_clear_pflag(profile, PFLAG_SQL_IN_TRANS);
 						}
+
+					} else if (!strcasecmp(var, "enable-soa")) {
+						if (switch_true(val)) {
+							sofia_set_flag(profile, TFLAG_ENABLE_SOA);
+						} else {
+							sofia_clear_flag(profile, TFLAG_ENABLE_SOA);
+						}
 					} else if (!strcasecmp(var, "bitpacking")) {
 						if (!strcasecmp(val, "aal2")) {
 							profile->codec_flags = SWITCH_CODEC_FLAG_AAL2;
@@ -2902,7 +3234,7 @@
 							profile->dtmf_duration = dur;
 						} else {
 							profile->dtmf_duration = SWITCH_DEFAULT_DTMF_DURATION;
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Duration out of bounds, using default of %d!\n", 
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Duration out of bounds, using default of %d!\n",
 											  SWITCH_DEFAULT_DTMF_DURATION);
 						}
 
@@ -2916,7 +3248,7 @@
 					} else if (!strcasecmp(var, "tls-bind-params")) {
 						profile->tls_bind_params = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "tls-sip-port")) {
-						profile->tls_sip_port = (switch_port_t)atoi(val);
+						profile->tls_sip_port = (switch_port_t) atoi(val);
 					} else if (!strcasecmp(var, "tls-cert-dir")) {
 						profile->tls_cert_dir = switch_core_strdup(profile->pool, val);
 					} else if (!strcasecmp(var, "tls-version")) {
@@ -2969,6 +3301,20 @@
 					profile->rtpip = switch_core_strdup(profile->pool, mod_sofia_globals.guess_ip);
 				}
 
+				if (switch_core_get_variable("nat_type")) {
+					const char *ip = switch_core_get_variable("nat_public_addr");
+					if (ip && !strchr(profile->sipip, ':')) {
+						if (!profile->extrtpip) {
+							profile->extrtpip = switch_core_strdup(profile->pool, ip);
+						}
+						if (!profile->extsipip) {
+							profile->extsipip = switch_core_strdup(profile->pool, ip);
+						}
+						sofia_set_pflag(profile, PFLAG_AUTO_NAT);
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "NAT detected setting external ip to %s\n", ip);
+					}
+				}
+
 				if (profile->nonce_ttl < 60) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Setting nonce TTL to 60 seconds\n");
 					profile->nonce_ttl = 60;
@@ -2984,7 +3330,7 @@
 				}
 
 				if (!profile->sip_port) {
-					profile->sip_port = (switch_port_t)atoi(SOFIA_DEFAULT_PORT);
+					profile->sip_port = (switch_port_t) atoi(SOFIA_DEFAULT_PORT);
 				}
 
 				if (!profile->dialplan) {
@@ -2998,105 +3344,77 @@
 				if (!profile->sipdomain) {
 					profile->sipdomain = switch_core_strdup(profile->pool, profile->sipip);
 				}
-				if (profile->extsipip && sofia_test_pflag(profile, PFLAG_AUTO_NAT)) {
+
+				if (profile->extsipip) {
 					char *ipv6 = strchr(profile->extsipip, ':');
 					profile->public_url = switch_core_sprintf(profile->pool,
 															  "sip:%s@%s%s%s:%d",
 															  profile->contact_user,
-															  ipv6 ? "[" : "",
-															  profile->extsipip,
-															  ipv6 ? "]" : "",
-															  profile->sip_port);
+															  ipv6 ? "[" : "", profile->extsipip, ipv6 ? "]" : "", profile->sip_port);
 				}
 
 				if (profile->extsipip && !sofia_test_pflag(profile, PFLAG_AUTO_NAT)) {
 					char *ipv6 = strchr(profile->extsipip, ':');
 					profile->url = switch_core_sprintf(profile->pool,
-														"sip:%s@%s%s%s:%d",
-														profile->contact_user,
-														ipv6 ? "[" : "",
-														profile->extsipip,
-														ipv6 ? "]" : "",
-														profile->sip_port);
+													   "sip:%s@%s%s%s:%d",
+													   profile->contact_user, ipv6 ? "[" : "", profile->extsipip, ipv6 ? "]" : "", profile->sip_port);
 					profile->bindurl = switch_core_sprintf(profile->pool, "%s;maddr=%s", profile->url, profile->sipip);
 				} else {
 					char *ipv6 = strchr(profile->sipip, ':');
 					profile->url = switch_core_sprintf(profile->pool,
-														"sip:%s@%s%s%s:%d",
-														profile->contact_user,
-														ipv6 ? "[" : "",
-														profile->sipip,
-														ipv6 ? "]" : "",
-														profile->sip_port);
+													   "sip:%s@%s%s%s:%d",
+													   profile->contact_user, ipv6 ? "[" : "", profile->sipip, ipv6 ? "]" : "", profile->sip_port);
 					profile->bindurl = profile->url;
 				}
 
-				profile->tcp_contact = switch_core_sprintf(profile->pool, "%s;transport=tcp", profile->url);
+				profile->tcp_contact = switch_core_sprintf(profile->pool, "<%s;transport=tcp>", profile->url);
 
-				if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) {
-					profile->tcp_public_contact = switch_core_sprintf(profile->pool, "%s;transport=tcp", profile->public_url);
+				if (profile->public_url) {
+					profile->tcp_public_contact = switch_core_sprintf(profile->pool, "<%s;transport=tcp>", profile->public_url);
 				}
 
 				if (profile->bind_params) {
 					char *bindurl = profile->bindurl;
 					profile->bindurl = switch_core_sprintf(profile->pool, "%s;%s", bindurl, profile->bind_params);
 				}
-				
+
 				/*
 				 * handle TLS params #2
 				 */
 				if (sofia_test_pflag(profile, PFLAG_TLS)) {
 					if (!profile->tls_sip_port) {
-						profile->tls_sip_port = (switch_port_t)atoi(SOFIA_DEFAULT_TLS_PORT);
+						profile->tls_sip_port = (switch_port_t) atoi(SOFIA_DEFAULT_TLS_PORT);
 					}
 
-					if (profile->extsipip && sofia_test_pflag(profile, PFLAG_AUTO_NAT)) {
+					if (profile->extsipip) {
 						char *ipv6 = strchr(profile->extsipip, ':');
 						profile->tls_public_url = switch_core_sprintf(profile->pool,
-																  "sip:%s@%s%s%s:%d",
-																  profile->contact_user,
-																  ipv6 ? "[" : "",
-																  profile->extsipip,
-																  ipv6 ? "]" : "",
-																  profile->tls_sip_port);
+																	  "sip:%s@%s%s%s:%d",
+																	  profile->contact_user,
+																	  ipv6 ? "[" : "", profile->extsipip, ipv6 ? "]" : "", profile->tls_sip_port);
 					}
-					
+
 					if (profile->extsipip && !sofia_test_pflag(profile, PFLAG_AUTO_NAT)) {
 						char *ipv6 = strchr(profile->extsipip, ':');
-						profile->tls_url = 
+						profile->tls_url =
 							switch_core_sprintf(profile->pool,
 												"sip:%s@%s%s%s:%d",
-												profile->contact_user,
-												ipv6 ? "[" : "",
-												profile->extsipip, ipv6 ? "]" : "",
-												profile->tls_sip_port);
+												profile->contact_user, ipv6 ? "[" : "", profile->extsipip, ipv6 ? "]" : "", profile->tls_sip_port);
 						profile->tls_bindurl =
 							switch_core_sprintf(profile->pool,
 												"sips:%s@%s%s%s:%d;maddr=%s",
 												profile->contact_user,
-												ipv6 ? "[" : "",
-												profile->extsipip,
-												ipv6 ? "]" : "",
-												profile->tls_sip_port,
-												profile->sipip);
+												ipv6 ? "[" : "", profile->extsipip, ipv6 ? "]" : "", profile->tls_sip_port, profile->sipip);
 					} else {
 						char *ipv6 = strchr(profile->sipip, ':');
-						profile->tls_url = 
+						profile->tls_url =
 							switch_core_sprintf(profile->pool,
 												"sip:%s@%s%s%s:%d",
-												profile->contact_user,
-												ipv6 ? "[" : "",
-												profile->sipip,
-												ipv6 ? "]" : "",
-												profile->tls_sip_port);
+												profile->contact_user, ipv6 ? "[" : "", profile->sipip, ipv6 ? "]" : "", profile->tls_sip_port);
 						profile->tls_bindurl =
 							switch_core_sprintf(profile->pool,
 												"sips:%s@%s%s%s:%d",
-												profile->contact_user,
-												ipv6 ? "[" : "",
-												profile->sipip,
-												ipv6 ? "]" : "",
-												profile->tls_sip_port);
+												profile->contact_user, ipv6 ? "[" : "", profile->sipip, ipv6 ? "]" : "", profile->tls_sip_port);
 					}
 
 					if (profile->tls_bind_params) {
@@ -3107,9 +3425,9 @@
 					if (!profile->tls_cert_dir) {
 						profile->tls_cert_dir = switch_core_sprintf(profile->pool, "%s/ssl", SWITCH_GLOBAL_dirs.conf_dir);
 					}
-					profile->tls_contact = switch_core_sprintf(profile->pool, "%s;transport=tls", profile->tls_url);
-					if (sofia_test_pflag(profile, PFLAG_AUTO_NAT)) {
-						profile->tls_public_contact = switch_core_sprintf(profile->pool, "%s;transport=tls", profile->tls_public_url);
+					profile->tls_contact = switch_core_sprintf(profile->pool, "<%s;transport=tls>", profile->tls_url);
+					if (profile->tls_public_url) {
+						profile->tls_public_contact = switch_core_sprintf(profile->pool, "<%s;transport=tls>", profile->tls_public_url);
 					}
 				}
 			}
@@ -3126,7 +3444,7 @@
 					switch_assert(xml_params);
 					switch_event_add_header_string(xml_params, SWITCH_STACK_BOTTOM, "purpose", "gateways");
 					switch_event_add_header_string(xml_params, SWITCH_STACK_BOTTOM, "profile", profile->name);
-					
+
 					for (domain_tag = switch_xml_child(domains_tag, "domain"); domain_tag; domain_tag = domain_tag->next) {
 						switch_xml_t droot, x_domain_tag;
 						const char *dname = switch_xml_attr_soft(domain_tag, "name");
@@ -3136,7 +3454,8 @@
 						if (!zstr(dname)) {
 							if (!strcasecmp(dname, "all")) {
 								switch_xml_t xml_root, x_domains;
-								if (switch_xml_locate("directory", NULL, NULL, NULL, &xml_root, &x_domains, xml_params, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
+								if (switch_xml_locate("directory", NULL, NULL, NULL, &xml_root, &x_domains, xml_params, SWITCH_FALSE) ==
+									SWITCH_STATUS_SUCCESS) {
 									for (x_domain_tag = switch_xml_child(x_domains, "domain"); x_domain_tag; x_domain_tag = x_domain_tag->next) {
 										dname = switch_xml_attr_soft(x_domain_tag, "name");
 										parse_domain_tag(profile, x_domain_tag, dname, parse, alias);
@@ -3149,7 +3468,7 @@
 							}
 						}
 					}
-					
+
 					switch_event_destroy(&xml_params);
 				}
 
@@ -3178,6 +3497,7 @@
 					}
 				} else {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Unable to start Profile %s due to no configured sip-ip\n", profile->name);
+					sofia_profile_start_failure(profile, profile->name);
 				}
 				profile = NULL;
 			}
@@ -3224,12 +3544,12 @@
 			if (gateway->ping_count < gateway->ping_max) {
 				gateway->ping_count++;
 
-				if (gateway->ping_count >= 0) gateway->status = SOFIA_GATEWAY_UP;
+				if (gateway->ping_count >= 0)
+					gateway->status = SOFIA_GATEWAY_UP;
 
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
-					"Ping succeeded %s with code %d - count %d/%d/%d, state %s\n",
-					gateway->name, status, gateway->ping_min, gateway->ping_count, gateway->ping_max,
-					status_names[gateway->status]);
+								  "Ping succeeded %s with code %d - count %d/%d/%d, state %s\n",
+								  gateway->name, status, gateway->ping_min, gateway->ping_count, gateway->ping_max, status_names[gateway->status]);
 			}
 		} else {
 			if (gateway->state == REG_STATE_REGED) {
@@ -3240,13 +3560,13 @@
 			if (gateway->ping_count > gateway->ping_min) {
 				gateway->ping_count--;
 
-				if (gateway->ping_count <= 0) gateway->status = SOFIA_GATEWAY_DOWN;
+				if (gateway->ping_count <= 0)
+					gateway->status = SOFIA_GATEWAY_DOWN;
 			}
 
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
-				"Ping failed %s with code %d - count %d/%d/%d, state %s\n",
-				gateway->name, status, gateway->ping_min, gateway->ping_count, gateway->ping_max,
-				status_names[gateway->status]);
+							  "Ping failed %s with code %d - count %d/%d/%d, state %s\n",
+							  gateway->name, status, gateway->ping_min, gateway->ping_count, gateway->ping_max, status_names[gateway->status]);
 		}
 
 		gateway->ping = switch_epoch_time_now(NULL) + gateway->ping_freq;
@@ -3269,6 +3589,8 @@
 									  nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
 									  tagi_t tags[])
 {
+	char *call_info = NULL;
+
 	if (sip && session) {
 		switch_channel_t *channel = switch_core_session_get_channel(session);
 		const char *uuid;
@@ -3278,18 +3600,73 @@
 		int network_port = 0;
 		switch_caller_profile_t *caller_profile = NULL;
 
-		sofia_glue_get_addr(nua_current_request(nua), network_ip,  sizeof(network_ip), &network_port);
+		sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port);
 
 		switch_channel_set_variable(channel, "sip_reply_host", network_ip);
 		switch_channel_set_variable_printf(channel, "sip_reply_port", "%d", network_port);
-		
+
+		switch_channel_set_variable_printf(channel, "sip_network_ip", "%s", network_ip);
+		switch_channel_set_variable_printf(channel, "sip_network_port", "%d", network_port);
+
 		if ((caller_profile = switch_channel_get_caller_profile(channel))) {
 			caller_profile->network_addr = switch_core_strdup(caller_profile->pool, network_ip);
 		}
 
 		switch_channel_clear_flag(channel, CF_REQ_MEDIA);
 
-		if ((status == 180 || status == 183 || status == 200)) { 
+		tech_pvt->last_sdp_str = NULL;
+		if (!sofia_use_soa(tech_pvt) && sip->sip_payload && sip->sip_payload->pl_data) {
+			tech_pvt->last_sdp_str = switch_core_session_strdup(session, sip->sip_payload->pl_data);
+		}
+
+		if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) {
+			if (channel && sip->sip_call_info) {
+				char *p;
+				call_info = sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_call_info);
+				if (switch_stristr("appearance", call_info)) {
+					switch_channel_set_variable(channel, "presence_call_info_full", call_info);
+					if ((p = strchr(call_info, ';'))) {
+						switch_channel_set_variable(channel, "presence_call_info", p + 1);
+					}
+				}
+			} else if ((status == 180 || status == 183 || status == 200)) {
+				char buf[128] = "";
+				char *sql;
+				char *state = "active";
+
+				if (status != 200) {
+					state = "progressing";
+				}
+
+				if (sip &&
+					sip->sip_from && sip->sip_from->a_url && sip->sip_from->a_url->url_user && sip->sip_from->a_url->url_host &&
+					sip->sip_to && sip->sip_to->a_url && sip->sip_to->a_url->url_user && sip->sip_to->a_url->url_host) {
+					sql =
+						switch_mprintf("select 'appearance-index=1' from sip_subscriptions where expires > -1 and hostname='%q' and event='call-info' and "
+									   "sub_to_user='%q' and sub_to_host='%q'", mod_sofia_globals.hostname, sip->sip_to->a_url->url_user,
+									   sip->sip_from->a_url->url_host);
+					sofia_glue_execute_sql2str(profile, profile->ireg_mutex, sql, buf, sizeof(buf));
+
+					if (mod_sofia_globals.debug_sla > 1) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "QUERY SQL %s [%s]\n", sql, buf);
+					}
+					free(sql);
+
+					if (!zstr(buf)) {
+						sql = switch_mprintf("update sip_dialogs set call_info='%q',call_info_state='%q' "
+											 "where uuid='%q'", buf, state, switch_core_session_get_uuid(session));
+
+						if (mod_sofia_globals.debug_sla > 1) {
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "QUERY SQL %s\n", sql);
+						}
+
+						sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
+					}
+				}
+			}
+		}
+
+		if ((status == 180 || status == 183 || status == 200)) {
 			const char *x_freeswitch_support;
 
 			switch_channel_set_flag(channel, CF_MEDIA_ACK);
@@ -3310,22 +3687,23 @@
 
 			if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTOFIX_TIMING)) {
 				tech_pvt->check_frames = 0;
+				tech_pvt->last_ts = 0;
 			}
 
 		}
-		
+
 		if (channel && sip && (status == 300 || status == 302 || status == 305) && switch_channel_test_flag(channel, CF_OUTBOUND)) {
-			sip_contact_t * p_contact = sip->sip_contact;
+			sip_contact_t *p_contact = sip->sip_contact;
 			int i = 0;
-			char var_name[80];	
+			char var_name[80];
 			const char *diversion_header;
 			char *full_contact = NULL;
 			char *invite_contact;
 			const char *br;
-			
+
 			if (!p_contact) {
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Missing contact header in redirect request\n");
-				return;
+				goto end;
 			}
 
 			if ((br = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
@@ -3335,7 +3713,7 @@
 
 				const char *sip_redirect_profile, *sip_redirect_context, *sip_redirect_dialplan, *sip_redirect_fork;
 
-				if ((a_session = switch_core_session_locate(br)) && (a_channel = switch_core_session_get_channel(a_session))) { 
+				if ((a_session = switch_core_session_locate(br)) && (a_channel = switch_core_session_get_channel(a_session))) {
 					switch_stream_handle_t stream = { 0 };
 					char separator[2] = "|";
 					char *redirect_dialstring;
@@ -3355,24 +3733,24 @@
 					}
 
 					sip_redirect_fork = switch_channel_get_variable(channel, "sip_redirect_fork");
-					
+
 					if (switch_true(sip_redirect_fork)) {
 						*separator = ',';
 					}
 
 					for (p_contact = sip->sip_contact; p_contact; p_contact = p_contact->m_next) {
 						if (p_contact->m_url) {
-							full_contact = sip_header_as_string(home, (void *) sip->sip_contact);
+							full_contact = sip_header_as_string(home, (void *) p_contact);
 							invite_contact = sofia_glue_strip_uri(full_contact);
-							
+
 							switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_%d", i);
 							switch_channel_set_variable(a_channel, var_name, full_contact);
-							
+
 							if (i == 0) {
 								switch_channel_set_variable(channel, "sip_redirected_to", full_contact);
 								switch_channel_set_variable(a_channel, "sip_redirected_to", full_contact);
 							}
-							
+
 							if (p_contact->m_url->url_user) {
 								switch_snprintf(var_name, sizeof(var_name), "sip_redirect_contact_user_%d", i);
 								switch_channel_set_variable(channel, var_name, p_contact->m_url->url_user);
@@ -3388,7 +3766,7 @@
 								switch_channel_set_variable(channel, var_name, p_contact->m_url->url_params);
 								switch_channel_set_variable(a_channel, var_name, p_contact->m_url->url_params);
 							}
-							
+
 							switch_snprintf(var_name, sizeof(var_name), "sip_redirect_dialstring_%d", i);
 							switch_channel_set_variable_printf(channel, var_name, "sofia/%s/%s", sip_redirect_profile, invite_contact);
 							switch_channel_set_variable_printf(a_channel, var_name, "sofia/%s/%s", sip_redirect_profile, invite_contact);
@@ -3397,28 +3775,29 @@
 							i++;
 						}
 					}
-					
+
 					redirect_dialstring = stream.data;
-					
+
 					switch_channel_set_variable(channel, "sip_redirect_dialstring", redirect_dialstring);
 					switch_channel_set_variable(a_channel, "sip_redirect_dialstring", redirect_dialstring);
-					
+
 					p_contact = sip->sip_contact;
 					full_contact = sip_header_as_string(home, (void *) sip->sip_contact);
-					
+
 					if ((diversion_header = sofia_glue_get_unknown_header(sip, "diversion"))) {
 						switch_channel_set_variable(channel, "sip_redirected_by", diversion_header);
 						switch_channel_set_variable(a_channel, "sip_redirected_by", diversion_header);
 					}
-					
+
 					if (sofia_test_pflag(profile, PFLAG_MANUAL_REDIRECT)) {
-						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Redirect: Transfering to %s %s %s\n", 
+						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Redirect: Transfering to %s %s %s\n",
 										  p_contact->m_url->url_user, sip_redirect_dialplan, sip_redirect_context);
-						switch_ivr_session_transfer(a_session, p_contact->m_url->url_user, sip_redirect_dialplan, sip_redirect_context);					
+						switch_ivr_session_transfer(a_session, p_contact->m_url->url_user, sip_redirect_dialplan, sip_redirect_context);
 					} else if ((!strcmp(profile->sipip, p_contact->m_url->url_host))
 							   || (profile->extsipip && !strcmp(profile->extsipip, p_contact->m_url->url_host))
 							   || (switch_xml_locate_domain(p_contact->m_url->url_host, NULL, &root, &domain) == SWITCH_STATUS_SUCCESS)) {
-						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Redirect: Transfering to %s\n", p_contact->m_url->url_user);
+						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Redirect: Transfering to %s\n",
+										  p_contact->m_url->url_user);
 						switch_ivr_session_transfer(a_session, p_contact->m_url->url_user, NULL, NULL);
 						switch_xml_free(root);
 					} else {
@@ -3426,7 +3805,7 @@
 						tech_pvt->redirected = switch_core_session_strdup(session, invite_contact);
 						free(invite_contact);
 					}
-					
+
 					if (home) {
 						su_home_unref(home);
 						home = NULL;
@@ -3455,39 +3834,37 @@
 
 		if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
 
-			if (!sofia_test_flag(tech_pvt, TFLAG_SENT_UPDATE)) {
-				return;
-			}
+			if (sofia_test_flag(tech_pvt, TFLAG_SENT_UPDATE)) {
+				sofia_clear_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
 
-			sofia_clear_flag_locked(tech_pvt, TFLAG_SENT_UPDATE);
+				if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
+					const char *r_sdp = NULL;
+					switch_core_session_message_t *msg;
 
-			if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
-				const char *r_sdp = NULL;
-				switch_core_session_message_t *msg;
+					if (sip->sip_payload && sip->sip_payload->pl_data &&
+						sip->sip_content_type && sip->sip_content_type->c_subtype && switch_stristr("sdp", sip->sip_content_type->c_subtype)) {
+						tech_pvt->remote_sdp_str = switch_core_session_strdup(tech_pvt->session, sip->sip_payload->pl_data);
+						r_sdp = tech_pvt->remote_sdp_str;
+						sofia_glue_tech_proxy_remote_addr(tech_pvt);
+					}
 
-				if (sip->sip_payload && sip->sip_payload->pl_data &&
-					sip->sip_content_type && sip->sip_content_type->c_subtype && switch_stristr("sdp", sip->sip_content_type->c_subtype)) {
-					tech_pvt->remote_sdp_str = switch_core_session_strdup(tech_pvt->session, sip->sip_payload->pl_data);
-					r_sdp = tech_pvt->remote_sdp_str;
-					sofia_glue_tech_proxy_remote_addr(tech_pvt);
-				}
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Passing %d %s to other leg\n", status, phrase);
 
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Passing %d %s to other leg\n", status, phrase);
+					msg = switch_core_session_alloc(other_session, sizeof(*msg));
+					msg->message_id = SWITCH_MESSAGE_INDICATE_RESPOND;
+					msg->from = __FILE__;
+					msg->numeric_arg = status;
+					msg->string_arg = switch_core_session_strdup(other_session, phrase);
+					if (r_sdp) {
+						msg->pointer_arg = switch_core_session_strdup(other_session, r_sdp);
+						msg->pointer_arg_size = strlen(r_sdp);
+					}
 
-				msg = switch_core_session_alloc(other_session, sizeof(*msg));
-				msg->message_id = SWITCH_MESSAGE_INDICATE_RESPOND;
-				msg->from = __FILE__;
-				msg->numeric_arg = status;
-				msg->string_arg = switch_core_session_strdup(other_session, phrase);
-				if (r_sdp) {
-					msg->pointer_arg = switch_core_session_strdup(other_session, r_sdp);
-					msg->pointer_arg_size = strlen(r_sdp);
+					switch_core_session_queue_message(other_session, msg);
+					switch_core_session_rwunlock(other_session);
 				}
-
-				switch_core_session_queue_message(other_session, msg);
-				switch_core_session_rwunlock(other_session);
+				goto end;
 			}
-			return;
 		}
 
 		if ((status == 180 || status == 183 || status == 200)) {
@@ -3513,7 +3890,7 @@
 				const char *from_user = "", *from_host = "", *to_user = "", *to_host = "", *contact_user = "", *contact_host = "";
 				const char *user_agent = "", *call_id = "";
 				char *sql = NULL;
-				
+
 				if (sip->sip_user_agent) {
 					user_agent = switch_str_nil(sip->sip_user_agent->g_string);
 				}
@@ -3541,25 +3918,30 @@
 					const char *presence_data = switch_channel_get_variable(channel, "presence_data");
 					const char *presence_id = switch_channel_get_variable(channel, "presence_id");
 					char *full_contact = "";
-					
+					char *p = NULL;
+
 					if (sip->sip_contact) {
 						full_contact = sip_header_as_string(nua_handle_home(tech_pvt->nh), (void *) sip->sip_contact);
 					}
-					
+
+					if (call_info && (p = strchr(call_info, ';'))) {
+						p++;
+					}
 					sql = switch_mprintf("insert into sip_dialogs "
 										 "(call_id,uuid,sip_to_user,sip_to_host,sip_from_user,sip_from_host,contact_user,"
-										 "contact_host,state,direction,user_agent,profile_name,hostname,contact,presence_id, presence_data) "
-										 "values('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q')",
+										 "contact_host,state,direction,user_agent,profile_name,hostname,contact,presence_id,presence_data,call_info) "
+										 "values('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q')",
 										 call_id,
 										 switch_core_session_get_uuid(session),
-										 to_user, to_host, from_user, from_host, contact_user, 
+										 to_user, to_host, from_user, from_host, contact_user,
 										 contact_host, astate, "outbound", user_agent,
 										 profile->name, mod_sofia_globals.hostname, switch_str_nil(full_contact),
-										 switch_str_nil(presence_id), switch_str_nil(presence_data));
-					
+										 switch_str_nil(presence_id), switch_str_nil(presence_data), switch_str_nil(p));
+
 					switch_assert(sql);
 
-					sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
+					sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex);
+					switch_safe_free(sql);
 
 				}
 			} else if (status == 200 && (profile->pres_type)) {
@@ -3568,15 +3950,26 @@
 				const char *presence_id = switch_channel_get_variable(channel, "presence_id");
 
 				sql = switch_mprintf("update sip_dialogs set state='%q',presence_id='%q',presence_data='%q' "
-									 "where uuid='%s';\n", astate, switch_str_nil(presence_id), switch_str_nil(presence_data), 
+									 "where uuid='%s';\n", astate, switch_str_nil(presence_id), switch_str_nil(presence_data),
 									 switch_core_session_get_uuid(session));
 				switch_assert(sql);
-				sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
+				sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
 			}
+
+			extract_header_vars(profile, sip, session);
+			extract_vars(profile, sip, session);
+			sofia_glue_tech_track(tech_pvt->profile, session);
+			sofia_clear_flag(tech_pvt, TFLAG_RECOVERING);
 		}
 
 	}
 
+  end:
+
+	if (call_info) {
+		su_free(nua_handle_home(nh), call_info);
+	}
+
 	if (!session && (status == 180 || status == 183 || status == 200)) {
 		/* nevermind */
 		nua_handle_bind(nh, NULL);
@@ -3590,16 +3983,16 @@
 {
 	switch_core_session_t *other_session = NULL, *session = (switch_core_session_t *) obj;
 	const char *uuid;
-	
+
 	if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
 		switch_channel_t *channel = switch_core_session_get_channel(session);
 		private_object_t *tech_pvt = switch_core_session_get_private(session);
-		
+
 		if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
 			if (switch_core_session_compare(session, other_session)) {
 				sofia_set_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
 				switch_ivr_media(switch_core_session_get_uuid(other_session), SMF_REBRIDGE);
-			
+
 				if (tech_pvt->rtp_session) {
 					switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
 				}
@@ -3611,7 +4004,7 @@
 
 		switch_core_session_rwunlock(session);
 	}
-	
+
 	return NULL;
 }
 
@@ -3644,6 +4037,7 @@
 	char st[80] = "";
 	int is_dup_sdp = 0;
 	switch_event_t *s_event = NULL;
+	char *p;
 
 	tl_gets(tags,
 			NUTAG_CALLSTATE_REF(ss_state),
@@ -3652,20 +4046,48 @@
 			NUTAG_OFFER_SENT_REF(offer_sent),
 			NUTAG_ANSWER_SENT_REF(answer_sent),
 			SIPTAG_REPLACES_STR_REF(replaces_str), SOATAG_LOCAL_SDP_STR_REF(l_sdp), SOATAG_REMOTE_SDP_STR_REF(r_sdp), TAG_END());
-	
-	
 
+
+	if (session) {
+		channel = switch_core_session_get_channel(session);
+		tech_pvt = switch_core_session_get_private(session);
+
+		if (!tech_pvt || !tech_pvt->nh) {
+			goto done;
+		}
+	}
+
+	if (status > 100 && status < 300 && tech_pvt && !sofia_use_soa(tech_pvt) && !r_sdp && tech_pvt->last_sdp_str) {
+		r_sdp = tech_pvt->last_sdp_str;
+	}
+
+	if ((channel && (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA))) ||
+		(sofia_test_flag(profile, TFLAG_INB_NOMEDIA) || sofia_test_flag(profile, TFLAG_PROXY_MEDIA))) {
+
+		/* This marr in our code brought to you by people who can't read........ */
+		if (profile->ndlb & PFLAG_NDLB_ALLOW_BAD_IANANAME && r_sdp && (p = (char *) switch_stristr("g729a/8000", r_sdp))) {
+			p += 4;
+			*p++ = '/';
+			*p++ = '8';
+			*p++ = '0';
+			*p++ = '0';
+			*p++ = '0';
+			*p++ = ' ';
+		}
+	}
+
+
 	if (ss_state == nua_callstate_terminated) {
 
 		if ((status == 300 || status == 302 || status == 305) && session) {
 			channel = switch_core_session_get_channel(session);
 			tech_pvt = switch_core_session_get_private(session);
-			
+
 			if (!tech_pvt || !tech_pvt->nh) {
 				goto done;
 			}
-			
 
+
 			if (tech_pvt->redirected) {
 				sofia_glue_do_invite(session);
 				goto done;
@@ -3678,15 +4100,7 @@
 	}
 
 	if (session) {
-		channel = switch_core_session_get_channel(session);
-		tech_pvt = switch_core_session_get_private(session);
-
-		if (!tech_pvt || !tech_pvt->nh) {
-			goto done;
-		}
-
-		if ((switch_channel_test_flag(channel, CF_EARLY_MEDIA) || switch_channel_test_flag(channel, CF_ANSWERED)) && 
-			(status == 180 || status == 183)) {
+		if ((switch_channel_test_flag(channel, CF_EARLY_MEDIA) || switch_channel_test_flag(channel, CF_ANSWERED)) && (status == 180 || status == 183)) {
 			/* Must you send 180 after 183 w/sdp ? sheesh */
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Channel %s skipping state [%s][%d]\n",
 							  switch_channel_get_name(channel), nua_callstate_name(ss_state), status);
@@ -3695,11 +4109,11 @@
 
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Channel %s entering state [%s][%d]\n",
 						  switch_channel_get_name(channel), nua_callstate_name(ss_state), status);
-		
+
 		if (r_sdp) {
 			sdp_parser_t *parser;
 			sdp_session_t *sdp;
-			
+
 			if (!zstr(tech_pvt->remote_sdp_str) && !strcmp(tech_pvt->remote_sdp_str, r_sdp)) {
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Duplicate SDP\n%s\n", r_sdp);
 				is_dup_sdp = 1;
@@ -3725,12 +4139,12 @@
 
 	if (status == 183 && !r_sdp) {
 		status = 180;
-	} 
-	
+	}
+
 	if (status == 180 && r_sdp) {
 		status = 183;
 	}
-	
+
 	if (channel && (status == 180 || status == 183) && switch_channel_test_flag(channel, CF_OUTBOUND)) {
 		const char *val;
 		if ((val = switch_channel_get_variable(channel, "sip_auto_answer")) && switch_true(val)) {
@@ -3747,8 +4161,9 @@
 	case nua_callstate_completed:
 	case nua_callstate_received:
 	case nua_callstate_proceeding:
-		if (!(session && channel && tech_pvt)) goto done;
-		break;
+	case nua_callstate_completing:
+		if (!(session && channel && tech_pvt))
+			goto done;
 	default:
 		break;
 	}
@@ -3764,7 +4179,7 @@
 		if (status == 180) {
 			switch_channel_mark_ring_ready(channel);
 		}
-			
+
 		if (r_sdp) {
 			if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
 				if (switch_channel_test_flag(channel, CF_PROXY_MEDIA) && !switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
@@ -3803,10 +4218,8 @@
 		}
 		break;
 	case nua_callstate_completing:
-		nua_ack(nh,
-				TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
-				TAG_END());
-		break;
+		nua_ack(nh, TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_END());
+		goto done;
 	case nua_callstate_received:
 		if (!sofia_test_flag(tech_pvt, TFLAG_SDP)) {
 			if (r_sdp && !sofia_test_flag(tech_pvt, TFLAG_SDP)) {
@@ -3907,12 +4320,19 @@
 						sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
 						sofia_set_flag_locked(tech_pvt, TFLAG_3PCC);
 						switch_channel_set_state(channel, CS_HIBERNATE);
-						nua_respond(tech_pvt->nh, SIP_200_OK,
-									SIPTAG_CONTACT_STR(tech_pvt->profile->url),
-									SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-									SOATAG_REUSE_REJECTED(1),
-									SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), 
-									TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
+						if (sofia_use_soa(tech_pvt)) {
+							nua_respond(tech_pvt->nh, SIP_200_OK,
+										SIPTAG_CONTACT_STR(tech_pvt->profile->url),
+										SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+										SOATAG_REUSE_REJECTED(1),
+										SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
+										TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
+						} else {
+							nua_respond(tech_pvt->nh, SIP_200_OK,
+										NUTAG_MEDIA_ENABLE(0),
+										SIPTAG_CONTACT_STR(tech_pvt->profile->url),
+										SIPTAG_CONTENT_TYPE_STR("application/sdp"), SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str), TAG_END());
+						}
 					} else if (sofia_test_pflag(profile, PFLAG_3PCC_PROXY)) {
 						//3PCC proxy mode delays the 200 OK until the call is answered
 						switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "RECEIVED_NOSDP");
@@ -3952,7 +4372,7 @@
 
 			if (r_sdp) {
 				const char *var;
-				
+
 				if ((var = switch_channel_get_variable(channel, "sip_ignore_reinvites")) && switch_true(var)) {
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Ignoring Re-invite\n");
 					nua_respond(tech_pvt->nh, SIP_200_OK, TAG_END());
@@ -3967,13 +4387,13 @@
 					if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
 						&& (other_session = switch_core_session_locate(uuid))) {
 						switch_core_session_message_t *msg;
-						
+
 						if (switch_channel_test_flag(channel, CF_PROXY_MODE) && !is_t38 && profile->media_options & MEDIA_OPT_MEDIA_ON_HOLD) {
 							tech_pvt->hold_laps = 1;
 							switch_channel_set_variable(channel, SWITCH_R_SDP_VARIABLE, r_sdp);
 							switch_channel_clear_flag(channel, CF_PROXY_MODE);
 							sofia_glue_tech_set_local_sdp(tech_pvt, NULL, SWITCH_FALSE);
-							
+
 							if (!switch_channel_media_ready(channel)) {
 								if (!switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND)) {
 									//const char *r_sdp = switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
@@ -3983,6 +4403,7 @@
 									if (sofia_glue_tech_media(tech_pvt, r_sdp) != SWITCH_STATUS_SUCCESS) {
 										switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "CODEC NEGOTIATION ERROR");
 										status = SWITCH_STATUS_FALSE;
+										switch_core_session_rwunlock(other_session);
 										goto done;
 									}
 								}
@@ -3992,29 +4413,37 @@
 								sofia_glue_tech_prepare_codecs(tech_pvt);
 								if ((status = sofia_glue_tech_choose_port(tech_pvt, 0)) != SWITCH_STATUS_SUCCESS) {
 									switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+									switch_core_session_rwunlock(other_session);
 									goto done;
 								}
 							}
 							sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
-							
-							nua_respond(tech_pvt->nh, SIP_200_OK,
-										SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-										SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-										SOATAG_REUSE_REJECTED(1),
-										SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), 
-										TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
+
+							if (sofia_use_soa(tech_pvt)) {
+								nua_respond(tech_pvt->nh, SIP_200_OK,
+											SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+											SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+											SOATAG_REUSE_REJECTED(1),
+											SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
+											TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
+							} else {
+								nua_respond(tech_pvt->nh, SIP_200_OK,
+											NUTAG_MEDIA_ENABLE(0),
+											SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+											SIPTAG_CONTENT_TYPE_STR("application/sdp"), SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str), TAG_END());
+							}
 							launch_media_on_hold(session);
-							
+
 							switch_core_session_rwunlock(other_session);
 							goto done;
 						}
-						
+
 						msg = switch_core_session_alloc(other_session, sizeof(*msg));
 						msg->message_id = SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT;
 						msg->from = __FILE__;
 						msg->string_arg = switch_core_session_strdup(other_session, r_sdp);
 						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Passing SDP to other leg.\n%s\n", r_sdp);
-						
+
 						if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
 							if (!switch_stristr("sendonly", r_sdp)) {
 								sofia_clear_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
@@ -4022,16 +4451,27 @@
 								switch_channel_presence(tech_pvt->channel, "unknown", "unhold", NULL);
 							}
 						} else if (switch_stristr("sendonly", r_sdp)) {
+							const char *msg = "hold";
+
+							if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) {
+								const char *info = switch_channel_get_variable(channel, "presence_call_info");
+								if (info) {
+									if (switch_stristr("private", info)) {
+										msg = "hold-private";
+									}
+								}
+							}
+
 							sofia_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
 							switch_channel_set_flag(channel, CF_LEG_HOLDING);
-							switch_channel_presence(tech_pvt->channel, "unknown", "hold", NULL);
+							switch_channel_presence(tech_pvt->channel, "unknown", msg, NULL);
 						}
-					
+
 						switch_core_session_queue_message(other_session, msg);
 
 						switch_core_session_rwunlock(other_session);
 					} else {
-						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, 
+						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
 										  "Re-INVITE to a no-media channel that is not in a bridge.\n");
 						is_ok = 0;
 						switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -4039,7 +4479,7 @@
 					goto done;
 				} else {
 					sofia_set_flag_locked(tech_pvt, TFLAG_REINVITE);
-					
+
 					if (tech_pvt->num_codecs) {
 						if ((parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) {
 							if ((sdp = sdp_session(parser))) {
@@ -4053,7 +4493,7 @@
 							goto done;
 						}
 						sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
-						
+
 						if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
 							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Reinvite RTP Error!\n");
 							is_ok = 0;
@@ -4066,19 +4506,25 @@
 						is_ok = 0;
 					}
 				}
-				
-				
+
+
 				if (is_ok) {
 					if (tech_pvt->local_crypto_key) {
 						sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
 					}
-					nua_respond(tech_pvt->nh, SIP_200_OK,
-								SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
-								SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-								SOATAG_REUSE_REJECTED(1),
-								SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), 
-								TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
-
+					if (sofia_use_soa(tech_pvt)) {
+						nua_respond(tech_pvt->nh, SIP_200_OK,
+									SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+									SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+									SOATAG_REUSE_REJECTED(1),
+									SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
+									TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_100REL), NUTAG_INCLUDE_EXTRA_SDP(1)), TAG_END());
+					} else {
+						nua_respond(tech_pvt->nh, SIP_200_OK,
+									NUTAG_MEDIA_ENABLE(0),
+									SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
+									SIPTAG_CONTENT_TYPE_STR("application/sdp"), SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str), TAG_END());
+					}
 					if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_REINVITE) == SWITCH_STATUS_SUCCESS) {
 						switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(session));
 						switch_event_fire(&s_event);
@@ -4097,7 +4543,7 @@
 			uint8_t match = 0;
 
 			sofia_set_flag_locked(tech_pvt, TFLAG_REINVITE);
-			
+
 			if (tech_pvt->num_codecs) {
 				if ((parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) {
 					if ((sdp = sdp_session(parser))) {
@@ -4111,7 +4557,7 @@
 					goto done;
 				}
 				sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 0);
-				
+
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Processing updated SDP\n");
 				if (sofia_glue_activate_rtp(tech_pvt, 0) != SWITCH_STATUS_SUCCESS) {
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "RTP Error!\n");
@@ -4180,12 +4626,12 @@
 			}
 			goto done;
 		}
-		
+
 		if (channel) {
-            if (sofia_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
-                sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
-                sofia_set_flag(tech_pvt, TFLAG_SDP);
-                switch_channel_mark_answered(channel);
+			if (sofia_test_flag(tech_pvt, TFLAG_EARLY_MEDIA)) {
+				sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
+				sofia_set_flag(tech_pvt, TFLAG_SDP);
+				switch_channel_mark_answered(channel);
 				if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
 					if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
 						&& (other_session = switch_core_session_locate(uuid))) {
@@ -4194,9 +4640,9 @@
 						switch_core_session_rwunlock(other_session);
 					}
 				}
-                goto done;
-            }
-			
+				goto done;
+			}
+
 			if (!r_sdp && !sofia_test_flag(tech_pvt, TFLAG_SDP)) {
 				r_sdp = (const char *) switch_channel_get_variable(channel, SWITCH_R_SDP_VARIABLE);
 			}
@@ -4236,8 +4682,9 @@
 						}
 					}
 
+					sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
+
 					if (match) {
-						sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
 						if (sofia_glue_tech_choose_port(tech_pvt, 0) == SWITCH_STATUS_SUCCESS) {
 							if (sofia_glue_activate_rtp(tech_pvt, 0) == SWITCH_STATUS_SUCCESS) {
 								switch_channel_mark_answered(channel);
@@ -4248,7 +4695,7 @@
 
 							if (sofia_test_flag(tech_pvt, TFLAG_3PCC)) {
 								/* Check if we are in 3PCC proxy mode, if so then set the flag to indicate we received the ack */
-								if (sofia_test_pflag(profile, PFLAG_3PCC_PROXY )) {
+								if (sofia_test_pflag(profile, PFLAG_3PCC_PROXY)) {
 									switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Got my ACK\n");
 									sofia_set_flag(tech_pvt, TFLAG_3PCC_HAS_ACK);
 								} else if (switch_channel_get_state(channel) == CS_HIBERNATE) {
@@ -4298,21 +4745,21 @@
 			switch_channel_set_variable(channel, "sip_term_cause", st);
 			switch_channel_hangup(channel, cause);
 		}
-		
 
+
 		if (ss_state == nua_callstate_terminated) {
 			if (tech_pvt->sofia_private) {
 				tech_pvt->sofia_private = NULL;
 			}
-			
+
 			tech_pvt->nh = NULL;
-	
+
 			if (nh) {
 				nua_handle_bind(nh, NULL);
 				nua_handle_destroy(nh);
 			}
 		}
-		
+
 		break;
 	}
 
@@ -4322,6 +4769,7 @@
 
 typedef struct {
 	char *exten;
+	char *exten_with_params;
 	char *event;
 	char *reply_uuid;
 	char *bridge_to_uuid;
@@ -4335,7 +4783,7 @@
 	switch_memory_pool_t *pool;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	switch_core_session_t *session, *a_session;
-	
+
 	if ((a_session = switch_core_session_locate(nhelper->bridge_to_uuid))) {
 		switch_core_session_t *tsession = NULL;
 		switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING;
@@ -4346,9 +4794,8 @@
 			private_object_t *tech_pvt = switch_core_session_get_private(session);
 			switch_channel_t *channel_a = switch_core_session_get_channel(session);
 
-			if ((status = switch_ivr_originate(NULL, &tsession, &cause, nhelper->exten, timeout, NULL, NULL, NULL,
-											   switch_channel_get_caller_profile(channel_a), 
-											   nhelper->vars, SOF_NONE, NULL)) == SWITCH_STATUS_SUCCESS) {
+			if ((status = switch_ivr_originate(NULL, &tsession, &cause, nhelper->exten_with_params, timeout, NULL, NULL, NULL,
+											   switch_channel_get_caller_profile(channel_a), nhelper->vars, SOF_NONE, NULL)) == SWITCH_STATUS_SUCCESS) {
 				if (switch_channel_up(channel_a)) {
 					tuuid_str = switch_core_session_get_uuid(tsession);
 					switch_ivr_uuid_bridge(nhelper->bridge_to_uuid, tuuid_str);
@@ -4367,10 +4814,10 @@
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "1 .. 2 .. Freddie's commin' for you...\n");
 			}
 
-			nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("messsage/sipfrag"),
+			nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
 					   NUTAG_SUBSTATE(nua_substate_terminated),
-					   SIPTAG_PAYLOAD_STR(status == SWITCH_STATUS_SUCCESS ? "SIP/2.0 200 OK": 
-										  "SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(nhelper->event), TAG_END());
+					   SIPTAG_PAYLOAD_STR(status == SWITCH_STATUS_SUCCESS ? "SIP/2.0 200 OK\r\n" :
+										  "SIP/2.0 403 Forbidden\r\n"), SIPTAG_EVENT_STR(nhelper->event), TAG_END());
 
 			switch_core_session_rwunlock(session);
 		}
@@ -4408,10 +4855,10 @@
 	if (state == CS_HANGUP) {
 		switch_core_session_t *ksession;
 		const char *uuid = switch_channel_get_variable(channel, "att_xfer_kill_uuid");
-		
+
 		if (uuid && (ksession = switch_core_session_force_locate(uuid))) {
 			switch_channel_t *kchannel = switch_core_session_get_channel(ksession);
-			
+
 			switch_channel_clear_flag(kchannel, CF_XFER_ZOMBIE);
 			switch_channel_clear_flag(kchannel, CF_TRANSFER);
 			if (switch_channel_up(kchannel)) {
@@ -4428,6 +4875,41 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+nua_handle_t *sofia_global_nua_handle_by_replaces(sip_replaces_t *replaces)
+{
+	nua_handle_t *nh = NULL;
+	switch_hash_index_t *hi;
+	const void *var;
+	void *val;
+	sofia_profile_t *profile;
+	switch_xml_t xml_root;
+	const char *err;
+
+	if ((xml_root = switch_xml_open_root(1, &err))) {
+		switch_xml_free(xml_root);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Reload XML [%s]\n", err);
+	}
+
+	switch_mutex_lock(mod_sofia_globals.hash_mutex);
+	if (mod_sofia_globals.profile_hash) {
+		for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+			switch_hash_this(hi, &var, NULL, &val);
+			if ((profile = (sofia_profile_t *) val)) {
+				if (!(nh = nua_handle_by_replaces(profile->nua, replaces))) {
+					nh = nua_handle_by_call_id(profile->nua, replaces->rp_call_id);
+				}
+				if (nh)
+					break;
+			}
+		}
+	}
+	switch_mutex_unlock(mod_sofia_globals.hash_mutex);
+
+	return nh;
+
+}
+
+
 void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, switch_core_session_t *session, sip_t const *sip, tagi_t tags[])
 {
 	/* Incoming refer */
@@ -4460,9 +4942,7 @@
 	home = su_home_new(sizeof(*home));
 	switch_assert(home != NULL);
 
-	nua_respond(nh, SIP_202_ACCEPTED,
-				NUTAG_WITH_THIS(nua),
-				SIPTAG_EXPIRES_STR("60"), TAG_END());
+	nua_respond(nh, SIP_202_ACCEPTED, NUTAG_WITH_THIS(nua), SIPTAG_EXPIRES_STR("60"), TAG_END());
 
 	if (sip->sip_referred_by) {
 		full_ref_by = sip_header_as_string(home, (void *) sip->sip_referred_by);
@@ -4480,10 +4960,10 @@
 
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Process REFER to [%s@%s]\n", exten, (char *) refer_to->r_url->url_host);
 
-		if (refer_to->r_url->url_headers && (rep = (char *)switch_stristr("Replaces=", refer_to->r_url->url_headers))) {
+		if (refer_to->r_url->url_headers && (rep = (char *) switch_stristr("Replaces=", refer_to->r_url->url_headers))) {
 			sip_replaces_t *replaces;
-			nua_handle_t *bnh;
-			
+			nua_handle_t *bnh = NULL;
+
 			if (rep) {
 				const char *br_a = NULL, *br_b = NULL;
 				char *buf;
@@ -4494,7 +4974,7 @@
 				if ((p = strchr(rep, ';'))) {
 					*p = '\0';
 				}
-				
+
 				if ((buf = switch_core_session_alloc(session, strlen(rep) + 1))) {
 					rep = url_unescape(buf, (const char *) rep);
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Replaces: [%s]\n", rep);
@@ -4503,8 +4983,15 @@
 					goto done;
 				}
 
-				if ((replaces = sip_replaces_make(home, rep))
-					&& (bnh = nua_handle_by_replaces(nua, replaces))) {
+				if ((replaces = sip_replaces_make(home, rep))) {
+					if (!(bnh = nua_handle_by_replaces(nua, replaces))) {
+						if (!(bnh = nua_handle_by_call_id(nua, replaces->rp_call_id))) {
+							bnh = sofia_global_nua_handle_by_replaces(replaces);
+						}
+					}
+				}
+
+				if (bnh) {
 					sofia_private_t *b_private = NULL;
 					private_object_t *b_tech_pvt = NULL;
 					switch_core_session_t *b_session = NULL;
@@ -4520,7 +5007,7 @@
 
 						br_a = switch_channel_get_variable(channel_a, SWITCH_SIGNAL_BOND_VARIABLE);
 						br_b = switch_channel_get_variable(channel_b, SWITCH_SIGNAL_BOND_VARIABLE);
-						
+
 						if (!switch_ivr_uuid_exists(br_a)) {
 							br_a = NULL;
 						}
@@ -4528,18 +5015,18 @@
 						if (!switch_ivr_uuid_exists(br_b)) {
 							br_b = NULL;
 						}
-						
+
 						if (switch_channel_test_flag(channel_b, CF_ORIGINATOR)) {
 							switch_core_session_t *a_session;
 
-							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, 
+							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE,
 											  "Attended Transfer on originating session %s\n", switch_core_session_get_uuid(b_session));
-							
 
-							
+
+
 							switch_channel_set_variable(channel_b, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER");
-							
-							
+
+
 							sofia_clear_flag_locked(b_tech_pvt, TFLAG_SIP_HOLD);
 							switch_channel_clear_flag(channel_b, CF_LEG_HOLDING);
 							sofia_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
@@ -4547,8 +5034,8 @@
 							switch_channel_set_variable(channel_b, SWITCH_HOLDING_UUID_VARIABLE, br_a);
 							switch_channel_set_flag(channel_b, CF_XFER_ZOMBIE);
 							switch_channel_set_flag(channel_b, CF_TRANSFER);
-							
-							
+
+
 							if ((a_session = switch_core_session_locate(br_a))) {
 								const char *moh = profile->hold_music;
 								switch_channel_t *a_channel = switch_core_session_get_channel(a_session);
@@ -4560,11 +5047,11 @@
 								if ((tmp = switch_channel_get_variable(a_channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
 									moh = tmp;
 								}
-								
+
 								if (!zstr(moh) && !strcasecmp(moh, "silence")) {
 									moh = NULL;
 								}
-								
+
 								if (moh) {
 									char *xdest;
 									xdest = switch_core_session_sprintf(a_session, "endless_playback:%s,park", moh);
@@ -4572,55 +5059,64 @@
 								} else {
 									switch_ivr_session_transfer(a_session, "park", "inline", NULL);
 								}
-								
+
 								switch_core_session_rwunlock(a_session);
 
-								nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
-										   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END());
+								nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"),
+										   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK\r\n"), SIPTAG_EVENT_STR(etmp),
+										   TAG_END());
 
-								if (b_tech_pvt) {
+								if (b_tech_pvt && !sofia_test_flag(b_tech_pvt, TFLAG_BYE)) {
+									char *q850 = NULL;
+									const char *val = NULL;
+
 									sofia_set_flag_locked(b_tech_pvt, TFLAG_BYE);
-									nua_bye(b_tech_pvt->nh, 
-											SIPTAG_REASON_STR("Q.850;cause=16;text=\"normal_clearing\""),
-											TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
-											TAG_END());
+									val = switch_channel_get_variable(tech_pvt->channel, "disable_q850_reason");
+									if (!val || switch_true(val)) {
+										q850 = switch_core_session_sprintf(a_session, "Q.850;cause=16;text=\"normal_clearing\"");
+									}
+									nua_bye(b_tech_pvt->nh,
+											TAG_IF(!zstr(q850), SIPTAG_REASON_STR(q850)),
+											TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_END());
+
 								}
 							} else {
-								nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
+								nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"),
 										   NUTAG_SUBSTATE(nua_substate_terminated),
-										   SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp), TAG_END());
+										   SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden\r\n"), SIPTAG_EVENT_STR(etmp), TAG_END());
 							}
 
 						} else if (br_a && br_b) {
 							switch_core_session_t *tmp = NULL;
-							
-							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Attended Transfer [%s][%s]\n", 
-											  switch_str_nil(br_a),
-											  switch_str_nil(br_b));
 
+							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Attended Transfer [%s][%s]\n",
+											  switch_str_nil(br_a), switch_str_nil(br_b));
+
 							if ((profile->media_options & MEDIA_OPT_BYPASS_AFTER_ATT_XFER) && (tmp = switch_core_session_locate(br_b))) {
 								switch_channel_t *tchannel = switch_core_session_get_channel(tmp);
 								switch_channel_set_flag(tchannel, CF_BYPASS_MEDIA_AFTER_BRIDGE);
 								switch_core_session_rwunlock(tmp);
 							}
-							
+
 							switch_ivr_uuid_bridge(br_b, br_a);
 							switch_channel_set_variable(channel_b, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER");
-							nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
-									   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END());
+							nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"),
+									   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK\r\n"), SIPTAG_EVENT_STR(etmp),
+									   TAG_END());
 
 							sofia_clear_flag_locked(b_tech_pvt, TFLAG_SIP_HOLD);
 							switch_channel_clear_flag(channel_b, CF_LEG_HOLDING);
 							sofia_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
 							switch_channel_set_variable(channel_b, "park_timeout", "2");
 							switch_channel_set_state(channel_b, CS_PARK);
-							
+
 						} else {
 							if (!br_a && !br_b) {
-								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Cannot transfer channels that are not in a bridge.\n");
-								nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
-										   NUTAG_SUBSTATE(nua_substate_terminated),
-										   SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp), TAG_END());
+								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
+												  "Cannot transfer channels that are not in a bridge.\n");
+								nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"),
+										   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden\r\n"),
+										   SIPTAG_EVENT_STR(etmp), TAG_END());
 							} else {
 								switch_core_session_t *t_session;
 								switch_channel_t *hup_channel;
@@ -4652,25 +5148,25 @@
 									if (!zstr(full_ref_to)) {
 										switch_channel_set_variable(t_channel, SOFIA_REFER_TO_VARIABLE, full_ref_to);
 									}
-									
+
 									if (idest) {
 										switch_ivr_session_transfer(t_session, idest, "inline", NULL);
 									} else {
 										switch_ivr_session_transfer(t_session, ext, NULL, NULL);
 									}
-									
+
 									nua_notify(tech_pvt->nh,
 											   NUTAG_NEWSUB(1),
-											   SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
+											   SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"),
 											   NUTAG_SUBSTATE(nua_substate_terminated),
-											   SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END());
+											   SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK\r\n"), SIPTAG_EVENT_STR(etmp), TAG_END());
 									switch_core_session_rwunlock(t_session);
 									switch_channel_hangup(hup_channel, SWITCH_CAUSE_ATTENDED_TRANSFER);
 								} else {
 									switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Session to transfer to not found.\n");
-									nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
+									nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"),
 											   NUTAG_SUBSTATE(nua_substate_terminated),
-											   SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp), TAG_END());
+											   SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden\r\n"), SIPTAG_EVENT_STR(etmp), TAG_END());
 								}
 							}
 						}
@@ -4686,54 +5182,81 @@
 
 						if ((a_session = switch_core_session_locate(br_a))) {
 							const char *port = NULL;
-							char *param_string = "";
-							int count = 0, bytes = 0;
+							const char *rep_h = NULL;
 
 							if (refer_to && refer_to->r_url && refer_to->r_url->url_port) {
 								port = refer_to->r_url->url_port;
 							}
 
-							if (zstr(port)) {
-								port = "5060";
-							}
-							
 							channel = switch_core_session_get_channel(a_session);
-							
-							if (refer_to->r_params) {
-								for (count = 0; refer_to->r_params[count] ; count++) {
-									bytes += strlen(refer_to->r_params[count]) + 1;
-								}
 
-								if (bytes) {
-									bytes += 2;
+							exten = switch_core_session_sprintf(session, "sofia/%s/sip:%s@%s%s%s",
+																profile->name, refer_to->r_url->url_user,
+																refer_to->r_url->url_host, port ? ":" : "", port ? port : "");
 
-									param_string = switch_core_session_alloc(session, bytes);
-									*param_string = ';';
-									for (count = 0; refer_to->r_params[count] ; count++) {
-										switch_snprintf(param_string + strlen(param_string), bytes - strlen(param_string), "%s;", refer_to->r_params[count]);
-									}
-								
-									if (end_of(param_string) == ';') {
-										end_of(param_string) = '\0';
-									}
+							switch_core_new_memory_pool(&npool);
+							nightmare_xfer_helper = switch_core_alloc(npool, sizeof(*nightmare_xfer_helper));
+							nightmare_xfer_helper->exten = switch_core_strdup(npool, exten);
+
+							if (refer_to->r_url && (refer_to->r_url->url_params || refer_to->r_url->url_headers)) {
+								if (refer_to->r_url->url_headers) {
+									nightmare_xfer_helper->exten_with_params = switch_core_sprintf(npool,
+																								   "{sip_invite_params=%s?%s}%s",
+																								   refer_to->r_url->url_params ? refer_to->r_url->
+																								   url_params : "", refer_to->r_url->url_headers, exten);
+								} else {
+									nightmare_xfer_helper->exten_with_params = switch_core_sprintf(npool,
+																								   "{sip_invite_params=%s}%s", refer_to->r_url->url_params,
+																								   exten);
 								}
+								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "INVITE RURI '%s'\n", nightmare_xfer_helper->exten_with_params);
+							} else {
+								nightmare_xfer_helper->exten_with_params = nightmare_xfer_helper->exten;
 							}
 
-							exten = switch_core_session_sprintf(session, "sofia/%s/sip:%s@%s", 
-																profile->name, refer_to->r_url->url_user, 
-																refer_to->r_url->url_host);
-
-							switch_core_new_memory_pool(&npool);
-							nightmare_xfer_helper = switch_core_alloc(npool, sizeof(*nightmare_xfer_helper));
-							nightmare_xfer_helper->exten = switch_core_strdup(npool, exten);
 							nightmare_xfer_helper->event = switch_core_strdup(npool, etmp);
 							nightmare_xfer_helper->reply_uuid = switch_core_strdup(npool, switch_core_session_get_uuid(session));
 							nightmare_xfer_helper->bridge_to_uuid = switch_core_strdup(npool, br_a);
 							nightmare_xfer_helper->pool = npool;
+
+							if (refer_to->r_url && refer_to->r_url->url_headers) {
+								char *h, *v, *hp;
+								p = switch_core_session_strdup(session, refer_to->r_url->url_headers);
+								while (p && *p) {
+									h = p;
+									if ((p = strchr(p, '='))) {
+										*p++ = '\0';
+										v = p;
+										if ((p = strchr(p, '&'))) {
+											*p++ = '\0';
+										}
+
+										url_unescape(h, (const char *) h);
+										url_unescape(v, (const char *) v);
+										if (strcasecmp("Replaces", h)) {
+											hp = switch_core_session_sprintf(session, "%s%s", SOFIA_SIP_HEADER_PREFIX, h);
+											switch_channel_set_variable(channel, hp, v);
+										} else {
+											// use this one instead of rep value from above to keep all parameters
+											switch_channel_set_variable(channel, SOFIA_REPLACES_HEADER, v);
+										}
+										switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Exporting replaces URL header [%s:%s]\n",
+														  h, v);
+									}
+								}
+							}
+
+
 							switch_event_create(&nightmare_xfer_helper->vars, SWITCH_EVENT_CHANNEL_DATA);
 
-							switch_event_add_header_string(nightmare_xfer_helper->vars, SWITCH_STACK_BOTTOM, SOFIA_REPLACES_HEADER, rep);
-							
+							rep_h = switch_channel_get_variable(channel, SOFIA_REPLACES_HEADER);
+							if (rep_h) {
+								switch_event_add_header_string(nightmare_xfer_helper->vars, SWITCH_STACK_BOTTOM, SOFIA_REPLACES_HEADER, rep_h);
+							} else {
+								switch_event_add_header_string(nightmare_xfer_helper->vars, SWITCH_STACK_BOTTOM, SOFIA_REPLACES_HEADER, rep);
+							}
+
+
 							if (!zstr(full_ref_by)) {
 								switch_event_add_header_string(nightmare_xfer_helper->vars, SWITCH_STACK_BOTTOM, "Referred-By", full_ref_by);
 							}
@@ -4744,7 +5267,7 @@
 
 							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Good Luck, you'll need it......\n");
 							launch_nightmare_xfer(nightmare_xfer_helper);
-							
+
 							switch_core_session_rwunlock(a_session);
 
 						} else {
@@ -4755,8 +5278,8 @@
 					  error:
 						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Transfer! [%s]\n", br_a);
 						switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER_ERROR");
-						nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
-								   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp),
+						nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"),
+								   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden\r\n"), SIPTAG_EVENT_STR(etmp),
 								   TAG_END());
 					}
 				}
@@ -4793,14 +5316,14 @@
 			}
 
 			switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "BLIND_TRANSFER");
-			nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
-					   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK"), SIPTAG_EVENT_STR(etmp), TAG_END());
+			nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"),
+					   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 200 OK\r\n"), SIPTAG_EVENT_STR(etmp), TAG_END());
 
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot Blind Transfer 1 Legged calls\n");
 			switch_channel_set_variable(channel_a, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER_ERROR");
-			nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
-					   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden"), SIPTAG_EVENT_STR(etmp), TAG_END());
+			nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"),
+					   NUTAG_SUBSTATE(nua_substate_terminated), SIPTAG_PAYLOAD_STR("SIP/2.0 403 Forbidden\r\n"), SIPTAG_EVENT_STR(etmp), TAG_END());
 		}
 	}
 
@@ -4841,9 +5364,12 @@
 					signal_ptr = signal_ptr + 7;
 
 					/* handle broken devices with spaces after the = (cough) VegaStream (cough) */
-					while (*signal_ptr && *signal_ptr == ' ') signal_ptr++;
+					while (*signal_ptr && *signal_ptr == ' ')
+						signal_ptr++;
 
-					if (*signal_ptr && (*signal_ptr == '*' || *signal_ptr == '#' || *signal_ptr == 'A' || *signal_ptr == 'B' || *signal_ptr == 'C' || *signal_ptr == 'D')) {
+					if (*signal_ptr
+						&& (*signal_ptr == '*' || *signal_ptr == '#' || *signal_ptr == 'A' || *signal_ptr == 'B' || *signal_ptr == 'C'
+							|| *signal_ptr == 'D')) {
 						dtmf.digit = *signal_ptr;
 					} else {
 						tmp = atoi(signal_ptr);
@@ -4859,8 +5385,9 @@
 					signal_ptr += 9;
 
 					/* handle broken devices with spaces after the = (cough) VegaStream (cough) */
-					while (*signal_ptr && *signal_ptr == ' ') signal_ptr++;
-					
+					while (*signal_ptr && *signal_ptr == ' ')
+						signal_ptr++;
+
 					if ((tmp = atoi(signal_ptr)) <= 0) {
 						tmp = switch_core_default_dtmf_duration(0);
 					}
@@ -4881,11 +5408,11 @@
 
 				/* print debug info */
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "INFO DTMF(%c)\n", dtmf.digit);
-				
+
 				if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
 					const char *uuid;
 					switch_core_session_t *session_b;
-					
+
 					if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (session_b = switch_core_session_locate(uuid))) {
 						while (switch_channel_has_dtmf(channel)) {
 							switch_dtmf_t idtmf = { 0, 0 };
@@ -4921,12 +5448,13 @@
 				if (!strcasecmp(rec_header, "on")) {
 					char *file = NULL, *tmp = NULL;
 
-					tmp = switch_mprintf("%s%s%s", profile->record_path ? profile->record_path : "${base_dir}/recordings",
+					tmp = switch_mprintf("%s%s%s", profile->record_path ? profile->record_path : "${recordings_dir}",
 										 SWITCH_PATH_SEPARATOR, profile->record_template);
 					file = switch_channel_expand_variables(channel, tmp);
 					switch_ivr_record_session(session, file, 0, NULL);
 					switch_channel_set_variable(channel, "sofia_record_file", file);
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Recording %s to %s\n", switch_channel_get_name(channel), file);
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Recording %s to %s\n", switch_channel_get_name(channel),
+									  file);
 					switch_safe_free(tmp);
 					nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
 					if (file != profile->record_template) {
@@ -4937,7 +5465,8 @@
 					const char *file;
 
 					if ((file = switch_channel_get_variable(channel, "sofia_record_file"))) {
-						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Done recording %s to %s\n", switch_channel_get_name(channel), file);
+						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Done recording %s to %s\n",
+										  switch_channel_get_name(channel), file);
 						switch_ivr_stop_record_session(session, file);
 						nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
 					} else {
@@ -4948,7 +5477,7 @@
 		}
 	}
 
- end:
+  end:
 
 
 	if (sip && switch_event_create(&event, SWITCH_EVENT_RECV_INFO) == SWITCH_STATUS_SUCCESS) {
@@ -4991,7 +5520,8 @@
 
 
 		if (sip->sip_call_info) {
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Call-Info", sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_call_info));
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Call-Info",
+										   sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_call_info));
 		}
 
 		if (alert_info) {
@@ -5013,56 +5543,27 @@
 
 }
 
-#define url_set_chanvars(session, url, varprefix) _url_set_chanvars(session, url, #varprefix "_user", #varprefix "_host", #varprefix "_port", #varprefix "_uri", #varprefix "_params")
-
-const char *_url_set_chanvars(switch_core_session_t *session, url_t *url, const char *user_var,
-							  const char *host_var, const char *port_var, const char *uri_var, const char *params_var)
+void sofia_handle_sip_i_reinvite(switch_core_session_t *session,
+								 nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+								 tagi_t tags[])
 {
-	const char *user = NULL, *host = NULL, *port = NULL;
-	char *uri = NULL;
-	switch_channel_t *channel = switch_core_session_get_channel(session);
-	char new_port[25] = "";
+	char *call_info = NULL;
 
-	if (url) {
-		user = url->url_user;
-		host = url->url_host;
-		port = url->url_port;
-		if (!zstr(url->url_params)) {
-			switch_channel_set_variable(channel, params_var, url->url_params);
+	if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) {
+		switch_channel_t *channel = switch_core_session_get_channel(session);
+		if (channel && sip->sip_call_info) {
+			char *p;
+			if ((call_info = sip_header_as_string(nua_handle_home(nh), (void *) sip->sip_call_info))) {
+				if (switch_stristr("appearance", call_info)) {
+					switch_channel_set_variable(channel, "presence_call_info_full", call_info);
+					if ((p = strchr(call_info, ';'))) {
+						switch_channel_set_variable(channel, "presence_call_info", p + 1);
+					}
+				}
+				su_free(nua_handle_home(nh), call_info);
+			}
 		}
 	}
-
-	if (zstr(user)) {
-		user = "nobody";
-	}
-
-	if (zstr(host)) {
-		host = "nowhere";
-	}
-
-	check_decode(user, session);
-
-	if (user) {
-		switch_channel_set_variable(channel, user_var, user);
-	}
-
-
-	if (port) {
-		switch_snprintf(new_port, sizeof(new_port), ":%s", port);
-	}
-
-	switch_channel_set_variable(channel, port_var, port);
-	if (host) {
-		if (user) {
-			uri = switch_core_session_sprintf(session, "%s@%s%s", user, host, new_port);
-		} else {
-			uri = switch_core_session_sprintf(session, "%s%s", host, new_port);
-		}
-		switch_channel_set_variable(channel, uri_var, uri);
-		switch_channel_set_variable(channel, host_var, host);
-	}
-
-	return uri;
 }
 
 void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
@@ -5097,6 +5598,8 @@
 	char acl_token[512] = "";
 	sofia_transport_t transport;
 	const char *gw_name = NULL;
+	char *call_info_str = NULL;
+	nua_handle_t *bnh = NULL;
 
 	profile->ib_calls++;
 
@@ -5117,7 +5620,7 @@
 		goto fail;
 	}
 
-	sofia_glue_get_addr(nua_current_request(nua), network_ip,  sizeof(network_ip), &network_port);
+	sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port);
 
 	if (sofia_test_pflag(profile, PFLAG_AGGRESSIVE_NAT_DETECTION)) {
 		if (sip && sip->sip_via) {
@@ -5157,7 +5660,7 @@
 			}
 		}
 	}
-	
+
 	if (profile->acl_count) {
 		uint32_t x = 0;
 		int ok = 1;
@@ -5183,16 +5686,15 @@
 		} else {
 			int network_ip_is_proxy = 0;
 			/* Check if network_ip is a proxy allowed to send us calls */
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%d acls to check for proxy\n", profile->proxy_acl_count);
-			
+			if (profile->proxy_acl_count) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%d acls to check for proxy\n", profile->proxy_acl_count);
+			}
+
 			for (x = 0; x < profile->proxy_acl_count; x++) {
 				last_acl = profile->proxy_acl[x];
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "checking %s against acl %s\n", network_ip, last_acl);
 				if (switch_check_network_list_ip_token(network_ip, last_acl, &token)) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
-									  "%s is a proxy according to the %s acl\n",
-									  network_ip, last_acl
-									  );
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s is a proxy according to the %s acl\n", network_ip, last_acl);
 					network_ip_is_proxy = 1;
 					break;
 				}
@@ -5201,20 +5703,17 @@
 			 * if network_ip is a proxy allowed to send calls, check for auth
 			 * ip header and see if it matches against the inbound acl
 			 */
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "network ip is a proxy [%d]\n", network_ip_is_proxy);
-			
 			if (network_ip_is_proxy) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "network ip is a proxy\n");
+
 				for (un = sip->sip_unknown; un; un = un->un_next) {
 					if (!strcasecmp(un->un_name, "X-AUTH-IP")) {
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
-										  "found auth ip [%s] header of [%s]\n",
-										  un->un_name, un->un_value
-										  );
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "found auth ip [%s] header of [%s]\n", un->un_name, un->un_value);
 						if (!zstr(un->un_value)) {
 							for (x = 0; x < profile->acl_count; x++) {
 								last_acl = profile->acl[x];
 								if ((ok = switch_check_network_list_ip_token(un->un_value, last_acl, &token))) {
-									switch_copy_string(proxied_client_ip, un->un_value, sizeof (proxied_client_ip));
+									switch_copy_string(proxied_client_ip, un->un_value, sizeof(proxied_client_ip));
 									break;
 								}
 							}
@@ -5222,7 +5721,7 @@
 					}
 				}
 			}
-			
+
 			if (!ok) {
 				if (!sofia_test_pflag(profile, PFLAG_AUTH_CALLS)) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl \"%s\"\n", network_ip, switch_str_nil(last_acl));
@@ -5246,7 +5745,8 @@
 	}
 
 	if (!is_auth &&
-		(sofia_test_pflag(profile, PFLAG_AUTH_CALLS) || (!sofia_test_pflag(profile, PFLAG_BLIND_AUTH) && (sip->sip_proxy_authorization || sip->sip_authorization)))) {
+		(sofia_test_pflag(profile, PFLAG_AUTH_CALLS)
+		 || (!sofia_test_pflag(profile, PFLAG_BLIND_AUTH) && (sip->sip_proxy_authorization || sip->sip_authorization)))) {
 		if (!strcmp(network_ip, profile->sipip) && network_port == profile->sip_port) {
 			calling_myself++;
 		} else {
@@ -5254,7 +5754,7 @@
 				if (v_event) {
 					switch_event_destroy(&v_event);
 				}
-				
+
 				if (sip->sip_authorization || sip->sip_proxy_authorization) {
 					goto fail;
 				}
@@ -5294,6 +5794,9 @@
 
 	channel = tech_pvt->channel = switch_core_session_get_channel(session);
 
+	switch_channel_set_variable_printf(channel, "sip_network_ip", "%s", network_ip);
+	switch_channel_set_variable_printf(channel, "sip_network_port", "%d", network_port);
+
 	if (*acl_token) {
 		switch_channel_set_variable(channel, "acl_token", acl_token);
 		if (strchr(acl_token, '@')) {
@@ -5313,13 +5816,9 @@
 
 		tech_pvt->record_route =
 			switch_core_session_sprintf(session,
-			"sip:%s@%s%s%s:%d;transport=%s",
-			sip->sip_contact->m_url->url_user,
-			ipv6 ? "[" : "",
-			tech_pvt->remote_ip,
-			ipv6 ? "]" : "",
-			tech_pvt->remote_port,
-			sofia_glue_transport2str(transport));
+										"sip:%s@%s%s%s:%d;transport=%s",
+										sip->sip_contact->m_url->url_user,
+										ipv6 ? "[" : "", tech_pvt->remote_ip, ipv6 ? "]" : "", tech_pvt->remote_port, sofia_glue_transport2str(transport));
 
 		switch_channel_set_variable(channel, "sip_received_ip", tech_pvt->remote_ip);
 		snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_port);
@@ -5353,10 +5852,11 @@
 	}
 
 	if (sip->sip_from && sip->sip_from->a_url) {
-		char * tmp;
+		char *tmp;
 		from_user = sip->sip_from->a_url->url_user;
 		from_host = sip->sip_from->a_url->url_host;
 		channel_name = url_set_chanvars(session, sip->sip_from->a_url, sip_from);
+
 		if (sip->sip_from->a_url->url_params && (tmp = sofia_glue_find_parameter(sip->sip_from->a_url->url_params, "isup-oli="))) {
 			aniii = switch_core_session_strdup(session, tmp + 9);
 			if ((tmp = strchr(aniii, ';'))) {
@@ -5390,7 +5890,7 @@
 
 	if ((rpid = sip_remote_party_id(sip))) {
 		if (rpid->rpid_url && rpid->rpid_url->url_user) {
-			char *full_rpid_header = sip_header_as_string(nh->nh_home, (void *) rpid); 
+			char *full_rpid_header = sip_header_as_string(nh->nh_home, (void *) rpid);
 			from_user = rpid->rpid_url->url_user;
 			if (!zstr(full_rpid_header)) {
 				switch_channel_set_variable(channel, "sip_Remote-Party-ID", full_rpid_header);
@@ -5426,7 +5926,7 @@
 			if (!zstr(full_ppid_header)) {
 				switch_channel_set_variable(channel, "sip_P-Preferred-Identity", full_ppid_header);
 			}
-			
+
 		}
 		if (!zstr(ppreferred->ppid_display)) {
 			displayname = ppreferred->ppid_display;
@@ -5439,6 +5939,8 @@
 		check_decode(from_user, session);
 	}
 
+	extract_header_vars(profile, sip, session);
+
 	if (sip->sip_request->rq_url) {
 		const char *req_uri = url_set_chanvars(session, sip->sip_request->rq_url, sip_req);
 		if (sofia_test_pflag(profile, PFLAG_FULL_ID)) {
@@ -5454,13 +5956,18 @@
 	if (!destination_number && sip->sip_to && sip->sip_to->a_url) {
 		destination_number = sip->sip_to->a_url->url_user;
 	}
-	
+
+	/* The human network, OH THE HUMANITY!!! lets send invites with no number! */
+	if (!destination_number && sip->sip_from && sip->sip_from->a_url) {
+		destination_number = sip->sip_from->a_url->url_user;
+	}
+
 	if (destination_number) {
 		check_decode(destination_number, session);
 	} else {
 		destination_number = "service";
 	}
-	
+
 	if (sip->sip_to && sip->sip_to->a_url) {
 		const char *host, *user;
 		int port;
@@ -5479,7 +5986,7 @@
 		if (switch_channel_get_variable(channel, "sip_to_uri")) {
 			const char *ipv6;
 			const char *tmp, *at, *url = NULL;
-			
+
 			host = switch_channel_get_variable(channel, "sip_to_host");
 			user = switch_channel_get_variable(channel, "sip_to_user");
 
@@ -5498,20 +6005,17 @@
 			ipv6 = strchr(host, ':');
 			tech_pvt->to_uri =
 				switch_core_session_sprintf(session,
-					"sip:%s@%s%s%s:%d;transport=%s",
-					user, ipv6 ? "[" : "",
-					host, ipv6 ? "]" : "",
-					port,
-					sofia_glue_transport2str(transport));
+											"sip:%s@%s%s%s:%d;transport=%s",
+											user, ipv6 ? "[" : "", host, ipv6 ? "]" : "", port, sofia_glue_transport2str(transport));
 
 			if (sofia_glue_check_nat(profile, tech_pvt->remote_ip)) {
 				url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_public_url : profile->public_url;
-			} else { 
+			} else {
 				url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url;
-			}			
-			
+			}
+
 			tmp = sofia_overcome_sip_uri_weakness(session, url, transport, SWITCH_TRUE, NULL);
-	
+
 			if ((at = strchr(tmp, '@'))) {
 				url = switch_core_session_sprintf(session, "sip:%s%s", user, at);
 			}
@@ -5519,43 +6023,41 @@
 			if (url) {
 				const char *brackets = NULL;
 				const char *proto = NULL;
-				
+
 				brackets = strchr(url, '>');
 				proto = switch_stristr("transport=", url);
 				tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s%s%s%s%s",
 																	  brackets ? "" : "<", url,
 																	  proto ? "" : ";transport=",
-																	  proto ? "" : sofia_glue_transport2str(transport),
-																	  brackets ? "" : ">");
+																	  proto ? "" : sofia_glue_transport2str(transport), brackets ? "" : ">");
 			} else {
 				switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 			}
-			
+
 		} else {
 			const char *url = NULL;
 			if (sofia_glue_check_nat(profile, tech_pvt->remote_ip)) {
-			url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_public_url : profile->public_url;
-			} else { 
+				url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_public_url : profile->public_url;
+			} else {
 				url = (sofia_glue_transport_has_tls(transport)) ? profile->tls_url : profile->url;
-			}			
-			
+			}
+
 			if (url) {
 				const char *brackets = NULL;
 				const char *proto = NULL;
-				
+
 				brackets = strchr(url, '>');
 				proto = switch_stristr("transport=", url);
 				tech_pvt->reply_contact = switch_core_session_sprintf(session, "%s%s%s%s%s",
 																	  brackets ? "" : "<", url,
 																	  proto ? "" : ";transport=",
-																	  proto ? "" : sofia_glue_transport2str(transport),
-																	  brackets ? "" : ">");
+																	  proto ? "" : sofia_glue_transport2str(transport), brackets ? "" : ">");
 			} else {
 				switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 			}
 		}
 	}
-	
+
 	if (sofia_glue_check_nat(profile, tech_pvt->remote_ip)) {
 		tech_pvt->user_via = sofia_glue_create_external_via(session, profile, tech_pvt->transport);
 	}
@@ -5656,12 +6158,11 @@
 	}
 
 	if ((call_info = sip_call_info(sip))) {
-		char *tmp = sip_header_as_string(profile->home, (void *) call_info);
-		if (call_info->ci_params && (msg_params_find(call_info->ci_params , "answer-after=0"))) {
+		call_info_str = sip_header_as_string(nh->nh_home, (void *) call_info);
+		if (call_info->ci_params && (msg_params_find(call_info->ci_params, "answer-after=0"))) {
 			switch_channel_set_variable(channel, "sip_auto_answer_detected", "true");
 		}
-		switch_channel_set_variable(channel, "sip_call_info", tmp);
-		su_free(profile->home, tmp);
+		switch_channel_set_variable(channel, "sip_call_info", call_info_str);
 	}
 
 	if (profile->pres_type) {
@@ -5674,7 +6175,7 @@
 		free(tmp);
 	}
 
-	
+
 	if (sip->sip_request->rq_url->url_params) {
 		gw_name = sofia_glue_find_parameter(sip->sip_request->rq_url->url_params, "gw=");
 	}
@@ -5703,7 +6204,7 @@
 
 			if (gateway->ib_vars) {
 				switch_event_header_t *hp;
-				for(hp = gateway->ib_vars->headers; hp; hp = hp->next) {
+				for (hp = gateway->ib_vars->headers; hp; hp = hp->next) {
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s setting variable [%s]=[%s]\n",
 									  switch_channel_get_name(channel), hp->name, hp->value);
 					switch_channel_set_variable(channel, hp->name, hp->value);
@@ -5714,77 +6215,127 @@
 		}
 	}
 
-	if (sip->sip_replaces) {
-		nua_handle_t *bnh;
-		if ((bnh = nua_handle_by_replaces(nua, sip->sip_replaces))) {
-			sofia_private_t *b_private = NULL;
-			if ((b_private = nua_handle_magic(bnh))) {
-				switch_core_session_t *b_session = NULL;
-				if ((b_session = switch_core_session_locate(b_private->uuid))) {
-					switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
-					const char *uuid;
-					int one_leg = 1;
-					private_object_t *b_tech_pvt = NULL;
-					const char *app = switch_channel_get_variable(b_channel, SWITCH_CURRENT_APPLICATION_VARIABLE);
-					const char *data = switch_channel_get_variable(b_channel, SWITCH_CURRENT_APPLICATION_DATA_VARIABLE);
-					
-					if (app && data && !strcasecmp(app, "conference")) {
-						destination_number = switch_core_session_sprintf(b_session, "answer,conference:%s", data);
-						dialplan = "inline";
+	if (call_info_str) {
+		char *sql;
+		char cid[512] = "";
+		char *str;
+		char *p = NULL;
+		const char *user = NULL, *host = NULL;
+
+		if (sip->sip_to && sip->sip_to->a_url) {
+			user = sip->sip_to->a_url->url_user;
+			host = sip->sip_to->a_url->url_host;
+		}
+
+		if (!user || !host) {
+			if (sip->sip_from && sip->sip_from->a_url) {
+				if (!user)
+					user = sip->sip_from->a_url->url_user;
+				if (!host)
+					host = sip->sip_from->a_url->url_host;
+			}
+		}
+
+		if (user && host) {
+			if ((p = strchr(call_info_str, ';'))) {
+				p++;
+			}
+
+			sql =
+				switch_mprintf
+				("select call_id from sip_dialogs where call_info='%q' and sip_from_user='%q' and sip_from_host='%q' and call_id is not null",
+				 switch_str_nil(p), user, host);
+
+			if ((str = sofia_glue_execute_sql2str(profile, profile->ireg_mutex, sql, cid, sizeof(cid)))) {
+				bnh = nua_handle_by_call_id(nua, str);
+			}
+
+			if (mod_sofia_globals.debug_sla > 1) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "PICK SQL %s [%s] [%s] %d\n", sql, str, cid, !!bnh);
+			}
+
+			free(sql);
+		}
+	}
+
+	if (!bnh && sip->sip_replaces) {
+		if (!(bnh = nua_handle_by_replaces(nua, sip->sip_replaces))) {
+			if (!(bnh = nua_handle_by_call_id(nua, sip->sip_replaces->rp_call_id))) {
+				bnh = sofia_global_nua_handle_by_replaces(sip->sip_replaces);
+			}
+		}
+	}
+
+	if (bnh) {
+		sofia_private_t *b_private = NULL;
+		if ((b_private = nua_handle_magic(bnh))) {
+			switch_core_session_t *b_session = NULL;
+
+			if ((b_session = switch_core_session_locate(b_private->uuid))) {
+				switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
+				const char *uuid;
+				int one_leg = 1;
+				private_object_t *b_tech_pvt = NULL;
+				const char *app = switch_channel_get_variable(b_channel, SWITCH_CURRENT_APPLICATION_VARIABLE);
+				const char *data = switch_channel_get_variable(b_channel, SWITCH_CURRENT_APPLICATION_DATA_VARIABLE);
+
+				if (app && data && !strcasecmp(app, "conference")) {
+					destination_number = switch_core_session_sprintf(b_session, "answer,conference:%s", data);
+					dialplan = "inline";
+				} else {
+					if (switch_core_session_check_interface(b_session, sofia_endpoint_interface)) {
+						b_tech_pvt = switch_core_session_get_private(b_session);
+					}
+
+					if ((uuid = switch_channel_get_variable(b_channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
+						switch_channel_set_variable(b_channel, "presence_call_info", NULL);
+						switch_channel_set_variable(b_channel, "presence_call_info_full", NULL);
+						one_leg = 0;
 					} else {
-						if (switch_core_session_check_interface(b_session, sofia_endpoint_interface)) {
-							b_tech_pvt = switch_core_session_get_private(b_session);
-						}
+						uuid = switch_core_session_get_uuid(b_session);
+					}
 
-						if ((uuid = switch_channel_get_variable(b_channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
-							one_leg = 0;
-						} else {
-							uuid = switch_core_session_get_uuid(b_session);
-						}
-					
-						if (uuid) {
-							switch_core_session_t *c_session = NULL;
-							int do_conf = 0;					
-						
-							uuid = switch_core_session_strdup(b_session, uuid);
+					if (uuid) {
+						switch_core_session_t *c_session = NULL;
+						int do_conf = 0;
+						uuid = switch_core_session_strdup(b_session, uuid);
 
-							if ((c_session = switch_core_session_locate(uuid))) {
-								switch_channel_t *c_channel = switch_core_session_get_channel(c_session);
-								private_object_t *c_tech_pvt = NULL;
-					
-								if (switch_core_session_check_interface(c_session, sofia_endpoint_interface)) {
-									c_tech_pvt = switch_core_session_get_private(c_session);
-								}
-								
+						if ((c_session = switch_core_session_locate(uuid))) {
+							switch_channel_t *c_channel = switch_core_session_get_channel(c_session);
+							private_object_t *c_tech_pvt = NULL;
 
-								if (!one_leg && 
-									(!b_tech_pvt || !sofia_test_flag(b_tech_pvt, TFLAG_SIP_HOLD)) && 
-									(!c_tech_pvt || !sofia_test_flag(c_tech_pvt, TFLAG_SIP_HOLD))) {
-									char *ext = switch_core_session_sprintf(b_session, "conference:%s@sla+flags{mintwo}", uuid);
-								
-									switch_channel_set_flag(c_channel, CF_REDIRECT);
-									switch_ivr_session_transfer(b_session, ext, "inline", NULL);
-									switch_ivr_session_transfer(c_session, ext, "inline", NULL);
-									switch_channel_clear_flag(c_channel, CF_REDIRECT);
-									do_conf = 1;
-								}
-								switch_core_session_rwunlock(c_session);
+							if (switch_core_session_check_interface(c_session, sofia_endpoint_interface)) {
+								c_tech_pvt = switch_core_session_get_private(c_session);
 							}
-						
-							if (do_conf) {
-								destination_number = switch_core_session_sprintf(b_session, "answer,conference:%s@sla+flags{mintwo}", uuid);
-							} else {
-								destination_number = switch_core_session_sprintf(b_session, "answer,intercept:%s", uuid);
+
+
+							if (!one_leg &&
+								(!b_tech_pvt || !sofia_test_flag(b_tech_pvt, TFLAG_SIP_HOLD)) &&
+								(!c_tech_pvt || !sofia_test_flag(c_tech_pvt, TFLAG_SIP_HOLD))) {
+								char *ext = switch_core_session_sprintf(b_session, "answer,conference:%s@sla+flags{mintwo}", uuid);
+
+								switch_channel_set_flag(c_channel, CF_REDIRECT);
+								switch_ivr_session_transfer(b_session, ext, "inline", NULL);
+								switch_ivr_session_transfer(c_session, ext, "inline", NULL);
+								switch_channel_clear_flag(c_channel, CF_REDIRECT);
+								do_conf = 1;
 							}
+							switch_core_session_rwunlock(c_session);
+						}
 
-							dialplan = "inline";
+						if (do_conf) {
+							destination_number = switch_core_session_sprintf(b_session, "answer,conference:%s@sla+flags{mintwo}", uuid);
+						} else {
+							destination_number = switch_core_session_sprintf(b_session, "answer,intercept:%s", uuid);
 						}
+
+						dialplan = "inline";
 					}
-					switch_core_session_rwunlock(b_session);
 				}
+				switch_core_session_rwunlock(b_session);
 			}
-			nua_handle_unref(bnh);
 		}
+		nua_handle_unref(bnh);
 	}
 
 	check_decode(displayname, session);
@@ -5817,7 +6368,7 @@
 		}
 
 		if ((privacy = sip_privacy(sip))) {
-			char *full_priv_header = sip_header_as_string(nh->nh_home, (void *) privacy); 
+			char *full_priv_header = sip_header_as_string(nh->nh_home, (void *) privacy);
 			if (!zstr(full_priv_header)) {
 				switch_channel_set_variable(channel, "sip_Privacy", full_priv_header);
 			}
@@ -5845,8 +6396,8 @@
 			} else if (!strncasecmp(un->un_name, "X-", 2) || !strncasecmp(un->un_name, "P-", 2)) {
 				if (!zstr(un->un_value)) {
 					char new_name[512] = "";
-					int reps  = 0;
-					for(;;) {
+					int reps = 0;
+					for (;;) {
 						char postfix[25] = "";
 						if (reps > 0) {
 							switch_snprintf(postfix, sizeof(postfix), "-%d", reps);
@@ -5864,10 +6415,10 @@
 				}
 			}
 		}
-		
+
 		switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
 	}
-	
+
 	if (!(sofia_private = malloc(sizeof(*sofia_private)))) {
 		abort();
 	}
@@ -5875,7 +6426,7 @@
 	memset(sofia_private, 0, sizeof(*sofia_private));
 	sofia_private->is_call++;
 	tech_pvt->sofia_private = sofia_private;
-	
+
 	if ((profile->pres_type)) {
 		sofia_presence_set_chat_hash(tech_pvt, sip);
 	}
@@ -5926,25 +6477,38 @@
 			const char *presence_data = switch_channel_get_variable(channel, "presence_data");
 			const char *presence_id = switch_channel_get_variable(channel, "presence_id");
 			char *full_contact = "";
+			char *p = NULL;
 
+
 			if (sip->sip_contact) {
 				full_contact = sip_header_as_string(nua_handle_home(tech_pvt->nh), (void *) sip->sip_contact);
 			}
-			
+
+			if (call_info_str && switch_stristr("appearance", call_info_str)) {
+				switch_channel_set_variable(channel, "presence_call_info_full", call_info_str);
+				if ((p = strchr(call_info_str, ';'))) {
+					p++;
+					switch_channel_set_variable(channel, "presence_call_info", p);
+				}
+			}
+
+
 			sql = switch_mprintf("insert into sip_dialogs "
 								 "(call_id,uuid,sip_to_user,sip_to_host,sip_from_user,sip_from_host,contact_user,"
-								 "contact_host,state,direction,user_agent,profile_name,hostname,contact,presence_id,presence_data) "
-								 "values('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q')",
+								 "contact_host,state,direction,user_agent,profile_name,hostname,contact,presence_id,presence_data,call_info) "
+								 "values('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q')",
 								 call_id,
 								 tech_pvt->sofia_private->uuid,
-								 to_user, to_host, dialog_from_user, dialog_from_host, 
+								 to_user, to_host, dialog_from_user, dialog_from_host,
 								 contact_user, contact_host, "confirmed", "inbound", user_agent,
-								 profile->name, mod_sofia_globals.hostname, switch_str_nil(full_contact), 
-								 switch_str_nil(presence_id), switch_str_nil(presence_data));
+								 profile->name, mod_sofia_globals.hostname, switch_str_nil(full_contact),
+								 switch_str_nil(presence_id), switch_str_nil(presence_data), switch_str_nil(p));
 
 			switch_assert(sql);
-			
-			sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
+
+			sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex);
+			switch_safe_free(sql);
+
 		}
 
 		if (is_nat) {
@@ -5959,7 +6523,8 @@
 		switch_mutex_lock(profile->flag_mutex);
 		switch_core_session_limit(sess_count - 10);
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "LUKE: I'm hit, but not bad.\n");
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "LUKE'S VOICE: Artoo, see what you can do with it. Hang on back there....\n"
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT,
+						  "LUKE'S VOICE: Artoo, see what you can do with it. Hang on back there....\n"
 						  "Green laserfire moves past the beeping little robot as his head turns.  "
 						  "After a few beeps and a twist of his mechanical arm,\n"
 						  "Artoo reduces the max sessions to %d thus, saving the switch from certain doom.\n", sess_count - 10);
@@ -5978,7 +6543,7 @@
 	nua_respond(nh, 503, "Maximum Calls In Progress", SIPTAG_RETRY_AFTER_STR("300"), TAG_END());
 	return;
 
- fail:
+  fail:
 	profile->ib_failed_calls++;
 	return;
 
@@ -5986,7 +6551,8 @@
 
 void sofia_handle_sip_i_options(int status,
 								char const *phrase,
-								nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
+								nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+								tagi_t tags[])
 {
 	nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
 }
@@ -5999,13 +6565,13 @@
 	if (aleg && bleg && switch_core_session_compare(aleg, bleg)) {
 		switch_channel_t *channel = switch_core_session_get_channel(bleg);
 		const char *ua = switch_channel_get_variable(channel, "sip_user_agent");
-		
+
 		a_tech_pvt = (private_object_t *) switch_core_session_get_private(aleg);
 		b_tech_pvt = (private_object_t *) switch_core_session_get_private(bleg);
 
 		if (b_tech_pvt && a_tech_pvt && a_tech_pvt->caller_profile) {
 			switch_caller_profile_t *acp = a_tech_pvt->caller_profile;
-			
+
 			if (ua && switch_stristr("snom", ua)) {
 				if (zstr(acp->caller_id_name)) {
 					snprintf(message, sizeof(message), "From:\r\nTo: %s\r\n", acp->caller_id_number);
@@ -6013,19 +6579,36 @@
 					snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", acp->caller_id_name, acp->caller_id_number);
 				}
 				nua_info(b_tech_pvt->nh,
-						 SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
-						 TAG_IF(!zstr(b_tech_pvt->user_via), SIPTAG_VIA_STR(b_tech_pvt->user_via)),
-						 SIPTAG_PAYLOAD_STR(message), TAG_END());
+						 SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"),
+						 TAG_IF(!zstr(b_tech_pvt->user_via), SIPTAG_VIA_STR(b_tech_pvt->user_via)), SIPTAG_PAYLOAD_STR(message), TAG_END());
 			} else if (ua && switch_stristr("polycom", ua)) {
 				if (zstr(acp->caller_id_name)) {
 					snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", acp->caller_id_number, acp->caller_id_number);
 				} else {
 					snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", acp->caller_id_name, acp->caller_id_number);
 				}
-				nua_update(b_tech_pvt->nh,
-						   TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
-						   TAG_IF(!zstr(b_tech_pvt->user_via), SIPTAG_VIA_STR(b_tech_pvt->user_via)),
-						   TAG_END());
+
+				if (b_tech_pvt->local_crypto_key) {
+					sofia_glue_set_local_sdp(b_tech_pvt, NULL, 0, NULL, 0);
+				}
+
+				if (sofia_use_soa(b_tech_pvt)) {
+					nua_update(b_tech_pvt->nh,
+							   SIPTAG_CONTACT_STR(b_tech_pvt->reply_contact),
+							   SOATAG_USER_SDP_STR(b_tech_pvt->local_sdp_str),
+							   SOATAG_REUSE_REJECTED(1),
+							   SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
+							   TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
+							   TAG_IF(!zstr(b_tech_pvt->user_via), SIPTAG_VIA_STR(b_tech_pvt->user_via)), TAG_END());
+				} else {
+					nua_update(b_tech_pvt->nh,
+							   NUTAG_MEDIA_ENABLE(0),
+							   SIPTAG_CONTACT_STR(b_tech_pvt->reply_contact),
+							   SIPTAG_CONTENT_TYPE_STR("application/sdp"),
+							   SIPTAG_PAYLOAD_STR(b_tech_pvt->local_sdp_str),
+							   TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
+							   TAG_IF(!zstr(b_tech_pvt->user_via), SIPTAG_VIA_STR(b_tech_pvt->user_via)), TAG_END());
+				}
 			}
 
 		}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/sofia_glue.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/sofia_glue.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/sofia_glue.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -51,12 +51,22 @@
 		}
 	}
 
+	if (!ip) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "%s NO IP!\n", switch_channel_get_name(tech_pvt->channel));
+		return;
+	}
+
 	if (!port) {
 		if (!(port = tech_pvt->adv_sdp_audio_port)) {
 			port = tech_pvt->proxy_sdp_audio_port;
 		}
 	}
 
+	if (!port) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "%s NO PORT!\n", switch_channel_get_name(tech_pvt->channel));
+		return;
+	}
+
 	if (!tech_pvt->owner_id) {
 		tech_pvt->owner_id = (uint32_t) switch_epoch_time_now(NULL) - port;
 	}
@@ -72,7 +82,7 @@
 					"v=0\n"
 					"o=%s %010u %010u IN %s %s\n"
 					"s=%s\n"
-					"c=IN %s %s\n" 
+					"c=IN %s %s\n"
 					"t=0 0\n"
 					"m=image %d udptl t38\n"
 					"a=T38MaxBitRate:%d\n"
@@ -84,9 +94,8 @@
 					"a=T38FaxMaxDatagram:%d\n"
 					"a=T38FaxUdpEC:%s\n"
 					"a=T38VendorInfo:%s\n",
-					
 					username,
-					tech_pvt->owner_id, 
+					tech_pvt->owner_id,
 					tech_pvt->session_id,
 					family,
 					ip,
@@ -94,18 +103,13 @@
 					family,
 					ip,
 					port,
-					
 					t38_options->T38MaxBitRate,
 					t38_options->T38FaxFillBitRemoval ? "a=T38FaxFillBitRemoval\n" : "",
 					t38_options->T38FaxTranscodingMMR ? "a=T38FaxTranscodingMMR\n" : "",
 					t38_options->T38FaxTranscodingJBIG ? "a=T38FaxTranscodingJBIG\n" : "",
 					t38_options->T38FaxRateManagement,
-					t38_options->T38FaxMaxBuffer,
-					t38_options->T38FaxMaxDatagram,
-					t38_options->T38FaxUdpEC,
-					t38_options->T38VendorInfo
-					);
-	
+					t38_options->T38FaxMaxBuffer, t38_options->T38FaxMaxDatagram, t38_options->T38FaxUdpEC, t38_options->T38VendorInfo);
+
 	sofia_glue_tech_set_local_sdp(tech_pvt, buf, SWITCH_TRUE);
 }
 
@@ -120,6 +124,7 @@
 	const char *family;
 	const char *pass_fmtp = switch_channel_get_variable(tech_pvt->channel, "sip_video_fmtp");
 	const char *ov_fmtp = switch_channel_get_variable(tech_pvt->channel, "sip_force_video_fmtp");
+	const char *append_audio = switch_channel_get_variable(tech_pvt->channel, "sip_append_audio_sdp");
 	char srbuf[128] = "";
 	const char *var_val;
 	const char *username = tech_pvt->profile->username;
@@ -141,12 +146,23 @@
 			ip = tech_pvt->proxy_sdp_audio_ip;
 		}
 	}
+
+	if (!ip) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "%s NO IP!\n", switch_channel_get_name(tech_pvt->channel));
+		return;
+	}
+
 	if (!port) {
 		if (!(port = tech_pvt->adv_sdp_audio_port)) {
 			port = tech_pvt->proxy_sdp_audio_port;
 		}
 	}
 
+	if (!port) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "%s NO PORT!\n", switch_channel_get_name(tech_pvt->channel));
+		return;
+	}
+
 	if (!sr) {
 		sr = "sendrecv";
 	}
@@ -161,12 +177,12 @@
 
 	tech_pvt->session_id++;
 
-	if ((tech_pvt->profile->ndlb & PFLAG_NDLB_SENDRECV_IN_SESSION) || 
-		((var_val=switch_channel_get_variable(tech_pvt->channel, "ndlb_sendrecv_in_session")) && switch_true(var_val))) {
+	if ((tech_pvt->profile->ndlb & PFLAG_NDLB_SENDRECV_IN_SESSION) ||
+		((var_val = switch_channel_get_variable(tech_pvt->channel, "ndlb_sendrecv_in_session")) && switch_true(var_val))) {
 		switch_snprintf(srbuf, sizeof(srbuf), "a=%s\n", sr);
 		sr = NULL;
 	}
-	
+
 	family = strchr(ip, ':') ? "IP6" : "IP4";
 	switch_snprintf(buf, sizeof(buf),
 					"v=0\n"
@@ -174,12 +190,10 @@
 					"s=%s\n"
 					"c=IN %s %s\n" "t=0 0\n"
 					"%sm=audio %d RTP/%sAVP",
-					username,
-					tech_pvt->owner_id, tech_pvt->session_id, family, ip, username, family, ip, 
-					srbuf,
-					port,
-					(!zstr(tech_pvt->local_crypto_key) 
-					&& sofia_test_flag(tech_pvt,TFLAG_SECURE)) ? "S" : "");
+					username, tech_pvt->owner_id, tech_pvt->session_id, family, ip, username, family, ip, srbuf, port, (!zstr(tech_pvt->local_crypto_key)
+																														&& sofia_test_flag(tech_pvt,
+																																		   TFLAG_SECURE)) ?
+					"S" : "");
 
 	if (tech_pvt->rm_encoding) {
 		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", tech_pvt->pt);
@@ -268,13 +282,17 @@
 		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=silenceSupp:off - - - -\n");
 	}
 
+	if (append_audio) {
+		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s%s", append_audio, end_of(append_audio) == '\n' ? "" : "\n");
+	}
+
 	if (ptime) {
 		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=ptime:%d\n", ptime);
 	}
 
 	if (sr) {
 		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=%s\n", sr);
-	} 
+	}
 
 	if (!zstr(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) {
 		switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=crypto:%s\n", tech_pvt->local_crypto_key);
@@ -318,7 +336,7 @@
 
 		if ((v_port = tech_pvt->adv_sdp_video_port)) {
 			switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "m=video %d RTP/AVP", v_port);
-			
+
 			/*****************************/
 			if (tech_pvt->video_rm_encoding) {
 				sofia_glue_tech_set_video_codec(tech_pvt, 0);
@@ -348,23 +366,28 @@
 			}
 
 			switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "\n");
-
+			
 			if (tech_pvt->video_rm_encoding) {
 				const char *of;
 				rate = tech_pvt->video_rm_rate;
 				switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d %s/%ld\n", tech_pvt->video_pt, tech_pvt->video_rm_encoding,
 								tech_pvt->video_rm_rate);
 
-				pass_fmtp = NULL;
+				if (sofia_test_flag(tech_pvt, TFLAG_RECOVERING)) {
+					pass_fmtp = tech_pvt->video_rm_fmtp;
+				} else {
 
-				if (switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE)) {
-					if ((of = switch_channel_get_variable_partner(tech_pvt->channel, "sip_video_fmtp"))) {
-						pass_fmtp = of;
+					pass_fmtp = NULL;
+
+					if (switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE)) {
+						if ((of = switch_channel_get_variable_partner(tech_pvt->channel, "sip_video_fmtp"))) {
+							pass_fmtp = of;
+						}
 					}
-				}
 
-				if (ov_fmtp) {
-					pass_fmtp = ov_fmtp;
+					if (ov_fmtp) {
+						pass_fmtp = ov_fmtp;
+					}
 				}
 
 				if (pass_fmtp) {
@@ -406,13 +429,14 @@
 			}
 		}
 	}
+
 	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;
@@ -422,7 +446,7 @@
 	}
 
 	codec_string = !zstr(preferred) ? preferred : fallback;
-	
+
 	return codec_string;
 }
 
@@ -463,9 +487,9 @@
 			}
 		}
 	}
-	
- ready:
 
+  ready:
+
 	if (codec_string) {
 		char *tmp_codec_string;
 		if ((tmp_codec_string = switch_core_session_strdup(tech_pvt->session, codec_string))) {
@@ -513,7 +537,7 @@
 	switch_mutex_lock(profile->flag_mutex);
 
 	/* copy flags from profile to the sofia private */
-	for(x = 0; x < TFLAG_MAX; x++ ) {
+	for (x = 0; x < TFLAG_MAX; x++) {
 		tech_pvt->flags[x] = profile->flags[x];
 	}
 
@@ -545,17 +569,20 @@
 	switch_channel_set_cap(tech_pvt->channel, CC_MEDIA_ACK);
 	switch_channel_set_cap(tech_pvt->channel, CC_BYPASS_MEDIA);
 	switch_channel_set_cap(tech_pvt->channel, CC_PROXY_MEDIA);
-	
+
 	switch_core_session_set_private(session, tech_pvt);
 
-	switch_snprintf(name, sizeof(name), "sofia/%s/%s", profile->name, channame);
-	if ((p = strchr(name, ';'))) {
-		*p = '\0';
+	if (channame) {
+		switch_snprintf(name, sizeof(name), "sofia/%s/%s", profile->name, channame);
+		if ((p = strchr(name, ';'))) {
+			*p = '\0';
+		}
+		switch_channel_set_name(tech_pvt->channel, name);
 	}
-	switch_channel_set_name(tech_pvt->channel, name);
 }
 
-switch_status_t sofia_glue_ext_address_lookup(sofia_profile_t *profile, private_object_t *tech_pvt, char **ip, switch_port_t *port, const char *sourceip, switch_memory_pool_t *pool)
+switch_status_t sofia_glue_ext_address_lookup(sofia_profile_t *profile, private_object_t *tech_pvt, char **ip, switch_port_t *port,
+											  const char *sourceip, switch_memory_pool_t *pool)
 {
 	char *error = "";
 	switch_status_t status = SWITCH_STATUS_FALSE;
@@ -580,7 +607,7 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Trying to use STUN but its disabled!\n");
 			goto out;
 		}
-		
+
 		stun_ip = strdup(sourceip + 5);
 
 		if ((p = strchr(stun_ip, ':'))) {
@@ -598,7 +625,7 @@
 		}
 
 		for (x = 0; x < 5; x++) {
-			if (sofia_test_pflag(profile, PFLAG_FUNNY_STUN) || 
+			if (sofia_test_pflag(profile, PFLAG_FUNNY_STUN) ||
 				(tech_pvt && (var = switch_channel_get_variable(tech_pvt->channel, "funny_stun")) && switch_true(var))) {
 				error = "funny";
 				funny++;
@@ -636,11 +663,11 @@
 			}
 		}
 	} else {
-		*ip = (char*)sourceip;
+		*ip = (char *) sourceip;
 		status = SWITCH_STATUS_SUCCESS;
 	}
 
- out:
+  out:
 
 	switch_safe_free(stun_ip);
 
@@ -687,23 +714,23 @@
 	}
 
 	tech_pvt->local_sdp_audio_ip = tech_pvt->profile->rtpip;
-	
+
 	sdp_port = tech_pvt->local_sdp_audio_port;
 
-	if (!(use_ip = switch_channel_get_variable(tech_pvt->channel, "rtp_adv_audio_ip")) 
+	if (!(use_ip = switch_channel_get_variable(tech_pvt->channel, "rtp_adv_audio_ip"))
 		&& !zstr(tech_pvt->profile->extrtpip)) {
-			use_ip = tech_pvt->profile->extrtpip;
+		use_ip = tech_pvt->profile->extrtpip;
 	}
 
 	if (use_ip) {
-		if (sofia_glue_ext_address_lookup(tech_pvt->profile, tech_pvt, &lookup_rtpip, &sdp_port, 
+		if (sofia_glue_ext_address_lookup(tech_pvt->profile, tech_pvt, &lookup_rtpip, &sdp_port,
 										  use_ip, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
 			/* Address lookup was required and fail (external ip was "host:..." or "stun:...") */
-			return SWITCH_STATUS_FALSE;	
+			return SWITCH_STATUS_FALSE;
 		} else {
 			if (lookup_rtpip == use_ip) {
 				/* sofia_glue_ext_address_lookup didn't return any error, but the return IP is the same as the original one, 
-				which means no lookup was necessary. Check if NAT is detected  */
+				   which means no lookup was necessary. Check if NAT is detected  */
 				if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
 					/* Yes, map the port through switch_nat */
 					switch_nat_add_mapping(tech_pvt->local_sdp_audio_port, SWITCH_NAT_UDP, &sdp_port, SWITCH_FALSE);
@@ -712,7 +739,7 @@
 					use_ip = tech_pvt->profile->rtpip;
 				}
 			} else {
-				/* Address properly resolved, use it as external ip */ 
+				/* Address properly resolved, use it as external ip */
 				use_ip = lookup_rtpip;
 			}
 		}
@@ -720,7 +747,7 @@
 		/* No NAT traversal required, use the profile's rtp ip */
 		use_ip = tech_pvt->profile->rtpip;
 	}
-	
+
 	tech_pvt->adv_sdp_audio_port = sdp_port;
 	tech_pvt->adv_sdp_audio_ip = tech_pvt->extrtpip = switch_core_session_strdup(tech_pvt->session, use_ip);
 
@@ -758,20 +785,20 @@
 
 	sdp_port = tech_pvt->local_sdp_video_port;
 
-	if (!(use_ip = switch_channel_get_variable(tech_pvt->channel, "rtp_adv_video_ip")) 
+	if (!(use_ip = switch_channel_get_variable(tech_pvt->channel, "rtp_adv_video_ip"))
 		&& !zstr(tech_pvt->profile->extrtpip)) {
-			use_ip = tech_pvt->profile->extrtpip;
+		use_ip = tech_pvt->profile->extrtpip;
 	}
 
 	if (use_ip) {
-		if (sofia_glue_ext_address_lookup(tech_pvt->profile, tech_pvt, &lookup_rtpip, &sdp_port, 
+		if (sofia_glue_ext_address_lookup(tech_pvt->profile, tech_pvt, &lookup_rtpip, &sdp_port,
 										  use_ip, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
 			/* Address lookup was required and fail (external ip was "host:..." or "stun:...") */
-			return SWITCH_STATUS_FALSE;	
+			return SWITCH_STATUS_FALSE;
 		} else {
 			if (lookup_rtpip == use_ip) {
 				/* sofia_glue_ext_address_lookup didn't return any error, but the return IP is the same as the original one, 
-				which means no lookup was necessary. Check if NAT is detected  */
+				   which means no lookup was necessary. Check if NAT is detected  */
 				if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
 					/* Yes, map the port through switch_nat */
 					switch_nat_add_mapping(tech_pvt->local_sdp_video_port, SWITCH_NAT_UDP, &sdp_port, SWITCH_FALSE);
@@ -780,7 +807,7 @@
 					use_ip = tech_pvt->profile->rtpip;
 				}
 			} else {
-				/* Address properly resolved, use it as external ip */ 
+				/* Address properly resolved, use it as external ip */
 				use_ip = lookup_rtpip;
 			}
 		}
@@ -788,7 +815,7 @@
 		/* No NAT traversal required, use the profile's rtp ip */
 		use_ip = tech_pvt->profile->rtpip;
 	}
-	
+
 	tech_pvt->adv_sdp_video_port = sdp_port;
 	switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_VIDEO_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip);
 	switch_channel_set_variable_printf(tech_pvt->channel, SWITCH_LOCAL_VIDEO_PORT_VARIABLE, "%d", sdp_port);
@@ -887,22 +914,19 @@
 	}
 }
 
-char *sofia_glue_create_external_via(switch_core_session_t *session, sofia_profile_t *profile, sofia_transport_t transport) 
+char *sofia_glue_create_external_via(switch_core_session_t *session, sofia_profile_t *profile, sofia_transport_t transport)
 {
-	return sofia_glue_create_via(session,
-								 profile->extsipip,
-								 (sofia_glue_transport_has_tls(transport))
-								 ? profile->tls_sip_port : profile->sip_port,
-								 transport);
+	return sofia_glue_create_via(session, profile->extsipip, (sofia_glue_transport_has_tls(transport))
+								 ? profile->tls_sip_port : profile->sip_port, transport);
 }
 
-char *sofia_glue_create_via(switch_core_session_t *session, const char *ip, switch_port_t port, sofia_transport_t transport) 
+char *sofia_glue_create_via(switch_core_session_t *session, const char *ip, switch_port_t port, sofia_transport_t transport)
 {
 	if (port && port != 5060) {
 		if (session) {
-			return switch_core_session_sprintf(session, "SIP/2.0/%s %s:%d;rport", sofia_glue_transport2str(transport), ip, port);		
+			return switch_core_session_sprintf(session, "SIP/2.0/%s %s:%d;rport", sofia_glue_transport2str(transport), ip, port);
 		} else {
-			return switch_mprintf("SIP/2.0/%s %s:%d;rport", sofia_glue_transport2str(transport), ip, port);		
+			return switch_mprintf("SIP/2.0/%s %s:%d;rport", sofia_glue_transport2str(transport), ip, port);
 		}
 	} else {
 		if (session) {
@@ -933,10 +957,7 @@
 
 int sofia_glue_check_nat(sofia_profile_t *profile, const char *network_ip)
 {
-	return (network_ip && 
-			profile->local_network && 
-			sofia_test_pflag(profile, PFLAG_AUTO_NAT) && 
-			!switch_check_network_list_ip(network_ip, profile->local_network));
+	return (profile->extsipip && !switch_check_network_list_ip(network_ip, profile->local_network));
 }
 
 int sofia_glue_transport_has_tls(const sofia_transport_t tp)
@@ -950,7 +971,8 @@
 	}
 }
 
-void sofia_glue_get_addr(msg_t *msg, char *buf, size_t buflen, int *port) {
+void sofia_glue_get_addr(msg_t *msg, char *buf, size_t buflen, int *port)
+{
 	su_addrinfo_t *addrinfo = msg_addrinfo(msg);
 
 	if (buf) {
@@ -958,7 +980,7 @@
 	}
 
 	if (port) {
-		*port = get_port(addrinfo->ai_addr); 
+		*port = get_port(addrinfo->ai_addr);
 	}
 }
 
@@ -972,8 +994,8 @@
 	stripped = sofia_glue_get_url_from_contact(stripped, 0);
 
 	/* remove our params so we don't make any whiny moronic device piss it's pants and forget who it is for a half-hour */
-	if ((p = (char *)switch_stristr(";fs_", stripped))) {
-		*p = '\0'; 
+	if ((p = (char *) switch_stristr(";fs_", stripped))) {
+		*p = '\0';
 	}
 
 	if (transport && transport != SOFIA_TRANSPORT_UDP) {
@@ -1025,13 +1047,12 @@
 	char *p, *ip_ptr = NULL, *port_ptr = NULL, *vid_port_ptr = NULL, *pe;
 	int x;
 	const char *val;
-	
+
 	if (zstr(tech_pvt->remote_sdp_str)) {
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if ((p = (char *) switch_stristr("c=IN IP4 ", tech_pvt->remote_sdp_str)) ||
-		(p = (char *) switch_stristr("c=IN IP6 ", tech_pvt->remote_sdp_str))) {
+	if ((p = (char *) switch_stristr("c=IN IP4 ", tech_pvt->remote_sdp_str)) || (p = (char *) switch_stristr("c=IN IP6 ", tech_pvt->remote_sdp_str))) {
 		ip_ptr = p + 9;
 	}
 
@@ -1089,7 +1110,7 @@
 
 	tech_pvt->remote_sdp_audio_ip = switch_core_session_strdup(tech_pvt->session, rip);
 	tech_pvt->remote_sdp_audio_port = (switch_port_t) atoi(rp);
-	
+
 	if (*rvp) {
 		tech_pvt->remote_sdp_video_ip = switch_core_session_strdup(tech_pvt->session, rip);
 		tech_pvt->remote_sdp_video_port = (switch_port_t) atoi(rvp);
@@ -1103,9 +1124,8 @@
 			sofia_set_flag_locked(tech_pvt, TFLAG_VIDEO);
 			switch_channel_set_flag(tech_pvt->channel, CF_VIDEO);
 			if (switch_rtp_ready(tech_pvt->video_rtp_session)) {
-				if (switch_rtp_set_remote_address(tech_pvt->video_rtp_session, tech_pvt->remote_sdp_video_ip, 
-												  tech_pvt->remote_sdp_video_port, SWITCH_TRUE, &err) !=
-					SWITCH_STATUS_SUCCESS) {
+				if (switch_rtp_set_remote_address(tech_pvt->video_rtp_session, tech_pvt->remote_sdp_video_ip,
+												  tech_pvt->remote_sdp_video_port, SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) {
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "VIDEO RTP REPORTS ERROR: [%s]\n", err);
 				} else {
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "VIDEO RTP CHANGING DEST TO: [%s:%d]\n",
@@ -1126,14 +1146,14 @@
 	if (switch_rtp_ready(tech_pvt->rtp_session)) {
 		char *remote_host = switch_rtp_get_remote_host(tech_pvt->rtp_session);
 		switch_port_t remote_port = switch_rtp_get_remote_port(tech_pvt->rtp_session);
-		
+
 		if (remote_host && remote_port && !strcmp(remote_host, tech_pvt->remote_sdp_audio_ip) && remote_port == tech_pvt->remote_sdp_audio_port) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Remote address:port [%s:%d] has not changed.\n",
 							  tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port);
 			return SWITCH_STATUS_SUCCESS;
 		}
-		
-		if (switch_rtp_set_remote_address(tech_pvt->rtp_session, tech_pvt->remote_sdp_audio_ip, 
+
+		if (switch_rtp_set_remote_address(tech_pvt->rtp_session, tech_pvt->remote_sdp_audio_ip,
 										  tech_pvt->remote_sdp_audio_port, SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "AUDIO RTP REPORTS ERROR: [%s]\n", err);
 		} else {
@@ -1142,7 +1162,7 @@
 			if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) &&
 				!((val = switch_channel_get_variable(tech_pvt->channel, "disable_rtp_auto_adjust")) && switch_true(val))) {
 				/* Reactivate the NAT buster flag. */
-				switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);	
+				switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
 			}
 			if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTOFIX_TIMING)) {
 				tech_pvt->check_frames = 0;
@@ -1157,8 +1177,8 @@
 void sofia_glue_tech_patch_sdp(private_object_t *tech_pvt)
 {
 	switch_size_t len;
-	char *p, *q, *pe , *qe;
-	int has_video=0,has_audio=0,has_ip=0;
+	char *p, *q, *pe, *qe;
+	int has_video = 0, has_audio = 0, has_ip = 0;
 	char port_buf[25] = "";
 	char vport_buf[25] = "";
 	char *new_sdp;
@@ -1169,51 +1189,52 @@
 	}
 
 	len = strlen(tech_pvt->local_sdp_str) * 2;
-	
-	if (switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED) && 
+
+	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;
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Skip patch on hold SDP\n");
+		return;
 	}
-	
+
 	if (zstr(tech_pvt->adv_sdp_audio_ip) || !tech_pvt->adv_sdp_audio_port) {
-	    if (sofia_glue_tech_choose_port(tech_pvt, 1) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "%s I/O Error\n", switch_channel_get_name(tech_pvt->channel));
+		if (sofia_glue_tech_choose_port(tech_pvt, 1) != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "%s I/O Error\n",
+							  switch_channel_get_name(tech_pvt->channel));
 			return;
 		}
 		tech_pvt->iananame = switch_core_session_strdup(tech_pvt->session, "PROXY");
 		tech_pvt->rm_rate = 8000;
 		tech_pvt->codec_ms = 20;
 	}
-	
+
 	new_sdp = switch_core_session_alloc(tech_pvt->session, len);
 	switch_snprintf(port_buf, sizeof(port_buf), "%u", tech_pvt->adv_sdp_audio_port);
-	
 
+
 	p = tech_pvt->local_sdp_str;
 	q = new_sdp;
 	pe = p + strlen(p);
 	qe = q + len - 1;
 
-	while(p && *p) {
+	while (p && *p) {
 		if (p >= pe) {
 			bad = 1;
 			goto end;
 		}
-		
+
 		if (q >= qe) {
 			bad = 2;
 			goto end;
 		}
 
-	    if (tech_pvt->adv_sdp_audio_ip && !strncmp("c=IN IP", p, 7)) {
+		if (tech_pvt->adv_sdp_audio_ip && !strncmp("c=IN IP", p, 7)) {
 			strncpy(q, p, 9);
 			p += 9;
 			q += 9;
 			strncpy(q, tech_pvt->adv_sdp_audio_ip, strlen(tech_pvt->adv_sdp_audio_ip));
 			q += strlen(tech_pvt->adv_sdp_audio_ip);
 
-			while(p && *p && ((*p >= '0' && *p <= '9') || *p == '.' || *p == ':' || (*p >= 'A' && *p <= 'F') || (*p >= 'a' && *p <= 'f'))) {
+			while (p && *p && ((*p >= '0' && *p <= '9') || *p == '.' || *p == ':' || (*p >= 'A' && *p <= 'F') || (*p >= 'a' && *p <= 'f'))) {
 				if (p >= pe) {
 					bad = 3;
 					goto end;
@@ -1221,7 +1242,7 @@
 				p++;
 			}
 
-	    	has_ip++;
+			has_ip++;
 
 		} else if (!strncmp("m=audio ", p, 8) || (!strncmp("m=image ", p, 8))) {
 			strncpy(q, p, 8);
@@ -1234,7 +1255,7 @@
 
 
 			q += 8;
-			
+
 			if (q >= qe) {
 				bad = 5;
 				goto end;
@@ -1257,9 +1278,9 @@
 				p++;
 			}
 
-			has_audio++;		
+			has_audio++;
 
-	    } else if (!strncmp("m=video ", p, 8)) {
+		} else if (!strncmp("m=video ", p, 8)) {
 			if (!has_video) {
 				sofia_glue_tech_choose_video_port(tech_pvt, 1);
 				tech_pvt->video_rm_encoding = "PROXY-VID";
@@ -1300,12 +1321,12 @@
 
 				p++;
 			}
-			
+
 			has_video++;
-	    }
-	    
-	    while (p && *p && *p != '\n') {
+		}
 
+		while (p && *p && *p != '\n') {
+
 			if (p >= pe) {
 				bad = 12;
 				goto end;
@@ -1317,23 +1338,23 @@
 			}
 
 			*q++ = *p++;
-	    }
-		
+		}
+
 		if (p >= pe) {
-            bad = 14;
-            goto end;
-        }
-		
+			bad = 14;
+			goto end;
+		}
+
 		if (q >= qe) {
 			bad = 15;
 			goto end;
 		}
 
-	    *q++ = *p++;
+		*q++ = *p++;
 
 	}
 
- end:
+  end:
 
 	if (bad) {
 		return;
@@ -1351,8 +1372,8 @@
 						  switch_channel_get_name(tech_pvt->channel), tech_pvt->local_sdp_str);
 		return;
 	}
-	
 
+
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "%s Patched SDP\n---\n%s\n+++\n%s\n",
 					  switch_channel_get_name(tech_pvt->channel), tech_pvt->local_sdp_str, new_sdp);
 
@@ -1364,33 +1385,34 @@
 void sofia_glue_tech_set_local_sdp(private_object_t *tech_pvt, const char *sdp_str, switch_bool_t dup)
 {
 	switch_mutex_lock(tech_pvt->sofia_mutex);
-	tech_pvt->local_sdp_str = dup ? switch_core_session_strdup(tech_pvt->session, sdp_str) : (char *)sdp_str;
-	switch_mutex_unlock(tech_pvt->sofia_mutex);	
+	tech_pvt->local_sdp_str = dup ? switch_core_session_strdup(tech_pvt->session, sdp_str) : (char *) sdp_str;
+	switch_channel_set_variable(tech_pvt->channel, "sip_local_sdp_str", tech_pvt->local_sdp_str);
+	switch_mutex_unlock(tech_pvt->sofia_mutex);
 }
 
-char* sofia_glue_get_extra_headers(switch_channel_t *channel, const char *prefix) 
+char *sofia_glue_get_extra_headers(switch_channel_t *channel, const char *prefix)
 {
 	char *extra_headers = NULL;
 	switch_stream_handle_t stream = { 0 };
-    switch_event_header_t *hi = NULL;
+	switch_event_header_t *hi = NULL;
 
-    SWITCH_STANDARD_STREAM(stream);
-    if ((hi = switch_channel_variable_first(channel))) {
-        for (; hi; hi = hi->next) {
-            const char *name = (char *) hi->name;
-            char *value = (char *) hi->value;
+	SWITCH_STANDARD_STREAM(stream);
+	if ((hi = switch_channel_variable_first(channel))) {
+		for (; hi; hi = hi->next) {
+			const char *name = (char *) hi->name;
+			char *value = (char *) hi->value;
 
-            if (!strncasecmp(name, prefix, strlen(prefix))) {
-                const char *hname = name + strlen(prefix);
-                stream.write_function(&stream, "%s: %s\r\n", hname, value);
-            }
-        }
-        switch_channel_variable_last(channel);
-    }
+			if (!strncasecmp(name, prefix, strlen(prefix))) {
+				const char *hname = name + strlen(prefix);
+				stream.write_function(&stream, "%s: %s\r\n", hname, value);
+			}
+		}
+		switch_channel_variable_last(channel);
+	}
 
-    if (!zstr((char*)stream.data)) {
-        extra_headers = stream.data;
-    } else {
+	if (!zstr((char *) stream.data)) {
+		extra_headers = stream.data;
+	} else {
 		switch_safe_free(stream.data);
 	}
 
@@ -1401,7 +1423,7 @@
 {
 	sip_unknown_t *un;
 	char name[512] = "";
-	
+
 	if (!sip || !channel) {
 		return;
 	}
@@ -1438,7 +1460,15 @@
 	char *route_uri = NULL;
 	sofia_destination_t *dst = NULL;
 	sofia_cid_type_t cid_type = tech_pvt->profile->cid_type;
+	sip_cseq_t *cseq = NULL;
+	const char *invite_full_via = switch_channel_get_variable(tech_pvt->channel, "sip_invite_full_via");
+	const char *invite_route_uri = switch_channel_get_variable(tech_pvt->channel, "sip_invite_route_uri");
+	const char *invite_full_from = switch_channel_get_variable(tech_pvt->channel, "sip_invite_full_from");
+	const char *invite_full_to = switch_channel_get_variable(tech_pvt->channel, "sip_invite_full_to");
+	const char *handle_full_from = switch_channel_get_variable(tech_pvt->channel, "sip_handle_full_from");
+	const char *handle_full_to = switch_channel_get_variable(tech_pvt->channel, "sip_handle_full_to");
 
+
 	rep = switch_channel_get_variable(channel, SOFIA_REPLACES_HEADER);
 
 	switch_assert(tech_pvt != NULL);
@@ -1454,32 +1484,7 @@
 	check_decode(cid_name, session);
 	check_decode(cid_num, session);
 
-	if (!tech_pvt->from_str) {
-		const char* sipip;
-		const char* format;
-		const char *alt = NULL;
 
-		if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
-			sipip = tech_pvt->profile->extsipip;
-		} else {
-			sipip = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip;
-		}
-
-		format = strchr(sipip, ':') ? "\"%s\" <sip:%s%s[%s]>" : "\"%s\" <sip:%s%s%s>";
-
-		if ((alt = switch_channel_get_variable(channel, "sip_invite_domain"))) {
-			sipip = alt;
-		}
-			
-		tech_pvt->from_str = 
-			switch_core_session_sprintf(tech_pvt->session,
-										format,
-										cid_name,
-										cid_num,
-										!zstr(cid_num) ? "@" : "",
-										sipip);
-	}
-
 	if ((alertbuf = switch_channel_get_variable(channel, "alert_info"))) {
 		alert_info = switch_core_session_sprintf(tech_pvt->session, "Alert-Info: %s", alertbuf);
 	}
@@ -1487,6 +1492,7 @@
 	max_forwards = switch_channel_get_variable(channel, SWITCH_MAX_FORWARDS_VARIABLE);
 
 	if ((status = sofia_glue_tech_choose_port(tech_pvt, 0)) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Port Error!\n");
 		return status;
 	}
 
@@ -1495,9 +1501,9 @@
 	sofia_set_flag_locked(tech_pvt, TFLAG_READY);
 
 	if (!tech_pvt->nh) {
-		char *d_url = NULL, *url = NULL;
+		char *d_url = NULL, *url = NULL, *url_str = NULL;
 		sofia_private_t *sofia_private;
-		char *invite_contact = NULL, *to_str, *use_from_str, *from_str, *url_str;
+		char *invite_contact = NULL, *to_str, *use_from_str, *from_str;
 		const char *t_var;
 		char *rpid_domain = "cluecon.com", *p;
 		const char *priv = "off";
@@ -1505,11 +1511,14 @@
 		const char *invite_params = switch_channel_get_variable(tech_pvt->channel, "sip_invite_params");
 		const char *invite_to_params = switch_channel_get_variable(tech_pvt->channel, "sip_invite_to_params");
 		const char *invite_to_uri = switch_channel_get_variable(tech_pvt->channel, "sip_invite_to_uri");
+		const char *invite_from_uri = switch_channel_get_variable(tech_pvt->channel, "sip_invite_from_uri");
 		const char *invite_contact_params = switch_channel_get_variable(tech_pvt->channel, "sip_invite_contact_params");
 		const char *invite_from_params = switch_channel_get_variable(tech_pvt->channel, "sip_invite_from_params");
 		const char *from_var = switch_channel_get_variable(tech_pvt->channel, "sip_from_uri");
 		const char *from_display = switch_channel_get_variable(tech_pvt->channel, "sip_from_display");
-		
+		const char *invite_req_uri = switch_channel_get_variable(tech_pvt->channel, "sip_invite_req_uri");
+		const char *use_name, *use_number;
+
 		if (zstr(tech_pvt->dest)) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "URL Error!\n");
 			return SWITCH_STATUS_FALSE;
@@ -1523,6 +1532,26 @@
 
 		url_str = url;
 
+		if (!tech_pvt->from_str) {
+			const char *sipip;
+			const char *format;
+			const char *alt = NULL;
+
+			sipip = tech_pvt->profile->sipip;
+
+			if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+				sipip = tech_pvt->profile->extsipip;
+			}
+
+			format = strchr(sipip, ':') ? "\"%s\" <sip:%s%s[%s]>" : "\"%s\" <sip:%s%s%s>";
+
+			if ((alt = switch_channel_get_variable(channel, "sip_invite_domain"))) {
+				sipip = alt;
+			}
+
+			tech_pvt->from_str = switch_core_session_sprintf(tech_pvt->session, format, cid_name, cid_num, !zstr(cid_num) ? "@" : "", sipip);
+		}
+
 		if (from_var) {
 			if (strncasecmp(from_var, "sip:", 4) || strncasecmp(from_var, "sips:", 5)) {
 				use_from_str = switch_core_session_strdup(tech_pvt->session, from_var);
@@ -1539,7 +1568,7 @@
 			rpid_domain = switch_core_session_strdup(session, tech_pvt->gateway_from_str);
 		} else if (!zstr(tech_pvt->from_str)) {
 			rpid_domain = switch_core_session_strdup(session, tech_pvt->from_str);
-		} 
+		}
 
 		sofia_glue_get_url_from_contact(rpid_domain, 0);
 		if ((rpid_domain = strrchr(rpid_domain, '@'))) {
@@ -1553,6 +1582,14 @@
 			rpid_domain = "cluecon.com";
 		}
 
+		if (sofia_test_pflag(tech_pvt->profile, PFLAG_AUTO_NAT)) {
+			if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+				rpid_domain = tech_pvt->profile->extsipip;
+			} else {
+				rpid_domain = tech_pvt->profile->sipip;
+			}
+		}
+
 		/*
 		 * Ignore transport chanvar and uri parameter for gateway connections
 		 * since all of them have been already taken care of in mod_sofia.c:sofia_outgoing_channel()
@@ -1582,33 +1619,32 @@
 		}
 
 		if (zstr(tech_pvt->invite_contact)) {
-			const char * contact;
+			const char *contact;
 			if ((contact = switch_channel_get_variable(channel, "sip_contact_user"))) {
 				char *ip_addr;
 				char *ipv6;
-				
-				if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { 
-					ip_addr = (switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network)) 
+
+				if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+					ip_addr = (switch_check_network_list_ip(tech_pvt->remote_ip, tech_pvt->profile->local_network))
 						? tech_pvt->profile->sipip : tech_pvt->profile->extsipip;
 				} else {
 					ip_addr = tech_pvt->profile->extsipip ? tech_pvt->profile->extsipip : tech_pvt->profile->sipip;
 				}
-				
+
 				ipv6 = strchr(ip_addr, ':');
 
 				if (sofia_glue_transport_has_tls(tech_pvt->transport)) {
-					tech_pvt->invite_contact = switch_core_session_sprintf(session, "sip:%s@%s%s%s:%d", contact, 
-																		   ipv6 ? "[" : "", ip_addr, ipv6 ? "]" : "", 
-																		   tech_pvt->profile->tls_sip_port);
+					tech_pvt->invite_contact = switch_core_session_sprintf(session, "sip:%s@%s%s%s:%d", contact,
+																		   ipv6 ? "[" : "", ip_addr, ipv6 ? "]" : "", tech_pvt->profile->tls_sip_port);
 				} else {
-					tech_pvt->invite_contact = switch_core_session_sprintf(session, "sip:%s@%s%s%s:%d", contact, 
+					tech_pvt->invite_contact = switch_core_session_sprintf(session, "sip:%s@%s%s%s:%d", contact,
 																		   ipv6 ? "[" : "", ip_addr, ipv6 ? "]" : "", tech_pvt->profile->sip_port);
 				}
 			} else {
 				if (sofia_glue_transport_has_tls(tech_pvt->transport)) {
 					tech_pvt->invite_contact = tech_pvt->profile->tls_url;
 				} else {
-					if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { 
+					if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
 						tech_pvt->invite_contact = tech_pvt->profile->public_url;
 					} else {
 						tech_pvt->invite_contact = tech_pvt->profile->url;
@@ -1619,37 +1655,68 @@
 
 		url_str = sofia_overcome_sip_uri_weakness(session, url, tech_pvt->transport, SWITCH_TRUE, invite_params);
 		invite_contact = sofia_overcome_sip_uri_weakness(session, tech_pvt->invite_contact, tech_pvt->transport, SWITCH_FALSE, invite_contact_params);
-		from_str = sofia_overcome_sip_uri_weakness(session, use_from_str, 0, SWITCH_TRUE, invite_from_params);
+		from_str = sofia_overcome_sip_uri_weakness(session, invite_from_uri ? invite_from_uri : use_from_str, 0, SWITCH_TRUE, invite_from_params);
 		to_str = sofia_overcome_sip_uri_weakness(session, invite_to_uri ? invite_to_uri : tech_pvt->dest_to, 0, SWITCH_FALSE, invite_to_params);
 
+		switch_channel_set_variable(channel, "sip_outgoing_contact_uri", invite_contact);
 
+
 		/*
 		   Does the "genius" who wanted SIP to be "text-based" so it was "easier to read" even use it now,
 		   or did he just suggest it to make our lives miserable?
 		 */
 		use_from_str = from_str;
+
+		if (!switch_stristr("sip:", use_from_str)) {
+			use_from_str = switch_core_session_sprintf(session, "sip:%s", use_from_str);
+		}
+
 		if (!from_display && !strcasecmp(tech_pvt->caller_profile->caller_id_name, "_undef_")) {
 			from_str = switch_core_session_sprintf(session, "<%s>", use_from_str);
 		} else {
-			from_str = switch_core_session_sprintf(session, "\"%s\" <%s>", from_display ? from_display : 
+			from_str = switch_core_session_sprintf(session, "\"%s\" <%s>", from_display ? from_display :
 												   tech_pvt->caller_profile->caller_id_name, use_from_str);
 		}
-		
-		if (!(call_id = switch_channel_get_variable(channel, "sip_outgoing_call_id"))) {
+
+		if (!(call_id = switch_channel_get_variable(channel, "sip_invite_call_id"))) {
 			if (sofia_test_pflag(tech_pvt->profile, PFLAG_UUID_AS_CALLID)) {
 				call_id = switch_core_session_get_uuid(session);
 			}
 		}
-		
+
+		if (handle_full_from) {
+			from_str = (char *) handle_full_from;
+		}
+
+		if (handle_full_to) {
+			to_str = (char *) handle_full_to;
+		}
+
+
+		if (invite_req_uri) {
+			url_str = (char *) invite_req_uri;
+		}
+
+		if (url_str) {
+			char *s = NULL;
+			if (!strncasecmp(url_str, "sip:", 4)) {
+				s = url_str + 4;
+			}
+			if (!strncasecmp(url_str, "sips:", 5)) {
+				s = url_str + 5;
+			}
+			if (!s) {
+				s = url_str;
+			}
+			switch_channel_set_variable(channel, "sip_req_uri", s);
+		}
+
 		tech_pvt->nh = nua_handle(tech_pvt->profile->nua, NULL,
 								  NUTAG_URL(url_str),
 								  TAG_IF(call_id, SIPTAG_CALL_ID_STR(call_id)),
-								  SIPTAG_TO_STR(to_str), 
-								  SIPTAG_FROM_STR(from_str),
-								  SIPTAG_CONTACT_STR(invite_contact),
-								  TAG_END());
+								  SIPTAG_TO_STR(to_str), SIPTAG_FROM_STR(from_str), SIPTAG_CONTACT_STR(invite_contact), TAG_END());
 
-		if (tech_pvt->dest && (strstr(tech_pvt->dest, ";fs_nat") || strstr(tech_pvt->dest, ";received") 
+		if (tech_pvt->dest && (strstr(tech_pvt->dest, ";fs_nat") || strstr(tech_pvt->dest, ";received")
 							   || ((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val)))) {
 			sofia_set_flag(tech_pvt, TFLAG_NAT);
 			tech_pvt->record_route = switch_core_session_strdup(tech_pvt->session, url_str);
@@ -1657,27 +1724,49 @@
 			session_timeout = SOFIA_NAT_SESSION_TIMEOUT;
 			switch_channel_set_variable(channel, "sip_nat_detected", "true");
 		}
-		
+
 		if ((val = switch_channel_get_variable(channel, "sip_cid_type"))) {
 			cid_type = sofia_cid_name2type(val);
 		} else {
 			cid_type = tech_pvt->cid_type;
 		}
 
+		if (sofia_test_flag(tech_pvt, TFLAG_RECOVERING) && switch_channel_direction(tech_pvt->channel) == SWITCH_CALL_DIRECTION_INBOUND) {
+			if (zstr((use_name = switch_channel_get_variable(tech_pvt->channel, "effective_callee_id_name"))) &&
+				zstr((use_name = switch_channel_get_variable(tech_pvt->channel, "sip_callee_id_name")))) {
+				if (!(use_name = switch_channel_get_variable(tech_pvt->channel, "sip_to_display"))) {
+					use_name = switch_channel_get_variable(tech_pvt->channel, "sip_to_user");
+				}
+			}
+
+			if (zstr((use_number = switch_channel_get_variable(tech_pvt->channel, "effective_callee_id_number"))) &&
+				zstr((use_number = switch_channel_get_variable(tech_pvt->channel, "sip_callee_id_number")))) {
+				use_number = switch_channel_get_variable(tech_pvt->channel, "sip_to_user");
+			}
+
+			if (zstr(use_name) && zstr(use_name = tech_pvt->caller_profile->callee_id_name)) {
+				use_name = tech_pvt->caller_profile->caller_id_name;
+			}
+
+			if (zstr(use_number) && zstr(use_number = tech_pvt->caller_profile->callee_id_number)) {
+				use_number = tech_pvt->caller_profile->caller_id_number;
+			}
+		} else {
+			use_name = tech_pvt->caller_profile->caller_id_name;
+			use_number = tech_pvt->caller_profile->caller_id_number;
+		}
+
+
 		switch (cid_type) {
 		case CID_TYPE_PID:
 			if (switch_test_flag(caller_profile, SWITCH_CPF_SCREEN)) {
-				tech_pvt->asserted_id = switch_core_session_sprintf(tech_pvt->session, "\"%s\"<sip:%s@%s>",
-																	tech_pvt->caller_profile->caller_id_name,
-																	tech_pvt->caller_profile->caller_id_number, 
-																	rpid_domain);
+				tech_pvt->asserted_id = switch_core_session_sprintf(tech_pvt->session, "\"%s\"<sip:%s@%s>", use_name, use_number, rpid_domain);
 			} else {
 				tech_pvt->preferred_id = switch_core_session_sprintf(tech_pvt->session, "\"%s\"<sip:%s@%s>",
 																	 tech_pvt->caller_profile->caller_id_name,
-																	 tech_pvt->caller_profile->caller_id_number, 
-																	 rpid_domain);
+																	 tech_pvt->caller_profile->caller_id_number, rpid_domain);
 			}
-			
+
 			if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER)) {
 				tech_pvt->privacy = "id";
 			} else {
@@ -1695,18 +1784,17 @@
 				} else if (switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER)) {
 					priv = "full";
 				}
-				
+
 				if (switch_test_flag(caller_profile, SWITCH_CPF_SCREEN)) {
 					screen = "yes";
 				}
-				
-				if (!strcasecmp(tech_pvt->caller_profile->caller_id_name, "_undef_")) {
+
+				if (zstr(tech_pvt->caller_profile->caller_id_name) || !strcasecmp(tech_pvt->caller_profile->caller_id_name, "_undef_")) {
 					tech_pvt->rpid = switch_core_session_sprintf(tech_pvt->session, "<sip:%s@%s>;party=calling;screen=%s;privacy=%s",
-																 tech_pvt->caller_profile->caller_id_number, rpid_domain, screen, priv);
+																 use_number, rpid_domain, screen, priv);
 				} else {
 					tech_pvt->rpid = switch_core_session_sprintf(tech_pvt->session, "\"%s\"<sip:%s@%s>;party=calling;screen=%s;privacy=%s",
-																 tech_pvt->caller_profile->caller_id_name,
-																 tech_pvt->caller_profile->caller_id_number, rpid_domain, screen, priv);
+																 use_name, use_number, rpid_domain, screen, priv);
 				}
 			}
 			break;
@@ -1782,7 +1870,7 @@
 		if (dst->route_uri) {
 			route_uri = sofia_overcome_sip_uri_weakness(tech_pvt->session, dst->route_uri, tech_pvt->transport, SWITCH_TRUE, NULL);
 		}
-	
+
 		if (dst->route) {
 			route = dst->route;
 		}
@@ -1792,34 +1880,81 @@
 		route_uri = switch_core_session_strdup(session, val);
 		route = NULL;
 	}
-	
+
 	if (route_uri) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "%s Setting proxy route to %s\n", route_uri, switch_channel_get_name(channel));
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "%s Setting proxy route to %s\n", route_uri,
+						  switch_channel_get_name(channel));
 		tech_pvt->route_uri = switch_core_session_strdup(tech_pvt->session, route_uri);
 	}
 
-	nua_invite(tech_pvt->nh,
-			   NUTAG_AUTOANSWER(0),
-			   NUTAG_SESSION_TIMER(session_timeout),
-			   TAG_IF(tech_pvt->redirected, NUTAG_URL(tech_pvt->redirected)),
-			   TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
-			   TAG_IF(!zstr(tech_pvt->rpid), SIPTAG_REMOTE_PARTY_ID_STR(tech_pvt->rpid)),
-			   TAG_IF(!zstr(tech_pvt->preferred_id), SIPTAG_P_PREFERRED_IDENTITY_STR(tech_pvt->preferred_id)),
-			   TAG_IF(!zstr(tech_pvt->asserted_id), SIPTAG_P_ASSERTED_IDENTITY_STR(tech_pvt->asserted_id)),
-			   TAG_IF(!zstr(tech_pvt->privacy), SIPTAG_PRIVACY_STR(tech_pvt->privacy)),
-			   TAG_IF(!zstr(alert_info), SIPTAG_HEADER_STR(alert_info)),
-			   TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
-			   TAG_IF(sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_CALLEE_ID), SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT)),
-			   TAG_IF(!zstr(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)),
-			   TAG_IF(!zstr(route_uri), NUTAG_PROXY(route_uri)),
-			   TAG_IF(!zstr(route), SIPTAG_ROUTE_STR(route)),
-			   SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip),
-			   SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
-			   SOATAG_REUSE_REJECTED(1),
-			   SOATAG_ORDERED_USER(1),
-			   SOATAG_RTP_SORT(SOA_RTP_SORT_REMOTE),
-			   SOATAG_RTP_SELECT(SOA_RTP_SELECT_ALL), TAG_IF(rep, SIPTAG_REPLACES_STR(rep)), SOATAG_HOLD(holdstr), TAG_END());
 
+	if ((val = switch_channel_get_variable(tech_pvt->channel, "sip_invite_cseq"))) {
+		uint32_t callsequence = (uint32_t) strtoul(val, NULL, 10);
+		cseq = sip_cseq_create(tech_pvt->nh->nh_home, callsequence, SIP_METHOD_INVITE);
+	}
+
+
+	switch_channel_clear_flag(channel, CF_MEDIA_ACK);
+
+	if (handle_full_from) {
+		tech_pvt->nh->nh_has_invite = 1;
+	}
+
+	if (sofia_use_soa(tech_pvt)) {
+		nua_invite(tech_pvt->nh,
+				   NUTAG_AUTOANSWER(0),
+				   NUTAG_SESSION_TIMER(session_timeout),
+				   TAG_IF(invite_full_from, SIPTAG_FROM_STR(invite_full_from)),
+				   TAG_IF(invite_full_to, SIPTAG_TO_STR(invite_full_to)),
+				   TAG_IF(tech_pvt->redirected, NUTAG_URL(tech_pvt->redirected)),
+				   TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
+				   TAG_IF(!zstr(invite_full_via), SIPTAG_VIA_STR(invite_full_via)),
+				   TAG_IF(!zstr(tech_pvt->rpid), SIPTAG_REMOTE_PARTY_ID_STR(tech_pvt->rpid)),
+				   TAG_IF(!zstr(tech_pvt->preferred_id), SIPTAG_P_PREFERRED_IDENTITY_STR(tech_pvt->preferred_id)),
+				   TAG_IF(!zstr(tech_pvt->asserted_id), SIPTAG_P_ASSERTED_IDENTITY_STR(tech_pvt->asserted_id)),
+				   TAG_IF(!zstr(tech_pvt->privacy), SIPTAG_PRIVACY_STR(tech_pvt->privacy)),
+				   TAG_IF(!zstr(alert_info), SIPTAG_HEADER_STR(alert_info)),
+				   TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+				   TAG_IF(sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_CALLEE_ID), SIPTAG_HEADER_STR("X-FS-Support: " FREESWITCH_SUPPORT)),
+				   TAG_IF(!zstr(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)),
+				   TAG_IF(!zstr(route_uri), NUTAG_PROXY(route_uri)),
+				   TAG_IF(!zstr(invite_route_uri), NUTAG_INITIAL_ROUTE_STR(invite_route_uri)),
+				   TAG_IF(!zstr(route), SIPTAG_ROUTE_STR(route)),
+				   TAG_IF(tech_pvt->profile->minimum_session_expires, NUTAG_MIN_SE(tech_pvt->profile->minimum_session_expires)),
+				   TAG_IF(cseq, SIPTAG_CSEQ(cseq)),
+				   SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip),
+				   SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
+				   SOATAG_REUSE_REJECTED(1),
+				   SOATAG_ORDERED_USER(1),
+				   SOATAG_RTP_SORT(SOA_RTP_SORT_REMOTE),
+				   SOATAG_RTP_SELECT(SOA_RTP_SELECT_ALL), TAG_IF(rep, SIPTAG_REPLACES_STR(rep)), SOATAG_HOLD(holdstr), TAG_END());
+	} else {
+		nua_invite(tech_pvt->nh,
+				   NUTAG_AUTOANSWER(0),
+				   NUTAG_SESSION_TIMER(session_timeout),
+				   TAG_IF(invite_full_from, SIPTAG_FROM_STR(invite_full_from)),
+				   TAG_IF(invite_full_to, SIPTAG_TO_STR(invite_full_to)),
+				   TAG_IF(tech_pvt->redirected, NUTAG_URL(tech_pvt->redirected)),
+				   TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
+				   TAG_IF(!zstr(invite_full_via), SIPTAG_VIA_STR(invite_full_via)),
+				   TAG_IF(!zstr(tech_pvt->rpid), SIPTAG_REMOTE_PARTY_ID_STR(tech_pvt->rpid)),
+				   TAG_IF(!zstr(tech_pvt->preferred_id), SIPTAG_P_PREFERRED_IDENTITY_STR(tech_pvt->preferred_id)),
+				   TAG_IF(!zstr(tech_pvt->asserted_id), SIPTAG_P_ASSERTED_IDENTITY_STR(tech_pvt->asserted_id)),
+				   TAG_IF(!zstr(tech_pvt->privacy), SIPTAG_PRIVACY_STR(tech_pvt->privacy)),
+				   TAG_IF(!zstr(alert_info), SIPTAG_HEADER_STR(alert_info)),
+				   TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
+				   TAG_IF(sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_CALLEE_ID), SIPTAG_HEADER_STR("X-FS-Support: " FREESWITCH_SUPPORT)),
+				   TAG_IF(!zstr(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)),
+				   TAG_IF(!zstr(route_uri), NUTAG_PROXY(route_uri)),
+				   TAG_IF(!zstr(route), SIPTAG_ROUTE_STR(route)),
+				   TAG_IF(!zstr(invite_route_uri), NUTAG_INITIAL_ROUTE_STR(invite_route_uri)),
+				   TAG_IF(tech_pvt->profile->minimum_session_expires, NUTAG_MIN_SE(tech_pvt->profile->minimum_session_expires)),
+				   TAG_IF(cseq, SIPTAG_CSEQ(cseq)),
+				   NUTAG_MEDIA_ENABLE(0),
+				   SIPTAG_CONTENT_TYPE_STR("application/sdp"),
+				   SIPTAG_PAYLOAD_STR(tech_pvt->local_sdp_str), TAG_IF(rep, SIPTAG_REPLACES_STR(rep)), SOATAG_HOLD(holdstr), TAG_END());
+	}
+
 	sofia_glue_free_destination(dst);
 	switch_safe_free(extra_headers);
 	tech_pvt->redirected = NULL;
@@ -1832,13 +1967,13 @@
 	private_object_t *tech_pvt = switch_core_session_get_private(session);
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_caller_profile_t *caller_profile;
-	const char *sipip, *format, *contact_url; 
+	const char *sipip, *format, *contact_url;
 
 	switch_assert(tech_pvt != NULL);
 	switch_mutex_lock(tech_pvt->sofia_mutex);
 	caller_profile = switch_channel_get_caller_profile(channel);
 
-	if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { 
+	if (sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
 		sipip = tech_pvt->profile->extsipip;
 		contact_url = tech_pvt->profile->public_url;
 	} else {
@@ -1848,17 +1983,12 @@
 
 	format = strchr(sipip, ':') ? "\"%s\" <sip:%s@[%s]>" : "\"%s\" <sip:%s@%s>";
 
-	if ((tech_pvt->from_str = switch_core_session_sprintf(session, format,
-															caller_profile->caller_id_name,
-															caller_profile->caller_id_number, sipip))) {
+	if ((tech_pvt->from_str = switch_core_session_sprintf(session, format, caller_profile->caller_id_name, caller_profile->caller_id_number, sipip))) {
 
 		const char *rep = switch_channel_get_variable(channel, SOFIA_REPLACES_HEADER);
 
 		tech_pvt->nh2 = nua_handle(tech_pvt->profile->nua, NULL,
-								   SIPTAG_TO_STR(tech_pvt->dest),
-								   SIPTAG_FROM_STR(tech_pvt->from_str),
-								   SIPTAG_CONTACT_STR(contact_url),
-								   TAG_END());
+								   SIPTAG_TO_STR(tech_pvt->dest), SIPTAG_FROM_STR(tech_pvt->from_str), SIPTAG_CONTACT_STR(contact_url), TAG_END());
 
 		nua_handle_bind(tech_pvt->nh2, tech_pvt->sofia_private);
 
@@ -1943,18 +2073,18 @@
 		add_stat(stats->outbound.skip_packet_count, "out_skip_packet_count");
 		add_stat(stats->outbound.dtmf_packet_count, "out_dtmf_packet_count");
 		add_stat(stats->outbound.cng_packet_count, "out_cng_packet_count");
-		
+
 	}
 }
 
 void sofia_glue_set_rtp_stats(private_object_t *tech_pvt)
 {
 	if (tech_pvt->rtp_session) {
-        set_stats(tech_pvt->rtp_session, tech_pvt, "audio");
+		set_stats(tech_pvt->rtp_session, tech_pvt, "audio");
 	}
 
 	if (tech_pvt->video_rtp_session) {
-        set_stats(tech_pvt->video_rtp_session, tech_pvt, "video");
+		set_stats(tech_pvt->video_rtp_session, tech_pvt, "video");
 	}
 }
 
@@ -1968,26 +2098,28 @@
 		}
 	}
 
+	if (tech_pvt->video_rtp_session) {
+		switch_rtp_destroy(&tech_pvt->video_rtp_session);
+	} else if (tech_pvt->local_sdp_video_port) {
+		switch_rtp_release_port(tech_pvt->profile->rtpip, tech_pvt->local_sdp_video_port);
+	}
+
+
+	if (tech_pvt->local_sdp_video_port > 0 && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+		switch_nat_del_mapping((switch_port_t) tech_pvt->local_sdp_video_port, SWITCH_NAT_UDP);
+	}
+
+
 	if (tech_pvt->rtp_session) {
 		switch_rtp_destroy(&tech_pvt->rtp_session);
 	} else if (tech_pvt->local_sdp_audio_port) {
 		switch_rtp_release_port(tech_pvt->profile->rtpip, tech_pvt->local_sdp_audio_port);
 	}
 
-	if (tech_pvt->local_sdp_audio_port > 0 && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { 
-		switch_nat_del_mapping((switch_port_t)tech_pvt->local_sdp_audio_port, SWITCH_NAT_UDP);
+	if (tech_pvt->local_sdp_audio_port > 0 && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) {
+		switch_nat_del_mapping((switch_port_t) tech_pvt->local_sdp_audio_port, SWITCH_NAT_UDP);
 	}
-	
-	if (tech_pvt->video_rtp_session) {
-		switch_rtp_destroy(&tech_pvt->video_rtp_session);
-	} else if (tech_pvt->local_sdp_video_port) {
-		switch_rtp_release_port(tech_pvt->profile->rtpip, tech_pvt->local_sdp_video_port);
-	}
 
-		
-	if (tech_pvt->local_sdp_video_port > 0 && sofia_glue_check_nat(tech_pvt->profile, tech_pvt->remote_ip)) { 
-		switch_nat_del_mapping((switch_port_t)tech_pvt->local_sdp_video_port, SWITCH_NAT_UDP);
-	}
 }
 
 switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int force)
@@ -2005,7 +2137,8 @@
 			switch_core_codec_destroy(&tech_pvt->video_read_codec);
 			switch_core_codec_destroy(&tech_pvt->video_write_codec);
 		} else {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Already using %s\n", tech_pvt->video_read_codec.implementation->iananame);
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Already using %s\n",
+							  tech_pvt->video_read_codec.implementation->iananame);
 			return SWITCH_STATUS_SUCCESS;
 		}
 	}
@@ -2050,6 +2183,13 @@
 			tech_pvt->video_read_codec.agreed_pt = tech_pvt->video_agreed_pt;
 			switch_core_session_set_video_read_codec(tech_pvt->session, &tech_pvt->video_read_codec);
 			switch_core_session_set_video_write_codec(tech_pvt->session, &tech_pvt->video_write_codec);
+
+
+			switch_channel_set_variable(tech_pvt->channel, "sip_use_video_codec_name", tech_pvt->video_rm_encoding);
+			switch_channel_set_variable(tech_pvt->channel, "sip_use_video_codec_fmtp", tech_pvt->video_rm_fmtp);
+			switch_channel_set_variable_printf(tech_pvt->channel, "sip_use_video_codec_rate", "%d", tech_pvt->video_rm_rate);
+			switch_channel_set_variable_printf(tech_pvt->channel, "sip_use_video_codec_ptime", "%d", 0);
+
 		}
 	}
 	return SWITCH_STATUS_SUCCESS;
@@ -2060,33 +2200,34 @@
 	int ms;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	int resetting = 0;
-	
+
 	if (!tech_pvt->iananame) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "No audio codec available\n");
 		switch_goto_status(SWITCH_STATUS_FALSE, end);
 	}
 
-	if (tech_pvt->read_codec.implementation && switch_core_codec_ready(&tech_pvt->read_codec)) {
+	if (switch_core_codec_ready(&tech_pvt->read_codec)) {
 		if (!force) {
 			switch_goto_status(SWITCH_STATUS_SUCCESS, end);
 		}
-		if (strcasecmp(tech_pvt->read_codec.implementation->iananame, tech_pvt->iananame) ||
-			tech_pvt->read_codec.implementation->samples_per_second != tech_pvt->rm_rate) {
+		if (strcasecmp(tech_pvt->read_impl.iananame, tech_pvt->iananame) ||
+			tech_pvt->read_impl.samples_per_second != tech_pvt->rm_rate ||
+			tech_pvt->codec_ms != (uint32_t) tech_pvt->read_impl.microseconds_per_packet / 1000) {
 
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Changing Codec from %s to %s\n",
-							  tech_pvt->read_codec.implementation->iananame, tech_pvt->rm_encoding);
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Changing Codec from %s@%dms to %s@%dms\n",
+							  tech_pvt->read_impl.iananame, tech_pvt->read_impl.microseconds_per_packet / 1000, tech_pvt->rm_encoding, tech_pvt->codec_ms);
+
 			switch_core_session_lock_codec_write(tech_pvt->session);
 			switch_core_session_lock_codec_read(tech_pvt->session);
 			resetting = 1;
 			switch_core_codec_destroy(&tech_pvt->read_codec);
 			switch_core_codec_destroy(&tech_pvt->write_codec);
-			switch_core_session_reset(tech_pvt->session, SWITCH_TRUE, SWITCH_TRUE);
 		} else {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Already using %s\n", tech_pvt->read_codec.implementation->iananame);
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Already using %s\n", tech_pvt->read_impl.iananame);
 			switch_goto_status(SWITCH_STATUS_SUCCESS, end);
 		}
 	}
-	
+
 	if (switch_core_codec_init(&tech_pvt->read_codec,
 							   tech_pvt->iananame,
 							   tech_pvt->rm_fmtp,
@@ -2111,6 +2252,12 @@
 		switch_goto_status(SWITCH_STATUS_FALSE, end);
 	}
 
+	switch_channel_set_variable(tech_pvt->channel, "sip_use_codec_name", tech_pvt->iananame);
+	switch_channel_set_variable(tech_pvt->channel, "sip_use_codec_fmtp", tech_pvt->rm_fmtp);
+	switch_channel_set_variable_printf(tech_pvt->channel, "sip_use_codec_rate", "%d", tech_pvt->rm_rate);
+	switch_channel_set_variable_printf(tech_pvt->channel, "sip_use_codec_ptime", "%d", tech_pvt->codec_ms);
+
+
 	switch_assert(tech_pvt->read_codec.implementation);
 	switch_assert(tech_pvt->write_codec.implementation);
 
@@ -2122,9 +2269,12 @@
 
 	if (switch_rtp_ready(tech_pvt->rtp_session)) {
 		switch_assert(tech_pvt->read_codec.implementation);
-		switch_rtp_set_interval(tech_pvt->rtp_session,
-								   tech_pvt->write_codec.implementation->microseconds_per_packet,
-								   tech_pvt->read_impl.samples_per_packet);
+
+		if (switch_rtp_change_interval(tech_pvt->rtp_session,
+									   tech_pvt->read_impl.microseconds_per_packet, tech_pvt->read_impl.samples_per_packet) != SWITCH_STATUS_SUCCESS) {
+			switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+			switch_goto_status(SWITCH_STATUS_FALSE, end);
+		}
 	}
 
 	tech_pvt->read_frame.rate = tech_pvt->rm_rate;
@@ -2154,12 +2304,13 @@
 		switch_rtp_set_default_payload(tech_pvt->rtp_session, tech_pvt->pt);
 	}
 
- end:
+  end:
 	if (resetting) {
 		switch_core_session_unlock_codec_write(tech_pvt->session);
 		switch_core_session_unlock_codec_read(tech_pvt->session);
 	}
 
+
 	return status;
 }
 
@@ -2314,9 +2465,9 @@
 	if (myflags) {
 		flags = myflags;
 	} else if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) &&
-				!((val = switch_channel_get_variable(tech_pvt->channel, "disable_rtp_auto_adjust")) && switch_true(val))) {
+			   !((val = switch_channel_get_variable(tech_pvt->channel, "disable_rtp_auto_adjust")) && switch_true(val))) {
 		flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT);
-    } else {
+	} else {
 		flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_DATAWAIT);
 	}
 
@@ -2359,10 +2510,11 @@
 		switch_port_t remote_port = switch_rtp_get_remote_port(tech_pvt->rtp_session);
 
 		if (remote_host && remote_port && !strcmp(remote_host, tech_pvt->remote_sdp_audio_ip) && remote_port == tech_pvt->remote_sdp_audio_port) {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Audio params are unchanged for %s.\n", switch_channel_get_name(tech_pvt->channel));
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Audio params are unchanged for %s.\n",
+							  switch_channel_get_name(tech_pvt->channel));
 			goto video;
 		} else {
-			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_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);
 
@@ -2387,7 +2539,7 @@
 
 	if (tech_pvt->rtp_session && sofia_test_flag(tech_pvt, TFLAG_REINVITE)) {
 		sofia_clear_flag_locked(tech_pvt, TFLAG_REINVITE);
-		
+
 		if (switch_rtp_set_remote_address(tech_pvt->rtp_session, tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port, SWITCH_TRUE, &err) !=
 			SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "AUDIO RTP REPORTS ERROR: [%s]\n", err);
@@ -2440,8 +2592,7 @@
 											   tech_pvt->agreed_pt,
 											   tech_pvt->read_impl.samples_per_packet,
 											   tech_pvt->codec_ms * 1000,
-											   (switch_rtp_flag_t) flags, timer_name, &err,
-											   switch_core_session_get_pool(tech_pvt->session));
+											   (switch_rtp_flag_t) flags, timer_name, &err, switch_core_session_get_pool(tech_pvt->session));
 	}
 
 	if (switch_rtp_ready(tech_pvt->rtp_session)) {
@@ -2449,9 +2600,18 @@
 		uint8_t vad_out = sofia_test_flag(tech_pvt, TFLAG_VAD_OUT) ? 1 : 0;
 		uint8_t inb = sofia_test_flag(tech_pvt, TFLAG_OUTBOUND) ? 0 : 1;
 		uint32_t stun_ping = 0;
+		const char *ssrc;
 
+		if ((ssrc = switch_channel_get_variable(tech_pvt->channel, "rtp_use_ssrc"))) {
+			uint32_t ssrc_ul = (uint32_t) strtoul(ssrc, NULL, 10);
+			switch_rtp_set_ssrc(tech_pvt->rtp_session, ssrc_ul);
+		}
+
+
 		switch_channel_set_flag(tech_pvt->channel, CF_FS_RTP);
-		
+
+		switch_channel_set_variable_printf(tech_pvt->channel, "sip_use_pt", "%d", tech_pvt->agreed_pt);
+
 		if ((val = switch_channel_get_variable(tech_pvt->channel, "rtp_enable_vad_in")) && switch_true(val)) {
 			vad_in = 1;
 		}
@@ -2468,7 +2628,7 @@
 
 		if ((tech_pvt->stun_flags & STUN_FLAG_SET) && (val = switch_channel_get_variable(tech_pvt->channel, "rtp_stun_ping"))) {
 			int ival = atoi(val);
-			
+
 			if (ival <= 0) {
 				if (switch_true(val)) {
 					ival = 6;
@@ -2479,11 +2639,13 @@
 		}
 
 		tech_pvt->ssrc = switch_rtp_get_ssrc(tech_pvt->rtp_session);
+		switch_channel_set_variable_printf(tech_pvt->channel, "rtp_use_ssrc", "%u", tech_pvt->ssrc);
+
 		sofia_set_flag(tech_pvt, TFLAG_RTP);
 		sofia_set_flag(tech_pvt, TFLAG_IO);
-		
+
 		switch_rtp_intentional_bugs(tech_pvt->rtp_session, tech_pvt->rtp_bugs);
-		
+
 		if ((vad_in && inb) || (vad_out && !inb)) {
 			switch_rtp_enable_vad(tech_pvt->rtp_session, tech_pvt->session, &tech_pvt->read_codec, SWITCH_VAD_FLAG_TALKING);
 			sofia_set_flag(tech_pvt, TFLAG_VAD);
@@ -2492,22 +2654,25 @@
 		}
 
 		if (stun_ping) {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Setting stun ping to %s:%d\n", tech_pvt->stun_ip, stun_ping);
-			switch_rtp_activate_stun_ping(tech_pvt->rtp_session, tech_pvt->stun_ip, tech_pvt->stun_port, 
-										  stun_ping, (tech_pvt->stun_flags & STUN_FLAG_FUNNY) ? 1 : 0);
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Setting stun ping to %s:%d\n", tech_pvt->stun_ip,
+							  stun_ping);
+			switch_rtp_activate_stun_ping(tech_pvt->rtp_session, tech_pvt->stun_ip, tech_pvt->stun_port, stun_ping,
+										  (tech_pvt->stun_flags & STUN_FLAG_FUNNY) ? 1 : 0);
 		}
 
 		if ((val = switch_channel_get_variable(tech_pvt->channel, "jitterbuffer_msec"))) {
 			int len = atoi(val);
 
 			if (len < 100 || len > 1000) {
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Invalid Jitterbuffer spec [%d] must be between 100 and 1000\n", len);
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR,
+								  "Invalid Jitterbuffer spec [%d] must be between 100 and 1000\n", len);
 			} else {
 				int qlen;
 
 				qlen = len / (tech_pvt->read_impl.microseconds_per_packet / 1000);
 
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames)\n", len, qlen);
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames)\n", len,
+								  qlen);
 				switch_rtp_activate_jitter_buffer(tech_pvt->rtp_session, qlen);
 			}
 		}
@@ -2527,8 +2692,7 @@
 		}
 
 		if (rtp_timeout_sec) {
-			tech_pvt->max_missed_packets = (tech_pvt->read_impl.samples_per_second * rtp_timeout_sec) /
-				tech_pvt->read_impl.samples_per_packet;
+			tech_pvt->max_missed_packets = (tech_pvt->read_impl.samples_per_second * rtp_timeout_sec) / tech_pvt->read_impl.samples_per_packet;
 
 			switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets);
 			if (!rtp_hold_timeout_sec) {
@@ -2537,8 +2701,7 @@
 		}
 
 		if (rtp_hold_timeout_sec) {
-			tech_pvt->max_missed_hold_packets = (tech_pvt->read_impl.samples_per_second * rtp_hold_timeout_sec) /
-				tech_pvt->read_impl.samples_per_packet;
+			tech_pvt->max_missed_hold_packets = (tech_pvt->read_impl.samples_per_second * rtp_hold_timeout_sec) / tech_pvt->read_impl.samples_per_packet;
 		}
 
 		if (tech_pvt->te) {
@@ -2574,7 +2737,7 @@
 
 		sofia_glue_check_video_codecs(tech_pvt);
 		if (sofia_test_flag(tech_pvt, TFLAG_VIDEO) && tech_pvt->video_rm_encoding && tech_pvt->remote_sdp_video_port) {
-			
+
 			/******************************************************************************************/
 			if (tech_pvt->video_rtp_session && sofia_test_flag(tech_pvt, TFLAG_REINVITE)) {
 				//const char *ip = switch_channel_get_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE);
@@ -2583,33 +2746,33 @@
 				switch_port_t remote_port = switch_rtp_get_remote_port(tech_pvt->video_rtp_session);
 
 				if (remote_host && remote_port && !strcmp(remote_host, tech_pvt->remote_sdp_video_ip) && remote_port == tech_pvt->remote_sdp_video_port) {
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Video params are unchanged for %s.\n", switch_channel_get_name(tech_pvt->channel));
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Video params are unchanged for %s.\n",
+									  switch_channel_get_name(tech_pvt->channel));
 					goto video_up;
 				} else {
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Video params changed for %s from %s:%d to %s:%d\n", 
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Video 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_video_ip, tech_pvt->remote_sdp_video_port);
 				}
 			}
 
 			if (!switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) {
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "VIDEO RTP [%s] %s port %d -> %s port %d codec: %u ms: %d\n",
-								  switch_channel_get_name(tech_pvt->channel),
-								  tech_pvt->local_sdp_audio_ip,
-								  tech_pvt->local_sdp_video_port,
-								  tech_pvt->remote_sdp_video_ip,
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG,
+								  "VIDEO RTP [%s] %s port %d -> %s port %d codec: %u ms: %d\n", switch_channel_get_name(tech_pvt->channel),
+								  tech_pvt->local_sdp_audio_ip, tech_pvt->local_sdp_video_port, tech_pvt->remote_sdp_video_ip,
 								  tech_pvt->remote_sdp_video_port, tech_pvt->video_agreed_pt, tech_pvt->read_impl.microseconds_per_packet / 1000);
 			}
 
 			switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->local_sdp_video_port);
-			switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip);
-			switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE, tmp);
+			switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_VIDEO_IP_VARIABLE, tech_pvt->adv_sdp_audio_ip);
+			switch_channel_set_variable(tech_pvt->channel, SWITCH_LOCAL_VIDEO_PORT_VARIABLE, tmp);
 
 			if (tech_pvt->video_rtp_session && sofia_test_flag(tech_pvt, TFLAG_REINVITE)) {
 				sofia_clear_flag_locked(tech_pvt, TFLAG_REINVITE);
-		
-				if (switch_rtp_set_remote_address(tech_pvt->video_rtp_session, tech_pvt->remote_sdp_video_ip, tech_pvt->remote_sdp_video_port, SWITCH_TRUE, &err) !=
-					SWITCH_STATUS_SUCCESS) {
+
+				if (switch_rtp_set_remote_address
+					(tech_pvt->video_rtp_session, tech_pvt->remote_sdp_video_ip, tech_pvt->remote_sdp_video_port, SWITCH_TRUE,
+					 &err) != SWITCH_STATUS_SUCCESS) {
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "VIDEO RTP REPORTS ERROR: [%s]\n", err);
 				} else {
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "VIDEO RTP CHANGING DEST TO: [%s:%d]\n",
@@ -2654,6 +2817,9 @@
 
 			/******************************************************************************************/
 
+			if (tech_pvt->video_rtp_session) {
+				goto video_up;
+			}
 
 
 			if (!tech_pvt->local_sdp_video_port) {
@@ -2662,8 +2828,7 @@
 
 			if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) && !switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE) &&
 				!((val = switch_channel_get_variable(tech_pvt->channel, "disable_rtp_auto_adjust")) && switch_true(val))) {
-				flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_AUTOADJ |
-		 									 SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_RAW_WRITE);
+				flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_RAW_WRITE);
 			} else {
 				flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_RAW_WRITE);
 			}
@@ -2674,7 +2839,7 @@
 			sofia_glue_tech_set_video_codec(tech_pvt, 0);
 
 			flags &= ~(SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_NOBLOCK);
-			flags |= SWITCH_RTP_FLAG_VIDEO | SWITCH_RTP_FLAG_PROXY_MEDIA;
+			flags |= SWITCH_RTP_FLAG_VIDEO;
 
 			tech_pvt->video_rtp_session = switch_rtp_new(tech_pvt->local_sdp_audio_ip,
 														 tech_pvt->local_sdp_video_port,
@@ -2693,7 +2858,16 @@
 							  0, switch_rtp_ready(tech_pvt->video_rtp_session) ? "SUCCESS" : err);
 
 			if (switch_rtp_ready(tech_pvt->video_rtp_session)) {
+				const char *ssrc;
 				switch_channel_set_flag(tech_pvt->channel, CF_VIDEO);
+				if ((ssrc = switch_channel_get_variable(tech_pvt->channel, "rtp_use_video_ssrc"))) {
+					uint32_t ssrc_ul = (uint32_t) strtoul(ssrc, NULL, 10);
+					switch_rtp_set_ssrc(tech_pvt->video_rtp_session, ssrc_ul);
+				}
+
+				switch_channel_set_variable_printf(tech_pvt->channel, "sip_use_video_pt", "%d", tech_pvt->video_agreed_pt);
+				tech_pvt->video_ssrc = switch_rtp_get_ssrc(tech_pvt->rtp_session);
+				switch_channel_set_variable_printf(tech_pvt->channel, "rtp_use_video_ssrc", "%u", tech_pvt->ssrc);
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "VIDEO RTP REPORTS ERROR: [%s]\n", switch_str_nil(err));
 				switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -2709,13 +2883,16 @@
 		goto end;
 	}
 
- video_up:
+  video_up:
 
 	sofia_set_flag(tech_pvt, TFLAG_IO);
 	status = SWITCH_STATUS_SUCCESS;
 
   end:
 
+	sofia_glue_tech_track(tech_pvt->profile, tech_pvt->session);
+
+
 	switch_mutex_unlock(tech_pvt->sofia_mutex);
 
 	return status;
@@ -2724,7 +2901,7 @@
 
 void sofia_glue_set_r_sdp_codec_string(switch_core_session_t *session, const char *codec_string, sdp_session_t *sdp)
 {
-	char buf[1024] = {0};
+	char buf[1024] = { 0 };
 	sdp_media_t *m;
 	sdp_attribute_t *attr;
 	int ptime = 0, dptime = 0;
@@ -2767,7 +2944,7 @@
 
 	for (m = sdp->sdp_media; m; m = m->m_next) {
 		ptime = dptime;
-		if ( m->m_type == sdp_media_image && m->m_port) {
+		if (m->m_type == sdp_media_image && m->m_port) {
 			switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",t38");
 		} else if (m->m_type == sdp_media_audio && m->m_port) {
 			for (attr = m->m_attributes; attr; attr = attr->a_next) {
@@ -2795,7 +2972,7 @@
 					continue;
 				}
 				for (map = m->m_rtpmaps; map; map = map->rm_next) {
-					if ( map->rm_pt > 127 ||  already_did[map->rm_pt]) {
+					if (map->rm_pt > 127 || already_did[map->rm_pt]) {
 						continue;
 					}
 
@@ -2811,7 +2988,8 @@
 
 					if (match) {
 						if (ptime > 0) {
-							switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh@%di", imp->iananame, (unsigned int) map->rm_rate, ptime);
+							switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh@%di", imp->iananame, (unsigned int) map->rm_rate,
+											ptime);
 						} else {
 							switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh", imp->iananame, (unsigned int) map->rm_rate);
 						}
@@ -2836,14 +3014,14 @@
 					continue;
 				}
 				for (map = m->m_rtpmaps; map; map = map->rm_next) {
-					if ( map->rm_pt > 127 || already_did[map->rm_pt]) {
+					if (map->rm_pt > 127 || already_did[map->rm_pt]) {
 						continue;
 					}
 
 					if ((zstr(map->rm_encoding) || (tech_pvt->profile->ndlb & PFLAG_NDLB_ALLOW_BAD_IANANAME)) && map->rm_pt < 96) {
 						match = (map->rm_pt == imp->ianacode) ? 1 : 0;
 					} else {
-						if(map->rm_encoding) {
+						if (map->rm_encoding) {
 							match = strcasecmp(map->rm_encoding, imp->iananame) ? 0 : 1;
 						} else {
 							match = 0;
@@ -2851,8 +3029,9 @@
 					}
 
 					if (match) {
-						if(ptime > 0) {
-							switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh@%di", imp->iananame, (unsigned int) map->rm_rate, ptime);
+						if (ptime > 0) {
+							switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh@%di", imp->iananame, (unsigned int) map->rm_rate,
+											ptime);
 						} else {
 							switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh", imp->iananame, (unsigned int) map->rm_rate);
 						}
@@ -2882,13 +3061,13 @@
 	}
 
 	if ((parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) {
-		
+
 		if (tech_pvt->num_codecs) {
 			if ((sdp = sdp_session(parser))) {
 				match = sofia_glue_negotiate_sdp(tech_pvt->session, sdp);
 			}
 		}
-		
+
 		sdp_parser_free(parser);
 	}
 
@@ -2914,10 +3093,20 @@
 	if (sendonly && switch_channel_test_flag(tech_pvt->channel, CF_ANSWERED)) {
 		if (!sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
 			const char *stream;
+			const char *msg = "hold";
 
+			if (sofia_test_pflag(tech_pvt->profile, PFLAG_MANAGE_SHARED_APPEARANCE)) {
+				const char *info = switch_channel_get_variable(tech_pvt->channel, "presence_call_info");
+				if (info) {
+					if (switch_stristr("private", info)) {
+						msg = "hold-private";
+					}
+				}
+			}
+
 			sofia_set_flag_locked(tech_pvt, TFLAG_SIP_HOLD);
 			switch_channel_set_flag(tech_pvt->channel, CF_LEG_HOLDING);
-			switch_channel_presence(tech_pvt->channel, "unknown", "hold", NULL);
+			switch_channel_presence(tech_pvt->channel, "unknown", msg, NULL);
 
 			if (tech_pvt->max_missed_hold_packets) {
 				switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_hold_packets);
@@ -2933,7 +3122,8 @@
 					switch_channel_set_flag(tech_pvt->channel, CF_HOLD);
 					switch_ivr_hold_uuid(switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE), NULL, 0);
 				} else {
-					switch_ivr_broadcast(switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE), stream, SMF_ECHO_ALEG | SMF_LOOP);
+					switch_ivr_broadcast(switch_channel_get_variable(tech_pvt->channel, SWITCH_SIGNAL_BOND_VARIABLE), stream,
+										 SMF_ECHO_ALEG | SMF_LOOP | SMF_PRIORITY);
 					switch_yield(250000);
 				}
 			}
@@ -2945,7 +3135,7 @@
 		}
 
 		sofia_clear_flag_locked(tech_pvt, TFLAG_HOLD_LOCK);
-		
+
 		if (sofia_test_flag(tech_pvt, TFLAG_SIP_HOLD)) {
 			const char *uuid;
 			switch_core_session_t *b_session;
@@ -2999,7 +3189,7 @@
 
 	greedy = !!sofia_test_pflag(tech_pvt->profile, PFLAG_GREEDY);
 	scrooge = !!sofia_test_pflag(tech_pvt->profile, PFLAG_SCROOGE);
-	
+
 	if (!greedy || !scrooge) {
 		if ((val = switch_channel_get_variable(channel, "sip_codec_negotiation"))) {
 			if (!strcasecmp(val, "greedy")) {
@@ -3020,16 +3210,15 @@
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Activate Buggy RFC2833 Mode!\n");
 			}
 		}
-		
+
 		if (tech_pvt->profile->auto_rtp_bugs & RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833) {
 			if (strstr(tech_pvt->origin, "Sonus_UAC")) {
 				tech_pvt->rtp_bugs |= RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833;
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, 
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
 								  "Hello,\nI see you have a Sonus!\n"
 								  "FYI, Sonus cannot follow the RFC on the proper way to send DTMF.\n"
 								  "Sadly, my creator had to spend several hours figuring this out so I thought you'd like to know that!\n"
-								  "Don't worry, DTMF will work but you may want to ask them to fix it......\n"
-								  );
+								  "Don't worry, DTMF will work but you may want to ask them to fix it......\n");
 			}
 		}
 	}
@@ -3075,25 +3264,25 @@
 
 		if (got_udptl && m->m_type == sdp_media_image && m->m_port) {
 			switch_t38_options_t *t38_options = switch_core_session_alloc(tech_pvt->session, sizeof(switch_t38_options_t));
-			
+
 			for (attr = m->m_attributes; attr; attr = attr->a_next) {
-				if (!strcasecmp(attr->a_name, "T38MaxBitRate") && attr->a_value) { 
+				if (!strcasecmp(attr->a_name, "T38MaxBitRate") && attr->a_value) {
 					t38_options->T38MaxBitRate = (uint32_t) atoi(attr->a_value);
-				} else  if (!strcasecmp(attr->a_name, "T38FaxFillBitRemoval")) {
+				} else if (!strcasecmp(attr->a_name, "T38FaxFillBitRemoval")) {
 					t38_options->T38FaxFillBitRemoval = SWITCH_TRUE;
-				} else  if (!strcasecmp(attr->a_name, "T38FaxTranscodingMMR")) {
+				} else if (!strcasecmp(attr->a_name, "T38FaxTranscodingMMR")) {
 					t38_options->T38FaxTranscodingMMR = SWITCH_TRUE;
-				} else  if (!strcasecmp(attr->a_name, "T38FaxTranscodingJBIG")) {
+				} else if (!strcasecmp(attr->a_name, "T38FaxTranscodingJBIG")) {
 					t38_options->T38FaxTranscodingJBIG = SWITCH_TRUE;
-				} else  if (!strcasecmp(attr->a_name, "T38FaxRateManagement") && attr->a_value) {
+				} else if (!strcasecmp(attr->a_name, "T38FaxRateManagement") && attr->a_value) {
 					t38_options->T38FaxRateManagement = switch_core_session_strdup(tech_pvt->session, attr->a_value);
-				} else  if (!strcasecmp(attr->a_name, "T38FaxMaxBuffer") && attr->a_value) {
+				} else if (!strcasecmp(attr->a_name, "T38FaxMaxBuffer") && attr->a_value) {
 					t38_options->T38FaxMaxBuffer = (uint32_t) atoi(attr->a_value);
-				} else  if (!strcasecmp(attr->a_name, "T38FaxMaxDatagram") && attr->a_value) {
+				} else if (!strcasecmp(attr->a_name, "T38FaxMaxDatagram") && attr->a_value) {
 					t38_options->T38FaxMaxDatagram = (uint32_t) atoi(attr->a_value);
-				} else  if (!strcasecmp(attr->a_name, "T38FaxUdpEC") && attr->a_value) {
+				} else if (!strcasecmp(attr->a_name, "T38FaxUdpEC") && attr->a_value) {
 					t38_options->T38FaxUdpEC = switch_core_session_strdup(tech_pvt->session, attr->a_value);
-				} else  if (!strcasecmp(attr->a_name, "T38VendorInfo") && attr->a_value) {
+				} else if (!strcasecmp(attr->a_name, "T38VendorInfo") && attr->a_value) {
 					t38_options->T38VendorInfo = switch_core_session_strdup(tech_pvt->session, attr->a_value);
 				}
 			}
@@ -3144,12 +3333,12 @@
 							} else {
 								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Crypto Setup Failed!.\n");
 							}
-														
+
 							if (a && b && !strncasecmp(a, b, 23)) {
 								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Change Remote key to [%s]\n", crypto);
 								tech_pvt->remote_crypto_key = switch_core_session_strdup(tech_pvt->session, crypto);
 								tech_pvt->crypto_tag = crypto_tag;
-								
+
 								if (switch_rtp_ready(tech_pvt->rtp_session) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) {
 									sofia_glue_add_crypto(tech_pvt, tech_pvt->remote_crypto_key, SWITCH_RTP_CRYPTO_RECV);
 									switch_rtp_add_crypto_key(tech_pvt->rtp_session, SWITCH_RTP_CRYPTO_RECV, tech_pvt->crypto_tag,
@@ -3200,7 +3389,7 @@
 		  greed:
 			x = 0;
 
-			if (tech_pvt->rm_encoding) {// && !sofia_test_flag(tech_pvt, TFLAG_REINVITE)) {
+			if (tech_pvt->rm_encoding) {	// && !sofia_test_flag(tech_pvt, TFLAG_REINVITE)) {
 				char *remote_host = tech_pvt->remote_sdp_audio_ip;
 				switch_port_t remote_port = tech_pvt->remote_sdp_audio_port;
 				int same = 0;
@@ -3209,7 +3398,7 @@
 					remote_host = switch_rtp_get_remote_host(tech_pvt->rtp_session);
 					remote_port = switch_rtp_get_remote_port(tech_pvt->rtp_session);
 				}
-				
+
 				for (map = m->m_rtpmaps; map; map = map->rm_next) {
 					if ((zstr(map->rm_encoding) || (tech_pvt->profile->ndlb & PFLAG_NDLB_ALLOW_BAD_IANANAME)) && map->rm_pt < 96) {
 						match = (map->rm_pt == tech_pvt->pt) ? 1 : 0;
@@ -3217,8 +3406,7 @@
 						match = strcasecmp(switch_str_nil(map->rm_encoding), tech_pvt->iananame) ? 0 : 1;
 					}
 
-					if (match && connection->c_address && remote_host &&
-						!strcmp(connection->c_address, remote_host) && m->m_port == remote_port) {
+					if (match && connection->c_address && remote_host && !strcmp(connection->c_address, remote_host) && m->m_port == remote_port) {
 						same = 1;
 					} else {
 						same = 0;
@@ -3227,7 +3415,7 @@
 				}
 
 				if (same) {
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
 									  "Our existing sdp is still good [%s %s:%d], let's keep it.\n",
 									  tech_pvt->rm_encoding, tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port);
 					got_audio = 1;
@@ -3236,7 +3424,7 @@
 					got_audio = 0;
 				}
 			}
-			
+
 			for (map = m->m_rtpmaps; map; map = map->rm_next) {
 				int32_t i;
 				uint32_t near_rate = 0;
@@ -3281,11 +3469,15 @@
 					first = 0;
 					last = tech_pvt->num_codecs;
 				}
-				
+
 				if (maxptime && (!ptime || ptime > maxptime)) {
 					ptime = maxptime;
 				}
 
+				if (!ptime) {
+					ptime = 20;
+				}
+
 				for (i = first; i < last && i < tech_pvt->num_codecs; i++) {
 					const switch_codec_implementation_t *imp = tech_pvt->codecs[i];
 					uint32_t codec_rate = imp->samples_per_second;
@@ -3304,12 +3496,11 @@
 
 					if (match) {
 						if (scrooge) {
-							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
-											  "Bah HUMBUG! Sticking with %s@%uh@%ui\n", 
+							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+											  "Bah HUMBUG! Sticking with %s@%uh@%ui\n",
 											  imp->iananame, imp->samples_per_second, imp->microseconds_per_packet / 1000);
 						} else {
-							if ((ptime && ptime * 1000 != imp->microseconds_per_packet) || 
-								map->rm_rate != codec_rate) {
+							if ((ptime && ptime * 1000 != imp->microseconds_per_packet) || map->rm_rate != codec_rate) {
 								near_rate = map->rm_rate;
 								near_match = imp;
 								match = 0;
@@ -3328,18 +3519,18 @@
 					char *prefs[1];
 					char tmp[80];
 					int num;
-					
+
 					switch_snprintf(tmp, sizeof(tmp), "%s@%uh@%ui", near_match->iananame, near_rate ? near_rate : near_match->samples_per_second, ptime);
-					
+
 					prefs[0] = tmp;
 					num = switch_loadable_module_get_codecs_sorted(search, 1, prefs, 1);
-					
+
 					if (num) {
 						mimp = search[0];
 					} else {
 						mimp = near_match;
 					}
-					
+
 					if (!maxptime || mimp->microseconds_per_packet / 1000 <= maxptime) {
 						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Substituting codec %s@%ui@%uh\n",
 										  mimp->iananame, mimp->microseconds_per_packet / 1000, mimp->samples_per_second);
@@ -3348,7 +3539,7 @@
 						mimp = NULL;
 						match = 0;
 					}
-					
+
 				}
 
 				if (!match && greedy) {
@@ -3362,7 +3553,7 @@
 					tech_pvt->iananame = switch_core_session_strdup(session, (char *) mimp->iananame);
 					tech_pvt->pt = (switch_payload_t) map->rm_pt;
 					tech_pvt->rm_rate = map->rm_rate;
-					if (!strcasecmp((char *) mimp->iananame, "ilbc") && zstr((char*)map->rm_fmtp)) {
+					if (!strcasecmp((char *) mimp->iananame, "ilbc") && zstr((char *) map->rm_fmtp)) {
 						/* default to 30 when no mode is defined for ilbc ONLY */
 						tech_pvt->codec_ms = 30;
 					} else {
@@ -3471,8 +3662,8 @@
 			}
 		}
 	}
-	
- done:
+
+  done:
 	tech_pvt->cng_pt = cng_pt;
 	sofia_set_flag_locked(tech_pvt, TFLAG_SDP);
 
@@ -3553,9 +3744,9 @@
 		other_channel = switch_core_session_get_channel(other_session);
 		switch_channel_set_variable(other_channel, SWITCH_B_SDP_VARIABLE, sdp);
 
-		if (!sofia_test_flag(tech_pvt, TFLAG_CHANGE_MEDIA) && (switch_channel_test_flag(other_channel, CF_OUTBOUND) &&
-																switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND) &&
-																switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE))) {
+		if (!sofia_test_flag(tech_pvt, TFLAG_CHANGE_MEDIA) && !sofia_test_flag(tech_pvt, TFLAG_RECOVERING) &&
+			(switch_channel_test_flag(other_channel, CF_OUTBOUND) &&
+			 switch_channel_test_flag(tech_pvt->channel, CF_OUTBOUND) && switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MODE))) {
 			switch_ivr_nomedia(val, SMF_FORCE);
 			sofia_set_flag_locked(tech_pvt, TFLAG_CHANGE_MEDIA);
 		}
@@ -3656,12 +3847,12 @@
 	}
 }
 
-void sofia_glue_restart_all_profiles(void) 
+void sofia_glue_restart_all_profiles(void)
 {
 	switch_hash_index_t *hi;
 	const void *var;
-    void *val;
-    sofia_profile_t *pptr;
+	void *val;
+	sofia_profile_t *pptr;
 	switch_xml_t xml_root;
 	const char *err;
 
@@ -3672,9 +3863,9 @@
 
 	switch_mutex_lock(mod_sofia_globals.hash_mutex);
 	if (mod_sofia_globals.profile_hash) {
-        for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+		for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
 			switch_hash_this(hi, &var, NULL, &val);
-            if ((pptr = (sofia_profile_t *) val)) {
+			if ((pptr = (sofia_profile_t *) val)) {
 				int rsec = 10;
 				int diff = (int) (switch_epoch_time_now(NULL) - pptr->started);
 				int remain = rsec - diff;
@@ -3683,7 +3874,7 @@
 				}
 
 				if (diff < rsec) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
 									  "Profile %s must be up for at least %d seconds to stop/restart.\nPlease wait %d second%s\n",
 									  pptr->name, rsec, remain, remain == 1 ? "" : "s");
 					continue;
@@ -3735,6 +3926,342 @@
 	switch_mutex_unlock(mod_sofia_globals.hash_mutex);
 }
 
+
+static int rebridge_callback(void *pArg, int argc, char **argv, char **columnNames)
+{
+	char *uuid = argv[2];
+	switch_core_session_t *session;
+
+	if ((session = switch_core_session_locate(uuid))) {
+		switch_channel_t *channel = switch_core_session_get_channel(session);
+		private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
+
+		if (sofia_test_flag(tech_pvt, TFLAG_RECOVERING_BRIDGE)) {
+			switch_channel_wait_for_state_timeout(channel, CS_INIT, 10000);
+			switch_channel_set_state(channel, CS_RESET);
+		}
+		switch_core_session_rwunlock(session);
+	}
+
+	return 0;
+}
+
+struct recover_helper {
+	sofia_profile_t *profile;
+	int total;
+};
+
+
+static int recover_callback(void *pArg, int argc, char **argv, char **columnNames)
+{
+	struct recover_helper *h = (struct recover_helper *) pArg;
+	switch_xml_t xml;
+	switch_core_session_t *session;
+	switch_channel_t *channel;
+	private_object_t *tech_pvt = NULL;
+	const char *tmp;
+
+	xml = switch_xml_parse_str_dynamic(argv[3], SWITCH_TRUE);
+
+	if (!xml)
+		return 0;
+
+	if (!(session = switch_core_session_request_xml(sofia_endpoint_interface, NULL, xml))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "skipping non-bridged entry\n");
+		return 0;
+	}
+
+	if (!(tech_pvt = (private_object_t *) switch_core_session_alloc(session, sizeof(private_object_t)))) {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Hey where is my memory pool?\n");
+		switch_core_session_destroy(&session);
+		return 0;
+	}
+
+	channel = tech_pvt->channel = switch_core_session_get_channel(session);
+
+	switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+	switch_mutex_init(&tech_pvt->sofia_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+
+	tech_pvt->remote_ip = (char *) switch_channel_get_variable(channel, "sip_network_ip");
+	tech_pvt->remote_port = atoi(switch_str_nil(switch_channel_get_variable(channel, "sip_network_port")));
+	tech_pvt->caller_profile = switch_channel_get_caller_profile(channel);
+
+
+
+
+
+	if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
+		tech_pvt->dest = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_req_uri"));
+		switch_channel_set_variable(channel, "sip_invite_full_via", switch_channel_get_variable(channel, "sip_full_via"));
+
+		switch_channel_set_variable(channel, "sip_handle_full_from", switch_channel_get_variable(channel, "sip_full_from"));
+		switch_channel_set_variable(channel, "sip_handle_full_to", switch_channel_get_variable(channel, "sip_full_to"));
+	} else {
+
+
+		switch_channel_set_variable_printf(channel, "sip_invite_route_uri", "<sip:%s@%s:%s;lr>",
+										   switch_channel_get_variable(channel, "sip_from_user"),
+										   switch_channel_get_variable(channel, "sip_network_ip"), switch_channel_get_variable(channel, "sip_network_port")
+			);
+
+		tech_pvt->dest = switch_core_session_sprintf(session, "sip:%s", switch_channel_get_variable(channel, "sip_from_uri"));
+
+		if (!switch_channel_get_variable_dup(channel, "sip_handle_full_from", SWITCH_FALSE)) {
+			switch_channel_set_variable(channel, "sip_handle_full_from", switch_channel_get_variable(channel, "sip_full_to"));
+		}
+
+		if (!switch_channel_get_variable_dup(channel, "sip_handle_full_to", SWITCH_FALSE)) {
+			switch_channel_set_variable(channel, "sip_handle_full_to", switch_channel_get_variable(channel, "sip_full_from"));
+		}
+	}
+
+	tech_pvt->dest_to = tech_pvt->dest;
+
+	sofia_glue_attach_private(session, h->profile, tech_pvt, NULL);
+	switch_channel_set_name(tech_pvt->channel, switch_channel_get_variable(channel, "channel_name"));
+
+
+	if ((tmp = switch_channel_get_variable(channel, "sip_local_sdp_str"))) {
+		tech_pvt->local_sdp_str = switch_core_session_strdup(session, tmp);
+	}
+
+	if ((tmp = switch_channel_get_variable(channel, "switch_r_sdp"))) {
+		tech_pvt->remote_sdp_str = switch_core_session_strdup(session, tmp);
+	}
+
+	switch_channel_set_variable(channel, "sip_invite_call_id", switch_channel_get_variable(channel, "sip_call_id"));
+
+	if (switch_true(switch_channel_get_variable(channel, "sip_nat_detected"))) {
+		switch_channel_set_variable_printf(channel, "sip_route_uri", "sip:%s@%s:%s",
+										   switch_channel_get_variable(channel, "sip_req_user"),
+										   switch_channel_get_variable(channel, "sip_network_ip"), switch_channel_get_variable(channel, "sip_network_port")
+			);
+	}
+
+	if (session) {
+		switch_caller_extension_t *extension = NULL;
+		const char *ip = switch_channel_get_variable(channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE);
+		const char *port = switch_channel_get_variable(channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE);
+		const char *r_ip = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE);
+		const char *r_port = switch_channel_get_variable(channel, SWITCH_REMOTE_MEDIA_PORT_VARIABLE);
+
+		if (!switch_channel_test_flag(channel, CF_PROXY_MODE) && ip && port) {
+			const char *tmp;
+			tech_pvt->iananame = tech_pvt->rm_encoding = (char *) switch_channel_get_variable(channel, "sip_use_codec_name");
+			tech_pvt->rm_fmtp = (char *) switch_channel_get_variable(channel, "sip_use_codec_fmtp");
+
+			if ((tmp = switch_channel_get_variable(channel, "sip_use_codec_rate"))) {
+				tech_pvt->rm_rate = atoi(tmp);
+			}
+
+			if ((tmp = switch_channel_get_variable(channel, "sip_use_codec_ptime"))) {
+				tech_pvt->codec_ms = atoi(tmp);
+			}
+
+			if ((tmp = switch_channel_get_variable(channel, "sip_use_pt"))) {
+				tech_pvt->agreed_pt = atoi(tmp);
+			}
+
+			sofia_glue_tech_set_codec(tech_pvt, 1);
+
+			tech_pvt->adv_sdp_audio_ip = tech_pvt->extrtpip = (char *) ip;
+			tech_pvt->adv_sdp_audio_port = tech_pvt->local_sdp_audio_port = atoi(port);
+			tech_pvt->local_sdp_audio_ip = tech_pvt->profile->rtpip;
+
+			if (r_ip && r_port) {
+				tech_pvt->remote_sdp_audio_ip = (char *) r_ip;
+				tech_pvt->remote_sdp_audio_port = atoi(r_port);
+			}
+			
+			if (switch_channel_test_flag(channel, CF_VIDEO)) {								
+				if ((tmp = switch_channel_get_variable(channel, "sip_use_video_pt"))) {
+					tech_pvt->video_pt = tech_pvt->video_agreed_pt = atoi(tmp);
+				}
+				
+
+				tech_pvt->video_rm_encoding = (char *) switch_channel_get_variable(channel, "sip_use_video_codec_name");
+				tech_pvt->video_rm_fmtp = (char *) switch_channel_get_variable(channel, "sip_use_video_codec_fmtp");
+
+				ip = switch_channel_get_variable(channel, SWITCH_LOCAL_VIDEO_IP_VARIABLE);
+				port = switch_channel_get_variable(channel, SWITCH_LOCAL_VIDEO_PORT_VARIABLE);
+				r_ip = switch_channel_get_variable(channel, SWITCH_REMOTE_VIDEO_IP_VARIABLE);
+				r_port = switch_channel_get_variable(channel, SWITCH_REMOTE_VIDEO_PORT_VARIABLE);
+				
+				sofia_set_flag(tech_pvt, TFLAG_VIDEO);
+
+				if ((tmp = switch_channel_get_variable(channel, "sip_use_video_codec_rate"))) {
+					tech_pvt->video_rm_rate = atoi(tmp);
+				}
+				
+				if ((tmp = switch_channel_get_variable(channel, "sip_use_video_codec_ptime"))) {
+					tech_pvt->video_codec_ms = atoi(tmp);
+				}
+
+				tech_pvt->adv_sdp_video_port = tech_pvt->local_sdp_video_port = atoi(port);
+				
+				if (r_ip && r_port) {
+					tech_pvt->remote_sdp_video_ip = (char *) r_ip;
+					tech_pvt->remote_sdp_video_port = atoi(r_port);
+				}
+
+				//sofia_glue_tech_set_video_codec(tech_pvt, 1);
+			}
+
+			sofia_glue_set_local_sdp(tech_pvt, NULL, 0, NULL, 1);
+			
+			sofia_glue_activate_rtp(tech_pvt, 0);
+		}
+
+		sofia_set_flag(tech_pvt, TFLAG_RECOVERING);
+
+		if (switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) {
+			sofia_set_flag(tech_pvt, TFLAG_RECOVERING_BRIDGE);
+		} else {
+			switch_xml_t callflow, param, x_extension;
+			if ((extension = switch_caller_extension_new(session, "recovery", "recovery")) == 0) {
+				abort();
+			}
+
+			if ((callflow = switch_xml_child(xml, "callflow")) && (x_extension = switch_xml_child(callflow, "extension"))) {
+				for (param = switch_xml_child(x_extension, "application"); param; param = param->next) {
+					const char *var = switch_xml_attr_soft(param, "app_name");
+					const char *val = switch_xml_attr_soft(param, "app_data");
+					switch_caller_extension_add_application(session, extension, var, val);
+				}
+			}
+			
+			switch_channel_set_caller_extension(channel, extension);
+		}
+
+		switch_channel_set_state(channel, CS_INIT);
+	}
+
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Resurrecting fallen channel %s\n", switch_channel_get_name(channel));
+
+	switch_core_session_thread_launch(session);
+	switch_xml_free(xml);
+
+	h->total++;
+
+	return 0;
+
+}
+
+int sofia_glue_recover(switch_bool_t flush)
+{
+	switch_hash_index_t *hi;
+	const void *var;
+	void *val;
+	sofia_profile_t *profile;
+	char *sql;
+	int r = 0;
+
+	switch_mutex_lock(mod_sofia_globals.hash_mutex);
+	if (mod_sofia_globals.profile_hash) {
+		for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
+			switch_hash_this(hi, &var, NULL, &val);
+
+			if ((profile = (sofia_profile_t *) val)) {
+				struct recover_helper h = { 0 };
+				h.profile = profile;
+				h.total = 0;
+
+				if (strcmp((char *) var, profile->name)) {
+					continue;
+				}
+
+				if (flush) {
+					sql = switch_mprintf("delete from sip_recovery where profile_name='%q'", profile->name);
+					sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
+				} else {
+
+					sql = switch_mprintf("select profile_name, hostname, uuid, metadata "
+										 "from sip_recovery where runtime_uuid!='%q' and profile_name='%q'", switch_core_get_uuid(), profile->name);
+
+					sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, recover_callback, &h);
+					r += h.total;
+					free(sql);
+					sql = NULL;
+
+					sql = switch_mprintf("select profile_name, hostname, uuid "
+										 "from sip_recovery where runtime_uuid!='%q' and profile_name='%q'", switch_core_get_uuid(), profile->name);
+
+					sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, rebridge_callback, NULL);
+					free(sql);
+					sql = NULL;
+
+					sql = switch_mprintf("delete "
+										 "from sip_recovery where runtime_uuid!='%q' and profile_name='%q'", switch_core_get_uuid(), profile->name);
+
+					sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
+				}
+			}
+		}
+	}
+	switch_mutex_unlock(mod_sofia_globals.hash_mutex);
+
+	return r;
+}
+
+void sofia_glue_tech_untrack(sofia_profile_t *profile, switch_core_session_t *session, switch_bool_t force)
+{
+	char *sql;
+	private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
+
+	if (!sofia_test_pflag(profile, PFLAG_TRACK_CALLS) || (sofia_test_flag(tech_pvt, TFLAG_RECOVERING))) {
+		return;
+	}
+
+	if (sofia_test_pflag(profile, PFLAG_TRACK_CALLS) && (sofia_test_flag(tech_pvt, TFLAG_TRACKED) || force)) {
+
+		if (force) {
+			sql = switch_mprintf("delete from sip_recovery where uuid='%q'", switch_core_session_get_uuid(session));
+
+		} else {
+			sql = switch_mprintf("delete from sip_recovery where runtime_uuid='%q' and uuid='%q'",
+								 switch_core_get_uuid(), switch_core_session_get_uuid(session));
+		}
+		sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
+		sofia_clear_flag(tech_pvt, TFLAG_TRACKED);
+	}
+}
+
+void sofia_glue_tech_track(sofia_profile_t *profile, switch_core_session_t *session)
+{
+	switch_event_t *event;
+	private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
+
+	if (!sofia_test_pflag(profile, PFLAG_TRACK_CALLS) || sofia_test_flag(tech_pvt, TFLAG_RECOVERING)) {
+		return;
+	}
+
+	if (sofia_test_flag(tech_pvt, TFLAG_TRACKED)) {
+		sofia_glue_tech_untrack(profile, session, SWITCH_TRUE);
+	}
+
+	if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) {
+		switch_xml_t cdr = NULL;
+		char *xml_cdr_text = NULL;
+
+		if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) {
+			xml_cdr_text = switch_xml_toxml(cdr, SWITCH_FALSE);
+			switch_xml_free(cdr);
+		}
+
+		if (xml_cdr_text) {
+			char *sql;
+			sql = switch_mprintf("insert into sip_recovery (runtime_uuid, profile_name, hostname, uuid, metadata) values ('%q','%q','%q','%q','%q')",
+								 switch_core_get_uuid(), profile->name, mod_sofia_globals.hostname, switch_core_session_get_uuid(session), xml_cdr_text);
+
+			sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
+			free(xml_cdr_text);
+			sofia_set_flag(tech_pvt, TFLAG_TRACKED);
+		}
+
+	}
+
+}
+
 int sofia_glue_init_sql(sofia_profile_t *profile)
 {
 	char *test_sql = NULL;
@@ -3743,41 +4270,44 @@
 
 	char reg_sql[] =
 		"CREATE TABLE sip_registrations (\n"
-		"   call_id         VARCHAR(255),\n"
-		"   sip_user        VARCHAR(255),\n"
-		"   sip_host        VARCHAR(255),\n"
-		"   presence_hosts  VARCHAR(255),\n"
-		"   contact         VARCHAR(1024),\n"
-		"   status          VARCHAR(255),\n"
-		"   rpid            VARCHAR(255),\n" 
-		"   expires         INTEGER,\n" 
-		"   user_agent      VARCHAR(255),\n" 
-		"   server_user     VARCHAR(255),\n"
-		"   server_host     VARCHAR(255),\n" 
-		"   profile_name    VARCHAR(255),\n" 
-		"   hostname        VARCHAR(255),\n" 
-		"   network_ip      VARCHAR(255),\n" 
-		"   network_port    VARCHAR(6),\n" 
-		"   sip_username    VARCHAR(255),\n" 
-		"   sip_realm       VARCHAR(255),\n"
-		"   mwi_user        VARCHAR(255),\n"
-		"   mwi_host        VARCHAR(255)\n"
+		"   call_id          VARCHAR(255),\n"
+		"   sip_user         VARCHAR(255),\n"
+		"   sip_host         VARCHAR(255),\n"
+		"   presence_hosts   VARCHAR(255),\n"
+		"   contact          VARCHAR(1024),\n"
+		"   status           VARCHAR(255),\n"
+		"   rpid             VARCHAR(255),\n" 
+		"   expires          INTEGER,\n" 
+		"   user_agent       VARCHAR(255),\n" 
+		"   server_user      VARCHAR(255),\n"
+		"   server_host      VARCHAR(255),\n" 
+		"   profile_name     VARCHAR(255),\n" 
+		"   hostname         VARCHAR(255),\n" 
+		"   network_ip       VARCHAR(255),\n" 
+		"   network_port     VARCHAR(6),\n" 
+		"   sip_username     VARCHAR(255),\n" 
+		"   sip_realm        VARCHAR(255),\n"
+		"   mwi_user         VARCHAR(255),\n"
+		"   mwi_host         VARCHAR(255),\n"
+		"   orig_server_host VARCHAR(255),\n"
+		"   orig_hostname    VARCHAR(255)\n"
 		");\n";
 
+	char recovery_sql[] =
+		"CREATE TABLE sip_recovery (\n"
+		"   runtime_uuid    VARCHAR(255),\n"
+		"   profile_name    VARCHAR(255),\n" "   hostname        VARCHAR(255),\n" "   uuid            VARCHAR(255),\n" "   metadata        text\n" ");\n";
 
 	char pres_sql[] =
 		"CREATE TABLE sip_presence (\n"
 		"   sip_user        VARCHAR(255),\n"
 		"   sip_host        VARCHAR(255),\n"
 		"   status          VARCHAR(255),\n"
-		"   rpid            VARCHAR(255),\n" 
-		"   expires         INTEGER,\n" 
-		"   user_agent      VARCHAR(255),\n" 
-		"   profile_name    VARCHAR(255),\n" 
-		"   hostname        VARCHAR(255),\n" 
-		"   network_ip      VARCHAR(255),\n" 
-		"   network_port    VARCHAR(6)\n" 
-		");\n";
+		"   rpid            VARCHAR(255),\n"
+		"   expires         INTEGER,\n"
+		"   user_agent      VARCHAR(255),\n"
+		"   profile_name    VARCHAR(255),\n"
+		"   hostname        VARCHAR(255),\n" "   network_ip      VARCHAR(255),\n" "   network_port    VARCHAR(6)\n" ");\n";
 
 	char dialog_sql[] =
 		"CREATE TABLE sip_dialogs (\n"
@@ -3789,15 +4319,15 @@
 		"   sip_from_host   VARCHAR(255),\n"
 		"   contact_user    VARCHAR(255),\n"
 		"   contact_host    VARCHAR(255),\n"
-		"   state           VARCHAR(255),\n" 
-		"   direction       VARCHAR(255),\n" 
-		"   user_agent      VARCHAR(255),\n" 
+		"   state           VARCHAR(255),\n"
+		"   direction       VARCHAR(255),\n"
+		"   user_agent      VARCHAR(255),\n"
 		"   profile_name    VARCHAR(255),\n"
-        "   hostname        VARCHAR(255),\n"
-        "   contact         VARCHAR(255),\n"
-        "   presence_id     VARCHAR(255),\n"
-        "   presence_data   VARCHAR(255)\n"
-		");\n";
+		"   hostname        VARCHAR(255),\n"
+		"   contact         VARCHAR(255),\n"
+		"   presence_id     VARCHAR(255),\n"
+		"   presence_data   VARCHAR(255),\n"
+		"   call_info       VARCHAR(255),\n" "   call_info_state VARCHAR(255),\n" "   expires         INTEGER default 0\n" ");\n";
 
 	char sub_sql[] =
 		"CREATE TABLE sip_subscriptions (\n"
@@ -3812,45 +4342,32 @@
 		"   call_id         VARCHAR(255),\n"
 		"   full_from       VARCHAR(255),\n"
 		"   full_via        VARCHAR(255),\n"
-		"   expires         INTEGER,\n" 
-		"   user_agent      VARCHAR(255),\n" 
+		"   expires         INTEGER,\n"
+		"   user_agent      VARCHAR(255),\n"
 		"   accept          VARCHAR(255),\n"
 		"   profile_name    VARCHAR(255),\n"
-		"   hostname        VARCHAR(255),\n"
-		"   network_port    VARCHAR(6),\n"
-		"   network_ip      VARCHAR(255)\n"
-		");\n";
+		"   hostname        VARCHAR(255),\n" "   network_port    VARCHAR(6),\n" "   network_ip      VARCHAR(255)\n" ");\n";
 
-	char auth_sql[] = 
-		"CREATE TABLE sip_authentication (\n" 
-		"   nonce           VARCHAR(255),\n" 
-		"   expires         INTEGER," 
-		"   profile_name    VARCHAR(255),\n"
-		"   hostname        VARCHAR(255),\n"
-		"   last_nc         INTEGER\n"
-		");\n";
+	char auth_sql[] =
+		"CREATE TABLE sip_authentication (\n"
+		"   nonce           VARCHAR(255),\n"
+		"   expires         INTEGER," "   profile_name    VARCHAR(255),\n" "   hostname        VARCHAR(255),\n" "   last_nc         INTEGER\n" ");\n";
 
 	/* should we move this glue to sofia_sla or keep it here where all db init happens? XXX MTK */
-	char shared_appearance_sql[] = 
+	char shared_appearance_sql[] =
 		"CREATE TABLE sip_shared_appearance_subscriptions (\n"
 		"   subscriber        VARCHAR(255),\n"
 		"   call_id           VARCHAR(255),\n"
 		"   aor               VARCHAR(255),\n"
 		"   profile_name      VARCHAR(255),\n"
-		"   hostname          VARCHAR(255),\n"
-		"   contact_str       VARCHAR(255),\n"
-		"   network_ip        VARCHAR(255)\n" 
-		");\n";
+		"   hostname          VARCHAR(255),\n" "   contact_str       VARCHAR(255),\n" "   network_ip        VARCHAR(255)\n" ");\n";
 
-	char shared_appearance_dialogs_sql[] = 
+	char shared_appearance_dialogs_sql[] =
 		"CREATE TABLE sip_shared_appearance_dialogs (\n"
 		"   profile_name      VARCHAR(255),\n"
 		"   hostname          VARCHAR(255),\n"
 		"   contact_str       VARCHAR(255),\n"
-		"   call_id           VARCHAR(255),\n"
-		"   network_ip        VARCHAR(255),\n"
-		"   expires           INTEGER\n"
-		");\n";
+		"   call_id           VARCHAR(255),\n" "   network_ip        VARCHAR(255),\n" "   expires           INTEGER\n" ");\n";
 
 	if (switch_odbc_available() && profile->odbc_dsn) {
 		int x;
@@ -3868,9 +4385,11 @@
 			"create index sr_network_port on sip_registrations (network_port)",
 			"create index sr_sip_username on sip_registrations (sip_username)",
 			"create index sr_sip_realm on sip_registrations (sip_realm)",
+			"create index sr_orig_server_host on sip_registrations (orig_server_host)",
+			"create index sr_orig_hostname on sip_registrations (orig_hostname)",
 			"create index ss_call_id on sip_subscriptions (call_id)",
 			"create index ss_hostname on sip_subscriptions (hostname)",
-			"create index ss_hostname on sip_subscriptions (network_ip)",
+			"create index ss_network_ip on sip_subscriptions (network_ip)",
 			"create index ss_sip_user on sip_subscriptions (sip_user)",
 			"create index ss_sip_host on sip_subscriptions (sip_host)",
 			"create index ss_presence_hosts on sip_subscriptions (presence_hosts)",
@@ -3880,23 +4399,24 @@
 			"create index ss_sub_to_host on sip_subscriptions (sub_to_host)",
 			"create index sd_uuid on sip_dialogs (uuid)",
 			"create index sd_hostname on sip_dialogs (hostname)",
+			"create index sd_presence_data on sip_dialogs (presence_data)",
+			"create index sd_call_info on sip_dialogs (call_info)",
+			"create index sd_call_info_state on sip_dialogs (call_info_state)",
+			"create index sd_expires on sip_dialogs (expires)",
 			"create index sp_hostname on sip_presence (hostname)",
 			"create index sa_nonce on sip_authentication (nonce)",
 			"create index sa_hostname on sip_authentication (hostname)",
 			"create index ssa_hostname on sip_shared_appearance_subscriptions (hostname)",
-			"create index ssa_hostname on sip_shared_appearance_subscriptions (network_ip)",
+			"create index ssa_network_ip on sip_shared_appearance_subscriptions (network_ip)",
 			"create index ssa_subscriber on sip_shared_appearance_subscriptions (subscriber)",
 			"create index ssa_profile_name on sip_shared_appearance_subscriptions (profile_name)",
 			"create index ssa_aor on sip_shared_appearance_subscriptions (aor)",
 			"create index ssd_profile_name on sip_shared_appearance_dialogs (profile_name)",
-			"create index ssd_contact on sip_shared_appearance_dialogs (contact)",
-			"create index ssd_presence_id on sip_shared_appearance_dialogs (presence_id)",
-			"create index ssd_presence_data on sip_shared_appearance_dialogs (presence_data)",
 			"create index ssd_hostname on sip_shared_appearance_dialogs (hostname)",
 			"create index ssd_contact_str on sip_shared_appearance_dialogs (contact_str)",
 			"create index ssd_call_id on sip_shared_appearance_dialogs (call_id)",
 			"create index ssd_expires on sip_shared_appearance_dialogs (expires)",
-			NULL	
+			NULL
 		};
 
 
@@ -3909,89 +4429,101 @@
 			switch_odbc_handle_destroy(&odbc_dbh);
 			return 0;
 		}
-		
+
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: %s\n", profile->odbc_dsn);
-		
+
 		test_sql = switch_mprintf("delete from sip_registrations where (contact like '%%TCP%%' "
 								  "or status like '%%TCP%%' or status like '%%TLS%%') and hostname='%q' "
 								  "and network_ip like '%%' and network_port like '%%' and sip_username "
-								  "like '%%' and mwi_user  like '%%' and mwi_host like '%%'", 
+								  "like '%%' and mwi_user  like '%%' and mwi_host like '%%' "
+								  "and orig_server_host like '%%' and orig_hostname like '%%'", 
 								  mod_sofia_globals.hostname);
 
-		if (switch_odbc_handle_exec(odbc_dbh, test_sql, NULL) != SWITCH_ODBC_SUCCESS) {
-			switch_odbc_handle_exec(odbc_dbh, "DROP TABLE sip_registrations", NULL);
-			switch_odbc_handle_exec(odbc_dbh, reg_sql, NULL);
+		if (switch_odbc_handle_exec(odbc_dbh, test_sql, NULL, NULL) != SWITCH_ODBC_SUCCESS) {
+			switch_odbc_handle_exec(odbc_dbh, "DROP TABLE sip_registrations", NULL, NULL);
+			switch_odbc_handle_exec(odbc_dbh, reg_sql, NULL, NULL);
 		}
 
 
-
 		if (sofia_test_pflag(profile, PFLAG_SQL_IN_TRANS)) {
 			char *test2 = switch_mprintf("%s;%s", test_sql, test_sql);
 
-			if (switch_odbc_handle_exec(odbc_dbh, test2, NULL) != SWITCH_ODBC_SUCCESS) {
+			if (switch_odbc_handle_exec(odbc_dbh, test2, NULL, NULL) != SWITCH_ODBC_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "GREAT SCOTT!!! Cannot execute batched statements!\n"
 								  "If you are using mysql, make sure you are using MYODBC 3.51.18 or higher and enable FLAG_MULTI_STATEMENTS\n");
 				sofia_clear_pflag(profile, PFLAG_SQL_IN_TRANS);
-				
+
 			}
 			free(test2);
 		}
 
-		free(test_sql);		
+		free(test_sql);
 
 
-		test_sql = switch_mprintf("delete from sip_subscriptions where hostname='%q' and network_ip like '%%' and network_port like '%%'", 
+		test_sql = switch_mprintf("delete from sip_subscriptions where hostname='%q' and network_ip like '%%' and network_port like '%%'",
 								  mod_sofia_globals.hostname);
 
-		if (switch_odbc_handle_exec(odbc_dbh, test_sql, NULL) != SWITCH_ODBC_SUCCESS) {
-			switch_odbc_handle_exec(odbc_dbh, "DROP TABLE sip_subscriptions", NULL);
-			switch_odbc_handle_exec(odbc_dbh, sub_sql, NULL);
+		if (switch_odbc_handle_exec(odbc_dbh, test_sql, NULL, NULL) != SWITCH_ODBC_SUCCESS) {
+			switch_odbc_handle_exec(odbc_dbh, "DROP TABLE sip_subscriptions", NULL, NULL);
+			switch_odbc_handle_exec(odbc_dbh, sub_sql, NULL, NULL);
 		}
 
 		free(test_sql);
-		test_sql = switch_mprintf("delete from sip_dialogs where hostname='%q' and contact like '%%'", mod_sofia_globals.hostname);
+		test_sql = switch_mprintf("delete from sip_dialogs where hostname='%q' and expires <> -9999", mod_sofia_globals.hostname);
 
-		if (switch_odbc_handle_exec(odbc_dbh, test_sql, NULL) != SWITCH_ODBC_SUCCESS) {
-			switch_odbc_handle_exec(odbc_dbh, "DROP TABLE sip_dialogs", NULL);
-			switch_odbc_handle_exec(odbc_dbh, dialog_sql, NULL);
+		if (switch_odbc_handle_exec(odbc_dbh, test_sql, NULL, NULL) != SWITCH_ODBC_SUCCESS) {
+			switch_odbc_handle_exec(odbc_dbh, "DROP TABLE sip_dialogs", NULL, NULL);
+			switch_odbc_handle_exec(odbc_dbh, dialog_sql, NULL, NULL);
 		}
 
-		test_sql = switch_mprintf("delete from sip_presence where hostname='%q'", mod_sofia_globals.hostname);
+		test_sql = switch_mprintf("delete from sip_presence where hostname='%q' ", mod_sofia_globals.hostname);
 
-		if (switch_odbc_handle_exec(odbc_dbh, test_sql, NULL) != SWITCH_ODBC_SUCCESS) {
-			switch_odbc_handle_exec(odbc_dbh, "DROP TABLE sip_presence", NULL);
-			switch_odbc_handle_exec(odbc_dbh, pres_sql, NULL);
+		if (switch_odbc_handle_exec(odbc_dbh, test_sql, NULL, NULL) != SWITCH_ODBC_SUCCESS) {
+			switch_odbc_handle_exec(odbc_dbh, "DROP TABLE sip_presence", NULL, NULL);
+			switch_odbc_handle_exec(odbc_dbh, pres_sql, NULL, NULL);
 		}
 
 		free(test_sql);
 		test_sql = switch_mprintf("delete from sip_authentication where hostname='%q' or last_nc >= 0", mod_sofia_globals.hostname);
 
-		if (switch_odbc_handle_exec(odbc_dbh, test_sql, NULL) != SWITCH_ODBC_SUCCESS) {
-			switch_odbc_handle_exec(odbc_dbh, "DROP TABLE sip_authentication", NULL);
-			switch_odbc_handle_exec(odbc_dbh, auth_sql, NULL);
+		if (switch_odbc_handle_exec(odbc_dbh, test_sql, NULL, NULL) != SWITCH_ODBC_SUCCESS) {
+			switch_odbc_handle_exec(odbc_dbh, "DROP TABLE sip_authentication", NULL, NULL);
+			switch_odbc_handle_exec(odbc_dbh, auth_sql, NULL, NULL);
 		}
 		free(test_sql);
 
 		test_sql = switch_mprintf("delete from sip_shared_appearance_subscriptions where contact_str='' or hostname='%q' and network_ip like '%%'",
 								  mod_sofia_globals.hostname);
-		if (switch_odbc_handle_exec(odbc_dbh, test_sql, NULL) != SWITCH_ODBC_SUCCESS) {
-			switch_odbc_handle_exec(odbc_dbh, "DROP TABLE sip_shared_appearance_subscriptions", NULL);
-			switch_odbc_handle_exec(odbc_dbh, shared_appearance_sql, NULL);
+		if (switch_odbc_handle_exec(odbc_dbh, test_sql, NULL, NULL) != SWITCH_ODBC_SUCCESS) {
+			switch_odbc_handle_exec(odbc_dbh, "DROP TABLE sip_shared_appearance_subscriptions", NULL, NULL);
+			switch_odbc_handle_exec(odbc_dbh, shared_appearance_sql, NULL, NULL);
 		}
 		free(test_sql);
 
 
 		test_sql = switch_mprintf("delete from sip_shared_appearance_dialogs where contact_str='' or hostname='%q' and network_ip like '%%'",
 								  mod_sofia_globals.hostname);
-		if (switch_odbc_handle_exec(odbc_dbh, test_sql, NULL) != SWITCH_ODBC_SUCCESS) {
-			switch_odbc_handle_exec(odbc_dbh, "DROP TABLE sip_shared_appearance_dialogs", NULL);
-			switch_odbc_handle_exec(odbc_dbh, shared_appearance_dialogs_sql, NULL);
+		if (switch_odbc_handle_exec(odbc_dbh, test_sql, NULL, NULL) != SWITCH_ODBC_SUCCESS) {
+			switch_odbc_handle_exec(odbc_dbh, "DROP TABLE sip_shared_appearance_dialogs", NULL, NULL);
+			switch_odbc_handle_exec(odbc_dbh, shared_appearance_dialogs_sql, NULL, NULL);
 		}
 		free(test_sql);
 
 
+
+		test_sql = switch_mprintf("select count(profile_name) from sip_recovery where hostname='%q'", mod_sofia_globals.hostname);
+
+		if (switch_odbc_handle_exec(odbc_dbh, test_sql, NULL, NULL) != SWITCH_ODBC_SUCCESS) {
+			switch_odbc_handle_exec(odbc_dbh, "DROP TABLE sip_recovery", NULL, NULL);
+			switch_odbc_handle_exec(odbc_dbh, recovery_sql, NULL, NULL);
+		}
+
+		free(test_sql);
+
+
+
 		for (x = 0; indexes[x]; x++) {
-			switch_odbc_handle_exec(odbc_dbh, indexes[x], NULL);
+			switch_odbc_handle_exec(odbc_dbh, indexes[x], NULL, NULL);
 		}
 
 
@@ -4005,22 +4537,23 @@
 		test_sql = switch_mprintf("delete from sip_registrations where (contact like '%%TCP%%' "
 								  "or status like '%%TCP%%' or status like '%%TLS%%') and hostname='%q' "
 								  "and network_ip like '%%' and network_port like '%%' and sip_username "
-								  "like '%%' and mwi_user like '%%' and mwi_host like '%%'",
+								  "like '%%' and mwi_user like '%%' and mwi_host like '%%'"
+								  "and orig_server_host like '%%' and orig_hostname like '%%'", 
 								  mod_sofia_globals.hostname);
 		
 		switch_core_db_test_reactive(db, test_sql, "DROP TABLE sip_registrations", reg_sql);
 		free(test_sql);
 
-		test_sql = switch_mprintf("delete from sip_subscriptions where hostname='%q' and network_ip like '%%' or network_port like '%%'", 
+		test_sql = switch_mprintf("delete from sip_subscriptions where hostname='%q' and network_ip like '%%' or network_port like '%%'",
 								  mod_sofia_globals.hostname);
 		switch_core_db_test_reactive(db, test_sql, "DROP TABLE sip_subscriptions", sub_sql);
 		free(test_sql);
 
-		test_sql = switch_mprintf("delete from sip_dialogs where hostname='%q' and contact like '%%'", mod_sofia_globals.hostname);
+		test_sql = switch_mprintf("delete from sip_dialogs where hostname='%q' and expires <> -9999", mod_sofia_globals.hostname);
 		switch_core_db_test_reactive(db, test_sql, "DROP TABLE sip_dialogs", dialog_sql);
 		free(test_sql);
 
-		test_sql = switch_mprintf("delete from sip_presence where hostname='%q'", mod_sofia_globals.hostname);
+		test_sql = switch_mprintf("delete from sip_presence where hostname='%q' ", mod_sofia_globals.hostname);
 		switch_core_db_test_reactive(db, test_sql, "DROP TABLE sip_presence", pres_sql);
 		free(test_sql);
 
@@ -4028,40 +4561,38 @@
 		switch_core_db_test_reactive(db, test_sql, "DROP TABLE sip_authentication", auth_sql);
 		free(test_sql);
 
-		
+
 		test_sql = switch_mprintf("delete from sip_shared_appearance_subscriptions where contact_str = '' or hostname='%q' and network_ip like '%%'",
 								  mod_sofia_globals.hostname);
 		switch_core_db_test_reactive(db, test_sql, "DROP TABLE sip_shared_appearance_subscriptions", shared_appearance_sql);
 		free(test_sql);
 
-		test_sql = switch_mprintf("delete from sip_shared_appearance_dialogs where contact_str = '' or hostname='%q'", mod_sofia_globals.hostname);
+		test_sql = switch_mprintf("delete from sip_shared_appearance_dialogs where contact_str = '' or hostname='%q' and network_ip like '%%'", mod_sofia_globals.hostname);
 		switch_core_db_test_reactive(db, test_sql, "DROP TABLE sip_shared_appearance_dialogs", shared_appearance_dialogs_sql);
 		free(test_sql);
-		
-		switch_core_db_exec(db, "create index if not exists ssa_hostname on sip_shared_appearance_subscriptions (hostname)", 
-							NULL, NULL, NULL);
-		switch_core_db_exec(db, "create index if not exists ssa_subscriber on sip_shared_appearance_subscriptions (subscriber)", 
-							NULL, NULL, NULL);
-		switch_core_db_exec(db, "create index if not exists ssa_profile_name on sip_shared_appearance_subscriptions (profile_name)", 
-							NULL, NULL, NULL);
+
+
+		test_sql = switch_mprintf("select count(profile_name) from sip_recovery where hostname='%q'", mod_sofia_globals.hostname);
+
+		switch_core_db_test_reactive(db, test_sql, "DROP TABLE sip_recovery", recovery_sql);
+		free(test_sql);
+
+
+		switch_core_db_exec(db, "create index if not exists ssa_hostname on sip_shared_appearance_subscriptions (hostname)", NULL, NULL, NULL);
+		switch_core_db_exec(db, "create index if not exists ssa_subscriber on sip_shared_appearance_subscriptions (subscriber)", NULL, NULL, NULL);
+		switch_core_db_exec(db, "create index if not exists ssa_profile_name on sip_shared_appearance_subscriptions (profile_name)", NULL, NULL, NULL);
 		switch_core_db_exec(db, "create index if not exists ssa_aor on sip_shared_appearance_subscriptions (aor)", NULL, NULL, NULL);
-		
 
-		switch_core_db_exec(db, "create index if not exists ssd_profile_name on sip_shared_appearance_dialogs (profile_name)", 
-							NULL, NULL, NULL);
-		switch_core_db_exec(db, "create index if not exists ssd_hostname on sip_shared_appearance_dialogs (hostname)", 
-							NULL, NULL, NULL);
-		switch_core_db_exec(db, "create index if not exists ssd_hostname on sip_shared_appearance_dialogs (network_ip)", 
-							NULL, NULL, NULL);
-		switch_core_db_exec(db, "create index if not exists ssd_contact_str on sip_shared_appearance_dialogs (contact_str)",  
-							NULL, NULL, NULL);
-		switch_core_db_exec(db, "create index if not exists ssd_call_id on sip_shared_appearance_dialogs (call_id)",  
-							NULL, NULL, NULL);
-		switch_core_db_exec(db, "create index if not exists ssd_expires on sip_shared_appearance_dialogs (expires)", 
-							NULL, NULL, NULL);
-		
 
+		switch_core_db_exec(db, "create index if not exists ssd_profile_name on sip_shared_appearance_dialogs (profile_name)", NULL, NULL, NULL);
+		switch_core_db_exec(db, "create index if not exists ssd_hostname on sip_shared_appearance_dialogs (hostname)", NULL, NULL, NULL);
+		switch_core_db_exec(db, "create index if not exists ssd_network_ip on sip_shared_appearance_dialogs (network_ip)", NULL, NULL, NULL);
+		switch_core_db_exec(db, "create index if not exists ssd_contact_str on sip_shared_appearance_dialogs (contact_str)", NULL, NULL, NULL);
+		switch_core_db_exec(db, "create index if not exists ssd_call_id on sip_shared_appearance_dialogs (call_id)", NULL, NULL, NULL);
+		switch_core_db_exec(db, "create index if not exists ssd_expires on sip_shared_appearance_dialogs (expires)", NULL, NULL, NULL);
 
+
+
 		switch_core_db_exec(db, "create index if not exists sr_call_id on sip_registrations (call_id)", NULL, NULL, NULL);
 		switch_core_db_exec(db, "create index if not exists sr_sip_user on sip_registrations (sip_user)", NULL, NULL, NULL);
 		switch_core_db_exec(db, "create index if not exists sr_sip_host on sip_registrations (sip_host)", NULL, NULL, NULL);
@@ -4075,11 +4606,13 @@
 		switch_core_db_exec(db, "create index if not exists sr_network_port on sip_registrations (network_port)", NULL, NULL, NULL);
 		switch_core_db_exec(db, "create index if not exists sr_sip_username on sip_registrations (sip_username)", NULL, NULL, NULL);
 		switch_core_db_exec(db, "create index if not exists sr_sip_realm on sip_registrations (sip_realm)", NULL, NULL, NULL);
+		switch_core_db_exec(db, "create index if not exists sr_orig_server_host on sip_registrations (orig_server_host)", NULL, NULL, NULL);
+		switch_core_db_exec(db, "create index if not exists sr_orig_hostname on sip_registrations (orig_hostname)", NULL, NULL, NULL);
 
 
 		switch_core_db_exec(db, "create index if not exists ss_call_id on sip_subscriptions (call_id)", NULL, NULL, NULL);
 		switch_core_db_exec(db, "create index if not exists ss_hostname on sip_subscriptions (hostname)", NULL, NULL, NULL);
-		switch_core_db_exec(db, "create index if not exists ss_hostname on sip_subscriptions (network_ip)", NULL, NULL, NULL);
+		switch_core_db_exec(db, "create index if not exists ss_network_ip on sip_subscriptions (network_ip)", NULL, NULL, NULL);
 		switch_core_db_exec(db, "create index if not exists ss_sip_user on sip_subscriptions (sip_user)", NULL, NULL, NULL);
 		switch_core_db_exec(db, "create index if not exists ss_sip_host on sip_subscriptions (sip_host)", NULL, NULL, NULL);
 		switch_core_db_exec(db, "create index if not exists ss_presence_hosts on sip_subscriptions (presence_hosts)", NULL, NULL, NULL);
@@ -4090,9 +4623,12 @@
 
 		switch_core_db_exec(db, "create index if not exists sd_uuid on sip_dialogs (uuid)", NULL, NULL, NULL);
 		switch_core_db_exec(db, "create index if not exists sd_hostname on sip_dialogs (hostname)", NULL, NULL, NULL);
-		switch_core_db_exec(db, "create index if not exists sd_hostname on sip_dialogs (contact)", NULL, NULL, NULL);
-		switch_core_db_exec(db, "create index if not exists sd_hostname on sip_dialogs (presence_id)", NULL, NULL, NULL);
-		switch_core_db_exec(db, "create index if not exists sd_hostname on sip_dialogs (presence_data)", NULL, NULL, NULL);
+		switch_core_db_exec(db, "create index if not exists sd_contact on sip_dialogs (contact)", NULL, NULL, NULL);
+		switch_core_db_exec(db, "create index if not exists sd_presence_id on sip_dialogs (presence_id)", NULL, NULL, NULL);
+		switch_core_db_exec(db, "create index if not exists sd_presence_data on sip_dialogs (presence_data)", NULL, NULL, NULL);
+		switch_core_db_exec(db, "create index if not exists sd_call_info on sip_dialogs (call_info)", NULL, NULL, NULL);
+		switch_core_db_exec(db, "create index if not exists sd_call_info_state on sip_dialogs (call_info_state)", NULL, NULL, NULL);
+		switch_core_db_exec(db, "create index if not exists sd_expires on sip_dialogs (expires)", NULL, NULL, NULL);
 
 		switch_core_db_exec(db, "create index if not exists sp_hostname on sip_presence (hostname)", NULL, NULL, NULL);
 
@@ -4110,7 +4646,7 @@
 		return 1;
 	}
 
-	return 0;	
+	return 0;
 
 }
 
@@ -4148,22 +4684,34 @@
 	}
 }
 
+void sofia_glue_execute_sql_now(sofia_profile_t *profile, char **sqlp, switch_bool_t sql_already_dynamic)
+{
+	sofia_glue_actually_execute_sql(profile, *sqlp, profile->ireg_mutex);
+	if (sql_already_dynamic) {
+		switch_safe_free(*sqlp);
+	}
+	*sqlp = NULL;
+}
 
+
 switch_cache_db_handle_t *sofia_glue_get_db_handle(sofia_profile_t *profile)
 {
-	switch_cache_db_connection_options_t options = { {0} };
+	switch_cache_db_connection_options_t options = { {0}
+	};
 	switch_cache_db_handle_t *dbh = NULL;
-	
-	if (profile->odbc_dsn && profile->odbc_user && profile->odbc_pass) {
+
+	if (!zstr(profile->odbc_dsn)) {
 		options.odbc_options.dsn = profile->odbc_dsn;
 		options.odbc_options.user = profile->odbc_user;
 		options.odbc_options.pass = profile->odbc_pass;
 
-		if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_ODBC, &options) != SWITCH_STATUS_SUCCESS) dbh = NULL;
+		if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_ODBC, &options) != SWITCH_STATUS_SUCCESS)
+			dbh = NULL;
 		return dbh;
 	} else {
 		options.core_db_options.db_path = profile->dbname;
-		if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_CORE_DB, &options) != SWITCH_STATUS_SUCCESS) dbh = NULL;
+		if (switch_cache_db_get_db_handle(&dbh, SCDB_TYPE_CORE_DB, &options) != SWITCH_STATUS_SUCCESS)
+			dbh = NULL;
 		return dbh;
 	}
 }
@@ -4184,7 +4732,7 @@
 	switch_cache_db_persistant_execute_trans(dbh, sql, 1);
 
   end:
-	
+
 	switch_cache_db_release_db_handle(&dbh);
 
 	if (mutex) {
@@ -4208,7 +4756,7 @@
 	switch_cache_db_execute_sql(dbh, sql, NULL);
 
   end:
-	
+
 	switch_cache_db_release_db_handle(&dbh);
 
 	if (mutex) {
@@ -4222,16 +4770,16 @@
 	switch_bool_t ret = SWITCH_FALSE;
 	char *errmsg = NULL;
 	switch_cache_db_handle_t *dbh = NULL;
-	
+
 	if (mutex) {
 		switch_mutex_lock(mutex);
 	}
 
 	if (!(dbh = sofia_glue_get_db_handle(profile))) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
-        goto end;
-    }
-	
+		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);
 
 	if (errmsg) {
@@ -4257,16 +4805,16 @@
 	switch_cache_db_handle_t *dbh = NULL;
 
 	if (!(dbh = sofia_glue_get_db_handle(profile))) {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n");
 		return NULL;
-    }
+	}
 
 	if (mutex) {
 		switch_mutex_lock(mutex);
 	}
 
 	ret = switch_cache_db_execute_sql2str(dbh, sql, resbuf, len, NULL);
-	
+
 	if (mutex) {
 		switch_mutex_unlock(mutex);
 	}
@@ -4324,7 +4872,7 @@
 	char *p;
 
 	if ((p = strchr(uri, ':'))) {
-		return p+1;
+		return p + 1;
 	}
 
 	return uri;
@@ -4341,19 +4889,19 @@
 	}
 
 	return CID_TYPE_NONE;
-	
+
 }
 
 /* all the values of the structure are initialized to NULL  */
 /* in case of failure the function returns NULL */
 /* sofia_destination->route can be NULL */
-sofia_destination_t* sofia_glue_get_destination(char *data)
+sofia_destination_t *sofia_glue_get_destination(char *data)
 {
 	sofia_destination_t *dst = NULL;
 	char *to = NULL;
 	char *contact = NULL;
-    char *route = NULL;
-    char *route_uri = NULL;
+	char *route = NULL;
+	char *route_uri = NULL;
 	char *eoc = NULL;
 	char *p = NULL;
 
@@ -4361,7 +4909,7 @@
 		return NULL;
 	}
 
-	if (!(dst = (sofia_destination_t *)malloc(sizeof(sofia_destination_t)))) {
+	if (!(dst = (sofia_destination_t *) malloc(sizeof(sofia_destination_t)))) {
 		return NULL;
 	}
 
@@ -4370,14 +4918,14 @@
 		goto mem_fail;
 	}
 
-	if((eoc = strstr(contact, ";fs_path="))) {
+	if ((eoc = strstr(contact, ";fs_path="))) {
 		*eoc = '\0';
 
-		if(!(route = strdup(eoc + 9))) {
+		if (!(route = strdup(eoc + 9))) {
 			goto mem_fail;
 		}
 
-		for (p = route; p && *p ; p++) {
+		for (p = route; p && *p; p++) {
 			if (*p == '>' || *p == ';') {
 				*p = '\0';
 				break;
@@ -4386,7 +4934,7 @@
 
 		switch_url_decode(route);
 
- 		if (!(route_uri = strdup(route))) {
+		if (!(route_uri = strdup(route))) {
 			goto mem_fail;
 		}
 		if ((p = strchr(route_uri, ','))) {
@@ -4394,28 +4942,28 @@
 				*p = '\0';
 			} while ((--p > route_uri) && *p == ' ');
 		}
-	} 
-	
+	}
+
 	if (!(to = strdup(data))) {
 		goto mem_fail;
 	}
 
-	if((eoc = strstr(to, ";fs_path="))) {
-		*eoc++ = '>';	
-		*eoc = '\0';	
+	if ((eoc = strstr(to, ";fs_path="))) {
+		*eoc++ = '>';
+		*eoc = '\0';
 	}
-	
+
 	if ((p = strstr(contact, ";fs_"))) {
 		*p = '\0';
 	}
-	
+
 	dst->contact = contact;
 	dst->to = to;
 	dst->route = route;
 	dst->route_uri = route_uri;
 	return dst;
 
-mem_fail:
+  mem_fail:
 	switch_safe_free(contact);
 	switch_safe_free(to);
 	switch_safe_free(route);
@@ -4435,7 +4983,8 @@
 	}
 }
 
-switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *user, const char *host, const char *event, const char *contenttype, const char *body, const char *o_contact, const char *network_ip)
+switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *user, const char *host, const char *event, const char *contenttype,
+									   const char *body, const char *o_contact, const char *network_ip)
 {
 	char *id = NULL;
 	nua_handle_t *nh;
@@ -4443,7 +4992,7 @@
 	char *contact_str, *contact, *user_via = NULL;
 	char *route_uri = NULL;
 
-	contact = sofia_glue_get_url_from_contact((char*) o_contact, 1);
+	contact = sofia_glue_get_url_from_contact((char *) o_contact, 1);
 	if (sofia_glue_check_nat(profile, network_ip)) {
 		char *ptr = NULL;
 		const char *transport_str = NULL;
@@ -4456,15 +5005,15 @@
 			sofia_transport_t transport = sofia_glue_str2transport(ptr);
 			transport_str = sofia_glue_transport2str(transport);
 			switch (transport) {
-				case SOFIA_TRANSPORT_TCP:
-					contact_str = profile->tcp_public_contact;
-					break;
-				case SOFIA_TRANSPORT_TCP_TLS:
-					contact_str = profile->tls_public_contact;
-					break;
-				default:
-					contact_str = profile->public_url;
-					break;
+			case SOFIA_TRANSPORT_TCP:
+				contact_str = profile->tcp_public_contact;
+				break;
+			case SOFIA_TRANSPORT_TCP_TLS:
+				contact_str = profile->tls_public_contact;
+				break;
+			default:
+				contact_str = profile->public_url;
+				break;
 			}
 			user_via = sofia_glue_create_external_via(NULL, profile, transport);
 		} else {
@@ -4477,25 +5026,22 @@
 		id = switch_mprintf("sip:%s@%s", user, host);
 	}
 
-	dst = sofia_glue_get_destination((char*) o_contact);
+	dst = sofia_glue_get_destination((char *) o_contact);
 	switch_assert(dst);
 
-	if(dst->route_uri) {
+	if (dst->route_uri) {
 		route_uri = sofia_glue_strip_uri(dst->route_uri);
 	}
 
-	nh = nua_handle(profile->nua, NULL, NUTAG_URL(contact),
-			SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id),
-			SIPTAG_CONTACT_STR(contact_str), TAG_END());
+	nh = nua_handle(profile->nua, NULL, NUTAG_URL(contact), SIPTAG_FROM_STR(id), SIPTAG_TO_STR(id), SIPTAG_CONTACT_STR(contact_str), TAG_END());
 	nua_handle_bind(nh, &mod_sofia_globals.destroy_private);
 
 	nua_notify(nh,
-			NUTAG_NEWSUB(1),
-			TAG_IF(dst->route_uri, NUTAG_PROXY(route_uri)), TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)),
-			TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
-			SIPTAG_EVENT_STR(event),
-			SIPTAG_CONTENT_TYPE_STR(contenttype),
-			SIPTAG_PAYLOAD_STR(body), TAG_END());
+			   NUTAG_NEWSUB(1),
+			   TAG_IF(dst->route_uri, NUTAG_PROXY(route_uri)), TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)),
+			   TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
+			   TAG_IF(event, SIPTAG_EVENT_STR(event)),
+			   TAG_IF(contenttype, SIPTAG_CONTENT_TYPE_STR(contenttype)), TAG_IF(body, SIPTAG_PAYLOAD_STR(body)), TAG_END());
 
 	switch_safe_free(contact);
 	switch_safe_free(route_uri);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/sofia_presence.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/sofia_presence.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/sofia_presence.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -33,15 +33,30 @@
  *
  */
 #include "mod_sofia.h"
+#include "switch_stun.h"
 
 #define SUB_OVERLAP 300
+struct state_helper {
+	switch_hash_t *hash;
+	sofia_profile_t *profile;
+	switch_memory_pool_t *pool;
+};
 
+
 static int sofia_presence_mwi_callback(void *pArg, int argc, char **argv, char **columnNames);
 static int sofia_presence_mwi_callback2(void *pArg, int argc, char **argv, char **columnNames);
 static int sofia_presence_sub_reg_callback(void *pArg, int argc, char **argv, char **columnNames);
 static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char **columnNames);
 static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char **columnNames);
+static int broadsoft_sla_gather_state_callback(void *pArg, int argc, char **argv, char **columnNames);
+static int broadsoft_sla_notify_callback(void *pArg, int argc, char **argv, char **columnNames);
+static void sync_sla(sofia_profile_t *profile, const char *to_user, const char *to_host, switch_bool_t clear, switch_bool_t unseize);
 
+struct resub_helper {
+	sofia_profile_t *profile;
+	switch_event_t *event;
+};
+
 struct presence_helper {
 	sofia_profile_t *profile;
 	switch_event_t *event;
@@ -82,11 +97,12 @@
 	} else {
 		user = prof;
 		prof = NULL;
-	}  
+	}
 
 	if ((host = strchr(user, '@'))) {
 		*host++ = '\0';
-		if (!prof) prof = host;
+		if (!prof)
+			prof = host;
 	}
 
 	if (!prof || !(profile = sofia_glue_find_profile(prof))) {
@@ -135,7 +151,7 @@
 		from = ffrom;
 		switch_safe_free(fp);
 	}
-	
+
 	if (!(dst = sofia_glue_get_destination(buf))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
 		goto end;
@@ -146,14 +162,12 @@
 	status = SWITCH_STATUS_SUCCESS;
 	/* if this cries, add contact here too, change the 1 to 0 and omit the safe_free */
 	msg_nh = nua_handle(profile->nua, NULL, TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)), TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)),
-						SIPTAG_FROM_STR(from), NUTAG_URL(contact),
-						SIPTAG_TO_STR(dst->to), SIPTAG_CONTACT_STR(profile->url),
-						TAG_END());
+						SIPTAG_FROM_STR(from), NUTAG_URL(contact), SIPTAG_TO_STR(dst->to), SIPTAG_CONTACT_STR(profile->url), TAG_END());
 	nua_handle_bind(msg_nh, &mod_sofia_globals.destroy_private);
 	nua_message(msg_nh, SIPTAG_CONTENT_TYPE_STR(ct), SIPTAG_PAYLOAD_STR(body), TAG_END());
-	
-	
- end:
+
+
+  end:
 	sofia_glue_free_destination(dst);
 	switch_safe_free(contact);
 	switch_safe_free(ffrom);
@@ -175,11 +189,10 @@
 
 	if (!mod_sofia_globals.profile_hash)
 		return;
-	
-	if ((sql = switch_mprintf(
-							  "select proto,sip_user,sip_host,sub_to_user,sub_to_host,event,contact,call_id,full_from,"
+
+	if ((sql = switch_mprintf("select proto,sip_user,sip_host,sub_to_user,sub_to_host,event,contact,call_id,full_from,"
 							  "full_via,expires,user_agent,accept,profile_name,network_ip"
-							  ",-1,'unavailable','unavailable' from sip_subscriptions where event='presence' and hostname='%q'", 
+							  ",-1,'unavailable','unavailable' from sip_subscriptions where expires > -1 and event='presence' and hostname='%q'",
 							  mod_sofia_globals.hostname))) {
 		switch_mutex_lock(mod_sofia_globals.hash_mutex);
 		for (hi = switch_hash_first(NULL, mod_sofia_globals.profile_hash); hi; hi = switch_hash_next(hi)) {
@@ -201,16 +214,19 @@
 
 void sofia_presence_establish_presence(sofia_profile_t *profile)
 {
+	struct resub_helper h = { 0 };
+	h.profile = profile;
 
 	if (sofia_glue_execute_sql_callback(profile, profile->ireg_mutex,
 										"select sip_user,sip_host,'Registered','unknown','' from sip_registrations",
-										sofia_presence_resub_callback, profile) != SWITCH_TRUE) {
+										sofia_presence_resub_callback, &h) != SWITCH_TRUE) {
 		return;
 	}
 
 	if (sofia_glue_execute_sql_callback(profile, profile->ireg_mutex,
 										"select sub_to_user,sub_to_host,'Online','unknown',proto from sip_subscriptions "
-										"where proto='ext' or proto='user' or proto='conf'", sofia_presence_resub_callback, profile) != SWITCH_TRUE) {
+										"where expires > -1 and proto='ext' or proto='user' or proto='conf'",
+										sofia_presence_resub_callback, &h) != SWITCH_TRUE) {
 		return;
 	}
 }
@@ -318,19 +334,18 @@
 	}
 
 	stream.write_function(&stream, "\r\n");
-	
+
 	sql = NULL;
 
 	if (for_everyone) {
 		sql = switch_mprintf("select proto,sip_user,sip_host,sub_to_user,sub_to_host,event,contact,call_id,full_from,"
 							 "full_via,expires,user_agent,accept,profile_name,network_ip"
-							 ",'%q','%q' from sip_subscriptions where event='message-summary' "
-							 "and sub_to_user='%q' and (sub_to_host='%q' or presence_hosts like '%%%q%%')",
-							 stream.data, host, user, host, host);
+							 ",'%q','%q' from sip_subscriptions where expires > -1 and event='message-summary' "
+							 "and sub_to_user='%q' and (sub_to_host='%q' or presence_hosts like '%%%q%%')", stream.data, host, user, host, host);
 	} else if (sub_call_id) {
 		sql = switch_mprintf("select proto,sip_user,sip_host,sub_to_user,sub_to_host,event,contact,call_id,full_from,"
 							 "full_via,expires,user_agent,accept,profile_name,network_ip"
-							 ",'%q','%q' from sip_subscriptions where event='message-summary' "
+							 ",'%q','%q' from sip_subscriptions where expires > -1 and event='message-summary' "
 							 "and sub_to_user='%q' and (sub_to_host='%q' or presence_hosts like '%%%q%%' and call_id='%q')",
 							 stream.data, host, user, host, host, sub_call_id);
 	}
@@ -340,17 +355,15 @@
 		sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_mwi_callback, &h);
 		free(sql);
 		sql = NULL;
-		
+
 	}
 
 	if (for_everyone) {
 		sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,network_ip,'%q' "
-							 "from sip_registrations where mwi_user='%q' and mwi_host='%q'", 
-							 stream.data, user, host);
+							 "from sip_registrations where mwi_user='%q' and mwi_host='%q'", stream.data, user, host);
 	} else if (call_id) {
 		sql = switch_mprintf("select sip_user,sip_host,contact,profile_name,network_ip,'%q' "
-							 "from sip_registrations where mwi_user='%q' and mwi_host='%q' and call_id='%q'", 
-							 stream.data, user, host, call_id);
+							 "from sip_registrations where mwi_user='%q' and mwi_host='%q' and call_id='%q'", stream.data, user, host, call_id);
 	}
 
 	if (sql) {
@@ -380,9 +393,14 @@
 	char *status = switch_event_get_header(event, "status");
 	char *event_type = switch_event_get_header(event, "event_type");
 	char *alt_event_type = switch_event_get_header(event, "alt_event_type");
+	//char *event_subtype = switch_event_get_header(event, "event_subtype");
 	char *sql = NULL;
 	char *euser = NULL, *user = NULL, *host = NULL;
+	char *call_info = switch_event_get_header(event, "presence-call-info");
+	char *call_info_state = switch_event_get_header(event, "presence-call-info-state");
+	struct resub_helper h = { 0 };
 
+
 	if (!mod_sofia_globals.running) {
 		return;
 	}
@@ -394,7 +412,7 @@
 	if (status && !strcasecmp(status, "n/a")) {
 		status = NULL;
 	}
-	
+
 	if (status && switch_stristr("CS_HANGUP", status)) {
 		status = "Call Ended";
 	}
@@ -402,7 +420,7 @@
 	if (rpid) {
 		rpid = sofia_presence_translate_rpid(rpid, status);
 	}
-	
+
 	if (event->event_id == SWITCH_EVENT_ROSTER) {
 		struct presence_helper helper = { 0 };
 
@@ -410,8 +428,7 @@
 			return;
 
 		if (from) {
-			sql = switch_mprintf(
-								 "select sip_subscriptions.proto,sip_subscriptions.sip_user,sip_subscriptions.sip_host,"
+			sql = switch_mprintf("select sip_subscriptions.proto,sip_subscriptions.sip_user,sip_subscriptions.sip_host,"
 								 "sip_subscriptions.sub_to_user,sip_subscriptions.sub_to_host,sip_subscriptions.event,"
 								 "sip_subscriptions.contact,sip_subscriptions.call_id,sip_subscriptions.full_from,"
 								 "sip_subscriptions.full_via,sip_subscriptions.expires,sip_subscriptions.user_agent,"
@@ -420,11 +437,10 @@
 								 "from sip_subscriptions left join sip_presence on "
 								 "(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and "
 								 "sip_subscriptions.profile_name=sip_presence.profile_name) "
-								 "where sip_subscriptions.event='presence' and sip_subscriptions.full_from like '%%%q%%'", 
+								 "where sip_subscriptions.expires > -1 and sip_subscriptions.event='presence' and sip_subscriptions.full_from like '%%%q%%'",
 								 switch_str_nil(status), switch_str_nil(rpid), from);
 		} else {
-			sql = switch_mprintf(
-								 "select sip_subscriptions.proto,sip_subscriptions.sip_user,sip_subscriptions.sip_host,"
+			sql = switch_mprintf("select sip_subscriptions.proto,sip_subscriptions.sip_user,sip_subscriptions.sip_host,"
 								 "sip_subscriptions.sub_to_user,sip_subscriptions.sub_to_host,sip_subscriptions.event,"
 								 "sip_subscriptions.contact,sip_subscriptions.call_id,sip_subscriptions.full_from,"
 								 "sip_subscriptions.full_via,sip_subscriptions.expires,sip_subscriptions.user_agent,"
@@ -433,7 +449,8 @@
 								 "from sip_subscriptions left join sip_presence on "
 								 "(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and "
 								 "sip_subscriptions.profile_name=sip_presence.profile_name) "
-								 "where sip_subscriptions.event='presence'", switch_str_nil(status), switch_str_nil(rpid));
+								 "where sip_subscriptions.expires > -1 and sip_subscriptions.event='presence'", switch_str_nil(status),
+								 switch_str_nil(rpid));
 		}
 
 		switch_assert(sql != NULL);
@@ -442,7 +459,7 @@
 			switch_hash_this(hi, &var, NULL, &val);
 			profile = (sofia_profile_t *) val;
 
-			if (strcmp((char *)var, profile->name)) {
+			if (strcmp((char *) var, profile->name)) {
 				if (mod_sofia_globals.debug_presence > 0) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s is an alias, skipping\n", (char *) var);
 				}
@@ -521,11 +538,11 @@
 									 "(sip_registrations.sip_user=sip_presence.sip_user and sip_registrations.sip_host=sip_presence.sip_host and "
 									 "sip_registrations.profile_name=sip_presence.profile_name) "
 									 "where sip_registrations.sip_user='%q' and "
-									 "(sip_registrations.sip_host='%q' or sip_registrations.presence_hosts like '%%%q%%')", 
+									 "(sip_registrations.sip_host='%q' or sip_registrations.presence_hosts like '%%%q%%')",
 									 probe_host, probe_euser, probe_host, probe_host);
 				switch_assert(sql);
 
-				
+
 				if (mod_sofia_globals.debug_presence > 0) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s START_PRESENCE_PROBE_SQL\n", profile->name);
 				}
@@ -534,7 +551,8 @@
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s DUMP PRESENCE_PROBE_SQL:\n%s\n", profile->name, sql);
 				}
 
-				sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_resub_callback, profile);
+				h.profile = profile;
+				sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_resub_callback, &h);
 				if (mod_sofia_globals.debug_presence > 0) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s END_PRESENCE_PROBE_SQL\n\n", profile->name);
 				}
@@ -550,8 +568,8 @@
 		break;
 	}
 
-	
 
+
 	if (!mod_sofia_globals.profile_hash)
 		goto done;
 
@@ -560,7 +578,7 @@
 		switch_hash_this(hi, &var, NULL, &val);
 		profile = (sofia_profile_t *) val;
 
-		if (strcmp((char *)var, profile->name)) {
+		if (strcmp((char *) var, profile->name)) {
 			if (mod_sofia_globals.debug_presence > 0) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s is an alias, skipping\n", (char *) var);
 			}
@@ -574,31 +592,65 @@
 			continue;
 		}
 
-		if ((sql = switch_mprintf(
-							 
-							 "select sip_subscriptions.proto,sip_subscriptions.sip_user,sip_subscriptions.sip_host,"
-							 "sip_subscriptions.sub_to_user,sip_subscriptions.sub_to_host,sip_subscriptions.event,"
-							 "sip_subscriptions.contact,sip_subscriptions.call_id,sip_subscriptions.full_from,"
-							 "sip_subscriptions.full_via,sip_subscriptions.expires,sip_subscriptions.user_agent,"
-							 "sip_subscriptions.accept,sip_subscriptions.profile_name"
-							 ",'%q','%q','%q',sip_presence.status,sip_presence.rpid "
-							 "from sip_subscriptions "
-							 "left join sip_presence on "
-							 "(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and "
-							 "sip_subscriptions.profile_name=sip_presence.profile_name) "
-							 "where (event='%q' or event='%q') and sub_to_user='%q' "
-							 "and (sub_to_host='%q' or presence_hosts like '%%%q%%') "
-							 "and (sip_subscriptions.profile_name = '%q' or sip_subscriptions.presence_hosts != sip_subscriptions.sub_to_host)",
-							 switch_str_nil(status), switch_str_nil(rpid), host, event_type, alt_event_type, euser, host, host, profile->name))) {
+		if (call_info) {
+			const char *uuid = switch_event_get_header(event, "unique-id");
 
+
+#if 0
+			if (mod_sofia_globals.debug_sla > 1) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SLA EVENT:\n");
+				DUMP_EVENT(event);
+			}
+#endif
+
+			if (uuid) {
+				sql = switch_mprintf("update sip_dialogs set call_info_state='%q' where hostname='%q' and uuid='%q'",
+									 call_info_state, mod_sofia_globals.hostname, uuid);
+			} else {
+				sql = switch_mprintf("update sip_dialogs set call_info_state='%q' where hostname='%q' and sip_dialogs.sip_from_user='%q' "
+									 "and sip_dialogs.sip_from_host='%q' and call_info='%q'",
+									 call_info_state, mod_sofia_globals.hostname, euser, host, call_info);
+
+			}
+
+			if (mod_sofia_globals.debug_sla > 1) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "STATE SQL %s\n", sql);
+			}
+			sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
+
+
+
+			if (mod_sofia_globals.debug_sla > 1) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "PROCESS PRESENCE EVENT\n");
+			}
+
+			sync_sla(profile, euser, host, SWITCH_TRUE, SWITCH_TRUE);
+		}
+
+
+		if ((sql = switch_mprintf("select sip_subscriptions.proto,sip_subscriptions.sip_user,sip_subscriptions.sip_host,"
+								  "sip_subscriptions.sub_to_user,sip_subscriptions.sub_to_host,sip_subscriptions.event,"
+								  "sip_subscriptions.contact,sip_subscriptions.call_id,sip_subscriptions.full_from,"
+								  "sip_subscriptions.full_via,sip_subscriptions.expires,sip_subscriptions.user_agent,"
+								  "sip_subscriptions.accept,sip_subscriptions.profile_name"
+								  ",'%q','%q','%q',sip_presence.status,sip_presence.rpid "
+								  "from sip_subscriptions "
+								  "left join sip_presence on "
+								  "(sip_subscriptions.sub_to_user=sip_presence.sip_user and sip_subscriptions.sub_to_host=sip_presence.sip_host and "
+								  "sip_subscriptions.profile_name=sip_presence.profile_name) "
+								  "where sip_subscriptions.expires > -1 and (event='%q' or event='%q') and sub_to_user='%q' "
+								  "and (sub_to_host='%q' or presence_hosts like '%%%q%%') "
+								  "and (sip_subscriptions.profile_name = '%q' or sip_subscriptions.presence_hosts != sip_subscriptions.sub_to_host)",
+								  switch_str_nil(status), switch_str_nil(rpid), host, event_type, alt_event_type, euser, host, host, profile->name))) {
+
 			struct presence_helper helper = { 0 };
 			helper.profile = profile;
 			helper.event = event;
 			SWITCH_STANDARD_STREAM(helper.stream);
 			switch_assert(helper.stream.data);
-			
+
 			if (mod_sofia_globals.debug_presence > 0) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s START_PRESENCE_SQL (%s)\n", 
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s START_PRESENCE_SQL (%s)\n",
 								  event->event_id == SWITCH_EVENT_PRESENCE_IN ? "IN" : "OUT", profile->name);
 			}
 
@@ -614,14 +666,13 @@
 				free(buf);
 			}
 
-			sofia_glue_execute_sql_callback(profile,
-											NULL, sql, sofia_presence_sub_callback, &helper);
+			sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_presence_sub_callback, &helper);
 
 			if (mod_sofia_globals.debug_presence > 0) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s END_PRESENCE_SQL (%s)\n", 
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s END_PRESENCE_SQL (%s)\n",
 								  event->event_id == SWITCH_EVENT_PRESENCE_IN ? "IN" : "OUT", profile->name);
 			}
-			
+
 			switch_safe_free(sql);
 
 			if (!zstr((char *) helper.stream.data)) {
@@ -680,7 +731,7 @@
 
 	while (mod_sofia_globals.running == 1) {
 		int count = 0;
-		
+
 		if (switch_queue_trypop(mod_sofia_globals.presence_queue, &pop) == SWITCH_STATUS_SUCCESS) {
 			switch_event_t *event = (switch_event_t *) pop;
 
@@ -815,7 +866,8 @@
 
 static int sofia_presence_resub_callback(void *pArg, int argc, char **argv, char **columnNames)
 {
-	sofia_profile_t *profile = (sofia_profile_t *) pArg;
+	struct resub_helper *h = (struct resub_helper *) pArg;
+	sofia_profile_t *profile = h->profile;
 	char *user = argv[0];
 	char *host = argv[1];
 	char *status = argv[2];
@@ -828,6 +880,7 @@
 	char *direction = NULL;
 	switch_event_t *event;
 	char to_buf[128] = "";
+	switch_event_header_t *hp;
 
 	if (argc > 5) {
 		uuid = switch_str_nil(argv[5]);
@@ -865,7 +918,7 @@
 		if (!zstr(to_user)) {
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to-user", to_user);
 		}
-		
+
 		if (zstr(state)) {
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "unique-id", SOFIA_CHAT_PROTO);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-state", "CS_HANGUP");
@@ -878,6 +931,15 @@
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction", direction);
 		}
 
+		if (h->event) {
+			for (hp = h->event->headers; hp; hp = hp->next) {
+				if (!strncasecmp(hp->name, "fwd-", 4)) {
+					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, hp->name + 4, hp->value);
+				}
+			}
+		}
+
+
 		switch_event_fire(&event);
 	}
 
@@ -922,50 +984,40 @@
 
 	if (switch_stristr("polycom", user_agent)) {
 		*ct = "application/xpidf+xml";
-		
+
 		/* of course!, lets make a big deal over dashes. Now the stupidity is complete. */
 
 		if (!strcmp(prpid, "on-the-phone")) {
 			prpid = "onthephone";
 		}
 
-		ret = switch_mprintf(
-							  "<?xml version=\"1.0\"?>\n"
-							  "<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n"
-							  "<presence>\n"
-							  " <status>\n"
-							  "  <note>%s</note>\n"
-							  " </status>\n"
-							  " <presentity uri=\"%s;method=SUBSCRIBE\" />\n"
-							  " <atom id=\"%s\">\n"
-							  "  <address uri=\"%s;user=ip\" priority=\"0.800000\">\n"
-							  "   <status status=\"%s\" />\n"
-							  "   <msnsubstatus substatus=\"%s\" />\n"
-							  "  </address>\n"
-							  " </atom>\n"
-							  "</presence>\n", status, id, id, url, open, prpid
-							  );
+		ret = switch_mprintf("<?xml version=\"1.0\"?>\n"
+							 "<!DOCTYPE presence PUBLIC \"-//IETF//DTD RFCxxxx XPIDF 1.0//EN\" \"xpidf.dtd\">\n"
+							 "<presence>\n"
+							 " <status>\n"
+							 "  <note>%s</note>\n"
+							 " </status>\n"
+							 " <presentity uri=\"%s;method=SUBSCRIBE\" />\n"
+							 " <atom id=\"%s\">\n"
+							 "  <address uri=\"%s;user=ip\" priority=\"0.800000\">\n"
+							 "   <status status=\"%s\" />\n"
+							 "   <msnsubstatus substatus=\"%s\" />\n" "  </address>\n" " </atom>\n" "</presence>\n", status, id, id, url, open, prpid);
 	} else {
 		*ct = "application/pidf+xml";
-		ret = switch_mprintf(
-							  "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?> \n"
-							  "<presence xmlns='urn:ietf:params:xml:ns:pidf' \n"
-							  "xmlns:dm='urn:ietf:params:xml:ns:pidf:data-model' \n"
-							  "xmlns:rpid='urn:ietf:params:xml:ns:pidf:rpid' \n"
-							  "xmlns:c='urn:ietf:params:xml:ns:pidf:cipid' entity='%s'>\n"
-							  
-							  " <tuple id='t6a5ed77e'>\n"
-							  "  <status>\r\n"
-							  "   <basic>%s</basic>\n"
-							  "  </status>\n"
-							  " </tuple>\n"
-							  " <dm:person id='p06360c4a'>\n"
-							  "  <rpid:activities>\r\n" 
-							  "   <rpid:%s/>\n"
-							  "  </rpid:activities>\n"
-							  "  <dm:note>%s</dm:note>\n"
-							  " </dm:person>\n"
-							  "</presence>", id, open, prpid, status);
+		ret = switch_mprintf("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?> \n"
+							 "<presence xmlns='urn:ietf:params:xml:ns:pidf' \n"
+							 "xmlns:dm='urn:ietf:params:xml:ns:pidf:data-model' \n"
+							 "xmlns:rpid='urn:ietf:params:xml:ns:pidf:rpid' \n"
+							 "xmlns:c='urn:ietf:params:xml:ns:pidf:cipid' entity='%s'>\n"
+							 " <tuple id='t6a5ed77e'>\n"
+							 "  <status>\r\n"
+							 "   <basic>%s</basic>\n"
+							 "  </status>\n"
+							 " </tuple>\n"
+							 " <dm:person id='p06360c4a'>\n"
+							 "  <rpid:activities>\r\n"
+							 "   <rpid:%s/>\n"
+							 "  </rpid:activities>\n" "  <dm:note>%s</dm:note>\n" " </dm:person>\n" "</presence>", id, open, prpid, status);
 	}
 
 
@@ -1026,26 +1078,26 @@
 			status = "Available";
 		}
 	}
-	
+
 	if (profile_name && strcasecmp(profile_name, helper->profile->name)) {
-        if ((ext_profile = sofia_glue_find_profile(profile_name))) {
-            profile = ext_profile;
-        }
-    }
-	
+		if ((ext_profile = sofia_glue_find_profile(profile_name))) {
+			profile = ext_profile;
+		}
+	}
+
 	if (!(nh = nua_handle_by_call_id(profile->nua, call_id))) {
 		goto end;
 	}
-	
+
 	if (expires) {
 		long tmp = atol(expires);
 		if (tmp > 0) {
-			exptime = tmp - switch_epoch_time_now(NULL);// - SUB_OVERLAP;
+			exptime = tmp - switch_epoch_time_now(NULL);	// - SUB_OVERLAP;
 		} else {
 			exptime = tmp;
 		}
 	}
-	
+
 	if (!rpid) {
 		rpid = "unknown";
 	}
@@ -1059,8 +1111,8 @@
 	}
 
 	if (mod_sofia_globals.debug_presence > 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, 
-						  "SEND PRESENCE\nTo:      \t%s@%s\nFrom:    \t%s@%s\nCall-ID:  \t%s\nProfile:\t%s [%s]\n\n", 
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
+						  "SEND PRESENCE\nTo:      \t%s@%s\nFrom:    \t%s@%s\nCall-ID:  \t%s\nProfile:\t%s [%s]\n\n",
 						  user, host, sub_to_user, sub_to_host, call_id, profile_name, helper->profile->name);
 	}
 
@@ -1237,7 +1289,7 @@
 					if (zstr(from_id)) {
 						from_id = p_to_user;
 					}
-					
+
 					if (zstr(from_id)) {
 						switch_snprintf(status_line, sizeof(status_line), "On The Phone %s", status);
 					} else {
@@ -1250,11 +1302,11 @@
 			} else {
 				open = "closed";
 			}
-			
+
 			prpid = translate_rpid(rpid);
 			pl = gen_pidf(user_agent, clean_id, profile->url, open, rpid, prpid, status_line, &ct);
 		}
-		
+
 	} else {
 		if (in) {
 			open = "open";
@@ -1264,15 +1316,15 @@
 		prpid = translate_rpid(rpid);
 		pl = gen_pidf(user_agent, clean_id, profile->url, open, rpid, prpid, status, &ct);
 	}
-	
+
 	nua_handle_bind(nh, &mod_sofia_globals.keep_private);
-	
+
 	if (helper->event && helper->event->event_id == SWITCH_EVENT_PRESENCE_OUT) {
 		switch_set_string(sstr, "terminated;reason=noresource");
 		switch_set_string(expires_str, "0");
-        kill_handle = 1;
+		kill_handle = 1;
 	} else if (exptime > 0) {
-		switch_snprintf(sstr, sizeof(sstr), "active;expires=%u", (unsigned)exptime);
+		switch_snprintf(sstr, sizeof(sstr), "active;expires=%u", (unsigned) exptime);
 	} else {
 		unsigned delta = (unsigned) (exptime * -1);
 		switch_snprintf(sstr, sizeof(sstr), "active;expires=%u", delta);
@@ -1288,13 +1340,12 @@
 
 
 
-	nua_notify(nh, 
+	nua_notify(nh,
 			   TAG_IF(*expires_str, SIPTAG_EXPIRES_STR(expires_str)),
-			   SIPTAG_SUBSCRIPTION_STATE_STR(sstr),
-			   SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR(ct), SIPTAG_PAYLOAD_STR(pl), TAG_END());
-	
+			   SIPTAG_SUBSCRIPTION_STATE_STR(sstr), SIPTAG_EVENT_STR(event), SIPTAG_CONTENT_TYPE_STR(ct), SIPTAG_PAYLOAD_STR(pl), TAG_END());
+
   end:
-	
+
 	if (ext_profile) {
 		sofia_glue_release_profile(ext_profile);
 	}
@@ -1331,7 +1382,7 @@
 			profile = ext_profile;
 		}
 	}
-	
+
 	if (!(nh = nua_handle_by_call_id(h->profile->nua, call_id))) {
 		if (profile->debug) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Cannot find handle for %s\n", call_id);
@@ -1353,7 +1404,7 @@
 
 	h->total++;
 
- end:
+  end:
 
 	if (ext_profile) {
 		sofia_glue_release_profile(ext_profile);
@@ -1391,6 +1442,173 @@
 	return 0;
 }
 
+static int broadsoft_sla_notify_callback(void *pArg, int argc, char **argv, char **columnNames)
+{
+	struct state_helper *sh = (struct state_helper *) pArg;
+	char key[256] = "";
+	char *data = NULL, *tmp;
+	char *call_id = argv[0];
+	char *expires = argv[1];
+	char *user = argv[2];
+	char *host = argv[3];
+	char *event = argv[4];
+	int i;
+	char sstr[128] = "", expires_str[128] = "";
+	time_t exptime = 3600;
+	nua_handle_t *nh;
+
+	if (mod_sofia_globals.debug_sla > 1) {
+		for (i = 0; i < argc; i++) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SLA3: %d [%s]=[%s]\n", i, columnNames[i], argv[i]);
+		}
+	}
+
+	switch_snprintf(key, sizeof(key), "%s%s", user, host);
+	data = switch_core_hash_find(sh->hash, key);
+
+	if (expires) {
+		long tmp = atol(expires);
+		exptime = tmp - switch_epoch_time_now(NULL);
+	}
+
+	if (exptime > 0) {
+		switch_snprintf(sstr, sizeof(sstr), "active;expires=%u", (unsigned) exptime);
+	} else {
+		switch_snprintf(sstr, sizeof(sstr), "terminated;reason=noresource");
+	}
+
+	switch_snprintf(expires_str, sizeof(expires_str), "%u", (unsigned) exptime);
+
+	data = switch_core_hash_find(sh->hash, key);
+
+	if (data) {
+		tmp = switch_core_sprintf(sh->pool, "%s,<sip:%s>;appearance-index=*;appearance-state=idle", data, host);
+	} else {
+		tmp = switch_core_sprintf(sh->pool, "<sip:%s>;appearance-index=*;appearance-state=idle", host);
+	}
+
+	if (!strcasecmp(event, "line-seize") && (nh = nua_handle_by_call_id(sh->profile->nua, call_id))) {
+		char *hack;
+
+		if ((hack = (char *) switch_stristr("=seized", tmp))) {
+			switch_snprintf(hack, 7, "=idle  ");
+		}
+		nua_notify(nh,
+				   SIPTAG_EXPIRES_STR("0"),
+				   SIPTAG_SUBSCRIPTION_STATE_STR("terminated;reason=noresource"), SIPTAG_EVENT_STR("line-seize"), SIPTAG_CALL_INFO_STR(tmp), TAG_END());
+		return 0;
+	}
+
+	if (!strcasecmp(event, "call-info") && (nh = nua_handle_by_call_id(sh->profile->nua, call_id))) {
+		nua_notify(nh,
+				   TAG_IF(*expires_str, SIPTAG_EXPIRES_STR(expires_str)),
+				   SIPTAG_SUBSCRIPTION_STATE_STR(sstr), SIPTAG_EVENT_STR("call-info"), SIPTAG_CALL_INFO_STR(tmp), TAG_END());
+
+	}
+
+	return 0;
+}
+
+static int broadsoft_sla_gather_state_callback(void *pArg, int argc, char **argv, char **columnNames)
+{
+	struct state_helper *sh = (struct state_helper *) pArg;
+	char key[256] = "";
+	char *data = NULL, *tmp;
+	char *user = argv[0];
+	char *host = argv[1];
+	char *info = argv[2];
+	char *state = argv[3];
+	int i;
+
+	if (mod_sofia_globals.debug_sla > 1) {
+		for (i = 0; i < argc; i++) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SLA2: %d [%s]=[%s]\n", i, columnNames[i], argv[i]);
+		}
+	}
+
+	if (zstr(info)) {
+		return 0;
+	}
+
+	if (zstr(state)) {
+		state = "idle";
+	}
+
+	switch_snprintf(key, sizeof(key), "%s%s", user, host);
+
+	data = switch_core_hash_find(sh->hash, key);
+
+	if (data) {
+		tmp = switch_core_sprintf(sh->pool, "%s,<sip:%s>;%s;appearance-state=%s", data, host, info, state);
+	} else {
+		tmp = switch_core_sprintf(sh->pool, "<sip:%s>;%s;appearance-state=%s", host, info, state);
+	}
+
+	switch_core_hash_insert(sh->hash, key, tmp);
+
+	return 0;
+}
+
+static void sync_sla(sofia_profile_t *profile, const char *to_user, const char *to_host, switch_bool_t clear, switch_bool_t unseize)
+{
+	struct state_helper *sh;
+	switch_memory_pool_t *pool;
+	char *sql;
+
+	switch_core_new_memory_pool(&pool);
+	sh = switch_core_alloc(pool, sizeof(*sh));
+	sh->pool = pool;
+	switch_core_hash_init(&sh->hash, sh->pool);
+
+	sql = switch_mprintf("select sip_from_user,sip_from_host,call_info,call_info_state from sip_dialogs "
+						 "where hostname='%q' " "and sip_from_user='%q' and sip_from_host='%q' ", mod_sofia_globals.hostname, to_user, to_host);
+
+
+	if (mod_sofia_globals.debug_sla > 1) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "PRES SQL %s\n", sql);
+	}
+	sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, broadsoft_sla_gather_state_callback, sh);
+	switch_safe_free(sql);
+
+
+	if (unseize) {
+		sql = switch_mprintf("select call_id,expires,sub_to_user,sub_to_host,event "
+							 "from sip_subscriptions "
+							 "where expires > -1 and hostname='%q' "
+							 "and sub_to_user='%q' and sub_to_host='%q' "
+							 "and (event='call-info' or event='line-seize')", mod_sofia_globals.hostname, to_user, to_host);
+	} else {
+		sql = switch_mprintf("select call_id,expires,sub_to_user,sub_to_host,event "
+							 "from sip_subscriptions "
+							 "where expires > -1 and hostname='%q' "
+							 "and sub_to_user='%q' and sub_to_host='%q' " "and (event='call-info')", mod_sofia_globals.hostname, to_user, to_host);
+	}
+
+
+	if (mod_sofia_globals.debug_sla > 1) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "PRES SQL %s\n", sql);
+	}
+	sh->profile = profile;
+	sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, broadsoft_sla_notify_callback, sh);
+	switch_safe_free(sql);
+	sh = NULL;
+	switch_core_destroy_memory_pool(&pool);
+
+
+
+	if (clear) {
+		sql = switch_mprintf("delete from sip_dialogs where sip_from_user='%q' and sip_from_host='%q' and call_info_state='seized'", to_user, to_host);
+
+
+		if (mod_sofia_globals.debug_sla > 1) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CLEAR SQL %s\n", sql);
+		}
+		sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
+	}
+
+}
+
+
 void sofia_presence_handle_sip_i_subscribe(int status,
 										   char const *phrase,
 										   nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
@@ -1433,11 +1651,11 @@
 			return;
 		}
 
-		sofia_glue_get_addr(nua_current_request(nua), network_ip,  sizeof(network_ip), &network_port);
+		sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port);
 
 		if (sofia_glue_check_nat(profile, network_ip)) {
 			is_auto_nat = 1;
-		}	
+		}
 
 		tl_gets(tags, NUTAG_SUBSTATE_REF(sub_state), TAG_END());
 
@@ -1494,6 +1712,13 @@
 			}
 		}
 
+		if (is_nat && profile->local_network && switch_check_network_list_ip(network_ip, profile->local_network)) {
+			if (profile->debug) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s is on local network, not seting NAT mode.\n", network_ip);
+			}
+			is_nat = NULL;
+		}
+
 		if (is_nat) {
 			contact_host = network_ip;
 			switch_snprintf(new_port, sizeof(new_port), ":%d", network_port);
@@ -1508,22 +1733,13 @@
 		ipv6 = strchr(contact_host, ':');
 		if (contact->m_url->url_params) {
 			contact_str = switch_mprintf("%s <sip:%s@%s%s%s%s;%s>%s",
-										display, contact->m_url->url_user,
-										ipv6 ? "[" : "",
-										contact_host,
-										ipv6 ? "]" : "",
-										new_port,
-										contact->m_url->url_params,
-										is_nat ? ";fs_nat" : "");
+										 display, contact->m_url->url_user,
+										 ipv6 ? "[" : "",
+										 contact_host, ipv6 ? "]" : "", new_port, contact->m_url->url_params, is_nat ? ";fs_nat=yes" : "");
 		} else {
 			contact_str = switch_mprintf("%s <sip:%s@%s%s%s%s>%s",
-										display,
-										contact->m_url->url_user,
-										ipv6 ? "[" : "",
-										contact_host,
-										ipv6 ? "]" : "",
-										new_port,
-										is_nat ?  ";fs_nat" : "");
+										 display,
+										 contact->m_url->url_user, ipv6 ? "[" : "", contact_host, ipv6 ? "]" : "", new_port, is_nat ? ";fs_nat=yes" : "");
 		}
 
 
@@ -1614,9 +1830,13 @@
 		call_id = sip->sip_call_id->i_id;
 		full_from = sip_header_as_string(profile->home, (void *) sip->sip_from);
 		full_via = sip_header_as_string(profile->home, (void *) sip->sip_via);
-		
+
+		if (sip->sip_expires->ex_delta > 31536000) {
+			sip->sip_expires->ex_delta = 31536000;
+		}
+
 		exp_delta = profile->force_subscription_expires ? profile->force_subscription_expires : (sip->sip_expires ? sip->sip_expires->ex_delta : 3600);
-		
+
 		if (exp_delta) {
 			exp_abs = (long) switch_epoch_time_now(NULL) + exp_delta;
 		} else {
@@ -1625,16 +1845,13 @@
 		}
 
 		switch_snprintf(exp_delta_str, sizeof(exp_delta_str), "%ld", exp_delta);
-		
+
 		if (sofia_test_pflag(profile, PFLAG_MULTIREG)) {
-			//sql = switch_mprintf("delete from sip_subscriptions where call_id='%q' or (contact='%q' and event='%q')", call_id, contact_str, event);
-
 			sql = switch_mprintf("delete from sip_subscriptions where call_id='%q' "
 								 "or (proto='%q' and sip_user='%q' and sip_host='%q' "
 								 "and sub_to_user='%q' and sub_to_host='%q' and event='%q' and hostname='%q' "
 								 "and contact='%q')",
-								 call_id, proto, from_user, from_host, to_user, to_host, event, mod_sofia_globals.hostname,
-								 contact_str);
+								 call_id, proto, from_user, from_host, to_user, to_host, event, mod_sofia_globals.hostname, contact_str);
 
 		} else {
 			sql = switch_mprintf("delete from sip_subscriptions where "
@@ -1644,7 +1861,8 @@
 
 		switch_mutex_lock(profile->ireg_mutex);
 		switch_assert(sql != NULL);
-		sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
+		sofia_glue_actually_execute_sql(profile, sql, NULL);
+		switch_safe_free(sql);
 
 		if (sub_state == nua_substate_terminated) {
 			sstr = switch_mprintf("terminated");
@@ -1657,34 +1875,25 @@
 				ap = ap->ac_next;
 			}
 
-			/* negative in exptime means keep bumping up sub time to avoid a snafu where every device has it's own rules about subscriptions
-			   that somehow barely resemble the RFC not that I blame them because the RFC MAY be amibiguous and SHOULD be deleted.
-			   So to avoid the problem we keep resetting the expiration date of the subscription so it never expires.
-
-			   Eybeam completely ignores this option and most other subscription-state: directives from rfc3265 and still expires.
-			   Polycom is happy to keep upping the subscription expiry back to the original time on each new notify.
-			   The rest ... who knows...?
-
-			*/
-
-
 			sql = switch_mprintf("insert into sip_subscriptions "
 								 "(proto,sip_user,sip_host,sub_to_user,sub_to_host,presence_hosts,event,contact,call_id,full_from,"
 								 "full_via,expires,user_agent,accept,profile_name,hostname,network_port,network_ip) "
 								 "values ('%q','%q','%q','%q','%q','%q','%q','%q','%q','%q','%q',%ld,'%q','%q','%q','%q','%d','%q')",
-								 proto, from_user, from_host, to_user, to_host, profile->presence_hosts ? profile->presence_hosts : to_host, 
-								 event, contact_str, call_id, full_from, full_via, 
+								 proto, from_user, from_host, to_user, to_host, profile->presence_hosts ? profile->presence_hosts : to_host,
+								 event, contact_str, call_id, full_from, full_via,
 								 //sofia_test_pflag(profile, PFLAG_MULTIREG) ? switch_epoch_time_now(NULL) + exp_delta : exp_delta * -1,
-								 (long)switch_epoch_time_now(NULL) + exp_delta,
-								 full_agent, accept, profile->name,mod_sofia_globals.hostname, network_port, network_ip);
-								 
-			if (mod_sofia_globals.debug_presence > 0) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s SUBSCRIBE %s@%s %s@%s\n", profile->name, from_user, from_host, to_user, to_host);
-			}
+								 (long) switch_epoch_time_now(NULL) + (exp_delta * 2),
+								 full_agent, accept, profile->name, mod_sofia_globals.hostname, network_port, network_ip);
 
 			switch_assert(sql != NULL);
-			sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 
+			if (mod_sofia_globals.debug_presence > 0 || mod_sofia_globals.debug_sla > 0) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "%s SUBSCRIBE %s@%s %s@%s\n%s\n",
+								  profile->name, from_user, from_host, to_user, to_host, sql);
+			}
+
+
+			sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
 			sstr = switch_mprintf("active;expires=%ld", exp_delta);
 		}
 
@@ -1692,21 +1901,16 @@
 
 		if (status < 200) {
 			char *sticky = NULL;
-			char *contactstr = profile->url;
-			
+			char *contactstr = profile->url, *cs = NULL;
+			char *p = NULL, *new_contactstr = NULL;
+
 			if (is_nat) {
 				char params[128] = "";
 				if (contact->m_url->url_params) {
 					switch_snprintf(params, sizeof(params), ";%s", contact->m_url->url_params);
 				}
 				ipv6 = strchr(network_ip, ':');
-				sticky = switch_mprintf("sip:%s@%s%s%s:%d%s",
-										contact_user,
-										ipv6 ? "[" : "",
-										network_ip,
-										ipv6 ? "]" : "",
-										network_port,
-										params);
+				sticky = switch_mprintf("sip:%s@%s%s%s:%d%s", contact_user, ipv6 ? "[" : "", network_ip, ipv6 ? "]" : "", network_port, params);
 			}
 
 			if (is_auto_nat) {
@@ -1715,57 +1919,152 @@
 				contactstr = profile->url;
 			}
 
-			
+
 			if (switch_stristr("port=tcp", contact->m_url->url_params)) {
 				if (is_auto_nat) {
-					contactstr = profile->tcp_public_contact;
+					cs = profile->tcp_public_contact;
 				} else {
-					contactstr = profile->tcp_contact;
+					cs = profile->tcp_contact;
 				}
 			} else if (switch_stristr("port=tls", contact->m_url->url_params)) {
 				if (is_auto_nat) {
-					contactstr = profile->tls_contact;
+					cs = profile->tls_public_contact;
 				} else {
-					contactstr = profile->tls_public_contact;
+					cs = profile->tls_contact;
 				}
 			}
 
+			if (cs) {
+				contactstr = cs;
+			}
+
+			
 			if (nh && nh->nh_ds && nh->nh_ds->ds_usage) {
-				//nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, exp_delta + SUB_OVERLAP, exp_delta + SUB_OVERLAP);
-				nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, exp_delta, exp_delta);
+				/* nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, exp_delta + SUB_OVERLAP, exp_delta + SUB_OVERLAP); */
+				nua_dialog_usage_set_refresh_range(nh->nh_ds->ds_usage, exp_delta * 2, exp_delta * 2);
 			}
 
+			if (contactstr && (p = strchr(contactstr, '@'))) {
+				if (strrchr(p, '>')) {
+					new_contactstr = switch_mprintf("<sip:%s%s", to_user, p);
+				} else {
+					new_contactstr = switch_mprintf("<sip:%s%s>", to_user, p);
+				}
+			}
+
 			nua_respond(nh, SIP_202_ACCEPTED,
-						SIPTAG_CONTACT_STR(contactstr),
-						NUTAG_WITH_THIS(nua), 
-						SIPTAG_SUBSCRIPTION_STATE_STR(sstr),
-						SIPTAG_EXPIRES_STR(exp_delta_str),
-						TAG_IF(sticky, NUTAG_PROXY(sticky)), TAG_END());
+						TAG_IF(new_contactstr, SIPTAG_CONTACT_STR(new_contactstr)),
+						NUTAG_WITH_THIS(nua),
+						SIPTAG_SUBSCRIPTION_STATE_STR(sstr), SIPTAG_EXPIRES_STR(exp_delta_str), TAG_IF(sticky, NUTAG_PROXY(sticky)), TAG_END());
 
+			switch_safe_free(new_contactstr);
 			switch_safe_free(sticky);
+		}
 
+		if (sub_state == nua_substate_terminated) {
+			char *full_call_info = NULL;
+			char *p = NULL;
+
+			if (sip->sip_call_info) {
+				full_call_info = sip_header_as_string(profile->home, (void *) sip->sip_call_info);
+				if ((p = strchr(full_call_info, ';'))) {
+					p++;
+				}
+
+				nua_notify(nh,
+						   SIPTAG_EXPIRES_STR("0"),
+						   SIPTAG_SUBSCRIPTION_STATE_STR(sstr), TAG_IF(full_call_info, SIPTAG_CALL_INFO_STR(full_call_info)), TAG_END());
+
+
+				if (!strcasecmp(event, "line-seize")) {
+					if (mod_sofia_globals.debug_sla > 1) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CANCEL LINE SEIZE\n");
+					}
+
+					sql = switch_mprintf("delete from sip_dialogs where sip_from_user='%q' and sip_from_host='%q' and call_info_state='seized'",
+										 to_user, to_host);
+
+
+					if (mod_sofia_globals.debug_sla > 1) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CLEAR SQL %s\n", sql);
+					}
+					sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
+
+					sync_sla(profile, to_user, to_host, SWITCH_FALSE, SWITCH_FALSE);
+				}
+
+				su_free(profile->home, full_call_info);
+
+			}
+
+		} else {
+			if (!strcasecmp(event, "dialog")) {
+				switch_event_t *pevent;
+				if (switch_event_create(&pevent, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) {
+					switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
+					switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "login", profile->url);
+					switch_event_add_header(pevent, SWITCH_STACK_BOTTOM, "from", "%s@%s", to_user, to_host);
+					switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "event_type", "presence");
+					switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "event_subtype", "probe");
+					switch_event_add_header_string(pevent, SWITCH_STACK_BOTTOM, "proto-specific-event-name", event);
+					switch_event_fire(&pevent);
+				}
+			} else if (!strcasecmp(event, "line-seize")) {
+				char *full_call_info = NULL;
+				char *p;
+
+				if (sip->sip_call_info) {
+					full_call_info = sip_header_as_string(profile->home, (void *) sip->sip_call_info);
+					if ((p = strchr(full_call_info, ';'))) {
+						p++;
+					}
+
+					nua_notify(nh,
+							   SIPTAG_EXPIRES_STR(exp_delta_str),
+							   SIPTAG_SUBSCRIPTION_STATE_STR(sstr),
+							   SIPTAG_EVENT_STR("line-seize"), TAG_IF(full_call_info, SIPTAG_CALL_INFO_STR(full_call_info)), TAG_END());
+
+
+
+					sql = switch_mprintf("delete from sip_dialogs where sip_from_user='%q' and sip_from_host='%q' and call_info_state='seized'",
+										 to_user, to_host);
+
+
+					if (mod_sofia_globals.debug_sla > 1) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "CLEAR SQL %s\n", sql);
+					}
+					sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
+
+					sql = switch_mprintf("insert into sip_dialogs (sip_from_user,sip_from_host,call_info,call_info_state,hostname,expires) "
+										 "values ('%q','%q','%q','seized','%q',%ld)",
+										 to_user, to_host, switch_str_nil(p), mod_sofia_globals.hostname, switch_epoch_time_now(NULL) + exp_delta);
+
+					if (mod_sofia_globals.debug_sla > 1) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SEIZE SQL %s\n", sql);
+					}
+					sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
+					sync_sla(profile, to_user, to_host, SWITCH_FALSE, SWITCH_FALSE);
+
+					su_free(profile->home, full_call_info);
+				}
+			} else if (!strcasecmp(event, "call-info")) {
+				sync_sla(profile, to_user, to_host, SWITCH_FALSE, SWITCH_FALSE);
+			}
 		}
 
 		sent_reply++;
 
-#if 0
-		nua_notify(nh,
-				   SIPTAG_SUBSCRIPTION_STATE_STR(sstr), SIPTAG_EVENT_STR(event),
-				   SIPTAG_EXPIRES_STR(exp_delta_str),
-				   SIPTAG_CONTENT_TYPE_STR("application/notice"),
-				   SIPTAG_PAYLOAD_STR("Note: Come to ClueCon http://www.cluecon.com\n\n"), TAG_END());
-#endif
-
 		switch_safe_free(sstr);
 
-		if ((sql = switch_mprintf(
-								  "select proto,sip_user,'%q',sub_to_user,sub_to_host,event,contact,call_id,full_from,"
-								  "full_via,expires,user_agent,accept,profile_name,network_ip"
-								  " from sip_subscriptions where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')", 
-								  to_host, to_user, to_host, to_host))) {
-			sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_sub_reg_callback, profile);
-			
-			switch_safe_free(sql);
+		if (!strcasecmp(event, "message-summary")) {
+			if ((sql = switch_mprintf("select proto,sip_user,'%q',sub_to_user,sub_to_host,event,contact,call_id,full_from,"
+									  "full_via,expires,user_agent,accept,profile_name,network_ip"
+									  " from sip_subscriptions where expires > -1 and event='message-summary' and sip_user='%q' "
+									  "and (sip_host='%q' or presence_hosts like '%%%q%%')", to_host, to_user, to_host, to_host))) {
+				sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_presence_sub_reg_callback, profile);
+
+				switch_safe_free(sql);
+			}
 		}
 	  end:
 
@@ -1793,7 +2092,8 @@
 	}
 }
 
-sofia_gateway_subscription_t *sofia_find_gateway_subscription(sofia_gateway_t *gateway_ptr, const char *event) {
+sofia_gateway_subscription_t *sofia_find_gateway_subscription(sofia_gateway_t *gateway_ptr, const char *event)
+{
 	sofia_gateway_subscription_t *gw_sub_ptr;
 	for (gw_sub_ptr = gateway_ptr->subscriptions; gw_sub_ptr; gw_sub_ptr = gw_sub_ptr->next) {
 		if (!strcasecmp(gw_sub_ptr->event, event)) {
@@ -1811,7 +2111,7 @@
 {
 	sip_event_t const *o = NULL;
 	sofia_gateway_subscription_t *gw_sub_ptr;
-	
+
 	if (!sip) {
 		return;
 	}
@@ -1835,14 +2135,14 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Gateway information missing\n");
 		return;
 	}
-	
+
 	/* Find the subscription if one exists */
 	if (!(gw_sub_ptr = sofia_find_gateway_subscription(sofia_private->gateway, o->o_type))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Could not find gateway subscription.  Gateway: %s.  Subscription Event: %s\n",
-				sofia_private->gateway->name, o->o_type);
+						  sofia_private->gateway->name, o->o_type);
 		return;
 	}
-	
+
 	/* Update the subscription status for the subscription */
 	switch (status) {
 	case 200:
@@ -1859,7 +2159,7 @@
 	default:
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "status (%d) != 200, updated state to SUB_STATE_FAILED.\n", status);
 		gw_sub_ptr->state = SUB_STATE_FAILED;
-		
+
 		if (sofia_private) {
 			nua_handle_destroy(sofia_private->gateway->sub_nh);
 			sofia_private->gateway->sub_nh = NULL;
@@ -1883,6 +2183,9 @@
 		char *rpid = "unknown";
 		sip_payload_t *payload = sip->sip_payload;
 		char *event_type;
+		char etag[9] = "";
+		char expstr[30] = "";
+		long exp = 0, exp_delta = 3600;
 
 		/* the following could instead be refactored back to the calling event handler in sofia.c XXX MTK */
 		if (sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE)) {
@@ -1904,7 +2207,6 @@
 			uint8_t in = 0;
 			char *sql;
 			char *full_agent = NULL;
-			long exp, exp_delta;
 
 			if ((xml = switch_xml_parse_str(payload->pl_data, strlen(payload->pl_data)))) {
 				char *status_txt = "", *note_txt = "";
@@ -1912,7 +2214,7 @@
 				if (sip->sip_user_agent) {
 					full_agent = sip_header_as_string(profile->home, (void *) sip->sip_user_agent);
 				}
-				
+
 				if ((tuple = switch_xml_child(xml, "tuple")) && (status = switch_xml_child(tuple, "status"))
 					&& (basic = switch_xml_child(status, "basic"))) {
 					status_txt = basic->txt;
@@ -1946,19 +2248,17 @@
 
 				if ((sql =
 					 switch_mprintf("delete from sip_presence where sip_user='%q' and sip_host='%q' "
-									" and profile_name='%q' and hostname='%q'",
-									from_user, from_host, profile->name, mod_sofia_globals.hostname
-									))) {
-					sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
+									" and profile_name='%q' and hostname='%q'", from_user, from_host, profile->name, mod_sofia_globals.hostname))) {
+					sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
 				}
-					 
+
 				if ((sql =
 					 switch_mprintf("insert into sip_presence (sip_user, sip_host, status, rpid, expires, user_agent, profile_name, hostname) "
 									"values ('%q','%q','%q','%q',%ld,'%q','%q','%q')",
 									from_user, from_host, note_txt, rpid, exp, full_agent, profile->name, mod_sofia_globals.hostname))) {
-					sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
+					sofia_glue_execute_sql_now(profile, &sql, SWITCH_TRUE);
 				}
-				
+
 				event_type = sip_header_as_string(profile->home, (void *) sip->sip_event);
 
 				if (in) {
@@ -1995,8 +2295,11 @@
 				switch_xml_free(xml);
 			}
 		}
+
+		switch_snprintf(expstr, sizeof(expstr), "%d", exp_delta);
+		switch_stun_random_string(etag, 8, NULL);
+		nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), SIPTAG_ETAG_STR(etag), SIPTAG_EXPIRES_STR(expstr), TAG_END());
 	}
-	nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
 }
 
 void sofia_presence_set_hash_key(char *hash_key, int32_t len, sip_t const *sip)
@@ -2068,7 +2371,7 @@
 				switch_copy_string(proto, to_user, sizeof(proto));
 				p = strchr(proto, '+');
 				*p++ = '\0';
-				
+
 				if ((to_addr = strdup(p))) {
 					if ((p = strchr(to_addr, '+'))) {
 						*p = '@';
@@ -2093,7 +2396,7 @@
 					if (msg) {
 						switch_event_add_body(event, "%s", msg);
 					}
-					
+
 					if (switch_core_session_queue_event(tech_pvt->session, &event) != SWITCH_STATUS_SUCCESS) {
 						switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "delivery-failure", "true");
 						switch_event_fire(&event);
@@ -2117,7 +2420,7 @@
 	char buf[512];
 	su_home_t *home = NULL;
 
-	if (!tech_pvt || tech_pvt->hash_key || !sip || !sip->sip_from || !sip->sip_from->a_url || 
+	if (!tech_pvt || tech_pvt->hash_key || !sip || !sip->sip_from || !sip->sip_from->a_url ||
 		!sip->sip_from->a_url->url_user || !sip->sip_from->a_url->url_host) {
 		return;
 	}
@@ -2133,7 +2436,7 @@
 	} else {
 		return;
 	}
-	
+
 	switch_mutex_lock(tech_pvt->profile->flag_mutex);
 	tech_pvt->hash_key = switch_core_session_strdup(tech_pvt->session, hash_key);
 	switch_core_hash_insert(tech_pvt->profile->chat_hash, tech_pvt->hash_key, tech_pvt);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/sofia_reg.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/sofia_reg.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/sofia_reg.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -58,7 +58,7 @@
 			switch_assert(gateway_ptr->sofia_private);
 		}
 		memset(gateway_ptr->sofia_private, 0, sizeof(*gateway_ptr->sofia_private));
-	
+
 		gateway_ptr->sofia_private->gateway = gateway_ptr;
 		nua_handle_bind(gateway_ptr->nh, gateway_ptr->sofia_private);
 	}
@@ -74,30 +74,34 @@
 		}
 		return;
 	}
-	
+
 	/*
-	if (!gateway_ptr->nh) {
-		sofia_reg_new_handle(gateway_ptr, SWITCH_FALSE);
-	}
-	*/
+	   if (!gateway_ptr->nh) {
+	   sofia_reg_new_handle(gateway_ptr, SWITCH_FALSE);
+	   }
+	 */
 
 	if (gateway_ptr->nh) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "UN-Registering %s\n", gateway_ptr->name);
-		nua_unregister(gateway_ptr->nh,
-					   NUTAG_URL(gateway_ptr->register_url),
-					   NUTAG_REGISTRAR(gateway_ptr->register_proxy), 
-					   TAG_END());
+		nua_unregister(gateway_ptr->nh, NUTAG_URL(gateway_ptr->register_url), NUTAG_REGISTRAR(gateway_ptr->register_proxy), TAG_END());
 	}
-	
 
 
+
 }
 
-static void sofia_reg_fire_custom_gateway_state_event(sofia_gateway_t *gateway) {
+static void sofia_reg_fire_custom_gateway_state_event(sofia_gateway_t *gateway, int status, const char *phrase)
+{
 	switch_event_t *s_event;
 	if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_GATEWAY_STATE) == SWITCH_STATUS_SUCCESS) {
 		switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "Gateway", gateway->name);
 		switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "State", sofia_state_string(gateway->state));
+		if (!zstr(phrase)) {
+			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "Phrase", phrase);
+		}
+		if (status) {
+			switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "Status", "%d", status);
+		}
 		switch_event_fire(&s_event);
 	}
 }
@@ -126,7 +130,7 @@
 	 * header (which we control in the outgoing subscription request)
 	 */
 	sofia_gateway_t *gateway_ptr;
-	
+
 	for (gateway_ptr = profile->gateways; gateway_ptr; gateway_ptr = gateway_ptr->next) {
 		sofia_gateway_subscription_t *gw_sub_ptr;
 
@@ -134,7 +138,7 @@
 			int ss_state = nua_callstate_authenticating;
 			sub_state_t ostate = gw_sub_ptr->state;
 			char *user_via = NULL;
-			
+
 			if (!now) {
 				gw_sub_ptr->state = ostate = SUB_STATE_UNSUBED;
 				gw_sub_ptr->expires_str = "0";
@@ -161,38 +165,27 @@
 								SIPTAG_EVENT_STR(gw_sub_ptr->event),
 								SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type),
 								SIPTAG_TO_STR(gateway_ptr->register_from),
-								SIPTAG_FROM_STR(gateway_ptr->register_from),
-								SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
-								TAG_NULL());
-				
+								SIPTAG_FROM_STR(gateway_ptr->register_from), SIPTAG_CONTACT_STR(gateway_ptr->register_contact), TAG_NULL());
+
 				break;
 			case SUB_STATE_UNSUBED:
 				gateway_ptr->sub_nh = nua_handle(gateway_ptr->profile->nua, NULL,
 												 NUTAG_URL(gateway_ptr->register_proxy),
 												 TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
 												 SIPTAG_TO_STR(gateway_ptr->register_to),
-												 NUTAG_CALLSTATE_REF(ss_state), 
-												 SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END());
+												 NUTAG_CALLSTATE_REF(ss_state), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END());
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "subscribing to [%s] on gateway [%s]\n", gw_sub_ptr->event, gateway_ptr->name);
-				
+
 				gateway_ptr->sofia_private = malloc(sizeof(*gateway_ptr->sofia_private));
 				switch_assert(gateway_ptr->sofia_private);
-				
+
 				memset(gateway_ptr->sofia_private, 0, sizeof(*gateway_ptr->sofia_private));
 
 				gateway_ptr->sofia_private->gateway = gateway_ptr;
 				nua_handle_bind(gateway_ptr->nh, gateway_ptr->sofia_private);
 
 				if (now) {
-					nua_subscribe(gateway_ptr->sub_nh,
-								  NUTAG_URL(gateway_ptr->register_url),
-								  TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
-								  SIPTAG_EVENT_STR(gw_sub_ptr->event),
-								  SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type),  
-								  SIPTAG_TO_STR(gateway_ptr->register_from),
-								  SIPTAG_FROM_STR(gateway_ptr->register_from),
-								  SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
-								  SIPTAG_EXPIRES_STR(gw_sub_ptr->expires_str),  // sofia stack bases its auto-refresh stuff on this
+					nua_subscribe(gateway_ptr->sub_nh, NUTAG_URL(gateway_ptr->register_url), TAG_IF(user_via, SIPTAG_VIA_STR(user_via)), SIPTAG_EVENT_STR(gw_sub_ptr->event), SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type), SIPTAG_TO_STR(gateway_ptr->register_from), SIPTAG_FROM_STR(gateway_ptr->register_from), SIPTAG_CONTACT_STR(gateway_ptr->register_contact), SIPTAG_EXPIRES_STR(gw_sub_ptr->expires_str),	// sofia stack bases its auto-refresh stuff on this
 								  TAG_NULL());
 					gw_sub_ptr->retry = now + gw_sub_ptr->retry_seconds;
 				} else {
@@ -203,13 +196,11 @@
 									SIPTAG_ACCEPT_STR(gw_sub_ptr->content_type),
 									SIPTAG_FROM_STR(gateway_ptr->register_from),
 									SIPTAG_TO_STR(gateway_ptr->register_from),
-									SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
-									SIPTAG_EXPIRES_STR(gw_sub_ptr->expires_str),
-									TAG_NULL());
+									SIPTAG_CONTACT_STR(gateway_ptr->register_contact), SIPTAG_EXPIRES_STR(gw_sub_ptr->expires_str), TAG_NULL());
 				}
 				gw_sub_ptr->state = SUB_STATE_TRYING;
 				break;
-				
+
 			case SUB_STATE_FAILED:
 			case SUB_STATE_TRYING:
 				if (gw_sub_ptr->retry && now >= gw_sub_ptr->retry) {
@@ -231,6 +222,7 @@
 void sofia_reg_check_gateway(sofia_profile_t *profile, time_t now)
 {
 	sofia_gateway_t *gateway_ptr, *last = NULL;
+	switch_event_t *event;
 
 	for (gateway_ptr = profile->gateways; gateway_ptr; gateway_ptr = gateway_ptr->next) {
 		if (gateway_ptr->deleted && gateway_ptr->state == REG_STATE_NOREG) {
@@ -244,6 +236,11 @@
 			switch_core_hash_delete(mod_sofia_globals.gateway_hash, gateway_ptr->register_from);
 			switch_core_hash_delete(mod_sofia_globals.gateway_hash, gateway_ptr->register_contact);
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleted gateway %s\n", gateway_ptr->name);
+			if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_GATEWAY_DEL) == SWITCH_STATUS_SUCCESS) {
+				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "profile-name", gateway_ptr->profile->name);
+				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Gateway", gateway_ptr->name);
+				switch_event_fire(&event);
+			}
 			if (gateway_ptr->ob_vars) {
 				switch_event_destroy(&gateway_ptr->ob_vars);
 			}
@@ -282,13 +279,11 @@
 			nua_handle_bind(nh, pvt);
 
 			gateway_ptr->pinging = 1;
-			nua_options(nh, 
+			nua_options(nh,
 						TAG_IF(gateway_ptr->register_sticky_proxy, NUTAG_PROXY(gateway_ptr->register_sticky_proxy)),
 						TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
 						SIPTAG_TO_STR(gateway_ptr->register_from),
-						SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
-						SIPTAG_FROM_STR(gateway_ptr->register_from),
-						TAG_END());
+						SIPTAG_CONTACT_STR(gateway_ptr->register_contact), SIPTAG_FROM_STR(gateway_ptr->register_from), TAG_END());
 
 			switch_safe_free(user_via);
 			user_via = NULL;
@@ -323,15 +318,17 @@
 			break;
 		case REG_STATE_UNREGED:
 			gateway_ptr->status = SOFIA_GATEWAY_DOWN;
+			gateway_ptr->retry = 0;
 
-			if (!gateway_ptr->nh) sofia_reg_new_handle(gateway_ptr, now ? 1 : 0);
+			if (!gateway_ptr->nh)
+				sofia_reg_new_handle(gateway_ptr, now ? 1 : 0);
 
 			if (sofia_glue_check_nat(gateway_ptr->profile, gateway_ptr->register_proxy)) {
 				user_via = sofia_glue_create_external_via(NULL, gateway_ptr->profile, gateway_ptr->register_transport);
 			}
 
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Registering %s\n", gateway_ptr->name);
-			
+
 			if (now) {
 				nua_register(gateway_ptr->nh,
 							 NUTAG_URL(gateway_ptr->register_url),
@@ -339,7 +336,7 @@
 							 TAG_IF(user_via, SIPTAG_VIA_STR(user_via)),
 							 SIPTAG_TO_STR(gateway_ptr->distinct_to ? gateway_ptr->register_to : gateway_ptr->register_from),
 							 SIPTAG_CONTACT_STR(gateway_ptr->register_contact),
-							 SIPTAG_FROM_STR(gateway_ptr->register_from),					 
+							 SIPTAG_FROM_STR(gateway_ptr->register_from),
 							 SIPTAG_EXPIRES_STR(gateway_ptr->expires_str),
 							 NUTAG_REGISTRAR(gateway_ptr->register_proxy),
 							 NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL());
@@ -355,17 +352,30 @@
 							   NUTAG_OUTBOUND("no-options-keepalive"), NUTAG_OUTBOUND("no-validate"), NUTAG_KEEPALIVE(0), TAG_NULL());
 			}
 			gateway_ptr->retry = now + gateway_ptr->retry_seconds;
-			gateway_ptr->state = REG_STATE_TRYING;			
+			gateway_ptr->state = REG_STATE_TRYING;
 			switch_safe_free(user_via);
 			user_via = NULL;
 			break;
 
 		case REG_STATE_FAILED:
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s Failed Registration, setting retry to %d seconds.\n", 
-								  gateway_ptr->name, gateway_ptr->retry_seconds * (gateway_ptr->failures + 1));
-			gateway_ptr->retry =  now + (gateway_ptr->retry_seconds * (gateway_ptr->failures + 1));
-			gateway_ptr->status = SOFIA_GATEWAY_DOWN;
-			gateway_ptr->state = REG_STATE_FAIL_WAIT;
+			{
+				int sec;
+
+				if (gateway_ptr->failure_status == 503) {
+					sec = gateway_ptr->retry_seconds;
+				} else {
+					sec = gateway_ptr->retry_seconds * (gateway_ptr->failures + 1);
+				}
+
+				gateway_ptr->retry = switch_epoch_time_now(NULL) + sec;
+				gateway_ptr->status = SOFIA_GATEWAY_DOWN;
+				gateway_ptr->state = REG_STATE_FAIL_WAIT;
+				gateway_ptr->failure_status = 0;
+
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s Failed Registration, setting retry to %d seconds.\n",
+								  gateway_ptr->name, sec);
+
+			}
 			break;
 		case REG_STATE_FAIL_WAIT:
 			if (!gateway_ptr->retry || now >= gateway_ptr->retry) {
@@ -384,7 +394,7 @@
 			break;
 		}
 		if (ostate != gateway_ptr->state) {
-			sofia_reg_fire_custom_gateway_state_event(gateway_ptr);
+			sofia_reg_fire_custom_gateway_state_event(gateway_ptr, 0, NULL);
 		}
 	}
 }
@@ -410,12 +420,10 @@
 	dst = sofia_glue_get_destination(argv[3]);
 	switch_assert(dst);
 
-	nh = nua_handle(profile->nua, NULL, SIPTAG_FROM_STR(profile->url), SIPTAG_TO_STR(to), NUTAG_URL(dst->contact), SIPTAG_CONTACT_STR(profile->url), TAG_END());
+	nh = nua_handle(profile->nua, NULL, SIPTAG_FROM_STR(profile->url), SIPTAG_TO_STR(to), NUTAG_URL(dst->contact), SIPTAG_CONTACT_STR(profile->url),
+					TAG_END());
 	nua_handle_bind(nh, &mod_sofia_globals.destroy_private);
-	nua_options(nh, 
-				TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)),
-				TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)),
-				TAG_END());
+	nua_options(nh, TAG_IF(dst->route_uri, NUTAG_PROXY(dst->route_uri)), TAG_IF(dst->route, SIPTAG_ROUTE_STR(dst->route)), TAG_END());
 
 	sofia_glue_free_destination(dst);
 
@@ -436,7 +444,8 @@
 	return 0;
 }
 
-void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent, const char *network_ip)
+void sofia_reg_send_reboot(sofia_profile_t *profile, const char *user, const char *host, const char *contact, const char *user_agent,
+						   const char *network_ip)
 {
 	const char *event = "check-sync";
 	const char *contenttype = "application/simple-message-summary";
@@ -446,6 +455,8 @@
 		event = "check-sync;reboot=true";
 	} else if (switch_stristr("linksys", user_agent)) {
 		event = "reboot_now";
+	} else if (switch_stristr("spa", user_agent)) {
+		event = "reboot";
 	}
 
 	sofia_glue_send_notify(profile, user, host, event, contenttype, body, contact, network_ip);
@@ -459,7 +470,7 @@
 	if ((nh = nua_handle_by_call_id(profile->nua, argv[0]))) {
 		nua_handle_destroy(nh);
 	}
-	
+
 	return 0;
 }
 
@@ -467,7 +478,7 @@
 {
 	switch_event_t *s_event;
 	sofia_profile_t *profile = (sofia_profile_t *) pArg;
-	
+
 	if (argc > 12 && atoi(argv[12]) == 1) {
 		sofia_reg_send_reboot(profile, argv[1], argv[2], argv[3], argv[7], argv[11]);
 	}
@@ -483,6 +494,25 @@
 			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "user-agent", argv[7]);
 			switch_event_fire(&s_event);
 		}
+
+		if (switch_event_create(&s_event, SWITCH_EVENT_PRESENCE_OUT) == SWITCH_STATUS_SUCCESS) {
+			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
+			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "rpid", "away");
+			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "login", profile->url);
+
+			if (argv[4]) {
+				switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "user-agent", argv[4]);
+			}
+
+			if (argv[1] && argv[2]) {
+				switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "from", "%s@%s", argv[1], argv[2]);
+			}
+
+			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "status", "Unregistered");
+			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "event_type", "presence");
+			switch_event_fire(&s_event);
+		}
+
 	}
 	return 0;
 }
@@ -514,18 +544,16 @@
 	}
 
 	sql = switch_mprintf("select call_id,sip_user,sip_host,contact,status,rpid,expires"
-					",user_agent,server_user,server_host,profile_name,network_ip"
-					",%d from sip_registrations where call_id='%q' %s", 
-					reboot, call_id, sqlextra);
+						 ",user_agent,server_user,server_host,profile_name,network_ip"
+						 ",%d from sip_registrations where call_id='%q' %s", reboot, call_id, sqlextra);
 	switch_safe_free(sqlextra);
-	
+
 	switch_mutex_lock(profile->ireg_mutex);
 	sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_reg_del_callback, profile);
 	switch_mutex_unlock(profile->ireg_mutex);
 	switch_safe_free(sql);
-	
-	sql = switch_mprintf("delete from sip_registrations where call_id='%q' or (sip_user='%q' and sip_host='%q')", 
-					call_id, user, host);
+
+	sql = switch_mprintf("delete from sip_registrations where call_id='%q' or (sip_user='%q' and sip_host='%q')", call_id, user, host);
 	sofia_glue_execute_sql(profile, &sql, SWITCH_FALSE);
 
 	switch_safe_free(sql);
@@ -545,13 +573,12 @@
 						",%d from sip_registrations where expires > 0 and expires <= %ld", reboot, (long) now);
 	} else {
 		switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,expires"
-						",user_agent,server_user,server_host,profile_name,network_ip"
-						",%d from sip_registrations where expires > 0", reboot);
+						",user_agent,server_user,server_host,profile_name,network_ip" ",%d from sip_registrations where expires > 0", reboot);
 	}
 
 	sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_reg_del_callback, profile);
 	if (now) {
-		switch_snprintf(sql, sizeof(sql), "delete from sip_registrations where expires > 0 and expires <= %ld and hostname='%s'", 
+		switch_snprintf(sql, sizeof(sql), "delete from sip_registrations where expires > 0 and expires <= %ld and hostname='%s'",
 						(long) now, mod_sofia_globals.hostname);
 	} else {
 		switch_snprintf(sql, sizeof(sql), "delete from sip_registrations where expires > 0 and hostname='%s'", mod_sofia_globals.hostname);
@@ -563,11 +590,10 @@
 
 	if (now) {
 		switch_snprintf(sql, sizeof(sql), "select call_id from sip_shared_appearance_dialogs where hostname='%s' "
-						"and profile_name='%s' and expires <= %ld", 
-						mod_sofia_globals.hostname, profile->name, (long) now);
-	
+						"and profile_name='%s' and expires <= %ld", mod_sofia_globals.hostname, profile->name, (long) now);
+
 		sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_sla_dialog_del_callback, profile);
-		switch_snprintf(sql, sizeof(sql), "delete from sip_registrations where expires > 0 and hostname='%s' and expires <= %ld", 
+		switch_snprintf(sql, sizeof(sql), "delete from sip_registrations where expires > 0 and hostname='%s' and expires <= %ld",
 						mod_sofia_globals.hostname, (long) now);
 
 
@@ -576,7 +602,7 @@
 
 
 	if (now) {
-		switch_snprintf(sql, sizeof(sql), "delete from sip_presence where expires > 0 and expires <= %ld and hostname='%s'", 
+		switch_snprintf(sql, sizeof(sql), "delete from sip_presence where expires > 0 and expires <= %ld and hostname='%s'",
 						(long) now, mod_sofia_globals.hostname);
 	} else {
 		switch_snprintf(sql, sizeof(sql), "delete from sip_presence where expires > 0 and hostname='%s'", mod_sofia_globals.hostname);
@@ -585,7 +611,7 @@
 	sofia_glue_actually_execute_sql(profile, sql, NULL);
 
 	if (now) {
-		switch_snprintf(sql, sizeof(sql), "delete from sip_authentication where expires > 0 and expires <= %ld and hostname='%s'", 
+		switch_snprintf(sql, sizeof(sql), "delete from sip_authentication where expires > 0 and expires <= %ld and hostname='%s'",
 						(long) now, mod_sofia_globals.hostname);
 	} else {
 		switch_snprintf(sql, sizeof(sql), "delete from sip_authentication where expires > 0 and hostname='%s'", mod_sofia_globals.hostname);
@@ -596,24 +622,35 @@
 
 
 	if (now) {
-		switch_snprintf(sql, sizeof(sql), "select call_id from sip_subscriptions where expires > 0 and expires <= %ld and hostname='%s'", 
-						(long) now, mod_sofia_globals.hostname);
+		switch_snprintf(sql, sizeof(sql),
+						"select call_id from sip_subscriptions where (expires = -1 or (expires > 0 and expires <= %ld)) and hostname='%s'", (long) now,
+						mod_sofia_globals.hostname);
 	} else {
-		switch_snprintf(sql, sizeof(sql), "select call_id from sip_subscriptions where expires > 0 and hostname='%s'", mod_sofia_globals.hostname);
+		switch_snprintf(sql, sizeof(sql), "select call_id from sip_subscriptions where expires >= -1 and hostname='%s'", mod_sofia_globals.hostname);
 	}
 
 	sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_sub_del_callback, profile);
 
 	if (now) {
-		switch_snprintf(sql, sizeof(sql), "delete from sip_subscriptions where expires > 0 and expires <= %ld and hostname='%s'", 
+		switch_snprintf(sql, sizeof(sql), "delete from sip_subscriptions where (expires = -1 or (expires > 0 and expires <= %ld)) and hostname='%s'",
 						(long) now, mod_sofia_globals.hostname);
 	} else {
-		switch_snprintf(sql, sizeof(sql), "delete from sip_subscriptions where expires > 0 and hostname='%s'", mod_sofia_globals.hostname);
+		switch_snprintf(sql, sizeof(sql), "delete from sip_subscriptions where expires >= -1 and hostname='%s'", mod_sofia_globals.hostname);
 	}
 
 	sofia_glue_actually_execute_sql(profile, sql, NULL);
 
 
+	if (now) {
+		switch_snprintf(sql, sizeof(sql), "delete from sip_dialogs where (expires = -1 or (expires > 0 and expires <= %ld)) and hostname='%s'",
+						(long) now, mod_sofia_globals.hostname);
+	} else {
+		switch_snprintf(sql, sizeof(sql), "delete from sip_dialogs where expires >= -1 and hostname='%s'", mod_sofia_globals.hostname);
+	}
+
+	sofia_glue_actually_execute_sql(profile, sql, NULL);
+
+
 	if (now && sofia_test_pflag(profile, PFLAG_NAT_OPTIONS_PING)) {
 		switch_snprintf(sql, sizeof(sql), "select call_id,sip_user,sip_host,contact,status,rpid,"
 						"expires,user_agent,server_user,server_host,profile_name"
@@ -641,8 +678,8 @@
 	cbt.len = len;
 
 	if (host) {
-		switch_snprintf(sql, sizeof(sql), "select contact from sip_registrations where sip_user='%s' and (sip_host='%s' or presence_hosts like '%%%s%%')"
-						, user, host, host);
+		switch_snprintf(sql, sizeof(sql), "select contact from sip_registrations where sip_user='%s' and (sip_host='%s' or presence_hosts like '%%%s%%')",
+						user, host, host);
 	} else {
 		switch_snprintf(sql, sizeof(sql), "select contact from sip_registrations where sip_user='%s'", user);
 	}
@@ -669,8 +706,8 @@
 	switch_uuid_format(uuid_str, &uuid);
 
 	sql = switch_mprintf("insert into sip_authentication (nonce,expires,profile_name,hostname, last_nc) "
-						 "values('%q', %ld, '%q', '%q', 0)", uuid_str, 
-						 switch_epoch_time_now(NULL) + (profile->nonce_ttl ? profile->nonce_ttl : DEFAULT_NONCE_TTL), 
+						 "values('%q', %ld, '%q', '%q', 0)", uuid_str,
+						 switch_epoch_time_now(NULL) + (profile->nonce_ttl ? profile->nonce_ttl : DEFAULT_NONCE_TTL),
 						 profile->name, mod_sofia_globals.hostname);
 	switch_assert(sql != NULL);
 	sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex);
@@ -733,7 +770,7 @@
 	/* all callers must confirm that sip, sip->sip_request and sip->sip_contact are not NULL */
 	switch_assert(sip != NULL && sip->sip_contact != NULL && sip->sip_request != NULL);
 
-	sofia_glue_get_addr(nua_current_request(nua), network_ip,  sizeof(network_ip), &network_port);
+	sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port);
 
 	snprintf(network_port_c, sizeof(network_port_c), "%d", network_port);
 
@@ -743,14 +780,25 @@
 	authorization = sip->sip_authorization;
 	contact = sip->sip_contact;
 	to = sip->sip_to;
+	from = sip->sip_from;
 
+	if (from) {
+		from_user = from->a_url->url_user;
+		from_host = from->a_url->url_host;
+	}
+
 	if (to) {
 		to_user = to->a_url->url_user;
 		to_host = to->a_url->url_host;
 	}
 
+	if (!to_user)
+		to_user = from_user;
+	if (!to_host)
+		to_host = from_host;
+
 	if (!to_user || !to_host) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not do authorization without a complete from header\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can not do authorization without a complete header\n");
 		nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS(nua), TAG_END());
 		switch_goto_int(r, 1, end);
 	}
@@ -759,13 +807,6 @@
 		reg_host = to_host;
 	}
 
-	from = sip->sip_from;
-
-	if (from) {
-		from_user = from->a_url->url_user;
-		from_host = from->a_url->url_host;
-	}
-
 	if (contact->m_url) {
 		const char *port = contact->m_url->url_port;
 		char new_port[25] = "";
@@ -779,18 +820,18 @@
 		if (switch_stristr("transport=tls", sip->sip_contact->m_url->url_params)) {
 			is_tls += 1;
 		}
-		
+
 		if (sip->sip_contact->m_url->url_type == url_sips) {
 			proto = "sips";
 			is_tls += 2;
 		}
-		
+
 		if (switch_stristr("transport=tcp", sip->sip_contact->m_url->url_params)) {
 			is_tcp = 1;
 		}
-		
+
 		display = contact->m_display;
-		
+
 		if (is_nat) {
 			if (is_tls) {
 				reg_desc = "Registered(TLS-NAT)";
@@ -830,7 +871,7 @@
 		} else if (is_nat) {
 			char my_contact_str[1024];
 			if (sip->sip_contact->m_url->url_params) {
-				switch_snprintf(my_contact_str, sizeof(my_contact_str), "sip:%s@%s:%d;%s", 
+				switch_snprintf(my_contact_str, sizeof(my_contact_str), "sip:%s@%s:%d;%s",
 								contact->m_url->url_user, url_ip, network_port, sip->sip_contact->m_url->url_params);
 			} else {
 				switch_snprintf(my_contact_str, sizeof(my_contact_str), "sip:%s@%s:%d", contact->m_url->url_user, url_ip, network_port);
@@ -854,7 +895,7 @@
 
 		if (contact->m_url->url_params) {
 			switch_snprintf(contact_str, sizeof(contact_str), "%s <%s:%s@%s%s;%s%s%s%s>",
-							display, proto, contact->m_url->url_user, contact_host, new_port, 
+							display, proto, contact->m_url->url_user, contact_host, new_port,
 							contact->m_url->url_params, received_data, is_nat ? ";fs_nat=yes" : "", path_encoded ? path_encoded : "");
 		} else {
 			switch_snprintf(contact_str, sizeof(contact_str), "%s <%s:%s@%s%s%s%s%s>", display, proto, contact->m_url->url_user, contact_host, new_port,
@@ -893,7 +934,7 @@
 			char *allow_multireg = NULL;
 
 			allow_multireg = switch_event_get_header(*v_event, "sip-allow-multiple-registrations");
-			if ( allow_multireg && switch_false(allow_multireg) ) {
+			if (allow_multireg && switch_false(allow_multireg)) {
 				avoid_multi_reg = 1;
 			}
 
@@ -927,7 +968,7 @@
 					if (*received_data && sofia_test_pflag(profile, PFLAG_RECIEVED_IN_NAT_REG_CONTACT)) {
 						switch_snprintf(received_data, sizeof(received_data), ";received=%s:%d", url_ip, network_port);
 					}
-	
+
 					if (!strcasecmp(v_contact_str, "nat-connectile-dysfunction") ||
 						!strcasecmp(v_contact_str, "NDLB-connectile-dysfunction") || !strcasecmp(v_contact_str, "NDLB-tls-connectile-dysfunction")) {
 						if (contact->m_url->url_params) {
@@ -970,7 +1011,7 @@
 			}
 			if (auth_res == AUTH_FORBIDDEN) {
 				nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
-				
+
 				/* Log line added to support Fail2Ban */
 				if (sofia_test_pflag(profile, PFLAG_LOG_AUTH_FAIL)) {
 					if (regtype == REG_REGISTER) {
@@ -979,7 +1020,7 @@
 					} else if (regtype == REG_INVITE) {
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "SIP auth failure (INVITE) on sofia profile '%s' "
 										  "for [%s@%s] from ip %s\n", profile->name, to_user, to_host, network_ip);
-					}									  
+					}
 				}
 			} else {
 				nua_respond(nh, SIP_401_UNAUTHORIZED, NUTAG_WITH_THIS(nua), TAG_END());
@@ -1035,13 +1076,12 @@
 	switch_assert(call_id);
 
 	/* Does this profile supports multiple registrations ? */
-	multi_reg = ( sofia_test_pflag(profile, PFLAG_MULTIREG) ) ? 1 : 0;
-	multi_reg_contact = ( sofia_test_pflag(profile, PFLAG_MULTIREG_CONTACT) ) ? 1 : 0;
+	multi_reg = (sofia_test_pflag(profile, PFLAG_MULTIREG)) ? 1 : 0;
+	multi_reg_contact = (sofia_test_pflag(profile, PFLAG_MULTIREG_CONTACT)) ? 1 : 0;
 
-	if ( multi_reg && avoid_multi_reg ) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
-					"Disabling multiple registrations on a per-user basis for %s@%s\n", 
-					switch_str_nil(to_user), switch_str_nil(to_host) );
+	if (multi_reg && avoid_multi_reg) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
+						  "Disabling multiple registrations on a per-user basis for %s@%s\n", switch_str_nil(to_user), switch_str_nil(to_host));
 		multi_reg = 0;
 	}
 
@@ -1062,13 +1102,13 @@
 
 		if (multi_reg) {
 			if (multi_reg_contact) {
-				sql = switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q' and contact='%q'", to_user, reg_host, contact_str);
+				sql =
+					switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q' and contact='%q'", to_user, reg_host, contact_str);
 			} else {
 				sql = switch_mprintf("delete from sip_registrations where call_id='%q'", call_id);
 			}
 		} else {
-			sql = switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q'", 
-								 to_user, reg_host);
+			sql = switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q'", to_user, reg_host);
 		}
 		switch_mutex_lock(profile->ireg_mutex);
 		sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
@@ -1076,11 +1116,13 @@
 		switch_find_local_ip(guess_ip4, sizeof(guess_ip4), NULL, AF_INET);
 		sql = switch_mprintf("insert into sip_registrations "
 							 "(call_id,sip_user,sip_host,presence_hosts,contact,status,rpid,expires,"
-							 "user_agent,server_user,server_host,profile_name,hostname,network_ip,network_port,sip_username,sip_realm,mwi_user,mwi_host) "
-							 "values ('%q','%q', '%q','%q','%q','%q', '%q', %ld, '%q', '%q', '%q', '%q', '%q', '%q', '%q','%q','%q','%q','%q')", 
+							 "user_agent,server_user,server_host,profile_name,hostname,network_ip,network_port,sip_username,sip_realm,"
+							 "mwi_user,mwi_host, orig_server_host, orig_hostname) "
+							 "values ('%q','%q', '%q','%q','%q','%q', '%q', %ld, '%q', '%q', '%q', '%q', '%q', '%q', '%q','%q','%q','%q','%q','%q','%q')", 
 							 call_id, to_user, reg_host, profile->presence_hosts ? profile->presence_hosts : reg_host, 
 							 contact_str, reg_desc, rpid, (long) switch_epoch_time_now(NULL) + (long) exptime * 2, 
-							 agent, from_user, guess_ip4, profile->name, mod_sofia_globals.hostname, network_ip, network_port_c, username, realm, mwi_user, mwi_host);
+							 agent, from_user, guess_ip4, profile->name, mod_sofia_globals.hostname, network_ip, network_port_c, username, realm, 
+							 mwi_user, mwi_host, guess_ip4, mod_sofia_globals.hostname);
 							 
 		if (sql) {
 			sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
@@ -1115,7 +1157,6 @@
 							  "Register:\nFrom:    [%s@%s]\nContact: [%s]\nExpires: [%ld]\n", to_user, reg_host, contact_str, (long) exptime);
 		}
 
-		
 #if 0
 		if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO);
@@ -1130,7 +1171,7 @@
 		}
 #else
 
-		if (sofia_test_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER) || 
+		if (sofia_test_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER) ||
 			(reg_count == 1 && sofia_test_pflag(profile, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER))) {
 
 			if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) {
@@ -1185,7 +1226,8 @@
 			}
 
 			if (multi_reg_contact) {
-				sql = switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q' and contact='%q'", to_user, reg_host, contact_str);
+				sql =
+					switch_mprintf("delete from sip_subscriptions where sip_user='%q' and sip_host='%q' and contact='%q'", to_user, reg_host, contact_str);
 			} else {
 				sql = switch_mprintf("delete from sip_subscriptions where call_id='%q'", call_id);
 			}
@@ -1193,7 +1235,8 @@
 			sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 
 			if (multi_reg_contact) {
-				sql = switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q' and contact='%q'", to_user, reg_host, contact_str);
+				sql =
+					switch_mprintf("delete from sip_registrations where sip_user='%q' and sip_host='%q' and contact='%q'", to_user, reg_host, contact_str);
 			} else {
 				sql = switch_mprintf("delete from sip_registrations where call_id='%q'", call_id);
 			}
@@ -1222,8 +1265,8 @@
 		if (exptime) {
 			switch_snprintf(exp_param, sizeof(exp_param), "expires=%ld", exptime);
 			sip_contact_add_param(nua_handle_home(nh), sip->sip_contact, exp_param);
-			
-			if (sofia_test_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER) || 
+
+			if (sofia_test_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER) ||
 				(reg_count == 1 && sofia_test_pflag(profile, PFLAG_MESSAGE_QUERY_ON_FIRST_REGISTER))) {
 				if (switch_event_create(&s_event, SWITCH_EVENT_MESSAGE_QUERY) == SWITCH_STATUS_SUCCESS) {
 					switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "Message-Account", "sip:%s@%s", mwi_user, mwi_host);
@@ -1242,19 +1285,16 @@
 				switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "expires", "%ld", (long) exptime);
 			}
 		}
-		
+
 		switch_rfc822_date(date, switch_micro_time_now());
 		nua_respond(nh, SIP_200_OK, SIPTAG_CONTACT(sip->sip_contact),
-					TAG_IF(path_val, SIPTAG_PATH_STR(path_val)),
-					NUTAG_WITH_THIS(nua),
-					SIPTAG_DATE_STR(date),
-					TAG_END());
+					TAG_IF(path_val, SIPTAG_PATH_STR(path_val)), NUTAG_WITH_THIS(nua), SIPTAG_DATE_STR(date), TAG_END());
 
 		if (s_event) {
 			switch_event_fire(&s_event);
 		}
-		
-		if (*contact_str && sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE) && sofia_sla_supported(sip)) {
+
+		if (*contact_str && sofia_test_pflag(profile, PFLAG_MANAGE_SHARED_APPEARANCE_SYLANTRO)) {
 			sofia_sla_handle_register(nua, profile, sip, exptime, contact_str);
 		}
 
@@ -1262,14 +1302,14 @@
 	}
 
 
- end:
+  end:
 	switch_safe_free(dup_mwi_account);
 
 	if (auth_params) {
 		switch_event_destroy(&auth_params);
 	}
 
-	return (uint8_t)r;
+	return (uint8_t) r;
 }
 
 
@@ -1284,7 +1324,7 @@
 	int network_port = 0;
 	char *is_nat = NULL;
 
-	sofia_glue_get_addr(nua_current_request(nua), network_ip,  sizeof(network_ip), &network_port);
+	sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port);
 
 	if (!(sip->sip_contact && sip->sip_contact->m_url)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "NO CONTACT!\n");
@@ -1301,7 +1341,7 @@
 		if (sip && sip->sip_via) {
 			const char *port = sip->sip_via->v_port;
 			const char *host = sip->sip_via->v_host;
-					
+
 			if (host && sip->sip_via->v_received) {
 				is_nat = "via received";
 			} else if (host && strcmp(network_ip, host)) {
@@ -1329,13 +1369,13 @@
 					break;
 				}
 			}
-				
+
 			if (ok) {
 				is_nat = last_acl;
 			}
 		}
 	}
-			
+
 	if (profile->reg_acl_count) {
 		uint32_t x = 0;
 		int ok = 1;
@@ -1351,7 +1391,7 @@
 		if (ok && !sofia_test_pflag(profile, PFLAG_BLIND_REG)) {
 			type = REG_AUTO_REGISTER;
 		} else if (!ok) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by acl \"%s\"\n", network_ip, profile->reg_acl[x]);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by register acl \"%s\"\n", network_ip, profile->reg_acl[x]);
 			nua_respond(nh, SIP_403_FORBIDDEN, NUTAG_WITH_THIS(nua), TAG_END());
 			goto end;
 		}
@@ -1362,13 +1402,16 @@
 		nua_respond(nh, SIP_500_INTERNAL_SERVER_ERROR, TAG_END());
 		goto end;
 	}
-	
-	if (is_nat && !sofia_glue_check_nat(profile, network_ip)) {
+
+	if (is_nat && profile->local_network && switch_check_network_list_ip(network_ip, profile->local_network)) {
+		if (profile->debug) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s is on local network, not seting NAT mode.\n", network_ip);
+		}
 		is_nat = NULL;
 	}
 
 	sofia_reg_handle_register(nua, profile, nh, sip, type, key, sizeof(key), &v_event, is_nat);
-	
+
 	if (v_event) {
 		switch_event_destroy(&v_event);
 	}
@@ -1385,15 +1428,13 @@
 									 nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
 									 tagi_t tags[])
 {
-	if (status >= 900) {
+	if (status >= 500) {
 		if (sofia_private && sofia_private->gateway) {
 			nua_handle_destroy(sofia_private->gateway->nh);
 			sofia_private->gateway->nh = NULL;
-			sofia_private->gateway->state = REG_STATE_UNREGED;
 		} else {
 			nua_handle_destroy(nh);
 		}
-		return;
 	}
 
 	if (sofia_private && sofia_private->gateway) {
@@ -1405,8 +1446,8 @@
 				const char *new_expires;
 				uint32_t expi;
 				if (contact->m_next) {
-					const char *sipip = profile->extsipip ?  profile->extsipip : profile->sipip;
-					for ( ; contact && strcasecmp(contact->m_url->url_host, sipip); contact = contact->m_next);
+					const char *sipip = profile->extsipip ? profile->extsipip : profile->sipip;
+					for (; contact && strcasecmp(contact->m_url->url_host, sipip); contact = contact->m_next);
 				}
 
 				if (!contact) {
@@ -1416,7 +1457,7 @@
 				if (contact->m_expires) {
 					new_expires = contact->m_expires;
 					expi = (uint32_t) atoi(new_expires);
-	
+
 					if (expi > 0 && expi != sofia_private->gateway->freq) {
 						sofia_private->gateway->freq = expi;
 						sofia_private->gateway->expires_str = switch_core_sprintf(sofia_private->gateway->pool, "%d", expi);
@@ -1439,12 +1480,13 @@
 			break;
 		default:
 			sofia_private->gateway->state = REG_STATE_FAILED;
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Registration Failed with status %s [%d]. failure #%d\n", 
+			sofia_private->gateway->failure_status = status;
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s Registration Failed with status %s [%d]. failure #%d\n",
 							  sofia_private->gateway->name, switch_str_nil(phrase), status, ++sofia_private->gateway->failures);
 			break;
 		}
 		if (ostate != sofia_private->gateway->state) {
-			sofia_reg_fire_custom_gateway_state_event(sofia_private->gateway);
+			sofia_reg_fire_custom_gateway_state_event(sofia_private->gateway, status, phrase);
 		}
 	}
 }
@@ -1508,14 +1550,14 @@
 
 	if (!gateway) {
 		if (gw_name) {
-			var_gateway = sofia_reg_find_gateway((char *)gw_name);
+			var_gateway = sofia_reg_find_gateway((char *) gw_name);
 		}
 
 
 		if (!var_gateway && realm) {
 			char rb[512] = "";
 			char *p = (char *) realm;
-			while((*p == '"')) {
+			while ((*p == '"')) {
 				p++;
 			}
 			switch_set_string(rb, p);
@@ -1530,15 +1572,15 @@
 		if (!var_gateway && sip && sip->sip_to) {
 			var_gateway = sofia_reg_find_gateway(sip->sip_to->a_url->url_host);
 		}
-		
+
 		if (var_gateway) {
 			gateway = var_gateway;
 		}
 	}
 
-	
 
 
+
 	if (!(scheme && realm)) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No scheme and realm!\n");
 		goto end;
@@ -1550,12 +1592,12 @@
 		switch_snprintf(authentication, sizeof(authentication), "%s:%s:%s:%s", scheme, realm, gateway->auth_username, gateway->register_password);
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No Matching gateway found\n");
-		goto cancel;		
+		goto cancel;
 	}
 
 	if (profile->debug) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Authenticating '%s' with '%s'.\n",
-			(sip_auth_username && sip_auth_password) ? sip_auth_username : gateway->auth_username, authentication);
+						  (sip_auth_username && sip_auth_password) ? sip_auth_username : gateway->auth_username, authentication);
 	}
 
 	ss_state = nua_callstate_authenticating;
@@ -1574,7 +1616,7 @@
 		nua_cancel(nh, TAG_END());
 	}
 
- end:
+  end:
 
 	if (var_gateway) {
 		sofia_reg_release_gateway(var_gateway);
@@ -1604,20 +1646,24 @@
 	return 0;
 }
 
-auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, 
-								sip_authorization_t const *authorization, 
-								sip_t const *sip, 
+static int sofia_reg_regcount_callback(void *pArg, int argc, char **argv, char **columnNames)
+{
+	int *ret = (int *) pArg;
+	if (argc == 1) {
+		*ret = atoi(argv[0]);
+	}
+	return 0;
+}
+
+auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile,
+								sip_authorization_t const *authorization,
+								sip_t const *sip,
 								const char *regstr,
-								char *np, 
-								size_t nplen, 
-								char *ip, 
-								switch_event_t **v_event, 
-								long exptime, 
-								sofia_regtype_t 
-								regtype, 
-								const char *to_user,
-								switch_event_t **auth_params,
-								long *reg_count)
+								char *np,
+								size_t nplen,
+								char *ip,
+								switch_event_t **v_event,
+								long exptime, sofia_regtype_t regtype, const char *to_user, switch_event_t **auth_params, long *reg_count)
 {
 	int indexnum;
 	const char *cur;
@@ -1630,6 +1676,7 @@
 	const char *passwd = NULL;
 	const char *a1_hash = NULL;
 	const char *mwi_account = NULL;
+	const char *call_id = NULL;
 	char *sql;
 	char *number_alias = NULL;
 	switch_xml_t domain, xml = NULL, user, param, uparams, dparams, group = NULL, gparams = NULL;
@@ -1638,6 +1685,10 @@
 	switch_event_t *params = NULL;
 	const char *auth_acl = NULL;
 	long ncl = 0;
+	sip_unknown_t *un;
+	const char *user_agent = NULL;
+	const char *user_agent_filter = profile->user_agent_filter;
+	uint32_t max_registrations_perext = profile->max_registrations_perext;
 
 	username = realm = nonce = uri = qop = cnonce = nc = response = NULL;
 
@@ -1697,11 +1748,13 @@
 		}
 	}
 
+	user_agent = (sip && sip->sip_user_agent) ? sip->sip_user_agent->g_string : "unknown";
+
 	if (zstr(np)) {
 		nonce_cb_t cb = { 0 };
 		long nc_long = 0;
 		first = 1;
-		
+
 		if (nc) {
 			nc_long = strtoul(nc, 0, 16);
 			sql = switch_mprintf("select nonce,last_nc from sip_authentication where nonce='%q' and last_nc < %lu", nonce, nc_long);
@@ -1711,7 +1764,7 @@
 
 		cb.nonce = np;
 		cb.nplen = nplen;
-		
+
 		switch_assert(sql != NULL);
 		sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_reg_nonce_callback, &cb);
 		free(sql);
@@ -1733,8 +1786,7 @@
 	switch_assert(params);
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "action", "sip_auth");
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_profile", profile->name);
-	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_user_agent",
-								   (sip && sip->sip_user_agent) ? sip->sip_user_agent->g_string : "unknown");
+	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_user_agent", user_agent);
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_username", username);
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_realm", realm);
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_nonce", nonce);
@@ -1769,6 +1821,17 @@
 		}
 	}
 
+	for (un = sip->sip_unknown; un; un = un->un_next) {
+		if (!strncasecmp(un->un_name, "X-", 2)) {
+			if (!zstr(un->un_value)) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "adding %s => %s to xml_curl request\n", un->un_name, un->un_value);
+				switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, un->un_name, un->un_value);
+			}
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "skipping %s => %s from xml_curl request\n", un->un_name, un->un_value);
+		}
+	}
+
 	if (qop) {
 		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "sip_auth_qop", qop);
 	}
@@ -1793,12 +1856,11 @@
 		domain_name = realm;
 	}
 
-	if (switch_xml_locate_user("id", zstr(username) ? "nobody" : username, 
-							   domain_name, ip, &xml, &domain, &user, &group, params) != SWITCH_STATUS_SUCCESS) {
+	if (switch_xml_locate_user("id", zstr(username) ? "nobody" : username, domain_name, ip, &xml, &domain, &user, &group, params) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't find user [%s@%s]\n"
 						  "You must define a domain called '%s' in your directory and add a user with the id=\"%s\" attribute\n"
-						  "and you must configure your device to use the proper domain in it's authentication credentials.\n"
-						  , username, domain_name, domain_name, username);
+						  "and you must configure your device to use the proper domain in it's authentication credentials.\n", username, domain_name,
+						  domain_name, username);
 
 		ret = AUTH_FORBIDDEN;
 		goto end;
@@ -1810,7 +1872,7 @@
 			goto end;
 		}
 	}
-	
+
 	if (!(number_alias = (char *) switch_xml_attr(user, "number-alias"))) {
 		number_alias = zstr(username) ? "nobody" : username;
 	}
@@ -1850,6 +1912,13 @@
 			if (!strcasecmp(var, "mwi-account")) {
 				mwi_account = val;
 			}
+
+			if (!strcasecmp(var, "user-agent-filter")) {
+				user_agent_filter = val;
+			}
+			if (!strcasecmp(var, "max-registrations-per-extension")) {
+				max_registrations_perext = atoi(val);
+			}
 		}
 	}
 
@@ -1877,6 +1946,13 @@
 			if (!strcasecmp(var, "mwi-account")) {
 				mwi_account = val;
 			}
+
+			if (!strcasecmp(var, "user-agent-filter")) {
+				user_agent_filter = val;
+			}
+			if (!strcasecmp(var, "max-registrations-per-extension")) {
+				max_registrations_perext = atoi(val);
+			}
 		}
 	}
 
@@ -1904,14 +1980,69 @@
 			if (!strcasecmp(var, "mwi-account")) {
 				mwi_account = val;
 			}
+			if (!strcasecmp(var, "user-agent-filter")) {
+				user_agent_filter = val;
+			}
+			if (!strcasecmp(var, "max-registrations-per-extension")) {
+				max_registrations_perext = atoi(val);
+			}
 		}
 	}
 
 	if (auth_acl) {
 		if (!switch_check_network_list_ip(ip, auth_acl)) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by user acl %s\n", ip, auth_acl);
-			ret = AUTH_FORBIDDEN;
-			goto end;
+			int network_ip_is_proxy = 0, x = 0;
+			char *last_acl = NULL;
+			if (profile->proxy_acl_count == 0) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by user acl [%s] and no proxy acl present\n", ip, auth_acl);
+				ret = AUTH_FORBIDDEN;
+				goto end;
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP %s Rejected by user acl [%s] checking proxy ACLs now\n", ip, auth_acl);
+			}
+			/* Check if network_ip is a proxy allowed to send us calls */
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%d acls to check for proxy\n", profile->proxy_acl_count);
+
+			for (x = 0; x < profile->proxy_acl_count; x++) {
+				last_acl = profile->proxy_acl[x];
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "checking %s against acl %s\n", ip, last_acl);
+				if (switch_check_network_list_ip(ip, last_acl)) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s is a proxy according to the %s acl\n", ip, last_acl);
+					network_ip_is_proxy = 1;
+					break;
+				}
+			}
+			/*
+			 * if network_ip is a proxy allowed to send traffic, check for auth
+			 * ip header and see if it matches against the auth acl
+			 */
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "network ip is a proxy [%d]\n", network_ip_is_proxy);
+			if (network_ip_is_proxy) {
+				int x_auth_ip = 0;
+				for (un = sip->sip_unknown; un; un = un->un_next) {
+					if (!strcasecmp(un->un_name, "X-AUTH-IP")) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "found auth ip [%s] header of [%s]\n", un->un_name, un->un_value);
+						if (!zstr(un->un_value)) {
+							if (!switch_check_network_list_ip(un->un_value, auth_acl)) {
+								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "IP %s Rejected by user acl %s\n", un->un_value, auth_acl);
+								ret = AUTH_FORBIDDEN;
+								goto end;
+							} else {
+								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
+												  "IP %s allowed by acl %s, checking credentials\n", un->un_value, auth_acl);
+								x_auth_ip = 1;
+								break;
+							}
+						}
+					}
+				}
+				if (!x_auth_ip) {
+					ret = AUTH_FORBIDDEN;
+					goto end;
+				}
+			}
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "IP [%s] passed ACL check [%s]\n", ip, auth_acl);
 		}
 	}
 
@@ -1931,6 +2062,46 @@
 
 	}
 
+	if (user_agent_filter) {
+		if (switch_regex_match(user_agent, user_agent_filter) == SWITCH_STATUS_SUCCESS) {
+			if (sofia_test_pflag(profile, PFLAG_LOG_AUTH_FAIL)) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
+								  "SIP auth OK (REGISTER) due to user-agent-filter.  Filter \"%s\" User-Agent \"%s\"\n", user_agent_filter, user_agent);
+			}
+		} else {
+			ret = AUTH_FORBIDDEN;
+			if (sofia_test_pflag(profile, PFLAG_LOG_AUTH_FAIL)) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+								  "SIP auth failure (REGISTER) due to user-agent-filter.  Filter \"%s\" User-Agent \"%s\"\n", user_agent_filter,
+								  user_agent);
+			}
+			goto end;
+		}
+	}
+
+	if (max_registrations_perext > 0 && (sip && sip->sip_contact && (sip->sip_contact->m_expires == NULL || atol(sip->sip_contact->m_expires) > 0))) {
+		/* if expires is null still process */
+		/* expires == 0 means the phone is going to unregiser, so don't count against max */
+		int count = 0;
+
+		call_id = sip->sip_call_id->i_id;
+		switch_assert(call_id);
+
+		sql = switch_mprintf("select count(sip_user) from sip_registrations where sip_user='%q' AND call_id <> '%q'", username, call_id);
+		switch_assert(sql != NULL);
+		sofia_glue_execute_sql_callback(profile, NULL, sql, sofia_reg_regcount_callback, &count);
+		free(sql);
+
+		if (count + 1 > max_registrations_perext) {
+			ret = AUTH_FORBIDDEN;
+			if (sofia_test_pflag(profile, PFLAG_LOG_AUTH_FAIL)) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+								  "SIP auth failure (REGISTER) due to reaching max allowed registrations.  Count: %d\n", count);
+			}
+			goto end;
+		}
+	}
+
   for_the_sake_of_interop:
 
 	if ((input = switch_mprintf("%s:%q", regstr, uri))) {
@@ -1979,7 +2150,7 @@
 			switch_event_create_plain(v_event, SWITCH_EVENT_REQUEST_PARAMS);
 		}
 
-		
+
 		if (v_event && *v_event) {
 			short int xparams_type[6];
 			switch_xml_t xparams[6];
@@ -2030,15 +2201,15 @@
 				int j = 0;
 
 				for (j = 0; j < i; j++) {
-					for (param = switch_xml_child(xparams[j], (xparams_type[j]?"variable":"param")); param; param = param->next) {
+					for (param = switch_xml_child(xparams[j], (xparams_type[j] ? "variable" : "param")); param; param = param->next) {
 						const char *var = switch_xml_attr_soft(param, "name");
 						const char *val = switch_xml_attr_soft(param, "value");
 						sofia_gateway_t *gateway_ptr = NULL;
 
-						if (!zstr(var) && !zstr(val) && (xparams_type[j] == 1 || !strncasecmp(var, "sip-",4) || !strcasecmp(var, "register-gateway")) ) {
+						if (!zstr(var) && !zstr(val) && (xparams_type[j] == 1 || !strncasecmp(var, "sip-", 4) || !strcasecmp(var, "register-gateway"))) {
 							if (!switch_event_get_header(*v_event, var)) {
 								if (profile->debug) {
-									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "event_add_header -> '%s' = '%s'\n",var, val);
+									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "event_add_header -> '%s' = '%s'\n", var, val);
 								}
 								switch_event_add_header_string(*v_event, SWITCH_STACK_BOTTOM, var, val);
 							} else {
@@ -2064,7 +2235,7 @@
 													gateway_ptr->state = REG_STATE_UNREGISTER;
 												}
 												if (ostate != gateway_ptr->state) {
-													sofia_reg_fire_custom_gateway_state_event(gateway_ptr);
+													sofia_reg_fire_custom_gateway_state_event(gateway_ptr, 0, NULL);
 												}
 												sofia_reg_release_gateway(gateway_ptr);
 											}
@@ -2090,7 +2261,7 @@
 												gateway_ptr->state = REG_STATE_UNREGISTER;
 											}
 											if (ostate != gateway_ptr->state) {
-												sofia_reg_fire_custom_gateway_state_event(gateway_ptr);
+												sofia_reg_fire_custom_gateway_state_event(gateway_ptr, 0, NULL);
 											}
 											sofia_reg_release_gateway(gateway_ptr);
 										} else {
@@ -2118,7 +2289,7 @@
 #else
 #define	LL_FMT "l"
 #endif
-		sql = switch_mprintf("update sip_authentication set expires='%"LL_FMT"u',last_nc=%lu where nonce='%s'", 
+		sql = switch_mprintf("update sip_authentication set expires='%" LL_FMT "u',last_nc=%lu where nonce='%s'",
 							 switch_epoch_time_now(NULL) + (profile->nonce_ttl ? profile->nonce_ttl : exptime + 10), ncl, nonce);
 
 		switch_assert(sql != NULL);
@@ -2191,7 +2362,7 @@
 	sofia_gateway_t *gateway = NULL;
 	switch_hash_index_t *hi;
 	const void *var;
-    void *val;
+	void *val;
 
 	switch_mutex_lock(mod_sofia_globals.hash_mutex);
 	for (hi = switch_hash_first(NULL, mod_sofia_globals.gateway_hash); hi; hi = switch_hash_next(hi)) {
@@ -2246,7 +2417,13 @@
 	switch_mutex_unlock(mod_sofia_globals.hash_mutex);
 
 	if (status == SWITCH_STATUS_SUCCESS) {
+		switch_event_t *s_event;
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Added gateway '%s' to profile '%s'\n", gateway->name, gateway->profile->name);
+		if (switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_GATEWAY_ADD) == SWITCH_STATUS_SUCCESS) {
+			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "Gateway", gateway->name);
+			switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile-name", gateway->profile->name);
+			switch_event_fire(&s_event);
+		}
 	}
 
 	return status;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/sofia_sla.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/sofia_sla.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_sofia/sofia_sla.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -74,7 +74,7 @@
 	char exp_str[256] = "";
 	char my_contact[256] = "";
 	char *sql;
-	struct sla_helper sh = { { 0 } };
+	struct sla_helper sh = { {0} };
 	char *contact_str = sofia_glue_strip_uri(full_contact);
 	sofia_transport_t transport = sofia_glue_url2transport(sip->sip_contact->m_url);
 	char network_ip[80];
@@ -83,17 +83,17 @@
 	char *route_uri = NULL;
 	char port_str[25] = "";
 
-	sofia_glue_get_addr(nua_current_request(nua), network_ip,  sizeof(network_ip), &network_port);
+	sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port);
 
-	sql = switch_mprintf("select call_id from sip_shared_appearance_dialogs where hostname='%q' and profile_name='%q' and contact_str='%q'", 
+	sql = switch_mprintf("select call_id from sip_shared_appearance_dialogs where hostname='%q' and profile_name='%q' and contact_str='%q'",
 						 mod_sofia_globals.hostname, profile->name, contact_str);
 	sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, get_call_id_callback, &sh);
 
 	free(sql);
-	
+
 	if (*sh.call_id) {
 		if (!(nh = nua_handle_by_call_id(profile->nua, sh.call_id))) {
-			if ((sql = switch_mprintf("delete from sip_shared_appearance_dialogs where hostname='%q' and profile_name='%q' and contact_str='%q'", 
+			if ((sql = switch_mprintf("delete from sip_shared_appearance_dialogs where hostname='%q' and profile_name='%q' and contact_str='%q'",
 									  mod_sofia_globals.hostname, profile->name, contact_str))) {
 				sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 			}
@@ -110,17 +110,17 @@
 
 	switch_snprintf(port_str, sizeof(port_str), ":%ld", sofia_glue_transport_has_tls(transport) ? profile->tls_sip_port : profile->sip_port);
 
-	if (sofia_glue_check_nat(profile, network_ip)) { 
-		switch_snprintf(my_contact, sizeof(my_contact), "<sip:%s@%s%s;transport=%s>;expires=%s", profile->sla_contact, 
+	if (sofia_glue_check_nat(profile, network_ip)) {
+		switch_snprintf(my_contact, sizeof(my_contact), "<sip:%s@%s%s;transport=%s>;expires=%s", profile->sla_contact,
 						profile->extsipip, port_str, sofia_glue_transport2str(transport), exp_str);
 	} else {
-		switch_snprintf(my_contact, sizeof(my_contact), "<sip:%s@%s%s;transport=%s>;expires=%s", profile->sla_contact, 
+		switch_snprintf(my_contact, sizeof(my_contact), "<sip:%s@%s%s;transport=%s>;expires=%s", profile->sla_contact,
 						profile->sipip, port_str, sofia_glue_transport2str(transport), exp_str);
 	}
 
-	dst = sofia_glue_get_destination((char*) full_contact);
+	dst = sofia_glue_get_destination((char *) full_contact);
 
-	if(dst->route_uri) {
+	if (dst->route_uri) {
 		route_uri = sofia_glue_strip_uri(dst->route_uri);
 	}
 
@@ -130,9 +130,7 @@
 				  SIPTAG_FROM(sip->sip_to),
 				  SIPTAG_CONTACT_STR(my_contact),
 				  SIPTAG_EXPIRES_STR(exp_str),
-				  SIPTAG_EVENT_STR("dialog;sla;include-session-description"),
-				  SIPTAG_ACCEPT_STR("application/dialog-info+xml"),
-				  TAG_NULL());
+				  SIPTAG_EVENT_STR("dialog;sla;include-session-description"), SIPTAG_ACCEPT_STR("application/dialog-info+xml"), TAG_NULL());
 
 	sofia_glue_free_destination(dst);
 
@@ -158,13 +156,13 @@
 
 	sofia_transport_t transport = sofia_glue_url2transport(sip->sip_contact->m_url);
 
-	sofia_glue_get_addr(nua_current_request(nua), network_ip,  sizeof(network_ip), &network_port);
+	sofia_glue_get_addr(nua_current_request(nua), network_ip, sizeof(network_ip), &network_port);
 	/*
 	 * XXX MTK FIXME - we don't look at the tag to see if NUTAG_SUBSTATE(nua_substate_terminated) or
 	 * a Subscription-State header with state "terminated" and/or expiration of 0. So we never forget
 	 * about them here.
 	 * likewise, we also don't have a hook against nua_r_notify events, so we can't see nua_substate_terminated there.
-	*/
+	 */
 
 	/*
 	 * extracting AOR is weird...
@@ -180,30 +178,29 @@
 	 * ok, and now that we HAVE the AOR, we REALLY should go check in the XML config and see if this particular
 	 * extension is set up to have shared appearances managed. right now it is all-or-nothing on the profile,
 	 * which won't be sufficient for real life. FIXME XXX MTK
-	*/
+	 */
 
 	/* then the subscriber is the user at their network location... this is arguably the wrong way, but works so far... */
 
 	subscriber = switch_mprintf("sip:%s@%s;transport=%s", sip->sip_from->a_url->url_user,
 								sip->sip_contact->m_url->url_host, sofia_glue_transport2str(transport));
- 
+
 	if ((sql =
-		switch_mprintf("delete from sip_shared_appearance_subscriptions where subscriber='%q' and profile_name='%q' and hostname='%q'",
-			subscriber, profile->name, mod_sofia_globals.hostname
-			))) {
+		 switch_mprintf("delete from sip_shared_appearance_subscriptions where subscriber='%q' and profile_name='%q' and hostname='%q'",
+						subscriber, profile->name, mod_sofia_globals.hostname))) {
 		sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 	}
 
 	if ((sql =
 		 switch_mprintf("insert into sip_shared_appearance_subscriptions (subscriber, call_id, aor, profile_name, hostname, contact_str, network_ip) "
-		               "values ('%q','%q','%q','%q','%q','%q','%q')",
-		                subscriber, sip->sip_call_id->i_id, aor, profile->name, mod_sofia_globals.hostname, contact_str, network_ip))) {
+						"values ('%q','%q','%q','%q','%q','%q','%q')",
+						subscriber, sip->sip_call_id->i_id, aor, profile->name, mod_sofia_globals.hostname, contact_str, network_ip))) {
 		sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 	}
 
 	if (strstr(contact_str, ";fs_nat")) {
 		char *p;
-		route_uri = sofia_glue_get_url_from_contact((char *)contact_str, 1);
+		route_uri = sofia_glue_get_url_from_contact((char *) contact_str, 1);
 		if ((p = strstr(contact_str, ";fs_"))) {
 			*p = '\0';
 		}
@@ -222,21 +219,17 @@
 
 	switch_snprintf(port_str, sizeof(port_str), ":%ld", sofia_glue_transport_has_tls(transport) ? profile->tls_sip_port : profile->sip_port);
 
-	if (sofia_glue_check_nat(profile, network_ip)) { 
-		sla_contact = switch_mprintf("<sip:%s@%s%s;transport=%s>", profile->sla_contact, profile->extsipip,
-									 port_str, sofia_glue_transport2str(transport));
+	if (sofia_glue_check_nat(profile, network_ip)) {
+		sla_contact = switch_mprintf("<sip:%s@%s%s;transport=%s>", profile->sla_contact, profile->extsipip, port_str, sofia_glue_transport2str(transport));
 	} else {
-		sla_contact = switch_mprintf("<sip:%s@%s%s;transport=%s>", profile->sla_contact, profile->sipip,
-									 port_str, sofia_glue_transport2str(transport));
+		sla_contact = switch_mprintf("<sip:%s@%s%s;transport=%s>", profile->sla_contact, profile->sipip, port_str, sofia_glue_transport2str(transport));
 	}
 
-	nua_respond(nh, SIP_202_ACCEPTED, SIPTAG_CONTACT_STR(sla_contact), NUTAG_WITH_THIS(nua),
-				TAG_IF(route_uri, NUTAG_PROXY(route_uri)),
-				SIPTAG_SUBSCRIPTION_STATE_STR("active;expires=300"), /* you thought the OTHER time was fake... need delta here FIXME XXX MTK */
-				SIPTAG_EXPIRES_STR("300"), /* likewise, totally fake - FIXME XXX MTK */
+	nua_respond(nh, SIP_202_ACCEPTED, SIPTAG_CONTACT_STR(sla_contact), NUTAG_WITH_THIS(nua), TAG_IF(route_uri, NUTAG_PROXY(route_uri)), SIPTAG_SUBSCRIPTION_STATE_STR("active;expires=300"),	/* you thought the OTHER time was fake... need delta here FIXME XXX MTK */
+				SIPTAG_EXPIRES_STR("300"),	/* likewise, totally fake - FIXME XXX MTK */
 				/*  sofia_presence says something about needing TAG_IF(sticky, NUTAG_PROXY(sticky)) for NAT stuff? */
 				TAG_END());
-	
+
 	switch_safe_free(aor);
 	switch_safe_free(subscriber);
 	switch_safe_free(route_uri);
@@ -251,7 +244,8 @@
 
 void sofia_sla_handle_sip_r_subscribe(int status,
 									  char const *phrase,
-									  nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[])
+									  nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip,
+									  tagi_t tags[])
 {
 	if (status >= 300) {
 		nua_handle_destroy(nh);
@@ -267,8 +261,8 @@
 		}
 
 		if ((sql = switch_mprintf("insert into sip_shared_appearance_dialogs (profile_name, hostname, contact_str, call_id, expires) "
-								  "values ('%q','%q','%q','%q','%ld')", 
-								  profile->name, mod_sofia_globals.hostname, contact_str, sip->sip_call_id->i_id, (long)expires))) {
+								  "values ('%q','%q','%q','%q','%ld')",
+								  profile->name, mod_sofia_globals.hostname, contact_str, sip->sip_call_id->i_id, (long) expires))) {
 			sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE);
 		}
 
@@ -298,20 +292,20 @@
 	 *     yet check each AOR as it comes in to see if it is to be managed, is more subscribers than we probably
 	 *     should have). for the current prototype stage, this works ok anyway.
 	 *   and because we don't parse the XML, we even reflect it right back to the notifier/sender (which is called
-     *     "target" in the payload XML, of course).
+	 *     "target" in the payload XML, of course).
 	 *   also because we don't track on a per-appearance basis, there IS NOT a hook back from sofia_glue to add
 	 *     an appearance index to the outbound invite for the "next free appearance". this can lead to race 
 	 *     conditions where a call shows up on slightly different line key numbers at different phones, making
 	 *     "pick up on line X" meaningless if such a race occurs. again, it is a prototype. we can fix it later.
-	*/
+	 */
 
 
 	/* the dispatcher calls us just because it is aimed at us, so check to see if it is dialog;sla at the very least... */
 
-	if (  (!sip->sip_event) 
-	   || (strcasecmp(sip->sip_event->o_type, "dialog"))
-	   || !msg_params_find(sip->sip_event->o_params, "sla") ) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,"sent to sla-agent but not dialog;sla\n");
+	if ((!sip->sip_event)
+		|| (strcasecmp(sip->sip_event->o_type, "dialog"))
+		|| !msg_params_find(sip->sip_event->o_params, "sla")) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "sent to sla-agent but not dialog;sla\n");
 		return;
 	}
 
@@ -326,16 +320,15 @@
 	 * so we don't reflect it back at anyone who is the "boss" config, but we do reflect it back at the "secretary"
 	 * config. if that breaks the phone, just set them all up as the "boss" config where ext#==third-party#
 	 */
-	contact = switch_mprintf("sip:%s@%s;transport=%s",sip->sip_contact->m_url->url_user,
+	contact = switch_mprintf("sip:%s@%s;transport=%s", sip->sip_contact->m_url->url_user,
 							 sip->sip_contact->m_url->url_host, sofia_glue_transport2str(transport));
 
 	if (sip->sip_payload && sip->sip_payload->pl_data) {
 		sql = switch_mprintf("select subscriber,call_id,aor,profile_name,hostname,contact_str,network_ip from sip_shared_appearance_subscriptions where "
-		"aor='%q' and profile_name='%q' and hostname='%q'",
-		aor, profile->name, mod_sofia_globals.hostname); 
+							 "aor='%q' and profile_name='%q' and hostname='%q'", aor, profile->name, mod_sofia_globals.hostname);
 
 		helper.profile = profile;
-		helper.payload = sip->sip_payload->pl_data; 	/* could just send the WHOLE payload. you'd get the type that way. */
+		helper.payload = sip->sip_payload->pl_data;	/* could just send the WHOLE payload. you'd get the type that way. */
 
 		/* which mutex if any is correct to hold in this callback? XXX MTK FIXME */
 		sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sofia_sla_sub_callback, &helper);
@@ -360,7 +353,7 @@
 	char *route_uri = NULL;
 	char *xml_fixup = NULL;
 	char *fixup = NULL;
-	nh = nua_handle_by_call_id(helper->profile->nua, call_id);  /* that's all you need to find the subscription's nh */
+	nh = nua_handle_by_call_id(helper->profile->nua, call_id);	/* that's all you need to find the subscription's nh */
 
 	if (nh) {
 
@@ -383,25 +376,22 @@
 			}
 		}
 
-		if (sofia_test_pflag(helper->profile, PFLAG_AUTO_NAT)) {
-			if (sofia_glue_check_nat(helper->profile, network_ip)) { 
+		if (helper->profile->extsipip) {
+			if (sofia_glue_check_nat(helper->profile, network_ip)) {
 				fixup = switch_string_replace(helper->payload, helper->profile->sipip, helper->profile->extsipip);
-			} else  {
+			} else {
 				fixup = switch_string_replace(helper->payload, helper->profile->extsipip, helper->profile->sipip);
 			}
 			xml_fixup = fixup;
 		} else {
 			xml_fixup = helper->payload;
 		}
-		
-		nua_notify(nh,
-				   SIPTAG_SUBSCRIPTION_STATE_STR("active;expires=300"), /* XXX MTK FIXME - this is totally fake calculation */
-				   TAG_IF(route_uri, NUTAG_PROXY(route_uri)),
-				   SIPTAG_CONTENT_TYPE_STR("application/dialog-info+xml"),	/* could've just kept the type from the payload */
-				   SIPTAG_PAYLOAD_STR(xml_fixup),
-				   TAG_END());
+
+		nua_notify(nh, SIPTAG_SUBSCRIPTION_STATE_STR("active;expires=300"),	/* XXX MTK FIXME - this is totally fake calculation */
+				   TAG_IF(route_uri, NUTAG_PROXY(route_uri)), SIPTAG_CONTENT_TYPE_STR("application/dialog-info+xml"),	/* could've just kept the type from the payload */
+				   SIPTAG_PAYLOAD_STR(xml_fixup), TAG_END());
 		switch_safe_free(route_uri);
-		if (fixup && fixup != helper->payload) { 
+		if (fixup && fixup != helper->payload) {
 			free(fixup);
 		}
 	}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_unicall/mod_unicall.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_unicall/mod_unicall.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/endpoints/mod_unicall/mod_unicall.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -30,7 +30,7 @@
  * mod_unicall.c -- UniCall endpoint module
  *
  */
- 
+
 /* This is a work in progress. Unfinished. Non-functional */
 
 #include <switch.h>
@@ -39,7 +39,7 @@
 SWITCH_MODULE_LOAD_FUNCTION(mod_unicall_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_unicall_shutdown);
 //SWITCH_MODULE_RUNTIME_FUNCTION(mod_unicall_runtime);
-SWITCH_MODULE_DEFINITION(mod_unicall, mod_unicall_load, mod_unicall_shutdown, NULL);    //mod_unicall_runtime);
+SWITCH_MODULE_DEFINITION(mod_unicall, mod_unicall_load, mod_unicall_shutdown, NULL);	//mod_unicall_runtime);
 
 #define MAX_SPANS 128
 
@@ -47,77 +47,74 @@
 static switch_memory_pool_t *module_pool = NULL;
 static volatile int running = 1;
 
-typedef struct
-{
-    int span;
-    const char *id;
-    const char *protocol_class;
-    const char *protocol_variant;
-    int protocol_end;
-    int outgoing_ok;
+typedef struct {
+	int span;
+	const char *id;
+	const char *protocol_class;
+	const char *protocol_variant;
+	int protocol_end;
+	int outgoing_ok;
 	char *dialplan;
 	char *context;
-    int fd;
-    uc_t *uc;
+	int fd;
+	uc_t *uc;
 } span_data_t;
 
 span_data_t *span_data[MAX_SPANS];
 
 typedef enum {
-    TFLAG_IO = (1 << 0),
-    TFLAG_INBOUND = (1 << 1),
-    TFLAG_OUTBOUND = (1 << 2),
-    TFLAG_DTMF = (1 << 3),
-    TFLAG_VOICE = (1 << 4),
-    TFLAG_HANGUP = (1 << 5),
-    TFLAG_LINEAR = (1 << 6),
-    TFLAG_CODEC = (1 << 7),
-    TFLAG_BREAK = (1 << 8)
+	TFLAG_IO = (1 << 0),
+	TFLAG_INBOUND = (1 << 1),
+	TFLAG_OUTBOUND = (1 << 2),
+	TFLAG_DTMF = (1 << 3),
+	TFLAG_VOICE = (1 << 4),
+	TFLAG_HANGUP = (1 << 5),
+	TFLAG_LINEAR = (1 << 6),
+	TFLAG_CODEC = (1 << 7),
+	TFLAG_BREAK = (1 << 8)
 } TFLAGS;
 
 typedef enum {
-    GFLAG_MY_CODEC_PREFS = (1 << 0)
+	GFLAG_MY_CODEC_PREFS = (1 << 0)
 } GFLAGS;
 
 
-static struct
-{
-    int debug;
-    /*! Requested frame duration, in ms */
-    uint32_t frame_duration;
-    int dtmf_on;
-    int dtmf_off;
-    int suppress_dtmf_tone;
-    int ignore_dtmf_tone;
-    char *dialplan;
-    char *codec_string;
-    char *codec_order[SWITCH_MAX_CODECS];
-    int codec_order_last;
-    char *codec_rates_string;
-    char *codec_rates[SWITCH_MAX_CODECS];
-    int codec_rates_last;
-    unsigned int flags;
-    int calls;
-    int configured_spans;
+static struct {
+	int debug;
+	/*! Requested frame duration, in ms */
+	uint32_t frame_duration;
+	int dtmf_on;
+	int dtmf_off;
+	int suppress_dtmf_tone;
+	int ignore_dtmf_tone;
+	char *dialplan;
+	char *codec_string;
+	char *codec_order[SWITCH_MAX_CODECS];
+	int codec_order_last;
+	char *codec_rates_string;
+	char *codec_rates[SWITCH_MAX_CODECS];
+	int codec_rates_last;
+	unsigned int flags;
+	int calls;
+	int configured_spans;
 	switch_hash_t *call_hash;
-    switch_mutex_t *mutex;
-    switch_mutex_t *hash_mutex;
-    switch_mutex_t *channel_mutex;
+	switch_mutex_t *mutex;
+	switch_mutex_t *hash_mutex;
+	switch_mutex_t *channel_mutex;
 } globals;
 
-typedef struct
-{
-    unsigned int flags;
-    switch_codec_t read_codec;
-    switch_codec_t write_codec;
-    switch_frame_t read_frame;
-    uint8_t databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
-    switch_core_session_t *session;
-    switch_caller_profile_t *caller_profile;
-    switch_mutex_t *mutex;
-    switch_mutex_t *flag_mutex;
-    //switch_thread_cond_t *cond;
-    uc_t *uc;
+typedef struct {
+	unsigned int flags;
+	switch_codec_t read_codec;
+	switch_codec_t write_codec;
+	switch_frame_t read_frame;
+	uint8_t databuf[SWITCH_RECOMMENDED_BUFFER_SIZE];
+	switch_core_session_t *session;
+	switch_caller_profile_t *caller_profile;
+	switch_mutex_t *mutex;
+	switch_mutex_t *flag_mutex;
+	//switch_thread_cond_t *cond;
+	uc_t *uc;
 } private_t;
 
 
@@ -133,11 +130,10 @@
 static switch_status_t unicall_on_soft_execute(switch_core_session_t *session);
 
 static switch_call_cause_t unicall_outgoing_channel(switch_core_session_t *session,
-                                                    switch_event_t *var_event,
-                                                    switch_caller_profile_t *outbound_profile,
-                                                    switch_core_session_t **new_session,
-                                                    switch_memory_pool_t **pool,
-                                                    switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
+													switch_event_t *var_event,
+													switch_caller_profile_t *outbound_profile,
+													switch_core_session_t **new_session,
+													switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause);
 static switch_status_t unicall_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id);
 static switch_status_t unicall_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id);
 static switch_status_t unicall_kill_channel(switch_core_session_t *session, int sig);
@@ -147,723 +143,692 @@
 
 static void unicall_message(int level, const char *s)
 {
-    int switch_level;
-    
-    switch (level)
-    {
-    case UC_LOG_NONE:
-        switch_level = SWITCH_LOG_CRIT;
-        break;
-    case UC_LOG_ERROR:
-        switch_level = SWITCH_LOG_ERROR;
-        break;
-    case UC_LOG_WARNING:
-        switch_level = SWITCH_LOG_WARNING;
-        break;
-    case UC_LOG_PROTOCOL_ERROR:
-        switch_level = SWITCH_LOG_ERROR;
-        break;
-    case UC_LOG_PROTOCOL_WARNING:
-        switch_level = SWITCH_LOG_WARNING;
-        break;
-    case UC_LOG_INFO:
-        switch_level = SWITCH_LOG_NOTICE;
-        //switch_level = SWITCH_LOG_NOTICE;
-        break;
-    case UC_LOG_FLOW:
-    case UC_LOG_FLOW_2:
-    case UC_LOG_FLOW_3:
-    case UC_LOG_CAS:
-    case UC_LOG_TONE:
-    case UC_LOG_DEBUG_1:
-    case UC_LOG_DEBUG_2:
-    case UC_LOG_DEBUG_3:
-        switch_level = SWITCH_LOG_DEBUG;
-        break;
-    default:
-        switch_level = SWITCH_LOG_CRIT;
-        break;
-    }
-    switch_log_printf(SWITCH_CHANNEL_LOG, switch_level, s);
+	int switch_level;
+
+	switch (level) {
+	case UC_LOG_NONE:
+		switch_level = SWITCH_LOG_CRIT;
+		break;
+	case UC_LOG_ERROR:
+		switch_level = SWITCH_LOG_ERROR;
+		break;
+	case UC_LOG_WARNING:
+		switch_level = SWITCH_LOG_WARNING;
+		break;
+	case UC_LOG_PROTOCOL_ERROR:
+		switch_level = SWITCH_LOG_ERROR;
+		break;
+	case UC_LOG_PROTOCOL_WARNING:
+		switch_level = SWITCH_LOG_WARNING;
+		break;
+	case UC_LOG_INFO:
+		switch_level = SWITCH_LOG_NOTICE;
+		//switch_level = SWITCH_LOG_NOTICE;
+		break;
+	case UC_LOG_FLOW:
+	case UC_LOG_FLOW_2:
+	case UC_LOG_FLOW_3:
+	case UC_LOG_CAS:
+	case UC_LOG_TONE:
+	case UC_LOG_DEBUG_1:
+	case UC_LOG_DEBUG_2:
+	case UC_LOG_DEBUG_3:
+		switch_level = SWITCH_LOG_DEBUG;
+		break;
+	default:
+		switch_level = SWITCH_LOG_CRIT;
+		break;
+	}
+	switch_log_printf(SWITCH_CHANNEL_LOG, switch_level, s);
 }
 
 static void unicall_report(const char *s)
 {
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, s);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, s);
 }
 
 #if 0
 static switch_call_cause_t unicall_incoming_channel(zap_sigmsg_t *sigmsg, switch_core_session_t **sp)
 {
-    switch_core_session_t *session = NULL;
-    private_t *tech_pvt = NULL;
-    switch_channel_t *channel = NULL;
-    char name[128];
-    
-    *sp = NULL;
-    
-    if (!(session = switch_core_session_request(openzap_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL)))
-    {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Initialization Error!\n");
-        return ZAP_FAIL;
-    }
-    
-    switch_core_session_add_stream(session, NULL);
-    
-    tech_pvt = (private_t *) switch_core_session_alloc(session, sizeof(private_t));
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    if (tech_init(tech_pvt, session, sigmsg->channel) != SWITCH_STATUS_SUCCESS)
-    {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Initialization Error!\n");
-        switch_core_session_destroy(&session);
-        return ZAP_FAIL;
-    }
-    
-    *sigmsg->channel->caller_data.collected = '\0';
-    
-    if (sigmsg->channel->caller_data.cid_name[0] == '\0')
-        switch_set_string(sigmsg->channel->caller_data.cid_name, sigmsg->channel->chan_name);
+	switch_core_session_t *session = NULL;
+	private_t *tech_pvt = NULL;
+	switch_channel_t *channel = NULL;
+	char name[128];
 
-    if (sigmsg->channel->caller_data.cid_num.digits[0] == '\0')
-    {
-        if (sigmsg->channel->caller_data.ani.digits[0] != '\0')
-            switch_set_string(sigmsg->channel->caller_data.cid_num.digits, sigmsg->channel->caller_data.ani.digits);
-        else
-            switch_set_string(sigmsg->channel->caller_data.cid_num.digits, sigmsg->channel->chan_number);
-    }
+	*sp = NULL;
 
-    tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
-                                                         "UniCall",
-                                                         SPAN_CONFIG[sigmsg->channel->span_id].dialplan,
-                                                         sigmsg->channel->caller_data.cid_name,
-                                                         sigmsg->channel->caller_data.cid_num.digits,
-                                                         NULL,
-                                                         sigmsg->channel->caller_data.ani.digits,
-                                                         sigmsg->channel->caller_data.aniII,
-                                                         sigmsg->channel->caller_data.rdnis.digits,
-                                                         (char *) modname,
-                                                         SPAN_CONFIG[sigmsg->channel->span_id].context,
-                                                         sigmsg->channel->caller_data.dnis.digits);
-    assert(tech_pvt->caller_profile != NULL);
+	if (!(session = switch_core_session_request(openzap_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, NULL))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Initialization Error!\n");
+		return ZAP_FAIL;
+	}
 
-    if (sigmsg->channel->caller_data.screen == 1  ||  sigmsg->channel->caller_data.screen == 3)
-        switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_SCREEN);
+	switch_core_session_add_stream(session, NULL);
 
-    if (sigmsg->channel->caller_data.pres)
-        switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
-    
-    snprintf(name, sizeof(name), "UNICALL/%u:%u/%s", sigmsg->channel->span_id, sigmsg->channel->chan_id, tech_pvt->caller_profile->destination_number);
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connect inbound channel %s\n", name);
-    switch_channel_set_name(channel, name);
-    switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
-        
-    switch_channel_set_state(channel, CS_INIT);
-    if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS)
-    {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Error spawning thread\n");
-        switch_core_session_destroy(&session);
-        return ZAP_FAIL;
-    }
+	tech_pvt = (private_t *) switch_core_session_alloc(session, sizeof(private_t));
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	if (tech_init(tech_pvt, session, sigmsg->channel) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Initialization Error!\n");
+		switch_core_session_destroy(&session);
+		return ZAP_FAIL;
+	}
 
-    if (zap_channel_add_token(sigmsg->channel, switch_core_session_get_uuid(session), 0) != ZAP_SUCCESS)
-    {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Error adding token\n");
-        switch_core_session_destroy(&session);
-        return ZAP_FAIL;
-    }
-    *sp = session;
+	*sigmsg->channel->caller_data.collected = '\0';
 
-    return ZAP_SUCCESS;
+	if (sigmsg->channel->caller_data.cid_name[0] == '\0')
+		switch_set_string(sigmsg->channel->caller_data.cid_name, sigmsg->channel->chan_name);
+
+	if (sigmsg->channel->caller_data.cid_num.digits[0] == '\0') {
+		if (sigmsg->channel->caller_data.ani.digits[0] != '\0')
+			switch_set_string(sigmsg->channel->caller_data.cid_num.digits, sigmsg->channel->caller_data.ani.digits);
+		else
+			switch_set_string(sigmsg->channel->caller_data.cid_num.digits, sigmsg->channel->chan_number);
+	}
+
+	tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
+														 "UniCall",
+														 SPAN_CONFIG[sigmsg->channel->span_id].dialplan,
+														 sigmsg->channel->caller_data.cid_name,
+														 sigmsg->channel->caller_data.cid_num.digits,
+														 NULL,
+														 sigmsg->channel->caller_data.ani.digits,
+														 sigmsg->channel->caller_data.aniII,
+														 sigmsg->channel->caller_data.rdnis.digits,
+														 (char *) modname,
+														 SPAN_CONFIG[sigmsg->channel->span_id].context, sigmsg->channel->caller_data.dnis.digits);
+	assert(tech_pvt->caller_profile != NULL);
+
+	if (sigmsg->channel->caller_data.screen == 1 || sigmsg->channel->caller_data.screen == 3)
+		switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_SCREEN);
+
+	if (sigmsg->channel->caller_data.pres)
+		switch_set_flag(tech_pvt->caller_profile, SWITCH_CPF_HIDE_NAME | SWITCH_CPF_HIDE_NUMBER);
+
+	snprintf(name, sizeof(name), "UNICALL/%u:%u/%s", sigmsg->channel->span_id, sigmsg->channel->chan_id, tech_pvt->caller_profile->destination_number);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connect inbound channel %s\n", name);
+	switch_channel_set_name(channel, name);
+	switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
+
+	switch_channel_set_state(channel, CS_INIT);
+	if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Error spawning thread\n");
+		switch_core_session_destroy(&session);
+		return ZAP_FAIL;
+	}
+
+	if (zap_channel_add_token(sigmsg->channel, switch_core_session_get_uuid(session), 0) != ZAP_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Error adding token\n");
+		switch_core_session_destroy(&session);
+		return ZAP_FAIL;
+	}
+	*sp = session;
+
+	return ZAP_SUCCESS;
 }
 #endif
 
 static void on_devicefail(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    //switch_channel_t *channel;
-    //private_t *tech_pvt;
+	//switch_channel_t *channel;
+	//private_t *tech_pvt;
 
-    //tech_pvt = switch_core_session_get_private(session);
-    //assert(tech_pvt != NULL);
-    //channel = switch_core_session_get_channel(session);
-    //assert(channel != NULL);
+	//tech_pvt = switch_core_session_get_private(session);
+	//assert(tech_pvt != NULL);
+	//channel = switch_core_session_get_channel(session);
+	//assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_devicefail\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_devicefail\n");
 }
 
 static void on_protocolfail(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    //switch_channel_t *channel;
-    //private_t *tech_pvt;
+	//switch_channel_t *channel;
+	//private_t *tech_pvt;
 
-    //tech_pvt = switch_core_session_get_private(session);
-    //assert(tech_pvt != NULL);
-    //channel = switch_core_session_get_channel(session);
-    //assert(channel != NULL);
+	//tech_pvt = switch_core_session_get_private(session);
+	//assert(tech_pvt != NULL);
+	//channel = switch_core_session_get_channel(session);
+	//assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_protocolfail\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_protocolfail\n");
 }
 
 static void on_sigchanstatus(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    //switch_channel_t *channel;
-    //private_t *tech_pvt;
+	//switch_channel_t *channel;
+	//private_t *tech_pvt;
 
-    //tech_pvt = switch_core_session_get_private(session);
-    //assert(tech_pvt != NULL);
-    //channel = switch_core_session_get_channel(session);
-    //assert(channel != NULL);
+	//tech_pvt = switch_core_session_get_private(session);
+	//assert(tech_pvt != NULL);
+	//channel = switch_core_session_get_channel(session);
+	//assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_sigchanstatus\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_sigchanstatus\n");
 }
 
 static void on_detected(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    //switch_channel_t *channel;
-    //private_t *tech_pvt;
-    //struct channel_map *chanmap;
-    //char name[128];
+	//switch_channel_t *channel;
+	//private_t *tech_pvt;
+	//struct channel_map *chanmap;
+	//char name[128];
 
-    //tech_pvt = switch_core_session_get_private(session);
-    //assert(tech_pvt != NULL);
-    //channel = switch_core_session_get_channel(session);
-    //assert(channel != NULL);
+	//tech_pvt = switch_core_session_get_private(session);
+	//assert(tech_pvt != NULL);
+	//channel = switch_core_session_get_channel(session);
+	//assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_detected\n");
-    switch_mutex_lock(globals.channel_mutex);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_detected\n");
+	switch_mutex_lock(globals.channel_mutex);
 
-    //chanmap = spri->private_info;
+	//chanmap = spri->private_info;
 
 #if 0
-    if ((session = switch_core_session_locate(chanmap->map[e->offered.channel])))
-    {
-        switch_log_printf(SWITCH_CHANNEL_LOG,
-                          SWITCH_LOG_NOTICE,
-                          "--Duplicate detected on channel s%dc%d (ignored)\n",
-                          spri->span,
-                          e->offered.channel);
-        switch_core_session_rwunlock(session);
-        switch_mutex_unlock(globals.channel_mutex);
-        return;
-    }
+	if ((session = switch_core_session_locate(chanmap->map[e->offered.channel]))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "--Duplicate detected on channel s%dc%d (ignored)\n", spri->span, e->offered.channel);
+		switch_core_session_rwunlock(session);
+		switch_mutex_unlock(globals.channel_mutex);
+		return;
+	}
 
-    switch_log_printf(SWITCH_CHANNEL_LOG,
-                      SWITCH_LOG_NOTICE,
-                      "-- Detected on channel s%dc%d (from %s to %s)\n",
-                      spri->span,
-                      e->offered.channel,
-                      e->offered.parms.originating_number,
-                      e->offered.parms.destination_number);
+	switch_log_printf(SWITCH_CHANNEL_LOG,
+					  SWITCH_LOG_NOTICE,
+					  "-- Detected on channel s%dc%d (from %s to %s)\n",
+					  spri->span, e->offered.channel, e->offered.parms.originating_number, e->offered.parms.destination_number);
 
-    switch_mutex_unlock(chanmap->mutex);
+	switch_mutex_unlock(chanmap->mutex);
 
-    //pri_proceeding(spri->pri, e->offered.call, e->offered.channel, 0);
-    //pri_acknowledge(spri->pri, e->offered.call, e->offered.channel, 0);
+	//pri_proceeding(spri->pri, e->offered.call, e->offered.channel, 0);
+	//pri_acknowledge(spri->pri, e->offered.call, e->offered.channel, 0);
 
-    switch_mutex_unlock(chanmap->mutex);
+	switch_mutex_unlock(chanmap->mutex);
 
-    if ((session = unicall_incoming_channel(sigmsg, &session)))
-    {
-    }
-    else
-    {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create new inbound channel!\n");
-    }
+	if ((session = unicall_incoming_channel(sigmsg, &session))) {
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot create new inbound channel!\n");
+	}
 #endif
-    switch_mutex_unlock(globals.channel_mutex);
+	switch_mutex_unlock(globals.channel_mutex);
 }
 
 static void on_offered(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    //switch_channel_t *channel;
-    //private_t *tech_pvt;
-    //struct channel_map *chanmap;
-    //char name[128];
+	//switch_channel_t *channel;
+	//private_t *tech_pvt;
+	//struct channel_map *chanmap;
+	//char name[128];
 
-    //tech_pvt = switch_core_session_get_private(session);
-    //assert(tech_pvt != NULL);
-    //channel = switch_core_session_get_channel(session);
-    //assert(channel != NULL);
+	//tech_pvt = switch_core_session_get_private(session);
+	//assert(tech_pvt != NULL);
+	//channel = switch_core_session_get_channel(session);
+	//assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_offered\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_offered\n");
 }
 
 static void on_requestmoreinfo(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_requestmoreinfo\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_requestmoreinfo\n");
 }
 
 static void on_accepted(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_accepted\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_accepted\n");
 }
 
 static void on_callinfo(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_callinfo\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_callinfo\n");
 }
 
 static void on_facility(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_facility\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_facility\n");
 }
 
 static void on_dialednumber(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_dialednumber\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_dialednumber\n");
 }
 
 static void on_dialing(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_dialing\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_dialing\n");
 }
 
 static void on_sendmoreinfo(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_sendmoreinfo\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_sendmoreinfo\n");
 }
 
 static void on_proceeding(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
-    //struct channel_map *chanmap;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+	//struct channel_map *chanmap;
 
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_proceeding\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_proceeding\n");
 
 #if 0
-    chanmap = spri->private_info;
+	chanmap = spri->private_info;
 
-    if ((session = switch_core_session_locate(chanmap->map[e->proceeding.channel])))
-    {
-        switch_core_session_message_t *msg;
+	if ((session = switch_core_session_locate(chanmap->map[e->proceeding.channel]))) {
+		switch_core_session_message_t *msg;
 
-        switch_log_printf(SWITCH_CHANNEL_LOG,
-                          SWITCH_LOG_NOTICE,
-                          "-- Proceeding on channel s%dc%d\n",
-                          spri->span,
-                          e->proceeding.channel);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Proceeding on channel s%dc%d\n", spri->span, e->proceeding.channel);
 
-        channel = switch_core_session_get_channel(session);
-        assert(channel != NULL);
+		channel = switch_core_session_get_channel(session);
+		assert(channel != NULL);
 
-        switch_core_session_pass_indication(session, SWITCH_MESSAGE_INDICATE_PROGRESS);
-        switch_channel_mark_pre_answered(channel);
+		switch_core_session_pass_indication(session, SWITCH_MESSAGE_INDICATE_PROGRESS);
+		switch_channel_mark_pre_answered(channel);
 
-        switch_core_session_rwunlock(session);
-    }
-    else
-    {
-        switch_log_printf(SWITCH_CHANNEL_LOG,
-                          SWITCH_LOG_NOTICE,
-                          "-- Proceeding on channel s%dc%d but it's not in use?\n",
-                          spri->span,
-                          e->proceeding.channel);
-    }
+		switch_core_session_rwunlock(session);
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG,
+						  SWITCH_LOG_NOTICE, "-- Proceeding on channel s%dc%d but it's not in use?\n", spri->span, e->proceeding.channel);
+	}
 #endif
 }
 
 static void on_alerting(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
-    //struct channel_map *chanmap;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+	//struct channel_map *chanmap;
 
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_alerting\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_alerting\n");
 
 #if 0
-    chanmap = spri->private_info;
+	chanmap = spri->private_info;
 
-    if ((session = switch_core_session_locate(chanmap->map[e->alerting.channel])))
-    {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "-- Ringing on channel s%dc%d\n", spri->span, e->alerting.channel);
-        channel = switch_core_session_get_channel(session);
-        assert(channel != NULL);
+	if ((session = switch_core_session_locate(chanmap->map[e->alerting.channel]))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "-- Ringing on channel s%dc%d\n", spri->span, e->alerting.channel);
+		channel = switch_core_session_get_channel(session);
+		assert(channel != NULL);
 
-        switch_core_session_pass_indication(session, SWITCH_MESSAGE_INDICATE_RINGING);
-        switch_channel_mark_ring_ready(channel);
+		switch_core_session_pass_indication(session, SWITCH_MESSAGE_INDICATE_RINGING);
+		switch_channel_mark_ring_ready(channel);
 
-        switch_core_session_rwunlock(session);
-    }
-    else
-    {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "-- Ringing on channel s%dc%d %s but it's not in use?\n", spri->span, e->alerting.channel, chanmap->map[e->alerting.channel]);
-    }
+		switch_core_session_rwunlock(session);
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "-- Ringing on channel s%dc%d %s but it's not in use?\n", spri->span, e->alerting.channel,
+						  chanmap->map[e->alerting.channel]);
+	}
 #endif
 }
 
 static void on_connected(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_connected\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_connected\n");
 }
 
 static void on_answered(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_answered\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_answered\n");
 }
 
 static void on_fardisconnected(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_fardisconnected\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_fardisconnected\n");
 }
 
 static void on_dropcall(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_dropcall\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_dropcall\n");
 }
 
 static void on_releasecall(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_releasecall\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_releasecall\n");
 }
 
 static void on_farblocked(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    //switch_channel_t *channel;
-    //private_t *tech_pvt;
+	//switch_channel_t *channel;
+	//private_t *tech_pvt;
 
-    //tech_pvt = switch_core_session_get_private(session);
-    //assert(tech_pvt != NULL);
-    //channel = switch_core_session_get_channel(session);
-    //assert(channel != NULL);
+	//tech_pvt = switch_core_session_get_private(session);
+	//assert(tech_pvt != NULL);
+	//channel = switch_core_session_get_channel(session);
+	//assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_farblocked\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_farblocked\n");
 }
 
 static void on_farunblocked(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    //switch_channel_t *channel;
-    //private_t *tech_pvt;
+	//switch_channel_t *channel;
+	//private_t *tech_pvt;
 
-    //tech_pvt = switch_core_session_get_private(session);
-    //assert(tech_pvt != NULL);
-    //channel = switch_core_session_get_channel(session);
-    //assert(channel != NULL);
+	//tech_pvt = switch_core_session_get_private(session);
+	//assert(tech_pvt != NULL);
+	//channel = switch_core_session_get_channel(session);
+	//assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_farunblocked\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_farunblocked\n");
 }
 
 static void on_localblocked(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    //switch_channel_t *channel;
-    //private_t *tech_pvt;
+	//switch_channel_t *channel;
+	//private_t *tech_pvt;
 
-    //tech_pvt = switch_core_session_get_private(session);
-    //assert(tech_pvt != NULL);
-    //channel = switch_core_session_get_channel(session);
-    //assert(channel != NULL);
+	//tech_pvt = switch_core_session_get_private(session);
+	//assert(tech_pvt != NULL);
+	//channel = switch_core_session_get_channel(session);
+	//assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_localblocked\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_localblocked\n");
 }
 
 static void on_localunblocked(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    //switch_channel_t *channel;
-    //private_t *tech_pvt;
+	//switch_channel_t *channel;
+	//private_t *tech_pvt;
 
-    //tech_pvt = switch_core_session_get_private(session);
-    //assert(tech_pvt != NULL);
-    //channel = switch_core_session_get_channel(session);
-    //assert(channel != NULL);
+	//tech_pvt = switch_core_session_get_private(session);
+	//assert(tech_pvt != NULL);
+	//channel = switch_core_session_get_channel(session);
+	//assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_localunblocked\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_localunblocked\n");
 }
 
 static void on_alarm(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_alarm\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_alarm\n");
 }
 
 static void on_resetlinedev(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_resetlinedev\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_resetlinedev\n");
 }
 
 static void on_l2frame(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_l2frame\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_l2frame\n");
 }
 
 static void on_l2bufferfull(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_l2bufferfull\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_l2bufferfull\n");
 }
 
 static void on_l2nobuffer(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_l2nobuffer\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_l2nobuffer\n");
 }
 
 static void on_usrinfo(uc_t *uc, switch_core_session_t *session, uc_event_t *e)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_usrinfo\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "on_usrinfo\n");
 }
 
 static void handle_uc_event(uc_t *uc, void *user_data, uc_event_t *e)
 {
-    switch_core_session_t *session;
+	switch_core_session_t *session;
 
-    session = (switch_core_session_t *) user_data;
-    assert(session != NULL);
+	session = (switch_core_session_t *) user_data;
+	assert(session != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "event %s\n", uc_event_to_str(e->e));
-    switch (e->e)
-    {
-    case UC_EVENT_DEVICEFAIL:
-        on_devicefail(uc, session, e);
-        break;
-    case UC_EVENT_PROTOCOLFAIL:
-        on_protocolfail(uc, session, e);
-        break;
-    case UC_EVENT_SIGCHANSTATUS:
-        on_sigchanstatus(uc, session, e);
-        break;
-    case UC_EVENT_DETECTED:
-        on_detected(uc, session, e);
-        break;
-    case UC_EVENT_OFFERED:
-        on_offered(uc, session, e);
-        break;
-    case UC_EVENT_REQUESTMOREINFO:
-        on_requestmoreinfo(uc, session, e);
-        break;
-    case UC_EVENT_ACCEPTED:
-        on_accepted(uc, session, e);
-        break;
-    case UC_EVENT_CALLINFO:
-        on_callinfo(uc, session, e);
-        break;
-    case UC_EVENT_FACILITY:
-        on_facility(uc, session, e);
-        break;
-    case UC_EVENT_DIALEDNUMBER:
-        on_dialednumber(uc, session, e);
-        break;
-    case UC_EVENT_DIALING:
-        on_dialing(uc, session, e);
-        break;
-    case UC_EVENT_SENDMOREINFO:
-        on_sendmoreinfo(uc, session, e);
-        break;
-    case UC_EVENT_PROCEEDING:
-        on_proceeding(uc, session, e);
-        break;
-    case UC_EVENT_ALERTING:
-        on_alerting(uc, session, e);
-        break;
-    case UC_EVENT_CONNECTED:
-        on_connected(uc, session, e);
-        break;
-    case UC_EVENT_ANSWERED:
-        on_answered(uc, session, e);
-        break;
-    case UC_EVENT_FARDISCONNECTED:
-        on_fardisconnected(uc, session, e);
-        break;
-    case UC_EVENT_DROPCALL:
-        on_dropcall(uc, session, e);
-        break;
-    case UC_EVENT_RELEASECALL:
-        on_releasecall(uc, session, e);
-        break;
-    case UC_EVENT_FARBLOCKED:
-        on_farblocked(uc, session, e);
-        break;
-    case UC_EVENT_FARUNBLOCKED:
-        on_farunblocked(uc, session, e);
-        break;
-    case UC_EVENT_LOCALBLOCKED:
-        on_localblocked(uc, session, e);
-        break;
-    case UC_EVENT_LOCALUNBLOCKED:
-        on_localunblocked(uc, session, e);
-        break;
-    case UC_EVENT_ALARM:
-        on_alarm(uc, session, e);
-        break;
-    case UC_EVENT_RESETLINEDEV:
-        on_resetlinedev(uc, session, e);
-        break;
-    case UC_EVENT_L2FRAME:
-        on_l2frame(uc, session, e);
-        break;
-    case UC_EVENT_L2BUFFERFULL:
-        on_l2bufferfull(uc, session, e);
-        break;
-    case UC_EVENT_L2NOBUFFER:
-        on_l2nobuffer(uc, session, e);
-        break;
-    case UC_EVENT_USRINFO:
-        on_usrinfo(uc, session, e);
-        break;
-    default:
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unknown unicall event %d\n", e->e);
-        break;
-    }
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "event %s\n", uc_event_to_str(e->e));
+	switch (e->e) {
+	case UC_EVENT_DEVICEFAIL:
+		on_devicefail(uc, session, e);
+		break;
+	case UC_EVENT_PROTOCOLFAIL:
+		on_protocolfail(uc, session, e);
+		break;
+	case UC_EVENT_SIGCHANSTATUS:
+		on_sigchanstatus(uc, session, e);
+		break;
+	case UC_EVENT_DETECTED:
+		on_detected(uc, session, e);
+		break;
+	case UC_EVENT_OFFERED:
+		on_offered(uc, session, e);
+		break;
+	case UC_EVENT_REQUESTMOREINFO:
+		on_requestmoreinfo(uc, session, e);
+		break;
+	case UC_EVENT_ACCEPTED:
+		on_accepted(uc, session, e);
+		break;
+	case UC_EVENT_CALLINFO:
+		on_callinfo(uc, session, e);
+		break;
+	case UC_EVENT_FACILITY:
+		on_facility(uc, session, e);
+		break;
+	case UC_EVENT_DIALEDNUMBER:
+		on_dialednumber(uc, session, e);
+		break;
+	case UC_EVENT_DIALING:
+		on_dialing(uc, session, e);
+		break;
+	case UC_EVENT_SENDMOREINFO:
+		on_sendmoreinfo(uc, session, e);
+		break;
+	case UC_EVENT_PROCEEDING:
+		on_proceeding(uc, session, e);
+		break;
+	case UC_EVENT_ALERTING:
+		on_alerting(uc, session, e);
+		break;
+	case UC_EVENT_CONNECTED:
+		on_connected(uc, session, e);
+		break;
+	case UC_EVENT_ANSWERED:
+		on_answered(uc, session, e);
+		break;
+	case UC_EVENT_FARDISCONNECTED:
+		on_fardisconnected(uc, session, e);
+		break;
+	case UC_EVENT_DROPCALL:
+		on_dropcall(uc, session, e);
+		break;
+	case UC_EVENT_RELEASECALL:
+		on_releasecall(uc, session, e);
+		break;
+	case UC_EVENT_FARBLOCKED:
+		on_farblocked(uc, session, e);
+		break;
+	case UC_EVENT_FARUNBLOCKED:
+		on_farunblocked(uc, session, e);
+		break;
+	case UC_EVENT_LOCALBLOCKED:
+		on_localblocked(uc, session, e);
+		break;
+	case UC_EVENT_LOCALUNBLOCKED:
+		on_localunblocked(uc, session, e);
+		break;
+	case UC_EVENT_ALARM:
+		on_alarm(uc, session, e);
+		break;
+	case UC_EVENT_RESETLINEDEV:
+		on_resetlinedev(uc, session, e);
+		break;
+	case UC_EVENT_L2FRAME:
+		on_l2frame(uc, session, e);
+		break;
+	case UC_EVENT_L2BUFFERFULL:
+		on_l2bufferfull(uc, session, e);
+		break;
+	case UC_EVENT_L2NOBUFFER:
+		on_l2nobuffer(uc, session, e);
+		break;
+	case UC_EVENT_USRINFO:
+		on_usrinfo(uc, session, e);
+		break;
+	default:
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unknown unicall event %d\n", e->e);
+		break;
+	}
 }
 
 static void tech_init(private_t *tech_pvt, switch_core_session_t *session)
 {
-    tech_pvt->read_frame.data = tech_pvt->databuf;
-    tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf);
-    switch_mutex_init(&tech_pvt->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
-    switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
-    switch_core_session_set_private(session, tech_pvt);
-    tech_pvt->session = session;
+	tech_pvt->read_frame.data = tech_pvt->databuf;
+	tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf);
+	switch_mutex_init(&tech_pvt->mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+	switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+	switch_core_session_set_private(session, tech_pvt);
+	tech_pvt->session = session;
 }
 
 /* 
@@ -873,74 +838,74 @@
 */
 static switch_status_t unicall_on_init(switch_core_session_t *session)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
 
-switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_on_init(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_on_init(%p)\n", (void *) session);
 
-    switch_set_flag_locked(tech_pvt, TFLAG_IO);
+	switch_set_flag_locked(tech_pvt, TFLAG_IO);
 
-    /* Move channel's state machine to ROUTING. This means the call is trying
-       to get from the initial state to the point where a destination has been
-       identified. If the channel is simply left in the initial state, nothing
-       will happen. */
-    switch_channel_set_state(channel, CS_ROUTING);
-    switch_mutex_lock(globals.mutex);
-    globals.calls++;
-    switch_mutex_unlock(globals.mutex);
+	/* Move channel's state machine to ROUTING. This means the call is trying
+	   to get from the initial state to the point where a destination has been
+	   identified. If the channel is simply left in the initial state, nothing
+	   will happen. */
+	switch_channel_set_state(channel, CS_ROUTING);
+	switch_mutex_lock(globals.mutex);
+	globals.calls++;
+	switch_mutex_unlock(globals.mutex);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t unicall_on_routing(switch_core_session_t *session)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
 
-switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_on_routing(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_on_routing(%p)\n", (void *) session);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s channel routing\n", switch_channel_get_name(channel));
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s channel routing\n", switch_channel_get_name(channel));
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t unicall_on_execute(switch_core_session_t *session)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
 
-switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_on_execute(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_on_execute(%p)\n", (void *) session);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s channel execute\n", switch_channel_get_name(channel));
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s channel execute\n", switch_channel_get_name(channel));
 
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t unicall_on_destroy(switch_core_session_t *session)
 {
-    //switch_channel_t *channel;
-    private_t *tech_pvt;
+	//switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    //channel = switch_core_session_get_channel(session);
-    //assert(channel != NULL);
+	//channel = switch_core_session_get_channel(session);
+	//assert(channel != NULL);
 
-    tech_pvt = switch_core_session_get_private(session);
+	tech_pvt = switch_core_session_get_private(session);
 
 	if (tech_pvt) {
 		if (switch_core_codec_ready(&tech_pvt->read_codec))
@@ -948,1030 +913,960 @@
 		if (switch_core_codec_ready(&tech_pvt->write_codec))
 			switch_core_codec_destroy(&tech_pvt->write_codec);
 	}
-	
+
 	return SWITCH_STATUS_SUCCESS;
-		
+
 }
 
 static switch_status_t unicall_on_hangup(switch_core_session_t *session)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
 
-switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_on_hangup(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_on_hangup(%p)\n", (void *) session);
 
-    switch_clear_flag_locked(tech_pvt, TFLAG_IO);
-    switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
-    //switch_thread_cond_signal(tech_pvt->cond);
+	switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+	switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+	//switch_thread_cond_signal(tech_pvt->cond);
 
-		
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s channel hangup\n", switch_channel_get_name(channel));
 
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s channel hangup\n", switch_channel_get_name(channel));
+
 #if 0
-    if ((ret = uc_call_control(uc, UC_OP_DROPCALL, crn, (void *) (intptr_t) switch_channel_get_cause(channel))) < 0)
-    {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Drop call failed - %s\n", uc_ret_to_str(ret));
-        return SWITCH_STATUS_FAILED;
-    }
-    /*endif*/
+	if ((ret = uc_call_control(uc, UC_OP_DROPCALL, crn, (void *) (intptr_t) switch_channel_get_cause(channel))) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Drop call failed - %s\n", uc_ret_to_str(ret));
+		return SWITCH_STATUS_FAILED;
+	}
+	/*endif */
 #endif
 
-    switch_mutex_lock(globals.mutex);
-    if (--globals.calls < 0)
-        globals.calls = 0;
-    switch_mutex_unlock(globals.mutex);
+	switch_mutex_lock(globals.mutex);
+	if (--globals.calls < 0)
+		globals.calls = 0;
+	switch_mutex_unlock(globals.mutex);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t unicall_kill_channel(switch_core_session_t *session, int sig)
 {
-    switch_channel_t *channel = NULL;
-    private_t *tech_pvt = NULL;
+	switch_channel_t *channel = NULL;
+	private_t *tech_pvt = NULL;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
 
-switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_kill_channel(%p, %d)\n", (void *) session, sig);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_kill_channel(%p, %d)\n", (void *) session, sig);
 
-    switch (sig)
-    {
-    case SWITCH_SIG_KILL:
-switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_kill_channel(%p, %d) SIG_KILL\n", (void *) session, sig);
-        switch_clear_flag_locked(tech_pvt, TFLAG_IO);
-        switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
-        switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
-        //switch_thread_cond_signal(tech_pvt->cond);
-        break;
-    case SWITCH_SIG_BREAK:
-switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_kill_channel(%p, %d) SIG_BREAK\n", (void *) session, sig);
-        switch_set_flag_locked(tech_pvt, TFLAG_BREAK);
-        break;
-    default:
-switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_kill_channel(%p, %d) DEFAULT\n", (void *) session, sig);
-        break;
-    }
+	switch (sig) {
+	case SWITCH_SIG_KILL:
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_kill_channel(%p, %d) SIG_KILL\n", (void *) session, sig);
+		switch_clear_flag_locked(tech_pvt, TFLAG_IO);
+		switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+		switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+		//switch_thread_cond_signal(tech_pvt->cond);
+		break;
+	case SWITCH_SIG_BREAK:
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_kill_channel(%p, %d) SIG_BREAK\n", (void *) session, sig);
+		switch_set_flag_locked(tech_pvt, TFLAG_BREAK);
+		break;
+	default:
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_kill_channel(%p, %d) DEFAULT\n", (void *) session, sig);
+		break;
+	}
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t unicall_on_exchange_media(switch_core_session_t *session)
 {
-switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_on_exchange_media(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_on_exchange_media(%p)\n", (void *) session);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL LOOPBACK\n");
-    return SWITCH_STATUS_SUCCESS;
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL LOOPBACK\n");
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t unicall_on_soft_execute(switch_core_session_t *session)
 {
-switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_on_soft_execute(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_on_soft_execute(%p)\n", (void *) session);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL TRANSMIT\n");
-    return SWITCH_STATUS_SUCCESS;
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CHANNEL TRANSMIT\n");
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t unicall_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
 {
-    private_t *tech_pvt = switch_core_session_get_private(session);
-    switch_assert(tech_pvt != NULL);
+	private_t *tech_pvt = switch_core_session_get_private(session);
+	switch_assert(tech_pvt != NULL);
 
-switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_send_dtmf(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_send_dtmf(%p)\n", (void *) session);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t unicall_read_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id)
 {
-    switch_channel_t *channel = NULL;
-    private_t *tech_pvt = NULL;
-    //switch_time_t started = switch_time_now();
-    //unsigned int elapsed;
-    switch_byte_t *data;
+	switch_channel_t *channel = NULL;
+	private_t *tech_pvt = NULL;
+	//switch_time_t started = switch_time_now();
+	//unsigned int elapsed;
+	switch_byte_t *data;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_read_frame(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_read_frame(%p)\n", (void *) session);
 
-    tech_pvt->read_frame.flags = SFF_NONE;
-    *frame = NULL;
+	tech_pvt->read_frame.flags = SFF_NONE;
+	*frame = NULL;
 
-    while (switch_test_flag(tech_pvt, TFLAG_IO))
-    {
-        if (switch_test_flag(tech_pvt, TFLAG_BREAK))
-        {
-            switch_clear_flag(tech_pvt, TFLAG_BREAK);
-            data = (switch_byte_t *) tech_pvt->read_frame.data;
-            data[0] = 65;
-            data[1] = 0;
-            tech_pvt->read_frame.datalen = 2;
-            tech_pvt->read_frame.flags = SFF_CNG;
-            *frame = &tech_pvt->read_frame;
-            return SWITCH_STATUS_SUCCESS;
-        }
+	while (switch_test_flag(tech_pvt, TFLAG_IO)) {
+		if (switch_test_flag(tech_pvt, TFLAG_BREAK)) {
+			switch_clear_flag(tech_pvt, TFLAG_BREAK);
+			data = (switch_byte_t *) tech_pvt->read_frame.data;
+			data[0] = 65;
+			data[1] = 0;
+			tech_pvt->read_frame.datalen = 2;
+			tech_pvt->read_frame.flags = SFF_CNG;
+			*frame = &tech_pvt->read_frame;
+			return SWITCH_STATUS_SUCCESS;
+		}
 
-        if (!switch_test_flag(tech_pvt, TFLAG_IO))
-            return SWITCH_STATUS_FALSE;
+		if (!switch_test_flag(tech_pvt, TFLAG_IO))
+			return SWITCH_STATUS_FALSE;
 
-        if (switch_test_flag(tech_pvt, TFLAG_IO)  &&  switch_test_flag(tech_pvt, TFLAG_VOICE))
-        {
-            switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
-            if (!tech_pvt->read_frame.datalen)
-                continue;
-            *frame = &tech_pvt->read_frame;
+		if (switch_test_flag(tech_pvt, TFLAG_IO) && switch_test_flag(tech_pvt, TFLAG_VOICE)) {
+			switch_clear_flag_locked(tech_pvt, TFLAG_VOICE);
+			if (!tech_pvt->read_frame.datalen)
+				continue;
+			*frame = &tech_pvt->read_frame;
 #if SWITCH_BYTE_ORDER == __BIG_ENDIAN
-            if (switch_test_flag(tech_pvt, TFLAG_LINEAR))
-                switch_swap_linear((*frame)->data, (int) (*frame)->datalen / 2);
+			if (switch_test_flag(tech_pvt, TFLAG_LINEAR))
+				switch_swap_linear((*frame)->data, (int) (*frame)->datalen / 2);
 #endif
-            return SWITCH_STATUS_SUCCESS;
-        }
+			return SWITCH_STATUS_SUCCESS;
+		}
 
-        switch_cond_next();
-    }
+		switch_cond_next();
+	}
 
-    return SWITCH_STATUS_FALSE;
+	return SWITCH_STATUS_FALSE;
 }
 
 static switch_status_t unicall_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id)
 {
-    switch_channel_t *channel = NULL;
-    private_t *tech_pvt = NULL;
-    //switch_frame_t *pframe;
+	switch_channel_t *channel = NULL;
+	private_t *tech_pvt = NULL;
+	//switch_frame_t *pframe;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_write_frame(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "unicall_write_frame(%p)\n", (void *) session);
 
-    if (!switch_test_flag(tech_pvt, TFLAG_IO))
-        return SWITCH_STATUS_FALSE;
+	if (!switch_test_flag(tech_pvt, TFLAG_IO))
+		return SWITCH_STATUS_FALSE;
 #if SWITCH_BYTE_ORDER == __BIG_ENDIAN
-    if (switch_test_flag(tech_pvt, TFLAG_LINEAR))
-        switch_swap_linear(frame->data, (int) frame->datalen/sizeof(int16_t));
+	if (switch_test_flag(tech_pvt, TFLAG_LINEAR))
+		switch_swap_linear(frame->data, (int) frame->datalen / sizeof(int16_t));
 #endif
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t redirect_audio(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
-    uc_t *uc;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+	uc_t *uc;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    uc = tech_pvt->uc;
-    assert(uc != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	uc = tech_pvt->uc;
+	assert(uc != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "redirect_audio(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "redirect_audio(%p)\n", (void *) session);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t transmit_text(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
-    uc_t *uc;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+	uc_t *uc;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    uc = tech_pvt->uc;
-    assert(uc != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	uc = tech_pvt->uc;
+	assert(uc != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "transmit_text(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "transmit_text(%p)\n", (void *) session);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t answer(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
-    uc_t *uc;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+	uc_t *uc;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    uc = tech_pvt->uc;
-    assert(uc != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	uc = tech_pvt->uc;
+	assert(uc != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "answer(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "answer(%p)\n", (void *) session);
 
 #if 0
-    if ((ret = uc_call_control(uc, UC_OP_ANSWERCALL, crn, NULL)) < 0)
-    {
-        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Answer call failed - %s\n", uc_ret_to_str(ret));
-        return SWITCH_STATUS_FAILED;
-    }
-    /*endif*/
+	if ((ret = uc_call_control(uc, UC_OP_ANSWERCALL, crn, NULL)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Answer call failed - %s\n", uc_ret_to_str(ret));
+		return SWITCH_STATUS_FAILED;
+	}
+	/*endif */
 #endif
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t progress(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
-    uc_t *uc;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+	uc_t *uc;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    uc = tech_pvt->uc;
-    assert(uc != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	uc = tech_pvt->uc;
+	assert(uc != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "progress(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "progress(%p)\n", (void *) session);
 
 #if 0
-    if ((ret = uc_call_control(uc, UC_OP_ACCEPTCALL, crn, NULL)) < 0)
-    {
-        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Accept call failed - %s\n", uc_ret_to_str(ret));
-        return SWITCH_STATUS_FAILED;
-    }
-    /*endif*/
+	if ((ret = uc_call_control(uc, UC_OP_ACCEPTCALL, crn, NULL)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Accept call failed - %s\n", uc_ret_to_str(ret));
+		return SWITCH_STATUS_FAILED;
+	}
+	/*endif */
 #endif
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t bridge(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
-    uc_t *uc;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+	uc_t *uc;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    uc = tech_pvt->uc;
-    assert(uc != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	uc = tech_pvt->uc;
+	assert(uc != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "bridge(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "bridge(%p)\n", (void *) session);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t unbridge(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
-    uc_t *uc;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+	uc_t *uc;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    uc = tech_pvt->uc;
-    assert(uc != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	uc = tech_pvt->uc;
+	assert(uc != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "unbridge(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "unbridge(%p)\n", (void *) session);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t transfer(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
-    uc_t *uc;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+	uc_t *uc;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    uc = tech_pvt->uc;
-    assert(uc != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	uc = tech_pvt->uc;
+	assert(uc != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "transfer(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "transfer(%p)\n", (void *) session);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t ringing(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
-    uc_t *uc;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+	uc_t *uc;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    uc = tech_pvt->uc;
-    assert(uc != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	uc = tech_pvt->uc;
+	assert(uc != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "ringing(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "ringing(%p)\n", (void *) session);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t media(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
-    uc_t *uc;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+	uc_t *uc;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    uc = tech_pvt->uc;
-    assert(uc != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	uc = tech_pvt->uc;
+	assert(uc != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "media(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "media(%p)\n", (void *) session);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t nomedia(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
-    uc_t *uc;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+	uc_t *uc;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    uc = tech_pvt->uc;
-    assert(uc != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	uc = tech_pvt->uc;
+	assert(uc != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "nomedia(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "nomedia(%p)\n", (void *) session);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t hold(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
-    uc_t *uc;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+	uc_t *uc;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    uc = tech_pvt->uc;
-    assert(uc != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	uc = tech_pvt->uc;
+	assert(uc != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "hold(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "hold(%p)\n", (void *) session);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t unhold(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
-    uc_t *uc;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+	uc_t *uc;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    uc = tech_pvt->uc;
-    assert(uc != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	uc = tech_pvt->uc;
+	assert(uc != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "unhold(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "unhold(%p)\n", (void *) session);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t redirect(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
-    uc_t *uc;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+	uc_t *uc;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    uc = tech_pvt->uc;
-    assert(uc != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	uc = tech_pvt->uc;
+	assert(uc != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "redirect(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "redirect(%p)\n", (void *) session);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t respond(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
-    uc_t *uc;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+	uc_t *uc;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    uc = tech_pvt->uc;
-    assert(uc != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	uc = tech_pvt->uc;
+	assert(uc != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "respond(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "respond(%p)\n", (void *) session);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t broadcast(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
-    uc_t *uc;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+	uc_t *uc;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    uc = tech_pvt->uc;
-    assert(uc != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	uc = tech_pvt->uc;
+	assert(uc != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "broadcast(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "broadcast(%p)\n", (void *) session);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t media_redirect(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
-    uc_t *uc;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+	uc_t *uc;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    uc = tech_pvt->uc;
-    assert(uc != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	uc = tech_pvt->uc;
+	assert(uc != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "media_redirect(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "media_redirect(%p)\n", (void *) session);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t deflect(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
-    uc_t *uc;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+	uc_t *uc;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    uc = tech_pvt->uc;
-    assert(uc != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	uc = tech_pvt->uc;
+	assert(uc != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "deflect(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "deflect(%p)\n", (void *) session);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t video_refresh_req(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
-    uc_t *uc;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+	uc_t *uc;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    uc = tech_pvt->uc;
-    assert(uc != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	uc = tech_pvt->uc;
+	assert(uc != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "video_refresh_req(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "video_refresh_req(%p)\n", (void *) session);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t display(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
-    switch_channel_t *channel;
-    private_t *tech_pvt;
-    uc_t *uc;
+	switch_channel_t *channel;
+	private_t *tech_pvt;
+	uc_t *uc;
 
-    channel = switch_core_session_get_channel(session);
-    assert(channel != NULL);
-    tech_pvt = switch_core_session_get_private(session);
-    assert(tech_pvt != NULL);
-    uc = tech_pvt->uc;
-    assert(uc != NULL);
+	channel = switch_core_session_get_channel(session);
+	assert(channel != NULL);
+	tech_pvt = switch_core_session_get_private(session);
+	assert(tech_pvt != NULL);
+	uc = tech_pvt->uc;
+	assert(uc != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "display(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "display(%p)\n", (void *) session);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t unicall_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)
 {
-    switch (msg->message_id)
-    {
-    case SWITCH_MESSAGE_REDIRECT_AUDIO:
-        return redirect_audio(session, msg);
-    case SWITCH_MESSAGE_TRANSMIT_TEXT:
-        return transmit_text(session, msg);
-    case SWITCH_MESSAGE_INDICATE_ANSWER:
-        return answer(session, msg);
-    case SWITCH_MESSAGE_INDICATE_PROGRESS:
-        return progress(session, msg);
-    case SWITCH_MESSAGE_INDICATE_BRIDGE:
-        return bridge(session, msg);
-    case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
-        return unbridge(session, msg);
-    case SWITCH_MESSAGE_INDICATE_TRANSFER:
-        return transfer(session, msg);
-    case SWITCH_MESSAGE_INDICATE_RINGING:
-        return ringing(session, msg);
-    case SWITCH_MESSAGE_INDICATE_MEDIA:
-        return media(session, msg);
-    case SWITCH_MESSAGE_INDICATE_NOMEDIA:
-        return nomedia(session, msg);
-    case SWITCH_MESSAGE_INDICATE_HOLD:
-        return hold(session, msg);
-    case SWITCH_MESSAGE_INDICATE_UNHOLD:
-        return unhold(session, msg);
-    case SWITCH_MESSAGE_INDICATE_REDIRECT:
-        return redirect(session, msg);
-    case SWITCH_MESSAGE_INDICATE_RESPOND:
-        return respond(session, msg);
-    case SWITCH_MESSAGE_INDICATE_BROADCAST:
-        return broadcast(session, msg);
-    case SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT:
-        return media_redirect(session, msg);
-    case SWITCH_MESSAGE_INDICATE_DEFLECT:
-        return deflect(session, msg);
-    case SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ:
-        return video_refresh_req(session, msg);
-    case SWITCH_MESSAGE_INDICATE_DISPLAY:
-        return display(session, msg);
-    default:
-        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "unicall_receive_message(%p) %d\n", (void *) session, msg->message_id);
-        break;
-    }
+	switch (msg->message_id) {
+	case SWITCH_MESSAGE_REDIRECT_AUDIO:
+		return redirect_audio(session, msg);
+	case SWITCH_MESSAGE_TRANSMIT_TEXT:
+		return transmit_text(session, msg);
+	case SWITCH_MESSAGE_INDICATE_ANSWER:
+		return answer(session, msg);
+	case SWITCH_MESSAGE_INDICATE_PROGRESS:
+		return progress(session, msg);
+	case SWITCH_MESSAGE_INDICATE_BRIDGE:
+		return bridge(session, msg);
+	case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
+		return unbridge(session, msg);
+	case SWITCH_MESSAGE_INDICATE_TRANSFER:
+		return transfer(session, msg);
+	case SWITCH_MESSAGE_INDICATE_RINGING:
+		return ringing(session, msg);
+	case SWITCH_MESSAGE_INDICATE_MEDIA:
+		return media(session, msg);
+	case SWITCH_MESSAGE_INDICATE_NOMEDIA:
+		return nomedia(session, msg);
+	case SWITCH_MESSAGE_INDICATE_HOLD:
+		return hold(session, msg);
+	case SWITCH_MESSAGE_INDICATE_UNHOLD:
+		return unhold(session, msg);
+	case SWITCH_MESSAGE_INDICATE_REDIRECT:
+		return redirect(session, msg);
+	case SWITCH_MESSAGE_INDICATE_RESPOND:
+		return respond(session, msg);
+	case SWITCH_MESSAGE_INDICATE_BROADCAST:
+		return broadcast(session, msg);
+	case SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT:
+		return media_redirect(session, msg);
+	case SWITCH_MESSAGE_INDICATE_DEFLECT:
+		return deflect(session, msg);
+	case SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ:
+		return video_refresh_req(session, msg);
+	case SWITCH_MESSAGE_INDICATE_DISPLAY:
+		return display(session, msg);
+	default:
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "unicall_receive_message(%p) %d\n", (void *) session, msg->message_id);
+		break;
+	}
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 /* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines
    that allocate memory or you will have 1 channel with memory allocated from another channel's pool!
 */
 static switch_call_cause_t unicall_outgoing_channel(switch_core_session_t *session,
-                                                    switch_event_t *var_event,
-                                                    switch_caller_profile_t *outbound_profile,
-                                                    switch_core_session_t **new_session,
-                                                    switch_memory_pool_t **pool,
-                                                    switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
+													switch_event_t *var_event,
+													switch_caller_profile_t *outbound_profile,
+													switch_core_session_t **new_session,
+													switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
 {
-    private_t *tech_pvt;
-    switch_channel_t *channel;
-    switch_caller_profile_t *caller_profile;
-    uc_t *uc;
-    uc_makecall_t makecall;
-    uc_callparms_t *callparms;
-    int screen;
-    int hide;
-    char name[128];
+	private_t *tech_pvt;
+	switch_channel_t *channel;
+	switch_caller_profile_t *caller_profile;
+	uc_t *uc;
+	uc_makecall_t makecall;
+	uc_callparms_t *callparms;
+	int screen;
+	int hide;
+	char name[128];
 
-switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "unicall_outgoing_channel(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "unicall_outgoing_channel(%p)\n", (void *) session);
 
- if ((*new_session = switch_core_session_request(unicall_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) == NULL)
-    {
-        return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
-    }
+	if ((*new_session = switch_core_session_request(unicall_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, pool)) == NULL) {
+		return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+	}
 
-    switch_core_session_add_stream(*new_session, NULL);
-    if ((tech_pvt = (private_t *) switch_core_session_alloc(*new_session, sizeof(private_t))) == NULL)
-    {
-        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Hey where is my memory pool?\n");
-        switch_core_session_destroy(new_session);
-        return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
-    }
-    channel = switch_core_session_get_channel(*new_session);
-    tech_init(tech_pvt, *new_session);
+	switch_core_session_add_stream(*new_session, NULL);
+	if ((tech_pvt = (private_t *) switch_core_session_alloc(*new_session, sizeof(private_t))) == NULL) {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Hey where is my memory pool?\n");
+		switch_core_session_destroy(new_session);
+		return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+	}
+	channel = switch_core_session_get_channel(*new_session);
+	tech_init(tech_pvt, *new_session);
 
-    if (outbound_profile == NULL)
-    {
-        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Doh! no caller profile\n");
-        switch_core_session_destroy(new_session);
-        return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
-    }
-    snprintf(name, sizeof(name), "UNICALL/%s", outbound_profile->destination_number);
-    switch_channel_set_name(channel, name);
+	if (outbound_profile == NULL) {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Doh! no caller profile\n");
+		switch_core_session_destroy(new_session);
+		return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+	}
+	snprintf(name, sizeof(name), "UNICALL/%s", outbound_profile->destination_number);
+	switch_channel_set_name(channel, name);
 
-    caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
-    switch_channel_set_caller_profile(channel, caller_profile);
-    tech_pvt->caller_profile = caller_profile;
+	caller_profile = switch_caller_profile_clone(*new_session, outbound_profile);
+	switch_channel_set_caller_profile(channel, caller_profile);
+	tech_pvt->caller_profile = caller_profile;
 
-    uc = tech_pvt->uc;
+	uc = tech_pvt->uc;
 
-    if ((callparms = uc_new_callparms(NULL)) == NULL)
-        return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
+	if ((callparms = uc_new_callparms(NULL)) == NULL)
+		return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
 
-    //uc_callparm_bear_cap_transfer_cap(callparms, cap);
-    //uc_callparm_bear_cap_transfer_mode(callparms, mode);
-    //uc_callparm_bear_cap_transfer_rate(callparms, rate);
-    //uc_callparm_userinfo_layer1_protocol(callparms, prot);
-    //uc_callparm_user_rate(callparms, rate);
+	//uc_callparm_bear_cap_transfer_cap(callparms, cap);
+	//uc_callparm_bear_cap_transfer_mode(callparms, mode);
+	//uc_callparm_bear_cap_transfer_rate(callparms, rate);
+	//uc_callparm_userinfo_layer1_protocol(callparms, prot);
+	//uc_callparm_user_rate(callparms, rate);
 
-switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_INFO, "destination '%s'\n", outbound_profile->destination_number);
-    uc_callparm_set_destination_number(callparms, outbound_profile->destination_number);
-    uc_callparm_set_destination_ton(callparms, outbound_profile->destination_number_ton);
-    uc_callparm_set_destination_npi(callparms, outbound_profile->destination_number_numplan);
-    //uc_callparm_set_destination_sub_addr_number(callparms, num);
-    //uc_callparm_set_destination_sub_addr_ton(callparms, ton);
-    //uc_callparm_set_destination_sub_addr_npi(callparms, npi);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_INFO, "destination '%s'\n", outbound_profile->destination_number);
+	uc_callparm_set_destination_number(callparms, outbound_profile->destination_number);
+	uc_callparm_set_destination_ton(callparms, outbound_profile->destination_number_ton);
+	uc_callparm_set_destination_npi(callparms, outbound_profile->destination_number_numplan);
+	//uc_callparm_set_destination_sub_addr_number(callparms, num);
+	//uc_callparm_set_destination_sub_addr_ton(callparms, ton);
+	//uc_callparm_set_destination_sub_addr_npi(callparms, npi);
 
-    //uc_callparm_set_redirecting_cause(callparms, cause);
-    //uc_callparm_set_redirecting_presentation(callparms, pres);
-    uc_callparm_set_redirecting_number(callparms, outbound_profile->rdnis);
-    uc_callparm_set_redirecting_ton(callparms, outbound_profile->rdnis_ton);
-    uc_callparm_set_redirecting_npi(callparms, outbound_profile->rdnis_numplan);
-    //uc_callparm_set_redirecting_subaddr(callparms, num);
-    //uc_callparm_set_redirecting_subaddr_ton(callparms, ton);
-    //uc_callparm_set_redirecting_subaddr_npi(callparms, npi);
+	//uc_callparm_set_redirecting_cause(callparms, cause);
+	//uc_callparm_set_redirecting_presentation(callparms, pres);
+	uc_callparm_set_redirecting_number(callparms, outbound_profile->rdnis);
+	uc_callparm_set_redirecting_ton(callparms, outbound_profile->rdnis_ton);
+	uc_callparm_set_redirecting_npi(callparms, outbound_profile->rdnis_numplan);
+	//uc_callparm_set_redirecting_subaddr(callparms, num);
+	//uc_callparm_set_redirecting_subaddr_ton(callparms, ton);
+	//uc_callparm_set_redirecting_subaddr_npi(callparms, npi);
 
-    //uc_callparm_set_original_called_number(callparms, num);
-    //uc_callparm_set_original_called_number_ton(callparms, ton);
-    //uc_callparm_set_original_called_number_npi(callparms, npi);
+	//uc_callparm_set_original_called_number(callparms, num);
+	//uc_callparm_set_original_called_number_ton(callparms, ton);
+	//uc_callparm_set_original_called_number_npi(callparms, npi);
 
-switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_INFO, "caller id name '%s'\n", outbound_profile->caller_id_name);
-switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_INFO, "caller id number '%s'\n", outbound_profile->caller_id_number);
-    uc_callparm_set_originating_name(callparms, outbound_profile->caller_id_name);
-    uc_callparm_set_originating_number(callparms, outbound_profile->caller_id_number);
-    screen = switch_test_flag(outbound_profile, SWITCH_CPF_SCREEN);
-    hide = switch_test_flag(outbound_profile, SWITCH_CPF_HIDE_NUMBER);
-    if (!screen  &&  !hide)
-        uc_callparm_set_originating_presentation(callparms, UC_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED);
-    else if (!screen  &&  hide)
-        uc_callparm_set_originating_presentation(callparms, UC_PRES_PROHIB_USER_NUMBER_NOT_SCREENED);
-    else if (screen  &&  !hide)
-        uc_callparm_set_originating_presentation(callparms, UC_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN);
-    else
-        uc_callparm_set_originating_presentation(callparms, UC_PRES_PROHIB_USER_NUMBER_PASSED_SCREEN);
-    uc_callparm_set_originating_ton(callparms, outbound_profile->caller_ton);
-    uc_callparm_set_originating_npi(callparms, outbound_profile->caller_numplan);
-    //uc_callparm_set_originating_sub_addr_number(callparms, num);
-    //uc_callparm_set_originating_sub_addr_ton(callparms, ton);
-    //uc_callparm_set_originating_sub_addr_npi(callparms, npi);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_INFO, "caller id name '%s'\n", outbound_profile->caller_id_name);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_INFO, "caller id number '%s'\n", outbound_profile->caller_id_number);
+	uc_callparm_set_originating_name(callparms, outbound_profile->caller_id_name);
+	uc_callparm_set_originating_number(callparms, outbound_profile->caller_id_number);
+	screen = switch_test_flag(outbound_profile, SWITCH_CPF_SCREEN);
+	hide = switch_test_flag(outbound_profile, SWITCH_CPF_HIDE_NUMBER);
+	if (!screen && !hide)
+		uc_callparm_set_originating_presentation(callparms, UC_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED);
+	else if (!screen && hide)
+		uc_callparm_set_originating_presentation(callparms, UC_PRES_PROHIB_USER_NUMBER_NOT_SCREENED);
+	else if (screen && !hide)
+		uc_callparm_set_originating_presentation(callparms, UC_PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN);
+	else
+		uc_callparm_set_originating_presentation(callparms, UC_PRES_PROHIB_USER_NUMBER_PASSED_SCREEN);
+	uc_callparm_set_originating_ton(callparms, outbound_profile->caller_ton);
+	uc_callparm_set_originating_npi(callparms, outbound_profile->caller_numplan);
+	//uc_callparm_set_originating_sub_addr_number(callparms, num);
+	//uc_callparm_set_originating_sub_addr_ton(callparms, ton);
+	//uc_callparm_set_originating_sub_addr_npi(callparms, npi);
 
-    uc_callparm_set_calling_party_category(callparms, UC_CALLER_CATEGORY_NATIONAL_SUBSCRIBER_CALL);
-    
-    makecall.callparms = callparms;
-    makecall.call = NULL;
+	uc_callparm_set_calling_party_category(callparms, UC_CALLER_CATEGORY_NATIONAL_SUBSCRIBER_CALL);
 
+	makecall.callparms = callparms;
+	makecall.call = NULL;
+
 #if 0
-    if ((ret = uc_call_control(uc, UC_OP_MAKECALL, 0, (void *) &makecall)) < 0)
-    {
-        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_INFO, "Make call failed - %s\n", uc_ret_to_str(ret));
-        return SWITCH_STATUS_FAILED;
-    }
-    /*endif*/
+	if ((ret = uc_call_control(uc, UC_OP_MAKECALL, 0, (void *) &makecall)) < 0) {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_INFO, "Make call failed - %s\n", uc_ret_to_str(ret));
+		return SWITCH_STATUS_FAILED;
+	}
+	/*endif */
 #endif
-    free(callparms);
+	free(callparms);
 
-    switch_channel_set_flag(channel, CF_OUTBOUND);
-    switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND);
-    switch_channel_set_state(channel, CS_INIT);
-switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_INFO, "unicall_outgoing_channel(%p) SUCCESS\n", (void *) session);
-    return SWITCH_CAUSE_SUCCESS;
+
+	switch_channel_set_state(channel, CS_INIT);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_INFO, "unicall_outgoing_channel(%p) SUCCESS\n", (void *) session);
+	return SWITCH_CAUSE_SUCCESS;
 }
 
 static switch_status_t unicall_receive_event(switch_core_session_t *session, switch_event_t *event)
 {
-    struct private_object *tech_pvt = switch_core_session_get_private(session);
-    char *body = switch_event_get_body(event);
+	struct private_object *tech_pvt = switch_core_session_get_private(session);
+	char *body = switch_event_get_body(event);
 
-    switch_assert(tech_pvt != NULL);
+	switch_assert(tech_pvt != NULL);
 
-    switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "unicall_receive_event(%p)\n", (void *) session);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "unicall_receive_event(%p)\n", (void *) session);
 
-    if (body == NULL)
-        body = "";
+	if (body == NULL)
+		body = "";
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 static void *SWITCH_THREAD_FUNC unicall_thread_run(switch_thread_t *thread, void *obj)
 {
-    fd_set read;
-    fd_set write;
-    fd_set oob;
+	fd_set read;
+	fd_set write;
+	fd_set oob;
 	int fd;
-    int ret;
-    switch_event_t *s_event;
-    uc_t *uc = (uc_t *) obj;
+	int ret;
+	switch_event_t *s_event;
+	uc_t *uc = (uc_t *) obj;
 
 #if 0
-    switch_mutex_init(&chanmap.mutex, SWITCH_MUTEX_NESTED, module_pool);
+	switch_mutex_init(&chanmap.mutex, SWITCH_MUTEX_NESTED, module_pool);
 #endif
 
-    if (switch_event_create(&s_event, SWITCH_EVENT_PUBLISH) == SWITCH_STATUS_SUCCESS)
-    {
-        switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "service", "_uc._tcp");
-        switch_event_fire(&s_event);
-    }
+	if (switch_event_create(&s_event, SWITCH_EVENT_PUBLISH) == SWITCH_STATUS_SUCCESS) {
+		switch_event_add_header(s_event, SWITCH_STACK_BOTTOM, "service", "_uc._tcp");
+		switch_event_fire(&s_event);
+	}
 
-    uc_get_device_handle(uc, 0, &fd);
-    if ((ret = uc_call_control(uc, UC_OP_UNBLOCK, 0, (void *) (intptr_t) -1)) < 0)
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Unblock failed - %s\n", uc_ret_to_str(ret));
-    /*endif*/
-    FD_ZERO(&read);
-    FD_ZERO(&write);
-    FD_ZERO(&oob);
-	for (;;)
-    {
+	uc_get_device_handle(uc, 0, &fd);
+	if ((ret = uc_call_control(uc, UC_OP_UNBLOCK, 0, (void *) (intptr_t) - 1)) < 0)
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Unblock failed - %s\n", uc_ret_to_str(ret));
+	/*endif */
+	FD_ZERO(&read);
+	FD_ZERO(&write);
+	FD_ZERO(&oob);
+	for (;;) {
 		FD_SET(fd, &read);
 		//FD_SET(fd, &write);
 		//FD_SET(fd, &oob);
 
-		if (select(fd + 1, &read, NULL, NULL, NULL))
-        {
-		    if (FD_ISSET(fd, &read))
-            {
-               uc_check_event(uc);
-               uc_schedule_run(uc);
+		if (select(fd + 1, &read, NULL, NULL, NULL)) {
+			if (FD_ISSET(fd, &read)) {
+				uc_check_event(uc);
+				uc_schedule_run(uc);
 			}
 		}
 	}
 
-    uc_delete(uc);
-    return NULL;
+	uc_delete(uc);
+	return NULL;
 }
 
 static void unicall_thread_launch(uc_t *uc)
 {
-    switch_thread_t *thread;
-    switch_threadattr_t *thd_attr = NULL;
+	switch_thread_t *thread;
+	switch_threadattr_t *thd_attr = NULL;
 
-    switch_threadattr_create(&thd_attr, module_pool);
-    switch_threadattr_detach_set(thd_attr, 1);
-    switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-    switch_thread_create(&thread, thd_attr, unicall_thread_run, uc, module_pool);
+	switch_threadattr_create(&thd_attr, module_pool);
+	switch_threadattr_detach_set(thd_attr, 1);
+	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+	switch_thread_create(&thread, thd_attr, unicall_thread_run, uc, module_pool);
 }
 
-switch_state_handler_table_t unicall_state_handlers =
-{
-    /*.on_init */ unicall_on_init,
-    /*.on_routing */ unicall_on_routing,
-    /*.on_execute */ unicall_on_execute,
-    /*.on_hangup */ unicall_on_hangup,
-    /*.on_exchange_media */ unicall_on_exchange_media,
-    /*.on_soft_execute */ unicall_on_soft_execute,
-    /*.on_consume_media*/ NULL,
-    /*.on_hibernate*/ NULL,
-    /*.on_reset*/ NULL,
-    /*.on_park*/ NULL,
-    /*.on_reporting*/ NULL,
-    /*.on_destroy*/ unicall_on_destroy
-
+switch_state_handler_table_t unicall_state_handlers = {
+	/*.on_init */ unicall_on_init,
+	/*.on_routing */ unicall_on_routing,
+	/*.on_execute */ unicall_on_execute,
+	/*.on_hangup */ unicall_on_hangup,
+	/*.on_exchange_media */ unicall_on_exchange_media,
+	/*.on_soft_execute */ unicall_on_soft_execute,
+	/*.on_consume_media */ NULL,
+	/*.on_hibernate */ NULL,
+	/*.on_reset */ NULL,
+	/*.on_park */ NULL,
+	/*.on_reporting */ NULL,
+	/*.on_destroy */ unicall_on_destroy
 };
 
-switch_io_routines_t unicall_io_routines =
-{
-    /*.outgoing_channel */ unicall_outgoing_channel,
-    /*.read_frame */ unicall_read_frame,
-    /*.write_frame */ unicall_write_frame,
-    /*.kill_channel */ unicall_kill_channel,
-    /*.send_dtmf */ unicall_send_dtmf,
-    /*.receive_message */ unicall_receive_message,
-    /*.receive_event */ unicall_receive_event
+switch_io_routines_t unicall_io_routines = {
+	/*.outgoing_channel */ unicall_outgoing_channel,
+	/*.read_frame */ unicall_read_frame,
+	/*.write_frame */ unicall_write_frame,
+	/*.kill_channel */ unicall_kill_channel,
+	/*.send_dtmf */ unicall_send_dtmf,
+	/*.receive_message */ unicall_receive_message,
+	/*.receive_event */ unicall_receive_event
 };
 
 static switch_status_t config_unicall(int reload)
 {
-    const char *cf = "unicall.conf";
-    switch_xml_t cfg;
-    switch_xml_t xml;
-    switch_xml_t settings;
-    switch_xml_t param;
-    switch_xml_t spans;
-    switch_xml_t span;
-    int current_span = 0;
-    int min_span = 0;
-    int max_span = 0;
-    int logging_level;
-    int i;
-    char *id;
-    span_data_t *sp;
+	const char *cf = "unicall.conf";
+	switch_xml_t cfg;
+	switch_xml_t xml;
+	switch_xml_t settings;
+	switch_xml_t param;
+	switch_xml_t spans;
+	switch_xml_t span;
+	int current_span = 0;
+	int min_span = 0;
+	int max_span = 0;
+	int logging_level;
+	int i;
+	char *id;
+	span_data_t *sp;
 
-    if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL)))
-    {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Opening of %s failed\n", cf);
-        return SWITCH_STATUS_TERM;
-    }
+	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Opening of %s failed\n", cf);
+		return SWITCH_STATUS_TERM;
+	}
 
-    if ((settings = switch_xml_child(cfg, "settings")))
-    {
-        for (param = switch_xml_child(settings, "param");  param;  param = param->next)
-        {
-            char *var = (char *) switch_xml_attr_soft(param, "name");
-            char *val = (char *) switch_xml_attr_soft(param, "value");
+	if ((settings = switch_xml_child(cfg, "settings"))) {
+		for (param = switch_xml_child(settings, "param"); param; param = param->next) {
+			char *var = (char *) switch_xml_attr_soft(param, "name");
+			char *val = (char *) switch_xml_attr_soft(param, "value");
 
-            if (!strcmp(var, "debug"))
-            {
-                globals.debug = atoi(val);
-            }
-            else if (!strcmp(var, "ms-per-frame"))
-            {
-                globals.frame_duration = atoi(val);
-            }
-            else if (!strcmp(var, "dtmf-on"))
-            {
-                globals.dtmf_on = atoi(val);
-            }
-            else if (!strcmp(var, "dtmf-off"))
-            {
-                globals.dtmf_off = atoi(val);
-            }
-            else if (!strcmp(var, "dialplan"))
-            {
-                set_global_dialplan(val);
-            }
-            else if (!strcmp(var, "suppress-dtmf-tone"))
-            {
-                globals.suppress_dtmf_tone = switch_true(val);
-            }
-            else if (!strcmp(var, "ignore-dtmf-tone"))
-            {
-                globals.ignore_dtmf_tone = switch_true(val);
-            }
-        }
-    }
-    spans = switch_xml_child(cfg, "spans");
-    id = NULL;
-    for (span = switch_xml_child(spans, "span");  span;  span = span->next)
-    {
-        id = (char *) switch_xml_attr(span, "id");
+			if (!strcmp(var, "debug")) {
+				globals.debug = atoi(val);
+			} else if (!strcmp(var, "ms-per-frame")) {
+				globals.frame_duration = atoi(val);
+			} else if (!strcmp(var, "dtmf-on")) {
+				globals.dtmf_on = atoi(val);
+			} else if (!strcmp(var, "dtmf-off")) {
+				globals.dtmf_off = atoi(val);
+			} else if (!strcmp(var, "dialplan")) {
+				set_global_dialplan(val);
+			} else if (!strcmp(var, "suppress-dtmf-tone")) {
+				globals.suppress_dtmf_tone = switch_true(val);
+			} else if (!strcmp(var, "ignore-dtmf-tone")) {
+				globals.ignore_dtmf_tone = switch_true(val);
+			}
+		}
+	}
+	spans = switch_xml_child(cfg, "spans");
+	id = NULL;
+	for (span = switch_xml_child(spans, "span"); span; span = span->next) {
+		id = (char *) switch_xml_attr(span, "id");
 
-        current_span = 0;
+		current_span = 0;
 
-        if (id)
-        {
-            char *p;
+		if (id) {
+			char *p;
 
-            min_span = atoi(id);
-            if ((p = strchr(id, '-')))
-            {
-                p++;
-                max_span = atoi(p);
-            }
-            else
-            {
-                max_span = min_span;
-            }
-            if (min_span < 1  ||  max_span < min_span)
-            {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid Span Config! [%s]\n", id);
-                continue;
-            }
-        }
-        else
-        {
-            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Missing SPAN ID!\n");
-            continue;
-        }
-        for (i = min_span;  i <= max_span;  i++)
-        {
-            current_span = i;
+			min_span = atoi(id);
+			if ((p = strchr(id, '-'))) {
+				p++;
+				max_span = atoi(p);
+			} else {
+				max_span = min_span;
+			}
+			if (min_span < 1 || max_span < min_span) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid Span Config! [%s]\n", id);
+				continue;
+			}
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Missing SPAN ID!\n");
+			continue;
+		}
+		for (i = min_span; i <= max_span; i++) {
+			current_span = i;
 
-            if (current_span <= 0  ||  current_span > MAX_SPANS)
-            {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid SPAN %d!\n", current_span);
-                current_span = 0;
-                continue;
-            }
-            if (span_data[current_span] == NULL)
-            {
-                if ((span_data[current_span] = switch_core_alloc(module_pool, sizeof(*span_data[current_span]))) == NULL)
-                {
-                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "MEMORY ERROR\n");
-                    break;
-                }
-                sp = span_data[current_span];
-                memset(sp, 0, sizeof(*sp));
-                sp->span = current_span;
-                sp->protocol_class = NULL;
-                sp->protocol_variant = NULL;
-                sp->protocol_end = UC_MODE_CPE;
-                sp->outgoing_ok = TRUE;
-            }
-            sp = span_data[current_span];
-            sp->id = strdup(id);
-            for (param = switch_xml_child(span, "param");  param;  param = param->next)
-            {
-                char *var = (char *) switch_xml_attr_soft(param, "name");
-                char *val = (char *) switch_xml_attr_soft(param, "value");
+			if (current_span <= 0 || current_span > MAX_SPANS) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid SPAN %d!\n", current_span);
+				current_span = 0;
+				continue;
+			}
+			if (span_data[current_span] == NULL) {
+				if ((span_data[current_span] = switch_core_alloc(module_pool, sizeof(*span_data[current_span]))) == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "MEMORY ERROR\n");
+					break;
+				}
+				sp = span_data[current_span];
+				memset(sp, 0, sizeof(*sp));
+				sp->span = current_span;
+				sp->protocol_class = NULL;
+				sp->protocol_variant = NULL;
+				sp->protocol_end = UC_MODE_CPE;
+				sp->outgoing_ok = TRUE;
+			}
+			sp = span_data[current_span];
+			sp->id = strdup(id);
+			for (param = switch_xml_child(span, "param"); param; param = param->next) {
+				char *var = (char *) switch_xml_attr_soft(param, "name");
+				char *val = (char *) switch_xml_attr_soft(param, "value");
 
-                if (strcmp(var, "protocol-class") == 0)
-                {
-                    sp->protocol_class = strdup(val);
-                }
-                else if (strcmp(var, "protocol-variant") == 0)
-                {
-                    sp->protocol_variant = strdup(val);
-                }
-                else if (strcmp(var, "protocol-end") == 0)
-                {
-                    if (strcasecmp(val, "co") == 0)
-                        sp->protocol_end = UC_MODE_CO;
-                    else if (strcasecmp(val, "cpe") == 0)
-                        sp->protocol_end = UC_MODE_CPE;
-                    else if (strcasecmp(val, "peer") == 0)
-                        sp->protocol_end = UC_MODE_PEER;
-                    else
-                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "UNKNOWN protocol-end TYPE %s\n", val);
-                }
-                else if (strcmp(var, "outgoing-allowed") == 0)
-                {
-                    sp->outgoing_ok = switch_true(var);
-                }
-                else if (strcmp(var, "dialplan") == 0)
-                {
-                    sp->dialplan = strdup(val);
-                }
-                else if (strcmp(var, "context") == 0)
-                {
-                    sp->context = strdup(val);
-                }
-                else
-                {
-                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "UNKNOWN PARAMETER %s\n", var);
-                }
-            }
-        }
-    }
-    switch_xml_free(xml);
+				if (strcmp(var, "protocol-class") == 0) {
+					sp->protocol_class = strdup(val);
+				} else if (strcmp(var, "protocol-variant") == 0) {
+					sp->protocol_variant = strdup(val);
+				} else if (strcmp(var, "protocol-end") == 0) {
+					if (strcasecmp(val, "co") == 0)
+						sp->protocol_end = UC_MODE_CO;
+					else if (strcasecmp(val, "cpe") == 0)
+						sp->protocol_end = UC_MODE_CPE;
+					else if (strcasecmp(val, "peer") == 0)
+						sp->protocol_end = UC_MODE_PEER;
+					else
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "UNKNOWN protocol-end TYPE %s\n", val);
+				} else if (strcmp(var, "outgoing-allowed") == 0) {
+					sp->outgoing_ok = switch_true(var);
+				} else if (strcmp(var, "dialplan") == 0) {
+					sp->dialplan = strdup(val);
+				} else if (strcmp(var, "context") == 0) {
+					sp->context = strdup(val);
+				} else {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "UNKNOWN PARAMETER %s\n", var);
+				}
+			}
+		}
+	}
+	switch_xml_free(xml);
 
-    if (globals.dialplan == NULL)
-        set_global_dialplan("XML");
+	if (globals.dialplan == NULL)
+		set_global_dialplan("XML");
 
-    globals.configured_spans = 0;
-    for (current_span = 1;  current_span < MAX_SPANS;  current_span++)
-    {
-        if (span_data[current_span])
-        {
-            sp = span_data[current_span];
-            if ((sp->uc = uc_create(sp->id,
-                                    sp->protocol_class,
-                                    sp->protocol_variant,
-                                    sp->protocol_end,
-                                    sp->outgoing_ok)) == NULL)
-            {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot launch span %d\n", current_span);
-                return SWITCH_STATUS_FALSE;
-            }
-            uc_get_device_handle(sp->uc, 0, &sp->fd);
-            uc_set_signaling_callback(sp->uc, handle_uc_event, (void *) (intptr_t) current_span);
-            logging_level = UC_LOG_SEVERITY_MASK | UC_LOG_SHOW_TAG | UC_LOG_SHOW_PROTOCOL;
-            uc_set_logging(sp->uc, logging_level, 1, sp->id);
+	globals.configured_spans = 0;
+	for (current_span = 1; current_span < MAX_SPANS; current_span++) {
+		if (span_data[current_span]) {
+			sp = span_data[current_span];
+			if ((sp->uc = uc_create(sp->id, sp->protocol_class, sp->protocol_variant, sp->protocol_end, sp->outgoing_ok)) == NULL) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot launch span %d\n", current_span);
+				return SWITCH_STATUS_FALSE;
+			}
+			uc_get_device_handle(sp->uc, 0, &sp->fd);
+			uc_set_signaling_callback(sp->uc, handle_uc_event, (void *) (intptr_t) current_span);
+			logging_level = UC_LOG_SEVERITY_MASK | UC_LOG_SHOW_TAG | UC_LOG_SHOW_PROTOCOL;
+			uc_set_logging(sp->uc, logging_level, 1, sp->id);
 
-            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Launched span %d\n", current_span);
-            unicall_thread_launch(sp->uc);
-            switch_mutex_lock(globals.hash_mutex);
-            globals.configured_spans++;
-            switch_mutex_unlock(globals.hash_mutex);
-        }
-    }
-    return SWITCH_STATUS_SUCCESS;
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Launched span %d\n", current_span);
+			unicall_thread_launch(sp->uc);
+			switch_mutex_lock(globals.hash_mutex);
+			globals.configured_spans++;
+			switch_mutex_unlock(globals.hash_mutex);
+		}
+	}
+	return SWITCH_STATUS_SUCCESS;
 }
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_unicall_load)
 {
-    int logging_level;
-    switch_status_t status = SWITCH_STATUS_SUCCESS;
+	int logging_level;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
-    uc_start();
-    uc_set_error_handler(unicall_report);
-    uc_set_message_handler(unicall_message);
-    logging_level = UC_LOG_SEVERITY_MASK;
-    uc_set_logging(NULL, logging_level, 1, NULL);
+	uc_start();
+	uc_set_error_handler(unicall_report);
+	uc_set_message_handler(unicall_message);
+	logging_level = UC_LOG_SEVERITY_MASK;
+	uc_set_logging(NULL, logging_level, 1, NULL);
 
 	memset(span_data, 0, sizeof(span_data));
 
-    module_pool = pool;
+	module_pool = pool;
 
 	memset(&globals, 0, sizeof(globals));
 	switch_core_hash_init(&globals.call_hash, module_pool);
@@ -1979,17 +1874,17 @@
 	switch_mutex_init(&globals.hash_mutex, SWITCH_MUTEX_NESTED, module_pool);
 	switch_mutex_init(&globals.channel_mutex, SWITCH_MUTEX_NESTED, module_pool);
 
-    if ((status = config_unicall(FALSE)) != SWITCH_STATUS_SUCCESS)
-        return status;
+	if ((status = config_unicall(FALSE)) != SWITCH_STATUS_SUCCESS)
+		return status;
 
-    *module_interface = switch_loadable_module_create_module_interface(pool, modname);
-    unicall_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
-    unicall_endpoint_interface->interface_name = "unicall";
-    unicall_endpoint_interface->io_routines = &unicall_io_routines;
-    unicall_endpoint_interface->state_handler = &unicall_state_handlers;
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
+	unicall_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE);
+	unicall_endpoint_interface->interface_name = "unicall";
+	unicall_endpoint_interface->io_routines = &unicall_io_routines;
+	unicall_endpoint_interface->state_handler = &unicall_state_handlers;
 
-    /* Indicate that the module should continue to be loaded */
-    return SWITCH_STATUS_SUCCESS;
+	/* Indicate that the module should continue to be loaded */
+	return SWITCH_STATUS_SUCCESS;
 }
 
 /*
@@ -2001,10 +1896,10 @@
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_unicall_shutdown)
 {
-    int x = 0;
+	int x = 0;
 
-    for (x = 0, running = -1;  running  &&  x <= 100;  x++)
-        switch_yield(20000);
-    uc_end();
-    return SWITCH_STATUS_SUCCESS;
+	for (x = 0, running = -1; running && x <= 100; x++)
+		switch_yield(20000);
+	uc_end();
+	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -161,7 +161,7 @@
 		do_rotate(fd);
 		switch_yield(250000);
 	}
-	
+
 	if (bytes_in > 0) {
 		fd->bytes += bytes_in;
 	}
@@ -215,15 +215,16 @@
 			free(buf);
 		}
 	}
-	
+
 	g_template_str = (const char *) switch_core_hash_find(globals.template_hash, globals.default_template);
 
 	if ((accountcode = switch_channel_get_variable(channel, "ACCOUNTCODE"))) {
 		a_template_str = (const char *) switch_core_hash_find(globals.template_hash, accountcode);
 	}
-	
+
 	if (!g_template_str) {
-		g_template_str = "\"${accountcode}\",\"${caller_id_number}\",\"${destination_number}\",\"${context}\",\"${caller_id}\",\"${channel_name}\",\"${bridge_channel}\",\"${last_app}\",\"${last_arg}\",\"${start_stamp}\",\"${answer_stamp}\",\"${end_stamp}\",\"${duration}\",\"${billsec}\",\"${hangup_cause}\",\"${amaflags}\",\"${uuid}\",\"${userfield}\";";
+		g_template_str =
+			"\"${accountcode}\",\"${caller_id_number}\",\"${destination_number}\",\"${context}\",\"${caller_id}\",\"${channel_name}\",\"${bridge_channel}\",\"${last_app}\",\"${last_arg}\",\"${start_stamp}\",\"${answer_stamp}\",\"${end_stamp}\",\"${duration}\",\"${billsec}\",\"${hangup_cause}\",\"${amaflags}\",\"${uuid}\",\"${userfield}\";";
 	}
 
 	if (!a_template_str) {
@@ -295,11 +296,11 @@
 	/*.on_hangup */ NULL,
 	/*.on_exchange_media */ NULL,
 	/*.on_soft_execute */ NULL,
-	/*.on_consume_media*/ NULL,
-	/*.on_hibernate*/ NULL,
-	/*.on_reset*/ NULL,
-	/*.on_park*/ NULL,
-	/*.on_reporting*/ my_on_reporting
+	/*.on_consume_media */ NULL,
+	/*.on_hibernate */ NULL,
+	/*.on_reset */ NULL,
+	/*.on_park */ NULL,
+	/*.on_reporting */ my_on_reporting
 };
 
 
@@ -315,11 +316,11 @@
 	switch_core_hash_init(&globals.template_hash, pool);
 
 	globals.pool = pool;
-	
+
 	switch_core_hash_insert(globals.template_hash, "default", default_template);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Adding default template.\n");
 	globals.legs = CDR_LEG_A;
-	
+
 	if ((xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
 
 		if ((settings = switch_xml_child(cfg, "settings"))) {
@@ -344,9 +345,11 @@
 					globals.rotate = switch_true(val);
 				} else if (!strcasecmp(var, "default-template")) {
 					globals.default_template = switch_core_strdup(pool, val);
-				} else if (!strcasecmp(var, "master-file-only")) {
-					globals.masterfileonly = switch_true(val);
-				}
+				} else if (!strcasecmp(var, "master-file-only")) {
+					
+globals.masterfileonly = switch_true(val);
+				
+}
 			}
 		}
 
@@ -388,20 +391,24 @@
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 
-	if (switch_event_bind(modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+	load_config(pool);
+
+	if ((status = switch_dir_make_recursive(globals.log_dir, SWITCH_DEFAULT_DIR_PERMS, pool)) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", globals.log_dir);
+		return status;
+	}
+
+	if ((status = switch_event_bind(modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL)) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
-		return SWITCH_STATUS_GENERR;
+		return status;
 	}
 
 	switch_core_add_state_handler(&state_handlers);
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
-	load_config(pool);
 
-	if ((status = switch_dir_make_recursive(globals.log_dir, SWITCH_DEFAULT_DIR_PERMS, pool)) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating %s\n", globals.log_dir);
-	}
 
+
 	return status;
 }
 
@@ -409,7 +416,7 @@
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cdr_csv_shutdown)
 {
 
-	globals.shutdown = 1;	
+	globals.shutdown = 1;
 	switch_event_unbind_callback(event_handler);
 	switch_core_remove_state_handler(&state_handlers);
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_erlang_event/ei_helpers.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_erlang_event/ei_helpers.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_erlang_event/ei_helpers.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -54,23 +54,24 @@
 } while (0)
 
 
-void ei_link(listener_t *listener, erlang_pid *from, erlang_pid *to) {
+void ei_link(listener_t *listener, erlang_pid * from, erlang_pid * to)
+{
 	char msgbuf[2048];
 	char *s;
 	int index = 0;
 	int ret;
 
-	index = 5;                                     /* max sizes: */
-	ei_encode_version(msgbuf,&index);                     /*   1 */
-	ei_encode_tuple_header(msgbuf,&index,3);
-	ei_encode_long(msgbuf,&index,ERL_LINK);
-	ei_encode_pid(msgbuf,&index,from);                    /* 268 */
-	ei_encode_pid(msgbuf,&index,to);                      /* 268 */
+	index = 5;					/* max sizes: */
+	ei_encode_version(msgbuf, &index);	/*   1 */
+	ei_encode_tuple_header(msgbuf, &index, 3);
+	ei_encode_long(msgbuf, &index, ERL_LINK);
+	ei_encode_pid(msgbuf, &index, from);	/* 268 */
+	ei_encode_pid(msgbuf, &index, to);	/* 268 */
 
 	/* 5 byte header missing */
 	s = msgbuf;
-	put32be(s, index - 4);                                /*   4 */
-	put8(s, ERL_PASS_THROUGH);                            /*   1 */
+	put32be(s, index - 4);		/*   4 */
+	put8(s, ERL_PASS_THROUGH);	/*   1 */
 	/* sum:  542 */
 
 	switch_mutex_lock(listener->sock_mutex);
@@ -82,7 +83,7 @@
 	switch_mutex_unlock(listener->sock_mutex);
 }
 
-void ei_encode_switch_event_headers(ei_x_buff *ebuf, switch_event_t *event)
+void ei_encode_switch_event_headers(ei_x_buff * ebuf, switch_event_t *event)
 {
 	int i;
 	char *uuid = switch_event_get_header(event, "unique-id");
@@ -94,7 +95,7 @@
 	if (event->body)
 		i++;
 
-	ei_x_encode_list_header(ebuf, i+1);
+	ei_x_encode_list_header(ebuf, i + 1);
 
 	if (uuid) {
 		_ei_x_encode_string(ebuf, switch_event_get_header(event, "unique-id"));
@@ -118,7 +119,7 @@
 }
 
 
-void ei_encode_switch_event_tag(ei_x_buff *ebuf, switch_event_t *event, char *tag)
+void ei_encode_switch_event_tag(ei_x_buff * ebuf, switch_event_t *event, char *tag)
 {
 
 	ei_x_encode_tuple_header(ebuf, 2);
@@ -130,7 +131,7 @@
    calls module:function(Ref). The response comes back as
    {rex, {Ref, Pid}}
  */
-int ei_pid_from_rpc(struct ei_cnode_s *ec, int sockfd, erlang_ref *ref, char *module, char *function)
+int ei_pid_from_rpc(struct ei_cnode_s *ec, int sockfd, erlang_ref * ref, char *module, char *function)
 {
 	ei_x_buff buf;
 	ei_x_new(&buf);
@@ -145,7 +146,7 @@
 }
 
 /* function to spawn a process on a remote node */
-int ei_spawn(struct ei_cnode_s *ec, int sockfd, erlang_ref *ref, char *module, char *function, int argc, char **argv)
+int ei_spawn(struct ei_cnode_s *ec, int sockfd, erlang_ref * ref, char *module, char *function, int argc, char **argv)
 {
 	int i;
 	ei_x_buff buf;
@@ -154,7 +155,7 @@
 	ei_x_encode_tuple_header(&buf, 3);
 	ei_x_encode_atom(&buf, "$gen_call");
 	ei_x_encode_tuple_header(&buf, 2);
-	ei_x_encode_pid(&buf, ei_self(ec)); 
+	ei_x_encode_pid(&buf, ei_self(ec));
 	ei_init_ref(ec, ref);
 	ei_x_encode_ref(&buf, ref);
 	ei_x_encode_tuple_header(&buf, 5);
@@ -165,18 +166,18 @@
 	/* argument list */
 	if (argc < 0) {
 		ei_x_encode_list_header(&buf, argc);
-		for(i = 0; i < argc && argv[i]; i++) {
+		for (i = 0; i < argc && argv[i]; i++) {
 			ei_x_encode_atom(&buf, argv[i]);
 		}
 	}
 
 	ei_x_encode_empty_list(&buf);
 
-	/*if (i != argc - 1) {*/
-		/* horked argument list */
-	/*}*/
+	/*if (i != argc - 1) { */
+	/* horked argument list */
+	/*} */
 
-	ei_x_encode_pid(&buf, ei_self(ec)); /* should really be a valid group leader */
+	ei_x_encode_pid(&buf, ei_self(ec));	/* should really be a valid group leader */
 
 #ifdef EI_DEBUG
 	ei_x_print_reg_msg(&buf, "net_kernel", 1);
@@ -191,11 +192,11 @@
 #define MAX_REFERENCE    (1 << _REF_NUM_SIZE)
 
 /* function to fill in an erlang reference struct */
-void ei_init_ref(ei_cnode *ec, erlang_ref *ref)
+void ei_init_ref(ei_cnode * ec, erlang_ref * ref)
 {
-	memset(ref, 0, sizeof(*ref)); /* zero out the struct */
+	memset(ref, 0, sizeof(*ref));	/* zero out the struct */
 	snprintf(ref->node, MAXATOMLEN, "%s", ec->thisnodename);
-	
+
 	switch_mutex_lock(globals.ref_mutex);
 	globals.reference0++;
 	if (globals.reference0 >= MAX_REFERENCE) {
@@ -212,12 +213,12 @@
 
 	switch_mutex_unlock(globals.ref_mutex);
 
-	ref->creation = 1; /* why is this 1 */
-	ref->len = 3; /* why is this 3 */
+	ref->creation = 1;			/* why is this 1 */
+	ref->len = 3;				/* why is this 3 */
 }
 
 
-void ei_x_print_reg_msg(ei_x_buff *buf, char *dest, int send)
+void ei_x_print_reg_msg(ei_x_buff * buf, char *dest, int send)
 {
 	char *mbuf = NULL;
 	int i = 1;
@@ -233,7 +234,7 @@
 }
 
 
-void ei_x_print_msg(ei_x_buff *buf, erlang_pid *pid, int send)
+void ei_x_print_msg(ei_x_buff * buf, erlang_pid * pid, int send)
 {
 	char *pbuf = NULL;
 	int i = 0;
@@ -241,7 +242,7 @@
 
 	ei_x_new(&pidbuf);
 	ei_x_encode_pid(&pidbuf, pid);
-	
+
 	ei_s_print_term(&pbuf, pidbuf.buff, &i);
 
 	ei_x_print_reg_msg(buf, pbuf, send);
@@ -249,7 +250,7 @@
 }
 
 
-int ei_sendto(ei_cnode *ec, int fd, struct erlang_process *process, ei_x_buff *buf)
+int ei_sendto(ei_cnode * ec, int fd, struct erlang_process *process, ei_x_buff * buf)
 {
 	int ret;
 	if (process->type == ERLANG_PID) {
@@ -273,19 +274,16 @@
 
 
 /* convert an erlang reference to some kind of hashed string so we can store it as a hash key */
-void ei_hash_ref(erlang_ref *ref, char *output)
+void ei_hash_ref(erlang_ref * ref, char *output)
 {
 	/* very lazy */
 	sprintf(output, "%d.%d.%d@%s", ref->n[0], ref->n[1], ref->n[2], ref->node);
 }
 
 
-int ei_compare_pids(erlang_pid *pid1, erlang_pid *pid2)
+int ei_compare_pids(erlang_pid * pid1, erlang_pid * pid2)
 {
-	if ((!strcmp(pid1->node, pid2->node)) &&
-			pid1->creation == pid2->creation &&
-			pid1->num == pid2->num &&
-			pid1->serial == pid2->serial) {
+	if ((!strcmp(pid1->node, pid2->node)) && pid1->creation == pid2->creation && pid1->num == pid2->num && pid1->serial == pid2->serial) {
 		return 0;
 	} else {
 		return 1;
@@ -293,20 +291,22 @@
 }
 
 
-int ei_decode_string_or_binary(char *buf, int *index, int maxlen, char *dst) {
+int ei_decode_string_or_binary(char *buf, int *index, int maxlen, char *dst)
+{
 	int type, size, res;
 	long len;
 
 	ei_get_type(buf, index, &type, &size);
 
 	if (type != ERL_STRING_EXT && type != ERL_BINARY_EXT) {
-		return -1; 
+		return -1;
 	} else if (size > maxlen) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Requested decoding of %s with size %d into a buffer of size %d\n", type == ERL_BINARY_EXT ? "binary" : "string", size, maxlen);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Requested decoding of %s with size %d into a buffer of size %d\n",
+						  type == ERL_BINARY_EXT ? "binary" : "string", size, maxlen);
 		return -1;
 	} else if (type == ERL_BINARY_EXT) {
 		res = ei_decode_binary(buf, index, dst, &len);
-		dst[len] = '\0'; /* binaries aren't null terminated */
+		dst[len] = '\0';		/* binaries aren't null terminated */
 	} else {
 		res = ei_decode_string(buf, index, dst);
 	}
@@ -320,12 +320,12 @@
 	switch_status_t rv;
 	struct sockaddr_in server_addr;
 	struct hostent *nodehost;
-	char thishostname[EI_MAXHOSTNAMELEN+1] = "";
-	char thisnodename[MAXNODELEN+1];
+	char thishostname[EI_MAXHOSTNAMELEN + 1] = "";
+	char thisnodename[MAXNODELEN + 1];
 
 	/* zero out the struct before we use it */
 	memset(&server_addr, 0, sizeof(server_addr));
-	
+
 	/* convert the configured IP to network byte order, handing errors */
 	rv = switch_inet_pton(AF_INET, prefs.ip, &server_addr.sin_addr.s_addr);
 	if (rv == 0) {
@@ -335,18 +335,18 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error when parsing ip address %s : %s\n", prefs.ip, strerror(errno));
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	/* set the address family and port */
 	server_addr.sin_family = AF_INET;
 	server_addr.sin_port = htons(prefs.port);
-	
+
 #ifdef WIN32
-	 if ((nodehost = gethostbyaddr((const char*)&server_addr.sin_addr.s_addr, sizeof(server_addr.sin_addr.s_addr), AF_INET)))
+	if ((nodehost = gethostbyaddr((const char *) &server_addr.sin_addr.s_addr, sizeof(server_addr.sin_addr.s_addr), AF_INET)))
 #else
-	if ((nodehost = gethostbyaddr((const char*)&server_addr.sin_addr.s_addr, sizeof(server_addr.sin_addr.s_addr), AF_INET)))
+	if ((nodehost = gethostbyaddr((const char *) &server_addr.sin_addr.s_addr, sizeof(server_addr.sin_addr.s_addr), AF_INET)))
 #endif
 		memcpy(thishostname, nodehost->h_name, EI_MAXHOSTNAMELEN);
-	
+
 	if (zstr_buf(thishostname)) {
 		gethostname(thishostname, EI_MAXHOSTNAMELEN);
 	}
@@ -357,11 +357,11 @@
 			*off = '\0';
 		}
 	}
-	
-	snprintf(thisnodename, MAXNODELEN+1, "%s@%s", prefs.nodename, thishostname);
-	
+
+	snprintf(thisnodename, MAXNODELEN + 1, "%s@%s", prefs.nodename, thishostname);
+
 	/* init the ei stuff */
-	if (ei_connect_xinit(ec, thishostname, prefs.nodename, thisnodename, (Erl_IpAddr)(&server_addr.sin_addr.s_addr), prefs.cookie, 0) < 0) {
+	if (ei_connect_xinit(ec, thishostname, prefs.nodename, thisnodename, (Erl_IpAddr) (&server_addr.sin_addr.s_addr), prefs.cookie, 0) < 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to init ei connection\n");
 		return SWITCH_STATUS_FALSE;
 	}

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_erlang_event/erlang_event.conf.xml

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_erlang_event/handle_msg.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_erlang_event/handle_msg.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_erlang_event/handle_msg.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -37,7 +37,7 @@
 
 static char *MARKER = "1";
 
-static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg *msg, ei_x_buff *buf, ei_x_buff *rbuf);
+static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg * msg, ei_x_buff * buf, ei_x_buff * rbuf);
 
 static void *SWITCH_THREAD_FUNC api_exec(switch_thread_t *thread, void *obj)
 {
@@ -131,7 +131,7 @@
 		} else {
 			ei_x_encode_atom(&rbuf, "error");
 		}
-		
+
 		_ei_x_encode_string(&rbuf, reply);
 
 
@@ -163,7 +163,7 @@
 
 }
 
-static switch_status_t  handle_msg_fetch_reply(listener_t *listener, ei_x_buff *buf, ei_x_buff *rbuf)
+static switch_status_t handle_msg_fetch_reply(listener_t *listener, ei_x_buff * buf, ei_x_buff * rbuf)
 {
 	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
 	void *p;
@@ -207,26 +207,24 @@
 			ei_x_encode_atom(rbuf, "invalid_uuid");
 		}
 
-		/*switch_core_hash_insert(listener->fetch_reply_hash, uuid_str, nbuf);*/
+		/*switch_core_hash_insert(listener->fetch_reply_hash, uuid_str, nbuf); */
 		switch_safe_free(nbuf->buff);
 		switch_safe_free(nbuf);
 	}
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t handle_msg_set_log_level(listener_t *listener, int arity, ei_x_buff *buf, ei_x_buff *rbuf)
+static switch_status_t handle_msg_set_log_level(listener_t *listener, int arity, ei_x_buff * buf, ei_x_buff * rbuf)
 {
 	switch_log_level_t ltype = SWITCH_LOG_DEBUG;
 	char loglevelstr[MAXATOMLEN];
-	if (arity != 2 ||
-		ei_decode_atom(buf->buff, &buf->index, loglevelstr)) {
+	if (arity != 2 || ei_decode_atom(buf->buff, &buf->index, loglevelstr)) {
 		ei_x_encode_tuple_header(rbuf, 2);
 		ei_x_encode_atom(rbuf, "error");
 		ei_x_encode_atom(rbuf, "badarg");
-	}
-	else {
+	} else {
 		ltype = switch_log_str2level(loglevelstr);
-		
+
 		if (ltype && ltype != SWITCH_LOG_INVALID) {
 			listener->level = ltype;
 			ei_x_encode_atom(rbuf, "ok");
@@ -239,7 +237,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t handle_msg_event(listener_t *listener, int arity, ei_x_buff *buf, ei_x_buff *rbuf)
+static switch_status_t handle_msg_event(listener_t *listener, int arity, ei_x_buff * buf, ei_x_buff * rbuf)
 {
 	char atom[MAXATOMLEN];
 
@@ -247,19 +245,18 @@
 		ei_x_encode_tuple_header(rbuf, 2);
 		ei_x_encode_atom(rbuf, "error");
 		ei_x_encode_atom(rbuf, "badarg");
-	}
-	else {
+	} else {
 		int custom = 0;
 		switch_event_types_t type;
 		int i = 0;
-		
+
 		if (!switch_test_flag(listener, LFLAG_EVENTS)) {
 			switch_set_flag_locked(listener, LFLAG_EVENTS);
 		}
-		
+
 		for (i = 1; i < arity; i++) {
 			if (!ei_decode_atom(buf->buff, &buf->index, atom)) {
-				
+
 				if (custom) {
 					switch_core_hash_insert(listener->event_hash, atom, MARKER);
 				} else if (switch_name_event(atom, &type) == SWITCH_STATUS_SUCCESS) {
@@ -277,7 +274,7 @@
 					if (type == SWITCH_EVENT_CUSTOM) {
 						custom++;
 					}
-					
+
 				}
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "enable event %s\n", atom);
 			}
@@ -287,7 +284,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t handle_msg_nixevent(listener_t *listener, int arity, ei_x_buff *buf, ei_x_buff *rbuf)
+static switch_status_t handle_msg_nixevent(listener_t *listener, int arity, ei_x_buff * buf, ei_x_buff * rbuf)
 {
 	char atom[MAXATOMLEN];
 
@@ -295,20 +292,19 @@
 		ei_x_encode_tuple_header(rbuf, 2);
 		ei_x_encode_atom(rbuf, "error");
 		ei_x_encode_atom(rbuf, "badarg");
-	}
-	else {
+	} else {
 		int custom = 0;
 		int i = 0;
 		switch_event_types_t type;
-		
+
 		for (i = 1; i < arity; i++) {
 			if (!ei_decode_atom(buf->buff, &buf->index, atom)) {
-				
+
 				if (custom) {
 					switch_core_hash_delete(listener->event_hash, atom);
 				} else if (switch_name_event(atom, &type) == SWITCH_STATUS_SUCCESS) {
 					uint32_t x = 0;
-					
+
 					if (type == SWITCH_EVENT_CUSTOM) {
 						custom++;
 					} else if (type == SWITCH_EVENT_ALL) {
@@ -332,19 +328,16 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t handle_msg_api(listener_t *listener, erlang_msg *msg, int arity, ei_x_buff *buf, ei_x_buff *rbuf)
+static switch_status_t handle_msg_api(listener_t *listener, erlang_msg * msg, int arity, ei_x_buff * buf, ei_x_buff * rbuf)
 {
 	char api_cmd[MAXATOMLEN];
 	char arg[1024];
-	if (arity < 3 ||
-		ei_decode_atom(buf->buff, &buf->index, api_cmd) ||
-		ei_decode_string(buf->buff, &buf->index, arg)) {
+	if (arity < 3 || ei_decode_atom(buf->buff, &buf->index, api_cmd) || ei_decode_string(buf->buff, &buf->index, arg)) {
 		ei_x_encode_tuple_header(rbuf, 2);
 		ei_x_encode_atom(rbuf, "error");
 		ei_x_encode_atom(rbuf, "badarg");
 		return SWITCH_STATUS_SUCCESS;
-	}
-	else {
+	} else {
 		struct api_command_struct acs = { 0 };
 		acs.listener = listener;
 		acs.api_cmd = api_cmd;
@@ -357,24 +350,21 @@
 	}
 }
 
-static switch_status_t handle_msg_bgapi(listener_t *listener, erlang_msg *msg, int arity, ei_x_buff *buf, ei_x_buff *rbuf)
+static switch_status_t handle_msg_bgapi(listener_t *listener, erlang_msg * msg, int arity, ei_x_buff * buf, ei_x_buff * rbuf)
 {
 	char api_cmd[MAXATOMLEN];
 	char arg[1024];
-	if (arity < 3 ||
-		ei_decode_atom(buf->buff, &buf->index, api_cmd) ||
-		ei_decode_string(buf->buff, &buf->index, arg)) {
+	if (arity < 3 || ei_decode_atom(buf->buff, &buf->index, api_cmd) || ei_decode_string(buf->buff, &buf->index, arg)) {
 		ei_x_encode_tuple_header(rbuf, 2);
 		ei_x_encode_atom(rbuf, "error");
 		ei_x_encode_atom(rbuf, "badarg");
-	}
-	else {
+	} else {
 		struct api_command_struct *acs = NULL;
 		switch_memory_pool_t *pool;
 		switch_thread_t *thread;
 		switch_threadattr_t *thd_attr = NULL;
 		switch_uuid_t uuid;
-		
+
 		switch_core_new_memory_pool(&pool);
 		acs = switch_core_alloc(pool, sizeof(*acs));
 		switch_assert(acs);
@@ -384,15 +374,15 @@
 		acs->arg = switch_core_strdup(acs->pool, arg);
 		acs->bg = 1;
 		acs->pid = msg->from;
-		
+
 		switch_threadattr_create(&thd_attr, acs->pool);
 		switch_threadattr_detach_set(thd_attr, 1);
 		switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
-		
+
 		switch_uuid_get(&uuid);
 		switch_uuid_format(acs->uuid_str, &uuid);
 		switch_thread_create(&thread, thd_attr, api_exec, acs, acs->pool);
-		
+
 		ei_x_encode_tuple_header(rbuf, 2);
 		ei_x_encode_atom(rbuf, "ok");
 		_ei_x_encode_string(rbuf, acs->uuid_str);
@@ -400,18 +390,17 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t handle_msg_sendevent(listener_t *listener, int arity, ei_x_buff *buf, ei_x_buff *rbuf)
+static switch_status_t handle_msg_sendevent(listener_t *listener, int arity, ei_x_buff * buf, ei_x_buff * rbuf)
 {
-	char ename[MAXATOMLEN+1];
-	char esname[MAXATOMLEN+1];
+	char ename[MAXATOMLEN + 1];
+	char esname[MAXATOMLEN + 1];
 	int headerlength;
 
 	memset(esname, 0, MAXATOMLEN);
-	
+
 	if (ei_decode_atom(buf->buff, &buf->index, ename) ||
 		(!strncasecmp(ename, "CUSTOM", MAXATOMLEN) &&
-		 ei_decode_atom(buf->buff, &buf->index, esname)) ||
-		ei_decode_list_header(buf->buff, &buf->index, &headerlength)) {
+		 ei_decode_atom(buf->buff, &buf->index, esname)) || ei_decode_list_header(buf->buff, &buf->index, &headerlength)) {
 		ei_x_encode_tuple_header(rbuf, 2);
 		ei_x_encode_atom(rbuf, "error");
 		ei_x_encode_atom(rbuf, "badarg");
@@ -420,29 +409,27 @@
 		if (switch_name_event(ename, &etype) == SWITCH_STATUS_SUCCESS) {
 			switch_event_t *event;
 			if ((strlen(esname) && switch_event_create_subclass(&event, etype, esname) == SWITCH_STATUS_SUCCESS) ||
-					switch_event_create(&event, etype) == SWITCH_STATUS_SUCCESS) {
+				switch_event_create(&event, etype) == SWITCH_STATUS_SUCCESS) {
 				char key[1024];
 				char value[1024];
 				int i = 0;
 				switch_bool_t fail = SWITCH_FALSE;
 
-				while(!ei_decode_tuple_header(buf->buff, &buf->index, &arity) && arity == 2) {
+				while (!ei_decode_tuple_header(buf->buff, &buf->index, &arity) && arity == 2) {
 					i++;
-					if (ei_decode_string(buf->buff, &buf->index, key) ||
-						ei_decode_string(buf->buff, &buf->index, value)) {
+					if (ei_decode_string(buf->buff, &buf->index, key) || ei_decode_string(buf->buff, &buf->index, value)) {
 						fail = SWITCH_TRUE;
 						break;
 					}
-					
+
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, key, value);
 				}
-				
+
 				if (headerlength != i || fail) {
 					ei_x_encode_tuple_header(rbuf, 2);
 					ei_x_encode_atom(rbuf, "error");
 					ei_x_encode_atom(rbuf, "badarg");
-				}
-				else {
+				} else {
 					switch_event_fire(&event);
 					ei_x_encode_atom(rbuf, "ok");
 				}
@@ -452,51 +439,48 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t handle_msg_sendmsg(listener_t *listener, int arity, ei_x_buff *buf, ei_x_buff *rbuf)
+static switch_status_t handle_msg_sendmsg(listener_t *listener, int arity, ei_x_buff * buf, ei_x_buff * rbuf)
 {
 	char uuid[SWITCH_UUID_FORMATTED_LENGTH + 1];
 	int headerlength;
-			
+
 	if (ei_decode_string_or_binary(buf->buff, &buf->index, SWITCH_UUID_FORMATTED_LENGTH, uuid) ||
 		ei_decode_list_header(buf->buff, &buf->index, &headerlength)) {
 		ei_x_encode_tuple_header(rbuf, 2);
 		ei_x_encode_atom(rbuf, "error");
 		ei_x_encode_atom(rbuf, "badarg");
-	}
-	else {
+	} else {
 		switch_core_session_t *session;
 		if (!zstr_buf(uuid) && (session = switch_core_session_locate(uuid))) {
-			switch_event_t *event;	  
+			switch_event_t *event;
 			if (switch_event_create(&event, SWITCH_EVENT_SEND_MESSAGE) == SWITCH_STATUS_SUCCESS) {
-				
+
 				char key[1024];
 				char value[1024];
 				int i = 0;
 				switch_bool_t fail = SWITCH_FALSE;
-				while(!ei_decode_tuple_header(buf->buff, &buf->index, &arity) && arity == 2) {
+				while (!ei_decode_tuple_header(buf->buff, &buf->index, &arity) && arity == 2) {
 					i++;
-					if (ei_decode_string(buf->buff, &buf->index, key) ||
-						ei_decode_string(buf->buff, &buf->index, value)) {
+					if (ei_decode_string(buf->buff, &buf->index, key) || ei_decode_string(buf->buff, &buf->index, value)) {
 						fail = SWITCH_TRUE;
 						break;
-					}					
+					}
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, key, value);
 				}
-				
+
 				if (headerlength != i || fail) {
 					ei_x_encode_tuple_header(rbuf, 2);
 					ei_x_encode_atom(rbuf, "error");
 					ei_x_encode_atom(rbuf, "badarg");
-				}
-				else {
-					if (switch_core_session_queue_private_event(session, &event) == SWITCH_STATUS_SUCCESS) {
+				} else {
+					if (switch_core_session_queue_private_event(session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
 						ei_x_encode_atom(rbuf, "ok");
 					} else {
 						ei_x_encode_tuple_header(rbuf, 2);
 						ei_x_encode_atom(rbuf, "error");
 						ei_x_encode_atom(rbuf, "badmem");
 					}
-					
+
 				}
 			}
 			/* release the lock returned by session locate */
@@ -511,19 +495,17 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t handle_msg_bind(listener_t *listener, erlang_msg *msg, ei_x_buff *buf, ei_x_buff *rbuf)
+static switch_status_t handle_msg_bind(listener_t *listener, erlang_msg * msg, ei_x_buff * buf, ei_x_buff * rbuf)
 {
 	/* format is (result|config|directory|dialplan|phrases)  */
 	char sectionstr[MAXATOMLEN];
 	switch_xml_section_t section;
 
-	if (ei_decode_atom(buf->buff, &buf->index, sectionstr) ||
-		!(section = switch_xml_parse_section_string(sectionstr))) {
+	if (ei_decode_atom(buf->buff, &buf->index, sectionstr) || !(section = switch_xml_parse_section_string(sectionstr))) {
 		ei_x_encode_tuple_header(rbuf, 2);
 		ei_x_encode_atom(rbuf, "error");
 		ei_x_encode_atom(rbuf, "badarg");
-	}
-	else {
+	} else {
 		struct erlang_binding *binding, *ptr;
 
 		if (!(binding = switch_core_alloc(listener->pool, sizeof(*binding)))) {
@@ -531,8 +513,7 @@
 			ei_x_encode_tuple_header(rbuf, 2);
 			ei_x_encode_atom(rbuf, "error");
 			ei_x_encode_atom(rbuf, "badmem");
-		}
-		else {
+		} else {
 			binding->section = section;
 			binding->process.type = ERLANG_PID;
 			binding->process.pid = msg->from;
@@ -547,7 +528,7 @@
 			} else {
 				bindings.head = binding;
 			}
-			
+
 			switch_xml_set_binding_sections(bindings.search_binding, switch_xml_get_binding_sections(bindings.search_binding) | section);
 			switch_mutex_unlock(globals.listener_mutex);
 
@@ -564,13 +545,13 @@
    or
    {handlecall,<uuid>} to send messages back to the sender
  */
-static switch_status_t handle_msg_handlecall(listener_t *listener, erlang_msg *msg, int arity, ei_x_buff *buf, ei_x_buff *rbuf)
+static switch_status_t handle_msg_handlecall(listener_t *listener, erlang_msg * msg, int arity, ei_x_buff * buf, ei_x_buff * rbuf)
 {
 	char reg_name[MAXATOMLEN];
 	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
 
 	if (arity < 2 || arity > 3 ||
-		(arity==3 && ei_decode_atom(buf->buff, &buf->index, reg_name)) ||
+		(arity == 3 && ei_decode_atom(buf->buff, &buf->index, reg_name)) ||
 		ei_decode_string_or_binary(buf->buff, &buf->index, SWITCH_UUID_FORMATTED_LENGTH, uuid_str)) {
 		ei_x_encode_tuple_header(rbuf, 2);
 		ei_x_encode_atom(rbuf, "error");
@@ -580,8 +561,8 @@
 		if (!zstr_buf(uuid_str)) {
 			if ((session = switch_core_session_locate(uuid_str))) {
 				/* create a new session list element and attach it to this listener */
-				if ((arity==2 && attach_call_to_pid(listener, &msg->from, session)) ||
-						(arity==3 && attach_call_to_registered_process(listener, reg_name, session))) {
+				if ((arity == 2 && attach_call_to_pid(listener, &msg->from, session)) ||
+					(arity == 3 && attach_call_to_registered_process(listener, reg_name, session))) {
 					ei_x_encode_atom(rbuf, "ok");
 				} else {
 					ei_x_encode_tuple_header(rbuf, 2);
@@ -607,17 +588,17 @@
 /* catch the response to ei_rpc_to (which comes back as {rex, {Ref, Pid}}
    The {Ref,Pid} bit can be handled by handle_ref_tuple
  */
-static switch_status_t handle_msg_rpcresponse(listener_t *listener, erlang_msg *msg, int arity, ei_x_buff *buf, ei_x_buff *rbuf)
+static switch_status_t handle_msg_rpcresponse(listener_t *listener, erlang_msg * msg, int arity, ei_x_buff * buf, ei_x_buff * rbuf)
 {
 	int type, size, arity2, tmpindex;
 
 	ei_get_type(buf->buff, &buf->index, &type, &size);
-	switch(type) {
-	case ERL_SMALL_TUPLE_EXT :
-	case ERL_LARGE_TUPLE_EXT :
+	switch (type) {
+	case ERL_SMALL_TUPLE_EXT:
+	case ERL_LARGE_TUPLE_EXT:
 		tmpindex = buf->index;
 		ei_decode_tuple_header(buf->buff, &tmpindex, &arity2);
-		return handle_ref_tuple(listener,msg,buf,rbuf);
+		return handle_ref_tuple(listener, msg, buf, rbuf);
 	default:
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Unknown rpc response\n");
 		break;
@@ -626,7 +607,7 @@
 	return SWITCH_STATUS_FALSE;
 }
 
-static switch_status_t handle_msg_tuple(listener_t *listener, erlang_msg *msg, ei_x_buff *buf, ei_x_buff *rbuf)
+static switch_status_t handle_msg_tuple(listener_t *listener, erlang_msg * msg, ei_x_buff * buf, ei_x_buff * rbuf)
 {
 	char tupletag[MAXATOMLEN];
 	int arity;
@@ -637,30 +618,29 @@
 		ei_x_encode_tuple_header(rbuf, 2);
 		ei_x_encode_atom(rbuf, "error");
 		ei_x_encode_atom(rbuf, "badarg");
-	}
-	else {
+	} else {
 		if (!strncmp(tupletag, "fetch_reply", MAXATOMLEN)) {
-			ret = handle_msg_fetch_reply(listener,buf,rbuf);
+			ret = handle_msg_fetch_reply(listener, buf, rbuf);
 		} else if (!strncmp(tupletag, "set_log_level", MAXATOMLEN)) {
-			ret = handle_msg_set_log_level(listener,arity,buf,rbuf);
+			ret = handle_msg_set_log_level(listener, arity, buf, rbuf);
 		} else if (!strncmp(tupletag, "event", MAXATOMLEN)) {
-			ret = handle_msg_event(listener,arity,buf,rbuf);
+			ret = handle_msg_event(listener, arity, buf, rbuf);
 		} else if (!strncmp(tupletag, "nixevent", MAXATOMLEN)) {
-			ret = handle_msg_nixevent(listener,arity,buf,rbuf);
+			ret = handle_msg_nixevent(listener, arity, buf, rbuf);
 		} else if (!strncmp(tupletag, "api", MAXATOMLEN)) {
-			ret = handle_msg_api(listener,msg,arity,buf,rbuf);
+			ret = handle_msg_api(listener, msg, arity, buf, rbuf);
 		} else if (!strncmp(tupletag, "bgapi", MAXATOMLEN)) {
-			ret = handle_msg_bgapi(listener,msg,arity,buf,rbuf);
+			ret = handle_msg_bgapi(listener, msg, arity, buf, rbuf);
 		} else if (!strncmp(tupletag, "sendevent", MAXATOMLEN)) {
-			ret = handle_msg_sendevent(listener,arity,buf,rbuf);
+			ret = handle_msg_sendevent(listener, arity, buf, rbuf);
 		} else if (!strncmp(tupletag, "sendmsg", MAXATOMLEN)) {
-			ret = handle_msg_sendmsg(listener,arity,buf,rbuf);
+			ret = handle_msg_sendmsg(listener, arity, buf, rbuf);
 		} else if (!strncmp(tupletag, "bind", MAXATOMLEN)) {
-			ret = handle_msg_bind(listener,msg,buf,rbuf);
+			ret = handle_msg_bind(listener, msg, buf, rbuf);
 		} else if (!strncmp(tupletag, "handlecall", MAXATOMLEN)) {
-			ret = handle_msg_handlecall(listener,msg,arity,buf,rbuf);
+			ret = handle_msg_handlecall(listener, msg, arity, buf, rbuf);
 		} else if (!strncmp(tupletag, "rex", MAXATOMLEN)) {
-			ret = handle_msg_rpcresponse(listener,msg,arity,buf,rbuf);
+			ret = handle_msg_rpcresponse(listener, msg, arity, buf, rbuf);
 		} else {
 			ei_x_encode_tuple_header(rbuf, 2);
 			ei_x_encode_atom(rbuf, "error");
@@ -670,7 +650,7 @@
 	return ret;
 }
 
-static switch_status_t  handle_msg_atom(listener_t *listener, erlang_msg *msg, ei_x_buff *buf, ei_x_buff *rbuf)
+static switch_status_t handle_msg_atom(listener_t *listener, erlang_msg * msg, ei_x_buff * buf, ei_x_buff * rbuf)
 {
 	char atom[MAXATOMLEN];
 	switch_status_t ret = SWITCH_STATUS_SUCCESS;
@@ -679,8 +659,7 @@
 		ei_x_encode_tuple_header(rbuf, 2);
 		ei_x_encode_atom(rbuf, "error");
 		ei_x_encode_atom(rbuf, "badarg");
-	}
-	else if (!strncmp(atom, "nolog", MAXATOMLEN)) {
+	} else if (!strncmp(atom, "nolog", MAXATOMLEN)) {
 		if (switch_test_flag(listener, LFLAG_LOG)) {
 			void *pop;
 			/*purge the log queue */
@@ -707,7 +686,7 @@
 		void *pop;
 		/*purge the event queue */
 		while (switch_queue_trypop(listener->event_queue, &pop) == SWITCH_STATUS_SUCCESS);
-		
+
 		if (switch_test_flag(listener, LFLAG_EVENTS)) {
 			uint8_t x = 0;
 			switch_clear_flag_locked(listener, LFLAG_EVENTS);
@@ -739,12 +718,12 @@
 		ei_x_encode_atom(rbuf, "error");
 		ei_x_encode_atom(rbuf, "undef");
 	}
-	
+
 	return ret;
 }
 
 
-static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg *msg, ei_x_buff *buf, ei_x_buff *rbuf)
+static switch_status_t handle_ref_tuple(listener_t *listener, erlang_msg * msg, ei_x_buff * buf, ei_x_buff * rbuf)
 {
 	erlang_ref ref;
 	erlang_pid *pid;
@@ -765,17 +744,17 @@
 		ei_x_encode_atom(rbuf, "error");
 		ei_x_encode_atom(rbuf, "badmem");
 		return SWITCH_STATUS_SUCCESS;
-	}
+	}
 
 	if (ei_decode_pid(buf->buff, &buf->index, pid)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid pid in a reference/pid tuple\n");
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	ei_hash_ref(&ref, hash);
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Hashed ref to %s\n", hash);
-	
+
 	if ((p = switch_core_hash_find(listener->spawn_pid_hash, hash))) {
 		if (p == &globals.TIMEOUT) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Handler for %s timed out\n", hash);
@@ -788,7 +767,7 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found waiting slot for %s\n", hash);
 			switch_core_hash_delete(listener->spawn_pid_hash, hash);
 			switch_core_hash_insert(listener->spawn_pid_hash, hash, pid);
-			return SWITCH_STATUS_FALSE; /*no reply */
+			return SWITCH_STATUS_FALSE;	/*no reply */
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found filled slot for %s\n", hash);
 			ei_x_encode_tuple_header(rbuf, 2);
@@ -803,7 +782,7 @@
 		ei_x_encode_atom(rbuf, "invalid_ref");
 	}
 
-	switch_safe_free(pid); /* don't need it */
+	switch_safe_free(pid);		/* don't need it */
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -811,7 +790,7 @@
 
 /* fake enough of the net_kernel module to be able to respond to net_adm:ping */
 /* {'$gen_call', {<cpx@freecpx.128.0>, #Ref<254770.4.0>}, {is_auth, cpx@freecpx} */
-static switch_status_t handle_net_kernel_msg(listener_t *listener, erlang_msg *msg, ei_x_buff *buf, ei_x_buff *rbuf)
+static switch_status_t handle_net_kernel_msg(listener_t *listener, erlang_msg * msg, ei_x_buff * buf, ei_x_buff * rbuf)
 {
 	int version, size, type, arity;
 	char atom[MAXATOMLEN];
@@ -881,7 +860,7 @@
 	ei_x_encode_tuple_header(rbuf, 2);
 	ei_x_encode_ref(rbuf, &ref);
 	ei_x_encode_atom(rbuf, "yes");
-	
+
 	switch_mutex_lock(listener->sock_mutex);
 	ei_send(listener->sockfd, &pid, rbuf->buff, rbuf->index);
 	switch_mutex_unlock(listener->sock_mutex);
@@ -893,7 +872,7 @@
 }
 
 
-int handle_msg(listener_t *listener, erlang_msg *msg, ei_x_buff *buf, ei_x_buff *rbuf)
+int handle_msg(listener_t *listener, erlang_msg * msg, ei_x_buff * buf, ei_x_buff * rbuf)
 {
 	int type, type2, size, version, arity, tmpindex;
 	switch_status_t ret = SWITCH_STATUS_SUCCESS;
@@ -905,37 +884,37 @@
 		buf->index = 0;
 		ei_decode_version(buf->buff, &buf->index, &version);
 		ei_get_type(buf->buff, &buf->index, &type, &size);
-		switch(type) {
-		case ERL_SMALL_TUPLE_EXT :
-		case ERL_LARGE_TUPLE_EXT :
+		switch (type) {
+		case ERL_SMALL_TUPLE_EXT:
+		case ERL_LARGE_TUPLE_EXT:
 			tmpindex = buf->index;
 			ei_decode_tuple_header(buf->buff, &tmpindex, &arity);
 			ei_get_type(buf->buff, &tmpindex, &type2, &size);
 
-			switch(type2) {
-				case ERL_ATOM_EXT:
-					ret = handle_msg_tuple(listener,msg,buf,rbuf);
-					break;
-				case ERL_REFERENCE_EXT :
-				case ERL_NEW_REFERENCE_EXT :
-					ret = handle_ref_tuple(listener, msg, buf, rbuf);
-					break;
-				default :
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "WEEEEEEEE %d %d\n", type, type2);
-					/* some other kind of erlang term */
-					ei_x_encode_tuple_header(rbuf, 2);
-					ei_x_encode_atom(rbuf, "error");
-					ei_x_encode_atom(rbuf, "undef");
-					break;
+			switch (type2) {
+			case ERL_ATOM_EXT:
+				ret = handle_msg_tuple(listener, msg, buf, rbuf);
+				break;
+			case ERL_REFERENCE_EXT:
+			case ERL_NEW_REFERENCE_EXT:
+				ret = handle_ref_tuple(listener, msg, buf, rbuf);
+				break;
+			default:
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "WEEEEEEEE %d %d\n", type, type2);
+				/* some other kind of erlang term */
+				ei_x_encode_tuple_header(rbuf, 2);
+				ei_x_encode_atom(rbuf, "error");
+				ei_x_encode_atom(rbuf, "undef");
+				break;
 			}
-			
+
 			break;
-							
-		case ERL_ATOM_EXT :
-			ret = handle_msg_atom(listener,msg,buf,rbuf);
+
+		case ERL_ATOM_EXT:
+			ret = handle_msg_atom(listener, msg, buf, rbuf);
 			break;
 
-		default :
+		default:
 			/* some other kind of erlang term */
 			ei_x_encode_tuple_header(rbuf, 2);
 			ei_x_encode_atom(rbuf, "error");
@@ -944,7 +923,7 @@
 		}
 	}
 
-	if (SWITCH_STATUS_FALSE==ret) {
+	if (SWITCH_STATUS_FALSE == ret) {
 		return 0;
 	} else if (rbuf->index > 1) {
 		switch_mutex_lock(listener->sock_mutex);
@@ -954,9 +933,9 @@
 		ei_x_print_msg(rbuf, &msg->from, 1);
 #endif
 
-		if (SWITCH_STATUS_SUCCESS==ret)
+		if (SWITCH_STATUS_SUCCESS == ret)
 			return 0;
-		else /* SWITCH_STATUS_TERM */
+		else					/* SWITCH_STATUS_TERM */
 			return 1;
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Empty reply, supressing\n");

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -59,7 +59,7 @@
 	for (l = listen_list.listeners; l; l = l->next) {
 		if (switch_test_flag(l, LFLAG_LOG) && l->level >= node->level) {
 
-			 switch_log_node_t *dnode = switch_log_node_dup(node); 
+			switch_log_node_t *dnode = switch_log_node_dup(node);
 
 			if (switch_queue_trypush(l->log_queue, dnode) == SWITCH_STATUS_SUCCESS) {
 				if (l->lost_logs) {
@@ -84,14 +84,14 @@
 }
 
 
-static void expire_listener(listener_t **listener)
+static void expire_listener(listener_t ** listener)
 {
 	void *pop;
-	
+
 	switch_thread_rwlock_unlock((*listener)->rwlock);
 	switch_core_hash_destroy(&(*listener)->event_hash);
 	switch_core_destroy_memory_pool(&(*listener)->pool);
-	
+
 	while (switch_queue_trypop((*listener)->event_queue, &pop) == SWITCH_STATUS_SUCCESS) {
 		switch_event_t *pevent = (switch_event_t *) pop;
 		switch_event_destroy(&pevent);
@@ -101,7 +101,8 @@
 }
 
 
-static void remove_binding(listener_t *listener, erlang_pid *pid) {
+static void remove_binding(listener_t *listener, erlang_pid * pid)
+{
 	struct erlang_binding *ptr, *lst = NULL;
 
 	switch_mutex_lock(globals.listener_mutex);
@@ -109,8 +110,7 @@
 	switch_xml_set_binding_sections(bindings.search_binding, SWITCH_XML_SECTION_MAX);
 
 	for (ptr = bindings.head; ptr; lst = ptr, ptr = ptr->next) {
-		if ((listener && ptr->listener == listener) ||
-			(pid && (ptr->process.type == ERLANG_PID) && !ei_compare_pids(&ptr->process.pid, pid)))  {
+		if ((listener && ptr->listener == listener) || (pid && (ptr->process.type == ERLANG_PID) && !ei_compare_pids(&ptr->process.pid, pid))) {
 			if (bindings.head == ptr) {
 				if (ptr->next) {
 					bindings.head = ptr->next;
@@ -136,11 +136,11 @@
 }
 
 
-static void send_event_to_attached_sessions(listener_t* listener, switch_event_t *event)
+static void send_event_to_attached_sessions(listener_t *listener, switch_event_t *event)
 {
 	char *uuid = switch_event_get_header(event, "unique-id");
 	switch_event_t *clone = NULL;
-	session_elem_t* s;
+	session_elem_t *s;
 
 	if (!uuid)
 		return;
@@ -148,7 +148,8 @@
 	for (s = listener->session_list; s; s = s->next) {
 		/* check the event uuid against the uuid of each session */
 		if (!strcmp(uuid, s->uuid_str)) {
-			switch_log_printf(SWITCH_CHANNEL_UUID_LOG(s->uuid_str), SWITCH_LOG_DEBUG, "Sending event %s to attached session for %s\n", switch_event_name(event->event_id), s->uuid_str);
+			switch_log_printf(SWITCH_CHANNEL_UUID_LOG(s->uuid_str), SWITCH_LOG_DEBUG, "Sending event %s to attached session for %s\n",
+							  switch_event_name(event->event_id), s->uuid_str);
 			if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) {
 				/* add the event to the queue for this session */
 				if (switch_queue_trypush(s->event_queue, clone) != SWITCH_STATUS_SUCCESS) {
@@ -177,9 +178,9 @@
 	lp = listen_list.listeners;
 
 	switch_mutex_lock(globals.listener_mutex);
-	while(lp) {
+	while (lp) {
 		uint8_t send = 0;
-		
+
 		l = lp;
 		lp = lp->next;
 
@@ -187,7 +188,7 @@
 		   one of them should receive the event as well
 		 */
 
-		send_event_to_attached_sessions(l,event);
+		send_event_to_attached_sessions(l, event);
 
 		if (!switch_test_flag(l, LFLAG_EVENTS)) {
 			continue;
@@ -208,7 +209,7 @@
 			}
 		}
 
-		
+
 		if (send) {
 			if (switch_event_dup(&clone, event) == SWITCH_STATUS_SUCCESS) {
 				if (switch_queue_trypush(l->event_queue, clone) == SWITCH_STATUS_SUCCESS) {
@@ -237,7 +238,7 @@
 
 
 #ifdef WIN32
-static void close_socket(SOCKET *sock)
+static void close_socket(SOCKET * sock)
 #else
 static void close_socket(int *sock)
 #endif
@@ -286,7 +287,7 @@
 }
 
 /* Search for a listener already talking to the specified node */
-static listener_t * find_listener(char* nodename)
+static listener_t *find_listener(char *nodename)
 {
 	listener_t *l = NULL;
 
@@ -313,13 +314,14 @@
 static void remove_session_elem_from_listener(listener_t *listener, session_elem_t *session_element)
 {
 	session_elem_t *s, *last = NULL;
-	
+
 	if (!session_element)
 		return;
 
-	for(s = listener->session_list; s; s = s->next) {
+	for (s = listener->session_list; s; s = s->next) {
 		if (s == session_element) {
-			switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_element->uuid_str), SWITCH_LOG_DEBUG, "Removing session element for %s\n", session_element->uuid_str);
+			switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_element->uuid_str), SWITCH_LOG_DEBUG, "Removing session element for %s\n",
+							  session_element->uuid_str);
 			if (last) {
 				last->next = s->next;
 			} else {
@@ -342,17 +344,18 @@
 	/* this allows the application threads to exit */
 	switch_clear_flag_locked(session_element, LFLAG_SESSION_ALIVE);
 	switch_core_destroy_memory_pool(&session_element->pool);
-	/*switch_safe_free(s);*/
+	/*switch_safe_free(s); */
 }
 
-static void remove_session_elem_from_listener_locked(listener_t *listener, session_elem_t *session_element) {
+static void remove_session_elem_from_listener_locked(listener_t *listener, session_elem_t *session_element)
+{
 	switch_mutex_lock(listener->session_mutex);
 	remove_session_elem_from_listener(listener, session_element);
 	switch_mutex_unlock(listener->session_mutex);
 }
 
 
-session_elem_t * find_session_elem_by_pid(listener_t *listener, erlang_pid *pid)
+session_elem_t *find_session_elem_by_pid(listener_t *listener, erlang_pid * pid)
 {
 	session_elem_t *s = NULL;
 
@@ -369,9 +372,9 @@
 
 
 static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, const char *key_name, const char *key_value,
-								switch_event_t *params, void *user_data)
+								 switch_event_t *params, void *user_data)
 {
-	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1];
+	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
 	int type, size;
 	int i = 0;
 	void *p = NULL;
@@ -388,7 +391,7 @@
 
 	section = switch_xml_parse_section_string((char *) sectionstr);
 
-	for (ptr = bindings.head; ptr && ptr->section != section; ptr = ptr->next); /* just get the first match */
+	for (ptr = bindings.head; ptr && ptr->section != section; ptr = ptr->next);	/* just get the first match */
 
 	if (!ptr) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "no binding for %s\n", sectionstr);
@@ -397,15 +400,16 @@
 
 	if (!ptr->listener) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NULL pointer binding!\n");
-		return NULL; /* our pointer is trash */
+		return NULL;			/* our pointer is trash */
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "binding for %s in section %s with key %s and value %s requested from node %s\n", tag_name, sectionstr, key_name, key_value, ptr->process.pid.node);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "binding for %s in section %s with key %s and value %s requested from node %s\n", tag_name,
+					  sectionstr, key_name, key_value, ptr->process.pid.node);
 
 	switch_uuid_get(&uuid);
 	switch_uuid_format(uuid_str, &uuid);
 
-	/*switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "Request-ID", uuid_str);*/
+	/*switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "Request-ID", uuid_str); */
 
 	ei_x_encode_tuple_header(&buf, 7);
 	ei_x_encode_atom(&buf, "fetch");
@@ -414,7 +418,11 @@
 	_ei_x_encode_string(&buf, key_name ? key_name : "undefined");
 	_ei_x_encode_string(&buf, key_value ? key_value : "undefined");
 	_ei_x_encode_string(&buf, uuid_str);
-	ei_encode_switch_event_headers(&buf, params);
+	if (params) {
+		ei_encode_switch_event_headers(&buf, params);
+	} else {
+		ei_x_encode_empty_list(&buf);
+	}
 
 	switch_core_hash_insert(ptr->listener->fetch_reply_hash, uuid_str, &globals.WAITING);
 
@@ -423,25 +431,26 @@
 	switch_mutex_unlock(ptr->listener->sock_mutex);
 
 	while (!(p = switch_core_hash_find(ptr->listener->fetch_reply_hash, uuid_str)) || p == &globals.WAITING) {
-		if (i > 50) { /* half a second timeout */
+		if (i > 50) {			/* half a second timeout */
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Timed out when waiting for XML fetch response\n");
-			switch_core_hash_insert(ptr->listener->fetch_reply_hash, uuid_str, &globals.TIMEOUT); /* TODO lock this? */
+			switch_core_hash_insert(ptr->listener->fetch_reply_hash, uuid_str, &globals.TIMEOUT);	/* TODO lock this? */
 			return NULL;
 		}
 		i++;
-		switch_yield(10000); /* 10ms */
+		switch_yield(10000);	/* 10ms */
 	}
 
 	rep = (ei_x_buff *) p;
 
 	ei_get_type(rep->buff, &rep->index, &type, &size);
 
-	if (type != ERL_STRING_EXT && type != ERL_BINARY_EXT) { /* XXX no unicode or character codes > 255 */
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "XML fetch response contained non ASCII characters? (was type %d of size %d)\n", type, size);
+	if (type != ERL_STRING_EXT && type != ERL_BINARY_EXT) {	/* XXX no unicode or character codes > 255 */
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "XML fetch response contained non ASCII characters? (was type %d of size %d)\n", type,
+						  size);
 		return NULL;
 	}
 
-	
+
 	if (!(xmlstr = malloc(size + 1))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error\n");
 		return NULL;
@@ -449,7 +458,7 @@
 
 	ei_decode_string_or_binary(rep->buff, &rep->index, size, xmlstr);
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got data %s after %d milliseconds!\n", xmlstr, i*10);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got data %s after %d milliseconds!\n", xmlstr, i * 10);
 
 	if (zstr(xmlstr)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Result\n");
@@ -472,14 +481,14 @@
 {
 	int result;
 	switch_core_session_t *session;
-	switch_event_t *call_event=NULL;
-	switch_channel_t *channel=NULL;
+	switch_event_t *call_event = NULL;
+	switch_channel_t *channel = NULL;
 	ei_x_buff lbuf;
 
 	/* Send a message to the associated registered process to let it know there is a call.
 	   Message is a tuple of the form {call, <call-event>}
-	*/
-	
+	 */
+
 	if (switch_event_create(&call_event, SWITCH_EVENT_CHANNEL_DATA) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_element->uuid_str), SWITCH_LOG_CRIT, "Memory Error!\n");
 		return SWITCH_STATUS_MEMERR;
@@ -497,49 +506,57 @@
 	switch_core_session_rwunlock(session);
 	switch_event_add_header_string(call_event, SWITCH_STACK_BOTTOM, "Content-Type", "command/reply");
 	switch_event_add_header_string(call_event, SWITCH_STACK_BOTTOM, "Reply-Text", "+OK\n");
-	
+
 	ei_x_new_with_version(&lbuf);
 	ei_x_encode_tuple_header(&lbuf, 2);
 	ei_x_encode_atom(&lbuf, "call");
 	ei_encode_switch_event(&lbuf, call_event);
 	switch_mutex_lock(listener->sock_mutex);
-	switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_element->uuid_str), SWITCH_LOG_DEBUG, "Sending initial call event for %s\n", session_element->uuid_str);
+	switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_element->uuid_str), SWITCH_LOG_DEBUG, "Sending initial call event for %s\n",
+					  session_element->uuid_str);
 	result = ei_sendto(listener->ec, listener->sockfd, &session_element->process, &lbuf);
 
 	switch_mutex_unlock(listener->sock_mutex);
 
 	if (result) {
-		switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_element->uuid_str), SWITCH_LOG_ERROR, "Failed to send call event for %s\n", session_element->uuid_str);
+		switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_element->uuid_str), SWITCH_LOG_ERROR, "Failed to send call event for %s\n",
+						  session_element->uuid_str);
 	}
-	
+
 	ei_x_free(&lbuf);
 	return SWITCH_STATUS_SUCCESS;
 }
 
 static switch_status_t check_attached_sessions(listener_t *listener)
 {
-	session_elem_t *last,*sp, *removed;
+	session_elem_t *last, *sp, *removed;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	void *pop;
 	/* check up on all the attached sessions -
 	   if they have not yet sent an initial call event to the associated erlang process then do so
 	   if they have pending events in their queues then send them
 	   if the session has finished then clean it up
-	*/
+	 */
 	switch_mutex_lock(listener->session_mutex);
 	sp = listener->session_list;
 	last = NULL;
-	while(sp) {
+	while (sp) {
 		removed = NULL;
 		if (switch_test_flag(sp, LFLAG_WAITING_FOR_PID)) {
-			break;
+			sp = sp->next;
+			continue;
 		}
 
 		if (!switch_test_flag(sp, LFLAG_OUTBOUND_INIT)) {
 			status = notify_new_session(listener, sp);
 			if (status != SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_UUID_LOG(sp->uuid_str), SWITCH_LOG_DEBUG, "Notifying new session failed\n");
-				break;
+				removed = sp;
+				sp = removed->next;
+
+				remove_session_elem_from_listener(listener, removed);
+				destroy_session_elem(removed);
+				continue;
 			}
 			switch_set_flag(sp, LFLAG_OUTBOUND_INIT);
 		}
@@ -551,11 +568,11 @@
 			while (switch_queue_trypop(sp->event_queue, &pop) == SWITCH_STATUS_SUCCESS) {
 				switch_event_t *pevent = (switch_event_t *) pop;
 
-				/*switch_log_printf(SWITCH_CHANNEL_UUID_LOG(sp->uuid_str), SWITCH_LOG_DEBUG, "flushed event %s for %s\n", switch_event_name(pevent->event_id), sp->uuid_str);*/
+				/*switch_log_printf(SWITCH_CHANNEL_UUID_LOG(sp->uuid_str), SWITCH_LOG_DEBUG, "flushed event %s for %s\n", switch_event_name(pevent->event_id), sp->uuid_str); */
 
 				/* events from attached sessions are wrapped in a {call_event,<EVT>} tuple 
 				   to distinguish them from normal events (if they are sent to the same process)
-				*/
+				 */
 
 				ei_x_new_with_version(&ebuf);
 				ei_x_encode_tuple_header(&ebuf, 2);
@@ -569,7 +586,8 @@
 				switch_event_destroy(&pevent);
 			}
 			/* this session can be removed */
-			switch_log_printf(SWITCH_CHANNEL_UUID_LOG(sp->uuid_str), SWITCH_LOG_DEBUG, "Destroy event for attached session for %s in state %s\n", sp->uuid_str, switch_channel_state_name(sp->channel_state));
+			switch_log_printf(SWITCH_CHANNEL_UUID_LOG(sp->uuid_str), SWITCH_LOG_DEBUG, "Destroy event for attached session for %s in state %s\n",
+							  sp->uuid_str, switch_channel_state_name(sp->channel_state));
 
 			ei_x_new_with_version(&ebuf);
 			ei_x_encode_atom(&ebuf, "call_hangup");
@@ -588,8 +606,8 @@
 			/* check event queue for this session */
 			switch_event_t *pevent = (switch_event_t *) pop;
 
-			/*switch_log_printf(SWITCH_CHANNEL_UUID_LOG(sp->uuid_str), SWITCH_LOG_DEBUG, "popped event %s for %s\n", switch_event_name(pevent->event_id), sp->uuid_str);*/
-			
+			/*switch_log_printf(SWITCH_CHANNEL_UUID_LOG(sp->uuid_str), SWITCH_LOG_DEBUG, "popped event %s for %s\n", switch_event_name(pevent->event_id), sp->uuid_str); */
+
 			/* events from attached sessions are wrapped in a {call_event,<EVT>} tuple 
 			   to distinguish them from normal events (if they are sent to the same process)
 			 */
@@ -599,7 +617,7 @@
 			ei_x_encode_tuple_header(&ebuf, 2);
 			ei_x_encode_atom(&ebuf, "call_event");
 			ei_encode_switch_event(&ebuf, pevent);
-			
+
 			switch_mutex_lock(listener->sock_mutex);
 			ei_sendto(listener->ec, listener->sockfd, &sp->process, &ebuf);
 			switch_mutex_unlock(listener->sock_mutex);
@@ -610,7 +628,11 @@
 		sp = sp->next;
 	}
 	switch_mutex_unlock(listener->session_mutex);
-	return status;
+	if (prefs.done) {
+		return SWITCH_STATUS_FALSE;	/* we're shutting down */
+	} else {
+		return SWITCH_STATUS_SUCCESS;
+	}
 }
 
 static void check_log_queue(listener_t *listener)
@@ -621,34 +643,34 @@
 	if (switch_test_flag(listener, LFLAG_LOG)) {
 		if (switch_queue_trypop(listener->log_queue, &pop) == SWITCH_STATUS_SUCCESS) {
 			switch_log_node_t *dnode = (switch_log_node_t *) pop;
-			
+
 			if (dnode->data) {
 				ei_x_buff lbuf;
 				ei_x_new_with_version(&lbuf);
 				ei_x_encode_tuple_header(&lbuf, 2);
 				ei_x_encode_atom(&lbuf, "log");
 				ei_x_encode_list_header(&lbuf, 7);
-				
+
 				ei_x_encode_tuple_header(&lbuf, 2);
 				ei_x_encode_atom(&lbuf, "level");
-				ei_x_encode_char(&lbuf, (unsigned char)dnode->level);
-				
+				ei_x_encode_char(&lbuf, (unsigned char) dnode->level);
+
 				ei_x_encode_tuple_header(&lbuf, 2);
 				ei_x_encode_atom(&lbuf, "text_channel");
-				ei_x_encode_char(&lbuf, (unsigned char)dnode->level);
-				
+				ei_x_encode_char(&lbuf, (unsigned char) dnode->level);
+
 				ei_x_encode_tuple_header(&lbuf, 2);
 				ei_x_encode_atom(&lbuf, "file");
 				ei_x_encode_string(&lbuf, dnode->file);
-				
+
 				ei_x_encode_tuple_header(&lbuf, 2);
 				ei_x_encode_atom(&lbuf, "func");
 				ei_x_encode_string(&lbuf, dnode->func);
-				
+
 				ei_x_encode_tuple_header(&lbuf, 2);
 				ei_x_encode_atom(&lbuf, "line");
-				ei_x_encode_ulong(&lbuf, (unsigned long)dnode->line);
-				
+				ei_x_encode_ulong(&lbuf, (unsigned long) dnode->line);
+
 				ei_x_encode_tuple_header(&lbuf, 2);
 				ei_x_encode_atom(&lbuf, "data");
 				ei_x_encode_string(&lbuf, dnode->data);
@@ -656,13 +678,13 @@
 				ei_x_encode_tuple_header(&lbuf, 2);
 				ei_x_encode_atom(&lbuf, "user_data");
 				ei_x_encode_string(&lbuf, switch_str_nil(dnode->userdata));
-				
+
 				ei_x_encode_empty_list(&lbuf);
-				
+
 				switch_mutex_lock(listener->sock_mutex);
 				ei_sendto(listener->ec, listener->sockfd, &listener->log_process, &lbuf);
 				switch_mutex_unlock(listener->sock_mutex);
-				
+
 				ei_x_free(&lbuf);
 				switch_log_node_free(&dnode);
 			}
@@ -672,19 +694,19 @@
 
 static void check_event_queue(listener_t *listener)
 {
-	void* pop;
+	void *pop;
 
 	/* send out any pending crap in the event queue */
 	if (switch_test_flag(listener, LFLAG_EVENTS)) {
 		if (switch_queue_trypop(listener->event_queue, &pop) == SWITCH_STATUS_SUCCESS) {
 
 			switch_event_t *pevent = (switch_event_t *) pop;
-			
+
 			ei_x_buff ebuf;
 			ei_x_new_with_version(&ebuf);
-			
+
 			ei_encode_switch_event(&ebuf, pevent);
-			
+
 			switch_mutex_lock(listener->sock_mutex);
 			ei_sendto(listener->ec, listener->sockfd, &listener->event_process, &ebuf);
 			switch_mutex_unlock(listener->sock_mutex);
@@ -695,17 +717,16 @@
 	}
 }
 
-static void handle_exit(listener_t *listener, erlang_pid *pid)
+static void handle_exit(listener_t *listener, erlang_pid * pid)
 {
 	session_elem_t *s;
 
-	remove_binding(NULL, pid); /* TODO - why don't we pass the listener as the first argument? */
+	remove_binding(NULL, pid);	/* TODO - why don't we pass the listener as the first argument? */
 	if ((s = find_session_elem_by_pid(listener, pid))) {
 		if (s->channel_state < CS_HANGUP) {
 			switch_core_session_t *session;
-			switch_log_printf(SWITCH_CHANNEL_UUID_LOG(s->uuid_str), SWITCH_LOG_WARNING, "Outbound session for %s exited unexpectedly!\n",
-					s->uuid_str);
-			
+			switch_log_printf(SWITCH_CHANNEL_UUID_LOG(s->uuid_str), SWITCH_LOG_WARNING, "Outbound session for %s exited unexpectedly!\n", s->uuid_str);
+
 			if ((session = switch_core_session_locate(s->uuid_str))) {
 				switch_channel_t *channel = switch_core_session_get_channel(session);
 				switch_channel_set_private(channel, "_erlang_session_", NULL);
@@ -757,7 +778,7 @@
 	}
 }
 
-static void listener_main_loop(listener_t *listener) 
+static void listener_main_loop(listener_t *listener)
 {
 	int status = 1;
 
@@ -765,72 +786,73 @@
 		erlang_msg msg;
 		ei_x_buff buf;
 		ei_x_buff rbuf;
-		
+
 		ei_x_new(&buf);
 		ei_x_new_with_version(&rbuf);
 
 		/* do we need the mutex when reading? */
-		/*switch_mutex_lock(listener->sock_mutex);*/
+		/*switch_mutex_lock(listener->sock_mutex); */
 		status = ei_xreceive_msg_tmo(listener->sockfd, &msg, &buf, 100);
-		/*switch_mutex_unlock(listener->sock_mutex);*/
+		/*switch_mutex_unlock(listener->sock_mutex); */
 
-		switch(status) {
-			case ERL_TICK :
-				break;
-			case ERL_MSG :
-				switch(msg.msgtype) {
-					case ERL_SEND :
+		switch (status) {
+		case ERL_TICK:
+			break;
+		case ERL_MSG:
+			switch (msg.msgtype) {
+			case ERL_SEND:
 #ifdef EI_DEBUG
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_send\n");
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_send\n");
 
-						ei_x_print_msg(&buf, &msg.from, 0);
-						/*ei_s_print_term(&pbuf, buf.buff, &i);*/
-						/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_send was message %s\n", pbuf);*/
+				ei_x_print_msg(&buf, &msg.from, 0);
+				/*ei_s_print_term(&pbuf, buf.buff, &i); */
+				/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_send was message %s\n", pbuf); */
 #endif
 
-						if (handle_msg(listener, &msg, &buf, &rbuf)) {
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "handle_msg requested exit\n");
-							return;
-						}
-						break;
-					case ERL_REG_SEND :
+				if (handle_msg(listener, &msg, &buf, &rbuf)) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "handle_msg requested exit\n");
+					return;
+				}
+				break;
+			case ERL_REG_SEND:
 #ifdef EI_DEBUG
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_reg_send to %s\n", msg.toname);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_reg_send to %s\n", msg.toname);
 
-						ei_x_print_reg_msg(&buf, msg.toname, 0);
-						/*i = 1;*/
-						/*ei_s_print_term(&pbuf, buf.buff, &i);*/
-						/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_reg_send was message %s\n", pbuf);*/
+				ei_x_print_reg_msg(&buf, msg.toname, 0);
+				/*i = 1; */
+				/*ei_s_print_term(&pbuf, buf.buff, &i); */
+				/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_reg_send was message %s\n", pbuf); */
 #endif
 
-						if (handle_msg(listener, &msg, &buf, &rbuf)) {
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "handle_msg requested exit\n");
-						    return;
-						}
-						break;
-					case ERL_LINK :
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_link\n");
-						break;
-					case ERL_UNLINK :
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_unlink\n");
-						break;
-					case ERL_EXIT :
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_exit from %s <%d.%d.%d>\n", msg.from.node, msg.from.creation, msg.from.num, msg.from.serial);
-						handle_exit(listener, &msg.from);
-						break;
-					default :
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unexpected msg type %d\n", (int)(msg.msgtype));
-						break;
+				if (handle_msg(listener, &msg, &buf, &rbuf)) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "handle_msg requested exit\n");
+					return;
 				}
 				break;
-			case ERL_ERROR :
-				if (erl_errno != ETIMEDOUT && erl_errno != EAGAIN) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_error\n");
-				}
+			case ERL_LINK:
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_link\n");
 				break;
-			default :
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unexpected status %d \n", status);
+			case ERL_UNLINK:
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_unlink\n");
 				break;
+			case ERL_EXIT:
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_exit from %s <%d.%d.%d>\n", msg.from.node, msg.from.creation, msg.from.num,
+								  msg.from.serial);
+				handle_exit(listener, &msg.from);
+				break;
+			default:
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unexpected msg type %d\n", (int) (msg.msgtype));
+				break;
+			}
+			break;
+		case ERL_ERROR:
+			if (erl_errno != ETIMEDOUT && erl_errno != EAGAIN) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "erl_error\n");
+			}
+			break;
+		default:
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unexpected status %d \n", status);
+			break;
 		}
 
 		ei_x_free(&buf);
@@ -845,7 +867,7 @@
 	}
 }
 
-static switch_bool_t check_inbound_acl(listener_t* listener)
+static switch_bool_t check_inbound_acl(listener_t *listener)
 {
 	/* check acl to see if inbound connection is allowed */
 	if (prefs.acl_count && !zstr(listener->remote_ip)) {
@@ -892,7 +914,7 @@
 static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj)
 {
 	listener_t *listener = (listener_t *) obj;
-	session_elem_t* s;
+	session_elem_t *s;
 	switch_core_session_t *session;
 
 	switch_mutex_lock(globals.listener_mutex);
@@ -907,11 +929,11 @@
 		if (zstr(listener->remote_ip)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Open\n");
 		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Open from %s\n", listener->remote_ip);/*, listener->remote_port);*/
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Open from %s\n", listener->remote_ip);	/*, listener->remote_port); */
 		}
-		
+
 		add_listener(listener);
-  		listener_main_loop(listener);
+		listener_main_loop(listener);
 	}
 
 	/* clean up */
@@ -920,7 +942,7 @@
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Session complete, waiting for children\n");
 
 	switch_thread_rwlock_wrlock(listener->rwlock);
-	
+
 	if (listener->sockfd) {
 		close_socket(&listener->sockfd);
 	}
@@ -935,7 +957,7 @@
 
 	/* clean up all the attached sessions */
 	switch_mutex_lock(listener->session_mutex);
-	/* TODO destroy memory pools since they're not children of the listener's pool*/
+	/* TODO destroy memory pools since they're not children of the listener's pool */
 	for (s = listener->session_list; s; s = s->next) {
 		if ((session = switch_core_session_locate(s->uuid_str))) {
 			switch_channel_clear_flag(switch_core_session_get_channel(session), CF_CONTROLLED);
@@ -1006,7 +1028,7 @@
 					else
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid compatability release '%s' specified\n", val);
 				} else if (!strcmp(var, "shortname")) {
-						prefs.shortname = switch_true(val);
+					prefs.shortname = switch_true(val);
 				} else if (!strcmp(var, "encoding")) {
 					if (!strcasecmp(val, "string")) {
 						prefs.encoding = ERLANG_STRING;
@@ -1047,10 +1069,10 @@
 }
 
 
-static listener_t* new_listener(struct ei_cnode_s *ec, int clientfd)
+static listener_t *new_listener(struct ei_cnode_s *ec, int clientfd)
 {
 	switch_memory_pool_t *listener_pool = NULL;
-	listener_t* listener = NULL;
+	listener_t *listener = NULL;
 
 	if (switch_core_new_memory_pool(&listener_pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH no pool\n");
@@ -1066,7 +1088,7 @@
 	switch_thread_rwlock_create(&listener->rwlock, listener_pool);
 	switch_queue_create(&listener->event_queue, SWITCH_CORE_QUEUE_LEN, listener_pool);
 	switch_queue_create(&listener->log_queue, SWITCH_CORE_QUEUE_LEN, listener_pool);
-		
+
 	listener->sockfd = clientfd;
 	listener->pool = listener_pool;
 	listener_pool = NULL;
@@ -1081,24 +1103,24 @@
 	return listener;
 }
 
-static listener_t* new_outbound_listener(char* node)
+static listener_t *new_outbound_listener(char *node)
 {
-	listener_t* listener = NULL;
+	listener_t *listener = NULL;
 	struct ei_cnode_s ec;
 	int clientfd;
 
-	if (SWITCH_STATUS_SUCCESS==initialise_ei(&ec)) {
+	if (SWITCH_STATUS_SUCCESS == initialise_ei(&ec)) {
 #ifdef WIN32
 		WSASetLastError(0);
 #else
 		errno = 0;
 #endif
-		if ((clientfd=ei_connect(&ec,node)) < 0) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error connecting to node %s (erl_errno=%d, errno=%d)!\n",node,erl_errno,errno);
+		if ((clientfd = ei_connect(&ec, node)) < 0) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error connecting to node %s (erl_errno=%d, errno=%d)!\n", node, erl_errno, errno);
 			return NULL;
 		}
-		listener = new_listener(&ec,clientfd);
-		listener->peer_nodename = switch_core_strdup(listener->pool,node);
+		listener = new_listener(&ec, clientfd);
+		listener->peer_nodename = switch_core_strdup(listener->pool, node);
 	}
 	return listener;
 }
@@ -1108,8 +1130,8 @@
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_channel_state_t state = switch_channel_get_state(channel);
 	session_elem_t *session_element = switch_channel_get_private(channel, "_erlang_session_");
-	/*listener_t* listener = switch_channel_get_private(channel, "_erlang_listener_");*/
-	
+	/*listener_t* listener = switch_channel_get_private(channel, "_erlang_listener_"); */
+
 	if (session_element) {
 		session_element->channel_state = state;
 		if (state == CS_DESTROY) {
@@ -1118,17 +1140,18 @@
 			switch_set_flag(session_element, LFLAG_SESSION_COMPLETE);
 		}
 	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to update channel state for %s to %s\n", switch_core_session_get_uuid(session), switch_channel_state_name(state));
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "unable to update channel state for %s to %s\n", switch_core_session_get_uuid(session),
+						  switch_channel_state_name(state));
 	}
 
 	return SWITCH_STATUS_SUCCESS;
 }
 
-session_elem_t *session_elem_create(listener_t* listener, switch_core_session_t *session) 
+session_elem_t *session_elem_create(listener_t *listener, switch_core_session_t *session)
 {
 	/* create a session list element */
 	switch_memory_pool_t *session_elem_pool;
-	session_elem_t* session_element;/* = malloc(sizeof(*session_element));*/
+	session_elem_t *session_element;	/* = malloc(sizeof(*session_element)); */
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 
 	if (switch_core_new_memory_pool(&session_elem_pool) != SWITCH_STATUS_SUCCESS) {
@@ -1143,51 +1166,51 @@
 	memcpy(session_element->uuid_str, switch_core_session_get_uuid(session), SWITCH_UUID_FORMATTED_LENGTH);
 	session_element->pool = session_elem_pool;
 	session_elem_pool = NULL;
-	
+
 	switch_queue_create(&session_element->event_queue, SWITCH_CORE_QUEUE_LEN, session_element->pool);
 	switch_mutex_init(&session_element->flag_mutex, SWITCH_MUTEX_NESTED, session_element->pool);
-	
+
 	switch_channel_set_private(channel, "_erlang_session_", session_element);
 	switch_channel_set_private(channel, "_erlang_listener_", listener);
-	
+
 	switch_core_event_hook_add_state_change(session, state_handler);
-	
+
 	return session_element;
 }
 
-session_elem_t* attach_call_to_registered_process(listener_t* listener, char* reg_name, switch_core_session_t *session)
+session_elem_t *attach_call_to_registered_process(listener_t *listener, char *reg_name, switch_core_session_t *session)
 {
 	/* create a session list element */
-	session_elem_t* session_element = session_elem_create(listener, session);
+	session_elem_t *session_element = session_elem_create(listener, session);
 
-    session_element->process.type = ERLANG_REG_PROCESS;
-    session_element->process.reg_name = switch_core_session_strdup(session, reg_name);
-    switch_set_flag(session_element, LFLAG_SESSION_ALIVE);
-    /* attach the session to the listener */
-    add_session_elem_to_listener(listener,session_element);
+	session_element->process.type = ERLANG_REG_PROCESS;
+	session_element->process.reg_name = switch_core_session_strdup(session, reg_name);
+	switch_set_flag(session_element, LFLAG_SESSION_ALIVE);
+	/* attach the session to the listener */
+	add_session_elem_to_listener(listener, session_element);
 
 	return session_element;
 }
 
-session_elem_t* attach_call_to_pid(listener_t* listener, erlang_pid* pid, switch_core_session_t *session)
+session_elem_t *attach_call_to_pid(listener_t *listener, erlang_pid * pid, switch_core_session_t *session)
 {
 	/* create a session list element */
-	session_elem_t* session_element = session_elem_create(listener, session);
+	session_elem_t *session_element = session_elem_create(listener, session);
 
 	session_element->process.type = ERLANG_PID;
 	memcpy(&session_element->process.pid, pid, sizeof(erlang_pid));
 	switch_set_flag(session_element, LFLAG_SESSION_ALIVE);
 	/* attach the session to the listener */
-	add_session_elem_to_listener(listener,session_element);
+	add_session_elem_to_listener(listener, session_element);
 	ei_link(listener, ei_self(listener->ec), pid);
-	
+
 	return session_element;
 }
 
-session_elem_t* attach_call_to_spawned_process(listener_t* listener, char *module, char *function, switch_core_session_t *session)
+session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *module, char *function, switch_core_session_t *session)
 {
 	/* create a session list element */
-	session_elem_t* session_element = session_elem_create(listener, session);
+	session_elem_t *session_element = session_elem_create(listener, session);
 	char hash[100];
 	int i = 0;
 	void *p = NULL;
@@ -1195,9 +1218,9 @@
 	erlang_ref ref;
 
 	switch_set_flag(session_element, LFLAG_WAITING_FOR_PID);
-	
+
 	/* attach the session to the listener */
-	add_session_elem_to_listener(listener,session_element);
+	add_session_elem_to_listener(listener, session_element);
 
 	ei_init_ref(listener->ec, &ref);
 	ei_hash_ref(&ref, hash);
@@ -1240,20 +1263,20 @@
 		/*
 		   char *argv[1];
 		   ei_spawn(listener->ec, listener->sockfd, &ref, module, function, 0, argv);
-		   */
+		 */
 	}
 
 	/* loop until either we timeout or we get a value that's not the waiting marker */
 	while (!(p = switch_core_hash_find(listener->spawn_pid_hash, hash)) || p == &globals.WAITING) {
-		if (i > 50) { /* half a second timeout */
+		if (i > 50) {			/* half a second timeout */
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Timed out when waiting for outbound pid\n");
-			remove_session_elem_from_listener_locked(listener,session_element);
-			switch_core_hash_insert(listener->spawn_pid_hash, hash, &globals.TIMEOUT); /* TODO lock this? */
+			remove_session_elem_from_listener_locked(listener, session_element);
+			switch_core_hash_insert(listener->spawn_pid_hash, hash, &globals.TIMEOUT);	/* TODO lock this? */
 			destroy_session_elem(session_element);
 			return NULL;
 		}
 		i++;
-		switch_yield(10000); /* 10ms */
+		switch_yield(10000);	/* 10ms */
 	}
 
 	switch_core_hash_delete(listener->spawn_pid_hash, hash);
@@ -1263,26 +1286,27 @@
 
 	session_element->process.type = ERLANG_PID;
 	memcpy(&session_element->process.pid, pid, sizeof(erlang_pid));
-	
+
 	switch_set_flag(session_element, LFLAG_SESSION_ALIVE);
 	switch_clear_flag(session_element, LFLAG_OUTBOUND_INIT);
 	switch_clear_flag(session_element, LFLAG_WAITING_FOR_PID);
 
 	ei_link(listener, ei_self(listener->ec), pid);
-	switch_safe_free(pid); /* malloced in handle_ref_tuple */
+	switch_safe_free(pid);		/* malloced in handle_ref_tuple */
 
 	return session_element;
 }
 
 
-int count_listener_sessions(listener_t *listener) {
-	session_elem_t *last,*sp;
+int count_listener_sessions(listener_t *listener)
+{
+	session_elem_t *last, *sp;
 	int count = 0;
 
 	switch_mutex_lock(listener->session_mutex);
 	sp = listener->session_list;
 	last = NULL;
-	while(sp) {
+	while (sp) {
 		count++;
 		last = sp;
 		sp = sp->next;
@@ -1301,18 +1325,19 @@
 {
 	char *reg_name = NULL, *node, *module = NULL, *function = NULL;
 	listener_t *listener;
-	int argc = 0, argc2=0;
-	char *argv[80] = { 0 }, *argv2[80] = { 0 };
+	int argc = 0, argc2 = 0;
+	char *argv[80] = { 0 }, *argv2[80] = {
+	0};
 	char *mydata, *myarg;
-	char uuid[SWITCH_UUID_FORMATTED_LENGTH+1];
+	char uuid[SWITCH_UUID_FORMATTED_LENGTH + 1];
 	switch_bool_t new_session = SWITCH_FALSE;
-	session_elem_t* session_element=NULL;
+	session_elem_t *session_element = NULL;
 
 	/* process app arguments */
 	if (data && (mydata = switch_core_session_strdup(session, data))) {
 		argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
-	} /* XXX else? */
-
+	}
+	/* XXX else? */
 	memcpy(uuid, switch_core_session_get_uuid(session), SWITCH_UUID_FORMATTED_LENGTH);
 
 	if (argc < 2) {
@@ -1344,7 +1369,7 @@
 		return;
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "enter erlang_outbound_function %s %s\n",argv[0], node);
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "enter erlang_outbound_function %s %s\n", argv[0], node);
 
 	/* first work out if there is a listener already talking to the node we want to talk to */
 	listener = find_listener(node);
@@ -1353,8 +1378,7 @@
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Creating new listener for session\n");
 		new_session = SWITCH_TRUE;
 		listener = new_outbound_listener(node);
-	}
-	else {
+	} else {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Using existing listener for session\n");
 	}
 
@@ -1367,10 +1391,10 @@
 		if (module && function) {
 			switch_core_hash_init(&listener->spawn_pid_hash, listener->pool);
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Creating new spawned session for listener\n");
-			session_element=attach_call_to_spawned_process(listener, module, function, session);
+			session_element = attach_call_to_spawned_process(listener, module, function, session);
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Creating new registered session for listener\n");
-			session_element=attach_call_to_registered_process(listener, reg_name, session);
+			session_element = attach_call_to_registered_process(listener, reg_name, session);
 		}
 
 		if (session_element) {
@@ -1407,8 +1431,8 @@
 	/* process app arguments */
 	if (data && (mydata = switch_core_session_strdup(session, data))) {
 		argc = switch_separate_string(mydata, ' ', argv, 3);
-	} /* XXX else? */
-
+	}
+	/* XXX else? */
 	if (argc < 3) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Parse Error - need node, registered name and message!\n");
 		return;
@@ -1417,7 +1441,7 @@
 	reg_name = argv[0];
 	node = argv[1];
 
-	/*switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "sendmsg: {%s, %s} ! %s\n", reg_name, node, argv[2]);*/
+	/*switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "sendmsg: {%s, %s} ! %s\n", reg_name, node, argv[2]); */
 
 	ei_x_encode_tuple_header(&buf, 2);
 	ei_x_encode_atom(&buf, "freeswitch_sendmsg");
@@ -1447,9 +1471,7 @@
 
 	const char *usage_string = "USAGE:\n"
 		"--------------------------------------------------------------------------------\n"
-		"erlang listeners\n"
-		"erlang sessions <node_name>\n"
-		"--------------------------------------------------------------------------------\n";
+		"erlang listeners\n" "erlang sessions <node_name>\n" "--------------------------------------------------------------------------------\n";
 
 	if (zstr(cmd)) {
 		stream->write_function(stream, "%s", usage_string);
@@ -1493,8 +1515,9 @@
 				found = 1;
 				switch_mutex_lock(l->session_mutex);
 				if ((sp = l->session_list)) {
-					while(sp) {
-						stream->write_function(stream, "Outbound session for %s in state %s\n", sp->uuid_str, switch_channel_state_name(sp->channel_state));
+					while (sp) {
+						stream->write_function(stream, "Outbound session for %s in state %s\n", sp->uuid_str,
+											   switch_channel_state_name(sp->channel_state));
 						sp = sp->next;
 					}
 				} else {
@@ -1514,7 +1537,7 @@
 		goto done;
 	}
 
-done:
+  done:
 	switch_safe_free(mycmd);
 	return status;
 }
@@ -1524,11 +1547,11 @@
 {
 	switch_application_interface_t *app_interface;
 	switch_api_interface_t *api_interface;
-	
+
 	memset(&prefs, 0, sizeof(prefs));
-	
+
 	switch_mutex_init(&globals.listener_mutex, SWITCH_MUTEX_NESTED, pool);
-	
+
 	/* intialize the unique reference stuff */
 	switch_mutex_init(&globals.ref_mutex, SWITCH_MUTEX_NESTED, pool);
 	globals.reference0 = 0;
@@ -1556,8 +1579,10 @@
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
-	SWITCH_ADD_APP(app_interface, "erlang", "Yield call control to an erlang process", "Connect to erlang", erlang_outbound_function, "<registered name> <node@host>", SAF_SUPPORT_NOMEDIA);
-	SWITCH_ADD_APP(app_interface, "erlang_sendmsg", "Send a message to an erlang process", "Connect to erlang", erlang_sendmsg_function, "<registered name> <node@host> <message>", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "erlang", "Yield call control to an erlang process", "Connect to erlang", erlang_outbound_function,
+				   "<registered name> <node@host>", SAF_SUPPORT_NOMEDIA);
+	SWITCH_ADD_APP(app_interface, "erlang_sendmsg", "Send a message to an erlang process", "Connect to erlang", erlang_sendmsg_function,
+				   "<registered name> <node@host> <message>", SAF_SUPPORT_NOMEDIA);
 	SWITCH_ADD_API(api_interface, "erlang", "erlang information", erlang_cmd, "<command> [<args>]");
 	switch_console_set_complete("add erlang listeners");
 
@@ -1584,7 +1609,7 @@
 	WSADATA wsaData;
 
 	wVersionRequested = MAKEWORD(2, 2);
-	
+
 	if (WSAStartup(wVersionRequested, &wsaData) != 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Winsock initialization failed, oh well\n");
 		return SWITCH_STATUS_TERM;
@@ -1630,21 +1655,21 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to allocate socket on %s:%u\n", prefs.ip, prefs.port);
 			goto sock_fail;
 		}
-
 #ifdef WIN32
-		if (setsockopt(listen_list.sockfd, SOL_SOCKET, SO_REUSEADDR, (const char *)&on, sizeof(on))) {
+		if (setsockopt(listen_list.sockfd, SOL_SOCKET, SO_REUSEADDR, (const char *) &on, sizeof(on))) {
 #else
 		if (setsockopt(listen_list.sockfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on))) {
 #endif
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to enable SO_REUSEADDR for socket on %s:%u : %s\n", prefs.ip, prefs.port, strerror(errno));
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to enable SO_REUSEADDR for socket on %s:%u : %s\n", prefs.ip, prefs.port,
+							  strerror(errno));
 			goto sock_fail;
 		}
-		
-		if (bind(listen_list.sockfd, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) {
+
+		if (bind(listen_list.sockfd, (struct sockaddr *) &server_addr, sizeof(server_addr)) < 0) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to bind to %s:%u\n", prefs.ip, prefs.port);
 			goto sock_fail;
 		}
-		
+
 		if (listen(listen_list.sockfd, 5) < 0) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to listen on %s:%u\n", prefs.ip, prefs.port);
 			goto sock_fail;
@@ -1661,7 +1686,7 @@
 		ei_set_compat_rel(prefs.compat_rel);
 	}
 
-	if (SWITCH_STATUS_SUCCESS!=initialise_ei(&ec)) {
+	if (SWITCH_STATUS_SUCCESS != initialise_ei(&ec)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to init ei connection\n");
 		goto init_failed;
 	}
@@ -1670,7 +1695,8 @@
 	if ((epmdfd = ei_publish(&ec, prefs.port)) == -1) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to publish port to empd, trying to start empd via system()\n");
 		if (system("epmd -daemon")) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to start empd manually! Is epmd in $PATH? If not, start it yourself or run an erl shell with -sname or -name\n");
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+							  "Failed to start empd manually! Is epmd in $PATH? If not, start it yourself or run an erl shell with -sname or -name\n");
 			goto init_failed;
 		}
 		switch_yield(100000);
@@ -1693,7 +1719,7 @@
 #else
 		errno = 0;
 #endif
-		if ((clientfd = ei_accept_tmo(&ec, (int)listen_list.sockfd, &conn, 100)) == ERL_ERROR) {
+		if ((clientfd = ei_accept_tmo(&ec, (int) listen_list.sockfd, &conn, 100)) == ERL_ERROR) {
 			if (prefs.done) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Shutting Down\n");
 			} else if (erl_errno == ETIMEDOUT) {
@@ -1708,22 +1734,22 @@
 			} else {
 				/* if errno didn't get set, assume nothing *too* horrible occured */
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
-						"Ignorable error in ei_accept - probable bad client version, bad cookie or bad nodename\n");
+								  "Ignorable error in ei_accept - probable bad client version, bad cookie or bad nodename\n");
 				continue;
 			}
 			break;
 		}
 
-		listener = new_listener(&ec,clientfd);
+		listener = new_listener(&ec, clientfd);
 		if (listener) {
 			/* store the IP and node name we are talking with */
 			switch_inet_ntop(AF_INET, conn.ipadr, listener->remote_ip, sizeof(listener->remote_ip));
-			listener->peer_nodename = switch_core_strdup(listener->pool,conn.nodename);
+			listener->peer_nodename = switch_core_strdup(listener->pool, conn.nodename);
 
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Launching listener, connection from node %s, ip %s\n", conn.nodename, listener->remote_ip);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Launching listener, connection from node %s, ip %s\n", conn.nodename,
+							  listener->remote_ip);
 			launch_listener_thread(listener);
-		}
-		else
+		} else
 			/* if we fail to create a listener (memory error), then the module will exit */
 			break;
 	}
@@ -1734,7 +1760,7 @@
 	ei_unpublish(&ec);
 	close_socket(&epmdfd);
 
-init_failed:
+  init_failed:
 	close_socket(&listen_list.sockfd);
 	if (pool) {
 		switch_core_destroy_memory_pool(&pool);
@@ -1756,13 +1782,13 @@
 	listener_t *l;
 	int sanity = 0;
 
-	if (prefs.done == 0) /* main thread might already have exited */
+	if (prefs.done == 0)		/* main thread might already have exited */
 		prefs.done = 1;
 
 	switch_log_unbind_logger(socket_logger);
 
-	/*close_socket(&listen_list.sockfd);*/
-	
+	/*close_socket(&listen_list.sockfd); */
+
 	while (prefs.threads || prefs.done == 1) {
 		switch_yield(10000);
 		if (++sanity == 1000) {
@@ -1785,7 +1811,7 @@
 
 	switch_mutex_unlock(globals.listener_mutex);
 
-	switch_sleep(1500000); /* sleep for 1.5 seconds */
+	switch_sleep(1500000);		/* sleep for 1.5 seconds */
 
 	switch_safe_free(prefs.ip);
 	switch_safe_free(prefs.cookie);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_erlang_event/mod_erlang_event.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -33,8 +33,8 @@
  */
 
 typedef enum {
-	LFLAG_WAITING_FOR_PID = (1 << 0), /* waiting for a node to return a pid */
-	LFLAG_OUTBOUND_INIT = (1 << 1), /* Erlang peer has been notified of this session */
+	LFLAG_WAITING_FOR_PID = (1 << 0),	/* waiting for a node to return a pid */
+	LFLAG_OUTBOUND_INIT = (1 << 1),	/* Erlang peer has been notified of this session */
 	LFLAG_SESSION_ALIVE = (1 << 2),
 	LFLAG_SESSION_COMPLETE = (1 << 3),
 } session_flag_t;
@@ -114,7 +114,7 @@
 	uint32_t timeout;
 	uint32_t id;
 	char remote_ip[50];
-	/*switch_port_t remote_port;*/
+	/*switch_port_t remote_port; */
 	struct listener *next;
 };
 
@@ -143,8 +143,8 @@
 	unsigned int reference0;
 	unsigned int reference1;
 	unsigned int reference2;
-	char TIMEOUT; /* marker for a timed out request */
-	char WAITING; /* marker for a request waiting for a response */
+	char TIMEOUT;				/* marker for a timed out request */
+	char WAITING;				/* marker for a request waiting for a response */
 	switch_mutex_t *ref_mutex;
 };
 typedef struct globals_struct globals_t;
@@ -200,20 +200,20 @@
 
 /* function prototypes */
 /* handle_msg.c */
-int handle_msg(listener_t *listener, erlang_msg *msg, ei_x_buff *buf, ei_x_buff *rbuf);
+int handle_msg(listener_t *listener, erlang_msg * msg, ei_x_buff * buf, ei_x_buff * rbuf);
 
 /* ei_helpers.c */
-void ei_link(listener_t *listener, erlang_pid *from, erlang_pid *to);
-void ei_encode_switch_event_headers(ei_x_buff *ebuf, switch_event_t *event);
-void ei_encode_switch_event_tag(ei_x_buff *ebuf, switch_event_t *event, char *tag);
-int ei_pid_from_rpc(struct ei_cnode_s *ec, int sockfd, erlang_ref *ref, char *module, char *function);
-int ei_spawn(struct ei_cnode_s *ec, int sockfd, erlang_ref *ref, char *module, char *function, int argc, char **argv);
-void ei_init_ref(struct ei_cnode_s *ec, erlang_ref *ref);
-void ei_x_print_reg_msg(ei_x_buff *buf, char *dest, int send);
-void ei_x_print_msg(ei_x_buff *buf, erlang_pid *pid, int send);
-int ei_sendto(ei_cnode *ec, int fd, struct erlang_process *process, ei_x_buff *buf);
-void ei_hash_ref(erlang_ref *ref, char *output);
-int ei_compare_pids(erlang_pid *pid1, erlang_pid *pid2);
+void ei_link(listener_t *listener, erlang_pid * from, erlang_pid * to);
+void ei_encode_switch_event_headers(ei_x_buff * ebuf, switch_event_t *event);
+void ei_encode_switch_event_tag(ei_x_buff * ebuf, switch_event_t *event, char *tag);
+int ei_pid_from_rpc(struct ei_cnode_s *ec, int sockfd, erlang_ref * ref, char *module, char *function);
+int ei_spawn(struct ei_cnode_s *ec, int sockfd, erlang_ref * ref, char *module, char *function, int argc, char **argv);
+void ei_init_ref(struct ei_cnode_s *ec, erlang_ref * ref);
+void ei_x_print_reg_msg(ei_x_buff * buf, char *dest, int send);
+void ei_x_print_msg(ei_x_buff * buf, erlang_pid * pid, int send);
+int ei_sendto(ei_cnode * ec, int fd, struct erlang_process *process, ei_x_buff * buf);
+void ei_hash_ref(erlang_ref * ref, char *output);
+int ei_compare_pids(erlang_pid * pid1, erlang_pid * pid2);
 int ei_decode_string_or_binary(char *buf, int *index, int maxlen, char *dst);
 switch_status_t initialise_ei(struct ei_cnode_s *ec);
 #define ei_encode_switch_event(_b, _e) ei_encode_switch_event_tag(_b, _e, "event")
@@ -228,14 +228,14 @@
 		break; \
 }
 
-#ifdef WIN32 /* MSDN suggested hack to fake errno for network operations */
+#ifdef WIN32					/* MSDN suggested hack to fake errno for network operations */
 /*#define errno WSAGetLastError()*/
 #endif
 
 /* mod_erlang_event.c */
-session_elem_t* attach_call_to_registered_process(listener_t* listener, char* reg_name, switch_core_session_t *session);
-session_elem_t* attach_call_to_pid(listener_t* listener, erlang_pid* pid, switch_core_session_t *session);
-session_elem_t* attach_call_to_spawned_process(listener_t* listener, char *module, char *function, switch_core_session_t *session);
+session_elem_t *attach_call_to_registered_process(listener_t *listener, char *reg_name, switch_core_session_t *session);
+session_elem_t *attach_call_to_pid(listener_t *listener, erlang_pid * pid, switch_core_session_t *session);
+session_elem_t *attach_call_to_spawned_process(listener_t *listener, char *module, char *function, switch_core_session_t *session);
 
 /* For Emacs:
  * Local Variables:

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -37,7 +37,7 @@
 #define MULTICAST_BUFFSIZE 65536
 
 /* magic byte sequence */
-static unsigned char MAGIC[] = {226, 132, 177, 197, 152, 198, 142, 211, 172, 197, 158, 208, 169, 208, 135, 197, 166, 207, 154, 196, 166};
+static unsigned char MAGIC[] = { 226, 132, 177, 197, 152, 198, 142, 211, 172, 197, 158, 208, 169, 208, 135, 197, 166, 207, 154, 196, 166 };
 static char *MARKER = "1";
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_event_multicast_load);
@@ -59,7 +59,6 @@
 	switch_hash_t *event_hash;
 	uint8_t event_list[SWITCH_EVENT_ALL + 1];
 	int running;
-	switch_event_node_t *node;
 	uint8_t ttl;
 	char *psk;
 	switch_mutex_t *mutex;
@@ -88,7 +87,7 @@
 	uint32_t count = 0;
 	uint8_t custom = 0;
 
-	
+
 	globals.ttl = 1;
 	globals.key_count = 0;
 
@@ -117,7 +116,7 @@
 #endif
 			} else if (!strcasecmp(var, "ttl")) {
 				int ttl = atoi(val);
-				if ((ttl && ttl <= 255)  || !strcmp(val, "0")) {
+				if ((ttl && ttl <= 255) || !strcmp(val, "0")) {
 					globals.ttl = (uint8_t) ttl;
 				} else {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid ttl '%s' specified, using default of 1\n", val);
@@ -177,22 +176,20 @@
 	}
 
 	if (event->subclass_name && (!strcmp(event->subclass_name, MULTICAST_EVENT) ||
-				!strcmp(event->subclass_name, MULTICAST_PEERUP) ||
-				!strcmp(event->subclass_name, MULTICAST_PEERDOWN))) {
-		char * event_name, *sender;
+								 !strcmp(event->subclass_name, MULTICAST_PEERUP) || !strcmp(event->subclass_name, MULTICAST_PEERDOWN))) {
+		char *event_name, *sender;
 		if ((event_name = switch_event_get_header(event, "orig-event-name")) &&
-			!strcasecmp(event_name, "HEARTBEAT") && 
-			(sender = switch_event_get_header(event, "orig-multicast-sender"))) {
+			!strcasecmp(event_name, "HEARTBEAT") && (sender = switch_event_get_header(event, "orig-multicast-sender"))) {
 			struct peer_status *p;
 			time_t now = switch_epoch_time_now(NULL);
-			
+
 			if (!(p = switch_core_hash_find(globals.peer_hash, sender))) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Host %s not already in hash\n", sender);
 				p = switch_core_alloc(module_pool, sizeof(struct peer_status));
 				p->active = SWITCH_FALSE;
 				p->lastseen = 0;
-			/*} else {*/
-				/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Host %s last seen %d seconds ago\n", sender, now - p->lastseen);*/
+				/*} else { */
+				/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Host %s last seen %d seconds ago\n", sender, now - p->lastseen); */
 			}
 
 			if (!p->active) {
@@ -201,7 +198,7 @@
 					char lastseen[21];
 					switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, "Peer", sender);
 					if (p->lastseen) {
-						switch_snprintf(lastseen, sizeof(lastseen), "%d", (int)p->lastseen);
+						switch_snprintf(lastseen, sizeof(lastseen), "%d", (int) p->lastseen);
 					} else {
 						switch_snprintf(lastseen, sizeof(lastseen), "%s", "Never");
 					}
@@ -247,11 +244,11 @@
 		time_t now = switch_epoch_time_now(NULL);
 		struct peer_status *last;
 		char *host;
-		
+
 		for (cur = switch_hash_first(NULL, globals.peer_hash); cur; cur = switch_hash_next(cur)) {
 			switch_hash_this(cur, &key, &keylen, &value);
-			host = (char*) key;
-			last = (struct peer_status*) value;
+			host = (char *) key;
+			last = (struct peer_status *) value;
 			if (last->active && (now - (last->lastseen)) > 60) {
 				switch_event_t *local_event;
 
@@ -259,7 +256,7 @@
 				if (switch_event_create_subclass(&local_event, SWITCH_EVENT_CUSTOM, MULTICAST_PEERDOWN) == SWITCH_STATUS_SUCCESS) {
 					char lastseen[21];
 					switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, "Peer", host);
-					switch_snprintf(lastseen, sizeof(lastseen), "%d", (int)last->lastseen);
+					switch_snprintf(lastseen, sizeof(lastseen), "%d", (int) last->lastseen);
 					switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, "Lastseen", lastseen);
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Peer %s has gone down; last seen: %s\n", host, lastseen);
 
@@ -293,14 +290,14 @@
 #ifdef HAVE_OPENSSL
 				int outlen, tmplen;
 				EVP_CIPHER_CTX ctx;
-				char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1];
+				char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
 				switch_uuid_t uuid;
 
 				switch_uuid_get(&uuid);
 				switch_uuid_format(uuid_str, &uuid);
-				len = strlen(packet) + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH + EVP_MAX_IV_LENGTH + strlen((char*)MAGIC);
+				len = strlen(packet) + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH + EVP_MAX_IV_LENGTH + strlen((char *) MAGIC);
 #else
-				len = strlen(packet) + sizeof(globals.host_hash) + strlen((char*) MAGIC);
+				len = strlen(packet) + sizeof(globals.host_hash) + strlen((char *) MAGIC);
 #endif
 				buf = malloc(len + 1);
 				memset(buf, 0, len + 1);
@@ -314,20 +311,20 @@
 					EVP_CIPHER_CTX_init(&ctx);
 					EVP_EncryptInit(&ctx, EVP_bf_cbc(), NULL, NULL);
 					EVP_CIPHER_CTX_set_key_length(&ctx, strlen(globals.psk));
-					EVP_EncryptInit(&ctx, NULL, (unsigned char*) globals.psk, (unsigned char*) uuid_str);
-					EVP_EncryptUpdate(&ctx, (unsigned char*) buf + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH,
-							&outlen, (unsigned char*) packet, (int) strlen(packet));
-					EVP_EncryptUpdate(&ctx, (unsigned char*) buf + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH + outlen,
-							&tmplen, (unsigned char*) MAGIC, (int) strlen((char *) MAGIC));
+					EVP_EncryptInit(&ctx, NULL, (unsigned char *) globals.psk, (unsigned char *) uuid_str);
+					EVP_EncryptUpdate(&ctx, (unsigned char *) buf + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH,
+									  &outlen, (unsigned char *) packet, (int) strlen(packet));
+					EVP_EncryptUpdate(&ctx, (unsigned char *) buf + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH + outlen,
+									  &tmplen, (unsigned char *) MAGIC, (int) strlen((char *) MAGIC));
 					outlen += tmplen;
-					EVP_EncryptFinal(&ctx, (unsigned char*) buf + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH + outlen, &tmplen);
+					EVP_EncryptFinal(&ctx, (unsigned char *) buf + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH + outlen, &tmplen);
 					outlen += tmplen;
 					len = (size_t) outlen + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH;
 					*(buf + sizeof(globals.host_hash) + SWITCH_UUID_FORMATTED_LENGTH + outlen) = '\0';
 				} else {
 #endif
 					switch_copy_string(buf + sizeof(globals.host_hash), packet, len - sizeof(globals.host_hash));
-					switch_copy_string(buf + sizeof(globals.host_hash) + strlen(packet), (char *) MAGIC, strlen((char*) MAGIC)+1);
+					switch_copy_string(buf + sizeof(globals.host_hash) + strlen(packet), (char *) MAGIC, strlen((char *) MAGIC) + 1);
 #ifdef HAVE_OPENSSL
 				}
 #endif
@@ -355,8 +352,8 @@
 
 	for (cur = switch_hash_first(NULL, globals.peer_hash); cur; cur = switch_hash_next(cur)) {
 		switch_hash_this(cur, &key, &keylen, &value);
-		host = (char*) key;
-		last = (struct peer_status*) value;
+		host = (char *) key;
+		last = (struct peer_status *) value;
 
 		stream->write_function(stream, "Peer %s %s; last seen %d seconds ago\n", host, last->active ? "UP" : "DOWN", now - last->lastseen);
 		i++;
@@ -373,6 +370,7 @@
 {
 	switch_api_interface_t *api_interface;
 	switch_ssize_t hlen = -1;
+	switch_status_t status = SWITCH_STATUS_GENERR;
 
 	memset(&globals, 0, sizeof(globals));
 
@@ -388,95 +386,95 @@
 
 	if (load_config() != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Configure\n");
-		return SWITCH_STATUS_TERM;
+		switch_goto_status(SWITCH_STATUS_TERM, fail);
 	}
 
 	if (switch_sockaddr_info_get(&globals.addr, globals.address, SWITCH_UNSPEC, globals.port, 0, module_pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find address\n");
-		return SWITCH_STATUS_TERM;
+		switch_goto_status(SWITCH_STATUS_TERM, fail);
 	}
 
 	if (switch_socket_create(&globals.udp_socket, AF_INET, SOCK_DGRAM, 0, module_pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Error\n");
-		return SWITCH_STATUS_TERM;
+		switch_goto_status(SWITCH_STATUS_TERM, fail);
 	}
 
 	if (switch_socket_opt_set(globals.udp_socket, SWITCH_SO_REUSEADDR, 1) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Socket Option Error\n");
-		switch_socket_close(globals.udp_socket);
-		return SWITCH_STATUS_TERM;
+		switch_goto_status(SWITCH_STATUS_TERM, fail);
 	}
 
 	if (switch_mcast_join(globals.udp_socket, globals.addr, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Multicast Error\n");
-		switch_socket_close(globals.udp_socket);
-		return SWITCH_STATUS_TERM;
+		switch_goto_status(SWITCH_STATUS_TERM, fail);
 	}
 
 	if (switch_mcast_hops(globals.udp_socket, globals.ttl) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set ttl to '%d'\n", globals.ttl);
-		switch_socket_close(globals.udp_socket);
-		return SWITCH_STATUS_TERM;
+		switch_goto_status(SWITCH_STATUS_TERM, fail);
 	}
 
 	if (switch_socket_bind(globals.udp_socket, globals.addr) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bind Error\n");
-		switch_socket_close(globals.udp_socket);
-		return SWITCH_STATUS_TERM;
+		switch_goto_status(SWITCH_STATUS_TERM, fail);
 	}
 
-	/* connect my internal structure to the blank pointer passed to me */
-	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
-
 	if (switch_event_reserve_subclass(MULTICAST_EVENT) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MULTICAST_EVENT);
-		return SWITCH_STATUS_GENERR;
+		switch_goto_status(SWITCH_STATUS_GENERR, fail);
 	}
 
 	if (switch_event_reserve_subclass(MULTICAST_PEERUP) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MULTICAST_PEERUP);
-		return SWITCH_STATUS_GENERR;
+		switch_goto_status(SWITCH_STATUS_GENERR, fail);
 	}
 
 	if (switch_event_reserve_subclass(MULTICAST_PEERDOWN) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MULTICAST_PEERDOWN);
-		return SWITCH_STATUS_GENERR;
+		switch_goto_status(SWITCH_STATUS_GENERR, fail);
 	}
 
 	if (switch_event_bind(modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
-		switch_socket_close(globals.udp_socket);
-		return SWITCH_STATUS_GENERR;
+		switch_goto_status(SWITCH_STATUS_GENERR, fail);
 	}
-
+#ifdef USE_NONBLOCK
 	switch_socket_opt_set(globals.udp_socket, SWITCH_SO_NONBLOCK, TRUE);
+#endif
 
+	/* connect my internal structure to the blank pointer passed to me */
+	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	SWITCH_ADD_API(api_interface, "multicast_peers", "Show status of multicast peers", multicast_peers, "");
 
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
+
+
+  fail:
+
+	if (globals.udp_socket) {
+		switch_socket_close(globals.udp_socket);
+	}
+
+	switch_event_free_subclass(MULTICAST_EVENT);
+	switch_event_free_subclass(MULTICAST_PEERUP);
+	switch_event_free_subclass(MULTICAST_PEERDOWN);
+
+	return status;
+
 }
 
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_event_multicast_shutdown)
 {
-	int x = 0;
+	globals.running = 0;
+	switch_event_unbind_callback(event_handler);
 
-	if (globals.running == 1) {
-		globals.running = -1;
-		while (x < 100000 && globals.running) {
-			x++;
-			switch_cond_next();
-		}
-	}
-
 	if (globals.udp_socket) {
-		switch_socket_close(globals.udp_socket);
-		globals.udp_socket = NULL;
+		switch_socket_shutdown(globals.udp_socket, 2);
 	}
 
-	switch_event_unbind(&globals.node);
 	switch_event_free_subclass(MULTICAST_EVENT);
 	switch_event_free_subclass(MULTICAST_PEERUP);
 	switch_event_free_subclass(MULTICAST_PEERDOWN);
@@ -508,8 +506,10 @@
 		memset(buf, 0, len);
 
 		switch_sockaddr_ip_get(&myaddr, globals.addr);
-		status = switch_socket_recvfrom(addr, globals.udp_socket, 0, buf, &len);
-
+		if ((status = switch_socket_recvfrom(addr, globals.udp_socket, 0, buf, &len)) != SWITCH_STATUS_SUCCESS || !len || !globals.running) {
+			break;
+		}
+#ifdef USE_NONBLOCK
 		if (!len) {
 			if (SWITCH_STATUS_IS_BREAK(status)) {
 				switch_yield(100000);
@@ -518,6 +518,7 @@
 
 			break;
 		}
+#endif
 
 		memcpy(&host_hash, buf, sizeof(host_hash));
 		packet = buf + sizeof(host_hash);
@@ -527,7 +528,7 @@
 		}
 #ifdef HAVE_OPENSSL
 		if (globals.psk) {
-			char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1];
+			char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
 			char *tmp;
 			int outl, tmplen;
 			EVP_CIPHER_CTX ctx;
@@ -544,22 +545,21 @@
 			EVP_CIPHER_CTX_init(&ctx);
 			EVP_DecryptInit(&ctx, EVP_bf_cbc(), NULL, NULL);
 			EVP_CIPHER_CTX_set_key_length(&ctx, strlen(globals.psk));
-			EVP_DecryptInit(&ctx, NULL, (unsigned char*) globals.psk, (unsigned char*) uuid_str);
-			EVP_DecryptUpdate(&ctx, (unsigned char*) tmp,
-					&outl, (unsigned char*) packet, (int) len);
-			EVP_DecryptFinal(&ctx, (unsigned char*) tmp + outl, &tmplen);
+			EVP_DecryptInit(&ctx, NULL, (unsigned char *) globals.psk, (unsigned char *) uuid_str);
+			EVP_DecryptUpdate(&ctx, (unsigned char *) tmp, &outl, (unsigned char *) packet, (int) len);
+			EVP_DecryptFinal(&ctx, (unsigned char *) tmp + outl, &tmplen);
 
 			*(tmp + outl + tmplen) = '\0';
 
-			/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "decrypted event as %s\n----------\n of actual length %d (%d) %d\n", tmp, outl + tmplen, (int) len, (int) strlen(tmp));*/
+			/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "decrypted event as %s\n----------\n of actual length %d (%d) %d\n", tmp, outl + tmplen, (int) len, (int) strlen(tmp)); */
 			packet = tmp;
 
 		}
 #endif
 		if ((m = strchr(packet, (int) MAGIC[0])) != 0) {
-			/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found start of magic string\n");*/
-			if (!strncmp((char*) MAGIC, m, strlen((char*) MAGIC))) {
-				/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found entire magic string\n");*/
+			/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found start of magic string\n"); */
+			if (!strncmp((char *) MAGIC, m, strlen((char *) MAGIC))) {
+				/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found entire magic string\n"); */
 				*m = '\0';
 			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Failed to find entire magic string\n");
@@ -570,7 +570,7 @@
 			continue;
 		}
 
-		/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\nEVENT %d\n--------------------------------\n%s\n", (int) len, packet);*/
+		/*switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "\nEVENT %d\n--------------------------------\n%s\n", (int) len, packet); */
 		if (switch_event_create_subclass(&local_event, SWITCH_EVENT_CUSTOM, MULTICAST_EVENT) == SWITCH_STATUS_SUCCESS) {
 			char *var, *val, *term = NULL, tmpname[128];
 			switch_event_add_header_string(local_event, SWITCH_STACK_BOTTOM, "Multicast", "yes");
@@ -606,6 +606,12 @@
 
 	}
 
+
+	if (globals.udp_socket) {
+		switch_socket_close(globals.udp_socket);
+		globals.udp_socket = NULL;
+	}
+
 	globals.running = 0;
 	free(buf);
 	return SWITCH_STATUS_TERM;

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


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -54,6 +54,9 @@
 	LFLAG_HANDLE_DISCO = (1 << 11),
 	LFLAG_CONNECTED = (1 << 12),
 	LFLAG_RESUME = (1 << 13),
+	LFLAG_AUTH_EVENTS = (1 << 14),
+	LFLAG_ALL_EVENTS_AUTHED = (1 << 15),
+	LFLAG_ALLOW_LOG = (1 << 16)
 } event_flag_t;
 
 typedef enum {
@@ -73,7 +76,10 @@
 	switch_log_level_t level;
 	char *ebuf;
 	uint8_t event_list[SWITCH_EVENT_ALL + 1];
+	uint8_t allowed_event_list[SWITCH_EVENT_ALL + 1];
 	switch_hash_t *event_hash;
+	switch_hash_t *allowed_event_hash;
+	switch_hash_t *allowed_api_hash;
 	switch_thread_rwlock_t *rwlock;
 	switch_core_session_t *session;
 	int lost_events;
@@ -92,7 +98,7 @@
 typedef struct listener listener_t;
 
 static struct {
-	switch_mutex_t *listener_mutex;	
+	switch_mutex_t *listener_mutex;
 	switch_event_node_t *node;
 	int debug;
 } globals;
@@ -127,8 +133,8 @@
 {
 	uint32_t id;
 	switch_mutex_lock(globals.listener_mutex);
-    id = ++prefs.id;
-    switch_mutex_unlock(globals.listener_mutex);
+	id = ++prefs.id;
+	switch_mutex_unlock(globals.listener_mutex);
 	return id;
 }
 
@@ -141,12 +147,12 @@
 static switch_status_t socket_logger(const switch_log_node_t *node, switch_log_level_t level)
 {
 	listener_t *l;
-	
+
 	switch_mutex_lock(globals.listener_mutex);
 	for (l = listen_list.listeners; l; l = l->next) {
 		if (switch_test_flag(l, LFLAG_LOG) && l->level >= node->level) {
-			switch_log_node_t *dnode = switch_log_node_dup(node);			
-			
+			switch_log_node_t *dnode = switch_log_node_dup(node);
+
 			if (switch_queue_trypush(l->log_queue, dnode) == SWITCH_STATUS_SUCCESS) {
 				if (l->lost_logs) {
 					int ll = l->lost_logs;
@@ -185,17 +191,19 @@
 	if (listener->event_queue) {
 		while (switch_queue_trypop(listener->event_queue, &pop) == SWITCH_STATUS_SUCCESS) {
 			switch_event_t *pevent = (switch_event_t *) pop;
-			if (!pop) continue;
+			if (!pop)
+				continue;
 			switch_event_destroy(&pevent);
 		}
 	}
 }
 
-static switch_status_t expire_listener(listener_t **listener)
+static switch_status_t expire_listener(listener_t ** listener)
 {
 	listener_t *l;
 
-	if (!listener || !*listener) return SWITCH_STATUS_FALSE;
+	if (!listener || !*listener)
+		return SWITCH_STATUS_FALSE;
 	l = *listener;
 
 	if (!l->expire_time) {
@@ -211,6 +219,15 @@
 	flush_listener(*listener, SWITCH_TRUE, SWITCH_TRUE);
 	switch_core_hash_destroy(&l->event_hash);
 
+	if (l->allowed_event_hash) {
+		switch_core_hash_destroy(&l->allowed_event_hash);
+	}
+
+	if (l->allowed_api_hash) {
+		switch_core_hash_destroy(&l->allowed_api_hash);
+	}
+
+
 	switch_mutex_lock(l->filter_mutex);
 	if (l->filters) {
 		switch_event_destroy(&l->filters);
@@ -235,11 +252,11 @@
 	if (!listen_list.ready) {
 		return;
 	}
-	
+
 	lp = listen_list.listeners;
 
 	switch_mutex_lock(globals.listener_mutex);
-	while(lp) {
+	while (lp) {
 		int send = 0;
 
 		l = lp;
@@ -255,11 +272,11 @@
 				continue;
 			}
 		}
-		
+
 		if (l->expire_time || !switch_test_flag(l, LFLAG_EVENTS)) {
 			last = l;
 			continue;
-		}		
+		}
 
 		if (l->event_list[SWITCH_EVENT_ALL]) {
 			send = 1;
@@ -268,7 +285,7 @@
 				send = 1;
 			}
 		}
-		
+
 		if (send && l->filters && l->filters->headers) {
 			switch_event_header_t *hp;
 			const char *hval;
@@ -298,12 +315,12 @@
 					if (!comp_to) {
 						continue;
 					}
-					
+
 					if (*hp->value == '/') {
 						switch_regex_t *re = NULL;
 						int ovector[30];
 						cmp = !!switch_regex_perform(hval, comp_to, &re, ovector, sizeof(ovector) / sizeof(ovector[0]));
-						switch_regex_safe_free(re);						
+						switch_regex_safe_free(re);
 					} else {
 						cmp = !strcasecmp(hval, comp_to);
 					}
@@ -320,7 +337,7 @@
 			}
 			switch_mutex_unlock(l->filter_mutex);
 		}
-		
+
 		if (send && switch_test_flag(l, LFLAG_MYEVENTS)) {
 			char *uuid = switch_event_get_header(event, "unique-id");
 			if (!uuid || strcmp(uuid, switch_core_session_get_uuid(l->session))) {
@@ -429,6 +446,7 @@
 	listener->pool = switch_core_session_get_pool(session);
 	listener->format = EVENT_FORMAT_PLAIN;
 	listener->session = session;
+	switch_set_flag(listener, LFLAG_ALLOW_LOG);
 
 	switch_mutex_init(&listener->flag_mutex, SWITCH_MUTEX_NESTED, listener->pool);
 	switch_mutex_init(&listener->filter_mutex, SWITCH_MUTEX_NESTED, listener->pool);
@@ -444,19 +462,19 @@
 		}
 	}
 
-	if (switch_test_flag(listener, LFLAG_ASYNC)) {		
+	if (switch_test_flag(listener, LFLAG_ASYNC)) {
 		const char *var;
-		
+
 		launch_listener_thread(listener);
 
-		while(switch_channel_ready(channel) && !switch_test_flag(listener, LFLAG_CONNECTED)) {
+		while (switch_channel_ready(channel) && !switch_test_flag(listener, LFLAG_CONNECTED)) {
 			switch_cond_next();
 		}
-		
+
 		switch_ivr_park(session, NULL);
 
 		switch_ivr_parse_all_events(session);
-		
+
 		if (switch_test_flag(listener, LFLAG_RESUME) || ((var = switch_channel_get_variable(channel, "socket_resume")) && switch_true(var))) {
 			switch_channel_set_state(channel, CS_EXECUTE);
 		}
@@ -475,7 +493,7 @@
 }
 
 
-static void close_socket(switch_socket_t **sock)
+static void close_socket(switch_socket_t ** sock)
 {
 	switch_mutex_lock(listen_list.sock_mutex);
 	if (*sock) {
@@ -508,7 +526,7 @@
 	switch_event_unbind(&globals.node);
 
 	switch_safe_free(prefs.ip);
-	switch_safe_free(prefs.password);	
+	switch_safe_free(prefs.password);
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -600,25 +618,25 @@
 	listener_t *listener = NULL;
 
 	if (stream->param_event) {
-        http = switch_event_get_header(stream->param_event, "http-host");
+		http = switch_event_get_header(stream->param_event, "http-host");
 		wcmd = switch_event_get_header(stream->param_event, "command");
 		format = switch_event_get_header(stream->param_event, "format");
-    }
+	}
 
 	if (!http) {
 		stream->write_function(stream, "This is a web application!\n");
-        return SWITCH_STATUS_SUCCESS;
+		return SWITCH_STATUS_SUCCESS;
 	}
 	stream->write_function(stream, "Content-Type: text/xml\n\n");
-	
+
 	stream->write_function(stream, "<?xml version=\"1.0\"?>\n");
 	stream->write_function(stream, "<root>\n");
-	
+
 	if (!wcmd) {
 		stream->write_function(stream, "<data><reply type=\"error\">Missing command parameter!</reply></data>\n");
 		goto end;
 	}
-	
+
 	if (!format) {
 		format = "xml";
 	}
@@ -637,15 +655,15 @@
 
 		if (!(listener = find_listener(idl))) {
 			stream->write_function(stream, "<data><reply type=\"error\">Invalid Listen-ID</reply></data>\n");
-            goto end;
+			goto end;
 		}
 
 		if (zstr(action)) {
 			stream->write_function(stream, "<data><reply type=\"error\">Invalid Syntax</reply></data>\n");
-            goto end;
+			goto end;
 		}
 
-		switch_mutex_lock(listener->filter_mutex);		
+		switch_mutex_lock(listener->filter_mutex);
 		if (!listener->filters) {
 			switch_event_create_plain(&listener->filters, SWITCH_EVENT_CHANNEL_DATA);
 		}
@@ -674,7 +692,7 @@
 			stream->write_function(stream, "<data><reply type=\"error\">Invalid Syntax</reply></data>\n");
 		}
 
-	filter_end:
+	  filter_end:
 
 		switch_mutex_unlock(listener->filter_mutex);
 
@@ -688,7 +706,7 @@
 
 		if (!(listener = find_listener(idl))) {
 			stream->write_function(stream, "<data><reply type=\"error\">Invalid Listen-ID</reply></data>\n");
-            goto end;
+			goto end;
 		}
 
 		if (switch_test_flag(listener, LFLAG_LOG)) {
@@ -711,7 +729,7 @@
 
 		if (!(listener = find_listener(idl))) {
 			stream->write_function(stream, "<data><reply type=\"error\">Invalid Listen-ID</reply></data>\n");
-            goto end;
+			goto end;
 		}
 
 		if (loglevel) {
@@ -737,7 +755,7 @@
 		uint32_t count = 0, key_count = 0;
 		uint8_t custom = 0;
 		char *edup;
-		
+
 		if (zstr(events) && zstr(loglevel)) {
 			stream->write_function(stream, "<data><reply type=\"error\">Missing parameter!</reply></data>\n");
 			goto end;
@@ -753,6 +771,7 @@
 		switch_core_hash_init(&listener->event_hash, listener->pool);
 		switch_set_flag(listener, LFLAG_AUTHED);
 		switch_set_flag(listener, LFLAG_STATEFUL);
+		switch_set_flag(listener, LFLAG_ALLOW_LOG);
 		switch_queue_create(&listener->event_queue, SWITCH_CORE_QUEUE_LEN, listener->pool);
 		switch_queue_create(&listener->log_queue, SWITCH_CORE_QUEUE_LEN, listener->pool);
 
@@ -767,7 +786,7 @@
 		listener->id = next_id();
 		listener->timeout = 60;
 		listener->last_flush = switch_epoch_time_now(NULL);
-		
+
 		if (events) {
 			char delim = ',';
 
@@ -776,7 +795,7 @@
 			} else {
 				listener->format = EVENT_FORMAT_PLAIN;
 			}
-			
+
 			edup = strdup(events);
 
 			if (strchr(edup, ' ')) {
@@ -785,7 +804,7 @@
 
 			for (cur = edup; cur; count++) {
 				switch_event_types_t type;
-				
+
 				if ((next = strchr(cur, delim))) {
 					*next++ = '\0';
 				}
@@ -807,11 +826,11 @@
 						custom++;
 					}
 				}
-				
+
 				cur = next;
 			}
-		
 
+
 			switch_safe_free(edup);
 
 			if (!key_count) {
@@ -832,9 +851,9 @@
 		if (globals.debug > 0) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Creating event-sink listener [%u]\n", listener->id);
 		}
-		
+
 		goto end;
-	} else if (!strcasecmp(wcmd, "destroy-listener")) {		
+	} else if (!strcasecmp(wcmd, "destroy-listener")) {
 		char *id = switch_event_get_header(stream->param_event, "listen-id");
 		uint32_t idl = 0;
 
@@ -864,7 +883,7 @@
 		uint32_t idl = 0;
 		void *pop;
 		switch_event_t *pevent = NULL;
-		
+
 		if (id) {
 			idl = (uint32_t) atol(id);
 		}
@@ -875,7 +894,7 @@
 		}
 
 		listener->last_flush = switch_epoch_time_now(NULL);
-		stream->write_function(stream, "<data>\n <reply type=\"success\">Current Events Follow</reply>\n");			
+		stream->write_function(stream, "<data>\n <reply type=\"success\">Current Events Follow</reply>\n");
 		xmlize_listener(listener, stream);
 
 		if (switch_test_flag(listener, LFLAG_LOG)) {
@@ -885,22 +904,16 @@
 				switch_log_node_t *dnode = (switch_log_node_t *) pop;
 				int encode_len = (strlen(dnode->data) * 3) + 1;
 				char *encode_buf = malloc(encode_len);
-				
+
 				switch_assert(encode_buf);
-				
+
 				memset(encode_buf, 0, encode_len);
 				switch_url_encode((char *) dnode->data, encode_buf, encode_len);
-				
 
-				stream->write_function(stream, "<log log-level=\"%d\" text-channel=\"%d\" log-file=\"%s\" log-func=\"%s\" log-line=\"%d\" user-data=\"%s\">%s</log>\n",
-									   dnode->level,
-									   dnode->channel,
-									   dnode->file,
-									   dnode->func,
-									   dnode->line,
-									   switch_str_nil(dnode->userdata),
-									   encode_buf
-									   );
+
+				stream->write_function(stream,
+									   "<log log-level=\"%d\" text-channel=\"%d\" log-file=\"%s\" log-func=\"%s\" log-line=\"%d\" user-data=\"%s\">%s</log>\n",
+									   dnode->level, dnode->channel, dnode->file, dnode->func, dnode->line, switch_str_nil(dnode->userdata), encode_buf);
 				free(encode_buf);
 				switch_log_node_free(&dnode);
 			}
@@ -932,7 +945,7 @@
 
 				stream->write_function(stream, "%s\n", listener->ebuf);
 			}
-			
+
 			switch_safe_free(listener->ebuf);
 			switch_event_destroy(&pevent);
 		}
@@ -948,7 +961,7 @@
 		char *api_command = switch_event_get_header(stream->param_event, "fsapi-command");
 		char *api_args = switch_event_get_header(stream->param_event, "fsapi-args");
 		switch_event_t *event, *oevent;
-		
+
 		if (!(api_command)) {
 			stream->write_function(stream, "<data><reply type=\"error\">INVALID API COMMAND!</reply></data>\n");
 			goto end;
@@ -974,10 +987,10 @@
 		stream->write_function(stream, "<data><reply type=\"error\">INVALID COMMAND!</reply></data\n");
 	}
 
- end:
+  end:
 
 	stream->write_function(stream, "</root>\n\n");
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -998,7 +1011,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
 		return SWITCH_STATUS_GENERR;
 	}
-	
+
 	switch_log_bind_logger(socket_logger, SWITCH_LOG_DEBUG, SWITCH_FALSE);
 
 	/* connect my internal structure to the blank pointer passed to me */
@@ -1045,7 +1058,7 @@
 		mlen = 1;
 
 		status = switch_socket_recv(listener->sock, ptr, &mlen);
-		
+
 		if (prefs.done || (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS)) {
 			return SWITCH_STATUS_FALSE;
 		}
@@ -1084,7 +1097,7 @@
 					}
 					count++;
 					if (count == 1) {
-						switch_event_create(event, SWITCH_EVENT_COMMAND);
+						switch_event_create(event, SWITCH_EVENT_SOCKET_DATA);
 						switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, "Command", mbuf);
 					} else if (cur) {
 						char *var, *val;
@@ -1102,34 +1115,34 @@
 								switch_event_add_header_string(*event, SWITCH_STACK_BOTTOM, var, val);
 								if (!strcasecmp(var, "content-length")) {
 									clen = atoi(val);
-									
+
 									if (clen > 0) {
 										char *body;
 										char *p;
-										
+
 										switch_zmalloc(body, clen + 1);
 
 										p = body;
-										while(clen > 0) {
+										while (clen > 0) {
 											mlen = clen;
-											
+
 											status = switch_socket_recv(listener->sock, p, &mlen);
 
 											if (prefs.done || (!SWITCH_STATUS_IS_BREAK(status) && status != SWITCH_STATUS_SUCCESS)) {
 												return SWITCH_STATUS_FALSE;
 											}
-											
+
 											/*
-											if (channel && !switch_channel_ready(channel)) {
-												status = SWITCH_STATUS_FALSE;
-												break;
-											}
-											*/
+											   if (channel && !switch_channel_ready(channel)) {
+											   status = SWITCH_STATUS_FALSE;
+											   break;
+											   }
+											 */
 
 											clen -= (int) mlen;
 											p += mlen;
 										}
-										
+
 										switch_event_add_body(*event, "%s", body);
 										free(body);
 									}
@@ -1137,13 +1150,13 @@
 							}
 						}
 					}
-					
+
 					cur = next;
 				}
 				break;
 			}
 		}
-		
+
 		if (timeout) {
 			elapsed = (uint32_t) (switch_epoch_time_now(NULL) - start);
 			if (elapsed >= timeout) {
@@ -1156,9 +1169,9 @@
 			if (switch_test_flag(listener, LFLAG_LOG)) {
 				if (switch_queue_trypop(listener->log_queue, &pop) == SWITCH_STATUS_SUCCESS) {
 					switch_log_node_t *dnode = (switch_log_node_t *) pop;
-					
+
 					if (dnode->data) {
-						switch_snprintf(buf, sizeof(buf), 
+						switch_snprintf(buf, sizeof(buf),
 										"Content-Type: log/data\n"
 										"Content-Length: %" SWITCH_SSIZE_T_FMT "\n"
 										"Log-Level: %d\n"
@@ -1169,25 +1182,20 @@
 										"User-Data: %s\n"
 										"\n",
 										strlen(dnode->data),
-										dnode->level,
-										dnode->channel,
-										dnode->file,
-										dnode->func,
-										dnode->line,
-										switch_str_nil(dnode->userdata)
-										);
+										dnode->level, dnode->channel, dnode->file, dnode->func, dnode->line, switch_str_nil(dnode->userdata)
+							);
 						len = strlen(buf);
 						switch_socket_send(listener->sock, buf, &len);
 						len = strlen(dnode->data);
 						switch_socket_send(listener->sock, dnode->data, &len);
 					}
-					
+
 					switch_log_node_free(&dnode);
 					do_sleep = 0;
 				}
 			}
-			
 
+
 			if (listener->session) {
 				switch_channel_t *chan = switch_core_session_get_channel(listener->session);
 				if (switch_channel_get_state(chan) < CS_HANGUP && switch_channel_test_flag(chan, CF_DIVERT_EVENTS)) {
@@ -1206,7 +1214,7 @@
 					char hbuf[512];
 					switch_event_t *pevent = (switch_event_t *) pop;
 					char *etype;
-					
+
 					do_sleep = 0;
 					if (listener->format == EVENT_FORMAT_PLAIN) {
 						etype = "plain";
@@ -1225,7 +1233,7 @@
 					}
 
 					switch_assert(listener->ebuf);
-					
+
 					len = strlen(listener->ebuf);
 
 					switch_snprintf(hbuf, sizeof(hbuf), "Content-Length: %" SWITCH_SSIZE_T_FMT "\n" "Content-Type: text/event-%s\n" "\n", len, etype);
@@ -1235,10 +1243,10 @@
 
 					len = strlen(listener->ebuf);
 					switch_socket_send(listener->sock, listener->ebuf, &len);
-					
+
 					switch_safe_free(listener->ebuf);
 
-				endloop:
+				  endloop:
 
 					switch_event_destroy(&pevent);
 				}
@@ -1251,15 +1259,13 @@
 				char message[128] = "";
 				char disco_buf[512] = "";
 
-				switch_snprintf(message, sizeof(message), 
+				switch_snprintf(message, sizeof(message),
 								"Channel %s has disconnected, lingering by request from remote.\n", switch_channel_get_name(channel));
 				mlen = strlen(message);
 
 				switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\n"
 								"Controlled-Session-UUID: %s\n"
-								"Content-Disposition: linger\n"
-								"Content-Length: %d\n\n", 
-								switch_core_session_get_uuid(listener->session), (int)mlen);
+								"Content-Disposition: linger\n" "Content-Length: %d\n\n", switch_core_session_get_uuid(listener->session), (int) mlen);
 
 				len = strlen(disco_buf);
 				switch_socket_send(listener->sock, disco_buf, &len);
@@ -1270,7 +1276,7 @@
 				break;
 			}
 		}
-		
+
 		if (do_sleep) {
 			switch_cond_next();
 		}
@@ -1287,6 +1293,7 @@
 	char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
 	int bg;
 	int ack;
+	int console_execute;
 	switch_memory_pool_t *pool;
 };
 
@@ -1302,7 +1309,7 @@
 	prefs.threads++;
 	switch_mutex_unlock(globals.listener_mutex);
 
-	
+
 	if (!acs) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Internal error.\n");
 		goto cleanup;
@@ -1314,12 +1321,20 @@
 		acs->ack = -1;
 		goto done;
 	}
-	
+
 	acs->ack = 1;
-	
+
 	SWITCH_STANDARD_STREAM(stream);
-	
-	if ((status = switch_api_execute(acs->api_cmd, acs->arg, NULL, &stream)) == SWITCH_STATUS_SUCCESS) {
+
+	if (acs->console_execute) {
+		if ((status = switch_console_execute(acs->api_cmd, 0, &stream)) != SWITCH_STATUS_SUCCESS) {
+			stream.write_function(&stream, "%s: Command not found!\n", acs->api_cmd);
+		}
+	} else {
+		status = switch_api_execute(acs->api_cmd, acs->arg, NULL, &stream);
+	}
+
+	if (status == SWITCH_STATUS_SUCCESS) {
 		reply = stream.data;
 	} else {
 		freply = switch_mprintf("%s: Command not found!\n", acs->api_cmd);
@@ -1370,19 +1385,20 @@
 		switch_memory_pool_t *pool = acs->pool;
 		if (acs->ack == -1) {
 			int sanity = 2000;
-			while(acs->ack == -1) {
+			while (acs->ack == -1) {
 				switch_cond_next();
-				if (--sanity <= 0) break;
+				if (--sanity <= 0)
+					break;
 			}
 		}
 
 		acs = NULL;
 		switch_core_destroy_memory_pool(&pool);
 		pool = NULL;
-			
+
 	}
 
- cleanup:
+  cleanup:
 	switch_mutex_lock(globals.listener_mutex);
 	prefs.threads--;
 	switch_mutex_unlock(globals.listener_mutex);
@@ -1390,22 +1406,76 @@
 	return NULL;
 
 }
+
+static switch_bool_t auth_api_command(listener_t *listener, const char *api_cmd, const char *arg)
+{
+	const char *check_cmd = api_cmd;
+	char *sneaky_commands[] = { "bgapi", "sched_api", "eval", "expand", NULL };
+	int x = 0;
+	char *dup_arg = NULL;
+	char *next = NULL;
+	switch_bool_t ok = SWITCH_TRUE;
+
+  top:
+
+	if (!switch_core_hash_find(listener->allowed_api_hash, check_cmd)) {
+		ok = SWITCH_FALSE;
+		goto end;
+	}
+
+	while (check_cmd) {
+		for (x = 0; sneaky_commands[x]; x++) {
+			if (!strcasecmp(sneaky_commands[x], check_cmd)) {
+				if (check_cmd == api_cmd) {
+					if (arg) {
+						dup_arg = strdup(arg);
+						check_cmd = dup_arg;
+						if ((next = strchr(check_cmd, ' '))) {
+							*next++ = '\0';
+						}
+					} else {
+						break;
+					}
+				} else {
+					if (next) {
+						check_cmd = next;
+					} else {
+						check_cmd = dup_arg;
+					}
+
+					if ((next = strchr(check_cmd, ' '))) {
+						*next++ = '\0';
+					}
+				}
+				goto top;
+			}
+		}
+		break;
+	}
+
+  end:
+
+	switch_safe_free(dup_arg);
+	return ok;
+
+}
+
 static switch_status_t parse_command(listener_t *listener, switch_event_t **event, char *reply, uint32_t reply_len)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	char *cmd = switch_event_get_header(*event, "command");
 	char unload_cheat[] = "api bgapi unload mod_event_socket";
 	char reload_cheat[] = "api bgapi reload mod_event_socket";
-	
+
 	*reply = '\0';
 
 	if (switch_stristr("unload", cmd) && switch_stristr("mod_event_socket", cmd)) {
 		cmd = unload_cheat;
 	} else if (switch_stristr("reload", cmd) && switch_stristr("mod_event_socket", cmd)) {
 		cmd = reload_cheat;
-	} 
+	}
 
-	if (!strncasecmp(cmd, "exit", 4)) {
+	if (!strncasecmp(cmd, "exit", 4) || !strncasecmp(cmd, "...", 3)) {
 		switch_clear_flag_locked(listener, LFLAG_RUNNING);
 		switch_snprintf(reply, reply_len, "+OK bye");
 		goto done;
@@ -1429,49 +1499,249 @@
 			goto done;
 		}
 
+		if (!strncasecmp(cmd, "userauth ", 9)) {
+			const char *passwd;
+			const char *allowed_api;
+			const char *allowed_events;
+			switch_event_t *params;
+			char *user, *domain_name, *pass;
+			switch_xml_t x_domain = NULL, x_domain_root, x_user = NULL, x_params, x_param, x_group = NULL;
+			int authed = 0;
+			char *edup = NULL;
+			char event_reply[512] = "Allowed-Events: all\n";
+			char api_reply[512] = "Allowed-API: all\n";
+			char log_reply[512] = "";
+			int allowed_log = 1;
+
+
+			switch_clear_flag(listener, LFLAG_ALLOW_LOG);
+
+			strip_cr(cmd);
+
+			user = cmd + 9;
+
+			if ((pass = strchr(user, ':'))) {
+				*pass++ = '\0';
+			}
+
+			if ((domain_name = strchr(user, '@'))) {
+				*domain_name++ = '\0';
+			}
+
+			if (zstr(user) || zstr(domain_name)) {
+				switch_snprintf(reply, reply_len, "-ERR invalid");
+				switch_clear_flag_locked(listener, LFLAG_RUNNING);
+				goto done;
+			}
+
+
+			passwd = NULL;
+			allowed_events = NULL;
+			allowed_api = NULL;
+
+			params = NULL;
+			x_domain_root = NULL;
+
+
+			switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS);
+			switch_assert(params);
+			switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "action", "event_socket_auth");
+
+			if (switch_xml_locate_user("id", user, domain_name, NULL, &x_domain_root, &x_domain, &x_user, &x_group, params) == SWITCH_STATUS_SUCCESS) {
+				switch_xml_t list[3];
+				int x = 0;
+
+				list[0] = x_domain;
+				list[1] = x_group;
+				list[2] = x_user;
+
+				for (x = 0; x < 3; x++) {
+					if ((x_params = switch_xml_child(list[x], "params"))) {
+						for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
+							const char *var = switch_xml_attr_soft(x_param, "name");
+							const char *val = switch_xml_attr_soft(x_param, "value");
+
+							if (!strcasecmp(var, "esl-password")) {
+								passwd = val;
+							} else if (!strcasecmp(var, "esl-allowed-log")) {
+								allowed_log = switch_true(val);
+							} else if (!strcasecmp(var, "esl-allowed-events")) {
+								allowed_events = val;
+							} else if (!strcasecmp(var, "esl-allowed-api")) {
+								allowed_api = val;
+							}
+						}
+					}
+				}
+			} else {
+				authed = 0;
+				goto bot;
+			}
+
+			if (!zstr(passwd) && !zstr(pass) && !strcmp(passwd, pass)) {
+				authed = 1;
+
+				if (allowed_events) {
+					char delim = ',';
+					char *cur, *next;
+					int count = 0, custom = 0, key_count = 0;
+
+					switch_set_flag(listener, LFLAG_AUTH_EVENTS);
+
+					switch_snprintf(event_reply, sizeof(event_reply), "Allowed-Events: %s\n", allowed_events);
+
+					switch_core_hash_init(&listener->allowed_event_hash, listener->pool);
+
+					edup = strdup(allowed_events);
+					cur = edup;
+
+					if (strchr(edup, ' ')) {
+						delim = ' ';
+					}
+
+					for (cur = edup; cur; count++) {
+						switch_event_types_t type;
+
+						if ((next = strchr(cur, delim))) {
+							*next++ = '\0';
+						}
+
+						if (custom) {
+							switch_core_hash_insert(listener->allowed_event_hash, cur, MARKER);
+						} else if (switch_name_event(cur, &type) == SWITCH_STATUS_SUCCESS) {
+							key_count++;
+							if (type == SWITCH_EVENT_ALL) {
+								uint32_t x = 0;
+								switch_set_flag(listener, LFLAG_ALL_EVENTS_AUTHED);
+								for (x = 0; x < SWITCH_EVENT_ALL; x++) {
+									listener->allowed_event_list[x] = 1;
+								}
+							}
+							if (type <= SWITCH_EVENT_ALL) {
+								listener->allowed_event_list[type] = 1;
+							}
+
+							if (type == SWITCH_EVENT_CUSTOM) {
+								custom++;
+							}
+						}
+
+						cur = next;
+					}
+
+					switch_safe_free(edup);
+				}
+
+				switch_snprintf(log_reply, sizeof(log_reply), "Allowed-LOG: %s\n", allowed_log ? "true" : "false");
+
+				if (allowed_log) {
+					switch_set_flag(listener, LFLAG_ALLOW_LOG);
+				}
+
+				if (allowed_api) {
+					char delim = ',';
+					char *cur, *next;
+					int count = 0;
+
+					switch_snprintf(api_reply, sizeof(api_reply), "Allowed-API: %s\n", allowed_api);
+
+					switch_core_hash_init(&listener->allowed_api_hash, listener->pool);
+
+					edup = strdup(allowed_api);
+					cur = edup;
+
+					if (strchr(edup, ' ')) {
+						delim = ' ';
+					}
+
+					for (cur = edup; cur; count++) {
+						if ((next = strchr(cur, delim))) {
+							*next++ = '\0';
+						}
+
+						switch_core_hash_insert(listener->allowed_api_hash, cur, MARKER);
+
+						cur = next;
+					}
+
+					switch_safe_free(edup);
+				}
+
+			}
+
+
+		  bot:
+
+			if (params) {
+				switch_event_destroy(&params);
+			}
+
+			if (authed) {
+				switch_set_flag_locked(listener, LFLAG_AUTHED);
+				switch_snprintf(reply, reply_len, "~Reply-Text: +OK accepted\n%s%s%s\n", event_reply, api_reply, log_reply);
+			} else {
+				switch_snprintf(reply, reply_len, "-ERR invalid");
+				switch_clear_flag_locked(listener, LFLAG_RUNNING);
+			}
+
+			if (x_domain_root) {
+				switch_xml_free(x_domain_root);
+			}
+
+		}
+
 		goto done;
 	}
 
 	if (!strncasecmp(cmd, "filter ", 7)) {
 		char *header_name = cmd + 7;
-		char *header_val;
+		char *header_val = NULL;
 
 		strip_cr(header_name);
 
-		while(header_name && *header_name && *header_name == ' ') header_name++;
-		
-		if (!(header_val = strchr(header_name, ' '))) {
-			switch_snprintf(reply, reply_len, "-ERR invalid syntax");
-			goto done;
+		while (header_name && *header_name && *header_name == ' ')
+			header_name++;
+
+		if ((header_val = strchr(header_name, ' '))) {
+			*header_val++ = '\0';
 		}
 
-		*header_val++ = '\0';
-
-
-		switch_mutex_lock(listener->filter_mutex);		
+		switch_mutex_lock(listener->filter_mutex);
 		if (!listener->filters) {
 			switch_event_create_plain(&listener->filters, SWITCH_EVENT_CHANNEL_DATA);
 		}
-		
-		if (!strcasecmp(header_name, "delete")) {
-			if (!strcasecmp(header_val, "all")) {
+
+		if (!strcasecmp(header_name, "delete") && header_val) {
+			header_name = header_val;
+			if ((header_val = strchr(header_name, ' '))) {
+				*header_val++ = '\0';
+			}
+			if (!strcasecmp(header_name, "all")) {
 				switch_event_destroy(&listener->filters);
 				switch_event_create_plain(&listener->filters, SWITCH_EVENT_CHANNEL_DATA);
 			} else {
-				switch_event_del_header(listener->filters, header_val);
+				switch_event_del_header_val(listener->filters, header_name, header_val);
 			}
-			switch_snprintf(reply, reply_len, "+OK filter deleted. [%s]", header_val);
-		} else {
+			switch_snprintf(reply, reply_len, "+OK filter deleted. [%s][%s]", header_name, switch_str_nil(header_val));
+		} else if (header_val) {
+			if (!strcasecmp(header_name, "add")) {
+				header_name = header_val;
+				if ((header_val = strchr(header_name, ' '))) {
+					*header_val++ = '\0';
+				}
+			}
 			switch_event_add_header_string(listener->filters, SWITCH_STACK_BOTTOM, header_name, header_val);
 			switch_snprintf(reply, reply_len, "+OK filter added. [%s]=[%s]", header_name, header_val);
+		} else {
+			switch_snprintf(reply, reply_len, "-ERR invalid syntax");
 		}
 		switch_mutex_unlock(listener->filter_mutex);
 
 		goto done;
 	}
-	
+
 	if (listener->session && !strncasecmp(cmd, "resume", 6)) {
-		switch_set_flag_locked(listener, LFLAG_RESUME);			
+		switch_set_flag_locked(listener, LFLAG_RESUME);
 		switch_channel_set_variable(switch_core_session_get_channel(listener->session), "socket_resume", "true");
 		switch_snprintf(reply, reply_len, "+OK");
 		goto done;
@@ -1489,9 +1759,9 @@
 			char *event_str;
 			switch_size_t len;
 
-			switch_set_flag_locked(listener, LFLAG_CONNECTED);			
+			switch_set_flag_locked(listener, LFLAG_CONNECTED);
 			switch_event_create(&call_event, SWITCH_EVENT_CHANNEL_DATA);
-			
+
 			if (channel) {
 				switch_caller_profile_event_set_data(switch_channel_get_caller_profile(channel), "Channel", call_event);
 				switch_channel_event_set_data(channel, call_event);
@@ -1532,10 +1802,10 @@
 
 			if (!listener->session) {
 				char *uuid;
-				
+
 				if ((uuid = cmd + 9)) {
 					strip_cr(uuid);
-					
+
 					if (!(listener->session = switch_core_session_locate(uuid))) {
 						switch_snprintf(reply, reply_len, "-ERR invalid uuid");
 						goto done;
@@ -1544,8 +1814,8 @@
 					switch_set_flag_locked(listener, LFLAG_SESSION);
 					switch_set_flag_locked(listener, LFLAG_ASYNC);
 				}
-				
 
+
 			}
 
 			listener->event_list[SWITCH_EVENT_CHANNEL_ANSWER] = 1;
@@ -1585,19 +1855,19 @@
 	if (!strncasecmp(cmd, "divert_events", 13)) {
 		char *onoff = cmd + 13;
 		switch_channel_t *channel;
-		
+
 		if (!listener->session) {
 			switch_snprintf(reply, reply_len, "-ERR not controlling a session.");
 			goto done;
 		}
 
 		channel = switch_core_session_get_channel(listener->session);
-		
+
 		if (onoff) {
-			while(*onoff == ' ') {
+			while (*onoff == ' ') {
 				onoff++;
 			}
-			
+
 			if (*onoff == '\r' || *onoff == '\n') {
 				onoff = NULL;
 			} else {
@@ -1610,7 +1880,7 @@
 			goto done;
 		}
 
-		
+
 		if (!strcasecmp(onoff, "on")) {
 			switch_snprintf(reply, reply_len, "+OK events diverted");
 			switch_channel_set_flag(channel, CF_DIVERT_EVENTS);
@@ -1628,11 +1898,11 @@
 		char *uuid = cmd + 7;
 		const char *async_var = switch_event_get_header(*event, "async");
 		int async = switch_test_flag(listener, LFLAG_ASYNC);
-		
+
 		if (switch_true(async_var)) {
 			async = 1;
 		}
-		
+
 		if (uuid) {
 			while (*uuid == ' ') {
 				uuid++;
@@ -1644,7 +1914,7 @@
 				strip_cr(uuid);
 			}
 		}
-		
+
 		if (zstr(uuid)) {
 			uuid = switch_event_get_header(*event, "session-id");
 		}
@@ -1655,7 +1925,7 @@
 
 		if (zstr(uuid) && listener->session) {
 			if (async) {
-				if ((status = switch_core_session_queue_private_event(listener->session, event)) == SWITCH_STATUS_SUCCESS) {
+				if ((status = switch_core_session_queue_private_event(listener->session, event, SWITCH_FALSE)) == SWITCH_STATUS_SUCCESS) {
 					switch_snprintf(reply, reply_len, "+OK");
 				} else {
 					switch_snprintf(reply, reply_len, "-ERR memory error");
@@ -1666,7 +1936,7 @@
 			}
 		} else {
 			if (!zstr(uuid) && (session = switch_core_session_locate(uuid))) {
-				if ((status = switch_core_session_queue_private_event(session, event)) == SWITCH_STATUS_SUCCESS) {
+				if ((status = switch_core_session_queue_private_event(session, event, SWITCH_FALSE)) == SWITCH_STATUS_SUCCESS) {
 					switch_snprintf(reply, reply_len, "+OK");
 				} else {
 					switch_snprintf(reply, reply_len, "-ERR memory error");
@@ -1676,11 +1946,11 @@
 				switch_snprintf(reply, reply_len, "-ERR invalid session id [%s]", switch_str_nil(uuid));
 			}
 		}
-		
+
 		goto done;
 
 	}
-	
+
 	if (switch_test_flag(listener, LFLAG_OUTBOUND) && !switch_test_flag(listener, LFLAG_FULL)) {
 		goto done;
 	}
@@ -1721,7 +1991,7 @@
 				switch_core_session_rwunlock(dsession);
 			}
 		}
-		
+
 		if (*event) {
 			switch_event_fire(event);
 		}
@@ -1729,19 +1999,33 @@
 		goto done;
 	} else if (!strncasecmp(cmd, "api ", 4)) {
 		struct api_command_struct acs = { 0 };
+		char *console_execute = switch_event_get_header(*event, "console_execute");
+
 		char *api_cmd = cmd + 4;
 		char *arg = NULL;
 		strip_cr(api_cmd);
 
-		if ((arg = strchr(api_cmd, ' '))) {
-			*arg++ = '\0';
+		if (!(acs.console_execute = switch_true(console_execute))) {
+			if ((arg = strchr(api_cmd, ' '))) {
+				*arg++ = '\0';
+			}
 		}
 
+		if (listener->allowed_api_hash) {
+			if (!auth_api_command(listener, api_cmd, arg)) {
+				switch_snprintf(reply, reply_len, "-ERR permission denied");
+				status = SWITCH_STATUS_SUCCESS;
+				goto done;
+			}
+		}
+
+
 		acs.listener = listener;
 		acs.api_cmd = api_cmd;
 		acs.arg = arg;
 		acs.bg = 0;
 
+
 		api_exec(NULL, (void *) &acs);
 
 		status = SWITCH_STATUS_SUCCESS;
@@ -1763,11 +2047,21 @@
 			*arg++ = '\0';
 		}
 
+		if (listener->allowed_api_hash) {
+			if (!auth_api_command(listener, api_cmd, arg)) {
+				switch_snprintf(reply, reply_len, "-ERR permission denied");
+				status = SWITCH_STATUS_SUCCESS;
+				goto done;
+			}
+		}
+
 		switch_core_new_memory_pool(&pool);
 		acs = switch_core_alloc(pool, sizeof(*acs));
 		switch_assert(acs);
 		acs->pool = pool;
 		acs->listener = listener;
+		acs->console_execute = 0;
+
 		if (api_cmd) {
 			acs->api_cmd = switch_core_strdup(acs->pool, api_cmd);
 		}
@@ -1789,9 +2083,10 @@
 		switch_snprintf(reply, reply_len, "~Reply-Text: +OK Job-UUID: %s\nJob-UUID: %s\n\n", acs->uuid_str, acs->uuid_str);
 		switch_thread_create(&thread, thd_attr, api_exec, acs, acs->pool);
 		sanity = 2000;
-		while(!acs->ack) {
+		while (!acs->ack) {
 			switch_cond_next();
-			if (--sanity <= 0) break;
+			if (--sanity <= 0)
+				break;
 		}
 		if (acs->ack == -1) {
 			acs->ack--;
@@ -1804,6 +2099,10 @@
 		char *level_s;
 		switch_log_level_t ltype = SWITCH_LOG_DEBUG;
 
+		if (!switch_test_flag(listener, LFLAG_ALLOW_LOG)) {
+			switch_snprintf(reply, reply_len, "-ERR permission denied");
+			goto done;
+		}
 		//pull off the first newline/carriage return
 		strip_cr(cmd);
 
@@ -1875,9 +2174,21 @@
 					}
 				}
 
+
 				if (custom) {
-					switch_core_hash_insert(listener->event_hash, cur, MARKER);
+					if (!listener->allowed_event_hash || switch_core_hash_find(listener->allowed_event_hash, cur)) {
+						switch_core_hash_insert(listener->event_hash, cur, MARKER);
+					} else {
+						switch_snprintf(reply, reply_len, "-ERR permission denied");
+						goto done;
+					}
 				} else if (switch_name_event(cur, &type) == SWITCH_STATUS_SUCCESS) {
+					if (switch_test_flag(listener, LFLAG_AUTH_EVENTS) && !listener->allowed_event_list[type] &&
+						!switch_test_flag(listener, LFLAG_ALL_EVENTS_AUTHED)) {
+						switch_snprintf(reply, reply_len, "-ERR permission denied");
+						goto done;
+					}
+
 					key_count++;
 					if (type == SWITCH_EVENT_ALL) {
 						uint32_t x = 0;
@@ -1981,13 +2292,13 @@
 		}
 	}
 
- done:
+  done:
 
 	if (zstr(reply)) {
 		switch_snprintf(reply, reply_len, "-ERR command not found");
 	}
 
- done_noreply:
+  done_noreply:
 
 	if (event) {
 		switch_event_destroy(event);
@@ -2012,11 +2323,10 @@
 	switch_mutex_lock(globals.listener_mutex);
 	prefs.threads++;
 	switch_mutex_unlock(globals.listener_mutex);
-	
+
 	switch_assert(listener != NULL);
-	
+
 	if ((session = listener->session)) {
-		channel = switch_core_session_get_channel(session);
 		if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) {
 			goto done;
 		}
@@ -2033,7 +2343,8 @@
 				const char message[] = "Access Denied, go away.\n";
 				int mlen = strlen(message);
 
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "IP %s Rejected by acl \"%s\"\n", listener->remote_ip, prefs.acl[x]);
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "IP %s Rejected by acl \"%s\"\n", listener->remote_ip,
+								  prefs.acl[x]);
 
 				switch_snprintf(buf, sizeof(buf), "Content-Type: text/rude-rejection\nContent-Length: %d\n\n", mlen);
 				len = strlen(buf);
@@ -2044,12 +2355,13 @@
 			}
 		}
 	}
-	
+
 	if (globals.debug > 0) {
 		if (zstr(listener->remote_ip)) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Connection Open\n");
 		} else {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Connection Open from %s:%d\n", listener->remote_ip, listener->remote_port);
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Connection Open from %s:%d\n", listener->remote_ip,
+							  listener->remote_port);
 		}
 	}
 
@@ -2059,7 +2371,7 @@
 
 	if (session && switch_test_flag(listener, LFLAG_AUTHED)) {
 		switch_event_t *ievent = NULL;
-		
+
 		switch_set_flag_locked(listener, LFLAG_SESSION);
 		status = read_packet(listener, &ievent, 25);
 
@@ -2068,8 +2380,8 @@
 			switch_clear_flag_locked(listener, LFLAG_RUNNING);
 			goto done;
 		}
-		
 
+
 		if (parse_command(listener, &ievent, reply, sizeof(reply)) != SWITCH_STATUS_SUCCESS) {
 			switch_clear_flag_locked(listener, LFLAG_RUNNING);
 			goto done;
@@ -2143,11 +2455,11 @@
 	}
 
   done:
-	
+
 	if (revent) {
 		switch_event_destroy(&revent);
 	}
-	
+
 	remove_listener(listener);
 
 	if (globals.debug > 0) {
@@ -2162,22 +2474,23 @@
 	}
 	switch_mutex_unlock(listener->filter_mutex);
 
-	if (listener->session && (switch_test_flag(listener, LFLAG_RESUME) || 
-							  ((var = switch_channel_get_variable(channel, "socket_resume")) && switch_true(var)))) {
+	if (listener->session) {
 		channel = switch_core_session_get_channel(listener->session);
+	}
+
+	if (channel && (switch_test_flag(listener, LFLAG_RESUME) || ((var = switch_channel_get_variable(channel, "socket_resume")) && switch_true(var)))) {
 		switch_channel_set_state(channel, CS_RESET);
 	}
+
 	if (listener->sock) {
 		char disco_buf[512] = "";
 		const char message[] = "Disconnected, goodbye.\nSee you at ClueCon! http://www.cluecon.com/\n";
 		int mlen = strlen(message);
-		
+
 		if (listener->session) {
 			switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\n"
 							"Controlled-Session-UUID: %s\n"
-							"Content-Disposition: disconnect\n"
-							"Content-Length: %d\n\n", 
-							switch_core_session_get_uuid(listener->session), mlen);
+							"Content-Disposition: disconnect\n" "Content-Length: %d\n\n", switch_core_session_get_uuid(listener->session), mlen);
 		} else {
 			switch_snprintf(disco_buf, sizeof(disco_buf), "Content-Type: text/disconnect-notice\nContent-Length: %d\n\n", mlen);
 		}
@@ -2197,6 +2510,14 @@
 
 	switch_core_hash_destroy(&listener->event_hash);
 
+	if (listener->allowed_event_hash) {
+		switch_core_hash_destroy(&listener->allowed_event_hash);
+	}
+
+	if (listener->allowed_api_hash) {
+		switch_core_hash_destroy(&listener->allowed_api_hash);
+	}
+
 	if (listener->session) {
 		switch_channel_clear_flag(switch_core_session_get_channel(listener->session), CF_CONTROLLED);
 		switch_clear_flag_locked(listener, LFLAG_SESSION);
@@ -2306,7 +2627,7 @@
 
 	config();
 
-	while(!prefs.done) {
+	while (!prefs.done) {
 		rv = switch_sockaddr_info_get(&sa, prefs.ip, SWITCH_INET, prefs.port, 0, pool);
 		if (rv)
 			goto fail;
@@ -2337,13 +2658,13 @@
 	listen_list.ready = 1;
 
 
-	while(!prefs.done) {
+	while (!prefs.done) {
 		if (switch_core_new_memory_pool(&listener_pool) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "OH OH no pool\n");
 			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");
@@ -2359,7 +2680,7 @@
 			errs = 0;
 		}
 
-		
+
 		if (!(listener = switch_core_alloc(listener_pool, sizeof(*listener)))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error\n");
 			break;
@@ -2374,6 +2695,8 @@
 		listener_pool = NULL;
 		listener->format = EVENT_FORMAT_PLAIN;
 		switch_set_flag(listener, LFLAG_FULL);
+		switch_set_flag(listener, LFLAG_ALLOW_LOG);
+
 		switch_mutex_init(&listener->flag_mutex, SWITCH_MUTEX_NESTED, listener->pool);
 		switch_mutex_init(&listener->filter_mutex, SWITCH_MUTEX_NESTED, listener->pool);
 
@@ -2385,10 +2708,10 @@
 
 	}
 
- end:
+  end:
 
 	close_socket(&listen_list.sock);
-	
+
 	if (prefs.nat_map && switch_core_get_variable("nat_type")) {
 		switch_nat_del_mapping(prefs.port, SWITCH_NAT_TCP);
 	}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_event_test/mod_event_test.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_event_test/mod_event_test.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_event_test/mod_event_test.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_radius_cdr/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_radius_cdr/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_radius_cdr/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,7 +1,8 @@
 RADCLIENT_VERSION=1.1.6
 RADCLIENT=freeradius-client-$(RADCLIENT_VERSION)
 RADCLIENT_DIR=$(switch_srcdir)/libs/$(RADCLIENT)
-RADCLIENT_LIBDIR=$(RADCLIENT_DIR)/lib
+RADCLIENT_BUILDDIR=$(switch_builddir)/libs/$(RADCLIENT)
+RADCLIENT_LIBDIR=$(RADCLIENT_BUILDDIR)/lib
 RADCLIENT_LA=${RADCLIENT_LIBDIR}/libfreeradius-client.la
 
 LOCAL_CFLAGS=-I$(RADCLIENT_DIR)/include
@@ -13,12 +14,13 @@
 $(RADCLIENT_DIR):
 	$(GETLIB) $(RADCLIENT).tar.gz
 
-$(RADCLIENT_DIR)/Makefile: $(RADCLIENT_DIR)
-	cd $(RADCLIENT_DIR) && ./configure --disable-shared --with-pic
+$(RADCLIENT_BUILDDIR)/Makefile: $(RADCLIENT_DIR)
+	mkdir -p $(RADCLIENT_BUILDDIR)
+	cd $(RADCLIENT_BUILDDIR) && $(DEFAULT_VARS) $(RADCLIENT_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(RADCLIENT_DIR)
 	$(TOUCH_TARGET)
 
-$(RADCLIENT_LA): $(RADCLIENT_DIR)/Makefile
-	cd $(RADCLIENT_DIR) && CFLAGS=$(CFLAGS) $(MAKE)
+$(RADCLIENT_LA): $(RADCLIENT_BUILDDIR)/Makefile
+	cd $(RADCLIENT_BUILDDIR) && CFLAGS="$(CFLAGS)" $(MAKE)
 	$(TOUCH_TARGET)
 
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -42,7 +42,8 @@
 static struct {
 	int shutdown;
 	switch_thread_rwlock_t *rwlock;
-} globals = { 0 };
+} globals = {
+0};
 
 static char cf[] = "mod_radius_cdr.conf";
 static char my_dictionary[PATH_MAX];
@@ -346,9 +347,7 @@
 				}
 			}
 
-			if (profile->caller_extension && 
-				profile->caller_extension->last_application && 
-				profile->caller_extension->last_application->application_name) {
+			if (profile->caller_extension && profile->caller_extension->last_application && profile->caller_extension->last_application->application_name) {
 				if (rc_avpair_add(rad_config, &send, PW_FS_LASTAPP,
 								  (void *) profile->caller_extension->last_application->application_name, -1, PW_FS_PEC) == NULL) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Lastapp: %s\n", profile->source);
@@ -369,8 +368,8 @@
 		retval = SWITCH_STATUS_TERM;
 	}
 	rc_avpair_free(send);
-        rc_destroy(rad_config);
- end:
+	rc_destroy(rad_config);
+  end:
 	switch_xml_free(cdr);
 	switch_thread_rwlock_unlock(globals.rwlock);
 	return (retval);
@@ -562,8 +561,7 @@
 					goto end;
 				}
 			}
-			if (profile->caller_extension && profile->caller_extension->last_application && 
-			    profile->caller_extension->last_application->application_name) {
+			if (profile->caller_extension && profile->caller_extension->last_application && profile->caller_extension->last_application->application_name) {
 				if (rc_avpair_add(rad_config, &send, PW_FS_LASTAPP,
 								  (void *) profile->caller_extension->last_application->application_name, -1, PW_FS_PEC) == NULL) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Lastapp: %s\n", profile->source);
@@ -643,9 +641,9 @@
 		retval = SWITCH_STATUS_TERM;
 	}
 	rc_avpair_free(send);
-        rc_destroy(rad_config);
+	rc_destroy(rad_config);
 
- end:
+  end:
 	switch_xml_free(cdr);
 	switch_thread_rwlock_unlock(globals.rwlock);
 	return (retval);
@@ -718,11 +716,11 @@
 	/*.on_hangup */ NULL,
 	/*.on_exchange_media */ NULL,
 	/*.on_soft_execute */ NULL,
-	/*.on_consume_media*/ NULL,
-	/*.on_hibernate*/ NULL,
-	/*.on_reset*/ NULL,
-	/*.on_park*/ NULL,
-	/*.on_reporting*/ my_on_reporting
+	/*.on_consume_media */ NULL,
+	/*.on_hibernate */ NULL,
+	/*.on_reset */ NULL,
+	/*.on_park */ NULL,
+	/*.on_reporting */ my_on_reporting
 };
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_radius_cdr_load)

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
mod_rtp_stream
mod_rtp_stream.tgz

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_file_string/mod_file_string.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_file_string/mod_file_string.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_file_string/mod_file_string.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -60,9 +60,13 @@
 static int next_file(switch_file_handle_t *handle)
 {
 	file_string_context_t *context = handle->private_info;
+	char *file;
+	const char *prefix = handle->prefix;
 
+  top:
+
 	context->index++;
-	
+
 	if (switch_test_flag((&context->fh), SWITCH_FILE_OPEN)) {
 		switch_core_file_close(&context->fh);
 	}
@@ -71,14 +75,24 @@
 		return 0;
 	}
 
+
+	if (!prefix) {
+		if (!(prefix = switch_core_get_variable("sound_prefix"))) {
+			prefix = SWITCH_GLOBAL_dirs.sounds_dir;
+		}
+	}
+
+	if (!prefix || switch_is_file_path(context->argv[context->index])) {
+		file = context->argv[context->index];
+	} else {
+		file = switch_core_sprintf(handle->memory_pool, "%s%s%s", prefix, SWITCH_PATH_SEPARATOR, context->argv[context->index]);
+	}
+
 	if (switch_core_file_open(&context->fh,
-							  context->argv[context->index],
-							  handle->channels,
-							  handle->samplerate,
-							  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
-		return 0;
+							  file, handle->channels, handle->samplerate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
+		goto top;
 	}
-	
+
 	handle->samples = context->fh.samples;
 	handle->samplerate = context->fh.samplerate;
 	handle->channels = context->fh.channels;
@@ -105,15 +119,15 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This format does not support writing!\n");
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	context = switch_core_alloc(handle->memory_pool, sizeof(*context));
-	
+
 	file_dup = switch_core_strdup(handle->memory_pool, path);
 	context->argc = switch_separate_string(file_dup, '!', context->argv, (sizeof(context->argv) / sizeof(context->argv[0])));
 	context->index = -1;
-	
+
 	handle->private_info = context;
-	
+
 	return next_file(handle) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
 }
 
@@ -133,17 +147,17 @@
 	size_t llen = *len;
 
 	if (context->samples > 0) {
-		if (*len > (size_t)context->samples) {
+		if (*len > (size_t) context->samples) {
 			*len = context->samples;
 		}
-		
+
 		context->samples -= *len;
 		switch_generate_sln_silence((int16_t *) data, *len, 400);
 		status = SWITCH_STATUS_SUCCESS;
 	} else {
 		status = switch_core_file_read(&context->fh, data, len);
 	}
-	
+
 	if (status != SWITCH_STATUS_SUCCESS) {
 		if (!next_file(handle)) {
 			return SWITCH_STATUS_FALSE;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_local_stream/mod_local_stream.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_local_stream/mod_local_stream.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_local_stream/mod_local_stream.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -137,7 +137,7 @@
 	}
 
 	switch_thread_rwlock_create(&source->rwlock, source->pool);
-	
+
 	if (RUNNING) {
 		switch_mutex_lock(globals.mutex);
 		switch_core_hash_insert(globals.source_hash, source->name, source);
@@ -156,7 +156,7 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error creating pool");
 			goto done;
 		}
-		
+
 		if (switch_dir_open(&source->dir_handle, source->location, temp_pool) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't open directory: %s\n", source->location);
 			goto done;
@@ -203,7 +203,7 @@
 			fname = path_buf;
 			fh.prebuf = source->prebuf;
 			fh.pre_buffer_datalen = source->prebuf;
-			
+
 			if (switch_core_file_open(&fh,
 									  (char *) fname,
 									  source->channels, source->rate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
@@ -211,7 +211,7 @@
 				switch_yield(1000000);
 				continue;
 			}
-			
+
 			if (switch_core_timer_init(&timer, source->timer_name, source->interval, source->samples, temp_pool) != SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't start timer.\n");
 				switch_dir_close(source->dir_handle);
@@ -231,10 +231,10 @@
 					if (source->chime_counter > 0) {
 						source->chime_counter -= source->samples;
 					}
-					
+
 					if (!switch_test_flag((&source->chime_fh), SWITCH_FILE_OPEN) && source->chime_counter <= 0) {
 						char *val;
-						
+
 						val = source->chime_list[source->chime_cur++];
 
 						if (source->chime_cur >= source->chime_total) {
@@ -243,9 +243,8 @@
 
 						if (switch_core_file_open(&source->chime_fh,
 												  (char *) val,
-												  source->channels, 
-												  source->rate, 
-												  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
+												  source->channels,
+												  source->rate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't open %s\n", val);
 						}
 					}
@@ -255,7 +254,7 @@
 					}
 				}
 
-			retry:
+			  retry:
 
 				is_open = switch_test_flag(use_fh, SWITCH_FILE_OPEN);
 
@@ -287,7 +286,7 @@
 				if (!used && !is_open) {
 					break;
 				}
-				
+
 				if (!is_open || used >= source->prebuf || (source->total && used > source->samples * 2)) {
 					used = switch_buffer_read(audio_buffer, dist_buf, source->samples * 2);
 					if (source->total) {
@@ -322,7 +321,7 @@
 		source->dir_handle = NULL;
 	}
 
- done:
+  done:
 
 	if (switch_test_flag((&fh), SWITCH_FILE_OPEN)) {
 		switch_core_file_close(&fh);
@@ -339,7 +338,7 @@
 
 	switch_thread_rwlock_wrlock(source->rwlock);
 	switch_thread_rwlock_unlock(source->rwlock);
-	
+
 	switch_buffer_destroy(&audio_buffer);
 
 	if (fd > -1) {
@@ -376,7 +375,7 @@
 
 	switch_mutex_lock(globals.mutex);
 
- top:
+  top:
 
 	alt_path = switch_mprintf("%s/%d", path, handle->samplerate);
 
@@ -439,7 +438,7 @@
 	source->total++;
 	switch_mutex_unlock(source->mutex);
 
- end:
+  end:
 	switch_safe_free(alt_path);
 	return status;
 }
@@ -464,7 +463,7 @@
 	switch_mutex_unlock(context->source->mutex);
 	switch_buffer_destroy(&context->audio_buffer);
 	switch_thread_rwlock_unlock(context->source->rwlock);
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -546,7 +545,7 @@
 
 			if (!strcasecmp(var, "rate")) {
 				int tmp = atoi(val);
-				if (tmp == 8000 || tmp == 16000 || tmp == 32000 || tmp == 48000) {
+				if (tmp == 8000 || tmp == 12000 || tmp == 16000 || tmp == 24000 || tmp == 32000 || tmp == 48000) {
 					source->rate = tmp;
 				}
 			} else if (!strcasecmp(var, "shuffle")) {
@@ -573,7 +572,8 @@
 				}
 			} else if (!strcasecmp(var, "chime-list")) {
 				char *list_dup = switch_core_strdup(source->pool, val);
-				source->chime_total = switch_separate_string(list_dup, ',', source->chime_list, (sizeof(source->chime_list) / sizeof(source->chime_list[0])));
+				source->chime_total =
+					switch_separate_string(list_dup, ',', source->chime_list, (sizeof(source->chime_list) / sizeof(source->chime_list[0])));
 			} else if (!strcasecmp(var, "interval")) {
 				int tmp = atoi(val);
 				if (SWITCH_ACCEPTABLE_INTERVAL(tmp)) {
@@ -644,19 +644,19 @@
 	switch_mutex_unlock(globals.mutex);
 
 	if (!source) {
-		stream->write_function(stream, "-ERR Cannot locate local_stream %s!\n",local_stream_name);
+		stream->write_function(stream, "-ERR Cannot locate local_stream %s!\n", local_stream_name);
 		goto done;
 	}
 
 	source->stopped = 1;
-	stream->write_function(stream,"+OK");
+	stream->write_function(stream, "+OK");
 	goto done;
 
- usage:
+  usage:
 	stream->write_function(stream, "-USAGE: %s\n", STOP_LOCAL_STREAM_SYNTAX);
 	switch_safe_free(mycmd);
 
- done:
+  done:
 
 	switch_safe_free(mycmd);
 	return SWITCH_STATUS_SUCCESS;
@@ -694,7 +694,7 @@
 				xml = SWITCH_TRUE;
 			}
 		}
-		
+
 		if (!local_stream_name) {
 			goto usage;
 		}
@@ -730,18 +730,18 @@
 				stream->write_function(stream, "  stopped:  %s\n", (source->stopped) ? "true" : "false");
 			}
 		} else {
-			stream->write_function(stream, "-ERR Cannot locate local_stream %s!\n",local_stream_name);
+			stream->write_function(stream, "-ERR Cannot locate local_stream %s!\n", local_stream_name);
 			goto done;
 		}
 	}
 
-	stream->write_function(stream,"+OK");
+	stream->write_function(stream, "+OK");
 	goto done;
 
- usage:
+  usage:
 	stream->write_function(stream, "-USAGE: %s\n", SHOW_LOCAL_STREAM_SYNTAX);
 
- done:
+  done:
 
 	switch_mutex_unlock(globals.mutex);
 	switch_safe_free(mycmd);
@@ -796,29 +796,28 @@
 	if (argv[5]) {
 		tmp = atoi(argv[5]);
 		if (tmp == 1 || tmp == 2) {
-			channels = (uint8_t)tmp;
+			channels = (uint8_t) tmp;
 		}
 	}
 
 	interval = argv[6] ? atoi(argv[6]) : 20;
-	
-	if (!SWITCH_ACCEPTABLE_INTERVAL(interval)){
+
+	if (!SWITCH_ACCEPTABLE_INTERVAL(interval)) {
 		interval = 20;
 	}
 
-	if (!path){
+	if (!path) {
 		if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
-			stream->write_function(stream, "-ERR unable to open file %s!\n",cf);
+			stream->write_function(stream, "-ERR unable to open file %s!\n", cf);
 			goto done;
 		}
 
 		for (directory = switch_xml_child(cfg, "directory"); directory; directory = directory->next) {
 			char *name = (char *) switch_xml_attr(directory, "name");
-			if (!name || !local_stream_name || strcasecmp(name, local_stream_name)){
+			if (!name || !local_stream_name || strcasecmp(name, local_stream_name)) {
 				continue;
-			}
-			else {
+			} else {
 				path = (char *) switch_xml_attr(directory, "path");
 				if (!(name && path)) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid config!\n");
@@ -868,7 +867,7 @@
 		}
 		switch_xml_free(xml);
 	}
-	
+
 	if (zstr(local_stream_name) || zstr(path)) {
 		goto usage;
 	}
@@ -878,13 +877,13 @@
 	switch_mutex_unlock(globals.mutex);
 	if (source) {
 		source->stopped = 0;
-		stream->write_function(stream,"+OK");
-		goto done; 
+		stream->write_function(stream, "+OK");
+		goto done;
 	}
 
 	if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool for new local_stream\n");
-		stream->write_function(stream, "-ERR unable to allocate memory for local_stream %s!\n",local_stream_name);
+		stream->write_function(stream, "-ERR unable to allocate memory for local_stream %s!\n", local_stream_name);
 		goto done;
 	}
 
@@ -910,13 +909,13 @@
 	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
 	switch_thread_create(&thread, thd_attr, read_stream_thread, source, source->pool);
 
-	stream->write_function(stream,"+OK");
+	stream->write_function(stream, "+OK");
 	goto done;
 
- usage:
+  usage:
 	stream->write_function(stream, "-USAGE: %s\n", START_LOCAL_STREAM_SYNTAX);
 
- done:
+  done:
 
 	switch_safe_free(path);
 	switch_safe_free(timer_name);
@@ -960,7 +959,7 @@
 	RUNNING = 0;
 	switch_event_unbind_callback(event_handler);
 
-	while(THREADS > 0) {
+	while (THREADS > 0) {
 		switch_yield(100000);
 	}
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_native_file/mod_native_file.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_native_file/mod_native_file.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_native_file/mod_native_file.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -104,7 +104,7 @@
 	if ((status = switch_file_trunc(context->fd, offset)) == SWITCH_STATUS_SUCCESS) {
 		handle->pos = 0;
 	}
-	
+
 	return status;
 
 }

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_portaudio_stream


Name: svn:ignore
   + Makefile.in
.deps
Makefile
mod_portaudio_stream.log

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_portaudio_stream/Makefile

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_portaudio_stream/Makefile.am (from rev 16612, freeswitch/trunk/src/mod/formats/mod_portaudio_stream/Makefile.am) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_portaudio_stream/Makefile.am	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_portaudio_stream/Makefile.am	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,26 @@
+include $(top_srcdir)/build/modmake.rulesam
+
+MODNAME=mod_portaudio_stream
+PA_DIR=$(switch_srcdir)/libs/portaudio
+PALA=$(switch_builddir)/libs/portaudio/lib/libportaudio.la
+MODPA_DIR=$(switch_srcdir)/src/mod/endpoints/mod_portaudio
+
+mod_LTLIBRARIES = mod_portaudio_stream.la
+mod_portaudio_stream_la_SOURCES = mod_portaudio_stream.c $(MODPA_DIR)/pablio.c $(MODPA_DIR)/pa_ringbuffer.c
+mod_portaudio_stream_la_CFLAGS  = $(AM_CFLAGS)
+mod_portaudio_stream_la_CFLAGS += -I. -I$(PA_DIR)/include -D__EXTENSION__=1 -I$(MODPA_DIR)
+mod_portaudio_stream_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(PALA)
+mod_portaudio_stream_la_LDFLAGS = -avoid-version -module -no-undefined -shared $(PA_LIBS)
+
+if ISMAC
+mod_portaudio_stream_la_LDFLAGS += -framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon
+endif
+
+BUILT_SOURCES = $(PALA)
+
+$(mod_portaudio_stream_la_SOURCES) : $(BUILT_SOURCES)
+
+$(PALA): $(PA_DIR) $(PA_DIR)/.update
+	cd $(switch_builddir)/libs/portaudio && $(MAKE) PORTAUDIO_CFLAGS="$(SWITCH_AM_CFLAGS)"
+	$(TOUCH_TARGET)
+

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -154,9 +154,9 @@
 	return -1;
 }
 
-static switch_status_t engage_device(portaudio_stream_source_t *source,int restart)
+static switch_status_t engage_device(portaudio_stream_source_t *source, int restart)
 {
-	PaStreamParameters inputParameters,outputParameters;
+	PaStreamParameters inputParameters, outputParameters;
 	PaError err;
 	int sample_rate = source->rate;
 	int codec_ms = source->interval;
@@ -187,8 +187,7 @@
 		if (switch_core_codec_init(&source->write_codec,
 								   "L16",
 								   NULL,
-								   sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
-								   NULL) != SWITCH_STATUS_SUCCESS) {
+								   sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
 			switch_core_codec_destroy(&source->read_codec);
 			return SWITCH_STATUS_FALSE;
@@ -198,7 +197,7 @@
 
 	if (!source->timer.timer_interface) {
 		if (switch_core_timer_init(&source->timer,
-									source->timer_name, codec_ms, source->read_codec.implementation->samples_per_packet,
+								   source->timer_name, codec_ms, source->read_codec.implementation->samples_per_packet,
 								   module_pool) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup timer failed!\n");
 			switch_core_codec_destroy(&source->read_codec);
@@ -224,14 +223,13 @@
 	outputParameters.hostApiSpecificStreamInfo = NULL;
 
 
-	err = OpenAudioStream(&source->audio_stream, &inputParameters, NULL, sample_rate, paClipOff,
-			source->read_codec.implementation->samples_per_packet, 0);
+	err = OpenAudioStream(&source->audio_stream, &inputParameters, NULL, sample_rate, paClipOff, source->read_codec.implementation->samples_per_packet, 0);
 	/* UNLOCKED ************************************************************************************************* */
 	if (err != paNoError) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening audio device retrying\n");
 		switch_yield(1000000);
 		err = OpenAudioStream(&source->audio_stream, &inputParameters, &outputParameters, sample_rate, paClipOff,
-					source->read_codec.implementation->samples_per_packet, 0);
+							  source->read_codec.implementation->samples_per_packet, 0);
 	}
 
 	switch_mutex_unlock(source->device_lock);
@@ -251,7 +249,7 @@
 	portaudio_stream_source_t *source = obj;
 	portaudio_stream_context_t *cp;
 	int samples = 0;
-	int  bused, bytesToWrite;
+	int bused, bytesToWrite;
 
 
 	switch_mutex_lock(globals.mutex);
@@ -271,14 +269,14 @@
 
 	switch_thread_rwlock_create(&source->rwlock, source->pool);
 
-	if (engage_device(source,0)!=SWITCH_STATUS_SUCCESS){
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, " Dev %d cant be engaged !\n",(int) source->sourcedev);
+	if (engage_device(source, 0) != SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, " Dev %d cant be engaged !\n", (int) source->sourcedev);
 	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " Dev %d engaged at %d rate!\n",(int) source->sourcedev, (int) source->rate);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " Dev %d engaged at %d rate!\n", (int) source->sourcedev, (int) source->rate);
 		if (globals.running && !source->stopped) {
 			source->ready = 1;
 
-			if (!source->audio_stream){
+			if (!source->audio_stream) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Audio Stream wops!\n");
 				source->stopped = 0;
 				source->ready = 0;
@@ -287,7 +285,7 @@
 					samples = 0;
 					switch_mutex_lock(source->device_lock);
 					samples = ReadAudioStream(source->audio_stream, source->databuf,
-									source->read_codec.implementation->samples_per_packet  , &source->timer);
+											  source->read_codec.implementation->samples_per_packet, &source->timer);
 					switch_mutex_unlock(source->device_lock);
 
 
@@ -306,9 +304,9 @@
 								switch_mutex_lock(cp->audio_mutex);
 
 								bused = switch_buffer_inuse(cp->audio_buffer);
-								if (bused > source->samples * 768 ) {
-									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Leaking stream handle! [%s() %s:%d] %d used %d max\n", cp->func, cp->file,
-													  cp->line,(int) bused, (int) ( source->samples * 768));
+								if (bused > source->samples * 768) {
+									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Leaking stream handle! [%s() %s:%d] %d used %d max\n",
+													  cp->func, cp->file, cp->line, (int) bused, (int) (source->samples * 768));
 									switch_buffer_zero(cp->audio_buffer);
 								} else {
 									switch_buffer_write(cp->audio_buffer, source->databuf, bytesToWrite);
@@ -357,7 +355,7 @@
 	switch_mutex_unlock(globals.mutex);
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " thread ending succesfully !\n");
-	switch_thread_exit(thread,SWITCH_STATUS_SUCCESS);
+	switch_thread_exit(thread, SWITCH_STATUS_SUCCESS);
 
 	return NULL;
 }
@@ -365,20 +363,17 @@
 
 static switch_status_t portaudio_stream_file_open(switch_file_handle_t *handle, const char *path)
 {
-	portaudio_stream_context_t *context ;
+	portaudio_stream_context_t *context;
 	portaudio_stream_source_t *source;
 	switch_memory_pool_t *pool;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr = NULL;
 	uint32_t rate = PREFERRED_RATE;
-	char *npath ;
+	char *npath;
 	int devNumber;
+	int tmp;
 
-
-
-
-
 	handle->pre_buffer_datalen = 0;
 
 	if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) {
@@ -386,22 +381,20 @@
 		return status;
 	}
 
-	npath =  switch_core_strdup(module_pool, path);
+	npath = switch_core_strdup(module_pool, path);
 
-	int tmp = handle->samplerate;
+	tmp = handle->samplerate;
 	if (tmp == 8000 || tmp == 16000 || tmp == 32000 || tmp == 48000) {
 		rate = tmp;
 	}
 
 	if (*path == '#') {
-		devNumber = get_dev_by_number(npath  + 1, 1);
+		devNumber = get_dev_by_number(npath + 1, 1);
 	} else {
-		devNumber = get_dev_by_name(npath , 1);
+		devNumber = get_dev_by_name(npath, 1);
 	}
-    npath = switch_mprintf("device-%d at %d",devNumber,rate);
+	npath = switch_mprintf("device-%d at %d", devNumber, rate);
 
-
-
 	switch_mutex_lock(globals.mutex);
 	source = switch_core_hash_find(globals.source_hash, npath);
 
@@ -413,7 +406,7 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, " :S no pool\n");
 		} else {
 			source = switch_core_alloc(pool, sizeof(*source));
-			if (source!=NULL){
+			if (source != NULL) {
 				source->pool = pool;
 				source->sourcedev = devNumber;
 				source->sourcename = switch_core_strdup(source->pool, npath);
@@ -426,42 +419,32 @@
 				source->ready = 0;
 				source->samples = switch_samples_per_packet(source->rate, source->interval);
 
-
-
 				switch_mutex_init(&source->mutex, SWITCH_MUTEX_NESTED, source->pool);
 
-
-
 				switch_threadattr_create(&thd_attr, source->pool);
 				switch_threadattr_detach_set(thd_attr, 1);
 
 				switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
 				switch_thread_create(&thread, thd_attr, read_stream_thread, source, source->pool);
-
 			}
-
 		}
-
 	}
 	switch_mutex_unlock(globals.mutex);
 	switch_yield(1000000);
 	/* dev already engaged */
 	if (source) {
 
-		/*wait for source to be ready*/
+		/*wait for source to be ready */
+		while (source->ready == 0) {
+			switch_yield(100000);
+		}
 
-		while(source->ready==0){switch_yield(100000);}
-
-
 		if (switch_thread_rwlock_tryrdlock(source->rwlock) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, " error rwlock !\n");
 			source = NULL;
 		}
-
 	}
 
-
-
 	if (source) {
 		status = SWITCH_STATUS_SUCCESS;
 
@@ -480,7 +463,6 @@
 			handle->private_info = context;
 			handle->interval = source->interval;
 
-
 			switch_mutex_init(&context->audio_mutex, SWITCH_MUTEX_NESTED, handle->memory_pool);
 			if (switch_buffer_create_dynamic(&context->audio_buffer, 512, 1024, 0) != SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
@@ -497,7 +479,6 @@
 				source->context_list = context;
 				source->total++;
 				switch_mutex_unlock(source->mutex);
-
 			}
 		}
 	} else {
@@ -505,8 +486,6 @@
 		status = SWITCH_STATUS_FALSE;
 	}
 
-
-
 	return status;
 }
 
@@ -544,8 +523,6 @@
 	int bytesPerSample = context->source->audio_stream->bytesPerFrame;
 	size_t need = *len * bytesPerSample;
 
-
-
 	if (!context->source->ready) {
 		*len = 0;
 		return SWITCH_STATUS_FALSE;
@@ -617,7 +594,7 @@
 	globals.running = 0;
 	switch_event_unbind_callback(shutdown_event_handler);
 
-	while(globals.threads > 0) {
+	while (globals.threads > 0) {
 		switch_yield(100000);
 	}
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_shell_stream/mod_shell_stream.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_shell_stream/mod_shell_stream.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_shell_stream/mod_shell_stream.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -43,7 +43,7 @@
 	int pid;
 	char *command;
 	switch_buffer_t *audio_buffer;
-	switch_mutex_t *mutex;	
+	switch_mutex_t *mutex;
 	switch_thread_rwlock_t *rwlock;
 	int running;
 };
@@ -63,15 +63,15 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Read Lock Fail\n");
 		goto end;
 	}
-	
-	while(context->running) {
-		
+
+	while (context->running) {
+
 		rlen = read(context->fds[0], data, MY_BUF_LEN);
 
 		if (rlen <= 3) {
 			break;
 		}
-		
+
 		switch_mutex_lock(context->mutex);
 		switch_buffer_write(context->audio_buffer, data, rlen);
 		switch_mutex_unlock(context->mutex);
@@ -79,7 +79,7 @@
 
 	switch_thread_rwlock_unlock(context->rwlock);
 
- end:
+  end:
 
 	context->running = 0;
 
@@ -92,26 +92,26 @@
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	switch_thread_t *thread;
 	switch_threadattr_t *thd_attr = NULL;
-	
+
 	if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This format does not support writing!\n");
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	context = switch_core_alloc(handle->memory_pool, sizeof(*context));
-	
+
 	context->fds[0] = -1;
 	context->fds[1] = -1;
 	context->command = switch_core_sprintf(handle->memory_pool, "%s -r %d -c %d", path, handle->samplerate, handle->channels);
 
 	if (pipe(context->fds)) {
 		goto error;
-	} else { /* good to go*/
+	} else {					/* good to go */
 		context->pid = fork();
-		
-		if (context->pid < 0) { /* ok maybe not */
+
+		if (context->pid < 0) {	/* ok maybe not */
 			goto error;
-		} else if (context->pid) { /* parent */
+		} else if (context->pid) {	/* parent */
 			handle->private_info = context;
 			status = SWITCH_STATUS_SUCCESS;
 			close(context->fds[1]);
@@ -124,19 +124,19 @@
 
 			switch_thread_rwlock_create(&context->rwlock, handle->memory_pool);
 			switch_mutex_init(&context->mutex, SWITCH_MUTEX_NESTED, handle->memory_pool);
-			
+
 			switch_threadattr_create(&thd_attr, handle->memory_pool);
 			switch_threadattr_detach_set(thd_attr, 1);
 			switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
 			switch_thread_create(&thread, thd_attr, buffer_thread_run, context, handle->memory_pool);
 			context->running = 2;
 
-			while(context->running == 2) {
+			while (context->running == 2) {
 				switch_cond_next();
 			}
 
 			goto end;
-		} else { /*  child */
+		} else {				/*  child */
 			close(context->fds[0]);
 			dup2(context->fds[1], STDOUT_FILENO);
 			switch_system(context->command, SWITCH_TRUE);
@@ -146,22 +146,22 @@
 		}
 	}
 
- error:
+  error:
 
 	close(context->fds[0]);
 	close(context->fds[1]);
 	status = SWITCH_STATUS_FALSE;
-		
 
- end:
-		
+
+  end:
+
 	return status;
 }
 
 static switch_status_t shell_stream_file_close(switch_file_handle_t *handle)
 {
 	shell_stream_context_t *context = handle->private_info;
-	
+
 	context->running = 0;
 
 	if (context->fds[0] > -1) {
@@ -184,10 +184,10 @@
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	switch_size_t rlen = *len * 2;
 
-	while(context->running && switch_buffer_inuse(context->audio_buffer) < rlen) {
+	while (context->running && switch_buffer_inuse(context->audio_buffer) < rlen) {
 		switch_cond_next();
 	}
-	
+
 	switch_mutex_lock(context->mutex);
 	*len = switch_buffer_read(context->audio_buffer, data, rlen) / 2;
 	switch_mutex_unlock(context->mutex);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_shout/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_shout/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_shout/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,7 +1,7 @@
 LAME=lame-3.97
 SHOUT=libshout-2.2.2
 MPG123=mpg123
-switch_srcdir=../../../..
+BASE=../../../..
 
 WANT_CURL=yes
 
@@ -9,54 +9,56 @@
 SHOUT_DIR=$(switch_srcdir)/libs/$(SHOUT)
 MPG123_DIR=$(switch_srcdir)/libs/$(MPG123)
 
-LAMELA=$(LAME_DIR)/libmp3lame/libmp3lame.la
-SHOUTLA=$(SHOUT_DIR)/src/libshout.la
-MPG123LA=$(MPG123_DIR)/src/libmpg123/libmpg123.la
+LAME_BUILDDIR=$(switch_builddir)/libs/$(LAME)
+SHOUT_BUILDDIR=$(switch_builddir)/libs/$(SHOUT)
+MPG123_BUILDDIR=$(switch_builddir)/libs/$(MPG123)
 
-LOCAL_CFLAGS=-I$(SHOUT_DIR)/include -I$(LAME_DIR)/include -I$(MPG123_DIR)/src
+LAMELA=$(LAME_BUILDDIR)/libmp3lame/libmp3lame.la
+SHOUTLA=$(SHOUT_BUILDDIR)/src/libshout.la
+MPG123LA=$(MPG123_BUILDDIR)/src/libmpg123/libmpg123.la
+
+LOCAL_CFLAGS=-I$(SHOUT_DIR)/include -I$(LAME_DIR)/include -I$(MPG123_DIR)/src  -I$(MPG123_BUILDDIR)/src -I$(SHOUT_BUILDDIR)/include 
 LOCAL_LIBADD=$(LAMELA) $(SHOUTLA) $(MPG123LA)
+LOCAL_LDFLAGS=`cat $(SHOUT_BUILDDIR)/Makefile | grep SPEEX_LIBS | sed -e 's|^SPEEX_LIBS =||'`  `cat $(SHOUTLA) | grep dependency_libs  | sed -e 's|^dependency_libs=||' | sed -e "s|'||g"`
 
-LOCAL_LDFLAGS=`cat ../../../../libs/libshout-2.2.2/Makefile | grep SPEEX_LIBS | sed -e 's|^SPEEX_LIBS =||'` 
-LOCAL_OBJS=$(MP3OBJS)
-LOCAL_SOURCES=$(MP3SOURCES)
+include $(BASE)/build/modmake.rules
 
-include $(switch_srcdir)/build/modmake.rules
+$(MODNAME).lo: $(LOCAL_LIBADD)
 
-DEFAULT_ARGS=--prefix=$(PREFIX) --disable-shared --with-pic
-
-$(LOCAL_OBJS): $(LOCAL_SOURCES)
-
 $(MPG123_DIR):
 	$(GETLIB) $(MPG123).tar.gz
 
-$(MPG123_DIR)/Makefile: $(MPG123_DIR)
-	cd $(MPG123_DIR) && CFLAGS=$(AM_CFLAGS) CC=$(CC) CXX=$(CXX) ./configure --disable-shared --with-pic CPPFLAGS= LDFLAGS=
+$(MPG123_BUILDDIR)/Makefile: $(MPG123_DIR)
+	mkdir -p $(MPG123_BUILDDIR)
+	cd $(MPG123_BUILDDIR) && $(DEFAULT_VARS) $(MPG123_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(MPG123_DIR) CPPFLAGS= LDFLAGS=
 	$(TOUCH_TARGET)
 
-$(MPG123LA): $(MPG123_DIR)/Makefile
-	cd $(MPG123_DIR) && $(MAKE)
+$(MPG123LA): $(MPG123_BUILDDIR)/Makefile
+	cd $(MPG123_BUILDDIR) && $(MAKE)
 	$(TOUCH_TARGET)
 
 $(LAME_DIR):
 	$(GETLIB) $(LAME).tar.gz
 
-$(LAME_DIR)/Makefile: $(LAME_DIR)
-	cd $(LAME_DIR) && CC=$(CC) CXX=$(CXX) ./configure $(DEFAULT_ARGS) --disable-decoder CPPFLAGS= LDFLAGS=
+$(LAME_BUILDDIR)/Makefile: $(LAME_DIR)
+	mkdir -p $(LAME_BUILDDIR)
+	cd $(LAME_BUILDDIR) && $(DEFAULT_VARS) $(LAME_DIR)/configure $(DEFAULT_ARGS) --disable-decoder --srcdir=$(LAME_DIR) CPPFLAGS= LDFLAGS=
 	$(TOUCH_TARGET)
 
-$(LAMELA): $(LAME_DIR)/Makefile
-	cd $(LAME_DIR) && $(MAKE)
+$(LAMELA): $(LAME_BUILDDIR)/Makefile
+	cd $(LAME_BUILDDIR) && $(MAKE)
 	$(TOUCH_TARGET)
 
 $(SHOUT_DIR):
 	$(GETLIB) $(SHOUT).tar.gz
 
-$(SHOUT_DIR)/Makefile: $(SHOUT_DIR)
-	cd $(SHOUT_DIR) && CC=$(CC) CXX=$(CXX) ./configure $(DEFAULT_ARGS) --without-speex --without-vorbis --without-ogg CPPFLAGS= LDFLAGS=
+$(SHOUT_BUILDDIR)/Makefile: $(SHOUT_DIR)
+	mkdir -p $(SHOUT_BUILDDIR)
+	cd $(SHOUT_BUILDDIR) && $(DEFAULT_VARS) $(SHOUT_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(SHOUT_DIR) --without-speex --without-vorbis --without-ogg CPPFLAGS= LDFLAGS=
 	$(TOUCH_TARGET)
 
-$(SHOUTLA): $(SHOUT_DIR)/Makefile
-	cd $(SHOUT_DIR) && $(MAKE)
+$(SHOUTLA): $(SHOUT_BUILDDIR)/Makefile
+	cd $(SHOUT_BUILDDIR) && $(MAKE)
 	$(TOUCH_TARGET)
 
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_shout/mod_shout.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_shout/mod_shout.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_shout/mod_shout.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -55,12 +55,12 @@
 	uint32_t outscale;
 } globals;
 
-mpg123_handle *our_mpg123_new(const char* decoder, int *error) 
+mpg123_handle *our_mpg123_new(const char *decoder, int *error)
 {
 	mpg123_handle *mh;
 	const char *arch = "auto";
 	int x64 = 0;
-	
+
 	if (*globals.decoder || globals.outscale || globals.vol) {
 		if (*globals.decoder) {
 			arch = globals.decoder;
@@ -159,17 +159,17 @@
 			mpg123_close(context->mh);
 			mpg123_delete(context->mh);
 		}
-		
+
 		if (context->fp) {
 			unsigned char mp3buffer[8192];
 			int len;
-			int16_t blank[2048] = {0}, *r = NULL;
-			
-			
+			int16_t blank[2048] = { 0 }, *r = NULL;
+
+
 			if (context->channels == 2) {
 				r = blank;
 			}
-			
+
 			len = lame_encode_buffer(context->gfp, blank, r, sizeof(blank) / 2, mp3buffer, sizeof(mp3buffer));
 
 			if (len) {
@@ -182,7 +182,7 @@
 					break;
 				}
 			}
-			
+
 			lame_mp3_tags_fid(context->gfp, context->fp);
 
 			fclose(context->fp);
@@ -292,7 +292,7 @@
 {
 	int decode_status = 0;
 	size_t usedlen;
-	
+
 	while (!context->err && !context->eof && switch_buffer_inuse(context->audio_buffer) < bytes) {
 		usedlen = 0;
 
@@ -332,8 +332,8 @@
 	shout_context_t *context = data;
 	int decode_status = 0;
 	size_t usedlen;
-	uint32_t used, buf_size = 1024 * 128; /* do not make this 64 or less, stutter will ensue after 
-	                                         first 64k buffer is dry */
+	uint32_t used, buf_size = 1024 * 128;	/* do not make this 64 or less, stutter will ensue after 
+											   first 64k buffer is dry */
 
 	if (context->prebuf) {
 		buf_size = context->prebuf;
@@ -387,7 +387,7 @@
 	if (context->err) {
 		goto error;
 	}
-	
+
 	return realsize;
 
   error:
@@ -405,7 +405,7 @@
 	CURL *curl_handle = NULL;
 	CURLcode cc;
 	shout_context_t *context = (shout_context_t *) obj;
-	
+
 	switch_thread_rwlock_rdlock(context->rwlock);
 
 	curl_handle = curl_easy_init();
@@ -416,13 +416,14 @@
 	curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) context);
 	curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "FreeSWITCH(mod_shout)/1.0");
 	curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
-	curl_easy_setopt(curl_handle, CURLOPT_CONNECTTIMEOUT, 30); /* eventually timeout connect */
-	curl_easy_setopt(curl_handle, CURLOPT_LOW_SPEED_LIMIT, 100); /* handle trickle connections */
+	curl_easy_setopt(curl_handle, CURLOPT_CONNECTTIMEOUT, 30);	/* eventually timeout connect */
+	curl_easy_setopt(curl_handle, CURLOPT_LOW_SPEED_LIMIT, 100);	/* handle trickle connections */
 	curl_easy_setopt(curl_handle, CURLOPT_LOW_SPEED_TIME, 30);
 	curl_easy_setopt(curl_handle, CURLOPT_ERRORBUFFER, context->curl_error_buff);
 	cc = curl_easy_perform(curl_handle);
-	if (cc && cc != CURLE_WRITE_ERROR) { /* write error is ok, we just exited from callback early */
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "CURL returned error:[%d] %s : %s [%s]\n", cc, curl_easy_strerror(cc), context->curl_error_buff, context->stream_url);
+	if (cc && cc != CURLE_WRITE_ERROR) {	/* write error is ok, we just exited from callback early */
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "CURL returned error:[%d] %s : %s [%s]\n", cc, curl_easy_strerror(cc),
+						  context->curl_error_buff, context->stream_url);
 	}
 	curl_easy_cleanup(curl_handle);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Read Thread Done\n");
@@ -453,7 +454,7 @@
 		switch_mutex_unlock(context->audio_mutex);
 
 		if (used >= (2 * context->samplerate)) {
-			 break;
+			break;
 		}
 
 		switch_yield(500000);
@@ -566,7 +567,8 @@
 
 	while (context->thread_running && context->thread_running != 2) {
 		switch_yield(100000);
-		if (!--sanity) break;
+		if (!--sanity)
+			break;
 	}
 }
 
@@ -590,9 +592,9 @@
 	context->memory_pool = handle->memory_pool;
 	context->samplerate = handle->samplerate;
 	context->handle = handle;
-	
+
 	switch_thread_rwlock_create(&(context->rwlock), context->memory_pool);
-	
+
 	switch_thread_rwlock_rdlock(context->rwlock);
 
 	switch_mutex_init(&context->audio_mutex, SWITCH_MUTEX_NESTED, context->memory_pool);
@@ -605,10 +607,10 @@
 
 		context->mh = our_mpg123_new(NULL, NULL);
 		mpg123_format_all(context->mh);
-		mpg123_param(context->mh, MPG123_FORCE_RATE, context->samplerate, 0);		
+		mpg123_param(context->mh, MPG123_FORCE_RATE, context->samplerate, 0);
 
 		if (handle->handler) {
-			mpg123_param(context->mh, MPG123_FLAGS, MPG123_SEEKBUFFER|MPG123_MONO_MIX, 0);
+			mpg123_param(context->mh, MPG123_FLAGS, MPG123_SEEKBUFFER | MPG123_MONO_MIX, 0);
 			if (mpg123_open_feed(context->mh) != MPG123_OK) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening mpg feed\n");
 				goto error;
@@ -800,7 +802,7 @@
 		}
 
 		switch_buffer_zero(context->audio_buffer);
-		*cur_sample = mpg123_seek (context->mh, (off_t)samples, whence);
+		*cur_sample = mpg123_seek(context->mh, (off_t) samples, whence);
 
 		return *cur_sample >= 0 ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
 	}
@@ -827,19 +829,19 @@
 	if (!rb && (context->eof || context->err)) {
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	/* switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "rb: %d, bytes: %d\n", (int) rb, (int) bytes); */
-	
+
 	if (rb) {
 		*len = rb / sizeof(int16_t);
 	} else {
 		/* no data, so insert 1 second of silence */
 		newbytes = 2 * handle->samplerate;
-		if(newbytes < bytes) {
+		if (newbytes < bytes) {
 			bytes = newbytes;
 		}
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Padding mp3 stream with 1s of empty audio. (%s)\n", context->stream_url);
-		
+
 		memset(data, 255, bytes);
 		*len = bytes / sizeof(int16_t);
 	}
@@ -918,18 +920,18 @@
 
 	if (handle->channels == 2) {
 		switch_size_t i, j = 0;
-		
+
 		if (context->llen < nsamples) {
 			context->l = switch_core_alloc(context->memory_pool, nsamples * 2);
 			context->r = switch_core_alloc(context->memory_pool, nsamples * 2);
 			context->llen = context->rlen = nsamples;
 		}
-		
+
 		for (i = 0; i < nsamples; i++) {
 			context->l[i] = audio[j++];
 			context->r[i] = audio[j++];
 		}
-		
+
 		if ((rlen = lame_encode_buffer(context->gfp, context->l, context->r, nsamples, context->mp3buf, context->mp3buflen)) < 0) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "MP3 encode error %d!\n", rlen);
 			return SWITCH_STATUS_FALSE;
@@ -1130,7 +1132,7 @@
 		switch_mutex_t *mutex;
 		switch_channel_t *channel = switch_core_session_get_channel(tsession);
 		lame_global_flags *gfp = NULL;
-		switch_codec_implementation_t read_impl = {0};
+		switch_codec_implementation_t read_impl = { 0 };
 		switch_core_session_get_read_impl(tsession, &read_impl);
 
 		if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
@@ -1322,7 +1324,7 @@
 
 void do_index(switch_stream_handle_t *stream)
 {
-	switch_cache_db_handle_t *db; 
+	switch_cache_db_handle_t *db;
 	const char *sql = "select * from channels";
 	struct holder holder;
 	char *errmsg;
@@ -1407,7 +1409,7 @@
 	switch_xml_t cfg, xml, settings, param;
 
 	memset(&globals, 0, sizeof(globals));
-	
+
 	if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
 		return SWITCH_STATUS_TERM;
@@ -1417,11 +1419,11 @@
 		for (param = switch_xml_child(settings, "param"); param; param = param->next) {
 			char *var = (char *) switch_xml_attr_soft(param, "name");
 			char *val = (char *) switch_xml_attr_soft(param, "value");
-			
+
 			if (!strcmp(var, "decoder")) {
 				switch_set_string(globals.decoder, val);
 			} else if (!strcmp(var, "volume")) {
-				globals.vol = (float)atof(val);
+				globals.vol = (float) atof(val);
 			} else if (!strcmp(var, "outscale")) {
 				int tmp = atoi(val);
 				if (tmp > 0) {
@@ -1430,8 +1432,8 @@
 			}
 		}
 	}
-	
 
+
 	switch_xml_free(xml);
 
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_sndfile/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_sndfile/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_sndfile/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,14 +1,14 @@
 BASE=../../../..
 
-SNDFILE_DIR=$(BASE)/libs/libsndfile
-SNDFILELA=$(SNDFILE_DIR)/src/libsndfile.la
+SNDFILE_DIR=$(switch_srcdir)/libs/libsndfile
+SNDFILE_BUILDDIR=$(switch_builddir)/libs/libsndfile
+SNDFILELA=$(SNDFILE_BUILDDIR)/src/libsndfile.la
 
-LOCAL_CFLAGS=-I$(SNDFILE_DIR)/src
+LOCAL_CFLAGS=-I$(SNDFILE_DIR)/src -I$(SNDFILE_BUILDDIR)/src
 LOCAL_LIBADD=$(SNDFILELA)
-LOCAL_OBJS=
 
 include $(BASE)/build/modmake.rules
 
 $(SNDFILELA): $(SNDFILE_DIR) $(SNDFILE_DIR)/.update
-	cd $(SNDFILE_DIR) && $(MAKE)
+	cd $(SNDFILE_BUILDDIR) && $(MAKE)
 	$(TOUCH_TARGET)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_sndfile/mod_sndfile.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_sndfile/mod_sndfile.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_sndfile/mod_sndfile.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -64,7 +64,7 @@
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	char *alt_path = NULL, *last, *ldup = NULL;
 	size_t alt_len = 0;
-	int rates[4] = {8000, 16000, 32000, 48000};
+	int rates[4] = { 8000, 16000, 32000, 48000 };
 	int i;
 #ifdef WIN32
 	char ps = '\\';
@@ -161,12 +161,12 @@
 	/* This block attempts to add the sample rate to the path
 	   if the sample rate is already present in the path it does nothing
 	   and reverts to the original file name.
-	*/
+	 */
 	if ((last = strrchr(alt_path, ps))) {
 		last++;
 #ifdef WIN32
 		if (strrchr(last, '/')) {
-			last = strrchr(alt_path, '/'); /* do not swallow a forward slash if they are intermixed under windows*/
+			last = strrchr(alt_path, '/');	/* do not swallow a forward slash if they are intermixed under windows */
 			last++;
 		}
 #endif
@@ -178,7 +178,7 @@
 		} else {
 			/* Try to find the file at the highest rate possible if we can't find one that matches the exact rate.
 			   If we don't find any, we will default back to the original file name.
-			*/
+			 */
 			for (i = 3; i >= 0; i--) {
 				switch_snprintf(last, alt_len - (last - alt_path), "%d%s%s", rates[i], SWITCH_PATH_SEPARATOR, ldup);
 				if ((context->handle = sf_open(alt_path, mode, &context->sfinfo))) {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_tone_stream/mod_tone_stream.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_tone_stream/mod_tone_stream.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/formats/mod_tone_stream/mod_tone_stream.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -58,7 +58,7 @@
 		sh->samples = 0;
 		sh->forever = 1;
 	}
-		
+
 	if ((p = strchr(path, ','))) {
 		p++;
 		ms = atoi(p);
@@ -80,19 +80,19 @@
 static switch_status_t silence_stream_file_read(switch_file_handle_t *handle, void *data, size_t *len)
 {
 	struct silence_handle *sh = handle->private_info;
-	
+
 	if (!sh->forever) {
 		if (sh->samples <= 0) {
 			return SWITCH_STATUS_FALSE;
 		}
 
-		if (*len > (size_t)sh->samples) {
+		if (*len > (size_t) sh->samples) {
 			*len = sh->samples;
 		}
 
 		sh->samples -= *len;
 	}
-	
+
 	if (sh->silence) {
 		switch_generate_sln_silence((int16_t *) data, *len, sh->silence);
 	} else {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_java/Makefile.in (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_java/Makefile.in	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_java/Makefile.in	2010-02-12 00:54:22 UTC (rev 16614)
@@ -26,5 +26,5 @@
 	swig -java -c++ -I../../../include -package org.freeswitch.swig -outdir src/org/freeswitch/swig -o switch_swig_wrap.cpp mod_java.i
 
 local_install:
-	cp freeswitch.jar $(DESTDIR)$(PREFIX)/scripts
+	cp freeswitch.jar $(DESTDIR)@scriptdir@
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_java/freeswitch_java.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_java/freeswitch_java.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_java/freeswitch_java.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -6,21 +6,19 @@
 
 extern JavaVM *javaVM;
 
-class JavaSession : public CoreSession
-{
- public:
-    JavaSession();
-    JavaSession(char *uuid);
-    JavaSession(switch_core_session_t *session);
-    virtual ~JavaSession();
+class JavaSession:public CoreSession {
+  public:
+	JavaSession();
+	JavaSession(char *uuid);
+	     JavaSession(switch_core_session_t *session);
+	                      virtual ~ JavaSession();
 
-    virtual bool begin_allow_threads();
-    virtual bool end_allow_threads();
-    void setDTMFCallback(jobject dtmfCallback, char *funcargs);
-    void setHangupHook(jobject hangupHook);
-    virtual void check_hangup_hook();
-    virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
+	virtual bool begin_allow_threads();
+	virtual bool end_allow_threads();
+	void setDTMFCallback(jobject dtmfCallback, char *funcargs);
+	void setHangupHook(jobject hangupHook);
+	virtual void check_hangup_hook();
+	virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
 };
 
 #endif
-

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_java/modjava.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_java/modjava.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_java/modjava.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -45,236 +45,205 @@
 SWITCH_MODULE_DEFINITION(mod_java, mod_java_load, mod_java_shutdown, NULL);
 
 
-static void launch_java(switch_core_session_t *session, const char *data, JNIEnv *env)
+static void launch_java(switch_core_session_t *session, const char *data, JNIEnv * env)
 {
-    jclass Launcher = NULL;
-    jmethodID launch = NULL;
-    jstring uuid = NULL;
-    jstring args = NULL;
+	jclass Launcher = NULL;
+	jmethodID launch = NULL;
+	jstring uuid = NULL;
+	jstring args = NULL;
 
-    Launcher = (*env)->FindClass(env, "org/freeswitch/Launcher");
-    if (Launcher == NULL)
-    {
-        (*env)->ExceptionDescribe(env);
-        goto done;
-    }
+	Launcher = (*env)->FindClass(env, "org/freeswitch/Launcher");
+	if (Launcher == NULL) {
+		(*env)->ExceptionDescribe(env);
+		goto done;
+	}
 
-    launch = (*env)->GetStaticMethodID(env, Launcher, "launch", "(Ljava/lang/String;Ljava/lang/String;)V");
-    if (launch == NULL)
-    {
-        (*env)->ExceptionDescribe(env);
-        goto done;
-    }
+	launch = (*env)->GetStaticMethodID(env, Launcher, "launch", "(Ljava/lang/String;Ljava/lang/String;)V");
+	if (launch == NULL) {
+		(*env)->ExceptionDescribe(env);
+		goto done;
+	}
 
-    uuid = (*env)->NewStringUTF(env, switch_core_session_get_uuid(session));
-    if (uuid == NULL)
-    {
-        (*env)->ExceptionDescribe(env);
-        goto done;
-    }
+	uuid = (*env)->NewStringUTF(env, switch_core_session_get_uuid(session));
+	if (uuid == NULL) {
+		(*env)->ExceptionDescribe(env);
+		goto done;
+	}
 
-    args = (*env)->NewStringUTF(env, data);
-    if (args == NULL)
-    {
-        (*env)->ExceptionDescribe(env);
-        goto done;
-    }
+	args = (*env)->NewStringUTF(env, data);
+	if (args == NULL) {
+		(*env)->ExceptionDescribe(env);
+		goto done;
+	}
 
-    (*env)->CallStaticVoidMethod(env, Launcher, launch, uuid, args);
-    if ((*env)->ExceptionOccurred(env))
-        (*env)->ExceptionDescribe(env);
+	(*env)->CallStaticVoidMethod(env, Launcher, launch, uuid, args);
+	if ((*env)->ExceptionOccurred(env))
+		(*env)->ExceptionDescribe(env);
 
-done:
-    if (args != NULL)
-        (*env)->DeleteLocalRef(env, args);
-    if (uuid != NULL)
-        (*env)->DeleteLocalRef(env, uuid);
-    if (Launcher != NULL)
-        (*env)->DeleteLocalRef(env, Launcher);
+  done:
+	if (args != NULL)
+		(*env)->DeleteLocalRef(env, args);
+	if (uuid != NULL)
+		(*env)->DeleteLocalRef(env, uuid);
+	if (Launcher != NULL)
+		(*env)->DeleteLocalRef(env, Launcher);
 }
 
 SWITCH_STANDARD_APP(java_function)
 {
-    JNIEnv *env;
-    jint res;
+	JNIEnv *env;
+	jint res;
 
-    if (javaVM == NULL)
-        return;
+	if (javaVM == NULL)
+		return;
 
-    res = (*javaVM)->AttachCurrentThread(javaVM, (void*) &env, NULL);
-    if (res == JNI_OK)
-    {
-        launch_java(session, data, env);
-        (*javaVM)->DetachCurrentThread(javaVM);
-    }
-    else
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error attaching thread to Java VM!\n");
+	res = (*javaVM)->AttachCurrentThread(javaVM, (void *) &env, NULL);
+	if (res == JNI_OK) {
+		launch_java(session, data, env);
+		(*javaVM)->DetachCurrentThread(javaVM);
+	} else
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error attaching thread to Java VM!\n");
 }
 
-static switch_status_t load_config(JavaVMOption **javaOptions, int *optionCount)
+static switch_status_t load_config(JavaVMOption ** javaOptions, int *optionCount)
 {
-    switch_xml_t cfg, xml;
-    switch_status_t status;
+	switch_xml_t cfg, xml;
+	switch_status_t status;
 
-    xml = switch_xml_open_cfg("java.conf", &cfg, NULL);
-    if (xml)
-    {
-        switch_xml_t javavm;
-        switch_xml_t options;
+	xml = switch_xml_open_cfg("java.conf", &cfg, NULL);
+	if (xml) {
+		switch_xml_t javavm;
+		switch_xml_t options;
 
-        javavm = switch_xml_child(cfg, "javavm");
-        if (javavm != NULL)
-        {
-            const char *path = switch_xml_attr_soft(javavm, "path");
-            if (path != NULL)
-            {
-                status = switch_dso_load(&javaVMHandle, path, memoryPool);
-                if (status != SWITCH_STATUS_SUCCESS)
-                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error loading %s\n", path);
-            }
-            else
-            {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Java VM path specified in java.conf.xml\n");
-                status = SWITCH_STATUS_FALSE;
-            }
-        }
-        else
-        {
-            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Java VM specified in java.conf.xml\n");
-            status = SWITCH_STATUS_FALSE;
-            goto close;
-        }
+		javavm = switch_xml_child(cfg, "javavm");
+		if (javavm != NULL) {
+			const char *path = switch_xml_attr_soft(javavm, "path");
+			if (path != NULL) {
+				status = switch_dso_load(&javaVMHandle, path, memoryPool);
+				if (status != SWITCH_STATUS_SUCCESS)
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error loading %s\n", path);
+			} else {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Java VM path specified in java.conf.xml\n");
+				status = SWITCH_STATUS_FALSE;
+			}
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No Java VM specified in java.conf.xml\n");
+			status = SWITCH_STATUS_FALSE;
+			goto close;
+		}
 
-        options = switch_xml_child(cfg, "options");
-        if (options != NULL)
-        {
-            switch_xml_t option;
-            int i = 0;
-            *optionCount = 0;
-            for (option = switch_xml_child(options, "option"); option; option = option->next)
-            {
-                const char *value = switch_xml_attr_soft(option, "value");
-                if (value != NULL)
-                    ++*optionCount;
-            }
-            *optionCount += 1;
-            *javaOptions = switch_core_alloc(memoryPool, (switch_size_t)(*optionCount * sizeof(JavaVMOption)));
-            if (*javaOptions == NULL)
-            {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Out of memory!\n");
-                status = SWITCH_STATUS_FALSE;
-                goto close;
-            }
-            for (option = switch_xml_child(options, "option"); option; option = option->next)
-            {
-                const char *value = switch_xml_attr_soft(option, "value");
-                if (value == NULL)
-                    continue;
-                (*javaOptions)[i].optionString = switch_core_strdup(memoryPool, value);
-                if ((*javaOptions)[i].optionString == NULL)
-                {
-                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Out of memory!\n");
-                    status = SWITCH_STATUS_FALSE;
-                    goto close;
-                }
-                ++i;
-            }
-            (*javaOptions)[i].optionString = "-Djava.library.path=" SWITCH_PREFIX_DIR SWITCH_PATH_SEPARATOR "mod";
-        }
+		options = switch_xml_child(cfg, "options");
+		if (options != NULL) {
+			switch_xml_t option;
+			int i = 0;
+			*optionCount = 0;
+			for (option = switch_xml_child(options, "option"); option; option = option->next) {
+				const char *value = switch_xml_attr_soft(option, "value");
+				if (value != NULL)
+					++ * optionCount;
+			}
+			*optionCount += 1;
+			*javaOptions = switch_core_alloc(memoryPool, (switch_size_t) (*optionCount * sizeof(JavaVMOption)));
+			if (*javaOptions == NULL) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Out of memory!\n");
+				status = SWITCH_STATUS_FALSE;
+				goto close;
+			}
+			for (option = switch_xml_child(options, "option"); option; option = option->next) {
+				const char *value = switch_xml_attr_soft(option, "value");
+				if (value == NULL)
+					continue;
+				(*javaOptions)[i].optionString = switch_core_strdup(memoryPool, value);
+				if ((*javaOptions)[i].optionString == NULL) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Out of memory!\n");
+					status = SWITCH_STATUS_FALSE;
+					goto close;
+				}
+				++i;
+			}
+			(*javaOptions)[i].optionString = "-Djava.library.path=" SWITCH_PREFIX_DIR SWITCH_PATH_SEPARATOR "mod";
+		}
 
-    close:
-        switch_xml_free(xml);
-    }
-    else
-    {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening java.conf.xml\n");
-        status = SWITCH_STATUS_FALSE;
-    }
-    return status;
+	  close:
+		switch_xml_free(xml);
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening java.conf.xml\n");
+		status = SWITCH_STATUS_FALSE;
+	}
+	return status;
 }
 
-static switch_status_t create_java_vm(JavaVMOption *options, int optionCount)
+static switch_status_t create_java_vm(JavaVMOption * options, int optionCount)
 {
-    jint (JNICALL *pJNI_CreateJavaVM)(JavaVM**,void**,void*);
-    switch_status_t status;
+	jint(JNICALL * pJNI_CreateJavaVM) (JavaVM **, void **, void *);
+	switch_status_t status;
 
-    status = switch_dso_sym((void*) &pJNI_CreateJavaVM, javaVMHandle, "JNI_CreateJavaVM");
-    if (status == SWITCH_STATUS_SUCCESS)
-    {
-        JNIEnv *env;
-        JavaVMInitArgs initArgs;
-        jint res;
+	status = switch_dso_sym((void *) &pJNI_CreateJavaVM, javaVMHandle, "JNI_CreateJavaVM");
+	if (status == SWITCH_STATUS_SUCCESS) {
+		JNIEnv *env;
+		JavaVMInitArgs initArgs;
+		jint res;
 
-        memset(&initArgs, 0, sizeof(initArgs));
-        initArgs.version = JNI_VERSION_1_4;
-        initArgs.nOptions = optionCount;
-        initArgs.options = options;
-        initArgs.ignoreUnrecognized = JNI_TRUE;
+		memset(&initArgs, 0, sizeof(initArgs));
+		initArgs.version = JNI_VERSION_1_4;
+		initArgs.nOptions = optionCount;
+		initArgs.options = options;
+		initArgs.ignoreUnrecognized = JNI_TRUE;
 
-        res = pJNI_CreateJavaVM(&javaVM, (void*) &env, &initArgs);
-        if (res == JNI_OK)
-        {
-            (*javaVM)->DetachCurrentThread(javaVM);
-            status = SWITCH_STATUS_SUCCESS;
-        }
-        else
-        {
-            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating Java VM!\n");
-            status = SWITCH_STATUS_FALSE;
-        }
-    }
-    else
-    {
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Specified Java VM doesn't have JNI_CreateJavaVM\n");
-        status = SWITCH_STATUS_FALSE;
-    }
-    return status;
+		res = pJNI_CreateJavaVM(&javaVM, (void *) &env, &initArgs);
+		if (res == JNI_OK) {
+			(*javaVM)->DetachCurrentThread(javaVM);
+			status = SWITCH_STATUS_SUCCESS;
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating Java VM!\n");
+			status = SWITCH_STATUS_FALSE;
+		}
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Specified Java VM doesn't have JNI_CreateJavaVM\n");
+		status = SWITCH_STATUS_FALSE;
+	}
+	return status;
 }
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_java_load)
 {
-    switch_status_t status;
-    JavaVMOption *options = NULL;
-    int optionCount = 0;
+	switch_status_t status;
+	JavaVMOption *options = NULL;
+	int optionCount = 0;
 	switch_application_interface_t *app_interface;
 
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 	SWITCH_ADD_APP(app_interface, "java", NULL, NULL, java_function, NULL, SAF_SUPPORT_NOMEDIA);
 
-    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Java Framework Loading...\n");
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Java Framework Loading...\n");
 
-    if (javaVM != NULL)
-        return SWITCH_STATUS_SUCCESS;
+	if (javaVM != NULL)
+		return SWITCH_STATUS_SUCCESS;
 
-    status = switch_core_new_memory_pool(&memoryPool);
-    if (status == SWITCH_STATUS_SUCCESS)
-    {
-        status = load_config(&options, &optionCount);
-        if (status == SWITCH_STATUS_SUCCESS)
-        {
-            status = create_java_vm(options, optionCount);
-            if (status == SWITCH_STATUS_SUCCESS)
-                return SWITCH_STATUS_SUCCESS;
-            switch_dso_unload(javaVMHandle);
-        }
-        switch_core_destroy_memory_pool(&memoryPool);
-    }
-    else
-        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating memory pool\n");
+	status = switch_core_new_memory_pool(&memoryPool);
+	if (status == SWITCH_STATUS_SUCCESS) {
+		status = load_config(&options, &optionCount);
+		if (status == SWITCH_STATUS_SUCCESS) {
+			status = create_java_vm(options, optionCount);
+			if (status == SWITCH_STATUS_SUCCESS)
+				return SWITCH_STATUS_SUCCESS;
+			switch_dso_unload(javaVMHandle);
+		}
+		switch_core_destroy_memory_pool(&memoryPool);
+	} else
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error creating memory pool\n");
 
-    return status == SWITCH_STATUS_SUCCESS ? SWITCH_STATUS_NOUNLOAD : status;
+	return status == SWITCH_STATUS_SUCCESS ? SWITCH_STATUS_NOUNLOAD : status;
 }
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_java_shutdown)
 {
-    if (javaVM == NULL)
-        return SWITCH_STATUS_FALSE;
+	if (javaVM == NULL)
+		return SWITCH_STATUS_FALSE;
 
-    (*javaVM)->DestroyJavaVM(javaVM);
-    javaVM = NULL;
-    switch_dso_unload(javaVMHandle);
-    switch_core_destroy_memory_pool(&memoryPool);
-    return SWITCH_STATUS_SUCCESS;
+	(*javaVM)->DestroyJavaVM(javaVM);
+	javaVM = NULL;
+	switch_dso_unload(javaVMHandle);
+	switch_core_destroy_memory_pool(&memoryPool);
+	return SWITCH_STATUS_SUCCESS;
 }
-
-

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_java/switch_swig_wrap.cpp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_java/switch_swig_wrap.cpp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_java/switch_swig_wrap.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1152,7 +1152,7 @@
     arg2 = (char *)jenv->GetStringUTFChars(jarg2, 0);
     if (!arg2) return 0;
   }
-  result = (char *)(arg1)->getHeader(arg2);
+  result = (char *)(arg1)->getHeader((char const *)arg2);
   if(result) jresult = jenv->NewStringUTF((const char *)result);
   if (arg2) jenv->ReleaseStringUTFChars(jarg2, (const char *)arg2);
   return jresult;

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/Makefile

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/Makefile.am (from rev 16612, freeswitch/trunk/src/mod/languages/mod_lua/Makefile.am) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/Makefile.am	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/Makefile.am	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,35 @@
+VERBOSE=1
+include $(top_srcdir)/build/modmake.rulesam
+
+MODNAME=mod_lua
+
+LIBLUA_A=lua/liblua.a
+
+AM_CFLAGS += $(CFLAGS) -D_GNU_SOURCE
+mod_LTLIBRARIES = mod_lua.la
+mod_lua_la_SOURCES = mod_lua.cpp freeswitch_lua.cpp mod_lua_wrap.cpp
+mod_lua_la_CXXFLAGS = -Ilua $(AM_CPPFLAGS)
+mod_lua_la_LIBADD = $(switch_builddir)/libfreeswitch.la 
+mod_lua_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lm $(AM_LDFLAGS) $(LIBLUA_A) $(SOLINK)
+
+BUILT_SOURCES = $(LIBLUA_A)
+$(mod_lua_la_SOURCES) : $(BUILT_SOURCES)
+
+$(LIBLUA_A):
+	cd lua && $(MAKE) CC="$(CC)" AR="$(AR) rcu" CFLAGS="$(AM_CFLAGS) -DLUA_USE_LINUX -w" liblua.a
+
+reswig: swigclean lua_wrap
+
+luaclean:
+	cd lua && $(MAKE) clean
+
+allclean: clean luaclean
+
+swigclean: clean
+	rm -f mod_lua_wrap.*
+
+lua_wrap: mod_lua_extra.c
+	swig -lua -c++ -I../../../../src/include -oh mod_lua_wrap.h -o mod_lua_wrap.cpp freeswitch.i
+	echo "#include \"mod_lua_extra.c\"" >> mod_lua_wrap.cpp
+	patch -s -p0 -i hack.diff
+

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/freeswitch_lua.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/freeswitch_lua.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/freeswitch_lua.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -7,41 +7,39 @@
 #include <lualib.h>
 #include "mod_lua_extra.h"
 }
-
 #include <switch_cpp.h>
-
 namespace LUA {
-class Session : public CoreSession {
- private:
-	virtual void do_hangup_hook();
-	lua_State *getLUA();
-	lua_State *L;
-	int hh;
-	int mark;
- public:
-    Session();
-    Session(char *uuid, CoreSession *a_leg = NULL);
-    Session(switch_core_session_t *session);
-    ~Session();        
-	SWITCH_MOD_DECLARE(virtual void) destroy(void);
-	
-	virtual bool begin_allow_threads();
-	virtual bool end_allow_threads();
-	virtual void check_hangup_hook();
+	class Session:public CoreSession {
+	  private:
+		virtual void do_hangup_hook();
+		lua_State *getLUA();
+		lua_State *L;
+		int hh;
+		int mark;
+	  public:
+		    Session();
+		    Session(char *uuid, CoreSession * a_leg = NULL);
+		     Session(switch_core_session_t *session);
+		                     ~Session();
+		                      SWITCH_MOD_DECLARE(virtual void) destroy(void);
 
-	virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
-	void unsetInputCallback(void);
-	void setInputCallback(char *cbfunc, char *funcargs = NULL);
-	void setHangupHook(char *func, char *arg = NULL);
-	bool ready();
-	int originate(CoreSession *a_leg_session, char *dest, int timeout);
-	
-	char *cb_function;
-	char *cb_arg;
-	char *hangup_func_str;
-	char *hangup_func_arg;
-	void setLUA(lua_State *state);
+		virtual bool begin_allow_threads();
+		virtual bool end_allow_threads();
+		virtual void check_hangup_hook();
 
-};
+		virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
+		void unsetInputCallback(void);
+		void setInputCallback(char *cbfunc, char *funcargs = NULL);
+		void setHangupHook(char *func, char *arg = NULL);
+		bool ready();
+		int originate(CoreSession * a_leg_session, char *dest, int timeout);
+
+		char *cb_function;
+		char *cb_arg;
+		char *hangup_func_str;
+		char *hangup_func_arg;
+		void setLUA(lua_State * state);
+
+	};
 }
 #endif

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/lua/loadlib.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/lua/loadlib.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/lua/loadlib.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -192,7 +192,7 @@
   NSObjectFileImage img;
   NSObjectFileImageReturnCode ret;
   /* this would be a rare case, but prevents crashing if it happens */
-  if(!_dyld_present()) {
+  if (!_dyld_present()) {
     lua_pushliteral(L, "dyld not present");
     return NULL;
   }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/mod_lua.cpp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/mod_lua.cpp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/mod_lua.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/mod_lua_extra.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/mod_lua_extra.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/mod_lua_extra.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,9 +1,7 @@
 #ifndef MOD_LUA_EXTRA
 #define MOD_LUA_EXTRA
-SWITCH_BEGIN_EXTERN_C
-
-void mod_lua_conjure_event(lua_State *L, switch_event_t *event, const char *name, int destroy_me);
-void mod_lua_conjure_stream(lua_State *L, switch_stream_handle_t *stream, const char *name, int destroy_me);
+SWITCH_BEGIN_EXTERN_C void mod_lua_conjure_event(lua_State * L, switch_event_t *event, const char *name, int destroy_me);
+void mod_lua_conjure_stream(lua_State * L, switch_stream_handle_t *stream, const char *name, int destroy_me);
 void mod_lua_conjure_session(lua_State * L, switch_core_session_t *session, const char *name, int destroy_me);
 
 SWITCH_END_EXTERN_C

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/mod_lua_wrap.cpp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/mod_lua_wrap.cpp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/mod_lua_wrap.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -3259,14 +3259,14 @@
   
   SWIG_check_num_args("getHeader",2,2)
   if(!SWIG_isptrtype(L,1)) SWIG_fail_arg("getHeader",1,"Event *");
-  if(!lua_isstring(L,2)) SWIG_fail_arg("getHeader",2,"char *");
+  if(!lua_isstring(L,2)) SWIG_fail_arg("getHeader",2,"char const *");
   
   if (!SWIG_IsOK(SWIG_ConvertPtr(L,1,(void**)&arg1,SWIGTYPE_p_Event,0))){
     SWIG_fail_ptr("Event_getHeader",1,SWIGTYPE_p_Event);
   }
   
   arg2 = (char *)lua_tostring(L, 2);
-  result = (char *)(arg1)->getHeader(arg2);
+  result = (char *)(arg1)->getHeader((char const *)arg2);
   SWIG_arg=0;
   lua_pushstring(L,(const char*)result); SWIG_arg++;
   return SWIG_arg;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/my_swigable_cpp.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/my_swigable_cpp.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_lua/my_swigable_cpp.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,169 +1,160 @@
 typedef struct input_callback_state {
-    void *function;
+	void *function;
 
-    void *threadState;
+	void *threadState;
 
-    void *extra;
-    char *funcargs;
+	void *extra;
+	char *funcargs;
 } input_callback_state_t;
 
 typedef enum {
- S_HUP = (1 << 0),
- S_FREE = (1 << 1),
- S_RDLOCK = (1 << 2)
+	S_HUP = (1 << 0),
+	S_FREE = (1 << 1),
+	S_RDLOCK = (1 << 2)
 } session_flag_t;
 
 class Stream {
- protected:
- switch_stream_handle_t mystream;
- switch_stream_handle_t *stream_p;
- int mine;
- public:
- Stream(void);
- Stream(switch_stream_handle_t *);
- virtual ~Stream();
- void write(const char *data);
- const char *get_data(void);
+  protected:
+	switch_stream_handle_t mystream;
+	switch_stream_handle_t *stream_p;
+	int mine;
+  public:
+	    Stream(void);
+	     Stream(switch_stream_handle_t *);
+	                       virtual ~ Stream();
+	void write(const char *data);
+	const char *get_data(void);
 };
 
 class Event {
- protected:
- public:
- switch_event_t *event;
- char *serialized_string;
- int mine;
+  protected:
+  public:
+	switch_event_t *event;
+	char *serialized_string;
+	int mine;
 
- Event(const char *type, const char *subclass_name = NULL);
- Event(switch_event_t *wrap_me, int free_me=0);
- virtual ~Event();
- const char *serialize(const char *format=NULL);
- bool setPriority(switch_priority_t priority = SWITCH_PRIORITY_NORMAL);
- char *getHeader(char *header_name);
- char *getBody(void);
- char *getType(void);
- bool addBody(const char *value);
- bool addHeader(const char *header_name, const char *value);
- bool delHeader(const char *header_name);
- bool fire(void);
+	    Event(const char *type, const char *subclass_name = NULL);
+	     Event(switch_event_t *wrap_me, int free_me = 0);
+	    virtual ~ Event();
+	const char *serialize(const char *format = NULL);
+	bool setPriority(switch_priority_t priority = SWITCH_PRIORITY_NORMAL);
+	char *getHeader(char *header_name);
+	char *getBody(void);
+	char *getType(void);
+	bool addBody(const char *value);
+	bool addHeader(const char *header_name, const char *value);
+	bool delHeader(const char *header_name);
+	bool fire(void);
 
 };
 
 
 class CoreSession {
- protected:
- switch_input_args_t args;
+  protected:
+	switch_input_args_t args;
 
- switch_input_args_t *ap;
- switch_caller_profile_t caller_profile;
+	switch_input_args_t *ap;
+	switch_caller_profile_t caller_profile;
 
- char *uuid;
- char *tts_name;
- char *voice_name;
- void store_file_handle(switch_file_handle_t *fh);
- void *on_hangup;
- switch_file_handle_t local_fh;
- switch_file_handle_t *fhp;
- switch_status_t process_callback_result(char *ret);
- public:
- CoreSession();
- CoreSession(char *uuid);
- CoreSession(switch_core_session_t *new_session);
- virtual ~CoreSession();
- switch_core_session_t *session;
- switch_channel_t *channel;
- unsigned int flags;
- int allocated;
- input_callback_state cb_state;
+	char *uuid;
+	char *tts_name;
+	char *voice_name;
+	void store_file_handle(switch_file_handle_t *fh);
+	void *on_hangup;
+	switch_file_handle_t local_fh;
+	switch_file_handle_t *fhp;
+	switch_status_t process_callback_result(char *ret);
+  public:
+	     CoreSession();
+	     CoreSession(char *uuid);
+	     CoreSession(switch_core_session_t *new_session);
+	                      virtual ~ CoreSession();
+	switch_core_session_t *session;
+	switch_channel_t *channel;
+	unsigned int flags;
+	int allocated;
+	input_callback_state cb_state;
 
- switch_channel_state_t hook_state;
+	switch_channel_state_t hook_state;
 
- int answer();
- int preAnswer();
- virtual void hangup(char *cause = "normal_clearing");
- void setVariable(char *var, char *val);
- void setPrivate(char *var, void *val);
- void *getPrivate(char *var);
- const char *getVariable(char *var);
- int recordFile(char *file_name, int max_len=0, int silence_threshold=0, int silence_secs=0);
+	int answer();
+	int preAnswer();
+	virtual void hangup(char *cause = "normal_clearing");
+	void setVariable(char *var, char *val);
+	void setPrivate(char *var, void *val);
+	void *getPrivate(char *var);
+	const char *getVariable(char *var);
+	int recordFile(char *file_name, int max_len = 0, int silence_threshold = 0, int silence_secs = 0);
 
 
 
 
 
 
- void setCallerData(char *var, char *val);
- int originate(CoreSession *a_leg_session,
-      char *dest,
-      int timeout=60);
- void setDTMFCallback(void *cbfunc, char *funcargs);
+	void setCallerData(char *var, char *val);
+	int originate(CoreSession * a_leg_session, char *dest, int timeout = 60);
+	void setDTMFCallback(void *cbfunc, char *funcargs);
 
- int speak(char *text);
- void set_tts_parms(char *tts_name, char *voice_name);
+	int speak(char *text);
+	void set_tts_parms(char *tts_name, char *voice_name);
 
 
 
 
 
- int collectDigits(int timeout);
- int getDigits(char *dtmf_buf,
-      switch_size_t buflen,
-      switch_size_t maxdigits,
-      char *terminators,
-      char *terminator,
-      int timeout);
+	int collectDigits(int timeout);
+	int getDigits(char *dtmf_buf, switch_size_t buflen, switch_size_t maxdigits, char *terminators, char *terminator, int timeout);
 
- int transfer(char *extensions, char *dialplan, char *context);
- int playAndGetDigits(int min_digits,
-       int max_digits,
-       int max_tries,
-       int timeout,
-       char *terminators,
-       char *audio_files,
-       char *bad_input_audio_files,
-       char *dtmf_buf,
-       char *digits_regex);
- int streamFile(char *file, int starting_sample_count=0);
+	int transfer(char *extensions, char *dialplan, char *context);
+	int playAndGetDigits(int min_digits,
+						 int max_digits,
+						 int max_tries,
+						 int timeout, char *terminators, char *audio_files, char *bad_input_audio_files, char *dtmf_buf, char *digits_regex);
+	int streamFile(char *file, int starting_sample_count = 0);
 
 
 
- int flushEvents();
+	int flushEvents();
 
 
 
- int flushDigits();
+	int flushDigits();
 
- int setAutoHangup(bool val);
+	int setAutoHangup(bool val);
 
 
 
 
- void setHangupHook(void *hangup_func);
+	void setHangupHook(void *hangup_func);
 
- bool ready();
+	bool ready();
 
- void execute(char *app, char *data);
+	void execute(char *app, char *data);
 
- void sendEvent(Event *sendME);
+	void sendEvent(Event * sendME);
 
- virtual bool begin_allow_threads() = 0;
- virtual bool end_allow_threads() = 0;
+	virtual bool begin_allow_threads() = 0;
+	virtual bool end_allow_threads() = 0;
 
 
 
 
- char* get_uuid() const { return uuid; };
+	char *get_uuid() const {
+		return uuid;
+	};
 
 
 
 
- const switch_input_args_t& get_cb_args() const { return args; };
+	const switch_input_args_t &get_cb_args() const {
+		return args;
+	};
 
 
 
- virtual void check_hangup_hook() = 0;
+	virtual void check_hangup_hook() = 0;
 
- virtual switch_status_t run_dtmf_callback(void *input,
-             switch_input_type_t itype) = 0;
+	virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype) = 0;
 
 };
 
@@ -180,7 +171,7 @@
 
 
 
-void bridge(CoreSession &session_a, CoreSession &session_b);
+void bridge(CoreSession & session_a, CoreSession & session_b);
 
 
 
@@ -189,8 +180,4 @@
 
 switch_status_t hanguphook(switch_core_session_t *session);
 
-switch_status_t dtmf_callback(switch_core_session_t *session,
-         void *input,
-         switch_input_type_t itype,
-         void *buf,
-         unsigned int buflen);
+switch_status_t dtmf_callback(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen);

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_managed


Name: svn:ignore
   - Debug_CLR
*.pdb
*.user
Release_CLR
x64
   + Debug_CLR
*.pdb
*.user
Release_CLR
x64
freeswitch_wrap.cpp

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_managed/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_managed/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_managed/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -20,12 +20,12 @@
 local_depend:
 	cd managed && $(MAKE)
 
-local_install: $(DESTDIR)$(MODINSTDIR)/mod_managed.so 
-	cd managed && $(MAKE) INSTALL="$(LTINSTALL)" MODINSTDIR=$(MODINSTDIR) DESTDIR=$(DESTDIR) install
+local_install: $(DESTDIR)$(modulesdir)/mod_managed.$(LIBTOOL_LIB_EXTEN)
+	cd managed && $(MAKE) INSTALL="$(LTINSTALL)" MODINSTDIR=$(modulesdir) DESTDIR=$(DESTDIR) install
 
 local_uninstall:
-	rm -fr $(MODINSTDIR)/mod_managed.so
-	cd managed && $(MAKE) UNINSTALL="$(LTUNINSTALL)" MODINSTDIR=$(MODINSTDIR) uninstall
+	rm -fr $(DESTDIR)$(modulesdir)/mod_managed.so
+	cd managed && $(MAKE) UNINSTALL="$(LTUNINSTALL)" MODINSTDIR=$(modulesdir) uninstall
 
 local_clean:
 	cd managed && $(MAKE) clean
@@ -40,4 +40,4 @@
 	rm -f *.cs
 
 depend_install:
-	mkdir -p $(DESTDIR)$(PREFIX)/mod/managed
+	mkdir -p $(DESTDIR)$(modulesdir)/managed

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_managed/freeswitch_managed.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_managed/freeswitch_managed.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_managed/freeswitch_managed.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -34,13 +34,11 @@
 #define FREESWITCH_MANAGED_H
 
 SWITCH_BEGIN_EXTERN_C
-
 #include <switch.h>
 #include <switch_cpp.h>
+typedef void (*hangupFunction) (void);
+typedef char *(*inputFunction) (void *, switch_input_type_t);
 
-typedef void (*hangupFunction)(void);
-typedef char* (*inputFunction)(void*, switch_input_type_t);
-
 #ifndef _MANAGED
 #include <glib.h>
 #include <mono/jit/jit.h>
@@ -79,58 +77,109 @@
 #endif
 
 SWITCH_END_EXTERN_C
-
 #ifdef _MANAGED
 // this section remove linker error LNK4248 for these opaque structures
-	struct switch_core_session {char foo[];};
-	struct apr_pool_t {char foo[];};
-	struct switch_channel {char foo[];};
-	struct apr_thread_t {char foo[];};
-	struct switch_hash {char foo[];};
-	struct apr_thread_mutex_t {char foo[];};
-	struct switch_network_list {char foo[];};
-	struct switch_xml_binding {char foo[];};
-	struct apr_sockaddr_t {char foo[];};
-	struct switch_core_port_allocator {char foo[];};
-	struct switch_media_bug {char foo[];};
-	struct switch_rtp {char foo[];};
-	struct sqlite3_stmt {char foo[];};
-	struct switch_buffer {char foo[];};
-	struct switch_ivr_menu {char foo[];};
-	struct switch_event_node {char foo[];};
-	struct switch_ivr_digit_stream_parser {char foo[];};
-	struct sqlite3 {char foo[];};
-	struct switch_ivr_digit_stream {char foo[];};
-	struct real_pcre {char foo[];};
-	struct HashElem {char foo[];};
-	struct switch_ivr_menu_xml_ctx {char foo[];};
-	struct apr_file_t {char foo[];};
-	struct apr_thread_rwlock_t {char foo[];};
-	struct apr_pollfd_t {char foo[];};
-	struct apr_queue_t {char foo[];};
-	struct apr_socket_t {char foo[];};
+	struct switch_core_session {
+	char foo[];
+};
+struct apr_pool_t {
+	char foo[];
+};
+struct switch_channel {
+	char foo[];
+};
+struct apr_thread_t {
+	char foo[];
+};
+struct switch_hash {
+	char foo[];
+};
+struct apr_thread_mutex_t {
+	char foo[];
+};
+struct switch_network_list {
+	char foo[];
+};
+struct switch_xml_binding {
+	char foo[];
+};
+struct apr_sockaddr_t {
+	char foo[];
+};
+struct switch_core_port_allocator {
+	char foo[];
+};
+struct switch_media_bug {
+	char foo[];
+};
+struct switch_rtp {
+	char foo[];
+};
+struct sqlite3_stmt {
+	char foo[];
+};
+struct switch_buffer {
+	char foo[];
+};
+struct switch_ivr_menu {
+	char foo[];
+};
+struct switch_event_node {
+	char foo[];
+};
+struct switch_ivr_digit_stream_parser {
+	char foo[];
+};
+struct sqlite3 {
+	char foo[];
+};
+struct switch_ivr_digit_stream {
+	char foo[];
+};
+struct real_pcre {
+	char foo[];
+};
+struct HashElem {
+	char foo[];
+};
+struct switch_ivr_menu_xml_ctx {
+	char foo[];
+};
+struct apr_file_t {
+	char foo[];
+};
+struct apr_thread_rwlock_t {
+	char foo[];
+};
+struct apr_pollfd_t {
+	char foo[];
+};
+struct apr_queue_t {
+	char foo[];
+};
+struct apr_socket_t {
+	char foo[];
+};
 // LNK Error
 
 using namespace System;
 using namespace System::Reflection;
 using namespace System::Runtime::InteropServices;
 
-public ref class FreeSwitchManaged
-{
-public:
-	static Assembly^ mod_dotnet_managed;
-	static MethodInfo^ loadMethod;
+public ref class FreeSwitchManaged {
+  public:
+	static Assembly ^ mod_dotnet_managed;
+	static MethodInfo ^ loadMethod;
 };
 
 #endif
 
-class ManagedSession : public CoreSession 
-{
-public:
+class ManagedSession:public CoreSession {
+  public:
 	ManagedSession(void);
 	ManagedSession(char *uuid);
 	ManagedSession(switch_core_session_t *session);
-	virtual ~ManagedSession();        
+	virtual ~ ManagedSession();
 
 	virtual bool begin_allow_threads();
 	virtual bool end_allow_threads();
@@ -138,8 +187,8 @@
 	virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
 
 	// P/Invoke function pointer to delegates
-	inputFunction dtmfDelegate; 
-	hangupFunction hangupDelegate; 
+	inputFunction dtmfDelegate;
+	hangupFunction hangupDelegate;
 };
 
 #endif

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_managed/freeswitch_wrap.cxx (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_managed/freeswitch_wrap.cxx	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_managed/freeswitch_wrap.cxx	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,30709 +1,31498 @@
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- * 
- * This file is not intended to be easily readable and contains a number of 
- * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG 
- * interface file instead. 
- * ----------------------------------------------------------------------------- */
-
-
-#ifdef __cplusplus
-template<typename T> class SwigValueWrapper {
-    T *tt;
-public:
-    SwigValueWrapper() : tt(0) { }
-    SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
-    SwigValueWrapper(const T& t) : tt(new T(t)) { }
-    ~SwigValueWrapper() { delete tt; } 
-    SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
-    operator T&() const { return *tt; }
-    T *operator&() { return tt; }
-private:
-    SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
-};
-
-template <typename T> T SwigValueInit() {
-  return T();
-}
-#endif
-
-/* -----------------------------------------------------------------------------
- *  This section contains generic SWIG labels for method/variable
- *  declarations/attributes, and other compiler dependent labels.
- * ----------------------------------------------------------------------------- */
-
-/* template workaround for compilers that cannot correctly implement the C++ standard */
-#ifndef SWIGTEMPLATEDISAMBIGUATOR
-# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
-#  define SWIGTEMPLATEDISAMBIGUATOR template
-# elif defined(__HP_aCC)
-/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
-/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
-#  define SWIGTEMPLATEDISAMBIGUATOR template
-# else
-#  define SWIGTEMPLATEDISAMBIGUATOR
-# endif
-#endif
-
-/* inline attribute */
-#ifndef SWIGINLINE
-# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
-#   define SWIGINLINE inline
-# else
-#   define SWIGINLINE
-# endif
-#endif
-
-/* attribute recognised by some compilers to avoid 'unused' warnings */
-#ifndef SWIGUNUSED
-# if defined(__GNUC__)
-#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__)) 
-#   else
-#     define SWIGUNUSED
-#   endif
-# elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__)) 
-# else
-#   define SWIGUNUSED 
-# endif
-#endif
-
-#ifndef SWIGUNUSEDPARM
-# ifdef __cplusplus
-#   define SWIGUNUSEDPARM(p)
-# else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
-# endif
-#endif
-
-/* internal SWIG method */
-#ifndef SWIGINTERN
-# define SWIGINTERN static SWIGUNUSED
-#endif
-
-/* internal inline SWIG method */
-#ifndef SWIGINTERNINLINE
-# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
-#endif
-
-/* exporting methods */
-#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
-#  ifndef GCC_HASCLASSVISIBILITY
-#    define GCC_HASCLASSVISIBILITY
-#  endif
-#endif
-
-#ifndef SWIGEXPORT
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-#   if defined(STATIC_LINKED)
-#     define SWIGEXPORT
-#   else
-#     define SWIGEXPORT __declspec(dllexport)
-#   endif
-# else
-#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
-#     define SWIGEXPORT __attribute__ ((visibility("default")))
-#   else
-#     define SWIGEXPORT
-#   endif
-# endif
-#endif
-
-/* calling conventions for Windows */
-#ifndef SWIGSTDCALL
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-#   define SWIGSTDCALL __stdcall
-# else
-#   define SWIGSTDCALL
-# endif 
-#endif
-
-/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
-#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
-# define _CRT_SECURE_NO_DEPRECATE
-#endif
-
-/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
-#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
-# define _SCL_SECURE_NO_DEPRECATE
-#endif
-
-
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-
-
-/* Support for throwing C# exceptions from C/C++. There are two types: 
- * Exceptions that take a message and ArgumentExceptions that take a message and a parameter name. */
-typedef enum {
-  SWIG_CSharpApplicationException,
-  SWIG_CSharpArithmeticException,
-  SWIG_CSharpDivideByZeroException,
-  SWIG_CSharpIndexOutOfRangeException,
-  SWIG_CSharpInvalidCastException,
-  SWIG_CSharpInvalidOperationException,
-  SWIG_CSharpIOException,
-  SWIG_CSharpNullReferenceException,
-  SWIG_CSharpOutOfMemoryException,
-  SWIG_CSharpOverflowException,
-  SWIG_CSharpSystemException
-} SWIG_CSharpExceptionCodes;
-
-typedef enum {
-  SWIG_CSharpArgumentException,
-  SWIG_CSharpArgumentNullException,
-  SWIG_CSharpArgumentOutOfRangeException
-} SWIG_CSharpExceptionArgumentCodes;
-
-typedef void (SWIGSTDCALL* SWIG_CSharpExceptionCallback_t)(const char *);
-typedef void (SWIGSTDCALL* SWIG_CSharpExceptionArgumentCallback_t)(const char *, const char *);
-
-typedef struct {
-  SWIG_CSharpExceptionCodes code;
-  SWIG_CSharpExceptionCallback_t callback;
-} SWIG_CSharpException_t;
-
-typedef struct {
-  SWIG_CSharpExceptionArgumentCodes code;
-  SWIG_CSharpExceptionArgumentCallback_t callback;
-} SWIG_CSharpExceptionArgument_t;
-
-static SWIG_CSharpException_t SWIG_csharp_exceptions[] = {
-  { SWIG_CSharpApplicationException, NULL },
-  { SWIG_CSharpArithmeticException, NULL },
-  { SWIG_CSharpDivideByZeroException, NULL },
-  { SWIG_CSharpIndexOutOfRangeException, NULL },
-  { SWIG_CSharpInvalidCastException, NULL },
-  { SWIG_CSharpInvalidOperationException, NULL },
-  { SWIG_CSharpIOException, NULL },
-  { SWIG_CSharpNullReferenceException, NULL },
-  { SWIG_CSharpOutOfMemoryException, NULL },
-  { SWIG_CSharpOverflowException, NULL },
-  { SWIG_CSharpSystemException, NULL }
-};
-
-static SWIG_CSharpExceptionArgument_t SWIG_csharp_exceptions_argument[] = {
-  { SWIG_CSharpArgumentException, NULL },
-  { SWIG_CSharpArgumentNullException, NULL },
-  { SWIG_CSharpArgumentOutOfRangeException, NULL },
-};
-
-static void SWIGUNUSED SWIG_CSharpSetPendingException(SWIG_CSharpExceptionCodes code, const char *msg) {
-  SWIG_CSharpExceptionCallback_t callback = SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback;
-  if (code >=0 && (size_t)code < sizeof(SWIG_csharp_exceptions)/sizeof(SWIG_CSharpException_t)) {
-    callback = SWIG_csharp_exceptions[code].callback;
-  }
-  callback(msg);
-}
-
-static void SWIGUNUSED SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpExceptionArgumentCodes code, const char *msg, const char *param_name) {
-  SWIG_CSharpExceptionArgumentCallback_t callback = SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback;
-  if (code >=0 && (size_t)code < sizeof(SWIG_csharp_exceptions_argument)/sizeof(SWIG_CSharpExceptionArgument_t)) {
-    callback = SWIG_csharp_exceptions_argument[code].callback;
-  }
-  callback(msg, param_name);
-}
-
-
-#ifdef __cplusplus
-extern "C" 
-#endif
-SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionCallbacks_freeswitch(
-                                                SWIG_CSharpExceptionCallback_t applicationCallback,
-                                                SWIG_CSharpExceptionCallback_t arithmeticCallback,
-                                                SWIG_CSharpExceptionCallback_t divideByZeroCallback, 
-                                                SWIG_CSharpExceptionCallback_t indexOutOfRangeCallback, 
-                                                SWIG_CSharpExceptionCallback_t invalidCastCallback,
-                                                SWIG_CSharpExceptionCallback_t invalidOperationCallback,
-                                                SWIG_CSharpExceptionCallback_t ioCallback,
-                                                SWIG_CSharpExceptionCallback_t nullReferenceCallback,
-                                                SWIG_CSharpExceptionCallback_t outOfMemoryCallback, 
-                                                SWIG_CSharpExceptionCallback_t overflowCallback, 
-                                                SWIG_CSharpExceptionCallback_t systemCallback) {
-  SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback = applicationCallback;
-  SWIG_csharp_exceptions[SWIG_CSharpArithmeticException].callback = arithmeticCallback;
-  SWIG_csharp_exceptions[SWIG_CSharpDivideByZeroException].callback = divideByZeroCallback;
-  SWIG_csharp_exceptions[SWIG_CSharpIndexOutOfRangeException].callback = indexOutOfRangeCallback;
-  SWIG_csharp_exceptions[SWIG_CSharpInvalidCastException].callback = invalidCastCallback;
-  SWIG_csharp_exceptions[SWIG_CSharpInvalidOperationException].callback = invalidOperationCallback;
-  SWIG_csharp_exceptions[SWIG_CSharpIOException].callback = ioCallback;
-  SWIG_csharp_exceptions[SWIG_CSharpNullReferenceException].callback = nullReferenceCallback;
-  SWIG_csharp_exceptions[SWIG_CSharpOutOfMemoryException].callback = outOfMemoryCallback;
-  SWIG_csharp_exceptions[SWIG_CSharpOverflowException].callback = overflowCallback;
-  SWIG_csharp_exceptions[SWIG_CSharpSystemException].callback = systemCallback;
-}
-
-#ifdef __cplusplus
-extern "C" 
-#endif
-SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_freeswitch(
-                                                SWIG_CSharpExceptionArgumentCallback_t argumentCallback,
-                                                SWIG_CSharpExceptionArgumentCallback_t argumentNullCallback,
-                                                SWIG_CSharpExceptionArgumentCallback_t argumentOutOfRangeCallback) {
-  SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback = argumentCallback;
-  SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentNullException].callback = argumentNullCallback;
-  SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentOutOfRangeException].callback = argumentOutOfRangeCallback;
-}
-
-
-/* Contract support */
-
-#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } else
-
-
-
-/* Callback for returning strings to C# without leaking memory */
-#ifndef _MANAGED
-#include <glib.h>
-#include <mono/jit/jit.h>
-#include <mono/metadata/environment.h>
-#include <mono/metadata/mono-config.h>
-#include <mono/metadata/threads.h>
-#include <mono/metadata/debug-helpers.h>
-#endif
-
-typedef char * (SWIGSTDCALL* SWIG_CSharpStringHelperCallback)(const char *);
-static SWIG_CSharpStringHelperCallback SWIG_csharp_string_callback_real = NULL;
-
-
-#ifdef __cplusplus
-extern "C" 
-#endif
-SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_freeswitch(SWIG_CSharpStringHelperCallback callback) {
-	/* Set this only once, in the main appdomain */
-	if (SWIG_csharp_string_callback_real == NULL) SWIG_csharp_string_callback_real = callback;
-}
-char * SWIG_csharp_string_callback(const char * str) {
-#ifndef _MANAGED
-	// Mono won't transition appdomains properly after the callback, so we force it
-	MonoDomain* dom = mono_domain_get();
-	char* res = SWIG_csharp_string_callback_real(str);
-	mono_domain_set(dom, true);
-	return res;
-#else
-	return SWIG_csharp_string_callback_real(str);
-#endif
-}
-
-
-#include "switch.h"
-#include "switch_cpp.h"
-#include "freeswitch_managed.h"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_FREESWITCH_PEN_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "27880";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_FREESWITCH_OID_PREFIX_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) ".1.3.6.1.4.1.27880";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_FREESWITCH_ITAD_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "543";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp___EXTENSIONS___get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 1;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp___BSD_VISIBLE_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 1;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ENT_ORIGINATE_DELIM_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) ":_:";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_BLANK_STRING_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\0";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_ESC_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\33[";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char SWIGSTDCALL CSharp_SWITCH_SEQ_HOME_CHAR_get() {
-  char jresult ;
-  char result;
-  
-  result = (char) 'H';
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_HOME_CHAR_STR_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "H";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char SWIGSTDCALL CSharp_SWITCH_SEQ_CLEARLINE_CHAR_get() {
-  char jresult ;
-  char result;
-  
-  result = (char) '1';
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_CLEARLINE_CHAR_STR_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "1";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_CLEARLINEEND_CHAR_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "K";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char SWIGSTDCALL CSharp_SWITCH_SEQ_CLEARSCR_CHAR0_get() {
-  char jresult ;
-  char result;
-  
-  result = (char) '2';
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char SWIGSTDCALL CSharp_SWITCH_SEQ_CLEARSCR_CHAR1_get() {
-  char jresult ;
-  char result;
-  
-  result = (char) 'J';
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_CLEARSCR_CHAR_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "2J";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_AND_COLOR_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) ";";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_END_COLOR_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "m";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_F_BLACK_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "30";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_F_RED_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "31";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_F_GREEN_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "32";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_F_YELLOW_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "33";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_F_BLUE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "34";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_F_MAGEN_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "35";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_F_CYAN_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "36";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_F_WHITE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "37";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_B_BLACK_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "40";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_B_RED_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "41";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_B_GREEN_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "42";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_B_YELLOW_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "43";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_B_BLUE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "44";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_B_MAGEN_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "45";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_B_CYAN_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "46";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_B_WHITE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "47";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_FBLACK_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\33[30m";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_FRED_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\33[31m";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_FGREEN_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\33[32m";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_FYELLOW_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\33[33m";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_FBLUE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\33[34m";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_FMAGEN_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\33[35m";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_FCYAN_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\33[36m";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_FWHITE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\33[37m";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_BBLACK_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\33[40m";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_BRED_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\33[41m";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_BGREEN_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\33[42m";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_BYELLOW_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\33[43m";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_BBLUE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\33[44m";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_BMAGEN_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\33[45m";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_BCYAN_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\33[46m";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_BWHITE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\33[47m";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_HOME_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\33[H";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_CLEARLINE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\33[1";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_CLEARLINEEND_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\33[K";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_CLEARSCR_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "\33[2J\33[H";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_DEFAULT_DTMF_DURATION_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 2000;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MIN_DTMF_DURATION_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 400;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_DTMF_DURATION_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 192000;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PATH_SEPARATOR_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "/";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_URL_SEPARATOR_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "://";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "ignore_display_updates";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_AUDIO_SPOOL_PATH_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "audio_spool_path";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "bridge_hangup_cause";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_READ_TERMINATOR_USED_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "read_terminator_used";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "send_silence_when_idle";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CURRENT_APPLICATION_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "current_application";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CURRENT_APPLICATION_DATA_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "current_application_data";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "current_application_response";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "enable_heartbeat_events";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "bypass_media_after_bridge";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_READ_RESULT_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "read_result";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_COPY_XML_CDR_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "copy_xml_cdr";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "proto_specific_hangup_cause";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "execute_on_answer";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "execute_on_pre_answer";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "execute_on_media";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "api_on_answer";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "execute_on_ring";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CALL_TIMEOUT_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "call_timeout";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_HOLDING_UUID_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "holding_uuid";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SOFT_HOLDING_UUID_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "soft_holding_uuid";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_API_BRIDGE_END_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "api_after_bridge";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_API_HANGUP_HOOK_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "api_hangup_hook";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "session_in_hangup_hook";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PROCESS_CDR_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "process_cdr";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_BRIDGE_CHANNEL_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "bridge_channel";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_NAME_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "channel_name";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_BRIDGE_UUID_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "bridge_uuid";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CONTINUE_ON_FAILURE_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "continue_on_fail";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PLAYBACK_TERMINATORS_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "playback_terminators";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PLAYBACK_TERMINATOR_USED_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "playback_terminator_used";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CACHE_SPEECH_HANDLES_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "cache_speech_handles";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "__cache_speech_handles_obj__";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_BYPASS_MEDIA_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "bypass_media";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PROXY_MEDIA_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "proxy_media";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "endpoint_disposition";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_HOLD_MUSIC_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "hold_music";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_EXPORT_VARS_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "export_vars";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_R_SDP_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "switch_r_sdp";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_L_SDP_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "switch_l_sdp";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_B_SDP_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "switch_m_sdp";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_BRIDGE_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "bridge_to";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SIGNAL_BRIDGE_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "signal_bridge_to";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SIGNAL_BOND_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "signal_bond";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ORIGINATOR_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "originator";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ORIGINATOR_CODEC_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "originator_codec";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "originator_video_codec";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_LOCAL_MEDIA_IP_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "local_media_ip";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_LOCAL_MEDIA_PORT_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "local_media_port";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_REMOTE_MEDIA_IP_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "remote_media_ip";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_REMOTE_MEDIA_PORT_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "remote_media_port";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_REMOTE_VIDEO_IP_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "remote_video_ip";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_REMOTE_VIDEO_PORT_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "remote_video_port";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_LOCAL_VIDEO_IP_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "local_video_ip";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_LOCAL_VIDEO_PORT_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "local_video_port";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "hangup_after_bridge";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PARK_AFTER_BRIDGE_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "park_after_bridge";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "transfer_after_bridge";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "exec_after_bridge_app";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "exec_after_bridge_arg";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_MAX_FORWARDS_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "max_forwards";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_DISABLE_APP_LOG_VARIABLE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "disable_app_log";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SPEECH_KEY_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "speech";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_UUID_BRIDGE_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "uuid_bridge";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_BITS_PER_BYTE_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 8;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_DEFAULT_FILE_BUFFER_LEN_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 65536;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_DTMF_LOG_LEN_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 1000;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_dtmf_t_digit_set(void * jarg1, char jarg2) {
-  switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ;
-  char arg2 ;
-  
-  arg1 = (switch_dtmf_t *)jarg1; 
-  arg2 = (char)jarg2; 
-  if (arg1) (arg1)->digit = arg2;
-  
-}
-
-
-SWIGEXPORT char SWIGSTDCALL CSharp_switch_dtmf_t_digit_get(void * jarg1) {
-  char jresult ;
-  switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ;
-  char result;
-  
-  arg1 = (switch_dtmf_t *)jarg1; 
-  result = (char) ((arg1)->digit);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_dtmf_t_duration_set(void * jarg1, unsigned long jarg2) {
-  switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_dtmf_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->duration = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_dtmf_t_duration_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_dtmf_t *)jarg1; 
-  result = (uint32_t) ((arg1)->duration);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_dtmf_t() {
-  void * jresult ;
-  switch_dtmf_t *result = 0 ;
-  
-  result = (switch_dtmf_t *)new switch_dtmf_t();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_dtmf_t(void * jarg1) {
-  switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ;
-  
-  arg1 = (switch_dtmf_t *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_buf_set(void * jarg1, void * jarg2) {
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  switch_byte_t *arg2 = (switch_byte_t *) 0 ;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  arg2 = (switch_byte_t *)jarg2; 
-  if (arg1) (arg1)->buf = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_bitpack_t_buf_get(void * jarg1) {
-  void * jresult ;
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  switch_byte_t *result = 0 ;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  result = (switch_byte_t *) ((arg1)->buf);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_buflen_set(void * jarg1, unsigned long jarg2) {
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->buflen = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_bitpack_t_buflen_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  result = (uint32_t) ((arg1)->buflen);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_cur_set(void * jarg1, void * jarg2) {
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  switch_byte_t *arg2 = (switch_byte_t *) 0 ;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  arg2 = (switch_byte_t *)jarg2; 
-  if (arg1) (arg1)->cur = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_bitpack_t_cur_get(void * jarg1) {
-  void * jresult ;
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  switch_byte_t *result = 0 ;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  result = (switch_byte_t *) ((arg1)->cur);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_bytes_set(void * jarg1, unsigned long jarg2) {
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->bytes = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_bitpack_t_bytes_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  result = (uint32_t) ((arg1)->bytes);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_bits_tot_set(void * jarg1, unsigned long jarg2) {
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->bits_tot = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_bitpack_t_bits_tot_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  result = (uint32_t) ((arg1)->bits_tot);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_bits_cur_set(void * jarg1, unsigned char jarg2) {
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  switch_byte_t arg2 ;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  arg2 = (switch_byte_t)jarg2; 
-  if (arg1) (arg1)->bits_cur = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_bitpack_t_bits_cur_get(void * jarg1) {
-  unsigned char jresult ;
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  switch_byte_t result;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  result = (switch_byte_t) ((arg1)->bits_cur);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_bits_rem_set(void * jarg1, unsigned char jarg2) {
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  switch_byte_t arg2 ;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  arg2 = (switch_byte_t)jarg2; 
-  if (arg1) (arg1)->bits_rem = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_bitpack_t_bits_rem_get(void * jarg1) {
-  unsigned char jresult ;
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  switch_byte_t result;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  result = (switch_byte_t) ((arg1)->bits_rem);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_frame_bits_set(void * jarg1, unsigned char jarg2) {
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  switch_byte_t arg2 ;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  arg2 = (switch_byte_t)jarg2; 
-  if (arg1) (arg1)->frame_bits = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_bitpack_t_frame_bits_get(void * jarg1) {
-  unsigned char jresult ;
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  switch_byte_t result;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  result = (switch_byte_t) ((arg1)->frame_bits);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_shiftby_set(void * jarg1, unsigned char jarg2) {
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  switch_byte_t arg2 ;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  arg2 = (switch_byte_t)jarg2; 
-  if (arg1) (arg1)->shiftby = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_bitpack_t_shiftby_get(void * jarg1) {
-  unsigned char jresult ;
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  switch_byte_t result;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  result = (switch_byte_t) ((arg1)->shiftby);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_this_byte_set(void * jarg1, unsigned char jarg2) {
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  switch_byte_t arg2 ;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  arg2 = (switch_byte_t)jarg2; 
-  if (arg1) (arg1)->this_byte = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_bitpack_t_this_byte_get(void * jarg1) {
-  unsigned char jresult ;
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  switch_byte_t result;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  result = (switch_byte_t) ((arg1)->this_byte);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_under_set(void * jarg1, unsigned char jarg2) {
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  switch_byte_t arg2 ;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  arg2 = (switch_byte_t)jarg2; 
-  if (arg1) (arg1)->under = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_bitpack_t_under_get(void * jarg1) {
-  unsigned char jresult ;
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  switch_byte_t result;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  result = (switch_byte_t) ((arg1)->under);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_over_set(void * jarg1, unsigned char jarg2) {
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  switch_byte_t arg2 ;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  arg2 = (switch_byte_t)jarg2; 
-  if (arg1) (arg1)->over = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_bitpack_t_over_get(void * jarg1) {
-  unsigned char jresult ;
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  switch_byte_t result;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  result = (switch_byte_t) ((arg1)->over);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_mode_set(void * jarg1, int jarg2) {
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  switch_bitpack_mode_t arg2 ;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  arg2 = (switch_bitpack_mode_t)jarg2; 
-  if (arg1) (arg1)->mode = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_bitpack_t_mode_get(void * jarg1) {
-  int jresult ;
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  switch_bitpack_mode_t result;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  result = (switch_bitpack_mode_t) ((arg1)->mode);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_bitpack_t() {
-  void * jresult ;
-  switch_bitpack_t *result = 0 ;
-  
-  result = (switch_bitpack_t *)new switch_bitpack_t();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_bitpack_t(void * jarg1) {
-  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
-  
-  arg1 = (switch_bitpack_t *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_base_dir_set(void * jarg1, char * jarg2) {
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->base_dir) delete [] arg1->base_dir;
-    if (arg2) {
-      arg1->base_dir = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->base_dir, (const char *)arg2);
-    } else {
-      arg1->base_dir = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_base_dir_get(void * jarg1) {
-  char * jresult ;
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  result = (char *) ((arg1)->base_dir);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_mod_dir_set(void * jarg1, char * jarg2) {
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->mod_dir) delete [] arg1->mod_dir;
-    if (arg2) {
-      arg1->mod_dir = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->mod_dir, (const char *)arg2);
-    } else {
-      arg1->mod_dir = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_mod_dir_get(void * jarg1) {
-  char * jresult ;
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  result = (char *) ((arg1)->mod_dir);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_conf_dir_set(void * jarg1, char * jarg2) {
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->conf_dir) delete [] arg1->conf_dir;
-    if (arg2) {
-      arg1->conf_dir = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->conf_dir, (const char *)arg2);
-    } else {
-      arg1->conf_dir = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_conf_dir_get(void * jarg1) {
-  char * jresult ;
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  result = (char *) ((arg1)->conf_dir);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_log_dir_set(void * jarg1, char * jarg2) {
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->log_dir) delete [] arg1->log_dir;
-    if (arg2) {
-      arg1->log_dir = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->log_dir, (const char *)arg2);
-    } else {
-      arg1->log_dir = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_log_dir_get(void * jarg1) {
-  char * jresult ;
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  result = (char *) ((arg1)->log_dir);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_run_dir_set(void * jarg1, char * jarg2) {
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->run_dir) delete [] arg1->run_dir;
-    if (arg2) {
-      arg1->run_dir = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->run_dir, (const char *)arg2);
-    } else {
-      arg1->run_dir = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_run_dir_get(void * jarg1) {
-  char * jresult ;
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  result = (char *) ((arg1)->run_dir);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_db_dir_set(void * jarg1, char * jarg2) {
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->db_dir) delete [] arg1->db_dir;
-    if (arg2) {
-      arg1->db_dir = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->db_dir, (const char *)arg2);
-    } else {
-      arg1->db_dir = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_db_dir_get(void * jarg1) {
-  char * jresult ;
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  result = (char *) ((arg1)->db_dir);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_script_dir_set(void * jarg1, char * jarg2) {
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->script_dir) delete [] arg1->script_dir;
-    if (arg2) {
-      arg1->script_dir = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->script_dir, (const char *)arg2);
-    } else {
-      arg1->script_dir = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_script_dir_get(void * jarg1) {
-  char * jresult ;
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  result = (char *) ((arg1)->script_dir);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_temp_dir_set(void * jarg1, char * jarg2) {
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->temp_dir) delete [] arg1->temp_dir;
-    if (arg2) {
-      arg1->temp_dir = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->temp_dir, (const char *)arg2);
-    } else {
-      arg1->temp_dir = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_temp_dir_get(void * jarg1) {
-  char * jresult ;
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  result = (char *) ((arg1)->temp_dir);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_htdocs_dir_set(void * jarg1, char * jarg2) {
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->htdocs_dir) delete [] arg1->htdocs_dir;
-    if (arg2) {
-      arg1->htdocs_dir = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->htdocs_dir, (const char *)arg2);
-    } else {
-      arg1->htdocs_dir = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_htdocs_dir_get(void * jarg1) {
-  char * jresult ;
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  result = (char *) ((arg1)->htdocs_dir);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_grammar_dir_set(void * jarg1, char * jarg2) {
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->grammar_dir) delete [] arg1->grammar_dir;
-    if (arg2) {
-      arg1->grammar_dir = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->grammar_dir, (const char *)arg2);
-    } else {
-      arg1->grammar_dir = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_grammar_dir_get(void * jarg1) {
-  char * jresult ;
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  result = (char *) ((arg1)->grammar_dir);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_storage_dir_set(void * jarg1, char * jarg2) {
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->storage_dir) delete [] arg1->storage_dir;
-    if (arg2) {
-      arg1->storage_dir = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->storage_dir, (const char *)arg2);
-    } else {
-      arg1->storage_dir = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_storage_dir_get(void * jarg1) {
-  char * jresult ;
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  result = (char *) ((arg1)->storage_dir);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_directories() {
-  void * jresult ;
-  switch_directories *result = 0 ;
-  
-  result = (switch_directories *)new switch_directories();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_directories(void * jarg1) {
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_SWITCH_GLOBAL_dirs_set(void * jarg1) {
-  switch_directories *arg1 = (switch_directories *) 0 ;
-  
-  arg1 = (switch_directories *)jarg1; 
-  SWITCH_GLOBAL_dirs = *arg1;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_SWITCH_GLOBAL_dirs_get() {
-  void * jresult ;
-  switch_directories *result = 0 ;
-  
-  result = (switch_directories *)&SWITCH_GLOBAL_dirs;
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_STACKS_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 16;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_THREAD_STACKSIZE_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 240*1024;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_SYSTEM_THREAD_STACKSIZE_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 8192*1024;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_INTERVAL_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 120;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_INTERVAL_PAD_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 10;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_SAMPLE_LEN_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 48;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_BYTES_PER_SAMPLE_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 2;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RECOMMENDED_BUFFER_SIZE_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 4096;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_CODECS_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 50;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_STATE_HANDLERS_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 30;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_QUEUE_LEN_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 100000;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_MANAGEMENT_BUFFER_LEN_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 1024*8;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_raw_bytes_set(void * jarg1, void * jarg2) {
-  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_rtp_numbers_t *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->raw_bytes = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_raw_bytes_get(void * jarg1) {
-  void * jresult ;
-  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_rtp_numbers_t *)jarg1; 
-  result =  ((arg1)->raw_bytes);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_media_bytes_set(void * jarg1, void * jarg2) {
-  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_rtp_numbers_t *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->media_bytes = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_media_bytes_get(void * jarg1) {
-  void * jresult ;
-  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_rtp_numbers_t *)jarg1; 
-  result =  ((arg1)->media_bytes);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_packet_count_set(void * jarg1, void * jarg2) {
-  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_rtp_numbers_t *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->packet_count = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_packet_count_get(void * jarg1) {
-  void * jresult ;
-  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_rtp_numbers_t *)jarg1; 
-  result =  ((arg1)->packet_count);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_media_packet_count_set(void * jarg1, void * jarg2) {
-  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_rtp_numbers_t *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->media_packet_count = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_media_packet_count_get(void * jarg1) {
-  void * jresult ;
-  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_rtp_numbers_t *)jarg1; 
-  result =  ((arg1)->media_packet_count);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_skip_packet_count_set(void * jarg1, void * jarg2) {
-  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_rtp_numbers_t *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->skip_packet_count = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_skip_packet_count_get(void * jarg1) {
-  void * jresult ;
-  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_rtp_numbers_t *)jarg1; 
-  result =  ((arg1)->skip_packet_count);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_jb_packet_count_set(void * jarg1, void * jarg2) {
-  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_rtp_numbers_t *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->jb_packet_count = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_jb_packet_count_get(void * jarg1) {
-  void * jresult ;
-  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_rtp_numbers_t *)jarg1; 
-  result =  ((arg1)->jb_packet_count);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_dtmf_packet_count_set(void * jarg1, void * jarg2) {
-  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_rtp_numbers_t *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->dtmf_packet_count = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_dtmf_packet_count_get(void * jarg1) {
-  void * jresult ;
-  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_rtp_numbers_t *)jarg1; 
-  result =  ((arg1)->dtmf_packet_count);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_cng_packet_count_set(void * jarg1, void * jarg2) {
-  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_rtp_numbers_t *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->cng_packet_count = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_cng_packet_count_get(void * jarg1) {
-  void * jresult ;
-  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_rtp_numbers_t *)jarg1; 
-  result =  ((arg1)->cng_packet_count);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_flush_packet_count_set(void * jarg1, void * jarg2) {
-  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_rtp_numbers_t *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->flush_packet_count = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_flush_packet_count_get(void * jarg1) {
-  void * jresult ;
-  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_rtp_numbers_t *)jarg1; 
-  result =  ((arg1)->flush_packet_count);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_rtp_numbers_t() {
-  void * jresult ;
-  switch_rtp_numbers_t *result = 0 ;
-  
-  result = (switch_rtp_numbers_t *)new switch_rtp_numbers_t();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_rtp_numbers_t(void * jarg1) {
-  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
-  
-  arg1 = (switch_rtp_numbers_t *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_stats_t_inbound_set(void * jarg1, void * jarg2) {
-  switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ;
-  switch_rtp_numbers_t *arg2 = (switch_rtp_numbers_t *) 0 ;
-  
-  arg1 = (switch_rtp_stats_t *)jarg1; 
-  arg2 = (switch_rtp_numbers_t *)jarg2; 
-  if (arg1) (arg1)->inbound = *arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_stats_t_inbound_get(void * jarg1) {
-  void * jresult ;
-  switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ;
-  switch_rtp_numbers_t *result = 0 ;
-  
-  arg1 = (switch_rtp_stats_t *)jarg1; 
-  result = (switch_rtp_numbers_t *)& ((arg1)->inbound);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_stats_t_outbound_set(void * jarg1, void * jarg2) {
-  switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ;
-  switch_rtp_numbers_t *arg2 = (switch_rtp_numbers_t *) 0 ;
-  
-  arg1 = (switch_rtp_stats_t *)jarg1; 
-  arg2 = (switch_rtp_numbers_t *)jarg2; 
-  if (arg1) (arg1)->outbound = *arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_stats_t_outbound_get(void * jarg1) {
-  void * jresult ;
-  switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ;
-  switch_rtp_numbers_t *result = 0 ;
-  
-  arg1 = (switch_rtp_stats_t *)jarg1; 
-  result = (switch_rtp_numbers_t *)& ((arg1)->outbound);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_rtp_stats_t() {
-  void * jresult ;
-  switch_rtp_stats_t *result = 0 ;
-  
-  result = (switch_rtp_stats_t *)new switch_rtp_stats_t();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_rtp_stats_t(void * jarg1) {
-  switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ;
-  
-  arg1 = (switch_rtp_stats_t *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_CNG_PAYLOAD_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 13;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_hdr_t_version_set(void * jarg1, unsigned int jarg2) {
-  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
-  unsigned int arg2 ;
-  
-  arg1 = (switch_rtp_hdr_t *)jarg1; 
-  arg2 = (unsigned int)jarg2; 
-  if (arg1) (arg1)->version = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_rtp_hdr_t_version_get(void * jarg1) {
-  unsigned int jresult ;
-  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
-  unsigned int result;
-  
-  arg1 = (switch_rtp_hdr_t *)jarg1; 
-  result = (unsigned int) ((arg1)->version);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_hdr_t_p_set(void * jarg1, unsigned int jarg2) {
-  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
-  unsigned int arg2 ;
-  
-  arg1 = (switch_rtp_hdr_t *)jarg1; 
-  arg2 = (unsigned int)jarg2; 
-  if (arg1) (arg1)->p = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_rtp_hdr_t_p_get(void * jarg1) {
-  unsigned int jresult ;
-  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
-  unsigned int result;
-  
-  arg1 = (switch_rtp_hdr_t *)jarg1; 
-  result = (unsigned int) ((arg1)->p);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_hdr_t_x_set(void * jarg1, unsigned int jarg2) {
-  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
-  unsigned int arg2 ;
-  
-  arg1 = (switch_rtp_hdr_t *)jarg1; 
-  arg2 = (unsigned int)jarg2; 
-  if (arg1) (arg1)->x = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_rtp_hdr_t_x_get(void * jarg1) {
-  unsigned int jresult ;
-  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
-  unsigned int result;
-  
-  arg1 = (switch_rtp_hdr_t *)jarg1; 
-  result = (unsigned int) ((arg1)->x);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_hdr_t_cc_set(void * jarg1, unsigned int jarg2) {
-  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
-  unsigned int arg2 ;
-  
-  arg1 = (switch_rtp_hdr_t *)jarg1; 
-  arg2 = (unsigned int)jarg2; 
-  if (arg1) (arg1)->cc = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_rtp_hdr_t_cc_get(void * jarg1) {
-  unsigned int jresult ;
-  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
-  unsigned int result;
-  
-  arg1 = (switch_rtp_hdr_t *)jarg1; 
-  result = (unsigned int) ((arg1)->cc);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_hdr_t_m_set(void * jarg1, unsigned int jarg2) {
-  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
-  unsigned int arg2 ;
-  
-  arg1 = (switch_rtp_hdr_t *)jarg1; 
-  arg2 = (unsigned int)jarg2; 
-  if (arg1) (arg1)->m = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_rtp_hdr_t_m_get(void * jarg1) {
-  unsigned int jresult ;
-  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
-  unsigned int result;
-  
-  arg1 = (switch_rtp_hdr_t *)jarg1; 
-  result = (unsigned int) ((arg1)->m);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_hdr_t_pt_set(void * jarg1, unsigned int jarg2) {
-  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
-  unsigned int arg2 ;
-  
-  arg1 = (switch_rtp_hdr_t *)jarg1; 
-  arg2 = (unsigned int)jarg2; 
-  if (arg1) (arg1)->pt = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_rtp_hdr_t_pt_get(void * jarg1) {
-  unsigned int jresult ;
-  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
-  unsigned int result;
-  
-  arg1 = (switch_rtp_hdr_t *)jarg1; 
-  result = (unsigned int) ((arg1)->pt);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_hdr_t_seq_set(void * jarg1, unsigned int jarg2) {
-  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
-  unsigned int arg2 ;
-  
-  arg1 = (switch_rtp_hdr_t *)jarg1; 
-  arg2 = (unsigned int)jarg2; 
-  if (arg1) (arg1)->seq = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_rtp_hdr_t_seq_get(void * jarg1) {
-  unsigned int jresult ;
-  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
-  unsigned int result;
-  
-  arg1 = (switch_rtp_hdr_t *)jarg1; 
-  result = (unsigned int) ((arg1)->seq);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_hdr_t_ts_set(void * jarg1, unsigned int jarg2) {
-  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
-  unsigned int arg2 ;
-  
-  arg1 = (switch_rtp_hdr_t *)jarg1; 
-  arg2 = (unsigned int)jarg2; 
-  if (arg1) (arg1)->ts = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_rtp_hdr_t_ts_get(void * jarg1) {
-  unsigned int jresult ;
-  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
-  unsigned int result;
-  
-  arg1 = (switch_rtp_hdr_t *)jarg1; 
-  result = (unsigned int) ((arg1)->ts);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_hdr_t_ssrc_set(void * jarg1, unsigned int jarg2) {
-  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
-  unsigned int arg2 ;
-  
-  arg1 = (switch_rtp_hdr_t *)jarg1; 
-  arg2 = (unsigned int)jarg2; 
-  if (arg1) (arg1)->ssrc = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_rtp_hdr_t_ssrc_get(void * jarg1) {
-  unsigned int jresult ;
-  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
-  unsigned int result;
-  
-  arg1 = (switch_rtp_hdr_t *)jarg1; 
-  result = (unsigned int) ((arg1)->ssrc);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_rtp_hdr_t() {
-  void * jresult ;
-  switch_rtp_hdr_t *result = 0 ;
-  
-  result = (switch_rtp_hdr_t *)new switch_rtp_hdr_t();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_rtp_hdr_t(void * jarg1) {
-  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
-  
-  arg1 = (switch_rtp_hdr_t *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_T38MaxBitRate_set(void * jarg1, unsigned long jarg2) {
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->T38MaxBitRate = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_t38_options_t_T38MaxBitRate_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  result = (uint32_t) ((arg1)->T38MaxBitRate);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxFillBitRemoval_set(void * jarg1, int jarg2) {
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  switch_bool_t arg2 ;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  arg2 = (switch_bool_t)jarg2; 
-  if (arg1) (arg1)->T38FaxFillBitRemoval = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxFillBitRemoval_get(void * jarg1) {
-  int jresult ;
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  switch_bool_t result;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  result = (switch_bool_t) ((arg1)->T38FaxFillBitRemoval);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxTranscodingMMR_set(void * jarg1, int jarg2) {
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  switch_bool_t arg2 ;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  arg2 = (switch_bool_t)jarg2; 
-  if (arg1) (arg1)->T38FaxTranscodingMMR = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxTranscodingMMR_get(void * jarg1) {
-  int jresult ;
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  switch_bool_t result;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  result = (switch_bool_t) ((arg1)->T38FaxTranscodingMMR);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxTranscodingJBIG_set(void * jarg1, int jarg2) {
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  switch_bool_t arg2 ;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  arg2 = (switch_bool_t)jarg2; 
-  if (arg1) (arg1)->T38FaxTranscodingJBIG = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxTranscodingJBIG_get(void * jarg1) {
-  int jresult ;
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  switch_bool_t result;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  result = (switch_bool_t) ((arg1)->T38FaxTranscodingJBIG);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxRateManagement_set(void * jarg1, char * jarg2) {
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->T38FaxRateManagement = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->T38FaxRateManagement, (const char *)arg2);
-    } else {
-      arg1->T38FaxRateManagement = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxRateManagement_get(void * jarg1) {
-  char * jresult ;
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  result = (char *) ((arg1)->T38FaxRateManagement);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxMaxBuffer_set(void * jarg1, unsigned long jarg2) {
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->T38FaxMaxBuffer = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxMaxBuffer_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  result = (uint32_t) ((arg1)->T38FaxMaxBuffer);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxMaxDatagram_set(void * jarg1, unsigned long jarg2) {
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->T38FaxMaxDatagram = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxMaxDatagram_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  result = (uint32_t) ((arg1)->T38FaxMaxDatagram);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxUdpEC_set(void * jarg1, char * jarg2) {
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->T38FaxUdpEC = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->T38FaxUdpEC, (const char *)arg2);
-    } else {
-      arg1->T38FaxUdpEC = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxUdpEC_get(void * jarg1) {
-  char * jresult ;
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  result = (char *) ((arg1)->T38FaxUdpEC);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_T38VendorInfo_set(void * jarg1, char * jarg2) {
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->T38VendorInfo = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->T38VendorInfo, (const char *)arg2);
-    } else {
-      arg1->T38VendorInfo = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_t38_options_t_T38VendorInfo_get(void * jarg1) {
-  char * jresult ;
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  result = (char *) ((arg1)->T38VendorInfo);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_ip_set(void * jarg1, char * jarg2) {
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->ip = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->ip, (const char *)arg2);
-    } else {
-      arg1->ip = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_t38_options_t_ip_get(void * jarg1) {
-  char * jresult ;
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  result = (char *) ((arg1)->ip);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_port_set(void * jarg1, unsigned long jarg2) {
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->port = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_t38_options_t_port_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  result = (uint32_t) ((arg1)->port);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_t38_options_t() {
-  void * jresult ;
-  switch_t38_options_t *result = 0 ;
-  
-  result = (switch_t38_options_t *)new switch_t38_options_t();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_t38_options_t(void * jarg1) {
-  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
-  
-  arg1 = (switch_t38_options_t *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_input_args_t_input_callback_set(void * jarg1, void * jarg2) {
-  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
-  switch_input_callback_function_t arg2 = (switch_input_callback_function_t) 0 ;
-  
-  arg1 = (switch_input_args_t *)jarg1; 
-  arg2 = (switch_input_callback_function_t)jarg2; 
-  if (arg1) (arg1)->input_callback = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_input_args_t_input_callback_get(void * jarg1) {
-  void * jresult ;
-  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
-  switch_input_callback_function_t result;
-  
-  arg1 = (switch_input_args_t *)jarg1; 
-  result = (switch_input_callback_function_t) ((arg1)->input_callback);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_input_args_t_buf_set(void * jarg1, void * jarg2) {
-  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_input_args_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->buf = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_input_args_t_buf_get(void * jarg1) {
-  void * jresult ;
-  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_input_args_t *)jarg1; 
-  result = (void *) ((arg1)->buf);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_input_args_t_buflen_set(void * jarg1, unsigned long jarg2) {
-  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_input_args_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->buflen = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_input_args_t_buflen_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_input_args_t *)jarg1; 
-  result = (uint32_t) ((arg1)->buflen);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_input_args_t_read_frame_callback_set(void * jarg1, void * jarg2) {
-  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
-  switch_read_frame_callback_function_t arg2 = (switch_read_frame_callback_function_t) 0 ;
-  
-  arg1 = (switch_input_args_t *)jarg1; 
-  arg2 = (switch_read_frame_callback_function_t)jarg2; 
-  if (arg1) (arg1)->read_frame_callback = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_input_args_t_read_frame_callback_get(void * jarg1) {
-  void * jresult ;
-  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
-  switch_read_frame_callback_function_t result;
-  
-  arg1 = (switch_input_args_t *)jarg1; 
-  result = (switch_read_frame_callback_function_t) ((arg1)->read_frame_callback);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_input_args_t_user_data_set(void * jarg1, void * jarg2) {
-  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_input_args_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->user_data = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_input_args_t_user_data_get(void * jarg1) {
-  void * jresult ;
-  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_input_args_t *)jarg1; 
-  result = (void *) ((arg1)->user_data);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_input_args_t() {
-  void * jresult ;
-  switch_input_args_t *result = 0 ;
-  
-  result = (switch_input_args_t *)new switch_input_args_t();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_input_args_t(void * jarg1) {
-  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
-  
-  arg1 = (switch_input_args_t *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_API_VERSION_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 4;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_function_table_t_switch_api_version_set(void * jarg1, int jarg2) {
-  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->switch_api_version = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_function_table_t_switch_api_version_get(void * jarg1) {
-  int jresult ;
-  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
-  int result;
-  
-  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
-  result = (int) ((arg1)->switch_api_version);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_function_table_t_load_set(void * jarg1, void * jarg2) {
-  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
-  switch_module_load_t arg2 = (switch_module_load_t) 0 ;
-  
-  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
-  arg2 = (switch_module_load_t)jarg2; 
-  if (arg1) (arg1)->load = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_function_table_t_load_get(void * jarg1) {
-  void * jresult ;
-  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
-  switch_module_load_t result;
-  
-  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
-  result = (switch_module_load_t) ((arg1)->load);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_function_table_t_shutdown_set(void * jarg1, void * jarg2) {
-  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
-  switch_module_shutdown_t arg2 = (switch_module_shutdown_t) 0 ;
-  
-  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
-  arg2 = (switch_module_shutdown_t)jarg2; 
-  if (arg1) (arg1)->shutdown = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_function_table_t_shutdown_get(void * jarg1) {
-  void * jresult ;
-  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
-  switch_module_shutdown_t result;
-  
-  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
-  result = (switch_module_shutdown_t) ((arg1)->shutdown);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_function_table_t_runtime_set(void * jarg1, void * jarg2) {
-  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
-  switch_module_runtime_t arg2 = (switch_module_runtime_t) 0 ;
-  
-  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
-  arg2 = (switch_module_runtime_t)jarg2; 
-  if (arg1) (arg1)->runtime = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_function_table_t_runtime_get(void * jarg1) {
-  void * jresult ;
-  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
-  switch_module_runtime_t result;
-  
-  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
-  result = (switch_module_runtime_t) ((arg1)->runtime);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_function_table_t_flags_set(void * jarg1, unsigned long jarg2) {
-  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
-  switch_module_flag_t arg2 ;
-  
-  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
-  arg2 = (switch_module_flag_t)jarg2; 
-  if (arg1) (arg1)->flags = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_loadable_module_function_table_t_flags_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
-  switch_module_flag_t result;
-  
-  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
-  result = (switch_module_flag_t) ((arg1)->flags);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_loadable_module_function_table_t() {
-  void * jresult ;
-  switch_loadable_module_function_table_t *result = 0 ;
-  
-  result = (switch_loadable_module_function_table_t *)new switch_loadable_module_function_table_t();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_loadable_module_function_table_t(void * jarg1) {
-  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
-  
-  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_close(void * jarg1) {
-  int jresult ;
-  switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
-  int result;
-  
-  arg1 = (switch_core_db_t *)jarg1; 
-  result = (int)switch_core_db_close(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_open(char * jarg1, void * jarg2) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_core_db_t **arg2 = (switch_core_db_t **) 0 ;
-  int result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_core_db_t **)jarg2; 
-  result = (int)switch_core_db_open((char const *)arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_db_column_text(void * jarg1, int jarg2) {
-  void * jresult ;
-  switch_core_db_stmt_t *arg1 = (switch_core_db_stmt_t *) 0 ;
-  int arg2 ;
-  unsigned char *result = 0 ;
-  
-  arg1 = (switch_core_db_stmt_t *)jarg1; 
-  arg2 = (int)jarg2; 
-  result = (unsigned char *)switch_core_db_column_text(arg1,arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_db_column_name(void * jarg1, int jarg2) {
-  char * jresult ;
-  switch_core_db_stmt_t *arg1 = (switch_core_db_stmt_t *) 0 ;
-  int arg2 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_core_db_stmt_t *)jarg1; 
-  arg2 = (int)jarg2; 
-  result = (char *)switch_core_db_column_name(arg1,arg2);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_column_count(void * jarg1) {
-  int jresult ;
-  switch_core_db_stmt_t *arg1 = (switch_core_db_stmt_t *) 0 ;
-  int result;
-  
-  arg1 = (switch_core_db_stmt_t *)jarg1; 
-  result = (int)switch_core_db_column_count(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_db_errmsg(void * jarg1) {
-  char * jresult ;
-  switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_core_db_t *)jarg1; 
-  result = (char *)switch_core_db_errmsg(arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_exec(void * jarg1, char * jarg2, void * jarg3, void * jarg4, void * jarg5) {
-  int jresult ;
-  switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_core_db_callback_func_t arg3 = (switch_core_db_callback_func_t) 0 ;
-  void *arg4 = (void *) 0 ;
-  char **arg5 = (char **) 0 ;
-  int result;
-  
-  arg1 = (switch_core_db_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_core_db_callback_func_t)jarg3; 
-  arg4 = (void *)jarg4; 
-  arg5 = (char **)jarg5; 
-  result = (int)switch_core_db_exec(arg1,(char const *)arg2,arg3,arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_finalize(void * jarg1) {
-  int jresult ;
-  switch_core_db_stmt_t *arg1 = (switch_core_db_stmt_t *) 0 ;
-  int result;
-  
-  arg1 = (switch_core_db_stmt_t *)jarg1; 
-  result = (int)switch_core_db_finalize(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_prepare(void * jarg1, char * jarg2, int jarg3, void * jarg4, void * jarg5) {
-  int jresult ;
-  switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int arg3 ;
-  switch_core_db_stmt_t **arg4 = (switch_core_db_stmt_t **) 0 ;
-  char **arg5 = (char **) 0 ;
-  int result;
-  
-  arg1 = (switch_core_db_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (int)jarg3; 
-  arg4 = (switch_core_db_stmt_t **)jarg4; 
-  arg5 = (char **)jarg5; 
-  result = (int)switch_core_db_prepare(arg1,(char const *)arg2,arg3,arg4,(char const **)arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_step(void * jarg1) {
-  int jresult ;
-  switch_core_db_stmt_t *arg1 = (switch_core_db_stmt_t *) 0 ;
-  int result;
-  
-  arg1 = (switch_core_db_stmt_t *)jarg1; 
-  result = (int)switch_core_db_step(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_reset(void * jarg1) {
-  int jresult ;
-  switch_core_db_stmt_t *arg1 = (switch_core_db_stmt_t *) 0 ;
-  int result;
-  
-  arg1 = (switch_core_db_stmt_t *)jarg1; 
-  result = (int)switch_core_db_reset(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_bind_int(void * jarg1, int jarg2, int jarg3) {
-  int jresult ;
-  switch_core_db_stmt_t *arg1 = (switch_core_db_stmt_t *) 0 ;
-  int arg2 ;
-  int arg3 ;
-  int result;
-  
-  arg1 = (switch_core_db_stmt_t *)jarg1; 
-  arg2 = (int)jarg2; 
-  arg3 = (int)jarg3; 
-  result = (int)switch_core_db_bind_int(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_bind_int64(void * jarg1, int jarg2, long long jarg3) {
-  int jresult ;
-  switch_core_db_stmt_t *arg1 = (switch_core_db_stmt_t *) 0 ;
-  int arg2 ;
-  int64_t arg3 ;
-  int result;
-  
-  arg1 = (switch_core_db_stmt_t *)jarg1; 
-  arg2 = (int)jarg2; 
-  arg3 = (int64_t)jarg3; 
-  result = (int)switch_core_db_bind_int64(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_bind_text(void * jarg1, int jarg2, char * jarg3, int jarg4, void * jarg5) {
-  int jresult ;
-  switch_core_db_stmt_t *arg1 = (switch_core_db_stmt_t *) 0 ;
-  int arg2 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  switch_core_db_destructor_type_t arg5 = (switch_core_db_destructor_type_t) 0 ;
-  int result;
-  
-  arg1 = (switch_core_db_stmt_t *)jarg1; 
-  arg2 = (int)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (int)jarg4; 
-  arg5 = (switch_core_db_destructor_type_t)jarg5; 
-  result = (int)switch_core_db_bind_text(arg1,arg2,(char const *)arg3,arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_bind_double(void * jarg1, int jarg2, double jarg3) {
-  int jresult ;
-  switch_core_db_stmt_t *arg1 = (switch_core_db_stmt_t *) 0 ;
-  int arg2 ;
-  double arg3 ;
-  int result;
-  
-  arg1 = (switch_core_db_stmt_t *)jarg1; 
-  arg2 = (int)jarg2; 
-  arg3 = (double)jarg3; 
-  result = (int)switch_core_db_bind_double(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT long long SWIGSTDCALL CSharp_switch_core_db_last_insert_rowid(void * jarg1) {
-  long long jresult ;
-  switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
-  int64_t result;
-  
-  arg1 = (switch_core_db_t *)jarg1; 
-  result = (int64_t)switch_core_db_last_insert_rowid(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_get_table(void * jarg1, char * jarg2, void * jarg3, void * jarg4, void * jarg5, void * jarg6) {
-  int jresult ;
-  switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char ***arg3 = (char ***) 0 ;
-  int *arg4 = (int *) 0 ;
-  int *arg5 = (int *) 0 ;
-  char **arg6 = (char **) 0 ;
-  int result;
-  
-  arg1 = (switch_core_db_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char ***)jarg3; 
-  arg4 = (int *)jarg4; 
-  arg5 = (int *)jarg5; 
-  arg6 = (char **)jarg6; 
-  result = (int)switch_core_db_get_table(arg1,(char const *)arg2,arg3,arg4,arg5,arg6);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_db_free_table(void * jarg1) {
-  char **arg1 = (char **) 0 ;
-  
-  arg1 = (char **)jarg1; 
-  switch_core_db_free_table(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_db_free(char * jarg1) {
-  char *arg1 = (char *) 0 ;
-  
-  arg1 = (char *)jarg1; 
-  switch_core_db_free(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_changes(void * jarg1) {
-  int jresult ;
-  switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
-  int result;
-  
-  arg1 = (switch_core_db_t *)jarg1; 
-  result = (int)switch_core_db_changes(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_OK_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 0;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_ERROR_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 1;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_INTERNAL_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 2;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_PERM_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 3;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_ABORT_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 4;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_BUSY_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 5;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_LOCKED_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 6;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_NOMEM_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 7;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_READONLY_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 8;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_INTERRUPT_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 9;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_IOERR_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 10;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_CORRUPT_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 11;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_NOTFOUND_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 12;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_FULL_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 13;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_CANTOPEN_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 14;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_PROTOCOL_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 15;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_EMPTY_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 16;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_SCHEMA_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 17;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_TOOBIG_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 18;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_CONSTRAINT_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 19;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_MISMATCH_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 20;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_MISUSE_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 21;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_NOLFS_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 22;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_AUTH_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 23;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_FORMAT_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 24;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_RANGE_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 25;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_NOTADB_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 26;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_ROW_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 100;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_DONE_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 101;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_mprintf(char * jarg1) {
-  char * jresult ;
-  char *arg1 = (char *) 0 ;
-  void *arg2 = 0 ;
-  char *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  result = (char *)switch_mprintf((char const *)arg1,arg2);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_regex_compile(char * jarg1, int jarg2, void * jarg3, void * jarg4, void * jarg5) {
-  void * jresult ;
-  char *arg1 = (char *) 0 ;
-  int arg2 ;
-  char **arg3 = (char **) 0 ;
-  int *arg4 = (int *) 0 ;
-  unsigned char *arg5 = (unsigned char *) 0 ;
-  switch_regex_t *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (int)jarg2; 
-  arg3 = (char **)jarg3; 
-  arg4 = (int *)jarg4; 
-  arg5 = (unsigned char *)jarg5; 
-  result = (switch_regex_t *)switch_regex_compile((char const *)arg1,arg2,(char const **)arg3,arg4,(unsigned char const *)arg5);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_regex_copy_substring(char * jarg1, void * jarg2, int jarg3, int jarg4, char * jarg5, int jarg6) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  int *arg2 = (int *) 0 ;
-  int arg3 ;
-  int arg4 ;
-  char *arg5 = (char *) 0 ;
-  int arg6 ;
-  int result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (int *)jarg2; 
-  arg3 = (int)jarg3; 
-  arg4 = (int)jarg4; 
-  arg5 = (char *)jarg5; 
-  arg6 = (int)jarg6; 
-  result = (int)switch_regex_copy_substring((char const *)arg1,arg2,arg3,arg4,arg5,arg6);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_regex_free(void * jarg1) {
-  void *arg1 = (void *) 0 ;
-  
-  arg1 = (void *)jarg1; 
-  switch_regex_free(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_regex_perform(char * jarg1, char * jarg2, void * jarg3, void * jarg4, unsigned long jarg5) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_regex_t **arg3 = (switch_regex_t **) 0 ;
-  int *arg4 = (int *) 0 ;
-  uint32_t arg5 ;
-  int result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_regex_t **)jarg3; 
-  arg4 = (int *)jarg4; 
-  arg5 = (uint32_t)jarg5; 
-  result = (int)switch_regex_perform((char const *)arg1,(char const *)arg2,arg3,arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_perform_substitution(void * jarg1, int jarg2, char * jarg3, char * jarg4, char * jarg5, void * jarg6, void * jarg7) {
-  switch_regex_t *arg1 = (switch_regex_t *) 0 ;
-  int arg2 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  char *arg5 = (char *) 0 ;
-  switch_size_t arg6 ;
-  int *arg7 = (int *) 0 ;
-  switch_size_t *argp6 ;
-  
-  arg1 = (switch_regex_t *)jarg1; 
-  arg2 = (int)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (char *)jarg5; 
-  argp6 = (switch_size_t *)jarg6; 
-  if (!argp6) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg6 = *argp6; 
-  arg7 = (int *)jarg7; 
-  switch_perform_substitution(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5,arg6,arg7);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_regex_match(char * jarg1, char * jarg2) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_status_t)switch_regex_match((char const *)arg1,(char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_regex_match_partial(char * jarg1, char * jarg2, void * jarg3) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int *arg3 = (int *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (int *)jarg3; 
-  result = (switch_status_t)switch_regex_match_partial((char const *)arg1,(char const *)arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_CORE_THREAD_SESSION_OBJS_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 128;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_STREAMS_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 128;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_time_duration_mms_set(void * jarg1, unsigned long jarg2) {
-  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_core_time_duration *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->mms = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_time_duration_mms_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_core_time_duration *)jarg1; 
-  result = (uint32_t) ((arg1)->mms);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_time_duration_ms_set(void * jarg1, unsigned long jarg2) {
-  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_core_time_duration *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->ms = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_time_duration_ms_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_core_time_duration *)jarg1; 
-  result = (uint32_t) ((arg1)->ms);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_time_duration_sec_set(void * jarg1, unsigned long jarg2) {
-  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_core_time_duration *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->sec = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_time_duration_sec_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_core_time_duration *)jarg1; 
-  result = (uint32_t) ((arg1)->sec);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_time_duration_min_set(void * jarg1, unsigned long jarg2) {
-  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_core_time_duration *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->min = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_time_duration_min_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_core_time_duration *)jarg1; 
-  result = (uint32_t) ((arg1)->min);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_time_duration_hr_set(void * jarg1, unsigned long jarg2) {
-  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_core_time_duration *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->hr = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_time_duration_hr_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_core_time_duration *)jarg1; 
-  result = (uint32_t) ((arg1)->hr);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_time_duration_day_set(void * jarg1, unsigned long jarg2) {
-  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_core_time_duration *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->day = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_time_duration_day_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_core_time_duration *)jarg1; 
-  result = (uint32_t) ((arg1)->day);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_time_duration_yr_set(void * jarg1, unsigned long jarg2) {
-  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_core_time_duration *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->yr = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_time_duration_yr_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_core_time_duration *)jarg1; 
-  result = (uint32_t) ((arg1)->yr);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_core_time_duration() {
-  void * jresult ;
-  switch_core_time_duration *result = 0 ;
-  
-  result = (switch_core_time_duration *)new switch_core_time_duration();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_core_time_duration(void * jarg1) {
-  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
-  
-  arg1 = (switch_core_time_duration *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_app_log_app_set(void * jarg1, char * jarg2) {
-  switch_app_log *arg1 = (switch_app_log *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_app_log *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->app) delete [] arg1->app;
-    if (arg2) {
-      arg1->app = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->app, (const char *)arg2);
-    } else {
-      arg1->app = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_app_log_app_get(void * jarg1) {
-  char * jresult ;
-  switch_app_log *arg1 = (switch_app_log *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_app_log *)jarg1; 
-  result = (char *) ((arg1)->app);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_app_log_arg_set(void * jarg1, char * jarg2) {
-  switch_app_log *arg1 = (switch_app_log *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_app_log *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->arg) delete [] arg1->arg;
-    if (arg2) {
-      arg1->arg = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->arg, (const char *)arg2);
-    } else {
-      arg1->arg = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_app_log_arg_get(void * jarg1) {
-  char * jresult ;
-  switch_app_log *arg1 = (switch_app_log *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_app_log *)jarg1; 
-  result = (char *) ((arg1)->arg);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_app_log_next_set(void * jarg1, void * jarg2) {
-  switch_app_log *arg1 = (switch_app_log *) 0 ;
-  switch_app_log *arg2 = (switch_app_log *) 0 ;
-  
-  arg1 = (switch_app_log *)jarg1; 
-  arg2 = (switch_app_log *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_app_log_next_get(void * jarg1) {
-  void * jresult ;
-  switch_app_log *arg1 = (switch_app_log *) 0 ;
-  switch_app_log *result = 0 ;
-  
-  arg1 = (switch_app_log *)jarg1; 
-  result = (switch_app_log *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_app_log() {
-  void * jresult ;
-  switch_app_log *result = 0 ;
-  
-  result = (switch_app_log *)new switch_app_log();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_app_log(void * jarg1) {
-  switch_app_log *arg1 = (switch_app_log *) 0 ;
-  
-  arg1 = (switch_app_log *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_MESSAGE_STRING_ARG_MAX_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 10;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_from_set(void * jarg1, char * jarg2) {
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->from) delete [] arg1->from;
-    if (arg2) {
-      arg1->from = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->from, (const char *)arg2);
-    } else {
-      arg1->from = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_session_message_from_get(void * jarg1) {
-  char * jresult ;
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  result = (char *) ((arg1)->from);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_message_id_set(void * jarg1, int jarg2) {
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  switch_core_session_message_types_t arg2 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  arg2 = (switch_core_session_message_types_t)jarg2; 
-  if (arg1) (arg1)->message_id = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_message_message_id_get(void * jarg1) {
-  int jresult ;
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  switch_core_session_message_types_t result;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  result = (switch_core_session_message_types_t) ((arg1)->message_id);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_numeric_arg_set(void * jarg1, int jarg2) {
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->numeric_arg = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_message_numeric_arg_get(void * jarg1) {
-  int jresult ;
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  int result;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  result = (int) ((arg1)->numeric_arg);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_string_arg_set(void * jarg1, char * jarg2) {
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->string_arg = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->string_arg, (const char *)arg2);
-    } else {
-      arg1->string_arg = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_session_message_string_arg_get(void * jarg1) {
-  char * jresult ;
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  result = (char *) ((arg1)->string_arg);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_string_arg_size_set(void * jarg1, void * jarg2) {
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->string_arg_size = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_message_string_arg_size_get(void * jarg1) {
-  void * jresult ;
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  result =  ((arg1)->string_arg_size);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_pointer_arg_set(void * jarg1, void * jarg2) {
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->pointer_arg = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_message_pointer_arg_get(void * jarg1) {
-  void * jresult ;
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  result = (void *) ((arg1)->pointer_arg);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_pointer_arg_size_set(void * jarg1, void * jarg2) {
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->pointer_arg_size = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_message_pointer_arg_size_get(void * jarg1) {
-  void * jresult ;
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  result =  ((arg1)->pointer_arg_size);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_numeric_reply_set(void * jarg1, int jarg2) {
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->numeric_reply = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_message_numeric_reply_get(void * jarg1) {
-  int jresult ;
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  int result;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  result = (int) ((arg1)->numeric_reply);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_string_reply_set(void * jarg1, char * jarg2) {
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->string_reply) delete [] arg1->string_reply;
-    if (arg2) {
-      arg1->string_reply = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->string_reply, (const char *)arg2);
-    } else {
-      arg1->string_reply = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_session_message_string_reply_get(void * jarg1) {
-  char * jresult ;
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  result = (char *) ((arg1)->string_reply);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_string_reply_size_set(void * jarg1, void * jarg2) {
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->string_reply_size = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_message_string_reply_size_get(void * jarg1) {
-  void * jresult ;
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  result =  ((arg1)->string_reply_size);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_pointer_reply_set(void * jarg1, void * jarg2) {
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->pointer_reply = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_message_pointer_reply_get(void * jarg1) {
-  void * jresult ;
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  result = (void *) ((arg1)->pointer_reply);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_pointer_reply_size_set(void * jarg1, void * jarg2) {
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->pointer_reply_size = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_message_pointer_reply_size_get(void * jarg1) {
-  void * jresult ;
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  result =  ((arg1)->pointer_reply_size);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_flags_set(void * jarg1, unsigned long jarg2) {
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  switch_core_session_message_flag_t arg2 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  arg2 = (switch_core_session_message_flag_t)jarg2; 
-  if (arg1) (arg1)->flags = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_session_message_flags_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  switch_core_session_message_flag_t result;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  result = (switch_core_session_message_flag_t) ((arg1)->flags);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message__file_set(void * jarg1, char * jarg2) {
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->_file = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->_file, (const char *)arg2);
-    } else {
-      arg1->_file = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_session_message__file_get(void * jarg1) {
-  char * jresult ;
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  result = (char *) ((arg1)->_file);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message__func_set(void * jarg1, char * jarg2) {
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->_func = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->_func, (const char *)arg2);
-    } else {
-      arg1->_func = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_session_message__func_get(void * jarg1) {
-  char * jresult ;
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  result = (char *) ((arg1)->_func);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message__line_set(void * jarg1, int jarg2) {
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->_line = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_message__line_get(void * jarg1) {
-  int jresult ;
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  int result;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  result = (int) ((arg1)->_line);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_string_array_arg_set(void * jarg1, void * jarg2) {
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  char **arg2 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  arg2 = (char **)jarg2; 
-  {
-    size_t ii;
-    char const * *b = (char const * *) arg1->string_array_arg;
-    for (ii = 0; ii < (size_t)10; ii++) b[ii] = *((char const * *) arg2 + ii);
-  }
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_message_string_array_arg_get(void * jarg1) {
-  void * jresult ;
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  char **result = 0 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  result = (char **)(char **) ((arg1)->string_array_arg);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_delivery_time_set(void * jarg1, void * jarg2) {
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  time_t arg2 ;
-  time_t *argp2 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  argp2 = (time_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null time_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->delivery_time = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_message_delivery_time_get(void * jarg1) {
-  void * jresult ;
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  time_t result;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  result =  ((arg1)->delivery_time);
-  jresult = new time_t((time_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_core_session_message() {
-  void * jresult ;
-  switch_core_session_message *result = 0 ;
-  
-  result = (switch_core_session_message *)new switch_core_session_message();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_core_session_message(void * jarg1) {
-  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
-  
-  arg1 = (switch_core_session_message *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_thread_session_running_set(void * jarg1, int jarg2) {
-  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_core_thread_session *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->running = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_thread_session_running_get(void * jarg1) {
-  int jresult ;
-  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
-  int result;
-  
-  arg1 = (switch_core_thread_session *)jarg1; 
-  result = (int) ((arg1)->running);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_thread_session_mutex_set(void * jarg1, void * jarg2) {
-  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
-  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
-  
-  arg1 = (switch_core_thread_session *)jarg1; 
-  arg2 = (switch_mutex_t *)jarg2; 
-  if (arg1) (arg1)->mutex = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_thread_session_mutex_get(void * jarg1) {
-  void * jresult ;
-  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
-  switch_mutex_t *result = 0 ;
-  
-  arg1 = (switch_core_thread_session *)jarg1; 
-  result = (switch_mutex_t *) ((arg1)->mutex);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_thread_session_objs_set(void * jarg1, void * jarg2) {
-  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
-  void **arg2 ;
-  
-  arg1 = (switch_core_thread_session *)jarg1; 
-  arg2 = (void **)jarg2; 
-  {
-    size_t ii;
-    void * *b = (void * *) arg1->objs;
-    for (ii = 0; ii < (size_t)128; ii++) b[ii] = *((void * *) arg2 + ii);
-  }
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_thread_session_objs_get(void * jarg1) {
-  void * jresult ;
-  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
-  void **result = 0 ;
-  
-  arg1 = (switch_core_thread_session *)jarg1; 
-  result = (void **)(void **) ((arg1)->objs);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_thread_session_input_callback_set(void * jarg1, void * jarg2) {
-  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
-  switch_input_callback_function_t arg2 = (switch_input_callback_function_t) 0 ;
-  
-  arg1 = (switch_core_thread_session *)jarg1; 
-  arg2 = (switch_input_callback_function_t)jarg2; 
-  if (arg1) (arg1)->input_callback = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_thread_session_input_callback_get(void * jarg1) {
-  void * jresult ;
-  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
-  switch_input_callback_function_t result;
-  
-  arg1 = (switch_core_thread_session *)jarg1; 
-  result = (switch_input_callback_function_t) ((arg1)->input_callback);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_thread_session_pool_set(void * jarg1, void * jarg2) {
-  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
-  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
-  
-  arg1 = (switch_core_thread_session *)jarg1; 
-  arg2 = (switch_memory_pool_t *)jarg2; 
-  if (arg1) (arg1)->pool = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_thread_session_pool_get(void * jarg1) {
-  void * jresult ;
-  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
-  switch_memory_pool_t *result = 0 ;
-  
-  arg1 = (switch_core_thread_session *)jarg1; 
-  result = (switch_memory_pool_t *) ((arg1)->pool);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_core_thread_session() {
-  void * jresult ;
-  switch_core_thread_session *result = 0 ;
-  
-  result = (switch_core_thread_session *)new switch_core_thread_session();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_core_thread_session(void * jarg1) {
-  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
-  
-  arg1 = (switch_core_thread_session *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_sched_heartbeat(void * jarg1, unsigned long jarg2) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  switch_core_session_sched_heartbeat(arg1,arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_unsched_heartbeat(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_core_session_unsched_heartbeat(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_enable_heartbeat(void * jarg1, unsigned long jarg2) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  switch_core_session_enable_heartbeat(arg1,arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_disable_heartbeat(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_core_session_disable_heartbeat(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_add(void * jarg1, void * jarg2, void * jarg3, void * jarg4, unsigned long jarg5, void * jarg6) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_media_bug_callback_t arg2 = (switch_media_bug_callback_t) 0 ;
-  void *arg3 = (void *) 0 ;
-  time_t arg4 ;
-  switch_media_bug_flag_t arg5 ;
-  switch_media_bug_t **arg6 = (switch_media_bug_t **) 0 ;
-  switch_status_t result;
-  time_t *argp4 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_media_bug_callback_t)jarg2; 
-  arg3 = (void *)jarg3; 
-  argp4 = (time_t *)jarg4; 
-  if (!argp4) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null time_t", 0);
-    return 0;
-  }
-  arg4 = *argp4; 
-  arg5 = (switch_media_bug_flag_t)jarg5; 
-  arg6 = (switch_media_bug_t **)jarg6; 
-  result = (switch_status_t)switch_core_media_bug_add(arg1,arg2,arg3,arg4,arg5,arg6);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_media_bug_pause(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_core_media_bug_pause(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_media_bug_resume(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_core_media_bug_resume(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_media_bug_inuse(void * jarg1, void * jarg2, void * jarg3) {
-  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
-  switch_size_t *arg2 = (switch_size_t *) 0 ;
-  switch_size_t *arg3 = (switch_size_t *) 0 ;
-  
-  arg1 = (switch_media_bug_t *)jarg1; 
-  arg2 = (switch_size_t *)jarg2; 
-  arg3 = (switch_size_t *)jarg3; 
-  switch_core_media_bug_inuse(arg1,arg2,arg3);
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_media_bug_get_user_data(void * jarg1) {
-  void * jresult ;
-  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_media_bug_t *)jarg1; 
-  result = (void *)switch_core_media_bug_get_user_data(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_media_bug_get_write_replace_frame(void * jarg1) {
-  void * jresult ;
-  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
-  switch_frame_t *result = 0 ;
-  
-  arg1 = (switch_media_bug_t *)jarg1; 
-  result = (switch_frame_t *)switch_core_media_bug_get_write_replace_frame(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_media_bug_set_write_replace_frame(void * jarg1, void * jarg2) {
-  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
-  switch_frame_t *arg2 = (switch_frame_t *) 0 ;
-  
-  arg1 = (switch_media_bug_t *)jarg1; 
-  arg2 = (switch_frame_t *)jarg2; 
-  switch_core_media_bug_set_write_replace_frame(arg1,arg2);
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_media_bug_get_read_replace_frame(void * jarg1) {
-  void * jresult ;
-  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
-  switch_frame_t *result = 0 ;
-  
-  arg1 = (switch_media_bug_t *)jarg1; 
-  result = (switch_frame_t *)switch_core_media_bug_get_read_replace_frame(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_media_bug_get_session(void * jarg1) {
-  void * jresult ;
-  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
-  switch_core_session_t *result = 0 ;
-  
-  arg1 = (switch_media_bug_t *)jarg1; 
-  result = (switch_core_session_t *)switch_core_media_bug_get_session(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_media_bug_test_flag(void * jarg1, unsigned long jarg2) {
-  unsigned long jresult ;
-  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
-  uint32_t arg2 ;
-  uint32_t result;
-  
-  arg1 = (switch_media_bug_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  result = (uint32_t)switch_core_media_bug_test_flag(arg1,arg2);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_media_bug_set_read_replace_frame(void * jarg1, void * jarg2) {
-  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
-  switch_frame_t *arg2 = (switch_frame_t *) 0 ;
-  
-  arg1 = (switch_media_bug_t *)jarg1; 
-  arg2 = (switch_frame_t *)jarg2; 
-  switch_core_media_bug_set_read_replace_frame(arg1,arg2);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_remove(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_media_bug_t **arg2 = (switch_media_bug_t **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_media_bug_t **)jarg2; 
-  result = (switch_status_t)switch_core_media_bug_remove(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_media_bug_prune(void * jarg1) {
-  unsigned long jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (uint32_t)switch_core_media_bug_prune(arg1);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_remove_callback(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_media_bug_callback_t arg2 = (switch_media_bug_callback_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_media_bug_callback_t)jarg2; 
-  result = (switch_status_t)switch_core_media_bug_remove_callback(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_close(void * jarg1) {
-  int jresult ;
-  switch_media_bug_t **arg1 = (switch_media_bug_t **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_media_bug_t **)jarg1; 
-  result = (switch_status_t)switch_core_media_bug_close(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_remove_all(void * jarg1) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_status_t)switch_core_media_bug_remove_all(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_read(void * jarg1, void * jarg2, int jarg3) {
-  int jresult ;
-  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
-  switch_frame_t *arg2 = (switch_frame_t *) 0 ;
-  switch_bool_t arg3 ;
-  switch_status_t result;
-  
-  arg1 = (switch_media_bug_t *)jarg1; 
-  arg2 = (switch_frame_t *)jarg2; 
-  arg3 = (switch_bool_t)jarg3; 
-  result = (switch_status_t)switch_core_media_bug_read(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_media_bug_flush(void * jarg1) {
-  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
-  
-  arg1 = (switch_media_bug_t *)jarg1; 
-  switch_core_media_bug_flush(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_flush_all(void * jarg1) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_status_t)switch_core_media_bug_flush_all(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_port_allocator_new(unsigned short jarg1, unsigned short jarg2, unsigned long jarg3, void * jarg4) {
-  int jresult ;
-  switch_port_t arg1 ;
-  switch_port_t arg2 ;
-  switch_port_flag_t arg3 ;
-  switch_core_port_allocator_t **arg4 = (switch_core_port_allocator_t **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_port_t)jarg1; 
-  arg2 = (switch_port_t)jarg2; 
-  arg3 = (switch_port_flag_t)jarg3; 
-  arg4 = (switch_core_port_allocator_t **)jarg4; 
-  result = (switch_status_t)switch_core_port_allocator_new(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_port_allocator_request_port(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_port_allocator_t *arg1 = (switch_core_port_allocator_t *) 0 ;
-  switch_port_t *arg2 = (switch_port_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_port_allocator_t *)jarg1; 
-  arg2 = (switch_port_t *)jarg2; 
-  result = (switch_status_t)switch_core_port_allocator_request_port(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_port_allocator_free_port(void * jarg1, unsigned short jarg2) {
-  int jresult ;
-  switch_core_port_allocator_t *arg1 = (switch_core_port_allocator_t *) 0 ;
-  switch_port_t arg2 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_port_allocator_t *)jarg1; 
-  arg2 = (switch_port_t)jarg2; 
-  result = (switch_status_t)switch_core_port_allocator_free_port(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_port_allocator_destroy(void * jarg1) {
-  switch_core_port_allocator_t **arg1 = (switch_core_port_allocator_t **) 0 ;
-  
-  arg1 = (switch_core_port_allocator_t **)jarg1; 
-  switch_core_port_allocator_destroy(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_init(unsigned long jarg1, int jarg2, void * jarg3) {
-  int jresult ;
-  switch_core_flag_t arg1 ;
-  switch_bool_t arg2 ;
-  char **arg3 = (char **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_flag_t)jarg1; 
-  arg2 = (switch_bool_t)jarg2; 
-  arg3 = (char **)jarg3; 
-  result = (switch_status_t)switch_core_init(arg1,arg2,(char const **)arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_init_and_modload(unsigned long jarg1, int jarg2, void * jarg3) {
-  int jresult ;
-  switch_core_flag_t arg1 ;
-  switch_bool_t arg2 ;
-  char **arg3 = (char **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_flag_t)jarg1; 
-  arg2 = (switch_bool_t)jarg2; 
-  arg3 = (char **)jarg3; 
-  result = (switch_status_t)switch_core_init_and_modload(arg1,arg2,(char const **)arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_session_limit(unsigned long jarg1) {
-  unsigned long jresult ;
-  uint32_t arg1 ;
-  uint32_t result;
-  
-  arg1 = (uint32_t)jarg1; 
-  result = (uint32_t)switch_core_session_limit(arg1);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_sessions_per_second(unsigned long jarg1) {
-  unsigned long jresult ;
-  uint32_t arg1 ;
-  uint32_t result;
-  
-  arg1 = (uint32_t)jarg1; 
-  result = (uint32_t)switch_core_sessions_per_second(arg1);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_destroy() {
-  int jresult ;
-  switch_status_t result;
-  
-  result = (switch_status_t)switch_core_destroy();
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_read_lock(void * jarg1) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_status_t)switch_core_session_read_lock(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_read_lock_hangup(void * jarg1) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_status_t)switch_core_session_read_lock_hangup(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_write_lock(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_core_session_write_lock(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_rwunlock(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_core_session_rwunlock(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_add_state_handler(void * jarg1) {
-  int jresult ;
-  switch_state_handler_table_t *arg1 = (switch_state_handler_table_t *) 0 ;
-  int result;
-  
-  arg1 = (switch_state_handler_table_t *)jarg1; 
-  result = (int)switch_core_add_state_handler((switch_state_handler_table const *)arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_remove_state_handler(void * jarg1) {
-  switch_state_handler_table_t *arg1 = (switch_state_handler_table_t *) 0 ;
-  
-  arg1 = (switch_state_handler_table_t *)jarg1; 
-  switch_core_remove_state_handler((switch_state_handler_table const *)arg1);
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_get_state_handler(int jarg1) {
-  void * jresult ;
-  int arg1 ;
-  switch_state_handler_table_t *result = 0 ;
-  
-  arg1 = (int)jarg1; 
-  result = (switch_state_handler_table_t *)switch_core_get_state_handler(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_memory_pool_tag(void * jarg1, char * jarg2) {
-  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_memory_pool_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  switch_core_memory_pool_tag(arg1,(char const *)arg2);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_perform_new_memory_pool(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
-  int jresult ;
-  switch_memory_pool_t **arg1 = (switch_memory_pool_t **) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  switch_status_t result;
-  
-  arg1 = (switch_memory_pool_t **)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (int)jarg4; 
-  result = (switch_status_t)switch_core_perform_new_memory_pool(arg1,(char const *)arg2,(char const *)arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_perform_destroy_memory_pool(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
-  int jresult ;
-  switch_memory_pool_t **arg1 = (switch_memory_pool_t **) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  switch_status_t result;
-  
-  arg1 = (switch_memory_pool_t **)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (int)jarg4; 
-  result = (switch_status_t)switch_core_perform_destroy_memory_pool(arg1,(char const *)arg2,(char const *)arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_memory_pool_set_data(void * jarg1, char * jarg2, void * jarg3) {
-  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *arg3 = (void *) 0 ;
-  
-  arg1 = (switch_memory_pool_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (void *)jarg3; 
-  switch_core_memory_pool_set_data(arg1,(char const *)arg2,arg3);
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_memory_pool_get_data(void * jarg1, char * jarg2) {
-  void * jresult ;
-  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_memory_pool_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (void *)switch_core_memory_pool_get_data(arg1,(char const *)arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_run(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_core_session_run(arg1);
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_core_session_running(void * jarg1) {
-  unsigned int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  unsigned int result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (unsigned int)switch_core_session_running(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_perform_permanent_alloc(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
-  void * jresult ;
-  switch_size_t arg1 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  void *result = 0 ;
-  switch_size_t *argp1 ;
-  
-  argp1 = (switch_size_t *)jarg1; 
-  if (!argp1) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg1 = *argp1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (int)jarg4; 
-  result = (void *)switch_core_perform_permanent_alloc(arg1,(char const *)arg2,(char const *)arg3,arg4);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_perform_alloc(void * jarg1, void * jarg2, char * jarg3, char * jarg4, int jarg5) {
-  void * jresult ;
-  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
-  switch_size_t arg2 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  int arg5 ;
-  void *result = 0 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_memory_pool_t *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg2 = *argp2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (int)jarg5; 
-  result = (void *)switch_core_perform_alloc(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_perform_session_alloc(void * jarg1, void * jarg2, char * jarg3, char * jarg4, int jarg5) {
-  void * jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_size_t arg2 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  int arg5 ;
-  void *result = 0 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg2 = *argp2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (int)jarg5; 
-  result = (void *)switch_core_perform_session_alloc(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_perform_permanent_strdup(char * jarg1, char * jarg2, char * jarg3, int jarg4) {
-  char * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  char *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (int)jarg4; 
-  result = (char *)switch_core_perform_permanent_strdup((char const *)arg1,(char const *)arg2,(char const *)arg3,arg4);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_perform_session_strdup(void * jarg1, char * jarg2, char * jarg3, char * jarg4, int jarg5) {
-  char * jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  int arg5 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (int)jarg5; 
-  result = (char *)switch_core_perform_session_strdup(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_perform_strdup(void * jarg1, char * jarg2, char * jarg3, char * jarg4, int jarg5) {
-  char * jresult ;
-  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  int arg5 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_memory_pool_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (int)jarg5; 
-  result = (char *)switch_core_perform_strdup(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_session_sprintf(void * jarg1, char * jarg2) {
-  char * jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *arg3 = 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (char *)switch_core_session_sprintf(arg1,(char const *)arg2,arg3);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_sprintf(void * jarg1, char * jarg2) {
-  char * jresult ;
-  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *arg3 = 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_memory_pool_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (char *)switch_core_sprintf(arg1,(char const *)arg2,arg3);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_pool(void * jarg1) {
-  void * jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_memory_pool_t *result = 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_memory_pool_t *)switch_core_session_get_pool(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_request_uuid(void * jarg1, int jarg2, void * jarg3, char * jarg4) {
-  void * jresult ;
-  switch_endpoint_interface_t *arg1 = (switch_endpoint_interface_t *) 0 ;
-  switch_call_direction_t arg2 ;
-  switch_memory_pool_t **arg3 = (switch_memory_pool_t **) 0 ;
-  char *arg4 = (char *) 0 ;
-  switch_core_session_t *result = 0 ;
-  
-  arg1 = (switch_endpoint_interface_t *)jarg1; 
-  arg2 = (switch_call_direction_t)jarg2; 
-  arg3 = (switch_memory_pool_t **)jarg3; 
-  arg4 = (char *)jarg4; 
-  result = (switch_core_session_t *)switch_core_session_request_uuid(arg1,arg2,arg3,(char const *)arg4);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_uuid(void * jarg1, char * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_status_t)switch_core_session_set_uuid(arg1,(char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_perform_destroy(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
-  switch_core_session_t **arg1 = (switch_core_session_t **) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  
-  arg1 = (switch_core_session_t **)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (int)jarg4; 
-  switch_core_session_perform_destroy(arg1,(char const *)arg2,(char const *)arg3,arg4);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_destroy_state(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_core_session_destroy_state(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_reporting_state(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_core_session_reporting_state(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_hangup_state(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_core_session_hangup_state(arg1);
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_session_count() {
-  unsigned long jresult ;
-  uint32_t result;
-  
-  result = (uint32_t)switch_core_session_count();
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_id(void * jarg1) {
-  void * jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = switch_core_session_get_id(arg1);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_id() {
-  void * jresult ;
-  switch_size_t result;
-  
-  result = switch_core_session_id();
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_request_by_name(char * jarg1, int jarg2, void * jarg3) {
-  void * jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_call_direction_t arg2 ;
-  switch_memory_pool_t **arg3 = (switch_memory_pool_t **) 0 ;
-  switch_core_session_t *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_call_direction_t)jarg2; 
-  arg3 = (switch_memory_pool_t **)jarg3; 
-  result = (switch_core_session_t *)switch_core_session_request_by_name((char const *)arg1,arg2,arg3);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_thread_launch(void * jarg1) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_status_t)switch_core_session_thread_launch(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_channel(void * jarg1) {
-  void * jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_channel_t *result = 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_channel_t *)switch_core_session_get_channel(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_wake_session_thread(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_core_session_wake_session_thread(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_signal_state_change(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_core_session_signal_state_change(arg1);
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_session_get_uuid(void * jarg1) {
-  char * jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (char *)switch_core_session_get_uuid(arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_get_uuid() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *)switch_core_get_uuid();
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_locate(char * jarg1) {
-  void * jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_core_session_t *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_core_session_t *)switch_core_session_locate((char const *)arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_force_locate(char * jarg1) {
-  void * jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_core_session_t *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_core_session_t *)switch_core_session_force_locate((char const *)arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_get_variable(char * jarg1) {
-  char * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  result = (char *)switch_core_get_variable((char const *)arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_set_variable(char * jarg1, char * jarg2) {
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  switch_core_set_variable((char const *)arg1,(char const *)arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_dump_variables(void * jarg1) {
-  switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ;
-  
-  arg1 = (switch_stream_handle_t *)jarg1; 
-  switch_core_dump_variables(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_hupall(int jarg1) {
-  switch_call_cause_t arg1 ;
-  
-  arg1 = (switch_call_cause_t)jarg1; 
-  switch_core_session_hupall(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_hupall_matching_var(char * jarg1, char * jarg2, int jarg3) {
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_call_cause_t arg3 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_call_cause_t)jarg3; 
-  switch_core_session_hupall_matching_var((char const *)arg1,(char const *)arg2,arg3);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_hupall_endpoint(void * jarg1, int jarg2) {
-  switch_endpoint_interface_t *arg1 = (switch_endpoint_interface_t *) 0 ;
-  switch_call_cause_t arg2 ;
-  
-  arg1 = (switch_endpoint_interface_t *)jarg1; 
-  arg2 = (switch_call_cause_t)jarg2; 
-  switch_core_session_hupall_endpoint((switch_endpoint_interface const *)arg1,arg2);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_partner(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_core_session_t **arg2 = (switch_core_session_t **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_core_session_t **)jarg2; 
-  result = (switch_status_t)switch_core_session_get_partner(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_message_send(char * jarg1, void * jarg2) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_core_session_message_t *arg2 = (switch_core_session_message_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_core_session_message_t *)jarg2; 
-  result = (switch_status_t)switch_core_session_message_send((char const *)arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_queue_message(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_core_session_message_t *arg2 = (switch_core_session_message_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_core_session_message_t *)jarg2; 
-  result = (switch_status_t)switch_core_session_queue_message(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_free_message(void * jarg1) {
-  switch_core_session_message_t **arg1 = (switch_core_session_message_t **) 0 ;
-  
-  arg1 = (switch_core_session_message_t **)jarg1; 
-  switch_core_session_free_message(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_pass_indication(void * jarg1, int jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_core_session_message_types_t arg2 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_core_session_message_types_t)jarg2; 
-  result = (switch_status_t)switch_core_session_pass_indication(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_queue_indication(void * jarg1, int jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_core_session_message_types_t arg2 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_core_session_message_types_t)jarg2; 
-  result = (switch_status_t)switch_core_session_queue_indication(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_dequeue_message(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_core_session_message_t **arg2 = (switch_core_session_message_t **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_core_session_message_t **)jarg2; 
-  result = (switch_status_t)switch_core_session_dequeue_message(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_flush_message(void * jarg1) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_status_t)switch_core_session_flush_message(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_event_send(char * jarg1, void * jarg2) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_event_t **arg2 = (switch_event_t **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_event_t **)jarg2; 
-  result = (switch_status_t)switch_core_session_event_send((char const *)arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_app_log(void * jarg1) {
-  void * jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_app_log_t *result = 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_app_log_t *)switch_core_session_get_app_log(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_exec(void * jarg1, void * jarg2, char * jarg3) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_application_interface_t *arg2 = (switch_application_interface_t *) 0 ;
-  char *arg3 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_application_interface_t *)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (switch_status_t)switch_core_session_exec(arg1,(switch_application_interface const *)arg2,(char const *)arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_execute_application(void * jarg1, char * jarg2, char * jarg3) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (switch_status_t)switch_core_session_execute_application(arg1,(char const *)arg2,(char const *)arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_execute_exten(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  result = (switch_status_t)switch_core_session_execute_exten(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_receive_event(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_event_t **arg2 = (switch_event_t **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_event_t **)jarg2; 
-  result = (switch_status_t)switch_core_session_receive_event(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_private(void * jarg1) {
-  void * jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (void *)switch_core_session_get_private(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_private(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  result = (switch_status_t)switch_core_session_set_private(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_add_stream(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  int result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  result = (int)switch_core_session_add_stream(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_stream(void * jarg1, int jarg2) {
-  void * jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  int arg2 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (int)jarg2; 
-  result = (void *)switch_core_session_get_stream(arg1,arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_stream_count(void * jarg1) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  int result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (int)switch_core_session_get_stream_count(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_launch_thread(void * jarg1, void * jarg2, void * jarg3) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  void *(*arg2)(switch_thread_t *,void *) = (void *(*)(switch_thread_t *,void *)) 0 ;
-  void *arg3 = (void *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (void *(*)(switch_thread_t *,void *))jarg2; 
-  arg3 = (void *)jarg3; 
-  switch_core_session_launch_thread(arg1,arg2,arg3);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_thread_session_end(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_core_thread_session_end(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_service_session(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_core_service_session(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_outgoing_channel(void * jarg1, void * jarg2, char * jarg3, void * jarg4, void * jarg5, void * jarg6, unsigned long jarg7, void * jarg8) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_event_t *arg2 = (switch_event_t *) 0 ;
-  char *arg3 = (char *) 0 ;
-  switch_caller_profile_t *arg4 = (switch_caller_profile_t *) 0 ;
-  switch_core_session_t **arg5 = (switch_core_session_t **) 0 ;
-  switch_memory_pool_t **arg6 = (switch_memory_pool_t **) 0 ;
-  switch_originate_flag_t arg7 ;
-  switch_call_cause_t *arg8 = (switch_call_cause_t *) 0 ;
-  switch_call_cause_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_event_t *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (switch_caller_profile_t *)jarg4; 
-  arg5 = (switch_core_session_t **)jarg5; 
-  arg6 = (switch_memory_pool_t **)jarg6; 
-  arg7 = (switch_originate_flag_t)jarg7; 
-  arg8 = (switch_call_cause_t *)jarg8; 
-  result = (switch_call_cause_t)switch_core_session_outgoing_channel(arg1,arg2,(char const *)arg3,arg4,arg5,arg6,arg7,arg8);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_resurrect_channel(char * jarg1, void * jarg2, void * jarg3, void * jarg4) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_core_session_t **arg2 = (switch_core_session_t **) 0 ;
-  switch_memory_pool_t **arg3 = (switch_memory_pool_t **) 0 ;
-  void *arg4 = (void *) 0 ;
-  switch_call_cause_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_core_session_t **)jarg2; 
-  arg3 = (switch_memory_pool_t **)jarg3; 
-  arg4 = (void *)jarg4; 
-  result = (switch_call_cause_t)switch_core_session_resurrect_channel((char const *)arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_perform_receive_message(void * jarg1, void * jarg2, char * jarg3, char * jarg4, int jarg5) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_core_session_message_t *arg2 = (switch_core_session_message_t *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  int arg5 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_core_session_message_t *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (int)jarg5; 
-  result = (switch_status_t)switch_core_session_perform_receive_message(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_queue_event(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_event_t **arg2 = (switch_event_t **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_event_t **)jarg2; 
-  result = (switch_status_t)switch_core_session_queue_event(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_session_event_count(void * jarg1) {
-  unsigned long jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (uint32_t)switch_core_session_event_count(arg1);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_dequeue_event(void * jarg1, void * jarg2, int jarg3) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_event_t **arg2 = (switch_event_t **) 0 ;
-  switch_bool_t arg3 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_event_t **)jarg2; 
-  arg3 = (switch_bool_t)jarg3; 
-  result = (switch_status_t)switch_core_session_dequeue_event(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_queue_private_event(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_event_t **arg2 = (switch_event_t **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_event_t **)jarg2; 
-  result = (switch_status_t)switch_core_session_queue_private_event(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_session_private_event_count(void * jarg1) {
-  unsigned long jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (uint32_t)switch_core_session_private_event_count(arg1);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_dequeue_private_event(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_event_t **arg2 = (switch_event_t **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_event_t **)jarg2; 
-  result = (switch_status_t)switch_core_session_dequeue_private_event(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_session_flush_private_events(void * jarg1) {
-  unsigned long jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (uint32_t)switch_core_session_flush_private_events(arg1);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_read_frame(void * jarg1, void * jarg2, unsigned long jarg3, int jarg4) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_frame_t **arg2 = (switch_frame_t **) 0 ;
-  switch_io_flag_t arg3 ;
-  int arg4 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_frame_t **)jarg2; 
-  arg3 = (switch_io_flag_t)jarg3; 
-  arg4 = (int)jarg4; 
-  result = (switch_status_t)switch_core_session_read_frame(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_read_video_frame(void * jarg1, void * jarg2, unsigned long jarg3, int jarg4) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_frame_t **arg2 = (switch_frame_t **) 0 ;
-  switch_io_flag_t arg3 ;
-  int arg4 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_frame_t **)jarg2; 
-  arg3 = (switch_io_flag_t)jarg3; 
-  arg4 = (int)jarg4; 
-  result = (switch_status_t)switch_core_session_read_video_frame(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_write_video_frame(void * jarg1, void * jarg2, unsigned long jarg3, int jarg4) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_frame_t *arg2 = (switch_frame_t *) 0 ;
-  switch_io_flag_t arg3 ;
-  int arg4 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_frame_t *)jarg2; 
-  arg3 = (switch_io_flag_t)jarg3; 
-  arg4 = (int)jarg4; 
-  result = (switch_status_t)switch_core_session_write_video_frame(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_read_impl(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_codec_implementation_t *)jarg2; 
-  result = (switch_status_t)switch_core_session_set_read_impl(arg1,(switch_codec_implementation const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_write_impl(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_codec_implementation_t *)jarg2; 
-  result = (switch_status_t)switch_core_session_set_write_impl(arg1,(switch_codec_implementation const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_video_read_impl(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_codec_implementation_t *)jarg2; 
-  result = (switch_status_t)switch_core_session_set_video_read_impl(arg1,(switch_codec_implementation const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_video_write_impl(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_codec_implementation_t *)jarg2; 
-  result = (switch_status_t)switch_core_session_set_video_write_impl(arg1,(switch_codec_implementation const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_reset(void * jarg1, int jarg2, int jarg3) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_bool_t arg2 ;
-  switch_bool_t arg3 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_bool_t)jarg2; 
-  arg3 = (switch_bool_t)jarg3; 
-  switch_core_session_reset(arg1,arg2,arg3);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_write_frame(void * jarg1, void * jarg2, unsigned long jarg3, int jarg4) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_frame_t *arg2 = (switch_frame_t *) 0 ;
-  switch_io_flag_t arg3 ;
-  int arg4 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_frame_t *)jarg2; 
-  arg3 = (switch_io_flag_t)jarg3; 
-  arg4 = (int)jarg4; 
-  result = (switch_status_t)switch_core_session_write_frame(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_perform_kill_channel(void * jarg1, char * jarg2, char * jarg3, int jarg4, int jarg5) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  switch_signal_t arg5 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (int)jarg4; 
-  arg5 = (switch_signal_t)jarg5; 
-  result = (switch_status_t)switch_core_session_perform_kill_channel(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_send_dtmf(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_dtmf_t *arg2 = (switch_dtmf_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_dtmf_t *)jarg2; 
-  result = (switch_status_t)switch_core_session_send_dtmf(arg1,(switch_dtmf_t const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_send_dtmf_string(void * jarg1, char * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_status_t)switch_core_session_send_dtmf_string(arg1,(char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_recv_dtmf(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_dtmf_t *arg2 = (switch_dtmf_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_dtmf_t *)jarg2; 
-  result = (switch_status_t)switch_core_session_recv_dtmf(arg1,(switch_dtmf_t const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_hash_init_case(void * jarg1, void * jarg2, int jarg3) {
-  int jresult ;
-  switch_hash_t **arg1 = (switch_hash_t **) 0 ;
-  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
-  switch_bool_t arg3 ;
-  switch_status_t result;
-  
-  arg1 = (switch_hash_t **)jarg1; 
-  arg2 = (switch_memory_pool_t *)jarg2; 
-  arg3 = (switch_bool_t)jarg3; 
-  result = (switch_status_t)switch_core_hash_init_case(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_hash_destroy(void * jarg1) {
-  int jresult ;
-  switch_hash_t **arg1 = (switch_hash_t **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_hash_t **)jarg1; 
-  result = (switch_status_t)switch_core_hash_destroy(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_hash_insert(void * jarg1, char * jarg2, void * jarg3) {
-  int jresult ;
-  switch_hash_t *arg1 = (switch_hash_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *arg3 = (void *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_hash_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (void *)jarg3; 
-  result = (switch_status_t)switch_core_hash_insert(arg1,(char const *)arg2,(void const *)arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_hash_insert_locked(void * jarg1, char * jarg2, void * jarg3, void * jarg4) {
-  int jresult ;
-  switch_hash_t *arg1 = (switch_hash_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *arg3 = (void *) 0 ;
-  switch_mutex_t *arg4 = (switch_mutex_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_hash_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (void *)jarg3; 
-  arg4 = (switch_mutex_t *)jarg4; 
-  result = (switch_status_t)switch_core_hash_insert_locked(arg1,(char const *)arg2,(void const *)arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_hash_delete(void * jarg1, char * jarg2) {
-  int jresult ;
-  switch_hash_t *arg1 = (switch_hash_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_hash_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_status_t)switch_core_hash_delete(arg1,(char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_hash_delete_locked(void * jarg1, char * jarg2, void * jarg3) {
-  int jresult ;
-  switch_hash_t *arg1 = (switch_hash_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_mutex_t *arg3 = (switch_mutex_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_hash_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_mutex_t *)jarg3; 
-  result = (switch_status_t)switch_core_hash_delete_locked(arg1,(char const *)arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_hash_find(void * jarg1, char * jarg2) {
-  void * jresult ;
-  switch_hash_t *arg1 = (switch_hash_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_hash_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (void *)switch_core_hash_find(arg1,(char const *)arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_hash_find_locked(void * jarg1, char * jarg2, void * jarg3) {
-  void * jresult ;
-  switch_hash_t *arg1 = (switch_hash_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_mutex_t *arg3 = (switch_mutex_t *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_hash_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_mutex_t *)jarg3; 
-  result = (void *)switch_core_hash_find_locked(arg1,(char const *)arg2,arg3);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_hash_first(char * jarg1, void * jarg2) {
-  void * jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_hash_t *arg2 = (switch_hash_t *) 0 ;
-  switch_hash_index_t *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_hash_t *)jarg2; 
-  result = (switch_hash_index_t *)switch_hash_first(arg1,arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_hash_next(void * jarg1) {
-  void * jresult ;
-  switch_hash_index_t *arg1 = (switch_hash_index_t *) 0 ;
-  switch_hash_index_t *result = 0 ;
-  
-  arg1 = (switch_hash_index_t *)jarg1; 
-  result = (switch_hash_index_t *)switch_hash_next(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_hash_this(void * jarg1, void * jarg2, void * jarg3, void * jarg4) {
-  switch_hash_index_t *arg1 = (switch_hash_index_t *) 0 ;
-  void **arg2 = (void **) 0 ;
-  switch_ssize_t *arg3 = (switch_ssize_t *) 0 ;
-  void **arg4 = (void **) 0 ;
-  
-  arg1 = (switch_hash_index_t *)jarg1; 
-  arg2 = (void **)jarg2; 
-  arg3 = (switch_ssize_t *)jarg3; 
-  arg4 = (void **)jarg4; 
-  switch_hash_this(arg1,(void const **)arg2,arg3,arg4);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_timer_init(void * jarg1, char * jarg2, int jarg3, int jarg4, void * jarg5) {
-  int jresult ;
-  switch_timer_t *arg1 = (switch_timer_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int arg3 ;
-  int arg4 ;
-  switch_memory_pool_t *arg5 = (switch_memory_pool_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_timer_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (int)jarg3; 
-  arg4 = (int)jarg4; 
-  arg5 = (switch_memory_pool_t *)jarg5; 
-  result = (switch_status_t)switch_core_timer_init(arg1,(char const *)arg2,arg3,arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_timer_next(void * jarg1) {
-  int jresult ;
-  switch_timer_t *arg1 = (switch_timer_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_timer_t *)jarg1; 
-  result = (switch_status_t)switch_core_timer_next(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_timer_step(void * jarg1) {
-  int jresult ;
-  switch_timer_t *arg1 = (switch_timer_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_timer_t *)jarg1; 
-  result = (switch_status_t)switch_core_timer_step(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_timer_sync(void * jarg1) {
-  int jresult ;
-  switch_timer_t *arg1 = (switch_timer_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_timer_t *)jarg1; 
-  result = (switch_status_t)switch_core_timer_sync(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_timer_check(void * jarg1, int jarg2) {
-  int jresult ;
-  switch_timer_t *arg1 = (switch_timer_t *) 0 ;
-  switch_bool_t arg2 ;
-  switch_status_t result;
-  
-  arg1 = (switch_timer_t *)jarg1; 
-  arg2 = (switch_bool_t)jarg2; 
-  result = (switch_status_t)switch_core_timer_check(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_timer_destroy(void * jarg1) {
-  int jresult ;
-  switch_timer_t *arg1 = (switch_timer_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_timer_t *)jarg1; 
-  result = (switch_status_t)switch_core_timer_destroy(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_init(void * jarg1, char * jarg2, char * jarg3, unsigned long jarg4, int jarg5, int jarg6, unsigned long jarg7, void * jarg8, void * jarg9) {
-  int jresult ;
-  switch_codec_t *arg1 = (switch_codec_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  uint32_t arg4 ;
-  int arg5 ;
-  int arg6 ;
-  uint32_t arg7 ;
-  switch_codec_settings_t *arg8 = (switch_codec_settings_t *) 0 ;
-  switch_memory_pool_t *arg9 = (switch_memory_pool_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_codec_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (uint32_t)jarg4; 
-  arg5 = (int)jarg5; 
-  arg6 = (int)jarg6; 
-  arg7 = (uint32_t)jarg7; 
-  arg8 = (switch_codec_settings_t *)jarg8; 
-  arg9 = (switch_memory_pool_t *)jarg9; 
-  result = (switch_status_t)switch_core_codec_init(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5,arg6,arg7,(switch_codec_settings const *)arg8,arg9);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_copy(void * jarg1, void * jarg2, void * jarg3) {
-  int jresult ;
-  switch_codec_t *arg1 = (switch_codec_t *) 0 ;
-  switch_codec_t *arg2 = (switch_codec_t *) 0 ;
-  switch_memory_pool_t *arg3 = (switch_memory_pool_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_codec_t *)jarg1; 
-  arg2 = (switch_codec_t *)jarg2; 
-  arg3 = (switch_memory_pool_t *)jarg3; 
-  result = (switch_status_t)switch_core_codec_copy(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_encode(void * jarg1, void * jarg2, void * jarg3, unsigned long jarg4, unsigned long jarg5, void * jarg6, void * jarg7, void * jarg8, void * jarg9) {
-  int jresult ;
-  switch_codec_t *arg1 = (switch_codec_t *) 0 ;
-  switch_codec_t *arg2 = (switch_codec_t *) 0 ;
-  void *arg3 = (void *) 0 ;
-  uint32_t arg4 ;
-  uint32_t arg5 ;
-  void *arg6 = (void *) 0 ;
-  uint32_t *arg7 = (uint32_t *) 0 ;
-  uint32_t *arg8 = (uint32_t *) 0 ;
-  unsigned int *arg9 = (unsigned int *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_codec_t *)jarg1; 
-  arg2 = (switch_codec_t *)jarg2; 
-  arg3 = (void *)jarg3; 
-  arg4 = (uint32_t)jarg4; 
-  arg5 = (uint32_t)jarg5; 
-  arg6 = (void *)jarg6; 
-  arg7 = (uint32_t *)jarg7; 
-  arg8 = (uint32_t *)jarg8; 
-  arg9 = (unsigned int *)jarg9; 
-  result = (switch_status_t)switch_core_codec_encode(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_decode(void * jarg1, void * jarg2, void * jarg3, unsigned long jarg4, unsigned long jarg5, void * jarg6, void * jarg7, void * jarg8, void * jarg9) {
-  int jresult ;
-  switch_codec_t *arg1 = (switch_codec_t *) 0 ;
-  switch_codec_t *arg2 = (switch_codec_t *) 0 ;
-  void *arg3 = (void *) 0 ;
-  uint32_t arg4 ;
-  uint32_t arg5 ;
-  void *arg6 = (void *) 0 ;
-  uint32_t *arg7 = (uint32_t *) 0 ;
-  uint32_t *arg8 = (uint32_t *) 0 ;
-  unsigned int *arg9 = (unsigned int *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_codec_t *)jarg1; 
-  arg2 = (switch_codec_t *)jarg2; 
-  arg3 = (void *)jarg3; 
-  arg4 = (uint32_t)jarg4; 
-  arg5 = (uint32_t)jarg5; 
-  arg6 = (void *)jarg6; 
-  arg7 = (uint32_t *)jarg7; 
-  arg8 = (uint32_t *)jarg8; 
-  arg9 = (unsigned int *)jarg9; 
-  result = (switch_status_t)switch_core_codec_decode(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_destroy(void * jarg1) {
-  int jresult ;
-  switch_codec_t *arg1 = (switch_codec_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_codec_t *)jarg1; 
-  result = (switch_status_t)switch_core_codec_destroy(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_read_codec(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_codec_t *arg2 = (switch_codec_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_codec_t *)jarg2; 
-  result = (switch_status_t)switch_core_session_set_read_codec(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_unset_read_codec(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_core_session_unset_read_codec(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_unset_write_codec(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_core_session_unset_write_codec(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_lock_codec_write(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_core_session_lock_codec_write(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_unlock_codec_write(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_core_session_unlock_codec_write(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_lock_codec_read(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_core_session_lock_codec_read(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_unlock_codec_read(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_core_session_unlock_codec_read(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_read_impl(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_codec_implementation_t *)jarg2; 
-  result = (switch_status_t)switch_core_session_get_read_impl(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_write_impl(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_codec_implementation_t *)jarg2; 
-  result = (switch_status_t)switch_core_session_get_write_impl(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_video_read_impl(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_codec_implementation_t *)jarg2; 
-  result = (switch_status_t)switch_core_session_get_video_read_impl(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_video_write_impl(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_codec_implementation_t *)jarg2; 
-  result = (switch_status_t)switch_core_session_get_video_write_impl(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_read_codec(void * jarg1) {
-  void * jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_codec_t *result = 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_codec_t *)switch_core_session_get_read_codec(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_effective_read_codec(void * jarg1) {
-  void * jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_codec_t *result = 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_codec_t *)switch_core_session_get_effective_read_codec(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_write_codec(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_codec_t *arg2 = (switch_codec_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_codec_t *)jarg2; 
-  result = (switch_status_t)switch_core_session_set_write_codec(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_write_codec(void * jarg1) {
-  void * jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_codec_t *result = 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_codec_t *)switch_core_session_get_write_codec(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_effective_write_codec(void * jarg1) {
-  void * jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_codec_t *result = 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_codec_t *)switch_core_session_get_effective_write_codec(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_video_read_codec(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_codec_t *arg2 = (switch_codec_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_codec_t *)jarg2; 
-  result = (switch_status_t)switch_core_session_set_video_read_codec(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_video_read_codec(void * jarg1) {
-  void * jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_codec_t *result = 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_codec_t *)switch_core_session_get_video_read_codec(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_video_write_codec(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_codec_t *arg2 = (switch_codec_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_codec_t *)jarg2; 
-  result = (switch_status_t)switch_core_session_set_video_write_codec(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_video_write_codec(void * jarg1) {
-  void * jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_codec_t *result = 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_codec_t *)switch_core_session_get_video_write_codec(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_db_open_file(char * jarg1) {
-  void * jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_core_db_t *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_core_db_t *)switch_core_db_open_file((char const *)arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_persistant_execute(void * jarg1, char * jarg2, unsigned long jarg3) {
-  int jresult ;
-  switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  uint32_t arg3 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_db_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (uint32_t)jarg3; 
-  result = (switch_status_t)switch_core_db_persistant_execute(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_persistant_execute_trans(void * jarg1, char * jarg2, unsigned long jarg3) {
-  int jresult ;
-  switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  uint32_t arg3 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_db_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (uint32_t)jarg3; 
-  result = (switch_status_t)switch_core_db_persistant_execute_trans(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_db_test_reactive(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
-  switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  
-  arg1 = (switch_core_db_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  switch_core_db_test_reactive(arg1,arg2,arg3,arg4);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_perform_file_open(char * jarg1, char * jarg2, int jarg3, void * jarg4, char * jarg5, unsigned char jarg6, unsigned long jarg7, unsigned int jarg8, void * jarg9) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int arg3 ;
-  switch_file_handle_t *arg4 = (switch_file_handle_t *) 0 ;
-  char *arg5 = (char *) 0 ;
-  uint8_t arg6 ;
-  uint32_t arg7 ;
-  unsigned int arg8 ;
-  switch_memory_pool_t *arg9 = (switch_memory_pool_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (int)jarg3; 
-  arg4 = (switch_file_handle_t *)jarg4; 
-  arg5 = (char *)jarg5; 
-  arg6 = (uint8_t)jarg6; 
-  arg7 = (uint32_t)jarg7; 
-  arg8 = (unsigned int)jarg8; 
-  arg9 = (switch_memory_pool_t *)jarg9; 
-  result = (switch_status_t)switch_core_perform_file_open((char const *)arg1,(char const *)arg2,arg3,arg4,(char const *)arg5,arg6,arg7,arg8,arg9);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_file_read(void * jarg1, void * jarg2, void * jarg3) {
-  int jresult ;
-  switch_file_handle_t *arg1 = (switch_file_handle_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  switch_size_t *arg3 = (switch_size_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_file_handle_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  arg3 = (switch_size_t *)jarg3; 
-  result = (switch_status_t)switch_core_file_read(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_file_write(void * jarg1, void * jarg2, void * jarg3) {
-  int jresult ;
-  switch_file_handle_t *arg1 = (switch_file_handle_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  switch_size_t *arg3 = (switch_size_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_file_handle_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  arg3 = (switch_size_t *)jarg3; 
-  result = (switch_status_t)switch_core_file_write(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_file_seek(void * jarg1, void * jarg2, long long jarg3, int jarg4) {
-  int jresult ;
-  switch_file_handle_t *arg1 = (switch_file_handle_t *) 0 ;
-  unsigned int *arg2 = (unsigned int *) 0 ;
-  int64_t arg3 ;
-  int arg4 ;
-  switch_status_t result;
-  
-  arg1 = (switch_file_handle_t *)jarg1; 
-  arg2 = (unsigned int *)jarg2; 
-  arg3 = (int64_t)jarg3; 
-  arg4 = (int)jarg4; 
-  result = (switch_status_t)switch_core_file_seek(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_file_set_string(void * jarg1, int jarg2, char * jarg3) {
-  int jresult ;
-  switch_file_handle_t *arg1 = (switch_file_handle_t *) 0 ;
-  switch_audio_col_t arg2 ;
-  char *arg3 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_file_handle_t *)jarg1; 
-  arg2 = (switch_audio_col_t)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (switch_status_t)switch_core_file_set_string(arg1,arg2,(char const *)arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_file_get_string(void * jarg1, int jarg2, void * jarg3) {
-  int jresult ;
-  switch_file_handle_t *arg1 = (switch_file_handle_t *) 0 ;
-  switch_audio_col_t arg2 ;
-  char **arg3 = (char **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_file_handle_t *)jarg1; 
-  arg2 = (switch_audio_col_t)jarg2; 
-  arg3 = (char **)jarg3; 
-  result = (switch_status_t)switch_core_file_get_string(arg1,arg2,(char const **)arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_file_close(void * jarg1) {
-  int jresult ;
-  switch_file_handle_t *arg1 = (switch_file_handle_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_file_handle_t *)jarg1; 
-  result = (switch_status_t)switch_core_file_close(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_file_truncate(void * jarg1, long long jarg2) {
-  int jresult ;
-  switch_file_handle_t *arg1 = (switch_file_handle_t *) 0 ;
-  int64_t arg2 ;
-  switch_status_t result;
-  
-  arg1 = (switch_file_handle_t *)jarg1; 
-  arg2 = (int64_t)jarg2; 
-  result = (switch_status_t)switch_core_file_truncate(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_speech_open(void * jarg1, char * jarg2, char * jarg3, unsigned int jarg4, unsigned int jarg5, void * jarg6, void * jarg7) {
-  int jresult ;
-  switch_speech_handle_t *arg1 = (switch_speech_handle_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  unsigned int arg4 ;
-  unsigned int arg5 ;
-  switch_speech_flag_t *arg6 = (switch_speech_flag_t *) 0 ;
-  switch_memory_pool_t *arg7 = (switch_memory_pool_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_speech_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (unsigned int)jarg4; 
-  arg5 = (unsigned int)jarg5; 
-  arg6 = (switch_speech_flag_t *)jarg6; 
-  arg7 = (switch_memory_pool_t *)jarg7; 
-  result = (switch_status_t)switch_core_speech_open(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5,arg6,arg7);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_speech_feed_tts(void * jarg1, char * jarg2, void * jarg3) {
-  int jresult ;
-  switch_speech_handle_t *arg1 = (switch_speech_handle_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_speech_flag_t *arg3 = (switch_speech_flag_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_speech_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_speech_flag_t *)jarg3; 
-  result = (switch_status_t)switch_core_speech_feed_tts(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_speech_flush_tts(void * jarg1) {
-  switch_speech_handle_t *arg1 = (switch_speech_handle_t *) 0 ;
-  
-  arg1 = (switch_speech_handle_t *)jarg1; 
-  switch_core_speech_flush_tts(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_speech_text_param_tts(void * jarg1, char * jarg2, char * jarg3) {
-  switch_speech_handle_t *arg1 = (switch_speech_handle_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  
-  arg1 = (switch_speech_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  switch_core_speech_text_param_tts(arg1,arg2,(char const *)arg3);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_speech_numeric_param_tts(void * jarg1, char * jarg2, int jarg3) {
-  switch_speech_handle_t *arg1 = (switch_speech_handle_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int arg3 ;
-  
-  arg1 = (switch_speech_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (int)jarg3; 
-  switch_core_speech_numeric_param_tts(arg1,arg2,arg3);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_speech_float_param_tts(void * jarg1, char * jarg2, double jarg3) {
-  switch_speech_handle_t *arg1 = (switch_speech_handle_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  double arg3 ;
-  
-  arg1 = (switch_speech_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (double)jarg3; 
-  switch_core_speech_float_param_tts(arg1,arg2,arg3);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_speech_read_tts(void * jarg1, void * jarg2, void * jarg3, void * jarg4) {
-  int jresult ;
-  switch_speech_handle_t *arg1 = (switch_speech_handle_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  switch_size_t *arg3 = (switch_size_t *) 0 ;
-  switch_speech_flag_t *arg4 = (switch_speech_flag_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_speech_handle_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  arg3 = (switch_size_t *)jarg3; 
-  arg4 = (switch_speech_flag_t *)jarg4; 
-  result = (switch_status_t)switch_core_speech_read_tts(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_speech_close(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_speech_handle_t *arg1 = (switch_speech_handle_t *) 0 ;
-  switch_speech_flag_t *arg2 = (switch_speech_flag_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_speech_handle_t *)jarg1; 
-  arg2 = (switch_speech_flag_t *)jarg2; 
-  result = (switch_status_t)switch_core_speech_close(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_open(void * jarg1, char * jarg2, char * jarg3, int jarg4, char * jarg5, void * jarg6, void * jarg7) {
-  int jresult ;
-  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  char *arg5 = (char *) 0 ;
-  switch_asr_flag_t *arg6 = (switch_asr_flag_t *) 0 ;
-  switch_memory_pool_t *arg7 = (switch_memory_pool_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_asr_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (int)jarg4; 
-  arg5 = (char *)jarg5; 
-  arg6 = (switch_asr_flag_t *)jarg6; 
-  arg7 = (switch_memory_pool_t *)jarg7; 
-  result = (switch_status_t)switch_core_asr_open(arg1,(char const *)arg2,(char const *)arg3,arg4,(char const *)arg5,arg6,arg7);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_close(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
-  switch_asr_flag_t *arg2 = (switch_asr_flag_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_asr_handle_t *)jarg1; 
-  arg2 = (switch_asr_flag_t *)jarg2; 
-  result = (switch_status_t)switch_core_asr_close(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_feed(void * jarg1, void * jarg2, unsigned int jarg3, void * jarg4) {
-  int jresult ;
-  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  unsigned int arg3 ;
-  switch_asr_flag_t *arg4 = (switch_asr_flag_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_asr_handle_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  arg3 = (unsigned int)jarg3; 
-  arg4 = (switch_asr_flag_t *)jarg4; 
-  result = (switch_status_t)switch_core_asr_feed(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_check_results(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
-  switch_asr_flag_t *arg2 = (switch_asr_flag_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_asr_handle_t *)jarg1; 
-  arg2 = (switch_asr_flag_t *)jarg2; 
-  result = (switch_status_t)switch_core_asr_check_results(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_get_results(void * jarg1, void * jarg2, void * jarg3) {
-  int jresult ;
-  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
-  char **arg2 = (char **) 0 ;
-  switch_asr_flag_t *arg3 = (switch_asr_flag_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_asr_handle_t *)jarg1; 
-  arg2 = (char **)jarg2; 
-  arg3 = (switch_asr_flag_t *)jarg3; 
-  result = (switch_status_t)switch_core_asr_get_results(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_load_grammar(void * jarg1, char * jarg2, char * jarg3) {
-  int jresult ;
-  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_asr_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (switch_status_t)switch_core_asr_load_grammar(arg1,(char const *)arg2,(char const *)arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_unload_grammar(void * jarg1, char * jarg2) {
-  int jresult ;
-  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_asr_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_status_t)switch_core_asr_unload_grammar(arg1,(char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_pause(void * jarg1) {
-  int jresult ;
-  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_asr_handle_t *)jarg1; 
-  result = (switch_status_t)switch_core_asr_pause(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_resume(void * jarg1) {
-  int jresult ;
-  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_asr_handle_t *)jarg1; 
-  result = (switch_status_t)switch_core_asr_resume(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_start_input_timers(void * jarg1) {
-  int jresult ;
-  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_asr_handle_t *)jarg1; 
-  result = (switch_status_t)switch_core_asr_start_input_timers(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_asr_text_param(void * jarg1, char * jarg2, char * jarg3) {
-  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  
-  arg1 = (switch_asr_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  switch_core_asr_text_param(arg1,arg2,(char const *)arg3);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_asr_numeric_param(void * jarg1, char * jarg2, int jarg3) {
-  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int arg3 ;
-  
-  arg1 = (switch_asr_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (int)jarg3; 
-  switch_core_asr_numeric_param(arg1,arg2,arg3);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_asr_float_param(void * jarg1, char * jarg2, double jarg3) {
-  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  double arg3 ;
-  
-  arg1 = (switch_asr_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (double)jarg3; 
-  switch_core_asr_float_param(arg1,arg2,arg3);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_directory_open(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, void * jarg6) {
-  int jresult ;
-  switch_directory_handle_t *arg1 = (switch_directory_handle_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  char *arg5 = (char *) 0 ;
-  switch_memory_pool_t *arg6 = (switch_memory_pool_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_directory_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (char *)jarg5; 
-  arg6 = (switch_memory_pool_t *)jarg6; 
-  result = (switch_status_t)switch_core_directory_open(arg1,arg2,arg3,arg4,arg5,arg6);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_directory_query(void * jarg1, char * jarg2, char * jarg3) {
-  int jresult ;
-  switch_directory_handle_t *arg1 = (switch_directory_handle_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_directory_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (switch_status_t)switch_core_directory_query(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_directory_next(void * jarg1) {
-  int jresult ;
-  switch_directory_handle_t *arg1 = (switch_directory_handle_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_directory_handle_t *)jarg1; 
-  result = (switch_status_t)switch_core_directory_next(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_directory_next_pair(void * jarg1, void * jarg2, void * jarg3) {
-  int jresult ;
-  switch_directory_handle_t *arg1 = (switch_directory_handle_t *) 0 ;
-  char **arg2 = (char **) 0 ;
-  char **arg3 = (char **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_directory_handle_t *)jarg1; 
-  arg2 = (char **)jarg2; 
-  arg3 = (char **)jarg3; 
-  result = (switch_status_t)switch_core_directory_next_pair(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_directory_close(void * jarg1) {
-  int jresult ;
-  switch_directory_handle_t *arg1 = (switch_directory_handle_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_directory_handle_t *)jarg1; 
-  result = (switch_status_t)switch_core_directory_close(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_data_channel(int jarg1) {
-  void * jresult ;
-  switch_text_channel_t arg1 ;
-  FILE *result = 0 ;
-  
-  arg1 = (switch_text_channel_t)jarg1; 
-  result = (FILE *)switch_core_data_channel(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_ready() {
-  int jresult ;
-  switch_bool_t result;
-  
-  result = (switch_bool_t)switch_core_ready();
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_flags() {
-  unsigned long jresult ;
-  switch_core_flag_t result;
-  
-  result = (switch_core_flag_t)switch_core_flags();
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_management_exec(char * jarg1, int jarg2, char * jarg3, void * jarg4) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_management_action_t arg2 ;
-  char *arg3 = (char *) 0 ;
-  switch_size_t arg4 ;
-  switch_status_t result;
-  switch_size_t *argp4 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_management_action_t)jarg2; 
-  arg3 = (char *)jarg3; 
-  argp4 = (switch_size_t *)jarg4; 
-  if (!argp4) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg4 = *argp4; 
-  result = (switch_status_t)switch_core_management_exec(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_set_high_priority() {
-  int jresult ;
-  int32_t result;
-  
-  result = (int32_t)set_high_priority();
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_change_user_group(char * jarg1, char * jarg2) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int32_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (int32_t)change_user_group((char const *)arg1,(char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_runtime_loop(int jarg1) {
-  int arg1 ;
-  
-  arg1 = (int)jarg1; 
-  switch_core_runtime_loop(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_set_console(char * jarg1) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_status_t)switch_core_set_console((char const *)arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_measure_time(void * jarg1, void * jarg2) {
-  switch_time_t arg1 ;
-  switch_core_time_duration_t *arg2 = (switch_core_time_duration_t *) 0 ;
-  switch_time_t *argp1 ;
-  
-  argp1 = (switch_time_t *)jarg1; 
-  if (!argp1) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
-    return ;
-  }
-  arg1 = *argp1; 
-  arg2 = (switch_core_time_duration_t *)jarg2; 
-  switch_core_measure_time(arg1,arg2);
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_uptime() {
-  void * jresult ;
-  switch_time_t result;
-  
-  result = switch_core_uptime();
-  jresult = new switch_time_t((switch_time_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_ctl(int jarg1, void * jarg2) {
-  int jresult ;
-  switch_session_ctl_t arg1 ;
-  int32_t *arg2 = (int32_t *) 0 ;
-  int32_t result;
-  
-  arg1 = (switch_session_ctl_t)jarg1; 
-  arg2 = (int32_t *)jarg2; 
-  result = (int32_t)switch_core_session_ctl(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_get_console() {
-  void * jresult ;
-  FILE *result = 0 ;
-  
-  result = (FILE *)switch_core_get_console();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_set_globals() {
-  switch_core_set_globals();
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_core_session_compare(void * jarg1, void * jarg2) {
-  unsigned char jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
-  uint8_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_core_session_t *)jarg2; 
-  result = (uint8_t)switch_core_session_compare(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_core_session_check_interface(void * jarg1, void * jarg2) {
-  unsigned char jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_endpoint_interface_t *arg2 = (switch_endpoint_interface_t *) 0 ;
-  uint8_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_endpoint_interface_t *)jarg2; 
-  result = (uint8_t)switch_core_session_check_interface(arg1,(switch_endpoint_interface const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_mime_index() {
-  void * jresult ;
-  switch_hash_index_t *result = 0 ;
-  
-  result = (switch_hash_index_t *)switch_core_mime_index();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_mime_ext2type(char * jarg1) {
-  char * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  result = (char *)switch_core_mime_ext2type((char const *)arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_mime_add_type(char * jarg1, char * jarg2) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_status_t)switch_core_mime_add_type((char const *)arg1,(char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_create_module_interface(void * jarg1, char * jarg2) {
-  void * jresult ;
-  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_loadable_module_interface_t *result = 0 ;
-  
-  arg1 = (switch_memory_pool_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_loadable_module_interface_t *)switch_loadable_module_create_module_interface(arg1,(char const *)arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_create_interface(void * jarg1, int jarg2) {
-  void * jresult ;
-  switch_loadable_module_interface_t *arg1 = (switch_loadable_module_interface_t *) 0 ;
-  switch_module_interface_name_t arg2 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_loadable_module_interface_t *)jarg1; 
-  arg2 = (switch_module_interface_name_t)jarg2; 
-  result = (void *)switch_loadable_module_create_interface(arg1,arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_micro_time_now() {
-  void * jresult ;
-  switch_time_t result;
-  
-  result = switch_micro_time_now();
-  jresult = new switch_time_t((switch_time_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_memory_reclaim() {
-  switch_core_memory_reclaim();
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_memory_reclaim_events() {
-  switch_core_memory_reclaim_events();
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_memory_reclaim_logger() {
-  switch_core_memory_reclaim_logger();
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_memory_reclaim_all() {
-  switch_core_memory_reclaim_all();
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_setrlimits() {
-  switch_core_setrlimits();
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_time_sync() {
-  switch_time_sync();
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_epoch_time_now(void * jarg1) {
-  void * jresult ;
-  time_t *arg1 = (time_t *) 0 ;
-  time_t result;
-  
-  arg1 = (time_t *)jarg1; 
-  result = switch_epoch_time_now(arg1);
-  jresult = new time_t((time_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_strftime_tz(char * jarg1, char * jarg2, char * jarg3, unsigned long jarg4, void * jarg5) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  size_t arg4 ;
-  switch_time_t arg5 ;
-  switch_status_t result;
-  switch_time_t *argp5 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (size_t)jarg4; 
-  argp5 = (switch_time_t *)jarg5; 
-  if (!argp5) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
-    return 0;
-  }
-  arg5 = *argp5; 
-  result = (switch_status_t)switch_strftime_tz((char const *)arg1,(char const *)arg2,arg3,arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_time_exp_tz_name(char * jarg1, void * jarg2, void * jarg3) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_time_exp_t *arg2 = (switch_time_exp_t *) 0 ;
-  switch_time_t arg3 ;
-  switch_status_t result;
-  switch_time_t *argp3 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_time_exp_t *)jarg2; 
-  argp3 = (switch_time_t *)jarg3; 
-  if (!argp3) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
-    return 0;
-  }
-  arg3 = *argp3; 
-  result = (switch_status_t)switch_time_exp_tz_name((char const *)arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_load_network_lists(int jarg1) {
-  switch_bool_t arg1 ;
-  
-  arg1 = (switch_bool_t)jarg1; 
-  switch_load_network_lists(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_check_network_list_ip_token(char * jarg1, char * jarg2, void * jarg3) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char **arg3 = (char **) 0 ;
-  switch_bool_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char **)jarg3; 
-  result = (switch_bool_t)switch_check_network_list_ip_token((char const *)arg1,(char const *)arg2,(char const **)arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_time_set_monotonic(int jarg1) {
-  switch_bool_t arg1 ;
-  
-  arg1 = (switch_bool_t)jarg1; 
-  switch_time_set_monotonic(arg1);
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_min_dtmf_duration(unsigned long jarg1) {
-  unsigned long jresult ;
-  uint32_t arg1 ;
-  uint32_t result;
-  
-  arg1 = (uint32_t)jarg1; 
-  result = (uint32_t)switch_core_min_dtmf_duration(arg1);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_max_dtmf_duration(unsigned long jarg1) {
-  unsigned long jresult ;
-  uint32_t arg1 ;
-  uint32_t result;
-  
-  arg1 = (uint32_t)jarg1; 
-  result = (uint32_t)switch_core_max_dtmf_duration(arg1);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_default_dtmf_duration(unsigned long jarg1) {
-  unsigned long jresult ;
-  uint32_t arg1 ;
-  uint32_t result;
-  
-  arg1 = (uint32_t)jarg1; 
-  result = (uint32_t)switch_core_default_dtmf_duration(arg1);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_console_set_complete(char * jarg1) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_status_t)switch_console_set_complete((char const *)arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_console_set_alias(char * jarg1) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_status_t)switch_console_set_alias((char const *)arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_system(char * jarg1, int jarg2) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_bool_t arg2 ;
-  int result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_bool_t)jarg2; 
-  result = (int)switch_system((char const *)arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cond_yield(void * jarg1) {
-  switch_interval_time_t arg1 ;
-  switch_interval_time_t *argp1 ;
-  
-  argp1 = (switch_interval_time_t *)jarg1; 
-  if (!argp1) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_interval_time_t", 0);
-    return ;
-  }
-  arg1 = *argp1; 
-  switch_cond_yield(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cond_next() {
-  switch_cond_next();
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_chat_send(char * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  char *arg5 = (char *) 0 ;
-  char *arg6 = (char *) 0 ;
-  char *arg7 = (char *) 0 ;
-  char *arg8 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (char *)jarg5; 
-  arg6 = (char *)jarg6; 
-  arg7 = (char *)jarg7; 
-  arg8 = (char *)jarg8; 
-  result = (switch_status_t)switch_core_chat_send((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_preprocess_session(void * jarg1, char * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_status_t)switch_ivr_preprocess_session(arg1,(char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_CACHE_DB_LEN_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 256;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_native_handle_t_core_db_dbh_set(void * jarg1, void * jarg2) {
-  switch_cache_db_native_handle_t *arg1 = (switch_cache_db_native_handle_t *) 0 ;
-  switch_core_db_t *arg2 = (switch_core_db_t *) 0 ;
-  
-  arg1 = (switch_cache_db_native_handle_t *)jarg1; 
-  arg2 = (switch_core_db_t *)jarg2; 
-  if (arg1) (arg1)->core_db_dbh = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_cache_db_native_handle_t_core_db_dbh_get(void * jarg1) {
-  void * jresult ;
-  switch_cache_db_native_handle_t *arg1 = (switch_cache_db_native_handle_t *) 0 ;
-  switch_core_db_t *result = 0 ;
-  
-  arg1 = (switch_cache_db_native_handle_t *)jarg1; 
-  result = (switch_core_db_t *) ((arg1)->core_db_dbh);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_native_handle_t_odbc_dbh_set(void * jarg1, void * jarg2) {
-  switch_cache_db_native_handle_t *arg1 = (switch_cache_db_native_handle_t *) 0 ;
-  switch_odbc_handle_t *arg2 = (switch_odbc_handle_t *) 0 ;
-  
-  arg1 = (switch_cache_db_native_handle_t *)jarg1; 
-  arg2 = (switch_odbc_handle_t *)jarg2; 
-  if (arg1) (arg1)->odbc_dbh = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_cache_db_native_handle_t_odbc_dbh_get(void * jarg1) {
-  void * jresult ;
-  switch_cache_db_native_handle_t *arg1 = (switch_cache_db_native_handle_t *) 0 ;
-  switch_odbc_handle_t *result = 0 ;
-  
-  arg1 = (switch_cache_db_native_handle_t *)jarg1; 
-  result = (switch_odbc_handle_t *) ((arg1)->odbc_dbh);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_cache_db_native_handle_t() {
-  void * jresult ;
-  switch_cache_db_native_handle_t *result = 0 ;
-  
-  result = (switch_cache_db_native_handle_t *)new switch_cache_db_native_handle_t();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_cache_db_native_handle_t(void * jarg1) {
-  switch_cache_db_native_handle_t *arg1 = (switch_cache_db_native_handle_t *) 0 ;
-  
-  arg1 = (switch_cache_db_native_handle_t *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_core_db_options_t_db_path_set(void * jarg1, char * jarg2) {
-  switch_cache_db_core_db_options_t *arg1 = (switch_cache_db_core_db_options_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_cache_db_core_db_options_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->db_path) delete [] arg1->db_path;
-    if (arg2) {
-      arg1->db_path = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->db_path, (const char *)arg2);
-    } else {
-      arg1->db_path = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_cache_db_core_db_options_t_db_path_get(void * jarg1) {
-  char * jresult ;
-  switch_cache_db_core_db_options_t *arg1 = (switch_cache_db_core_db_options_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_cache_db_core_db_options_t *)jarg1; 
-  result = (char *) ((arg1)->db_path);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_cache_db_core_db_options_t() {
-  void * jresult ;
-  switch_cache_db_core_db_options_t *result = 0 ;
-  
-  result = (switch_cache_db_core_db_options_t *)new switch_cache_db_core_db_options_t();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_cache_db_core_db_options_t(void * jarg1) {
-  switch_cache_db_core_db_options_t *arg1 = (switch_cache_db_core_db_options_t *) 0 ;
-  
-  arg1 = (switch_cache_db_core_db_options_t *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_odbc_options_t_dsn_set(void * jarg1, char * jarg2) {
-  switch_cache_db_odbc_options_t *arg1 = (switch_cache_db_odbc_options_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_cache_db_odbc_options_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->dsn) delete [] arg1->dsn;
-    if (arg2) {
-      arg1->dsn = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->dsn, (const char *)arg2);
-    } else {
-      arg1->dsn = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_cache_db_odbc_options_t_dsn_get(void * jarg1) {
-  char * jresult ;
-  switch_cache_db_odbc_options_t *arg1 = (switch_cache_db_odbc_options_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_cache_db_odbc_options_t *)jarg1; 
-  result = (char *) ((arg1)->dsn);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_odbc_options_t_user_set(void * jarg1, char * jarg2) {
-  switch_cache_db_odbc_options_t *arg1 = (switch_cache_db_odbc_options_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_cache_db_odbc_options_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->user) delete [] arg1->user;
-    if (arg2) {
-      arg1->user = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->user, (const char *)arg2);
-    } else {
-      arg1->user = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_cache_db_odbc_options_t_user_get(void * jarg1) {
-  char * jresult ;
-  switch_cache_db_odbc_options_t *arg1 = (switch_cache_db_odbc_options_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_cache_db_odbc_options_t *)jarg1; 
-  result = (char *) ((arg1)->user);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_odbc_options_t_pass_set(void * jarg1, char * jarg2) {
-  switch_cache_db_odbc_options_t *arg1 = (switch_cache_db_odbc_options_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_cache_db_odbc_options_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->pass) delete [] arg1->pass;
-    if (arg2) {
-      arg1->pass = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->pass, (const char *)arg2);
-    } else {
-      arg1->pass = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_cache_db_odbc_options_t_pass_get(void * jarg1) {
-  char * jresult ;
-  switch_cache_db_odbc_options_t *arg1 = (switch_cache_db_odbc_options_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_cache_db_odbc_options_t *)jarg1; 
-  result = (char *) ((arg1)->pass);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_cache_db_odbc_options_t() {
-  void * jresult ;
-  switch_cache_db_odbc_options_t *result = 0 ;
-  
-  result = (switch_cache_db_odbc_options_t *)new switch_cache_db_odbc_options_t();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_cache_db_odbc_options_t(void * jarg1) {
-  switch_cache_db_odbc_options_t *arg1 = (switch_cache_db_odbc_options_t *) 0 ;
-  
-  arg1 = (switch_cache_db_odbc_options_t *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_connection_options_t_core_db_options_set(void * jarg1, void * jarg2) {
-  switch_cache_db_connection_options_t *arg1 = (switch_cache_db_connection_options_t *) 0 ;
-  switch_cache_db_core_db_options_t *arg2 = (switch_cache_db_core_db_options_t *) 0 ;
-  
-  arg1 = (switch_cache_db_connection_options_t *)jarg1; 
-  arg2 = (switch_cache_db_core_db_options_t *)jarg2; 
-  if (arg1) (arg1)->core_db_options = *arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_cache_db_connection_options_t_core_db_options_get(void * jarg1) {
-  void * jresult ;
-  switch_cache_db_connection_options_t *arg1 = (switch_cache_db_connection_options_t *) 0 ;
-  switch_cache_db_core_db_options_t *result = 0 ;
-  
-  arg1 = (switch_cache_db_connection_options_t *)jarg1; 
-  result = (switch_cache_db_core_db_options_t *)& ((arg1)->core_db_options);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_connection_options_t_odbc_options_set(void * jarg1, void * jarg2) {
-  switch_cache_db_connection_options_t *arg1 = (switch_cache_db_connection_options_t *) 0 ;
-  switch_cache_db_odbc_options_t *arg2 = (switch_cache_db_odbc_options_t *) 0 ;
-  
-  arg1 = (switch_cache_db_connection_options_t *)jarg1; 
-  arg2 = (switch_cache_db_odbc_options_t *)jarg2; 
-  if (arg1) (arg1)->odbc_options = *arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_cache_db_connection_options_t_odbc_options_get(void * jarg1) {
-  void * jresult ;
-  switch_cache_db_connection_options_t *arg1 = (switch_cache_db_connection_options_t *) 0 ;
-  switch_cache_db_odbc_options_t *result = 0 ;
-  
-  arg1 = (switch_cache_db_connection_options_t *)jarg1; 
-  result = (switch_cache_db_odbc_options_t *)& ((arg1)->odbc_options);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_cache_db_connection_options_t() {
-  void * jresult ;
-  switch_cache_db_connection_options_t *result = 0 ;
-  
-  result = (switch_cache_db_connection_options_t *)new switch_cache_db_connection_options_t();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_cache_db_connection_options_t(void * jarg1) {
-  switch_cache_db_connection_options_t *arg1 = (switch_cache_db_connection_options_t *) 0 ;
-  
-  arg1 = (switch_cache_db_connection_options_t *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_handle_t_name_set(void * jarg1, char * jarg2) {
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  char *arg2 ;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) strncpy((char *)arg1->name, (const char *)arg2, 256);
-    else arg1->name[0] = 0;
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_cache_db_handle_t_name_get(void * jarg1) {
-  char * jresult ;
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  result = (char *)(char *) ((arg1)->name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_handle_t_type_set(void * jarg1, int jarg2) {
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  switch_cache_db_handle_type_t arg2 ;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  arg2 = (switch_cache_db_handle_type_t)jarg2; 
-  if (arg1) (arg1)->type = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_cache_db_handle_t_type_get(void * jarg1) {
-  int jresult ;
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  switch_cache_db_handle_type_t result;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  result = (switch_cache_db_handle_type_t) ((arg1)->type);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_handle_t_native_handle_set(void * jarg1, void * jarg2) {
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  switch_cache_db_native_handle_t *arg2 = (switch_cache_db_native_handle_t *) 0 ;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  arg2 = (switch_cache_db_native_handle_t *)jarg2; 
-  if (arg1) (arg1)->native_handle = *arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_cache_db_handle_t_native_handle_get(void * jarg1) {
-  void * jresult ;
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  switch_cache_db_native_handle_t *result = 0 ;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  result = (switch_cache_db_native_handle_t *)& ((arg1)->native_handle);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_handle_t_last_used_set(void * jarg1, void * jarg2) {
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  time_t arg2 ;
-  time_t *argp2 ;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  argp2 = (time_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null time_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->last_used = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_cache_db_handle_t_last_used_get(void * jarg1) {
-  void * jresult ;
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  time_t result;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  result =  ((arg1)->last_used);
-  jresult = new time_t((time_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_handle_t_mutex_set(void * jarg1, void * jarg2) {
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  arg2 = (switch_mutex_t *)jarg2; 
-  if (arg1) (arg1)->mutex = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_cache_db_handle_t_mutex_get(void * jarg1) {
-  void * jresult ;
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  switch_mutex_t *result = 0 ;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  result = (switch_mutex_t *) ((arg1)->mutex);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_handle_t_pool_set(void * jarg1, void * jarg2) {
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  arg2 = (switch_memory_pool_t *)jarg2; 
-  if (arg1) (arg1)->pool = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_cache_db_handle_t_pool_get(void * jarg1) {
-  void * jresult ;
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  switch_memory_pool_t *result = 0 ;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  result = (switch_memory_pool_t *) ((arg1)->pool);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_handle_t_flags_set(void * jarg1, int jarg2) {
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  int32_t arg2 ;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  arg2 = (int32_t)jarg2; 
-  if (arg1) (arg1)->flags = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_cache_db_handle_t_flags_get(void * jarg1) {
-  int jresult ;
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  int32_t result;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  result = (int32_t) ((arg1)->flags);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_handle_t_hash_set(void * jarg1, unsigned long jarg2) {
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  unsigned long arg2 ;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  arg2 = (unsigned long)jarg2; 
-  if (arg1) (arg1)->hash = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_cache_db_handle_t_hash_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  unsigned long result;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  result = (unsigned long) ((arg1)->hash);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_handle_t_creator_set(void * jarg1, char * jarg2) {
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  char *arg2 ;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) strncpy((char *)arg1->creator, (const char *)arg2, 256);
-    else arg1->creator[0] = 0;
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_cache_db_handle_t_creator_get(void * jarg1) {
-  char * jresult ;
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  result = (char *)(char *) ((arg1)->creator);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_handle_t_last_user_set(void * jarg1, char * jarg2) {
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  char *arg2 ;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) strncpy((char *)arg1->last_user, (const char *)arg2, 256);
-    else arg1->last_user[0] = 0;
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_cache_db_handle_t_last_user_get(void * jarg1) {
-  char * jresult ;
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  result = (char *)(char *) ((arg1)->last_user);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_cache_db_handle_t() {
-  void * jresult ;
-  switch_cache_db_handle_t *result = 0 ;
-  
-  result = (switch_cache_db_handle_t *)new switch_cache_db_handle_t();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_cache_db_handle_t(void * jarg1) {
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_cache_db_type_name(int jarg1) {
-  char * jresult ;
-  switch_cache_db_handle_type_t arg1 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_cache_db_handle_type_t)jarg1; 
-  result = (char *)switch_cache_db_type_name(arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_release_db_handle(void * jarg1) {
-  switch_cache_db_handle_t **arg1 = (switch_cache_db_handle_t **) 0 ;
-  
-  arg1 = (switch_cache_db_handle_t **)jarg1; 
-  switch_cache_db_release_db_handle(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_destroy_db_handle(void * jarg1) {
-  switch_cache_db_handle_t **arg1 = (switch_cache_db_handle_t **) 0 ;
-  
-  arg1 = (switch_cache_db_handle_t **)jarg1; 
-  switch_cache_db_destroy_db_handle(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp__switch_cache_db_get_db_handle(void * jarg1, int jarg2, void * jarg3, char * jarg4, char * jarg5, int jarg6) {
-  int jresult ;
-  switch_cache_db_handle_t **arg1 = (switch_cache_db_handle_t **) 0 ;
-  switch_cache_db_handle_type_t arg2 ;
-  switch_cache_db_connection_options_t *arg3 = (switch_cache_db_connection_options_t *) 0 ;
-  char *arg4 = (char *) 0 ;
-  char *arg5 = (char *) 0 ;
-  int arg6 ;
-  switch_status_t result;
-  
-  arg1 = (switch_cache_db_handle_t **)jarg1; 
-  arg2 = (switch_cache_db_handle_type_t)jarg2; 
-  arg3 = (switch_cache_db_connection_options_t *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (char *)jarg5; 
-  arg6 = (int)jarg6; 
-  result = (switch_status_t)_switch_cache_db_get_db_handle(arg1,arg2,arg3,(char const *)arg4,(char const *)arg5,arg6);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_cache_db_execute_sql2str(void * jarg1, char * jarg2, char * jarg3, unsigned long jarg4, void * jarg5) {
-  char * jresult ;
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  size_t arg4 ;
-  char **arg5 = (char **) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (size_t)jarg4; 
-  arg5 = (char **)jarg5; 
-  result = (char *)switch_cache_db_execute_sql2str(arg1,arg2,arg3,arg4,arg5);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_cache_db_execute_sql(void * jarg1, char * jarg2, void * jarg3) {
-  int jresult ;
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char **arg3 = (char **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char **)jarg3; 
-  result = (switch_status_t)switch_cache_db_execute_sql(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_cache_db_execute_sql_callback(void * jarg1, char * jarg2, void * jarg3, void * jarg4, void * jarg5) {
-  int jresult ;
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_core_db_callback_func_t arg3 = (switch_core_db_callback_func_t) 0 ;
-  void *arg4 = (void *) 0 ;
-  char **arg5 = (char **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_core_db_callback_func_t)jarg3; 
-  arg4 = (void *)jarg4; 
-  arg5 = (char **)jarg5; 
-  result = (switch_status_t)switch_cache_db_execute_sql_callback(arg1,(char const *)arg2,arg3,arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_status(void * jarg1) {
-  switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ;
-  
-  arg1 = (switch_stream_handle_t *)jarg1; 
-  switch_cache_db_status(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp__switch_core_db_handle(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
-  int jresult ;
-  switch_cache_db_handle_t **arg1 = (switch_cache_db_handle_t **) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  switch_status_t result;
-  
-  arg1 = (switch_cache_db_handle_t **)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (int)jarg4; 
-  result = (switch_status_t)_switch_core_db_handle(arg1,(char const *)arg2,(char const *)arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_test_reactive(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  switch_cache_db_test_reactive(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_cache_db_persistant_execute(void * jarg1, char * jarg2, unsigned long jarg3) {
-  int jresult ;
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  uint32_t arg3 ;
-  switch_status_t result;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (uint32_t)jarg3; 
-  result = (switch_status_t)switch_cache_db_persistant_execute(arg1,(char const *)arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_cache_db_persistant_execute_trans(void * jarg1, char * jarg2, unsigned long jarg3) {
-  int jresult ;
-  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  uint32_t arg3 ;
-  switch_status_t result;
-  
-  arg1 = (switch_cache_db_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (uint32_t)jarg3; 
-  result = (switch_status_t)switch_cache_db_persistant_execute_trans(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_detach() {
-  switch_cache_db_detach();
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_debug_level() {
-  unsigned long jresult ;
-  uint32_t result;
-  
-  result = (uint32_t)switch_core_debug_level();
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CMD_CHUNK_LEN_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 1024;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_console_loop() {
-  switch_console_loop();
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_console_stream_raw_write(void * jarg1, void * jarg2, void * jarg3) {
-  int jresult ;
-  switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ;
-  uint8_t *arg2 = (uint8_t *) 0 ;
-  switch_size_t arg3 ;
-  switch_status_t result;
-  switch_size_t *argp3 ;
-  
-  arg1 = (switch_stream_handle_t *)jarg1; 
-  arg2 = (uint8_t *)jarg2; 
-  argp3 = (switch_size_t *)jarg3; 
-  if (!argp3) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg3 = *argp3; 
-  result = (switch_status_t)switch_console_stream_raw_write(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_stream_write_file_contents(void * jarg1, char * jarg2) {
-  int jresult ;
-  switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_stream_handle_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_status_t)switch_stream_write_file_contents(arg1,(char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_toupper(int jarg1) {
-  int jresult ;
-  int arg1 ;
-  int result;
-  
-  arg1 = (int)jarg1; 
-  result = (int)switch_toupper(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_tolower(int jarg1) {
-  int jresult ;
-  int arg1 ;
-  int result;
-  
-  arg1 = (int)jarg1; 
-  result = (int)switch_tolower(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_isalnum(int jarg1) {
-  int jresult ;
-  int arg1 ;
-  int result;
-  
-  arg1 = (int)jarg1; 
-  result = (int)switch_isalnum(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_isalpha(int jarg1) {
-  int jresult ;
-  int arg1 ;
-  int result;
-  
-  arg1 = (int)jarg1; 
-  result = (int)switch_isalpha(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_iscntrl(int jarg1) {
-  int jresult ;
-  int arg1 ;
-  int result;
-  
-  arg1 = (int)jarg1; 
-  result = (int)switch_iscntrl(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_isdigit(int jarg1) {
-  int jresult ;
-  int arg1 ;
-  int result;
-  
-  arg1 = (int)jarg1; 
-  result = (int)switch_isdigit(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_isgraph(int jarg1) {
-  int jresult ;
-  int arg1 ;
-  int result;
-  
-  arg1 = (int)jarg1; 
-  result = (int)switch_isgraph(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_islower(int jarg1) {
-  int jresult ;
-  int arg1 ;
-  int result;
-  
-  arg1 = (int)jarg1; 
-  result = (int)switch_islower(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_isprint(int jarg1) {
-  int jresult ;
-  int arg1 ;
-  int result;
-  
-  arg1 = (int)jarg1; 
-  result = (int)switch_isprint(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ispunct(int jarg1) {
-  int jresult ;
-  int arg1 ;
-  int result;
-  
-  arg1 = (int)jarg1; 
-  result = (int)switch_ispunct(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_isspace(int jarg1) {
-  int jresult ;
-  int arg1 ;
-  int result;
-  
-  arg1 = (int)jarg1; 
-  result = (int)switch_isspace(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_isupper(int jarg1) {
-  int jresult ;
-  int arg1 ;
-  int result;
-  
-  arg1 = (int)jarg1; 
-  result = (int)switch_isupper(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_isxdigit(int jarg1) {
-  int jresult ;
-  int arg1 ;
-  int result;
-  
-  arg1 = (int)jarg1; 
-  result = (int)switch_isxdigit(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_SMAX_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 32767;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_SMIN_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) -32768;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_zstr(char * jarg1) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  int result;
-  
-  arg1 = (char *)jarg1; 
-  result = (int)zstr((char const *)arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_moh(char * jarg1) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_bool_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_bool_t)switch_is_moh((char const *)arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_string_has_escaped_data(char * jarg1) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  int result;
-  
-  arg1 = (char *)jarg1; 
-  result = (int)switch_string_has_escaped_data((char const *)arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_b64_encode(void * jarg1, void * jarg2, void * jarg3, void * jarg4) {
-  int jresult ;
-  unsigned char *arg1 = (unsigned char *) 0 ;
-  switch_size_t arg2 ;
-  unsigned char *arg3 = (unsigned char *) 0 ;
-  switch_size_t arg4 ;
-  switch_status_t result;
-  switch_size_t *argp2 ;
-  switch_size_t *argp4 ;
-  
-  arg1 = (unsigned char *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg2 = *argp2; 
-  arg3 = (unsigned char *)jarg3; 
-  argp4 = (switch_size_t *)jarg4; 
-  if (!argp4) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg4 = *argp4; 
-  result = (switch_status_t)switch_b64_encode(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_b64_decode(char * jarg1, char * jarg2, void * jarg3) {
-  void * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_size_t arg3 ;
-  switch_size_t result;
-  switch_size_t *argp3 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  argp3 = (switch_size_t *)jarg3; 
-  if (!argp3) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg3 = *argp3; 
-  result = switch_b64_decode(arg1,arg2,arg3);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_amp_encode(char * jarg1, char * jarg2, void * jarg3) {
-  char * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_size_t arg3 ;
-  char *result = 0 ;
-  switch_size_t *argp3 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  argp3 = (switch_size_t *)jarg3; 
-  if (!argp3) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg3 = *argp3; 
-  result = (char *)switch_amp_encode(arg1,arg2,arg3);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_digit_string(char * jarg1) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_bool_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_bool_t)switch_is_digit_string((char const *)arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_fd_read_line(int jarg1, char * jarg2, void * jarg3) {
-  void * jresult ;
-  int arg1 ;
-  char *arg2 = (char *) 0 ;
-  switch_size_t arg3 ;
-  switch_size_t result;
-  switch_size_t *argp3 ;
-  
-  arg1 = (int)jarg1; 
-  arg2 = (char *)jarg2; 
-  argp3 = (switch_size_t *)jarg3; 
-  if (!argp3) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg3 = *argp3; 
-  result = switch_fd_read_line(arg1,arg2,arg3);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_frame_alloc(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_frame_t **arg1 = (switch_frame_t **) 0 ;
-  switch_size_t arg2 ;
-  switch_status_t result;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_frame_t **)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg2 = *argp2; 
-  result = (switch_status_t)switch_frame_alloc(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_frame_dup(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_frame_t *arg1 = (switch_frame_t *) 0 ;
-  switch_frame_t **arg2 = (switch_frame_t **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_frame_t *)jarg1; 
-  arg2 = (switch_frame_t **)jarg2; 
-  result = (switch_status_t)switch_frame_dup(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_frame_free(void * jarg1) {
-  int jresult ;
-  switch_frame_t **arg1 = (switch_frame_t **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_frame_t **)jarg1; 
-  result = (switch_status_t)switch_frame_free(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_resolve_host(char * jarg1, char * jarg2, unsigned long jarg3) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  size_t arg3 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (size_t)jarg3; 
-  result = (switch_status_t)switch_resolve_host((char const *)arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_find_local_ip(char * jarg1, int jarg2, void * jarg3, int jarg4) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  int arg2 ;
-  int *arg3 = (int *) 0 ;
-  int arg4 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (int)jarg2; 
-  arg3 = (int *)jarg3; 
-  arg4 = (int)jarg4; 
-  result = (switch_status_t)switch_find_local_ip(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_get_addr(char * jarg1, void * jarg2, void * jarg3, void * jarg4) {
-  char * jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_size_t arg2 ;
-  sockaddr *arg3 = (sockaddr *) 0 ;
-  socklen_t arg4 ;
-  char *result = 0 ;
-  switch_size_t *argp2 ;
-  socklen_t *argp4 ;
-  
-  arg1 = (char *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg2 = *argp2; 
-  arg3 = (sockaddr *)jarg3; 
-  argp4 = (socklen_t *)jarg4; 
-  if (!argp4) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null socklen_t", 0);
-    return 0;
-  }
-  arg4 = *argp4; 
-  result = (char *)get_addr(arg1,arg2,arg3,arg4);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_get_addr_int(void * jarg1) {
-  int jresult ;
-  switch_sockaddr_t *arg1 = (switch_sockaddr_t *) 0 ;
-  int result;
-  
-  arg1 = (switch_sockaddr_t *)jarg1; 
-  result = (int)get_addr_int(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_cmp_addr(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_sockaddr_t *arg1 = (switch_sockaddr_t *) 0 ;
-  switch_sockaddr_t *arg2 = (switch_sockaddr_t *) 0 ;
-  int result;
-  
-  arg1 = (switch_sockaddr_t *)jarg1; 
-  arg2 = (switch_sockaddr_t *)jarg2; 
-  result = (int)switch_cmp_addr(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned short SWIGSTDCALL CSharp_get_port(void * jarg1) {
-  unsigned short jresult ;
-  sockaddr *arg1 = (sockaddr *) 0 ;
-  unsigned short result;
-  
-  arg1 = (sockaddr *)jarg1; 
-  result = (unsigned short)get_port(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_build_uri(char * jarg1, void * jarg2, char * jarg3, char * jarg4, void * jarg5, int jarg6) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_size_t arg2 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  switch_sockaddr_t *arg5 = (switch_sockaddr_t *) 0 ;
-  int arg6 ;
-  int result;
-  switch_size_t *argp2 ;
-  
-  arg1 = (char *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg2 = *argp2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (switch_sockaddr_t *)jarg5; 
-  arg6 = (int)jarg6; 
-  result = (int)switch_build_uri(arg1,arg2,(char const *)arg3,(char const *)arg4,(switch_sockaddr_t const *)arg5,arg6);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_priority_name(int jarg1) {
-  char * jresult ;
-  switch_priority_t arg1 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_priority_t)jarg1; 
-  result = (char *)switch_priority_name(arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char SWIGSTDCALL CSharp_switch_rfc2833_to_char(int jarg1) {
-  char jresult ;
-  int arg1 ;
-  char result;
-  
-  arg1 = (int)jarg1; 
-  result = (char)switch_rfc2833_to_char(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_char_to_rfc2833(char jarg1) {
-  unsigned char jresult ;
-  char arg1 ;
-  unsigned char result;
-  
-  arg1 = (char)jarg1; 
-  result = (unsigned char)switch_char_to_rfc2833(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_sanitize_number(char * jarg1) {
-  char * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  result = (char *)switch_sanitize_number(arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_string_var_check(char * jarg1, int jarg2) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_bool_t arg2 ;
-  switch_bool_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_bool_t)jarg2; 
-  result = (switch_bool_t)switch_string_var_check(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_string_var_check_const(char * jarg1) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_bool_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_bool_t)switch_string_var_check_const((char const *)arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_var_clean_string(char * jarg1) {
-  char * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  result = (char *)switch_var_clean_string(arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_clean_string(char * jarg1) {
-  char * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  result = (char *)switch_clean_string(arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_safe_strdup(char * jarg1) {
-  char * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  result = (char *)switch_safe_strdup((char const *)arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_lc_strdup(char * jarg1) {
-  char * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  result = (char *)switch_lc_strdup((char const *)arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_uc_strdup(char * jarg1) {
-  char * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  result = (char *)switch_uc_strdup((char const *)arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_strstr(char * jarg1, char * jarg2) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_bool_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_bool_t)switch_strstr(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_str_time(char * jarg1) {
-  void * jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_time_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = switch_str_time((char const *)arg1);
-  jresult = new switch_time_t((switch_time_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_separate_string(char * jarg1, char jarg2, void * jarg3, unsigned int jarg4) {
-  unsigned int jresult ;
-  char *arg1 = (char *) 0 ;
-  char arg2 ;
-  char **arg3 = (char **) 0 ;
-  unsigned int arg4 ;
-  unsigned int result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char)jarg2; 
-  arg3 = (char **)jarg3; 
-  arg4 = (unsigned int)jarg4; 
-  result = (unsigned int)switch_separate_string(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_separate_string_string(char * jarg1, char * jarg2, void * jarg3, unsigned int jarg4) {
-  unsigned int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char **arg3 = (char **) 0 ;
-  unsigned int arg4 ;
-  unsigned int result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char **)jarg3; 
-  arg4 = (unsigned int)jarg4; 
-  result = (unsigned int)switch_separate_string_string(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_number(char * jarg1) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_bool_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_bool_t)switch_is_number((char const *)arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_spaces(char * jarg1) {
-  char * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  result = (char *)switch_strip_spaces((char const *)arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_separate_paren_args(char * jarg1) {
-  char * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  result = (char *)switch_separate_paren_args(arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_stristr(char * jarg1, char * jarg2) {
-  char * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (char *)switch_stristr((char const *)arg1,(char const *)arg2);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_lan_addr(char * jarg1) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_bool_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_bool_t)switch_is_lan_addr((char const *)arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_replace_char(char * jarg1, char jarg2, char jarg3, int jarg4) {
-  char * jresult ;
-  char *arg1 = (char *) 0 ;
-  char arg2 ;
-  char arg3 ;
-  switch_bool_t arg4 ;
-  char *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char)jarg2; 
-  arg3 = (char)jarg3; 
-  arg4 = (switch_bool_t)jarg4; 
-  result = (char *)switch_replace_char(arg1,arg2,arg3,arg4);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ast2regex(char * jarg1, char * jarg2, unsigned long jarg3) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  size_t arg3 ;
-  switch_bool_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (size_t)jarg3; 
-  result = (switch_bool_t)switch_ast2regex((char const *)arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_escape_char(void * jarg1, char * jarg2, char * jarg3, char jarg4) {
-  char * jresult ;
-  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char arg4 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_memory_pool_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char)jarg4; 
-  result = (char *)switch_escape_char(arg1,arg2,(char const *)arg3,arg4);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_socket_waitfor(void * jarg1, int jarg2) {
-  int jresult ;
-  switch_pollfd_t *arg1 = (switch_pollfd_t *) 0 ;
-  int arg2 ;
-  int result;
-  
-  arg1 = (switch_pollfd_t *)jarg1; 
-  arg2 = (int)jarg2; 
-  result = (int)switch_socket_waitfor(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_cut_path(char * jarg1) {
-  char * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  result = (char *)switch_cut_path((char const *)arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_string_replace(char * jarg1, char * jarg2, char * jarg3) {
-  char * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (char *)switch_string_replace((char const *)arg1,(char const *)arg2,(char const *)arg3);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_string_match(char * jarg1, unsigned long jarg2, char * jarg3, unsigned long jarg4) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  size_t arg2 ;
-  char *arg3 = (char *) 0 ;
-  size_t arg4 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (size_t)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (size_t)jarg4; 
-  result = (switch_status_t)switch_string_match((char const *)arg1,arg2,(char const *)arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_util_quote_shell_arg(char * jarg1) {
-  char * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  result = (char *)switch_util_quote_shell_arg((char const *)arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_url_encode(char * jarg1, char * jarg2, unsigned long jarg3) {
-  unsigned long jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  size_t arg3 ;
-  size_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (size_t)jarg3; 
-  result = switch_url_encode((char const *)arg1,arg2,arg3);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_url_decode(char * jarg1) {
-  char * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  result = (char *)switch_url_decode(arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_simple_email(char * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  char *arg5 = (char *) 0 ;
-  char *arg6 = (char *) 0 ;
-  char *arg7 = (char *) 0 ;
-  switch_bool_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (char *)jarg5; 
-  arg6 = (char *)jarg6; 
-  arg7 = (char *)jarg7; 
-  result = (switch_bool_t)switch_simple_email((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_find_end_paren(char * jarg1, char jarg2, char jarg3) {
-  char * jresult ;
-  char *arg1 = (char *) 0 ;
-  char arg2 ;
-  char arg3 ;
-  char *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char)jarg2; 
-  arg3 = (char)jarg3; 
-  result = (char *)switch_find_end_paren((char const *)arg1,arg2,arg3);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_file_path(char * jarg1) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_bool_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_bool_t)switch_is_file_path((char const *)arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_parse_cidr(char * jarg1, void * jarg2, void * jarg3, void * jarg4) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  uint32_t *arg2 = (uint32_t *) 0 ;
-  uint32_t *arg3 = (uint32_t *) 0 ;
-  uint32_t *arg4 = (uint32_t *) 0 ;
-  int result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (uint32_t *)jarg2; 
-  arg3 = (uint32_t *)jarg3; 
-  arg4 = (uint32_t *)jarg4; 
-  result = (int)switch_parse_cidr((char const *)arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_create(void * jarg1, char * jarg2, int jarg3, void * jarg4) {
-  int jresult ;
-  switch_network_list_t **arg1 = (switch_network_list_t **) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_bool_t arg3 ;
-  switch_memory_pool_t *arg4 = (switch_memory_pool_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_network_list_t **)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_bool_t)jarg3; 
-  arg4 = (switch_memory_pool_t *)jarg4; 
-  result = (switch_status_t)switch_network_list_create(arg1,(char const *)arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_add_cidr_token(void * jarg1, char * jarg2, int jarg3, char * jarg4) {
-  int jresult ;
-  switch_network_list_t *arg1 = (switch_network_list_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_bool_t arg3 ;
-  char *arg4 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_network_list_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_bool_t)jarg3; 
-  arg4 = (char *)jarg4; 
-  result = (switch_status_t)switch_network_list_add_cidr_token(arg1,(char const *)arg2,arg3,(char const *)arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_add_host_mask(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
-  int jresult ;
-  switch_network_list_t *arg1 = (switch_network_list_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  switch_bool_t arg4 ;
-  switch_status_t result;
-  
-  arg1 = (switch_network_list_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (switch_bool_t)jarg4; 
-  result = (switch_status_t)switch_network_list_add_host_mask(arg1,(char const *)arg2,(char const *)arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_validate_ip_token(void * jarg1, unsigned long jarg2, void * jarg3) {
-  int jresult ;
-  switch_network_list_t *arg1 = (switch_network_list_t *) 0 ;
-  uint32_t arg2 ;
-  char **arg3 = (char **) 0 ;
-  switch_bool_t result;
-  
-  arg1 = (switch_network_list_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  arg3 = (char **)jarg3; 
-  result = (switch_bool_t)switch_network_list_validate_ip_token(arg1,arg2,(char const **)arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_number_cmp(char * jarg1, int jarg2) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  int arg2 ;
-  int result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (int)jarg2; 
-  result = (int)switch_number_cmp((char const *)arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_username_set(void * jarg1, char * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->username = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->username, (const char *)arg2);
-    } else {
-      arg1->username = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_username_get(void * jarg1) {
-  char * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (char *) ((arg1)->username);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_dialplan_set(void * jarg1, char * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->dialplan = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->dialplan, (const char *)arg2);
-    } else {
-      arg1->dialplan = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_dialplan_get(void * jarg1) {
-  char * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (char *) ((arg1)->dialplan);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_caller_id_name_set(void * jarg1, char * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->caller_id_name = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->caller_id_name, (const char *)arg2);
-    } else {
-      arg1->caller_id_name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_caller_id_name_get(void * jarg1) {
-  char * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (char *) ((arg1)->caller_id_name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_caller_id_number_set(void * jarg1, char * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->caller_id_number = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->caller_id_number, (const char *)arg2);
-    } else {
-      arg1->caller_id_number = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_caller_id_number_get(void * jarg1) {
-  char * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (char *) ((arg1)->caller_id_number);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_callee_id_name_set(void * jarg1, char * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->callee_id_name = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->callee_id_name, (const char *)arg2);
-    } else {
-      arg1->callee_id_name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_callee_id_name_get(void * jarg1) {
-  char * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (char *) ((arg1)->callee_id_name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_callee_id_number_set(void * jarg1, char * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->callee_id_number = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->callee_id_number, (const char *)arg2);
-    } else {
-      arg1->callee_id_number = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_callee_id_number_get(void * jarg1) {
-  char * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (char *) ((arg1)->callee_id_number);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_caller_ton_set(void * jarg1, unsigned char jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  uint8_t arg2 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (uint8_t)jarg2; 
-  if (arg1) (arg1)->caller_ton = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_caller_profile_caller_ton_get(void * jarg1) {
-  unsigned char jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  uint8_t result;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (uint8_t) ((arg1)->caller_ton);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_caller_numplan_set(void * jarg1, unsigned char jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  uint8_t arg2 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (uint8_t)jarg2; 
-  if (arg1) (arg1)->caller_numplan = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_caller_profile_caller_numplan_get(void * jarg1) {
-  unsigned char jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  uint8_t result;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (uint8_t) ((arg1)->caller_numplan);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_network_addr_set(void * jarg1, char * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->network_addr = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->network_addr, (const char *)arg2);
-    } else {
-      arg1->network_addr = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_network_addr_get(void * jarg1) {
-  char * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (char *) ((arg1)->network_addr);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_ani_set(void * jarg1, char * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->ani = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->ani, (const char *)arg2);
-    } else {
-      arg1->ani = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_ani_get(void * jarg1) {
-  char * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (char *) ((arg1)->ani);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_ani_ton_set(void * jarg1, unsigned char jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  uint8_t arg2 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (uint8_t)jarg2; 
-  if (arg1) (arg1)->ani_ton = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_caller_profile_ani_ton_get(void * jarg1) {
-  unsigned char jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  uint8_t result;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (uint8_t) ((arg1)->ani_ton);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_ani_numplan_set(void * jarg1, unsigned char jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  uint8_t arg2 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (uint8_t)jarg2; 
-  if (arg1) (arg1)->ani_numplan = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_caller_profile_ani_numplan_get(void * jarg1) {
-  unsigned char jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  uint8_t result;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (uint8_t) ((arg1)->ani_numplan);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_aniii_set(void * jarg1, char * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->aniii = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->aniii, (const char *)arg2);
-    } else {
-      arg1->aniii = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_aniii_get(void * jarg1) {
-  char * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (char *) ((arg1)->aniii);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_rdnis_set(void * jarg1, char * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->rdnis = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->rdnis, (const char *)arg2);
-    } else {
-      arg1->rdnis = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_rdnis_get(void * jarg1) {
-  char * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (char *) ((arg1)->rdnis);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_rdnis_ton_set(void * jarg1, unsigned char jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  uint8_t arg2 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (uint8_t)jarg2; 
-  if (arg1) (arg1)->rdnis_ton = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_caller_profile_rdnis_ton_get(void * jarg1) {
-  unsigned char jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  uint8_t result;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (uint8_t) ((arg1)->rdnis_ton);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_rdnis_numplan_set(void * jarg1, unsigned char jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  uint8_t arg2 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (uint8_t)jarg2; 
-  if (arg1) (arg1)->rdnis_numplan = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_caller_profile_rdnis_numplan_get(void * jarg1) {
-  unsigned char jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  uint8_t result;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (uint8_t) ((arg1)->rdnis_numplan);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_destination_number_set(void * jarg1, char * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->destination_number) delete [] arg1->destination_number;
-    if (arg2) {
-      arg1->destination_number = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->destination_number, (const char *)arg2);
-    } else {
-      arg1->destination_number = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_destination_number_get(void * jarg1) {
-  char * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (char *) ((arg1)->destination_number);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_destination_number_ton_set(void * jarg1, unsigned char jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  uint8_t arg2 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (uint8_t)jarg2; 
-  if (arg1) (arg1)->destination_number_ton = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_caller_profile_destination_number_ton_get(void * jarg1) {
-  unsigned char jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  uint8_t result;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (uint8_t) ((arg1)->destination_number_ton);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_destination_number_numplan_set(void * jarg1, unsigned char jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  uint8_t arg2 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (uint8_t)jarg2; 
-  if (arg1) (arg1)->destination_number_numplan = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_caller_profile_destination_number_numplan_get(void * jarg1) {
-  unsigned char jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  uint8_t result;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (uint8_t) ((arg1)->destination_number_numplan);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_source_set(void * jarg1, char * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->source = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->source, (const char *)arg2);
-    } else {
-      arg1->source = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_source_get(void * jarg1) {
-  char * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (char *) ((arg1)->source);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_chan_name_set(void * jarg1, char * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->chan_name) delete [] arg1->chan_name;
-    if (arg2) {
-      arg1->chan_name = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->chan_name, (const char *)arg2);
-    } else {
-      arg1->chan_name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_chan_name_get(void * jarg1) {
-  char * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (char *) ((arg1)->chan_name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_uuid_set(void * jarg1, char * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->uuid) delete [] arg1->uuid;
-    if (arg2) {
-      arg1->uuid = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->uuid, (const char *)arg2);
-    } else {
-      arg1->uuid = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_uuid_get(void * jarg1) {
-  char * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (char *) ((arg1)->uuid);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_context_set(void * jarg1, char * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->context = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->context, (const char *)arg2);
-    } else {
-      arg1->context = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_context_get(void * jarg1) {
-  char * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (char *) ((arg1)->context);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_profile_index_set(void * jarg1, char * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->profile_index = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->profile_index, (const char *)arg2);
-    } else {
-      arg1->profile_index = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_profile_index_get(void * jarg1) {
-  char * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (char *) ((arg1)->profile_index);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_flags_set(void * jarg1, unsigned long jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  switch_caller_profile_flag_t arg2 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (switch_caller_profile_flag_t)jarg2; 
-  if (arg1) (arg1)->flags = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_caller_profile_flags_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  switch_caller_profile_flag_t result;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (switch_caller_profile_flag_t) ((arg1)->flags);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_originator_caller_profile_set(void * jarg1, void * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  switch_caller_profile *arg2 = (switch_caller_profile *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (switch_caller_profile *)jarg2; 
-  if (arg1) (arg1)->originator_caller_profile = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_originator_caller_profile_get(void * jarg1) {
-  void * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  switch_caller_profile *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (switch_caller_profile *) ((arg1)->originator_caller_profile);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_originatee_caller_profile_set(void * jarg1, void * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  switch_caller_profile *arg2 = (switch_caller_profile *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (switch_caller_profile *)jarg2; 
-  if (arg1) (arg1)->originatee_caller_profile = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_originatee_caller_profile_get(void * jarg1) {
-  void * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  switch_caller_profile *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (switch_caller_profile *) ((arg1)->originatee_caller_profile);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_hunt_caller_profile_set(void * jarg1, void * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  switch_caller_profile *arg2 = (switch_caller_profile *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (switch_caller_profile *)jarg2; 
-  if (arg1) (arg1)->hunt_caller_profile = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_hunt_caller_profile_get(void * jarg1) {
-  void * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  switch_caller_profile *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (switch_caller_profile *) ((arg1)->hunt_caller_profile);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_times_set(void * jarg1, void * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  switch_channel_timetable *arg2 = (switch_channel_timetable *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (switch_channel_timetable *)jarg2; 
-  if (arg1) (arg1)->times = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_times_get(void * jarg1) {
-  void * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  switch_channel_timetable *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (switch_channel_timetable *) ((arg1)->times);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_caller_extension_set(void * jarg1, void * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  switch_caller_extension *arg2 = (switch_caller_extension *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (switch_caller_extension *)jarg2; 
-  if (arg1) (arg1)->caller_extension = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_caller_extension_get(void * jarg1) {
-  void * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  switch_caller_extension *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (switch_caller_extension *) ((arg1)->caller_extension);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_pool_set(void * jarg1, void * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (switch_memory_pool_t *)jarg2; 
-  if (arg1) (arg1)->pool = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_pool_get(void * jarg1) {
-  void * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  switch_memory_pool_t *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (switch_memory_pool_t *) ((arg1)->pool);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_next_set(void * jarg1, void * jarg2) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  switch_caller_profile *arg2 = (switch_caller_profile *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  arg2 = (switch_caller_profile *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_next_get(void * jarg1) {
-  void * jresult ;
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  switch_caller_profile *result = 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  result = (switch_caller_profile *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_caller_profile() {
-  void * jresult ;
-  switch_caller_profile *result = 0 ;
-  
-  result = (switch_caller_profile *)new switch_caller_profile();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_caller_profile(void * jarg1) {
-  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
-  
-  arg1 = (switch_caller_profile *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_application_application_name_set(void * jarg1, char * jarg2) {
-  switch_caller_application *arg1 = (switch_caller_application *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_caller_application *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->application_name) delete [] arg1->application_name;
-    if (arg2) {
-      arg1->application_name = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->application_name, (const char *)arg2);
-    } else {
-      arg1->application_name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_application_application_name_get(void * jarg1) {
-  char * jresult ;
-  switch_caller_application *arg1 = (switch_caller_application *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_caller_application *)jarg1; 
-  result = (char *) ((arg1)->application_name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_application_application_data_set(void * jarg1, char * jarg2) {
-  switch_caller_application *arg1 = (switch_caller_application *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_caller_application *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->application_data) delete [] arg1->application_data;
-    if (arg2) {
-      arg1->application_data = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->application_data, (const char *)arg2);
-    } else {
-      arg1->application_data = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_application_application_data_get(void * jarg1) {
-  char * jresult ;
-  switch_caller_application *arg1 = (switch_caller_application *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_caller_application *)jarg1; 
-  result = (char *) ((arg1)->application_data);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_application_application_function_set(void * jarg1, void * jarg2) {
-  switch_caller_application *arg1 = (switch_caller_application *) 0 ;
-  switch_application_function_t arg2 = (switch_application_function_t) 0 ;
-  
-  arg1 = (switch_caller_application *)jarg1; 
-  arg2 = (switch_application_function_t)jarg2; 
-  if (arg1) (arg1)->application_function = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_application_application_function_get(void * jarg1) {
-  void * jresult ;
-  switch_caller_application *arg1 = (switch_caller_application *) 0 ;
-  switch_application_function_t result;
-  
-  arg1 = (switch_caller_application *)jarg1; 
-  result = (switch_application_function_t) ((arg1)->application_function);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_application_next_set(void * jarg1, void * jarg2) {
-  switch_caller_application *arg1 = (switch_caller_application *) 0 ;
-  switch_caller_application *arg2 = (switch_caller_application *) 0 ;
-  
-  arg1 = (switch_caller_application *)jarg1; 
-  arg2 = (switch_caller_application *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_application_next_get(void * jarg1) {
-  void * jresult ;
-  switch_caller_application *arg1 = (switch_caller_application *) 0 ;
-  switch_caller_application *result = 0 ;
-  
-  arg1 = (switch_caller_application *)jarg1; 
-  result = (switch_caller_application *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_caller_application() {
-  void * jresult ;
-  switch_caller_application *result = 0 ;
-  
-  result = (switch_caller_application *)new switch_caller_application();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_caller_application(void * jarg1) {
-  switch_caller_application *arg1 = (switch_caller_application *) 0 ;
-  
-  arg1 = (switch_caller_application *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_extension_extension_name_set(void * jarg1, char * jarg2) {
-  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_caller_extension *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->extension_name) delete [] arg1->extension_name;
-    if (arg2) {
-      arg1->extension_name = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->extension_name, (const char *)arg2);
-    } else {
-      arg1->extension_name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_extension_extension_name_get(void * jarg1) {
-  char * jresult ;
-  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_caller_extension *)jarg1; 
-  result = (char *) ((arg1)->extension_name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_extension_extension_number_set(void * jarg1, char * jarg2) {
-  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_caller_extension *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->extension_number) delete [] arg1->extension_number;
-    if (arg2) {
-      arg1->extension_number = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->extension_number, (const char *)arg2);
-    } else {
-      arg1->extension_number = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_extension_extension_number_get(void * jarg1) {
-  char * jresult ;
-  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_caller_extension *)jarg1; 
-  result = (char *) ((arg1)->extension_number);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_extension_current_application_set(void * jarg1, void * jarg2) {
-  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
-  switch_caller_application_t *arg2 = (switch_caller_application_t *) 0 ;
-  
-  arg1 = (switch_caller_extension *)jarg1; 
-  arg2 = (switch_caller_application_t *)jarg2; 
-  if (arg1) (arg1)->current_application = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_extension_current_application_get(void * jarg1) {
-  void * jresult ;
-  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
-  switch_caller_application_t *result = 0 ;
-  
-  arg1 = (switch_caller_extension *)jarg1; 
-  result = (switch_caller_application_t *) ((arg1)->current_application);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_extension_last_application_set(void * jarg1, void * jarg2) {
-  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
-  switch_caller_application_t *arg2 = (switch_caller_application_t *) 0 ;
-  
-  arg1 = (switch_caller_extension *)jarg1; 
-  arg2 = (switch_caller_application_t *)jarg2; 
-  if (arg1) (arg1)->last_application = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_extension_last_application_get(void * jarg1) {
-  void * jresult ;
-  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
-  switch_caller_application_t *result = 0 ;
-  
-  arg1 = (switch_caller_extension *)jarg1; 
-  result = (switch_caller_application_t *) ((arg1)->last_application);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_extension_applications_set(void * jarg1, void * jarg2) {
-  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
-  switch_caller_application_t *arg2 = (switch_caller_application_t *) 0 ;
-  
-  arg1 = (switch_caller_extension *)jarg1; 
-  arg2 = (switch_caller_application_t *)jarg2; 
-  if (arg1) (arg1)->applications = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_extension_applications_get(void * jarg1) {
-  void * jresult ;
-  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
-  switch_caller_application_t *result = 0 ;
-  
-  arg1 = (switch_caller_extension *)jarg1; 
-  result = (switch_caller_application_t *) ((arg1)->applications);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_extension_children_set(void * jarg1, void * jarg2) {
-  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
-  switch_caller_profile *arg2 = (switch_caller_profile *) 0 ;
-  
-  arg1 = (switch_caller_extension *)jarg1; 
-  arg2 = (switch_caller_profile *)jarg2; 
-  if (arg1) (arg1)->children = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_extension_children_get(void * jarg1) {
-  void * jresult ;
-  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
-  switch_caller_profile *result = 0 ;
-  
-  arg1 = (switch_caller_extension *)jarg1; 
-  result = (switch_caller_profile *) ((arg1)->children);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_extension_next_set(void * jarg1, void * jarg2) {
-  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
-  switch_caller_extension *arg2 = (switch_caller_extension *) 0 ;
-  
-  arg1 = (switch_caller_extension *)jarg1; 
-  arg2 = (switch_caller_extension *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_extension_next_get(void * jarg1) {
-  void * jresult ;
-  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
-  switch_caller_extension *result = 0 ;
-  
-  arg1 = (switch_caller_extension *)jarg1; 
-  result = (switch_caller_extension *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_caller_extension() {
-  void * jresult ;
-  switch_caller_extension *result = 0 ;
-  
-  result = (switch_caller_extension *)new switch_caller_extension();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_caller_extension(void * jarg1) {
-  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
-  
-  arg1 = (switch_caller_extension *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_extension_new(void * jarg1, char * jarg2, char * jarg3) {
-  void * jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  switch_caller_extension_t *result = 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (switch_caller_extension_t *)switch_caller_extension_new(arg1,(char const *)arg2,(char const *)arg3);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_caller_extension_clone(void * jarg1, void * jarg2, void * jarg3) {
-  int jresult ;
-  switch_caller_extension_t **arg1 = (switch_caller_extension_t **) 0 ;
-  switch_caller_extension_t *arg2 = (switch_caller_extension_t *) 0 ;
-  switch_memory_pool_t *arg3 = (switch_memory_pool_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_caller_extension_t **)jarg1; 
-  arg2 = (switch_caller_extension_t *)jarg2; 
-  arg3 = (switch_memory_pool_t *)jarg3; 
-  result = (switch_status_t)switch_caller_extension_clone(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_extension_add_application(void * jarg1, void * jarg2, char * jarg3, char * jarg4) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_caller_extension_t *arg2 = (switch_caller_extension_t *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_caller_extension_t *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  switch_caller_extension_add_application(arg1,arg2,(char const *)arg3,(char const *)arg4);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_extension_add_application_printf(void * jarg1, void * jarg2, char * jarg3, char * jarg4) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_caller_extension_t *arg2 = (switch_caller_extension_t *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  void *arg5 = 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_caller_extension_t *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  switch_caller_extension_add_application_printf(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5);
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_get_field_by_name(void * jarg1, char * jarg2) {
-  char * jresult ;
-  switch_caller_profile_t *arg1 = (switch_caller_profile_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_caller_profile_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (char *)switch_caller_get_field_by_name(arg1,(char const *)arg2);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_new(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, char * jarg11, char * jarg12) {
-  void * jresult ;
-  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  char *arg5 = (char *) 0 ;
-  char *arg6 = (char *) 0 ;
-  char *arg7 = (char *) 0 ;
-  char *arg8 = (char *) 0 ;
-  char *arg9 = (char *) 0 ;
-  char *arg10 = (char *) 0 ;
-  char *arg11 = (char *) 0 ;
-  char *arg12 = (char *) 0 ;
-  switch_caller_profile_t *result = 0 ;
-  
-  arg1 = (switch_memory_pool_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (char *)jarg5; 
-  arg6 = (char *)jarg6; 
-  arg7 = (char *)jarg7; 
-  arg8 = (char *)jarg8; 
-  arg9 = (char *)jarg9; 
-  arg10 = (char *)jarg10; 
-  arg11 = (char *)jarg11; 
-  arg12 = (char *)jarg12; 
-  result = (switch_caller_profile_t *)switch_caller_profile_new(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,(char const *)arg11,(char const *)arg12);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_clone(void * jarg1, void * jarg2) {
-  void * jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_caller_profile_t *arg2 = (switch_caller_profile_t *) 0 ;
-  switch_caller_profile_t *result = 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_caller_profile_t *)jarg2; 
-  result = (switch_caller_profile_t *)switch_caller_profile_clone(arg1,arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_dup(void * jarg1, void * jarg2) {
-  void * jresult ;
-  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
-  switch_caller_profile_t *arg2 = (switch_caller_profile_t *) 0 ;
-  switch_caller_profile_t *result = 0 ;
-  
-  arg1 = (switch_memory_pool_t *)jarg1; 
-  arg2 = (switch_caller_profile_t *)jarg2; 
-  result = (switch_caller_profile_t *)switch_caller_profile_dup(arg1,arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_event_set_data(void * jarg1, char * jarg2, void * jarg3) {
-  switch_caller_profile_t *arg1 = (switch_caller_profile_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_event_t *arg3 = (switch_event_t *) 0 ;
-  
-  arg1 = (switch_caller_profile_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_event_t *)jarg3; 
-  switch_caller_profile_event_set_data(arg1,(char const *)arg2,arg3);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_codec_set(void * jarg1, void * jarg2) {
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  switch_codec_t *arg2 = (switch_codec_t *) 0 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  arg2 = (switch_codec_t *)jarg2; 
-  if (arg1) (arg1)->codec = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_frame_codec_get(void * jarg1) {
-  void * jresult ;
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  switch_codec_t *result = 0 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  result = (switch_codec_t *) ((arg1)->codec);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_source_set(void * jarg1, char * jarg2) {
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->source = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->source, (const char *)arg2);
-    } else {
-      arg1->source = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_frame_source_get(void * jarg1) {
-  char * jresult ;
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  result = (char *) ((arg1)->source);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_packet_set(void * jarg1, void * jarg2) {
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->packet = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_frame_packet_get(void * jarg1) {
-  void * jresult ;
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  result = (void *) ((arg1)->packet);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_packetlen_set(void * jarg1, unsigned long jarg2) {
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->packetlen = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_frame_packetlen_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_frame *)jarg1; 
-  result = (uint32_t) ((arg1)->packetlen);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_extra_data_set(void * jarg1, void * jarg2) {
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->extra_data = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_frame_extra_data_get(void * jarg1) {
-  void * jresult ;
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  result = (void *) ((arg1)->extra_data);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_data_set(void * jarg1, void * jarg2) {
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->data = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_frame_data_get(void * jarg1) {
-  void * jresult ;
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  result = (void *) ((arg1)->data);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_datalen_set(void * jarg1, unsigned long jarg2) {
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->datalen = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_frame_datalen_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_frame *)jarg1; 
-  result = (uint32_t) ((arg1)->datalen);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_buflen_set(void * jarg1, unsigned long jarg2) {
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->buflen = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_frame_buflen_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_frame *)jarg1; 
-  result = (uint32_t) ((arg1)->buflen);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_samples_set(void * jarg1, unsigned long jarg2) {
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->samples = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_frame_samples_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_frame *)jarg1; 
-  result = (uint32_t) ((arg1)->samples);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_rate_set(void * jarg1, unsigned long jarg2) {
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->rate = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_frame_rate_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_frame *)jarg1; 
-  result = (uint32_t) ((arg1)->rate);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_payload_set(void * jarg1, unsigned char jarg2) {
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  switch_payload_t arg2 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  arg2 = (switch_payload_t)jarg2; 
-  if (arg1) (arg1)->payload = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_frame_payload_get(void * jarg1) {
-  unsigned char jresult ;
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  switch_payload_t result;
-  
-  arg1 = (switch_frame *)jarg1; 
-  result = (switch_payload_t) ((arg1)->payload);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_timestamp_set(void * jarg1, void * jarg2) {
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->timestamp = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_frame_timestamp_get(void * jarg1) {
-  void * jresult ;
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_frame *)jarg1; 
-  result =  ((arg1)->timestamp);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_seq_set(void * jarg1, unsigned short jarg2) {
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  uint16_t arg2 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  arg2 = (uint16_t)jarg2; 
-  if (arg1) (arg1)->seq = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_frame_seq_get(void * jarg1) {
-  unsigned short jresult ;
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  uint16_t result;
-  
-  arg1 = (switch_frame *)jarg1; 
-  result = (uint16_t) ((arg1)->seq);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_ssrc_set(void * jarg1, unsigned long jarg2) {
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->ssrc = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_frame_ssrc_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_frame *)jarg1; 
-  result = (uint32_t) ((arg1)->ssrc);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_m_set(void * jarg1, int jarg2) {
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  switch_bool_t arg2 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  arg2 = (switch_bool_t)jarg2; 
-  if (arg1) (arg1)->m = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_frame_m_get(void * jarg1) {
-  int jresult ;
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  switch_bool_t result;
-  
-  arg1 = (switch_frame *)jarg1; 
-  result = (switch_bool_t) ((arg1)->m);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_flags_set(void * jarg1, unsigned long jarg2) {
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  switch_frame_flag_t arg2 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  arg2 = (switch_frame_flag_t)jarg2; 
-  if (arg1) (arg1)->flags = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_frame_flags_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  switch_frame_flag_t result;
-  
-  arg1 = (switch_frame *)jarg1; 
-  result = (switch_frame_flag_t) ((arg1)->flags);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_frame() {
-  void * jresult ;
-  switch_frame *result = 0 ;
-  
-  result = (switch_frame *)new switch_frame();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_frame(void * jarg1) {
-  switch_frame *arg1 = (switch_frame *) 0 ;
-  
-  arg1 = (switch_frame *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_init_set(void * jarg1, void * jarg2) {
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  arg2 = (switch_state_handler_t)jarg2; 
-  if (arg1) (arg1)->on_init = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_init_get(void * jarg1) {
-  void * jresult ;
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t result;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  result = (switch_state_handler_t) ((arg1)->on_init);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_routing_set(void * jarg1, void * jarg2) {
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  arg2 = (switch_state_handler_t)jarg2; 
-  if (arg1) (arg1)->on_routing = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_routing_get(void * jarg1) {
-  void * jresult ;
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t result;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  result = (switch_state_handler_t) ((arg1)->on_routing);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_execute_set(void * jarg1, void * jarg2) {
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  arg2 = (switch_state_handler_t)jarg2; 
-  if (arg1) (arg1)->on_execute = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_execute_get(void * jarg1) {
-  void * jresult ;
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t result;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  result = (switch_state_handler_t) ((arg1)->on_execute);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_hangup_set(void * jarg1, void * jarg2) {
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  arg2 = (switch_state_handler_t)jarg2; 
-  if (arg1) (arg1)->on_hangup = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_hangup_get(void * jarg1) {
-  void * jresult ;
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t result;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  result = (switch_state_handler_t) ((arg1)->on_hangup);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_exchange_media_set(void * jarg1, void * jarg2) {
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  arg2 = (switch_state_handler_t)jarg2; 
-  if (arg1) (arg1)->on_exchange_media = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_exchange_media_get(void * jarg1) {
-  void * jresult ;
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t result;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  result = (switch_state_handler_t) ((arg1)->on_exchange_media);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_soft_execute_set(void * jarg1, void * jarg2) {
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  arg2 = (switch_state_handler_t)jarg2; 
-  if (arg1) (arg1)->on_soft_execute = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_soft_execute_get(void * jarg1) {
-  void * jresult ;
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t result;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  result = (switch_state_handler_t) ((arg1)->on_soft_execute);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_consume_media_set(void * jarg1, void * jarg2) {
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  arg2 = (switch_state_handler_t)jarg2; 
-  if (arg1) (arg1)->on_consume_media = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_consume_media_get(void * jarg1) {
-  void * jresult ;
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t result;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  result = (switch_state_handler_t) ((arg1)->on_consume_media);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_hibernate_set(void * jarg1, void * jarg2) {
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  arg2 = (switch_state_handler_t)jarg2; 
-  if (arg1) (arg1)->on_hibernate = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_hibernate_get(void * jarg1) {
-  void * jresult ;
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t result;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  result = (switch_state_handler_t) ((arg1)->on_hibernate);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_reset_set(void * jarg1, void * jarg2) {
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  arg2 = (switch_state_handler_t)jarg2; 
-  if (arg1) (arg1)->on_reset = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_reset_get(void * jarg1) {
-  void * jresult ;
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t result;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  result = (switch_state_handler_t) ((arg1)->on_reset);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_park_set(void * jarg1, void * jarg2) {
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  arg2 = (switch_state_handler_t)jarg2; 
-  if (arg1) (arg1)->on_park = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_park_get(void * jarg1) {
-  void * jresult ;
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t result;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  result = (switch_state_handler_t) ((arg1)->on_park);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_reporting_set(void * jarg1, void * jarg2) {
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  arg2 = (switch_state_handler_t)jarg2; 
-  if (arg1) (arg1)->on_reporting = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_reporting_get(void * jarg1) {
-  void * jresult ;
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t result;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  result = (switch_state_handler_t) ((arg1)->on_reporting);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_destroy_set(void * jarg1, void * jarg2) {
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  arg2 = (switch_state_handler_t)jarg2; 
-  if (arg1) (arg1)->on_destroy = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_destroy_get(void * jarg1) {
-  void * jresult ;
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  switch_state_handler_t result;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  result = (switch_state_handler_t) ((arg1)->on_destroy);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_flags_set(void * jarg1, int jarg2) {
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->flags = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_state_handler_table_flags_get(void * jarg1) {
-  int jresult ;
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  int result;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  result = (int) ((arg1)->flags);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_padding_set(void * jarg1, void * jarg2) {
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  void **arg2 ;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  arg2 = (void **)jarg2; 
-  {
-    size_t ii;
-    void * *b = (void * *) arg1->padding;
-    for (ii = 0; ii < (size_t)10; ii++) b[ii] = *((void * *) arg2 + ii);
-  }
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_padding_get(void * jarg1) {
-  void * jresult ;
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  void **result = 0 ;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  result = (void **)(void **) ((arg1)->padding);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_state_handler_table() {
-  void * jresult ;
-  switch_state_handler_table *result = 0 ;
-  
-  result = (switch_state_handler_table *)new switch_state_handler_table();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_state_handler_table(void * jarg1) {
-  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
-  
-  arg1 = (switch_state_handler_table *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_write_function_set(void * jarg1, void * jarg2) {
-  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
-  switch_stream_handle_write_function_t arg2 = (switch_stream_handle_write_function_t) 0 ;
-  
-  arg1 = (switch_stream_handle *)jarg1; 
-  arg2 = (switch_stream_handle_write_function_t)jarg2; 
-  if (arg1) (arg1)->write_function = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_stream_handle_write_function_get(void * jarg1) {
-  void * jresult ;
-  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
-  switch_stream_handle_write_function_t result;
-  
-  arg1 = (switch_stream_handle *)jarg1; 
-  result = (switch_stream_handle_write_function_t) ((arg1)->write_function);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_raw_write_function_set(void * jarg1, void * jarg2) {
-  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
-  switch_stream_handle_raw_write_function_t arg2 = (switch_stream_handle_raw_write_function_t) 0 ;
-  
-  arg1 = (switch_stream_handle *)jarg1; 
-  arg2 = (switch_stream_handle_raw_write_function_t)jarg2; 
-  if (arg1) (arg1)->raw_write_function = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_stream_handle_raw_write_function_get(void * jarg1) {
-  void * jresult ;
-  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
-  switch_stream_handle_raw_write_function_t result;
-  
-  arg1 = (switch_stream_handle *)jarg1; 
-  result = (switch_stream_handle_raw_write_function_t) ((arg1)->raw_write_function);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_data_set(void * jarg1, void * jarg2) {
-  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_stream_handle *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->data = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_stream_handle_data_get(void * jarg1) {
-  void * jresult ;
-  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_stream_handle *)jarg1; 
-  result = (void *) ((arg1)->data);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_end_set(void * jarg1, void * jarg2) {
-  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_stream_handle *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->end = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_stream_handle_end_get(void * jarg1) {
-  void * jresult ;
-  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_stream_handle *)jarg1; 
-  result = (void *) ((arg1)->end);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_data_size_set(void * jarg1, void * jarg2) {
-  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_stream_handle *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->data_size = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_stream_handle_data_size_get(void * jarg1) {
-  void * jresult ;
-  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_stream_handle *)jarg1; 
-  result =  ((arg1)->data_size);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_data_len_set(void * jarg1, void * jarg2) {
-  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_stream_handle *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->data_len = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_stream_handle_data_len_get(void * jarg1) {
-  void * jresult ;
-  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_stream_handle *)jarg1; 
-  result =  ((arg1)->data_len);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_alloc_len_set(void * jarg1, void * jarg2) {
-  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_stream_handle *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->alloc_len = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_stream_handle_alloc_len_get(void * jarg1) {
-  void * jresult ;
-  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_stream_handle *)jarg1; 
-  result =  ((arg1)->alloc_len);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_alloc_chunk_set(void * jarg1, void * jarg2) {
-  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_stream_handle *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->alloc_chunk = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_stream_handle_alloc_chunk_get(void * jarg1) {
-  void * jresult ;
-  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_stream_handle *)jarg1; 
-  result =  ((arg1)->alloc_chunk);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_param_event_set(void * jarg1, void * jarg2) {
-  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
-  switch_event_t *arg2 = (switch_event_t *) 0 ;
-  
-  arg1 = (switch_stream_handle *)jarg1; 
-  arg2 = (switch_event_t *)jarg2; 
-  if (arg1) (arg1)->param_event = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_stream_handle_param_event_get(void * jarg1) {
-  void * jresult ;
-  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
-  switch_event_t *result = 0 ;
-  
-  arg1 = (switch_stream_handle *)jarg1; 
-  result = (switch_event_t *) ((arg1)->param_event);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_stream_handle() {
-  void * jresult ;
-  switch_stream_handle *result = 0 ;
-  
-  result = (switch_stream_handle *)new switch_stream_handle();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_stream_handle(void * jarg1) {
-  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
-  
-  arg1 = (switch_stream_handle *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_outgoing_channel_set(void * jarg1, void * jarg2) {
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_outgoing_channel_t arg2 = (switch_io_outgoing_channel_t) 0 ;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  arg2 = (switch_io_outgoing_channel_t)jarg2; 
-  if (arg1) (arg1)->outgoing_channel = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_outgoing_channel_get(void * jarg1) {
-  void * jresult ;
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_outgoing_channel_t result;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  result = (switch_io_outgoing_channel_t) ((arg1)->outgoing_channel);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_read_frame_set(void * jarg1, void * jarg2) {
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_read_frame_t arg2 = (switch_io_read_frame_t) 0 ;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  arg2 = (switch_io_read_frame_t)jarg2; 
-  if (arg1) (arg1)->read_frame = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_read_frame_get(void * jarg1) {
-  void * jresult ;
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_read_frame_t result;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  result = (switch_io_read_frame_t) ((arg1)->read_frame);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_write_frame_set(void * jarg1, void * jarg2) {
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_write_frame_t arg2 = (switch_io_write_frame_t) 0 ;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  arg2 = (switch_io_write_frame_t)jarg2; 
-  if (arg1) (arg1)->write_frame = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_write_frame_get(void * jarg1) {
-  void * jresult ;
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_write_frame_t result;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  result = (switch_io_write_frame_t) ((arg1)->write_frame);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_kill_channel_set(void * jarg1, void * jarg2) {
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_kill_channel_t arg2 = (switch_io_kill_channel_t) 0 ;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  arg2 = (switch_io_kill_channel_t)jarg2; 
-  if (arg1) (arg1)->kill_channel = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_kill_channel_get(void * jarg1) {
-  void * jresult ;
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_kill_channel_t result;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  result = (switch_io_kill_channel_t) ((arg1)->kill_channel);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_send_dtmf_set(void * jarg1, void * jarg2) {
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_send_dtmf_t arg2 = (switch_io_send_dtmf_t) 0 ;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  arg2 = (switch_io_send_dtmf_t)jarg2; 
-  if (arg1) (arg1)->send_dtmf = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_send_dtmf_get(void * jarg1) {
-  void * jresult ;
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_send_dtmf_t result;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  result = (switch_io_send_dtmf_t) ((arg1)->send_dtmf);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_receive_message_set(void * jarg1, void * jarg2) {
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_receive_message_t arg2 = (switch_io_receive_message_t) 0 ;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  arg2 = (switch_io_receive_message_t)jarg2; 
-  if (arg1) (arg1)->receive_message = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_receive_message_get(void * jarg1) {
-  void * jresult ;
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_receive_message_t result;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  result = (switch_io_receive_message_t) ((arg1)->receive_message);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_receive_event_set(void * jarg1, void * jarg2) {
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_receive_event_t arg2 = (switch_io_receive_event_t) 0 ;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  arg2 = (switch_io_receive_event_t)jarg2; 
-  if (arg1) (arg1)->receive_event = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_receive_event_get(void * jarg1) {
-  void * jresult ;
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_receive_event_t result;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  result = (switch_io_receive_event_t) ((arg1)->receive_event);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_state_change_set(void * jarg1, void * jarg2) {
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_state_change_t arg2 = (switch_io_state_change_t) 0 ;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  arg2 = (switch_io_state_change_t)jarg2; 
-  if (arg1) (arg1)->state_change = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_state_change_get(void * jarg1) {
-  void * jresult ;
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_state_change_t result;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  result = (switch_io_state_change_t) ((arg1)->state_change);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_read_video_frame_set(void * jarg1, void * jarg2) {
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_read_video_frame_t arg2 = (switch_io_read_video_frame_t) 0 ;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  arg2 = (switch_io_read_video_frame_t)jarg2; 
-  if (arg1) (arg1)->read_video_frame = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_read_video_frame_get(void * jarg1) {
-  void * jresult ;
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_read_video_frame_t result;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  result = (switch_io_read_video_frame_t) ((arg1)->read_video_frame);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_write_video_frame_set(void * jarg1, void * jarg2) {
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_write_video_frame_t arg2 = (switch_io_write_video_frame_t) 0 ;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  arg2 = (switch_io_write_video_frame_t)jarg2; 
-  if (arg1) (arg1)->write_video_frame = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_write_video_frame_get(void * jarg1) {
-  void * jresult ;
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_write_video_frame_t result;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  result = (switch_io_write_video_frame_t) ((arg1)->write_video_frame);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_resurrect_session_set(void * jarg1, void * jarg2) {
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_resurrect_session_t arg2 = (switch_io_resurrect_session_t) 0 ;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  arg2 = (switch_io_resurrect_session_t)jarg2; 
-  if (arg1) (arg1)->resurrect_session = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_resurrect_session_get(void * jarg1) {
-  void * jresult ;
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  switch_io_resurrect_session_t result;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  result = (switch_io_resurrect_session_t) ((arg1)->resurrect_session);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_padding_set(void * jarg1, void * jarg2) {
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  void **arg2 ;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  arg2 = (void **)jarg2; 
-  {
-    size_t ii;
-    void * *b = (void * *) arg1->padding;
-    for (ii = 0; ii < (size_t)10; ii++) b[ii] = *((void * *) arg2 + ii);
-  }
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_padding_get(void * jarg1) {
-  void * jresult ;
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  void **result = 0 ;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  result = (void **)(void **) ((arg1)->padding);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_routines() {
-  void * jresult ;
-  switch_io_routines *result = 0 ;
-  
-  result = (switch_io_routines *)new switch_io_routines();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_routines(void * jarg1) {
-  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
-  
-  arg1 = (switch_io_routines *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_endpoint_interface_interface_name_set(void * jarg1, char * jarg2) {
-  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_endpoint_interface *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->interface_name, (const char *)arg2);
-    } else {
-      arg1->interface_name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_endpoint_interface_interface_name_get(void * jarg1) {
-  char * jresult ;
-  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_endpoint_interface *)jarg1; 
-  result = (char *) ((arg1)->interface_name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_endpoint_interface_io_routines_set(void * jarg1, void * jarg2) {
-  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
-  switch_io_routines_t *arg2 = (switch_io_routines_t *) 0 ;
-  
-  arg1 = (switch_endpoint_interface *)jarg1; 
-  arg2 = (switch_io_routines_t *)jarg2; 
-  if (arg1) (arg1)->io_routines = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_endpoint_interface_io_routines_get(void * jarg1) {
-  void * jresult ;
-  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
-  switch_io_routines_t *result = 0 ;
-  
-  arg1 = (switch_endpoint_interface *)jarg1; 
-  result = (switch_io_routines_t *) ((arg1)->io_routines);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_endpoint_interface_state_handler_set(void * jarg1, void * jarg2) {
-  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
-  switch_state_handler_table_t *arg2 = (switch_state_handler_table_t *) 0 ;
-  
-  arg1 = (switch_endpoint_interface *)jarg1; 
-  arg2 = (switch_state_handler_table_t *)jarg2; 
-  if (arg1) (arg1)->state_handler = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_endpoint_interface_state_handler_get(void * jarg1) {
-  void * jresult ;
-  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
-  switch_state_handler_table_t *result = 0 ;
-  
-  arg1 = (switch_endpoint_interface *)jarg1; 
-  result = (switch_state_handler_table_t *) ((arg1)->state_handler);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_endpoint_interface_private_info_set(void * jarg1, void * jarg2) {
-  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_endpoint_interface *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->private_info = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_endpoint_interface_private_info_get(void * jarg1) {
-  void * jresult ;
-  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_endpoint_interface *)jarg1; 
-  result = (void *) ((arg1)->private_info);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_endpoint_interface_rwlock_set(void * jarg1, void * jarg2) {
-  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
-  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
-  
-  arg1 = (switch_endpoint_interface *)jarg1; 
-  arg2 = (switch_thread_rwlock_t *)jarg2; 
-  if (arg1) (arg1)->rwlock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_endpoint_interface_rwlock_get(void * jarg1) {
-  void * jresult ;
-  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
-  switch_thread_rwlock_t *result = 0 ;
-  
-  arg1 = (switch_endpoint_interface *)jarg1; 
-  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_endpoint_interface_refs_set(void * jarg1, int jarg2) {
-  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_endpoint_interface *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->refs = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_endpoint_interface_refs_get(void * jarg1) {
-  int jresult ;
-  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
-  int result;
-  
-  arg1 = (switch_endpoint_interface *)jarg1; 
-  result = (int) ((arg1)->refs);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_endpoint_interface_reflock_set(void * jarg1, void * jarg2) {
-  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
-  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
-  
-  arg1 = (switch_endpoint_interface *)jarg1; 
-  arg2 = (switch_mutex_t *)jarg2; 
-  if (arg1) (arg1)->reflock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_endpoint_interface_reflock_get(void * jarg1) {
-  void * jresult ;
-  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
-  switch_mutex_t *result = 0 ;
-  
-  arg1 = (switch_endpoint_interface *)jarg1; 
-  result = (switch_mutex_t *) ((arg1)->reflock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_endpoint_interface_parent_set(void * jarg1, void * jarg2) {
-  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
-  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
-  
-  arg1 = (switch_endpoint_interface *)jarg1; 
-  arg2 = (switch_loadable_module_interface_t *)jarg2; 
-  if (arg1) (arg1)->parent = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_endpoint_interface_parent_get(void * jarg1) {
-  void * jresult ;
-  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
-  switch_loadable_module_interface_t *result = 0 ;
-  
-  arg1 = (switch_endpoint_interface *)jarg1; 
-  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_endpoint_interface_next_set(void * jarg1, void * jarg2) {
-  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
-  switch_endpoint_interface *arg2 = (switch_endpoint_interface *) 0 ;
-  
-  arg1 = (switch_endpoint_interface *)jarg1; 
-  arg2 = (switch_endpoint_interface *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_endpoint_interface_next_get(void * jarg1) {
-  void * jresult ;
-  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
-  switch_endpoint_interface *result = 0 ;
-  
-  arg1 = (switch_endpoint_interface *)jarg1; 
-  result = (switch_endpoint_interface *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_endpoint_interface() {
-  void * jresult ;
-  switch_endpoint_interface *result = 0 ;
-  
-  result = (switch_endpoint_interface *)new switch_endpoint_interface();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_endpoint_interface(void * jarg1) {
-  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
-  
-  arg1 = (switch_endpoint_interface *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interval_set(void * jarg1, int jarg2) {
-  switch_timer *arg1 = (switch_timer *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_timer *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->interval = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_timer_interval_get(void * jarg1) {
-  int jresult ;
-  switch_timer *arg1 = (switch_timer *) 0 ;
-  int result;
-  
-  arg1 = (switch_timer *)jarg1; 
-  result = (int) ((arg1)->interval);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_flags_set(void * jarg1, unsigned long jarg2) {
-  switch_timer *arg1 = (switch_timer *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_timer *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->flags = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_timer_flags_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_timer *arg1 = (switch_timer *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_timer *)jarg1; 
-  result = (uint32_t) ((arg1)->flags);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_samples_set(void * jarg1, unsigned int jarg2) {
-  switch_timer *arg1 = (switch_timer *) 0 ;
-  unsigned int arg2 ;
-  
-  arg1 = (switch_timer *)jarg1; 
-  arg2 = (unsigned int)jarg2; 
-  if (arg1) (arg1)->samples = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_timer_samples_get(void * jarg1) {
-  unsigned int jresult ;
-  switch_timer *arg1 = (switch_timer *) 0 ;
-  unsigned int result;
-  
-  arg1 = (switch_timer *)jarg1; 
-  result = (unsigned int) ((arg1)->samples);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_samplecount_set(void * jarg1, unsigned long jarg2) {
-  switch_timer *arg1 = (switch_timer *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_timer *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->samplecount = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_timer_samplecount_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_timer *arg1 = (switch_timer *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_timer *)jarg1; 
-  result = (uint32_t) ((arg1)->samplecount);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_timer_interface_set(void * jarg1, void * jarg2) {
-  switch_timer *arg1 = (switch_timer *) 0 ;
-  switch_timer_interface_t *arg2 = (switch_timer_interface_t *) 0 ;
-  
-  arg1 = (switch_timer *)jarg1; 
-  arg2 = (switch_timer_interface_t *)jarg2; 
-  if (arg1) (arg1)->timer_interface = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_timer_interface_get(void * jarg1) {
-  void * jresult ;
-  switch_timer *arg1 = (switch_timer *) 0 ;
-  switch_timer_interface_t *result = 0 ;
-  
-  arg1 = (switch_timer *)jarg1; 
-  result = (switch_timer_interface_t *) ((arg1)->timer_interface);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_memory_pool_set(void * jarg1, void * jarg2) {
-  switch_timer *arg1 = (switch_timer *) 0 ;
-  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
-  
-  arg1 = (switch_timer *)jarg1; 
-  arg2 = (switch_memory_pool_t *)jarg2; 
-  if (arg1) (arg1)->memory_pool = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_memory_pool_get(void * jarg1) {
-  void * jresult ;
-  switch_timer *arg1 = (switch_timer *) 0 ;
-  switch_memory_pool_t *result = 0 ;
-  
-  arg1 = (switch_timer *)jarg1; 
-  result = (switch_memory_pool_t *) ((arg1)->memory_pool);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_private_info_set(void * jarg1, void * jarg2) {
-  switch_timer *arg1 = (switch_timer *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_timer *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->private_info = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_private_info_get(void * jarg1) {
-  void * jresult ;
-  switch_timer *arg1 = (switch_timer *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_timer *)jarg1; 
-  result = (void *) ((arg1)->private_info);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_diff_set(void * jarg1, void * jarg2) {
-  switch_timer *arg1 = (switch_timer *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_timer *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->diff = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_diff_get(void * jarg1) {
-  void * jresult ;
-  switch_timer *arg1 = (switch_timer *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_timer *)jarg1; 
-  result =  ((arg1)->diff);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_tick_set(void * jarg1, void * jarg2) {
-  switch_timer *arg1 = (switch_timer *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_timer *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->tick = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_tick_get(void * jarg1) {
-  void * jresult ;
-  switch_timer *arg1 = (switch_timer *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_timer *)jarg1; 
-  result =  ((arg1)->tick);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_timer() {
-  void * jresult ;
-  switch_timer *result = 0 ;
-  
-  result = (switch_timer *)new switch_timer();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_timer(void * jarg1) {
-  switch_timer *arg1 = (switch_timer *) 0 ;
-  
-  arg1 = (switch_timer *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_interface_name_set(void * jarg1, char * jarg2) {
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->interface_name, (const char *)arg2);
-    } else {
-      arg1->interface_name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_timer_interface_interface_name_get(void * jarg1) {
-  char * jresult ;
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  result = (char *) ((arg1)->interface_name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_timer_init_set(void * jarg1, void * jarg2) {
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  switch_status_t (*arg2)(switch_timer_t *) = (switch_status_t (*)(switch_timer_t *)) 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_timer_t *))jarg2; 
-  if (arg1) (arg1)->timer_init = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_interface_timer_init_get(void * jarg1) {
-  void * jresult ;
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  switch_status_t (*result)(switch_timer_t *) = 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_timer_t *)) ((arg1)->timer_init);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_timer_next_set(void * jarg1, void * jarg2) {
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  switch_status_t (*arg2)(switch_timer_t *) = (switch_status_t (*)(switch_timer_t *)) 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_timer_t *))jarg2; 
-  if (arg1) (arg1)->timer_next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_interface_timer_next_get(void * jarg1) {
-  void * jresult ;
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  switch_status_t (*result)(switch_timer_t *) = 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_timer_t *)) ((arg1)->timer_next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_timer_step_set(void * jarg1, void * jarg2) {
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  switch_status_t (*arg2)(switch_timer_t *) = (switch_status_t (*)(switch_timer_t *)) 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_timer_t *))jarg2; 
-  if (arg1) (arg1)->timer_step = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_interface_timer_step_get(void * jarg1) {
-  void * jresult ;
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  switch_status_t (*result)(switch_timer_t *) = 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_timer_t *)) ((arg1)->timer_step);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_timer_sync_set(void * jarg1, void * jarg2) {
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  switch_status_t (*arg2)(switch_timer_t *) = (switch_status_t (*)(switch_timer_t *)) 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_timer_t *))jarg2; 
-  if (arg1) (arg1)->timer_sync = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_interface_timer_sync_get(void * jarg1) {
-  void * jresult ;
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  switch_status_t (*result)(switch_timer_t *) = 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_timer_t *)) ((arg1)->timer_sync);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_timer_check_set(void * jarg1, void * jarg2) {
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  switch_status_t (*arg2)(switch_timer_t *,switch_bool_t) = (switch_status_t (*)(switch_timer_t *,switch_bool_t)) 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_timer_t *,switch_bool_t))jarg2; 
-  if (arg1) (arg1)->timer_check = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_interface_timer_check_get(void * jarg1) {
-  void * jresult ;
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  switch_status_t (*result)(switch_timer_t *,switch_bool_t) = 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_timer_t *,switch_bool_t)) ((arg1)->timer_check);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_timer_destroy_set(void * jarg1, void * jarg2) {
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  switch_status_t (*arg2)(switch_timer_t *) = (switch_status_t (*)(switch_timer_t *)) 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_timer_t *))jarg2; 
-  if (arg1) (arg1)->timer_destroy = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_interface_timer_destroy_get(void * jarg1) {
-  void * jresult ;
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  switch_status_t (*result)(switch_timer_t *) = 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_timer_t *)) ((arg1)->timer_destroy);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_rwlock_set(void * jarg1, void * jarg2) {
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  arg2 = (switch_thread_rwlock_t *)jarg2; 
-  if (arg1) (arg1)->rwlock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_interface_rwlock_get(void * jarg1) {
-  void * jresult ;
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  switch_thread_rwlock_t *result = 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_refs_set(void * jarg1, int jarg2) {
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->refs = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_timer_interface_refs_get(void * jarg1) {
-  int jresult ;
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  int result;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  result = (int) ((arg1)->refs);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_reflock_set(void * jarg1, void * jarg2) {
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  arg2 = (switch_mutex_t *)jarg2; 
-  if (arg1) (arg1)->reflock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_interface_reflock_get(void * jarg1) {
-  void * jresult ;
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  switch_mutex_t *result = 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  result = (switch_mutex_t *) ((arg1)->reflock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_parent_set(void * jarg1, void * jarg2) {
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  arg2 = (switch_loadable_module_interface_t *)jarg2; 
-  if (arg1) (arg1)->parent = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_interface_parent_get(void * jarg1) {
-  void * jresult ;
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  switch_loadable_module_interface_t *result = 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_next_set(void * jarg1, void * jarg2) {
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  switch_timer_interface *arg2 = (switch_timer_interface *) 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  arg2 = (switch_timer_interface *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_interface_next_get(void * jarg1) {
-  void * jresult ;
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  switch_timer_interface *result = 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  result = (switch_timer_interface *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_timer_interface() {
-  void * jresult ;
-  switch_timer_interface *result = 0 ;
-  
-  result = (switch_timer_interface *)new switch_timer_interface();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_timer_interface(void * jarg1) {
-  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
-  
-  arg1 = (switch_timer_interface *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_dialplan_interface_interface_name_set(void * jarg1, char * jarg2) {
-  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_dialplan_interface *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->interface_name, (const char *)arg2);
-    } else {
-      arg1->interface_name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_dialplan_interface_interface_name_get(void * jarg1) {
-  char * jresult ;
-  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_dialplan_interface *)jarg1; 
-  result = (char *) ((arg1)->interface_name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_dialplan_interface_hunt_function_set(void * jarg1, void * jarg2) {
-  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
-  switch_dialplan_hunt_function_t arg2 = (switch_dialplan_hunt_function_t) 0 ;
-  
-  arg1 = (switch_dialplan_interface *)jarg1; 
-  arg2 = (switch_dialplan_hunt_function_t)jarg2; 
-  if (arg1) (arg1)->hunt_function = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_dialplan_interface_hunt_function_get(void * jarg1) {
-  void * jresult ;
-  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
-  switch_dialplan_hunt_function_t result;
-  
-  arg1 = (switch_dialplan_interface *)jarg1; 
-  result = (switch_dialplan_hunt_function_t) ((arg1)->hunt_function);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_dialplan_interface_rwlock_set(void * jarg1, void * jarg2) {
-  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
-  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
-  
-  arg1 = (switch_dialplan_interface *)jarg1; 
-  arg2 = (switch_thread_rwlock_t *)jarg2; 
-  if (arg1) (arg1)->rwlock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_dialplan_interface_rwlock_get(void * jarg1) {
-  void * jresult ;
-  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
-  switch_thread_rwlock_t *result = 0 ;
-  
-  arg1 = (switch_dialplan_interface *)jarg1; 
-  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_dialplan_interface_refs_set(void * jarg1, int jarg2) {
-  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_dialplan_interface *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->refs = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_dialplan_interface_refs_get(void * jarg1) {
-  int jresult ;
-  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
-  int result;
-  
-  arg1 = (switch_dialplan_interface *)jarg1; 
-  result = (int) ((arg1)->refs);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_dialplan_interface_reflock_set(void * jarg1, void * jarg2) {
-  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
-  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
-  
-  arg1 = (switch_dialplan_interface *)jarg1; 
-  arg2 = (switch_mutex_t *)jarg2; 
-  if (arg1) (arg1)->reflock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_dialplan_interface_reflock_get(void * jarg1) {
-  void * jresult ;
-  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
-  switch_mutex_t *result = 0 ;
-  
-  arg1 = (switch_dialplan_interface *)jarg1; 
-  result = (switch_mutex_t *) ((arg1)->reflock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_dialplan_interface_parent_set(void * jarg1, void * jarg2) {
-  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
-  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
-  
-  arg1 = (switch_dialplan_interface *)jarg1; 
-  arg2 = (switch_loadable_module_interface_t *)jarg2; 
-  if (arg1) (arg1)->parent = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_dialplan_interface_parent_get(void * jarg1) {
-  void * jresult ;
-  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
-  switch_loadable_module_interface_t *result = 0 ;
-  
-  arg1 = (switch_dialplan_interface *)jarg1; 
-  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_dialplan_interface_next_set(void * jarg1, void * jarg2) {
-  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
-  switch_dialplan_interface *arg2 = (switch_dialplan_interface *) 0 ;
-  
-  arg1 = (switch_dialplan_interface *)jarg1; 
-  arg2 = (switch_dialplan_interface *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_dialplan_interface_next_get(void * jarg1) {
-  void * jresult ;
-  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
-  switch_dialplan_interface *result = 0 ;
-  
-  arg1 = (switch_dialplan_interface *)jarg1; 
-  result = (switch_dialplan_interface *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_dialplan_interface() {
-  void * jresult ;
-  switch_dialplan_interface *result = 0 ;
-  
-  result = (switch_dialplan_interface *)new switch_dialplan_interface();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_dialplan_interface(void * jarg1) {
-  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
-  
-  arg1 = (switch_dialplan_interface *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_interface_name_set(void * jarg1, char * jarg2) {
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->interface_name, (const char *)arg2);
-    } else {
-      arg1->interface_name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_file_interface_interface_name_get(void * jarg1) {
-  char * jresult ;
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  result = (char *) ((arg1)->interface_name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_file_open_set(void * jarg1, void * jarg2) {
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_status_t (*arg2)(switch_file_handle_t *,char const *) = (switch_status_t (*)(switch_file_handle_t *,char const *)) 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_file_handle_t *,char const *))jarg2; 
-  if (arg1) (arg1)->file_open = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_file_open_get(void * jarg1) {
-  void * jresult ;
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_status_t (*result)(switch_file_handle_t *,char const *) = 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_file_handle_t *,char const *)) ((arg1)->file_open);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_file_close_set(void * jarg1, void * jarg2) {
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_status_t (*arg2)(switch_file_handle_t *) = (switch_status_t (*)(switch_file_handle_t *)) 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_file_handle_t *))jarg2; 
-  if (arg1) (arg1)->file_close = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_file_close_get(void * jarg1) {
-  void * jresult ;
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_status_t (*result)(switch_file_handle_t *) = 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_file_handle_t *)) ((arg1)->file_close);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_file_truncate_set(void * jarg1, void * jarg2) {
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_status_t (*arg2)(switch_file_handle_t *,int64_t) = (switch_status_t (*)(switch_file_handle_t *,int64_t)) 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_file_handle_t *,int64_t))jarg2; 
-  if (arg1) (arg1)->file_truncate = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_file_truncate_get(void * jarg1) {
-  void * jresult ;
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_status_t (*result)(switch_file_handle_t *,int64_t) = 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_file_handle_t *,int64_t)) ((arg1)->file_truncate);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_file_read_set(void * jarg1, void * jarg2) {
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_status_t (*arg2)(switch_file_handle_t *,void *,switch_size_t *) = (switch_status_t (*)(switch_file_handle_t *,void *,switch_size_t *)) 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_file_handle_t *,void *,switch_size_t *))jarg2; 
-  if (arg1) (arg1)->file_read = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_file_read_get(void * jarg1) {
-  void * jresult ;
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_status_t (*result)(switch_file_handle_t *,void *,switch_size_t *) = 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_file_handle_t *,void *,switch_size_t *)) ((arg1)->file_read);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_file_write_set(void * jarg1, void * jarg2) {
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_status_t (*arg2)(switch_file_handle_t *,void *,switch_size_t *) = (switch_status_t (*)(switch_file_handle_t *,void *,switch_size_t *)) 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_file_handle_t *,void *,switch_size_t *))jarg2; 
-  if (arg1) (arg1)->file_write = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_file_write_get(void * jarg1) {
-  void * jresult ;
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_status_t (*result)(switch_file_handle_t *,void *,switch_size_t *) = 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_file_handle_t *,void *,switch_size_t *)) ((arg1)->file_write);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_file_seek_set(void * jarg1, void * jarg2) {
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_status_t (*arg2)(switch_file_handle_t *,unsigned int *,int64_t,int) = (switch_status_t (*)(switch_file_handle_t *,unsigned int *,int64_t,int)) 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_file_handle_t *,unsigned int *,int64_t,int))jarg2; 
-  if (arg1) (arg1)->file_seek = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_file_seek_get(void * jarg1) {
-  void * jresult ;
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_status_t (*result)(switch_file_handle_t *,unsigned int *,int64_t,int) = 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_file_handle_t *,unsigned int *,int64_t,int)) ((arg1)->file_seek);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_file_set_string_set(void * jarg1, void * jarg2) {
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_status_t (*arg2)(switch_file_handle_t *,switch_audio_col_t,char const *) = (switch_status_t (*)(switch_file_handle_t *,switch_audio_col_t,char const *)) 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_file_handle_t *,switch_audio_col_t,char const *))jarg2; 
-  if (arg1) (arg1)->file_set_string = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_file_set_string_get(void * jarg1) {
-  void * jresult ;
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_status_t (*result)(switch_file_handle_t *,switch_audio_col_t,char const *) = 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_file_handle_t *,switch_audio_col_t,char const *)) ((arg1)->file_set_string);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_file_get_string_set(void * jarg1, void * jarg2) {
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_status_t (*arg2)(switch_file_handle_t *,switch_audio_col_t,char const **) = (switch_status_t (*)(switch_file_handle_t *,switch_audio_col_t,char const **)) 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_file_handle_t *,switch_audio_col_t,char const **))jarg2; 
-  if (arg1) (arg1)->file_get_string = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_file_get_string_get(void * jarg1) {
-  void * jresult ;
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_status_t (*result)(switch_file_handle_t *,switch_audio_col_t,char const **) = 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_file_handle_t *,switch_audio_col_t,char const **)) ((arg1)->file_get_string);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_extens_set(void * jarg1, void * jarg2) {
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  char **arg2 = (char **) 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  arg2 = (char **)jarg2; 
-  if (arg1) (arg1)->extens = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_extens_get(void * jarg1) {
-  void * jresult ;
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  char **result = 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  result = (char **) ((arg1)->extens);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_rwlock_set(void * jarg1, void * jarg2) {
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  arg2 = (switch_thread_rwlock_t *)jarg2; 
-  if (arg1) (arg1)->rwlock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_rwlock_get(void * jarg1) {
-  void * jresult ;
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_thread_rwlock_t *result = 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_refs_set(void * jarg1, int jarg2) {
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->refs = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_file_interface_refs_get(void * jarg1) {
-  int jresult ;
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  int result;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  result = (int) ((arg1)->refs);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_reflock_set(void * jarg1, void * jarg2) {
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  arg2 = (switch_mutex_t *)jarg2; 
-  if (arg1) (arg1)->reflock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_reflock_get(void * jarg1) {
-  void * jresult ;
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_mutex_t *result = 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  result = (switch_mutex_t *) ((arg1)->reflock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_parent_set(void * jarg1, void * jarg2) {
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  arg2 = (switch_loadable_module_interface_t *)jarg2; 
-  if (arg1) (arg1)->parent = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_parent_get(void * jarg1) {
-  void * jresult ;
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_loadable_module_interface_t *result = 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_next_set(void * jarg1, void * jarg2) {
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_file_interface *arg2 = (switch_file_interface *) 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  arg2 = (switch_file_interface *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_next_get(void * jarg1) {
-  void * jresult ;
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  switch_file_interface *result = 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  result = (switch_file_interface *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_file_interface() {
-  void * jresult ;
-  switch_file_interface *result = 0 ;
-  
-  result = (switch_file_interface *)new switch_file_interface();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_file_interface(void * jarg1) {
-  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
-  
-  arg1 = (switch_file_interface *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_file_interface_set(void * jarg1, void * jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_file_interface_t *arg2 = (switch_file_interface_t *) 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (switch_file_interface_t *)jarg2; 
-  if (arg1) (arg1)->file_interface = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_file_interface_get(void * jarg1) {
-  void * jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_file_interface_t *result = 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (switch_file_interface_t *) ((arg1)->file_interface);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_flags_set(void * jarg1, unsigned long jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->flags = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_file_handle_flags_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (uint32_t) ((arg1)->flags);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_fd_set(void * jarg1, void * jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_file_t *arg2 = (switch_file_t *) 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (switch_file_t *)jarg2; 
-  if (arg1) (arg1)->fd = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_fd_get(void * jarg1) {
-  void * jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_file_t *result = 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (switch_file_t *) ((arg1)->fd);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_samples_set(void * jarg1, unsigned int jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  unsigned int arg2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (unsigned int)jarg2; 
-  if (arg1) (arg1)->samples = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_file_handle_samples_get(void * jarg1) {
-  unsigned int jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  unsigned int result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (unsigned int) ((arg1)->samples);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_samplerate_set(void * jarg1, unsigned long jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->samplerate = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_file_handle_samplerate_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (uint32_t) ((arg1)->samplerate);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_native_rate_set(void * jarg1, unsigned long jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->native_rate = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_file_handle_native_rate_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (uint32_t) ((arg1)->native_rate);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_channels_set(void * jarg1, unsigned char jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  uint8_t arg2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (uint8_t)jarg2; 
-  if (arg1) (arg1)->channels = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_file_handle_channels_get(void * jarg1) {
-  unsigned char jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  uint8_t result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (uint8_t) ((arg1)->channels);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_format_set(void * jarg1, unsigned int jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  unsigned int arg2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (unsigned int)jarg2; 
-  if (arg1) (arg1)->format = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_file_handle_format_get(void * jarg1) {
-  unsigned int jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  unsigned int result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (unsigned int) ((arg1)->format);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_sections_set(void * jarg1, unsigned int jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  unsigned int arg2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (unsigned int)jarg2; 
-  if (arg1) (arg1)->sections = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_file_handle_sections_get(void * jarg1) {
-  unsigned int jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  unsigned int result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (unsigned int) ((arg1)->sections);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_seekable_set(void * jarg1, int jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->seekable = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_file_handle_seekable_get(void * jarg1) {
-  int jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  int result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (int) ((arg1)->seekable);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_sample_count_set(void * jarg1, void * jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->sample_count = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_sample_count_get(void * jarg1) {
-  void * jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result =  ((arg1)->sample_count);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_speed_set(void * jarg1, int jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->speed = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_file_handle_speed_get(void * jarg1) {
-  int jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  int result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (int) ((arg1)->speed);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_memory_pool_set(void * jarg1, void * jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (switch_memory_pool_t *)jarg2; 
-  if (arg1) (arg1)->memory_pool = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_memory_pool_get(void * jarg1) {
-  void * jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_memory_pool_t *result = 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (switch_memory_pool_t *) ((arg1)->memory_pool);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_prebuf_set(void * jarg1, unsigned long jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->prebuf = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_file_handle_prebuf_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (uint32_t) ((arg1)->prebuf);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_interval_set(void * jarg1, unsigned long jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->interval = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_file_handle_interval_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (uint32_t) ((arg1)->interval);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_private_info_set(void * jarg1, void * jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->private_info = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_private_info_get(void * jarg1) {
-  void * jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (void *) ((arg1)->private_info);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_handler_set(void * jarg1, char * jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->handler) delete [] arg1->handler;
-    if (arg2) {
-      arg1->handler = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->handler, (const char *)arg2);
-    } else {
-      arg1->handler = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_file_handle_handler_get(void * jarg1) {
-  char * jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (char *) ((arg1)->handler);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_pos_set(void * jarg1, long long jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  int64_t arg2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (int64_t)jarg2; 
-  if (arg1) (arg1)->pos = arg2;
-  
-}
-
-
-SWIGEXPORT long long SWIGSTDCALL CSharp_switch_file_handle_pos_get(void * jarg1) {
-  long long jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  int64_t result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (int64_t) ((arg1)->pos);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_audio_buffer_set(void * jarg1, void * jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_buffer_t *arg2 = (switch_buffer_t *) 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (switch_buffer_t *)jarg2; 
-  if (arg1) (arg1)->audio_buffer = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_audio_buffer_get(void * jarg1) {
-  void * jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_buffer_t *result = 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (switch_buffer_t *) ((arg1)->audio_buffer);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_sp_audio_buffer_set(void * jarg1, void * jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_buffer_t *arg2 = (switch_buffer_t *) 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (switch_buffer_t *)jarg2; 
-  if (arg1) (arg1)->sp_audio_buffer = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_sp_audio_buffer_get(void * jarg1) {
-  void * jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_buffer_t *result = 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (switch_buffer_t *) ((arg1)->sp_audio_buffer);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_thresh_set(void * jarg1, unsigned long jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->thresh = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_file_handle_thresh_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (uint32_t) ((arg1)->thresh);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_silence_hits_set(void * jarg1, unsigned long jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->silence_hits = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_file_handle_silence_hits_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (uint32_t) ((arg1)->silence_hits);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_offset_pos_set(void * jarg1, unsigned long jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->offset_pos = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_file_handle_offset_pos_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (uint32_t) ((arg1)->offset_pos);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_samples_in_set(void * jarg1, void * jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->samples_in = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_samples_in_get(void * jarg1) {
-  void * jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result =  ((arg1)->samples_in);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_samples_out_set(void * jarg1, void * jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->samples_out = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_samples_out_get(void * jarg1) {
-  void * jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result =  ((arg1)->samples_out);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_vol_set(void * jarg1, int jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  int32_t arg2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (int32_t)jarg2; 
-  if (arg1) (arg1)->vol = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_file_handle_vol_get(void * jarg1) {
-  int jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  int32_t result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (int32_t) ((arg1)->vol);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_resampler_set(void * jarg1, void * jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_audio_resampler_t *arg2 = (switch_audio_resampler_t *) 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (switch_audio_resampler_t *)jarg2; 
-  if (arg1) (arg1)->resampler = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_resampler_get(void * jarg1) {
-  void * jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_audio_resampler_t *result = 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (switch_audio_resampler_t *) ((arg1)->resampler);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_buffer_set(void * jarg1, void * jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_buffer_t *arg2 = (switch_buffer_t *) 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (switch_buffer_t *)jarg2; 
-  if (arg1) (arg1)->buffer = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_buffer_get(void * jarg1) {
-  void * jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_buffer_t *result = 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (switch_buffer_t *) ((arg1)->buffer);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_dbuf_set(void * jarg1, void * jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_byte_t *arg2 = (switch_byte_t *) 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (switch_byte_t *)jarg2; 
-  if (arg1) (arg1)->dbuf = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_dbuf_get(void * jarg1) {
-  void * jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_byte_t *result = 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (switch_byte_t *) ((arg1)->dbuf);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_dbuflen_set(void * jarg1, void * jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->dbuflen = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_dbuflen_get(void * jarg1) {
-  void * jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result =  ((arg1)->dbuflen);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_pre_buffer_set(void * jarg1, void * jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_buffer_t *arg2 = (switch_buffer_t *) 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (switch_buffer_t *)jarg2; 
-  if (arg1) (arg1)->pre_buffer = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_pre_buffer_get(void * jarg1) {
-  void * jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_buffer_t *result = 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (switch_buffer_t *) ((arg1)->pre_buffer);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_pre_buffer_data_set(void * jarg1, void * jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  unsigned char *arg2 = (unsigned char *) 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (unsigned char *)jarg2; 
-  if (arg1) (arg1)->pre_buffer_data = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_pre_buffer_data_get(void * jarg1) {
-  void * jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  unsigned char *result = 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (unsigned char *) ((arg1)->pre_buffer_data);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_pre_buffer_datalen_set(void * jarg1, void * jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->pre_buffer_datalen = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_pre_buffer_datalen_get(void * jarg1) {
-  void * jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result =  ((arg1)->pre_buffer_datalen);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_file_set(void * jarg1, char * jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->file = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->file, (const char *)arg2);
-    } else {
-      arg1->file = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_file_handle_file_get(void * jarg1) {
-  char * jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (char *) ((arg1)->file);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_func_set(void * jarg1, char * jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->func = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->func, (const char *)arg2);
-    } else {
-      arg1->func = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_file_handle_func_get(void * jarg1) {
-  char * jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (char *) ((arg1)->func);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_line_set(void * jarg1, int jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->line = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_file_handle_line_get(void * jarg1) {
-  int jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  int result;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (int) ((arg1)->line);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_file_path_set(void * jarg1, char * jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->file_path) delete [] arg1->file_path;
-    if (arg2) {
-      arg1->file_path = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->file_path, (const char *)arg2);
-    } else {
-      arg1->file_path = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_file_handle_file_path_get(void * jarg1) {
-  char * jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (char *) ((arg1)->file_path);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_spool_path_set(void * jarg1, char * jarg2) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->spool_path) delete [] arg1->spool_path;
-    if (arg2) {
-      arg1->spool_path = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->spool_path, (const char *)arg2);
-    } else {
-      arg1->spool_path = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_file_handle_spool_path_get(void * jarg1) {
-  char * jresult ;
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  result = (char *) ((arg1)->spool_path);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_file_handle() {
-  void * jresult ;
-  switch_file_handle *result = 0 ;
-  
-  result = (switch_file_handle *)new switch_file_handle();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_file_handle(void * jarg1) {
-  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
-  
-  arg1 = (switch_file_handle *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_interface_name_set(void * jarg1, char * jarg2) {
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->interface_name, (const char *)arg2);
-    } else {
-      arg1->interface_name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_asr_interface_interface_name_get(void * jarg1) {
-  char * jresult ;
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  result = (char *) ((arg1)->interface_name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_open_set(void * jarg1, void * jarg2) {
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_status_t (*arg2)(switch_asr_handle_t *,char const *,int,char const *,switch_asr_flag_t *) = (switch_status_t (*)(switch_asr_handle_t *,char const *,int,char const *,switch_asr_flag_t *)) 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_asr_handle_t *,char const *,int,char const *,switch_asr_flag_t *))jarg2; 
-  if (arg1) (arg1)->asr_open = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_open_get(void * jarg1) {
-  void * jresult ;
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_status_t (*result)(switch_asr_handle_t *,char const *,int,char const *,switch_asr_flag_t *) = 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_asr_handle_t *,char const *,int,char const *,switch_asr_flag_t *)) ((arg1)->asr_open);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_load_grammar_set(void * jarg1, void * jarg2) {
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_status_t (*arg2)(switch_asr_handle_t *,char const *,char const *) = (switch_status_t (*)(switch_asr_handle_t *,char const *,char const *)) 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_asr_handle_t *,char const *,char const *))jarg2; 
-  if (arg1) (arg1)->asr_load_grammar = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_load_grammar_get(void * jarg1) {
-  void * jresult ;
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_status_t (*result)(switch_asr_handle_t *,char const *,char const *) = 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_asr_handle_t *,char const *,char const *)) ((arg1)->asr_load_grammar);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_unload_grammar_set(void * jarg1, void * jarg2) {
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_status_t (*arg2)(switch_asr_handle_t *,char const *) = (switch_status_t (*)(switch_asr_handle_t *,char const *)) 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_asr_handle_t *,char const *))jarg2; 
-  if (arg1) (arg1)->asr_unload_grammar = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_unload_grammar_get(void * jarg1) {
-  void * jresult ;
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_status_t (*result)(switch_asr_handle_t *,char const *) = 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_asr_handle_t *,char const *)) ((arg1)->asr_unload_grammar);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_close_set(void * jarg1, void * jarg2) {
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_status_t (*arg2)(switch_asr_handle_t *,switch_asr_flag_t *) = (switch_status_t (*)(switch_asr_handle_t *,switch_asr_flag_t *)) 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_asr_handle_t *,switch_asr_flag_t *))jarg2; 
-  if (arg1) (arg1)->asr_close = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_close_get(void * jarg1) {
-  void * jresult ;
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_status_t (*result)(switch_asr_handle_t *,switch_asr_flag_t *) = 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_asr_handle_t *,switch_asr_flag_t *)) ((arg1)->asr_close);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_feed_set(void * jarg1, void * jarg2) {
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_status_t (*arg2)(switch_asr_handle_t *,void *,unsigned int,switch_asr_flag_t *) = (switch_status_t (*)(switch_asr_handle_t *,void *,unsigned int,switch_asr_flag_t *)) 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_asr_handle_t *,void *,unsigned int,switch_asr_flag_t *))jarg2; 
-  if (arg1) (arg1)->asr_feed = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_feed_get(void * jarg1) {
-  void * jresult ;
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_status_t (*result)(switch_asr_handle_t *,void *,unsigned int,switch_asr_flag_t *) = 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_asr_handle_t *,void *,unsigned int,switch_asr_flag_t *)) ((arg1)->asr_feed);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_resume_set(void * jarg1, void * jarg2) {
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_status_t (*arg2)(switch_asr_handle_t *) = (switch_status_t (*)(switch_asr_handle_t *)) 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_asr_handle_t *))jarg2; 
-  if (arg1) (arg1)->asr_resume = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_resume_get(void * jarg1) {
-  void * jresult ;
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_status_t (*result)(switch_asr_handle_t *) = 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_asr_handle_t *)) ((arg1)->asr_resume);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_pause_set(void * jarg1, void * jarg2) {
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_status_t (*arg2)(switch_asr_handle_t *) = (switch_status_t (*)(switch_asr_handle_t *)) 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_asr_handle_t *))jarg2; 
-  if (arg1) (arg1)->asr_pause = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_pause_get(void * jarg1) {
-  void * jresult ;
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_status_t (*result)(switch_asr_handle_t *) = 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_asr_handle_t *)) ((arg1)->asr_pause);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_check_results_set(void * jarg1, void * jarg2) {
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_status_t (*arg2)(switch_asr_handle_t *,switch_asr_flag_t *) = (switch_status_t (*)(switch_asr_handle_t *,switch_asr_flag_t *)) 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_asr_handle_t *,switch_asr_flag_t *))jarg2; 
-  if (arg1) (arg1)->asr_check_results = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_check_results_get(void * jarg1) {
-  void * jresult ;
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_status_t (*result)(switch_asr_handle_t *,switch_asr_flag_t *) = 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_asr_handle_t *,switch_asr_flag_t *)) ((arg1)->asr_check_results);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_get_results_set(void * jarg1, void * jarg2) {
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_status_t (*arg2)(switch_asr_handle_t *,char **,switch_asr_flag_t *) = (switch_status_t (*)(switch_asr_handle_t *,char **,switch_asr_flag_t *)) 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_asr_handle_t *,char **,switch_asr_flag_t *))jarg2; 
-  if (arg1) (arg1)->asr_get_results = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_get_results_get(void * jarg1) {
-  void * jresult ;
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_status_t (*result)(switch_asr_handle_t *,char **,switch_asr_flag_t *) = 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_asr_handle_t *,char **,switch_asr_flag_t *)) ((arg1)->asr_get_results);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_start_input_timers_set(void * jarg1, void * jarg2) {
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_status_t (*arg2)(switch_asr_handle_t *) = (switch_status_t (*)(switch_asr_handle_t *)) 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_asr_handle_t *))jarg2; 
-  if (arg1) (arg1)->asr_start_input_timers = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_start_input_timers_get(void * jarg1) {
-  void * jresult ;
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_status_t (*result)(switch_asr_handle_t *) = 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_asr_handle_t *)) ((arg1)->asr_start_input_timers);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_text_param_set(void * jarg1, void * jarg2) {
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  void (*arg2)(switch_asr_handle_t *,char *,char const *) = (void (*)(switch_asr_handle_t *,char *,char const *)) 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  arg2 = (void (*)(switch_asr_handle_t *,char *,char const *))jarg2; 
-  if (arg1) (arg1)->asr_text_param = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_text_param_get(void * jarg1) {
-  void * jresult ;
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  void (*result)(switch_asr_handle_t *,char *,char const *) = 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  result = (void (*)(switch_asr_handle_t *,char *,char const *)) ((arg1)->asr_text_param);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_numeric_param_set(void * jarg1, void * jarg2) {
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  void (*arg2)(switch_asr_handle_t *,char *,int) = (void (*)(switch_asr_handle_t *,char *,int)) 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  arg2 = (void (*)(switch_asr_handle_t *,char *,int))jarg2; 
-  if (arg1) (arg1)->asr_numeric_param = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_numeric_param_get(void * jarg1) {
-  void * jresult ;
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  void (*result)(switch_asr_handle_t *,char *,int) = 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  result = (void (*)(switch_asr_handle_t *,char *,int)) ((arg1)->asr_numeric_param);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_float_param_set(void * jarg1, void * jarg2) {
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  void (*arg2)(switch_asr_handle_t *,char *,double) = (void (*)(switch_asr_handle_t *,char *,double)) 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  arg2 = (void (*)(switch_asr_handle_t *,char *,double))jarg2; 
-  if (arg1) (arg1)->asr_float_param = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_float_param_get(void * jarg1) {
-  void * jresult ;
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  void (*result)(switch_asr_handle_t *,char *,double) = 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  result = (void (*)(switch_asr_handle_t *,char *,double)) ((arg1)->asr_float_param);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_rwlock_set(void * jarg1, void * jarg2) {
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  arg2 = (switch_thread_rwlock_t *)jarg2; 
-  if (arg1) (arg1)->rwlock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_rwlock_get(void * jarg1) {
-  void * jresult ;
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_thread_rwlock_t *result = 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_refs_set(void * jarg1, int jarg2) {
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->refs = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_asr_interface_refs_get(void * jarg1) {
-  int jresult ;
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  int result;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  result = (int) ((arg1)->refs);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_reflock_set(void * jarg1, void * jarg2) {
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  arg2 = (switch_mutex_t *)jarg2; 
-  if (arg1) (arg1)->reflock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_reflock_get(void * jarg1) {
-  void * jresult ;
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_mutex_t *result = 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  result = (switch_mutex_t *) ((arg1)->reflock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_parent_set(void * jarg1, void * jarg2) {
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  arg2 = (switch_loadable_module_interface_t *)jarg2; 
-  if (arg1) (arg1)->parent = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_parent_get(void * jarg1) {
-  void * jresult ;
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_loadable_module_interface_t *result = 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_next_set(void * jarg1, void * jarg2) {
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_asr_interface *arg2 = (switch_asr_interface *) 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  arg2 = (switch_asr_interface *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_next_get(void * jarg1) {
-  void * jresult ;
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  switch_asr_interface *result = 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  result = (switch_asr_interface *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_asr_interface() {
-  void * jresult ;
-  switch_asr_interface *result = 0 ;
-  
-  result = (switch_asr_interface *)new switch_asr_interface();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_asr_interface(void * jarg1) {
-  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
-  
-  arg1 = (switch_asr_interface *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_handle_asr_interface_set(void * jarg1, void * jarg2) {
-  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
-  switch_asr_interface_t *arg2 = (switch_asr_interface_t *) 0 ;
-  
-  arg1 = (switch_asr_handle *)jarg1; 
-  arg2 = (switch_asr_interface_t *)jarg2; 
-  if (arg1) (arg1)->asr_interface = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_handle_asr_interface_get(void * jarg1) {
-  void * jresult ;
-  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
-  switch_asr_interface_t *result = 0 ;
-  
-  arg1 = (switch_asr_handle *)jarg1; 
-  result = (switch_asr_interface_t *) ((arg1)->asr_interface);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_handle_flags_set(void * jarg1, unsigned long jarg2) {
-  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_asr_handle *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->flags = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_asr_handle_flags_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_asr_handle *)jarg1; 
-  result = (uint32_t) ((arg1)->flags);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_handle_name_set(void * jarg1, char * jarg2) {
-  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_asr_handle *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->name) delete [] arg1->name;
-    if (arg2) {
-      arg1->name = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->name, (const char *)arg2);
-    } else {
-      arg1->name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_asr_handle_name_get(void * jarg1) {
-  char * jresult ;
-  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_asr_handle *)jarg1; 
-  result = (char *) ((arg1)->name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_handle_codec_set(void * jarg1, char * jarg2) {
-  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_asr_handle *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->codec) delete [] arg1->codec;
-    if (arg2) {
-      arg1->codec = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->codec, (const char *)arg2);
-    } else {
-      arg1->codec = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_asr_handle_codec_get(void * jarg1) {
-  char * jresult ;
-  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_asr_handle *)jarg1; 
-  result = (char *) ((arg1)->codec);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_handle_rate_set(void * jarg1, unsigned long jarg2) {
-  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_asr_handle *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->rate = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_asr_handle_rate_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_asr_handle *)jarg1; 
-  result = (uint32_t) ((arg1)->rate);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_handle_grammar_set(void * jarg1, char * jarg2) {
-  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_asr_handle *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->grammar) delete [] arg1->grammar;
-    if (arg2) {
-      arg1->grammar = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->grammar, (const char *)arg2);
-    } else {
-      arg1->grammar = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_asr_handle_grammar_get(void * jarg1) {
-  char * jresult ;
-  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_asr_handle *)jarg1; 
-  result = (char *) ((arg1)->grammar);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_handle_param_set(void * jarg1, char * jarg2) {
-  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_asr_handle *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->param) delete [] arg1->param;
-    if (arg2) {
-      arg1->param = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->param, (const char *)arg2);
-    } else {
-      arg1->param = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_asr_handle_param_get(void * jarg1) {
-  char * jresult ;
-  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_asr_handle *)jarg1; 
-  result = (char *) ((arg1)->param);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_handle_memory_pool_set(void * jarg1, void * jarg2) {
-  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
-  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
-  
-  arg1 = (switch_asr_handle *)jarg1; 
-  arg2 = (switch_memory_pool_t *)jarg2; 
-  if (arg1) (arg1)->memory_pool = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_handle_memory_pool_get(void * jarg1) {
-  void * jresult ;
-  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
-  switch_memory_pool_t *result = 0 ;
-  
-  arg1 = (switch_asr_handle *)jarg1; 
-  result = (switch_memory_pool_t *) ((arg1)->memory_pool);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_handle_private_info_set(void * jarg1, void * jarg2) {
-  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_asr_handle *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->private_info = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_handle_private_info_get(void * jarg1) {
-  void * jresult ;
-  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_asr_handle *)jarg1; 
-  result = (void *) ((arg1)->private_info);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_asr_handle() {
-  void * jresult ;
-  switch_asr_handle *result = 0 ;
-  
-  result = (switch_asr_handle *)new switch_asr_handle();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_asr_handle(void * jarg1) {
-  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
-  
-  arg1 = (switch_asr_handle *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_interface_name_set(void * jarg1, char * jarg2) {
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->interface_name, (const char *)arg2);
-    } else {
-      arg1->interface_name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_speech_interface_interface_name_get(void * jarg1) {
-  char * jresult ;
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  result = (char *) ((arg1)->interface_name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_speech_open_set(void * jarg1, void * jarg2) {
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  switch_status_t (*arg2)(switch_speech_handle_t *,char const *,int,switch_speech_flag_t *) = (switch_status_t (*)(switch_speech_handle_t *,char const *,int,switch_speech_flag_t *)) 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_speech_handle_t *,char const *,int,switch_speech_flag_t *))jarg2; 
-  if (arg1) (arg1)->speech_open = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_speech_open_get(void * jarg1) {
-  void * jresult ;
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  switch_status_t (*result)(switch_speech_handle_t *,char const *,int,switch_speech_flag_t *) = 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_speech_handle_t *,char const *,int,switch_speech_flag_t *)) ((arg1)->speech_open);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_speech_close_set(void * jarg1, void * jarg2) {
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  switch_status_t (*arg2)(switch_speech_handle_t *,switch_speech_flag_t *) = (switch_status_t (*)(switch_speech_handle_t *,switch_speech_flag_t *)) 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_speech_handle_t *,switch_speech_flag_t *))jarg2; 
-  if (arg1) (arg1)->speech_close = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_speech_close_get(void * jarg1) {
-  void * jresult ;
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  switch_status_t (*result)(switch_speech_handle_t *,switch_speech_flag_t *) = 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_speech_handle_t *,switch_speech_flag_t *)) ((arg1)->speech_close);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_speech_feed_tts_set(void * jarg1, void * jarg2) {
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  switch_status_t (*arg2)(switch_speech_handle_t *,char *,switch_speech_flag_t *) = (switch_status_t (*)(switch_speech_handle_t *,char *,switch_speech_flag_t *)) 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_speech_handle_t *,char *,switch_speech_flag_t *))jarg2; 
-  if (arg1) (arg1)->speech_feed_tts = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_speech_feed_tts_get(void * jarg1) {
-  void * jresult ;
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  switch_status_t (*result)(switch_speech_handle_t *,char *,switch_speech_flag_t *) = 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_speech_handle_t *,char *,switch_speech_flag_t *)) ((arg1)->speech_feed_tts);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_speech_read_tts_set(void * jarg1, void * jarg2) {
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  switch_status_t (*arg2)(switch_speech_handle_t *,void *,switch_size_t *,switch_speech_flag_t *) = (switch_status_t (*)(switch_speech_handle_t *,void *,switch_size_t *,switch_speech_flag_t *)) 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_speech_handle_t *,void *,switch_size_t *,switch_speech_flag_t *))jarg2; 
-  if (arg1) (arg1)->speech_read_tts = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_speech_read_tts_get(void * jarg1) {
-  void * jresult ;
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  switch_status_t (*result)(switch_speech_handle_t *,void *,switch_size_t *,switch_speech_flag_t *) = 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_speech_handle_t *,void *,switch_size_t *,switch_speech_flag_t *)) ((arg1)->speech_read_tts);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_speech_flush_tts_set(void * jarg1, void * jarg2) {
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  void (*arg2)(switch_speech_handle_t *) = (void (*)(switch_speech_handle_t *)) 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  arg2 = (void (*)(switch_speech_handle_t *))jarg2; 
-  if (arg1) (arg1)->speech_flush_tts = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_speech_flush_tts_get(void * jarg1) {
-  void * jresult ;
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  void (*result)(switch_speech_handle_t *) = 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  result = (void (*)(switch_speech_handle_t *)) ((arg1)->speech_flush_tts);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_speech_text_param_tts_set(void * jarg1, void * jarg2) {
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  void (*arg2)(switch_speech_handle_t *,char *,char const *) = (void (*)(switch_speech_handle_t *,char *,char const *)) 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  arg2 = (void (*)(switch_speech_handle_t *,char *,char const *))jarg2; 
-  if (arg1) (arg1)->speech_text_param_tts = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_speech_text_param_tts_get(void * jarg1) {
-  void * jresult ;
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  void (*result)(switch_speech_handle_t *,char *,char const *) = 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  result = (void (*)(switch_speech_handle_t *,char *,char const *)) ((arg1)->speech_text_param_tts);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_speech_numeric_param_tts_set(void * jarg1, void * jarg2) {
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  void (*arg2)(switch_speech_handle_t *,char *,int) = (void (*)(switch_speech_handle_t *,char *,int)) 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  arg2 = (void (*)(switch_speech_handle_t *,char *,int))jarg2; 
-  if (arg1) (arg1)->speech_numeric_param_tts = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_speech_numeric_param_tts_get(void * jarg1) {
-  void * jresult ;
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  void (*result)(switch_speech_handle_t *,char *,int) = 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  result = (void (*)(switch_speech_handle_t *,char *,int)) ((arg1)->speech_numeric_param_tts);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_speech_float_param_tts_set(void * jarg1, void * jarg2) {
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  void (*arg2)(switch_speech_handle_t *,char *,double) = (void (*)(switch_speech_handle_t *,char *,double)) 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  arg2 = (void (*)(switch_speech_handle_t *,char *,double))jarg2; 
-  if (arg1) (arg1)->speech_float_param_tts = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_speech_float_param_tts_get(void * jarg1) {
-  void * jresult ;
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  void (*result)(switch_speech_handle_t *,char *,double) = 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  result = (void (*)(switch_speech_handle_t *,char *,double)) ((arg1)->speech_float_param_tts);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_rwlock_set(void * jarg1, void * jarg2) {
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  arg2 = (switch_thread_rwlock_t *)jarg2; 
-  if (arg1) (arg1)->rwlock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_rwlock_get(void * jarg1) {
-  void * jresult ;
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  switch_thread_rwlock_t *result = 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_refs_set(void * jarg1, int jarg2) {
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->refs = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_speech_interface_refs_get(void * jarg1) {
-  int jresult ;
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  int result;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  result = (int) ((arg1)->refs);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_reflock_set(void * jarg1, void * jarg2) {
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  arg2 = (switch_mutex_t *)jarg2; 
-  if (arg1) (arg1)->reflock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_reflock_get(void * jarg1) {
-  void * jresult ;
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  switch_mutex_t *result = 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  result = (switch_mutex_t *) ((arg1)->reflock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_parent_set(void * jarg1, void * jarg2) {
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  arg2 = (switch_loadable_module_interface_t *)jarg2; 
-  if (arg1) (arg1)->parent = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_parent_get(void * jarg1) {
-  void * jresult ;
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  switch_loadable_module_interface_t *result = 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_next_set(void * jarg1, void * jarg2) {
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  switch_speech_interface *arg2 = (switch_speech_interface *) 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  arg2 = (switch_speech_interface *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_next_get(void * jarg1) {
-  void * jresult ;
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  switch_speech_interface *result = 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  result = (switch_speech_interface *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_speech_interface() {
-  void * jresult ;
-  switch_speech_interface *result = 0 ;
-  
-  result = (switch_speech_interface *)new switch_speech_interface();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_speech_interface(void * jarg1) {
-  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
-  
-  arg1 = (switch_speech_interface *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_speech_interface_set(void * jarg1, void * jarg2) {
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  switch_speech_interface_t *arg2 = (switch_speech_interface_t *) 0 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  arg2 = (switch_speech_interface_t *)jarg2; 
-  if (arg1) (arg1)->speech_interface = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_speech_interface_get(void * jarg1) {
-  void * jresult ;
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  switch_speech_interface_t *result = 0 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  result = (switch_speech_interface_t *) ((arg1)->speech_interface);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_flags_set(void * jarg1, unsigned long jarg2) {
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->flags = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_speech_handle_flags_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  result = (uint32_t) ((arg1)->flags);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_name_set(void * jarg1, char * jarg2) {
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->name) delete [] arg1->name;
-    if (arg2) {
-      arg1->name = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->name, (const char *)arg2);
-    } else {
-      arg1->name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_speech_handle_name_get(void * jarg1) {
-  char * jresult ;
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  result = (char *) ((arg1)->name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_rate_set(void * jarg1, unsigned long jarg2) {
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->rate = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_speech_handle_rate_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  result = (uint32_t) ((arg1)->rate);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_speed_set(void * jarg1, unsigned long jarg2) {
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->speed = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_speech_handle_speed_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  result = (uint32_t) ((arg1)->speed);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_samples_set(void * jarg1, unsigned long jarg2) {
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->samples = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_speech_handle_samples_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  result = (uint32_t) ((arg1)->samples);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_voice_set(void * jarg1, char * jarg2) {
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  char *arg2 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) strncpy((char *)arg1->voice, (const char *)arg2, 80);
-    else arg1->voice[0] = 0;
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_speech_handle_voice_get(void * jarg1) {
-  char * jresult ;
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  result = (char *)(char *) ((arg1)->voice);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_engine_set(void * jarg1, char * jarg2) {
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->engine) delete [] arg1->engine;
-    if (arg2) {
-      arg1->engine = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->engine, (const char *)arg2);
-    } else {
-      arg1->engine = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_speech_handle_engine_get(void * jarg1) {
-  char * jresult ;
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  result = (char *) ((arg1)->engine);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_param_set(void * jarg1, char * jarg2) {
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->param) delete [] arg1->param;
-    if (arg2) {
-      arg1->param = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->param, (const char *)arg2);
-    } else {
-      arg1->param = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_speech_handle_param_get(void * jarg1) {
-  char * jresult ;
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  result = (char *) ((arg1)->param);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_memory_pool_set(void * jarg1, void * jarg2) {
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  arg2 = (switch_memory_pool_t *)jarg2; 
-  if (arg1) (arg1)->memory_pool = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_memory_pool_get(void * jarg1) {
-  void * jresult ;
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  switch_memory_pool_t *result = 0 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  result = (switch_memory_pool_t *) ((arg1)->memory_pool);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_resampler_set(void * jarg1, void * jarg2) {
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  switch_audio_resampler_t *arg2 = (switch_audio_resampler_t *) 0 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  arg2 = (switch_audio_resampler_t *)jarg2; 
-  if (arg1) (arg1)->resampler = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_resampler_get(void * jarg1) {
-  void * jresult ;
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  switch_audio_resampler_t *result = 0 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  result = (switch_audio_resampler_t *) ((arg1)->resampler);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_buffer_set(void * jarg1, void * jarg2) {
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  switch_buffer_t *arg2 = (switch_buffer_t *) 0 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  arg2 = (switch_buffer_t *)jarg2; 
-  if (arg1) (arg1)->buffer = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_buffer_get(void * jarg1) {
-  void * jresult ;
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  switch_buffer_t *result = 0 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  result = (switch_buffer_t *) ((arg1)->buffer);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_dbuf_set(void * jarg1, void * jarg2) {
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  switch_byte_t *arg2 = (switch_byte_t *) 0 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  arg2 = (switch_byte_t *)jarg2; 
-  if (arg1) (arg1)->dbuf = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_dbuf_get(void * jarg1) {
-  void * jresult ;
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  switch_byte_t *result = 0 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  result = (switch_byte_t *) ((arg1)->dbuf);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_dbuflen_set(void * jarg1, void * jarg2) {
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->dbuflen = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_dbuflen_get(void * jarg1) {
-  void * jresult ;
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  result =  ((arg1)->dbuflen);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_samplerate_set(void * jarg1, unsigned long jarg2) {
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->samplerate = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_speech_handle_samplerate_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  result = (uint32_t) ((arg1)->samplerate);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_native_rate_set(void * jarg1, unsigned long jarg2) {
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->native_rate = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_speech_handle_native_rate_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  result = (uint32_t) ((arg1)->native_rate);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_private_info_set(void * jarg1, void * jarg2) {
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->private_info = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_private_info_get(void * jarg1) {
-  void * jresult ;
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  result = (void *) ((arg1)->private_info);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_speech_handle() {
-  void * jresult ;
-  switch_speech_handle *result = 0 ;
-  
-  result = (switch_speech_handle *)new switch_speech_handle();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_speech_handle(void * jarg1) {
-  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
-  
-  arg1 = (switch_speech_handle *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_interface_interface_name_set(void * jarg1, char * jarg2) {
-  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_say_interface *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->interface_name, (const char *)arg2);
-    } else {
-      arg1->interface_name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_say_interface_interface_name_get(void * jarg1) {
-  char * jresult ;
-  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_say_interface *)jarg1; 
-  result = (char *) ((arg1)->interface_name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_interface_say_function_set(void * jarg1, void * jarg2) {
-  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
-  switch_say_callback_t arg2 = (switch_say_callback_t) 0 ;
-  
-  arg1 = (switch_say_interface *)jarg1; 
-  arg2 = (switch_say_callback_t)jarg2; 
-  if (arg1) (arg1)->say_function = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_say_interface_say_function_get(void * jarg1) {
-  void * jresult ;
-  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
-  switch_say_callback_t result;
-  
-  arg1 = (switch_say_interface *)jarg1; 
-  result = (switch_say_callback_t) ((arg1)->say_function);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_interface_rwlock_set(void * jarg1, void * jarg2) {
-  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
-  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
-  
-  arg1 = (switch_say_interface *)jarg1; 
-  arg2 = (switch_thread_rwlock_t *)jarg2; 
-  if (arg1) (arg1)->rwlock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_say_interface_rwlock_get(void * jarg1) {
-  void * jresult ;
-  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
-  switch_thread_rwlock_t *result = 0 ;
-  
-  arg1 = (switch_say_interface *)jarg1; 
-  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_interface_refs_set(void * jarg1, int jarg2) {
-  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_say_interface *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->refs = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_say_interface_refs_get(void * jarg1) {
-  int jresult ;
-  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
-  int result;
-  
-  arg1 = (switch_say_interface *)jarg1; 
-  result = (int) ((arg1)->refs);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_interface_reflock_set(void * jarg1, void * jarg2) {
-  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
-  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
-  
-  arg1 = (switch_say_interface *)jarg1; 
-  arg2 = (switch_mutex_t *)jarg2; 
-  if (arg1) (arg1)->reflock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_say_interface_reflock_get(void * jarg1) {
-  void * jresult ;
-  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
-  switch_mutex_t *result = 0 ;
-  
-  arg1 = (switch_say_interface *)jarg1; 
-  result = (switch_mutex_t *) ((arg1)->reflock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_interface_parent_set(void * jarg1, void * jarg2) {
-  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
-  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
-  
-  arg1 = (switch_say_interface *)jarg1; 
-  arg2 = (switch_loadable_module_interface_t *)jarg2; 
-  if (arg1) (arg1)->parent = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_say_interface_parent_get(void * jarg1) {
-  void * jresult ;
-  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
-  switch_loadable_module_interface_t *result = 0 ;
-  
-  arg1 = (switch_say_interface *)jarg1; 
-  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_interface_next_set(void * jarg1, void * jarg2) {
-  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
-  switch_say_interface *arg2 = (switch_say_interface *) 0 ;
-  
-  arg1 = (switch_say_interface *)jarg1; 
-  arg2 = (switch_say_interface *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_say_interface_next_get(void * jarg1) {
-  void * jresult ;
-  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
-  switch_say_interface *result = 0 ;
-  
-  arg1 = (switch_say_interface *)jarg1; 
-  result = (switch_say_interface *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_say_interface() {
-  void * jresult ;
-  switch_say_interface *result = 0 ;
-  
-  result = (switch_say_interface *)new switch_say_interface();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_say_interface(void * jarg1) {
-  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
-  
-  arg1 = (switch_say_interface *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_interface_interface_name_set(void * jarg1, char * jarg2) {
-  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_chat_interface *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->interface_name, (const char *)arg2);
-    } else {
-      arg1->interface_name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_chat_interface_interface_name_get(void * jarg1) {
-  char * jresult ;
-  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_chat_interface *)jarg1; 
-  result = (char *) ((arg1)->interface_name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_interface_chat_send_set(void * jarg1, void * jarg2) {
-  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
-  switch_status_t (*arg2)(char const *,char const *,char const *,char const *,char const *,char const *,char const *) = (switch_status_t (*)(char const *,char const *,char const *,char const *,char const *,char const *,char const *)) 0 ;
-  
-  arg1 = (switch_chat_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(char const *,char const *,char const *,char const *,char const *,char const *,char const *))jarg2; 
-  if (arg1) (arg1)->chat_send = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_chat_interface_chat_send_get(void * jarg1) {
-  void * jresult ;
-  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
-  switch_status_t (*result)(char const *,char const *,char const *,char const *,char const *,char const *,char const *) = 0 ;
-  
-  arg1 = (switch_chat_interface *)jarg1; 
-  result = (switch_status_t (*)(char const *,char const *,char const *,char const *,char const *,char const *,char const *)) ((arg1)->chat_send);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_interface_rwlock_set(void * jarg1, void * jarg2) {
-  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
-  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
-  
-  arg1 = (switch_chat_interface *)jarg1; 
-  arg2 = (switch_thread_rwlock_t *)jarg2; 
-  if (arg1) (arg1)->rwlock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_chat_interface_rwlock_get(void * jarg1) {
-  void * jresult ;
-  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
-  switch_thread_rwlock_t *result = 0 ;
-  
-  arg1 = (switch_chat_interface *)jarg1; 
-  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_interface_refs_set(void * jarg1, int jarg2) {
-  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_chat_interface *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->refs = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_chat_interface_refs_get(void * jarg1) {
-  int jresult ;
-  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
-  int result;
-  
-  arg1 = (switch_chat_interface *)jarg1; 
-  result = (int) ((arg1)->refs);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_interface_reflock_set(void * jarg1, void * jarg2) {
-  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
-  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
-  
-  arg1 = (switch_chat_interface *)jarg1; 
-  arg2 = (switch_mutex_t *)jarg2; 
-  if (arg1) (arg1)->reflock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_chat_interface_reflock_get(void * jarg1) {
-  void * jresult ;
-  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
-  switch_mutex_t *result = 0 ;
-  
-  arg1 = (switch_chat_interface *)jarg1; 
-  result = (switch_mutex_t *) ((arg1)->reflock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_interface_parent_set(void * jarg1, void * jarg2) {
-  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
-  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
-  
-  arg1 = (switch_chat_interface *)jarg1; 
-  arg2 = (switch_loadable_module_interface_t *)jarg2; 
-  if (arg1) (arg1)->parent = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_chat_interface_parent_get(void * jarg1) {
-  void * jresult ;
-  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
-  switch_loadable_module_interface_t *result = 0 ;
-  
-  arg1 = (switch_chat_interface *)jarg1; 
-  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_interface_next_set(void * jarg1, void * jarg2) {
-  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
-  switch_chat_interface *arg2 = (switch_chat_interface *) 0 ;
-  
-  arg1 = (switch_chat_interface *)jarg1; 
-  arg2 = (switch_chat_interface *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_chat_interface_next_get(void * jarg1) {
-  void * jresult ;
-  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
-  switch_chat_interface *result = 0 ;
-  
-  arg1 = (switch_chat_interface *)jarg1; 
-  result = (switch_chat_interface *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_chat_interface() {
-  void * jresult ;
-  switch_chat_interface *result = 0 ;
-  
-  result = (switch_chat_interface *)new switch_chat_interface();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_chat_interface(void * jarg1) {
-  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
-  
-  arg1 = (switch_chat_interface *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_management_interface_relative_oid_set(void * jarg1, char * jarg2) {
-  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_management_interface *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->relative_oid = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->relative_oid, (const char *)arg2);
-    } else {
-      arg1->relative_oid = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_management_interface_relative_oid_get(void * jarg1) {
-  char * jresult ;
-  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_management_interface *)jarg1; 
-  result = (char *) ((arg1)->relative_oid);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_management_interface_management_function_set(void * jarg1, void * jarg2) {
-  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
-  switch_status_t (*arg2)(char *,switch_management_action_t,char *,switch_size_t) = (switch_status_t (*)(char *,switch_management_action_t,char *,switch_size_t)) 0 ;
-  
-  arg1 = (switch_management_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(char *,switch_management_action_t,char *,switch_size_t))jarg2; 
-  if (arg1) (arg1)->management_function = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_management_interface_management_function_get(void * jarg1) {
-  void * jresult ;
-  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
-  switch_status_t (*result)(char *,switch_management_action_t,char *,switch_size_t) = 0 ;
-  
-  arg1 = (switch_management_interface *)jarg1; 
-  result = (switch_status_t (*)(char *,switch_management_action_t,char *,switch_size_t)) ((arg1)->management_function);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_management_interface_rwlock_set(void * jarg1, void * jarg2) {
-  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
-  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
-  
-  arg1 = (switch_management_interface *)jarg1; 
-  arg2 = (switch_thread_rwlock_t *)jarg2; 
-  if (arg1) (arg1)->rwlock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_management_interface_rwlock_get(void * jarg1) {
-  void * jresult ;
-  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
-  switch_thread_rwlock_t *result = 0 ;
-  
-  arg1 = (switch_management_interface *)jarg1; 
-  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_management_interface_refs_set(void * jarg1, int jarg2) {
-  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_management_interface *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->refs = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_management_interface_refs_get(void * jarg1) {
-  int jresult ;
-  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
-  int result;
-  
-  arg1 = (switch_management_interface *)jarg1; 
-  result = (int) ((arg1)->refs);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_management_interface_reflock_set(void * jarg1, void * jarg2) {
-  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
-  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
-  
-  arg1 = (switch_management_interface *)jarg1; 
-  arg2 = (switch_mutex_t *)jarg2; 
-  if (arg1) (arg1)->reflock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_management_interface_reflock_get(void * jarg1) {
-  void * jresult ;
-  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
-  switch_mutex_t *result = 0 ;
-  
-  arg1 = (switch_management_interface *)jarg1; 
-  result = (switch_mutex_t *) ((arg1)->reflock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_management_interface_parent_set(void * jarg1, void * jarg2) {
-  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
-  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
-  
-  arg1 = (switch_management_interface *)jarg1; 
-  arg2 = (switch_loadable_module_interface_t *)jarg2; 
-  if (arg1) (arg1)->parent = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_management_interface_parent_get(void * jarg1) {
-  void * jresult ;
-  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
-  switch_loadable_module_interface_t *result = 0 ;
-  
-  arg1 = (switch_management_interface *)jarg1; 
-  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_management_interface_next_set(void * jarg1, void * jarg2) {
-  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
-  switch_management_interface *arg2 = (switch_management_interface *) 0 ;
-  
-  arg1 = (switch_management_interface *)jarg1; 
-  arg2 = (switch_management_interface *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_management_interface_next_get(void * jarg1) {
-  void * jresult ;
-  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
-  switch_management_interface *result = 0 ;
-  
-  arg1 = (switch_management_interface *)jarg1; 
-  result = (switch_management_interface *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_management_interface() {
-  void * jresult ;
-  switch_management_interface *result = 0 ;
-  
-  result = (switch_management_interface *)new switch_management_interface();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_management_interface(void * jarg1) {
-  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
-  
-  arg1 = (switch_management_interface *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_interface_name_set(void * jarg1, char * jarg2) {
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->interface_name, (const char *)arg2);
-    } else {
-      arg1->interface_name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directory_interface_interface_name_get(void * jarg1) {
-  char * jresult ;
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  result = (char *) ((arg1)->interface_name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_directory_open_set(void * jarg1, void * jarg2) {
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  switch_status_t (*arg2)(switch_directory_handle_t *,char *,char *,char *) = (switch_status_t (*)(switch_directory_handle_t *,char *,char *,char *)) 0 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_directory_handle_t *,char *,char *,char *))jarg2; 
-  if (arg1) (arg1)->directory_open = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_interface_directory_open_get(void * jarg1) {
-  void * jresult ;
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  switch_status_t (*result)(switch_directory_handle_t *,char *,char *,char *) = 0 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_directory_handle_t *,char *,char *,char *)) ((arg1)->directory_open);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_directory_close_set(void * jarg1, void * jarg2) {
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  switch_status_t (*arg2)(switch_directory_handle_t *) = (switch_status_t (*)(switch_directory_handle_t *)) 0 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_directory_handle_t *))jarg2; 
-  if (arg1) (arg1)->directory_close = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_interface_directory_close_get(void * jarg1) {
-  void * jresult ;
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  switch_status_t (*result)(switch_directory_handle_t *) = 0 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_directory_handle_t *)) ((arg1)->directory_close);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_directory_query_set(void * jarg1, void * jarg2) {
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  switch_status_t (*arg2)(switch_directory_handle_t *,char *,char *) = (switch_status_t (*)(switch_directory_handle_t *,char *,char *)) 0 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_directory_handle_t *,char *,char *))jarg2; 
-  if (arg1) (arg1)->directory_query = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_interface_directory_query_get(void * jarg1) {
-  void * jresult ;
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  switch_status_t (*result)(switch_directory_handle_t *,char *,char *) = 0 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_directory_handle_t *,char *,char *)) ((arg1)->directory_query);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_directory_next_set(void * jarg1, void * jarg2) {
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  switch_status_t (*arg2)(switch_directory_handle_t *) = (switch_status_t (*)(switch_directory_handle_t *)) 0 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_directory_handle_t *))jarg2; 
-  if (arg1) (arg1)->directory_next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_interface_directory_next_get(void * jarg1) {
-  void * jresult ;
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  switch_status_t (*result)(switch_directory_handle_t *) = 0 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_directory_handle_t *)) ((arg1)->directory_next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_directory_next_pair_set(void * jarg1, void * jarg2) {
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  switch_status_t (*arg2)(switch_directory_handle_t *,char **,char **) = (switch_status_t (*)(switch_directory_handle_t *,char **,char **)) 0 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  arg2 = (switch_status_t (*)(switch_directory_handle_t *,char **,char **))jarg2; 
-  if (arg1) (arg1)->directory_next_pair = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_interface_directory_next_pair_get(void * jarg1) {
-  void * jresult ;
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  switch_status_t (*result)(switch_directory_handle_t *,char **,char **) = 0 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  result = (switch_status_t (*)(switch_directory_handle_t *,char **,char **)) ((arg1)->directory_next_pair);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_rwlock_set(void * jarg1, void * jarg2) {
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  arg2 = (switch_thread_rwlock_t *)jarg2; 
-  if (arg1) (arg1)->rwlock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_interface_rwlock_get(void * jarg1) {
-  void * jresult ;
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  switch_thread_rwlock_t *result = 0 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_refs_set(void * jarg1, int jarg2) {
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->refs = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_directory_interface_refs_get(void * jarg1) {
-  int jresult ;
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  int result;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  result = (int) ((arg1)->refs);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_reflock_set(void * jarg1, void * jarg2) {
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  arg2 = (switch_mutex_t *)jarg2; 
-  if (arg1) (arg1)->reflock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_interface_reflock_get(void * jarg1) {
-  void * jresult ;
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  switch_mutex_t *result = 0 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  result = (switch_mutex_t *) ((arg1)->reflock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_parent_set(void * jarg1, void * jarg2) {
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  arg2 = (switch_loadable_module_interface_t *)jarg2; 
-  if (arg1) (arg1)->parent = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_interface_parent_get(void * jarg1) {
-  void * jresult ;
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  switch_loadable_module_interface_t *result = 0 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_next_set(void * jarg1, void * jarg2) {
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  switch_directory_interface *arg2 = (switch_directory_interface *) 0 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  arg2 = (switch_directory_interface *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_interface_next_get(void * jarg1) {
-  void * jresult ;
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  switch_directory_interface *result = 0 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  result = (switch_directory_interface *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_directory_interface() {
-  void * jresult ;
-  switch_directory_interface *result = 0 ;
-  
-  result = (switch_directory_interface *)new switch_directory_interface();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_directory_interface(void * jarg1) {
-  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
-  
-  arg1 = (switch_directory_interface *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_handle_directory_interface_set(void * jarg1, void * jarg2) {
-  switch_directory_handle *arg1 = (switch_directory_handle *) 0 ;
-  switch_directory_interface_t *arg2 = (switch_directory_interface_t *) 0 ;
-  
-  arg1 = (switch_directory_handle *)jarg1; 
-  arg2 = (switch_directory_interface_t *)jarg2; 
-  if (arg1) (arg1)->directory_interface = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_handle_directory_interface_get(void * jarg1) {
-  void * jresult ;
-  switch_directory_handle *arg1 = (switch_directory_handle *) 0 ;
-  switch_directory_interface_t *result = 0 ;
-  
-  arg1 = (switch_directory_handle *)jarg1; 
-  result = (switch_directory_interface_t *) ((arg1)->directory_interface);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_handle_flags_set(void * jarg1, unsigned long jarg2) {
-  switch_directory_handle *arg1 = (switch_directory_handle *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_directory_handle *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->flags = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_directory_handle_flags_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_directory_handle *arg1 = (switch_directory_handle *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_directory_handle *)jarg1; 
-  result = (uint32_t) ((arg1)->flags);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_handle_memory_pool_set(void * jarg1, void * jarg2) {
-  switch_directory_handle *arg1 = (switch_directory_handle *) 0 ;
-  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
-  
-  arg1 = (switch_directory_handle *)jarg1; 
-  arg2 = (switch_memory_pool_t *)jarg2; 
-  if (arg1) (arg1)->memory_pool = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_handle_memory_pool_get(void * jarg1) {
-  void * jresult ;
-  switch_directory_handle *arg1 = (switch_directory_handle *) 0 ;
-  switch_memory_pool_t *result = 0 ;
-  
-  arg1 = (switch_directory_handle *)jarg1; 
-  result = (switch_memory_pool_t *) ((arg1)->memory_pool);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_handle_private_info_set(void * jarg1, void * jarg2) {
-  switch_directory_handle *arg1 = (switch_directory_handle *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_directory_handle *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->private_info = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_handle_private_info_get(void * jarg1) {
-  void * jresult ;
-  switch_directory_handle *arg1 = (switch_directory_handle *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_directory_handle *)jarg1; 
-  result = (void *) ((arg1)->private_info);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_directory_handle() {
-  void * jresult ;
-  switch_directory_handle *result = 0 ;
-  
-  result = (switch_directory_handle *)new switch_directory_handle();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_directory_handle(void * jarg1) {
-  switch_directory_handle *arg1 = (switch_directory_handle *) 0 ;
-  
-  arg1 = (switch_directory_handle *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_quality_set(void * jarg1, int jarg2) {
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->quality = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_quality_get(void * jarg1) {
-  int jresult ;
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int result;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  result = (int) ((arg1)->quality);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_complexity_set(void * jarg1, int jarg2) {
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->complexity = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_complexity_get(void * jarg1) {
-  int jresult ;
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int result;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  result = (int) ((arg1)->complexity);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_enhancement_set(void * jarg1, int jarg2) {
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->enhancement = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_enhancement_get(void * jarg1) {
-  int jresult ;
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int result;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  result = (int) ((arg1)->enhancement);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_vad_set(void * jarg1, int jarg2) {
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->vad = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_vad_get(void * jarg1) {
-  int jresult ;
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int result;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  result = (int) ((arg1)->vad);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_vbr_set(void * jarg1, int jarg2) {
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->vbr = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_vbr_get(void * jarg1) {
-  int jresult ;
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int result;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  result = (int) ((arg1)->vbr);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_vbr_quality_set(void * jarg1, float jarg2) {
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  float arg2 ;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  arg2 = (float)jarg2; 
-  if (arg1) (arg1)->vbr_quality = arg2;
-  
-}
-
-
-SWIGEXPORT float SWIGSTDCALL CSharp_switch_codec_settings_vbr_quality_get(void * jarg1) {
-  float jresult ;
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  float result;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  result = (float) ((arg1)->vbr_quality);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_abr_set(void * jarg1, int jarg2) {
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->abr = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_abr_get(void * jarg1) {
-  int jresult ;
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int result;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  result = (int) ((arg1)->abr);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_dtx_set(void * jarg1, int jarg2) {
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->dtx = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_dtx_get(void * jarg1) {
-  int jresult ;
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int result;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  result = (int) ((arg1)->dtx);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_preproc_set(void * jarg1, int jarg2) {
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->preproc = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_preproc_get(void * jarg1) {
-  int jresult ;
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int result;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  result = (int) ((arg1)->preproc);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_vad_set(void * jarg1, int jarg2) {
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->pp_vad = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_pp_vad_get(void * jarg1) {
-  int jresult ;
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int result;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  result = (int) ((arg1)->pp_vad);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_agc_set(void * jarg1, int jarg2) {
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->pp_agc = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_pp_agc_get(void * jarg1) {
-  int jresult ;
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int result;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  result = (int) ((arg1)->pp_agc);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_agc_level_set(void * jarg1, float jarg2) {
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  float arg2 ;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  arg2 = (float)jarg2; 
-  if (arg1) (arg1)->pp_agc_level = arg2;
-  
-}
-
-
-SWIGEXPORT float SWIGSTDCALL CSharp_switch_codec_settings_pp_agc_level_get(void * jarg1) {
-  float jresult ;
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  float result;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  result = (float) ((arg1)->pp_agc_level);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_denoise_set(void * jarg1, int jarg2) {
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->pp_denoise = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_pp_denoise_get(void * jarg1) {
-  int jresult ;
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int result;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  result = (int) ((arg1)->pp_denoise);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_set(void * jarg1, int jarg2) {
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->pp_dereverb = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_get(void * jarg1) {
-  int jresult ;
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  int result;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  result = (int) ((arg1)->pp_dereverb);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_decay_set(void * jarg1, float jarg2) {
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  float arg2 ;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  arg2 = (float)jarg2; 
-  if (arg1) (arg1)->pp_dereverb_decay = arg2;
-  
-}
-
-
-SWIGEXPORT float SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_decay_get(void * jarg1) {
-  float jresult ;
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  float result;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  result = (float) ((arg1)->pp_dereverb_decay);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_level_set(void * jarg1, float jarg2) {
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  float arg2 ;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  arg2 = (float)jarg2; 
-  if (arg1) (arg1)->pp_dereverb_level = arg2;
-  
-}
-
-
-SWIGEXPORT float SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_level_get(void * jarg1) {
-  float jresult ;
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  float result;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  result = (float) ((arg1)->pp_dereverb_level);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_codec_settings() {
-  void * jresult ;
-  switch_codec_settings *result = 0 ;
-  
-  result = (switch_codec_settings *)new switch_codec_settings();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_codec_settings(void * jarg1) {
-  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
-  
-  arg1 = (switch_codec_settings *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_codec_interface_set(void * jarg1, void * jarg2) {
-  switch_codec *arg1 = (switch_codec *) 0 ;
-  switch_codec_interface_t *arg2 = (switch_codec_interface_t *) 0 ;
-  
-  arg1 = (switch_codec *)jarg1; 
-  arg2 = (switch_codec_interface_t *)jarg2; 
-  if (arg1) (arg1)->codec_interface = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_codec_interface_get(void * jarg1) {
-  void * jresult ;
-  switch_codec *arg1 = (switch_codec *) 0 ;
-  switch_codec_interface_t *result = 0 ;
-  
-  arg1 = (switch_codec *)jarg1; 
-  result = (switch_codec_interface_t *) ((arg1)->codec_interface);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_set(void * jarg1, void * jarg2) {
-  switch_codec *arg1 = (switch_codec *) 0 ;
-  switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
-  
-  arg1 = (switch_codec *)jarg1; 
-  arg2 = (switch_codec_implementation_t *)jarg2; 
-  if (arg1) (arg1)->implementation = (switch_codec_implementation_t const *)arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_implementation_get(void * jarg1) {
-  void * jresult ;
-  switch_codec *arg1 = (switch_codec *) 0 ;
-  switch_codec_implementation_t *result = 0 ;
-  
-  arg1 = (switch_codec *)jarg1; 
-  result = (switch_codec_implementation_t *) ((arg1)->implementation);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_fmtp_in_set(void * jarg1, char * jarg2) {
-  switch_codec *arg1 = (switch_codec *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_codec *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->fmtp_in) delete [] arg1->fmtp_in;
-    if (arg2) {
-      arg1->fmtp_in = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->fmtp_in, (const char *)arg2);
-    } else {
-      arg1->fmtp_in = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_codec_fmtp_in_get(void * jarg1) {
-  char * jresult ;
-  switch_codec *arg1 = (switch_codec *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_codec *)jarg1; 
-  result = (char *) ((arg1)->fmtp_in);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_fmtp_out_set(void * jarg1, char * jarg2) {
-  switch_codec *arg1 = (switch_codec *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_codec *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->fmtp_out) delete [] arg1->fmtp_out;
-    if (arg2) {
-      arg1->fmtp_out = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->fmtp_out, (const char *)arg2);
-    } else {
-      arg1->fmtp_out = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_codec_fmtp_out_get(void * jarg1) {
-  char * jresult ;
-  switch_codec *arg1 = (switch_codec *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_codec *)jarg1; 
-  result = (char *) ((arg1)->fmtp_out);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_codec_settings_set(void * jarg1, void * jarg2) {
-  switch_codec *arg1 = (switch_codec *) 0 ;
-  switch_codec_settings_t *arg2 = (switch_codec_settings_t *) 0 ;
-  
-  arg1 = (switch_codec *)jarg1; 
-  arg2 = (switch_codec_settings_t *)jarg2; 
-  if (arg1) (arg1)->codec_settings = *arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_codec_settings_get(void * jarg1) {
-  void * jresult ;
-  switch_codec *arg1 = (switch_codec *) 0 ;
-  switch_codec_settings_t *result = 0 ;
-  
-  arg1 = (switch_codec *)jarg1; 
-  result = (switch_codec_settings_t *)& ((arg1)->codec_settings);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_flags_set(void * jarg1, unsigned long jarg2) {
-  switch_codec *arg1 = (switch_codec *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_codec *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->flags = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_codec_flags_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_codec *arg1 = (switch_codec *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_codec *)jarg1; 
-  result = (uint32_t) ((arg1)->flags);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_memory_pool_set(void * jarg1, void * jarg2) {
-  switch_codec *arg1 = (switch_codec *) 0 ;
-  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
-  
-  arg1 = (switch_codec *)jarg1; 
-  arg2 = (switch_memory_pool_t *)jarg2; 
-  if (arg1) (arg1)->memory_pool = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_memory_pool_get(void * jarg1) {
-  void * jresult ;
-  switch_codec *arg1 = (switch_codec *) 0 ;
-  switch_memory_pool_t *result = 0 ;
-  
-  arg1 = (switch_codec *)jarg1; 
-  result = (switch_memory_pool_t *) ((arg1)->memory_pool);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_private_info_set(void * jarg1, void * jarg2) {
-  switch_codec *arg1 = (switch_codec *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_codec *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->private_info = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_private_info_get(void * jarg1) {
-  void * jresult ;
-  switch_codec *arg1 = (switch_codec *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_codec *)jarg1; 
-  result = (void *) ((arg1)->private_info);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_agreed_pt_set(void * jarg1, unsigned char jarg2) {
-  switch_codec *arg1 = (switch_codec *) 0 ;
-  switch_payload_t arg2 ;
-  
-  arg1 = (switch_codec *)jarg1; 
-  arg2 = (switch_payload_t)jarg2; 
-  if (arg1) (arg1)->agreed_pt = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_codec_agreed_pt_get(void * jarg1) {
-  unsigned char jresult ;
-  switch_codec *arg1 = (switch_codec *) 0 ;
-  switch_payload_t result;
-  
-  arg1 = (switch_codec *)jarg1; 
-  result = (switch_payload_t) ((arg1)->agreed_pt);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_mutex_set(void * jarg1, void * jarg2) {
-  switch_codec *arg1 = (switch_codec *) 0 ;
-  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
-  
-  arg1 = (switch_codec *)jarg1; 
-  arg2 = (switch_mutex_t *)jarg2; 
-  if (arg1) (arg1)->mutex = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_mutex_get(void * jarg1) {
-  void * jresult ;
-  switch_codec *arg1 = (switch_codec *) 0 ;
-  switch_mutex_t *result = 0 ;
-  
-  arg1 = (switch_codec *)jarg1; 
-  result = (switch_mutex_t *) ((arg1)->mutex);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_codec() {
-  void * jresult ;
-  switch_codec *result = 0 ;
-  
-  result = (switch_codec *)new switch_codec();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_codec(void * jarg1) {
-  switch_codec *arg1 = (switch_codec *) 0 ;
-  
-  arg1 = (switch_codec *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_codec_type_set(void * jarg1, int jarg2) {
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  switch_codec_type_t arg2 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  arg2 = (switch_codec_type_t)jarg2; 
-  if (arg1) (arg1)->codec_type = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_implementation_codec_type_get(void * jarg1) {
-  int jresult ;
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  switch_codec_type_t result;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  result = (switch_codec_type_t) ((arg1)->codec_type);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_ianacode_set(void * jarg1, unsigned char jarg2) {
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  switch_payload_t arg2 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  arg2 = (switch_payload_t)jarg2; 
-  if (arg1) (arg1)->ianacode = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_codec_implementation_ianacode_get(void * jarg1) {
-  unsigned char jresult ;
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  switch_payload_t result;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  result = (switch_payload_t) ((arg1)->ianacode);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_iananame_set(void * jarg1, char * jarg2) {
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->iananame) delete [] arg1->iananame;
-    if (arg2) {
-      arg1->iananame = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->iananame, (const char *)arg2);
-    } else {
-      arg1->iananame = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_codec_implementation_iananame_get(void * jarg1) {
-  char * jresult ;
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  result = (char *) ((arg1)->iananame);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_fmtp_set(void * jarg1, char * jarg2) {
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->fmtp) delete [] arg1->fmtp;
-    if (arg2) {
-      arg1->fmtp = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->fmtp, (const char *)arg2);
-    } else {
-      arg1->fmtp = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_codec_implementation_fmtp_get(void * jarg1) {
-  char * jresult ;
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  result = (char *) ((arg1)->fmtp);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_samples_per_second_set(void * jarg1, unsigned long jarg2) {
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->samples_per_second = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_codec_implementation_samples_per_second_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  result = (uint32_t) ((arg1)->samples_per_second);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_actual_samples_per_second_set(void * jarg1, unsigned long jarg2) {
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->actual_samples_per_second = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_codec_implementation_actual_samples_per_second_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  result = (uint32_t) ((arg1)->actual_samples_per_second);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_bits_per_second_set(void * jarg1, int jarg2) {
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->bits_per_second = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_implementation_bits_per_second_get(void * jarg1) {
-  int jresult ;
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  int result;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  result = (int) ((arg1)->bits_per_second);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_microseconds_per_packet_set(void * jarg1, int jarg2) {
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->microseconds_per_packet = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_implementation_microseconds_per_packet_get(void * jarg1) {
-  int jresult ;
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  int result;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  result = (int) ((arg1)->microseconds_per_packet);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_samples_per_packet_set(void * jarg1, unsigned long jarg2) {
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->samples_per_packet = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_codec_implementation_samples_per_packet_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  result = (uint32_t) ((arg1)->samples_per_packet);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_decoded_bytes_per_packet_set(void * jarg1, unsigned long jarg2) {
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->decoded_bytes_per_packet = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_codec_implementation_decoded_bytes_per_packet_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  result = (uint32_t) ((arg1)->decoded_bytes_per_packet);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_encoded_bytes_per_packet_set(void * jarg1, unsigned long jarg2) {
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->encoded_bytes_per_packet = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_codec_implementation_encoded_bytes_per_packet_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  result = (uint32_t) ((arg1)->encoded_bytes_per_packet);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_number_of_channels_set(void * jarg1, unsigned char jarg2) {
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  uint8_t arg2 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  arg2 = (uint8_t)jarg2; 
-  if (arg1) (arg1)->number_of_channels = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_codec_implementation_number_of_channels_get(void * jarg1) {
-  unsigned char jresult ;
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  uint8_t result;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  result = (uint8_t) ((arg1)->number_of_channels);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_codec_frames_per_packet_set(void * jarg1, int jarg2) {
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->codec_frames_per_packet = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_implementation_codec_frames_per_packet_get(void * jarg1) {
-  int jresult ;
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  int result;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  result = (int) ((arg1)->codec_frames_per_packet);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_init_set(void * jarg1, void * jarg2) {
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  switch_core_codec_init_func_t arg2 = (switch_core_codec_init_func_t) 0 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  arg2 = (switch_core_codec_init_func_t)jarg2; 
-  if (arg1) (arg1)->init = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_implementation_init_get(void * jarg1) {
-  void * jresult ;
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  switch_core_codec_init_func_t result;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  result = (switch_core_codec_init_func_t) ((arg1)->init);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_encode_set(void * jarg1, void * jarg2) {
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  switch_core_codec_encode_func_t arg2 = (switch_core_codec_encode_func_t) 0 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  arg2 = (switch_core_codec_encode_func_t)jarg2; 
-  if (arg1) (arg1)->encode = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_implementation_encode_get(void * jarg1) {
-  void * jresult ;
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  switch_core_codec_encode_func_t result;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  result = (switch_core_codec_encode_func_t) ((arg1)->encode);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_decode_set(void * jarg1, void * jarg2) {
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  switch_core_codec_decode_func_t arg2 = (switch_core_codec_decode_func_t) 0 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  arg2 = (switch_core_codec_decode_func_t)jarg2; 
-  if (arg1) (arg1)->decode = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_implementation_decode_get(void * jarg1) {
-  void * jresult ;
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  switch_core_codec_decode_func_t result;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  result = (switch_core_codec_decode_func_t) ((arg1)->decode);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_destroy_set(void * jarg1, void * jarg2) {
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  switch_core_codec_destroy_func_t arg2 = (switch_core_codec_destroy_func_t) 0 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  arg2 = (switch_core_codec_destroy_func_t)jarg2; 
-  if (arg1) (arg1)->destroy = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_implementation_destroy_get(void * jarg1) {
-  void * jresult ;
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  switch_core_codec_destroy_func_t result;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  result = (switch_core_codec_destroy_func_t) ((arg1)->destroy);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_codec_id_set(void * jarg1, unsigned long jarg2) {
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->codec_id = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_codec_implementation_codec_id_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  result = (uint32_t) ((arg1)->codec_id);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_impl_id_set(void * jarg1, unsigned long jarg2) {
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->impl_id = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_codec_implementation_impl_id_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  result = (uint32_t) ((arg1)->impl_id);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_next_set(void * jarg1, void * jarg2) {
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  switch_codec_implementation *arg2 = (switch_codec_implementation *) 0 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  arg2 = (switch_codec_implementation *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_implementation_next_get(void * jarg1) {
-  void * jresult ;
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  switch_codec_implementation *result = 0 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  result = (switch_codec_implementation *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_codec_implementation() {
-  void * jresult ;
-  switch_codec_implementation *result = 0 ;
-  
-  result = (switch_codec_implementation *)new switch_codec_implementation();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_codec_implementation(void * jarg1) {
-  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
-  
-  arg1 = (switch_codec_implementation *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_interface_interface_name_set(void * jarg1, char * jarg2) {
-  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_codec_interface *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->interface_name, (const char *)arg2);
-    } else {
-      arg1->interface_name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_codec_interface_interface_name_get(void * jarg1) {
-  char * jresult ;
-  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_codec_interface *)jarg1; 
-  result = (char *) ((arg1)->interface_name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_interface_implementations_set(void * jarg1, void * jarg2) {
-  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
-  switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
-  
-  arg1 = (switch_codec_interface *)jarg1; 
-  arg2 = (switch_codec_implementation_t *)jarg2; 
-  if (arg1) (arg1)->implementations = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_interface_implementations_get(void * jarg1) {
-  void * jresult ;
-  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
-  switch_codec_implementation_t *result = 0 ;
-  
-  arg1 = (switch_codec_interface *)jarg1; 
-  result = (switch_codec_implementation_t *) ((arg1)->implementations);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_interface_codec_id_set(void * jarg1, unsigned long jarg2) {
-  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_codec_interface *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->codec_id = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_codec_interface_codec_id_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_codec_interface *)jarg1; 
-  result = (uint32_t) ((arg1)->codec_id);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_interface_rwlock_set(void * jarg1, void * jarg2) {
-  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
-  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
-  
-  arg1 = (switch_codec_interface *)jarg1; 
-  arg2 = (switch_thread_rwlock_t *)jarg2; 
-  if (arg1) (arg1)->rwlock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_interface_rwlock_get(void * jarg1) {
-  void * jresult ;
-  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
-  switch_thread_rwlock_t *result = 0 ;
-  
-  arg1 = (switch_codec_interface *)jarg1; 
-  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_interface_refs_set(void * jarg1, int jarg2) {
-  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_codec_interface *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->refs = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_interface_refs_get(void * jarg1) {
-  int jresult ;
-  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
-  int result;
-  
-  arg1 = (switch_codec_interface *)jarg1; 
-  result = (int) ((arg1)->refs);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_interface_reflock_set(void * jarg1, void * jarg2) {
-  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
-  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
-  
-  arg1 = (switch_codec_interface *)jarg1; 
-  arg2 = (switch_mutex_t *)jarg2; 
-  if (arg1) (arg1)->reflock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_interface_reflock_get(void * jarg1) {
-  void * jresult ;
-  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
-  switch_mutex_t *result = 0 ;
-  
-  arg1 = (switch_codec_interface *)jarg1; 
-  result = (switch_mutex_t *) ((arg1)->reflock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_interface_parent_set(void * jarg1, void * jarg2) {
-  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
-  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
-  
-  arg1 = (switch_codec_interface *)jarg1; 
-  arg2 = (switch_loadable_module_interface_t *)jarg2; 
-  if (arg1) (arg1)->parent = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_interface_parent_get(void * jarg1) {
-  void * jresult ;
-  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
-  switch_loadable_module_interface_t *result = 0 ;
-  
-  arg1 = (switch_codec_interface *)jarg1; 
-  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_interface_next_set(void * jarg1, void * jarg2) {
-  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
-  switch_codec_interface *arg2 = (switch_codec_interface *) 0 ;
-  
-  arg1 = (switch_codec_interface *)jarg1; 
-  arg2 = (switch_codec_interface *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_interface_next_get(void * jarg1) {
-  void * jresult ;
-  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
-  switch_codec_interface *result = 0 ;
-  
-  arg1 = (switch_codec_interface *)jarg1; 
-  result = (switch_codec_interface *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_codec_interface() {
-  void * jresult ;
-  switch_codec_interface *result = 0 ;
-  
-  result = (switch_codec_interface *)new switch_codec_interface();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_codec_interface(void * jarg1) {
-  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
-  
-  arg1 = (switch_codec_interface *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_interface_name_set(void * jarg1, char * jarg2) {
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->interface_name, (const char *)arg2);
-    } else {
-      arg1->interface_name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_application_interface_interface_name_get(void * jarg1) {
-  char * jresult ;
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  result = (char *) ((arg1)->interface_name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_application_function_set(void * jarg1, void * jarg2) {
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  switch_application_function_t arg2 = (switch_application_function_t) 0 ;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  arg2 = (switch_application_function_t)jarg2; 
-  if (arg1) (arg1)->application_function = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_application_interface_application_function_get(void * jarg1) {
-  void * jresult ;
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  switch_application_function_t result;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  result = (switch_application_function_t) ((arg1)->application_function);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_long_desc_set(void * jarg1, char * jarg2) {
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->long_desc = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->long_desc, (const char *)arg2);
-    } else {
-      arg1->long_desc = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_application_interface_long_desc_get(void * jarg1) {
-  char * jresult ;
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  result = (char *) ((arg1)->long_desc);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_short_desc_set(void * jarg1, char * jarg2) {
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->short_desc = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->short_desc, (const char *)arg2);
-    } else {
-      arg1->short_desc = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_application_interface_short_desc_get(void * jarg1) {
-  char * jresult ;
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  result = (char *) ((arg1)->short_desc);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_syntax_set(void * jarg1, char * jarg2) {
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->syntax = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->syntax, (const char *)arg2);
-    } else {
-      arg1->syntax = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_application_interface_syntax_get(void * jarg1) {
-  char * jresult ;
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  result = (char *) ((arg1)->syntax);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_flags_set(void * jarg1, unsigned long jarg2) {
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->flags = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_application_interface_flags_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  result = (uint32_t) ((arg1)->flags);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_rwlock_set(void * jarg1, void * jarg2) {
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  arg2 = (switch_thread_rwlock_t *)jarg2; 
-  if (arg1) (arg1)->rwlock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_application_interface_rwlock_get(void * jarg1) {
-  void * jresult ;
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  switch_thread_rwlock_t *result = 0 ;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_refs_set(void * jarg1, int jarg2) {
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->refs = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_application_interface_refs_get(void * jarg1) {
-  int jresult ;
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  int result;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  result = (int) ((arg1)->refs);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_reflock_set(void * jarg1, void * jarg2) {
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  arg2 = (switch_mutex_t *)jarg2; 
-  if (arg1) (arg1)->reflock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_application_interface_reflock_get(void * jarg1) {
-  void * jresult ;
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  switch_mutex_t *result = 0 ;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  result = (switch_mutex_t *) ((arg1)->reflock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_parent_set(void * jarg1, void * jarg2) {
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  arg2 = (switch_loadable_module_interface_t *)jarg2; 
-  if (arg1) (arg1)->parent = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_application_interface_parent_get(void * jarg1) {
-  void * jresult ;
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  switch_loadable_module_interface_t *result = 0 ;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_next_set(void * jarg1, void * jarg2) {
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  switch_application_interface *arg2 = (switch_application_interface *) 0 ;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  arg2 = (switch_application_interface *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_application_interface_next_get(void * jarg1) {
-  void * jresult ;
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  switch_application_interface *result = 0 ;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  result = (switch_application_interface *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_application_interface() {
-  void * jresult ;
-  switch_application_interface *result = 0 ;
-  
-  result = (switch_application_interface *)new switch_application_interface();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_application_interface(void * jarg1) {
-  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
-  
-  arg1 = (switch_application_interface *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_api_interface_interface_name_set(void * jarg1, char * jarg2) {
-  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_api_interface *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->interface_name, (const char *)arg2);
-    } else {
-      arg1->interface_name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_api_interface_interface_name_get(void * jarg1) {
-  char * jresult ;
-  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_api_interface *)jarg1; 
-  result = (char *) ((arg1)->interface_name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_api_interface_desc_set(void * jarg1, char * jarg2) {
-  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_api_interface *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->desc = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->desc, (const char *)arg2);
-    } else {
-      arg1->desc = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_api_interface_desc_get(void * jarg1) {
-  char * jresult ;
-  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_api_interface *)jarg1; 
-  result = (char *) ((arg1)->desc);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_api_interface_function_set(void * jarg1, void * jarg2) {
-  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
-  switch_api_function_t arg2 = (switch_api_function_t) 0 ;
-  
-  arg1 = (switch_api_interface *)jarg1; 
-  arg2 = (switch_api_function_t)jarg2; 
-  if (arg1) (arg1)->function = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_api_interface_function_get(void * jarg1) {
-  void * jresult ;
-  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
-  switch_api_function_t result;
-  
-  arg1 = (switch_api_interface *)jarg1; 
-  result = (switch_api_function_t) ((arg1)->function);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_api_interface_syntax_set(void * jarg1, char * jarg2) {
-  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_api_interface *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) {
-      arg1->syntax = (char const *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->syntax, (const char *)arg2);
-    } else {
-      arg1->syntax = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_api_interface_syntax_get(void * jarg1) {
-  char * jresult ;
-  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_api_interface *)jarg1; 
-  result = (char *) ((arg1)->syntax);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_api_interface_rwlock_set(void * jarg1, void * jarg2) {
-  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
-  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
-  
-  arg1 = (switch_api_interface *)jarg1; 
-  arg2 = (switch_thread_rwlock_t *)jarg2; 
-  if (arg1) (arg1)->rwlock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_api_interface_rwlock_get(void * jarg1) {
-  void * jresult ;
-  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
-  switch_thread_rwlock_t *result = 0 ;
-  
-  arg1 = (switch_api_interface *)jarg1; 
-  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_api_interface_refs_set(void * jarg1, int jarg2) {
-  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_api_interface *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->refs = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_api_interface_refs_get(void * jarg1) {
-  int jresult ;
-  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
-  int result;
-  
-  arg1 = (switch_api_interface *)jarg1; 
-  result = (int) ((arg1)->refs);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_api_interface_reflock_set(void * jarg1, void * jarg2) {
-  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
-  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
-  
-  arg1 = (switch_api_interface *)jarg1; 
-  arg2 = (switch_mutex_t *)jarg2; 
-  if (arg1) (arg1)->reflock = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_api_interface_reflock_get(void * jarg1) {
-  void * jresult ;
-  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
-  switch_mutex_t *result = 0 ;
-  
-  arg1 = (switch_api_interface *)jarg1; 
-  result = (switch_mutex_t *) ((arg1)->reflock);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_api_interface_parent_set(void * jarg1, void * jarg2) {
-  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
-  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
-  
-  arg1 = (switch_api_interface *)jarg1; 
-  arg2 = (switch_loadable_module_interface_t *)jarg2; 
-  if (arg1) (arg1)->parent = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_api_interface_parent_get(void * jarg1) {
-  void * jresult ;
-  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
-  switch_loadable_module_interface_t *result = 0 ;
-  
-  arg1 = (switch_api_interface *)jarg1; 
-  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_api_interface_next_set(void * jarg1, void * jarg2) {
-  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
-  switch_api_interface *arg2 = (switch_api_interface *) 0 ;
-  
-  arg1 = (switch_api_interface *)jarg1; 
-  arg2 = (switch_api_interface *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_api_interface_next_get(void * jarg1) {
-  void * jresult ;
-  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
-  switch_api_interface *result = 0 ;
-  
-  arg1 = (switch_api_interface *)jarg1; 
-  result = (switch_api_interface *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_api_interface() {
-  void * jresult ;
-  switch_api_interface *result = 0 ;
-  
-  result = (switch_api_interface *)new switch_api_interface();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_api_interface(void * jarg1) {
-  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
-  
-  arg1 = (switch_api_interface *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_profile_created_set(void * jarg1, void * jarg2) {
-  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
-  switch_time_t arg2 ;
-  switch_time_t *argp2 ;
-  
-  arg1 = (switch_channel_timetable *)jarg1; 
-  argp2 = (switch_time_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->profile_created = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_timetable_profile_created_get(void * jarg1) {
-  void * jresult ;
-  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
-  switch_time_t result;
-  
-  arg1 = (switch_channel_timetable *)jarg1; 
-  result =  ((arg1)->profile_created);
-  jresult = new switch_time_t((switch_time_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_created_set(void * jarg1, void * jarg2) {
-  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
-  switch_time_t arg2 ;
-  switch_time_t *argp2 ;
-  
-  arg1 = (switch_channel_timetable *)jarg1; 
-  argp2 = (switch_time_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->created = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_timetable_created_get(void * jarg1) {
-  void * jresult ;
-  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
-  switch_time_t result;
-  
-  arg1 = (switch_channel_timetable *)jarg1; 
-  result =  ((arg1)->created);
-  jresult = new switch_time_t((switch_time_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_answered_set(void * jarg1, void * jarg2) {
-  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
-  switch_time_t arg2 ;
-  switch_time_t *argp2 ;
-  
-  arg1 = (switch_channel_timetable *)jarg1; 
-  argp2 = (switch_time_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->answered = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_timetable_answered_get(void * jarg1) {
-  void * jresult ;
-  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
-  switch_time_t result;
-  
-  arg1 = (switch_channel_timetable *)jarg1; 
-  result =  ((arg1)->answered);
-  jresult = new switch_time_t((switch_time_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_progress_set(void * jarg1, void * jarg2) {
-  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
-  switch_time_t arg2 ;
-  switch_time_t *argp2 ;
-  
-  arg1 = (switch_channel_timetable *)jarg1; 
-  argp2 = (switch_time_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->progress = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_timetable_progress_get(void * jarg1) {
-  void * jresult ;
-  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
-  switch_time_t result;
-  
-  arg1 = (switch_channel_timetable *)jarg1; 
-  result =  ((arg1)->progress);
-  jresult = new switch_time_t((switch_time_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_progress_media_set(void * jarg1, void * jarg2) {
-  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
-  switch_time_t arg2 ;
-  switch_time_t *argp2 ;
-  
-  arg1 = (switch_channel_timetable *)jarg1; 
-  argp2 = (switch_time_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->progress_media = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_timetable_progress_media_get(void * jarg1) {
-  void * jresult ;
-  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
-  switch_time_t result;
-  
-  arg1 = (switch_channel_timetable *)jarg1; 
-  result =  ((arg1)->progress_media);
-  jresult = new switch_time_t((switch_time_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_hungup_set(void * jarg1, void * jarg2) {
-  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
-  switch_time_t arg2 ;
-  switch_time_t *argp2 ;
-  
-  arg1 = (switch_channel_timetable *)jarg1; 
-  argp2 = (switch_time_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->hungup = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_timetable_hungup_get(void * jarg1) {
-  void * jresult ;
-  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
-  switch_time_t result;
-  
-  arg1 = (switch_channel_timetable *)jarg1; 
-  result =  ((arg1)->hungup);
-  jresult = new switch_time_t((switch_time_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_transferred_set(void * jarg1, void * jarg2) {
-  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
-  switch_time_t arg2 ;
-  switch_time_t *argp2 ;
-  
-  arg1 = (switch_channel_timetable *)jarg1; 
-  argp2 = (switch_time_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->transferred = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_timetable_transferred_get(void * jarg1) {
-  void * jresult ;
-  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
-  switch_time_t result;
-  
-  arg1 = (switch_channel_timetable *)jarg1; 
-  result =  ((arg1)->transferred);
-  jresult = new switch_time_t((switch_time_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_next_set(void * jarg1, void * jarg2) {
-  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
-  switch_channel_timetable *arg2 = (switch_channel_timetable *) 0 ;
-  
-  arg1 = (switch_channel_timetable *)jarg1; 
-  arg2 = (switch_channel_timetable *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_timetable_next_get(void * jarg1) {
-  void * jresult ;
-  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
-  switch_channel_timetable *result = 0 ;
-  
-  arg1 = (switch_channel_timetable *)jarg1; 
-  result = (switch_channel_timetable *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_channel_timetable() {
-  void * jresult ;
-  switch_channel_timetable *result = 0 ;
-  
-  result = (switch_channel_timetable *)new switch_channel_timetable();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_channel_timetable(void * jarg1) {
-  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
-  
-  arg1 = (switch_channel_timetable *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_get_state(void * jarg1) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_channel_state_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  result = (switch_channel_state_t)switch_channel_get_state(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_get_running_state(void * jarg1) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_channel_state_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  result = (switch_channel_state_t)switch_channel_get_running_state(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_test_ready(void * jarg1, int jarg2) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_bool_t arg2 ;
-  int result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_bool_t)jarg2; 
-  result = (int)switch_channel_test_ready(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_wait_for_state(void * jarg1, void * jarg2, int jarg3) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_channel_t *arg2 = (switch_channel_t *) 0 ;
-  switch_channel_state_t arg3 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_channel_t *)jarg2; 
-  arg3 = (switch_channel_state_t)jarg3; 
-  switch_channel_wait_for_state(arg1,arg2,arg3);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_wait_for_state_timeout(void * jarg1, int jarg2, unsigned long jarg3) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_channel_state_t arg2 ;
-  uint32_t arg3 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_channel_state_t)jarg2; 
-  arg3 = (uint32_t)jarg3; 
-  switch_channel_wait_for_state_timeout(arg1,arg2,arg3);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_wait_for_flag(void * jarg1, int jarg2, int jarg3, unsigned long jarg4, void * jarg5) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_channel_flag_t arg2 ;
-  switch_bool_t arg3 ;
-  uint32_t arg4 ;
-  switch_channel_t *arg5 = (switch_channel_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_channel_flag_t)jarg2; 
-  arg3 = (switch_bool_t)jarg3; 
-  arg4 = (uint32_t)jarg4; 
-  arg5 = (switch_channel_t *)jarg5; 
-  result = (switch_status_t)switch_channel_wait_for_flag(arg1,arg2,arg3,arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_set_state(void * jarg1, char * jarg2, char * jarg3, int jarg4, int jarg5) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  switch_channel_state_t arg5 ;
-  switch_channel_state_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (int)jarg4; 
-  arg5 = (switch_channel_state_t)jarg5; 
-  result = (switch_channel_state_t)switch_channel_perform_set_state(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_set_running_state(void * jarg1, int jarg2, char * jarg3, char * jarg4, int jarg5) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_channel_state_t arg2 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  int arg5 ;
-  switch_channel_state_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_channel_state_t)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (int)jarg5; 
-  result = (switch_channel_state_t)switch_channel_perform_set_running_state(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_str2cause(char * jarg1) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_call_cause_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_call_cause_t)switch_channel_str2cause((char const *)arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_get_cause(void * jarg1) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_call_cause_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  result = (switch_call_cause_t)switch_channel_get_cause(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_cause_q850(int jarg1) {
-  int jresult ;
-  switch_call_cause_t arg1 ;
-  switch_call_cause_t result;
-  
-  arg1 = (switch_call_cause_t)jarg1; 
-  result = (switch_call_cause_t)switch_channel_cause_q850(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_get_cause_q850(void * jarg1) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_call_cause_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  result = (switch_call_cause_t)switch_channel_get_cause_q850(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_cause2str(int jarg1) {
-  char * jresult ;
-  switch_call_cause_t arg1 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_call_cause_t)jarg1; 
-  result = (char *)switch_channel_cause2str(arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_timetable(void * jarg1) {
-  void * jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_channel_timetable_t *result = 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  result = (switch_channel_timetable_t *)switch_channel_get_timetable(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_alloc(void * jarg1, int jarg2, void * jarg3) {
-  int jresult ;
-  switch_channel_t **arg1 = (switch_channel_t **) 0 ;
-  switch_call_direction_t arg2 ;
-  switch_memory_pool_t *arg3 = (switch_memory_pool_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t **)jarg1; 
-  arg2 = (switch_call_direction_t)jarg2; 
-  arg3 = (switch_memory_pool_t *)jarg3; 
-  result = (switch_status_t)switch_channel_alloc(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_init(void * jarg1, void * jarg2, int jarg3, int jarg4) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
-  switch_channel_state_t arg3 ;
-  switch_channel_flag_t arg4 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_core_session_t *)jarg2; 
-  arg3 = (switch_channel_state_t)jarg3; 
-  arg4 = (switch_channel_flag_t)jarg4; 
-  result = (switch_status_t)switch_channel_init(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_presence(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  switch_channel_presence(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_uninit(void * jarg1) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  switch_channel_uninit(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_caller_profile(void * jarg1, void * jarg2) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_caller_profile_t *arg2 = (switch_caller_profile_t *) 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_caller_profile_t *)jarg2; 
-  switch_channel_set_caller_profile(arg1,arg2);
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_caller_profile(void * jarg1) {
-  void * jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_caller_profile_t *result = 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  result = (switch_caller_profile_t *)switch_channel_get_caller_profile(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_originator_caller_profile(void * jarg1, void * jarg2) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_caller_profile_t *arg2 = (switch_caller_profile_t *) 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_caller_profile_t *)jarg2; 
-  switch_channel_set_originator_caller_profile(arg1,arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_hunt_caller_profile(void * jarg1, void * jarg2) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_caller_profile_t *arg2 = (switch_caller_profile_t *) 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_caller_profile_t *)jarg2; 
-  switch_channel_set_hunt_caller_profile(arg1,arg2);
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_originator_caller_profile(void * jarg1) {
-  void * jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_caller_profile_t *result = 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  result = (switch_caller_profile_t *)switch_channel_get_originator_caller_profile(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_originatee_caller_profile(void * jarg1, void * jarg2) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_caller_profile_t *arg2 = (switch_caller_profile_t *) 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_caller_profile_t *)jarg2; 
-  switch_channel_set_originatee_caller_profile(arg1,arg2);
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_originatee_caller_profile(void * jarg1) {
-  void * jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_caller_profile_t *result = 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  result = (switch_caller_profile_t *)switch_channel_get_originatee_caller_profile(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_uuid(void * jarg1) {
-  char * jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  result = (char *)switch_channel_get_uuid(arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_profile_var(void * jarg1, char * jarg2, char * jarg3) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (switch_status_t)switch_channel_set_profile_var(arg1,(char const *)arg2,(char const *)arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_variable_var_check(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  switch_bool_t arg4 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (switch_bool_t)jarg4; 
-  result = (switch_status_t)switch_channel_set_variable_var_check(arg1,(char const *)arg2,(char const *)arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_variable_printf(void * jarg1, char * jarg2, char * jarg3) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  void *arg4 = 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (switch_status_t)switch_channel_set_variable_printf(arg1,(char const *)arg2,(char const *)arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_variable_partner_var_check(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  switch_bool_t arg4 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (switch_bool_t)jarg4; 
-  result = (switch_status_t)switch_channel_set_variable_partner_var_check(arg1,(char const *)arg2,(char const *)arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_variable_partner(void * jarg1, char * jarg2) {
-  char * jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (char *)switch_channel_get_variable_partner(arg1,(char const *)arg2);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_variable(void * jarg1, char * jarg2) {
-  char * jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (char *)switch_channel_get_variable(arg1,(char const *)arg2);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_get_variables(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_event_t **arg2 = (switch_event_t **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_event_t **)jarg2; 
-  result = (switch_status_t)switch_channel_get_variables(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_pass_callee_id(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_channel_t *arg2 = (switch_channel_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_channel_t *)jarg2; 
-  result = (switch_status_t)switch_channel_pass_callee_id(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_variable_first(void * jarg1) {
-  void * jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_event_header_t *result = 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  result = (switch_event_header_t *)switch_channel_variable_first(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_variable_last(void * jarg1) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  switch_channel_variable_last(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_restart(void * jarg1) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  switch_channel_restart(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_caller_extension_masquerade(void * jarg1, void * jarg2, unsigned long jarg3) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_channel_t *arg2 = (switch_channel_t *) 0 ;
-  uint32_t arg3 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_channel_t *)jarg2; 
-  arg3 = (uint32_t)jarg3; 
-  result = (switch_status_t)switch_channel_caller_extension_masquerade(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_caller_extension(void * jarg1, void * jarg2) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_caller_extension_t *arg2 = (switch_caller_extension_t *) 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_caller_extension_t *)jarg2; 
-  switch_channel_set_caller_extension(arg1,arg2);
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_caller_extension(void * jarg1) {
-  void * jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_caller_extension_t *result = 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  result = (switch_caller_extension_t *)switch_channel_get_caller_extension(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_channel_test_flag(void * jarg1, int jarg2) {
-  unsigned long jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_channel_flag_t arg2 ;
-  uint32_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_channel_flag_t)jarg2; 
-  result = (uint32_t)switch_channel_test_flag(arg1,arg2);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_flag(void * jarg1, int jarg2) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_channel_flag_t arg2 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_channel_flag_t)jarg2; 
-  switch_channel_set_flag(arg1,arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_flag_recursive(void * jarg1, int jarg2) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_channel_flag_t arg2 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_channel_flag_t)jarg2; 
-  switch_channel_set_flag_recursive(arg1,arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_cap(void * jarg1, int jarg2) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_channel_cap_t arg2 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_channel_cap_t)jarg2; 
-  switch_channel_set_cap(arg1,arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_clear_cap(void * jarg1, int jarg2) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_channel_cap_t arg2 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_channel_cap_t)jarg2; 
-  switch_channel_clear_cap(arg1,arg2);
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_channel_test_cap(void * jarg1, int jarg2) {
-  unsigned long jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_channel_cap_t arg2 ;
-  uint32_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_channel_cap_t)jarg2; 
-  result = (uint32_t)switch_channel_test_cap(arg1,arg2);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_flag_partner(void * jarg1, int jarg2) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_channel_flag_t arg2 ;
-  switch_bool_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_channel_flag_t)jarg2; 
-  result = (switch_bool_t)switch_channel_set_flag_partner(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_clear_flag_partner(void * jarg1, int jarg2) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_channel_flag_t arg2 ;
-  switch_bool_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_channel_flag_t)jarg2; 
-  result = (switch_bool_t)switch_channel_clear_flag_partner(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_channel_test_flag_partner(void * jarg1, int jarg2) {
-  unsigned long jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_channel_flag_t arg2 ;
-  uint32_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_channel_flag_t)jarg2; 
-  result = (uint32_t)switch_channel_test_flag_partner(arg1,arg2);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_state_flag(void * jarg1, int jarg2) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_channel_flag_t arg2 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_channel_flag_t)jarg2; 
-  switch_channel_set_state_flag(arg1,arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_clear_flag(void * jarg1, int jarg2) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_channel_flag_t arg2 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_channel_flag_t)jarg2; 
-  switch_channel_clear_flag(arg1,arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_clear_flag_recursive(void * jarg1, int jarg2) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_channel_flag_t arg2 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_channel_flag_t)jarg2; 
-  switch_channel_clear_flag_recursive(arg1,arg2);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_answer(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (int)jarg4; 
-  result = (switch_status_t)switch_channel_perform_answer(arg1,(char const *)arg2,(char const *)arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_mark_answered(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (int)jarg4; 
-  result = (switch_status_t)switch_channel_perform_mark_answered(arg1,(char const *)arg2,(char const *)arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_ring_ready(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (int)jarg4; 
-  result = (switch_status_t)switch_channel_perform_ring_ready(arg1,(char const *)arg2,(char const *)arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_pre_answer(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (int)jarg4; 
-  result = (switch_status_t)switch_channel_perform_pre_answer(arg1,(char const *)arg2,(char const *)arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_mark_pre_answered(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (int)jarg4; 
-  result = (switch_status_t)switch_channel_perform_mark_pre_answered(arg1,(char const *)arg2,(char const *)arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_mark_ring_ready(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (int)jarg4; 
-  result = (switch_status_t)switch_channel_perform_mark_ring_ready(arg1,(char const *)arg2,(char const *)arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_add_state_handler(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_state_handler_table_t *arg2 = (switch_state_handler_table_t *) 0 ;
-  int result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_state_handler_table_t *)jarg2; 
-  result = (int)switch_channel_add_state_handler(arg1,(switch_state_handler_table const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_clear_state_handler(void * jarg1, void * jarg2) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_state_handler_table_t *arg2 = (switch_state_handler_table_t *) 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_state_handler_table_t *)jarg2; 
-  switch_channel_clear_state_handler(arg1,(switch_state_handler_table const *)arg2);
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_state_handler(void * jarg1, int jarg2) {
-  void * jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  int arg2 ;
-  switch_state_handler_table_t *result = 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (int)jarg2; 
-  result = (switch_state_handler_table_t *)switch_channel_get_state_handler(arg1,arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_private(void * jarg1, char * jarg2, void * jarg3) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *arg3 = (void *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (void *)jarg3; 
-  result = (switch_status_t)switch_channel_set_private(arg1,(char const *)arg2,(void const *)arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_private(void * jarg1, char * jarg2) {
-  void * jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (void *)switch_channel_get_private(arg1,(char const *)arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_name(void * jarg1, char * jarg2) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_status_t)switch_channel_set_name(arg1,(char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_name(void * jarg1) {
-  char * jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  result = (char *)switch_channel_get_name(arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_hangup(void * jarg1, char * jarg2, char * jarg3, int jarg4, int jarg5) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  switch_call_cause_t arg5 ;
-  switch_channel_state_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (int)jarg4; 
-  arg5 = (switch_call_cause_t)jarg5; 
-  result = (switch_channel_state_t)switch_channel_perform_hangup(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_has_dtmf(void * jarg1) {
-  void * jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  result = switch_channel_has_dtmf(arg1);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_queue_dtmf(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_dtmf_t *arg2 = (switch_dtmf_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_dtmf_t *)jarg2; 
-  result = (switch_status_t)switch_channel_queue_dtmf(arg1,(switch_dtmf_t const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_queue_dtmf_string(void * jarg1, char * jarg2) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_status_t)switch_channel_queue_dtmf_string(arg1,(char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_dequeue_dtmf(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_dtmf_t *arg2 = (switch_dtmf_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_dtmf_t *)jarg2; 
-  result = (switch_status_t)switch_channel_dequeue_dtmf(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_flush_dtmf(void * jarg1) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  switch_channel_flush_dtmf(arg1);
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_dequeue_dtmf_string(void * jarg1, char * jarg2, void * jarg3) {
-  void * jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_size_t arg3 ;
-  switch_size_t result;
-  switch_size_t *argp3 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  argp3 = (switch_size_t *)jarg3; 
-  if (!argp3) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg3 = *argp3; 
-  result = switch_channel_dequeue_dtmf_string(arg1,arg2,arg3);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_state_name(int jarg1) {
-  char * jresult ;
-  switch_channel_state_t arg1 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_channel_state_t)jarg1; 
-  result = (char *)switch_channel_state_name(arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_name_state(char * jarg1) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_channel_state_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_channel_state_t)switch_channel_name_state((char const *)arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_event_set_data(void * jarg1, void * jarg2) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_event_t *arg2 = (switch_event_t *) 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_event_t *)jarg2; 
-  switch_channel_event_set_data(arg1,arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_event_set_basic_data(void * jarg1, void * jarg2) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_event_t *arg2 = (switch_event_t *) 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_event_t *)jarg2; 
-  switch_channel_event_set_basic_data(arg1,arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_event_set_extended_data(void * jarg1, void * jarg2) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_event_t *arg2 = (switch_event_t *) 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_event_t *)jarg2; 
-  switch_channel_event_set_extended_data(arg1,arg2);
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_expand_variables(void * jarg1, char * jarg2) {
-  char * jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (char *)switch_channel_expand_variables(arg1,(char const *)arg2);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_build_param_string(void * jarg1, void * jarg2, char * jarg3) {
-  char * jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_caller_profile_t *arg2 = (switch_caller_profile_t *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (switch_caller_profile_t *)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (char *)switch_channel_build_param_string(arg1,arg2,(char const *)arg3);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_timestamps(void * jarg1) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  result = (switch_status_t)switch_channel_set_timestamps(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_audio_sync(void * jarg1) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  switch_channel_audio_sync(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_private_flag(void * jarg1, unsigned long jarg2) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  switch_channel_set_private_flag(arg1,arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_clear_private_flag(void * jarg1, unsigned long jarg2) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  switch_channel_clear_private_flag(arg1,arg2);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_test_private_flag(void * jarg1, unsigned long jarg2) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  uint32_t arg2 ;
-  int result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  result = (int)switch_channel_test_private_flag(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_app_flag(void * jarg1, unsigned long jarg2) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  switch_channel_set_app_flag(arg1,arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_clear_app_flag(void * jarg1, unsigned long jarg2) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  switch_channel_clear_app_flag(arg1,arg2);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_test_app_flag(void * jarg1, unsigned long jarg2) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  uint32_t arg2 ;
-  int result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  result = (int)switch_channel_test_app_flag(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_hangup_time(void * jarg1) {
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  switch_channel_set_hangup_time(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_direction(void * jarg1) {
-  int jresult ;
-  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
-  switch_call_direction_t result;
-  
-  arg1 = (switch_channel_t *)jarg1; 
-  result = (switch_call_direction_t)switch_channel_direction(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_buffer_create(void * jarg1, void * jarg2, void * jarg3) {
-  int jresult ;
-  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
-  switch_buffer_t **arg2 = (switch_buffer_t **) 0 ;
-  switch_size_t arg3 ;
-  switch_status_t result;
-  switch_size_t *argp3 ;
-  
-  arg1 = (switch_memory_pool_t *)jarg1; 
-  arg2 = (switch_buffer_t **)jarg2; 
-  argp3 = (switch_size_t *)jarg3; 
-  if (!argp3) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg3 = *argp3; 
-  result = (switch_status_t)switch_buffer_create(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_buffer_create_dynamic(void * jarg1, void * jarg2, void * jarg3, void * jarg4) {
-  int jresult ;
-  switch_buffer_t **arg1 = (switch_buffer_t **) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t arg3 ;
-  switch_size_t arg4 ;
-  switch_status_t result;
-  switch_size_t *argp2 ;
-  switch_size_t *argp3 ;
-  switch_size_t *argp4 ;
-  
-  arg1 = (switch_buffer_t **)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg2 = *argp2; 
-  argp3 = (switch_size_t *)jarg3; 
-  if (!argp3) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg3 = *argp3; 
-  argp4 = (switch_size_t *)jarg4; 
-  if (!argp4) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg4 = *argp4; 
-  result = (switch_status_t)switch_buffer_create_dynamic(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_buffer_add_mutex(void * jarg1, void * jarg2) {
-  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
-  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
-  
-  arg1 = (switch_buffer_t *)jarg1; 
-  arg2 = (switch_mutex_t *)jarg2; 
-  switch_buffer_add_mutex(arg1,arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_buffer_lock(void * jarg1) {
-  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
-  
-  arg1 = (switch_buffer_t *)jarg1; 
-  switch_buffer_lock(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_buffer_trylock(void * jarg1) {
-  int jresult ;
-  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_buffer_t *)jarg1; 
-  result = (switch_status_t)switch_buffer_trylock(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_buffer_unlock(void * jarg1) {
-  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
-  
-  arg1 = (switch_buffer_t *)jarg1; 
-  switch_buffer_unlock(arg1);
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_buffer_len(void * jarg1) {
-  void * jresult ;
-  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_buffer_t *)jarg1; 
-  result = switch_buffer_len(arg1);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_buffer_freespace(void * jarg1) {
-  void * jresult ;
-  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_buffer_t *)jarg1; 
-  result = switch_buffer_freespace(arg1);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_buffer_inuse(void * jarg1) {
-  void * jresult ;
-  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_buffer_t *)jarg1; 
-  result = switch_buffer_inuse(arg1);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_buffer_read(void * jarg1, void * jarg2, void * jarg3) {
-  void * jresult ;
-  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  switch_size_t arg3 ;
-  switch_size_t result;
-  switch_size_t *argp3 ;
-  
-  arg1 = (switch_buffer_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  argp3 = (switch_size_t *)jarg3; 
-  if (!argp3) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg3 = *argp3; 
-  result = switch_buffer_read(arg1,arg2,arg3);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_buffer_read_loop(void * jarg1, void * jarg2, void * jarg3) {
-  void * jresult ;
-  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  switch_size_t arg3 ;
-  switch_size_t result;
-  switch_size_t *argp3 ;
-  
-  arg1 = (switch_buffer_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  argp3 = (switch_size_t *)jarg3; 
-  if (!argp3) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg3 = *argp3; 
-  result = switch_buffer_read_loop(arg1,arg2,arg3);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_buffer_set_loops(void * jarg1, int jarg2) {
-  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
-  int32_t arg2 ;
-  
-  arg1 = (switch_buffer_t *)jarg1; 
-  arg2 = (int32_t)jarg2; 
-  switch_buffer_set_loops(arg1,arg2);
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_buffer_write(void * jarg1, void * jarg2, void * jarg3) {
-  void * jresult ;
-  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  switch_size_t arg3 ;
-  switch_size_t result;
-  switch_size_t *argp3 ;
-  
-  arg1 = (switch_buffer_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  argp3 = (switch_size_t *)jarg3; 
-  if (!argp3) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg3 = *argp3; 
-  result = switch_buffer_write(arg1,(void const *)arg2,arg3);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_buffer_toss(void * jarg1, void * jarg2) {
-  void * jresult ;
-  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t result;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_buffer_t *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg2 = *argp2; 
-  result = switch_buffer_toss(arg1,arg2);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_buffer_zero(void * jarg1) {
-  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
-  
-  arg1 = (switch_buffer_t *)jarg1; 
-  switch_buffer_zero(arg1);
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_buffer_slide_write(void * jarg1, void * jarg2, void * jarg3) {
-  void * jresult ;
-  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  switch_size_t arg3 ;
-  switch_size_t result;
-  switch_size_t *argp3 ;
-  
-  arg1 = (switch_buffer_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  argp3 = (switch_size_t *)jarg3; 
-  if (!argp3) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg3 = *argp3; 
-  result = switch_buffer_slide_write(arg1,(void const *)arg2,arg3);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_buffer_destroy(void * jarg1) {
-  switch_buffer_t **arg1 = (switch_buffer_t **) 0 ;
-  
-  arg1 = (switch_buffer_t **)jarg1; 
-  switch_buffer_destroy(arg1);
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_buffer_zwrite(void * jarg1, void * jarg2, void * jarg3) {
-  void * jresult ;
-  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  switch_size_t arg3 ;
-  switch_size_t result;
-  switch_size_t *argp3 ;
-  
-  arg1 = (switch_buffer_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  argp3 = (switch_size_t *)jarg3; 
-  if (!argp3) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg3 = *argp3; 
-  result = switch_buffer_zwrite(arg1,(void const *)arg2,arg3);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_header_name_set(void * jarg1, char * jarg2) {
-  switch_event_header *arg1 = (switch_event_header *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_event_header *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->name) delete [] arg1->name;
-    if (arg2) {
-      arg1->name = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->name, (const char *)arg2);
-    } else {
-      arg1->name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_header_name_get(void * jarg1) {
-  char * jresult ;
-  switch_event_header *arg1 = (switch_event_header *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_event_header *)jarg1; 
-  result = (char *) ((arg1)->name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_header_value_set(void * jarg1, char * jarg2) {
-  switch_event_header *arg1 = (switch_event_header *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_event_header *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->value) delete [] arg1->value;
-    if (arg2) {
-      arg1->value = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->value, (const char *)arg2);
-    } else {
-      arg1->value = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_header_value_get(void * jarg1) {
-  char * jresult ;
-  switch_event_header *arg1 = (switch_event_header *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_event_header *)jarg1; 
-  result = (char *) ((arg1)->value);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_header_hash_set(void * jarg1, unsigned long jarg2) {
-  switch_event_header *arg1 = (switch_event_header *) 0 ;
-  unsigned long arg2 ;
-  
-  arg1 = (switch_event_header *)jarg1; 
-  arg2 = (unsigned long)jarg2; 
-  if (arg1) (arg1)->hash = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_event_header_hash_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_event_header *arg1 = (switch_event_header *) 0 ;
-  unsigned long result;
-  
-  arg1 = (switch_event_header *)jarg1; 
-  result = (unsigned long) ((arg1)->hash);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_header_next_set(void * jarg1, void * jarg2) {
-  switch_event_header *arg1 = (switch_event_header *) 0 ;
-  switch_event_header *arg2 = (switch_event_header *) 0 ;
-  
-  arg1 = (switch_event_header *)jarg1; 
-  arg2 = (switch_event_header *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_event_header_next_get(void * jarg1) {
-  void * jresult ;
-  switch_event_header *arg1 = (switch_event_header *) 0 ;
-  switch_event_header *result = 0 ;
-  
-  arg1 = (switch_event_header *)jarg1; 
-  result = (switch_event_header *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_event_header() {
-  void * jresult ;
-  switch_event_header *result = 0 ;
-  
-  result = (switch_event_header *)new switch_event_header();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_event_header(void * jarg1) {
-  switch_event_header *arg1 = (switch_event_header *) 0 ;
-  
-  arg1 = (switch_event_header *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_event_id_set(void * jarg1, int jarg2) {
-  switch_event *arg1 = (switch_event *) 0 ;
-  switch_event_types_t arg2 ;
-  
-  arg1 = (switch_event *)jarg1; 
-  arg2 = (switch_event_types_t)jarg2; 
-  if (arg1) (arg1)->event_id = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_event_id_get(void * jarg1) {
-  int jresult ;
-  switch_event *arg1 = (switch_event *) 0 ;
-  switch_event_types_t result;
-  
-  arg1 = (switch_event *)jarg1; 
-  result = (switch_event_types_t) ((arg1)->event_id);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_priority_set(void * jarg1, int jarg2) {
-  switch_event *arg1 = (switch_event *) 0 ;
-  switch_priority_t arg2 ;
-  
-  arg1 = (switch_event *)jarg1; 
-  arg2 = (switch_priority_t)jarg2; 
-  if (arg1) (arg1)->priority = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_priority_get(void * jarg1) {
-  int jresult ;
-  switch_event *arg1 = (switch_event *) 0 ;
-  switch_priority_t result;
-  
-  arg1 = (switch_event *)jarg1; 
-  result = (switch_priority_t) ((arg1)->priority);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_owner_set(void * jarg1, char * jarg2) {
-  switch_event *arg1 = (switch_event *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_event *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->owner) delete [] arg1->owner;
-    if (arg2) {
-      arg1->owner = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->owner, (const char *)arg2);
-    } else {
-      arg1->owner = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_owner_get(void * jarg1) {
-  char * jresult ;
-  switch_event *arg1 = (switch_event *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_event *)jarg1; 
-  result = (char *) ((arg1)->owner);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_subclass_name_set(void * jarg1, char * jarg2) {
-  switch_event *arg1 = (switch_event *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_event *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->subclass_name) delete [] arg1->subclass_name;
-    if (arg2) {
-      arg1->subclass_name = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->subclass_name, (const char *)arg2);
-    } else {
-      arg1->subclass_name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_subclass_name_get(void * jarg1) {
-  char * jresult ;
-  switch_event *arg1 = (switch_event *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_event *)jarg1; 
-  result = (char *) ((arg1)->subclass_name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_headers_set(void * jarg1, void * jarg2) {
-  switch_event *arg1 = (switch_event *) 0 ;
-  switch_event_header_t *arg2 = (switch_event_header_t *) 0 ;
-  
-  arg1 = (switch_event *)jarg1; 
-  arg2 = (switch_event_header_t *)jarg2; 
-  if (arg1) (arg1)->headers = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_event_headers_get(void * jarg1) {
-  void * jresult ;
-  switch_event *arg1 = (switch_event *) 0 ;
-  switch_event_header_t *result = 0 ;
-  
-  arg1 = (switch_event *)jarg1; 
-  result = (switch_event_header_t *) ((arg1)->headers);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_last_header_set(void * jarg1, void * jarg2) {
-  switch_event *arg1 = (switch_event *) 0 ;
-  switch_event_header_t *arg2 = (switch_event_header_t *) 0 ;
-  
-  arg1 = (switch_event *)jarg1; 
-  arg2 = (switch_event_header_t *)jarg2; 
-  if (arg1) (arg1)->last_header = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_event_last_header_get(void * jarg1) {
-  void * jresult ;
-  switch_event *arg1 = (switch_event *) 0 ;
-  switch_event_header_t *result = 0 ;
-  
-  arg1 = (switch_event *)jarg1; 
-  result = (switch_event_header_t *) ((arg1)->last_header);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_body_set(void * jarg1, char * jarg2) {
-  switch_event *arg1 = (switch_event *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_event *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->body) delete [] arg1->body;
-    if (arg2) {
-      arg1->body = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->body, (const char *)arg2);
-    } else {
-      arg1->body = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_body_get(void * jarg1) {
-  char * jresult ;
-  switch_event *arg1 = (switch_event *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_event *)jarg1; 
-  result = (char *) ((arg1)->body);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_bind_user_data_set(void * jarg1, void * jarg2) {
-  switch_event *arg1 = (switch_event *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_event *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->bind_user_data = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_event_bind_user_data_get(void * jarg1) {
-  void * jresult ;
-  switch_event *arg1 = (switch_event *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_event *)jarg1; 
-  result = (void *) ((arg1)->bind_user_data);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_event_user_data_set(void * jarg1, void * jarg2) {
-  switch_event *arg1 = (switch_event *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_event *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->event_user_data = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_event_event_user_data_get(void * jarg1) {
-  void * jresult ;
-  switch_event *arg1 = (switch_event *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_event *)jarg1; 
-  result = (void *) ((arg1)->event_user_data);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_key_set(void * jarg1, unsigned long jarg2) {
-  switch_event *arg1 = (switch_event *) 0 ;
-  unsigned long arg2 ;
-  
-  arg1 = (switch_event *)jarg1; 
-  arg2 = (unsigned long)jarg2; 
-  if (arg1) (arg1)->key = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_event_key_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_event *arg1 = (switch_event *) 0 ;
-  unsigned long result;
-  
-  arg1 = (switch_event *)jarg1; 
-  result = (unsigned long) ((arg1)->key);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_next_set(void * jarg1, void * jarg2) {
-  switch_event *arg1 = (switch_event *) 0 ;
-  switch_event *arg2 = (switch_event *) 0 ;
-  
-  arg1 = (switch_event *)jarg1; 
-  arg2 = (switch_event *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_event_next_get(void * jarg1) {
-  void * jresult ;
-  switch_event *arg1 = (switch_event *) 0 ;
-  switch_event *result = 0 ;
-  
-  arg1 = (switch_event *)jarg1; 
-  result = (switch_event *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_flags_set(void * jarg1, int jarg2) {
-  switch_event *arg1 = (switch_event *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_event *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->flags = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_flags_get(void * jarg1) {
-  int jresult ;
-  switch_event *arg1 = (switch_event *) 0 ;
-  int result;
-  
-  arg1 = (switch_event *)jarg1; 
-  result = (int) ((arg1)->flags);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_event() {
-  void * jresult ;
-  switch_event *result = 0 ;
-  
-  result = (switch_event *)new switch_event();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_event(void * jarg1) {
-  switch_event *arg1 = (switch_event *) 0 ;
-  
-  arg1 = (switch_event *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_init(void * jarg1) {
-  int jresult ;
-  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_memory_pool_t *)jarg1; 
-  result = (switch_status_t)switch_event_init(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_shutdown() {
-  int jresult ;
-  switch_status_t result;
-  
-  result = (switch_status_t)switch_event_shutdown();
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_create_subclass_detailed(char * jarg1, char * jarg2, int jarg3, void * jarg4, int jarg5, char * jarg6) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int arg3 ;
-  switch_event_t **arg4 = (switch_event_t **) 0 ;
-  switch_event_types_t arg5 ;
-  char *arg6 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (int)jarg3; 
-  arg4 = (switch_event_t **)jarg4; 
-  arg5 = (switch_event_types_t)jarg5; 
-  arg6 = (char *)jarg6; 
-  result = (switch_status_t)switch_event_create_subclass_detailed((char const *)arg1,(char const *)arg2,arg3,arg4,arg5,(char const *)arg6);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_set_priority(void * jarg1, int jarg2) {
-  int jresult ;
-  switch_event_t *arg1 = (switch_event_t *) 0 ;
-  switch_priority_t arg2 ;
-  switch_status_t result;
-  
-  arg1 = (switch_event_t *)jarg1; 
-  arg2 = (switch_priority_t)jarg2; 
-  result = (switch_status_t)switch_event_set_priority(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_get_header(void * jarg1, char * jarg2) {
-  char * jresult ;
-  switch_event_t *arg1 = (switch_event_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_event_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (char *)switch_event_get_header(arg1,(char const *)arg2);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_get_body(void * jarg1) {
-  char * jresult ;
-  switch_event_t *arg1 = (switch_event_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_event_t *)jarg1; 
-  result = (char *)switch_event_get_body(arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_set_subclass_name(void * jarg1, char * jarg2) {
-  int jresult ;
-  switch_event_t *arg1 = (switch_event_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_event_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_status_t)switch_event_set_subclass_name(arg1,(char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_add_header_string(void * jarg1, int jarg2, char * jarg3, char * jarg4) {
-  int jresult ;
-  switch_event_t *arg1 = (switch_event_t *) 0 ;
-  switch_stack_t arg2 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_event_t *)jarg1; 
-  arg2 = (switch_stack_t)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  result = (switch_status_t)switch_event_add_header_string(arg1,arg2,(char const *)arg3,(char const *)arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_del_header(void * jarg1, char * jarg2) {
-  int jresult ;
-  switch_event_t *arg1 = (switch_event_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_event_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_status_t)switch_event_del_header(arg1,(char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_destroy(void * jarg1) {
-  switch_event_t **arg1 = (switch_event_t **) 0 ;
-  
-  arg1 = (switch_event_t **)jarg1; 
-  switch_event_destroy(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_dup(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_event_t **arg1 = (switch_event_t **) 0 ;
-  switch_event_t *arg2 = (switch_event_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_event_t **)jarg1; 
-  arg2 = (switch_event_t *)jarg2; 
-  result = (switch_status_t)switch_event_dup(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_fire_detailed(char * jarg1, char * jarg2, int jarg3, void * jarg4, void * jarg5) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int arg3 ;
-  switch_event_t **arg4 = (switch_event_t **) 0 ;
-  void *arg5 = (void *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (int)jarg3; 
-  arg4 = (switch_event_t **)jarg4; 
-  arg5 = (void *)jarg5; 
-  result = (switch_status_t)switch_event_fire_detailed((char const *)arg1,(char const *)arg2,arg3,arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_prep_for_delivery_detailed(char * jarg1, char * jarg2, int jarg3, void * jarg4) {
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int arg3 ;
-  switch_event_t *arg4 = (switch_event_t *) 0 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (int)jarg3; 
-  arg4 = (switch_event_t *)jarg4; 
-  switch_event_prep_for_delivery_detailed((char const *)arg1,(char const *)arg2,arg3,arg4);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_bind(char * jarg1, int jarg2, char * jarg3, void * jarg4, void * jarg5) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_event_types_t arg2 ;
-  char *arg3 = (char *) 0 ;
-  switch_event_callback_t arg4 = (switch_event_callback_t) 0 ;
-  void *arg5 = (void *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_event_types_t)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (switch_event_callback_t)jarg4; 
-  arg5 = (void *)jarg5; 
-  result = (switch_status_t)switch_event_bind((char const *)arg1,arg2,(char const *)arg3,arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_bind_removable(char * jarg1, int jarg2, char * jarg3, void * jarg4, void * jarg5, void * jarg6) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_event_types_t arg2 ;
-  char *arg3 = (char *) 0 ;
-  switch_event_callback_t arg4 = (switch_event_callback_t) 0 ;
-  void *arg5 = (void *) 0 ;
-  switch_event_node_t **arg6 = (switch_event_node_t **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_event_types_t)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (switch_event_callback_t)jarg4; 
-  arg5 = (void *)jarg5; 
-  arg6 = (switch_event_node_t **)jarg6; 
-  result = (switch_status_t)switch_event_bind_removable((char const *)arg1,arg2,(char const *)arg3,arg4,arg5,arg6);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_unbind(void * jarg1) {
-  int jresult ;
-  switch_event_node_t **arg1 = (switch_event_node_t **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_event_node_t **)jarg1; 
-  result = (switch_status_t)switch_event_unbind(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_unbind_callback(void * jarg1) {
-  int jresult ;
-  switch_event_callback_t arg1 = (switch_event_callback_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_event_callback_t)jarg1; 
-  result = (switch_status_t)switch_event_unbind_callback(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_name(int jarg1) {
-  char * jresult ;
-  switch_event_types_t arg1 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_event_types_t)jarg1; 
-  result = (char *)switch_event_name(arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_name_event(char * jarg1, void * jarg2) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_event_types_t *arg2 = (switch_event_types_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_event_types_t *)jarg2; 
-  result = (switch_status_t)switch_name_event((char const *)arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_reserve_subclass_detailed(char * jarg1, char * jarg2) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_status_t)switch_event_reserve_subclass_detailed((char const *)arg1,(char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_free_subclass_detailed(char * jarg1, char * jarg2) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_status_t)switch_event_free_subclass_detailed((char const *)arg1,(char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_serialize(void * jarg1, void * jarg2, int jarg3) {
-  int jresult ;
-  switch_event_t *arg1 = (switch_event_t *) 0 ;
-  char **arg2 = (char **) 0 ;
-  switch_bool_t arg3 ;
-  switch_status_t result;
-  
-  arg1 = (switch_event_t *)jarg1; 
-  arg2 = (char **)jarg2; 
-  arg3 = (switch_bool_t)jarg3; 
-  result = (switch_status_t)switch_event_serialize(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_running() {
-  int jresult ;
-  switch_status_t result;
-  
-  result = (switch_status_t)switch_event_running();
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_expand_headers(void * jarg1, char * jarg2) {
-  char * jresult ;
-  switch_event_t *arg1 = (switch_event_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_event_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (char *)switch_event_expand_headers(arg1,(char const *)arg2);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_create_pres_in_detailed(char * jarg1, char * jarg2, int jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, int jarg11, char * jarg12, char * jarg13, char * jarg14, char * jarg15) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int arg3 ;
-  char *arg4 = (char *) 0 ;
-  char *arg5 = (char *) 0 ;
-  char *arg6 = (char *) 0 ;
-  char *arg7 = (char *) 0 ;
-  char *arg8 = (char *) 0 ;
-  char *arg9 = (char *) 0 ;
-  char *arg10 = (char *) 0 ;
-  int arg11 ;
-  char *arg12 = (char *) 0 ;
-  char *arg13 = (char *) 0 ;
-  char *arg14 = (char *) 0 ;
-  char *arg15 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (int)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (char *)jarg5; 
-  arg6 = (char *)jarg6; 
-  arg7 = (char *)jarg7; 
-  arg8 = (char *)jarg8; 
-  arg9 = (char *)jarg9; 
-  arg10 = (char *)jarg10; 
-  arg11 = (int)jarg11; 
-  arg12 = (char *)jarg12; 
-  arg13 = (char *)jarg13; 
-  arg14 = (char *)jarg14; 
-  arg15 = (char *)jarg15; 
-  result = (switch_status_t)switch_event_create_pres_in_detailed(arg1,arg2,arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,arg11,(char const *)arg12,(char const *)arg13,(char const *)arg14,(char const *)arg15);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_create_plain(void * jarg1, int jarg2) {
-  int jresult ;
-  switch_event_t **arg1 = (switch_event_t **) 0 ;
-  switch_event_types_t arg2 ;
-  switch_status_t result;
-  
-  arg1 = (switch_event_t **)jarg1; 
-  arg2 = (switch_event_types_t)jarg2; 
-  result = (switch_status_t)switch_event_create_plain(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_deliver(void * jarg1) {
-  switch_event_t **arg1 = (switch_event_t **) 0 ;
-  
-  arg1 = (switch_event_t **)jarg1; 
-  switch_event_deliver(arg1);
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_build_param_string(void * jarg1, char * jarg2, void * jarg3) {
-  char * jresult ;
-  switch_event_t *arg1 = (switch_event_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_hash_t *arg3 = (switch_hash_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_event_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_hash_t *)jarg3; 
-  result = (char *)switch_event_build_param_string(arg1,(char const *)arg2,arg3);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RESAMPLE_QUALITY_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 2;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_audio_resampler_t_resampler_set(void * jarg1, void * jarg2) {
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->resampler = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_audio_resampler_t_resampler_get(void * jarg1) {
-  void * jresult ;
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  result = (void *) ((arg1)->resampler);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_audio_resampler_t_from_rate_set(void * jarg1, int jarg2) {
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->from_rate = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_audio_resampler_t_from_rate_get(void * jarg1) {
-  int jresult ;
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  int result;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  result = (int) ((arg1)->from_rate);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_audio_resampler_t_to_rate_set(void * jarg1, int jarg2) {
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->to_rate = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_audio_resampler_t_to_rate_get(void * jarg1) {
-  int jresult ;
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  int result;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  result = (int) ((arg1)->to_rate);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_audio_resampler_t_factor_set(void * jarg1, double jarg2) {
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  double arg2 ;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  arg2 = (double)jarg2; 
-  if (arg1) (arg1)->factor = arg2;
-  
-}
-
-
-SWIGEXPORT double SWIGSTDCALL CSharp_switch_audio_resampler_t_factor_get(void * jarg1) {
-  double jresult ;
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  double result;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  result = (double) ((arg1)->factor);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_audio_resampler_t_rfactor_set(void * jarg1, double jarg2) {
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  double arg2 ;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  arg2 = (double)jarg2; 
-  if (arg1) (arg1)->rfactor = arg2;
-  
-}
-
-
-SWIGEXPORT double SWIGSTDCALL CSharp_switch_audio_resampler_t_rfactor_get(void * jarg1) {
-  double jresult ;
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  double result;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  result = (double) ((arg1)->rfactor);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_audio_resampler_t_to_set(void * jarg1, void * jarg2) {
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  int16_t *arg2 = (int16_t *) 0 ;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  arg2 = (int16_t *)jarg2; 
-  if (arg1) (arg1)->to = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_audio_resampler_t_to_get(void * jarg1) {
-  void * jresult ;
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  int16_t *result = 0 ;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  result = (int16_t *) ((arg1)->to);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_audio_resampler_t_to_len_set(void * jarg1, unsigned long jarg2) {
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->to_len = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_audio_resampler_t_to_len_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  result = (uint32_t) ((arg1)->to_len);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_audio_resampler_t_to_size_set(void * jarg1, unsigned long jarg2) {
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->to_size = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_audio_resampler_t_to_size_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  result = (uint32_t) ((arg1)->to_size);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_audio_resampler_t() {
-  void * jresult ;
-  switch_audio_resampler_t *result = 0 ;
-  
-  result = (switch_audio_resampler_t *)new switch_audio_resampler_t();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_audio_resampler_t(void * jarg1) {
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_resample_perform_create(void * jarg1, unsigned long jarg2, unsigned long jarg3, unsigned long jarg4, int jarg5, unsigned long jarg6, char * jarg7, char * jarg8, int jarg9) {
-  int jresult ;
-  switch_audio_resampler_t **arg1 = (switch_audio_resampler_t **) 0 ;
-  uint32_t arg2 ;
-  uint32_t arg3 ;
-  uint32_t arg4 ;
-  int arg5 ;
-  uint32_t arg6 ;
-  char *arg7 = (char *) 0 ;
-  char *arg8 = (char *) 0 ;
-  int arg9 ;
-  switch_status_t result;
-  
-  arg1 = (switch_audio_resampler_t **)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  arg3 = (uint32_t)jarg3; 
-  arg4 = (uint32_t)jarg4; 
-  arg5 = (int)jarg5; 
-  arg6 = (uint32_t)jarg6; 
-  arg7 = (char *)jarg7; 
-  arg8 = (char *)jarg8; 
-  arg9 = (int)jarg9; 
-  result = (switch_status_t)switch_resample_perform_create(arg1,arg2,arg3,arg4,arg5,arg6,(char const *)arg7,(char const *)arg8,arg9);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_resample_destroy(void * jarg1) {
-  switch_audio_resampler_t **arg1 = (switch_audio_resampler_t **) 0 ;
-  
-  arg1 = (switch_audio_resampler_t **)jarg1; 
-  switch_resample_destroy(arg1);
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_resample_process(void * jarg1, void * jarg2, unsigned long jarg3) {
-  unsigned long jresult ;
-  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
-  int16_t *arg2 = (int16_t *) 0 ;
-  uint32_t arg3 ;
-  uint32_t result;
-  
-  arg1 = (switch_audio_resampler_t *)jarg1; 
-  arg2 = (int16_t *)jarg2; 
-  arg3 = (uint32_t)jarg3; 
-  result = (uint32_t)switch_resample_process(arg1,arg2,arg3);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_float_to_short(void * jarg1, void * jarg2, void * jarg3) {
-  void * jresult ;
-  float *arg1 = (float *) 0 ;
-  short *arg2 = (short *) 0 ;
-  switch_size_t arg3 ;
-  switch_size_t result;
-  switch_size_t *argp3 ;
-  
-  arg1 = (float *)jarg1; 
-  arg2 = (short *)jarg2; 
-  argp3 = (switch_size_t *)jarg3; 
-  if (!argp3) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg3 = *argp3; 
-  result = switch_float_to_short(arg1,arg2,arg3);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_char_to_float(char * jarg1, void * jarg2, int jarg3) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  float *arg2 = (float *) 0 ;
-  int arg3 ;
-  int result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (float *)jarg2; 
-  arg3 = (int)jarg3; 
-  result = (int)switch_char_to_float(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_float_to_char(void * jarg1, char * jarg2, int jarg3) {
-  int jresult ;
-  float *arg1 = (float *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int arg3 ;
-  int result;
-  
-  arg1 = (float *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (int)jarg3; 
-  result = (int)switch_float_to_char(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_short_to_float(void * jarg1, void * jarg2, int jarg3) {
-  int jresult ;
-  short *arg1 = (short *) 0 ;
-  float *arg2 = (float *) 0 ;
-  int arg3 ;
-  int result;
-  
-  arg1 = (short *)jarg1; 
-  arg2 = (float *)jarg2; 
-  arg3 = (int)jarg3; 
-  result = (int)switch_short_to_float(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_swap_linear(void * jarg1, int jarg2) {
-  int16_t *arg1 = (int16_t *) 0 ;
-  int arg2 ;
-  
-  arg1 = (int16_t *)jarg1; 
-  arg2 = (int)jarg2; 
-  switch_swap_linear(arg1,arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_generate_sln_silence(void * jarg1, unsigned long jarg2, unsigned long jarg3) {
-  int16_t *arg1 = (int16_t *) 0 ;
-  uint32_t arg2 ;
-  uint32_t arg3 ;
-  
-  arg1 = (int16_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  arg3 = (uint32_t)jarg3; 
-  switch_generate_sln_silence(arg1,arg2,arg3);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_change_sln_volume(void * jarg1, unsigned long jarg2, int jarg3) {
-  int16_t *arg1 = (int16_t *) 0 ;
-  uint32_t arg2 ;
-  int32_t arg3 ;
-  
-  arg1 = (int16_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  arg3 = (int32_t)jarg3; 
-  switch_change_sln_volume(arg1,arg2,arg3);
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_merge_sln(void * jarg1, unsigned long jarg2, void * jarg3, unsigned long jarg4) {
-  unsigned long jresult ;
-  int16_t *arg1 = (int16_t *) 0 ;
-  uint32_t arg2 ;
-  int16_t *arg3 = (int16_t *) 0 ;
-  uint32_t arg4 ;
-  uint32_t result;
-  
-  arg1 = (int16_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  arg3 = (int16_t *)jarg3; 
-  arg4 = (uint32_t)jarg4; 
-  result = (uint32_t)switch_merge_sln(arg1,arg2,arg3,arg4);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_mux_channels(void * jarg1, void * jarg2, unsigned long jarg3) {
-  int16_t *arg1 = (int16_t *) 0 ;
-  switch_size_t arg2 ;
-  uint32_t arg3 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (int16_t *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  arg3 = (uint32_t)jarg3; 
-  switch_mux_channels(arg1,arg2,arg3);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_session_set(void * jarg1, void * jarg2) {
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  arg2 = (switch_core_session_t *)jarg2; 
-  if (arg1) (arg1)->session = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_unicast_conninfo_session_get(void * jarg1) {
-  void * jresult ;
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  switch_core_session_t *result = 0 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  result = (switch_core_session_t *) ((arg1)->session);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_read_codec_set(void * jarg1, void * jarg2) {
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  switch_codec_t *arg2 = (switch_codec_t *) 0 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  arg2 = (switch_codec_t *)jarg2; 
-  if (arg1) (arg1)->read_codec = *arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_unicast_conninfo_read_codec_get(void * jarg1) {
-  void * jresult ;
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  switch_codec_t *result = 0 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  result = (switch_codec_t *)& ((arg1)->read_codec);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_write_frame_set(void * jarg1, void * jarg2) {
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  switch_frame_t *arg2 = (switch_frame_t *) 0 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  arg2 = (switch_frame_t *)jarg2; 
-  if (arg1) (arg1)->write_frame = *arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_unicast_conninfo_write_frame_get(void * jarg1) {
-  void * jresult ;
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  switch_frame_t *result = 0 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  result = (switch_frame_t *)& ((arg1)->write_frame);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_write_frame_data_set(void * jarg1, void * jarg2) {
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  switch_byte_t *arg2 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  arg2 = (switch_byte_t *)jarg2; 
-  {
-    size_t ii;
-    switch_byte_t *b = (switch_byte_t *) arg1->write_frame_data;
-    for (ii = 0; ii < (size_t)4096; ii++) b[ii] = *((switch_byte_t *) arg2 + ii);
-  }
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_unicast_conninfo_write_frame_data_get(void * jarg1) {
-  void * jresult ;
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  switch_byte_t *result = 0 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  result = (switch_byte_t *)(switch_byte_t *) ((arg1)->write_frame_data);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_socket_set(void * jarg1, void * jarg2) {
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  switch_socket_t *arg2 = (switch_socket_t *) 0 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  arg2 = (switch_socket_t *)jarg2; 
-  if (arg1) (arg1)->socket = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_unicast_conninfo_socket_get(void * jarg1) {
-  void * jresult ;
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  switch_socket_t *result = 0 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  result = (switch_socket_t *) ((arg1)->socket);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_local_ip_set(void * jarg1, char * jarg2) {
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->local_ip) delete [] arg1->local_ip;
-    if (arg2) {
-      arg1->local_ip = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->local_ip, (const char *)arg2);
-    } else {
-      arg1->local_ip = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_unicast_conninfo_local_ip_get(void * jarg1) {
-  char * jresult ;
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  result = (char *) ((arg1)->local_ip);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_local_port_set(void * jarg1, unsigned short jarg2) {
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  switch_port_t arg2 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  arg2 = (switch_port_t)jarg2; 
-  if (arg1) (arg1)->local_port = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_unicast_conninfo_local_port_get(void * jarg1) {
-  unsigned short jresult ;
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  switch_port_t result;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  result = (switch_port_t) ((arg1)->local_port);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_remote_ip_set(void * jarg1, char * jarg2) {
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->remote_ip) delete [] arg1->remote_ip;
-    if (arg2) {
-      arg1->remote_ip = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->remote_ip, (const char *)arg2);
-    } else {
-      arg1->remote_ip = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_unicast_conninfo_remote_ip_get(void * jarg1) {
-  char * jresult ;
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  result = (char *) ((arg1)->remote_ip);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_remote_port_set(void * jarg1, unsigned short jarg2) {
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  switch_port_t arg2 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  arg2 = (switch_port_t)jarg2; 
-  if (arg1) (arg1)->remote_port = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_unicast_conninfo_remote_port_get(void * jarg1) {
-  unsigned short jresult ;
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  switch_port_t result;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  result = (switch_port_t) ((arg1)->remote_port);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_local_addr_set(void * jarg1, void * jarg2) {
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  switch_sockaddr_t *arg2 = (switch_sockaddr_t *) 0 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  arg2 = (switch_sockaddr_t *)jarg2; 
-  if (arg1) (arg1)->local_addr = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_unicast_conninfo_local_addr_get(void * jarg1) {
-  void * jresult ;
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  switch_sockaddr_t *result = 0 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  result = (switch_sockaddr_t *) ((arg1)->local_addr);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_remote_addr_set(void * jarg1, void * jarg2) {
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  switch_sockaddr_t *arg2 = (switch_sockaddr_t *) 0 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  arg2 = (switch_sockaddr_t *)jarg2; 
-  if (arg1) (arg1)->remote_addr = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_unicast_conninfo_remote_addr_get(void * jarg1) {
-  void * jresult ;
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  switch_sockaddr_t *result = 0 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  result = (switch_sockaddr_t *) ((arg1)->remote_addr);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_flag_mutex_set(void * jarg1, void * jarg2) {
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  arg2 = (switch_mutex_t *)jarg2; 
-  if (arg1) (arg1)->flag_mutex = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_unicast_conninfo_flag_mutex_get(void * jarg1) {
-  void * jresult ;
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  switch_mutex_t *result = 0 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  result = (switch_mutex_t *) ((arg1)->flag_mutex);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_flags_set(void * jarg1, int jarg2) {
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  int32_t arg2 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  arg2 = (int32_t)jarg2; 
-  if (arg1) (arg1)->flags = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_unicast_conninfo_flags_get(void * jarg1) {
-  int jresult ;
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  int32_t result;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  result = (int32_t) ((arg1)->flags);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_type_set(void * jarg1, int jarg2) {
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->type = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_unicast_conninfo_type_get(void * jarg1) {
-  int jresult ;
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  int result;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  result = (int) ((arg1)->type);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_transport_set(void * jarg1, int jarg2) {
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->transport = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_unicast_conninfo_transport_get(void * jarg1) {
-  int jresult ;
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  int result;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  result = (int) ((arg1)->transport);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_stream_id_set(void * jarg1, int jarg2) {
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->stream_id = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_unicast_conninfo_stream_id_get(void * jarg1) {
-  int jresult ;
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  int result;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  result = (int) ((arg1)->stream_id);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_unicast_conninfo() {
-  void * jresult ;
-  switch_unicast_conninfo *result = 0 ;
-  
-  result = (switch_unicast_conninfo *)new switch_unicast_conninfo();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_unicast_conninfo(void * jarg1) {
-  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
-  
-  arg1 = (switch_unicast_conninfo *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_deactivate_unicast(void * jarg1) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_status_t)switch_ivr_deactivate_unicast(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_activate_unicast(void * jarg1, char * jarg2, unsigned short jarg3, char * jarg4, unsigned short jarg5, char * jarg6, char * jarg7) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_port_t arg3 ;
-  char *arg4 = (char *) 0 ;
-  switch_port_t arg5 ;
-  char *arg6 = (char *) 0 ;
-  char *arg7 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_port_t)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (switch_port_t)jarg5; 
-  arg6 = (char *)jarg6; 
-  arg7 = (char *)jarg7; 
-  result = (switch_status_t)switch_ivr_activate_unicast(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_generate_xml_cdr(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_xml_t *arg2 = (switch_xml_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_xml_t *)jarg2; 
-  result = (switch_status_t)switch_ivr_generate_xml_cdr(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_set_xml_profile_data(void * jarg1, void * jarg2, int jarg3) {
-  int jresult ;
-  switch_xml_t arg1 = (switch_xml_t) 0 ;
-  switch_caller_profile_t *arg2 = (switch_caller_profile_t *) 0 ;
-  int arg3 ;
-  int result;
-  
-  arg1 = (switch_xml_t)jarg1; 
-  arg2 = (switch_caller_profile_t *)jarg2; 
-  arg3 = (int)jarg3; 
-  result = (int)switch_ivr_set_xml_profile_data(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_set_xml_chan_vars(void * jarg1, void * jarg2, int jarg3) {
-  int jresult ;
-  switch_xml_t arg1 = (switch_xml_t) 0 ;
-  switch_channel_t *arg2 = (switch_channel_t *) 0 ;
-  int arg3 ;
-  int result;
-  
-  arg1 = (switch_xml_t)jarg1; 
-  arg2 = (switch_channel_t *)jarg2; 
-  arg3 = (int)jarg3; 
-  result = (int)switch_ivr_set_xml_chan_vars(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_parse_event(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_event_t *arg2 = (switch_event_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_event_t *)jarg2; 
-  result = (switch_status_t)switch_ivr_parse_event(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_parse_all_events(void * jarg1) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_status_t)switch_ivr_parse_all_events(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_parse_next_event(void * jarg1) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_status_t)switch_ivr_parse_next_event(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_parse_all_messages(void * jarg1) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_status_t)switch_ivr_parse_all_messages(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_sleep(void * jarg1, unsigned long jarg2, int jarg3, void * jarg4) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  uint32_t arg2 ;
-  switch_bool_t arg3 ;
-  switch_input_args_t *arg4 = (switch_input_args_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  arg3 = (switch_bool_t)jarg3; 
-  arg4 = (switch_input_args_t *)jarg4; 
-  result = (switch_status_t)switch_ivr_sleep(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_park(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_input_args_t *arg2 = (switch_input_args_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_input_args_t *)jarg2; 
-  result = (switch_status_t)switch_ivr_park(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_collect_digits_callback(void * jarg1, void * jarg2, unsigned long jarg3, unsigned long jarg4) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_input_args_t *arg2 = (switch_input_args_t *) 0 ;
-  uint32_t arg3 ;
-  uint32_t arg4 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_input_args_t *)jarg2; 
-  arg3 = (uint32_t)jarg3; 
-  arg4 = (uint32_t)jarg4; 
-  result = (switch_status_t)switch_ivr_collect_digits_callback(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_collect_digits_count(void * jarg1, char * jarg2, void * jarg3, void * jarg4, char * jarg5, char * jarg6, unsigned long jarg7, unsigned long jarg8, unsigned long jarg9) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_size_t arg3 ;
-  switch_size_t arg4 ;
-  char *arg5 = (char *) 0 ;
-  char *arg6 = (char *) 0 ;
-  uint32_t arg7 ;
-  uint32_t arg8 ;
-  uint32_t arg9 ;
-  switch_status_t result;
-  switch_size_t *argp3 ;
-  switch_size_t *argp4 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  argp3 = (switch_size_t *)jarg3; 
-  if (!argp3) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg3 = *argp3; 
-  argp4 = (switch_size_t *)jarg4; 
-  if (!argp4) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg4 = *argp4; 
-  arg5 = (char *)jarg5; 
-  arg6 = (char *)jarg6; 
-  arg7 = (uint32_t)jarg7; 
-  arg8 = (uint32_t)jarg8; 
-  arg9 = (uint32_t)jarg9; 
-  result = (switch_status_t)switch_ivr_collect_digits_count(arg1,arg2,arg3,arg4,(char const *)arg5,arg6,arg7,arg8,arg9);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_detect_speech(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, void * jarg6) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  char *arg5 = (char *) 0 ;
-  switch_asr_handle_t *arg6 = (switch_asr_handle_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (char *)jarg5; 
-  arg6 = (switch_asr_handle_t *)jarg6; 
-  result = (switch_status_t)switch_ivr_detect_speech(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,arg6);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_stop_detect_speech(void * jarg1) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_status_t)switch_ivr_stop_detect_speech(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_pause_detect_speech(void * jarg1) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_status_t)switch_ivr_pause_detect_speech(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_resume_detect_speech(void * jarg1) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_status_t)switch_ivr_resume_detect_speech(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_detect_speech_load_grammar(void * jarg1, char * jarg2, char * jarg3) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (switch_status_t)switch_ivr_detect_speech_load_grammar(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_detect_speech_unload_grammar(void * jarg1, char * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_status_t)switch_ivr_detect_speech_unload_grammar(arg1,(char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_record_session(void * jarg1, char * jarg2, unsigned long jarg3, void * jarg4) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  uint32_t arg3 ;
-  switch_file_handle_t *arg4 = (switch_file_handle_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (uint32_t)jarg3; 
-  arg4 = (switch_file_handle_t *)jarg4; 
-  result = (switch_status_t)switch_ivr_record_session(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_eavesdrop_session(void * jarg1, char * jarg2, char * jarg3, unsigned long jarg4) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  switch_eavesdrop_flag_t arg4 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (switch_eavesdrop_flag_t)jarg4; 
-  result = (switch_status_t)switch_ivr_eavesdrop_session(arg1,(char const *)arg2,(char const *)arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_displace_session(void * jarg1, char * jarg2, unsigned long jarg3, char * jarg4) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  uint32_t arg3 ;
-  char *arg4 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (uint32_t)jarg3; 
-  arg4 = (char *)jarg4; 
-  result = (switch_status_t)switch_ivr_displace_session(arg1,(char const *)arg2,arg3,(char const *)arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_stop_displace_session(void * jarg1, char * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_status_t)switch_ivr_stop_displace_session(arg1,(char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_stop_record_session(void * jarg1, char * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_status_t)switch_ivr_stop_record_session(arg1,(char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_inband_dtmf_session(void * jarg1) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_status_t)switch_ivr_inband_dtmf_session(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_stop_inband_dtmf_session(void * jarg1) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_status_t)switch_ivr_stop_inband_dtmf_session(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_inband_dtmf_generate_session(void * jarg1, int jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_bool_t arg2 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_bool_t)jarg2; 
-  result = (switch_status_t)switch_ivr_inband_dtmf_generate_session(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_stop_inband_dtmf_generate_session(void * jarg1) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_status_t)switch_ivr_stop_inband_dtmf_generate_session(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_session_echo(void * jarg1, void * jarg2) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_input_args_t *arg2 = (switch_input_args_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_input_args_t *)jarg2; 
-  switch_ivr_session_echo(arg1,arg2);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_stop_tone_detect_session(void * jarg1) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_status_t)switch_ivr_stop_tone_detect_session(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_tone_detect_session(void * jarg1, char * jarg2, char * jarg3, char * jarg4, void * jarg5, int jarg6, char * jarg7, char * jarg8, void * jarg9) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  time_t arg5 ;
-  int arg6 ;
-  char *arg7 = (char *) 0 ;
-  char *arg8 = (char *) 0 ;
-  switch_tone_detect_callback_t arg9 = (switch_tone_detect_callback_t) 0 ;
-  switch_status_t result;
-  time_t *argp5 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  argp5 = (time_t *)jarg5; 
-  if (!argp5) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null time_t", 0);
-    return 0;
-  }
-  arg5 = *argp5; 
-  arg6 = (int)jarg6; 
-  arg7 = (char *)jarg7; 
-  arg8 = (char *)jarg8; 
-  arg9 = (switch_tone_detect_callback_t)jarg9; 
-  result = (switch_status_t)switch_ivr_tone_detect_session(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5,arg6,(char const *)arg7,(char const *)arg8,arg9);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_play_file(void * jarg1, void * jarg2, char * jarg3, void * jarg4) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_file_handle_t *arg2 = (switch_file_handle_t *) 0 ;
-  char *arg3 = (char *) 0 ;
-  switch_input_args_t *arg4 = (switch_input_args_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_file_handle_t *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (switch_input_args_t *)jarg4; 
-  result = (switch_status_t)switch_ivr_play_file(arg1,arg2,(char const *)arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_wait_for_silence(void * jarg1, unsigned long jarg2, unsigned long jarg3, unsigned long jarg4, unsigned long jarg5, char * jarg6) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  uint32_t arg2 ;
-  uint32_t arg3 ;
-  uint32_t arg4 ;
-  uint32_t arg5 ;
-  char *arg6 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  arg3 = (uint32_t)jarg3; 
-  arg4 = (uint32_t)jarg4; 
-  arg5 = (uint32_t)jarg5; 
-  arg6 = (char *)jarg6; 
-  result = (switch_status_t)switch_ivr_wait_for_silence(arg1,arg2,arg3,arg4,arg5,(char const *)arg6);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_gentones(void * jarg1, char * jarg2, int jarg3, void * jarg4) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int32_t arg3 ;
-  switch_input_args_t *arg4 = (switch_input_args_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (int32_t)jarg3; 
-  arg4 = (switch_input_args_t *)jarg4; 
-  result = (switch_status_t)switch_ivr_gentones(arg1,(char const *)arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_record_file(void * jarg1, void * jarg2, char * jarg3, void * jarg4, unsigned long jarg5) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_file_handle_t *arg2 = (switch_file_handle_t *) 0 ;
-  char *arg3 = (char *) 0 ;
-  switch_input_args_t *arg4 = (switch_input_args_t *) 0 ;
-  uint32_t arg5 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_file_handle_t *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (switch_input_args_t *)jarg4; 
-  arg5 = (uint32_t)jarg5; 
-  result = (switch_status_t)switch_ivr_record_file(arg1,arg2,(char const *)arg3,arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_play_and_get_digits(void * jarg1, unsigned long jarg2, unsigned long jarg3, unsigned long jarg4, unsigned long jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, unsigned long jarg11, char * jarg12) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  uint32_t arg2 ;
-  uint32_t arg3 ;
-  uint32_t arg4 ;
-  uint32_t arg5 ;
-  char *arg6 = (char *) 0 ;
-  char *arg7 = (char *) 0 ;
-  char *arg8 = (char *) 0 ;
-  char *arg9 = (char *) 0 ;
-  char *arg10 = (char *) 0 ;
-  uint32_t arg11 ;
-  char *arg12 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  arg3 = (uint32_t)jarg3; 
-  arg4 = (uint32_t)jarg4; 
-  arg5 = (uint32_t)jarg5; 
-  arg6 = (char *)jarg6; 
-  arg7 = (char *)jarg7; 
-  arg8 = (char *)jarg8; 
-  arg9 = (char *)jarg9; 
-  arg10 = (char *)jarg10; 
-  arg11 = (uint32_t)jarg11; 
-  arg12 = (char *)jarg12; 
-  result = (switch_status_t)switch_play_and_get_digits(arg1,arg2,arg3,arg4,arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,arg10,arg11,(char const *)arg12);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_speak_text_handle(void * jarg1, void * jarg2, void * jarg3, void * jarg4, char * jarg5, void * jarg6) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_speech_handle_t *arg2 = (switch_speech_handle_t *) 0 ;
-  switch_codec_t *arg3 = (switch_codec_t *) 0 ;
-  switch_timer_t *arg4 = (switch_timer_t *) 0 ;
-  char *arg5 = (char *) 0 ;
-  switch_input_args_t *arg6 = (switch_input_args_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_speech_handle_t *)jarg2; 
-  arg3 = (switch_codec_t *)jarg3; 
-  arg4 = (switch_timer_t *)jarg4; 
-  arg5 = (char *)jarg5; 
-  arg6 = (switch_input_args_t *)jarg6; 
-  result = (switch_status_t)switch_ivr_speak_text_handle(arg1,arg2,arg3,arg4,arg5,arg6);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_clear_speech_cache(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_ivr_clear_speech_cache(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_speak_text(void * jarg1, char * jarg2, char * jarg3, char * jarg4, void * jarg5) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  switch_input_args_t *arg5 = (switch_input_args_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (switch_input_args_t *)jarg5; 
-  result = (switch_status_t)switch_ivr_speak_text(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_originate(void * jarg1, void * jarg2, void * jarg3, char * jarg4, unsigned long jarg5, void * jarg6, char * jarg7, char * jarg8, void * jarg9, void * jarg10, unsigned long jarg11, void * jarg12) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_core_session_t **arg2 = (switch_core_session_t **) 0 ;
-  switch_call_cause_t *arg3 = (switch_call_cause_t *) 0 ;
-  char *arg4 = (char *) 0 ;
-  uint32_t arg5 ;
-  switch_state_handler_table_t *arg6 = (switch_state_handler_table_t *) 0 ;
-  char *arg7 = (char *) 0 ;
-  char *arg8 = (char *) 0 ;
-  switch_caller_profile_t *arg9 = (switch_caller_profile_t *) 0 ;
-  switch_event_t *arg10 = (switch_event_t *) 0 ;
-  switch_originate_flag_t arg11 ;
-  switch_call_cause_t *arg12 = (switch_call_cause_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_core_session_t **)jarg2; 
-  arg3 = (switch_call_cause_t *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (uint32_t)jarg5; 
-  arg6 = (switch_state_handler_table_t *)jarg6; 
-  arg7 = (char *)jarg7; 
-  arg8 = (char *)jarg8; 
-  arg9 = (switch_caller_profile_t *)jarg9; 
-  arg10 = (switch_event_t *)jarg10; 
-  arg11 = (switch_originate_flag_t)jarg11; 
-  arg12 = (switch_call_cause_t *)jarg12; 
-  result = (switch_status_t)switch_ivr_originate(arg1,arg2,arg3,(char const *)arg4,arg5,(switch_state_handler_table const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_enterprise_originate(void * jarg1, void * jarg2, void * jarg3, char * jarg4, unsigned long jarg5, void * jarg6, char * jarg7, char * jarg8, void * jarg9, void * jarg10, unsigned long jarg11) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_core_session_t **arg2 = (switch_core_session_t **) 0 ;
-  switch_call_cause_t *arg3 = (switch_call_cause_t *) 0 ;
-  char *arg4 = (char *) 0 ;
-  uint32_t arg5 ;
-  switch_state_handler_table_t *arg6 = (switch_state_handler_table_t *) 0 ;
-  char *arg7 = (char *) 0 ;
-  char *arg8 = (char *) 0 ;
-  switch_caller_profile_t *arg9 = (switch_caller_profile_t *) 0 ;
-  switch_event_t *arg10 = (switch_event_t *) 0 ;
-  switch_originate_flag_t arg11 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_core_session_t **)jarg2; 
-  arg3 = (switch_call_cause_t *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (uint32_t)jarg5; 
-  arg6 = (switch_state_handler_table_t *)jarg6; 
-  arg7 = (char *)jarg7; 
-  arg8 = (char *)jarg8; 
-  arg9 = (switch_caller_profile_t *)jarg9; 
-  arg10 = (switch_event_t *)jarg10; 
-  arg11 = (switch_originate_flag_t)jarg11; 
-  result = (switch_status_t)switch_ivr_enterprise_originate(arg1,arg2,arg3,(char const *)arg4,arg5,(switch_state_handler_table const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_bridge_display(void * jarg1, void * jarg2) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_core_session_t *)jarg2; 
-  switch_ivr_bridge_display(arg1,arg2);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_multi_threaded_bridge(void * jarg1, void * jarg2, void * jarg3, void * jarg4, void * jarg5) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
-  switch_input_callback_function_t arg3 = (switch_input_callback_function_t) 0 ;
-  void *arg4 = (void *) 0 ;
-  void *arg5 = (void *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_core_session_t *)jarg2; 
-  arg3 = (switch_input_callback_function_t)jarg3; 
-  arg4 = (void *)jarg4; 
-  arg5 = (void *)jarg5; 
-  result = (switch_status_t)switch_ivr_multi_threaded_bridge(arg1,arg2,arg3,arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_signal_bridge(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_core_session_t *)jarg2; 
-  result = (switch_status_t)switch_ivr_signal_bridge(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_session_transfer(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  result = (switch_status_t)switch_ivr_session_transfer(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_ivr_schedule_transfer(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5) {
-  unsigned long jresult ;
-  time_t arg1 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  char *arg5 = (char *) 0 ;
-  uint32_t result;
-  time_t *argp1 ;
-  
-  argp1 = (time_t *)jarg1; 
-  if (!argp1) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null time_t", 0);
-    return 0;
-  }
-  arg1 = *argp1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (char *)jarg5; 
-  result = (uint32_t)switch_ivr_schedule_transfer(arg1,(char const *)arg2,arg3,arg4,arg5);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_ivr_schedule_hangup(void * jarg1, char * jarg2, int jarg3, int jarg4) {
-  unsigned long jresult ;
-  time_t arg1 ;
-  char *arg2 = (char *) 0 ;
-  switch_call_cause_t arg3 ;
-  switch_bool_t arg4 ;
-  uint32_t result;
-  time_t *argp1 ;
-  
-  argp1 = (time_t *)jarg1; 
-  if (!argp1) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null time_t", 0);
-    return 0;
-  }
-  arg1 = *argp1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_call_cause_t)jarg3; 
-  arg4 = (switch_bool_t)jarg4; 
-  result = (uint32_t)switch_ivr_schedule_hangup(arg1,(char const *)arg2,arg3,arg4);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_uuid_bridge(char * jarg1, char * jarg2) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_status_t)switch_ivr_uuid_bridge((char const *)arg1,(char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_media(char * jarg1, unsigned long jarg2) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_media_flag_t arg2 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_media_flag_t)jarg2; 
-  result = (switch_status_t)switch_ivr_media((char const *)arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_nomedia(char * jarg1, unsigned long jarg2) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_media_flag_t arg2 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_media_flag_t)jarg2; 
-  result = (switch_status_t)switch_ivr_nomedia((char const *)arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_hold_uuid(char * jarg1, char * jarg2, int jarg3) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_bool_t arg3 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_bool_t)jarg3; 
-  result = (switch_status_t)switch_ivr_hold_uuid((char const *)arg1,(char const *)arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_unhold_uuid(char * jarg1) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_status_t)switch_ivr_unhold_uuid((char const *)arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_hold(void * jarg1, char * jarg2, int jarg3) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_bool_t arg3 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_bool_t)jarg3; 
-  result = (switch_status_t)switch_ivr_hold(arg1,(char const *)arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_unhold(void * jarg1) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_status_t)switch_ivr_unhold(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_ivr_schedule_broadcast(void * jarg1, char * jarg2, char * jarg3, unsigned long jarg4) {
-  unsigned long jresult ;
-  time_t arg1 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  switch_media_flag_t arg4 ;
-  uint32_t result;
-  time_t *argp1 ;
-  
-  argp1 = (time_t *)jarg1; 
-  if (!argp1) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null time_t", 0);
-    return 0;
-  }
-  arg1 = *argp1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (switch_media_flag_t)jarg4; 
-  result = (uint32_t)switch_ivr_schedule_broadcast(arg1,(char const *)arg2,(char const *)arg3,arg4);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_broadcast(char * jarg1, char * jarg2, unsigned long jarg3) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_media_flag_t arg3 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_media_flag_t)jarg3; 
-  result = (switch_status_t)switch_ivr_broadcast((char const *)arg1,(char const *)arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_transfer_variable(void * jarg1, void * jarg2, char * jarg3) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
-  char *arg3 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_core_session_t *)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (switch_status_t)switch_ivr_transfer_variable(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_digit_stream_parser_new(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
-  switch_ivr_digit_stream_parser_t **arg2 = (switch_ivr_digit_stream_parser_t **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_memory_pool_t *)jarg1; 
-  arg2 = (switch_ivr_digit_stream_parser_t **)jarg2; 
-  result = (switch_status_t)switch_ivr_digit_stream_parser_new(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_digit_stream_parser_destroy(void * jarg1) {
-  int jresult ;
-  switch_ivr_digit_stream_parser_t *arg1 = (switch_ivr_digit_stream_parser_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_ivr_digit_stream_parser_t *)jarg1; 
-  result = (switch_status_t)switch_ivr_digit_stream_parser_destroy(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_digit_stream_new(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_ivr_digit_stream_parser_t *arg1 = (switch_ivr_digit_stream_parser_t *) 0 ;
-  switch_ivr_digit_stream_t **arg2 = (switch_ivr_digit_stream_t **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_ivr_digit_stream_parser_t *)jarg1; 
-  arg2 = (switch_ivr_digit_stream_t **)jarg2; 
-  result = (switch_status_t)switch_ivr_digit_stream_new(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_digit_stream_destroy(void * jarg1) {
-  int jresult ;
-  switch_ivr_digit_stream_t **arg1 = (switch_ivr_digit_stream_t **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_ivr_digit_stream_t **)jarg1; 
-  result = (switch_status_t)switch_ivr_digit_stream_destroy(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_digit_stream_parser_set_event(void * jarg1, char * jarg2, void * jarg3) {
-  int jresult ;
-  switch_ivr_digit_stream_parser_t *arg1 = (switch_ivr_digit_stream_parser_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *arg3 = (void *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_ivr_digit_stream_parser_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (void *)jarg3; 
-  result = (switch_status_t)switch_ivr_digit_stream_parser_set_event(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_digit_stream_parser_del_event(void * jarg1, char * jarg2) {
-  int jresult ;
-  switch_ivr_digit_stream_parser_t *arg1 = (switch_ivr_digit_stream_parser_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_ivr_digit_stream_parser_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_status_t)switch_ivr_digit_stream_parser_del_event(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_ivr_digit_stream_parser_feed(void * jarg1, void * jarg2, char jarg3) {
-  void * jresult ;
-  switch_ivr_digit_stream_parser_t *arg1 = (switch_ivr_digit_stream_parser_t *) 0 ;
-  switch_ivr_digit_stream_t *arg2 = (switch_ivr_digit_stream_t *) 0 ;
-  char arg3 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_ivr_digit_stream_parser_t *)jarg1; 
-  arg2 = (switch_ivr_digit_stream_t *)jarg2; 
-  arg3 = (char)jarg3; 
-  result = (void *)switch_ivr_digit_stream_parser_feed(arg1,arg2,arg3);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_digit_stream_reset(void * jarg1) {
-  int jresult ;
-  switch_ivr_digit_stream_t *arg1 = (switch_ivr_digit_stream_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_ivr_digit_stream_t *)jarg1; 
-  result = (switch_status_t)switch_ivr_digit_stream_reset(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_digit_stream_parser_set_terminator(void * jarg1, char jarg2) {
-  int jresult ;
-  switch_ivr_digit_stream_parser_t *arg1 = (switch_ivr_digit_stream_parser_t *) 0 ;
-  char arg2 ;
-  switch_status_t result;
-  
-  arg1 = (switch_ivr_digit_stream_parser_t *)jarg1; 
-  arg2 = (char)jarg2; 
-  result = (switch_status_t)switch_ivr_digit_stream_parser_set_terminator(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_init(void * jarg1, void * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, char * jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16, int jarg17, void * jarg18) {
-  int jresult ;
-  switch_ivr_menu_t **arg1 = (switch_ivr_menu_t **) 0 ;
-  switch_ivr_menu_t *arg2 = (switch_ivr_menu_t *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  char *arg5 = (char *) 0 ;
-  char *arg6 = (char *) 0 ;
-  char *arg7 = (char *) 0 ;
-  char *arg8 = (char *) 0 ;
-  char *arg9 = (char *) 0 ;
-  char *arg10 = (char *) 0 ;
-  char *arg11 = (char *) 0 ;
-  int arg12 ;
-  int arg13 ;
-  int arg14 ;
-  int arg15 ;
-  int arg16 ;
-  int arg17 ;
-  switch_memory_pool_t *arg18 = (switch_memory_pool_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_ivr_menu_t **)jarg1; 
-  arg2 = (switch_ivr_menu_t *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (char *)jarg5; 
-  arg6 = (char *)jarg6; 
-  arg7 = (char *)jarg7; 
-  arg8 = (char *)jarg8; 
-  arg9 = (char *)jarg9; 
-  arg10 = (char *)jarg10; 
-  arg11 = (char *)jarg11; 
-  arg12 = (int)jarg12; 
-  arg13 = (int)jarg13; 
-  arg14 = (int)jarg14; 
-  arg15 = (int)jarg15; 
-  arg16 = (int)jarg16; 
-  arg17 = (int)jarg17; 
-  arg18 = (switch_memory_pool_t *)jarg18; 
-  result = (switch_status_t)switch_ivr_menu_init(arg1,arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,(char const *)arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_bind_action(void * jarg1, int jarg2, char * jarg3, char * jarg4) {
-  int jresult ;
-  switch_ivr_menu_t *arg1 = (switch_ivr_menu_t *) 0 ;
-  switch_ivr_action_t arg2 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_ivr_menu_t *)jarg1; 
-  arg2 = (switch_ivr_action_t)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  result = (switch_status_t)switch_ivr_menu_bind_action(arg1,arg2,(char const *)arg3,(char const *)arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_bind_function(void * jarg1, void * jarg2, char * jarg3, char * jarg4) {
-  int jresult ;
-  switch_ivr_menu_t *arg1 = (switch_ivr_menu_t *) 0 ;
-  switch_ivr_menu_action_function_t *arg2 = (switch_ivr_menu_action_function_t *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_ivr_menu_t *)jarg1; 
-  arg2 = (switch_ivr_menu_action_function_t *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  result = (switch_status_t)switch_ivr_menu_bind_function(arg1,arg2,(char const *)arg3,(char const *)arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_execute(void * jarg1, void * jarg2, char * jarg3, void * jarg4) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_ivr_menu_t *arg2 = (switch_ivr_menu_t *) 0 ;
-  char *arg3 = (char *) 0 ;
-  void *arg4 = (void *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_ivr_menu_t *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (void *)jarg4; 
-  result = (switch_status_t)switch_ivr_menu_execute(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_stack_free(void * jarg1) {
-  int jresult ;
-  switch_ivr_menu_t *arg1 = (switch_ivr_menu_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_ivr_menu_t *)jarg1; 
-  result = (switch_status_t)switch_ivr_menu_stack_free(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_stack_xml_build(void * jarg1, void * jarg2, void * jarg3, void * jarg4) {
-  int jresult ;
-  switch_ivr_menu_xml_ctx_t *arg1 = (switch_ivr_menu_xml_ctx_t *) 0 ;
-  switch_ivr_menu_t **arg2 = (switch_ivr_menu_t **) 0 ;
-  switch_xml_t arg3 = (switch_xml_t) 0 ;
-  switch_xml_t arg4 = (switch_xml_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_ivr_menu_xml_ctx_t *)jarg1; 
-  arg2 = (switch_ivr_menu_t **)jarg2; 
-  arg3 = (switch_xml_t)jarg3; 
-  arg4 = (switch_xml_t)jarg4; 
-  result = (switch_status_t)switch_ivr_menu_stack_xml_build(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_str2action(char * jarg1, void * jarg2) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_ivr_action_t *arg2 = (switch_ivr_action_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_ivr_action_t *)jarg2; 
-  result = (switch_status_t)switch_ivr_menu_str2action((char const *)arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_stack_xml_add_custom(void * jarg1, char * jarg2, void * jarg3) {
-  int jresult ;
-  switch_ivr_menu_xml_ctx_t *arg1 = (switch_ivr_menu_xml_ctx_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_ivr_menu_action_function_t *arg3 = (switch_ivr_menu_action_function_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_ivr_menu_xml_ctx_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_ivr_menu_action_function_t *)jarg3; 
-  result = (switch_status_t)switch_ivr_menu_stack_xml_add_custom(arg1,(char const *)arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_stack_xml_init(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_ivr_menu_xml_ctx_t **arg1 = (switch_ivr_menu_xml_ctx_t **) 0 ;
-  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_ivr_menu_xml_ctx_t **)jarg1; 
-  arg2 = (switch_memory_pool_t *)jarg2; 
-  result = (switch_status_t)switch_ivr_menu_stack_xml_init(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_phrase_macro(void * jarg1, char * jarg2, char * jarg3, char * jarg4, void * jarg5) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  switch_input_args_t *arg5 = (switch_input_args_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (switch_input_args_t *)jarg5; 
-  result = (switch_status_t)switch_ivr_phrase_macro(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_delay_echo(void * jarg1, unsigned long jarg2) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  switch_ivr_delay_echo(arg1,arg2);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_find_bridged_uuid(char * jarg1, char * jarg2, void * jarg3) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_size_t arg3 ;
-  switch_status_t result;
-  switch_size_t *argp3 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  argp3 = (switch_size_t *)jarg3; 
-  if (!argp3) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg3 = *argp3; 
-  result = (switch_status_t)switch_ivr_find_bridged_uuid((char const *)arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_intercept_session(void * jarg1, char * jarg2, int jarg3) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_bool_t arg3 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_bool_t)jarg3; 
-  switch_ivr_intercept_session(arg1,(char const *)arg2,arg3);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_park_session(void * jarg1) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  switch_ivr_park_session(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_wait_for_answer(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_core_session_t *)jarg2; 
-  result = (switch_status_t)switch_ivr_wait_for_answer(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_read(void * jarg1, unsigned long jarg2, unsigned long jarg3, char * jarg4, char * jarg5, char * jarg6, void * jarg7, unsigned long jarg8, char * jarg9) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  uint32_t arg2 ;
-  uint32_t arg3 ;
-  char *arg4 = (char *) 0 ;
-  char *arg5 = (char *) 0 ;
-  char *arg6 = (char *) 0 ;
-  switch_size_t arg7 ;
-  uint32_t arg8 ;
-  char *arg9 = (char *) 0 ;
-  switch_status_t result;
-  switch_size_t *argp7 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  arg3 = (uint32_t)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (char *)jarg5; 
-  arg6 = (char *)jarg6; 
-  argp7 = (switch_size_t *)jarg7; 
-  if (!argp7) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg7 = *argp7; 
-  arg8 = (uint32_t)jarg8; 
-  arg9 = (char *)jarg9; 
-  result = (switch_status_t)switch_ivr_read(arg1,arg2,arg3,(char const *)arg4,(char const *)arg5,arg6,arg7,arg8,(char const *)arg9);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_bind_dtmf_meta_session(void * jarg1, unsigned long jarg2, unsigned long jarg3, char * jarg4) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  uint32_t arg2 ;
-  switch_bind_flag_t arg3 ;
-  char *arg4 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  arg3 = (switch_bind_flag_t)jarg3; 
-  arg4 = (char *)jarg4; 
-  result = (switch_status_t)switch_ivr_bind_dtmf_meta_session(arg1,arg2,arg3,(char const *)arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_unbind_dtmf_meta_session(void * jarg1, unsigned long jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  uint32_t arg2 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  result = (switch_status_t)switch_ivr_unbind_dtmf_meta_session(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_soft_hold(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  result = (switch_status_t)switch_ivr_soft_hold(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_say(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, void * jarg6) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  char *arg5 = (char *) 0 ;
-  switch_input_args_t *arg6 = (switch_input_args_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (char *)jarg5; 
-  arg6 = (switch_input_args_t *)jarg6; 
-  result = (switch_status_t)switch_ivr_say(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,arg6);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_get_say_method_by_name(char * jarg1) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_say_method_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_say_method_t)switch_ivr_get_say_method_by_name((char const *)arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_get_say_type_by_name(char * jarg1) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_say_type_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_say_type_t)switch_ivr_get_say_type_by_name((char const *)arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_set_user(void * jarg1, char * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_status_t)switch_ivr_set_user(arg1,(char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_sound_test(void * jarg1) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_status_t)switch_ivr_sound_test(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_process_import(void * jarg1, void * jarg2, char * jarg3) {
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_channel_t *arg2 = (switch_channel_t *) 0 ;
-  char *arg3 = (char *) 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_channel_t *)jarg2; 
-  arg3 = (char *)jarg3; 
-  switch_process_import(arg1,arg2,(char const *)arg3);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_uuid_exists(char * jarg1) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_bool_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_bool_t)switch_ivr_uuid_exists((char const *)arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_MAX_BUF_LEN_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 16384;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_MAX_CRYPTO_LEN_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 64;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_KEY_LEN_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 30;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_RTP_CRYPTO_KEY_32_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "AES_CM_128_HMAC_SHA1_32";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_RTP_CRYPTO_KEY_80_get() {
-  char * jresult ;
-  char *result = 0 ;
-  
-  result = (char *) "AES_CM_128_HMAC_SHA1_80";
-  
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_crypto_key_index_set(void * jarg1, unsigned long jarg2) {
-  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_rtp_crypto_key *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->index = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtp_crypto_key_index_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_rtp_crypto_key *)jarg1; 
-  result = (uint32_t) ((arg1)->index);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_crypto_key_type_set(void * jarg1, int jarg2) {
-  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
-  switch_rtp_crypto_key_type_t arg2 ;
-  
-  arg1 = (switch_rtp_crypto_key *)jarg1; 
-  arg2 = (switch_rtp_crypto_key_type_t)jarg2; 
-  if (arg1) (arg1)->type = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_crypto_key_type_get(void * jarg1) {
-  int jresult ;
-  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
-  switch_rtp_crypto_key_type_t result;
-  
-  arg1 = (switch_rtp_crypto_key *)jarg1; 
-  result = (switch_rtp_crypto_key_type_t) ((arg1)->type);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_crypto_key_key_set(void * jarg1, void * jarg2) {
-  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
-  unsigned char *arg2 ;
-  
-  arg1 = (switch_rtp_crypto_key *)jarg1; 
-  arg2 = (unsigned char *)jarg2; 
-  {
-    size_t ii;
-    unsigned char *b = (unsigned char *) arg1->key;
-    for (ii = 0; ii < (size_t)64; ii++) b[ii] = *((unsigned char *) arg2 + ii);
-  }
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_crypto_key_key_get(void * jarg1) {
-  void * jresult ;
-  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
-  unsigned char *result = 0 ;
-  
-  arg1 = (switch_rtp_crypto_key *)jarg1; 
-  result = (unsigned char *)(unsigned char *) ((arg1)->key);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_crypto_key_keylen_set(void * jarg1, void * jarg2) {
-  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_rtp_crypto_key *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->keylen = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_crypto_key_keylen_get(void * jarg1) {
-  void * jresult ;
-  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_rtp_crypto_key *)jarg1; 
-  result =  ((arg1)->keylen);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_crypto_key_next_set(void * jarg1, void * jarg2) {
-  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
-  switch_rtp_crypto_key *arg2 = (switch_rtp_crypto_key *) 0 ;
-  
-  arg1 = (switch_rtp_crypto_key *)jarg1; 
-  arg2 = (switch_rtp_crypto_key *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_crypto_key_next_get(void * jarg1) {
-  void * jresult ;
-  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
-  switch_rtp_crypto_key *result = 0 ;
-  
-  arg1 = (switch_rtp_crypto_key *)jarg1; 
-  result = (switch_rtp_crypto_key *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_rtp_crypto_key() {
-  void * jresult ;
-  switch_rtp_crypto_key *result = 0 ;
-  
-  result = (switch_rtp_crypto_key *)new switch_rtp_crypto_key();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_rtp_crypto_key(void * jarg1) {
-  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
-  
-  arg1 = (switch_rtp_crypto_key *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_add_crypto_key(void * jarg1, int jarg2, unsigned long jarg3, int jarg4, void * jarg5, void * jarg6) {
-  int jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  switch_rtp_crypto_direction_t arg2 ;
-  uint32_t arg3 ;
-  switch_rtp_crypto_key_type_t arg4 ;
-  unsigned char *arg5 = (unsigned char *) 0 ;
-  switch_size_t arg6 ;
-  switch_status_t result;
-  switch_size_t *argp6 ;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (switch_rtp_crypto_direction_t)jarg2; 
-  arg3 = (uint32_t)jarg3; 
-  arg4 = (switch_rtp_crypto_key_type_t)jarg4; 
-  arg5 = (unsigned char *)jarg5; 
-  argp6 = (switch_size_t *)jarg6; 
-  if (!argp6) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg6 = *argp6; 
-  result = (switch_status_t)switch_rtp_add_crypto_key(arg1,arg2,arg3,arg4,arg5,arg6);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_get_random(void * jarg1, unsigned long jarg2) {
-  void *arg1 = (void *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (void *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  switch_rtp_get_random(arg1,arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_init(void * jarg1) {
-  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
-  
-  arg1 = (switch_memory_pool_t *)jarg1; 
-  switch_rtp_init(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_shutdown() {
-  switch_rtp_shutdown();
-}
-
-
-SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_rtp_set_start_port(unsigned short jarg1) {
-  unsigned short jresult ;
-  switch_port_t arg1 ;
-  switch_port_t result;
-  
-  arg1 = (switch_port_t)jarg1; 
-  result = (switch_port_t)switch_rtp_set_start_port(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_rtp_set_end_port(unsigned short jarg1) {
-  unsigned short jresult ;
-  switch_port_t arg1 ;
-  switch_port_t result;
-  
-  arg1 = (switch_port_t)jarg1; 
-  result = (switch_port_t)switch_rtp_set_end_port(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_rtp_request_port(char * jarg1) {
-  unsigned short jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_port_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_port_t)switch_rtp_request_port((char const *)arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_release_port(char * jarg1, unsigned short jarg2) {
-  char *arg1 = (char *) 0 ;
-  switch_port_t arg2 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_port_t)jarg2; 
-  switch_rtp_release_port((char const *)arg1,arg2);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_set_interval(void * jarg1, unsigned long jarg2, unsigned long jarg3) {
-  int jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  uint32_t arg2 ;
-  uint32_t arg3 ;
-  switch_status_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  arg3 = (uint32_t)jarg3; 
-  result = (switch_status_t)switch_rtp_set_interval(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_change_interval(void * jarg1, unsigned long jarg2, unsigned long jarg3) {
-  int jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  uint32_t arg2 ;
-  uint32_t arg3 ;
-  switch_status_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  arg3 = (uint32_t)jarg3; 
-  result = (switch_status_t)switch_rtp_change_interval(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_create(void * jarg1, unsigned char jarg2, unsigned long jarg3, unsigned long jarg4, unsigned long jarg5, char * jarg6, void * jarg7, void * jarg8) {
-  int jresult ;
-  switch_rtp_t **arg1 = (switch_rtp_t **) 0 ;
-  switch_payload_t arg2 ;
-  uint32_t arg3 ;
-  uint32_t arg4 ;
-  switch_rtp_flag_t arg5 ;
-  char *arg6 = (char *) 0 ;
-  char **arg7 = (char **) 0 ;
-  switch_memory_pool_t *arg8 = (switch_memory_pool_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_rtp_t **)jarg1; 
-  arg2 = (switch_payload_t)jarg2; 
-  arg3 = (uint32_t)jarg3; 
-  arg4 = (uint32_t)jarg4; 
-  arg5 = (switch_rtp_flag_t)jarg5; 
-  arg6 = (char *)jarg6; 
-  arg7 = (char **)jarg7; 
-  arg8 = (switch_memory_pool_t *)jarg8; 
-  result = (switch_status_t)switch_rtp_create(arg1,arg2,arg3,arg4,arg5,arg6,(char const **)arg7,arg8);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_new(char * jarg1, unsigned short jarg2, char * jarg3, unsigned short jarg4, unsigned char jarg5, unsigned long jarg6, unsigned long jarg7, unsigned long jarg8, char * jarg9, void * jarg10, void * jarg11) {
-  void * jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_port_t arg2 ;
-  char *arg3 = (char *) 0 ;
-  switch_port_t arg4 ;
-  switch_payload_t arg5 ;
-  uint32_t arg6 ;
-  uint32_t arg7 ;
-  switch_rtp_flag_t arg8 ;
-  char *arg9 = (char *) 0 ;
-  char **arg10 = (char **) 0 ;
-  switch_memory_pool_t *arg11 = (switch_memory_pool_t *) 0 ;
-  switch_rtp_t *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_port_t)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (switch_port_t)jarg4; 
-  arg5 = (switch_payload_t)jarg5; 
-  arg6 = (uint32_t)jarg6; 
-  arg7 = (uint32_t)jarg7; 
-  arg8 = (switch_rtp_flag_t)jarg8; 
-  arg9 = (char *)jarg9; 
-  arg10 = (char **)jarg10; 
-  arg11 = (switch_memory_pool_t *)jarg11; 
-  result = (switch_rtp_t *)switch_rtp_new((char const *)arg1,arg2,(char const *)arg3,arg4,arg5,arg6,arg7,arg8,arg9,(char const **)arg10,arg11);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_set_remote_address(void * jarg1, char * jarg2, unsigned short jarg3, int jarg4, void * jarg5) {
-  int jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_port_t arg3 ;
-  switch_bool_t arg4 ;
-  char **arg5 = (char **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_port_t)jarg3; 
-  arg4 = (switch_bool_t)jarg4; 
-  arg5 = (char **)jarg5; 
-  result = (switch_status_t)switch_rtp_set_remote_address(arg1,(char const *)arg2,arg3,arg4,(char const **)arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_rtp_get_remote_host(void * jarg1) {
-  char * jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  result = (char *)switch_rtp_get_remote_host(arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_rtp_get_remote_port(void * jarg1) {
-  unsigned short jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  switch_port_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  result = (switch_port_t)switch_rtp_get_remote_port(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_reset_media_timer(void * jarg1) {
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  switch_rtp_reset_media_timer(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_set_max_missed_packets(void * jarg1, unsigned long jarg2) {
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  switch_rtp_set_max_missed_packets(arg1,arg2);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_set_local_address(void * jarg1, char * jarg2, unsigned short jarg3, void * jarg4) {
-  int jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_port_t arg3 ;
-  char **arg4 = (char **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_port_t)jarg3; 
-  arg4 = (char **)jarg4; 
-  result = (switch_status_t)switch_rtp_set_local_address(arg1,(char const *)arg2,arg3,(char const **)arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_kill_socket(void * jarg1) {
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  switch_rtp_kill_socket(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_break(void * jarg1) {
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  switch_rtp_break(arg1);
-}
-
-
-SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_rtp_ready(void * jarg1) {
-  unsigned char jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  uint8_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  result = (uint8_t)switch_rtp_ready(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_destroy(void * jarg1) {
-  switch_rtp_t **arg1 = (switch_rtp_t **) 0 ;
-  
-  arg1 = (switch_rtp_t **)jarg1; 
-  switch_rtp_destroy(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_ice(void * jarg1, char * jarg2, char * jarg3) {
-  int jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (switch_status_t)switch_rtp_activate_ice(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_jitter_buffer(void * jarg1, unsigned long jarg2) {
-  int jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  uint32_t arg2 ;
-  switch_status_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  result = (switch_status_t)switch_rtp_activate_jitter_buffer(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_set_flag(void * jarg1, unsigned long jarg2) {
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  switch_rtp_flag_t arg2 ;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (switch_rtp_flag_t)jarg2; 
-  switch_rtp_set_flag(arg1,arg2);
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtp_test_flag(void * jarg1, unsigned long jarg2) {
-  unsigned long jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  switch_rtp_flag_t arg2 ;
-  uint32_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (switch_rtp_flag_t)jarg2; 
-  result = (uint32_t)switch_rtp_test_flag(arg1,arg2);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_clear_flag(void * jarg1, unsigned long jarg2) {
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  switch_rtp_flag_t arg2 ;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (switch_rtp_flag_t)jarg2; 
-  switch_rtp_clear_flag(arg1,arg2);
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_get_rtp_socket(void * jarg1) {
-  void * jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  switch_socket_t *result = 0 ;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  result = (switch_socket_t *)switch_rtp_get_rtp_socket(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtp_get_default_samples_per_interval(void * jarg1) {
-  unsigned long jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  result = (uint32_t)switch_rtp_get_default_samples_per_interval(arg1);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_set_default_payload(void * jarg1, unsigned char jarg2) {
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  switch_payload_t arg2 ;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (switch_payload_t)jarg2; 
-  switch_rtp_set_default_payload(arg1,arg2);
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtp_get_default_payload(void * jarg1) {
-  unsigned long jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  result = (uint32_t)switch_rtp_get_default_payload(arg1);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_set_invald_handler(void * jarg1, void * jarg2) {
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  switch_rtp_invalid_handler_t arg2 = (switch_rtp_invalid_handler_t) 0 ;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (switch_rtp_invalid_handler_t)jarg2; 
-  switch_rtp_set_invald_handler(arg1,arg2);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_read(void * jarg1, void * jarg2, void * jarg3, void * jarg4, void * jarg5, unsigned long jarg6) {
-  int jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  uint32_t *arg3 = (uint32_t *) 0 ;
-  switch_payload_t *arg4 = (switch_payload_t *) 0 ;
-  switch_frame_flag_t *arg5 = (switch_frame_flag_t *) 0 ;
-  switch_io_flag_t arg6 ;
-  switch_status_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  arg3 = (uint32_t *)jarg3; 
-  arg4 = (switch_payload_t *)jarg4; 
-  arg5 = (switch_frame_flag_t *)jarg5; 
-  arg6 = (switch_io_flag_t)jarg6; 
-  result = (switch_status_t)switch_rtp_read(arg1,arg2,arg3,arg4,arg5,arg6);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_queue_rfc2833(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  switch_dtmf_t *arg2 = (switch_dtmf_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (switch_dtmf_t *)jarg2; 
-  result = (switch_status_t)switch_rtp_queue_rfc2833(arg1,(switch_dtmf_t const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_queue_rfc2833_in(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  switch_dtmf_t *arg2 = (switch_dtmf_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (switch_dtmf_t *)jarg2; 
-  result = (switch_status_t)switch_rtp_queue_rfc2833_in(arg1,(switch_dtmf_t const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_has_dtmf(void * jarg1) {
-  void * jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  result = switch_rtp_has_dtmf(arg1);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_dequeue_dtmf(void * jarg1, void * jarg2) {
-  void * jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  switch_dtmf_t *arg2 = (switch_dtmf_t *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (switch_dtmf_t *)jarg2; 
-  result = switch_rtp_dequeue_dtmf(arg1,arg2);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_zerocopy_read(void * jarg1, void * jarg2, void * jarg3, void * jarg4, void * jarg5, unsigned long jarg6) {
-  int jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  void **arg2 = (void **) 0 ;
-  uint32_t *arg3 = (uint32_t *) 0 ;
-  switch_payload_t *arg4 = (switch_payload_t *) 0 ;
-  switch_frame_flag_t *arg5 = (switch_frame_flag_t *) 0 ;
-  switch_io_flag_t arg6 ;
-  switch_status_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (void **)jarg2; 
-  arg3 = (uint32_t *)jarg3; 
-  arg4 = (switch_payload_t *)jarg4; 
-  arg5 = (switch_frame_flag_t *)jarg5; 
-  arg6 = (switch_io_flag_t)jarg6; 
-  result = (switch_status_t)switch_rtp_zerocopy_read(arg1,arg2,arg3,arg4,arg5,arg6);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_zerocopy_read_frame(void * jarg1, void * jarg2, unsigned long jarg3) {
-  int jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  switch_frame_t *arg2 = (switch_frame_t *) 0 ;
-  switch_io_flag_t arg3 ;
-  switch_status_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (switch_frame_t *)jarg2; 
-  arg3 = (switch_io_flag_t)jarg3; 
-  result = (switch_status_t)switch_rtp_zerocopy_read_frame(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_rtp_flush_read_buffer(void * jarg1, int jarg2) {
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  switch_rtp_flush_t arg2 ;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (switch_rtp_flush_t)jarg2; 
-  rtp_flush_read_buffer(arg1,arg2);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_enable_vad(void * jarg1, void * jarg2, void * jarg3, unsigned long jarg4) {
-  int jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
-  switch_codec_t *arg3 = (switch_codec_t *) 0 ;
-  switch_vad_flag_t arg4 ;
-  switch_status_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (switch_core_session_t *)jarg2; 
-  arg3 = (switch_codec_t *)jarg3; 
-  arg4 = (switch_vad_flag_t)jarg4; 
-  result = (switch_status_t)switch_rtp_enable_vad(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_disable_vad(void * jarg1) {
-  int jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  result = (switch_status_t)switch_rtp_disable_vad(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_write_frame(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  switch_frame_t *arg2 = (switch_frame_t *) 0 ;
-  int result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (switch_frame_t *)jarg2; 
-  result = (int)switch_rtp_write_frame(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_write_manual(void * jarg1, void * jarg2, unsigned long jarg3, unsigned char jarg4, unsigned char jarg5, unsigned long jarg6, void * jarg7) {
-  int jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  uint32_t arg3 ;
-  uint8_t arg4 ;
-  switch_payload_t arg5 ;
-  uint32_t arg6 ;
-  switch_frame_flag_t *arg7 = (switch_frame_flag_t *) 0 ;
-  int result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  arg3 = (uint32_t)jarg3; 
-  arg4 = (uint8_t)jarg4; 
-  arg5 = (switch_payload_t)jarg5; 
-  arg6 = (uint32_t)jarg6; 
-  arg7 = (switch_frame_flag_t *)jarg7; 
-  result = (int)switch_rtp_write_manual(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtp_get_ssrc(void * jarg1) {
-  unsigned long jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  result = (uint32_t)switch_rtp_get_ssrc(arg1);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_set_private(void * jarg1, void * jarg2) {
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  switch_rtp_set_private(arg1,arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_set_telephony_event(void * jarg1, unsigned char jarg2) {
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  switch_payload_t arg2 ;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (switch_payload_t)jarg2; 
-  switch_rtp_set_telephony_event(arg1,arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_set_cng_pt(void * jarg1, unsigned char jarg2) {
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  switch_payload_t arg2 ;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (switch_payload_t)jarg2; 
-  switch_rtp_set_cng_pt(arg1,arg2);
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_get_private(void * jarg1) {
-  void * jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  result = (void *)switch_rtp_get_private(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_stun_ping(void * jarg1, char * jarg2, unsigned short jarg3, unsigned long jarg4, int jarg5) {
-  int jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_port_t arg3 ;
-  uint32_t arg4 ;
-  switch_bool_t arg5 ;
-  switch_status_t result;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_port_t)jarg3; 
-  arg4 = (uint32_t)jarg4; 
-  arg5 = (switch_bool_t)jarg5; 
-  result = (switch_status_t)switch_rtp_activate_stun_ping(arg1,(char const *)arg2,arg3,arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_intentional_bugs(void * jarg1, int jarg2) {
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  switch_rtp_bug_flag_t arg2 ;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (switch_rtp_bug_flag_t)jarg2; 
-  switch_rtp_intentional_bugs(arg1,arg2);
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_get_stats(void * jarg1, void * jarg2) {
-  void * jresult ;
-  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
-  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
-  switch_rtp_stats_t *result = 0 ;
-  
-  arg1 = (switch_rtp_t *)jarg1; 
-  arg2 = (switch_memory_pool_t *)jarg2; 
-  result = (switch_rtp_stats_t *)switch_rtp_get_stats(arg1,arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_data_set(void * jarg1, char * jarg2) {
-  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_log_node_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->data) delete [] arg1->data;
-    if (arg2) {
-      arg1->data = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->data, (const char *)arg2);
-    } else {
-      arg1->data = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_log_node_t_data_get(void * jarg1) {
-  char * jresult ;
-  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_log_node_t *)jarg1; 
-  result = (char *) ((arg1)->data);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_file_set(void * jarg1, char * jarg2) {
-  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
-  char *arg2 ;
-  
-  arg1 = (switch_log_node_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) strncpy((char *)arg1->file, (const char *)arg2, 80);
-    else arg1->file[0] = 0;
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_log_node_t_file_get(void * jarg1) {
-  char * jresult ;
-  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_log_node_t *)jarg1; 
-  result = (char *)(char *) ((arg1)->file);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_line_set(void * jarg1, unsigned long jarg2) {
-  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_log_node_t *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->line = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_log_node_t_line_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_log_node_t *)jarg1; 
-  result = (uint32_t) ((arg1)->line);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_func_set(void * jarg1, char * jarg2) {
-  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
-  char *arg2 ;
-  
-  arg1 = (switch_log_node_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) strncpy((char *)arg1->func, (const char *)arg2, 80);
-    else arg1->func[0] = 0;
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_log_node_t_func_get(void * jarg1) {
-  char * jresult ;
-  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_log_node_t *)jarg1; 
-  result = (char *)(char *) ((arg1)->func);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_level_set(void * jarg1, int jarg2) {
-  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
-  switch_log_level_t arg2 ;
-  
-  arg1 = (switch_log_node_t *)jarg1; 
-  arg2 = (switch_log_level_t)jarg2; 
-  if (arg1) (arg1)->level = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_log_node_t_level_get(void * jarg1) {
-  int jresult ;
-  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
-  switch_log_level_t result;
-  
-  arg1 = (switch_log_node_t *)jarg1; 
-  result = (switch_log_level_t) ((arg1)->level);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_timestamp_set(void * jarg1, void * jarg2) {
-  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
-  switch_time_t arg2 ;
-  switch_time_t *argp2 ;
-  
-  arg1 = (switch_log_node_t *)jarg1; 
-  argp2 = (switch_time_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->timestamp = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_log_node_t_timestamp_get(void * jarg1) {
-  void * jresult ;
-  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
-  switch_time_t result;
-  
-  arg1 = (switch_log_node_t *)jarg1; 
-  result =  ((arg1)->timestamp);
-  jresult = new switch_time_t((switch_time_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_content_set(void * jarg1, char * jarg2) {
-  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_log_node_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->content) delete [] arg1->content;
-    if (arg2) {
-      arg1->content = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->content, (const char *)arg2);
-    } else {
-      arg1->content = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_log_node_t_content_get(void * jarg1) {
-  char * jresult ;
-  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_log_node_t *)jarg1; 
-  result = (char *) ((arg1)->content);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_userdata_set(void * jarg1, char * jarg2) {
-  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_log_node_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->userdata) delete [] arg1->userdata;
-    if (arg2) {
-      arg1->userdata = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->userdata, (const char *)arg2);
-    } else {
-      arg1->userdata = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_log_node_t_userdata_get(void * jarg1) {
-  char * jresult ;
-  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_log_node_t *)jarg1; 
-  result = (char *) ((arg1)->userdata);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_channel_set(void * jarg1, int jarg2) {
-  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
-  switch_text_channel_t arg2 ;
-  
-  arg1 = (switch_log_node_t *)jarg1; 
-  arg2 = (switch_text_channel_t)jarg2; 
-  if (arg1) (arg1)->channel = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_log_node_t_channel_get(void * jarg1) {
-  int jresult ;
-  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
-  switch_text_channel_t result;
-  
-  arg1 = (switch_log_node_t *)jarg1; 
-  result = (switch_text_channel_t) ((arg1)->channel);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_log_node_t() {
-  void * jresult ;
-  switch_log_node_t *result = 0 ;
-  
-  result = (switch_log_node_t *)new switch_log_node_t();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_log_node_t(void * jarg1) {
-  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
-  
-  arg1 = (switch_log_node_t *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_log_init(void * jarg1, int jarg2) {
-  int jresult ;
-  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
-  switch_bool_t arg2 ;
-  switch_status_t result;
-  
-  arg1 = (switch_memory_pool_t *)jarg1; 
-  arg2 = (switch_bool_t)jarg2; 
-  result = (switch_status_t)switch_log_init(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_log_shutdown() {
-  int jresult ;
-  switch_status_t result;
-  
-  result = (switch_status_t)switch_log_shutdown();
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_log_bind_logger(void * jarg1, int jarg2, int jarg3) {
-  int jresult ;
-  switch_log_function_t arg1 = (switch_log_function_t) 0 ;
-  switch_log_level_t arg2 ;
-  switch_bool_t arg3 ;
-  switch_status_t result;
-  
-  arg1 = (switch_log_function_t)jarg1; 
-  arg2 = (switch_log_level_t)jarg2; 
-  arg3 = (switch_bool_t)jarg3; 
-  result = (switch_status_t)switch_log_bind_logger(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_log_unbind_logger(void * jarg1) {
-  int jresult ;
-  switch_log_function_t arg1 = (switch_log_function_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_log_function_t)jarg1; 
-  result = (switch_status_t)switch_log_unbind_logger(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_log_level2str(int jarg1) {
-  char * jresult ;
-  switch_log_level_t arg1 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_log_level_t)jarg1; 
-  result = (char *)switch_log_level2str(arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_log_str2level(char * jarg1) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_log_level_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_log_level_t)switch_log_str2level((char const *)arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_log_str2mask(char * jarg1) {
-  unsigned long jresult ;
-  char *arg1 = (char *) 0 ;
-  uint32_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (uint32_t)switch_log_str2mask((char const *)arg1);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_log_node_dup(void * jarg1) {
-  void * jresult ;
-  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
-  switch_log_node_t *result = 0 ;
-  
-  arg1 = (switch_log_node_t *)jarg1; 
-  result = (switch_log_node_t *)switch_log_node_dup((switch_log_node_t const *)arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_free(void * jarg1) {
-  switch_log_node_t **arg1 = (switch_log_node_t **) 0 ;
-  
-  arg1 = (switch_log_node_t **)jarg1; 
-  switch_log_node_free(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_XML_BUFSIZE_get() {
-  int jresult ;
-  int result;
-  
-  result = (int) 1024;
-  
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_name_set(void * jarg1, char * jarg2) {
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_xml *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->name) delete [] arg1->name;
-    if (arg2) {
-      arg1->name = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->name, (const char *)arg2);
-    } else {
-      arg1->name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_name_get(void * jarg1) {
-  char * jresult ;
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_xml *)jarg1; 
-  result = (char *) ((arg1)->name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_attr_set(void * jarg1, void * jarg2) {
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  char **arg2 = (char **) 0 ;
-  
-  arg1 = (switch_xml *)jarg1; 
-  arg2 = (char **)jarg2; 
-  if (arg1) (arg1)->attr = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_attr_get(void * jarg1) {
-  void * jresult ;
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  char **result = 0 ;
-  
-  arg1 = (switch_xml *)jarg1; 
-  result = (char **) ((arg1)->attr);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_txt_set(void * jarg1, char * jarg2) {
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_xml *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->txt) delete [] arg1->txt;
-    if (arg2) {
-      arg1->txt = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->txt, (const char *)arg2);
-    } else {
-      arg1->txt = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_txt_get(void * jarg1) {
-  char * jresult ;
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_xml *)jarg1; 
-  result = (char *) ((arg1)->txt);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_free_path_set(void * jarg1, char * jarg2) {
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_xml *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->free_path) delete [] arg1->free_path;
-    if (arg2) {
-      arg1->free_path = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->free_path, (const char *)arg2);
-    } else {
-      arg1->free_path = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_free_path_get(void * jarg1) {
-  char * jresult ;
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_xml *)jarg1; 
-  result = (char *) ((arg1)->free_path);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_off_set(void * jarg1, void * jarg2) {
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  switch_size_t arg2 ;
-  switch_size_t *argp2 ;
-  
-  arg1 = (switch_xml *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return ;
-  }
-  arg2 = *argp2; 
-  if (arg1) (arg1)->off = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_off_get(void * jarg1) {
-  void * jresult ;
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  switch_size_t result;
-  
-  arg1 = (switch_xml *)jarg1; 
-  result =  ((arg1)->off);
-  jresult = new switch_size_t((switch_size_t &)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_next_set(void * jarg1, void * jarg2) {
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  switch_xml_t arg2 = (switch_xml_t) 0 ;
-  
-  arg1 = (switch_xml *)jarg1; 
-  arg2 = (switch_xml_t)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_next_get(void * jarg1) {
-  void * jresult ;
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  switch_xml_t result;
-  
-  arg1 = (switch_xml *)jarg1; 
-  result = (switch_xml_t) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_sibling_set(void * jarg1, void * jarg2) {
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  switch_xml_t arg2 = (switch_xml_t) 0 ;
-  
-  arg1 = (switch_xml *)jarg1; 
-  arg2 = (switch_xml_t)jarg2; 
-  if (arg1) (arg1)->sibling = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_sibling_get(void * jarg1) {
-  void * jresult ;
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  switch_xml_t result;
-  
-  arg1 = (switch_xml *)jarg1; 
-  result = (switch_xml_t) ((arg1)->sibling);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_ordered_set(void * jarg1, void * jarg2) {
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  switch_xml_t arg2 = (switch_xml_t) 0 ;
-  
-  arg1 = (switch_xml *)jarg1; 
-  arg2 = (switch_xml_t)jarg2; 
-  if (arg1) (arg1)->ordered = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_ordered_get(void * jarg1) {
-  void * jresult ;
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  switch_xml_t result;
-  
-  arg1 = (switch_xml *)jarg1; 
-  result = (switch_xml_t) ((arg1)->ordered);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_child_set(void * jarg1, void * jarg2) {
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  switch_xml_t arg2 = (switch_xml_t) 0 ;
-  
-  arg1 = (switch_xml *)jarg1; 
-  arg2 = (switch_xml_t)jarg2; 
-  if (arg1) (arg1)->child = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_child_get(void * jarg1) {
-  void * jresult ;
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  switch_xml_t result;
-  
-  arg1 = (switch_xml *)jarg1; 
-  result = (switch_xml_t) ((arg1)->child);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_parent_set(void * jarg1, void * jarg2) {
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  switch_xml_t arg2 = (switch_xml_t) 0 ;
-  
-  arg1 = (switch_xml *)jarg1; 
-  arg2 = (switch_xml_t)jarg2; 
-  if (arg1) (arg1)->parent = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_parent_get(void * jarg1) {
-  void * jresult ;
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  switch_xml_t result;
-  
-  arg1 = (switch_xml *)jarg1; 
-  result = (switch_xml_t) ((arg1)->parent);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_flags_set(void * jarg1, unsigned long jarg2) {
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_xml *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->flags = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_xml_flags_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_xml *)jarg1; 
-  result = (uint32_t) ((arg1)->flags);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_xml() {
-  void * jresult ;
-  switch_xml *result = 0 ;
-  
-  result = (switch_xml *)new switch_xml();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_xml(void * jarg1) {
-  switch_xml *arg1 = (switch_xml *) 0 ;
-  
-  arg1 = (switch_xml *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_parse_str_dynamic(char * jarg1, int jarg2) {
-  void * jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_bool_t arg2 ;
-  switch_xml_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_bool_t)jarg2; 
-  result = (switch_xml_t)switch_xml_parse_str_dynamic(arg1,arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_parse_str(char * jarg1, void * jarg2) {
-  void * jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_size_t arg2 ;
-  switch_xml_t result;
-  switch_size_t *argp2 ;
-  
-  arg1 = (char *)jarg1; 
-  argp2 = (switch_size_t *)jarg2; 
-  if (!argp2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg2 = *argp2; 
-  result = (switch_xml_t)switch_xml_parse_str(arg1,arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_parse_fd(int jarg1) {
-  void * jresult ;
-  int arg1 ;
-  switch_xml_t result;
-  
-  arg1 = (int)jarg1; 
-  result = (switch_xml_t)switch_xml_parse_fd(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_parse_file(char * jarg1) {
-  void * jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_xml_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_xml_t)switch_xml_parse_file((char const *)arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_parse_file_simple(char * jarg1) {
-  void * jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_xml_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_xml_t)switch_xml_parse_file_simple((char const *)arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_parse_fp(void * jarg1) {
-  void * jresult ;
-  FILE *arg1 = (FILE *) 0 ;
-  switch_xml_t result;
-  
-  arg1 = (FILE *)jarg1; 
-  result = (switch_xml_t)switch_xml_parse_fp(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_child(void * jarg1, char * jarg2) {
-  void * jresult ;
-  switch_xml_t arg1 = (switch_xml_t) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_xml_t result;
-  
-  arg1 = (switch_xml_t)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_xml_t)switch_xml_child(arg1,(char const *)arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_find_child(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
-  void * jresult ;
-  switch_xml_t arg1 = (switch_xml_t) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  switch_xml_t result;
-  
-  arg1 = (switch_xml_t)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  result = (switch_xml_t)switch_xml_find_child(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_find_child_multi(void * jarg1, char * jarg2) {
-  void * jresult ;
-  switch_xml_t arg1 = (switch_xml_t) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *arg3 = 0 ;
-  switch_xml_t result;
-  
-  arg1 = (switch_xml_t)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_xml_t)switch_xml_find_child_multi(arg1,(char const *)arg2,arg3);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_attr(void * jarg1, char * jarg2) {
-  char * jresult ;
-  switch_xml_t arg1 = (switch_xml_t) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_xml_t)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (char *)switch_xml_attr(arg1,(char const *)arg2);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_attr_soft(void * jarg1, char * jarg2) {
-  char * jresult ;
-  switch_xml_t arg1 = (switch_xml_t) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_xml_t)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (char *)switch_xml_attr_soft(arg1,(char const *)arg2);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_get(void * jarg1) {
-  void * jresult ;
-  switch_xml_t arg1 = (switch_xml_t) 0 ;
-  void *arg2 = 0 ;
-  switch_xml_t result;
-  
-  arg1 = (switch_xml_t)jarg1; 
-  result = (switch_xml_t)switch_xml_get(arg1,arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_toxml(void * jarg1, int jarg2) {
-  char * jresult ;
-  switch_xml_t arg1 = (switch_xml_t) 0 ;
-  switch_bool_t arg2 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_xml_t)jarg1; 
-  arg2 = (switch_bool_t)jarg2; 
-  result = (char *)switch_xml_toxml(arg1,arg2);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_toxml_buf(void * jarg1, char * jarg2, void * jarg3, void * jarg4, int jarg5) {
-  char * jresult ;
-  switch_xml_t arg1 = (switch_xml_t) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_size_t arg3 ;
-  switch_size_t arg4 ;
-  switch_bool_t arg5 ;
-  char *result = 0 ;
-  switch_size_t *argp3 ;
-  switch_size_t *argp4 ;
-  
-  arg1 = (switch_xml_t)jarg1; 
-  arg2 = (char *)jarg2; 
-  argp3 = (switch_size_t *)jarg3; 
-  if (!argp3) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg3 = *argp3; 
-  argp4 = (switch_size_t *)jarg4; 
-  if (!argp4) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg4 = *argp4; 
-  arg5 = (switch_bool_t)jarg5; 
-  result = (char *)switch_xml_toxml_buf(arg1,arg2,arg3,arg4,arg5);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_free(void * jarg1) {
-  switch_xml_t arg1 = (switch_xml_t) 0 ;
-  
-  arg1 = (switch_xml_t)jarg1; 
-  switch_xml_free(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_free_in_thread(void * jarg1, int jarg2) {
-  switch_xml_t arg1 = (switch_xml_t) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_xml_t)jarg1; 
-  arg2 = (int)jarg2; 
-  switch_xml_free_in_thread(arg1,arg2);
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_error(void * jarg1) {
-  char * jresult ;
-  switch_xml_t arg1 = (switch_xml_t) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_xml_t)jarg1; 
-  result = (char *)switch_xml_error(arg1);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_new(char * jarg1) {
-  void * jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_xml_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_xml_t)switch_xml_new((char const *)arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_add_child(void * jarg1, char * jarg2, void * jarg3) {
-  void * jresult ;
-  switch_xml_t arg1 = (switch_xml_t) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_size_t arg3 ;
-  switch_xml_t result;
-  switch_size_t *argp3 ;
-  
-  arg1 = (switch_xml_t)jarg1; 
-  arg2 = (char *)jarg2; 
-  argp3 = (switch_size_t *)jarg3; 
-  if (!argp3) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg3 = *argp3; 
-  result = (switch_xml_t)switch_xml_add_child(arg1,(char const *)arg2,arg3);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_set_txt(void * jarg1, char * jarg2) {
-  void * jresult ;
-  switch_xml_t arg1 = (switch_xml_t) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_xml_t result;
-  
-  arg1 = (switch_xml_t)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (switch_xml_t)switch_xml_set_txt(arg1,(char const *)arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_set_attr(void * jarg1, char * jarg2, char * jarg3) {
-  void * jresult ;
-  switch_xml_t arg1 = (switch_xml_t) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  switch_xml_t result;
-  
-  arg1 = (switch_xml_t)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (switch_xml_t)switch_xml_set_attr(arg1,(char const *)arg2,(char const *)arg3);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_set_flag(void * jarg1, int jarg2) {
-  void * jresult ;
-  switch_xml_t arg1 = (switch_xml_t) 0 ;
-  switch_xml_flag_t arg2 ;
-  switch_xml_t result;
-  
-  arg1 = (switch_xml_t)jarg1; 
-  arg2 = (switch_xml_flag_t)jarg2; 
-  result = (switch_xml_t)switch_xml_set_flag(arg1,arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_cut(void * jarg1) {
-  void * jresult ;
-  switch_xml_t arg1 = (switch_xml_t) 0 ;
-  switch_xml_t result;
-  
-  arg1 = (switch_xml_t)jarg1; 
-  result = (switch_xml_t)switch_xml_cut(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_insert(void * jarg1, void * jarg2, void * jarg3) {
-  void * jresult ;
-  switch_xml_t arg1 = (switch_xml_t) 0 ;
-  switch_xml_t arg2 = (switch_xml_t) 0 ;
-  switch_size_t arg3 ;
-  switch_xml_t result;
-  switch_size_t *argp3 ;
-  
-  arg1 = (switch_xml_t)jarg1; 
-  arg2 = (switch_xml_t)jarg2; 
-  argp3 = (switch_size_t *)jarg3; 
-  if (!argp3) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
-    return 0;
-  }
-  arg3 = *argp3; 
-  result = (switch_xml_t)switch_xml_insert(arg1,arg2,arg3);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_open_root(unsigned char jarg1, void * jarg2) {
-  void * jresult ;
-  uint8_t arg1 ;
-  char **arg2 = (char **) 0 ;
-  switch_xml_t result;
-  
-  arg1 = (uint8_t)jarg1; 
-  arg2 = (char **)jarg2; 
-  result = (switch_xml_t)switch_xml_open_root(arg1,(char const **)arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_init(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
-  char **arg2 = (char **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_memory_pool_t *)jarg1; 
-  arg2 = (char **)jarg2; 
-  result = (switch_status_t)switch_xml_init(arg1,(char const **)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_destroy() {
-  int jresult ;
-  switch_status_t result;
-  
-  result = (switch_status_t)switch_xml_destroy();
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_root() {
-  void * jresult ;
-  switch_xml_t result;
-  
-  result = (switch_xml_t)switch_xml_root();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_locate(char * jarg1, char * jarg2, char * jarg3, char * jarg4, void * jarg5, void * jarg6, void * jarg7, int jarg8) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  switch_xml_t *arg5 = (switch_xml_t *) 0 ;
-  switch_xml_t *arg6 = (switch_xml_t *) 0 ;
-  switch_event_t *arg7 = (switch_event_t *) 0 ;
-  switch_bool_t arg8 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (switch_xml_t *)jarg5; 
-  arg6 = (switch_xml_t *)jarg6; 
-  arg7 = (switch_event_t *)jarg7; 
-  arg8 = (switch_bool_t)jarg8; 
-  result = (switch_status_t)switch_xml_locate((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5,arg6,arg7,arg8);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_locate_domain(char * jarg1, void * jarg2, void * jarg3, void * jarg4) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_event_t *arg2 = (switch_event_t *) 0 ;
-  switch_xml_t *arg3 = (switch_xml_t *) 0 ;
-  switch_xml_t *arg4 = (switch_xml_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_event_t *)jarg2; 
-  arg3 = (switch_xml_t *)jarg3; 
-  arg4 = (switch_xml_t *)jarg4; 
-  result = (switch_status_t)switch_xml_locate_domain((char const *)arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_locate_group(char * jarg1, char * jarg2, void * jarg3, void * jarg4, void * jarg5, void * jarg6) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  switch_xml_t *arg3 = (switch_xml_t *) 0 ;
-  switch_xml_t *arg4 = (switch_xml_t *) 0 ;
-  switch_xml_t *arg5 = (switch_xml_t *) 0 ;
-  switch_event_t *arg6 = (switch_event_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (switch_xml_t *)jarg3; 
-  arg4 = (switch_xml_t *)jarg4; 
-  arg5 = (switch_xml_t *)jarg5; 
-  arg6 = (switch_event_t *)jarg6; 
-  result = (switch_status_t)switch_xml_locate_group((char const *)arg1,(char const *)arg2,arg3,arg4,arg5,arg6);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_locate_user(char * jarg1, char * jarg2, char * jarg3, char * jarg4, void * jarg5, void * jarg6, void * jarg7, void * jarg8, void * jarg9) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  switch_xml_t *arg5 = (switch_xml_t *) 0 ;
-  switch_xml_t *arg6 = (switch_xml_t *) 0 ;
-  switch_xml_t *arg7 = (switch_xml_t *) 0 ;
-  switch_xml_t *arg8 = (switch_xml_t *) 0 ;
-  switch_event_t *arg9 = (switch_event_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (switch_xml_t *)jarg5; 
-  arg6 = (switch_xml_t *)jarg6; 
-  arg7 = (switch_xml_t *)jarg7; 
-  arg8 = (switch_xml_t *)jarg8; 
-  arg9 = (switch_event_t *)jarg9; 
-  result = (switch_status_t)switch_xml_locate_user((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5,arg6,arg7,arg8,arg9);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_locate_user_in_domain(char * jarg1, void * jarg2, void * jarg3, void * jarg4) {
-  int jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_xml_t arg2 = (switch_xml_t) 0 ;
-  switch_xml_t *arg3 = (switch_xml_t *) 0 ;
-  switch_xml_t *arg4 = (switch_xml_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_xml_t)jarg2; 
-  arg3 = (switch_xml_t *)jarg3; 
-  arg4 = (switch_xml_t *)jarg4; 
-  result = (switch_status_t)switch_xml_locate_user_in_domain((char const *)arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_open_cfg(char * jarg1, void * jarg2, void * jarg3) {
-  void * jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_xml_t *arg2 = (switch_xml_t *) 0 ;
-  switch_event_t *arg3 = (switch_event_t *) 0 ;
-  switch_xml_t result;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (switch_xml_t *)jarg2; 
-  arg3 = (switch_event_t *)jarg3; 
-  result = (switch_xml_t)switch_xml_open_cfg((char const *)arg1,arg2,arg3);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_set_binding_sections(void * jarg1, unsigned long jarg2) {
-  switch_xml_binding_t *arg1 = (switch_xml_binding_t *) 0 ;
-  switch_xml_section_t arg2 ;
-  
-  arg1 = (switch_xml_binding_t *)jarg1; 
-  arg2 = (switch_xml_section_t)jarg2; 
-  switch_xml_set_binding_sections(arg1,arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_set_binding_user_data(void * jarg1, void * jarg2) {
-  switch_xml_binding_t *arg1 = (switch_xml_binding_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_xml_binding_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  switch_xml_set_binding_user_data(arg1,arg2);
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_xml_get_binding_sections(void * jarg1) {
-  unsigned long jresult ;
-  switch_xml_binding_t *arg1 = (switch_xml_binding_t *) 0 ;
-  switch_xml_section_t result;
-  
-  arg1 = (switch_xml_binding_t *)jarg1; 
-  result = (switch_xml_section_t)switch_xml_get_binding_sections(arg1);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_get_binding_user_data(void * jarg1) {
-  void * jresult ;
-  switch_xml_binding_t *arg1 = (switch_xml_binding_t *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_xml_binding_t *)jarg1; 
-  result = (void *)switch_xml_get_binding_user_data(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_bind_search_function_ret(void * jarg1, unsigned long jarg2, void * jarg3, void * jarg4) {
-  int jresult ;
-  switch_xml_search_function_t arg1 = (switch_xml_search_function_t) 0 ;
-  switch_xml_section_t arg2 ;
-  void *arg3 = (void *) 0 ;
-  switch_xml_binding_t **arg4 = (switch_xml_binding_t **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_xml_search_function_t)jarg1; 
-  arg2 = (switch_xml_section_t)jarg2; 
-  arg3 = (void *)jarg3; 
-  arg4 = (switch_xml_binding_t **)jarg4; 
-  result = (switch_status_t)switch_xml_bind_search_function_ret(arg1,arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_unbind_search_function(void * jarg1) {
-  int jresult ;
-  switch_xml_binding_t **arg1 = (switch_xml_binding_t **) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_xml_binding_t **)jarg1; 
-  result = (switch_status_t)switch_xml_unbind_search_function(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_unbind_search_function_ptr(void * jarg1) {
-  int jresult ;
-  switch_xml_search_function_t arg1 = (switch_xml_search_function_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_xml_search_function_t)jarg1; 
-  result = (switch_status_t)switch_xml_unbind_search_function_ptr(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_xml_parse_section_string(char * jarg1) {
-  unsigned long jresult ;
-  char *arg1 = (char *) 0 ;
-  switch_xml_section_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (switch_xml_section_t)switch_xml_parse_section_string((char const *)arg1);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_outgoing_channel_outgoing_channel_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_outgoing_channel *arg1 = (switch_io_event_hook_outgoing_channel *) 0 ;
-  switch_outgoing_channel_hook_t arg2 = (switch_outgoing_channel_hook_t) 0 ;
-  
-  arg1 = (switch_io_event_hook_outgoing_channel *)jarg1; 
-  arg2 = (switch_outgoing_channel_hook_t)jarg2; 
-  if (arg1) (arg1)->outgoing_channel = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_outgoing_channel_outgoing_channel_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_outgoing_channel *arg1 = (switch_io_event_hook_outgoing_channel *) 0 ;
-  switch_outgoing_channel_hook_t result;
-  
-  arg1 = (switch_io_event_hook_outgoing_channel *)jarg1; 
-  result = (switch_outgoing_channel_hook_t) ((arg1)->outgoing_channel);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_outgoing_channel_next_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_outgoing_channel *arg1 = (switch_io_event_hook_outgoing_channel *) 0 ;
-  switch_io_event_hook_outgoing_channel *arg2 = (switch_io_event_hook_outgoing_channel *) 0 ;
-  
-  arg1 = (switch_io_event_hook_outgoing_channel *)jarg1; 
-  arg2 = (switch_io_event_hook_outgoing_channel *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_outgoing_channel_next_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_outgoing_channel *arg1 = (switch_io_event_hook_outgoing_channel *) 0 ;
-  switch_io_event_hook_outgoing_channel *result = 0 ;
-  
-  arg1 = (switch_io_event_hook_outgoing_channel *)jarg1; 
-  result = (switch_io_event_hook_outgoing_channel *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_outgoing_channel() {
-  void * jresult ;
-  switch_io_event_hook_outgoing_channel *result = 0 ;
-  
-  result = (switch_io_event_hook_outgoing_channel *)new switch_io_event_hook_outgoing_channel();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_outgoing_channel(void * jarg1) {
-  switch_io_event_hook_outgoing_channel *arg1 = (switch_io_event_hook_outgoing_channel *) 0 ;
-  
-  arg1 = (switch_io_event_hook_outgoing_channel *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_receive_message_receive_message_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_receive_message *arg1 = (switch_io_event_hook_receive_message *) 0 ;
-  switch_receive_message_hook_t arg2 = (switch_receive_message_hook_t) 0 ;
-  
-  arg1 = (switch_io_event_hook_receive_message *)jarg1; 
-  arg2 = (switch_receive_message_hook_t)jarg2; 
-  if (arg1) (arg1)->receive_message = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_receive_message_receive_message_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_receive_message *arg1 = (switch_io_event_hook_receive_message *) 0 ;
-  switch_receive_message_hook_t result;
-  
-  arg1 = (switch_io_event_hook_receive_message *)jarg1; 
-  result = (switch_receive_message_hook_t) ((arg1)->receive_message);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_receive_message_next_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_receive_message *arg1 = (switch_io_event_hook_receive_message *) 0 ;
-  switch_io_event_hook_receive_message *arg2 = (switch_io_event_hook_receive_message *) 0 ;
-  
-  arg1 = (switch_io_event_hook_receive_message *)jarg1; 
-  arg2 = (switch_io_event_hook_receive_message *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_receive_message_next_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_receive_message *arg1 = (switch_io_event_hook_receive_message *) 0 ;
-  switch_io_event_hook_receive_message *result = 0 ;
-  
-  arg1 = (switch_io_event_hook_receive_message *)jarg1; 
-  result = (switch_io_event_hook_receive_message *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_receive_message() {
-  void * jresult ;
-  switch_io_event_hook_receive_message *result = 0 ;
-  
-  result = (switch_io_event_hook_receive_message *)new switch_io_event_hook_receive_message();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_receive_message(void * jarg1) {
-  switch_io_event_hook_receive_message *arg1 = (switch_io_event_hook_receive_message *) 0 ;
-  
-  arg1 = (switch_io_event_hook_receive_message *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_receive_event_receive_event_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_receive_event *arg1 = (switch_io_event_hook_receive_event *) 0 ;
-  switch_receive_event_hook_t arg2 = (switch_receive_event_hook_t) 0 ;
-  
-  arg1 = (switch_io_event_hook_receive_event *)jarg1; 
-  arg2 = (switch_receive_event_hook_t)jarg2; 
-  if (arg1) (arg1)->receive_event = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_receive_event_receive_event_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_receive_event *arg1 = (switch_io_event_hook_receive_event *) 0 ;
-  switch_receive_event_hook_t result;
-  
-  arg1 = (switch_io_event_hook_receive_event *)jarg1; 
-  result = (switch_receive_event_hook_t) ((arg1)->receive_event);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_receive_event_next_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_receive_event *arg1 = (switch_io_event_hook_receive_event *) 0 ;
-  switch_io_event_hook_receive_event *arg2 = (switch_io_event_hook_receive_event *) 0 ;
-  
-  arg1 = (switch_io_event_hook_receive_event *)jarg1; 
-  arg2 = (switch_io_event_hook_receive_event *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_receive_event_next_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_receive_event *arg1 = (switch_io_event_hook_receive_event *) 0 ;
-  switch_io_event_hook_receive_event *result = 0 ;
-  
-  arg1 = (switch_io_event_hook_receive_event *)jarg1; 
-  result = (switch_io_event_hook_receive_event *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_receive_event() {
-  void * jresult ;
-  switch_io_event_hook_receive_event *result = 0 ;
-  
-  result = (switch_io_event_hook_receive_event *)new switch_io_event_hook_receive_event();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_receive_event(void * jarg1) {
-  switch_io_event_hook_receive_event *arg1 = (switch_io_event_hook_receive_event *) 0 ;
-  
-  arg1 = (switch_io_event_hook_receive_event *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_read_frame_read_frame_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_read_frame *arg1 = (switch_io_event_hook_read_frame *) 0 ;
-  switch_read_frame_hook_t arg2 = (switch_read_frame_hook_t) 0 ;
-  
-  arg1 = (switch_io_event_hook_read_frame *)jarg1; 
-  arg2 = (switch_read_frame_hook_t)jarg2; 
-  if (arg1) (arg1)->read_frame = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_read_frame_read_frame_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_read_frame *arg1 = (switch_io_event_hook_read_frame *) 0 ;
-  switch_read_frame_hook_t result;
-  
-  arg1 = (switch_io_event_hook_read_frame *)jarg1; 
-  result = (switch_read_frame_hook_t) ((arg1)->read_frame);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_read_frame_next_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_read_frame *arg1 = (switch_io_event_hook_read_frame *) 0 ;
-  switch_io_event_hook_read_frame *arg2 = (switch_io_event_hook_read_frame *) 0 ;
-  
-  arg1 = (switch_io_event_hook_read_frame *)jarg1; 
-  arg2 = (switch_io_event_hook_read_frame *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_read_frame_next_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_read_frame *arg1 = (switch_io_event_hook_read_frame *) 0 ;
-  switch_io_event_hook_read_frame *result = 0 ;
-  
-  arg1 = (switch_io_event_hook_read_frame *)jarg1; 
-  result = (switch_io_event_hook_read_frame *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_read_frame() {
-  void * jresult ;
-  switch_io_event_hook_read_frame *result = 0 ;
-  
-  result = (switch_io_event_hook_read_frame *)new switch_io_event_hook_read_frame();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_read_frame(void * jarg1) {
-  switch_io_event_hook_read_frame *arg1 = (switch_io_event_hook_read_frame *) 0 ;
-  
-  arg1 = (switch_io_event_hook_read_frame *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_video_read_frame_video_read_frame_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_video_read_frame *arg1 = (switch_io_event_hook_video_read_frame *) 0 ;
-  switch_read_frame_hook_t arg2 = (switch_read_frame_hook_t) 0 ;
-  
-  arg1 = (switch_io_event_hook_video_read_frame *)jarg1; 
-  arg2 = (switch_read_frame_hook_t)jarg2; 
-  if (arg1) (arg1)->video_read_frame = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_video_read_frame_video_read_frame_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_video_read_frame *arg1 = (switch_io_event_hook_video_read_frame *) 0 ;
-  switch_read_frame_hook_t result;
-  
-  arg1 = (switch_io_event_hook_video_read_frame *)jarg1; 
-  result = (switch_read_frame_hook_t) ((arg1)->video_read_frame);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_video_read_frame_next_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_video_read_frame *arg1 = (switch_io_event_hook_video_read_frame *) 0 ;
-  switch_io_event_hook_video_read_frame *arg2 = (switch_io_event_hook_video_read_frame *) 0 ;
-  
-  arg1 = (switch_io_event_hook_video_read_frame *)jarg1; 
-  arg2 = (switch_io_event_hook_video_read_frame *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_video_read_frame_next_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_video_read_frame *arg1 = (switch_io_event_hook_video_read_frame *) 0 ;
-  switch_io_event_hook_video_read_frame *result = 0 ;
-  
-  arg1 = (switch_io_event_hook_video_read_frame *)jarg1; 
-  result = (switch_io_event_hook_video_read_frame *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_video_read_frame() {
-  void * jresult ;
-  switch_io_event_hook_video_read_frame *result = 0 ;
-  
-  result = (switch_io_event_hook_video_read_frame *)new switch_io_event_hook_video_read_frame();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_video_read_frame(void * jarg1) {
-  switch_io_event_hook_video_read_frame *arg1 = (switch_io_event_hook_video_read_frame *) 0 ;
-  
-  arg1 = (switch_io_event_hook_video_read_frame *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_write_frame_write_frame_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_write_frame *arg1 = (switch_io_event_hook_write_frame *) 0 ;
-  switch_write_frame_hook_t arg2 = (switch_write_frame_hook_t) 0 ;
-  
-  arg1 = (switch_io_event_hook_write_frame *)jarg1; 
-  arg2 = (switch_write_frame_hook_t)jarg2; 
-  if (arg1) (arg1)->write_frame = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_write_frame_write_frame_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_write_frame *arg1 = (switch_io_event_hook_write_frame *) 0 ;
-  switch_write_frame_hook_t result;
-  
-  arg1 = (switch_io_event_hook_write_frame *)jarg1; 
-  result = (switch_write_frame_hook_t) ((arg1)->write_frame);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_write_frame_next_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_write_frame *arg1 = (switch_io_event_hook_write_frame *) 0 ;
-  switch_io_event_hook_write_frame *arg2 = (switch_io_event_hook_write_frame *) 0 ;
-  
-  arg1 = (switch_io_event_hook_write_frame *)jarg1; 
-  arg2 = (switch_io_event_hook_write_frame *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_write_frame_next_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_write_frame *arg1 = (switch_io_event_hook_write_frame *) 0 ;
-  switch_io_event_hook_write_frame *result = 0 ;
-  
-  arg1 = (switch_io_event_hook_write_frame *)jarg1; 
-  result = (switch_io_event_hook_write_frame *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_write_frame() {
-  void * jresult ;
-  switch_io_event_hook_write_frame *result = 0 ;
-  
-  result = (switch_io_event_hook_write_frame *)new switch_io_event_hook_write_frame();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_write_frame(void * jarg1) {
-  switch_io_event_hook_write_frame *arg1 = (switch_io_event_hook_write_frame *) 0 ;
-  
-  arg1 = (switch_io_event_hook_write_frame *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_video_write_frame_video_write_frame_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_video_write_frame *arg1 = (switch_io_event_hook_video_write_frame *) 0 ;
-  switch_video_write_frame_hook_t arg2 = (switch_video_write_frame_hook_t) 0 ;
-  
-  arg1 = (switch_io_event_hook_video_write_frame *)jarg1; 
-  arg2 = (switch_video_write_frame_hook_t)jarg2; 
-  if (arg1) (arg1)->video_write_frame = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_video_write_frame_video_write_frame_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_video_write_frame *arg1 = (switch_io_event_hook_video_write_frame *) 0 ;
-  switch_video_write_frame_hook_t result;
-  
-  arg1 = (switch_io_event_hook_video_write_frame *)jarg1; 
-  result = (switch_video_write_frame_hook_t) ((arg1)->video_write_frame);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_video_write_frame_next_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_video_write_frame *arg1 = (switch_io_event_hook_video_write_frame *) 0 ;
-  switch_io_event_hook_video_write_frame *arg2 = (switch_io_event_hook_video_write_frame *) 0 ;
-  
-  arg1 = (switch_io_event_hook_video_write_frame *)jarg1; 
-  arg2 = (switch_io_event_hook_video_write_frame *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_video_write_frame_next_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_video_write_frame *arg1 = (switch_io_event_hook_video_write_frame *) 0 ;
-  switch_io_event_hook_video_write_frame *result = 0 ;
-  
-  arg1 = (switch_io_event_hook_video_write_frame *)jarg1; 
-  result = (switch_io_event_hook_video_write_frame *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_video_write_frame() {
-  void * jresult ;
-  switch_io_event_hook_video_write_frame *result = 0 ;
-  
-  result = (switch_io_event_hook_video_write_frame *)new switch_io_event_hook_video_write_frame();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_video_write_frame(void * jarg1) {
-  switch_io_event_hook_video_write_frame *arg1 = (switch_io_event_hook_video_write_frame *) 0 ;
-  
-  arg1 = (switch_io_event_hook_video_write_frame *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_kill_channel_kill_channel_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_kill_channel *arg1 = (switch_io_event_hook_kill_channel *) 0 ;
-  switch_kill_channel_hook_t arg2 = (switch_kill_channel_hook_t) 0 ;
-  
-  arg1 = (switch_io_event_hook_kill_channel *)jarg1; 
-  arg2 = (switch_kill_channel_hook_t)jarg2; 
-  if (arg1) (arg1)->kill_channel = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_kill_channel_kill_channel_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_kill_channel *arg1 = (switch_io_event_hook_kill_channel *) 0 ;
-  switch_kill_channel_hook_t result;
-  
-  arg1 = (switch_io_event_hook_kill_channel *)jarg1; 
-  result = (switch_kill_channel_hook_t) ((arg1)->kill_channel);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_kill_channel_next_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_kill_channel *arg1 = (switch_io_event_hook_kill_channel *) 0 ;
-  switch_io_event_hook_kill_channel *arg2 = (switch_io_event_hook_kill_channel *) 0 ;
-  
-  arg1 = (switch_io_event_hook_kill_channel *)jarg1; 
-  arg2 = (switch_io_event_hook_kill_channel *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_kill_channel_next_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_kill_channel *arg1 = (switch_io_event_hook_kill_channel *) 0 ;
-  switch_io_event_hook_kill_channel *result = 0 ;
-  
-  arg1 = (switch_io_event_hook_kill_channel *)jarg1; 
-  result = (switch_io_event_hook_kill_channel *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_kill_channel() {
-  void * jresult ;
-  switch_io_event_hook_kill_channel *result = 0 ;
-  
-  result = (switch_io_event_hook_kill_channel *)new switch_io_event_hook_kill_channel();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_kill_channel(void * jarg1) {
-  switch_io_event_hook_kill_channel *arg1 = (switch_io_event_hook_kill_channel *) 0 ;
-  
-  arg1 = (switch_io_event_hook_kill_channel *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_send_dtmf_send_dtmf_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_send_dtmf *arg1 = (switch_io_event_hook_send_dtmf *) 0 ;
-  switch_send_dtmf_hook_t arg2 = (switch_send_dtmf_hook_t) 0 ;
-  
-  arg1 = (switch_io_event_hook_send_dtmf *)jarg1; 
-  arg2 = (switch_send_dtmf_hook_t)jarg2; 
-  if (arg1) (arg1)->send_dtmf = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_send_dtmf_send_dtmf_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_send_dtmf *arg1 = (switch_io_event_hook_send_dtmf *) 0 ;
-  switch_send_dtmf_hook_t result;
-  
-  arg1 = (switch_io_event_hook_send_dtmf *)jarg1; 
-  result = (switch_send_dtmf_hook_t) ((arg1)->send_dtmf);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_send_dtmf_next_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_send_dtmf *arg1 = (switch_io_event_hook_send_dtmf *) 0 ;
-  switch_io_event_hook_send_dtmf *arg2 = (switch_io_event_hook_send_dtmf *) 0 ;
-  
-  arg1 = (switch_io_event_hook_send_dtmf *)jarg1; 
-  arg2 = (switch_io_event_hook_send_dtmf *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_send_dtmf_next_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_send_dtmf *arg1 = (switch_io_event_hook_send_dtmf *) 0 ;
-  switch_io_event_hook_send_dtmf *result = 0 ;
-  
-  arg1 = (switch_io_event_hook_send_dtmf *)jarg1; 
-  result = (switch_io_event_hook_send_dtmf *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_send_dtmf() {
-  void * jresult ;
-  switch_io_event_hook_send_dtmf *result = 0 ;
-  
-  result = (switch_io_event_hook_send_dtmf *)new switch_io_event_hook_send_dtmf();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_send_dtmf(void * jarg1) {
-  switch_io_event_hook_send_dtmf *arg1 = (switch_io_event_hook_send_dtmf *) 0 ;
-  
-  arg1 = (switch_io_event_hook_send_dtmf *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_recv_dtmf_recv_dtmf_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_recv_dtmf *arg1 = (switch_io_event_hook_recv_dtmf *) 0 ;
-  switch_recv_dtmf_hook_t arg2 = (switch_recv_dtmf_hook_t) 0 ;
-  
-  arg1 = (switch_io_event_hook_recv_dtmf *)jarg1; 
-  arg2 = (switch_recv_dtmf_hook_t)jarg2; 
-  if (arg1) (arg1)->recv_dtmf = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_recv_dtmf_recv_dtmf_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_recv_dtmf *arg1 = (switch_io_event_hook_recv_dtmf *) 0 ;
-  switch_recv_dtmf_hook_t result;
-  
-  arg1 = (switch_io_event_hook_recv_dtmf *)jarg1; 
-  result = (switch_recv_dtmf_hook_t) ((arg1)->recv_dtmf);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_recv_dtmf_next_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_recv_dtmf *arg1 = (switch_io_event_hook_recv_dtmf *) 0 ;
-  switch_io_event_hook_recv_dtmf *arg2 = (switch_io_event_hook_recv_dtmf *) 0 ;
-  
-  arg1 = (switch_io_event_hook_recv_dtmf *)jarg1; 
-  arg2 = (switch_io_event_hook_recv_dtmf *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_recv_dtmf_next_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_recv_dtmf *arg1 = (switch_io_event_hook_recv_dtmf *) 0 ;
-  switch_io_event_hook_recv_dtmf *result = 0 ;
-  
-  arg1 = (switch_io_event_hook_recv_dtmf *)jarg1; 
-  result = (switch_io_event_hook_recv_dtmf *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_recv_dtmf() {
-  void * jresult ;
-  switch_io_event_hook_recv_dtmf *result = 0 ;
-  
-  result = (switch_io_event_hook_recv_dtmf *)new switch_io_event_hook_recv_dtmf();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_recv_dtmf(void * jarg1) {
-  switch_io_event_hook_recv_dtmf *arg1 = (switch_io_event_hook_recv_dtmf *) 0 ;
-  
-  arg1 = (switch_io_event_hook_recv_dtmf *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_state_change_state_change_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_state_change *arg1 = (switch_io_event_hook_state_change *) 0 ;
-  switch_state_change_hook_t arg2 = (switch_state_change_hook_t) 0 ;
-  
-  arg1 = (switch_io_event_hook_state_change *)jarg1; 
-  arg2 = (switch_state_change_hook_t)jarg2; 
-  if (arg1) (arg1)->state_change = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_state_change_state_change_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_state_change *arg1 = (switch_io_event_hook_state_change *) 0 ;
-  switch_state_change_hook_t result;
-  
-  arg1 = (switch_io_event_hook_state_change *)jarg1; 
-  result = (switch_state_change_hook_t) ((arg1)->state_change);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_state_change_next_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_state_change *arg1 = (switch_io_event_hook_state_change *) 0 ;
-  switch_io_event_hook_state_change *arg2 = (switch_io_event_hook_state_change *) 0 ;
-  
-  arg1 = (switch_io_event_hook_state_change *)jarg1; 
-  arg2 = (switch_io_event_hook_state_change *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_state_change_next_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_state_change *arg1 = (switch_io_event_hook_state_change *) 0 ;
-  switch_io_event_hook_state_change *result = 0 ;
-  
-  arg1 = (switch_io_event_hook_state_change *)jarg1; 
-  result = (switch_io_event_hook_state_change *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_state_change() {
-  void * jresult ;
-  switch_io_event_hook_state_change *result = 0 ;
-  
-  result = (switch_io_event_hook_state_change *)new switch_io_event_hook_state_change();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_state_change(void * jarg1) {
-  switch_io_event_hook_state_change *arg1 = (switch_io_event_hook_state_change *) 0 ;
-  
-  arg1 = (switch_io_event_hook_state_change *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_resurrect_session_resurrect_session_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_resurrect_session *arg1 = (switch_io_event_hook_resurrect_session *) 0 ;
-  switch_resurrect_session_hook_t arg2 = (switch_resurrect_session_hook_t) 0 ;
-  
-  arg1 = (switch_io_event_hook_resurrect_session *)jarg1; 
-  arg2 = (switch_resurrect_session_hook_t)jarg2; 
-  if (arg1) (arg1)->resurrect_session = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_resurrect_session_resurrect_session_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_resurrect_session *arg1 = (switch_io_event_hook_resurrect_session *) 0 ;
-  switch_resurrect_session_hook_t result;
-  
-  arg1 = (switch_io_event_hook_resurrect_session *)jarg1; 
-  result = (switch_resurrect_session_hook_t) ((arg1)->resurrect_session);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_resurrect_session_next_set(void * jarg1, void * jarg2) {
-  switch_io_event_hook_resurrect_session *arg1 = (switch_io_event_hook_resurrect_session *) 0 ;
-  switch_io_event_hook_resurrect_session *arg2 = (switch_io_event_hook_resurrect_session *) 0 ;
-  
-  arg1 = (switch_io_event_hook_resurrect_session *)jarg1; 
-  arg2 = (switch_io_event_hook_resurrect_session *)jarg2; 
-  if (arg1) (arg1)->next = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_resurrect_session_next_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hook_resurrect_session *arg1 = (switch_io_event_hook_resurrect_session *) 0 ;
-  switch_io_event_hook_resurrect_session *result = 0 ;
-  
-  arg1 = (switch_io_event_hook_resurrect_session *)jarg1; 
-  result = (switch_io_event_hook_resurrect_session *) ((arg1)->next);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_resurrect_session() {
-  void * jresult ;
-  switch_io_event_hook_resurrect_session *result = 0 ;
-  
-  result = (switch_io_event_hook_resurrect_session *)new switch_io_event_hook_resurrect_session();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_resurrect_session(void * jarg1) {
-  switch_io_event_hook_resurrect_session *arg1 = (switch_io_event_hook_resurrect_session *) 0 ;
-  
-  arg1 = (switch_io_event_hook_resurrect_session *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_outgoing_channel_set(void * jarg1, void * jarg2) {
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_outgoing_channel_t *arg2 = (switch_io_event_hook_outgoing_channel_t *) 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  arg2 = (switch_io_event_hook_outgoing_channel_t *)jarg2; 
-  if (arg1) (arg1)->outgoing_channel = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_outgoing_channel_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_outgoing_channel_t *result = 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  result = (switch_io_event_hook_outgoing_channel_t *) ((arg1)->outgoing_channel);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_receive_message_set(void * jarg1, void * jarg2) {
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_receive_message_t *arg2 = (switch_io_event_hook_receive_message_t *) 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  arg2 = (switch_io_event_hook_receive_message_t *)jarg2; 
-  if (arg1) (arg1)->receive_message = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_receive_message_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_receive_message_t *result = 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  result = (switch_io_event_hook_receive_message_t *) ((arg1)->receive_message);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_receive_event_set(void * jarg1, void * jarg2) {
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_receive_event_t *arg2 = (switch_io_event_hook_receive_event_t *) 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  arg2 = (switch_io_event_hook_receive_event_t *)jarg2; 
-  if (arg1) (arg1)->receive_event = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_receive_event_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_receive_event_t *result = 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  result = (switch_io_event_hook_receive_event_t *) ((arg1)->receive_event);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_read_frame_set(void * jarg1, void * jarg2) {
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_read_frame_t *arg2 = (switch_io_event_hook_read_frame_t *) 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  arg2 = (switch_io_event_hook_read_frame_t *)jarg2; 
-  if (arg1) (arg1)->read_frame = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_read_frame_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_read_frame_t *result = 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  result = (switch_io_event_hook_read_frame_t *) ((arg1)->read_frame);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_video_read_frame_set(void * jarg1, void * jarg2) {
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_video_read_frame_t *arg2 = (switch_io_event_hook_video_read_frame_t *) 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  arg2 = (switch_io_event_hook_video_read_frame_t *)jarg2; 
-  if (arg1) (arg1)->video_read_frame = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_video_read_frame_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_video_read_frame_t *result = 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  result = (switch_io_event_hook_video_read_frame_t *) ((arg1)->video_read_frame);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_write_frame_set(void * jarg1, void * jarg2) {
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_write_frame_t *arg2 = (switch_io_event_hook_write_frame_t *) 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  arg2 = (switch_io_event_hook_write_frame_t *)jarg2; 
-  if (arg1) (arg1)->write_frame = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_write_frame_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_write_frame_t *result = 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  result = (switch_io_event_hook_write_frame_t *) ((arg1)->write_frame);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_video_write_frame_set(void * jarg1, void * jarg2) {
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_video_write_frame_t *arg2 = (switch_io_event_hook_video_write_frame_t *) 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  arg2 = (switch_io_event_hook_video_write_frame_t *)jarg2; 
-  if (arg1) (arg1)->video_write_frame = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_video_write_frame_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_video_write_frame_t *result = 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  result = (switch_io_event_hook_video_write_frame_t *) ((arg1)->video_write_frame);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_kill_channel_set(void * jarg1, void * jarg2) {
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_kill_channel_t *arg2 = (switch_io_event_hook_kill_channel_t *) 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  arg2 = (switch_io_event_hook_kill_channel_t *)jarg2; 
-  if (arg1) (arg1)->kill_channel = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_kill_channel_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_kill_channel_t *result = 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  result = (switch_io_event_hook_kill_channel_t *) ((arg1)->kill_channel);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_send_dtmf_set(void * jarg1, void * jarg2) {
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_send_dtmf_t *arg2 = (switch_io_event_hook_send_dtmf_t *) 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  arg2 = (switch_io_event_hook_send_dtmf_t *)jarg2; 
-  if (arg1) (arg1)->send_dtmf = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_send_dtmf_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_send_dtmf_t *result = 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  result = (switch_io_event_hook_send_dtmf_t *) ((arg1)->send_dtmf);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_recv_dtmf_set(void * jarg1, void * jarg2) {
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_recv_dtmf_t *arg2 = (switch_io_event_hook_recv_dtmf_t *) 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  arg2 = (switch_io_event_hook_recv_dtmf_t *)jarg2; 
-  if (arg1) (arg1)->recv_dtmf = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_recv_dtmf_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_recv_dtmf_t *result = 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  result = (switch_io_event_hook_recv_dtmf_t *) ((arg1)->recv_dtmf);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_state_change_set(void * jarg1, void * jarg2) {
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_state_change_t *arg2 = (switch_io_event_hook_state_change_t *) 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  arg2 = (switch_io_event_hook_state_change_t *)jarg2; 
-  if (arg1) (arg1)->state_change = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_state_change_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_state_change_t *result = 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  result = (switch_io_event_hook_state_change_t *) ((arg1)->state_change);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_resurrect_session_set(void * jarg1, void * jarg2) {
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_resurrect_session_t *arg2 = (switch_io_event_hook_resurrect_session_t *) 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  arg2 = (switch_io_event_hook_resurrect_session_t *)jarg2; 
-  if (arg1) (arg1)->resurrect_session = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_resurrect_session_get(void * jarg1) {
-  void * jresult ;
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  switch_io_event_hook_resurrect_session_t *result = 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  result = (switch_io_event_hook_resurrect_session_t *) ((arg1)->resurrect_session);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hooks() {
-  void * jresult ;
-  switch_io_event_hooks *result = 0 ;
-  
-  result = (switch_io_event_hooks *)new switch_io_event_hooks();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hooks(void * jarg1) {
-  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
-  
-  arg1 = (switch_io_event_hooks *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_outgoing_channel(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_outgoing_channel_hook_t arg2 = (switch_outgoing_channel_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_outgoing_channel_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_add_outgoing_channel(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_receive_message(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_receive_message_hook_t arg2 = (switch_receive_message_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_receive_message_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_add_receive_message(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_receive_event(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_receive_event_hook_t arg2 = (switch_receive_event_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_receive_event_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_add_receive_event(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_state_change(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_state_change_hook_t arg2 = (switch_state_change_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_state_change_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_add_state_change(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_read_frame(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_read_frame_hook_t arg2 = (switch_read_frame_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_read_frame_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_add_read_frame(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_write_frame(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_write_frame_hook_t arg2 = (switch_write_frame_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_write_frame_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_add_write_frame(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_video_read_frame(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_video_read_frame_hook_t arg2 = (switch_video_read_frame_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_video_read_frame_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_add_video_read_frame(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_video_write_frame(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_video_write_frame_hook_t arg2 = (switch_video_write_frame_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_video_write_frame_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_add_video_write_frame(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_kill_channel(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_kill_channel_hook_t arg2 = (switch_kill_channel_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_kill_channel_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_add_kill_channel(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_send_dtmf(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_send_dtmf_hook_t arg2 = (switch_send_dtmf_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_send_dtmf_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_add_send_dtmf(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_recv_dtmf(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_recv_dtmf_hook_t arg2 = (switch_recv_dtmf_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_recv_dtmf_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_add_recv_dtmf(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_resurrect_session(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_resurrect_session_hook_t arg2 = (switch_resurrect_session_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_resurrect_session_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_add_resurrect_session(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_outgoing_channel(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_outgoing_channel_hook_t arg2 = (switch_outgoing_channel_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_outgoing_channel_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_remove_outgoing_channel(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_receive_message(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_receive_message_hook_t arg2 = (switch_receive_message_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_receive_message_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_remove_receive_message(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_receive_event(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_receive_event_hook_t arg2 = (switch_receive_event_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_receive_event_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_remove_receive_event(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_state_change(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_state_change_hook_t arg2 = (switch_state_change_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_state_change_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_remove_state_change(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_read_frame(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_read_frame_hook_t arg2 = (switch_read_frame_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_read_frame_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_remove_read_frame(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_write_frame(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_write_frame_hook_t arg2 = (switch_write_frame_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_write_frame_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_remove_write_frame(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_video_read_frame(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_video_read_frame_hook_t arg2 = (switch_video_read_frame_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_video_read_frame_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_remove_video_read_frame(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_video_write_frame(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_video_write_frame_hook_t arg2 = (switch_video_write_frame_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_video_write_frame_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_remove_video_write_frame(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_kill_channel(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_kill_channel_hook_t arg2 = (switch_kill_channel_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_kill_channel_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_remove_kill_channel(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_send_dtmf(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_send_dtmf_hook_t arg2 = (switch_send_dtmf_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_send_dtmf_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_remove_send_dtmf(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_recv_dtmf(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_recv_dtmf_hook_t arg2 = (switch_recv_dtmf_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_recv_dtmf_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_remove_recv_dtmf(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_resurrect_session(void * jarg1, void * jarg2) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_resurrect_session_hook_t arg2 = (switch_resurrect_session_hook_t) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (switch_resurrect_session_hook_t)jarg2; 
-  result = (switch_status_t)switch_core_event_hook_remove_resurrect_session(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_scheduler_task_created_set(void * jarg1, long long jarg2) {
-  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
-  int64_t arg2 ;
-  
-  arg1 = (switch_scheduler_task *)jarg1; 
-  arg2 = (int64_t)jarg2; 
-  if (arg1) (arg1)->created = arg2;
-  
-}
-
-
-SWIGEXPORT long long SWIGSTDCALL CSharp_switch_scheduler_task_created_get(void * jarg1) {
-  long long jresult ;
-  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
-  int64_t result;
-  
-  arg1 = (switch_scheduler_task *)jarg1; 
-  result = (int64_t) ((arg1)->created);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_scheduler_task_runtime_set(void * jarg1, long long jarg2) {
-  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
-  int64_t arg2 ;
-  
-  arg1 = (switch_scheduler_task *)jarg1; 
-  arg2 = (int64_t)jarg2; 
-  if (arg1) (arg1)->runtime = arg2;
-  
-}
-
-
-SWIGEXPORT long long SWIGSTDCALL CSharp_switch_scheduler_task_runtime_get(void * jarg1) {
-  long long jresult ;
-  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
-  int64_t result;
-  
-  arg1 = (switch_scheduler_task *)jarg1; 
-  result = (int64_t) ((arg1)->runtime);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_scheduler_task_cmd_id_set(void * jarg1, unsigned long jarg2) {
-  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_scheduler_task *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->cmd_id = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_scheduler_task_cmd_id_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_scheduler_task *)jarg1; 
-  result = (uint32_t) ((arg1)->cmd_id);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_scheduler_task_group_set(void * jarg1, char * jarg2) {
-  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (switch_scheduler_task *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->group) delete [] arg1->group;
-    if (arg2) {
-      arg1->group = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->group, (const char *)arg2);
-    } else {
-      arg1->group = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_scheduler_task_group_get(void * jarg1) {
-  char * jresult ;
-  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_scheduler_task *)jarg1; 
-  result = (char *) ((arg1)->group);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_scheduler_task_cmd_arg_set(void * jarg1, void * jarg2) {
-  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (switch_scheduler_task *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->cmd_arg = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_scheduler_task_cmd_arg_get(void * jarg1) {
-  void * jresult ;
-  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (switch_scheduler_task *)jarg1; 
-  result = (void *) ((arg1)->cmd_arg);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_scheduler_task_task_id_set(void * jarg1, unsigned long jarg2) {
-  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (switch_scheduler_task *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->task_id = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_scheduler_task_task_id_get(void * jarg1) {
-  unsigned long jresult ;
-  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
-  uint32_t result;
-  
-  arg1 = (switch_scheduler_task *)jarg1; 
-  result = (uint32_t) ((arg1)->task_id);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_scheduler_task() {
-  void * jresult ;
-  switch_scheduler_task *result = 0 ;
-  
-  result = (switch_scheduler_task *)new switch_scheduler_task();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_scheduler_task(void * jarg1) {
-  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
-  
-  arg1 = (switch_scheduler_task *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_scheduler_add_task(void * jarg1, void * jarg2, char * jarg3, char * jarg4, unsigned long jarg5, void * jarg6, unsigned long jarg7) {
-  unsigned long jresult ;
-  time_t arg1 ;
-  switch_scheduler_func_t arg2 = (switch_scheduler_func_t) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  uint32_t arg5 ;
-  void *arg6 = (void *) 0 ;
-  switch_scheduler_flag_t arg7 ;
-  uint32_t result;
-  time_t *argp1 ;
-  
-  argp1 = (time_t *)jarg1; 
-  if (!argp1) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null time_t", 0);
-    return 0;
-  }
-  arg1 = *argp1; 
-  arg2 = (switch_scheduler_func_t)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (uint32_t)jarg5; 
-  arg6 = (void *)jarg6; 
-  arg7 = (switch_scheduler_flag_t)jarg7; 
-  result = (uint32_t)switch_scheduler_add_task(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5,arg6,arg7);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_scheduler_del_task_id(unsigned long jarg1) {
-  unsigned long jresult ;
-  uint32_t arg1 ;
-  uint32_t result;
-  
-  arg1 = (uint32_t)jarg1; 
-  result = (uint32_t)switch_scheduler_del_task_id(arg1);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_scheduler_del_task_group(char * jarg1) {
-  unsigned long jresult ;
-  char *arg1 = (char *) 0 ;
-  uint32_t result;
-  
-  arg1 = (char *)jarg1; 
-  result = (uint32_t)switch_scheduler_del_task_group((char const *)arg1);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_scheduler_task_thread_start() {
-  switch_scheduler_task_thread_start();
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_scheduler_task_thread_stop() {
-  switch_scheduler_task_thread_stop();
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_config_file_set(void * jarg1, void * jarg2) {
-  switch_config *arg1 = (switch_config *) 0 ;
-  FILE *arg2 = (FILE *) 0 ;
-  
-  arg1 = (switch_config *)jarg1; 
-  arg2 = (FILE *)jarg2; 
-  if (arg1) (arg1)->file = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_switch_config_file_get(void * jarg1) {
-  void * jresult ;
-  switch_config *arg1 = (switch_config *) 0 ;
-  FILE *result = 0 ;
-  
-  arg1 = (switch_config *)jarg1; 
-  result = (FILE *) ((arg1)->file);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_config_path_set(void * jarg1, char * jarg2) {
-  switch_config *arg1 = (switch_config *) 0 ;
-  char *arg2 ;
-  
-  arg1 = (switch_config *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) strncpy((char *)arg1->path, (const char *)arg2, 512);
-    else arg1->path[0] = 0;
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_config_path_get(void * jarg1) {
-  char * jresult ;
-  switch_config *arg1 = (switch_config *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_config *)jarg1; 
-  result = (char *)(char *) ((arg1)->path);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_config_category_set(void * jarg1, char * jarg2) {
-  switch_config *arg1 = (switch_config *) 0 ;
-  char *arg2 ;
-  
-  arg1 = (switch_config *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) strncpy((char *)arg1->category, (const char *)arg2, 256);
-    else arg1->category[0] = 0;
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_config_category_get(void * jarg1) {
-  char * jresult ;
-  switch_config *arg1 = (switch_config *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_config *)jarg1; 
-  result = (char *)(char *) ((arg1)->category);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_config_section_set(void * jarg1, char * jarg2) {
-  switch_config *arg1 = (switch_config *) 0 ;
-  char *arg2 ;
-  
-  arg1 = (switch_config *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) strncpy((char *)arg1->section, (const char *)arg2, 256);
-    else arg1->section[0] = 0;
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_config_section_get(void * jarg1) {
-  char * jresult ;
-  switch_config *arg1 = (switch_config *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_config *)jarg1; 
-  result = (char *)(char *) ((arg1)->section);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_config_buf_set(void * jarg1, char * jarg2) {
-  switch_config *arg1 = (switch_config *) 0 ;
-  char *arg2 ;
-  
-  arg1 = (switch_config *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg2) strncpy((char *)arg1->buf, (const char *)arg2, 1024);
-    else arg1->buf[0] = 0;
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_switch_config_buf_get(void * jarg1) {
-  char * jresult ;
-  switch_config *arg1 = (switch_config *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (switch_config *)jarg1; 
-  result = (char *)(char *) ((arg1)->buf);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_config_lineno_set(void * jarg1, int jarg2) {
-  switch_config *arg1 = (switch_config *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_config *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->lineno = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_config_lineno_get(void * jarg1) {
-  int jresult ;
-  switch_config *arg1 = (switch_config *) 0 ;
-  int result;
-  
-  arg1 = (switch_config *)jarg1; 
-  result = (int) ((arg1)->lineno);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_config_catno_set(void * jarg1, int jarg2) {
-  switch_config *arg1 = (switch_config *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_config *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->catno = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_config_catno_get(void * jarg1) {
-  int jresult ;
-  switch_config *arg1 = (switch_config *) 0 ;
-  int result;
-  
-  arg1 = (switch_config *)jarg1; 
-  result = (int) ((arg1)->catno);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_config_sectno_set(void * jarg1, int jarg2) {
-  switch_config *arg1 = (switch_config *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_config *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->sectno = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_config_sectno_get(void * jarg1) {
-  int jresult ;
-  switch_config *arg1 = (switch_config *) 0 ;
-  int result;
-  
-  arg1 = (switch_config *)jarg1; 
-  result = (int) ((arg1)->sectno);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_config_lockto_set(void * jarg1, int jarg2) {
-  switch_config *arg1 = (switch_config *) 0 ;
-  int arg2 ;
-  
-  arg1 = (switch_config *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->lockto = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_config_lockto_get(void * jarg1) {
-  int jresult ;
-  switch_config *arg1 = (switch_config *) 0 ;
-  int result;
-  
-  arg1 = (switch_config *)jarg1; 
-  result = (int) ((arg1)->lockto);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_config() {
-  void * jresult ;
-  switch_config *result = 0 ;
-  
-  result = (switch_config *)new switch_config();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_config(void * jarg1) {
-  switch_config *arg1 = (switch_config *) 0 ;
-  
-  arg1 = (switch_config *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_config_open_file(void * jarg1, char * jarg2) {
-  int jresult ;
-  switch_config_t *arg1 = (switch_config_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int result;
-  
-  arg1 = (switch_config_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (int)switch_config_open_file(arg1,arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_switch_config_close_file(void * jarg1) {
-  switch_config_t *arg1 = (switch_config_t *) 0 ;
-  
-  arg1 = (switch_config_t *)jarg1; 
-  switch_config_close_file(arg1);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_switch_config_next_pair(void * jarg1, void * jarg2, void * jarg3) {
-  int jresult ;
-  switch_config_t *arg1 = (switch_config_t *) 0 ;
-  char **arg2 = (char **) 0 ;
-  char **arg3 = (char **) 0 ;
-  int result;
-  
-  arg1 = (switch_config_t *)jarg1; 
-  arg2 = (char **)jarg2; 
-  arg3 = (char **)jarg3; 
-  result = (int)switch_config_next_pair(arg1,arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_consoleLog(char * jarg1, char * jarg2) {
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  consoleLog(arg1,arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_consoleCleanLog(char * jarg1) {
-  char *arg1 = (char *) 0 ;
-  
-  arg1 = (char *)jarg1; 
-  consoleCleanLog(arg1);
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_IvrMenu(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, int jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16) {
-  void * jresult ;
-  IVRMenu *arg1 = (IVRMenu *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  char *arg5 = (char *) 0 ;
-  char *arg6 = (char *) 0 ;
-  char *arg7 = (char *) 0 ;
-  char *arg8 = (char *) 0 ;
-  char *arg9 = (char *) 0 ;
-  char *arg10 = (char *) 0 ;
-  int arg11 ;
-  int arg12 ;
-  int arg13 ;
-  int arg14 ;
-  int arg15 ;
-  int arg16 ;
-  IVRMenu *result = 0 ;
-  
-  arg1 = (IVRMenu *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (char *)jarg5; 
-  arg6 = (char *)jarg6; 
-  arg7 = (char *)jarg7; 
-  arg8 = (char *)jarg8; 
-  arg9 = (char *)jarg9; 
-  arg10 = (char *)jarg10; 
-  arg11 = (int)jarg11; 
-  arg12 = (int)jarg12; 
-  arg13 = (int)jarg13; 
-  arg14 = (int)jarg14; 
-  arg15 = (int)jarg15; 
-  arg16 = (int)jarg16; 
-  result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,arg11,arg12,arg13,arg14,arg15,arg16);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_IvrMenu(void * jarg1) {
-  IVRMenu *arg1 = (IVRMenu *) 0 ;
-  
-  arg1 = (IVRMenu *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_IvrMenu_bindAction(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
-  IVRMenu *arg1 = (IVRMenu *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  
-  arg1 = (IVRMenu *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  (arg1)->bindAction(arg2,(char const *)arg3,(char const *)arg4);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_IvrMenu_Execute(void * jarg1, void * jarg2, char * jarg3) {
-  IVRMenu *arg1 = (IVRMenu *) 0 ;
-  CoreSession *arg2 = (CoreSession *) 0 ;
-  char *arg3 = (char *) 0 ;
-  
-  arg1 = (IVRMenu *)jarg1; 
-  arg2 = (CoreSession *)jarg2; 
-  arg3 = (char *)jarg3; 
-  (arg1)->execute(arg2,(char const *)arg3);
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_Api() {
-  void * jresult ;
-  API *result = 0 ;
-  
-  result = (API *)new API();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_Api(void * jarg1) {
-  API *arg1 = (API *) 0 ;
-  
-  arg1 = (API *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_Api_Execute(void * jarg1, char * jarg2, char * jarg3) {
-  char * jresult ;
-  API *arg1 = (API *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) NULL ;
-  char *result = 0 ;
-  
-  arg1 = (API *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (char *)(arg1)->execute((char const *)arg2,(char const *)arg3);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_Api_ExecuteString(void * jarg1, char * jarg2) {
-  char * jresult ;
-  API *arg1 = (API *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (API *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (char *)(arg1)->executeString((char const *)arg2);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_Api_getTime(void * jarg1) {
-  char * jresult ;
-  API *arg1 = (API *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (API *)jarg1; 
-  result = (char *)(arg1)->getTime();
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_input_callback_state_t_function_set(void * jarg1, void * jarg2) {
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (input_callback_state_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->function = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_input_callback_state_t_function_get(void * jarg1) {
-  void * jresult ;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (input_callback_state_t *)jarg1; 
-  result = (void *) ((arg1)->function);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_input_callback_state_t_threadState_set(void * jarg1, void * jarg2) {
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (input_callback_state_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->threadState = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_input_callback_state_t_threadState_get(void * jarg1) {
-  void * jresult ;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (input_callback_state_t *)jarg1; 
-  result = (void *) ((arg1)->threadState);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_input_callback_state_t_extra_set(void * jarg1, void * jarg2) {
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  
-  arg1 = (input_callback_state_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  if (arg1) (arg1)->extra = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_input_callback_state_t_extra_get(void * jarg1) {
-  void * jresult ;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (input_callback_state_t *)jarg1; 
-  result = (void *) ((arg1)->extra);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_input_callback_state_t_funcargs_set(void * jarg1, char * jarg2) {
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (input_callback_state_t *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->funcargs) delete [] arg1->funcargs;
-    if (arg2) {
-      arg1->funcargs = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->funcargs, (const char *)arg2);
-    } else {
-      arg1->funcargs = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_input_callback_state_t_funcargs_get(void * jarg1) {
-  char * jresult ;
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (input_callback_state_t *)jarg1; 
-  result = (char *) ((arg1)->funcargs);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_input_callback_state_t() {
-  void * jresult ;
-  input_callback_state_t *result = 0 ;
-  
-  result = (input_callback_state_t *)new input_callback_state_t();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_input_callback_state_t(void * jarg1) {
-  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
-  
-  arg1 = (input_callback_state_t *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_DTMF_digit_set(void * jarg1, char jarg2) {
-  DTMF *arg1 = (DTMF *) 0 ;
-  char arg2 ;
-  
-  arg1 = (DTMF *)jarg1; 
-  arg2 = (char)jarg2; 
-  if (arg1) (arg1)->digit = arg2;
-  
-}
-
-
-SWIGEXPORT char SWIGSTDCALL CSharp_DTMF_digit_get(void * jarg1) {
-  char jresult ;
-  DTMF *arg1 = (DTMF *) 0 ;
-  char result;
-  
-  arg1 = (DTMF *)jarg1; 
-  result = (char) ((arg1)->digit);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_DTMF_duration_set(void * jarg1, unsigned long jarg2) {
-  DTMF *arg1 = (DTMF *) 0 ;
-  uint32_t arg2 ;
-  
-  arg1 = (DTMF *)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  if (arg1) (arg1)->duration = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned long SWIGSTDCALL CSharp_DTMF_duration_get(void * jarg1) {
-  unsigned long jresult ;
-  DTMF *arg1 = (DTMF *) 0 ;
-  uint32_t result;
-  
-  arg1 = (DTMF *)jarg1; 
-  result = (uint32_t) ((arg1)->duration);
-  jresult = (unsigned long)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_DTMF(char jarg1, unsigned long jarg2) {
-  void * jresult ;
-  char arg1 ;
-  uint32_t arg2 = (uint32_t) 2000 ;
-  DTMF *result = 0 ;
-  
-  arg1 = (char)jarg1; 
-  arg2 = (uint32_t)jarg2; 
-  result = (DTMF *)new DTMF(arg1,arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_DTMF(void * jarg1) {
-  DTMF *arg1 = (DTMF *) 0 ;
-  
-  arg1 = (DTMF *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_Stream__SWIG_0() {
-  void * jresult ;
-  Stream *result = 0 ;
-  
-  result = (Stream *)new Stream();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_Stream__SWIG_1(void * jarg1) {
-  void * jresult ;
-  switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ;
-  Stream *result = 0 ;
-  
-  arg1 = (switch_stream_handle_t *)jarg1; 
-  result = (Stream *)new Stream(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_Stream(void * jarg1) {
-  Stream *arg1 = (Stream *) 0 ;
-  
-  arg1 = (Stream *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_Stream_Write(void * jarg1, char * jarg2) {
-  Stream *arg1 = (Stream *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (Stream *)jarg1; 
-  arg2 = (char *)jarg2; 
-  (arg1)->write((char const *)arg2);
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_Stream_get_data(void * jarg1) {
-  char * jresult ;
-  Stream *arg1 = (Stream *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (Stream *)jarg1; 
-  result = (char *)(arg1)->get_data();
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_Event_InternalEvent_set(void * jarg1, void * jarg2) {
-  Event *arg1 = (Event *) 0 ;
-  switch_event_t *arg2 = (switch_event_t *) 0 ;
-  
-  arg1 = (Event *)jarg1; 
-  arg2 = (switch_event_t *)jarg2; 
-  if (arg1) (arg1)->event = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_Event_InternalEvent_get(void * jarg1) {
-  void * jresult ;
-  Event *arg1 = (Event *) 0 ;
-  switch_event_t *result = 0 ;
-  
-  arg1 = (Event *)jarg1; 
-  result = (switch_event_t *) ((arg1)->event);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_Event_serialized_string_set(void * jarg1, char * jarg2) {
-  Event *arg1 = (Event *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (Event *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->serialized_string) delete [] arg1->serialized_string;
-    if (arg2) {
-      arg1->serialized_string = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->serialized_string, (const char *)arg2);
-    } else {
-      arg1->serialized_string = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_Event_serialized_string_get(void * jarg1) {
-  char * jresult ;
-  Event *arg1 = (Event *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (Event *)jarg1; 
-  result = (char *) ((arg1)->serialized_string);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_Event_mine_set(void * jarg1, int jarg2) {
-  Event *arg1 = (Event *) 0 ;
-  int arg2 ;
-  
-  arg1 = (Event *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->mine = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_Event_mine_get(void * jarg1) {
-  int jresult ;
-  Event *arg1 = (Event *) 0 ;
-  int result;
-  
-  arg1 = (Event *)jarg1; 
-  result = (int) ((arg1)->mine);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_Event__SWIG_0(char * jarg1, char * jarg2) {
-  void * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) NULL ;
-  Event *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (Event *)new Event((char const *)arg1,(char const *)arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_Event__SWIG_1(void * jarg1, int jarg2) {
-  void * jresult ;
-  switch_event_t *arg1 = (switch_event_t *) 0 ;
-  int arg2 = (int) 0 ;
-  Event *result = 0 ;
-  
-  arg1 = (switch_event_t *)jarg1; 
-  arg2 = (int)jarg2; 
-  result = (Event *)new Event(arg1,arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_Event(void * jarg1) {
-  Event *arg1 = (Event *) 0 ;
-  
-  arg1 = (Event *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_Event_Serialize(void * jarg1, char * jarg2) {
-  char * jresult ;
-  Event *arg1 = (Event *) 0 ;
-  char *arg2 = (char *) NULL ;
-  char *result = 0 ;
-  
-  arg1 = (Event *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (char *)(arg1)->serialize((char const *)arg2);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_Event_SetPriority(void * jarg1, int jarg2) {
-  unsigned int jresult ;
-  Event *arg1 = (Event *) 0 ;
-  switch_priority_t arg2 = (switch_priority_t) SWITCH_PRIORITY_NORMAL ;
-  bool result;
-  
-  arg1 = (Event *)jarg1; 
-  arg2 = (switch_priority_t)jarg2; 
-  result = (bool)(arg1)->setPriority(arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_Event_GetHeader(void * jarg1, char * jarg2) {
-  char * jresult ;
-  Event *arg1 = (Event *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (Event *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (char *)(arg1)->getHeader(arg2);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_Event_GetBody(void * jarg1) {
-  char * jresult ;
-  Event *arg1 = (Event *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (Event *)jarg1; 
-  result = (char *)(arg1)->getBody();
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_Event_GetEventType(void * jarg1) {
-  char * jresult ;
-  Event *arg1 = (Event *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (Event *)jarg1; 
-  result = (char *)(arg1)->getType();
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_Event_AddBody(void * jarg1, char * jarg2) {
-  unsigned int jresult ;
-  Event *arg1 = (Event *) 0 ;
-  char *arg2 = (char *) 0 ;
-  bool result;
-  
-  arg1 = (Event *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (bool)(arg1)->addBody((char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_Event_AddHeader(void * jarg1, char * jarg2, char * jarg3) {
-  unsigned int jresult ;
-  Event *arg1 = (Event *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  bool result;
-  
-  arg1 = (Event *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_Event_DeleteHeader(void * jarg1, char * jarg2) {
-  unsigned int jresult ;
-  Event *arg1 = (Event *) 0 ;
-  char *arg2 = (char *) 0 ;
-  bool result;
-  
-  arg1 = (Event *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (bool)(arg1)->delHeader((char const *)arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_Event_Fire(void * jarg1) {
-  unsigned int jresult ;
-  Event *arg1 = (Event *) 0 ;
-  bool result;
-  
-  arg1 = (Event *)jarg1; 
-  result = (bool)(arg1)->fire();
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_EventConsumer_events_set(void * jarg1, void * jarg2) {
-  EventConsumer *arg1 = (EventConsumer *) 0 ;
-  switch_queue_t *arg2 = (switch_queue_t *) 0 ;
-  
-  arg1 = (EventConsumer *)jarg1; 
-  arg2 = (switch_queue_t *)jarg2; 
-  if (arg1) (arg1)->events = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_EventConsumer_events_get(void * jarg1) {
-  void * jresult ;
-  EventConsumer *arg1 = (EventConsumer *) 0 ;
-  switch_queue_t *result = 0 ;
-  
-  arg1 = (EventConsumer *)jarg1; 
-  result = (switch_queue_t *) ((arg1)->events);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_EventConsumer_e_event_id_set(void * jarg1, int jarg2) {
-  EventConsumer *arg1 = (EventConsumer *) 0 ;
-  switch_event_types_t arg2 ;
-  
-  arg1 = (EventConsumer *)jarg1; 
-  arg2 = (switch_event_types_t)jarg2; 
-  if (arg1) (arg1)->e_event_id = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_EventConsumer_e_event_id_get(void * jarg1) {
-  int jresult ;
-  EventConsumer *arg1 = (EventConsumer *) 0 ;
-  switch_event_types_t result;
-  
-  arg1 = (EventConsumer *)jarg1; 
-  result = (switch_event_types_t) ((arg1)->e_event_id);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_EventConsumer_node_set(void * jarg1, void * jarg2) {
-  EventConsumer *arg1 = (EventConsumer *) 0 ;
-  switch_event_node_t *arg2 = (switch_event_node_t *) 0 ;
-  
-  arg1 = (EventConsumer *)jarg1; 
-  arg2 = (switch_event_node_t *)jarg2; 
-  if (arg1) (arg1)->node = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_EventConsumer_node_get(void * jarg1) {
-  void * jresult ;
-  EventConsumer *arg1 = (EventConsumer *) 0 ;
-  switch_event_node_t *result = 0 ;
-  
-  arg1 = (EventConsumer *)jarg1; 
-  result = (switch_event_node_t *) ((arg1)->node);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_EventConsumer_e_callback_set(void * jarg1, char * jarg2) {
-  EventConsumer *arg1 = (EventConsumer *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (EventConsumer *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->e_callback) delete [] arg1->e_callback;
-    if (arg2) {
-      arg1->e_callback = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->e_callback, (const char *)arg2);
-    } else {
-      arg1->e_callback = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_EventConsumer_e_callback_get(void * jarg1) {
-  char * jresult ;
-  EventConsumer *arg1 = (EventConsumer *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (EventConsumer *)jarg1; 
-  result = (char *) ((arg1)->e_callback);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_EventConsumer_e_subclass_name_set(void * jarg1, char * jarg2) {
-  EventConsumer *arg1 = (EventConsumer *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (EventConsumer *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->e_subclass_name) delete [] arg1->e_subclass_name;
-    if (arg2) {
-      arg1->e_subclass_name = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->e_subclass_name, (const char *)arg2);
-    } else {
-      arg1->e_subclass_name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_EventConsumer_e_subclass_name_get(void * jarg1) {
-  char * jresult ;
-  EventConsumer *arg1 = (EventConsumer *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (EventConsumer *)jarg1; 
-  result = (char *) ((arg1)->e_subclass_name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_EventConsumer_e_cb_arg_set(void * jarg1, char * jarg2) {
-  EventConsumer *arg1 = (EventConsumer *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (EventConsumer *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->e_cb_arg) delete [] arg1->e_cb_arg;
-    if (arg2) {
-      arg1->e_cb_arg = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->e_cb_arg, (const char *)arg2);
-    } else {
-      arg1->e_cb_arg = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_EventConsumer_e_cb_arg_get(void * jarg1) {
-  char * jresult ;
-  EventConsumer *arg1 = (EventConsumer *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (EventConsumer *)jarg1; 
-  result = (char *) ((arg1)->e_cb_arg);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_EventConsumer(char * jarg1, char * jarg2) {
-  void * jresult ;
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) "" ;
-  EventConsumer *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (EventConsumer *)new EventConsumer((char const *)arg1,(char const *)arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_EventConsumer(void * jarg1) {
-  EventConsumer *arg1 = (EventConsumer *) 0 ;
-  
-  arg1 = (EventConsumer *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_EventConsumer_pop(void * jarg1, int jarg2) {
-  void * jresult ;
-  EventConsumer *arg1 = (EventConsumer *) 0 ;
-  int arg2 = (int) 0 ;
-  Event *result = 0 ;
-  
-  arg1 = (EventConsumer *)jarg1; 
-  arg2 = (int)jarg2; 
-  result = (Event *)(arg1)->pop(arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_CoreSession(void * jarg1) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_InternalSession_set(void * jarg1, void * jarg2) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (switch_core_session_t *)jarg2; 
-  if (arg1) (arg1)->session = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_CoreSession_InternalSession_get(void * jarg1) {
-  void * jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_core_session_t *result = 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (switch_core_session_t *) ((arg1)->session);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_Channel_set(void * jarg1, void * jarg2) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_channel_t *arg2 = (switch_channel_t *) 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (switch_channel_t *)jarg2; 
-  if (arg1) (arg1)->channel = arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_CoreSession_Channel_get(void * jarg1) {
-  void * jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_channel_t *result = 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (switch_channel_t *) ((arg1)->channel);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_Flags_set(void * jarg1, unsigned int jarg2) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  unsigned int arg2 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (unsigned int)jarg2; 
-  if (arg1) (arg1)->flags = arg2;
-  
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_CoreSession_Flags_get(void * jarg1) {
-  unsigned int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  unsigned int result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (unsigned int) ((arg1)->flags);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_Allocated_set(void * jarg1, int jarg2) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int arg2 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (int)jarg2; 
-  if (arg1) (arg1)->allocated = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_Allocated_get(void * jarg1) {
-  int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (int) ((arg1)->allocated);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_CallbackState_set(void * jarg1, void * jarg2) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  input_callback_state *arg2 = (input_callback_state *) 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (input_callback_state *)jarg2; 
-  if (arg1) (arg1)->cb_state = *arg2;
-  
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_CoreSession_CallbackState_get(void * jarg1) {
-  void * jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  input_callback_state *result = 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (input_callback_state *)& ((arg1)->cb_state);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_HookState_set(void * jarg1, int jarg2) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_channel_state_t arg2 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (switch_channel_state_t)jarg2; 
-  if (arg1) (arg1)->hook_state = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_HookState_get(void * jarg1) {
-  int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_channel_state_t result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (switch_channel_state_t) ((arg1)->hook_state);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_CallCause_set(void * jarg1, int jarg2) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_call_cause_t arg2 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (switch_call_cause_t)jarg2; 
-  if (arg1) (arg1)->cause = arg2;
-  
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_CallCause_get(void * jarg1) {
-  int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_call_cause_t result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (switch_call_cause_t) ((arg1)->cause);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_UuidString_set(void * jarg1, char * jarg2) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->uuid) delete [] arg1->uuid;
-    if (arg2) {
-      arg1->uuid = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->uuid, (const char *)arg2);
-    } else {
-      arg1->uuid = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_UuidString_get(void * jarg1) {
-  char * jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (char *) ((arg1)->uuid);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_TextToSpeechEngine_set(void * jarg1, char * jarg2) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->tts_name) delete [] arg1->tts_name;
-    if (arg2) {
-      arg1->tts_name = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->tts_name, (const char *)arg2);
-    } else {
-      arg1->tts_name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_TextToSpeechEngine_get(void * jarg1) {
-  char * jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (char *) ((arg1)->tts_name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_TextToSpeechVoice_set(void * jarg1, char * jarg2) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (char *)jarg2; 
-  {
-    if (arg1->voice_name) delete [] arg1->voice_name;
-    if (arg2) {
-      arg1->voice_name = (char *) (new char[strlen((const char *)arg2)+1]);
-      strcpy((char *)arg1->voice_name, (const char *)arg2);
-    } else {
-      arg1->voice_name = 0;
-    }
-  }
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_TextToSpeechVoice_get(void * jarg1) {
-  char * jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (char *) ((arg1)->voice_name);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_Answer(void * jarg1) {
-  int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (int)(arg1)->answer();
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_PreAnswer(void * jarg1) {
-  int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (int)(arg1)->preAnswer();
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_Hangup(void * jarg1, char * jarg2) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) "normal_clearing" ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (char *)jarg2; 
-  (arg1)->hangup((char const *)arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_HangupState(void * jarg1) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  (arg1)->hangupState();
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_SetVariable(void * jarg1, char * jarg2, char * jarg3) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  (arg1)->setVariable(arg2,arg3);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_SetPrivate(void * jarg1, char * jarg2, void * jarg3) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *arg3 = (void *) 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (void *)jarg3; 
-  (arg1)->setPrivate(arg2,arg3);
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_CoreSession_GetPrivate(void * jarg1, char * jarg2) {
-  void * jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  void *result = 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (void *)(arg1)->getPrivate(arg2);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_GetVariable(void * jarg1, char * jarg2) {
-  char * jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (char *)(arg1)->getVariable(arg2);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_Say(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  char *arg4 = (char *) 0 ;
-  char *arg5 = (char *) 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (char *)jarg5; 
-  (arg1)->say((char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_SayPhrase(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) "" ;
-  char *arg4 = (char *) NULL ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  (arg1)->sayPhrase((char const *)arg2,(char const *)arg3,(char const *)arg4);
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_HangupCause(void * jarg1) {
-  char * jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (char *)(arg1)->hangupCause();
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_GetState(void * jarg1) {
-  char * jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (char *)(arg1)->getState();
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_RecordFile(void * jarg1, char * jarg2, int jarg3, int jarg4, int jarg5) {
-  int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int arg3 = (int) 0 ;
-  int arg4 = (int) 0 ;
-  int arg5 = (int) 0 ;
-  int result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (int)jarg3; 
-  arg4 = (int)jarg4; 
-  arg5 = (int)jarg5; 
-  result = (int)(arg1)->recordFile(arg2,arg3,arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_originate(void * jarg1, void * jarg2, char * jarg3, int jarg4, void * jarg5) {
-  int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  CoreSession *arg2 = (CoreSession *) 0 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 = (int) 60 ;
-  switch_state_handler_table_t *arg5 = (switch_state_handler_table_t *) NULL ;
-  int result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (CoreSession *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (int)jarg4; 
-  arg5 = (switch_state_handler_table_t *)jarg5; 
-  result = (int)(arg1)->originate(arg2,arg3,arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_Destroy(void * jarg1) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  (arg1)->destroy();
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_Speak(void * jarg1, char * jarg2) {
-  int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (char *)jarg2; 
-  result = (int)(arg1)->speak(arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_SetTtsParameters(void * jarg1, char * jarg2, char * jarg3) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  (arg1)->set_tts_parms(arg2,arg3);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_CollectDigits__SWIG_0(void * jarg1, int jarg2) {
-  int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int arg2 ;
-  int result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (int)jarg2; 
-  result = (int)(arg1)->collectDigits(arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_CollectDigits__SWIG_1(void * jarg1, int jarg2, int jarg3) {
-  int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int arg2 ;
-  int arg3 ;
-  int result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (int)jarg2; 
-  arg3 = (int)jarg3; 
-  result = (int)(arg1)->collectDigits(arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_GetDigits__SWIG_0(void * jarg1, int jarg2, char * jarg3, int jarg4) {
-  char * jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int arg2 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  char *result = 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (int)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (int)jarg4; 
-  result = (char *)(arg1)->getDigits(arg2,arg3,arg4);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_GetDigits__SWIG_1(void * jarg1, int jarg2, char * jarg3, int jarg4, int jarg5) {
-  char * jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int arg2 ;
-  char *arg3 = (char *) 0 ;
-  int arg4 ;
-  int arg5 ;
-  char *result = 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (int)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (int)jarg4; 
-  arg5 = (int)jarg5; 
-  result = (char *)(arg1)->getDigits(arg2,arg3,arg4,arg5);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_Transfer(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
-  int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) NULL ;
-  char *arg4 = (char *) NULL ;
-  int result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  arg4 = (char *)jarg4; 
-  result = (int)(arg1)->transfer(arg2,arg3,arg4);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_Read(void * jarg1, int jarg2, int jarg3, char * jarg4, int jarg5, char * jarg6) {
-  char * jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int arg2 ;
-  int arg3 ;
-  char *arg4 = (char *) 0 ;
-  int arg5 ;
-  char *arg6 = (char *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (int)jarg2; 
-  arg3 = (int)jarg3; 
-  arg4 = (char *)jarg4; 
-  arg5 = (int)jarg5; 
-  arg6 = (char *)jarg6; 
-  result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_PlayAndGetDigits(void * jarg1, int jarg2, int jarg3, int jarg4, int jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10) {
-  char * jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int arg2 ;
-  int arg3 ;
-  int arg4 ;
-  int arg5 ;
-  char *arg6 = (char *) 0 ;
-  char *arg7 = (char *) 0 ;
-  char *arg8 = (char *) 0 ;
-  char *arg9 = (char *) 0 ;
-  char *arg10 = (char *) NULL ;
-  char *result = 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (int)jarg2; 
-  arg3 = (int)jarg3; 
-  arg4 = (int)jarg4; 
-  arg5 = (int)jarg5; 
-  arg6 = (char *)jarg6; 
-  arg7 = (char *)jarg7; 
-  arg8 = (char *)jarg8; 
-  arg9 = (char *)jarg9; 
-  arg10 = (char *)jarg10; 
-  result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,(char const *)arg10);
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_StreamFile(void * jarg1, char * jarg2, int jarg3) {
-  int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  int arg3 = (int) 0 ;
-  int result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (int)jarg3; 
-  result = (int)(arg1)->streamFile(arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_Sleep(void * jarg1, int jarg2, int jarg3) {
-  int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int arg2 ;
-  int arg3 = (int) 0 ;
-  int result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (int)jarg2; 
-  arg3 = (int)jarg3; 
-  result = (int)(arg1)->sleep(arg2,arg3);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_FlushEvents(void * jarg1) {
-  int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (int)(arg1)->flushEvents();
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_FlushDigits(void * jarg1) {
-  int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  int result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (int)(arg1)->flushDigits();
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_SetAutoHangup(void * jarg1, unsigned int jarg2) {
-  int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  bool arg2 ;
-  int result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = jarg2 ? true : false; 
-  result = (int)(arg1)->setAutoHangup(arg2);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_CoreSession_Ready(void * jarg1) {
-  unsigned int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  bool result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (bool)(arg1)->ready();
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_CoreSession_Answered(void * jarg1) {
-  unsigned int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  bool result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (bool)(arg1)->answered();
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_CoreSession_MediaReady(void * jarg1) {
-  unsigned int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  bool result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (bool)(arg1)->mediaReady();
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_WaitForAnswer(void * jarg1, void * jarg2) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  CoreSession *arg2 = (CoreSession *) 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (CoreSession *)jarg2; 
-  (arg1)->waitForAnswer(arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_Execute(void * jarg1, char * jarg2, char * jarg3) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *arg2 = (char *) 0 ;
-  char *arg3 = (char *) NULL ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (char *)jarg2; 
-  arg3 = (char *)jarg3; 
-  (arg1)->execute((char const *)arg2,(char const *)arg3);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_SendEvent(void * jarg1, void * jarg2) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  Event *arg2 = (Event *) 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (Event *)jarg2; 
-  (arg1)->sendEvent(arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_QueuePrivateEvent(void * jarg1, void * jarg2) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  Event *arg2 = (Event *) 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (Event *)jarg2; 
-  (arg1)->queuePrivateEvent(arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_SetEventData(void * jarg1, void * jarg2) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  Event *arg2 = (Event *) 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  arg2 = (Event *)jarg2; 
-  (arg1)->setEventData(arg2);
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_GetXmlCdr(void * jarg1) {
-  char * jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (char *)(arg1)->getXMLCDR();
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_CoreSession_BeginAllowThreads(void * jarg1) {
-  unsigned int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  bool result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (bool)(arg1)->begin_allow_threads();
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT unsigned int SWIGSTDCALL CSharp_CoreSession_EndAllowThreads(void * jarg1) {
-  unsigned int jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  bool result;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (bool)(arg1)->end_allow_threads();
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_GetUuid(void * jarg1) {
-  char * jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  char *result = 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  result = (char *)((CoreSession const *)arg1)->get_uuid();
-  jresult = SWIG_csharp_string_callback((const char *)result); 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_CoreSession_GetCallbackArguments(void * jarg1) {
-  void * jresult ;
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  switch_input_args_t *result = 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  {
-    switch_input_args_t const &_result_ref = ((CoreSession const *)arg1)->get_cb_args();
-    result = (switch_input_args_t *) &_result_ref;
-  }
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_CheckHangupHook(void * jarg1) {
-  CoreSession *arg1 = (CoreSession *) 0 ;
-  
-  arg1 = (CoreSession *)jarg1; 
-  (arg1)->check_hangup_hook();
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_console_log(char * jarg1, char * jarg2) {
-  char *arg1 = (char *) 0 ;
-  char *arg2 = (char *) 0 ;
-  
-  arg1 = (char *)jarg1; 
-  arg2 = (char *)jarg2; 
-  console_log(arg1,arg2);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_console_clean_log(char * jarg1) {
-  char *arg1 = (char *) 0 ;
-  
-  arg1 = (char *)jarg1; 
-  console_clean_log(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_msleep(unsigned int jarg1) {
-  unsigned int arg1 ;
-  
-  arg1 = (unsigned int)jarg1; 
-  msleep(arg1);
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_bridge(void * jarg1, void * jarg2) {
-  CoreSession *arg1 = 0 ;
-  CoreSession *arg2 = 0 ;
-  
-  arg1 = (CoreSession *)jarg1;
-  if(!arg1) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "CoreSession & type is null", 0);
-    return ;
-  } 
-  arg2 = (CoreSession *)jarg2;
-  if(!arg2) {
-    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "CoreSession & type is null", 0);
-    return ;
-  } 
-  bridge(*arg1,*arg2);
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_hanguphook(void * jarg1) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (switch_status_t)hanguphook(arg1);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT int SWIGSTDCALL CSharp_dtmf_callback(void * jarg1, void * jarg2, int jarg3, void * jarg4, unsigned int jarg5) {
-  int jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  void *arg2 = (void *) 0 ;
-  switch_input_type_t arg3 ;
-  void *arg4 = (void *) 0 ;
-  unsigned int arg5 ;
-  switch_status_t result;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  arg2 = (void *)jarg2; 
-  arg3 = (switch_input_type_t)jarg3; 
-  arg4 = (void *)jarg4; 
-  arg5 = (unsigned int)jarg5; 
-  result = (switch_status_t)dtmf_callback(arg1,arg2,arg3,arg4,arg5);
-  jresult = result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_ManagedSession__SWIG_0() {
-  void * jresult ;
-  ManagedSession *result = 0 ;
-  
-  result = (ManagedSession *)new ManagedSession();
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_ManagedSession__SWIG_1(char * jarg1) {
-  void * jresult ;
-  char *arg1 = (char *) 0 ;
-  ManagedSession *result = 0 ;
-  
-  arg1 = (char *)jarg1; 
-  result = (ManagedSession *)new ManagedSession(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void * SWIGSTDCALL CSharp_new_ManagedSession__SWIG_2(void * jarg1) {
-  void * jresult ;
-  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
-  ManagedSession *result = 0 ;
-  
-  arg1 = (switch_core_session_t *)jarg1; 
-  result = (ManagedSession *)new ManagedSession(arg1);
-  jresult = (void *)result; 
-  return jresult;
-}
-
-
-SWIGEXPORT void SWIGSTDCALL CSharp_delete_ManagedSession(void * jarg1) {
-  ManagedSession *arg1 = (ManagedSession *) 0 ;
-  
-  arg1 = (ManagedSession *)jarg1; 
-  delete arg1;
-  
-}
-
-
-SWIGEXPORT CoreSession * SWIGSTDCALL CSharp_ManagedSessionUpcast(ManagedSession *objectRef) {
-    return (CoreSession *)objectRef;
-}
-
-#ifdef __cplusplus
-}
-#endif
-
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ * 
+ * This file is not intended to be easily readable and contains a number of 
+ * coding conventions designed to improve portability and efficiency. Do not make
+ * changes to this file unless you know what you are doing--modify the SWIG 
+ * interface file instead. 
+ * ----------------------------------------------------------------------------- */
+
+
+#ifdef __cplusplus
+template<typename T> class SwigValueWrapper {
+    T *tt;
+public:
+    SwigValueWrapper() : tt(0) { }
+    SwigValueWrapper(const SwigValueWrapper<T>& rhs) : tt(new T(*rhs.tt)) { }
+    SwigValueWrapper(const T& t) : tt(new T(t)) { }
+    ~SwigValueWrapper() { delete tt; } 
+    SwigValueWrapper& operator=(const T& t) { delete tt; tt = new T(t); return *this; }
+    operator T&() const { return *tt; }
+    T *operator&() { return tt; }
+private:
+    SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
+};
+
+template <typename T> T SwigValueInit() {
+  return T();
+}
+#endif
+
+/* -----------------------------------------------------------------------------
+ *  This section contains generic SWIG labels for method/variable
+ *  declarations/attributes, and other compiler dependent labels.
+ * ----------------------------------------------------------------------------- */
+
+/* template workaround for compilers that cannot correctly implement the C++ standard */
+#ifndef SWIGTEMPLATEDISAMBIGUATOR
+# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# elif defined(__HP_aCC)
+/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
+/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
+#  define SWIGTEMPLATEDISAMBIGUATOR template
+# else
+#  define SWIGTEMPLATEDISAMBIGUATOR
+# endif
+#endif
+
+/* inline attribute */
+#ifndef SWIGINLINE
+# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
+#   define SWIGINLINE inline
+# else
+#   define SWIGINLINE
+# endif
+#endif
+
+/* attribute recognised by some compilers to avoid 'unused' warnings */
+#ifndef SWIGUNUSED
+# if defined(__GNUC__)
+#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
+#     define SWIGUNUSED __attribute__ ((__unused__)) 
+#   else
+#     define SWIGUNUSED
+#   endif
+# elif defined(__ICC)
+#   define SWIGUNUSED __attribute__ ((__unused__)) 
+# else
+#   define SWIGUNUSED 
+# endif
+#endif
+
+#ifndef SWIGUNUSEDPARM
+# ifdef __cplusplus
+#   define SWIGUNUSEDPARM(p)
+# else
+#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
+# endif
+#endif
+
+/* internal SWIG method */
+#ifndef SWIGINTERN
+# define SWIGINTERN static SWIGUNUSED
+#endif
+
+/* internal inline SWIG method */
+#ifndef SWIGINTERNINLINE
+# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
+#endif
+
+/* exporting methods */
+#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
+#  ifndef GCC_HASCLASSVISIBILITY
+#    define GCC_HASCLASSVISIBILITY
+#  endif
+#endif
+
+#ifndef SWIGEXPORT
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   if defined(STATIC_LINKED)
+#     define SWIGEXPORT
+#   else
+#     define SWIGEXPORT __declspec(dllexport)
+#   endif
+# else
+#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
+#     define SWIGEXPORT __attribute__ ((visibility("default")))
+#   else
+#     define SWIGEXPORT
+#   endif
+# endif
+#endif
+
+/* calling conventions for Windows */
+#ifndef SWIGSTDCALL
+# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
+#   define SWIGSTDCALL __stdcall
+# else
+#   define SWIGSTDCALL
+# endif 
+#endif
+
+/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
+#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
+# define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
+#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
+# define _SCL_SECURE_NO_DEPRECATE
+#endif
+
+
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+
+/* Support for throwing C# exceptions from C/C++. There are two types: 
+ * Exceptions that take a message and ArgumentExceptions that take a message and a parameter name. */
+typedef enum {
+  SWIG_CSharpApplicationException,
+  SWIG_CSharpArithmeticException,
+  SWIG_CSharpDivideByZeroException,
+  SWIG_CSharpIndexOutOfRangeException,
+  SWIG_CSharpInvalidCastException,
+  SWIG_CSharpInvalidOperationException,
+  SWIG_CSharpIOException,
+  SWIG_CSharpNullReferenceException,
+  SWIG_CSharpOutOfMemoryException,
+  SWIG_CSharpOverflowException,
+  SWIG_CSharpSystemException
+} SWIG_CSharpExceptionCodes;
+
+typedef enum {
+  SWIG_CSharpArgumentException,
+  SWIG_CSharpArgumentNullException,
+  SWIG_CSharpArgumentOutOfRangeException
+} SWIG_CSharpExceptionArgumentCodes;
+
+typedef void (SWIGSTDCALL* SWIG_CSharpExceptionCallback_t)(const char *);
+typedef void (SWIGSTDCALL* SWIG_CSharpExceptionArgumentCallback_t)(const char *, const char *);
+
+typedef struct {
+  SWIG_CSharpExceptionCodes code;
+  SWIG_CSharpExceptionCallback_t callback;
+} SWIG_CSharpException_t;
+
+typedef struct {
+  SWIG_CSharpExceptionArgumentCodes code;
+  SWIG_CSharpExceptionArgumentCallback_t callback;
+} SWIG_CSharpExceptionArgument_t;
+
+static SWIG_CSharpException_t SWIG_csharp_exceptions[] = {
+  { SWIG_CSharpApplicationException, NULL },
+  { SWIG_CSharpArithmeticException, NULL },
+  { SWIG_CSharpDivideByZeroException, NULL },
+  { SWIG_CSharpIndexOutOfRangeException, NULL },
+  { SWIG_CSharpInvalidCastException, NULL },
+  { SWIG_CSharpInvalidOperationException, NULL },
+  { SWIG_CSharpIOException, NULL },
+  { SWIG_CSharpNullReferenceException, NULL },
+  { SWIG_CSharpOutOfMemoryException, NULL },
+  { SWIG_CSharpOverflowException, NULL },
+  { SWIG_CSharpSystemException, NULL }
+};
+
+static SWIG_CSharpExceptionArgument_t SWIG_csharp_exceptions_argument[] = {
+  { SWIG_CSharpArgumentException, NULL },
+  { SWIG_CSharpArgumentNullException, NULL },
+  { SWIG_CSharpArgumentOutOfRangeException, NULL },
+};
+
+static void SWIGUNUSED SWIG_CSharpSetPendingException(SWIG_CSharpExceptionCodes code, const char *msg) {
+  SWIG_CSharpExceptionCallback_t callback = SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback;
+  if (code >=0 && (size_t)code < sizeof(SWIG_csharp_exceptions)/sizeof(SWIG_CSharpException_t)) {
+    callback = SWIG_csharp_exceptions[code].callback;
+  }
+  callback(msg);
+}
+
+static void SWIGUNUSED SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpExceptionArgumentCodes code, const char *msg, const char *param_name) {
+  SWIG_CSharpExceptionArgumentCallback_t callback = SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback;
+  if (code >=0 && (size_t)code < sizeof(SWIG_csharp_exceptions_argument)/sizeof(SWIG_CSharpExceptionArgument_t)) {
+    callback = SWIG_csharp_exceptions_argument[code].callback;
+  }
+  callback(msg, param_name);
+}
+
+
+#ifdef __cplusplus
+extern "C" 
+#endif
+SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionCallbacks_freeswitch(
+                                                SWIG_CSharpExceptionCallback_t applicationCallback,
+                                                SWIG_CSharpExceptionCallback_t arithmeticCallback,
+                                                SWIG_CSharpExceptionCallback_t divideByZeroCallback, 
+                                                SWIG_CSharpExceptionCallback_t indexOutOfRangeCallback, 
+                                                SWIG_CSharpExceptionCallback_t invalidCastCallback,
+                                                SWIG_CSharpExceptionCallback_t invalidOperationCallback,
+                                                SWIG_CSharpExceptionCallback_t ioCallback,
+                                                SWIG_CSharpExceptionCallback_t nullReferenceCallback,
+                                                SWIG_CSharpExceptionCallback_t outOfMemoryCallback, 
+                                                SWIG_CSharpExceptionCallback_t overflowCallback, 
+                                                SWIG_CSharpExceptionCallback_t systemCallback) {
+  SWIG_csharp_exceptions[SWIG_CSharpApplicationException].callback = applicationCallback;
+  SWIG_csharp_exceptions[SWIG_CSharpArithmeticException].callback = arithmeticCallback;
+  SWIG_csharp_exceptions[SWIG_CSharpDivideByZeroException].callback = divideByZeroCallback;
+  SWIG_csharp_exceptions[SWIG_CSharpIndexOutOfRangeException].callback = indexOutOfRangeCallback;
+  SWIG_csharp_exceptions[SWIG_CSharpInvalidCastException].callback = invalidCastCallback;
+  SWIG_csharp_exceptions[SWIG_CSharpInvalidOperationException].callback = invalidOperationCallback;
+  SWIG_csharp_exceptions[SWIG_CSharpIOException].callback = ioCallback;
+  SWIG_csharp_exceptions[SWIG_CSharpNullReferenceException].callback = nullReferenceCallback;
+  SWIG_csharp_exceptions[SWIG_CSharpOutOfMemoryException].callback = outOfMemoryCallback;
+  SWIG_csharp_exceptions[SWIG_CSharpOverflowException].callback = overflowCallback;
+  SWIG_csharp_exceptions[SWIG_CSharpSystemException].callback = systemCallback;
+}
+
+#ifdef __cplusplus
+extern "C" 
+#endif
+SWIGEXPORT void SWIGSTDCALL SWIGRegisterExceptionArgumentCallbacks_freeswitch(
+                                                SWIG_CSharpExceptionArgumentCallback_t argumentCallback,
+                                                SWIG_CSharpExceptionArgumentCallback_t argumentNullCallback,
+                                                SWIG_CSharpExceptionArgumentCallback_t argumentOutOfRangeCallback) {
+  SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentException].callback = argumentCallback;
+  SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentNullException].callback = argumentNullCallback;
+  SWIG_csharp_exceptions_argument[SWIG_CSharpArgumentOutOfRangeException].callback = argumentOutOfRangeCallback;
+}
+
+
+/* Contract support */
+
+#define SWIG_contract_assert(nullreturn, expr, msg) if (!(expr)) {SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentOutOfRangeException, msg, ""); return nullreturn; } else
+
+
+
+/* Callback for returning strings to C# without leaking memory */
+#ifndef _MANAGED
+#include <glib.h>
+#include <mono/jit/jit.h>
+#include <mono/metadata/environment.h>
+#include <mono/metadata/mono-config.h>
+#include <mono/metadata/threads.h>
+#include <mono/metadata/debug-helpers.h>
+#endif
+
+typedef char * (SWIGSTDCALL* SWIG_CSharpStringHelperCallback)(const char *);
+static SWIG_CSharpStringHelperCallback SWIG_csharp_string_callback_real = NULL;
+
+
+#ifdef __cplusplus
+extern "C" 
+#endif
+SWIGEXPORT void SWIGSTDCALL SWIGRegisterStringCallback_freeswitch(SWIG_CSharpStringHelperCallback callback) {
+	/* Set this only once, in the main appdomain */
+	if (SWIG_csharp_string_callback_real == NULL) SWIG_csharp_string_callback_real = callback;
+}
+char * SWIG_csharp_string_callback(const char * str) {
+#ifndef _MANAGED
+	// Mono won't transition appdomains properly after the callback, so we force it
+	MonoDomain* dom = mono_domain_get();
+	char* res = SWIG_csharp_string_callback_real(str);
+	mono_domain_set(dom, true);
+	return res;
+#else
+	return SWIG_csharp_string_callback_real(str);
+#endif
+}
+
+
+#include "switch.h"
+#include "switch_cpp.h"
+#include "freeswitch_managed.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_FREESWITCH_PEN_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "27880";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_FREESWITCH_OID_PREFIX_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) ".1.3.6.1.4.1.27880";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_FREESWITCH_ITAD_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "543";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp___EXTENSIONS___get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 1;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp___BSD_VISIBLE_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 1;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ENT_ORIGINATE_DELIM_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) ":_:";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_BLANK_STRING_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\0";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_ESC_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\33[";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char SWIGSTDCALL CSharp_SWITCH_SEQ_HOME_CHAR_get() {
+  char jresult ;
+  char result;
+  
+  result = (char) 'H';
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_HOME_CHAR_STR_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "H";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char SWIGSTDCALL CSharp_SWITCH_SEQ_CLEARLINE_CHAR_get() {
+  char jresult ;
+  char result;
+  
+  result = (char) '1';
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_CLEARLINE_CHAR_STR_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "1";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_CLEARLINEEND_CHAR_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "K";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char SWIGSTDCALL CSharp_SWITCH_SEQ_CLEARSCR_CHAR0_get() {
+  char jresult ;
+  char result;
+  
+  result = (char) '2';
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char SWIGSTDCALL CSharp_SWITCH_SEQ_CLEARSCR_CHAR1_get() {
+  char jresult ;
+  char result;
+  
+  result = (char) 'J';
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_CLEARSCR_CHAR_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "2J";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_AND_COLOR_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) ";";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_END_COLOR_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "m";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_F_BLACK_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "30";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_F_RED_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "31";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_F_GREEN_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "32";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_F_YELLOW_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "33";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_F_BLUE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "34";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_F_MAGEN_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "35";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_F_CYAN_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "36";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_F_WHITE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "37";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_B_BLACK_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "40";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_B_RED_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "41";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_B_GREEN_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "42";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_B_YELLOW_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "43";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_B_BLUE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "44";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_B_MAGEN_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "45";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_B_CYAN_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "46";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_B_WHITE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "47";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_FBLACK_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\33[30m";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_FRED_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\33[31m";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_FGREEN_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\33[32m";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_FYELLOW_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\33[33m";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_FBLUE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\33[34m";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_FMAGEN_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\33[35m";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_FCYAN_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\33[36m";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_FWHITE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\33[37m";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_BBLACK_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\33[40m";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_BRED_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\33[41m";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_BGREEN_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\33[42m";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_BYELLOW_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\33[43m";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_BBLUE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\33[44m";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_BMAGEN_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\33[45m";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_BCYAN_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\33[46m";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_BWHITE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\33[47m";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_HOME_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\33[H";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_CLEARLINE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\33[1";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_CLEARLINEEND_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\33[K";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEQ_CLEARSCR_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\33[2J\33[H";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_DEFAULT_CLID_NAME_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "\0";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_DEFAULT_DTMF_DURATION_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 2000;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MIN_DTMF_DURATION_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 400;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_DTMF_DURATION_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 192000;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PATH_SEPARATOR_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "/";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_URL_SEPARATOR_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "://";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "ignore_display_updates";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_AUDIO_SPOOL_PATH_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "audio_spool_path";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "bridge_hangup_cause";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_READ_TERMINATOR_USED_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "read_terminator_used";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "send_silence_when_idle";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CURRENT_APPLICATION_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "current_application";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CURRENT_APPLICATION_DATA_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "current_application_data";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "current_application_response";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "enable_heartbeat_events";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "bypass_media_after_bridge";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_READ_RESULT_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "read_result";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_COPY_XML_CDR_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "copy_xml_cdr";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "proto_specific_hangup_cause";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "execute_on_answer";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "execute_on_pre_answer";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "execute_on_media";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "api_on_answer";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "execute_on_ring";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CALL_TIMEOUT_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "call_timeout";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_HOLDING_UUID_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "holding_uuid";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SOFT_HOLDING_UUID_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "soft_holding_uuid";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_API_BRIDGE_END_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "api_after_bridge";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_API_HANGUP_HOOK_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "api_hangup_hook";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "session_in_hangup_hook";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PROCESS_CDR_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "process_cdr";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_BRIDGE_CHANNEL_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "bridge_channel";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_NAME_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "channel_name";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_BRIDGE_UUID_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "bridge_uuid";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CONTINUE_ON_FAILURE_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "continue_on_fail";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PLAYBACK_TERMINATORS_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "playback_terminators";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PLAYBACK_TERMINATOR_USED_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "playback_terminator_used";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CACHE_SPEECH_HANDLES_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "cache_speech_handles";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "__cache_speech_handles_obj__";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_BYPASS_MEDIA_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "bypass_media";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PROXY_MEDIA_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "proxy_media";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "endpoint_disposition";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_HOLD_MUSIC_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "hold_music";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_EXPORT_VARS_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "export_vars";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_R_SDP_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "switch_r_sdp";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_L_SDP_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "switch_l_sdp";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_B_SDP_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "switch_m_sdp";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_BRIDGE_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "bridge_to";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SIGNAL_BRIDGE_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "signal_bridge_to";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SIGNAL_BOND_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "signal_bond";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ORIGINATOR_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "originator";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ORIGINATOR_CODEC_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "originator_codec";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "originator_video_codec";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_LOCAL_MEDIA_IP_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "local_media_ip";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_LOCAL_MEDIA_PORT_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "local_media_port";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_REMOTE_MEDIA_IP_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "remote_media_ip";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_REMOTE_MEDIA_PORT_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "remote_media_port";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_REMOTE_VIDEO_IP_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "remote_video_ip";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_REMOTE_VIDEO_PORT_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "remote_video_port";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_LOCAL_VIDEO_IP_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "local_video_ip";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_LOCAL_VIDEO_PORT_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "local_video_port";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "hangup_after_bridge";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_PARK_AFTER_BRIDGE_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "park_after_bridge";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "transfer_after_bridge";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "exec_after_bridge_app";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "exec_after_bridge_arg";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_MAX_FORWARDS_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "max_forwards";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_DISABLE_APP_LOG_VARIABLE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "disable_app_log";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_SPEECH_KEY_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "speech";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_UUID_BRIDGE_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "uuid_bridge";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_BITS_PER_BYTE_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 8;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_DEFAULT_FILE_BUFFER_LEN_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 65536;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_DTMF_LOG_LEN_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 1000;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_dtmf_t_digit_set(void * jarg1, char jarg2) {
+  switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ;
+  char arg2 ;
+  
+  arg1 = (switch_dtmf_t *)jarg1; 
+  arg2 = (char)jarg2; 
+  if (arg1) (arg1)->digit = arg2;
+  
+}
+
+
+SWIGEXPORT char SWIGSTDCALL CSharp_switch_dtmf_t_digit_get(void * jarg1) {
+  char jresult ;
+  switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ;
+  char result;
+  
+  arg1 = (switch_dtmf_t *)jarg1; 
+  result = (char) ((arg1)->digit);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_dtmf_t_duration_set(void * jarg1, unsigned long jarg2) {
+  switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_dtmf_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->duration = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_dtmf_t_duration_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_dtmf_t *)jarg1; 
+  result = (uint32_t) ((arg1)->duration);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_dtmf_t() {
+  void * jresult ;
+  switch_dtmf_t *result = 0 ;
+  
+  result = (switch_dtmf_t *)new switch_dtmf_t();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_dtmf_t(void * jarg1) {
+  switch_dtmf_t *arg1 = (switch_dtmf_t *) 0 ;
+  
+  arg1 = (switch_dtmf_t *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_buf_set(void * jarg1, void * jarg2) {
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  switch_byte_t *arg2 = (switch_byte_t *) 0 ;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  arg2 = (switch_byte_t *)jarg2; 
+  if (arg1) (arg1)->buf = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_bitpack_t_buf_get(void * jarg1) {
+  void * jresult ;
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  switch_byte_t *result = 0 ;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  result = (switch_byte_t *) ((arg1)->buf);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_buflen_set(void * jarg1, unsigned long jarg2) {
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->buflen = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_bitpack_t_buflen_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  result = (uint32_t) ((arg1)->buflen);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_cur_set(void * jarg1, void * jarg2) {
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  switch_byte_t *arg2 = (switch_byte_t *) 0 ;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  arg2 = (switch_byte_t *)jarg2; 
+  if (arg1) (arg1)->cur = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_bitpack_t_cur_get(void * jarg1) {
+  void * jresult ;
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  switch_byte_t *result = 0 ;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  result = (switch_byte_t *) ((arg1)->cur);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_bytes_set(void * jarg1, unsigned long jarg2) {
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->bytes = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_bitpack_t_bytes_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  result = (uint32_t) ((arg1)->bytes);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_bits_tot_set(void * jarg1, unsigned long jarg2) {
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->bits_tot = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_bitpack_t_bits_tot_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  result = (uint32_t) ((arg1)->bits_tot);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_bits_cur_set(void * jarg1, unsigned char jarg2) {
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  switch_byte_t arg2 ;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  arg2 = (switch_byte_t)jarg2; 
+  if (arg1) (arg1)->bits_cur = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_bitpack_t_bits_cur_get(void * jarg1) {
+  unsigned char jresult ;
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  switch_byte_t result;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  result = (switch_byte_t) ((arg1)->bits_cur);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_bits_rem_set(void * jarg1, unsigned char jarg2) {
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  switch_byte_t arg2 ;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  arg2 = (switch_byte_t)jarg2; 
+  if (arg1) (arg1)->bits_rem = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_bitpack_t_bits_rem_get(void * jarg1) {
+  unsigned char jresult ;
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  switch_byte_t result;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  result = (switch_byte_t) ((arg1)->bits_rem);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_frame_bits_set(void * jarg1, unsigned char jarg2) {
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  switch_byte_t arg2 ;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  arg2 = (switch_byte_t)jarg2; 
+  if (arg1) (arg1)->frame_bits = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_bitpack_t_frame_bits_get(void * jarg1) {
+  unsigned char jresult ;
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  switch_byte_t result;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  result = (switch_byte_t) ((arg1)->frame_bits);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_shiftby_set(void * jarg1, unsigned char jarg2) {
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  switch_byte_t arg2 ;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  arg2 = (switch_byte_t)jarg2; 
+  if (arg1) (arg1)->shiftby = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_bitpack_t_shiftby_get(void * jarg1) {
+  unsigned char jresult ;
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  switch_byte_t result;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  result = (switch_byte_t) ((arg1)->shiftby);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_this_byte_set(void * jarg1, unsigned char jarg2) {
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  switch_byte_t arg2 ;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  arg2 = (switch_byte_t)jarg2; 
+  if (arg1) (arg1)->this_byte = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_bitpack_t_this_byte_get(void * jarg1) {
+  unsigned char jresult ;
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  switch_byte_t result;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  result = (switch_byte_t) ((arg1)->this_byte);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_under_set(void * jarg1, unsigned char jarg2) {
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  switch_byte_t arg2 ;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  arg2 = (switch_byte_t)jarg2; 
+  if (arg1) (arg1)->under = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_bitpack_t_under_get(void * jarg1) {
+  unsigned char jresult ;
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  switch_byte_t result;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  result = (switch_byte_t) ((arg1)->under);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_over_set(void * jarg1, unsigned char jarg2) {
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  switch_byte_t arg2 ;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  arg2 = (switch_byte_t)jarg2; 
+  if (arg1) (arg1)->over = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_bitpack_t_over_get(void * jarg1) {
+  unsigned char jresult ;
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  switch_byte_t result;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  result = (switch_byte_t) ((arg1)->over);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_bitpack_t_mode_set(void * jarg1, int jarg2) {
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  switch_bitpack_mode_t arg2 ;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  arg2 = (switch_bitpack_mode_t)jarg2; 
+  if (arg1) (arg1)->mode = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_bitpack_t_mode_get(void * jarg1) {
+  int jresult ;
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  switch_bitpack_mode_t result;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  result = (switch_bitpack_mode_t) ((arg1)->mode);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_bitpack_t() {
+  void * jresult ;
+  switch_bitpack_t *result = 0 ;
+  
+  result = (switch_bitpack_t *)new switch_bitpack_t();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_bitpack_t(void * jarg1) {
+  switch_bitpack_t *arg1 = (switch_bitpack_t *) 0 ;
+  
+  arg1 = (switch_bitpack_t *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_base_dir_set(void * jarg1, char * jarg2) {
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->base_dir) delete [] arg1->base_dir;
+    if (arg2) {
+      arg1->base_dir = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->base_dir, (const char *)arg2);
+    } else {
+      arg1->base_dir = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_base_dir_get(void * jarg1) {
+  char * jresult ;
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  result = (char *) ((arg1)->base_dir);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_mod_dir_set(void * jarg1, char * jarg2) {
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->mod_dir) delete [] arg1->mod_dir;
+    if (arg2) {
+      arg1->mod_dir = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->mod_dir, (const char *)arg2);
+    } else {
+      arg1->mod_dir = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_mod_dir_get(void * jarg1) {
+  char * jresult ;
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  result = (char *) ((arg1)->mod_dir);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_conf_dir_set(void * jarg1, char * jarg2) {
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->conf_dir) delete [] arg1->conf_dir;
+    if (arg2) {
+      arg1->conf_dir = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->conf_dir, (const char *)arg2);
+    } else {
+      arg1->conf_dir = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_conf_dir_get(void * jarg1) {
+  char * jresult ;
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  result = (char *) ((arg1)->conf_dir);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_log_dir_set(void * jarg1, char * jarg2) {
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->log_dir) delete [] arg1->log_dir;
+    if (arg2) {
+      arg1->log_dir = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->log_dir, (const char *)arg2);
+    } else {
+      arg1->log_dir = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_log_dir_get(void * jarg1) {
+  char * jresult ;
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  result = (char *) ((arg1)->log_dir);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_run_dir_set(void * jarg1, char * jarg2) {
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->run_dir) delete [] arg1->run_dir;
+    if (arg2) {
+      arg1->run_dir = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->run_dir, (const char *)arg2);
+    } else {
+      arg1->run_dir = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_run_dir_get(void * jarg1) {
+  char * jresult ;
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  result = (char *) ((arg1)->run_dir);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_db_dir_set(void * jarg1, char * jarg2) {
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->db_dir) delete [] arg1->db_dir;
+    if (arg2) {
+      arg1->db_dir = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->db_dir, (const char *)arg2);
+    } else {
+      arg1->db_dir = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_db_dir_get(void * jarg1) {
+  char * jresult ;
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  result = (char *) ((arg1)->db_dir);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_script_dir_set(void * jarg1, char * jarg2) {
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->script_dir) delete [] arg1->script_dir;
+    if (arg2) {
+      arg1->script_dir = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->script_dir, (const char *)arg2);
+    } else {
+      arg1->script_dir = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_script_dir_get(void * jarg1) {
+  char * jresult ;
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  result = (char *) ((arg1)->script_dir);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_temp_dir_set(void * jarg1, char * jarg2) {
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->temp_dir) delete [] arg1->temp_dir;
+    if (arg2) {
+      arg1->temp_dir = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->temp_dir, (const char *)arg2);
+    } else {
+      arg1->temp_dir = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_temp_dir_get(void * jarg1) {
+  char * jresult ;
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  result = (char *) ((arg1)->temp_dir);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_htdocs_dir_set(void * jarg1, char * jarg2) {
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->htdocs_dir) delete [] arg1->htdocs_dir;
+    if (arg2) {
+      arg1->htdocs_dir = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->htdocs_dir, (const char *)arg2);
+    } else {
+      arg1->htdocs_dir = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_htdocs_dir_get(void * jarg1) {
+  char * jresult ;
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  result = (char *) ((arg1)->htdocs_dir);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_grammar_dir_set(void * jarg1, char * jarg2) {
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->grammar_dir) delete [] arg1->grammar_dir;
+    if (arg2) {
+      arg1->grammar_dir = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->grammar_dir, (const char *)arg2);
+    } else {
+      arg1->grammar_dir = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_grammar_dir_get(void * jarg1) {
+  char * jresult ;
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  result = (char *) ((arg1)->grammar_dir);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_storage_dir_set(void * jarg1, char * jarg2) {
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->storage_dir) delete [] arg1->storage_dir;
+    if (arg2) {
+      arg1->storage_dir = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->storage_dir, (const char *)arg2);
+    } else {
+      arg1->storage_dir = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_storage_dir_get(void * jarg1) {
+  char * jresult ;
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  result = (char *) ((arg1)->storage_dir);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_recordings_dir_set(void * jarg1, char * jarg2) {
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->recordings_dir) delete [] arg1->recordings_dir;
+    if (arg2) {
+      arg1->recordings_dir = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->recordings_dir, (const char *)arg2);
+    } else {
+      arg1->recordings_dir = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_recordings_dir_get(void * jarg1) {
+  char * jresult ;
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  result = (char *) ((arg1)->recordings_dir);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directories_sounds_dir_set(void * jarg1, char * jarg2) {
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->sounds_dir) delete [] arg1->sounds_dir;
+    if (arg2) {
+      arg1->sounds_dir = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->sounds_dir, (const char *)arg2);
+    } else {
+      arg1->sounds_dir = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directories_sounds_dir_get(void * jarg1) {
+  char * jresult ;
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  result = (char *) ((arg1)->sounds_dir);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_directories() {
+  void * jresult ;
+  switch_directories *result = 0 ;
+  
+  result = (switch_directories *)new switch_directories();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_directories(void * jarg1) {
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_SWITCH_GLOBAL_dirs_set(void * jarg1) {
+  switch_directories *arg1 = (switch_directories *) 0 ;
+  
+  arg1 = (switch_directories *)jarg1; 
+  SWITCH_GLOBAL_dirs = *arg1;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_SWITCH_GLOBAL_dirs_get() {
+  void * jresult ;
+  switch_directories *result = 0 ;
+  
+  result = (switch_directories *)&SWITCH_GLOBAL_dirs;
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_STACKS_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 16;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_THREAD_STACKSIZE_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 240*1024;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_SYSTEM_THREAD_STACKSIZE_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 8192*1024;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_INTERVAL_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 120;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_INTERVAL_PAD_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 10;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_SAMPLE_LEN_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 48;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_BYTES_PER_SAMPLE_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 2;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RECOMMENDED_BUFFER_SIZE_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 4096;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_CODECS_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 50;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_STATE_HANDLERS_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 30;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_QUEUE_LEN_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 100000;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_MANAGEMENT_BUFFER_LEN_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 1024*8;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_raw_bytes_set(void * jarg1, void * jarg2) {
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->raw_bytes = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_raw_bytes_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  result =  ((arg1)->raw_bytes);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_media_bytes_set(void * jarg1, void * jarg2) {
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->media_bytes = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_media_bytes_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  result =  ((arg1)->media_bytes);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_packet_count_set(void * jarg1, void * jarg2) {
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->packet_count = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_packet_count_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  result =  ((arg1)->packet_count);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_media_packet_count_set(void * jarg1, void * jarg2) {
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->media_packet_count = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_media_packet_count_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  result =  ((arg1)->media_packet_count);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_skip_packet_count_set(void * jarg1, void * jarg2) {
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->skip_packet_count = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_skip_packet_count_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  result =  ((arg1)->skip_packet_count);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_jb_packet_count_set(void * jarg1, void * jarg2) {
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->jb_packet_count = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_jb_packet_count_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  result =  ((arg1)->jb_packet_count);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_dtmf_packet_count_set(void * jarg1, void * jarg2) {
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->dtmf_packet_count = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_dtmf_packet_count_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  result =  ((arg1)->dtmf_packet_count);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_cng_packet_count_set(void * jarg1, void * jarg2) {
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->cng_packet_count = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_cng_packet_count_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  result =  ((arg1)->cng_packet_count);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_flush_packet_count_set(void * jarg1, void * jarg2) {
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->flush_packet_count = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_flush_packet_count_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  result =  ((arg1)->flush_packet_count);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_rtp_numbers_t() {
+  void * jresult ;
+  switch_rtp_numbers_t *result = 0 ;
+  
+  result = (switch_rtp_numbers_t *)new switch_rtp_numbers_t();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_rtp_numbers_t(void * jarg1) {
+  switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ;
+  
+  arg1 = (switch_rtp_numbers_t *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_stats_t_inbound_set(void * jarg1, void * jarg2) {
+  switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ;
+  switch_rtp_numbers_t *arg2 = (switch_rtp_numbers_t *) 0 ;
+  
+  arg1 = (switch_rtp_stats_t *)jarg1; 
+  arg2 = (switch_rtp_numbers_t *)jarg2; 
+  if (arg1) (arg1)->inbound = *arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_stats_t_inbound_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ;
+  switch_rtp_numbers_t *result = 0 ;
+  
+  arg1 = (switch_rtp_stats_t *)jarg1; 
+  result = (switch_rtp_numbers_t *)& ((arg1)->inbound);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_stats_t_outbound_set(void * jarg1, void * jarg2) {
+  switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ;
+  switch_rtp_numbers_t *arg2 = (switch_rtp_numbers_t *) 0 ;
+  
+  arg1 = (switch_rtp_stats_t *)jarg1; 
+  arg2 = (switch_rtp_numbers_t *)jarg2; 
+  if (arg1) (arg1)->outbound = *arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_stats_t_outbound_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ;
+  switch_rtp_numbers_t *result = 0 ;
+  
+  arg1 = (switch_rtp_stats_t *)jarg1; 
+  result = (switch_rtp_numbers_t *)& ((arg1)->outbound);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_rtp_stats_t() {
+  void * jresult ;
+  switch_rtp_stats_t *result = 0 ;
+  
+  result = (switch_rtp_stats_t *)new switch_rtp_stats_t();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_rtp_stats_t(void * jarg1) {
+  switch_rtp_stats_t *arg1 = (switch_rtp_stats_t *) 0 ;
+  
+  arg1 = (switch_rtp_stats_t *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_CNG_PAYLOAD_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 13;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_hdr_t_version_set(void * jarg1, unsigned int jarg2) {
+  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
+  unsigned int arg2 ;
+  
+  arg1 = (switch_rtp_hdr_t *)jarg1; 
+  arg2 = (unsigned int)jarg2; 
+  if (arg1) (arg1)->version = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_rtp_hdr_t_version_get(void * jarg1) {
+  unsigned int jresult ;
+  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
+  unsigned int result;
+  
+  arg1 = (switch_rtp_hdr_t *)jarg1; 
+  result = (unsigned int) ((arg1)->version);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_hdr_t_p_set(void * jarg1, unsigned int jarg2) {
+  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
+  unsigned int arg2 ;
+  
+  arg1 = (switch_rtp_hdr_t *)jarg1; 
+  arg2 = (unsigned int)jarg2; 
+  if (arg1) (arg1)->p = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_rtp_hdr_t_p_get(void * jarg1) {
+  unsigned int jresult ;
+  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
+  unsigned int result;
+  
+  arg1 = (switch_rtp_hdr_t *)jarg1; 
+  result = (unsigned int) ((arg1)->p);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_hdr_t_x_set(void * jarg1, unsigned int jarg2) {
+  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
+  unsigned int arg2 ;
+  
+  arg1 = (switch_rtp_hdr_t *)jarg1; 
+  arg2 = (unsigned int)jarg2; 
+  if (arg1) (arg1)->x = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_rtp_hdr_t_x_get(void * jarg1) {
+  unsigned int jresult ;
+  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
+  unsigned int result;
+  
+  arg1 = (switch_rtp_hdr_t *)jarg1; 
+  result = (unsigned int) ((arg1)->x);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_hdr_t_cc_set(void * jarg1, unsigned int jarg2) {
+  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
+  unsigned int arg2 ;
+  
+  arg1 = (switch_rtp_hdr_t *)jarg1; 
+  arg2 = (unsigned int)jarg2; 
+  if (arg1) (arg1)->cc = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_rtp_hdr_t_cc_get(void * jarg1) {
+  unsigned int jresult ;
+  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
+  unsigned int result;
+  
+  arg1 = (switch_rtp_hdr_t *)jarg1; 
+  result = (unsigned int) ((arg1)->cc);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_hdr_t_m_set(void * jarg1, unsigned int jarg2) {
+  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
+  unsigned int arg2 ;
+  
+  arg1 = (switch_rtp_hdr_t *)jarg1; 
+  arg2 = (unsigned int)jarg2; 
+  if (arg1) (arg1)->m = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_rtp_hdr_t_m_get(void * jarg1) {
+  unsigned int jresult ;
+  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
+  unsigned int result;
+  
+  arg1 = (switch_rtp_hdr_t *)jarg1; 
+  result = (unsigned int) ((arg1)->m);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_hdr_t_pt_set(void * jarg1, unsigned int jarg2) {
+  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
+  unsigned int arg2 ;
+  
+  arg1 = (switch_rtp_hdr_t *)jarg1; 
+  arg2 = (unsigned int)jarg2; 
+  if (arg1) (arg1)->pt = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_rtp_hdr_t_pt_get(void * jarg1) {
+  unsigned int jresult ;
+  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
+  unsigned int result;
+  
+  arg1 = (switch_rtp_hdr_t *)jarg1; 
+  result = (unsigned int) ((arg1)->pt);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_hdr_t_seq_set(void * jarg1, unsigned int jarg2) {
+  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
+  unsigned int arg2 ;
+  
+  arg1 = (switch_rtp_hdr_t *)jarg1; 
+  arg2 = (unsigned int)jarg2; 
+  if (arg1) (arg1)->seq = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_rtp_hdr_t_seq_get(void * jarg1) {
+  unsigned int jresult ;
+  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
+  unsigned int result;
+  
+  arg1 = (switch_rtp_hdr_t *)jarg1; 
+  result = (unsigned int) ((arg1)->seq);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_hdr_t_ts_set(void * jarg1, unsigned int jarg2) {
+  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
+  unsigned int arg2 ;
+  
+  arg1 = (switch_rtp_hdr_t *)jarg1; 
+  arg2 = (unsigned int)jarg2; 
+  if (arg1) (arg1)->ts = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_rtp_hdr_t_ts_get(void * jarg1) {
+  unsigned int jresult ;
+  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
+  unsigned int result;
+  
+  arg1 = (switch_rtp_hdr_t *)jarg1; 
+  result = (unsigned int) ((arg1)->ts);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_hdr_t_ssrc_set(void * jarg1, unsigned int jarg2) {
+  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
+  unsigned int arg2 ;
+  
+  arg1 = (switch_rtp_hdr_t *)jarg1; 
+  arg2 = (unsigned int)jarg2; 
+  if (arg1) (arg1)->ssrc = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_rtp_hdr_t_ssrc_get(void * jarg1) {
+  unsigned int jresult ;
+  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
+  unsigned int result;
+  
+  arg1 = (switch_rtp_hdr_t *)jarg1; 
+  result = (unsigned int) ((arg1)->ssrc);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_rtp_hdr_t() {
+  void * jresult ;
+  switch_rtp_hdr_t *result = 0 ;
+  
+  result = (switch_rtp_hdr_t *)new switch_rtp_hdr_t();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_rtp_hdr_t(void * jarg1) {
+  switch_rtp_hdr_t *arg1 = (switch_rtp_hdr_t *) 0 ;
+  
+  arg1 = (switch_rtp_hdr_t *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_T38MaxBitRate_set(void * jarg1, unsigned long jarg2) {
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->T38MaxBitRate = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_t38_options_t_T38MaxBitRate_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  result = (uint32_t) ((arg1)->T38MaxBitRate);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxFillBitRemoval_set(void * jarg1, int jarg2) {
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  switch_bool_t arg2 ;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  arg2 = (switch_bool_t)jarg2; 
+  if (arg1) (arg1)->T38FaxFillBitRemoval = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxFillBitRemoval_get(void * jarg1) {
+  int jresult ;
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  switch_bool_t result;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  result = (switch_bool_t) ((arg1)->T38FaxFillBitRemoval);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxTranscodingMMR_set(void * jarg1, int jarg2) {
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  switch_bool_t arg2 ;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  arg2 = (switch_bool_t)jarg2; 
+  if (arg1) (arg1)->T38FaxTranscodingMMR = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxTranscodingMMR_get(void * jarg1) {
+  int jresult ;
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  switch_bool_t result;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  result = (switch_bool_t) ((arg1)->T38FaxTranscodingMMR);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxTranscodingJBIG_set(void * jarg1, int jarg2) {
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  switch_bool_t arg2 ;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  arg2 = (switch_bool_t)jarg2; 
+  if (arg1) (arg1)->T38FaxTranscodingJBIG = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxTranscodingJBIG_get(void * jarg1) {
+  int jresult ;
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  switch_bool_t result;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  result = (switch_bool_t) ((arg1)->T38FaxTranscodingJBIG);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxRateManagement_set(void * jarg1, char * jarg2) {
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->T38FaxRateManagement = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->T38FaxRateManagement, (const char *)arg2);
+    } else {
+      arg1->T38FaxRateManagement = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxRateManagement_get(void * jarg1) {
+  char * jresult ;
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  result = (char *) ((arg1)->T38FaxRateManagement);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxMaxBuffer_set(void * jarg1, unsigned long jarg2) {
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->T38FaxMaxBuffer = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxMaxBuffer_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  result = (uint32_t) ((arg1)->T38FaxMaxBuffer);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxMaxDatagram_set(void * jarg1, unsigned long jarg2) {
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->T38FaxMaxDatagram = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxMaxDatagram_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  result = (uint32_t) ((arg1)->T38FaxMaxDatagram);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxUdpEC_set(void * jarg1, char * jarg2) {
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->T38FaxUdpEC = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->T38FaxUdpEC, (const char *)arg2);
+    } else {
+      arg1->T38FaxUdpEC = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_t38_options_t_T38FaxUdpEC_get(void * jarg1) {
+  char * jresult ;
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  result = (char *) ((arg1)->T38FaxUdpEC);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_T38VendorInfo_set(void * jarg1, char * jarg2) {
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->T38VendorInfo = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->T38VendorInfo, (const char *)arg2);
+    } else {
+      arg1->T38VendorInfo = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_t38_options_t_T38VendorInfo_get(void * jarg1) {
+  char * jresult ;
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  result = (char *) ((arg1)->T38VendorInfo);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_ip_set(void * jarg1, char * jarg2) {
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->ip = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->ip, (const char *)arg2);
+    } else {
+      arg1->ip = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_t38_options_t_ip_get(void * jarg1) {
+  char * jresult ;
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  result = (char *) ((arg1)->ip);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_t38_options_t_port_set(void * jarg1, unsigned long jarg2) {
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->port = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_t38_options_t_port_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  result = (uint32_t) ((arg1)->port);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_t38_options_t() {
+  void * jresult ;
+  switch_t38_options_t *result = 0 ;
+  
+  result = (switch_t38_options_t *)new switch_t38_options_t();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_t38_options_t(void * jarg1) {
+  switch_t38_options_t *arg1 = (switch_t38_options_t *) 0 ;
+  
+  arg1 = (switch_t38_options_t *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_console_callback_match_node_val_set(void * jarg1, char * jarg2) {
+  switch_console_callback_match_node *arg1 = (switch_console_callback_match_node *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_console_callback_match_node *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->val) delete [] arg1->val;
+    if (arg2) {
+      arg1->val = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->val, (const char *)arg2);
+    } else {
+      arg1->val = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_console_callback_match_node_val_get(void * jarg1) {
+  char * jresult ;
+  switch_console_callback_match_node *arg1 = (switch_console_callback_match_node *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_console_callback_match_node *)jarg1; 
+  result = (char *) ((arg1)->val);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_console_callback_match_node_next_set(void * jarg1, void * jarg2) {
+  switch_console_callback_match_node *arg1 = (switch_console_callback_match_node *) 0 ;
+  switch_console_callback_match_node *arg2 = (switch_console_callback_match_node *) 0 ;
+  
+  arg1 = (switch_console_callback_match_node *)jarg1; 
+  arg2 = (switch_console_callback_match_node *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_console_callback_match_node_next_get(void * jarg1) {
+  void * jresult ;
+  switch_console_callback_match_node *arg1 = (switch_console_callback_match_node *) 0 ;
+  switch_console_callback_match_node *result = 0 ;
+  
+  arg1 = (switch_console_callback_match_node *)jarg1; 
+  result = (switch_console_callback_match_node *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_console_callback_match_node() {
+  void * jresult ;
+  switch_console_callback_match_node *result = 0 ;
+  
+  result = (switch_console_callback_match_node *)new switch_console_callback_match_node();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_console_callback_match_node(void * jarg1) {
+  switch_console_callback_match_node *arg1 = (switch_console_callback_match_node *) 0 ;
+  
+  arg1 = (switch_console_callback_match_node *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_console_callback_match_head_set(void * jarg1, void * jarg2) {
+  switch_console_callback_match *arg1 = (switch_console_callback_match *) 0 ;
+  switch_console_callback_match_node *arg2 = (switch_console_callback_match_node *) 0 ;
+  
+  arg1 = (switch_console_callback_match *)jarg1; 
+  arg2 = (switch_console_callback_match_node *)jarg2; 
+  if (arg1) (arg1)->head = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_console_callback_match_head_get(void * jarg1) {
+  void * jresult ;
+  switch_console_callback_match *arg1 = (switch_console_callback_match *) 0 ;
+  switch_console_callback_match_node *result = 0 ;
+  
+  arg1 = (switch_console_callback_match *)jarg1; 
+  result = (switch_console_callback_match_node *) ((arg1)->head);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_console_callback_match_end_set(void * jarg1, void * jarg2) {
+  switch_console_callback_match *arg1 = (switch_console_callback_match *) 0 ;
+  switch_console_callback_match_node *arg2 = (switch_console_callback_match_node *) 0 ;
+  
+  arg1 = (switch_console_callback_match *)jarg1; 
+  arg2 = (switch_console_callback_match_node *)jarg2; 
+  if (arg1) (arg1)->end = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_console_callback_match_end_get(void * jarg1) {
+  void * jresult ;
+  switch_console_callback_match *arg1 = (switch_console_callback_match *) 0 ;
+  switch_console_callback_match_node *result = 0 ;
+  
+  arg1 = (switch_console_callback_match *)jarg1; 
+  result = (switch_console_callback_match_node *) ((arg1)->end);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_console_callback_match_count_set(void * jarg1, int jarg2) {
+  switch_console_callback_match *arg1 = (switch_console_callback_match *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_console_callback_match *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->count = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_console_callback_match_count_get(void * jarg1) {
+  int jresult ;
+  switch_console_callback_match *arg1 = (switch_console_callback_match *) 0 ;
+  int result;
+  
+  arg1 = (switch_console_callback_match *)jarg1; 
+  result = (int) ((arg1)->count);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_console_callback_match_dynamic_set(void * jarg1, int jarg2) {
+  switch_console_callback_match *arg1 = (switch_console_callback_match *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_console_callback_match *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->dynamic = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_console_callback_match_dynamic_get(void * jarg1) {
+  int jresult ;
+  switch_console_callback_match *arg1 = (switch_console_callback_match *) 0 ;
+  int result;
+  
+  arg1 = (switch_console_callback_match *)jarg1; 
+  result = (int) ((arg1)->dynamic);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_console_callback_match() {
+  void * jresult ;
+  switch_console_callback_match *result = 0 ;
+  
+  result = (switch_console_callback_match *)new switch_console_callback_match();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_console_callback_match(void * jarg1) {
+  switch_console_callback_match *arg1 = (switch_console_callback_match *) 0 ;
+  
+  arg1 = (switch_console_callback_match *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_input_args_t_input_callback_set(void * jarg1, void * jarg2) {
+  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
+  switch_input_callback_function_t arg2 = (switch_input_callback_function_t) 0 ;
+  
+  arg1 = (switch_input_args_t *)jarg1; 
+  arg2 = (switch_input_callback_function_t)jarg2; 
+  if (arg1) (arg1)->input_callback = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_input_args_t_input_callback_get(void * jarg1) {
+  void * jresult ;
+  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
+  switch_input_callback_function_t result;
+  
+  arg1 = (switch_input_args_t *)jarg1; 
+  result = (switch_input_callback_function_t) ((arg1)->input_callback);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_input_args_t_buf_set(void * jarg1, void * jarg2) {
+  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_input_args_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->buf = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_input_args_t_buf_get(void * jarg1) {
+  void * jresult ;
+  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_input_args_t *)jarg1; 
+  result = (void *) ((arg1)->buf);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_input_args_t_buflen_set(void * jarg1, unsigned long jarg2) {
+  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_input_args_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->buflen = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_input_args_t_buflen_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_input_args_t *)jarg1; 
+  result = (uint32_t) ((arg1)->buflen);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_input_args_t_read_frame_callback_set(void * jarg1, void * jarg2) {
+  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
+  switch_read_frame_callback_function_t arg2 = (switch_read_frame_callback_function_t) 0 ;
+  
+  arg1 = (switch_input_args_t *)jarg1; 
+  arg2 = (switch_read_frame_callback_function_t)jarg2; 
+  if (arg1) (arg1)->read_frame_callback = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_input_args_t_read_frame_callback_get(void * jarg1) {
+  void * jresult ;
+  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
+  switch_read_frame_callback_function_t result;
+  
+  arg1 = (switch_input_args_t *)jarg1; 
+  result = (switch_read_frame_callback_function_t) ((arg1)->read_frame_callback);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_input_args_t_user_data_set(void * jarg1, void * jarg2) {
+  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_input_args_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->user_data = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_input_args_t_user_data_get(void * jarg1) {
+  void * jresult ;
+  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_input_args_t *)jarg1; 
+  result = (void *) ((arg1)->user_data);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_input_args_t() {
+  void * jresult ;
+  switch_input_args_t *result = 0 ;
+  
+  result = (switch_input_args_t *)new switch_input_args_t();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_input_args_t(void * jarg1) {
+  switch_input_args_t *arg1 = (switch_input_args_t *) 0 ;
+  
+  arg1 = (switch_input_args_t *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_API_VERSION_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 4;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_function_table_t_switch_api_version_set(void * jarg1, int jarg2) {
+  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->switch_api_version = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_loadable_module_function_table_t_switch_api_version_get(void * jarg1) {
+  int jresult ;
+  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
+  int result;
+  
+  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
+  result = (int) ((arg1)->switch_api_version);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_function_table_t_load_set(void * jarg1, void * jarg2) {
+  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
+  switch_module_load_t arg2 = (switch_module_load_t) 0 ;
+  
+  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
+  arg2 = (switch_module_load_t)jarg2; 
+  if (arg1) (arg1)->load = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_function_table_t_load_get(void * jarg1) {
+  void * jresult ;
+  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
+  switch_module_load_t result;
+  
+  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
+  result = (switch_module_load_t) ((arg1)->load);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_function_table_t_shutdown_set(void * jarg1, void * jarg2) {
+  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
+  switch_module_shutdown_t arg2 = (switch_module_shutdown_t) 0 ;
+  
+  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
+  arg2 = (switch_module_shutdown_t)jarg2; 
+  if (arg1) (arg1)->shutdown = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_function_table_t_shutdown_get(void * jarg1) {
+  void * jresult ;
+  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
+  switch_module_shutdown_t result;
+  
+  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
+  result = (switch_module_shutdown_t) ((arg1)->shutdown);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_function_table_t_runtime_set(void * jarg1, void * jarg2) {
+  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
+  switch_module_runtime_t arg2 = (switch_module_runtime_t) 0 ;
+  
+  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
+  arg2 = (switch_module_runtime_t)jarg2; 
+  if (arg1) (arg1)->runtime = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_function_table_t_runtime_get(void * jarg1) {
+  void * jresult ;
+  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
+  switch_module_runtime_t result;
+  
+  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
+  result = (switch_module_runtime_t) ((arg1)->runtime);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_function_table_t_flags_set(void * jarg1, unsigned long jarg2) {
+  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
+  switch_module_flag_t arg2 ;
+  
+  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
+  arg2 = (switch_module_flag_t)jarg2; 
+  if (arg1) (arg1)->flags = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_loadable_module_function_table_t_flags_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
+  switch_module_flag_t result;
+  
+  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
+  result = (switch_module_flag_t) ((arg1)->flags);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_loadable_module_function_table_t() {
+  void * jresult ;
+  switch_loadable_module_function_table_t *result = 0 ;
+  
+  result = (switch_loadable_module_function_table_t *)new switch_loadable_module_function_table_t();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_loadable_module_function_table_t(void * jarg1) {
+  switch_loadable_module_function_table_t *arg1 = (switch_loadable_module_function_table_t *) 0 ;
+  
+  arg1 = (switch_loadable_module_function_table_t *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_close(void * jarg1) {
+  int jresult ;
+  switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
+  int result;
+  
+  arg1 = (switch_core_db_t *)jarg1; 
+  result = (int)switch_core_db_close(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_open(char * jarg1, void * jarg2) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_core_db_t **arg2 = (switch_core_db_t **) 0 ;
+  int result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_core_db_t **)jarg2; 
+  result = (int)switch_core_db_open((char const *)arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_db_column_text(void * jarg1, int jarg2) {
+  void * jresult ;
+  switch_core_db_stmt_t *arg1 = (switch_core_db_stmt_t *) 0 ;
+  int arg2 ;
+  unsigned char *result = 0 ;
+  
+  arg1 = (switch_core_db_stmt_t *)jarg1; 
+  arg2 = (int)jarg2; 
+  result = (unsigned char *)switch_core_db_column_text(arg1,arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_db_column_name(void * jarg1, int jarg2) {
+  char * jresult ;
+  switch_core_db_stmt_t *arg1 = (switch_core_db_stmt_t *) 0 ;
+  int arg2 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_core_db_stmt_t *)jarg1; 
+  arg2 = (int)jarg2; 
+  result = (char *)switch_core_db_column_name(arg1,arg2);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_column_count(void * jarg1) {
+  int jresult ;
+  switch_core_db_stmt_t *arg1 = (switch_core_db_stmt_t *) 0 ;
+  int result;
+  
+  arg1 = (switch_core_db_stmt_t *)jarg1; 
+  result = (int)switch_core_db_column_count(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_db_errmsg(void * jarg1) {
+  char * jresult ;
+  switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_core_db_t *)jarg1; 
+  result = (char *)switch_core_db_errmsg(arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_exec(void * jarg1, char * jarg2, void * jarg3, void * jarg4, void * jarg5) {
+  int jresult ;
+  switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_core_db_callback_func_t arg3 = (switch_core_db_callback_func_t) 0 ;
+  void *arg4 = (void *) 0 ;
+  char **arg5 = (char **) 0 ;
+  int result;
+  
+  arg1 = (switch_core_db_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_core_db_callback_func_t)jarg3; 
+  arg4 = (void *)jarg4; 
+  arg5 = (char **)jarg5; 
+  result = (int)switch_core_db_exec(arg1,(char const *)arg2,arg3,arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_finalize(void * jarg1) {
+  int jresult ;
+  switch_core_db_stmt_t *arg1 = (switch_core_db_stmt_t *) 0 ;
+  int result;
+  
+  arg1 = (switch_core_db_stmt_t *)jarg1; 
+  result = (int)switch_core_db_finalize(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_prepare(void * jarg1, char * jarg2, int jarg3, void * jarg4, void * jarg5) {
+  int jresult ;
+  switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  switch_core_db_stmt_t **arg4 = (switch_core_db_stmt_t **) 0 ;
+  char **arg5 = (char **) 0 ;
+  int result;
+  
+  arg1 = (switch_core_db_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (int)jarg3; 
+  arg4 = (switch_core_db_stmt_t **)jarg4; 
+  arg5 = (char **)jarg5; 
+  result = (int)switch_core_db_prepare(arg1,(char const *)arg2,arg3,arg4,(char const **)arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_step(void * jarg1) {
+  int jresult ;
+  switch_core_db_stmt_t *arg1 = (switch_core_db_stmt_t *) 0 ;
+  int result;
+  
+  arg1 = (switch_core_db_stmt_t *)jarg1; 
+  result = (int)switch_core_db_step(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_reset(void * jarg1) {
+  int jresult ;
+  switch_core_db_stmt_t *arg1 = (switch_core_db_stmt_t *) 0 ;
+  int result;
+  
+  arg1 = (switch_core_db_stmt_t *)jarg1; 
+  result = (int)switch_core_db_reset(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_bind_int(void * jarg1, int jarg2, int jarg3) {
+  int jresult ;
+  switch_core_db_stmt_t *arg1 = (switch_core_db_stmt_t *) 0 ;
+  int arg2 ;
+  int arg3 ;
+  int result;
+  
+  arg1 = (switch_core_db_stmt_t *)jarg1; 
+  arg2 = (int)jarg2; 
+  arg3 = (int)jarg3; 
+  result = (int)switch_core_db_bind_int(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_bind_int64(void * jarg1, int jarg2, long long jarg3) {
+  int jresult ;
+  switch_core_db_stmt_t *arg1 = (switch_core_db_stmt_t *) 0 ;
+  int arg2 ;
+  int64_t arg3 ;
+  int result;
+  
+  arg1 = (switch_core_db_stmt_t *)jarg1; 
+  arg2 = (int)jarg2; 
+  arg3 = (int64_t)jarg3; 
+  result = (int)switch_core_db_bind_int64(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_bind_text(void * jarg1, int jarg2, char * jarg3, int jarg4, void * jarg5) {
+  int jresult ;
+  switch_core_db_stmt_t *arg1 = (switch_core_db_stmt_t *) 0 ;
+  int arg2 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  switch_core_db_destructor_type_t arg5 = (switch_core_db_destructor_type_t) 0 ;
+  int result;
+  
+  arg1 = (switch_core_db_stmt_t *)jarg1; 
+  arg2 = (int)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int)jarg4; 
+  arg5 = (switch_core_db_destructor_type_t)jarg5; 
+  result = (int)switch_core_db_bind_text(arg1,arg2,(char const *)arg3,arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_bind_double(void * jarg1, int jarg2, double jarg3) {
+  int jresult ;
+  switch_core_db_stmt_t *arg1 = (switch_core_db_stmt_t *) 0 ;
+  int arg2 ;
+  double arg3 ;
+  int result;
+  
+  arg1 = (switch_core_db_stmt_t *)jarg1; 
+  arg2 = (int)jarg2; 
+  arg3 = (double)jarg3; 
+  result = (int)switch_core_db_bind_double(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT long long SWIGSTDCALL CSharp_switch_core_db_last_insert_rowid(void * jarg1) {
+  long long jresult ;
+  switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
+  int64_t result;
+  
+  arg1 = (switch_core_db_t *)jarg1; 
+  result = (int64_t)switch_core_db_last_insert_rowid(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_get_table(void * jarg1, char * jarg2, void * jarg3, void * jarg4, void * jarg5, void * jarg6) {
+  int jresult ;
+  switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char ***arg3 = (char ***) 0 ;
+  int *arg4 = (int *) 0 ;
+  int *arg5 = (int *) 0 ;
+  char **arg6 = (char **) 0 ;
+  int result;
+  
+  arg1 = (switch_core_db_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char ***)jarg3; 
+  arg4 = (int *)jarg4; 
+  arg5 = (int *)jarg5; 
+  arg6 = (char **)jarg6; 
+  result = (int)switch_core_db_get_table(arg1,(char const *)arg2,arg3,arg4,arg5,arg6);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_db_free_table(void * jarg1) {
+  char **arg1 = (char **) 0 ;
+  
+  arg1 = (char **)jarg1; 
+  switch_core_db_free_table(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_db_free(char * jarg1) {
+  char *arg1 = (char *) 0 ;
+  
+  arg1 = (char *)jarg1; 
+  switch_core_db_free(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_changes(void * jarg1) {
+  int jresult ;
+  switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
+  int result;
+  
+  arg1 = (switch_core_db_t *)jarg1; 
+  result = (int)switch_core_db_changes(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_OK_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 0;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_ERROR_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 1;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_INTERNAL_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 2;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_PERM_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 3;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_ABORT_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 4;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_BUSY_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 5;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_LOCKED_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 6;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_NOMEM_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 7;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_READONLY_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 8;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_INTERRUPT_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 9;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_IOERR_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 10;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_CORRUPT_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 11;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_NOTFOUND_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 12;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_FULL_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 13;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_CANTOPEN_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 14;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_PROTOCOL_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 15;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_EMPTY_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 16;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_SCHEMA_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 17;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_TOOBIG_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 18;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_CONSTRAINT_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 19;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_MISMATCH_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 20;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_MISUSE_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 21;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_NOLFS_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 22;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_AUTH_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 23;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_FORMAT_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 24;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_RANGE_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 25;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_NOTADB_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 26;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_ROW_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 100;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CORE_DB_DONE_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 101;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_regex_compile(char * jarg1, int jarg2, void * jarg3, void * jarg4, void * jarg5) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  int arg2 ;
+  char **arg3 = (char **) 0 ;
+  int *arg4 = (int *) 0 ;
+  unsigned char *arg5 = (unsigned char *) 0 ;
+  switch_regex_t *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (int)jarg2; 
+  arg3 = (char **)jarg3; 
+  arg4 = (int *)jarg4; 
+  arg5 = (unsigned char *)jarg5; 
+  result = (switch_regex_t *)switch_regex_compile((char const *)arg1,arg2,(char const **)arg3,arg4,(unsigned char const *)arg5);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_regex_copy_substring(char * jarg1, void * jarg2, int jarg3, int jarg4, char * jarg5, int jarg6) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  int *arg2 = (int *) 0 ;
+  int arg3 ;
+  int arg4 ;
+  char *arg5 = (char *) 0 ;
+  int arg6 ;
+  int result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (int *)jarg2; 
+  arg3 = (int)jarg3; 
+  arg4 = (int)jarg4; 
+  arg5 = (char *)jarg5; 
+  arg6 = (int)jarg6; 
+  result = (int)switch_regex_copy_substring((char const *)arg1,arg2,arg3,arg4,arg5,arg6);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_regex_free(void * jarg1) {
+  void *arg1 = (void *) 0 ;
+  
+  arg1 = (void *)jarg1; 
+  switch_regex_free(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_regex_perform(char * jarg1, char * jarg2, void * jarg3, void * jarg4, unsigned long jarg5) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_regex_t **arg3 = (switch_regex_t **) 0 ;
+  int *arg4 = (int *) 0 ;
+  uint32_t arg5 ;
+  int result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_regex_t **)jarg3; 
+  arg4 = (int *)jarg4; 
+  arg5 = (uint32_t)jarg5; 
+  result = (int)switch_regex_perform((char const *)arg1,(char const *)arg2,arg3,arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_perform_substitution(void * jarg1, int jarg2, char * jarg3, char * jarg4, char * jarg5, void * jarg6, void * jarg7) {
+  switch_regex_t *arg1 = (switch_regex_t *) 0 ;
+  int arg2 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  char *arg5 = (char *) 0 ;
+  switch_size_t arg6 ;
+  int *arg7 = (int *) 0 ;
+  switch_size_t *argp6 ;
+  
+  arg1 = (switch_regex_t *)jarg1; 
+  arg2 = (int)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (char *)jarg5; 
+  argp6 = (switch_size_t *)jarg6; 
+  if (!argp6) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg6 = *argp6; 
+  arg7 = (int *)jarg7; 
+  switch_perform_substitution(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5,arg6,arg7);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_regex_match(char * jarg1, char * jarg2) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_status_t)switch_regex_match((char const *)arg1,(char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_regex_match_partial(char * jarg1, char * jarg2, void * jarg3) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int *arg3 = (int *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (int *)jarg3; 
+  result = (switch_status_t)switch_regex_match_partial((char const *)arg1,(char const *)arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_CORE_THREAD_SESSION_OBJS_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 128;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_MAX_STREAMS_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 128;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_time_duration_mms_set(void * jarg1, unsigned long jarg2) {
+  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_core_time_duration *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->mms = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_time_duration_mms_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_core_time_duration *)jarg1; 
+  result = (uint32_t) ((arg1)->mms);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_time_duration_ms_set(void * jarg1, unsigned long jarg2) {
+  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_core_time_duration *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->ms = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_time_duration_ms_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_core_time_duration *)jarg1; 
+  result = (uint32_t) ((arg1)->ms);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_time_duration_sec_set(void * jarg1, unsigned long jarg2) {
+  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_core_time_duration *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->sec = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_time_duration_sec_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_core_time_duration *)jarg1; 
+  result = (uint32_t) ((arg1)->sec);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_time_duration_min_set(void * jarg1, unsigned long jarg2) {
+  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_core_time_duration *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->min = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_time_duration_min_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_core_time_duration *)jarg1; 
+  result = (uint32_t) ((arg1)->min);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_time_duration_hr_set(void * jarg1, unsigned long jarg2) {
+  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_core_time_duration *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->hr = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_time_duration_hr_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_core_time_duration *)jarg1; 
+  result = (uint32_t) ((arg1)->hr);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_time_duration_day_set(void * jarg1, unsigned long jarg2) {
+  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_core_time_duration *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->day = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_time_duration_day_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_core_time_duration *)jarg1; 
+  result = (uint32_t) ((arg1)->day);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_time_duration_yr_set(void * jarg1, unsigned long jarg2) {
+  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_core_time_duration *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->yr = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_time_duration_yr_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_core_time_duration *)jarg1; 
+  result = (uint32_t) ((arg1)->yr);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_core_time_duration() {
+  void * jresult ;
+  switch_core_time_duration *result = 0 ;
+  
+  result = (switch_core_time_duration *)new switch_core_time_duration();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_core_time_duration(void * jarg1) {
+  switch_core_time_duration *arg1 = (switch_core_time_duration *) 0 ;
+  
+  arg1 = (switch_core_time_duration *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_app_log_app_set(void * jarg1, char * jarg2) {
+  switch_app_log *arg1 = (switch_app_log *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_app_log *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->app) delete [] arg1->app;
+    if (arg2) {
+      arg1->app = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->app, (const char *)arg2);
+    } else {
+      arg1->app = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_app_log_app_get(void * jarg1) {
+  char * jresult ;
+  switch_app_log *arg1 = (switch_app_log *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_app_log *)jarg1; 
+  result = (char *) ((arg1)->app);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_app_log_arg_set(void * jarg1, char * jarg2) {
+  switch_app_log *arg1 = (switch_app_log *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_app_log *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->arg) delete [] arg1->arg;
+    if (arg2) {
+      arg1->arg = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->arg, (const char *)arg2);
+    } else {
+      arg1->arg = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_app_log_arg_get(void * jarg1) {
+  char * jresult ;
+  switch_app_log *arg1 = (switch_app_log *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_app_log *)jarg1; 
+  result = (char *) ((arg1)->arg);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_app_log_next_set(void * jarg1, void * jarg2) {
+  switch_app_log *arg1 = (switch_app_log *) 0 ;
+  switch_app_log *arg2 = (switch_app_log *) 0 ;
+  
+  arg1 = (switch_app_log *)jarg1; 
+  arg2 = (switch_app_log *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_app_log_next_get(void * jarg1) {
+  void * jresult ;
+  switch_app_log *arg1 = (switch_app_log *) 0 ;
+  switch_app_log *result = 0 ;
+  
+  arg1 = (switch_app_log *)jarg1; 
+  result = (switch_app_log *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_app_log() {
+  void * jresult ;
+  switch_app_log *result = 0 ;
+  
+  result = (switch_app_log *)new switch_app_log();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_app_log(void * jarg1) {
+  switch_app_log *arg1 = (switch_app_log *) 0 ;
+  
+  arg1 = (switch_app_log *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_MESSAGE_STRING_ARG_MAX_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 10;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_from_set(void * jarg1, char * jarg2) {
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->from) delete [] arg1->from;
+    if (arg2) {
+      arg1->from = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->from, (const char *)arg2);
+    } else {
+      arg1->from = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_session_message_from_get(void * jarg1) {
+  char * jresult ;
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  result = (char *) ((arg1)->from);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_message_id_set(void * jarg1, int jarg2) {
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  switch_core_session_message_types_t arg2 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  arg2 = (switch_core_session_message_types_t)jarg2; 
+  if (arg1) (arg1)->message_id = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_message_message_id_get(void * jarg1) {
+  int jresult ;
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  switch_core_session_message_types_t result;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  result = (switch_core_session_message_types_t) ((arg1)->message_id);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_numeric_arg_set(void * jarg1, int jarg2) {
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->numeric_arg = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_message_numeric_arg_get(void * jarg1) {
+  int jresult ;
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  int result;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  result = (int) ((arg1)->numeric_arg);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_string_arg_set(void * jarg1, char * jarg2) {
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->string_arg = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->string_arg, (const char *)arg2);
+    } else {
+      arg1->string_arg = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_session_message_string_arg_get(void * jarg1) {
+  char * jresult ;
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  result = (char *) ((arg1)->string_arg);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_string_arg_size_set(void * jarg1, void * jarg2) {
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->string_arg_size = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_message_string_arg_size_get(void * jarg1) {
+  void * jresult ;
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  result =  ((arg1)->string_arg_size);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_pointer_arg_set(void * jarg1, void * jarg2) {
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->pointer_arg = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_message_pointer_arg_get(void * jarg1) {
+  void * jresult ;
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  result = (void *) ((arg1)->pointer_arg);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_pointer_arg_size_set(void * jarg1, void * jarg2) {
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->pointer_arg_size = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_message_pointer_arg_size_get(void * jarg1) {
+  void * jresult ;
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  result =  ((arg1)->pointer_arg_size);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_numeric_reply_set(void * jarg1, int jarg2) {
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->numeric_reply = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_message_numeric_reply_get(void * jarg1) {
+  int jresult ;
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  int result;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  result = (int) ((arg1)->numeric_reply);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_string_reply_set(void * jarg1, char * jarg2) {
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->string_reply) delete [] arg1->string_reply;
+    if (arg2) {
+      arg1->string_reply = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->string_reply, (const char *)arg2);
+    } else {
+      arg1->string_reply = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_session_message_string_reply_get(void * jarg1) {
+  char * jresult ;
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  result = (char *) ((arg1)->string_reply);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_string_reply_size_set(void * jarg1, void * jarg2) {
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->string_reply_size = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_message_string_reply_size_get(void * jarg1) {
+  void * jresult ;
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  result =  ((arg1)->string_reply_size);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_pointer_reply_set(void * jarg1, void * jarg2) {
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->pointer_reply = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_message_pointer_reply_get(void * jarg1) {
+  void * jresult ;
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  result = (void *) ((arg1)->pointer_reply);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_pointer_reply_size_set(void * jarg1, void * jarg2) {
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->pointer_reply_size = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_message_pointer_reply_size_get(void * jarg1) {
+  void * jresult ;
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  result =  ((arg1)->pointer_reply_size);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_flags_set(void * jarg1, unsigned long jarg2) {
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  switch_core_session_message_flag_t arg2 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  arg2 = (switch_core_session_message_flag_t)jarg2; 
+  if (arg1) (arg1)->flags = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_session_message_flags_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  switch_core_session_message_flag_t result;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  result = (switch_core_session_message_flag_t) ((arg1)->flags);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message__file_set(void * jarg1, char * jarg2) {
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->_file = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->_file, (const char *)arg2);
+    } else {
+      arg1->_file = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_session_message__file_get(void * jarg1) {
+  char * jresult ;
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  result = (char *) ((arg1)->_file);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message__func_set(void * jarg1, char * jarg2) {
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->_func = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->_func, (const char *)arg2);
+    } else {
+      arg1->_func = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_session_message__func_get(void * jarg1) {
+  char * jresult ;
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  result = (char *) ((arg1)->_func);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message__line_set(void * jarg1, int jarg2) {
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->_line = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_message__line_get(void * jarg1) {
+  int jresult ;
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  int result;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  result = (int) ((arg1)->_line);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_string_array_arg_set(void * jarg1, void * jarg2) {
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  char **arg2 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  arg2 = (char **)jarg2; 
+  {
+    size_t ii;
+    char const * *b = (char const * *) arg1->string_array_arg;
+    for (ii = 0; ii < (size_t)10; ii++) b[ii] = *((char const * *) arg2 + ii);
+  }
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_message_string_array_arg_get(void * jarg1) {
+  void * jresult ;
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  char **result = 0 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  result = (char **)(char **) ((arg1)->string_array_arg);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_message_delivery_time_set(void * jarg1, void * jarg2) {
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  time_t arg2 ;
+  time_t *argp2 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  argp2 = (time_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null time_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->delivery_time = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_message_delivery_time_get(void * jarg1) {
+  void * jresult ;
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  time_t result;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  result =  ((arg1)->delivery_time);
+  jresult = new time_t((time_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_core_session_message() {
+  void * jresult ;
+  switch_core_session_message *result = 0 ;
+  
+  result = (switch_core_session_message *)new switch_core_session_message();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_core_session_message(void * jarg1) {
+  switch_core_session_message *arg1 = (switch_core_session_message *) 0 ;
+  
+  arg1 = (switch_core_session_message *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_thread_session_running_set(void * jarg1, int jarg2) {
+  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_core_thread_session *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->running = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_thread_session_running_get(void * jarg1) {
+  int jresult ;
+  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
+  int result;
+  
+  arg1 = (switch_core_thread_session *)jarg1; 
+  result = (int) ((arg1)->running);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_thread_session_mutex_set(void * jarg1, void * jarg2) {
+  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
+  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
+  
+  arg1 = (switch_core_thread_session *)jarg1; 
+  arg2 = (switch_mutex_t *)jarg2; 
+  if (arg1) (arg1)->mutex = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_thread_session_mutex_get(void * jarg1) {
+  void * jresult ;
+  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
+  switch_mutex_t *result = 0 ;
+  
+  arg1 = (switch_core_thread_session *)jarg1; 
+  result = (switch_mutex_t *) ((arg1)->mutex);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_thread_session_objs_set(void * jarg1, void * jarg2) {
+  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
+  void **arg2 ;
+  
+  arg1 = (switch_core_thread_session *)jarg1; 
+  arg2 = (void **)jarg2; 
+  {
+    size_t ii;
+    void * *b = (void * *) arg1->objs;
+    for (ii = 0; ii < (size_t)128; ii++) b[ii] = *((void * *) arg2 + ii);
+  }
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_thread_session_objs_get(void * jarg1) {
+  void * jresult ;
+  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
+  void **result = 0 ;
+  
+  arg1 = (switch_core_thread_session *)jarg1; 
+  result = (void **)(void **) ((arg1)->objs);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_thread_session_input_callback_set(void * jarg1, void * jarg2) {
+  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
+  switch_input_callback_function_t arg2 = (switch_input_callback_function_t) 0 ;
+  
+  arg1 = (switch_core_thread_session *)jarg1; 
+  arg2 = (switch_input_callback_function_t)jarg2; 
+  if (arg1) (arg1)->input_callback = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_thread_session_input_callback_get(void * jarg1) {
+  void * jresult ;
+  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
+  switch_input_callback_function_t result;
+  
+  arg1 = (switch_core_thread_session *)jarg1; 
+  result = (switch_input_callback_function_t) ((arg1)->input_callback);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_thread_session_pool_set(void * jarg1, void * jarg2) {
+  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
+  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
+  
+  arg1 = (switch_core_thread_session *)jarg1; 
+  arg2 = (switch_memory_pool_t *)jarg2; 
+  if (arg1) (arg1)->pool = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_thread_session_pool_get(void * jarg1) {
+  void * jresult ;
+  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
+  switch_memory_pool_t *result = 0 ;
+  
+  arg1 = (switch_core_thread_session *)jarg1; 
+  result = (switch_memory_pool_t *) ((arg1)->pool);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_core_thread_session() {
+  void * jresult ;
+  switch_core_thread_session *result = 0 ;
+  
+  result = (switch_core_thread_session *)new switch_core_thread_session();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_core_thread_session(void * jarg1) {
+  switch_core_thread_session *arg1 = (switch_core_thread_session *) 0 ;
+  
+  arg1 = (switch_core_thread_session *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_sched_heartbeat(void * jarg1, unsigned long jarg2) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  switch_core_session_sched_heartbeat(arg1,arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_unsched_heartbeat(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_session_unsched_heartbeat(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_enable_heartbeat(void * jarg1, unsigned long jarg2) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  switch_core_session_enable_heartbeat(arg1,arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_disable_heartbeat(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_session_disable_heartbeat(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_add(void * jarg1, void * jarg2, void * jarg3, void * jarg4, unsigned long jarg5, void * jarg6) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_media_bug_callback_t arg2 = (switch_media_bug_callback_t) 0 ;
+  void *arg3 = (void *) 0 ;
+  time_t arg4 ;
+  switch_media_bug_flag_t arg5 ;
+  switch_media_bug_t **arg6 = (switch_media_bug_t **) 0 ;
+  switch_status_t result;
+  time_t *argp4 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_media_bug_callback_t)jarg2; 
+  arg3 = (void *)jarg3; 
+  argp4 = (time_t *)jarg4; 
+  if (!argp4) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null time_t", 0);
+    return 0;
+  }
+  arg4 = *argp4; 
+  arg5 = (switch_media_bug_flag_t)jarg5; 
+  arg6 = (switch_media_bug_t **)jarg6; 
+  result = (switch_status_t)switch_core_media_bug_add(arg1,arg2,arg3,arg4,arg5,arg6);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_media_bug_pause(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_media_bug_pause(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_media_bug_resume(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_media_bug_resume(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_media_bug_inuse(void * jarg1, void * jarg2, void * jarg3) {
+  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
+  switch_size_t *arg2 = (switch_size_t *) 0 ;
+  switch_size_t *arg3 = (switch_size_t *) 0 ;
+  
+  arg1 = (switch_media_bug_t *)jarg1; 
+  arg2 = (switch_size_t *)jarg2; 
+  arg3 = (switch_size_t *)jarg3; 
+  switch_core_media_bug_inuse(arg1,arg2,arg3);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_media_bug_get_user_data(void * jarg1) {
+  void * jresult ;
+  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_media_bug_t *)jarg1; 
+  result = (void *)switch_core_media_bug_get_user_data(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_media_bug_get_write_replace_frame(void * jarg1) {
+  void * jresult ;
+  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
+  switch_frame_t *result = 0 ;
+  
+  arg1 = (switch_media_bug_t *)jarg1; 
+  result = (switch_frame_t *)switch_core_media_bug_get_write_replace_frame(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_media_bug_set_write_replace_frame(void * jarg1, void * jarg2) {
+  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
+  switch_frame_t *arg2 = (switch_frame_t *) 0 ;
+  
+  arg1 = (switch_media_bug_t *)jarg1; 
+  arg2 = (switch_frame_t *)jarg2; 
+  switch_core_media_bug_set_write_replace_frame(arg1,arg2);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_media_bug_get_read_replace_frame(void * jarg1) {
+  void * jresult ;
+  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
+  switch_frame_t *result = 0 ;
+  
+  arg1 = (switch_media_bug_t *)jarg1; 
+  result = (switch_frame_t *)switch_core_media_bug_get_read_replace_frame(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_media_bug_get_session(void * jarg1) {
+  void * jresult ;
+  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
+  switch_core_session_t *result = 0 ;
+  
+  arg1 = (switch_media_bug_t *)jarg1; 
+  result = (switch_core_session_t *)switch_core_media_bug_get_session(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_media_bug_test_flag(void * jarg1, unsigned long jarg2) {
+  unsigned long jresult ;
+  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
+  uint32_t arg2 ;
+  uint32_t result;
+  
+  arg1 = (switch_media_bug_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  result = (uint32_t)switch_core_media_bug_test_flag(arg1,arg2);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_media_bug_set_flag(void * jarg1, unsigned long jarg2) {
+  unsigned long jresult ;
+  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
+  uint32_t arg2 ;
+  uint32_t result;
+  
+  arg1 = (switch_media_bug_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  result = (uint32_t)switch_core_media_bug_set_flag(arg1,arg2);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_media_bug_clear_flag(void * jarg1, unsigned long jarg2) {
+  unsigned long jresult ;
+  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
+  uint32_t arg2 ;
+  uint32_t result;
+  
+  arg1 = (switch_media_bug_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  result = (uint32_t)switch_core_media_bug_clear_flag(arg1,arg2);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_media_bug_set_read_replace_frame(void * jarg1, void * jarg2) {
+  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
+  switch_frame_t *arg2 = (switch_frame_t *) 0 ;
+  
+  arg1 = (switch_media_bug_t *)jarg1; 
+  arg2 = (switch_frame_t *)jarg2; 
+  switch_core_media_bug_set_read_replace_frame(arg1,arg2);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_remove(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_media_bug_t **arg2 = (switch_media_bug_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_media_bug_t **)jarg2; 
+  result = (switch_status_t)switch_core_media_bug_remove(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_media_bug_prune(void * jarg1) {
+  unsigned long jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (uint32_t)switch_core_media_bug_prune(arg1);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_remove_callback(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_media_bug_callback_t arg2 = (switch_media_bug_callback_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_media_bug_callback_t)jarg2; 
+  result = (switch_status_t)switch_core_media_bug_remove_callback(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_close(void * jarg1) {
+  int jresult ;
+  switch_media_bug_t **arg1 = (switch_media_bug_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_media_bug_t **)jarg1; 
+  result = (switch_status_t)switch_core_media_bug_close(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_remove_all(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)switch_core_media_bug_remove_all(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_read(void * jarg1, void * jarg2, int jarg3) {
+  int jresult ;
+  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
+  switch_frame_t *arg2 = (switch_frame_t *) 0 ;
+  switch_bool_t arg3 ;
+  switch_status_t result;
+  
+  arg1 = (switch_media_bug_t *)jarg1; 
+  arg2 = (switch_frame_t *)jarg2; 
+  arg3 = (switch_bool_t)jarg3; 
+  result = (switch_status_t)switch_core_media_bug_read(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_media_bug_flush(void * jarg1) {
+  switch_media_bug_t *arg1 = (switch_media_bug_t *) 0 ;
+  
+  arg1 = (switch_media_bug_t *)jarg1; 
+  switch_core_media_bug_flush(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_media_bug_flush_all(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)switch_core_media_bug_flush_all(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_port_allocator_new(unsigned short jarg1, unsigned short jarg2, unsigned long jarg3, void * jarg4) {
+  int jresult ;
+  switch_port_t arg1 ;
+  switch_port_t arg2 ;
+  switch_port_flag_t arg3 ;
+  switch_core_port_allocator_t **arg4 = (switch_core_port_allocator_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_port_t)jarg1; 
+  arg2 = (switch_port_t)jarg2; 
+  arg3 = (switch_port_flag_t)jarg3; 
+  arg4 = (switch_core_port_allocator_t **)jarg4; 
+  result = (switch_status_t)switch_core_port_allocator_new(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_port_allocator_request_port(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_port_allocator_t *arg1 = (switch_core_port_allocator_t *) 0 ;
+  switch_port_t *arg2 = (switch_port_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_port_allocator_t *)jarg1; 
+  arg2 = (switch_port_t *)jarg2; 
+  result = (switch_status_t)switch_core_port_allocator_request_port(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_port_allocator_free_port(void * jarg1, unsigned short jarg2) {
+  int jresult ;
+  switch_core_port_allocator_t *arg1 = (switch_core_port_allocator_t *) 0 ;
+  switch_port_t arg2 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_port_allocator_t *)jarg1; 
+  arg2 = (switch_port_t)jarg2; 
+  result = (switch_status_t)switch_core_port_allocator_free_port(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_port_allocator_destroy(void * jarg1) {
+  switch_core_port_allocator_t **arg1 = (switch_core_port_allocator_t **) 0 ;
+  
+  arg1 = (switch_core_port_allocator_t **)jarg1; 
+  switch_core_port_allocator_destroy(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_init(unsigned long jarg1, int jarg2, void * jarg3) {
+  int jresult ;
+  switch_core_flag_t arg1 ;
+  switch_bool_t arg2 ;
+  char **arg3 = (char **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_flag_t)jarg1; 
+  arg2 = (switch_bool_t)jarg2; 
+  arg3 = (char **)jarg3; 
+  result = (switch_status_t)switch_core_init(arg1,arg2,(char const **)arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_init_and_modload(unsigned long jarg1, int jarg2, void * jarg3) {
+  int jresult ;
+  switch_core_flag_t arg1 ;
+  switch_bool_t arg2 ;
+  char **arg3 = (char **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_flag_t)jarg1; 
+  arg2 = (switch_bool_t)jarg2; 
+  arg3 = (char **)jarg3; 
+  result = (switch_status_t)switch_core_init_and_modload(arg1,arg2,(char const **)arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_session_limit(unsigned long jarg1) {
+  unsigned long jresult ;
+  uint32_t arg1 ;
+  uint32_t result;
+  
+  arg1 = (uint32_t)jarg1; 
+  result = (uint32_t)switch_core_session_limit(arg1);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_sessions_per_second(unsigned long jarg1) {
+  unsigned long jresult ;
+  uint32_t arg1 ;
+  uint32_t result;
+  
+  arg1 = (uint32_t)jarg1; 
+  result = (uint32_t)switch_core_sessions_per_second(arg1);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_destroy() {
+  int jresult ;
+  switch_status_t result;
+  
+  result = (switch_status_t)switch_core_destroy();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_read_lock(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)switch_core_session_read_lock(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_read_lock_hangup(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)switch_core_session_read_lock_hangup(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_write_lock(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_session_write_lock(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_rwunlock(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_session_rwunlock(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_add_state_handler(void * jarg1) {
+  int jresult ;
+  switch_state_handler_table_t *arg1 = (switch_state_handler_table_t *) 0 ;
+  int result;
+  
+  arg1 = (switch_state_handler_table_t *)jarg1; 
+  result = (int)switch_core_add_state_handler((switch_state_handler_table const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_remove_state_handler(void * jarg1) {
+  switch_state_handler_table_t *arg1 = (switch_state_handler_table_t *) 0 ;
+  
+  arg1 = (switch_state_handler_table_t *)jarg1; 
+  switch_core_remove_state_handler((switch_state_handler_table const *)arg1);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_get_state_handler(int jarg1) {
+  void * jresult ;
+  int arg1 ;
+  switch_state_handler_table_t *result = 0 ;
+  
+  arg1 = (int)jarg1; 
+  result = (switch_state_handler_table_t *)switch_core_get_state_handler(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_memory_pool_tag(void * jarg1, char * jarg2) {
+  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_memory_pool_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  switch_core_memory_pool_tag(arg1,(char const *)arg2);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_perform_new_memory_pool(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
+  int jresult ;
+  switch_memory_pool_t **arg1 = (switch_memory_pool_t **) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_memory_pool_t **)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int)jarg4; 
+  result = (switch_status_t)switch_core_perform_new_memory_pool(arg1,(char const *)arg2,(char const *)arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_perform_destroy_memory_pool(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
+  int jresult ;
+  switch_memory_pool_t **arg1 = (switch_memory_pool_t **) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_memory_pool_t **)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int)jarg4; 
+  result = (switch_status_t)switch_core_perform_destroy_memory_pool(arg1,(char const *)arg2,(char const *)arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_memory_pool_set_data(void * jarg1, char * jarg2, void * jarg3) {
+  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *arg3 = (void *) 0 ;
+  
+  arg1 = (switch_memory_pool_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (void *)jarg3; 
+  switch_core_memory_pool_set_data(arg1,(char const *)arg2,arg3);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_memory_pool_get_data(void * jarg1, char * jarg2) {
+  void * jresult ;
+  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_memory_pool_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (void *)switch_core_memory_pool_get_data(arg1,(char const *)arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_run(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_session_run(arg1);
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_core_session_running(void * jarg1) {
+  unsigned int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  unsigned int result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (unsigned int)switch_core_session_running(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_perform_permanent_alloc(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
+  void * jresult ;
+  switch_size_t arg1 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  void *result = 0 ;
+  switch_size_t *argp1 ;
+  
+  argp1 = (switch_size_t *)jarg1; 
+  if (!argp1) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg1 = *argp1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int)jarg4; 
+  result = (void *)switch_core_perform_permanent_alloc(arg1,(char const *)arg2,(char const *)arg3,arg4);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_perform_alloc(void * jarg1, void * jarg2, char * jarg3, char * jarg4, int jarg5) {
+  void * jresult ;
+  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
+  switch_size_t arg2 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  int arg5 ;
+  void *result = 0 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_memory_pool_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg2 = *argp2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (int)jarg5; 
+  result = (void *)switch_core_perform_alloc(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_perform_session_alloc(void * jarg1, void * jarg2, char * jarg3, char * jarg4, int jarg5) {
+  void * jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_size_t arg2 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  int arg5 ;
+  void *result = 0 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg2 = *argp2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (int)jarg5; 
+  result = (void *)switch_core_perform_session_alloc(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_perform_permanent_strdup(char * jarg1, char * jarg2, char * jarg3, int jarg4) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  char *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int)jarg4; 
+  result = (char *)switch_core_perform_permanent_strdup((char const *)arg1,(char const *)arg2,(char const *)arg3,arg4);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_perform_session_strdup(void * jarg1, char * jarg2, char * jarg3, char * jarg4, int jarg5) {
+  char * jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  int arg5 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (int)jarg5; 
+  result = (char *)switch_core_perform_session_strdup(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_perform_strdup(void * jarg1, char * jarg2, char * jarg3, char * jarg4, int jarg5) {
+  char * jresult ;
+  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  int arg5 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_memory_pool_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (int)jarg5; 
+  result = (char *)switch_core_perform_strdup(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_session_sprintf(void * jarg1, char * jarg2) {
+  char * jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *arg3 = 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (char *)switch_core_session_sprintf(arg1,(char const *)arg2,arg3);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_sprintf(void * jarg1, char * jarg2) {
+  char * jresult ;
+  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *arg3 = 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_memory_pool_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (char *)switch_core_sprintf(arg1,(char const *)arg2,arg3);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_pool(void * jarg1) {
+  void * jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_memory_pool_t *result = 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_memory_pool_t *)switch_core_session_get_pool(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_request_xml(void * jarg1, void * jarg2, void * jarg3) {
+  void * jresult ;
+  switch_endpoint_interface_t *arg1 = (switch_endpoint_interface_t *) 0 ;
+  switch_memory_pool_t **arg2 = (switch_memory_pool_t **) 0 ;
+  switch_xml_t arg3 = (switch_xml_t) 0 ;
+  switch_core_session_t *result = 0 ;
+  
+  arg1 = (switch_endpoint_interface_t *)jarg1; 
+  arg2 = (switch_memory_pool_t **)jarg2; 
+  arg3 = (switch_xml_t)jarg3; 
+  result = (switch_core_session_t *)switch_core_session_request_xml(arg1,arg2,arg3);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_request_uuid(void * jarg1, int jarg2, void * jarg3, char * jarg4) {
+  void * jresult ;
+  switch_endpoint_interface_t *arg1 = (switch_endpoint_interface_t *) 0 ;
+  switch_call_direction_t arg2 ;
+  switch_memory_pool_t **arg3 = (switch_memory_pool_t **) 0 ;
+  char *arg4 = (char *) 0 ;
+  switch_core_session_t *result = 0 ;
+  
+  arg1 = (switch_endpoint_interface_t *)jarg1; 
+  arg2 = (switch_call_direction_t)jarg2; 
+  arg3 = (switch_memory_pool_t **)jarg3; 
+  arg4 = (char *)jarg4; 
+  result = (switch_core_session_t *)switch_core_session_request_uuid(arg1,arg2,arg3,(char const *)arg4);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_uuid(void * jarg1, char * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_status_t)switch_core_session_set_uuid(arg1,(char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_perform_destroy(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
+  switch_core_session_t **arg1 = (switch_core_session_t **) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  
+  arg1 = (switch_core_session_t **)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int)jarg4; 
+  switch_core_session_perform_destroy(arg1,(char const *)arg2,(char const *)arg3,arg4);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_destroy_state(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_session_destroy_state(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_reporting_state(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_session_reporting_state(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_hangup_state(void * jarg1, int jarg2) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_bool_t arg2 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_bool_t)jarg2; 
+  switch_core_session_hangup_state(arg1,arg2);
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_session_count() {
+  unsigned long jresult ;
+  uint32_t result;
+  
+  result = (uint32_t)switch_core_session_count();
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_id(void * jarg1) {
+  void * jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = switch_core_session_get_id(arg1);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_id() {
+  void * jresult ;
+  switch_size_t result;
+  
+  result = switch_core_session_id();
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_request_by_name(char * jarg1, int jarg2, void * jarg3) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_call_direction_t arg2 ;
+  switch_memory_pool_t **arg3 = (switch_memory_pool_t **) 0 ;
+  switch_core_session_t *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_call_direction_t)jarg2; 
+  arg3 = (switch_memory_pool_t **)jarg3; 
+  result = (switch_core_session_t *)switch_core_session_request_by_name((char const *)arg1,arg2,arg3);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_thread_launch(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)switch_core_session_thread_launch(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_channel(void * jarg1) {
+  void * jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_channel_t *result = 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_channel_t *)switch_core_session_get_channel(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_wake_session_thread(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_session_wake_session_thread(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_signal_state_change(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_session_signal_state_change(arg1);
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_session_get_uuid(void * jarg1) {
+  char * jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (char *)switch_core_session_get_uuid(arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_loglevel(void * jarg1, int jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_log_level_t arg2 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_log_level_t)jarg2; 
+  result = (switch_status_t)switch_core_session_set_loglevel(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_loglevel(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_log_level_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_log_level_t)switch_core_session_get_loglevel(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_get_uuid() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *)switch_core_get_uuid();
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_locate(char * jarg1) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_core_session_t *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_core_session_t *)switch_core_session_locate((char const *)arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_force_locate(char * jarg1) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_core_session_t *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_core_session_t *)switch_core_session_force_locate((char const *)arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_get_variable(char * jarg1) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  result = (char *)switch_core_get_variable((char const *)arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_set_variable(char * jarg1, char * jarg2) {
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  switch_core_set_variable((char const *)arg1,(char const *)arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_dump_variables(void * jarg1) {
+  switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ;
+  
+  arg1 = (switch_stream_handle_t *)jarg1; 
+  switch_core_dump_variables(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_hupall(int jarg1) {
+  switch_call_cause_t arg1 ;
+  
+  arg1 = (switch_call_cause_t)jarg1; 
+  switch_core_session_hupall(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_hupall_matching_var(char * jarg1, char * jarg2, int jarg3) {
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_call_cause_t arg3 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_call_cause_t)jarg3; 
+  switch_core_session_hupall_matching_var((char const *)arg1,(char const *)arg2,arg3);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_hupall_endpoint(void * jarg1, int jarg2) {
+  switch_endpoint_interface_t *arg1 = (switch_endpoint_interface_t *) 0 ;
+  switch_call_cause_t arg2 ;
+  
+  arg1 = (switch_endpoint_interface_t *)jarg1; 
+  arg2 = (switch_call_cause_t)jarg2; 
+  switch_core_session_hupall_endpoint((switch_endpoint_interface const *)arg1,arg2);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_partner(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_core_session_t **arg2 = (switch_core_session_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_core_session_t **)jarg2; 
+  result = (switch_status_t)switch_core_session_get_partner(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_message_send(char * jarg1, void * jarg2) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_core_session_message_t *arg2 = (switch_core_session_message_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_core_session_message_t *)jarg2; 
+  result = (switch_status_t)switch_core_session_message_send((char const *)arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_queue_message(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_core_session_message_t *arg2 = (switch_core_session_message_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_core_session_message_t *)jarg2; 
+  result = (switch_status_t)switch_core_session_queue_message(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_free_message(void * jarg1) {
+  switch_core_session_message_t **arg1 = (switch_core_session_message_t **) 0 ;
+  
+  arg1 = (switch_core_session_message_t **)jarg1; 
+  switch_core_session_free_message(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_pass_indication(void * jarg1, int jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_core_session_message_types_t arg2 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_core_session_message_types_t)jarg2; 
+  result = (switch_status_t)switch_core_session_pass_indication(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_queue_indication(void * jarg1, int jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_core_session_message_types_t arg2 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_core_session_message_types_t)jarg2; 
+  result = (switch_status_t)switch_core_session_queue_indication(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_dequeue_message(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_core_session_message_t **arg2 = (switch_core_session_message_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_core_session_message_t **)jarg2; 
+  result = (switch_status_t)switch_core_session_dequeue_message(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_flush_message(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)switch_core_session_flush_message(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_event_send(char * jarg1, void * jarg2) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_event_t **arg2 = (switch_event_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_event_t **)jarg2; 
+  result = (switch_status_t)switch_core_session_event_send((char const *)arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_app_log(void * jarg1) {
+  void * jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_app_log_t *result = 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_app_log_t *)switch_core_session_get_app_log(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_exec(void * jarg1, void * jarg2, char * jarg3) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_application_interface_t *arg2 = (switch_application_interface_t *) 0 ;
+  char *arg3 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_application_interface_t *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (switch_status_t)switch_core_session_exec(arg1,(switch_application_interface const *)arg2,(char const *)arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_execute_application_get_flags(void * jarg1, char * jarg2, char * jarg3, void * jarg4) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int32_t *arg4 = (int32_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int32_t *)jarg4; 
+  result = (switch_status_t)switch_core_session_execute_application_get_flags(arg1,(char const *)arg2,(char const *)arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_app_flags(char * jarg1, void * jarg2) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  int32_t *arg2 = (int32_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (int32_t *)jarg2; 
+  result = (switch_status_t)switch_core_session_get_app_flags((char const *)arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_execute_exten(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  result = (switch_status_t)switch_core_session_execute_exten(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_receive_event(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_event_t **arg2 = (switch_event_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_event_t **)jarg2; 
+  result = (switch_status_t)switch_core_session_receive_event(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_private(void * jarg1) {
+  void * jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (void *)switch_core_session_get_private(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_private(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  result = (switch_status_t)switch_core_session_set_private(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_add_stream(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  int result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  result = (int)switch_core_session_add_stream(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_stream(void * jarg1, int jarg2) {
+  void * jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  int arg2 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (int)jarg2; 
+  result = (void *)switch_core_session_get_stream(arg1,arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_stream_count(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  int result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (int)switch_core_session_get_stream_count(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_launch_thread(void * jarg1, void * jarg2, void * jarg3) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  void *(*arg2)(switch_thread_t *,void *) = (void *(*)(switch_thread_t *,void *)) 0 ;
+  void *arg3 = (void *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (void *(*)(switch_thread_t *,void *))jarg2; 
+  arg3 = (void *)jarg3; 
+  switch_core_session_launch_thread(arg1,arg2,arg3);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_thread_session_end(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_thread_session_end(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_service_session(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_service_session(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_outgoing_channel(void * jarg1, void * jarg2, char * jarg3, void * jarg4, void * jarg5, void * jarg6, unsigned long jarg7, void * jarg8) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_event_t *arg2 = (switch_event_t *) 0 ;
+  char *arg3 = (char *) 0 ;
+  switch_caller_profile_t *arg4 = (switch_caller_profile_t *) 0 ;
+  switch_core_session_t **arg5 = (switch_core_session_t **) 0 ;
+  switch_memory_pool_t **arg6 = (switch_memory_pool_t **) 0 ;
+  switch_originate_flag_t arg7 ;
+  switch_call_cause_t *arg8 = (switch_call_cause_t *) 0 ;
+  switch_call_cause_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_event_t *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (switch_caller_profile_t *)jarg4; 
+  arg5 = (switch_core_session_t **)jarg5; 
+  arg6 = (switch_memory_pool_t **)jarg6; 
+  arg7 = (switch_originate_flag_t)jarg7; 
+  arg8 = (switch_call_cause_t *)jarg8; 
+  result = (switch_call_cause_t)switch_core_session_outgoing_channel(arg1,arg2,(char const *)arg3,arg4,arg5,arg6,arg7,arg8);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_resurrect_channel(char * jarg1, void * jarg2, void * jarg3, void * jarg4) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_core_session_t **arg2 = (switch_core_session_t **) 0 ;
+  switch_memory_pool_t **arg3 = (switch_memory_pool_t **) 0 ;
+  void *arg4 = (void *) 0 ;
+  switch_call_cause_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_core_session_t **)jarg2; 
+  arg3 = (switch_memory_pool_t **)jarg3; 
+  arg4 = (void *)jarg4; 
+  result = (switch_call_cause_t)switch_core_session_resurrect_channel((char const *)arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_perform_receive_message(void * jarg1, void * jarg2, char * jarg3, char * jarg4, int jarg5) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_core_session_message_t *arg2 = (switch_core_session_message_t *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  int arg5 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_core_session_message_t *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (int)jarg5; 
+  result = (switch_status_t)switch_core_session_perform_receive_message(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_queue_event(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_event_t **arg2 = (switch_event_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_event_t **)jarg2; 
+  result = (switch_status_t)switch_core_session_queue_event(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_session_event_count(void * jarg1) {
+  unsigned long jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (uint32_t)switch_core_session_event_count(arg1);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_dequeue_event(void * jarg1, void * jarg2, int jarg3) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_event_t **arg2 = (switch_event_t **) 0 ;
+  switch_bool_t arg3 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_event_t **)jarg2; 
+  arg3 = (switch_bool_t)jarg3; 
+  result = (switch_status_t)switch_core_session_dequeue_event(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_queue_private_event(void * jarg1, void * jarg2, int jarg3) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_event_t **arg2 = (switch_event_t **) 0 ;
+  switch_bool_t arg3 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_event_t **)jarg2; 
+  arg3 = (switch_bool_t)jarg3; 
+  result = (switch_status_t)switch_core_session_queue_private_event(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_session_private_event_count(void * jarg1) {
+  unsigned long jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (uint32_t)switch_core_session_private_event_count(arg1);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_dequeue_private_event(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_event_t **arg2 = (switch_event_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_event_t **)jarg2; 
+  result = (switch_status_t)switch_core_session_dequeue_private_event(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_session_flush_private_events(void * jarg1) {
+  unsigned long jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (uint32_t)switch_core_session_flush_private_events(arg1);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_read_frame(void * jarg1, void * jarg2, unsigned long jarg3, int jarg4) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_frame_t **arg2 = (switch_frame_t **) 0 ;
+  switch_io_flag_t arg3 ;
+  int arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_frame_t **)jarg2; 
+  arg3 = (switch_io_flag_t)jarg3; 
+  arg4 = (int)jarg4; 
+  result = (switch_status_t)switch_core_session_read_frame(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_read_video_frame(void * jarg1, void * jarg2, unsigned long jarg3, int jarg4) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_frame_t **arg2 = (switch_frame_t **) 0 ;
+  switch_io_flag_t arg3 ;
+  int arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_frame_t **)jarg2; 
+  arg3 = (switch_io_flag_t)jarg3; 
+  arg4 = (int)jarg4; 
+  result = (switch_status_t)switch_core_session_read_video_frame(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_write_video_frame(void * jarg1, void * jarg2, unsigned long jarg3, int jarg4) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_frame_t *arg2 = (switch_frame_t *) 0 ;
+  switch_io_flag_t arg3 ;
+  int arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_frame_t *)jarg2; 
+  arg3 = (switch_io_flag_t)jarg3; 
+  arg4 = (int)jarg4; 
+  result = (switch_status_t)switch_core_session_write_video_frame(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_read_impl(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_codec_implementation_t *)jarg2; 
+  result = (switch_status_t)switch_core_session_set_read_impl(arg1,(switch_codec_implementation const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_write_impl(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_codec_implementation_t *)jarg2; 
+  result = (switch_status_t)switch_core_session_set_write_impl(arg1,(switch_codec_implementation const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_video_read_impl(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_codec_implementation_t *)jarg2; 
+  result = (switch_status_t)switch_core_session_set_video_read_impl(arg1,(switch_codec_implementation const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_video_write_impl(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_codec_implementation_t *)jarg2; 
+  result = (switch_status_t)switch_core_session_set_video_write_impl(arg1,(switch_codec_implementation const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_reset(void * jarg1, int jarg2, int jarg3) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_bool_t arg2 ;
+  switch_bool_t arg3 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_bool_t)jarg2; 
+  arg3 = (switch_bool_t)jarg3; 
+  switch_core_session_reset(arg1,arg2,arg3);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_write_frame(void * jarg1, void * jarg2, unsigned long jarg3, int jarg4) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_frame_t *arg2 = (switch_frame_t *) 0 ;
+  switch_io_flag_t arg3 ;
+  int arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_frame_t *)jarg2; 
+  arg3 = (switch_io_flag_t)jarg3; 
+  arg4 = (int)jarg4; 
+  result = (switch_status_t)switch_core_session_write_frame(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_perform_kill_channel(void * jarg1, char * jarg2, char * jarg3, int jarg4, int jarg5) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  switch_signal_t arg5 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int)jarg4; 
+  arg5 = (switch_signal_t)jarg5; 
+  result = (switch_status_t)switch_core_session_perform_kill_channel(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_send_dtmf(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_dtmf_t *arg2 = (switch_dtmf_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_dtmf_t *)jarg2; 
+  result = (switch_status_t)switch_core_session_send_dtmf(arg1,(switch_dtmf_t const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_send_dtmf_string(void * jarg1, char * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_status_t)switch_core_session_send_dtmf_string(arg1,(char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_recv_dtmf(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_dtmf_t *arg2 = (switch_dtmf_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_dtmf_t *)jarg2; 
+  result = (switch_status_t)switch_core_session_recv_dtmf(arg1,(switch_dtmf_t const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_hash_init_case(void * jarg1, void * jarg2, int jarg3) {
+  int jresult ;
+  switch_hash_t **arg1 = (switch_hash_t **) 0 ;
+  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
+  switch_bool_t arg3 ;
+  switch_status_t result;
+  
+  arg1 = (switch_hash_t **)jarg1; 
+  arg2 = (switch_memory_pool_t *)jarg2; 
+  arg3 = (switch_bool_t)jarg3; 
+  result = (switch_status_t)switch_core_hash_init_case(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_hash_destroy(void * jarg1) {
+  int jresult ;
+  switch_hash_t **arg1 = (switch_hash_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_hash_t **)jarg1; 
+  result = (switch_status_t)switch_core_hash_destroy(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_hash_insert(void * jarg1, char * jarg2, void * jarg3) {
+  int jresult ;
+  switch_hash_t *arg1 = (switch_hash_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *arg3 = (void *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_hash_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (void *)jarg3; 
+  result = (switch_status_t)switch_core_hash_insert(arg1,(char const *)arg2,(void const *)arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_hash_insert_locked(void * jarg1, char * jarg2, void * jarg3, void * jarg4) {
+  int jresult ;
+  switch_hash_t *arg1 = (switch_hash_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *arg3 = (void *) 0 ;
+  switch_mutex_t *arg4 = (switch_mutex_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_hash_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (void *)jarg3; 
+  arg4 = (switch_mutex_t *)jarg4; 
+  result = (switch_status_t)switch_core_hash_insert_locked(arg1,(char const *)arg2,(void const *)arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_hash_delete(void * jarg1, char * jarg2) {
+  int jresult ;
+  switch_hash_t *arg1 = (switch_hash_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_hash_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_status_t)switch_core_hash_delete(arg1,(char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_hash_delete_locked(void * jarg1, char * jarg2, void * jarg3) {
+  int jresult ;
+  switch_hash_t *arg1 = (switch_hash_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_mutex_t *arg3 = (switch_mutex_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_hash_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_mutex_t *)jarg3; 
+  result = (switch_status_t)switch_core_hash_delete_locked(arg1,(char const *)arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_hash_find(void * jarg1, char * jarg2) {
+  void * jresult ;
+  switch_hash_t *arg1 = (switch_hash_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_hash_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (void *)switch_core_hash_find(arg1,(char const *)arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_hash_find_locked(void * jarg1, char * jarg2, void * jarg3) {
+  void * jresult ;
+  switch_hash_t *arg1 = (switch_hash_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_mutex_t *arg3 = (switch_mutex_t *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_hash_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_mutex_t *)jarg3; 
+  result = (void *)switch_core_hash_find_locked(arg1,(char const *)arg2,arg3);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_hash_first(char * jarg1, void * jarg2) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_hash_t *arg2 = (switch_hash_t *) 0 ;
+  switch_hash_index_t *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_hash_t *)jarg2; 
+  result = (switch_hash_index_t *)switch_hash_first(arg1,arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_hash_next(void * jarg1) {
+  void * jresult ;
+  switch_hash_index_t *arg1 = (switch_hash_index_t *) 0 ;
+  switch_hash_index_t *result = 0 ;
+  
+  arg1 = (switch_hash_index_t *)jarg1; 
+  result = (switch_hash_index_t *)switch_hash_next(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_hash_this(void * jarg1, void * jarg2, void * jarg3, void * jarg4) {
+  switch_hash_index_t *arg1 = (switch_hash_index_t *) 0 ;
+  void **arg2 = (void **) 0 ;
+  switch_ssize_t *arg3 = (switch_ssize_t *) 0 ;
+  void **arg4 = (void **) 0 ;
+  
+  arg1 = (switch_hash_index_t *)jarg1; 
+  arg2 = (void **)jarg2; 
+  arg3 = (switch_ssize_t *)jarg3; 
+  arg4 = (void **)jarg4; 
+  switch_hash_this(arg1,(void const **)arg2,arg3,arg4);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_timer_init(void * jarg1, char * jarg2, int jarg3, int jarg4, void * jarg5) {
+  int jresult ;
+  switch_timer_t *arg1 = (switch_timer_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  int arg4 ;
+  switch_memory_pool_t *arg5 = (switch_memory_pool_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_timer_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (int)jarg3; 
+  arg4 = (int)jarg4; 
+  arg5 = (switch_memory_pool_t *)jarg5; 
+  result = (switch_status_t)switch_core_timer_init(arg1,(char const *)arg2,arg3,arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_time_calibrate_clock() {
+  switch_time_calibrate_clock();
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_timer_next(void * jarg1) {
+  int jresult ;
+  switch_timer_t *arg1 = (switch_timer_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_timer_t *)jarg1; 
+  result = (switch_status_t)switch_core_timer_next(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_timer_step(void * jarg1) {
+  int jresult ;
+  switch_timer_t *arg1 = (switch_timer_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_timer_t *)jarg1; 
+  result = (switch_status_t)switch_core_timer_step(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_timer_sync(void * jarg1) {
+  int jresult ;
+  switch_timer_t *arg1 = (switch_timer_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_timer_t *)jarg1; 
+  result = (switch_status_t)switch_core_timer_sync(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_timer_check(void * jarg1, int jarg2) {
+  int jresult ;
+  switch_timer_t *arg1 = (switch_timer_t *) 0 ;
+  switch_bool_t arg2 ;
+  switch_status_t result;
+  
+  arg1 = (switch_timer_t *)jarg1; 
+  arg2 = (switch_bool_t)jarg2; 
+  result = (switch_status_t)switch_core_timer_check(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_timer_destroy(void * jarg1) {
+  int jresult ;
+  switch_timer_t *arg1 = (switch_timer_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_timer_t *)jarg1; 
+  result = (switch_status_t)switch_core_timer_destroy(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_init(void * jarg1, char * jarg2, char * jarg3, unsigned long jarg4, int jarg5, int jarg6, unsigned long jarg7, void * jarg8, void * jarg9) {
+  int jresult ;
+  switch_codec_t *arg1 = (switch_codec_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  uint32_t arg4 ;
+  int arg5 ;
+  int arg6 ;
+  uint32_t arg7 ;
+  switch_codec_settings_t *arg8 = (switch_codec_settings_t *) 0 ;
+  switch_memory_pool_t *arg9 = (switch_memory_pool_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_codec_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (uint32_t)jarg4; 
+  arg5 = (int)jarg5; 
+  arg6 = (int)jarg6; 
+  arg7 = (uint32_t)jarg7; 
+  arg8 = (switch_codec_settings_t *)jarg8; 
+  arg9 = (switch_memory_pool_t *)jarg9; 
+  result = (switch_status_t)switch_core_codec_init(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5,arg6,arg7,(switch_codec_settings const *)arg8,arg9);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_copy(void * jarg1, void * jarg2, void * jarg3) {
+  int jresult ;
+  switch_codec_t *arg1 = (switch_codec_t *) 0 ;
+  switch_codec_t *arg2 = (switch_codec_t *) 0 ;
+  switch_memory_pool_t *arg3 = (switch_memory_pool_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_codec_t *)jarg1; 
+  arg2 = (switch_codec_t *)jarg2; 
+  arg3 = (switch_memory_pool_t *)jarg3; 
+  result = (switch_status_t)switch_core_codec_copy(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_encode(void * jarg1, void * jarg2, void * jarg3, unsigned long jarg4, unsigned long jarg5, void * jarg6, void * jarg7, void * jarg8, void * jarg9) {
+  int jresult ;
+  switch_codec_t *arg1 = (switch_codec_t *) 0 ;
+  switch_codec_t *arg2 = (switch_codec_t *) 0 ;
+  void *arg3 = (void *) 0 ;
+  uint32_t arg4 ;
+  uint32_t arg5 ;
+  void *arg6 = (void *) 0 ;
+  uint32_t *arg7 = (uint32_t *) 0 ;
+  uint32_t *arg8 = (uint32_t *) 0 ;
+  unsigned int *arg9 = (unsigned int *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_codec_t *)jarg1; 
+  arg2 = (switch_codec_t *)jarg2; 
+  arg3 = (void *)jarg3; 
+  arg4 = (uint32_t)jarg4; 
+  arg5 = (uint32_t)jarg5; 
+  arg6 = (void *)jarg6; 
+  arg7 = (uint32_t *)jarg7; 
+  arg8 = (uint32_t *)jarg8; 
+  arg9 = (unsigned int *)jarg9; 
+  result = (switch_status_t)switch_core_codec_encode(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_decode(void * jarg1, void * jarg2, void * jarg3, unsigned long jarg4, unsigned long jarg5, void * jarg6, void * jarg7, void * jarg8, void * jarg9) {
+  int jresult ;
+  switch_codec_t *arg1 = (switch_codec_t *) 0 ;
+  switch_codec_t *arg2 = (switch_codec_t *) 0 ;
+  void *arg3 = (void *) 0 ;
+  uint32_t arg4 ;
+  uint32_t arg5 ;
+  void *arg6 = (void *) 0 ;
+  uint32_t *arg7 = (uint32_t *) 0 ;
+  uint32_t *arg8 = (uint32_t *) 0 ;
+  unsigned int *arg9 = (unsigned int *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_codec_t *)jarg1; 
+  arg2 = (switch_codec_t *)jarg2; 
+  arg3 = (void *)jarg3; 
+  arg4 = (uint32_t)jarg4; 
+  arg5 = (uint32_t)jarg5; 
+  arg6 = (void *)jarg6; 
+  arg7 = (uint32_t *)jarg7; 
+  arg8 = (uint32_t *)jarg8; 
+  arg9 = (unsigned int *)jarg9; 
+  result = (switch_status_t)switch_core_codec_decode(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_codec_destroy(void * jarg1) {
+  int jresult ;
+  switch_codec_t *arg1 = (switch_codec_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_codec_t *)jarg1; 
+  result = (switch_status_t)switch_core_codec_destroy(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_read_codec(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_codec_t *arg2 = (switch_codec_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_codec_t *)jarg2; 
+  result = (switch_status_t)switch_core_session_set_read_codec(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_unset_read_codec(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_session_unset_read_codec(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_unset_write_codec(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_session_unset_write_codec(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_lock_codec_write(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_session_lock_codec_write(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_unlock_codec_write(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_session_unlock_codec_write(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_lock_codec_read(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_session_lock_codec_read(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_session_unlock_codec_read(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_core_session_unlock_codec_read(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_read_impl(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_codec_implementation_t *)jarg2; 
+  result = (switch_status_t)switch_core_session_get_read_impl(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_write_impl(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_codec_implementation_t *)jarg2; 
+  result = (switch_status_t)switch_core_session_get_write_impl(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_video_read_impl(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_codec_implementation_t *)jarg2; 
+  result = (switch_status_t)switch_core_session_get_video_read_impl(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_get_video_write_impl(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_codec_implementation_t *)jarg2; 
+  result = (switch_status_t)switch_core_session_get_video_write_impl(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_read_codec(void * jarg1) {
+  void * jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_codec_t *result = 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_codec_t *)switch_core_session_get_read_codec(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_effective_read_codec(void * jarg1) {
+  void * jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_codec_t *result = 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_codec_t *)switch_core_session_get_effective_read_codec(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_write_codec(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_codec_t *arg2 = (switch_codec_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_codec_t *)jarg2; 
+  result = (switch_status_t)switch_core_session_set_write_codec(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_write_codec(void * jarg1) {
+  void * jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_codec_t *result = 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_codec_t *)switch_core_session_get_write_codec(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_effective_write_codec(void * jarg1) {
+  void * jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_codec_t *result = 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_codec_t *)switch_core_session_get_effective_write_codec(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_video_read_codec(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_codec_t *arg2 = (switch_codec_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_codec_t *)jarg2; 
+  result = (switch_status_t)switch_core_session_set_video_read_codec(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_video_read_codec(void * jarg1) {
+  void * jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_codec_t *result = 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_codec_t *)switch_core_session_get_video_read_codec(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_set_video_write_codec(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_codec_t *arg2 = (switch_codec_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_codec_t *)jarg2; 
+  result = (switch_status_t)switch_core_session_set_video_write_codec(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_session_get_video_write_codec(void * jarg1) {
+  void * jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_codec_t *result = 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_codec_t *)switch_core_session_get_video_write_codec(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_db_open_file(char * jarg1) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_core_db_t *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_core_db_t *)switch_core_db_open_file((char const *)arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_persistant_execute(void * jarg1, char * jarg2, unsigned long jarg3) {
+  int jresult ;
+  switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  uint32_t arg3 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_db_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  result = (switch_status_t)switch_core_db_persistant_execute(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_db_persistant_execute_trans(void * jarg1, char * jarg2, unsigned long jarg3) {
+  int jresult ;
+  switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  uint32_t arg3 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_db_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  result = (switch_status_t)switch_core_db_persistant_execute_trans(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_db_test_reactive(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
+  switch_core_db_t *arg1 = (switch_core_db_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  
+  arg1 = (switch_core_db_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  switch_core_db_test_reactive(arg1,arg2,arg3,arg4);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_perform_file_open(char * jarg1, char * jarg2, int jarg3, void * jarg4, char * jarg5, unsigned char jarg6, unsigned long jarg7, unsigned int jarg8, void * jarg9) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  switch_file_handle_t *arg4 = (switch_file_handle_t *) 0 ;
+  char *arg5 = (char *) 0 ;
+  uint8_t arg6 ;
+  uint32_t arg7 ;
+  unsigned int arg8 ;
+  switch_memory_pool_t *arg9 = (switch_memory_pool_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (int)jarg3; 
+  arg4 = (switch_file_handle_t *)jarg4; 
+  arg5 = (char *)jarg5; 
+  arg6 = (uint8_t)jarg6; 
+  arg7 = (uint32_t)jarg7; 
+  arg8 = (unsigned int)jarg8; 
+  arg9 = (switch_memory_pool_t *)jarg9; 
+  result = (switch_status_t)switch_core_perform_file_open((char const *)arg1,(char const *)arg2,arg3,arg4,(char const *)arg5,arg6,arg7,arg8,arg9);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_file_read(void * jarg1, void * jarg2, void * jarg3) {
+  int jresult ;
+  switch_file_handle_t *arg1 = (switch_file_handle_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  switch_size_t *arg3 = (switch_size_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_file_handle_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  arg3 = (switch_size_t *)jarg3; 
+  result = (switch_status_t)switch_core_file_read(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_file_write(void * jarg1, void * jarg2, void * jarg3) {
+  int jresult ;
+  switch_file_handle_t *arg1 = (switch_file_handle_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  switch_size_t *arg3 = (switch_size_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_file_handle_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  arg3 = (switch_size_t *)jarg3; 
+  result = (switch_status_t)switch_core_file_write(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_file_seek(void * jarg1, void * jarg2, long long jarg3, int jarg4) {
+  int jresult ;
+  switch_file_handle_t *arg1 = (switch_file_handle_t *) 0 ;
+  unsigned int *arg2 = (unsigned int *) 0 ;
+  int64_t arg3 ;
+  int arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_file_handle_t *)jarg1; 
+  arg2 = (unsigned int *)jarg2; 
+  arg3 = (int64_t)jarg3; 
+  arg4 = (int)jarg4; 
+  result = (switch_status_t)switch_core_file_seek(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_file_set_string(void * jarg1, int jarg2, char * jarg3) {
+  int jresult ;
+  switch_file_handle_t *arg1 = (switch_file_handle_t *) 0 ;
+  switch_audio_col_t arg2 ;
+  char *arg3 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_file_handle_t *)jarg1; 
+  arg2 = (switch_audio_col_t)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (switch_status_t)switch_core_file_set_string(arg1,arg2,(char const *)arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_file_get_string(void * jarg1, int jarg2, void * jarg3) {
+  int jresult ;
+  switch_file_handle_t *arg1 = (switch_file_handle_t *) 0 ;
+  switch_audio_col_t arg2 ;
+  char **arg3 = (char **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_file_handle_t *)jarg1; 
+  arg2 = (switch_audio_col_t)jarg2; 
+  arg3 = (char **)jarg3; 
+  result = (switch_status_t)switch_core_file_get_string(arg1,arg2,(char const **)arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_file_close(void * jarg1) {
+  int jresult ;
+  switch_file_handle_t *arg1 = (switch_file_handle_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_file_handle_t *)jarg1; 
+  result = (switch_status_t)switch_core_file_close(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_file_truncate(void * jarg1, long long jarg2) {
+  int jresult ;
+  switch_file_handle_t *arg1 = (switch_file_handle_t *) 0 ;
+  int64_t arg2 ;
+  switch_status_t result;
+  
+  arg1 = (switch_file_handle_t *)jarg1; 
+  arg2 = (int64_t)jarg2; 
+  result = (switch_status_t)switch_core_file_truncate(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_speech_open(void * jarg1, char * jarg2, char * jarg3, unsigned int jarg4, unsigned int jarg5, void * jarg6, void * jarg7) {
+  int jresult ;
+  switch_speech_handle_t *arg1 = (switch_speech_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  unsigned int arg4 ;
+  unsigned int arg5 ;
+  switch_speech_flag_t *arg6 = (switch_speech_flag_t *) 0 ;
+  switch_memory_pool_t *arg7 = (switch_memory_pool_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_speech_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (unsigned int)jarg4; 
+  arg5 = (unsigned int)jarg5; 
+  arg6 = (switch_speech_flag_t *)jarg6; 
+  arg7 = (switch_memory_pool_t *)jarg7; 
+  result = (switch_status_t)switch_core_speech_open(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5,arg6,arg7);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_speech_feed_tts(void * jarg1, char * jarg2, void * jarg3) {
+  int jresult ;
+  switch_speech_handle_t *arg1 = (switch_speech_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_speech_flag_t *arg3 = (switch_speech_flag_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_speech_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_speech_flag_t *)jarg3; 
+  result = (switch_status_t)switch_core_speech_feed_tts(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_speech_flush_tts(void * jarg1) {
+  switch_speech_handle_t *arg1 = (switch_speech_handle_t *) 0 ;
+  
+  arg1 = (switch_speech_handle_t *)jarg1; 
+  switch_core_speech_flush_tts(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_speech_text_param_tts(void * jarg1, char * jarg2, char * jarg3) {
+  switch_speech_handle_t *arg1 = (switch_speech_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  
+  arg1 = (switch_speech_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  switch_core_speech_text_param_tts(arg1,arg2,(char const *)arg3);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_speech_numeric_param_tts(void * jarg1, char * jarg2, int jarg3) {
+  switch_speech_handle_t *arg1 = (switch_speech_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  
+  arg1 = (switch_speech_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (int)jarg3; 
+  switch_core_speech_numeric_param_tts(arg1,arg2,arg3);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_speech_float_param_tts(void * jarg1, char * jarg2, double jarg3) {
+  switch_speech_handle_t *arg1 = (switch_speech_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  double arg3 ;
+  
+  arg1 = (switch_speech_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (double)jarg3; 
+  switch_core_speech_float_param_tts(arg1,arg2,arg3);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_speech_read_tts(void * jarg1, void * jarg2, void * jarg3, void * jarg4) {
+  int jresult ;
+  switch_speech_handle_t *arg1 = (switch_speech_handle_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  switch_size_t *arg3 = (switch_size_t *) 0 ;
+  switch_speech_flag_t *arg4 = (switch_speech_flag_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_speech_handle_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  arg3 = (switch_size_t *)jarg3; 
+  arg4 = (switch_speech_flag_t *)jarg4; 
+  result = (switch_status_t)switch_core_speech_read_tts(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_speech_close(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_speech_handle_t *arg1 = (switch_speech_handle_t *) 0 ;
+  switch_speech_flag_t *arg2 = (switch_speech_flag_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_speech_handle_t *)jarg1; 
+  arg2 = (switch_speech_flag_t *)jarg2; 
+  result = (switch_status_t)switch_core_speech_close(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_open(void * jarg1, char * jarg2, char * jarg3, int jarg4, char * jarg5, void * jarg6, void * jarg7) {
+  int jresult ;
+  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  char *arg5 = (char *) 0 ;
+  switch_asr_flag_t *arg6 = (switch_asr_flag_t *) 0 ;
+  switch_memory_pool_t *arg7 = (switch_memory_pool_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_asr_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int)jarg4; 
+  arg5 = (char *)jarg5; 
+  arg6 = (switch_asr_flag_t *)jarg6; 
+  arg7 = (switch_memory_pool_t *)jarg7; 
+  result = (switch_status_t)switch_core_asr_open(arg1,(char const *)arg2,(char const *)arg3,arg4,(char const *)arg5,arg6,arg7);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_close(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
+  switch_asr_flag_t *arg2 = (switch_asr_flag_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_asr_handle_t *)jarg1; 
+  arg2 = (switch_asr_flag_t *)jarg2; 
+  result = (switch_status_t)switch_core_asr_close(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_feed(void * jarg1, void * jarg2, unsigned int jarg3, void * jarg4) {
+  int jresult ;
+  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  unsigned int arg3 ;
+  switch_asr_flag_t *arg4 = (switch_asr_flag_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_asr_handle_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  arg3 = (unsigned int)jarg3; 
+  arg4 = (switch_asr_flag_t *)jarg4; 
+  result = (switch_status_t)switch_core_asr_feed(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_check_results(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
+  switch_asr_flag_t *arg2 = (switch_asr_flag_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_asr_handle_t *)jarg1; 
+  arg2 = (switch_asr_flag_t *)jarg2; 
+  result = (switch_status_t)switch_core_asr_check_results(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_get_results(void * jarg1, void * jarg2, void * jarg3) {
+  int jresult ;
+  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
+  char **arg2 = (char **) 0 ;
+  switch_asr_flag_t *arg3 = (switch_asr_flag_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_asr_handle_t *)jarg1; 
+  arg2 = (char **)jarg2; 
+  arg3 = (switch_asr_flag_t *)jarg3; 
+  result = (switch_status_t)switch_core_asr_get_results(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_load_grammar(void * jarg1, char * jarg2, char * jarg3) {
+  int jresult ;
+  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_asr_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (switch_status_t)switch_core_asr_load_grammar(arg1,(char const *)arg2,(char const *)arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_unload_grammar(void * jarg1, char * jarg2) {
+  int jresult ;
+  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_asr_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_status_t)switch_core_asr_unload_grammar(arg1,(char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_pause(void * jarg1) {
+  int jresult ;
+  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_asr_handle_t *)jarg1; 
+  result = (switch_status_t)switch_core_asr_pause(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_resume(void * jarg1) {
+  int jresult ;
+  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_asr_handle_t *)jarg1; 
+  result = (switch_status_t)switch_core_asr_resume(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_asr_start_input_timers(void * jarg1) {
+  int jresult ;
+  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_asr_handle_t *)jarg1; 
+  result = (switch_status_t)switch_core_asr_start_input_timers(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_asr_text_param(void * jarg1, char * jarg2, char * jarg3) {
+  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  
+  arg1 = (switch_asr_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  switch_core_asr_text_param(arg1,arg2,(char const *)arg3);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_asr_numeric_param(void * jarg1, char * jarg2, int jarg3) {
+  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  
+  arg1 = (switch_asr_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (int)jarg3; 
+  switch_core_asr_numeric_param(arg1,arg2,arg3);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_asr_float_param(void * jarg1, char * jarg2, double jarg3) {
+  switch_asr_handle_t *arg1 = (switch_asr_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  double arg3 ;
+  
+  arg1 = (switch_asr_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (double)jarg3; 
+  switch_core_asr_float_param(arg1,arg2,arg3);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_directory_open(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, void * jarg6) {
+  int jresult ;
+  switch_directory_handle_t *arg1 = (switch_directory_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  char *arg5 = (char *) 0 ;
+  switch_memory_pool_t *arg6 = (switch_memory_pool_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_directory_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (char *)jarg5; 
+  arg6 = (switch_memory_pool_t *)jarg6; 
+  result = (switch_status_t)switch_core_directory_open(arg1,arg2,arg3,arg4,arg5,arg6);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_directory_query(void * jarg1, char * jarg2, char * jarg3) {
+  int jresult ;
+  switch_directory_handle_t *arg1 = (switch_directory_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_directory_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (switch_status_t)switch_core_directory_query(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_directory_next(void * jarg1) {
+  int jresult ;
+  switch_directory_handle_t *arg1 = (switch_directory_handle_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_directory_handle_t *)jarg1; 
+  result = (switch_status_t)switch_core_directory_next(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_directory_next_pair(void * jarg1, void * jarg2, void * jarg3) {
+  int jresult ;
+  switch_directory_handle_t *arg1 = (switch_directory_handle_t *) 0 ;
+  char **arg2 = (char **) 0 ;
+  char **arg3 = (char **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_directory_handle_t *)jarg1; 
+  arg2 = (char **)jarg2; 
+  arg3 = (char **)jarg3; 
+  result = (switch_status_t)switch_core_directory_next_pair(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_directory_close(void * jarg1) {
+  int jresult ;
+  switch_directory_handle_t *arg1 = (switch_directory_handle_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_directory_handle_t *)jarg1; 
+  result = (switch_status_t)switch_core_directory_close(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_data_channel(int jarg1) {
+  void * jresult ;
+  switch_text_channel_t arg1 ;
+  FILE *result = 0 ;
+  
+  arg1 = (switch_text_channel_t)jarg1; 
+  result = (FILE *)switch_core_data_channel(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_ready() {
+  int jresult ;
+  switch_bool_t result;
+  
+  result = (switch_bool_t)switch_core_ready();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_flags() {
+  unsigned long jresult ;
+  switch_core_flag_t result;
+  
+  result = (switch_core_flag_t)switch_core_flags();
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_management_exec(char * jarg1, int jarg2, char * jarg3, void * jarg4) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_management_action_t arg2 ;
+  char *arg3 = (char *) 0 ;
+  switch_size_t arg4 ;
+  switch_status_t result;
+  switch_size_t *argp4 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_management_action_t)jarg2; 
+  arg3 = (char *)jarg3; 
+  argp4 = (switch_size_t *)jarg4; 
+  if (!argp4) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg4 = *argp4; 
+  result = (switch_status_t)switch_core_management_exec(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_set_high_priority() {
+  int jresult ;
+  int32_t result;
+  
+  result = (int32_t)set_high_priority();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_change_user_group(char * jarg1, char * jarg2) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int32_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (int32_t)change_user_group((char const *)arg1,(char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_runtime_loop(int jarg1) {
+  int arg1 ;
+  
+  arg1 = (int)jarg1; 
+  switch_core_runtime_loop(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_set_console(char * jarg1) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_status_t)switch_core_set_console((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_measure_time(void * jarg1, void * jarg2) {
+  switch_time_t arg1 ;
+  switch_core_time_duration_t *arg2 = (switch_core_time_duration_t *) 0 ;
+  switch_time_t *argp1 ;
+  
+  argp1 = (switch_time_t *)jarg1; 
+  if (!argp1) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
+    return ;
+  }
+  arg1 = *argp1; 
+  arg2 = (switch_core_time_duration_t *)jarg2; 
+  switch_core_measure_time(arg1,arg2);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_uptime() {
+  void * jresult ;
+  switch_time_t result;
+  
+  result = switch_core_uptime();
+  jresult = new switch_time_t((switch_time_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_ctl(int jarg1, void * jarg2) {
+  int jresult ;
+  switch_session_ctl_t arg1 ;
+  int32_t *arg2 = (int32_t *) 0 ;
+  int32_t result;
+  
+  arg1 = (switch_session_ctl_t)jarg1; 
+  arg2 = (int32_t *)jarg2; 
+  result = (int32_t)switch_core_session_ctl(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_get_console() {
+  void * jresult ;
+  FILE *result = 0 ;
+  
+  result = (FILE *)switch_core_get_console();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_set_globals() {
+  switch_core_set_globals();
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_core_session_compare(void * jarg1, void * jarg2) {
+  unsigned char jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
+  uint8_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_core_session_t *)jarg2; 
+  result = (uint8_t)switch_core_session_compare(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_core_session_check_interface(void * jarg1, void * jarg2) {
+  unsigned char jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_endpoint_interface_t *arg2 = (switch_endpoint_interface_t *) 0 ;
+  uint8_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_endpoint_interface_t *)jarg2; 
+  result = (uint8_t)switch_core_session_check_interface(arg1,(switch_endpoint_interface const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_core_mime_index() {
+  void * jresult ;
+  switch_hash_index_t *result = 0 ;
+  
+  result = (switch_hash_index_t *)switch_core_mime_index();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_mime_ext2type(char * jarg1) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  result = (char *)switch_core_mime_ext2type((char const *)arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_mime_add_type(char * jarg1, char * jarg2) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_status_t)switch_core_mime_add_type((char const *)arg1,(char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_create_module_interface(void * jarg1, char * jarg2) {
+  void * jresult ;
+  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_loadable_module_interface_t *result = 0 ;
+  
+  arg1 = (switch_memory_pool_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_loadable_module_interface_t *)switch_loadable_module_create_module_interface(arg1,(char const *)arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_loadable_module_create_interface(void * jarg1, int jarg2) {
+  void * jresult ;
+  switch_loadable_module_interface_t *arg1 = (switch_loadable_module_interface_t *) 0 ;
+  switch_module_interface_name_t arg2 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_loadable_module_interface_t *)jarg1; 
+  arg2 = (switch_module_interface_name_t)jarg2; 
+  result = (void *)switch_loadable_module_create_interface(arg1,arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_micro_time_now() {
+  void * jresult ;
+  switch_time_t result;
+  
+  result = switch_micro_time_now();
+  jresult = new switch_time_t((switch_time_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_memory_reclaim() {
+  switch_core_memory_reclaim();
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_memory_reclaim_events() {
+  switch_core_memory_reclaim_events();
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_memory_reclaim_logger() {
+  switch_core_memory_reclaim_logger();
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_memory_reclaim_all() {
+  switch_core_memory_reclaim_all();
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_setrlimits() {
+  switch_core_setrlimits();
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_time_sync() {
+  switch_time_sync();
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_epoch_time_now(void * jarg1) {
+  void * jresult ;
+  time_t *arg1 = (time_t *) 0 ;
+  time_t result;
+  
+  arg1 = (time_t *)jarg1; 
+  result = switch_epoch_time_now(arg1);
+  jresult = new time_t((time_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_strftime_tz(char * jarg1, char * jarg2, char * jarg3, unsigned long jarg4, void * jarg5) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  size_t arg4 ;
+  switch_time_t arg5 ;
+  switch_status_t result;
+  switch_time_t *argp5 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (size_t)jarg4; 
+  argp5 = (switch_time_t *)jarg5; 
+  if (!argp5) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
+    return 0;
+  }
+  arg5 = *argp5; 
+  result = (switch_status_t)switch_strftime_tz((char const *)arg1,(char const *)arg2,arg3,arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_time_exp_tz_name(char * jarg1, void * jarg2, void * jarg3) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_time_exp_t *arg2 = (switch_time_exp_t *) 0 ;
+  switch_time_t arg3 ;
+  switch_status_t result;
+  switch_time_t *argp3 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_time_exp_t *)jarg2; 
+  argp3 = (switch_time_t *)jarg3; 
+  if (!argp3) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
+    return 0;
+  }
+  arg3 = *argp3; 
+  result = (switch_status_t)switch_time_exp_tz_name((char const *)arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_load_network_lists(int jarg1) {
+  switch_bool_t arg1 ;
+  
+  arg1 = (switch_bool_t)jarg1; 
+  switch_load_network_lists(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_check_network_list_ip_token(char * jarg1, char * jarg2, void * jarg3) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char **arg3 = (char **) 0 ;
+  switch_bool_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char **)jarg3; 
+  result = (switch_bool_t)switch_check_network_list_ip_token((char const *)arg1,(char const *)arg2,(char const **)arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_time_set_monotonic(int jarg1) {
+  switch_bool_t arg1 ;
+  
+  arg1 = (switch_bool_t)jarg1; 
+  switch_time_set_monotonic(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_time_set_nanosleep(int jarg1) {
+  switch_bool_t arg1 ;
+  
+  arg1 = (switch_bool_t)jarg1; 
+  switch_time_set_nanosleep(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_time_set_matrix(int jarg1) {
+  switch_bool_t arg1 ;
+  
+  arg1 = (switch_bool_t)jarg1; 
+  switch_time_set_matrix(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_time_set_cond_yield(int jarg1) {
+  switch_bool_t arg1 ;
+  
+  arg1 = (switch_bool_t)jarg1; 
+  switch_time_set_cond_yield(arg1);
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_min_dtmf_duration(unsigned long jarg1) {
+  unsigned long jresult ;
+  uint32_t arg1 ;
+  uint32_t result;
+  
+  arg1 = (uint32_t)jarg1; 
+  result = (uint32_t)switch_core_min_dtmf_duration(arg1);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_max_dtmf_duration(unsigned long jarg1) {
+  unsigned long jresult ;
+  uint32_t arg1 ;
+  uint32_t result;
+  
+  arg1 = (uint32_t)jarg1; 
+  result = (uint32_t)switch_core_max_dtmf_duration(arg1);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_default_dtmf_duration(unsigned long jarg1) {
+  unsigned long jresult ;
+  uint32_t arg1 ;
+  uint32_t result;
+  
+  arg1 = (uint32_t)jarg1; 
+  result = (uint32_t)switch_core_default_dtmf_duration(arg1);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_console_set_complete(char * jarg1) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_status_t)switch_console_set_complete((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_console_set_alias(char * jarg1) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_status_t)switch_console_set_alias((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_system(char * jarg1, int jarg2) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_bool_t arg2 ;
+  int result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_bool_t)jarg2; 
+  result = (int)switch_system((char const *)arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cond_yield(void * jarg1) {
+  switch_interval_time_t arg1 ;
+  switch_interval_time_t *argp1 ;
+  
+  argp1 = (switch_interval_time_t *)jarg1; 
+  if (!argp1) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_interval_time_t", 0);
+    return ;
+  }
+  arg1 = *argp1; 
+  switch_cond_yield(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cond_next() {
+  switch_cond_next();
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_chat_send(char * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  char *arg5 = (char *) 0 ;
+  char *arg6 = (char *) 0 ;
+  char *arg7 = (char *) 0 ;
+  char *arg8 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (char *)jarg5; 
+  arg6 = (char *)jarg6; 
+  arg7 = (char *)jarg7; 
+  arg8 = (char *)jarg8; 
+  result = (switch_status_t)switch_core_chat_send((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_preprocess_session(void * jarg1, char * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_status_t)switch_ivr_preprocess_session(arg1,(char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_CACHE_DB_LEN_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 256;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_native_handle_t_core_db_dbh_set(void * jarg1, void * jarg2) {
+  switch_cache_db_native_handle_t *arg1 = (switch_cache_db_native_handle_t *) 0 ;
+  switch_core_db_t *arg2 = (switch_core_db_t *) 0 ;
+  
+  arg1 = (switch_cache_db_native_handle_t *)jarg1; 
+  arg2 = (switch_core_db_t *)jarg2; 
+  if (arg1) (arg1)->core_db_dbh = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_cache_db_native_handle_t_core_db_dbh_get(void * jarg1) {
+  void * jresult ;
+  switch_cache_db_native_handle_t *arg1 = (switch_cache_db_native_handle_t *) 0 ;
+  switch_core_db_t *result = 0 ;
+  
+  arg1 = (switch_cache_db_native_handle_t *)jarg1; 
+  result = (switch_core_db_t *) ((arg1)->core_db_dbh);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_native_handle_t_odbc_dbh_set(void * jarg1, void * jarg2) {
+  switch_cache_db_native_handle_t *arg1 = (switch_cache_db_native_handle_t *) 0 ;
+  switch_odbc_handle_t *arg2 = (switch_odbc_handle_t *) 0 ;
+  
+  arg1 = (switch_cache_db_native_handle_t *)jarg1; 
+  arg2 = (switch_odbc_handle_t *)jarg2; 
+  if (arg1) (arg1)->odbc_dbh = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_cache_db_native_handle_t_odbc_dbh_get(void * jarg1) {
+  void * jresult ;
+  switch_cache_db_native_handle_t *arg1 = (switch_cache_db_native_handle_t *) 0 ;
+  switch_odbc_handle_t *result = 0 ;
+  
+  arg1 = (switch_cache_db_native_handle_t *)jarg1; 
+  result = (switch_odbc_handle_t *) ((arg1)->odbc_dbh);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_cache_db_native_handle_t() {
+  void * jresult ;
+  switch_cache_db_native_handle_t *result = 0 ;
+  
+  result = (switch_cache_db_native_handle_t *)new switch_cache_db_native_handle_t();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_cache_db_native_handle_t(void * jarg1) {
+  switch_cache_db_native_handle_t *arg1 = (switch_cache_db_native_handle_t *) 0 ;
+  
+  arg1 = (switch_cache_db_native_handle_t *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_core_db_options_t_db_path_set(void * jarg1, char * jarg2) {
+  switch_cache_db_core_db_options_t *arg1 = (switch_cache_db_core_db_options_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_cache_db_core_db_options_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->db_path) delete [] arg1->db_path;
+    if (arg2) {
+      arg1->db_path = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->db_path, (const char *)arg2);
+    } else {
+      arg1->db_path = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_cache_db_core_db_options_t_db_path_get(void * jarg1) {
+  char * jresult ;
+  switch_cache_db_core_db_options_t *arg1 = (switch_cache_db_core_db_options_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_cache_db_core_db_options_t *)jarg1; 
+  result = (char *) ((arg1)->db_path);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_cache_db_core_db_options_t() {
+  void * jresult ;
+  switch_cache_db_core_db_options_t *result = 0 ;
+  
+  result = (switch_cache_db_core_db_options_t *)new switch_cache_db_core_db_options_t();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_cache_db_core_db_options_t(void * jarg1) {
+  switch_cache_db_core_db_options_t *arg1 = (switch_cache_db_core_db_options_t *) 0 ;
+  
+  arg1 = (switch_cache_db_core_db_options_t *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_odbc_options_t_dsn_set(void * jarg1, char * jarg2) {
+  switch_cache_db_odbc_options_t *arg1 = (switch_cache_db_odbc_options_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_cache_db_odbc_options_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->dsn) delete [] arg1->dsn;
+    if (arg2) {
+      arg1->dsn = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->dsn, (const char *)arg2);
+    } else {
+      arg1->dsn = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_cache_db_odbc_options_t_dsn_get(void * jarg1) {
+  char * jresult ;
+  switch_cache_db_odbc_options_t *arg1 = (switch_cache_db_odbc_options_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_cache_db_odbc_options_t *)jarg1; 
+  result = (char *) ((arg1)->dsn);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_odbc_options_t_user_set(void * jarg1, char * jarg2) {
+  switch_cache_db_odbc_options_t *arg1 = (switch_cache_db_odbc_options_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_cache_db_odbc_options_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->user) delete [] arg1->user;
+    if (arg2) {
+      arg1->user = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->user, (const char *)arg2);
+    } else {
+      arg1->user = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_cache_db_odbc_options_t_user_get(void * jarg1) {
+  char * jresult ;
+  switch_cache_db_odbc_options_t *arg1 = (switch_cache_db_odbc_options_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_cache_db_odbc_options_t *)jarg1; 
+  result = (char *) ((arg1)->user);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_odbc_options_t_pass_set(void * jarg1, char * jarg2) {
+  switch_cache_db_odbc_options_t *arg1 = (switch_cache_db_odbc_options_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_cache_db_odbc_options_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->pass) delete [] arg1->pass;
+    if (arg2) {
+      arg1->pass = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->pass, (const char *)arg2);
+    } else {
+      arg1->pass = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_cache_db_odbc_options_t_pass_get(void * jarg1) {
+  char * jresult ;
+  switch_cache_db_odbc_options_t *arg1 = (switch_cache_db_odbc_options_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_cache_db_odbc_options_t *)jarg1; 
+  result = (char *) ((arg1)->pass);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_cache_db_odbc_options_t() {
+  void * jresult ;
+  switch_cache_db_odbc_options_t *result = 0 ;
+  
+  result = (switch_cache_db_odbc_options_t *)new switch_cache_db_odbc_options_t();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_cache_db_odbc_options_t(void * jarg1) {
+  switch_cache_db_odbc_options_t *arg1 = (switch_cache_db_odbc_options_t *) 0 ;
+  
+  arg1 = (switch_cache_db_odbc_options_t *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_connection_options_t_core_db_options_set(void * jarg1, void * jarg2) {
+  switch_cache_db_connection_options_t *arg1 = (switch_cache_db_connection_options_t *) 0 ;
+  switch_cache_db_core_db_options_t *arg2 = (switch_cache_db_core_db_options_t *) 0 ;
+  
+  arg1 = (switch_cache_db_connection_options_t *)jarg1; 
+  arg2 = (switch_cache_db_core_db_options_t *)jarg2; 
+  if (arg1) (arg1)->core_db_options = *arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_cache_db_connection_options_t_core_db_options_get(void * jarg1) {
+  void * jresult ;
+  switch_cache_db_connection_options_t *arg1 = (switch_cache_db_connection_options_t *) 0 ;
+  switch_cache_db_core_db_options_t *result = 0 ;
+  
+  arg1 = (switch_cache_db_connection_options_t *)jarg1; 
+  result = (switch_cache_db_core_db_options_t *)& ((arg1)->core_db_options);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_connection_options_t_odbc_options_set(void * jarg1, void * jarg2) {
+  switch_cache_db_connection_options_t *arg1 = (switch_cache_db_connection_options_t *) 0 ;
+  switch_cache_db_odbc_options_t *arg2 = (switch_cache_db_odbc_options_t *) 0 ;
+  
+  arg1 = (switch_cache_db_connection_options_t *)jarg1; 
+  arg2 = (switch_cache_db_odbc_options_t *)jarg2; 
+  if (arg1) (arg1)->odbc_options = *arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_cache_db_connection_options_t_odbc_options_get(void * jarg1) {
+  void * jresult ;
+  switch_cache_db_connection_options_t *arg1 = (switch_cache_db_connection_options_t *) 0 ;
+  switch_cache_db_odbc_options_t *result = 0 ;
+  
+  arg1 = (switch_cache_db_connection_options_t *)jarg1; 
+  result = (switch_cache_db_odbc_options_t *)& ((arg1)->odbc_options);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_cache_db_connection_options_t() {
+  void * jresult ;
+  switch_cache_db_connection_options_t *result = 0 ;
+  
+  result = (switch_cache_db_connection_options_t *)new switch_cache_db_connection_options_t();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_cache_db_connection_options_t(void * jarg1) {
+  switch_cache_db_connection_options_t *arg1 = (switch_cache_db_connection_options_t *) 0 ;
+  
+  arg1 = (switch_cache_db_connection_options_t *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_handle_t_name_set(void * jarg1, char * jarg2) {
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  char *arg2 ;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) strncpy((char *)arg1->name, (const char *)arg2, 256);
+    else arg1->name[0] = 0;
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_cache_db_handle_t_name_get(void * jarg1) {
+  char * jresult ;
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  result = (char *)(char *) ((arg1)->name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_handle_t_type_set(void * jarg1, int jarg2) {
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  switch_cache_db_handle_type_t arg2 ;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  arg2 = (switch_cache_db_handle_type_t)jarg2; 
+  if (arg1) (arg1)->type = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_cache_db_handle_t_type_get(void * jarg1) {
+  int jresult ;
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  switch_cache_db_handle_type_t result;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  result = (switch_cache_db_handle_type_t) ((arg1)->type);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_handle_t_native_handle_set(void * jarg1, void * jarg2) {
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  switch_cache_db_native_handle_t *arg2 = (switch_cache_db_native_handle_t *) 0 ;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  arg2 = (switch_cache_db_native_handle_t *)jarg2; 
+  if (arg1) (arg1)->native_handle = *arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_cache_db_handle_t_native_handle_get(void * jarg1) {
+  void * jresult ;
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  switch_cache_db_native_handle_t *result = 0 ;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  result = (switch_cache_db_native_handle_t *)& ((arg1)->native_handle);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_handle_t_last_used_set(void * jarg1, void * jarg2) {
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  time_t arg2 ;
+  time_t *argp2 ;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  argp2 = (time_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null time_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->last_used = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_cache_db_handle_t_last_used_get(void * jarg1) {
+  void * jresult ;
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  time_t result;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  result =  ((arg1)->last_used);
+  jresult = new time_t((time_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_handle_t_mutex_set(void * jarg1, void * jarg2) {
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  arg2 = (switch_mutex_t *)jarg2; 
+  if (arg1) (arg1)->mutex = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_cache_db_handle_t_mutex_get(void * jarg1) {
+  void * jresult ;
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  switch_mutex_t *result = 0 ;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  result = (switch_mutex_t *) ((arg1)->mutex);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_handle_t_io_mutex_set(void * jarg1, void * jarg2) {
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  arg2 = (switch_mutex_t *)jarg2; 
+  if (arg1) (arg1)->io_mutex = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_cache_db_handle_t_io_mutex_get(void * jarg1) {
+  void * jresult ;
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  switch_mutex_t *result = 0 ;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  result = (switch_mutex_t *) ((arg1)->io_mutex);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_handle_t_pool_set(void * jarg1, void * jarg2) {
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  arg2 = (switch_memory_pool_t *)jarg2; 
+  if (arg1) (arg1)->pool = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_cache_db_handle_t_pool_get(void * jarg1) {
+  void * jresult ;
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  switch_memory_pool_t *result = 0 ;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  result = (switch_memory_pool_t *) ((arg1)->pool);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_handle_t_flags_set(void * jarg1, int jarg2) {
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  int32_t arg2 ;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  arg2 = (int32_t)jarg2; 
+  if (arg1) (arg1)->flags = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_cache_db_handle_t_flags_get(void * jarg1) {
+  int jresult ;
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  int32_t result;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  result = (int32_t) ((arg1)->flags);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_handle_t_hash_set(void * jarg1, unsigned long jarg2) {
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  unsigned long arg2 ;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  arg2 = (unsigned long)jarg2; 
+  if (arg1) (arg1)->hash = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_cache_db_handle_t_hash_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  unsigned long result;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  result = (unsigned long) ((arg1)->hash);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_handle_t_creator_set(void * jarg1, char * jarg2) {
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  char *arg2 ;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) strncpy((char *)arg1->creator, (const char *)arg2, 256);
+    else arg1->creator[0] = 0;
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_cache_db_handle_t_creator_get(void * jarg1) {
+  char * jresult ;
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  result = (char *)(char *) ((arg1)->creator);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_handle_t_last_user_set(void * jarg1, char * jarg2) {
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  char *arg2 ;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) strncpy((char *)arg1->last_user, (const char *)arg2, 256);
+    else arg1->last_user[0] = 0;
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_cache_db_handle_t_last_user_get(void * jarg1) {
+  char * jresult ;
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  result = (char *)(char *) ((arg1)->last_user);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_cache_db_handle_t() {
+  void * jresult ;
+  switch_cache_db_handle_t *result = 0 ;
+  
+  result = (switch_cache_db_handle_t *)new switch_cache_db_handle_t();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_cache_db_handle_t(void * jarg1) {
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_cache_db_type_name(int jarg1) {
+  char * jresult ;
+  switch_cache_db_handle_type_t arg1 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_cache_db_handle_type_t)jarg1; 
+  result = (char *)switch_cache_db_type_name(arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_release_db_handle(void * jarg1) {
+  switch_cache_db_handle_t **arg1 = (switch_cache_db_handle_t **) 0 ;
+  
+  arg1 = (switch_cache_db_handle_t **)jarg1; 
+  switch_cache_db_release_db_handle(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_destroy_db_handle(void * jarg1) {
+  switch_cache_db_handle_t **arg1 = (switch_cache_db_handle_t **) 0 ;
+  
+  arg1 = (switch_cache_db_handle_t **)jarg1; 
+  switch_cache_db_destroy_db_handle(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp__switch_cache_db_get_db_handle(void * jarg1, int jarg2, void * jarg3, char * jarg4, char * jarg5, int jarg6) {
+  int jresult ;
+  switch_cache_db_handle_t **arg1 = (switch_cache_db_handle_t **) 0 ;
+  switch_cache_db_handle_type_t arg2 ;
+  switch_cache_db_connection_options_t *arg3 = (switch_cache_db_connection_options_t *) 0 ;
+  char *arg4 = (char *) 0 ;
+  char *arg5 = (char *) 0 ;
+  int arg6 ;
+  switch_status_t result;
+  
+  arg1 = (switch_cache_db_handle_t **)jarg1; 
+  arg2 = (switch_cache_db_handle_type_t)jarg2; 
+  arg3 = (switch_cache_db_connection_options_t *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (char *)jarg5; 
+  arg6 = (int)jarg6; 
+  result = (switch_status_t)_switch_cache_db_get_db_handle(arg1,arg2,arg3,(char const *)arg4,(char const *)arg5,arg6);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_cache_db_execute_sql2str(void * jarg1, char * jarg2, char * jarg3, unsigned long jarg4, void * jarg5) {
+  char * jresult ;
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  size_t arg4 ;
+  char **arg5 = (char **) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (size_t)jarg4; 
+  arg5 = (char **)jarg5; 
+  result = (char *)switch_cache_db_execute_sql2str(arg1,arg2,arg3,arg4,arg5);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_cache_db_execute_sql(void * jarg1, char * jarg2, void * jarg3) {
+  int jresult ;
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char **arg3 = (char **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char **)jarg3; 
+  result = (switch_status_t)switch_cache_db_execute_sql(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_cache_db_execute_sql_callback(void * jarg1, char * jarg2, void * jarg3, void * jarg4, void * jarg5) {
+  int jresult ;
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_core_db_callback_func_t arg3 = (switch_core_db_callback_func_t) 0 ;
+  void *arg4 = (void *) 0 ;
+  char **arg5 = (char **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_core_db_callback_func_t)jarg3; 
+  arg4 = (void *)jarg4; 
+  arg5 = (char **)jarg5; 
+  result = (switch_status_t)switch_cache_db_execute_sql_callback(arg1,(char const *)arg2,arg3,arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_status(void * jarg1) {
+  switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ;
+  
+  arg1 = (switch_stream_handle_t *)jarg1; 
+  switch_cache_db_status(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp__switch_core_db_handle(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
+  int jresult ;
+  switch_cache_db_handle_t **arg1 = (switch_cache_db_handle_t **) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_cache_db_handle_t **)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int)jarg4; 
+  result = (switch_status_t)_switch_core_db_handle(arg1,(char const *)arg2,(char const *)arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_cache_db_test_reactive(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
+  int jresult ;
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  switch_bool_t result;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  result = (switch_bool_t)switch_cache_db_test_reactive(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_cache_db_persistant_execute(void * jarg1, char * jarg2, unsigned long jarg3) {
+  int jresult ;
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  uint32_t arg3 ;
+  switch_status_t result;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  result = (switch_status_t)switch_cache_db_persistant_execute(arg1,(char const *)arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_cache_db_persistant_execute_trans(void * jarg1, char * jarg2, unsigned long jarg3) {
+  int jresult ;
+  switch_cache_db_handle_t *arg1 = (switch_cache_db_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  uint32_t arg3 ;
+  switch_status_t result;
+  
+  arg1 = (switch_cache_db_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  result = (switch_status_t)switch_cache_db_persistant_execute_trans(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_detach() {
+  switch_cache_db_detach();
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_debug_level() {
+  unsigned long jresult ;
+  uint32_t result;
+  
+  result = (uint32_t)switch_core_debug_level();
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_cache_db_flush_handles() {
+  switch_cache_db_flush_handles();
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_banner() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *)switch_core_banner();
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_session_in_thread(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_bool_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_bool_t)switch_core_session_in_thread(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_CMD_CHUNK_LEN_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 1024;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_console_loop() {
+  switch_console_loop();
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_console_stream_raw_write(void * jarg1, void * jarg2, void * jarg3) {
+  int jresult ;
+  switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ;
+  uint8_t *arg2 = (uint8_t *) 0 ;
+  switch_size_t arg3 ;
+  switch_status_t result;
+  switch_size_t *argp3 ;
+  
+  arg1 = (switch_stream_handle_t *)jarg1; 
+  arg2 = (uint8_t *)jarg2; 
+  argp3 = (switch_size_t *)jarg3; 
+  if (!argp3) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg3 = *argp3; 
+  result = (switch_status_t)switch_console_stream_raw_write(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_stream_write_file_contents(void * jarg1, char * jarg2) {
+  int jresult ;
+  switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_stream_handle_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_status_t)switch_stream_write_file_contents(arg1,(char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_console_init(void * jarg1) {
+  int jresult ;
+  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_memory_pool_t *)jarg1; 
+  result = (switch_status_t)switch_console_init(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_console_shutdown() {
+  int jresult ;
+  switch_status_t result;
+  
+  result = (switch_status_t)switch_console_shutdown();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_console_add_complete_func(char * jarg1, void * jarg2) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_console_complete_callback_t arg2 = (switch_console_complete_callback_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_console_complete_callback_t)jarg2; 
+  result = (switch_status_t)switch_console_add_complete_func((char const *)arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_console_del_complete_func(char * jarg1) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_status_t)switch_console_del_complete_func((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_console_run_complete_func(char * jarg1, char * jarg2, char * jarg3, void * jarg4) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  switch_console_callback_match_t **arg4 = (switch_console_callback_match_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (switch_console_callback_match_t **)jarg4; 
+  result = (switch_status_t)switch_console_run_complete_func((char const *)arg1,(char const *)arg2,(char const *)arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_console_push_match(void * jarg1, char * jarg2) {
+  switch_console_callback_match_t **arg1 = (switch_console_callback_match_t **) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_console_callback_match_t **)jarg1; 
+  arg2 = (char *)jarg2; 
+  switch_console_push_match(arg1,(char const *)arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_console_free_matches(void * jarg1) {
+  switch_console_callback_match_t **arg1 = (switch_console_callback_match_t **) 0 ;
+  
+  arg1 = (switch_console_callback_match_t **)jarg1; 
+  switch_console_free_matches(arg1);
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_console_complete(char * jarg1, char * jarg2, void * jarg3, void * jarg4, void * jarg5) {
+  unsigned char jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  FILE *arg3 = (FILE *) 0 ;
+  switch_stream_handle_t *arg4 = (switch_stream_handle_t *) 0 ;
+  switch_xml_t arg5 = (switch_xml_t) 0 ;
+  unsigned char result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (FILE *)jarg3; 
+  arg4 = (switch_stream_handle_t *)jarg4; 
+  arg5 = (switch_xml_t)jarg5; 
+  result = (unsigned char)switch_console_complete((char const *)arg1,(char const *)arg2,arg3,arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_console_sort_matches(void * jarg1) {
+  switch_console_callback_match_t *arg1 = (switch_console_callback_match_t *) 0 ;
+  
+  arg1 = (switch_console_callback_match_t *)jarg1; 
+  switch_console_sort_matches(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_console_save_history() {
+  switch_console_save_history();
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_console_expand_alias(char * jarg1, char * jarg2) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (char *)switch_console_expand_alias(arg1,arg2);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_console_execute(char * jarg1, int jarg2, void * jarg3) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  int arg2 ;
+  switch_stream_handle_t *arg3 = (switch_stream_handle_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (int)jarg2; 
+  arg3 = (switch_stream_handle_t *)jarg3; 
+  result = (switch_status_t)switch_console_execute(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_toupper(int jarg1) {
+  int jresult ;
+  int arg1 ;
+  int result;
+  
+  arg1 = (int)jarg1; 
+  result = (int)switch_toupper(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_tolower(int jarg1) {
+  int jresult ;
+  int arg1 ;
+  int result;
+  
+  arg1 = (int)jarg1; 
+  result = (int)switch_tolower(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_isalnum(int jarg1) {
+  int jresult ;
+  int arg1 ;
+  int result;
+  
+  arg1 = (int)jarg1; 
+  result = (int)switch_isalnum(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_isalpha(int jarg1) {
+  int jresult ;
+  int arg1 ;
+  int result;
+  
+  arg1 = (int)jarg1; 
+  result = (int)switch_isalpha(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_iscntrl(int jarg1) {
+  int jresult ;
+  int arg1 ;
+  int result;
+  
+  arg1 = (int)jarg1; 
+  result = (int)switch_iscntrl(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_isdigit(int jarg1) {
+  int jresult ;
+  int arg1 ;
+  int result;
+  
+  arg1 = (int)jarg1; 
+  result = (int)switch_isdigit(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_isgraph(int jarg1) {
+  int jresult ;
+  int arg1 ;
+  int result;
+  
+  arg1 = (int)jarg1; 
+  result = (int)switch_isgraph(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_islower(int jarg1) {
+  int jresult ;
+  int arg1 ;
+  int result;
+  
+  arg1 = (int)jarg1; 
+  result = (int)switch_islower(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_isprint(int jarg1) {
+  int jresult ;
+  int arg1 ;
+  int result;
+  
+  arg1 = (int)jarg1; 
+  result = (int)switch_isprint(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ispunct(int jarg1) {
+  int jresult ;
+  int arg1 ;
+  int result;
+  
+  arg1 = (int)jarg1; 
+  result = (int)switch_ispunct(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_isspace(int jarg1) {
+  int jresult ;
+  int arg1 ;
+  int result;
+  
+  arg1 = (int)jarg1; 
+  result = (int)switch_isspace(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_isupper(int jarg1) {
+  int jresult ;
+  int arg1 ;
+  int result;
+  
+  arg1 = (int)jarg1; 
+  result = (int)switch_isupper(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_isxdigit(int jarg1) {
+  int jresult ;
+  int arg1 ;
+  int result;
+  
+  arg1 = (int)jarg1; 
+  result = (int)switch_isxdigit(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_SMAX_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 32767;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_SMIN_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) -32768;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_zstr(char * jarg1) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  int result;
+  
+  arg1 = (char *)jarg1; 
+  result = (int)zstr((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_moh(char * jarg1) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_bool_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_bool_t)switch_is_moh((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_string_has_escaped_data(char * jarg1) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  int result;
+  
+  arg1 = (char *)jarg1; 
+  result = (int)switch_string_has_escaped_data((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_b64_encode(void * jarg1, void * jarg2, void * jarg3, void * jarg4) {
+  int jresult ;
+  unsigned char *arg1 = (unsigned char *) 0 ;
+  switch_size_t arg2 ;
+  unsigned char *arg3 = (unsigned char *) 0 ;
+  switch_size_t arg4 ;
+  switch_status_t result;
+  switch_size_t *argp2 ;
+  switch_size_t *argp4 ;
+  
+  arg1 = (unsigned char *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg2 = *argp2; 
+  arg3 = (unsigned char *)jarg3; 
+  argp4 = (switch_size_t *)jarg4; 
+  if (!argp4) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg4 = *argp4; 
+  result = (switch_status_t)switch_b64_encode(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_b64_decode(char * jarg1, char * jarg2, void * jarg3) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_size_t arg3 ;
+  switch_size_t result;
+  switch_size_t *argp3 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  argp3 = (switch_size_t *)jarg3; 
+  if (!argp3) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg3 = *argp3; 
+  result = switch_b64_decode(arg1,arg2,arg3);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_amp_encode(char * jarg1, char * jarg2, void * jarg3) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_size_t arg3 ;
+  char *result = 0 ;
+  switch_size_t *argp3 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  argp3 = (switch_size_t *)jarg3; 
+  if (!argp3) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg3 = *argp3; 
+  result = (char *)switch_amp_encode(arg1,arg2,arg3);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_digit_string(char * jarg1) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_bool_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_bool_t)switch_is_digit_string((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_fd_read_line(int jarg1, char * jarg2, void * jarg3) {
+  void * jresult ;
+  int arg1 ;
+  char *arg2 = (char *) 0 ;
+  switch_size_t arg3 ;
+  switch_size_t result;
+  switch_size_t *argp3 ;
+  
+  arg1 = (int)jarg1; 
+  arg2 = (char *)jarg2; 
+  argp3 = (switch_size_t *)jarg3; 
+  if (!argp3) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg3 = *argp3; 
+  result = switch_fd_read_line(arg1,arg2,arg3);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_frame_alloc(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_frame_t **arg1 = (switch_frame_t **) 0 ;
+  switch_size_t arg2 ;
+  switch_status_t result;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_frame_t **)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg2 = *argp2; 
+  result = (switch_status_t)switch_frame_alloc(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_frame_dup(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_frame_t *arg1 = (switch_frame_t *) 0 ;
+  switch_frame_t **arg2 = (switch_frame_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_frame_t *)jarg1; 
+  arg2 = (switch_frame_t **)jarg2; 
+  result = (switch_status_t)switch_frame_dup(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_frame_free(void * jarg1) {
+  int jresult ;
+  switch_frame_t **arg1 = (switch_frame_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_frame_t **)jarg1; 
+  result = (switch_status_t)switch_frame_free(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_resolve_host(char * jarg1, char * jarg2, unsigned long jarg3) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  size_t arg3 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (size_t)jarg3; 
+  result = (switch_status_t)switch_resolve_host((char const *)arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_find_local_ip(char * jarg1, int jarg2, void * jarg3, int jarg4) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  int arg2 ;
+  int *arg3 = (int *) 0 ;
+  int arg4 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (int)jarg2; 
+  arg3 = (int *)jarg3; 
+  arg4 = (int)jarg4; 
+  result = (switch_status_t)switch_find_local_ip(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_get_addr(char * jarg1, void * jarg2, void * jarg3, void * jarg4) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_size_t arg2 ;
+  sockaddr *arg3 = (sockaddr *) 0 ;
+  socklen_t arg4 ;
+  char *result = 0 ;
+  switch_size_t *argp2 ;
+  socklen_t *argp4 ;
+  
+  arg1 = (char *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg2 = *argp2; 
+  arg3 = (sockaddr *)jarg3; 
+  argp4 = (socklen_t *)jarg4; 
+  if (!argp4) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null socklen_t", 0);
+    return 0;
+  }
+  arg4 = *argp4; 
+  result = (char *)get_addr(arg1,arg2,arg3,arg4);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_get_addr_int(void * jarg1) {
+  int jresult ;
+  switch_sockaddr_t *arg1 = (switch_sockaddr_t *) 0 ;
+  int result;
+  
+  arg1 = (switch_sockaddr_t *)jarg1; 
+  result = (int)get_addr_int(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_cmp_addr(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_sockaddr_t *arg1 = (switch_sockaddr_t *) 0 ;
+  switch_sockaddr_t *arg2 = (switch_sockaddr_t *) 0 ;
+  int result;
+  
+  arg1 = (switch_sockaddr_t *)jarg1; 
+  arg2 = (switch_sockaddr_t *)jarg2; 
+  result = (int)switch_cmp_addr(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned short SWIGSTDCALL CSharp_get_port(void * jarg1) {
+  unsigned short jresult ;
+  sockaddr *arg1 = (sockaddr *) 0 ;
+  unsigned short result;
+  
+  arg1 = (sockaddr *)jarg1; 
+  result = (unsigned short)get_port(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_build_uri(char * jarg1, void * jarg2, char * jarg3, char * jarg4, void * jarg5, int jarg6) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_size_t arg2 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  switch_sockaddr_t *arg5 = (switch_sockaddr_t *) 0 ;
+  int arg6 ;
+  int result;
+  switch_size_t *argp2 ;
+  
+  arg1 = (char *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg2 = *argp2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (switch_sockaddr_t *)jarg5; 
+  arg6 = (int)jarg6; 
+  result = (int)switch_build_uri(arg1,arg2,(char const *)arg3,(char const *)arg4,(switch_sockaddr_t const *)arg5,arg6);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_priority_name(int jarg1) {
+  char * jresult ;
+  switch_priority_t arg1 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_priority_t)jarg1; 
+  result = (char *)switch_priority_name(arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char SWIGSTDCALL CSharp_switch_rfc2833_to_char(int jarg1) {
+  char jresult ;
+  int arg1 ;
+  char result;
+  
+  arg1 = (int)jarg1; 
+  result = (char)switch_rfc2833_to_char(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_char_to_rfc2833(char jarg1) {
+  unsigned char jresult ;
+  char arg1 ;
+  unsigned char result;
+  
+  arg1 = (char)jarg1; 
+  result = (unsigned char)switch_char_to_rfc2833(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_sanitize_number(char * jarg1) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  result = (char *)switch_sanitize_number(arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_string_var_check(char * jarg1, int jarg2) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_bool_t arg2 ;
+  switch_bool_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_bool_t)jarg2; 
+  result = (switch_bool_t)switch_string_var_check(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_string_var_check_const(char * jarg1) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_bool_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_bool_t)switch_string_var_check_const((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_var_clean_string(char * jarg1) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  result = (char *)switch_var_clean_string(arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_clean_string(char * jarg1) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  result = (char *)switch_clean_string(arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_safe_strdup(char * jarg1) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  result = (char *)switch_safe_strdup((char const *)arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_lc_strdup(char * jarg1) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  result = (char *)switch_lc_strdup((char const *)arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_uc_strdup(char * jarg1) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  result = (char *)switch_uc_strdup((char const *)arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_strstr(char * jarg1, char * jarg2) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_bool_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_bool_t)switch_strstr(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_str_time(char * jarg1) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_time_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = switch_str_time((char const *)arg1);
+  jresult = new switch_time_t((switch_time_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_separate_string(char * jarg1, char jarg2, void * jarg3, unsigned int jarg4) {
+  unsigned int jresult ;
+  char *arg1 = (char *) 0 ;
+  char arg2 ;
+  char **arg3 = (char **) 0 ;
+  unsigned int arg4 ;
+  unsigned int result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char)jarg2; 
+  arg3 = (char **)jarg3; 
+  arg4 = (unsigned int)jarg4; 
+  result = (unsigned int)switch_separate_string(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_separate_string_string(char * jarg1, char * jarg2, void * jarg3, unsigned int jarg4) {
+  unsigned int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char **arg3 = (char **) 0 ;
+  unsigned int arg4 ;
+  unsigned int result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char **)jarg3; 
+  arg4 = (unsigned int)jarg4; 
+  result = (unsigned int)switch_separate_string_string(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_number(char * jarg1) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_bool_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_bool_t)switch_is_number((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_spaces(char * jarg1) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  result = (char *)switch_strip_spaces((char const *)arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_separate_paren_args(char * jarg1) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  result = (char *)switch_separate_paren_args(arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_stristr(char * jarg1, char * jarg2) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (char *)switch_stristr((char const *)arg1,(char const *)arg2);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_lan_addr(char * jarg1) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_bool_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_bool_t)switch_is_lan_addr((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_replace_char(char * jarg1, char jarg2, char jarg3, int jarg4) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char arg2 ;
+  char arg3 ;
+  switch_bool_t arg4 ;
+  char *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char)jarg2; 
+  arg3 = (char)jarg3; 
+  arg4 = (switch_bool_t)jarg4; 
+  result = (char *)switch_replace_char(arg1,arg2,arg3,arg4);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ast2regex(char * jarg1, char * jarg2, unsigned long jarg3) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  size_t arg3 ;
+  switch_bool_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (size_t)jarg3; 
+  result = (switch_bool_t)switch_ast2regex((char const *)arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_escape_char(void * jarg1, char * jarg2, char * jarg3, char jarg4) {
+  char * jresult ;
+  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char arg4 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_memory_pool_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char)jarg4; 
+  result = (char *)switch_escape_char(arg1,arg2,(char const *)arg3,arg4);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_escape_string(char * jarg1, char * jarg2, void * jarg3) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_size_t arg3 ;
+  char *result = 0 ;
+  switch_size_t *argp3 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  argp3 = (switch_size_t *)jarg3; 
+  if (!argp3) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg3 = *argp3; 
+  result = (char *)switch_escape_string((char const *)arg1,arg2,arg3);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_escape_string_pool(char * jarg1, void * jarg2) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_memory_pool_t *)jarg2; 
+  result = (char *)switch_escape_string_pool((char const *)arg1,arg2);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_socket_waitfor(void * jarg1, int jarg2) {
+  int jresult ;
+  switch_pollfd_t *arg1 = (switch_pollfd_t *) 0 ;
+  int arg2 ;
+  int result;
+  
+  arg1 = (switch_pollfd_t *)jarg1; 
+  arg2 = (int)jarg2; 
+  result = (int)switch_socket_waitfor(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_cut_path(char * jarg1) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  result = (char *)switch_cut_path((char const *)arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_string_replace(char * jarg1, char * jarg2, char * jarg3) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (char *)switch_string_replace((char const *)arg1,(char const *)arg2,(char const *)arg3);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_string_match(char * jarg1, unsigned long jarg2, char * jarg3, unsigned long jarg4) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  size_t arg2 ;
+  char *arg3 = (char *) 0 ;
+  size_t arg4 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (size_t)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (size_t)jarg4; 
+  result = (switch_status_t)switch_string_match((char const *)arg1,arg2,(char const *)arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_util_quote_shell_arg(char * jarg1) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  result = (char *)switch_util_quote_shell_arg((char const *)arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_url_encode(char * jarg1, char * jarg2, unsigned long jarg3) {
+  unsigned long jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  size_t arg3 ;
+  size_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (size_t)jarg3; 
+  result = switch_url_encode((char const *)arg1,arg2,arg3);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_url_decode(char * jarg1) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  result = (char *)switch_url_decode(arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_simple_email(char * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  char *arg5 = (char *) 0 ;
+  char *arg6 = (char *) 0 ;
+  char *arg7 = (char *) 0 ;
+  switch_bool_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (char *)jarg5; 
+  arg6 = (char *)jarg6; 
+  arg7 = (char *)jarg7; 
+  result = (switch_bool_t)switch_simple_email((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_find_end_paren(char * jarg1, char jarg2, char jarg3) {
+  char * jresult ;
+  char *arg1 = (char *) 0 ;
+  char arg2 ;
+  char arg3 ;
+  char *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char)jarg2; 
+  arg3 = (char)jarg3; 
+  result = (char *)switch_find_end_paren((char const *)arg1,arg2,arg3);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_file_path(char * jarg1) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_bool_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_bool_t)switch_is_file_path((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_parse_cidr(char * jarg1, void * jarg2, void * jarg3, void * jarg4) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  uint32_t *arg2 = (uint32_t *) 0 ;
+  uint32_t *arg3 = (uint32_t *) 0 ;
+  uint32_t *arg4 = (uint32_t *) 0 ;
+  int result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (uint32_t *)jarg2; 
+  arg3 = (uint32_t *)jarg3; 
+  arg4 = (uint32_t *)jarg4; 
+  result = (int)switch_parse_cidr((char const *)arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_create(void * jarg1, char * jarg2, int jarg3, void * jarg4) {
+  int jresult ;
+  switch_network_list_t **arg1 = (switch_network_list_t **) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_bool_t arg3 ;
+  switch_memory_pool_t *arg4 = (switch_memory_pool_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_network_list_t **)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_bool_t)jarg3; 
+  arg4 = (switch_memory_pool_t *)jarg4; 
+  result = (switch_status_t)switch_network_list_create(arg1,(char const *)arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_add_cidr_token(void * jarg1, char * jarg2, int jarg3, char * jarg4) {
+  int jresult ;
+  switch_network_list_t *arg1 = (switch_network_list_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_bool_t arg3 ;
+  char *arg4 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_network_list_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_bool_t)jarg3; 
+  arg4 = (char *)jarg4; 
+  result = (switch_status_t)switch_network_list_add_cidr_token(arg1,(char const *)arg2,arg3,(char const *)arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_add_host_mask(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
+  int jresult ;
+  switch_network_list_t *arg1 = (switch_network_list_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  switch_bool_t arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_network_list_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (switch_bool_t)jarg4; 
+  result = (switch_status_t)switch_network_list_add_host_mask(arg1,(char const *)arg2,(char const *)arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_network_list_validate_ip_token(void * jarg1, unsigned long jarg2, void * jarg3) {
+  int jresult ;
+  switch_network_list_t *arg1 = (switch_network_list_t *) 0 ;
+  uint32_t arg2 ;
+  char **arg3 = (char **) 0 ;
+  switch_bool_t result;
+  
+  arg1 = (switch_network_list_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  arg3 = (char **)jarg3; 
+  result = (switch_bool_t)switch_network_list_validate_ip_token(arg1,arg2,(char const **)arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_number_cmp(char * jarg1, int jarg2) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  int arg2 ;
+  int result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (int)jarg2; 
+  result = (int)switch_number_cmp((char const *)arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_username_set(void * jarg1, char * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->username = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->username, (const char *)arg2);
+    } else {
+      arg1->username = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_username_get(void * jarg1) {
+  char * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (char *) ((arg1)->username);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_dialplan_set(void * jarg1, char * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->dialplan = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->dialplan, (const char *)arg2);
+    } else {
+      arg1->dialplan = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_dialplan_get(void * jarg1) {
+  char * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (char *) ((arg1)->dialplan);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_caller_id_name_set(void * jarg1, char * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->caller_id_name = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->caller_id_name, (const char *)arg2);
+    } else {
+      arg1->caller_id_name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_caller_id_name_get(void * jarg1) {
+  char * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (char *) ((arg1)->caller_id_name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_caller_id_number_set(void * jarg1, char * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->caller_id_number = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->caller_id_number, (const char *)arg2);
+    } else {
+      arg1->caller_id_number = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_caller_id_number_get(void * jarg1) {
+  char * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (char *) ((arg1)->caller_id_number);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_callee_id_name_set(void * jarg1, char * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->callee_id_name = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->callee_id_name, (const char *)arg2);
+    } else {
+      arg1->callee_id_name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_callee_id_name_get(void * jarg1) {
+  char * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (char *) ((arg1)->callee_id_name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_callee_id_number_set(void * jarg1, char * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->callee_id_number = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->callee_id_number, (const char *)arg2);
+    } else {
+      arg1->callee_id_number = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_callee_id_number_get(void * jarg1) {
+  char * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (char *) ((arg1)->callee_id_number);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_caller_ton_set(void * jarg1, unsigned char jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  uint8_t arg2 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (uint8_t)jarg2; 
+  if (arg1) (arg1)->caller_ton = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_caller_profile_caller_ton_get(void * jarg1) {
+  unsigned char jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  uint8_t result;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (uint8_t) ((arg1)->caller_ton);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_caller_numplan_set(void * jarg1, unsigned char jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  uint8_t arg2 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (uint8_t)jarg2; 
+  if (arg1) (arg1)->caller_numplan = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_caller_profile_caller_numplan_get(void * jarg1) {
+  unsigned char jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  uint8_t result;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (uint8_t) ((arg1)->caller_numplan);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_network_addr_set(void * jarg1, char * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->network_addr = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->network_addr, (const char *)arg2);
+    } else {
+      arg1->network_addr = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_network_addr_get(void * jarg1) {
+  char * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (char *) ((arg1)->network_addr);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_ani_set(void * jarg1, char * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->ani = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->ani, (const char *)arg2);
+    } else {
+      arg1->ani = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_ani_get(void * jarg1) {
+  char * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (char *) ((arg1)->ani);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_ani_ton_set(void * jarg1, unsigned char jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  uint8_t arg2 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (uint8_t)jarg2; 
+  if (arg1) (arg1)->ani_ton = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_caller_profile_ani_ton_get(void * jarg1) {
+  unsigned char jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  uint8_t result;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (uint8_t) ((arg1)->ani_ton);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_ani_numplan_set(void * jarg1, unsigned char jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  uint8_t arg2 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (uint8_t)jarg2; 
+  if (arg1) (arg1)->ani_numplan = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_caller_profile_ani_numplan_get(void * jarg1) {
+  unsigned char jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  uint8_t result;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (uint8_t) ((arg1)->ani_numplan);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_aniii_set(void * jarg1, char * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->aniii = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->aniii, (const char *)arg2);
+    } else {
+      arg1->aniii = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_aniii_get(void * jarg1) {
+  char * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (char *) ((arg1)->aniii);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_rdnis_set(void * jarg1, char * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->rdnis = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->rdnis, (const char *)arg2);
+    } else {
+      arg1->rdnis = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_rdnis_get(void * jarg1) {
+  char * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (char *) ((arg1)->rdnis);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_rdnis_ton_set(void * jarg1, unsigned char jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  uint8_t arg2 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (uint8_t)jarg2; 
+  if (arg1) (arg1)->rdnis_ton = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_caller_profile_rdnis_ton_get(void * jarg1) {
+  unsigned char jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  uint8_t result;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (uint8_t) ((arg1)->rdnis_ton);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_rdnis_numplan_set(void * jarg1, unsigned char jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  uint8_t arg2 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (uint8_t)jarg2; 
+  if (arg1) (arg1)->rdnis_numplan = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_caller_profile_rdnis_numplan_get(void * jarg1) {
+  unsigned char jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  uint8_t result;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (uint8_t) ((arg1)->rdnis_numplan);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_destination_number_set(void * jarg1, char * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->destination_number) delete [] arg1->destination_number;
+    if (arg2) {
+      arg1->destination_number = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->destination_number, (const char *)arg2);
+    } else {
+      arg1->destination_number = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_destination_number_get(void * jarg1) {
+  char * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (char *) ((arg1)->destination_number);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_destination_number_ton_set(void * jarg1, unsigned char jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  uint8_t arg2 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (uint8_t)jarg2; 
+  if (arg1) (arg1)->destination_number_ton = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_caller_profile_destination_number_ton_get(void * jarg1) {
+  unsigned char jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  uint8_t result;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (uint8_t) ((arg1)->destination_number_ton);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_destination_number_numplan_set(void * jarg1, unsigned char jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  uint8_t arg2 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (uint8_t)jarg2; 
+  if (arg1) (arg1)->destination_number_numplan = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_caller_profile_destination_number_numplan_get(void * jarg1) {
+  unsigned char jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  uint8_t result;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (uint8_t) ((arg1)->destination_number_numplan);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_source_set(void * jarg1, char * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->source = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->source, (const char *)arg2);
+    } else {
+      arg1->source = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_source_get(void * jarg1) {
+  char * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (char *) ((arg1)->source);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_chan_name_set(void * jarg1, char * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->chan_name) delete [] arg1->chan_name;
+    if (arg2) {
+      arg1->chan_name = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->chan_name, (const char *)arg2);
+    } else {
+      arg1->chan_name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_chan_name_get(void * jarg1) {
+  char * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (char *) ((arg1)->chan_name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_uuid_set(void * jarg1, char * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->uuid) delete [] arg1->uuid;
+    if (arg2) {
+      arg1->uuid = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->uuid, (const char *)arg2);
+    } else {
+      arg1->uuid = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_uuid_get(void * jarg1) {
+  char * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (char *) ((arg1)->uuid);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_context_set(void * jarg1, char * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->context = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->context, (const char *)arg2);
+    } else {
+      arg1->context = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_context_get(void * jarg1) {
+  char * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (char *) ((arg1)->context);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_profile_index_set(void * jarg1, char * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->profile_index = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->profile_index, (const char *)arg2);
+    } else {
+      arg1->profile_index = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_profile_profile_index_get(void * jarg1) {
+  char * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (char *) ((arg1)->profile_index);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_flags_set(void * jarg1, unsigned long jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  switch_caller_profile_flag_t arg2 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (switch_caller_profile_flag_t)jarg2; 
+  if (arg1) (arg1)->flags = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_caller_profile_flags_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  switch_caller_profile_flag_t result;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (switch_caller_profile_flag_t) ((arg1)->flags);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_originator_caller_profile_set(void * jarg1, void * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  switch_caller_profile *arg2 = (switch_caller_profile *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (switch_caller_profile *)jarg2; 
+  if (arg1) (arg1)->originator_caller_profile = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_originator_caller_profile_get(void * jarg1) {
+  void * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  switch_caller_profile *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (switch_caller_profile *) ((arg1)->originator_caller_profile);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_originatee_caller_profile_set(void * jarg1, void * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  switch_caller_profile *arg2 = (switch_caller_profile *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (switch_caller_profile *)jarg2; 
+  if (arg1) (arg1)->originatee_caller_profile = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_originatee_caller_profile_get(void * jarg1) {
+  void * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  switch_caller_profile *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (switch_caller_profile *) ((arg1)->originatee_caller_profile);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_hunt_caller_profile_set(void * jarg1, void * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  switch_caller_profile *arg2 = (switch_caller_profile *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (switch_caller_profile *)jarg2; 
+  if (arg1) (arg1)->hunt_caller_profile = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_hunt_caller_profile_get(void * jarg1) {
+  void * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  switch_caller_profile *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (switch_caller_profile *) ((arg1)->hunt_caller_profile);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_times_set(void * jarg1, void * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  switch_channel_timetable *arg2 = (switch_channel_timetable *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (switch_channel_timetable *)jarg2; 
+  if (arg1) (arg1)->times = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_times_get(void * jarg1) {
+  void * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  switch_channel_timetable *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (switch_channel_timetable *) ((arg1)->times);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_caller_extension_set(void * jarg1, void * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  switch_caller_extension *arg2 = (switch_caller_extension *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (switch_caller_extension *)jarg2; 
+  if (arg1) (arg1)->caller_extension = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_caller_extension_get(void * jarg1) {
+  void * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  switch_caller_extension *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (switch_caller_extension *) ((arg1)->caller_extension);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_pool_set(void * jarg1, void * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (switch_memory_pool_t *)jarg2; 
+  if (arg1) (arg1)->pool = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_pool_get(void * jarg1) {
+  void * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  switch_memory_pool_t *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (switch_memory_pool_t *) ((arg1)->pool);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_next_set(void * jarg1, void * jarg2) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  switch_caller_profile *arg2 = (switch_caller_profile *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  arg2 = (switch_caller_profile *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_next_get(void * jarg1) {
+  void * jresult ;
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  switch_caller_profile *result = 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  result = (switch_caller_profile *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_caller_profile() {
+  void * jresult ;
+  switch_caller_profile *result = 0 ;
+  
+  result = (switch_caller_profile *)new switch_caller_profile();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_caller_profile(void * jarg1) {
+  switch_caller_profile *arg1 = (switch_caller_profile *) 0 ;
+  
+  arg1 = (switch_caller_profile *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_application_application_name_set(void * jarg1, char * jarg2) {
+  switch_caller_application *arg1 = (switch_caller_application *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_caller_application *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->application_name) delete [] arg1->application_name;
+    if (arg2) {
+      arg1->application_name = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->application_name, (const char *)arg2);
+    } else {
+      arg1->application_name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_application_application_name_get(void * jarg1) {
+  char * jresult ;
+  switch_caller_application *arg1 = (switch_caller_application *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_caller_application *)jarg1; 
+  result = (char *) ((arg1)->application_name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_application_application_data_set(void * jarg1, char * jarg2) {
+  switch_caller_application *arg1 = (switch_caller_application *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_caller_application *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->application_data) delete [] arg1->application_data;
+    if (arg2) {
+      arg1->application_data = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->application_data, (const char *)arg2);
+    } else {
+      arg1->application_data = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_application_application_data_get(void * jarg1) {
+  char * jresult ;
+  switch_caller_application *arg1 = (switch_caller_application *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_caller_application *)jarg1; 
+  result = (char *) ((arg1)->application_data);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_application_application_function_set(void * jarg1, void * jarg2) {
+  switch_caller_application *arg1 = (switch_caller_application *) 0 ;
+  switch_application_function_t arg2 = (switch_application_function_t) 0 ;
+  
+  arg1 = (switch_caller_application *)jarg1; 
+  arg2 = (switch_application_function_t)jarg2; 
+  if (arg1) (arg1)->application_function = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_application_application_function_get(void * jarg1) {
+  void * jresult ;
+  switch_caller_application *arg1 = (switch_caller_application *) 0 ;
+  switch_application_function_t result;
+  
+  arg1 = (switch_caller_application *)jarg1; 
+  result = (switch_application_function_t) ((arg1)->application_function);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_application_next_set(void * jarg1, void * jarg2) {
+  switch_caller_application *arg1 = (switch_caller_application *) 0 ;
+  switch_caller_application *arg2 = (switch_caller_application *) 0 ;
+  
+  arg1 = (switch_caller_application *)jarg1; 
+  arg2 = (switch_caller_application *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_application_next_get(void * jarg1) {
+  void * jresult ;
+  switch_caller_application *arg1 = (switch_caller_application *) 0 ;
+  switch_caller_application *result = 0 ;
+  
+  arg1 = (switch_caller_application *)jarg1; 
+  result = (switch_caller_application *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_caller_application() {
+  void * jresult ;
+  switch_caller_application *result = 0 ;
+  
+  result = (switch_caller_application *)new switch_caller_application();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_caller_application(void * jarg1) {
+  switch_caller_application *arg1 = (switch_caller_application *) 0 ;
+  
+  arg1 = (switch_caller_application *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_extension_extension_name_set(void * jarg1, char * jarg2) {
+  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_caller_extension *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->extension_name) delete [] arg1->extension_name;
+    if (arg2) {
+      arg1->extension_name = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->extension_name, (const char *)arg2);
+    } else {
+      arg1->extension_name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_extension_extension_name_get(void * jarg1) {
+  char * jresult ;
+  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_caller_extension *)jarg1; 
+  result = (char *) ((arg1)->extension_name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_extension_extension_number_set(void * jarg1, char * jarg2) {
+  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_caller_extension *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->extension_number) delete [] arg1->extension_number;
+    if (arg2) {
+      arg1->extension_number = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->extension_number, (const char *)arg2);
+    } else {
+      arg1->extension_number = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_extension_extension_number_get(void * jarg1) {
+  char * jresult ;
+  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_caller_extension *)jarg1; 
+  result = (char *) ((arg1)->extension_number);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_extension_current_application_set(void * jarg1, void * jarg2) {
+  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
+  switch_caller_application_t *arg2 = (switch_caller_application_t *) 0 ;
+  
+  arg1 = (switch_caller_extension *)jarg1; 
+  arg2 = (switch_caller_application_t *)jarg2; 
+  if (arg1) (arg1)->current_application = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_extension_current_application_get(void * jarg1) {
+  void * jresult ;
+  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
+  switch_caller_application_t *result = 0 ;
+  
+  arg1 = (switch_caller_extension *)jarg1; 
+  result = (switch_caller_application_t *) ((arg1)->current_application);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_extension_last_application_set(void * jarg1, void * jarg2) {
+  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
+  switch_caller_application_t *arg2 = (switch_caller_application_t *) 0 ;
+  
+  arg1 = (switch_caller_extension *)jarg1; 
+  arg2 = (switch_caller_application_t *)jarg2; 
+  if (arg1) (arg1)->last_application = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_extension_last_application_get(void * jarg1) {
+  void * jresult ;
+  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
+  switch_caller_application_t *result = 0 ;
+  
+  arg1 = (switch_caller_extension *)jarg1; 
+  result = (switch_caller_application_t *) ((arg1)->last_application);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_extension_applications_set(void * jarg1, void * jarg2) {
+  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
+  switch_caller_application_t *arg2 = (switch_caller_application_t *) 0 ;
+  
+  arg1 = (switch_caller_extension *)jarg1; 
+  arg2 = (switch_caller_application_t *)jarg2; 
+  if (arg1) (arg1)->applications = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_extension_applications_get(void * jarg1) {
+  void * jresult ;
+  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
+  switch_caller_application_t *result = 0 ;
+  
+  arg1 = (switch_caller_extension *)jarg1; 
+  result = (switch_caller_application_t *) ((arg1)->applications);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_extension_children_set(void * jarg1, void * jarg2) {
+  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
+  switch_caller_profile *arg2 = (switch_caller_profile *) 0 ;
+  
+  arg1 = (switch_caller_extension *)jarg1; 
+  arg2 = (switch_caller_profile *)jarg2; 
+  if (arg1) (arg1)->children = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_extension_children_get(void * jarg1) {
+  void * jresult ;
+  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
+  switch_caller_profile *result = 0 ;
+  
+  arg1 = (switch_caller_extension *)jarg1; 
+  result = (switch_caller_profile *) ((arg1)->children);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_extension_next_set(void * jarg1, void * jarg2) {
+  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
+  switch_caller_extension *arg2 = (switch_caller_extension *) 0 ;
+  
+  arg1 = (switch_caller_extension *)jarg1; 
+  arg2 = (switch_caller_extension *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_extension_next_get(void * jarg1) {
+  void * jresult ;
+  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
+  switch_caller_extension *result = 0 ;
+  
+  arg1 = (switch_caller_extension *)jarg1; 
+  result = (switch_caller_extension *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_caller_extension() {
+  void * jresult ;
+  switch_caller_extension *result = 0 ;
+  
+  result = (switch_caller_extension *)new switch_caller_extension();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_caller_extension(void * jarg1) {
+  switch_caller_extension *arg1 = (switch_caller_extension *) 0 ;
+  
+  arg1 = (switch_caller_extension *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_extension_new(void * jarg1, char * jarg2, char * jarg3) {
+  void * jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  switch_caller_extension_t *result = 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (switch_caller_extension_t *)switch_caller_extension_new(arg1,(char const *)arg2,(char const *)arg3);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_caller_extension_clone(void * jarg1, void * jarg2, void * jarg3) {
+  int jresult ;
+  switch_caller_extension_t **arg1 = (switch_caller_extension_t **) 0 ;
+  switch_caller_extension_t *arg2 = (switch_caller_extension_t *) 0 ;
+  switch_memory_pool_t *arg3 = (switch_memory_pool_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_caller_extension_t **)jarg1; 
+  arg2 = (switch_caller_extension_t *)jarg2; 
+  arg3 = (switch_memory_pool_t *)jarg3; 
+  result = (switch_status_t)switch_caller_extension_clone(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_extension_add_application(void * jarg1, void * jarg2, char * jarg3, char * jarg4) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_caller_extension_t *arg2 = (switch_caller_extension_t *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_caller_extension_t *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  switch_caller_extension_add_application(arg1,arg2,(char const *)arg3,(char const *)arg4);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_extension_add_application_printf(void * jarg1, void * jarg2, char * jarg3, char * jarg4) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_caller_extension_t *arg2 = (switch_caller_extension_t *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  void *arg5 = 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_caller_extension_t *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  switch_caller_extension_add_application_printf(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5);
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_caller_get_field_by_name(void * jarg1, char * jarg2) {
+  char * jresult ;
+  switch_caller_profile_t *arg1 = (switch_caller_profile_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_caller_profile_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (char *)switch_caller_get_field_by_name(arg1,(char const *)arg2);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_new(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, char * jarg11, char * jarg12) {
+  void * jresult ;
+  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  char *arg5 = (char *) 0 ;
+  char *arg6 = (char *) 0 ;
+  char *arg7 = (char *) 0 ;
+  char *arg8 = (char *) 0 ;
+  char *arg9 = (char *) 0 ;
+  char *arg10 = (char *) 0 ;
+  char *arg11 = (char *) 0 ;
+  char *arg12 = (char *) 0 ;
+  switch_caller_profile_t *result = 0 ;
+  
+  arg1 = (switch_memory_pool_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (char *)jarg5; 
+  arg6 = (char *)jarg6; 
+  arg7 = (char *)jarg7; 
+  arg8 = (char *)jarg8; 
+  arg9 = (char *)jarg9; 
+  arg10 = (char *)jarg10; 
+  arg11 = (char *)jarg11; 
+  arg12 = (char *)jarg12; 
+  result = (switch_caller_profile_t *)switch_caller_profile_new(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,(char const *)arg11,(char const *)arg12);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_clone(void * jarg1, void * jarg2) {
+  void * jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_caller_profile_t *arg2 = (switch_caller_profile_t *) 0 ;
+  switch_caller_profile_t *result = 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_caller_profile_t *)jarg2; 
+  result = (switch_caller_profile_t *)switch_caller_profile_clone(arg1,arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_caller_profile_dup(void * jarg1, void * jarg2) {
+  void * jresult ;
+  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
+  switch_caller_profile_t *arg2 = (switch_caller_profile_t *) 0 ;
+  switch_caller_profile_t *result = 0 ;
+  
+  arg1 = (switch_memory_pool_t *)jarg1; 
+  arg2 = (switch_caller_profile_t *)jarg2; 
+  result = (switch_caller_profile_t *)switch_caller_profile_dup(arg1,arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_caller_profile_event_set_data(void * jarg1, char * jarg2, void * jarg3) {
+  switch_caller_profile_t *arg1 = (switch_caller_profile_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_event_t *arg3 = (switch_event_t *) 0 ;
+  
+  arg1 = (switch_caller_profile_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_event_t *)jarg3; 
+  switch_caller_profile_event_set_data(arg1,(char const *)arg2,arg3);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_codec_set(void * jarg1, void * jarg2) {
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  switch_codec_t *arg2 = (switch_codec_t *) 0 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  arg2 = (switch_codec_t *)jarg2; 
+  if (arg1) (arg1)->codec = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_frame_codec_get(void * jarg1) {
+  void * jresult ;
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  switch_codec_t *result = 0 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  result = (switch_codec_t *) ((arg1)->codec);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_source_set(void * jarg1, char * jarg2) {
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->source = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->source, (const char *)arg2);
+    } else {
+      arg1->source = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_frame_source_get(void * jarg1) {
+  char * jresult ;
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  result = (char *) ((arg1)->source);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_packet_set(void * jarg1, void * jarg2) {
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->packet = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_frame_packet_get(void * jarg1) {
+  void * jresult ;
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  result = (void *) ((arg1)->packet);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_packetlen_set(void * jarg1, unsigned long jarg2) {
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->packetlen = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_frame_packetlen_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_frame *)jarg1; 
+  result = (uint32_t) ((arg1)->packetlen);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_extra_data_set(void * jarg1, void * jarg2) {
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->extra_data = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_frame_extra_data_get(void * jarg1) {
+  void * jresult ;
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  result = (void *) ((arg1)->extra_data);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_data_set(void * jarg1, void * jarg2) {
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->data = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_frame_data_get(void * jarg1) {
+  void * jresult ;
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  result = (void *) ((arg1)->data);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_datalen_set(void * jarg1, unsigned long jarg2) {
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->datalen = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_frame_datalen_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_frame *)jarg1; 
+  result = (uint32_t) ((arg1)->datalen);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_buflen_set(void * jarg1, unsigned long jarg2) {
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->buflen = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_frame_buflen_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_frame *)jarg1; 
+  result = (uint32_t) ((arg1)->buflen);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_samples_set(void * jarg1, unsigned long jarg2) {
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->samples = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_frame_samples_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_frame *)jarg1; 
+  result = (uint32_t) ((arg1)->samples);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_rate_set(void * jarg1, unsigned long jarg2) {
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->rate = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_frame_rate_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_frame *)jarg1; 
+  result = (uint32_t) ((arg1)->rate);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_payload_set(void * jarg1, unsigned char jarg2) {
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  switch_payload_t arg2 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  arg2 = (switch_payload_t)jarg2; 
+  if (arg1) (arg1)->payload = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_frame_payload_get(void * jarg1) {
+  unsigned char jresult ;
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  switch_payload_t result;
+  
+  arg1 = (switch_frame *)jarg1; 
+  result = (switch_payload_t) ((arg1)->payload);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_timestamp_set(void * jarg1, void * jarg2) {
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->timestamp = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_frame_timestamp_get(void * jarg1) {
+  void * jresult ;
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_frame *)jarg1; 
+  result =  ((arg1)->timestamp);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_seq_set(void * jarg1, unsigned short jarg2) {
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  uint16_t arg2 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  arg2 = (uint16_t)jarg2; 
+  if (arg1) (arg1)->seq = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_frame_seq_get(void * jarg1) {
+  unsigned short jresult ;
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  uint16_t result;
+  
+  arg1 = (switch_frame *)jarg1; 
+  result = (uint16_t) ((arg1)->seq);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_ssrc_set(void * jarg1, unsigned long jarg2) {
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->ssrc = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_frame_ssrc_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_frame *)jarg1; 
+  result = (uint32_t) ((arg1)->ssrc);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_m_set(void * jarg1, int jarg2) {
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  switch_bool_t arg2 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  arg2 = (switch_bool_t)jarg2; 
+  if (arg1) (arg1)->m = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_frame_m_get(void * jarg1) {
+  int jresult ;
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  switch_bool_t result;
+  
+  arg1 = (switch_frame *)jarg1; 
+  result = (switch_bool_t) ((arg1)->m);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_frame_flags_set(void * jarg1, unsigned long jarg2) {
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  switch_frame_flag_t arg2 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  arg2 = (switch_frame_flag_t)jarg2; 
+  if (arg1) (arg1)->flags = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_frame_flags_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  switch_frame_flag_t result;
+  
+  arg1 = (switch_frame *)jarg1; 
+  result = (switch_frame_flag_t) ((arg1)->flags);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_frame() {
+  void * jresult ;
+  switch_frame *result = 0 ;
+  
+  result = (switch_frame *)new switch_frame();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_frame(void * jarg1) {
+  switch_frame *arg1 = (switch_frame *) 0 ;
+  
+  arg1 = (switch_frame *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_init_set(void * jarg1, void * jarg2) {
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  arg2 = (switch_state_handler_t)jarg2; 
+  if (arg1) (arg1)->on_init = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_init_get(void * jarg1) {
+  void * jresult ;
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t result;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  result = (switch_state_handler_t) ((arg1)->on_init);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_routing_set(void * jarg1, void * jarg2) {
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  arg2 = (switch_state_handler_t)jarg2; 
+  if (arg1) (arg1)->on_routing = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_routing_get(void * jarg1) {
+  void * jresult ;
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t result;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  result = (switch_state_handler_t) ((arg1)->on_routing);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_execute_set(void * jarg1, void * jarg2) {
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  arg2 = (switch_state_handler_t)jarg2; 
+  if (arg1) (arg1)->on_execute = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_execute_get(void * jarg1) {
+  void * jresult ;
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t result;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  result = (switch_state_handler_t) ((arg1)->on_execute);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_hangup_set(void * jarg1, void * jarg2) {
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  arg2 = (switch_state_handler_t)jarg2; 
+  if (arg1) (arg1)->on_hangup = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_hangup_get(void * jarg1) {
+  void * jresult ;
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t result;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  result = (switch_state_handler_t) ((arg1)->on_hangup);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_exchange_media_set(void * jarg1, void * jarg2) {
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  arg2 = (switch_state_handler_t)jarg2; 
+  if (arg1) (arg1)->on_exchange_media = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_exchange_media_get(void * jarg1) {
+  void * jresult ;
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t result;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  result = (switch_state_handler_t) ((arg1)->on_exchange_media);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_soft_execute_set(void * jarg1, void * jarg2) {
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  arg2 = (switch_state_handler_t)jarg2; 
+  if (arg1) (arg1)->on_soft_execute = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_soft_execute_get(void * jarg1) {
+  void * jresult ;
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t result;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  result = (switch_state_handler_t) ((arg1)->on_soft_execute);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_consume_media_set(void * jarg1, void * jarg2) {
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  arg2 = (switch_state_handler_t)jarg2; 
+  if (arg1) (arg1)->on_consume_media = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_consume_media_get(void * jarg1) {
+  void * jresult ;
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t result;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  result = (switch_state_handler_t) ((arg1)->on_consume_media);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_hibernate_set(void * jarg1, void * jarg2) {
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  arg2 = (switch_state_handler_t)jarg2; 
+  if (arg1) (arg1)->on_hibernate = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_hibernate_get(void * jarg1) {
+  void * jresult ;
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t result;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  result = (switch_state_handler_t) ((arg1)->on_hibernate);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_reset_set(void * jarg1, void * jarg2) {
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  arg2 = (switch_state_handler_t)jarg2; 
+  if (arg1) (arg1)->on_reset = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_reset_get(void * jarg1) {
+  void * jresult ;
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t result;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  result = (switch_state_handler_t) ((arg1)->on_reset);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_park_set(void * jarg1, void * jarg2) {
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  arg2 = (switch_state_handler_t)jarg2; 
+  if (arg1) (arg1)->on_park = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_park_get(void * jarg1) {
+  void * jresult ;
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t result;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  result = (switch_state_handler_t) ((arg1)->on_park);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_reporting_set(void * jarg1, void * jarg2) {
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  arg2 = (switch_state_handler_t)jarg2; 
+  if (arg1) (arg1)->on_reporting = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_reporting_get(void * jarg1) {
+  void * jresult ;
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t result;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  result = (switch_state_handler_t) ((arg1)->on_reporting);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_on_destroy_set(void * jarg1, void * jarg2) {
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t arg2 = (switch_state_handler_t) 0 ;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  arg2 = (switch_state_handler_t)jarg2; 
+  if (arg1) (arg1)->on_destroy = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_on_destroy_get(void * jarg1) {
+  void * jresult ;
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  switch_state_handler_t result;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  result = (switch_state_handler_t) ((arg1)->on_destroy);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_flags_set(void * jarg1, int jarg2) {
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->flags = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_state_handler_table_flags_get(void * jarg1) {
+  int jresult ;
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  int result;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  result = (int) ((arg1)->flags);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_state_handler_table_padding_set(void * jarg1, void * jarg2) {
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  void **arg2 ;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  arg2 = (void **)jarg2; 
+  {
+    size_t ii;
+    void * *b = (void * *) arg1->padding;
+    for (ii = 0; ii < (size_t)10; ii++) b[ii] = *((void * *) arg2 + ii);
+  }
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_state_handler_table_padding_get(void * jarg1) {
+  void * jresult ;
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  void **result = 0 ;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  result = (void **)(void **) ((arg1)->padding);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_state_handler_table() {
+  void * jresult ;
+  switch_state_handler_table *result = 0 ;
+  
+  result = (switch_state_handler_table *)new switch_state_handler_table();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_state_handler_table(void * jarg1) {
+  switch_state_handler_table *arg1 = (switch_state_handler_table *) 0 ;
+  
+  arg1 = (switch_state_handler_table *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_write_function_set(void * jarg1, void * jarg2) {
+  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
+  switch_stream_handle_write_function_t arg2 = (switch_stream_handle_write_function_t) 0 ;
+  
+  arg1 = (switch_stream_handle *)jarg1; 
+  arg2 = (switch_stream_handle_write_function_t)jarg2; 
+  if (arg1) (arg1)->write_function = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_stream_handle_write_function_get(void * jarg1) {
+  void * jresult ;
+  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
+  switch_stream_handle_write_function_t result;
+  
+  arg1 = (switch_stream_handle *)jarg1; 
+  result = (switch_stream_handle_write_function_t) ((arg1)->write_function);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_raw_write_function_set(void * jarg1, void * jarg2) {
+  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
+  switch_stream_handle_raw_write_function_t arg2 = (switch_stream_handle_raw_write_function_t) 0 ;
+  
+  arg1 = (switch_stream_handle *)jarg1; 
+  arg2 = (switch_stream_handle_raw_write_function_t)jarg2; 
+  if (arg1) (arg1)->raw_write_function = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_stream_handle_raw_write_function_get(void * jarg1) {
+  void * jresult ;
+  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
+  switch_stream_handle_raw_write_function_t result;
+  
+  arg1 = (switch_stream_handle *)jarg1; 
+  result = (switch_stream_handle_raw_write_function_t) ((arg1)->raw_write_function);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_data_set(void * jarg1, void * jarg2) {
+  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_stream_handle *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->data = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_stream_handle_data_get(void * jarg1) {
+  void * jresult ;
+  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_stream_handle *)jarg1; 
+  result = (void *) ((arg1)->data);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_end_set(void * jarg1, void * jarg2) {
+  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_stream_handle *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->end = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_stream_handle_end_get(void * jarg1) {
+  void * jresult ;
+  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_stream_handle *)jarg1; 
+  result = (void *) ((arg1)->end);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_data_size_set(void * jarg1, void * jarg2) {
+  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_stream_handle *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->data_size = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_stream_handle_data_size_get(void * jarg1) {
+  void * jresult ;
+  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_stream_handle *)jarg1; 
+  result =  ((arg1)->data_size);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_data_len_set(void * jarg1, void * jarg2) {
+  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_stream_handle *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->data_len = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_stream_handle_data_len_get(void * jarg1) {
+  void * jresult ;
+  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_stream_handle *)jarg1; 
+  result =  ((arg1)->data_len);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_alloc_len_set(void * jarg1, void * jarg2) {
+  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_stream_handle *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->alloc_len = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_stream_handle_alloc_len_get(void * jarg1) {
+  void * jresult ;
+  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_stream_handle *)jarg1; 
+  result =  ((arg1)->alloc_len);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_alloc_chunk_set(void * jarg1, void * jarg2) {
+  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_stream_handle *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->alloc_chunk = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_stream_handle_alloc_chunk_get(void * jarg1) {
+  void * jresult ;
+  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_stream_handle *)jarg1; 
+  result =  ((arg1)->alloc_chunk);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_stream_handle_param_event_set(void * jarg1, void * jarg2) {
+  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
+  switch_event_t *arg2 = (switch_event_t *) 0 ;
+  
+  arg1 = (switch_stream_handle *)jarg1; 
+  arg2 = (switch_event_t *)jarg2; 
+  if (arg1) (arg1)->param_event = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_stream_handle_param_event_get(void * jarg1) {
+  void * jresult ;
+  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
+  switch_event_t *result = 0 ;
+  
+  arg1 = (switch_stream_handle *)jarg1; 
+  result = (switch_event_t *) ((arg1)->param_event);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_stream_handle() {
+  void * jresult ;
+  switch_stream_handle *result = 0 ;
+  
+  result = (switch_stream_handle *)new switch_stream_handle();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_stream_handle(void * jarg1) {
+  switch_stream_handle *arg1 = (switch_stream_handle *) 0 ;
+  
+  arg1 = (switch_stream_handle *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_outgoing_channel_set(void * jarg1, void * jarg2) {
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_outgoing_channel_t arg2 = (switch_io_outgoing_channel_t) 0 ;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  arg2 = (switch_io_outgoing_channel_t)jarg2; 
+  if (arg1) (arg1)->outgoing_channel = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_outgoing_channel_get(void * jarg1) {
+  void * jresult ;
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_outgoing_channel_t result;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  result = (switch_io_outgoing_channel_t) ((arg1)->outgoing_channel);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_read_frame_set(void * jarg1, void * jarg2) {
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_read_frame_t arg2 = (switch_io_read_frame_t) 0 ;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  arg2 = (switch_io_read_frame_t)jarg2; 
+  if (arg1) (arg1)->read_frame = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_read_frame_get(void * jarg1) {
+  void * jresult ;
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_read_frame_t result;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  result = (switch_io_read_frame_t) ((arg1)->read_frame);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_write_frame_set(void * jarg1, void * jarg2) {
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_write_frame_t arg2 = (switch_io_write_frame_t) 0 ;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  arg2 = (switch_io_write_frame_t)jarg2; 
+  if (arg1) (arg1)->write_frame = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_write_frame_get(void * jarg1) {
+  void * jresult ;
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_write_frame_t result;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  result = (switch_io_write_frame_t) ((arg1)->write_frame);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_kill_channel_set(void * jarg1, void * jarg2) {
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_kill_channel_t arg2 = (switch_io_kill_channel_t) 0 ;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  arg2 = (switch_io_kill_channel_t)jarg2; 
+  if (arg1) (arg1)->kill_channel = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_kill_channel_get(void * jarg1) {
+  void * jresult ;
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_kill_channel_t result;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  result = (switch_io_kill_channel_t) ((arg1)->kill_channel);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_send_dtmf_set(void * jarg1, void * jarg2) {
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_send_dtmf_t arg2 = (switch_io_send_dtmf_t) 0 ;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  arg2 = (switch_io_send_dtmf_t)jarg2; 
+  if (arg1) (arg1)->send_dtmf = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_send_dtmf_get(void * jarg1) {
+  void * jresult ;
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_send_dtmf_t result;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  result = (switch_io_send_dtmf_t) ((arg1)->send_dtmf);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_receive_message_set(void * jarg1, void * jarg2) {
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_receive_message_t arg2 = (switch_io_receive_message_t) 0 ;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  arg2 = (switch_io_receive_message_t)jarg2; 
+  if (arg1) (arg1)->receive_message = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_receive_message_get(void * jarg1) {
+  void * jresult ;
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_receive_message_t result;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  result = (switch_io_receive_message_t) ((arg1)->receive_message);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_receive_event_set(void * jarg1, void * jarg2) {
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_receive_event_t arg2 = (switch_io_receive_event_t) 0 ;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  arg2 = (switch_io_receive_event_t)jarg2; 
+  if (arg1) (arg1)->receive_event = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_receive_event_get(void * jarg1) {
+  void * jresult ;
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_receive_event_t result;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  result = (switch_io_receive_event_t) ((arg1)->receive_event);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_state_change_set(void * jarg1, void * jarg2) {
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_state_change_t arg2 = (switch_io_state_change_t) 0 ;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  arg2 = (switch_io_state_change_t)jarg2; 
+  if (arg1) (arg1)->state_change = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_state_change_get(void * jarg1) {
+  void * jresult ;
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_state_change_t result;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  result = (switch_io_state_change_t) ((arg1)->state_change);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_read_video_frame_set(void * jarg1, void * jarg2) {
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_read_video_frame_t arg2 = (switch_io_read_video_frame_t) 0 ;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  arg2 = (switch_io_read_video_frame_t)jarg2; 
+  if (arg1) (arg1)->read_video_frame = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_read_video_frame_get(void * jarg1) {
+  void * jresult ;
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_read_video_frame_t result;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  result = (switch_io_read_video_frame_t) ((arg1)->read_video_frame);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_write_video_frame_set(void * jarg1, void * jarg2) {
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_write_video_frame_t arg2 = (switch_io_write_video_frame_t) 0 ;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  arg2 = (switch_io_write_video_frame_t)jarg2; 
+  if (arg1) (arg1)->write_video_frame = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_write_video_frame_get(void * jarg1) {
+  void * jresult ;
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_write_video_frame_t result;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  result = (switch_io_write_video_frame_t) ((arg1)->write_video_frame);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_resurrect_session_set(void * jarg1, void * jarg2) {
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_resurrect_session_t arg2 = (switch_io_resurrect_session_t) 0 ;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  arg2 = (switch_io_resurrect_session_t)jarg2; 
+  if (arg1) (arg1)->resurrect_session = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_resurrect_session_get(void * jarg1) {
+  void * jresult ;
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  switch_io_resurrect_session_t result;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  result = (switch_io_resurrect_session_t) ((arg1)->resurrect_session);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_routines_padding_set(void * jarg1, void * jarg2) {
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  void **arg2 ;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  arg2 = (void **)jarg2; 
+  {
+    size_t ii;
+    void * *b = (void * *) arg1->padding;
+    for (ii = 0; ii < (size_t)10; ii++) b[ii] = *((void * *) arg2 + ii);
+  }
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_routines_padding_get(void * jarg1) {
+  void * jresult ;
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  void **result = 0 ;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  result = (void **)(void **) ((arg1)->padding);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_routines() {
+  void * jresult ;
+  switch_io_routines *result = 0 ;
+  
+  result = (switch_io_routines *)new switch_io_routines();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_routines(void * jarg1) {
+  switch_io_routines *arg1 = (switch_io_routines *) 0 ;
+  
+  arg1 = (switch_io_routines *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_endpoint_interface_interface_name_set(void * jarg1, char * jarg2) {
+  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_endpoint_interface *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->interface_name, (const char *)arg2);
+    } else {
+      arg1->interface_name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_endpoint_interface_interface_name_get(void * jarg1) {
+  char * jresult ;
+  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_endpoint_interface *)jarg1; 
+  result = (char *) ((arg1)->interface_name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_endpoint_interface_io_routines_set(void * jarg1, void * jarg2) {
+  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
+  switch_io_routines_t *arg2 = (switch_io_routines_t *) 0 ;
+  
+  arg1 = (switch_endpoint_interface *)jarg1; 
+  arg2 = (switch_io_routines_t *)jarg2; 
+  if (arg1) (arg1)->io_routines = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_endpoint_interface_io_routines_get(void * jarg1) {
+  void * jresult ;
+  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
+  switch_io_routines_t *result = 0 ;
+  
+  arg1 = (switch_endpoint_interface *)jarg1; 
+  result = (switch_io_routines_t *) ((arg1)->io_routines);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_endpoint_interface_state_handler_set(void * jarg1, void * jarg2) {
+  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
+  switch_state_handler_table_t *arg2 = (switch_state_handler_table_t *) 0 ;
+  
+  arg1 = (switch_endpoint_interface *)jarg1; 
+  arg2 = (switch_state_handler_table_t *)jarg2; 
+  if (arg1) (arg1)->state_handler = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_endpoint_interface_state_handler_get(void * jarg1) {
+  void * jresult ;
+  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
+  switch_state_handler_table_t *result = 0 ;
+  
+  arg1 = (switch_endpoint_interface *)jarg1; 
+  result = (switch_state_handler_table_t *) ((arg1)->state_handler);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_endpoint_interface_private_info_set(void * jarg1, void * jarg2) {
+  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_endpoint_interface *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->private_info = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_endpoint_interface_private_info_get(void * jarg1) {
+  void * jresult ;
+  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_endpoint_interface *)jarg1; 
+  result = (void *) ((arg1)->private_info);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_endpoint_interface_rwlock_set(void * jarg1, void * jarg2) {
+  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
+  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
+  
+  arg1 = (switch_endpoint_interface *)jarg1; 
+  arg2 = (switch_thread_rwlock_t *)jarg2; 
+  if (arg1) (arg1)->rwlock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_endpoint_interface_rwlock_get(void * jarg1) {
+  void * jresult ;
+  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
+  switch_thread_rwlock_t *result = 0 ;
+  
+  arg1 = (switch_endpoint_interface *)jarg1; 
+  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_endpoint_interface_refs_set(void * jarg1, int jarg2) {
+  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_endpoint_interface *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->refs = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_endpoint_interface_refs_get(void * jarg1) {
+  int jresult ;
+  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
+  int result;
+  
+  arg1 = (switch_endpoint_interface *)jarg1; 
+  result = (int) ((arg1)->refs);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_endpoint_interface_reflock_set(void * jarg1, void * jarg2) {
+  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
+  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
+  
+  arg1 = (switch_endpoint_interface *)jarg1; 
+  arg2 = (switch_mutex_t *)jarg2; 
+  if (arg1) (arg1)->reflock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_endpoint_interface_reflock_get(void * jarg1) {
+  void * jresult ;
+  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
+  switch_mutex_t *result = 0 ;
+  
+  arg1 = (switch_endpoint_interface *)jarg1; 
+  result = (switch_mutex_t *) ((arg1)->reflock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_endpoint_interface_parent_set(void * jarg1, void * jarg2) {
+  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
+  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
+  
+  arg1 = (switch_endpoint_interface *)jarg1; 
+  arg2 = (switch_loadable_module_interface_t *)jarg2; 
+  if (arg1) (arg1)->parent = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_endpoint_interface_parent_get(void * jarg1) {
+  void * jresult ;
+  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
+  switch_loadable_module_interface_t *result = 0 ;
+  
+  arg1 = (switch_endpoint_interface *)jarg1; 
+  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_endpoint_interface_next_set(void * jarg1, void * jarg2) {
+  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
+  switch_endpoint_interface *arg2 = (switch_endpoint_interface *) 0 ;
+  
+  arg1 = (switch_endpoint_interface *)jarg1; 
+  arg2 = (switch_endpoint_interface *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_endpoint_interface_next_get(void * jarg1) {
+  void * jresult ;
+  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
+  switch_endpoint_interface *result = 0 ;
+  
+  arg1 = (switch_endpoint_interface *)jarg1; 
+  result = (switch_endpoint_interface *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_endpoint_interface() {
+  void * jresult ;
+  switch_endpoint_interface *result = 0 ;
+  
+  result = (switch_endpoint_interface *)new switch_endpoint_interface();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_endpoint_interface(void * jarg1) {
+  switch_endpoint_interface *arg1 = (switch_endpoint_interface *) 0 ;
+  
+  arg1 = (switch_endpoint_interface *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interval_set(void * jarg1, int jarg2) {
+  switch_timer *arg1 = (switch_timer *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_timer *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->interval = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_timer_interval_get(void * jarg1) {
+  int jresult ;
+  switch_timer *arg1 = (switch_timer *) 0 ;
+  int result;
+  
+  arg1 = (switch_timer *)jarg1; 
+  result = (int) ((arg1)->interval);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_flags_set(void * jarg1, unsigned long jarg2) {
+  switch_timer *arg1 = (switch_timer *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_timer *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->flags = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_timer_flags_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_timer *arg1 = (switch_timer *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_timer *)jarg1; 
+  result = (uint32_t) ((arg1)->flags);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_samples_set(void * jarg1, unsigned int jarg2) {
+  switch_timer *arg1 = (switch_timer *) 0 ;
+  unsigned int arg2 ;
+  
+  arg1 = (switch_timer *)jarg1; 
+  arg2 = (unsigned int)jarg2; 
+  if (arg1) (arg1)->samples = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_timer_samples_get(void * jarg1) {
+  unsigned int jresult ;
+  switch_timer *arg1 = (switch_timer *) 0 ;
+  unsigned int result;
+  
+  arg1 = (switch_timer *)jarg1; 
+  result = (unsigned int) ((arg1)->samples);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_samplecount_set(void * jarg1, unsigned long jarg2) {
+  switch_timer *arg1 = (switch_timer *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_timer *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->samplecount = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_timer_samplecount_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_timer *arg1 = (switch_timer *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_timer *)jarg1; 
+  result = (uint32_t) ((arg1)->samplecount);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_timer_interface_set(void * jarg1, void * jarg2) {
+  switch_timer *arg1 = (switch_timer *) 0 ;
+  switch_timer_interface_t *arg2 = (switch_timer_interface_t *) 0 ;
+  
+  arg1 = (switch_timer *)jarg1; 
+  arg2 = (switch_timer_interface_t *)jarg2; 
+  if (arg1) (arg1)->timer_interface = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_timer_interface_get(void * jarg1) {
+  void * jresult ;
+  switch_timer *arg1 = (switch_timer *) 0 ;
+  switch_timer_interface_t *result = 0 ;
+  
+  arg1 = (switch_timer *)jarg1; 
+  result = (switch_timer_interface_t *) ((arg1)->timer_interface);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_memory_pool_set(void * jarg1, void * jarg2) {
+  switch_timer *arg1 = (switch_timer *) 0 ;
+  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
+  
+  arg1 = (switch_timer *)jarg1; 
+  arg2 = (switch_memory_pool_t *)jarg2; 
+  if (arg1) (arg1)->memory_pool = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_memory_pool_get(void * jarg1) {
+  void * jresult ;
+  switch_timer *arg1 = (switch_timer *) 0 ;
+  switch_memory_pool_t *result = 0 ;
+  
+  arg1 = (switch_timer *)jarg1; 
+  result = (switch_memory_pool_t *) ((arg1)->memory_pool);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_private_info_set(void * jarg1, void * jarg2) {
+  switch_timer *arg1 = (switch_timer *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_timer *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->private_info = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_private_info_get(void * jarg1) {
+  void * jresult ;
+  switch_timer *arg1 = (switch_timer *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_timer *)jarg1; 
+  result = (void *) ((arg1)->private_info);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_diff_set(void * jarg1, void * jarg2) {
+  switch_timer *arg1 = (switch_timer *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_timer *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->diff = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_diff_get(void * jarg1) {
+  void * jresult ;
+  switch_timer *arg1 = (switch_timer *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_timer *)jarg1; 
+  result =  ((arg1)->diff);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_tick_set(void * jarg1, void * jarg2) {
+  switch_timer *arg1 = (switch_timer *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_timer *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->tick = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_tick_get(void * jarg1) {
+  void * jresult ;
+  switch_timer *arg1 = (switch_timer *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_timer *)jarg1; 
+  result =  ((arg1)->tick);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_timer() {
+  void * jresult ;
+  switch_timer *result = 0 ;
+  
+  result = (switch_timer *)new switch_timer();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_timer(void * jarg1) {
+  switch_timer *arg1 = (switch_timer *) 0 ;
+  
+  arg1 = (switch_timer *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_interface_name_set(void * jarg1, char * jarg2) {
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->interface_name, (const char *)arg2);
+    } else {
+      arg1->interface_name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_timer_interface_interface_name_get(void * jarg1) {
+  char * jresult ;
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  result = (char *) ((arg1)->interface_name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_timer_init_set(void * jarg1, void * jarg2) {
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  switch_status_t (*arg2)(switch_timer_t *) = (switch_status_t (*)(switch_timer_t *)) 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_timer_t *))jarg2; 
+  if (arg1) (arg1)->timer_init = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_interface_timer_init_get(void * jarg1) {
+  void * jresult ;
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  switch_status_t (*result)(switch_timer_t *) = 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_timer_t *)) ((arg1)->timer_init);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_timer_next_set(void * jarg1, void * jarg2) {
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  switch_status_t (*arg2)(switch_timer_t *) = (switch_status_t (*)(switch_timer_t *)) 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_timer_t *))jarg2; 
+  if (arg1) (arg1)->timer_next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_interface_timer_next_get(void * jarg1) {
+  void * jresult ;
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  switch_status_t (*result)(switch_timer_t *) = 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_timer_t *)) ((arg1)->timer_next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_timer_step_set(void * jarg1, void * jarg2) {
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  switch_status_t (*arg2)(switch_timer_t *) = (switch_status_t (*)(switch_timer_t *)) 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_timer_t *))jarg2; 
+  if (arg1) (arg1)->timer_step = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_interface_timer_step_get(void * jarg1) {
+  void * jresult ;
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  switch_status_t (*result)(switch_timer_t *) = 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_timer_t *)) ((arg1)->timer_step);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_timer_sync_set(void * jarg1, void * jarg2) {
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  switch_status_t (*arg2)(switch_timer_t *) = (switch_status_t (*)(switch_timer_t *)) 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_timer_t *))jarg2; 
+  if (arg1) (arg1)->timer_sync = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_interface_timer_sync_get(void * jarg1) {
+  void * jresult ;
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  switch_status_t (*result)(switch_timer_t *) = 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_timer_t *)) ((arg1)->timer_sync);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_timer_check_set(void * jarg1, void * jarg2) {
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  switch_status_t (*arg2)(switch_timer_t *,switch_bool_t) = (switch_status_t (*)(switch_timer_t *,switch_bool_t)) 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_timer_t *,switch_bool_t))jarg2; 
+  if (arg1) (arg1)->timer_check = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_interface_timer_check_get(void * jarg1) {
+  void * jresult ;
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  switch_status_t (*result)(switch_timer_t *,switch_bool_t) = 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_timer_t *,switch_bool_t)) ((arg1)->timer_check);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_timer_destroy_set(void * jarg1, void * jarg2) {
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  switch_status_t (*arg2)(switch_timer_t *) = (switch_status_t (*)(switch_timer_t *)) 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_timer_t *))jarg2; 
+  if (arg1) (arg1)->timer_destroy = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_interface_timer_destroy_get(void * jarg1) {
+  void * jresult ;
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  switch_status_t (*result)(switch_timer_t *) = 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_timer_t *)) ((arg1)->timer_destroy);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_rwlock_set(void * jarg1, void * jarg2) {
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  arg2 = (switch_thread_rwlock_t *)jarg2; 
+  if (arg1) (arg1)->rwlock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_interface_rwlock_get(void * jarg1) {
+  void * jresult ;
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  switch_thread_rwlock_t *result = 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_refs_set(void * jarg1, int jarg2) {
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->refs = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_timer_interface_refs_get(void * jarg1) {
+  int jresult ;
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  int result;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  result = (int) ((arg1)->refs);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_reflock_set(void * jarg1, void * jarg2) {
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  arg2 = (switch_mutex_t *)jarg2; 
+  if (arg1) (arg1)->reflock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_interface_reflock_get(void * jarg1) {
+  void * jresult ;
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  switch_mutex_t *result = 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  result = (switch_mutex_t *) ((arg1)->reflock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_parent_set(void * jarg1, void * jarg2) {
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  arg2 = (switch_loadable_module_interface_t *)jarg2; 
+  if (arg1) (arg1)->parent = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_interface_parent_get(void * jarg1) {
+  void * jresult ;
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  switch_loadable_module_interface_t *result = 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_timer_interface_next_set(void * jarg1, void * jarg2) {
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  switch_timer_interface *arg2 = (switch_timer_interface *) 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  arg2 = (switch_timer_interface *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_timer_interface_next_get(void * jarg1) {
+  void * jresult ;
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  switch_timer_interface *result = 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  result = (switch_timer_interface *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_timer_interface() {
+  void * jresult ;
+  switch_timer_interface *result = 0 ;
+  
+  result = (switch_timer_interface *)new switch_timer_interface();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_timer_interface(void * jarg1) {
+  switch_timer_interface *arg1 = (switch_timer_interface *) 0 ;
+  
+  arg1 = (switch_timer_interface *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_dialplan_interface_interface_name_set(void * jarg1, char * jarg2) {
+  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_dialplan_interface *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->interface_name, (const char *)arg2);
+    } else {
+      arg1->interface_name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_dialplan_interface_interface_name_get(void * jarg1) {
+  char * jresult ;
+  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_dialplan_interface *)jarg1; 
+  result = (char *) ((arg1)->interface_name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_dialplan_interface_hunt_function_set(void * jarg1, void * jarg2) {
+  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
+  switch_dialplan_hunt_function_t arg2 = (switch_dialplan_hunt_function_t) 0 ;
+  
+  arg1 = (switch_dialplan_interface *)jarg1; 
+  arg2 = (switch_dialplan_hunt_function_t)jarg2; 
+  if (arg1) (arg1)->hunt_function = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_dialplan_interface_hunt_function_get(void * jarg1) {
+  void * jresult ;
+  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
+  switch_dialplan_hunt_function_t result;
+  
+  arg1 = (switch_dialplan_interface *)jarg1; 
+  result = (switch_dialplan_hunt_function_t) ((arg1)->hunt_function);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_dialplan_interface_rwlock_set(void * jarg1, void * jarg2) {
+  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
+  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
+  
+  arg1 = (switch_dialplan_interface *)jarg1; 
+  arg2 = (switch_thread_rwlock_t *)jarg2; 
+  if (arg1) (arg1)->rwlock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_dialplan_interface_rwlock_get(void * jarg1) {
+  void * jresult ;
+  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
+  switch_thread_rwlock_t *result = 0 ;
+  
+  arg1 = (switch_dialplan_interface *)jarg1; 
+  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_dialplan_interface_refs_set(void * jarg1, int jarg2) {
+  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_dialplan_interface *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->refs = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_dialplan_interface_refs_get(void * jarg1) {
+  int jresult ;
+  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
+  int result;
+  
+  arg1 = (switch_dialplan_interface *)jarg1; 
+  result = (int) ((arg1)->refs);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_dialplan_interface_reflock_set(void * jarg1, void * jarg2) {
+  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
+  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
+  
+  arg1 = (switch_dialplan_interface *)jarg1; 
+  arg2 = (switch_mutex_t *)jarg2; 
+  if (arg1) (arg1)->reflock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_dialplan_interface_reflock_get(void * jarg1) {
+  void * jresult ;
+  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
+  switch_mutex_t *result = 0 ;
+  
+  arg1 = (switch_dialplan_interface *)jarg1; 
+  result = (switch_mutex_t *) ((arg1)->reflock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_dialplan_interface_parent_set(void * jarg1, void * jarg2) {
+  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
+  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
+  
+  arg1 = (switch_dialplan_interface *)jarg1; 
+  arg2 = (switch_loadable_module_interface_t *)jarg2; 
+  if (arg1) (arg1)->parent = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_dialplan_interface_parent_get(void * jarg1) {
+  void * jresult ;
+  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
+  switch_loadable_module_interface_t *result = 0 ;
+  
+  arg1 = (switch_dialplan_interface *)jarg1; 
+  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_dialplan_interface_next_set(void * jarg1, void * jarg2) {
+  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
+  switch_dialplan_interface *arg2 = (switch_dialplan_interface *) 0 ;
+  
+  arg1 = (switch_dialplan_interface *)jarg1; 
+  arg2 = (switch_dialplan_interface *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_dialplan_interface_next_get(void * jarg1) {
+  void * jresult ;
+  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
+  switch_dialplan_interface *result = 0 ;
+  
+  arg1 = (switch_dialplan_interface *)jarg1; 
+  result = (switch_dialplan_interface *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_dialplan_interface() {
+  void * jresult ;
+  switch_dialplan_interface *result = 0 ;
+  
+  result = (switch_dialplan_interface *)new switch_dialplan_interface();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_dialplan_interface(void * jarg1) {
+  switch_dialplan_interface *arg1 = (switch_dialplan_interface *) 0 ;
+  
+  arg1 = (switch_dialplan_interface *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_interface_name_set(void * jarg1, char * jarg2) {
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->interface_name, (const char *)arg2);
+    } else {
+      arg1->interface_name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_file_interface_interface_name_get(void * jarg1) {
+  char * jresult ;
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  result = (char *) ((arg1)->interface_name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_file_open_set(void * jarg1, void * jarg2) {
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_status_t (*arg2)(switch_file_handle_t *,char const *) = (switch_status_t (*)(switch_file_handle_t *,char const *)) 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_file_handle_t *,char const *))jarg2; 
+  if (arg1) (arg1)->file_open = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_file_open_get(void * jarg1) {
+  void * jresult ;
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_status_t (*result)(switch_file_handle_t *,char const *) = 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_file_handle_t *,char const *)) ((arg1)->file_open);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_file_close_set(void * jarg1, void * jarg2) {
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_status_t (*arg2)(switch_file_handle_t *) = (switch_status_t (*)(switch_file_handle_t *)) 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_file_handle_t *))jarg2; 
+  if (arg1) (arg1)->file_close = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_file_close_get(void * jarg1) {
+  void * jresult ;
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_status_t (*result)(switch_file_handle_t *) = 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_file_handle_t *)) ((arg1)->file_close);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_file_truncate_set(void * jarg1, void * jarg2) {
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_status_t (*arg2)(switch_file_handle_t *,int64_t) = (switch_status_t (*)(switch_file_handle_t *,int64_t)) 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_file_handle_t *,int64_t))jarg2; 
+  if (arg1) (arg1)->file_truncate = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_file_truncate_get(void * jarg1) {
+  void * jresult ;
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_status_t (*result)(switch_file_handle_t *,int64_t) = 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_file_handle_t *,int64_t)) ((arg1)->file_truncate);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_file_read_set(void * jarg1, void * jarg2) {
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_status_t (*arg2)(switch_file_handle_t *,void *,switch_size_t *) = (switch_status_t (*)(switch_file_handle_t *,void *,switch_size_t *)) 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_file_handle_t *,void *,switch_size_t *))jarg2; 
+  if (arg1) (arg1)->file_read = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_file_read_get(void * jarg1) {
+  void * jresult ;
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_status_t (*result)(switch_file_handle_t *,void *,switch_size_t *) = 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_file_handle_t *,void *,switch_size_t *)) ((arg1)->file_read);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_file_write_set(void * jarg1, void * jarg2) {
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_status_t (*arg2)(switch_file_handle_t *,void *,switch_size_t *) = (switch_status_t (*)(switch_file_handle_t *,void *,switch_size_t *)) 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_file_handle_t *,void *,switch_size_t *))jarg2; 
+  if (arg1) (arg1)->file_write = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_file_write_get(void * jarg1) {
+  void * jresult ;
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_status_t (*result)(switch_file_handle_t *,void *,switch_size_t *) = 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_file_handle_t *,void *,switch_size_t *)) ((arg1)->file_write);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_file_seek_set(void * jarg1, void * jarg2) {
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_status_t (*arg2)(switch_file_handle_t *,unsigned int *,int64_t,int) = (switch_status_t (*)(switch_file_handle_t *,unsigned int *,int64_t,int)) 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_file_handle_t *,unsigned int *,int64_t,int))jarg2; 
+  if (arg1) (arg1)->file_seek = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_file_seek_get(void * jarg1) {
+  void * jresult ;
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_status_t (*result)(switch_file_handle_t *,unsigned int *,int64_t,int) = 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_file_handle_t *,unsigned int *,int64_t,int)) ((arg1)->file_seek);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_file_set_string_set(void * jarg1, void * jarg2) {
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_status_t (*arg2)(switch_file_handle_t *,switch_audio_col_t,char const *) = (switch_status_t (*)(switch_file_handle_t *,switch_audio_col_t,char const *)) 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_file_handle_t *,switch_audio_col_t,char const *))jarg2; 
+  if (arg1) (arg1)->file_set_string = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_file_set_string_get(void * jarg1) {
+  void * jresult ;
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_status_t (*result)(switch_file_handle_t *,switch_audio_col_t,char const *) = 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_file_handle_t *,switch_audio_col_t,char const *)) ((arg1)->file_set_string);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_file_get_string_set(void * jarg1, void * jarg2) {
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_status_t (*arg2)(switch_file_handle_t *,switch_audio_col_t,char const **) = (switch_status_t (*)(switch_file_handle_t *,switch_audio_col_t,char const **)) 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_file_handle_t *,switch_audio_col_t,char const **))jarg2; 
+  if (arg1) (arg1)->file_get_string = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_file_get_string_get(void * jarg1) {
+  void * jresult ;
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_status_t (*result)(switch_file_handle_t *,switch_audio_col_t,char const **) = 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_file_handle_t *,switch_audio_col_t,char const **)) ((arg1)->file_get_string);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_extens_set(void * jarg1, void * jarg2) {
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  char **arg2 = (char **) 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  arg2 = (char **)jarg2; 
+  if (arg1) (arg1)->extens = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_extens_get(void * jarg1) {
+  void * jresult ;
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  char **result = 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  result = (char **) ((arg1)->extens);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_rwlock_set(void * jarg1, void * jarg2) {
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  arg2 = (switch_thread_rwlock_t *)jarg2; 
+  if (arg1) (arg1)->rwlock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_rwlock_get(void * jarg1) {
+  void * jresult ;
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_thread_rwlock_t *result = 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_refs_set(void * jarg1, int jarg2) {
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->refs = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_file_interface_refs_get(void * jarg1) {
+  int jresult ;
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  int result;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  result = (int) ((arg1)->refs);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_reflock_set(void * jarg1, void * jarg2) {
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  arg2 = (switch_mutex_t *)jarg2; 
+  if (arg1) (arg1)->reflock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_reflock_get(void * jarg1) {
+  void * jresult ;
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_mutex_t *result = 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  result = (switch_mutex_t *) ((arg1)->reflock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_parent_set(void * jarg1, void * jarg2) {
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  arg2 = (switch_loadable_module_interface_t *)jarg2; 
+  if (arg1) (arg1)->parent = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_parent_get(void * jarg1) {
+  void * jresult ;
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_loadable_module_interface_t *result = 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_interface_next_set(void * jarg1, void * jarg2) {
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_file_interface *arg2 = (switch_file_interface *) 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  arg2 = (switch_file_interface *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_interface_next_get(void * jarg1) {
+  void * jresult ;
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  switch_file_interface *result = 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  result = (switch_file_interface *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_file_interface() {
+  void * jresult ;
+  switch_file_interface *result = 0 ;
+  
+  result = (switch_file_interface *)new switch_file_interface();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_file_interface(void * jarg1) {
+  switch_file_interface *arg1 = (switch_file_interface *) 0 ;
+  
+  arg1 = (switch_file_interface *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_file_interface_set(void * jarg1, void * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_file_interface_t *arg2 = (switch_file_interface_t *) 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (switch_file_interface_t *)jarg2; 
+  if (arg1) (arg1)->file_interface = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_file_interface_get(void * jarg1) {
+  void * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_file_interface_t *result = 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (switch_file_interface_t *) ((arg1)->file_interface);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_flags_set(void * jarg1, unsigned long jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->flags = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_file_handle_flags_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (uint32_t) ((arg1)->flags);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_fd_set(void * jarg1, void * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_file_t *arg2 = (switch_file_t *) 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (switch_file_t *)jarg2; 
+  if (arg1) (arg1)->fd = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_fd_get(void * jarg1) {
+  void * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_file_t *result = 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (switch_file_t *) ((arg1)->fd);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_samples_set(void * jarg1, unsigned int jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  unsigned int arg2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (unsigned int)jarg2; 
+  if (arg1) (arg1)->samples = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_file_handle_samples_get(void * jarg1) {
+  unsigned int jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  unsigned int result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (unsigned int) ((arg1)->samples);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_samplerate_set(void * jarg1, unsigned long jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->samplerate = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_file_handle_samplerate_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (uint32_t) ((arg1)->samplerate);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_native_rate_set(void * jarg1, unsigned long jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->native_rate = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_file_handle_native_rate_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (uint32_t) ((arg1)->native_rate);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_channels_set(void * jarg1, unsigned char jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  uint8_t arg2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (uint8_t)jarg2; 
+  if (arg1) (arg1)->channels = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_file_handle_channels_get(void * jarg1) {
+  unsigned char jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  uint8_t result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (uint8_t) ((arg1)->channels);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_format_set(void * jarg1, unsigned int jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  unsigned int arg2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (unsigned int)jarg2; 
+  if (arg1) (arg1)->format = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_file_handle_format_get(void * jarg1) {
+  unsigned int jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  unsigned int result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (unsigned int) ((arg1)->format);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_sections_set(void * jarg1, unsigned int jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  unsigned int arg2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (unsigned int)jarg2; 
+  if (arg1) (arg1)->sections = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_file_handle_sections_get(void * jarg1) {
+  unsigned int jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  unsigned int result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (unsigned int) ((arg1)->sections);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_seekable_set(void * jarg1, int jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->seekable = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_file_handle_seekable_get(void * jarg1) {
+  int jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  int result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (int) ((arg1)->seekable);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_sample_count_set(void * jarg1, void * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->sample_count = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_sample_count_get(void * jarg1) {
+  void * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result =  ((arg1)->sample_count);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_speed_set(void * jarg1, int jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->speed = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_file_handle_speed_get(void * jarg1) {
+  int jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  int result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (int) ((arg1)->speed);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_memory_pool_set(void * jarg1, void * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (switch_memory_pool_t *)jarg2; 
+  if (arg1) (arg1)->memory_pool = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_memory_pool_get(void * jarg1) {
+  void * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_memory_pool_t *result = 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (switch_memory_pool_t *) ((arg1)->memory_pool);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_prebuf_set(void * jarg1, unsigned long jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->prebuf = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_file_handle_prebuf_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (uint32_t) ((arg1)->prebuf);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_interval_set(void * jarg1, unsigned long jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->interval = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_file_handle_interval_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (uint32_t) ((arg1)->interval);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_private_info_set(void * jarg1, void * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->private_info = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_private_info_get(void * jarg1) {
+  void * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (void *) ((arg1)->private_info);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_handler_set(void * jarg1, char * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->handler) delete [] arg1->handler;
+    if (arg2) {
+      arg1->handler = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->handler, (const char *)arg2);
+    } else {
+      arg1->handler = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_file_handle_handler_get(void * jarg1) {
+  char * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (char *) ((arg1)->handler);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_pos_set(void * jarg1, long long jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  int64_t arg2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (int64_t)jarg2; 
+  if (arg1) (arg1)->pos = arg2;
+  
+}
+
+
+SWIGEXPORT long long SWIGSTDCALL CSharp_switch_file_handle_pos_get(void * jarg1) {
+  long long jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  int64_t result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (int64_t) ((arg1)->pos);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_audio_buffer_set(void * jarg1, void * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_buffer_t *arg2 = (switch_buffer_t *) 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (switch_buffer_t *)jarg2; 
+  if (arg1) (arg1)->audio_buffer = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_audio_buffer_get(void * jarg1) {
+  void * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_buffer_t *result = 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (switch_buffer_t *) ((arg1)->audio_buffer);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_sp_audio_buffer_set(void * jarg1, void * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_buffer_t *arg2 = (switch_buffer_t *) 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (switch_buffer_t *)jarg2; 
+  if (arg1) (arg1)->sp_audio_buffer = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_sp_audio_buffer_get(void * jarg1) {
+  void * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_buffer_t *result = 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (switch_buffer_t *) ((arg1)->sp_audio_buffer);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_thresh_set(void * jarg1, unsigned long jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->thresh = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_file_handle_thresh_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (uint32_t) ((arg1)->thresh);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_silence_hits_set(void * jarg1, unsigned long jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->silence_hits = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_file_handle_silence_hits_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (uint32_t) ((arg1)->silence_hits);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_offset_pos_set(void * jarg1, unsigned long jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->offset_pos = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_file_handle_offset_pos_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (uint32_t) ((arg1)->offset_pos);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_samples_in_set(void * jarg1, void * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->samples_in = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_samples_in_get(void * jarg1) {
+  void * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result =  ((arg1)->samples_in);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_samples_out_set(void * jarg1, void * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->samples_out = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_samples_out_get(void * jarg1) {
+  void * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result =  ((arg1)->samples_out);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_vol_set(void * jarg1, int jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  int32_t arg2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (int32_t)jarg2; 
+  if (arg1) (arg1)->vol = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_file_handle_vol_get(void * jarg1) {
+  int jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  int32_t result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (int32_t) ((arg1)->vol);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_resampler_set(void * jarg1, void * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_audio_resampler_t *arg2 = (switch_audio_resampler_t *) 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (switch_audio_resampler_t *)jarg2; 
+  if (arg1) (arg1)->resampler = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_resampler_get(void * jarg1) {
+  void * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_audio_resampler_t *result = 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (switch_audio_resampler_t *) ((arg1)->resampler);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_buffer_set(void * jarg1, void * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_buffer_t *arg2 = (switch_buffer_t *) 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (switch_buffer_t *)jarg2; 
+  if (arg1) (arg1)->buffer = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_buffer_get(void * jarg1) {
+  void * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_buffer_t *result = 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (switch_buffer_t *) ((arg1)->buffer);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_dbuf_set(void * jarg1, void * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_byte_t *arg2 = (switch_byte_t *) 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (switch_byte_t *)jarg2; 
+  if (arg1) (arg1)->dbuf = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_dbuf_get(void * jarg1) {
+  void * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_byte_t *result = 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (switch_byte_t *) ((arg1)->dbuf);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_dbuflen_set(void * jarg1, void * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->dbuflen = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_dbuflen_get(void * jarg1) {
+  void * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result =  ((arg1)->dbuflen);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_pre_buffer_set(void * jarg1, void * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_buffer_t *arg2 = (switch_buffer_t *) 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (switch_buffer_t *)jarg2; 
+  if (arg1) (arg1)->pre_buffer = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_pre_buffer_get(void * jarg1) {
+  void * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_buffer_t *result = 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (switch_buffer_t *) ((arg1)->pre_buffer);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_pre_buffer_data_set(void * jarg1, void * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  unsigned char *arg2 = (unsigned char *) 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (unsigned char *)jarg2; 
+  if (arg1) (arg1)->pre_buffer_data = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_pre_buffer_data_get(void * jarg1) {
+  void * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  unsigned char *result = 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (unsigned char *) ((arg1)->pre_buffer_data);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_pre_buffer_datalen_set(void * jarg1, void * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->pre_buffer_datalen = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_file_handle_pre_buffer_datalen_get(void * jarg1) {
+  void * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result =  ((arg1)->pre_buffer_datalen);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_file_set(void * jarg1, char * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->file = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->file, (const char *)arg2);
+    } else {
+      arg1->file = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_file_handle_file_get(void * jarg1) {
+  char * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (char *) ((arg1)->file);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_func_set(void * jarg1, char * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->func = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->func, (const char *)arg2);
+    } else {
+      arg1->func = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_file_handle_func_get(void * jarg1) {
+  char * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (char *) ((arg1)->func);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_line_set(void * jarg1, int jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->line = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_file_handle_line_get(void * jarg1) {
+  int jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  int result;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (int) ((arg1)->line);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_file_path_set(void * jarg1, char * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->file_path) delete [] arg1->file_path;
+    if (arg2) {
+      arg1->file_path = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->file_path, (const char *)arg2);
+    } else {
+      arg1->file_path = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_file_handle_file_path_get(void * jarg1) {
+  char * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (char *) ((arg1)->file_path);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_spool_path_set(void * jarg1, char * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->spool_path) delete [] arg1->spool_path;
+    if (arg2) {
+      arg1->spool_path = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->spool_path, (const char *)arg2);
+    } else {
+      arg1->spool_path = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_file_handle_spool_path_get(void * jarg1) {
+  char * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (char *) ((arg1)->spool_path);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_file_handle_prefix_set(void * jarg1, char * jarg2) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->prefix = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->prefix, (const char *)arg2);
+    } else {
+      arg1->prefix = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_file_handle_prefix_get(void * jarg1) {
+  char * jresult ;
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  result = (char *) ((arg1)->prefix);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_file_handle() {
+  void * jresult ;
+  switch_file_handle *result = 0 ;
+  
+  result = (switch_file_handle *)new switch_file_handle();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_file_handle(void * jarg1) {
+  switch_file_handle *arg1 = (switch_file_handle *) 0 ;
+  
+  arg1 = (switch_file_handle *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_interface_name_set(void * jarg1, char * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->interface_name, (const char *)arg2);
+    } else {
+      arg1->interface_name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_asr_interface_interface_name_get(void * jarg1) {
+  char * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (char *) ((arg1)->interface_name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_open_set(void * jarg1, void * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*arg2)(switch_asr_handle_t *,char const *,int,char const *,switch_asr_flag_t *) = (switch_status_t (*)(switch_asr_handle_t *,char const *,int,char const *,switch_asr_flag_t *)) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_asr_handle_t *,char const *,int,char const *,switch_asr_flag_t *))jarg2; 
+  if (arg1) (arg1)->asr_open = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_open_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*result)(switch_asr_handle_t *,char const *,int,char const *,switch_asr_flag_t *) = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_asr_handle_t *,char const *,int,char const *,switch_asr_flag_t *)) ((arg1)->asr_open);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_load_grammar_set(void * jarg1, void * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*arg2)(switch_asr_handle_t *,char const *,char const *) = (switch_status_t (*)(switch_asr_handle_t *,char const *,char const *)) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_asr_handle_t *,char const *,char const *))jarg2; 
+  if (arg1) (arg1)->asr_load_grammar = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_load_grammar_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*result)(switch_asr_handle_t *,char const *,char const *) = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_asr_handle_t *,char const *,char const *)) ((arg1)->asr_load_grammar);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_unload_grammar_set(void * jarg1, void * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*arg2)(switch_asr_handle_t *,char const *) = (switch_status_t (*)(switch_asr_handle_t *,char const *)) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_asr_handle_t *,char const *))jarg2; 
+  if (arg1) (arg1)->asr_unload_grammar = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_unload_grammar_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*result)(switch_asr_handle_t *,char const *) = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_asr_handle_t *,char const *)) ((arg1)->asr_unload_grammar);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_close_set(void * jarg1, void * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*arg2)(switch_asr_handle_t *,switch_asr_flag_t *) = (switch_status_t (*)(switch_asr_handle_t *,switch_asr_flag_t *)) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_asr_handle_t *,switch_asr_flag_t *))jarg2; 
+  if (arg1) (arg1)->asr_close = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_close_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*result)(switch_asr_handle_t *,switch_asr_flag_t *) = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_asr_handle_t *,switch_asr_flag_t *)) ((arg1)->asr_close);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_feed_set(void * jarg1, void * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*arg2)(switch_asr_handle_t *,void *,unsigned int,switch_asr_flag_t *) = (switch_status_t (*)(switch_asr_handle_t *,void *,unsigned int,switch_asr_flag_t *)) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_asr_handle_t *,void *,unsigned int,switch_asr_flag_t *))jarg2; 
+  if (arg1) (arg1)->asr_feed = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_feed_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*result)(switch_asr_handle_t *,void *,unsigned int,switch_asr_flag_t *) = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_asr_handle_t *,void *,unsigned int,switch_asr_flag_t *)) ((arg1)->asr_feed);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_resume_set(void * jarg1, void * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*arg2)(switch_asr_handle_t *) = (switch_status_t (*)(switch_asr_handle_t *)) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_asr_handle_t *))jarg2; 
+  if (arg1) (arg1)->asr_resume = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_resume_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*result)(switch_asr_handle_t *) = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_asr_handle_t *)) ((arg1)->asr_resume);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_pause_set(void * jarg1, void * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*arg2)(switch_asr_handle_t *) = (switch_status_t (*)(switch_asr_handle_t *)) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_asr_handle_t *))jarg2; 
+  if (arg1) (arg1)->asr_pause = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_pause_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*result)(switch_asr_handle_t *) = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_asr_handle_t *)) ((arg1)->asr_pause);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_check_results_set(void * jarg1, void * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*arg2)(switch_asr_handle_t *,switch_asr_flag_t *) = (switch_status_t (*)(switch_asr_handle_t *,switch_asr_flag_t *)) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_asr_handle_t *,switch_asr_flag_t *))jarg2; 
+  if (arg1) (arg1)->asr_check_results = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_check_results_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*result)(switch_asr_handle_t *,switch_asr_flag_t *) = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_asr_handle_t *,switch_asr_flag_t *)) ((arg1)->asr_check_results);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_get_results_set(void * jarg1, void * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*arg2)(switch_asr_handle_t *,char **,switch_asr_flag_t *) = (switch_status_t (*)(switch_asr_handle_t *,char **,switch_asr_flag_t *)) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_asr_handle_t *,char **,switch_asr_flag_t *))jarg2; 
+  if (arg1) (arg1)->asr_get_results = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_get_results_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*result)(switch_asr_handle_t *,char **,switch_asr_flag_t *) = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_asr_handle_t *,char **,switch_asr_flag_t *)) ((arg1)->asr_get_results);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_start_input_timers_set(void * jarg1, void * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*arg2)(switch_asr_handle_t *) = (switch_status_t (*)(switch_asr_handle_t *)) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_asr_handle_t *))jarg2; 
+  if (arg1) (arg1)->asr_start_input_timers = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_start_input_timers_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_status_t (*result)(switch_asr_handle_t *) = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_asr_handle_t *)) ((arg1)->asr_start_input_timers);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_text_param_set(void * jarg1, void * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  void (*arg2)(switch_asr_handle_t *,char *,char const *) = (void (*)(switch_asr_handle_t *,char *,char const *)) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (void (*)(switch_asr_handle_t *,char *,char const *))jarg2; 
+  if (arg1) (arg1)->asr_text_param = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_text_param_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  void (*result)(switch_asr_handle_t *,char *,char const *) = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (void (*)(switch_asr_handle_t *,char *,char const *)) ((arg1)->asr_text_param);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_numeric_param_set(void * jarg1, void * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  void (*arg2)(switch_asr_handle_t *,char *,int) = (void (*)(switch_asr_handle_t *,char *,int)) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (void (*)(switch_asr_handle_t *,char *,int))jarg2; 
+  if (arg1) (arg1)->asr_numeric_param = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_numeric_param_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  void (*result)(switch_asr_handle_t *,char *,int) = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (void (*)(switch_asr_handle_t *,char *,int)) ((arg1)->asr_numeric_param);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_asr_float_param_set(void * jarg1, void * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  void (*arg2)(switch_asr_handle_t *,char *,double) = (void (*)(switch_asr_handle_t *,char *,double)) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (void (*)(switch_asr_handle_t *,char *,double))jarg2; 
+  if (arg1) (arg1)->asr_float_param = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_asr_float_param_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  void (*result)(switch_asr_handle_t *,char *,double) = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (void (*)(switch_asr_handle_t *,char *,double)) ((arg1)->asr_float_param);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_rwlock_set(void * jarg1, void * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (switch_thread_rwlock_t *)jarg2; 
+  if (arg1) (arg1)->rwlock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_rwlock_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_thread_rwlock_t *result = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_refs_set(void * jarg1, int jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->refs = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_asr_interface_refs_get(void * jarg1) {
+  int jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  int result;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (int) ((arg1)->refs);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_reflock_set(void * jarg1, void * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (switch_mutex_t *)jarg2; 
+  if (arg1) (arg1)->reflock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_reflock_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_mutex_t *result = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (switch_mutex_t *) ((arg1)->reflock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_parent_set(void * jarg1, void * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (switch_loadable_module_interface_t *)jarg2; 
+  if (arg1) (arg1)->parent = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_parent_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_loadable_module_interface_t *result = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_interface_next_set(void * jarg1, void * jarg2) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_asr_interface *arg2 = (switch_asr_interface *) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  arg2 = (switch_asr_interface *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_interface_next_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  switch_asr_interface *result = 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  result = (switch_asr_interface *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_asr_interface() {
+  void * jresult ;
+  switch_asr_interface *result = 0 ;
+  
+  result = (switch_asr_interface *)new switch_asr_interface();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_asr_interface(void * jarg1) {
+  switch_asr_interface *arg1 = (switch_asr_interface *) 0 ;
+  
+  arg1 = (switch_asr_interface *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_handle_asr_interface_set(void * jarg1, void * jarg2) {
+  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
+  switch_asr_interface_t *arg2 = (switch_asr_interface_t *) 0 ;
+  
+  arg1 = (switch_asr_handle *)jarg1; 
+  arg2 = (switch_asr_interface_t *)jarg2; 
+  if (arg1) (arg1)->asr_interface = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_handle_asr_interface_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
+  switch_asr_interface_t *result = 0 ;
+  
+  arg1 = (switch_asr_handle *)jarg1; 
+  result = (switch_asr_interface_t *) ((arg1)->asr_interface);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_handle_flags_set(void * jarg1, unsigned long jarg2) {
+  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_asr_handle *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->flags = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_asr_handle_flags_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_asr_handle *)jarg1; 
+  result = (uint32_t) ((arg1)->flags);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_handle_name_set(void * jarg1, char * jarg2) {
+  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_asr_handle *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->name) delete [] arg1->name;
+    if (arg2) {
+      arg1->name = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->name, (const char *)arg2);
+    } else {
+      arg1->name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_asr_handle_name_get(void * jarg1) {
+  char * jresult ;
+  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_asr_handle *)jarg1; 
+  result = (char *) ((arg1)->name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_handle_codec_set(void * jarg1, char * jarg2) {
+  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_asr_handle *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->codec) delete [] arg1->codec;
+    if (arg2) {
+      arg1->codec = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->codec, (const char *)arg2);
+    } else {
+      arg1->codec = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_asr_handle_codec_get(void * jarg1) {
+  char * jresult ;
+  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_asr_handle *)jarg1; 
+  result = (char *) ((arg1)->codec);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_handle_rate_set(void * jarg1, unsigned long jarg2) {
+  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_asr_handle *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->rate = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_asr_handle_rate_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_asr_handle *)jarg1; 
+  result = (uint32_t) ((arg1)->rate);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_handle_grammar_set(void * jarg1, char * jarg2) {
+  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_asr_handle *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->grammar) delete [] arg1->grammar;
+    if (arg2) {
+      arg1->grammar = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->grammar, (const char *)arg2);
+    } else {
+      arg1->grammar = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_asr_handle_grammar_get(void * jarg1) {
+  char * jresult ;
+  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_asr_handle *)jarg1; 
+  result = (char *) ((arg1)->grammar);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_handle_param_set(void * jarg1, char * jarg2) {
+  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_asr_handle *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->param) delete [] arg1->param;
+    if (arg2) {
+      arg1->param = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->param, (const char *)arg2);
+    } else {
+      arg1->param = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_asr_handle_param_get(void * jarg1) {
+  char * jresult ;
+  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_asr_handle *)jarg1; 
+  result = (char *) ((arg1)->param);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_handle_memory_pool_set(void * jarg1, void * jarg2) {
+  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
+  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
+  
+  arg1 = (switch_asr_handle *)jarg1; 
+  arg2 = (switch_memory_pool_t *)jarg2; 
+  if (arg1) (arg1)->memory_pool = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_handle_memory_pool_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
+  switch_memory_pool_t *result = 0 ;
+  
+  arg1 = (switch_asr_handle *)jarg1; 
+  result = (switch_memory_pool_t *) ((arg1)->memory_pool);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_asr_handle_private_info_set(void * jarg1, void * jarg2) {
+  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_asr_handle *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->private_info = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_asr_handle_private_info_get(void * jarg1) {
+  void * jresult ;
+  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_asr_handle *)jarg1; 
+  result = (void *) ((arg1)->private_info);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_asr_handle() {
+  void * jresult ;
+  switch_asr_handle *result = 0 ;
+  
+  result = (switch_asr_handle *)new switch_asr_handle();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_asr_handle(void * jarg1) {
+  switch_asr_handle *arg1 = (switch_asr_handle *) 0 ;
+  
+  arg1 = (switch_asr_handle *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_interface_name_set(void * jarg1, char * jarg2) {
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->interface_name, (const char *)arg2);
+    } else {
+      arg1->interface_name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_speech_interface_interface_name_get(void * jarg1) {
+  char * jresult ;
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  result = (char *) ((arg1)->interface_name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_speech_open_set(void * jarg1, void * jarg2) {
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  switch_status_t (*arg2)(switch_speech_handle_t *,char const *,int,switch_speech_flag_t *) = (switch_status_t (*)(switch_speech_handle_t *,char const *,int,switch_speech_flag_t *)) 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_speech_handle_t *,char const *,int,switch_speech_flag_t *))jarg2; 
+  if (arg1) (arg1)->speech_open = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_speech_open_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  switch_status_t (*result)(switch_speech_handle_t *,char const *,int,switch_speech_flag_t *) = 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_speech_handle_t *,char const *,int,switch_speech_flag_t *)) ((arg1)->speech_open);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_speech_close_set(void * jarg1, void * jarg2) {
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  switch_status_t (*arg2)(switch_speech_handle_t *,switch_speech_flag_t *) = (switch_status_t (*)(switch_speech_handle_t *,switch_speech_flag_t *)) 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_speech_handle_t *,switch_speech_flag_t *))jarg2; 
+  if (arg1) (arg1)->speech_close = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_speech_close_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  switch_status_t (*result)(switch_speech_handle_t *,switch_speech_flag_t *) = 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_speech_handle_t *,switch_speech_flag_t *)) ((arg1)->speech_close);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_speech_feed_tts_set(void * jarg1, void * jarg2) {
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  switch_status_t (*arg2)(switch_speech_handle_t *,char *,switch_speech_flag_t *) = (switch_status_t (*)(switch_speech_handle_t *,char *,switch_speech_flag_t *)) 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_speech_handle_t *,char *,switch_speech_flag_t *))jarg2; 
+  if (arg1) (arg1)->speech_feed_tts = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_speech_feed_tts_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  switch_status_t (*result)(switch_speech_handle_t *,char *,switch_speech_flag_t *) = 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_speech_handle_t *,char *,switch_speech_flag_t *)) ((arg1)->speech_feed_tts);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_speech_read_tts_set(void * jarg1, void * jarg2) {
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  switch_status_t (*arg2)(switch_speech_handle_t *,void *,switch_size_t *,switch_speech_flag_t *) = (switch_status_t (*)(switch_speech_handle_t *,void *,switch_size_t *,switch_speech_flag_t *)) 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_speech_handle_t *,void *,switch_size_t *,switch_speech_flag_t *))jarg2; 
+  if (arg1) (arg1)->speech_read_tts = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_speech_read_tts_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  switch_status_t (*result)(switch_speech_handle_t *,void *,switch_size_t *,switch_speech_flag_t *) = 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_speech_handle_t *,void *,switch_size_t *,switch_speech_flag_t *)) ((arg1)->speech_read_tts);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_speech_flush_tts_set(void * jarg1, void * jarg2) {
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  void (*arg2)(switch_speech_handle_t *) = (void (*)(switch_speech_handle_t *)) 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  arg2 = (void (*)(switch_speech_handle_t *))jarg2; 
+  if (arg1) (arg1)->speech_flush_tts = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_speech_flush_tts_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  void (*result)(switch_speech_handle_t *) = 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  result = (void (*)(switch_speech_handle_t *)) ((arg1)->speech_flush_tts);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_speech_text_param_tts_set(void * jarg1, void * jarg2) {
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  void (*arg2)(switch_speech_handle_t *,char *,char const *) = (void (*)(switch_speech_handle_t *,char *,char const *)) 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  arg2 = (void (*)(switch_speech_handle_t *,char *,char const *))jarg2; 
+  if (arg1) (arg1)->speech_text_param_tts = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_speech_text_param_tts_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  void (*result)(switch_speech_handle_t *,char *,char const *) = 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  result = (void (*)(switch_speech_handle_t *,char *,char const *)) ((arg1)->speech_text_param_tts);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_speech_numeric_param_tts_set(void * jarg1, void * jarg2) {
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  void (*arg2)(switch_speech_handle_t *,char *,int) = (void (*)(switch_speech_handle_t *,char *,int)) 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  arg2 = (void (*)(switch_speech_handle_t *,char *,int))jarg2; 
+  if (arg1) (arg1)->speech_numeric_param_tts = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_speech_numeric_param_tts_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  void (*result)(switch_speech_handle_t *,char *,int) = 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  result = (void (*)(switch_speech_handle_t *,char *,int)) ((arg1)->speech_numeric_param_tts);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_speech_float_param_tts_set(void * jarg1, void * jarg2) {
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  void (*arg2)(switch_speech_handle_t *,char *,double) = (void (*)(switch_speech_handle_t *,char *,double)) 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  arg2 = (void (*)(switch_speech_handle_t *,char *,double))jarg2; 
+  if (arg1) (arg1)->speech_float_param_tts = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_speech_float_param_tts_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  void (*result)(switch_speech_handle_t *,char *,double) = 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  result = (void (*)(switch_speech_handle_t *,char *,double)) ((arg1)->speech_float_param_tts);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_rwlock_set(void * jarg1, void * jarg2) {
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  arg2 = (switch_thread_rwlock_t *)jarg2; 
+  if (arg1) (arg1)->rwlock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_rwlock_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  switch_thread_rwlock_t *result = 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_refs_set(void * jarg1, int jarg2) {
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->refs = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_speech_interface_refs_get(void * jarg1) {
+  int jresult ;
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  int result;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  result = (int) ((arg1)->refs);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_reflock_set(void * jarg1, void * jarg2) {
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  arg2 = (switch_mutex_t *)jarg2; 
+  if (arg1) (arg1)->reflock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_reflock_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  switch_mutex_t *result = 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  result = (switch_mutex_t *) ((arg1)->reflock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_parent_set(void * jarg1, void * jarg2) {
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  arg2 = (switch_loadable_module_interface_t *)jarg2; 
+  if (arg1) (arg1)->parent = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_parent_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  switch_loadable_module_interface_t *result = 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_interface_next_set(void * jarg1, void * jarg2) {
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  switch_speech_interface *arg2 = (switch_speech_interface *) 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  arg2 = (switch_speech_interface *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_interface_next_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  switch_speech_interface *result = 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  result = (switch_speech_interface *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_speech_interface() {
+  void * jresult ;
+  switch_speech_interface *result = 0 ;
+  
+  result = (switch_speech_interface *)new switch_speech_interface();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_speech_interface(void * jarg1) {
+  switch_speech_interface *arg1 = (switch_speech_interface *) 0 ;
+  
+  arg1 = (switch_speech_interface *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_speech_interface_set(void * jarg1, void * jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  switch_speech_interface_t *arg2 = (switch_speech_interface_t *) 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  arg2 = (switch_speech_interface_t *)jarg2; 
+  if (arg1) (arg1)->speech_interface = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_speech_interface_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  switch_speech_interface_t *result = 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result = (switch_speech_interface_t *) ((arg1)->speech_interface);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_flags_set(void * jarg1, unsigned long jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->flags = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_speech_handle_flags_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result = (uint32_t) ((arg1)->flags);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_name_set(void * jarg1, char * jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->name) delete [] arg1->name;
+    if (arg2) {
+      arg1->name = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->name, (const char *)arg2);
+    } else {
+      arg1->name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_speech_handle_name_get(void * jarg1) {
+  char * jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result = (char *) ((arg1)->name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_rate_set(void * jarg1, unsigned long jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->rate = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_speech_handle_rate_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result = (uint32_t) ((arg1)->rate);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_speed_set(void * jarg1, unsigned long jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->speed = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_speech_handle_speed_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result = (uint32_t) ((arg1)->speed);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_samples_set(void * jarg1, unsigned long jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->samples = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_speech_handle_samples_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result = (uint32_t) ((arg1)->samples);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_voice_set(void * jarg1, char * jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  char *arg2 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) strncpy((char *)arg1->voice, (const char *)arg2, 80);
+    else arg1->voice[0] = 0;
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_speech_handle_voice_get(void * jarg1) {
+  char * jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result = (char *)(char *) ((arg1)->voice);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_engine_set(void * jarg1, char * jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->engine) delete [] arg1->engine;
+    if (arg2) {
+      arg1->engine = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->engine, (const char *)arg2);
+    } else {
+      arg1->engine = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_speech_handle_engine_get(void * jarg1) {
+  char * jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result = (char *) ((arg1)->engine);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_param_set(void * jarg1, char * jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->param) delete [] arg1->param;
+    if (arg2) {
+      arg1->param = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->param, (const char *)arg2);
+    } else {
+      arg1->param = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_speech_handle_param_get(void * jarg1) {
+  char * jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result = (char *) ((arg1)->param);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_memory_pool_set(void * jarg1, void * jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  arg2 = (switch_memory_pool_t *)jarg2; 
+  if (arg1) (arg1)->memory_pool = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_memory_pool_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  switch_memory_pool_t *result = 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result = (switch_memory_pool_t *) ((arg1)->memory_pool);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_resampler_set(void * jarg1, void * jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  switch_audio_resampler_t *arg2 = (switch_audio_resampler_t *) 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  arg2 = (switch_audio_resampler_t *)jarg2; 
+  if (arg1) (arg1)->resampler = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_resampler_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  switch_audio_resampler_t *result = 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result = (switch_audio_resampler_t *) ((arg1)->resampler);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_buffer_set(void * jarg1, void * jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  switch_buffer_t *arg2 = (switch_buffer_t *) 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  arg2 = (switch_buffer_t *)jarg2; 
+  if (arg1) (arg1)->buffer = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_buffer_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  switch_buffer_t *result = 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result = (switch_buffer_t *) ((arg1)->buffer);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_dbuf_set(void * jarg1, void * jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  switch_byte_t *arg2 = (switch_byte_t *) 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  arg2 = (switch_byte_t *)jarg2; 
+  if (arg1) (arg1)->dbuf = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_dbuf_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  switch_byte_t *result = 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result = (switch_byte_t *) ((arg1)->dbuf);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_dbuflen_set(void * jarg1, void * jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->dbuflen = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_dbuflen_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result =  ((arg1)->dbuflen);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_samplerate_set(void * jarg1, unsigned long jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->samplerate = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_speech_handle_samplerate_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result = (uint32_t) ((arg1)->samplerate);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_native_rate_set(void * jarg1, unsigned long jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->native_rate = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_speech_handle_native_rate_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result = (uint32_t) ((arg1)->native_rate);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_speech_handle_private_info_set(void * jarg1, void * jarg2) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->private_info = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_speech_handle_private_info_get(void * jarg1) {
+  void * jresult ;
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  result = (void *) ((arg1)->private_info);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_speech_handle() {
+  void * jresult ;
+  switch_speech_handle *result = 0 ;
+  
+  result = (switch_speech_handle *)new switch_speech_handle();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_speech_handle(void * jarg1) {
+  switch_speech_handle *arg1 = (switch_speech_handle *) 0 ;
+  
+  arg1 = (switch_speech_handle *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_interface_interface_name_set(void * jarg1, char * jarg2) {
+  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_say_interface *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->interface_name, (const char *)arg2);
+    } else {
+      arg1->interface_name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_say_interface_interface_name_get(void * jarg1) {
+  char * jresult ;
+  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_say_interface *)jarg1; 
+  result = (char *) ((arg1)->interface_name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_interface_say_function_set(void * jarg1, void * jarg2) {
+  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
+  switch_say_callback_t arg2 = (switch_say_callback_t) 0 ;
+  
+  arg1 = (switch_say_interface *)jarg1; 
+  arg2 = (switch_say_callback_t)jarg2; 
+  if (arg1) (arg1)->say_function = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_say_interface_say_function_get(void * jarg1) {
+  void * jresult ;
+  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
+  switch_say_callback_t result;
+  
+  arg1 = (switch_say_interface *)jarg1; 
+  result = (switch_say_callback_t) ((arg1)->say_function);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_interface_rwlock_set(void * jarg1, void * jarg2) {
+  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
+  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
+  
+  arg1 = (switch_say_interface *)jarg1; 
+  arg2 = (switch_thread_rwlock_t *)jarg2; 
+  if (arg1) (arg1)->rwlock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_say_interface_rwlock_get(void * jarg1) {
+  void * jresult ;
+  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
+  switch_thread_rwlock_t *result = 0 ;
+  
+  arg1 = (switch_say_interface *)jarg1; 
+  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_interface_refs_set(void * jarg1, int jarg2) {
+  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_say_interface *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->refs = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_say_interface_refs_get(void * jarg1) {
+  int jresult ;
+  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
+  int result;
+  
+  arg1 = (switch_say_interface *)jarg1; 
+  result = (int) ((arg1)->refs);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_interface_reflock_set(void * jarg1, void * jarg2) {
+  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
+  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
+  
+  arg1 = (switch_say_interface *)jarg1; 
+  arg2 = (switch_mutex_t *)jarg2; 
+  if (arg1) (arg1)->reflock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_say_interface_reflock_get(void * jarg1) {
+  void * jresult ;
+  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
+  switch_mutex_t *result = 0 ;
+  
+  arg1 = (switch_say_interface *)jarg1; 
+  result = (switch_mutex_t *) ((arg1)->reflock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_interface_parent_set(void * jarg1, void * jarg2) {
+  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
+  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
+  
+  arg1 = (switch_say_interface *)jarg1; 
+  arg2 = (switch_loadable_module_interface_t *)jarg2; 
+  if (arg1) (arg1)->parent = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_say_interface_parent_get(void * jarg1) {
+  void * jresult ;
+  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
+  switch_loadable_module_interface_t *result = 0 ;
+  
+  arg1 = (switch_say_interface *)jarg1; 
+  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_interface_next_set(void * jarg1, void * jarg2) {
+  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
+  switch_say_interface *arg2 = (switch_say_interface *) 0 ;
+  
+  arg1 = (switch_say_interface *)jarg1; 
+  arg2 = (switch_say_interface *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_say_interface_next_get(void * jarg1) {
+  void * jresult ;
+  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
+  switch_say_interface *result = 0 ;
+  
+  arg1 = (switch_say_interface *)jarg1; 
+  result = (switch_say_interface *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_say_interface() {
+  void * jresult ;
+  switch_say_interface *result = 0 ;
+  
+  result = (switch_say_interface *)new switch_say_interface();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_say_interface(void * jarg1) {
+  switch_say_interface *arg1 = (switch_say_interface *) 0 ;
+  
+  arg1 = (switch_say_interface *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_interface_interface_name_set(void * jarg1, char * jarg2) {
+  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_chat_interface *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->interface_name, (const char *)arg2);
+    } else {
+      arg1->interface_name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_chat_interface_interface_name_get(void * jarg1) {
+  char * jresult ;
+  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_chat_interface *)jarg1; 
+  result = (char *) ((arg1)->interface_name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_interface_chat_send_set(void * jarg1, void * jarg2) {
+  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
+  switch_status_t (*arg2)(char const *,char const *,char const *,char const *,char const *,char const *,char const *) = (switch_status_t (*)(char const *,char const *,char const *,char const *,char const *,char const *,char const *)) 0 ;
+  
+  arg1 = (switch_chat_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(char const *,char const *,char const *,char const *,char const *,char const *,char const *))jarg2; 
+  if (arg1) (arg1)->chat_send = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_chat_interface_chat_send_get(void * jarg1) {
+  void * jresult ;
+  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
+  switch_status_t (*result)(char const *,char const *,char const *,char const *,char const *,char const *,char const *) = 0 ;
+  
+  arg1 = (switch_chat_interface *)jarg1; 
+  result = (switch_status_t (*)(char const *,char const *,char const *,char const *,char const *,char const *,char const *)) ((arg1)->chat_send);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_interface_rwlock_set(void * jarg1, void * jarg2) {
+  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
+  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
+  
+  arg1 = (switch_chat_interface *)jarg1; 
+  arg2 = (switch_thread_rwlock_t *)jarg2; 
+  if (arg1) (arg1)->rwlock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_chat_interface_rwlock_get(void * jarg1) {
+  void * jresult ;
+  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
+  switch_thread_rwlock_t *result = 0 ;
+  
+  arg1 = (switch_chat_interface *)jarg1; 
+  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_interface_refs_set(void * jarg1, int jarg2) {
+  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_chat_interface *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->refs = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_chat_interface_refs_get(void * jarg1) {
+  int jresult ;
+  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
+  int result;
+  
+  arg1 = (switch_chat_interface *)jarg1; 
+  result = (int) ((arg1)->refs);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_interface_reflock_set(void * jarg1, void * jarg2) {
+  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
+  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
+  
+  arg1 = (switch_chat_interface *)jarg1; 
+  arg2 = (switch_mutex_t *)jarg2; 
+  if (arg1) (arg1)->reflock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_chat_interface_reflock_get(void * jarg1) {
+  void * jresult ;
+  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
+  switch_mutex_t *result = 0 ;
+  
+  arg1 = (switch_chat_interface *)jarg1; 
+  result = (switch_mutex_t *) ((arg1)->reflock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_interface_parent_set(void * jarg1, void * jarg2) {
+  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
+  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
+  
+  arg1 = (switch_chat_interface *)jarg1; 
+  arg2 = (switch_loadable_module_interface_t *)jarg2; 
+  if (arg1) (arg1)->parent = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_chat_interface_parent_get(void * jarg1) {
+  void * jresult ;
+  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
+  switch_loadable_module_interface_t *result = 0 ;
+  
+  arg1 = (switch_chat_interface *)jarg1; 
+  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_chat_interface_next_set(void * jarg1, void * jarg2) {
+  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
+  switch_chat_interface *arg2 = (switch_chat_interface *) 0 ;
+  
+  arg1 = (switch_chat_interface *)jarg1; 
+  arg2 = (switch_chat_interface *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_chat_interface_next_get(void * jarg1) {
+  void * jresult ;
+  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
+  switch_chat_interface *result = 0 ;
+  
+  arg1 = (switch_chat_interface *)jarg1; 
+  result = (switch_chat_interface *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_chat_interface() {
+  void * jresult ;
+  switch_chat_interface *result = 0 ;
+  
+  result = (switch_chat_interface *)new switch_chat_interface();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_chat_interface(void * jarg1) {
+  switch_chat_interface *arg1 = (switch_chat_interface *) 0 ;
+  
+  arg1 = (switch_chat_interface *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_management_interface_relative_oid_set(void * jarg1, char * jarg2) {
+  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_management_interface *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->relative_oid = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->relative_oid, (const char *)arg2);
+    } else {
+      arg1->relative_oid = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_management_interface_relative_oid_get(void * jarg1) {
+  char * jresult ;
+  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_management_interface *)jarg1; 
+  result = (char *) ((arg1)->relative_oid);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_management_interface_management_function_set(void * jarg1, void * jarg2) {
+  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
+  switch_status_t (*arg2)(char *,switch_management_action_t,char *,switch_size_t) = (switch_status_t (*)(char *,switch_management_action_t,char *,switch_size_t)) 0 ;
+  
+  arg1 = (switch_management_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(char *,switch_management_action_t,char *,switch_size_t))jarg2; 
+  if (arg1) (arg1)->management_function = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_management_interface_management_function_get(void * jarg1) {
+  void * jresult ;
+  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
+  switch_status_t (*result)(char *,switch_management_action_t,char *,switch_size_t) = 0 ;
+  
+  arg1 = (switch_management_interface *)jarg1; 
+  result = (switch_status_t (*)(char *,switch_management_action_t,char *,switch_size_t)) ((arg1)->management_function);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_management_interface_rwlock_set(void * jarg1, void * jarg2) {
+  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
+  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
+  
+  arg1 = (switch_management_interface *)jarg1; 
+  arg2 = (switch_thread_rwlock_t *)jarg2; 
+  if (arg1) (arg1)->rwlock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_management_interface_rwlock_get(void * jarg1) {
+  void * jresult ;
+  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
+  switch_thread_rwlock_t *result = 0 ;
+  
+  arg1 = (switch_management_interface *)jarg1; 
+  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_management_interface_refs_set(void * jarg1, int jarg2) {
+  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_management_interface *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->refs = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_management_interface_refs_get(void * jarg1) {
+  int jresult ;
+  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
+  int result;
+  
+  arg1 = (switch_management_interface *)jarg1; 
+  result = (int) ((arg1)->refs);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_management_interface_reflock_set(void * jarg1, void * jarg2) {
+  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
+  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
+  
+  arg1 = (switch_management_interface *)jarg1; 
+  arg2 = (switch_mutex_t *)jarg2; 
+  if (arg1) (arg1)->reflock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_management_interface_reflock_get(void * jarg1) {
+  void * jresult ;
+  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
+  switch_mutex_t *result = 0 ;
+  
+  arg1 = (switch_management_interface *)jarg1; 
+  result = (switch_mutex_t *) ((arg1)->reflock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_management_interface_parent_set(void * jarg1, void * jarg2) {
+  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
+  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
+  
+  arg1 = (switch_management_interface *)jarg1; 
+  arg2 = (switch_loadable_module_interface_t *)jarg2; 
+  if (arg1) (arg1)->parent = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_management_interface_parent_get(void * jarg1) {
+  void * jresult ;
+  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
+  switch_loadable_module_interface_t *result = 0 ;
+  
+  arg1 = (switch_management_interface *)jarg1; 
+  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_management_interface_next_set(void * jarg1, void * jarg2) {
+  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
+  switch_management_interface *arg2 = (switch_management_interface *) 0 ;
+  
+  arg1 = (switch_management_interface *)jarg1; 
+  arg2 = (switch_management_interface *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_management_interface_next_get(void * jarg1) {
+  void * jresult ;
+  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
+  switch_management_interface *result = 0 ;
+  
+  arg1 = (switch_management_interface *)jarg1; 
+  result = (switch_management_interface *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_management_interface() {
+  void * jresult ;
+  switch_management_interface *result = 0 ;
+  
+  result = (switch_management_interface *)new switch_management_interface();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_management_interface(void * jarg1) {
+  switch_management_interface *arg1 = (switch_management_interface *) 0 ;
+  
+  arg1 = (switch_management_interface *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_interface_name_set(void * jarg1, char * jarg2) {
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->interface_name, (const char *)arg2);
+    } else {
+      arg1->interface_name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_directory_interface_interface_name_get(void * jarg1) {
+  char * jresult ;
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  result = (char *) ((arg1)->interface_name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_directory_open_set(void * jarg1, void * jarg2) {
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  switch_status_t (*arg2)(switch_directory_handle_t *,char *,char *,char *) = (switch_status_t (*)(switch_directory_handle_t *,char *,char *,char *)) 0 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_directory_handle_t *,char *,char *,char *))jarg2; 
+  if (arg1) (arg1)->directory_open = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_interface_directory_open_get(void * jarg1) {
+  void * jresult ;
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  switch_status_t (*result)(switch_directory_handle_t *,char *,char *,char *) = 0 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_directory_handle_t *,char *,char *,char *)) ((arg1)->directory_open);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_directory_close_set(void * jarg1, void * jarg2) {
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  switch_status_t (*arg2)(switch_directory_handle_t *) = (switch_status_t (*)(switch_directory_handle_t *)) 0 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_directory_handle_t *))jarg2; 
+  if (arg1) (arg1)->directory_close = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_interface_directory_close_get(void * jarg1) {
+  void * jresult ;
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  switch_status_t (*result)(switch_directory_handle_t *) = 0 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_directory_handle_t *)) ((arg1)->directory_close);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_directory_query_set(void * jarg1, void * jarg2) {
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  switch_status_t (*arg2)(switch_directory_handle_t *,char *,char *) = (switch_status_t (*)(switch_directory_handle_t *,char *,char *)) 0 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_directory_handle_t *,char *,char *))jarg2; 
+  if (arg1) (arg1)->directory_query = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_interface_directory_query_get(void * jarg1) {
+  void * jresult ;
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  switch_status_t (*result)(switch_directory_handle_t *,char *,char *) = 0 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_directory_handle_t *,char *,char *)) ((arg1)->directory_query);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_directory_next_set(void * jarg1, void * jarg2) {
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  switch_status_t (*arg2)(switch_directory_handle_t *) = (switch_status_t (*)(switch_directory_handle_t *)) 0 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_directory_handle_t *))jarg2; 
+  if (arg1) (arg1)->directory_next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_interface_directory_next_get(void * jarg1) {
+  void * jresult ;
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  switch_status_t (*result)(switch_directory_handle_t *) = 0 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_directory_handle_t *)) ((arg1)->directory_next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_directory_next_pair_set(void * jarg1, void * jarg2) {
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  switch_status_t (*arg2)(switch_directory_handle_t *,char **,char **) = (switch_status_t (*)(switch_directory_handle_t *,char **,char **)) 0 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  arg2 = (switch_status_t (*)(switch_directory_handle_t *,char **,char **))jarg2; 
+  if (arg1) (arg1)->directory_next_pair = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_interface_directory_next_pair_get(void * jarg1) {
+  void * jresult ;
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  switch_status_t (*result)(switch_directory_handle_t *,char **,char **) = 0 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  result = (switch_status_t (*)(switch_directory_handle_t *,char **,char **)) ((arg1)->directory_next_pair);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_rwlock_set(void * jarg1, void * jarg2) {
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  arg2 = (switch_thread_rwlock_t *)jarg2; 
+  if (arg1) (arg1)->rwlock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_interface_rwlock_get(void * jarg1) {
+  void * jresult ;
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  switch_thread_rwlock_t *result = 0 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_refs_set(void * jarg1, int jarg2) {
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->refs = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_directory_interface_refs_get(void * jarg1) {
+  int jresult ;
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  int result;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  result = (int) ((arg1)->refs);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_reflock_set(void * jarg1, void * jarg2) {
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  arg2 = (switch_mutex_t *)jarg2; 
+  if (arg1) (arg1)->reflock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_interface_reflock_get(void * jarg1) {
+  void * jresult ;
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  switch_mutex_t *result = 0 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  result = (switch_mutex_t *) ((arg1)->reflock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_parent_set(void * jarg1, void * jarg2) {
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  arg2 = (switch_loadable_module_interface_t *)jarg2; 
+  if (arg1) (arg1)->parent = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_interface_parent_get(void * jarg1) {
+  void * jresult ;
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  switch_loadable_module_interface_t *result = 0 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_interface_next_set(void * jarg1, void * jarg2) {
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  switch_directory_interface *arg2 = (switch_directory_interface *) 0 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  arg2 = (switch_directory_interface *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_interface_next_get(void * jarg1) {
+  void * jresult ;
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  switch_directory_interface *result = 0 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  result = (switch_directory_interface *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_directory_interface() {
+  void * jresult ;
+  switch_directory_interface *result = 0 ;
+  
+  result = (switch_directory_interface *)new switch_directory_interface();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_directory_interface(void * jarg1) {
+  switch_directory_interface *arg1 = (switch_directory_interface *) 0 ;
+  
+  arg1 = (switch_directory_interface *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_handle_directory_interface_set(void * jarg1, void * jarg2) {
+  switch_directory_handle *arg1 = (switch_directory_handle *) 0 ;
+  switch_directory_interface_t *arg2 = (switch_directory_interface_t *) 0 ;
+  
+  arg1 = (switch_directory_handle *)jarg1; 
+  arg2 = (switch_directory_interface_t *)jarg2; 
+  if (arg1) (arg1)->directory_interface = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_handle_directory_interface_get(void * jarg1) {
+  void * jresult ;
+  switch_directory_handle *arg1 = (switch_directory_handle *) 0 ;
+  switch_directory_interface_t *result = 0 ;
+  
+  arg1 = (switch_directory_handle *)jarg1; 
+  result = (switch_directory_interface_t *) ((arg1)->directory_interface);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_handle_flags_set(void * jarg1, unsigned long jarg2) {
+  switch_directory_handle *arg1 = (switch_directory_handle *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_directory_handle *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->flags = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_directory_handle_flags_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_directory_handle *arg1 = (switch_directory_handle *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_directory_handle *)jarg1; 
+  result = (uint32_t) ((arg1)->flags);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_handle_memory_pool_set(void * jarg1, void * jarg2) {
+  switch_directory_handle *arg1 = (switch_directory_handle *) 0 ;
+  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
+  
+  arg1 = (switch_directory_handle *)jarg1; 
+  arg2 = (switch_memory_pool_t *)jarg2; 
+  if (arg1) (arg1)->memory_pool = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_handle_memory_pool_get(void * jarg1) {
+  void * jresult ;
+  switch_directory_handle *arg1 = (switch_directory_handle *) 0 ;
+  switch_memory_pool_t *result = 0 ;
+  
+  arg1 = (switch_directory_handle *)jarg1; 
+  result = (switch_memory_pool_t *) ((arg1)->memory_pool);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_directory_handle_private_info_set(void * jarg1, void * jarg2) {
+  switch_directory_handle *arg1 = (switch_directory_handle *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_directory_handle *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->private_info = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_directory_handle_private_info_get(void * jarg1) {
+  void * jresult ;
+  switch_directory_handle *arg1 = (switch_directory_handle *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_directory_handle *)jarg1; 
+  result = (void *) ((arg1)->private_info);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_directory_handle() {
+  void * jresult ;
+  switch_directory_handle *result = 0 ;
+  
+  result = (switch_directory_handle *)new switch_directory_handle();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_directory_handle(void * jarg1) {
+  switch_directory_handle *arg1 = (switch_directory_handle *) 0 ;
+  
+  arg1 = (switch_directory_handle *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_quality_set(void * jarg1, int jarg2) {
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->quality = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_quality_get(void * jarg1) {
+  int jresult ;
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int result;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  result = (int) ((arg1)->quality);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_complexity_set(void * jarg1, int jarg2) {
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->complexity = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_complexity_get(void * jarg1) {
+  int jresult ;
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int result;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  result = (int) ((arg1)->complexity);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_enhancement_set(void * jarg1, int jarg2) {
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->enhancement = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_enhancement_get(void * jarg1) {
+  int jresult ;
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int result;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  result = (int) ((arg1)->enhancement);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_vad_set(void * jarg1, int jarg2) {
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->vad = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_vad_get(void * jarg1) {
+  int jresult ;
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int result;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  result = (int) ((arg1)->vad);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_vbr_set(void * jarg1, int jarg2) {
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->vbr = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_vbr_get(void * jarg1) {
+  int jresult ;
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int result;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  result = (int) ((arg1)->vbr);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_vbr_quality_set(void * jarg1, float jarg2) {
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  float arg2 ;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  arg2 = (float)jarg2; 
+  if (arg1) (arg1)->vbr_quality = arg2;
+  
+}
+
+
+SWIGEXPORT float SWIGSTDCALL CSharp_switch_codec_settings_vbr_quality_get(void * jarg1) {
+  float jresult ;
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  float result;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  result = (float) ((arg1)->vbr_quality);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_abr_set(void * jarg1, int jarg2) {
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->abr = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_abr_get(void * jarg1) {
+  int jresult ;
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int result;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  result = (int) ((arg1)->abr);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_dtx_set(void * jarg1, int jarg2) {
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->dtx = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_dtx_get(void * jarg1) {
+  int jresult ;
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int result;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  result = (int) ((arg1)->dtx);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_preproc_set(void * jarg1, int jarg2) {
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->preproc = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_preproc_get(void * jarg1) {
+  int jresult ;
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int result;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  result = (int) ((arg1)->preproc);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_vad_set(void * jarg1, int jarg2) {
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->pp_vad = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_pp_vad_get(void * jarg1) {
+  int jresult ;
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int result;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  result = (int) ((arg1)->pp_vad);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_agc_set(void * jarg1, int jarg2) {
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->pp_agc = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_pp_agc_get(void * jarg1) {
+  int jresult ;
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int result;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  result = (int) ((arg1)->pp_agc);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_agc_level_set(void * jarg1, float jarg2) {
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  float arg2 ;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  arg2 = (float)jarg2; 
+  if (arg1) (arg1)->pp_agc_level = arg2;
+  
+}
+
+
+SWIGEXPORT float SWIGSTDCALL CSharp_switch_codec_settings_pp_agc_level_get(void * jarg1) {
+  float jresult ;
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  float result;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  result = (float) ((arg1)->pp_agc_level);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_denoise_set(void * jarg1, int jarg2) {
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->pp_denoise = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_pp_denoise_get(void * jarg1) {
+  int jresult ;
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int result;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  result = (int) ((arg1)->pp_denoise);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_set(void * jarg1, int jarg2) {
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->pp_dereverb = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_get(void * jarg1) {
+  int jresult ;
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  int result;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  result = (int) ((arg1)->pp_dereverb);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_decay_set(void * jarg1, float jarg2) {
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  float arg2 ;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  arg2 = (float)jarg2; 
+  if (arg1) (arg1)->pp_dereverb_decay = arg2;
+  
+}
+
+
+SWIGEXPORT float SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_decay_get(void * jarg1) {
+  float jresult ;
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  float result;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  result = (float) ((arg1)->pp_dereverb_decay);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_level_set(void * jarg1, float jarg2) {
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  float arg2 ;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  arg2 = (float)jarg2; 
+  if (arg1) (arg1)->pp_dereverb_level = arg2;
+  
+}
+
+
+SWIGEXPORT float SWIGSTDCALL CSharp_switch_codec_settings_pp_dereverb_level_get(void * jarg1) {
+  float jresult ;
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  float result;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  result = (float) ((arg1)->pp_dereverb_level);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_codec_settings() {
+  void * jresult ;
+  switch_codec_settings *result = 0 ;
+  
+  result = (switch_codec_settings *)new switch_codec_settings();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_codec_settings(void * jarg1) {
+  switch_codec_settings *arg1 = (switch_codec_settings *) 0 ;
+  
+  arg1 = (switch_codec_settings *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_codec_interface_set(void * jarg1, void * jarg2) {
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  switch_codec_interface_t *arg2 = (switch_codec_interface_t *) 0 ;
+  
+  arg1 = (switch_codec *)jarg1; 
+  arg2 = (switch_codec_interface_t *)jarg2; 
+  if (arg1) (arg1)->codec_interface = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_codec_interface_get(void * jarg1) {
+  void * jresult ;
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  switch_codec_interface_t *result = 0 ;
+  
+  arg1 = (switch_codec *)jarg1; 
+  result = (switch_codec_interface_t *) ((arg1)->codec_interface);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_set(void * jarg1, void * jarg2) {
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
+  
+  arg1 = (switch_codec *)jarg1; 
+  arg2 = (switch_codec_implementation_t *)jarg2; 
+  if (arg1) (arg1)->implementation = (switch_codec_implementation_t const *)arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_implementation_get(void * jarg1) {
+  void * jresult ;
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  switch_codec_implementation_t *result = 0 ;
+  
+  arg1 = (switch_codec *)jarg1; 
+  result = (switch_codec_implementation_t *) ((arg1)->implementation);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_fmtp_in_set(void * jarg1, char * jarg2) {
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_codec *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->fmtp_in) delete [] arg1->fmtp_in;
+    if (arg2) {
+      arg1->fmtp_in = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->fmtp_in, (const char *)arg2);
+    } else {
+      arg1->fmtp_in = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_codec_fmtp_in_get(void * jarg1) {
+  char * jresult ;
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_codec *)jarg1; 
+  result = (char *) ((arg1)->fmtp_in);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_fmtp_out_set(void * jarg1, char * jarg2) {
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_codec *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->fmtp_out) delete [] arg1->fmtp_out;
+    if (arg2) {
+      arg1->fmtp_out = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->fmtp_out, (const char *)arg2);
+    } else {
+      arg1->fmtp_out = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_codec_fmtp_out_get(void * jarg1) {
+  char * jresult ;
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_codec *)jarg1; 
+  result = (char *) ((arg1)->fmtp_out);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_codec_settings_set(void * jarg1, void * jarg2) {
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  switch_codec_settings_t *arg2 = (switch_codec_settings_t *) 0 ;
+  
+  arg1 = (switch_codec *)jarg1; 
+  arg2 = (switch_codec_settings_t *)jarg2; 
+  if (arg1) (arg1)->codec_settings = *arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_codec_settings_get(void * jarg1) {
+  void * jresult ;
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  switch_codec_settings_t *result = 0 ;
+  
+  arg1 = (switch_codec *)jarg1; 
+  result = (switch_codec_settings_t *)& ((arg1)->codec_settings);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_flags_set(void * jarg1, unsigned long jarg2) {
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_codec *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->flags = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_codec_flags_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_codec *)jarg1; 
+  result = (uint32_t) ((arg1)->flags);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_memory_pool_set(void * jarg1, void * jarg2) {
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
+  
+  arg1 = (switch_codec *)jarg1; 
+  arg2 = (switch_memory_pool_t *)jarg2; 
+  if (arg1) (arg1)->memory_pool = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_memory_pool_get(void * jarg1) {
+  void * jresult ;
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  switch_memory_pool_t *result = 0 ;
+  
+  arg1 = (switch_codec *)jarg1; 
+  result = (switch_memory_pool_t *) ((arg1)->memory_pool);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_private_info_set(void * jarg1, void * jarg2) {
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_codec *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->private_info = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_private_info_get(void * jarg1) {
+  void * jresult ;
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_codec *)jarg1; 
+  result = (void *) ((arg1)->private_info);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_agreed_pt_set(void * jarg1, unsigned char jarg2) {
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  switch_payload_t arg2 ;
+  
+  arg1 = (switch_codec *)jarg1; 
+  arg2 = (switch_payload_t)jarg2; 
+  if (arg1) (arg1)->agreed_pt = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_codec_agreed_pt_get(void * jarg1) {
+  unsigned char jresult ;
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  switch_payload_t result;
+  
+  arg1 = (switch_codec *)jarg1; 
+  result = (switch_payload_t) ((arg1)->agreed_pt);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_mutex_set(void * jarg1, void * jarg2) {
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
+  
+  arg1 = (switch_codec *)jarg1; 
+  arg2 = (switch_mutex_t *)jarg2; 
+  if (arg1) (arg1)->mutex = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_mutex_get(void * jarg1) {
+  void * jresult ;
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  switch_mutex_t *result = 0 ;
+  
+  arg1 = (switch_codec *)jarg1; 
+  result = (switch_mutex_t *) ((arg1)->mutex);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_next_set(void * jarg1, void * jarg2) {
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  switch_codec *arg2 = (switch_codec *) 0 ;
+  
+  arg1 = (switch_codec *)jarg1; 
+  arg2 = (switch_codec *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_next_get(void * jarg1) {
+  void * jresult ;
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  switch_codec *result = 0 ;
+  
+  arg1 = (switch_codec *)jarg1; 
+  result = (switch_codec *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_codec() {
+  void * jresult ;
+  switch_codec *result = 0 ;
+  
+  result = (switch_codec *)new switch_codec();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_codec(void * jarg1) {
+  switch_codec *arg1 = (switch_codec *) 0 ;
+  
+  arg1 = (switch_codec *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_codec_type_set(void * jarg1, int jarg2) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  switch_codec_type_t arg2 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  arg2 = (switch_codec_type_t)jarg2; 
+  if (arg1) (arg1)->codec_type = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_implementation_codec_type_get(void * jarg1) {
+  int jresult ;
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  switch_codec_type_t result;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  result = (switch_codec_type_t) ((arg1)->codec_type);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_ianacode_set(void * jarg1, unsigned char jarg2) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  switch_payload_t arg2 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  arg2 = (switch_payload_t)jarg2; 
+  if (arg1) (arg1)->ianacode = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_codec_implementation_ianacode_get(void * jarg1) {
+  unsigned char jresult ;
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  switch_payload_t result;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  result = (switch_payload_t) ((arg1)->ianacode);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_iananame_set(void * jarg1, char * jarg2) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->iananame) delete [] arg1->iananame;
+    if (arg2) {
+      arg1->iananame = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->iananame, (const char *)arg2);
+    } else {
+      arg1->iananame = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_codec_implementation_iananame_get(void * jarg1) {
+  char * jresult ;
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  result = (char *) ((arg1)->iananame);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_fmtp_set(void * jarg1, char * jarg2) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->fmtp) delete [] arg1->fmtp;
+    if (arg2) {
+      arg1->fmtp = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->fmtp, (const char *)arg2);
+    } else {
+      arg1->fmtp = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_codec_implementation_fmtp_get(void * jarg1) {
+  char * jresult ;
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  result = (char *) ((arg1)->fmtp);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_samples_per_second_set(void * jarg1, unsigned long jarg2) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->samples_per_second = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_codec_implementation_samples_per_second_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  result = (uint32_t) ((arg1)->samples_per_second);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_actual_samples_per_second_set(void * jarg1, unsigned long jarg2) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->actual_samples_per_second = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_codec_implementation_actual_samples_per_second_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  result = (uint32_t) ((arg1)->actual_samples_per_second);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_bits_per_second_set(void * jarg1, int jarg2) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->bits_per_second = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_implementation_bits_per_second_get(void * jarg1) {
+  int jresult ;
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  int result;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  result = (int) ((arg1)->bits_per_second);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_microseconds_per_packet_set(void * jarg1, int jarg2) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->microseconds_per_packet = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_implementation_microseconds_per_packet_get(void * jarg1) {
+  int jresult ;
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  int result;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  result = (int) ((arg1)->microseconds_per_packet);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_samples_per_packet_set(void * jarg1, unsigned long jarg2) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->samples_per_packet = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_codec_implementation_samples_per_packet_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  result = (uint32_t) ((arg1)->samples_per_packet);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_decoded_bytes_per_packet_set(void * jarg1, unsigned long jarg2) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->decoded_bytes_per_packet = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_codec_implementation_decoded_bytes_per_packet_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  result = (uint32_t) ((arg1)->decoded_bytes_per_packet);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_encoded_bytes_per_packet_set(void * jarg1, unsigned long jarg2) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->encoded_bytes_per_packet = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_codec_implementation_encoded_bytes_per_packet_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  result = (uint32_t) ((arg1)->encoded_bytes_per_packet);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_number_of_channels_set(void * jarg1, unsigned char jarg2) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  uint8_t arg2 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  arg2 = (uint8_t)jarg2; 
+  if (arg1) (arg1)->number_of_channels = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_codec_implementation_number_of_channels_get(void * jarg1) {
+  unsigned char jresult ;
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  uint8_t result;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  result = (uint8_t) ((arg1)->number_of_channels);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_codec_frames_per_packet_set(void * jarg1, int jarg2) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->codec_frames_per_packet = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_implementation_codec_frames_per_packet_get(void * jarg1) {
+  int jresult ;
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  int result;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  result = (int) ((arg1)->codec_frames_per_packet);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_init_set(void * jarg1, void * jarg2) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  switch_core_codec_init_func_t arg2 = (switch_core_codec_init_func_t) 0 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  arg2 = (switch_core_codec_init_func_t)jarg2; 
+  if (arg1) (arg1)->init = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_implementation_init_get(void * jarg1) {
+  void * jresult ;
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  switch_core_codec_init_func_t result;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  result = (switch_core_codec_init_func_t) ((arg1)->init);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_encode_set(void * jarg1, void * jarg2) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  switch_core_codec_encode_func_t arg2 = (switch_core_codec_encode_func_t) 0 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  arg2 = (switch_core_codec_encode_func_t)jarg2; 
+  if (arg1) (arg1)->encode = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_implementation_encode_get(void * jarg1) {
+  void * jresult ;
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  switch_core_codec_encode_func_t result;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  result = (switch_core_codec_encode_func_t) ((arg1)->encode);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_decode_set(void * jarg1, void * jarg2) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  switch_core_codec_decode_func_t arg2 = (switch_core_codec_decode_func_t) 0 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  arg2 = (switch_core_codec_decode_func_t)jarg2; 
+  if (arg1) (arg1)->decode = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_implementation_decode_get(void * jarg1) {
+  void * jresult ;
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  switch_core_codec_decode_func_t result;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  result = (switch_core_codec_decode_func_t) ((arg1)->decode);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_destroy_set(void * jarg1, void * jarg2) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  switch_core_codec_destroy_func_t arg2 = (switch_core_codec_destroy_func_t) 0 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  arg2 = (switch_core_codec_destroy_func_t)jarg2; 
+  if (arg1) (arg1)->destroy = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_implementation_destroy_get(void * jarg1) {
+  void * jresult ;
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  switch_core_codec_destroy_func_t result;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  result = (switch_core_codec_destroy_func_t) ((arg1)->destroy);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_codec_id_set(void * jarg1, unsigned long jarg2) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->codec_id = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_codec_implementation_codec_id_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  result = (uint32_t) ((arg1)->codec_id);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_impl_id_set(void * jarg1, unsigned long jarg2) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->impl_id = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_codec_implementation_impl_id_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  result = (uint32_t) ((arg1)->impl_id);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_implementation_next_set(void * jarg1, void * jarg2) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  switch_codec_implementation *arg2 = (switch_codec_implementation *) 0 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  arg2 = (switch_codec_implementation *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_implementation_next_get(void * jarg1) {
+  void * jresult ;
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  switch_codec_implementation *result = 0 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  result = (switch_codec_implementation *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_codec_implementation() {
+  void * jresult ;
+  switch_codec_implementation *result = 0 ;
+  
+  result = (switch_codec_implementation *)new switch_codec_implementation();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_codec_implementation(void * jarg1) {
+  switch_codec_implementation *arg1 = (switch_codec_implementation *) 0 ;
+  
+  arg1 = (switch_codec_implementation *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_interface_interface_name_set(void * jarg1, char * jarg2) {
+  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_codec_interface *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->interface_name, (const char *)arg2);
+    } else {
+      arg1->interface_name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_codec_interface_interface_name_get(void * jarg1) {
+  char * jresult ;
+  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_codec_interface *)jarg1; 
+  result = (char *) ((arg1)->interface_name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_interface_implementations_set(void * jarg1, void * jarg2) {
+  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
+  switch_codec_implementation_t *arg2 = (switch_codec_implementation_t *) 0 ;
+  
+  arg1 = (switch_codec_interface *)jarg1; 
+  arg2 = (switch_codec_implementation_t *)jarg2; 
+  if (arg1) (arg1)->implementations = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_interface_implementations_get(void * jarg1) {
+  void * jresult ;
+  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
+  switch_codec_implementation_t *result = 0 ;
+  
+  arg1 = (switch_codec_interface *)jarg1; 
+  result = (switch_codec_implementation_t *) ((arg1)->implementations);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_interface_codec_id_set(void * jarg1, unsigned long jarg2) {
+  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_codec_interface *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->codec_id = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_codec_interface_codec_id_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_codec_interface *)jarg1; 
+  result = (uint32_t) ((arg1)->codec_id);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_interface_rwlock_set(void * jarg1, void * jarg2) {
+  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
+  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
+  
+  arg1 = (switch_codec_interface *)jarg1; 
+  arg2 = (switch_thread_rwlock_t *)jarg2; 
+  if (arg1) (arg1)->rwlock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_interface_rwlock_get(void * jarg1) {
+  void * jresult ;
+  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
+  switch_thread_rwlock_t *result = 0 ;
+  
+  arg1 = (switch_codec_interface *)jarg1; 
+  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_interface_refs_set(void * jarg1, int jarg2) {
+  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_codec_interface *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->refs = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_codec_interface_refs_get(void * jarg1) {
+  int jresult ;
+  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
+  int result;
+  
+  arg1 = (switch_codec_interface *)jarg1; 
+  result = (int) ((arg1)->refs);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_interface_reflock_set(void * jarg1, void * jarg2) {
+  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
+  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
+  
+  arg1 = (switch_codec_interface *)jarg1; 
+  arg2 = (switch_mutex_t *)jarg2; 
+  if (arg1) (arg1)->reflock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_interface_reflock_get(void * jarg1) {
+  void * jresult ;
+  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
+  switch_mutex_t *result = 0 ;
+  
+  arg1 = (switch_codec_interface *)jarg1; 
+  result = (switch_mutex_t *) ((arg1)->reflock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_interface_parent_set(void * jarg1, void * jarg2) {
+  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
+  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
+  
+  arg1 = (switch_codec_interface *)jarg1; 
+  arg2 = (switch_loadable_module_interface_t *)jarg2; 
+  if (arg1) (arg1)->parent = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_interface_parent_get(void * jarg1) {
+  void * jresult ;
+  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
+  switch_loadable_module_interface_t *result = 0 ;
+  
+  arg1 = (switch_codec_interface *)jarg1; 
+  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_codec_interface_next_set(void * jarg1, void * jarg2) {
+  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
+  switch_codec_interface *arg2 = (switch_codec_interface *) 0 ;
+  
+  arg1 = (switch_codec_interface *)jarg1; 
+  arg2 = (switch_codec_interface *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_codec_interface_next_get(void * jarg1) {
+  void * jresult ;
+  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
+  switch_codec_interface *result = 0 ;
+  
+  arg1 = (switch_codec_interface *)jarg1; 
+  result = (switch_codec_interface *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_codec_interface() {
+  void * jresult ;
+  switch_codec_interface *result = 0 ;
+  
+  result = (switch_codec_interface *)new switch_codec_interface();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_codec_interface(void * jarg1) {
+  switch_codec_interface *arg1 = (switch_codec_interface *) 0 ;
+  
+  arg1 = (switch_codec_interface *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_interface_name_set(void * jarg1, char * jarg2) {
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->interface_name, (const char *)arg2);
+    } else {
+      arg1->interface_name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_application_interface_interface_name_get(void * jarg1) {
+  char * jresult ;
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  result = (char *) ((arg1)->interface_name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_application_function_set(void * jarg1, void * jarg2) {
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  switch_application_function_t arg2 = (switch_application_function_t) 0 ;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  arg2 = (switch_application_function_t)jarg2; 
+  if (arg1) (arg1)->application_function = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_application_interface_application_function_get(void * jarg1) {
+  void * jresult ;
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  switch_application_function_t result;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  result = (switch_application_function_t) ((arg1)->application_function);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_long_desc_set(void * jarg1, char * jarg2) {
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->long_desc = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->long_desc, (const char *)arg2);
+    } else {
+      arg1->long_desc = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_application_interface_long_desc_get(void * jarg1) {
+  char * jresult ;
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  result = (char *) ((arg1)->long_desc);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_short_desc_set(void * jarg1, char * jarg2) {
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->short_desc = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->short_desc, (const char *)arg2);
+    } else {
+      arg1->short_desc = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_application_interface_short_desc_get(void * jarg1) {
+  char * jresult ;
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  result = (char *) ((arg1)->short_desc);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_syntax_set(void * jarg1, char * jarg2) {
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->syntax = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->syntax, (const char *)arg2);
+    } else {
+      arg1->syntax = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_application_interface_syntax_get(void * jarg1) {
+  char * jresult ;
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  result = (char *) ((arg1)->syntax);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_flags_set(void * jarg1, unsigned long jarg2) {
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->flags = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_application_interface_flags_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  result = (uint32_t) ((arg1)->flags);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_rwlock_set(void * jarg1, void * jarg2) {
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  arg2 = (switch_thread_rwlock_t *)jarg2; 
+  if (arg1) (arg1)->rwlock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_application_interface_rwlock_get(void * jarg1) {
+  void * jresult ;
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  switch_thread_rwlock_t *result = 0 ;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_refs_set(void * jarg1, int jarg2) {
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->refs = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_application_interface_refs_get(void * jarg1) {
+  int jresult ;
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  int result;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  result = (int) ((arg1)->refs);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_reflock_set(void * jarg1, void * jarg2) {
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  arg2 = (switch_mutex_t *)jarg2; 
+  if (arg1) (arg1)->reflock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_application_interface_reflock_get(void * jarg1) {
+  void * jresult ;
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  switch_mutex_t *result = 0 ;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  result = (switch_mutex_t *) ((arg1)->reflock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_parent_set(void * jarg1, void * jarg2) {
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  arg2 = (switch_loadable_module_interface_t *)jarg2; 
+  if (arg1) (arg1)->parent = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_application_interface_parent_get(void * jarg1) {
+  void * jresult ;
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  switch_loadable_module_interface_t *result = 0 ;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_application_interface_next_set(void * jarg1, void * jarg2) {
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  switch_application_interface *arg2 = (switch_application_interface *) 0 ;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  arg2 = (switch_application_interface *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_application_interface_next_get(void * jarg1) {
+  void * jresult ;
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  switch_application_interface *result = 0 ;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  result = (switch_application_interface *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_application_interface() {
+  void * jresult ;
+  switch_application_interface *result = 0 ;
+  
+  result = (switch_application_interface *)new switch_application_interface();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_application_interface(void * jarg1) {
+  switch_application_interface *arg1 = (switch_application_interface *) 0 ;
+  
+  arg1 = (switch_application_interface *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_api_interface_interface_name_set(void * jarg1, char * jarg2) {
+  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_api_interface *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->interface_name = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->interface_name, (const char *)arg2);
+    } else {
+      arg1->interface_name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_api_interface_interface_name_get(void * jarg1) {
+  char * jresult ;
+  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_api_interface *)jarg1; 
+  result = (char *) ((arg1)->interface_name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_api_interface_desc_set(void * jarg1, char * jarg2) {
+  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_api_interface *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->desc = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->desc, (const char *)arg2);
+    } else {
+      arg1->desc = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_api_interface_desc_get(void * jarg1) {
+  char * jresult ;
+  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_api_interface *)jarg1; 
+  result = (char *) ((arg1)->desc);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_api_interface_function_set(void * jarg1, void * jarg2) {
+  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
+  switch_api_function_t arg2 = (switch_api_function_t) 0 ;
+  
+  arg1 = (switch_api_interface *)jarg1; 
+  arg2 = (switch_api_function_t)jarg2; 
+  if (arg1) (arg1)->function = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_api_interface_function_get(void * jarg1) {
+  void * jresult ;
+  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
+  switch_api_function_t result;
+  
+  arg1 = (switch_api_interface *)jarg1; 
+  result = (switch_api_function_t) ((arg1)->function);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_api_interface_syntax_set(void * jarg1, char * jarg2) {
+  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_api_interface *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) {
+      arg1->syntax = (char const *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->syntax, (const char *)arg2);
+    } else {
+      arg1->syntax = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_api_interface_syntax_get(void * jarg1) {
+  char * jresult ;
+  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_api_interface *)jarg1; 
+  result = (char *) ((arg1)->syntax);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_api_interface_rwlock_set(void * jarg1, void * jarg2) {
+  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
+  switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ;
+  
+  arg1 = (switch_api_interface *)jarg1; 
+  arg2 = (switch_thread_rwlock_t *)jarg2; 
+  if (arg1) (arg1)->rwlock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_api_interface_rwlock_get(void * jarg1) {
+  void * jresult ;
+  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
+  switch_thread_rwlock_t *result = 0 ;
+  
+  arg1 = (switch_api_interface *)jarg1; 
+  result = (switch_thread_rwlock_t *) ((arg1)->rwlock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_api_interface_refs_set(void * jarg1, int jarg2) {
+  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_api_interface *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->refs = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_api_interface_refs_get(void * jarg1) {
+  int jresult ;
+  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
+  int result;
+  
+  arg1 = (switch_api_interface *)jarg1; 
+  result = (int) ((arg1)->refs);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_api_interface_reflock_set(void * jarg1, void * jarg2) {
+  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
+  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
+  
+  arg1 = (switch_api_interface *)jarg1; 
+  arg2 = (switch_mutex_t *)jarg2; 
+  if (arg1) (arg1)->reflock = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_api_interface_reflock_get(void * jarg1) {
+  void * jresult ;
+  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
+  switch_mutex_t *result = 0 ;
+  
+  arg1 = (switch_api_interface *)jarg1; 
+  result = (switch_mutex_t *) ((arg1)->reflock);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_api_interface_parent_set(void * jarg1, void * jarg2) {
+  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
+  switch_loadable_module_interface_t *arg2 = (switch_loadable_module_interface_t *) 0 ;
+  
+  arg1 = (switch_api_interface *)jarg1; 
+  arg2 = (switch_loadable_module_interface_t *)jarg2; 
+  if (arg1) (arg1)->parent = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_api_interface_parent_get(void * jarg1) {
+  void * jresult ;
+  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
+  switch_loadable_module_interface_t *result = 0 ;
+  
+  arg1 = (switch_api_interface *)jarg1; 
+  result = (switch_loadable_module_interface_t *) ((arg1)->parent);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_api_interface_next_set(void * jarg1, void * jarg2) {
+  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
+  switch_api_interface *arg2 = (switch_api_interface *) 0 ;
+  
+  arg1 = (switch_api_interface *)jarg1; 
+  arg2 = (switch_api_interface *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_api_interface_next_get(void * jarg1) {
+  void * jresult ;
+  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
+  switch_api_interface *result = 0 ;
+  
+  arg1 = (switch_api_interface *)jarg1; 
+  result = (switch_api_interface *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_api_interface() {
+  void * jresult ;
+  switch_api_interface *result = 0 ;
+  
+  result = (switch_api_interface *)new switch_api_interface();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_api_interface(void * jarg1) {
+  switch_api_interface *arg1 = (switch_api_interface *) 0 ;
+  
+  arg1 = (switch_api_interface *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_profile_created_set(void * jarg1, void * jarg2) {
+  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
+  switch_time_t arg2 ;
+  switch_time_t *argp2 ;
+  
+  arg1 = (switch_channel_timetable *)jarg1; 
+  argp2 = (switch_time_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->profile_created = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_timetable_profile_created_get(void * jarg1) {
+  void * jresult ;
+  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
+  switch_time_t result;
+  
+  arg1 = (switch_channel_timetable *)jarg1; 
+  result =  ((arg1)->profile_created);
+  jresult = new switch_time_t((switch_time_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_created_set(void * jarg1, void * jarg2) {
+  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
+  switch_time_t arg2 ;
+  switch_time_t *argp2 ;
+  
+  arg1 = (switch_channel_timetable *)jarg1; 
+  argp2 = (switch_time_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->created = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_timetable_created_get(void * jarg1) {
+  void * jresult ;
+  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
+  switch_time_t result;
+  
+  arg1 = (switch_channel_timetable *)jarg1; 
+  result =  ((arg1)->created);
+  jresult = new switch_time_t((switch_time_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_answered_set(void * jarg1, void * jarg2) {
+  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
+  switch_time_t arg2 ;
+  switch_time_t *argp2 ;
+  
+  arg1 = (switch_channel_timetable *)jarg1; 
+  argp2 = (switch_time_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->answered = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_timetable_answered_get(void * jarg1) {
+  void * jresult ;
+  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
+  switch_time_t result;
+  
+  arg1 = (switch_channel_timetable *)jarg1; 
+  result =  ((arg1)->answered);
+  jresult = new switch_time_t((switch_time_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_progress_set(void * jarg1, void * jarg2) {
+  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
+  switch_time_t arg2 ;
+  switch_time_t *argp2 ;
+  
+  arg1 = (switch_channel_timetable *)jarg1; 
+  argp2 = (switch_time_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->progress = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_timetable_progress_get(void * jarg1) {
+  void * jresult ;
+  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
+  switch_time_t result;
+  
+  arg1 = (switch_channel_timetable *)jarg1; 
+  result =  ((arg1)->progress);
+  jresult = new switch_time_t((switch_time_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_progress_media_set(void * jarg1, void * jarg2) {
+  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
+  switch_time_t arg2 ;
+  switch_time_t *argp2 ;
+  
+  arg1 = (switch_channel_timetable *)jarg1; 
+  argp2 = (switch_time_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->progress_media = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_timetable_progress_media_get(void * jarg1) {
+  void * jresult ;
+  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
+  switch_time_t result;
+  
+  arg1 = (switch_channel_timetable *)jarg1; 
+  result =  ((arg1)->progress_media);
+  jresult = new switch_time_t((switch_time_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_hungup_set(void * jarg1, void * jarg2) {
+  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
+  switch_time_t arg2 ;
+  switch_time_t *argp2 ;
+  
+  arg1 = (switch_channel_timetable *)jarg1; 
+  argp2 = (switch_time_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->hungup = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_timetable_hungup_get(void * jarg1) {
+  void * jresult ;
+  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
+  switch_time_t result;
+  
+  arg1 = (switch_channel_timetable *)jarg1; 
+  result =  ((arg1)->hungup);
+  jresult = new switch_time_t((switch_time_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_transferred_set(void * jarg1, void * jarg2) {
+  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
+  switch_time_t arg2 ;
+  switch_time_t *argp2 ;
+  
+  arg1 = (switch_channel_timetable *)jarg1; 
+  argp2 = (switch_time_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->transferred = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_timetable_transferred_get(void * jarg1) {
+  void * jresult ;
+  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
+  switch_time_t result;
+  
+  arg1 = (switch_channel_timetable *)jarg1; 
+  result =  ((arg1)->transferred);
+  jresult = new switch_time_t((switch_time_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_resurrected_set(void * jarg1, void * jarg2) {
+  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
+  switch_time_t arg2 ;
+  switch_time_t *argp2 ;
+  
+  arg1 = (switch_channel_timetable *)jarg1; 
+  argp2 = (switch_time_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->resurrected = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_timetable_resurrected_get(void * jarg1) {
+  void * jresult ;
+  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
+  switch_time_t result;
+  
+  arg1 = (switch_channel_timetable *)jarg1; 
+  result =  ((arg1)->resurrected);
+  jresult = new switch_time_t((switch_time_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_next_set(void * jarg1, void * jarg2) {
+  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
+  switch_channel_timetable *arg2 = (switch_channel_timetable *) 0 ;
+  
+  arg1 = (switch_channel_timetable *)jarg1; 
+  arg2 = (switch_channel_timetable *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_timetable_next_get(void * jarg1) {
+  void * jresult ;
+  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
+  switch_channel_timetable *result = 0 ;
+  
+  arg1 = (switch_channel_timetable *)jarg1; 
+  result = (switch_channel_timetable *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_channel_timetable() {
+  void * jresult ;
+  switch_channel_timetable *result = 0 ;
+  
+  result = (switch_channel_timetable *)new switch_channel_timetable();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_channel_timetable(void * jarg1) {
+  switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ;
+  
+  arg1 = (switch_channel_timetable *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_get_state(void * jarg1) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_state_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  result = (switch_channel_state_t)switch_channel_get_state(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_get_running_state(void * jarg1) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_state_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  result = (switch_channel_state_t)switch_channel_get_running_state(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_test_ready(void * jarg1, int jarg2, int jarg3) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_bool_t arg2 ;
+  switch_bool_t arg3 ;
+  int result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_bool_t)jarg2; 
+  arg3 = (switch_bool_t)jarg3; 
+  result = (int)switch_channel_test_ready(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_wait_for_state(void * jarg1, void * jarg2, int jarg3) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_t *arg2 = (switch_channel_t *) 0 ;
+  switch_channel_state_t arg3 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_channel_t *)jarg2; 
+  arg3 = (switch_channel_state_t)jarg3; 
+  switch_channel_wait_for_state(arg1,arg2,arg3);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_wait_for_state_timeout(void * jarg1, int jarg2, unsigned long jarg3) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_state_t arg2 ;
+  uint32_t arg3 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_channel_state_t)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  switch_channel_wait_for_state_timeout(arg1,arg2,arg3);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_wait_for_flag(void * jarg1, int jarg2, int jarg3, unsigned long jarg4, void * jarg5) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_flag_t arg2 ;
+  switch_bool_t arg3 ;
+  uint32_t arg4 ;
+  switch_channel_t *arg5 = (switch_channel_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_channel_flag_t)jarg2; 
+  arg3 = (switch_bool_t)jarg3; 
+  arg4 = (uint32_t)jarg4; 
+  arg5 = (switch_channel_t *)jarg5; 
+  result = (switch_status_t)switch_channel_wait_for_flag(arg1,arg2,arg3,arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_set_state(void * jarg1, char * jarg2, char * jarg3, int jarg4, int jarg5) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  switch_channel_state_t arg5 ;
+  switch_channel_state_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int)jarg4; 
+  arg5 = (switch_channel_state_t)jarg5; 
+  result = (switch_channel_state_t)switch_channel_perform_set_state(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_set_running_state(void * jarg1, int jarg2, char * jarg3, char * jarg4, int jarg5) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_state_t arg2 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  int arg5 ;
+  switch_channel_state_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_channel_state_t)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (int)jarg5; 
+  result = (switch_channel_state_t)switch_channel_perform_set_running_state(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_str2cause(char * jarg1) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_call_cause_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_call_cause_t)switch_channel_str2cause((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_get_cause(void * jarg1) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_call_cause_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  result = (switch_call_cause_t)switch_channel_get_cause(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_cause_q850(int jarg1) {
+  int jresult ;
+  switch_call_cause_t arg1 ;
+  switch_call_cause_t result;
+  
+  arg1 = (switch_call_cause_t)jarg1; 
+  result = (switch_call_cause_t)switch_channel_cause_q850(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_get_cause_q850(void * jarg1) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_call_cause_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  result = (switch_call_cause_t)switch_channel_get_cause_q850(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_cause2str(int jarg1) {
+  char * jresult ;
+  switch_call_cause_t arg1 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_call_cause_t)jarg1; 
+  result = (char *)switch_channel_cause2str(arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_timetable(void * jarg1) {
+  void * jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_timetable_t *result = 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  result = (switch_channel_timetable_t *)switch_channel_get_timetable(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_alloc(void * jarg1, int jarg2, void * jarg3) {
+  int jresult ;
+  switch_channel_t **arg1 = (switch_channel_t **) 0 ;
+  switch_call_direction_t arg2 ;
+  switch_memory_pool_t *arg3 = (switch_memory_pool_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t **)jarg1; 
+  arg2 = (switch_call_direction_t)jarg2; 
+  arg3 = (switch_memory_pool_t *)jarg3; 
+  result = (switch_status_t)switch_channel_alloc(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_init(void * jarg1, void * jarg2, int jarg3, int jarg4) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
+  switch_channel_state_t arg3 ;
+  switch_channel_flag_t arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_core_session_t *)jarg2; 
+  arg3 = (switch_channel_state_t)jarg3; 
+  arg4 = (switch_channel_flag_t)jarg4; 
+  result = (switch_status_t)switch_channel_init(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_presence(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  switch_channel_presence(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_uninit(void * jarg1) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  switch_channel_uninit(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_caller_profile(void * jarg1, void * jarg2) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_caller_profile_t *arg2 = (switch_caller_profile_t *) 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_caller_profile_t *)jarg2; 
+  switch_channel_set_caller_profile(arg1,arg2);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_caller_profile(void * jarg1) {
+  void * jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_caller_profile_t *result = 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  result = (switch_caller_profile_t *)switch_channel_get_caller_profile(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_originator_caller_profile(void * jarg1, void * jarg2) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_caller_profile_t *arg2 = (switch_caller_profile_t *) 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_caller_profile_t *)jarg2; 
+  switch_channel_set_originator_caller_profile(arg1,arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_hunt_caller_profile(void * jarg1, void * jarg2) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_caller_profile_t *arg2 = (switch_caller_profile_t *) 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_caller_profile_t *)jarg2; 
+  switch_channel_set_hunt_caller_profile(arg1,arg2);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_originator_caller_profile(void * jarg1) {
+  void * jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_caller_profile_t *result = 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  result = (switch_caller_profile_t *)switch_channel_get_originator_caller_profile(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_originatee_caller_profile(void * jarg1, void * jarg2) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_caller_profile_t *arg2 = (switch_caller_profile_t *) 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_caller_profile_t *)jarg2; 
+  switch_channel_set_originatee_caller_profile(arg1,arg2);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_originatee_caller_profile(void * jarg1) {
+  void * jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_caller_profile_t *result = 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  result = (switch_caller_profile_t *)switch_channel_get_originatee_caller_profile(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_uuid(void * jarg1) {
+  char * jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  result = (char *)switch_channel_get_uuid(arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_profile_var(void * jarg1, char * jarg2, char * jarg3) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (switch_status_t)switch_channel_set_profile_var(arg1,(char const *)arg2,(char const *)arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_variable_var_check(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  switch_bool_t arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (switch_bool_t)jarg4; 
+  result = (switch_status_t)switch_channel_set_variable_var_check(arg1,(char const *)arg2,(char const *)arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_variable_printf(void * jarg1, char * jarg2, char * jarg3) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  void *arg4 = 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (switch_status_t)switch_channel_set_variable_printf(arg1,(char const *)arg2,(char const *)arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_variable_name_printf(void * jarg1, char * jarg2, char * jarg3) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  void *arg4 = 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (switch_status_t)switch_channel_set_variable_name_printf(arg1,(char const *)arg2,(char const *)arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_variable_partner_var_check(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  switch_bool_t arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (switch_bool_t)jarg4; 
+  result = (switch_status_t)switch_channel_set_variable_partner_var_check(arg1,(char const *)arg2,(char const *)arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_variable_partner(void * jarg1, char * jarg2) {
+  char * jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (char *)switch_channel_get_variable_partner(arg1,(char const *)arg2);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_variable_dup(void * jarg1, char * jarg2, int jarg3) {
+  char * jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_bool_t arg3 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_bool_t)jarg3; 
+  result = (char *)switch_channel_get_variable_dup(arg1,(char const *)arg2,arg3);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_get_variables(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_event_t **arg2 = (switch_event_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_event_t **)jarg2; 
+  result = (switch_status_t)switch_channel_get_variables(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_pass_callee_id(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_t *arg2 = (switch_channel_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_channel_t *)jarg2; 
+  result = (switch_status_t)switch_channel_pass_callee_id(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_variable_first(void * jarg1) {
+  void * jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_event_header_t *result = 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  result = (switch_event_header_t *)switch_channel_variable_first(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_variable_last(void * jarg1) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  switch_channel_variable_last(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_restart(void * jarg1) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  switch_channel_restart(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_caller_extension_masquerade(void * jarg1, void * jarg2, unsigned long jarg3) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_t *arg2 = (switch_channel_t *) 0 ;
+  uint32_t arg3 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_channel_t *)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  result = (switch_status_t)switch_channel_caller_extension_masquerade(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_caller_extension(void * jarg1, void * jarg2) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_caller_extension_t *arg2 = (switch_caller_extension_t *) 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_caller_extension_t *)jarg2; 
+  switch_channel_set_caller_extension(arg1,arg2);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_caller_extension(void * jarg1) {
+  void * jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_caller_extension_t *result = 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  result = (switch_caller_extension_t *)switch_channel_get_caller_extension(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_channel_test_flag(void * jarg1, int jarg2) {
+  unsigned long jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_flag_t arg2 ;
+  uint32_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_channel_flag_t)jarg2; 
+  result = (uint32_t)switch_channel_test_flag(arg1,arg2);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_flag_value(void * jarg1, int jarg2, unsigned long jarg3) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_flag_t arg2 ;
+  uint32_t arg3 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_channel_flag_t)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  switch_channel_set_flag_value(arg1,arg2,arg3);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_flag_recursive(void * jarg1, int jarg2) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_flag_t arg2 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_channel_flag_t)jarg2; 
+  switch_channel_set_flag_recursive(arg1,arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_cap_value(void * jarg1, int jarg2, unsigned long jarg3) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_cap_t arg2 ;
+  uint32_t arg3 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_channel_cap_t)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  switch_channel_set_cap_value(arg1,arg2,arg3);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_clear_cap(void * jarg1, int jarg2) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_cap_t arg2 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_channel_cap_t)jarg2; 
+  switch_channel_clear_cap(arg1,arg2);
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_channel_test_cap(void * jarg1, int jarg2) {
+  unsigned long jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_cap_t arg2 ;
+  uint32_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_channel_cap_t)jarg2; 
+  result = (uint32_t)switch_channel_test_cap(arg1,arg2);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_flag_partner(void * jarg1, int jarg2) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_flag_t arg2 ;
+  switch_bool_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_channel_flag_t)jarg2; 
+  result = (switch_bool_t)switch_channel_set_flag_partner(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_clear_flag_partner(void * jarg1, int jarg2) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_flag_t arg2 ;
+  switch_bool_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_channel_flag_t)jarg2; 
+  result = (switch_bool_t)switch_channel_clear_flag_partner(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_channel_test_flag_partner(void * jarg1, int jarg2) {
+  unsigned long jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_flag_t arg2 ;
+  uint32_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_channel_flag_t)jarg2; 
+  result = (uint32_t)switch_channel_test_flag_partner(arg1,arg2);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_state_flag(void * jarg1, int jarg2) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_flag_t arg2 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_channel_flag_t)jarg2; 
+  switch_channel_set_state_flag(arg1,arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_clear_flag(void * jarg1, int jarg2) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_flag_t arg2 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_channel_flag_t)jarg2; 
+  switch_channel_clear_flag(arg1,arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_clear_flag_recursive(void * jarg1, int jarg2) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_channel_flag_t arg2 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_channel_flag_t)jarg2; 
+  switch_channel_clear_flag_recursive(arg1,arg2);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_answer(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int)jarg4; 
+  result = (switch_status_t)switch_channel_perform_answer(arg1,(char const *)arg2,(char const *)arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_mark_answered(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int)jarg4; 
+  result = (switch_status_t)switch_channel_perform_mark_answered(arg1,(char const *)arg2,(char const *)arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_ring_ready(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int)jarg4; 
+  result = (switch_status_t)switch_channel_perform_ring_ready(arg1,(char const *)arg2,(char const *)arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_pre_answer(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int)jarg4; 
+  result = (switch_status_t)switch_channel_perform_pre_answer(arg1,(char const *)arg2,(char const *)arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_mark_pre_answered(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int)jarg4; 
+  result = (switch_status_t)switch_channel_perform_mark_pre_answered(arg1,(char const *)arg2,(char const *)arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_mark_ring_ready(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int)jarg4; 
+  result = (switch_status_t)switch_channel_perform_mark_ring_ready(arg1,(char const *)arg2,(char const *)arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_add_state_handler(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_state_handler_table_t *arg2 = (switch_state_handler_table_t *) 0 ;
+  int result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_state_handler_table_t *)jarg2; 
+  result = (int)switch_channel_add_state_handler(arg1,(switch_state_handler_table const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_clear_state_handler(void * jarg1, void * jarg2) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_state_handler_table_t *arg2 = (switch_state_handler_table_t *) 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_state_handler_table_t *)jarg2; 
+  switch_channel_clear_state_handler(arg1,(switch_state_handler_table const *)arg2);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_state_handler(void * jarg1, int jarg2) {
+  void * jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  int arg2 ;
+  switch_state_handler_table_t *result = 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (int)jarg2; 
+  result = (switch_state_handler_table_t *)switch_channel_get_state_handler(arg1,arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_private(void * jarg1, char * jarg2, void * jarg3) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *arg3 = (void *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (void *)jarg3; 
+  result = (switch_status_t)switch_channel_set_private(arg1,(char const *)arg2,(void const *)arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_private(void * jarg1, char * jarg2) {
+  void * jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (void *)switch_channel_get_private(arg1,(char const *)arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_private_partner(void * jarg1, char * jarg2) {
+  void * jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (void *)switch_channel_get_private_partner(arg1,(char const *)arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_name(void * jarg1, char * jarg2) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_status_t)switch_channel_set_name(arg1,(char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_name(void * jarg1) {
+  char * jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  result = (char *)switch_channel_get_name(arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_perform_hangup(void * jarg1, char * jarg2, char * jarg3, int jarg4, int jarg5) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  switch_call_cause_t arg5 ;
+  switch_channel_state_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int)jarg4; 
+  arg5 = (switch_call_cause_t)jarg5; 
+  result = (switch_channel_state_t)switch_channel_perform_hangup(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_has_dtmf(void * jarg1) {
+  void * jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  result = switch_channel_has_dtmf(arg1);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_queue_dtmf(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_dtmf_t *arg2 = (switch_dtmf_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_dtmf_t *)jarg2; 
+  result = (switch_status_t)switch_channel_queue_dtmf(arg1,(switch_dtmf_t const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_queue_dtmf_string(void * jarg1, char * jarg2) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_status_t)switch_channel_queue_dtmf_string(arg1,(char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_dequeue_dtmf(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_dtmf_t *arg2 = (switch_dtmf_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_dtmf_t *)jarg2; 
+  result = (switch_status_t)switch_channel_dequeue_dtmf(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_flush_dtmf(void * jarg1) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  switch_channel_flush_dtmf(arg1);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_dequeue_dtmf_string(void * jarg1, char * jarg2, void * jarg3) {
+  void * jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_size_t arg3 ;
+  switch_size_t result;
+  switch_size_t *argp3 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  argp3 = (switch_size_t *)jarg3; 
+  if (!argp3) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg3 = *argp3; 
+  result = switch_channel_dequeue_dtmf_string(arg1,arg2,arg3);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_state_name(int jarg1) {
+  char * jresult ;
+  switch_channel_state_t arg1 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_channel_state_t)jarg1; 
+  result = (char *)switch_channel_state_name(arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_name_state(char * jarg1) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_channel_state_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_channel_state_t)switch_channel_name_state((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_event_set_data(void * jarg1, void * jarg2) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_event_t *arg2 = (switch_event_t *) 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_event_t *)jarg2; 
+  switch_channel_event_set_data(arg1,arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_event_set_basic_data(void * jarg1, void * jarg2) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_event_t *arg2 = (switch_event_t *) 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_event_t *)jarg2; 
+  switch_channel_event_set_basic_data(arg1,arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_event_set_extended_data(void * jarg1, void * jarg2) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_event_t *arg2 = (switch_event_t *) 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_event_t *)jarg2; 
+  switch_channel_event_set_extended_data(arg1,arg2);
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_expand_variables(void * jarg1, char * jarg2) {
+  char * jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (char *)switch_channel_expand_variables(arg1,(char const *)arg2);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_build_param_string(void * jarg1, void * jarg2, char * jarg3) {
+  char * jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_caller_profile_t *arg2 = (switch_caller_profile_t *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (switch_caller_profile_t *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (char *)switch_channel_build_param_string(arg1,arg2,(char const *)arg3);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_set_timestamps(void * jarg1) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  result = (switch_status_t)switch_channel_set_timestamps(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_audio_sync(void * jarg1) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  switch_channel_audio_sync(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_private_flag(void * jarg1, unsigned long jarg2) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  switch_channel_set_private_flag(arg1,arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_clear_private_flag(void * jarg1, unsigned long jarg2) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  switch_channel_clear_private_flag(arg1,arg2);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_test_private_flag(void * jarg1, unsigned long jarg2) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  uint32_t arg2 ;
+  int result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  result = (int)switch_channel_test_private_flag(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_app_flag(void * jarg1, unsigned long jarg2) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  switch_channel_set_app_flag(arg1,arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_clear_app_flag(void * jarg1, unsigned long jarg2) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  switch_channel_clear_app_flag(arg1,arg2);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_test_app_flag(void * jarg1, unsigned long jarg2) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  uint32_t arg2 ;
+  int result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  result = (int)switch_channel_test_app_flag(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_hangup_time(void * jarg1) {
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  switch_channel_set_hangup_time(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_direction(void * jarg1) {
+  int jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_call_direction_t result;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  result = (switch_call_direction_t)switch_channel_direction(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_get_session(void * jarg1) {
+  void * jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  switch_core_session_t *result = 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  result = (switch_core_session_t *)switch_channel_get_session(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_flag_string(void * jarg1) {
+  char * jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  result = (char *)switch_channel_get_flag_string(arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_channel_get_cap_string(void * jarg1) {
+  char * jresult ;
+  switch_channel_t *arg1 = (switch_channel_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_channel_t *)jarg1; 
+  result = (char *)switch_channel_get_cap_string(arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_buffer_create(void * jarg1, void * jarg2, void * jarg3) {
+  int jresult ;
+  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
+  switch_buffer_t **arg2 = (switch_buffer_t **) 0 ;
+  switch_size_t arg3 ;
+  switch_status_t result;
+  switch_size_t *argp3 ;
+  
+  arg1 = (switch_memory_pool_t *)jarg1; 
+  arg2 = (switch_buffer_t **)jarg2; 
+  argp3 = (switch_size_t *)jarg3; 
+  if (!argp3) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg3 = *argp3; 
+  result = (switch_status_t)switch_buffer_create(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_buffer_create_dynamic(void * jarg1, void * jarg2, void * jarg3, void * jarg4) {
+  int jresult ;
+  switch_buffer_t **arg1 = (switch_buffer_t **) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t arg3 ;
+  switch_size_t arg4 ;
+  switch_status_t result;
+  switch_size_t *argp2 ;
+  switch_size_t *argp3 ;
+  switch_size_t *argp4 ;
+  
+  arg1 = (switch_buffer_t **)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg2 = *argp2; 
+  argp3 = (switch_size_t *)jarg3; 
+  if (!argp3) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg3 = *argp3; 
+  argp4 = (switch_size_t *)jarg4; 
+  if (!argp4) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg4 = *argp4; 
+  result = (switch_status_t)switch_buffer_create_dynamic(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_buffer_add_mutex(void * jarg1, void * jarg2) {
+  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
+  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
+  
+  arg1 = (switch_buffer_t *)jarg1; 
+  arg2 = (switch_mutex_t *)jarg2; 
+  switch_buffer_add_mutex(arg1,arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_buffer_lock(void * jarg1) {
+  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
+  
+  arg1 = (switch_buffer_t *)jarg1; 
+  switch_buffer_lock(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_buffer_trylock(void * jarg1) {
+  int jresult ;
+  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_buffer_t *)jarg1; 
+  result = (switch_status_t)switch_buffer_trylock(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_buffer_unlock(void * jarg1) {
+  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
+  
+  arg1 = (switch_buffer_t *)jarg1; 
+  switch_buffer_unlock(arg1);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_buffer_len(void * jarg1) {
+  void * jresult ;
+  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_buffer_t *)jarg1; 
+  result = switch_buffer_len(arg1);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_buffer_freespace(void * jarg1) {
+  void * jresult ;
+  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_buffer_t *)jarg1; 
+  result = switch_buffer_freespace(arg1);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_buffer_inuse(void * jarg1) {
+  void * jresult ;
+  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_buffer_t *)jarg1; 
+  result = switch_buffer_inuse(arg1);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_buffer_read(void * jarg1, void * jarg2, void * jarg3) {
+  void * jresult ;
+  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  switch_size_t arg3 ;
+  switch_size_t result;
+  switch_size_t *argp3 ;
+  
+  arg1 = (switch_buffer_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  argp3 = (switch_size_t *)jarg3; 
+  if (!argp3) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg3 = *argp3; 
+  result = switch_buffer_read(arg1,arg2,arg3);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_buffer_read_loop(void * jarg1, void * jarg2, void * jarg3) {
+  void * jresult ;
+  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  switch_size_t arg3 ;
+  switch_size_t result;
+  switch_size_t *argp3 ;
+  
+  arg1 = (switch_buffer_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  argp3 = (switch_size_t *)jarg3; 
+  if (!argp3) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg3 = *argp3; 
+  result = switch_buffer_read_loop(arg1,arg2,arg3);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_buffer_set_loops(void * jarg1, int jarg2) {
+  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
+  int32_t arg2 ;
+  
+  arg1 = (switch_buffer_t *)jarg1; 
+  arg2 = (int32_t)jarg2; 
+  switch_buffer_set_loops(arg1,arg2);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_buffer_write(void * jarg1, void * jarg2, void * jarg3) {
+  void * jresult ;
+  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  switch_size_t arg3 ;
+  switch_size_t result;
+  switch_size_t *argp3 ;
+  
+  arg1 = (switch_buffer_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  argp3 = (switch_size_t *)jarg3; 
+  if (!argp3) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg3 = *argp3; 
+  result = switch_buffer_write(arg1,(void const *)arg2,arg3);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_buffer_toss(void * jarg1, void * jarg2) {
+  void * jresult ;
+  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t result;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_buffer_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg2 = *argp2; 
+  result = switch_buffer_toss(arg1,arg2);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_buffer_zero(void * jarg1) {
+  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
+  
+  arg1 = (switch_buffer_t *)jarg1; 
+  switch_buffer_zero(arg1);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_buffer_slide_write(void * jarg1, void * jarg2, void * jarg3) {
+  void * jresult ;
+  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  switch_size_t arg3 ;
+  switch_size_t result;
+  switch_size_t *argp3 ;
+  
+  arg1 = (switch_buffer_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  argp3 = (switch_size_t *)jarg3; 
+  if (!argp3) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg3 = *argp3; 
+  result = switch_buffer_slide_write(arg1,(void const *)arg2,arg3);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_buffer_destroy(void * jarg1) {
+  switch_buffer_t **arg1 = (switch_buffer_t **) 0 ;
+  
+  arg1 = (switch_buffer_t **)jarg1; 
+  switch_buffer_destroy(arg1);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_buffer_zwrite(void * jarg1, void * jarg2, void * jarg3) {
+  void * jresult ;
+  switch_buffer_t *arg1 = (switch_buffer_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  switch_size_t arg3 ;
+  switch_size_t result;
+  switch_size_t *argp3 ;
+  
+  arg1 = (switch_buffer_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  argp3 = (switch_size_t *)jarg3; 
+  if (!argp3) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg3 = *argp3; 
+  result = switch_buffer_zwrite(arg1,(void const *)arg2,arg3);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_header_name_set(void * jarg1, char * jarg2) {
+  switch_event_header *arg1 = (switch_event_header *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_event_header *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->name) delete [] arg1->name;
+    if (arg2) {
+      arg1->name = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->name, (const char *)arg2);
+    } else {
+      arg1->name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_header_name_get(void * jarg1) {
+  char * jresult ;
+  switch_event_header *arg1 = (switch_event_header *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_event_header *)jarg1; 
+  result = (char *) ((arg1)->name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_header_value_set(void * jarg1, char * jarg2) {
+  switch_event_header *arg1 = (switch_event_header *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_event_header *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->value) delete [] arg1->value;
+    if (arg2) {
+      arg1->value = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->value, (const char *)arg2);
+    } else {
+      arg1->value = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_header_value_get(void * jarg1) {
+  char * jresult ;
+  switch_event_header *arg1 = (switch_event_header *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_event_header *)jarg1; 
+  result = (char *) ((arg1)->value);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_header_hash_set(void * jarg1, unsigned long jarg2) {
+  switch_event_header *arg1 = (switch_event_header *) 0 ;
+  unsigned long arg2 ;
+  
+  arg1 = (switch_event_header *)jarg1; 
+  arg2 = (unsigned long)jarg2; 
+  if (arg1) (arg1)->hash = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_event_header_hash_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_event_header *arg1 = (switch_event_header *) 0 ;
+  unsigned long result;
+  
+  arg1 = (switch_event_header *)jarg1; 
+  result = (unsigned long) ((arg1)->hash);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_header_next_set(void * jarg1, void * jarg2) {
+  switch_event_header *arg1 = (switch_event_header *) 0 ;
+  switch_event_header *arg2 = (switch_event_header *) 0 ;
+  
+  arg1 = (switch_event_header *)jarg1; 
+  arg2 = (switch_event_header *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_event_header_next_get(void * jarg1) {
+  void * jresult ;
+  switch_event_header *arg1 = (switch_event_header *) 0 ;
+  switch_event_header *result = 0 ;
+  
+  arg1 = (switch_event_header *)jarg1; 
+  result = (switch_event_header *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_event_header() {
+  void * jresult ;
+  switch_event_header *result = 0 ;
+  
+  result = (switch_event_header *)new switch_event_header();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_event_header(void * jarg1) {
+  switch_event_header *arg1 = (switch_event_header *) 0 ;
+  
+  arg1 = (switch_event_header *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_event_id_set(void * jarg1, int jarg2) {
+  switch_event *arg1 = (switch_event *) 0 ;
+  switch_event_types_t arg2 ;
+  
+  arg1 = (switch_event *)jarg1; 
+  arg2 = (switch_event_types_t)jarg2; 
+  if (arg1) (arg1)->event_id = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_event_id_get(void * jarg1) {
+  int jresult ;
+  switch_event *arg1 = (switch_event *) 0 ;
+  switch_event_types_t result;
+  
+  arg1 = (switch_event *)jarg1; 
+  result = (switch_event_types_t) ((arg1)->event_id);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_priority_set(void * jarg1, int jarg2) {
+  switch_event *arg1 = (switch_event *) 0 ;
+  switch_priority_t arg2 ;
+  
+  arg1 = (switch_event *)jarg1; 
+  arg2 = (switch_priority_t)jarg2; 
+  if (arg1) (arg1)->priority = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_priority_get(void * jarg1) {
+  int jresult ;
+  switch_event *arg1 = (switch_event *) 0 ;
+  switch_priority_t result;
+  
+  arg1 = (switch_event *)jarg1; 
+  result = (switch_priority_t) ((arg1)->priority);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_owner_set(void * jarg1, char * jarg2) {
+  switch_event *arg1 = (switch_event *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_event *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->owner) delete [] arg1->owner;
+    if (arg2) {
+      arg1->owner = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->owner, (const char *)arg2);
+    } else {
+      arg1->owner = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_owner_get(void * jarg1) {
+  char * jresult ;
+  switch_event *arg1 = (switch_event *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_event *)jarg1; 
+  result = (char *) ((arg1)->owner);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_subclass_name_set(void * jarg1, char * jarg2) {
+  switch_event *arg1 = (switch_event *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_event *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->subclass_name) delete [] arg1->subclass_name;
+    if (arg2) {
+      arg1->subclass_name = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->subclass_name, (const char *)arg2);
+    } else {
+      arg1->subclass_name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_subclass_name_get(void * jarg1) {
+  char * jresult ;
+  switch_event *arg1 = (switch_event *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_event *)jarg1; 
+  result = (char *) ((arg1)->subclass_name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_headers_set(void * jarg1, void * jarg2) {
+  switch_event *arg1 = (switch_event *) 0 ;
+  switch_event_header_t *arg2 = (switch_event_header_t *) 0 ;
+  
+  arg1 = (switch_event *)jarg1; 
+  arg2 = (switch_event_header_t *)jarg2; 
+  if (arg1) (arg1)->headers = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_event_headers_get(void * jarg1) {
+  void * jresult ;
+  switch_event *arg1 = (switch_event *) 0 ;
+  switch_event_header_t *result = 0 ;
+  
+  arg1 = (switch_event *)jarg1; 
+  result = (switch_event_header_t *) ((arg1)->headers);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_last_header_set(void * jarg1, void * jarg2) {
+  switch_event *arg1 = (switch_event *) 0 ;
+  switch_event_header_t *arg2 = (switch_event_header_t *) 0 ;
+  
+  arg1 = (switch_event *)jarg1; 
+  arg2 = (switch_event_header_t *)jarg2; 
+  if (arg1) (arg1)->last_header = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_event_last_header_get(void * jarg1) {
+  void * jresult ;
+  switch_event *arg1 = (switch_event *) 0 ;
+  switch_event_header_t *result = 0 ;
+  
+  arg1 = (switch_event *)jarg1; 
+  result = (switch_event_header_t *) ((arg1)->last_header);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_body_set(void * jarg1, char * jarg2) {
+  switch_event *arg1 = (switch_event *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_event *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->body) delete [] arg1->body;
+    if (arg2) {
+      arg1->body = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->body, (const char *)arg2);
+    } else {
+      arg1->body = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_body_get(void * jarg1) {
+  char * jresult ;
+  switch_event *arg1 = (switch_event *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_event *)jarg1; 
+  result = (char *) ((arg1)->body);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_bind_user_data_set(void * jarg1, void * jarg2) {
+  switch_event *arg1 = (switch_event *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_event *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->bind_user_data = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_event_bind_user_data_get(void * jarg1) {
+  void * jresult ;
+  switch_event *arg1 = (switch_event *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_event *)jarg1; 
+  result = (void *) ((arg1)->bind_user_data);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_event_user_data_set(void * jarg1, void * jarg2) {
+  switch_event *arg1 = (switch_event *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_event *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->event_user_data = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_event_event_user_data_get(void * jarg1) {
+  void * jresult ;
+  switch_event *arg1 = (switch_event *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_event *)jarg1; 
+  result = (void *) ((arg1)->event_user_data);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_key_set(void * jarg1, unsigned long jarg2) {
+  switch_event *arg1 = (switch_event *) 0 ;
+  unsigned long arg2 ;
+  
+  arg1 = (switch_event *)jarg1; 
+  arg2 = (unsigned long)jarg2; 
+  if (arg1) (arg1)->key = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_event_key_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_event *arg1 = (switch_event *) 0 ;
+  unsigned long result;
+  
+  arg1 = (switch_event *)jarg1; 
+  result = (unsigned long) ((arg1)->key);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_next_set(void * jarg1, void * jarg2) {
+  switch_event *arg1 = (switch_event *) 0 ;
+  switch_event *arg2 = (switch_event *) 0 ;
+  
+  arg1 = (switch_event *)jarg1; 
+  arg2 = (switch_event *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_event_next_get(void * jarg1) {
+  void * jresult ;
+  switch_event *arg1 = (switch_event *) 0 ;
+  switch_event *result = 0 ;
+  
+  arg1 = (switch_event *)jarg1; 
+  result = (switch_event *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_flags_set(void * jarg1, int jarg2) {
+  switch_event *arg1 = (switch_event *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_event *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->flags = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_flags_get(void * jarg1) {
+  int jresult ;
+  switch_event *arg1 = (switch_event *) 0 ;
+  int result;
+  
+  arg1 = (switch_event *)jarg1; 
+  result = (int) ((arg1)->flags);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_event() {
+  void * jresult ;
+  switch_event *result = 0 ;
+  
+  result = (switch_event *)new switch_event();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_event(void * jarg1) {
+  switch_event *arg1 = (switch_event *) 0 ;
+  
+  arg1 = (switch_event *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_init(void * jarg1) {
+  int jresult ;
+  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_memory_pool_t *)jarg1; 
+  result = (switch_status_t)switch_event_init(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_shutdown() {
+  int jresult ;
+  switch_status_t result;
+  
+  result = (switch_status_t)switch_event_shutdown();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_create_subclass_detailed(char * jarg1, char * jarg2, int jarg3, void * jarg4, int jarg5, char * jarg6) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  switch_event_t **arg4 = (switch_event_t **) 0 ;
+  switch_event_types_t arg5 ;
+  char *arg6 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (int)jarg3; 
+  arg4 = (switch_event_t **)jarg4; 
+  arg5 = (switch_event_types_t)jarg5; 
+  arg6 = (char *)jarg6; 
+  result = (switch_status_t)switch_event_create_subclass_detailed((char const *)arg1,(char const *)arg2,arg3,arg4,arg5,(char const *)arg6);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_set_priority(void * jarg1, int jarg2) {
+  int jresult ;
+  switch_event_t *arg1 = (switch_event_t *) 0 ;
+  switch_priority_t arg2 ;
+  switch_status_t result;
+  
+  arg1 = (switch_event_t *)jarg1; 
+  arg2 = (switch_priority_t)jarg2; 
+  result = (switch_status_t)switch_event_set_priority(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_get_header(void * jarg1, char * jarg2) {
+  char * jresult ;
+  switch_event_t *arg1 = (switch_event_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_event_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (char *)switch_event_get_header(arg1,(char const *)arg2);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_get_body(void * jarg1) {
+  char * jresult ;
+  switch_event_t *arg1 = (switch_event_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_event_t *)jarg1; 
+  result = (char *)switch_event_get_body(arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_set_subclass_name(void * jarg1, char * jarg2) {
+  int jresult ;
+  switch_event_t *arg1 = (switch_event_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_event_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_status_t)switch_event_set_subclass_name(arg1,(char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_add_header_string(void * jarg1, int jarg2, char * jarg3, char * jarg4) {
+  int jresult ;
+  switch_event_t *arg1 = (switch_event_t *) 0 ;
+  switch_stack_t arg2 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_event_t *)jarg1; 
+  arg2 = (switch_stack_t)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  result = (switch_status_t)switch_event_add_header_string(arg1,arg2,(char const *)arg3,(char const *)arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_del_header_val(void * jarg1, char * jarg2, char * jarg3) {
+  int jresult ;
+  switch_event_t *arg1 = (switch_event_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_event_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (switch_status_t)switch_event_del_header_val(arg1,(char const *)arg2,(char const *)arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_destroy(void * jarg1) {
+  switch_event_t **arg1 = (switch_event_t **) 0 ;
+  
+  arg1 = (switch_event_t **)jarg1; 
+  switch_event_destroy(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_dup(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_event_t **arg1 = (switch_event_t **) 0 ;
+  switch_event_t *arg2 = (switch_event_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_event_t **)jarg1; 
+  arg2 = (switch_event_t *)jarg2; 
+  result = (switch_status_t)switch_event_dup(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_fire_detailed(char * jarg1, char * jarg2, int jarg3, void * jarg4, void * jarg5) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  switch_event_t **arg4 = (switch_event_t **) 0 ;
+  void *arg5 = (void *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (int)jarg3; 
+  arg4 = (switch_event_t **)jarg4; 
+  arg5 = (void *)jarg5; 
+  result = (switch_status_t)switch_event_fire_detailed((char const *)arg1,(char const *)arg2,arg3,arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_prep_for_delivery_detailed(char * jarg1, char * jarg2, int jarg3, void * jarg4) {
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  switch_event_t *arg4 = (switch_event_t *) 0 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (int)jarg3; 
+  arg4 = (switch_event_t *)jarg4; 
+  switch_event_prep_for_delivery_detailed((char const *)arg1,(char const *)arg2,arg3,arg4);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_bind(char * jarg1, int jarg2, char * jarg3, void * jarg4, void * jarg5) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_event_types_t arg2 ;
+  char *arg3 = (char *) 0 ;
+  switch_event_callback_t arg4 = (switch_event_callback_t) 0 ;
+  void *arg5 = (void *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_event_types_t)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (switch_event_callback_t)jarg4; 
+  arg5 = (void *)jarg5; 
+  result = (switch_status_t)switch_event_bind((char const *)arg1,arg2,(char const *)arg3,arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_bind_removable(char * jarg1, int jarg2, char * jarg3, void * jarg4, void * jarg5, void * jarg6) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_event_types_t arg2 ;
+  char *arg3 = (char *) 0 ;
+  switch_event_callback_t arg4 = (switch_event_callback_t) 0 ;
+  void *arg5 = (void *) 0 ;
+  switch_event_node_t **arg6 = (switch_event_node_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_event_types_t)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (switch_event_callback_t)jarg4; 
+  arg5 = (void *)jarg5; 
+  arg6 = (switch_event_node_t **)jarg6; 
+  result = (switch_status_t)switch_event_bind_removable((char const *)arg1,arg2,(char const *)arg3,arg4,arg5,arg6);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_unbind(void * jarg1) {
+  int jresult ;
+  switch_event_node_t **arg1 = (switch_event_node_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_event_node_t **)jarg1; 
+  result = (switch_status_t)switch_event_unbind(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_unbind_callback(void * jarg1) {
+  int jresult ;
+  switch_event_callback_t arg1 = (switch_event_callback_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_event_callback_t)jarg1; 
+  result = (switch_status_t)switch_event_unbind_callback(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_name(int jarg1) {
+  char * jresult ;
+  switch_event_types_t arg1 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_event_types_t)jarg1; 
+  result = (char *)switch_event_name(arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_name_event(char * jarg1, void * jarg2) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_event_types_t *arg2 = (switch_event_types_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_event_types_t *)jarg2; 
+  result = (switch_status_t)switch_name_event((char const *)arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_reserve_subclass_detailed(char * jarg1, char * jarg2) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_status_t)switch_event_reserve_subclass_detailed((char const *)arg1,(char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_free_subclass_detailed(char * jarg1, char * jarg2) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_status_t)switch_event_free_subclass_detailed((char const *)arg1,(char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_serialize(void * jarg1, void * jarg2, int jarg3) {
+  int jresult ;
+  switch_event_t *arg1 = (switch_event_t *) 0 ;
+  char **arg2 = (char **) 0 ;
+  switch_bool_t arg3 ;
+  switch_status_t result;
+  
+  arg1 = (switch_event_t *)jarg1; 
+  arg2 = (char **)jarg2; 
+  arg3 = (switch_bool_t)jarg3; 
+  result = (switch_status_t)switch_event_serialize(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_running() {
+  int jresult ;
+  switch_status_t result;
+  
+  result = (switch_status_t)switch_event_running();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_expand_headers(void * jarg1, char * jarg2) {
+  char * jresult ;
+  switch_event_t *arg1 = (switch_event_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_event_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (char *)switch_event_expand_headers(arg1,(char const *)arg2);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_create_pres_in_detailed(char * jarg1, char * jarg2, int jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, int jarg11, char * jarg12, char * jarg13, char * jarg14, char * jarg15) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  char *arg4 = (char *) 0 ;
+  char *arg5 = (char *) 0 ;
+  char *arg6 = (char *) 0 ;
+  char *arg7 = (char *) 0 ;
+  char *arg8 = (char *) 0 ;
+  char *arg9 = (char *) 0 ;
+  char *arg10 = (char *) 0 ;
+  int arg11 ;
+  char *arg12 = (char *) 0 ;
+  char *arg13 = (char *) 0 ;
+  char *arg14 = (char *) 0 ;
+  char *arg15 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (int)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (char *)jarg5; 
+  arg6 = (char *)jarg6; 
+  arg7 = (char *)jarg7; 
+  arg8 = (char *)jarg8; 
+  arg9 = (char *)jarg9; 
+  arg10 = (char *)jarg10; 
+  arg11 = (int)jarg11; 
+  arg12 = (char *)jarg12; 
+  arg13 = (char *)jarg13; 
+  arg14 = (char *)jarg14; 
+  arg15 = (char *)jarg15; 
+  result = (switch_status_t)switch_event_create_pres_in_detailed(arg1,arg2,arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,arg11,(char const *)arg12,(char const *)arg13,(char const *)arg14,(char const *)arg15);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_create_plain(void * jarg1, int jarg2) {
+  int jresult ;
+  switch_event_t **arg1 = (switch_event_t **) 0 ;
+  switch_event_types_t arg2 ;
+  switch_status_t result;
+  
+  arg1 = (switch_event_t **)jarg1; 
+  arg2 = (switch_event_types_t)jarg2; 
+  result = (switch_status_t)switch_event_create_plain(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_event_deliver(void * jarg1) {
+  switch_event_t **arg1 = (switch_event_t **) 0 ;
+  
+  arg1 = (switch_event_t **)jarg1; 
+  switch_event_deliver(arg1);
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_event_build_param_string(void * jarg1, char * jarg2, void * jarg3) {
+  char * jresult ;
+  switch_event_t *arg1 = (switch_event_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_hash_t *arg3 = (switch_hash_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_event_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_hash_t *)jarg3; 
+  result = (char *)switch_event_build_param_string(arg1,(char const *)arg2,arg3);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RESAMPLE_QUALITY_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 2;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_audio_resampler_t_resampler_set(void * jarg1, void * jarg2) {
+  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_audio_resampler_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->resampler = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_audio_resampler_t_resampler_get(void * jarg1) {
+  void * jresult ;
+  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_audio_resampler_t *)jarg1; 
+  result = (void *) ((arg1)->resampler);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_audio_resampler_t_from_rate_set(void * jarg1, int jarg2) {
+  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_audio_resampler_t *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->from_rate = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_audio_resampler_t_from_rate_get(void * jarg1) {
+  int jresult ;
+  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
+  int result;
+  
+  arg1 = (switch_audio_resampler_t *)jarg1; 
+  result = (int) ((arg1)->from_rate);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_audio_resampler_t_to_rate_set(void * jarg1, int jarg2) {
+  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_audio_resampler_t *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->to_rate = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_audio_resampler_t_to_rate_get(void * jarg1) {
+  int jresult ;
+  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
+  int result;
+  
+  arg1 = (switch_audio_resampler_t *)jarg1; 
+  result = (int) ((arg1)->to_rate);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_audio_resampler_t_factor_set(void * jarg1, double jarg2) {
+  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
+  double arg2 ;
+  
+  arg1 = (switch_audio_resampler_t *)jarg1; 
+  arg2 = (double)jarg2; 
+  if (arg1) (arg1)->factor = arg2;
+  
+}
+
+
+SWIGEXPORT double SWIGSTDCALL CSharp_switch_audio_resampler_t_factor_get(void * jarg1) {
+  double jresult ;
+  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
+  double result;
+  
+  arg1 = (switch_audio_resampler_t *)jarg1; 
+  result = (double) ((arg1)->factor);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_audio_resampler_t_rfactor_set(void * jarg1, double jarg2) {
+  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
+  double arg2 ;
+  
+  arg1 = (switch_audio_resampler_t *)jarg1; 
+  arg2 = (double)jarg2; 
+  if (arg1) (arg1)->rfactor = arg2;
+  
+}
+
+
+SWIGEXPORT double SWIGSTDCALL CSharp_switch_audio_resampler_t_rfactor_get(void * jarg1) {
+  double jresult ;
+  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
+  double result;
+  
+  arg1 = (switch_audio_resampler_t *)jarg1; 
+  result = (double) ((arg1)->rfactor);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_audio_resampler_t_to_set(void * jarg1, void * jarg2) {
+  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
+  int16_t *arg2 = (int16_t *) 0 ;
+  
+  arg1 = (switch_audio_resampler_t *)jarg1; 
+  arg2 = (int16_t *)jarg2; 
+  if (arg1) (arg1)->to = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_audio_resampler_t_to_get(void * jarg1) {
+  void * jresult ;
+  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
+  int16_t *result = 0 ;
+  
+  arg1 = (switch_audio_resampler_t *)jarg1; 
+  result = (int16_t *) ((arg1)->to);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_audio_resampler_t_to_len_set(void * jarg1, unsigned long jarg2) {
+  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_audio_resampler_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->to_len = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_audio_resampler_t_to_len_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_audio_resampler_t *)jarg1; 
+  result = (uint32_t) ((arg1)->to_len);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_audio_resampler_t_to_size_set(void * jarg1, unsigned long jarg2) {
+  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_audio_resampler_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->to_size = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_audio_resampler_t_to_size_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_audio_resampler_t *)jarg1; 
+  result = (uint32_t) ((arg1)->to_size);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_audio_resampler_t() {
+  void * jresult ;
+  switch_audio_resampler_t *result = 0 ;
+  
+  result = (switch_audio_resampler_t *)new switch_audio_resampler_t();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_audio_resampler_t(void * jarg1) {
+  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
+  
+  arg1 = (switch_audio_resampler_t *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_resample_perform_create(void * jarg1, unsigned long jarg2, unsigned long jarg3, unsigned long jarg4, int jarg5, unsigned long jarg6, char * jarg7, char * jarg8, int jarg9) {
+  int jresult ;
+  switch_audio_resampler_t **arg1 = (switch_audio_resampler_t **) 0 ;
+  uint32_t arg2 ;
+  uint32_t arg3 ;
+  uint32_t arg4 ;
+  int arg5 ;
+  uint32_t arg6 ;
+  char *arg7 = (char *) 0 ;
+  char *arg8 = (char *) 0 ;
+  int arg9 ;
+  switch_status_t result;
+  
+  arg1 = (switch_audio_resampler_t **)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  arg4 = (uint32_t)jarg4; 
+  arg5 = (int)jarg5; 
+  arg6 = (uint32_t)jarg6; 
+  arg7 = (char *)jarg7; 
+  arg8 = (char *)jarg8; 
+  arg9 = (int)jarg9; 
+  result = (switch_status_t)switch_resample_perform_create(arg1,arg2,arg3,arg4,arg5,arg6,(char const *)arg7,(char const *)arg8,arg9);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_resample_destroy(void * jarg1) {
+  switch_audio_resampler_t **arg1 = (switch_audio_resampler_t **) 0 ;
+  
+  arg1 = (switch_audio_resampler_t **)jarg1; 
+  switch_resample_destroy(arg1);
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_resample_process(void * jarg1, void * jarg2, unsigned long jarg3) {
+  unsigned long jresult ;
+  switch_audio_resampler_t *arg1 = (switch_audio_resampler_t *) 0 ;
+  int16_t *arg2 = (int16_t *) 0 ;
+  uint32_t arg3 ;
+  uint32_t result;
+  
+  arg1 = (switch_audio_resampler_t *)jarg1; 
+  arg2 = (int16_t *)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  result = (uint32_t)switch_resample_process(arg1,arg2,arg3);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_float_to_short(void * jarg1, void * jarg2, void * jarg3) {
+  void * jresult ;
+  float *arg1 = (float *) 0 ;
+  short *arg2 = (short *) 0 ;
+  switch_size_t arg3 ;
+  switch_size_t result;
+  switch_size_t *argp3 ;
+  
+  arg1 = (float *)jarg1; 
+  arg2 = (short *)jarg2; 
+  argp3 = (switch_size_t *)jarg3; 
+  if (!argp3) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg3 = *argp3; 
+  result = switch_float_to_short(arg1,arg2,arg3);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_char_to_float(char * jarg1, void * jarg2, int jarg3) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  float *arg2 = (float *) 0 ;
+  int arg3 ;
+  int result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (float *)jarg2; 
+  arg3 = (int)jarg3; 
+  result = (int)switch_char_to_float(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_float_to_char(void * jarg1, char * jarg2, int jarg3) {
+  int jresult ;
+  float *arg1 = (float *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 ;
+  int result;
+  
+  arg1 = (float *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (int)jarg3; 
+  result = (int)switch_float_to_char(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_short_to_float(void * jarg1, void * jarg2, int jarg3) {
+  int jresult ;
+  short *arg1 = (short *) 0 ;
+  float *arg2 = (float *) 0 ;
+  int arg3 ;
+  int result;
+  
+  arg1 = (short *)jarg1; 
+  arg2 = (float *)jarg2; 
+  arg3 = (int)jarg3; 
+  result = (int)switch_short_to_float(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_swap_linear(void * jarg1, int jarg2) {
+  int16_t *arg1 = (int16_t *) 0 ;
+  int arg2 ;
+  
+  arg1 = (int16_t *)jarg1; 
+  arg2 = (int)jarg2; 
+  switch_swap_linear(arg1,arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_generate_sln_silence(void * jarg1, unsigned long jarg2, unsigned long jarg3) {
+  int16_t *arg1 = (int16_t *) 0 ;
+  uint32_t arg2 ;
+  uint32_t arg3 ;
+  
+  arg1 = (int16_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  switch_generate_sln_silence(arg1,arg2,arg3);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_change_sln_volume(void * jarg1, unsigned long jarg2, int jarg3) {
+  int16_t *arg1 = (int16_t *) 0 ;
+  uint32_t arg2 ;
+  int32_t arg3 ;
+  
+  arg1 = (int16_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  arg3 = (int32_t)jarg3; 
+  switch_change_sln_volume(arg1,arg2,arg3);
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_merge_sln(void * jarg1, unsigned long jarg2, void * jarg3, unsigned long jarg4) {
+  unsigned long jresult ;
+  int16_t *arg1 = (int16_t *) 0 ;
+  uint32_t arg2 ;
+  int16_t *arg3 = (int16_t *) 0 ;
+  uint32_t arg4 ;
+  uint32_t result;
+  
+  arg1 = (int16_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  arg3 = (int16_t *)jarg3; 
+  arg4 = (uint32_t)jarg4; 
+  result = (uint32_t)switch_merge_sln(arg1,arg2,arg3,arg4);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_mux_channels(void * jarg1, void * jarg2, unsigned long jarg3) {
+  int16_t *arg1 = (int16_t *) 0 ;
+  switch_size_t arg2 ;
+  uint32_t arg3 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (int16_t *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  arg3 = (uint32_t)jarg3; 
+  switch_mux_channels(arg1,arg2,arg3);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_session_set(void * jarg1, void * jarg2) {
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  arg2 = (switch_core_session_t *)jarg2; 
+  if (arg1) (arg1)->session = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_unicast_conninfo_session_get(void * jarg1) {
+  void * jresult ;
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  switch_core_session_t *result = 0 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  result = (switch_core_session_t *) ((arg1)->session);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_read_codec_set(void * jarg1, void * jarg2) {
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  switch_codec_t *arg2 = (switch_codec_t *) 0 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  arg2 = (switch_codec_t *)jarg2; 
+  if (arg1) (arg1)->read_codec = *arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_unicast_conninfo_read_codec_get(void * jarg1) {
+  void * jresult ;
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  switch_codec_t *result = 0 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  result = (switch_codec_t *)& ((arg1)->read_codec);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_write_frame_set(void * jarg1, void * jarg2) {
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  switch_frame_t *arg2 = (switch_frame_t *) 0 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  arg2 = (switch_frame_t *)jarg2; 
+  if (arg1) (arg1)->write_frame = *arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_unicast_conninfo_write_frame_get(void * jarg1) {
+  void * jresult ;
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  switch_frame_t *result = 0 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  result = (switch_frame_t *)& ((arg1)->write_frame);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_write_frame_data_set(void * jarg1, void * jarg2) {
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  switch_byte_t *arg2 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  arg2 = (switch_byte_t *)jarg2; 
+  {
+    size_t ii;
+    switch_byte_t *b = (switch_byte_t *) arg1->write_frame_data;
+    for (ii = 0; ii < (size_t)4096; ii++) b[ii] = *((switch_byte_t *) arg2 + ii);
+  }
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_unicast_conninfo_write_frame_data_get(void * jarg1) {
+  void * jresult ;
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  switch_byte_t *result = 0 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  result = (switch_byte_t *)(switch_byte_t *) ((arg1)->write_frame_data);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_socket_set(void * jarg1, void * jarg2) {
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  switch_socket_t *arg2 = (switch_socket_t *) 0 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  arg2 = (switch_socket_t *)jarg2; 
+  if (arg1) (arg1)->socket = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_unicast_conninfo_socket_get(void * jarg1) {
+  void * jresult ;
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  switch_socket_t *result = 0 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  result = (switch_socket_t *) ((arg1)->socket);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_local_ip_set(void * jarg1, char * jarg2) {
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->local_ip) delete [] arg1->local_ip;
+    if (arg2) {
+      arg1->local_ip = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->local_ip, (const char *)arg2);
+    } else {
+      arg1->local_ip = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_unicast_conninfo_local_ip_get(void * jarg1) {
+  char * jresult ;
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  result = (char *) ((arg1)->local_ip);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_local_port_set(void * jarg1, unsigned short jarg2) {
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  switch_port_t arg2 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  arg2 = (switch_port_t)jarg2; 
+  if (arg1) (arg1)->local_port = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_unicast_conninfo_local_port_get(void * jarg1) {
+  unsigned short jresult ;
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  switch_port_t result;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  result = (switch_port_t) ((arg1)->local_port);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_remote_ip_set(void * jarg1, char * jarg2) {
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->remote_ip) delete [] arg1->remote_ip;
+    if (arg2) {
+      arg1->remote_ip = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->remote_ip, (const char *)arg2);
+    } else {
+      arg1->remote_ip = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_unicast_conninfo_remote_ip_get(void * jarg1) {
+  char * jresult ;
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  result = (char *) ((arg1)->remote_ip);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_remote_port_set(void * jarg1, unsigned short jarg2) {
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  switch_port_t arg2 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  arg2 = (switch_port_t)jarg2; 
+  if (arg1) (arg1)->remote_port = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_unicast_conninfo_remote_port_get(void * jarg1) {
+  unsigned short jresult ;
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  switch_port_t result;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  result = (switch_port_t) ((arg1)->remote_port);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_local_addr_set(void * jarg1, void * jarg2) {
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  switch_sockaddr_t *arg2 = (switch_sockaddr_t *) 0 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  arg2 = (switch_sockaddr_t *)jarg2; 
+  if (arg1) (arg1)->local_addr = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_unicast_conninfo_local_addr_get(void * jarg1) {
+  void * jresult ;
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  switch_sockaddr_t *result = 0 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  result = (switch_sockaddr_t *) ((arg1)->local_addr);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_remote_addr_set(void * jarg1, void * jarg2) {
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  switch_sockaddr_t *arg2 = (switch_sockaddr_t *) 0 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  arg2 = (switch_sockaddr_t *)jarg2; 
+  if (arg1) (arg1)->remote_addr = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_unicast_conninfo_remote_addr_get(void * jarg1) {
+  void * jresult ;
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  switch_sockaddr_t *result = 0 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  result = (switch_sockaddr_t *) ((arg1)->remote_addr);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_flag_mutex_set(void * jarg1, void * jarg2) {
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  switch_mutex_t *arg2 = (switch_mutex_t *) 0 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  arg2 = (switch_mutex_t *)jarg2; 
+  if (arg1) (arg1)->flag_mutex = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_unicast_conninfo_flag_mutex_get(void * jarg1) {
+  void * jresult ;
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  switch_mutex_t *result = 0 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  result = (switch_mutex_t *) ((arg1)->flag_mutex);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_flags_set(void * jarg1, int jarg2) {
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  int32_t arg2 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  arg2 = (int32_t)jarg2; 
+  if (arg1) (arg1)->flags = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_unicast_conninfo_flags_get(void * jarg1) {
+  int jresult ;
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  int32_t result;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  result = (int32_t) ((arg1)->flags);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_type_set(void * jarg1, int jarg2) {
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->type = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_unicast_conninfo_type_get(void * jarg1) {
+  int jresult ;
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  int result;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  result = (int) ((arg1)->type);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_transport_set(void * jarg1, int jarg2) {
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->transport = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_unicast_conninfo_transport_get(void * jarg1) {
+  int jresult ;
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  int result;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  result = (int) ((arg1)->transport);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_unicast_conninfo_stream_id_set(void * jarg1, int jarg2) {
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->stream_id = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_unicast_conninfo_stream_id_get(void * jarg1) {
+  int jresult ;
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  int result;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  result = (int) ((arg1)->stream_id);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_unicast_conninfo() {
+  void * jresult ;
+  switch_unicast_conninfo *result = 0 ;
+  
+  result = (switch_unicast_conninfo *)new switch_unicast_conninfo();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_unicast_conninfo(void * jarg1) {
+  switch_unicast_conninfo *arg1 = (switch_unicast_conninfo *) 0 ;
+  
+  arg1 = (switch_unicast_conninfo *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_deactivate_unicast(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)switch_ivr_deactivate_unicast(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_activate_unicast(void * jarg1, char * jarg2, unsigned short jarg3, char * jarg4, unsigned short jarg5, char * jarg6, char * jarg7) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_port_t arg3 ;
+  char *arg4 = (char *) 0 ;
+  switch_port_t arg5 ;
+  char *arg6 = (char *) 0 ;
+  char *arg7 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_port_t)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (switch_port_t)jarg5; 
+  arg6 = (char *)jarg6; 
+  arg7 = (char *)jarg7; 
+  result = (switch_status_t)switch_ivr_activate_unicast(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_generate_xml_cdr(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_xml_t *arg2 = (switch_xml_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_xml_t *)jarg2; 
+  result = (switch_status_t)switch_ivr_generate_xml_cdr(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_set_xml_profile_data(void * jarg1, void * jarg2, int jarg3) {
+  int jresult ;
+  switch_xml_t arg1 = (switch_xml_t) 0 ;
+  switch_caller_profile_t *arg2 = (switch_caller_profile_t *) 0 ;
+  int arg3 ;
+  int result;
+  
+  arg1 = (switch_xml_t)jarg1; 
+  arg2 = (switch_caller_profile_t *)jarg2; 
+  arg3 = (int)jarg3; 
+  result = (int)switch_ivr_set_xml_profile_data(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_set_xml_chan_vars(void * jarg1, void * jarg2, int jarg3) {
+  int jresult ;
+  switch_xml_t arg1 = (switch_xml_t) 0 ;
+  switch_channel_t *arg2 = (switch_channel_t *) 0 ;
+  int arg3 ;
+  int result;
+  
+  arg1 = (switch_xml_t)jarg1; 
+  arg2 = (switch_channel_t *)jarg2; 
+  arg3 = (int)jarg3; 
+  result = (int)switch_ivr_set_xml_chan_vars(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_parse_event(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_event_t *arg2 = (switch_event_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_event_t *)jarg2; 
+  result = (switch_status_t)switch_ivr_parse_event(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_parse_all_events(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)switch_ivr_parse_all_events(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_parse_next_event(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)switch_ivr_parse_next_event(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_parse_all_messages(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)switch_ivr_parse_all_messages(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_sleep(void * jarg1, unsigned long jarg2, int jarg3, void * jarg4) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  uint32_t arg2 ;
+  switch_bool_t arg3 ;
+  switch_input_args_t *arg4 = (switch_input_args_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  arg3 = (switch_bool_t)jarg3; 
+  arg4 = (switch_input_args_t *)jarg4; 
+  result = (switch_status_t)switch_ivr_sleep(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_park(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_input_args_t *arg2 = (switch_input_args_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_input_args_t *)jarg2; 
+  result = (switch_status_t)switch_ivr_park(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_collect_digits_callback(void * jarg1, void * jarg2, unsigned long jarg3, unsigned long jarg4) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_input_args_t *arg2 = (switch_input_args_t *) 0 ;
+  uint32_t arg3 ;
+  uint32_t arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_input_args_t *)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  arg4 = (uint32_t)jarg4; 
+  result = (switch_status_t)switch_ivr_collect_digits_callback(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_collect_digits_count(void * jarg1, char * jarg2, void * jarg3, void * jarg4, char * jarg5, char * jarg6, unsigned long jarg7, unsigned long jarg8, unsigned long jarg9) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_size_t arg3 ;
+  switch_size_t arg4 ;
+  char *arg5 = (char *) 0 ;
+  char *arg6 = (char *) 0 ;
+  uint32_t arg7 ;
+  uint32_t arg8 ;
+  uint32_t arg9 ;
+  switch_status_t result;
+  switch_size_t *argp3 ;
+  switch_size_t *argp4 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  argp3 = (switch_size_t *)jarg3; 
+  if (!argp3) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg3 = *argp3; 
+  argp4 = (switch_size_t *)jarg4; 
+  if (!argp4) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg4 = *argp4; 
+  arg5 = (char *)jarg5; 
+  arg6 = (char *)jarg6; 
+  arg7 = (uint32_t)jarg7; 
+  arg8 = (uint32_t)jarg8; 
+  arg9 = (uint32_t)jarg9; 
+  result = (switch_status_t)switch_ivr_collect_digits_count(arg1,arg2,arg3,arg4,(char const *)arg5,arg6,arg7,arg8,arg9);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_detect_speech(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, void * jarg6) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  char *arg5 = (char *) 0 ;
+  switch_asr_handle_t *arg6 = (switch_asr_handle_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (char *)jarg5; 
+  arg6 = (switch_asr_handle_t *)jarg6; 
+  result = (switch_status_t)switch_ivr_detect_speech(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,arg6);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_stop_detect_speech(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)switch_ivr_stop_detect_speech(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_pause_detect_speech(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)switch_ivr_pause_detect_speech(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_resume_detect_speech(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)switch_ivr_resume_detect_speech(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_detect_speech_load_grammar(void * jarg1, char * jarg2, char * jarg3) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (switch_status_t)switch_ivr_detect_speech_load_grammar(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_detect_speech_unload_grammar(void * jarg1, char * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_status_t)switch_ivr_detect_speech_unload_grammar(arg1,(char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_record_session(void * jarg1, char * jarg2, unsigned long jarg3, void * jarg4) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  uint32_t arg3 ;
+  switch_file_handle_t *arg4 = (switch_file_handle_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  arg4 = (switch_file_handle_t *)jarg4; 
+  result = (switch_status_t)switch_ivr_record_session(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_eavesdrop_session(void * jarg1, char * jarg2, char * jarg3, unsigned long jarg4) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  switch_eavesdrop_flag_t arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (switch_eavesdrop_flag_t)jarg4; 
+  result = (switch_status_t)switch_ivr_eavesdrop_session(arg1,(char const *)arg2,(char const *)arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_displace_session(void * jarg1, char * jarg2, unsigned long jarg3, char * jarg4) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  uint32_t arg3 ;
+  char *arg4 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  arg4 = (char *)jarg4; 
+  result = (switch_status_t)switch_ivr_displace_session(arg1,(char const *)arg2,arg3,(char const *)arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_stop_displace_session(void * jarg1, char * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_status_t)switch_ivr_stop_displace_session(arg1,(char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_stop_record_session(void * jarg1, char * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_status_t)switch_ivr_stop_record_session(arg1,(char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_session_audio(void * jarg1, char * jarg2, char * jarg3, int jarg4) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int)jarg4; 
+  result = (switch_status_t)switch_ivr_session_audio(arg1,(char const *)arg2,(char const *)arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_stop_session_audio(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)switch_ivr_stop_session_audio(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_inband_dtmf_session(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)switch_ivr_inband_dtmf_session(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_stop_inband_dtmf_session(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)switch_ivr_stop_inband_dtmf_session(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_inband_dtmf_generate_session(void * jarg1, int jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_bool_t arg2 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_bool_t)jarg2; 
+  result = (switch_status_t)switch_ivr_inband_dtmf_generate_session(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_stop_inband_dtmf_generate_session(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)switch_ivr_stop_inband_dtmf_generate_session(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_session_echo(void * jarg1, void * jarg2) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_input_args_t *arg2 = (switch_input_args_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_input_args_t *)jarg2; 
+  switch_ivr_session_echo(arg1,arg2);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_stop_tone_detect_session(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)switch_ivr_stop_tone_detect_session(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_tone_detect_session(void * jarg1, char * jarg2, char * jarg3, char * jarg4, void * jarg5, int jarg6, char * jarg7, char * jarg8, void * jarg9) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  time_t arg5 ;
+  int arg6 ;
+  char *arg7 = (char *) 0 ;
+  char *arg8 = (char *) 0 ;
+  switch_tone_detect_callback_t arg9 = (switch_tone_detect_callback_t) 0 ;
+  switch_status_t result;
+  time_t *argp5 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  argp5 = (time_t *)jarg5; 
+  if (!argp5) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null time_t", 0);
+    return 0;
+  }
+  arg5 = *argp5; 
+  arg6 = (int)jarg6; 
+  arg7 = (char *)jarg7; 
+  arg8 = (char *)jarg8; 
+  arg9 = (switch_tone_detect_callback_t)jarg9; 
+  result = (switch_status_t)switch_ivr_tone_detect_session(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5,arg6,(char const *)arg7,(char const *)arg8,arg9);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_play_file(void * jarg1, void * jarg2, char * jarg3, void * jarg4) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_file_handle_t *arg2 = (switch_file_handle_t *) 0 ;
+  char *arg3 = (char *) 0 ;
+  switch_input_args_t *arg4 = (switch_input_args_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_file_handle_t *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (switch_input_args_t *)jarg4; 
+  result = (switch_status_t)switch_ivr_play_file(arg1,arg2,(char const *)arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_wait_for_silence(void * jarg1, unsigned long jarg2, unsigned long jarg3, unsigned long jarg4, unsigned long jarg5, char * jarg6) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  uint32_t arg2 ;
+  uint32_t arg3 ;
+  uint32_t arg4 ;
+  uint32_t arg5 ;
+  char *arg6 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  arg4 = (uint32_t)jarg4; 
+  arg5 = (uint32_t)jarg5; 
+  arg6 = (char *)jarg6; 
+  result = (switch_status_t)switch_ivr_wait_for_silence(arg1,arg2,arg3,arg4,arg5,(char const *)arg6);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_gentones(void * jarg1, char * jarg2, int jarg3, void * jarg4) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int32_t arg3 ;
+  switch_input_args_t *arg4 = (switch_input_args_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (int32_t)jarg3; 
+  arg4 = (switch_input_args_t *)jarg4; 
+  result = (switch_status_t)switch_ivr_gentones(arg1,(char const *)arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_record_file(void * jarg1, void * jarg2, char * jarg3, void * jarg4, unsigned long jarg5) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_file_handle_t *arg2 = (switch_file_handle_t *) 0 ;
+  char *arg3 = (char *) 0 ;
+  switch_input_args_t *arg4 = (switch_input_args_t *) 0 ;
+  uint32_t arg5 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_file_handle_t *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (switch_input_args_t *)jarg4; 
+  arg5 = (uint32_t)jarg5; 
+  result = (switch_status_t)switch_ivr_record_file(arg1,arg2,(char const *)arg3,arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_play_and_get_digits(void * jarg1, unsigned long jarg2, unsigned long jarg3, unsigned long jarg4, unsigned long jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, unsigned long jarg11, char * jarg12) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  uint32_t arg2 ;
+  uint32_t arg3 ;
+  uint32_t arg4 ;
+  uint32_t arg5 ;
+  char *arg6 = (char *) 0 ;
+  char *arg7 = (char *) 0 ;
+  char *arg8 = (char *) 0 ;
+  char *arg9 = (char *) 0 ;
+  char *arg10 = (char *) 0 ;
+  uint32_t arg11 ;
+  char *arg12 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  arg4 = (uint32_t)jarg4; 
+  arg5 = (uint32_t)jarg5; 
+  arg6 = (char *)jarg6; 
+  arg7 = (char *)jarg7; 
+  arg8 = (char *)jarg8; 
+  arg9 = (char *)jarg9; 
+  arg10 = (char *)jarg10; 
+  arg11 = (uint32_t)jarg11; 
+  arg12 = (char *)jarg12; 
+  result = (switch_status_t)switch_play_and_get_digits(arg1,arg2,arg3,arg4,arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,arg10,arg11,(char const *)arg12);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_speak_text_handle(void * jarg1, void * jarg2, void * jarg3, void * jarg4, char * jarg5, void * jarg6) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_speech_handle_t *arg2 = (switch_speech_handle_t *) 0 ;
+  switch_codec_t *arg3 = (switch_codec_t *) 0 ;
+  switch_timer_t *arg4 = (switch_timer_t *) 0 ;
+  char *arg5 = (char *) 0 ;
+  switch_input_args_t *arg6 = (switch_input_args_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_speech_handle_t *)jarg2; 
+  arg3 = (switch_codec_t *)jarg3; 
+  arg4 = (switch_timer_t *)jarg4; 
+  arg5 = (char *)jarg5; 
+  arg6 = (switch_input_args_t *)jarg6; 
+  result = (switch_status_t)switch_ivr_speak_text_handle(arg1,arg2,arg3,arg4,arg5,arg6);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_clear_speech_cache(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_ivr_clear_speech_cache(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_speak_text(void * jarg1, char * jarg2, char * jarg3, char * jarg4, void * jarg5) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  switch_input_args_t *arg5 = (switch_input_args_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (switch_input_args_t *)jarg5; 
+  result = (switch_status_t)switch_ivr_speak_text(arg1,(char const *)arg2,(char const *)arg3,arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_originate(void * jarg1, void * jarg2, void * jarg3, char * jarg4, unsigned long jarg5, void * jarg6, char * jarg7, char * jarg8, void * jarg9, void * jarg10, unsigned long jarg11, void * jarg12) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_core_session_t **arg2 = (switch_core_session_t **) 0 ;
+  switch_call_cause_t *arg3 = (switch_call_cause_t *) 0 ;
+  char *arg4 = (char *) 0 ;
+  uint32_t arg5 ;
+  switch_state_handler_table_t *arg6 = (switch_state_handler_table_t *) 0 ;
+  char *arg7 = (char *) 0 ;
+  char *arg8 = (char *) 0 ;
+  switch_caller_profile_t *arg9 = (switch_caller_profile_t *) 0 ;
+  switch_event_t *arg10 = (switch_event_t *) 0 ;
+  switch_originate_flag_t arg11 ;
+  switch_call_cause_t *arg12 = (switch_call_cause_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_core_session_t **)jarg2; 
+  arg3 = (switch_call_cause_t *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (uint32_t)jarg5; 
+  arg6 = (switch_state_handler_table_t *)jarg6; 
+  arg7 = (char *)jarg7; 
+  arg8 = (char *)jarg8; 
+  arg9 = (switch_caller_profile_t *)jarg9; 
+  arg10 = (switch_event_t *)jarg10; 
+  arg11 = (switch_originate_flag_t)jarg11; 
+  arg12 = (switch_call_cause_t *)jarg12; 
+  result = (switch_status_t)switch_ivr_originate(arg1,arg2,arg3,(char const *)arg4,arg5,(switch_state_handler_table const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11,arg12);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_enterprise_originate(void * jarg1, void * jarg2, void * jarg3, char * jarg4, unsigned long jarg5, void * jarg6, char * jarg7, char * jarg8, void * jarg9, void * jarg10, unsigned long jarg11) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_core_session_t **arg2 = (switch_core_session_t **) 0 ;
+  switch_call_cause_t *arg3 = (switch_call_cause_t *) 0 ;
+  char *arg4 = (char *) 0 ;
+  uint32_t arg5 ;
+  switch_state_handler_table_t *arg6 = (switch_state_handler_table_t *) 0 ;
+  char *arg7 = (char *) 0 ;
+  char *arg8 = (char *) 0 ;
+  switch_caller_profile_t *arg9 = (switch_caller_profile_t *) 0 ;
+  switch_event_t *arg10 = (switch_event_t *) 0 ;
+  switch_originate_flag_t arg11 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_core_session_t **)jarg2; 
+  arg3 = (switch_call_cause_t *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (uint32_t)jarg5; 
+  arg6 = (switch_state_handler_table_t *)jarg6; 
+  arg7 = (char *)jarg7; 
+  arg8 = (char *)jarg8; 
+  arg9 = (switch_caller_profile_t *)jarg9; 
+  arg10 = (switch_event_t *)jarg10; 
+  arg11 = (switch_originate_flag_t)jarg11; 
+  result = (switch_status_t)switch_ivr_enterprise_originate(arg1,arg2,arg3,(char const *)arg4,arg5,(switch_state_handler_table const *)arg6,(char const *)arg7,(char const *)arg8,arg9,arg10,arg11);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_bridge_display(void * jarg1, void * jarg2) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_core_session_t *)jarg2; 
+  switch_ivr_bridge_display(arg1,arg2);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_multi_threaded_bridge(void * jarg1, void * jarg2, void * jarg3, void * jarg4, void * jarg5) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
+  switch_input_callback_function_t arg3 = (switch_input_callback_function_t) 0 ;
+  void *arg4 = (void *) 0 ;
+  void *arg5 = (void *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_core_session_t *)jarg2; 
+  arg3 = (switch_input_callback_function_t)jarg3; 
+  arg4 = (void *)jarg4; 
+  arg5 = (void *)jarg5; 
+  result = (switch_status_t)switch_ivr_multi_threaded_bridge(arg1,arg2,arg3,arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_signal_bridge(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_core_session_t *)jarg2; 
+  result = (switch_status_t)switch_ivr_signal_bridge(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_session_transfer(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  result = (switch_status_t)switch_ivr_session_transfer(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_ivr_schedule_transfer(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5) {
+  unsigned long jresult ;
+  time_t arg1 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  char *arg5 = (char *) 0 ;
+  uint32_t result;
+  time_t *argp1 ;
+  
+  argp1 = (time_t *)jarg1; 
+  if (!argp1) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null time_t", 0);
+    return 0;
+  }
+  arg1 = *argp1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (char *)jarg5; 
+  result = (uint32_t)switch_ivr_schedule_transfer(arg1,(char const *)arg2,arg3,arg4,arg5);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_ivr_schedule_hangup(void * jarg1, char * jarg2, int jarg3, int jarg4) {
+  unsigned long jresult ;
+  time_t arg1 ;
+  char *arg2 = (char *) 0 ;
+  switch_call_cause_t arg3 ;
+  switch_bool_t arg4 ;
+  uint32_t result;
+  time_t *argp1 ;
+  
+  argp1 = (time_t *)jarg1; 
+  if (!argp1) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null time_t", 0);
+    return 0;
+  }
+  arg1 = *argp1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_call_cause_t)jarg3; 
+  arg4 = (switch_bool_t)jarg4; 
+  result = (uint32_t)switch_ivr_schedule_hangup(arg1,(char const *)arg2,arg3,arg4);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_uuid_bridge(char * jarg1, char * jarg2) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_status_t)switch_ivr_uuid_bridge((char const *)arg1,(char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_media(char * jarg1, unsigned long jarg2) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_media_flag_t arg2 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_media_flag_t)jarg2; 
+  result = (switch_status_t)switch_ivr_media((char const *)arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_nomedia(char * jarg1, unsigned long jarg2) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_media_flag_t arg2 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_media_flag_t)jarg2; 
+  result = (switch_status_t)switch_ivr_nomedia((char const *)arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_hold_uuid(char * jarg1, char * jarg2, int jarg3) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_bool_t arg3 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_bool_t)jarg3; 
+  result = (switch_status_t)switch_ivr_hold_uuid((char const *)arg1,(char const *)arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_unhold_uuid(char * jarg1) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_status_t)switch_ivr_unhold_uuid((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_hold(void * jarg1, char * jarg2, int jarg3) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_bool_t arg3 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_bool_t)jarg3; 
+  result = (switch_status_t)switch_ivr_hold(arg1,(char const *)arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_unhold(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)switch_ivr_unhold(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_ivr_schedule_broadcast(void * jarg1, char * jarg2, char * jarg3, unsigned long jarg4) {
+  unsigned long jresult ;
+  time_t arg1 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  switch_media_flag_t arg4 ;
+  uint32_t result;
+  time_t *argp1 ;
+  
+  argp1 = (time_t *)jarg1; 
+  if (!argp1) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null time_t", 0);
+    return 0;
+  }
+  arg1 = *argp1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (switch_media_flag_t)jarg4; 
+  result = (uint32_t)switch_ivr_schedule_broadcast(arg1,(char const *)arg2,(char const *)arg3,arg4);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_broadcast(char * jarg1, char * jarg2, unsigned long jarg3) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_media_flag_t arg3 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_media_flag_t)jarg3; 
+  result = (switch_status_t)switch_ivr_broadcast((char const *)arg1,(char const *)arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_transfer_variable(void * jarg1, void * jarg2, char * jarg3) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
+  char *arg3 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_core_session_t *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (switch_status_t)switch_ivr_transfer_variable(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_digit_stream_parser_new(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
+  switch_ivr_digit_stream_parser_t **arg2 = (switch_ivr_digit_stream_parser_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_memory_pool_t *)jarg1; 
+  arg2 = (switch_ivr_digit_stream_parser_t **)jarg2; 
+  result = (switch_status_t)switch_ivr_digit_stream_parser_new(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_digit_stream_parser_destroy(void * jarg1) {
+  int jresult ;
+  switch_ivr_digit_stream_parser_t *arg1 = (switch_ivr_digit_stream_parser_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_ivr_digit_stream_parser_t *)jarg1; 
+  result = (switch_status_t)switch_ivr_digit_stream_parser_destroy(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_digit_stream_new(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_ivr_digit_stream_parser_t *arg1 = (switch_ivr_digit_stream_parser_t *) 0 ;
+  switch_ivr_digit_stream_t **arg2 = (switch_ivr_digit_stream_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_ivr_digit_stream_parser_t *)jarg1; 
+  arg2 = (switch_ivr_digit_stream_t **)jarg2; 
+  result = (switch_status_t)switch_ivr_digit_stream_new(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_digit_stream_destroy(void * jarg1) {
+  int jresult ;
+  switch_ivr_digit_stream_t **arg1 = (switch_ivr_digit_stream_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_ivr_digit_stream_t **)jarg1; 
+  result = (switch_status_t)switch_ivr_digit_stream_destroy(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_digit_stream_parser_set_event(void * jarg1, char * jarg2, void * jarg3) {
+  int jresult ;
+  switch_ivr_digit_stream_parser_t *arg1 = (switch_ivr_digit_stream_parser_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *arg3 = (void *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_ivr_digit_stream_parser_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (void *)jarg3; 
+  result = (switch_status_t)switch_ivr_digit_stream_parser_set_event(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_digit_stream_parser_del_event(void * jarg1, char * jarg2) {
+  int jresult ;
+  switch_ivr_digit_stream_parser_t *arg1 = (switch_ivr_digit_stream_parser_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_ivr_digit_stream_parser_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_status_t)switch_ivr_digit_stream_parser_del_event(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_ivr_digit_stream_parser_feed(void * jarg1, void * jarg2, char jarg3) {
+  void * jresult ;
+  switch_ivr_digit_stream_parser_t *arg1 = (switch_ivr_digit_stream_parser_t *) 0 ;
+  switch_ivr_digit_stream_t *arg2 = (switch_ivr_digit_stream_t *) 0 ;
+  char arg3 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_ivr_digit_stream_parser_t *)jarg1; 
+  arg2 = (switch_ivr_digit_stream_t *)jarg2; 
+  arg3 = (char)jarg3; 
+  result = (void *)switch_ivr_digit_stream_parser_feed(arg1,arg2,arg3);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_digit_stream_reset(void * jarg1) {
+  int jresult ;
+  switch_ivr_digit_stream_t *arg1 = (switch_ivr_digit_stream_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_ivr_digit_stream_t *)jarg1; 
+  result = (switch_status_t)switch_ivr_digit_stream_reset(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_digit_stream_parser_set_terminator(void * jarg1, char jarg2) {
+  int jresult ;
+  switch_ivr_digit_stream_parser_t *arg1 = (switch_ivr_digit_stream_parser_t *) 0 ;
+  char arg2 ;
+  switch_status_t result;
+  
+  arg1 = (switch_ivr_digit_stream_parser_t *)jarg1; 
+  arg2 = (char)jarg2; 
+  result = (switch_status_t)switch_ivr_digit_stream_parser_set_terminator(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_init(void * jarg1, void * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, char * jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16, int jarg17, void * jarg18) {
+  int jresult ;
+  switch_ivr_menu_t **arg1 = (switch_ivr_menu_t **) 0 ;
+  switch_ivr_menu_t *arg2 = (switch_ivr_menu_t *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  char *arg5 = (char *) 0 ;
+  char *arg6 = (char *) 0 ;
+  char *arg7 = (char *) 0 ;
+  char *arg8 = (char *) 0 ;
+  char *arg9 = (char *) 0 ;
+  char *arg10 = (char *) 0 ;
+  char *arg11 = (char *) 0 ;
+  int arg12 ;
+  int arg13 ;
+  int arg14 ;
+  int arg15 ;
+  int arg16 ;
+  int arg17 ;
+  switch_memory_pool_t *arg18 = (switch_memory_pool_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_ivr_menu_t **)jarg1; 
+  arg2 = (switch_ivr_menu_t *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (char *)jarg5; 
+  arg6 = (char *)jarg6; 
+  arg7 = (char *)jarg7; 
+  arg8 = (char *)jarg8; 
+  arg9 = (char *)jarg9; 
+  arg10 = (char *)jarg10; 
+  arg11 = (char *)jarg11; 
+  arg12 = (int)jarg12; 
+  arg13 = (int)jarg13; 
+  arg14 = (int)jarg14; 
+  arg15 = (int)jarg15; 
+  arg16 = (int)jarg16; 
+  arg17 = (int)jarg17; 
+  arg18 = (switch_memory_pool_t *)jarg18; 
+  result = (switch_status_t)switch_ivr_menu_init(arg1,arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,(char const *)arg11,arg12,arg13,arg14,arg15,arg16,arg17,arg18);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_bind_action(void * jarg1, int jarg2, char * jarg3, char * jarg4) {
+  int jresult ;
+  switch_ivr_menu_t *arg1 = (switch_ivr_menu_t *) 0 ;
+  switch_ivr_action_t arg2 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_ivr_menu_t *)jarg1; 
+  arg2 = (switch_ivr_action_t)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  result = (switch_status_t)switch_ivr_menu_bind_action(arg1,arg2,(char const *)arg3,(char const *)arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_bind_function(void * jarg1, void * jarg2, char * jarg3, char * jarg4) {
+  int jresult ;
+  switch_ivr_menu_t *arg1 = (switch_ivr_menu_t *) 0 ;
+  switch_ivr_menu_action_function_t *arg2 = (switch_ivr_menu_action_function_t *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_ivr_menu_t *)jarg1; 
+  arg2 = (switch_ivr_menu_action_function_t *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  result = (switch_status_t)switch_ivr_menu_bind_function(arg1,arg2,(char const *)arg3,(char const *)arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_execute(void * jarg1, void * jarg2, char * jarg3, void * jarg4) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_ivr_menu_t *arg2 = (switch_ivr_menu_t *) 0 ;
+  char *arg3 = (char *) 0 ;
+  void *arg4 = (void *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_ivr_menu_t *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (void *)jarg4; 
+  result = (switch_status_t)switch_ivr_menu_execute(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_stack_free(void * jarg1) {
+  int jresult ;
+  switch_ivr_menu_t *arg1 = (switch_ivr_menu_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_ivr_menu_t *)jarg1; 
+  result = (switch_status_t)switch_ivr_menu_stack_free(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_stack_xml_build(void * jarg1, void * jarg2, void * jarg3, void * jarg4) {
+  int jresult ;
+  switch_ivr_menu_xml_ctx_t *arg1 = (switch_ivr_menu_xml_ctx_t *) 0 ;
+  switch_ivr_menu_t **arg2 = (switch_ivr_menu_t **) 0 ;
+  switch_xml_t arg3 = (switch_xml_t) 0 ;
+  switch_xml_t arg4 = (switch_xml_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_ivr_menu_xml_ctx_t *)jarg1; 
+  arg2 = (switch_ivr_menu_t **)jarg2; 
+  arg3 = (switch_xml_t)jarg3; 
+  arg4 = (switch_xml_t)jarg4; 
+  result = (switch_status_t)switch_ivr_menu_stack_xml_build(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_str2action(char * jarg1, void * jarg2) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_ivr_action_t *arg2 = (switch_ivr_action_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_ivr_action_t *)jarg2; 
+  result = (switch_status_t)switch_ivr_menu_str2action((char const *)arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_stack_xml_add_custom(void * jarg1, char * jarg2, void * jarg3) {
+  int jresult ;
+  switch_ivr_menu_xml_ctx_t *arg1 = (switch_ivr_menu_xml_ctx_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_ivr_menu_action_function_t *arg3 = (switch_ivr_menu_action_function_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_ivr_menu_xml_ctx_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_ivr_menu_action_function_t *)jarg3; 
+  result = (switch_status_t)switch_ivr_menu_stack_xml_add_custom(arg1,(char const *)arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_menu_stack_xml_init(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_ivr_menu_xml_ctx_t **arg1 = (switch_ivr_menu_xml_ctx_t **) 0 ;
+  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_ivr_menu_xml_ctx_t **)jarg1; 
+  arg2 = (switch_memory_pool_t *)jarg2; 
+  result = (switch_status_t)switch_ivr_menu_stack_xml_init(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_phrase_macro(void * jarg1, char * jarg2, char * jarg3, char * jarg4, void * jarg5) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  switch_input_args_t *arg5 = (switch_input_args_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (switch_input_args_t *)jarg5; 
+  result = (switch_status_t)switch_ivr_phrase_macro(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_delay_echo(void * jarg1, unsigned long jarg2) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  switch_ivr_delay_echo(arg1,arg2);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_find_bridged_uuid(char * jarg1, char * jarg2, void * jarg3) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_size_t arg3 ;
+  switch_status_t result;
+  switch_size_t *argp3 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  argp3 = (switch_size_t *)jarg3; 
+  if (!argp3) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg3 = *argp3; 
+  result = (switch_status_t)switch_ivr_find_bridged_uuid((char const *)arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_intercept_session(void * jarg1, char * jarg2, int jarg3) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_bool_t arg3 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_bool_t)jarg3; 
+  switch_ivr_intercept_session(arg1,(char const *)arg2,arg3);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_ivr_park_session(void * jarg1) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  switch_ivr_park_session(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_wait_for_answer(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_core_session_t *)jarg2; 
+  result = (switch_status_t)switch_ivr_wait_for_answer(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_read(void * jarg1, unsigned long jarg2, unsigned long jarg3, char * jarg4, char * jarg5, char * jarg6, void * jarg7, unsigned long jarg8, char * jarg9) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  uint32_t arg2 ;
+  uint32_t arg3 ;
+  char *arg4 = (char *) 0 ;
+  char *arg5 = (char *) 0 ;
+  char *arg6 = (char *) 0 ;
+  switch_size_t arg7 ;
+  uint32_t arg8 ;
+  char *arg9 = (char *) 0 ;
+  switch_status_t result;
+  switch_size_t *argp7 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (char *)jarg5; 
+  arg6 = (char *)jarg6; 
+  argp7 = (switch_size_t *)jarg7; 
+  if (!argp7) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg7 = *argp7; 
+  arg8 = (uint32_t)jarg8; 
+  arg9 = (char *)jarg9; 
+  result = (switch_status_t)switch_ivr_read(arg1,arg2,arg3,(char const *)arg4,(char const *)arg5,arg6,arg7,arg8,(char const *)arg9);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_bind_dtmf_meta_session(void * jarg1, unsigned long jarg2, unsigned long jarg3, char * jarg4) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  uint32_t arg2 ;
+  switch_bind_flag_t arg3 ;
+  char *arg4 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  arg3 = (switch_bind_flag_t)jarg3; 
+  arg4 = (char *)jarg4; 
+  result = (switch_status_t)switch_ivr_bind_dtmf_meta_session(arg1,arg2,arg3,(char const *)arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_unbind_dtmf_meta_session(void * jarg1, unsigned long jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  uint32_t arg2 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  result = (switch_status_t)switch_ivr_unbind_dtmf_meta_session(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_soft_hold(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  result = (switch_status_t)switch_ivr_soft_hold(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_say(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, void * jarg6) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  char *arg5 = (char *) 0 ;
+  switch_input_args_t *arg6 = (switch_input_args_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (char *)jarg5; 
+  arg6 = (switch_input_args_t *)jarg6; 
+  result = (switch_status_t)switch_ivr_say(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,arg6);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_get_say_method_by_name(char * jarg1) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_say_method_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_say_method_t)switch_ivr_get_say_method_by_name((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_get_say_type_by_name(char * jarg1) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_say_type_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_say_type_t)switch_ivr_get_say_type_by_name((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_set_user(void * jarg1, char * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_status_t)switch_ivr_set_user(arg1,(char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_sound_test(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)switch_ivr_sound_test(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_process_import(void * jarg1, void * jarg2, char * jarg3) {
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_channel_t *arg2 = (switch_channel_t *) 0 ;
+  char *arg3 = (char *) 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_channel_t *)jarg2; 
+  arg3 = (char *)jarg3; 
+  switch_process_import(arg1,arg2,(char const *)arg3);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_uuid_exists(char * jarg1) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_bool_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_bool_t)switch_ivr_uuid_exists((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_MAX_BUF_LEN_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 16384;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_MAX_CRYPTO_LEN_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 64;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_RTP_KEY_LEN_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 30;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_RTP_CRYPTO_KEY_32_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "AES_CM_128_HMAC_SHA1_32";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_RTP_CRYPTO_KEY_80_get() {
+  char * jresult ;
+  char *result = 0 ;
+  
+  result = (char *) "AES_CM_128_HMAC_SHA1_80";
+  
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_crypto_key_index_set(void * jarg1, unsigned long jarg2) {
+  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_rtp_crypto_key *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->index = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtp_crypto_key_index_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_rtp_crypto_key *)jarg1; 
+  result = (uint32_t) ((arg1)->index);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_crypto_key_type_set(void * jarg1, int jarg2) {
+  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
+  switch_rtp_crypto_key_type_t arg2 ;
+  
+  arg1 = (switch_rtp_crypto_key *)jarg1; 
+  arg2 = (switch_rtp_crypto_key_type_t)jarg2; 
+  if (arg1) (arg1)->type = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_crypto_key_type_get(void * jarg1) {
+  int jresult ;
+  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
+  switch_rtp_crypto_key_type_t result;
+  
+  arg1 = (switch_rtp_crypto_key *)jarg1; 
+  result = (switch_rtp_crypto_key_type_t) ((arg1)->type);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_crypto_key_key_set(void * jarg1, void * jarg2) {
+  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
+  unsigned char *arg2 ;
+  
+  arg1 = (switch_rtp_crypto_key *)jarg1; 
+  arg2 = (unsigned char *)jarg2; 
+  {
+    size_t ii;
+    unsigned char *b = (unsigned char *) arg1->key;
+    for (ii = 0; ii < (size_t)64; ii++) b[ii] = *((unsigned char *) arg2 + ii);
+  }
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_crypto_key_key_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
+  unsigned char *result = 0 ;
+  
+  arg1 = (switch_rtp_crypto_key *)jarg1; 
+  result = (unsigned char *)(unsigned char *) ((arg1)->key);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_crypto_key_keylen_set(void * jarg1, void * jarg2) {
+  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_rtp_crypto_key *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->keylen = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_crypto_key_keylen_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_rtp_crypto_key *)jarg1; 
+  result =  ((arg1)->keylen);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_crypto_key_next_set(void * jarg1, void * jarg2) {
+  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
+  switch_rtp_crypto_key *arg2 = (switch_rtp_crypto_key *) 0 ;
+  
+  arg1 = (switch_rtp_crypto_key *)jarg1; 
+  arg2 = (switch_rtp_crypto_key *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_crypto_key_next_get(void * jarg1) {
+  void * jresult ;
+  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
+  switch_rtp_crypto_key *result = 0 ;
+  
+  arg1 = (switch_rtp_crypto_key *)jarg1; 
+  result = (switch_rtp_crypto_key *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_rtp_crypto_key() {
+  void * jresult ;
+  switch_rtp_crypto_key *result = 0 ;
+  
+  result = (switch_rtp_crypto_key *)new switch_rtp_crypto_key();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_rtp_crypto_key(void * jarg1) {
+  switch_rtp_crypto_key *arg1 = (switch_rtp_crypto_key *) 0 ;
+  
+  arg1 = (switch_rtp_crypto_key *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_add_crypto_key(void * jarg1, int jarg2, unsigned long jarg3, int jarg4, void * jarg5, void * jarg6) {
+  int jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_rtp_crypto_direction_t arg2 ;
+  uint32_t arg3 ;
+  switch_rtp_crypto_key_type_t arg4 ;
+  unsigned char *arg5 = (unsigned char *) 0 ;
+  switch_size_t arg6 ;
+  switch_status_t result;
+  switch_size_t *argp6 ;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (switch_rtp_crypto_direction_t)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  arg4 = (switch_rtp_crypto_key_type_t)jarg4; 
+  arg5 = (unsigned char *)jarg5; 
+  argp6 = (switch_size_t *)jarg6; 
+  if (!argp6) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg6 = *argp6; 
+  result = (switch_status_t)switch_rtp_add_crypto_key(arg1,arg2,arg3,arg4,arg5,arg6);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_get_random(void * jarg1, unsigned long jarg2) {
+  void *arg1 = (void *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (void *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  switch_rtp_get_random(arg1,arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_init(void * jarg1) {
+  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
+  
+  arg1 = (switch_memory_pool_t *)jarg1; 
+  switch_rtp_init(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_shutdown() {
+  switch_rtp_shutdown();
+}
+
+
+SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_rtp_set_start_port(unsigned short jarg1) {
+  unsigned short jresult ;
+  switch_port_t arg1 ;
+  switch_port_t result;
+  
+  arg1 = (switch_port_t)jarg1; 
+  result = (switch_port_t)switch_rtp_set_start_port(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_set_ssrc(void * jarg1, unsigned long jarg2) {
+  int jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  uint32_t arg2 ;
+  switch_status_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  result = (switch_status_t)switch_rtp_set_ssrc(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_rtp_set_end_port(unsigned short jarg1) {
+  unsigned short jresult ;
+  switch_port_t arg1 ;
+  switch_port_t result;
+  
+  arg1 = (switch_port_t)jarg1; 
+  result = (switch_port_t)switch_rtp_set_end_port(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_rtp_request_port(char * jarg1) {
+  unsigned short jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_port_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_port_t)switch_rtp_request_port((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_release_port(char * jarg1, unsigned short jarg2) {
+  char *arg1 = (char *) 0 ;
+  switch_port_t arg2 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_port_t)jarg2; 
+  switch_rtp_release_port((char const *)arg1,arg2);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_set_interval(void * jarg1, unsigned long jarg2, unsigned long jarg3) {
+  int jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  uint32_t arg2 ;
+  uint32_t arg3 ;
+  switch_status_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  result = (switch_status_t)switch_rtp_set_interval(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_change_interval(void * jarg1, unsigned long jarg2, unsigned long jarg3) {
+  int jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  uint32_t arg2 ;
+  uint32_t arg3 ;
+  switch_status_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  result = (switch_status_t)switch_rtp_change_interval(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_create(void * jarg1, unsigned char jarg2, unsigned long jarg3, unsigned long jarg4, unsigned long jarg5, char * jarg6, void * jarg7, void * jarg8) {
+  int jresult ;
+  switch_rtp_t **arg1 = (switch_rtp_t **) 0 ;
+  switch_payload_t arg2 ;
+  uint32_t arg3 ;
+  uint32_t arg4 ;
+  switch_rtp_flag_t arg5 ;
+  char *arg6 = (char *) 0 ;
+  char **arg7 = (char **) 0 ;
+  switch_memory_pool_t *arg8 = (switch_memory_pool_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_rtp_t **)jarg1; 
+  arg2 = (switch_payload_t)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  arg4 = (uint32_t)jarg4; 
+  arg5 = (switch_rtp_flag_t)jarg5; 
+  arg6 = (char *)jarg6; 
+  arg7 = (char **)jarg7; 
+  arg8 = (switch_memory_pool_t *)jarg8; 
+  result = (switch_status_t)switch_rtp_create(arg1,arg2,arg3,arg4,arg5,arg6,(char const **)arg7,arg8);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_new(char * jarg1, unsigned short jarg2, char * jarg3, unsigned short jarg4, unsigned char jarg5, unsigned long jarg6, unsigned long jarg7, unsigned long jarg8, char * jarg9, void * jarg10, void * jarg11) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_port_t arg2 ;
+  char *arg3 = (char *) 0 ;
+  switch_port_t arg4 ;
+  switch_payload_t arg5 ;
+  uint32_t arg6 ;
+  uint32_t arg7 ;
+  switch_rtp_flag_t arg8 ;
+  char *arg9 = (char *) 0 ;
+  char **arg10 = (char **) 0 ;
+  switch_memory_pool_t *arg11 = (switch_memory_pool_t *) 0 ;
+  switch_rtp_t *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_port_t)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (switch_port_t)jarg4; 
+  arg5 = (switch_payload_t)jarg5; 
+  arg6 = (uint32_t)jarg6; 
+  arg7 = (uint32_t)jarg7; 
+  arg8 = (switch_rtp_flag_t)jarg8; 
+  arg9 = (char *)jarg9; 
+  arg10 = (char **)jarg10; 
+  arg11 = (switch_memory_pool_t *)jarg11; 
+  result = (switch_rtp_t *)switch_rtp_new((char const *)arg1,arg2,(char const *)arg3,arg4,arg5,arg6,arg7,arg8,arg9,(char const **)arg10,arg11);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_set_remote_address(void * jarg1, char * jarg2, unsigned short jarg3, int jarg4, void * jarg5) {
+  int jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_port_t arg3 ;
+  switch_bool_t arg4 ;
+  char **arg5 = (char **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_port_t)jarg3; 
+  arg4 = (switch_bool_t)jarg4; 
+  arg5 = (char **)jarg5; 
+  result = (switch_status_t)switch_rtp_set_remote_address(arg1,(char const *)arg2,arg3,arg4,(char const **)arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_rtp_get_remote_host(void * jarg1) {
+  char * jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  result = (char *)switch_rtp_get_remote_host(arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned short SWIGSTDCALL CSharp_switch_rtp_get_remote_port(void * jarg1) {
+  unsigned short jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_port_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  result = (switch_port_t)switch_rtp_get_remote_port(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_reset_media_timer(void * jarg1) {
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  switch_rtp_reset_media_timer(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_set_max_missed_packets(void * jarg1, unsigned long jarg2) {
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  switch_rtp_set_max_missed_packets(arg1,arg2);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_set_local_address(void * jarg1, char * jarg2, unsigned short jarg3, void * jarg4) {
+  int jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_port_t arg3 ;
+  char **arg4 = (char **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_port_t)jarg3; 
+  arg4 = (char **)jarg4; 
+  result = (switch_status_t)switch_rtp_set_local_address(arg1,(char const *)arg2,arg3,(char const **)arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_kill_socket(void * jarg1) {
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  switch_rtp_kill_socket(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_break(void * jarg1) {
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  switch_rtp_break(arg1);
+}
+
+
+SWIGEXPORT unsigned char SWIGSTDCALL CSharp_switch_rtp_ready(void * jarg1) {
+  unsigned char jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  uint8_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  result = (uint8_t)switch_rtp_ready(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_destroy(void * jarg1) {
+  switch_rtp_t **arg1 = (switch_rtp_t **) 0 ;
+  
+  arg1 = (switch_rtp_t **)jarg1; 
+  switch_rtp_destroy(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_ice(void * jarg1, char * jarg2, char * jarg3) {
+  int jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (switch_status_t)switch_rtp_activate_ice(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_jitter_buffer(void * jarg1, unsigned long jarg2) {
+  int jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  uint32_t arg2 ;
+  switch_status_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  result = (switch_status_t)switch_rtp_activate_jitter_buffer(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_set_flag(void * jarg1, unsigned long jarg2) {
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_rtp_flag_t arg2 ;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (switch_rtp_flag_t)jarg2; 
+  switch_rtp_set_flag(arg1,arg2);
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtp_test_flag(void * jarg1, unsigned long jarg2) {
+  unsigned long jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_rtp_flag_t arg2 ;
+  uint32_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (switch_rtp_flag_t)jarg2; 
+  result = (uint32_t)switch_rtp_test_flag(arg1,arg2);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_clear_flag(void * jarg1, unsigned long jarg2) {
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_rtp_flag_t arg2 ;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (switch_rtp_flag_t)jarg2; 
+  switch_rtp_clear_flag(arg1,arg2);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_get_rtp_socket(void * jarg1) {
+  void * jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_socket_t *result = 0 ;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  result = (switch_socket_t *)switch_rtp_get_rtp_socket(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtp_get_default_samples_per_interval(void * jarg1) {
+  unsigned long jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  result = (uint32_t)switch_rtp_get_default_samples_per_interval(arg1);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_set_default_payload(void * jarg1, unsigned char jarg2) {
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_payload_t arg2 ;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (switch_payload_t)jarg2; 
+  switch_rtp_set_default_payload(arg1,arg2);
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtp_get_default_payload(void * jarg1) {
+  unsigned long jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  result = (uint32_t)switch_rtp_get_default_payload(arg1);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_set_invald_handler(void * jarg1, void * jarg2) {
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_rtp_invalid_handler_t arg2 = (switch_rtp_invalid_handler_t) 0 ;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (switch_rtp_invalid_handler_t)jarg2; 
+  switch_rtp_set_invald_handler(arg1,arg2);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_read(void * jarg1, void * jarg2, void * jarg3, void * jarg4, void * jarg5, unsigned long jarg6) {
+  int jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  uint32_t *arg3 = (uint32_t *) 0 ;
+  switch_payload_t *arg4 = (switch_payload_t *) 0 ;
+  switch_frame_flag_t *arg5 = (switch_frame_flag_t *) 0 ;
+  switch_io_flag_t arg6 ;
+  switch_status_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  arg3 = (uint32_t *)jarg3; 
+  arg4 = (switch_payload_t *)jarg4; 
+  arg5 = (switch_frame_flag_t *)jarg5; 
+  arg6 = (switch_io_flag_t)jarg6; 
+  result = (switch_status_t)switch_rtp_read(arg1,arg2,arg3,arg4,arg5,arg6);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_queue_rfc2833(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_dtmf_t *arg2 = (switch_dtmf_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (switch_dtmf_t *)jarg2; 
+  result = (switch_status_t)switch_rtp_queue_rfc2833(arg1,(switch_dtmf_t const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_queue_rfc2833_in(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_dtmf_t *arg2 = (switch_dtmf_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (switch_dtmf_t *)jarg2; 
+  result = (switch_status_t)switch_rtp_queue_rfc2833_in(arg1,(switch_dtmf_t const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_has_dtmf(void * jarg1) {
+  void * jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  result = switch_rtp_has_dtmf(arg1);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_dequeue_dtmf(void * jarg1, void * jarg2) {
+  void * jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_dtmf_t *arg2 = (switch_dtmf_t *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (switch_dtmf_t *)jarg2; 
+  result = switch_rtp_dequeue_dtmf(arg1,arg2);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_zerocopy_read(void * jarg1, void * jarg2, void * jarg3, void * jarg4, void * jarg5, unsigned long jarg6) {
+  int jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  void **arg2 = (void **) 0 ;
+  uint32_t *arg3 = (uint32_t *) 0 ;
+  switch_payload_t *arg4 = (switch_payload_t *) 0 ;
+  switch_frame_flag_t *arg5 = (switch_frame_flag_t *) 0 ;
+  switch_io_flag_t arg6 ;
+  switch_status_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (void **)jarg2; 
+  arg3 = (uint32_t *)jarg3; 
+  arg4 = (switch_payload_t *)jarg4; 
+  arg5 = (switch_frame_flag_t *)jarg5; 
+  arg6 = (switch_io_flag_t)jarg6; 
+  result = (switch_status_t)switch_rtp_zerocopy_read(arg1,arg2,arg3,arg4,arg5,arg6);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_zerocopy_read_frame(void * jarg1, void * jarg2, unsigned long jarg3) {
+  int jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_frame_t *arg2 = (switch_frame_t *) 0 ;
+  switch_io_flag_t arg3 ;
+  switch_status_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (switch_frame_t *)jarg2; 
+  arg3 = (switch_io_flag_t)jarg3; 
+  result = (switch_status_t)switch_rtp_zerocopy_read_frame(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_rtp_flush_read_buffer(void * jarg1, int jarg2) {
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_rtp_flush_t arg2 ;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (switch_rtp_flush_t)jarg2; 
+  rtp_flush_read_buffer(arg1,arg2);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_enable_vad(void * jarg1, void * jarg2, void * jarg3, unsigned long jarg4) {
+  int jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
+  switch_codec_t *arg3 = (switch_codec_t *) 0 ;
+  switch_vad_flag_t arg4 ;
+  switch_status_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (switch_core_session_t *)jarg2; 
+  arg3 = (switch_codec_t *)jarg3; 
+  arg4 = (switch_vad_flag_t)jarg4; 
+  result = (switch_status_t)switch_rtp_enable_vad(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_disable_vad(void * jarg1) {
+  int jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  result = (switch_status_t)switch_rtp_disable_vad(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_write_frame(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_frame_t *arg2 = (switch_frame_t *) 0 ;
+  int result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (switch_frame_t *)jarg2; 
+  result = (int)switch_rtp_write_frame(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_write_manual(void * jarg1, void * jarg2, unsigned long jarg3, unsigned char jarg4, unsigned char jarg5, unsigned long jarg6, void * jarg7) {
+  int jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  uint32_t arg3 ;
+  uint8_t arg4 ;
+  switch_payload_t arg5 ;
+  uint32_t arg6 ;
+  switch_frame_flag_t *arg7 = (switch_frame_flag_t *) 0 ;
+  int result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  arg3 = (uint32_t)jarg3; 
+  arg4 = (uint8_t)jarg4; 
+  arg5 = (switch_payload_t)jarg5; 
+  arg6 = (uint32_t)jarg6; 
+  arg7 = (switch_frame_flag_t *)jarg7; 
+  result = (int)switch_rtp_write_manual(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_rtp_get_ssrc(void * jarg1) {
+  unsigned long jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  result = (uint32_t)switch_rtp_get_ssrc(arg1);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_set_private(void * jarg1, void * jarg2) {
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  switch_rtp_set_private(arg1,arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_set_telephony_event(void * jarg1, unsigned char jarg2) {
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_payload_t arg2 ;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (switch_payload_t)jarg2; 
+  switch_rtp_set_telephony_event(arg1,arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_set_cng_pt(void * jarg1, unsigned char jarg2) {
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_payload_t arg2 ;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (switch_payload_t)jarg2; 
+  switch_rtp_set_cng_pt(arg1,arg2);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_get_private(void * jarg1) {
+  void * jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  result = (void *)switch_rtp_get_private(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_rtp_activate_stun_ping(void * jarg1, char * jarg2, unsigned short jarg3, unsigned long jarg4, int jarg5) {
+  int jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_port_t arg3 ;
+  uint32_t arg4 ;
+  switch_bool_t arg5 ;
+  switch_status_t result;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_port_t)jarg3; 
+  arg4 = (uint32_t)jarg4; 
+  arg5 = (switch_bool_t)jarg5; 
+  result = (switch_status_t)switch_rtp_activate_stun_ping(arg1,(char const *)arg2,arg3,arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_intentional_bugs(void * jarg1, int jarg2) {
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_rtp_bug_flag_t arg2 ;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (switch_rtp_bug_flag_t)jarg2; 
+  switch_rtp_intentional_bugs(arg1,arg2);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_get_stats(void * jarg1, void * jarg2) {
+  void * jresult ;
+  switch_rtp_t *arg1 = (switch_rtp_t *) 0 ;
+  switch_memory_pool_t *arg2 = (switch_memory_pool_t *) 0 ;
+  switch_rtp_stats_t *result = 0 ;
+  
+  arg1 = (switch_rtp_t *)jarg1; 
+  arg2 = (switch_memory_pool_t *)jarg2; 
+  result = (switch_rtp_stats_t *)switch_rtp_get_stats(arg1,arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_data_set(void * jarg1, char * jarg2) {
+  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_log_node_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->data) delete [] arg1->data;
+    if (arg2) {
+      arg1->data = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->data, (const char *)arg2);
+    } else {
+      arg1->data = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_log_node_t_data_get(void * jarg1) {
+  char * jresult ;
+  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_log_node_t *)jarg1; 
+  result = (char *) ((arg1)->data);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_file_set(void * jarg1, char * jarg2) {
+  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
+  char *arg2 ;
+  
+  arg1 = (switch_log_node_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) strncpy((char *)arg1->file, (const char *)arg2, 80);
+    else arg1->file[0] = 0;
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_log_node_t_file_get(void * jarg1) {
+  char * jresult ;
+  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_log_node_t *)jarg1; 
+  result = (char *)(char *) ((arg1)->file);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_line_set(void * jarg1, unsigned long jarg2) {
+  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_log_node_t *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->line = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_log_node_t_line_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_log_node_t *)jarg1; 
+  result = (uint32_t) ((arg1)->line);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_func_set(void * jarg1, char * jarg2) {
+  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
+  char *arg2 ;
+  
+  arg1 = (switch_log_node_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) strncpy((char *)arg1->func, (const char *)arg2, 80);
+    else arg1->func[0] = 0;
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_log_node_t_func_get(void * jarg1) {
+  char * jresult ;
+  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_log_node_t *)jarg1; 
+  result = (char *)(char *) ((arg1)->func);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_level_set(void * jarg1, int jarg2) {
+  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
+  switch_log_level_t arg2 ;
+  
+  arg1 = (switch_log_node_t *)jarg1; 
+  arg2 = (switch_log_level_t)jarg2; 
+  if (arg1) (arg1)->level = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_log_node_t_level_get(void * jarg1) {
+  int jresult ;
+  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
+  switch_log_level_t result;
+  
+  arg1 = (switch_log_node_t *)jarg1; 
+  result = (switch_log_level_t) ((arg1)->level);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_timestamp_set(void * jarg1, void * jarg2) {
+  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
+  switch_time_t arg2 ;
+  switch_time_t *argp2 ;
+  
+  arg1 = (switch_log_node_t *)jarg1; 
+  argp2 = (switch_time_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->timestamp = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_log_node_t_timestamp_get(void * jarg1) {
+  void * jresult ;
+  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
+  switch_time_t result;
+  
+  arg1 = (switch_log_node_t *)jarg1; 
+  result =  ((arg1)->timestamp);
+  jresult = new switch_time_t((switch_time_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_content_set(void * jarg1, char * jarg2) {
+  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_log_node_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->content) delete [] arg1->content;
+    if (arg2) {
+      arg1->content = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->content, (const char *)arg2);
+    } else {
+      arg1->content = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_log_node_t_content_get(void * jarg1) {
+  char * jresult ;
+  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_log_node_t *)jarg1; 
+  result = (char *) ((arg1)->content);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_userdata_set(void * jarg1, char * jarg2) {
+  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_log_node_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->userdata) delete [] arg1->userdata;
+    if (arg2) {
+      arg1->userdata = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->userdata, (const char *)arg2);
+    } else {
+      arg1->userdata = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_log_node_t_userdata_get(void * jarg1) {
+  char * jresult ;
+  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_log_node_t *)jarg1; 
+  result = (char *) ((arg1)->userdata);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_t_channel_set(void * jarg1, int jarg2) {
+  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
+  switch_text_channel_t arg2 ;
+  
+  arg1 = (switch_log_node_t *)jarg1; 
+  arg2 = (switch_text_channel_t)jarg2; 
+  if (arg1) (arg1)->channel = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_log_node_t_channel_get(void * jarg1) {
+  int jresult ;
+  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
+  switch_text_channel_t result;
+  
+  arg1 = (switch_log_node_t *)jarg1; 
+  result = (switch_text_channel_t) ((arg1)->channel);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_log_node_t() {
+  void * jresult ;
+  switch_log_node_t *result = 0 ;
+  
+  result = (switch_log_node_t *)new switch_log_node_t();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_log_node_t(void * jarg1) {
+  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
+  
+  arg1 = (switch_log_node_t *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_log_init(void * jarg1, int jarg2) {
+  int jresult ;
+  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
+  switch_bool_t arg2 ;
+  switch_status_t result;
+  
+  arg1 = (switch_memory_pool_t *)jarg1; 
+  arg2 = (switch_bool_t)jarg2; 
+  result = (switch_status_t)switch_log_init(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_log_shutdown() {
+  int jresult ;
+  switch_status_t result;
+  
+  result = (switch_status_t)switch_log_shutdown();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_log_bind_logger(void * jarg1, int jarg2, int jarg3) {
+  int jresult ;
+  switch_log_function_t arg1 = (switch_log_function_t) 0 ;
+  switch_log_level_t arg2 ;
+  switch_bool_t arg3 ;
+  switch_status_t result;
+  
+  arg1 = (switch_log_function_t)jarg1; 
+  arg2 = (switch_log_level_t)jarg2; 
+  arg3 = (switch_bool_t)jarg3; 
+  result = (switch_status_t)switch_log_bind_logger(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_log_unbind_logger(void * jarg1) {
+  int jresult ;
+  switch_log_function_t arg1 = (switch_log_function_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_log_function_t)jarg1; 
+  result = (switch_status_t)switch_log_unbind_logger(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_log_level2str(int jarg1) {
+  char * jresult ;
+  switch_log_level_t arg1 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_log_level_t)jarg1; 
+  result = (char *)switch_log_level2str(arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_log_str2level(char * jarg1) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_log_level_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_log_level_t)switch_log_str2level((char const *)arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_log_str2mask(char * jarg1) {
+  unsigned long jresult ;
+  char *arg1 = (char *) 0 ;
+  uint32_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (uint32_t)switch_log_str2mask((char const *)arg1);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_log_node_dup(void * jarg1) {
+  void * jresult ;
+  switch_log_node_t *arg1 = (switch_log_node_t *) 0 ;
+  switch_log_node_t *result = 0 ;
+  
+  arg1 = (switch_log_node_t *)jarg1; 
+  result = (switch_log_node_t *)switch_log_node_dup((switch_log_node_t const *)arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_log_node_free(void * jarg1) {
+  switch_log_node_t **arg1 = (switch_log_node_t **) 0 ;
+  
+  arg1 = (switch_log_node_t **)jarg1; 
+  switch_log_node_free(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_SWITCH_XML_BUFSIZE_get() {
+  int jresult ;
+  int result;
+  
+  result = (int) 1024;
+  
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_name_set(void * jarg1, char * jarg2) {
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_xml *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->name) delete [] arg1->name;
+    if (arg2) {
+      arg1->name = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->name, (const char *)arg2);
+    } else {
+      arg1->name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_name_get(void * jarg1) {
+  char * jresult ;
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_xml *)jarg1; 
+  result = (char *) ((arg1)->name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_attr_set(void * jarg1, void * jarg2) {
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  char **arg2 = (char **) 0 ;
+  
+  arg1 = (switch_xml *)jarg1; 
+  arg2 = (char **)jarg2; 
+  if (arg1) (arg1)->attr = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_attr_get(void * jarg1) {
+  void * jresult ;
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  char **result = 0 ;
+  
+  arg1 = (switch_xml *)jarg1; 
+  result = (char **) ((arg1)->attr);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_txt_set(void * jarg1, char * jarg2) {
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_xml *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->txt) delete [] arg1->txt;
+    if (arg2) {
+      arg1->txt = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->txt, (const char *)arg2);
+    } else {
+      arg1->txt = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_txt_get(void * jarg1) {
+  char * jresult ;
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_xml *)jarg1; 
+  result = (char *) ((arg1)->txt);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_free_path_set(void * jarg1, char * jarg2) {
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_xml *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->free_path) delete [] arg1->free_path;
+    if (arg2) {
+      arg1->free_path = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->free_path, (const char *)arg2);
+    } else {
+      arg1->free_path = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_free_path_get(void * jarg1) {
+  char * jresult ;
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_xml *)jarg1; 
+  result = (char *) ((arg1)->free_path);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_off_set(void * jarg1, void * jarg2) {
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  switch_size_t arg2 ;
+  switch_size_t *argp2 ;
+  
+  arg1 = (switch_xml *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return ;
+  }
+  arg2 = *argp2; 
+  if (arg1) (arg1)->off = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_off_get(void * jarg1) {
+  void * jresult ;
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  switch_size_t result;
+  
+  arg1 = (switch_xml *)jarg1; 
+  result =  ((arg1)->off);
+  jresult = new switch_size_t((switch_size_t &)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_next_set(void * jarg1, void * jarg2) {
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  switch_xml_t arg2 = (switch_xml_t) 0 ;
+  
+  arg1 = (switch_xml *)jarg1; 
+  arg2 = (switch_xml_t)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_next_get(void * jarg1) {
+  void * jresult ;
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  switch_xml_t result;
+  
+  arg1 = (switch_xml *)jarg1; 
+  result = (switch_xml_t) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_sibling_set(void * jarg1, void * jarg2) {
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  switch_xml_t arg2 = (switch_xml_t) 0 ;
+  
+  arg1 = (switch_xml *)jarg1; 
+  arg2 = (switch_xml_t)jarg2; 
+  if (arg1) (arg1)->sibling = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_sibling_get(void * jarg1) {
+  void * jresult ;
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  switch_xml_t result;
+  
+  arg1 = (switch_xml *)jarg1; 
+  result = (switch_xml_t) ((arg1)->sibling);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_ordered_set(void * jarg1, void * jarg2) {
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  switch_xml_t arg2 = (switch_xml_t) 0 ;
+  
+  arg1 = (switch_xml *)jarg1; 
+  arg2 = (switch_xml_t)jarg2; 
+  if (arg1) (arg1)->ordered = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_ordered_get(void * jarg1) {
+  void * jresult ;
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  switch_xml_t result;
+  
+  arg1 = (switch_xml *)jarg1; 
+  result = (switch_xml_t) ((arg1)->ordered);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_child_set(void * jarg1, void * jarg2) {
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  switch_xml_t arg2 = (switch_xml_t) 0 ;
+  
+  arg1 = (switch_xml *)jarg1; 
+  arg2 = (switch_xml_t)jarg2; 
+  if (arg1) (arg1)->child = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_child_get(void * jarg1) {
+  void * jresult ;
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  switch_xml_t result;
+  
+  arg1 = (switch_xml *)jarg1; 
+  result = (switch_xml_t) ((arg1)->child);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_parent_set(void * jarg1, void * jarg2) {
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  switch_xml_t arg2 = (switch_xml_t) 0 ;
+  
+  arg1 = (switch_xml *)jarg1; 
+  arg2 = (switch_xml_t)jarg2; 
+  if (arg1) (arg1)->parent = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_parent_get(void * jarg1) {
+  void * jresult ;
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  switch_xml_t result;
+  
+  arg1 = (switch_xml *)jarg1; 
+  result = (switch_xml_t) ((arg1)->parent);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_flags_set(void * jarg1, unsigned long jarg2) {
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_xml *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->flags = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_xml_flags_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_xml *)jarg1; 
+  result = (uint32_t) ((arg1)->flags);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_xml() {
+  void * jresult ;
+  switch_xml *result = 0 ;
+  
+  result = (switch_xml *)new switch_xml();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_xml(void * jarg1) {
+  switch_xml *arg1 = (switch_xml *) 0 ;
+  
+  arg1 = (switch_xml *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_parse_str_dynamic(char * jarg1, int jarg2) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_bool_t arg2 ;
+  switch_xml_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_bool_t)jarg2; 
+  result = (switch_xml_t)switch_xml_parse_str_dynamic(arg1,arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_parse_str(char * jarg1, void * jarg2) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_size_t arg2 ;
+  switch_xml_t result;
+  switch_size_t *argp2 ;
+  
+  arg1 = (char *)jarg1; 
+  argp2 = (switch_size_t *)jarg2; 
+  if (!argp2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg2 = *argp2; 
+  result = (switch_xml_t)switch_xml_parse_str(arg1,arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_parse_fd(int jarg1) {
+  void * jresult ;
+  int arg1 ;
+  switch_xml_t result;
+  
+  arg1 = (int)jarg1; 
+  result = (switch_xml_t)switch_xml_parse_fd(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_parse_file(char * jarg1) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_xml_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_xml_t)switch_xml_parse_file((char const *)arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_parse_file_simple(char * jarg1) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_xml_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_xml_t)switch_xml_parse_file_simple((char const *)arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_parse_fp(void * jarg1) {
+  void * jresult ;
+  FILE *arg1 = (FILE *) 0 ;
+  switch_xml_t result;
+  
+  arg1 = (FILE *)jarg1; 
+  result = (switch_xml_t)switch_xml_parse_fp(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_child(void * jarg1, char * jarg2) {
+  void * jresult ;
+  switch_xml_t arg1 = (switch_xml_t) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_xml_t result;
+  
+  arg1 = (switch_xml_t)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_xml_t)switch_xml_child(arg1,(char const *)arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_find_child(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
+  void * jresult ;
+  switch_xml_t arg1 = (switch_xml_t) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  switch_xml_t result;
+  
+  arg1 = (switch_xml_t)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  result = (switch_xml_t)switch_xml_find_child(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_find_child_multi(void * jarg1, char * jarg2) {
+  void * jresult ;
+  switch_xml_t arg1 = (switch_xml_t) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *arg3 = 0 ;
+  switch_xml_t result;
+  
+  arg1 = (switch_xml_t)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_xml_t)switch_xml_find_child_multi(arg1,(char const *)arg2,arg3);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_attr(void * jarg1, char * jarg2) {
+  char * jresult ;
+  switch_xml_t arg1 = (switch_xml_t) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_xml_t)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (char *)switch_xml_attr(arg1,(char const *)arg2);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_attr_soft(void * jarg1, char * jarg2) {
+  char * jresult ;
+  switch_xml_t arg1 = (switch_xml_t) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_xml_t)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (char *)switch_xml_attr_soft(arg1,(char const *)arg2);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_get(void * jarg1) {
+  void * jresult ;
+  switch_xml_t arg1 = (switch_xml_t) 0 ;
+  void *arg2 = 0 ;
+  switch_xml_t result;
+  
+  arg1 = (switch_xml_t)jarg1; 
+  result = (switch_xml_t)switch_xml_get(arg1,arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_toxml(void * jarg1, int jarg2) {
+  char * jresult ;
+  switch_xml_t arg1 = (switch_xml_t) 0 ;
+  switch_bool_t arg2 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_xml_t)jarg1; 
+  arg2 = (switch_bool_t)jarg2; 
+  result = (char *)switch_xml_toxml(arg1,arg2);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_toxml_buf(void * jarg1, char * jarg2, void * jarg3, void * jarg4, int jarg5) {
+  char * jresult ;
+  switch_xml_t arg1 = (switch_xml_t) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_size_t arg3 ;
+  switch_size_t arg4 ;
+  switch_bool_t arg5 ;
+  char *result = 0 ;
+  switch_size_t *argp3 ;
+  switch_size_t *argp4 ;
+  
+  arg1 = (switch_xml_t)jarg1; 
+  arg2 = (char *)jarg2; 
+  argp3 = (switch_size_t *)jarg3; 
+  if (!argp3) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg3 = *argp3; 
+  argp4 = (switch_size_t *)jarg4; 
+  if (!argp4) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg4 = *argp4; 
+  arg5 = (switch_bool_t)jarg5; 
+  result = (char *)switch_xml_toxml_buf(arg1,arg2,arg3,arg4,arg5);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_free(void * jarg1) {
+  switch_xml_t arg1 = (switch_xml_t) 0 ;
+  
+  arg1 = (switch_xml_t)jarg1; 
+  switch_xml_free(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_free_in_thread(void * jarg1, int jarg2) {
+  switch_xml_t arg1 = (switch_xml_t) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_xml_t)jarg1; 
+  arg2 = (int)jarg2; 
+  switch_xml_free_in_thread(arg1,arg2);
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_xml_error(void * jarg1) {
+  char * jresult ;
+  switch_xml_t arg1 = (switch_xml_t) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_xml_t)jarg1; 
+  result = (char *)switch_xml_error(arg1);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_new(char * jarg1) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_xml_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_xml_t)switch_xml_new((char const *)arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_add_child(void * jarg1, char * jarg2, void * jarg3) {
+  void * jresult ;
+  switch_xml_t arg1 = (switch_xml_t) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_size_t arg3 ;
+  switch_xml_t result;
+  switch_size_t *argp3 ;
+  
+  arg1 = (switch_xml_t)jarg1; 
+  arg2 = (char *)jarg2; 
+  argp3 = (switch_size_t *)jarg3; 
+  if (!argp3) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg3 = *argp3; 
+  result = (switch_xml_t)switch_xml_add_child(arg1,(char const *)arg2,arg3);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_set_txt(void * jarg1, char * jarg2) {
+  void * jresult ;
+  switch_xml_t arg1 = (switch_xml_t) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_xml_t result;
+  
+  arg1 = (switch_xml_t)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (switch_xml_t)switch_xml_set_txt(arg1,(char const *)arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_set_attr(void * jarg1, char * jarg2, char * jarg3) {
+  void * jresult ;
+  switch_xml_t arg1 = (switch_xml_t) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  switch_xml_t result;
+  
+  arg1 = (switch_xml_t)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (switch_xml_t)switch_xml_set_attr(arg1,(char const *)arg2,(char const *)arg3);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_set_flag(void * jarg1, int jarg2) {
+  void * jresult ;
+  switch_xml_t arg1 = (switch_xml_t) 0 ;
+  switch_xml_flag_t arg2 ;
+  switch_xml_t result;
+  
+  arg1 = (switch_xml_t)jarg1; 
+  arg2 = (switch_xml_flag_t)jarg2; 
+  result = (switch_xml_t)switch_xml_set_flag(arg1,arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_cut(void * jarg1) {
+  void * jresult ;
+  switch_xml_t arg1 = (switch_xml_t) 0 ;
+  switch_xml_t result;
+  
+  arg1 = (switch_xml_t)jarg1; 
+  result = (switch_xml_t)switch_xml_cut(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_insert(void * jarg1, void * jarg2, void * jarg3) {
+  void * jresult ;
+  switch_xml_t arg1 = (switch_xml_t) 0 ;
+  switch_xml_t arg2 = (switch_xml_t) 0 ;
+  switch_size_t arg3 ;
+  switch_xml_t result;
+  switch_size_t *argp3 ;
+  
+  arg1 = (switch_xml_t)jarg1; 
+  arg2 = (switch_xml_t)jarg2; 
+  argp3 = (switch_size_t *)jarg3; 
+  if (!argp3) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0);
+    return 0;
+  }
+  arg3 = *argp3; 
+  result = (switch_xml_t)switch_xml_insert(arg1,arg2,arg3);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_open_root(unsigned char jarg1, void * jarg2) {
+  void * jresult ;
+  uint8_t arg1 ;
+  char **arg2 = (char **) 0 ;
+  switch_xml_t result;
+  
+  arg1 = (uint8_t)jarg1; 
+  arg2 = (char **)jarg2; 
+  result = (switch_xml_t)switch_xml_open_root(arg1,(char const **)arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_init(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ;
+  char **arg2 = (char **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_memory_pool_t *)jarg1; 
+  arg2 = (char **)jarg2; 
+  result = (switch_status_t)switch_xml_init(arg1,(char const **)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_destroy() {
+  int jresult ;
+  switch_status_t result;
+  
+  result = (switch_status_t)switch_xml_destroy();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_root() {
+  void * jresult ;
+  switch_xml_t result;
+  
+  result = (switch_xml_t)switch_xml_root();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_locate(char * jarg1, char * jarg2, char * jarg3, char * jarg4, void * jarg5, void * jarg6, void * jarg7, int jarg8) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  switch_xml_t *arg5 = (switch_xml_t *) 0 ;
+  switch_xml_t *arg6 = (switch_xml_t *) 0 ;
+  switch_event_t *arg7 = (switch_event_t *) 0 ;
+  switch_bool_t arg8 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (switch_xml_t *)jarg5; 
+  arg6 = (switch_xml_t *)jarg6; 
+  arg7 = (switch_event_t *)jarg7; 
+  arg8 = (switch_bool_t)jarg8; 
+  result = (switch_status_t)switch_xml_locate((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5,arg6,arg7,arg8);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_locate_domain(char * jarg1, void * jarg2, void * jarg3, void * jarg4) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_event_t *arg2 = (switch_event_t *) 0 ;
+  switch_xml_t *arg3 = (switch_xml_t *) 0 ;
+  switch_xml_t *arg4 = (switch_xml_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_event_t *)jarg2; 
+  arg3 = (switch_xml_t *)jarg3; 
+  arg4 = (switch_xml_t *)jarg4; 
+  result = (switch_status_t)switch_xml_locate_domain((char const *)arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_locate_group(char * jarg1, char * jarg2, void * jarg3, void * jarg4, void * jarg5, void * jarg6) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  switch_xml_t *arg3 = (switch_xml_t *) 0 ;
+  switch_xml_t *arg4 = (switch_xml_t *) 0 ;
+  switch_xml_t *arg5 = (switch_xml_t *) 0 ;
+  switch_event_t *arg6 = (switch_event_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (switch_xml_t *)jarg3; 
+  arg4 = (switch_xml_t *)jarg4; 
+  arg5 = (switch_xml_t *)jarg5; 
+  arg6 = (switch_event_t *)jarg6; 
+  result = (switch_status_t)switch_xml_locate_group((char const *)arg1,(char const *)arg2,arg3,arg4,arg5,arg6);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_locate_user(char * jarg1, char * jarg2, char * jarg3, char * jarg4, void * jarg5, void * jarg6, void * jarg7, void * jarg8, void * jarg9) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  switch_xml_t *arg5 = (switch_xml_t *) 0 ;
+  switch_xml_t *arg6 = (switch_xml_t *) 0 ;
+  switch_xml_t *arg7 = (switch_xml_t *) 0 ;
+  switch_xml_t *arg8 = (switch_xml_t *) 0 ;
+  switch_event_t *arg9 = (switch_event_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (switch_xml_t *)jarg5; 
+  arg6 = (switch_xml_t *)jarg6; 
+  arg7 = (switch_xml_t *)jarg7; 
+  arg8 = (switch_xml_t *)jarg8; 
+  arg9 = (switch_event_t *)jarg9; 
+  result = (switch_status_t)switch_xml_locate_user((char const *)arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,arg5,arg6,arg7,arg8,arg9);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_locate_user_in_domain(char * jarg1, void * jarg2, void * jarg3, void * jarg4) {
+  int jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_xml_t arg2 = (switch_xml_t) 0 ;
+  switch_xml_t *arg3 = (switch_xml_t *) 0 ;
+  switch_xml_t *arg4 = (switch_xml_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_xml_t)jarg2; 
+  arg3 = (switch_xml_t *)jarg3; 
+  arg4 = (switch_xml_t *)jarg4; 
+  result = (switch_status_t)switch_xml_locate_user_in_domain((char const *)arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_open_cfg(char * jarg1, void * jarg2, void * jarg3) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_xml_t *arg2 = (switch_xml_t *) 0 ;
+  switch_event_t *arg3 = (switch_event_t *) 0 ;
+  switch_xml_t result;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (switch_xml_t *)jarg2; 
+  arg3 = (switch_event_t *)jarg3; 
+  result = (switch_xml_t)switch_xml_open_cfg((char const *)arg1,arg2,arg3);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_set_binding_sections(void * jarg1, unsigned long jarg2) {
+  switch_xml_binding_t *arg1 = (switch_xml_binding_t *) 0 ;
+  switch_xml_section_t arg2 ;
+  
+  arg1 = (switch_xml_binding_t *)jarg1; 
+  arg2 = (switch_xml_section_t)jarg2; 
+  switch_xml_set_binding_sections(arg1,arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_set_binding_user_data(void * jarg1, void * jarg2) {
+  switch_xml_binding_t *arg1 = (switch_xml_binding_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_xml_binding_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  switch_xml_set_binding_user_data(arg1,arg2);
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_xml_get_binding_sections(void * jarg1) {
+  unsigned long jresult ;
+  switch_xml_binding_t *arg1 = (switch_xml_binding_t *) 0 ;
+  switch_xml_section_t result;
+  
+  arg1 = (switch_xml_binding_t *)jarg1; 
+  result = (switch_xml_section_t)switch_xml_get_binding_sections(arg1);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_xml_get_binding_user_data(void * jarg1) {
+  void * jresult ;
+  switch_xml_binding_t *arg1 = (switch_xml_binding_t *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_xml_binding_t *)jarg1; 
+  result = (void *)switch_xml_get_binding_user_data(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_bind_search_function_ret(void * jarg1, unsigned long jarg2, void * jarg3, void * jarg4) {
+  int jresult ;
+  switch_xml_search_function_t arg1 = (switch_xml_search_function_t) 0 ;
+  switch_xml_section_t arg2 ;
+  void *arg3 = (void *) 0 ;
+  switch_xml_binding_t **arg4 = (switch_xml_binding_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_xml_search_function_t)jarg1; 
+  arg2 = (switch_xml_section_t)jarg2; 
+  arg3 = (void *)jarg3; 
+  arg4 = (switch_xml_binding_t **)jarg4; 
+  result = (switch_status_t)switch_xml_bind_search_function_ret(arg1,arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_unbind_search_function(void * jarg1) {
+  int jresult ;
+  switch_xml_binding_t **arg1 = (switch_xml_binding_t **) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_xml_binding_t **)jarg1; 
+  result = (switch_status_t)switch_xml_unbind_search_function(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_unbind_search_function_ptr(void * jarg1) {
+  int jresult ;
+  switch_xml_search_function_t arg1 = (switch_xml_search_function_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_xml_search_function_t)jarg1; 
+  result = (switch_status_t)switch_xml_unbind_search_function_ptr(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_xml_parse_section_string(char * jarg1) {
+  unsigned long jresult ;
+  char *arg1 = (char *) 0 ;
+  switch_xml_section_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (switch_xml_section_t)switch_xml_parse_section_string((char const *)arg1);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_outgoing_channel_outgoing_channel_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_outgoing_channel *arg1 = (switch_io_event_hook_outgoing_channel *) 0 ;
+  switch_outgoing_channel_hook_t arg2 = (switch_outgoing_channel_hook_t) 0 ;
+  
+  arg1 = (switch_io_event_hook_outgoing_channel *)jarg1; 
+  arg2 = (switch_outgoing_channel_hook_t)jarg2; 
+  if (arg1) (arg1)->outgoing_channel = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_outgoing_channel_outgoing_channel_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_outgoing_channel *arg1 = (switch_io_event_hook_outgoing_channel *) 0 ;
+  switch_outgoing_channel_hook_t result;
+  
+  arg1 = (switch_io_event_hook_outgoing_channel *)jarg1; 
+  result = (switch_outgoing_channel_hook_t) ((arg1)->outgoing_channel);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_outgoing_channel_next_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_outgoing_channel *arg1 = (switch_io_event_hook_outgoing_channel *) 0 ;
+  switch_io_event_hook_outgoing_channel *arg2 = (switch_io_event_hook_outgoing_channel *) 0 ;
+  
+  arg1 = (switch_io_event_hook_outgoing_channel *)jarg1; 
+  arg2 = (switch_io_event_hook_outgoing_channel *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_outgoing_channel_next_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_outgoing_channel *arg1 = (switch_io_event_hook_outgoing_channel *) 0 ;
+  switch_io_event_hook_outgoing_channel *result = 0 ;
+  
+  arg1 = (switch_io_event_hook_outgoing_channel *)jarg1; 
+  result = (switch_io_event_hook_outgoing_channel *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_outgoing_channel() {
+  void * jresult ;
+  switch_io_event_hook_outgoing_channel *result = 0 ;
+  
+  result = (switch_io_event_hook_outgoing_channel *)new switch_io_event_hook_outgoing_channel();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_outgoing_channel(void * jarg1) {
+  switch_io_event_hook_outgoing_channel *arg1 = (switch_io_event_hook_outgoing_channel *) 0 ;
+  
+  arg1 = (switch_io_event_hook_outgoing_channel *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_receive_message_receive_message_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_receive_message *arg1 = (switch_io_event_hook_receive_message *) 0 ;
+  switch_receive_message_hook_t arg2 = (switch_receive_message_hook_t) 0 ;
+  
+  arg1 = (switch_io_event_hook_receive_message *)jarg1; 
+  arg2 = (switch_receive_message_hook_t)jarg2; 
+  if (arg1) (arg1)->receive_message = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_receive_message_receive_message_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_receive_message *arg1 = (switch_io_event_hook_receive_message *) 0 ;
+  switch_receive_message_hook_t result;
+  
+  arg1 = (switch_io_event_hook_receive_message *)jarg1; 
+  result = (switch_receive_message_hook_t) ((arg1)->receive_message);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_receive_message_next_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_receive_message *arg1 = (switch_io_event_hook_receive_message *) 0 ;
+  switch_io_event_hook_receive_message *arg2 = (switch_io_event_hook_receive_message *) 0 ;
+  
+  arg1 = (switch_io_event_hook_receive_message *)jarg1; 
+  arg2 = (switch_io_event_hook_receive_message *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_receive_message_next_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_receive_message *arg1 = (switch_io_event_hook_receive_message *) 0 ;
+  switch_io_event_hook_receive_message *result = 0 ;
+  
+  arg1 = (switch_io_event_hook_receive_message *)jarg1; 
+  result = (switch_io_event_hook_receive_message *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_receive_message() {
+  void * jresult ;
+  switch_io_event_hook_receive_message *result = 0 ;
+  
+  result = (switch_io_event_hook_receive_message *)new switch_io_event_hook_receive_message();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_receive_message(void * jarg1) {
+  switch_io_event_hook_receive_message *arg1 = (switch_io_event_hook_receive_message *) 0 ;
+  
+  arg1 = (switch_io_event_hook_receive_message *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_receive_event_receive_event_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_receive_event *arg1 = (switch_io_event_hook_receive_event *) 0 ;
+  switch_receive_event_hook_t arg2 = (switch_receive_event_hook_t) 0 ;
+  
+  arg1 = (switch_io_event_hook_receive_event *)jarg1; 
+  arg2 = (switch_receive_event_hook_t)jarg2; 
+  if (arg1) (arg1)->receive_event = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_receive_event_receive_event_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_receive_event *arg1 = (switch_io_event_hook_receive_event *) 0 ;
+  switch_receive_event_hook_t result;
+  
+  arg1 = (switch_io_event_hook_receive_event *)jarg1; 
+  result = (switch_receive_event_hook_t) ((arg1)->receive_event);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_receive_event_next_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_receive_event *arg1 = (switch_io_event_hook_receive_event *) 0 ;
+  switch_io_event_hook_receive_event *arg2 = (switch_io_event_hook_receive_event *) 0 ;
+  
+  arg1 = (switch_io_event_hook_receive_event *)jarg1; 
+  arg2 = (switch_io_event_hook_receive_event *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_receive_event_next_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_receive_event *arg1 = (switch_io_event_hook_receive_event *) 0 ;
+  switch_io_event_hook_receive_event *result = 0 ;
+  
+  arg1 = (switch_io_event_hook_receive_event *)jarg1; 
+  result = (switch_io_event_hook_receive_event *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_receive_event() {
+  void * jresult ;
+  switch_io_event_hook_receive_event *result = 0 ;
+  
+  result = (switch_io_event_hook_receive_event *)new switch_io_event_hook_receive_event();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_receive_event(void * jarg1) {
+  switch_io_event_hook_receive_event *arg1 = (switch_io_event_hook_receive_event *) 0 ;
+  
+  arg1 = (switch_io_event_hook_receive_event *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_read_frame_read_frame_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_read_frame *arg1 = (switch_io_event_hook_read_frame *) 0 ;
+  switch_read_frame_hook_t arg2 = (switch_read_frame_hook_t) 0 ;
+  
+  arg1 = (switch_io_event_hook_read_frame *)jarg1; 
+  arg2 = (switch_read_frame_hook_t)jarg2; 
+  if (arg1) (arg1)->read_frame = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_read_frame_read_frame_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_read_frame *arg1 = (switch_io_event_hook_read_frame *) 0 ;
+  switch_read_frame_hook_t result;
+  
+  arg1 = (switch_io_event_hook_read_frame *)jarg1; 
+  result = (switch_read_frame_hook_t) ((arg1)->read_frame);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_read_frame_next_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_read_frame *arg1 = (switch_io_event_hook_read_frame *) 0 ;
+  switch_io_event_hook_read_frame *arg2 = (switch_io_event_hook_read_frame *) 0 ;
+  
+  arg1 = (switch_io_event_hook_read_frame *)jarg1; 
+  arg2 = (switch_io_event_hook_read_frame *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_read_frame_next_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_read_frame *arg1 = (switch_io_event_hook_read_frame *) 0 ;
+  switch_io_event_hook_read_frame *result = 0 ;
+  
+  arg1 = (switch_io_event_hook_read_frame *)jarg1; 
+  result = (switch_io_event_hook_read_frame *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_read_frame() {
+  void * jresult ;
+  switch_io_event_hook_read_frame *result = 0 ;
+  
+  result = (switch_io_event_hook_read_frame *)new switch_io_event_hook_read_frame();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_read_frame(void * jarg1) {
+  switch_io_event_hook_read_frame *arg1 = (switch_io_event_hook_read_frame *) 0 ;
+  
+  arg1 = (switch_io_event_hook_read_frame *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_video_read_frame_video_read_frame_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_video_read_frame *arg1 = (switch_io_event_hook_video_read_frame *) 0 ;
+  switch_read_frame_hook_t arg2 = (switch_read_frame_hook_t) 0 ;
+  
+  arg1 = (switch_io_event_hook_video_read_frame *)jarg1; 
+  arg2 = (switch_read_frame_hook_t)jarg2; 
+  if (arg1) (arg1)->video_read_frame = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_video_read_frame_video_read_frame_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_video_read_frame *arg1 = (switch_io_event_hook_video_read_frame *) 0 ;
+  switch_read_frame_hook_t result;
+  
+  arg1 = (switch_io_event_hook_video_read_frame *)jarg1; 
+  result = (switch_read_frame_hook_t) ((arg1)->video_read_frame);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_video_read_frame_next_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_video_read_frame *arg1 = (switch_io_event_hook_video_read_frame *) 0 ;
+  switch_io_event_hook_video_read_frame *arg2 = (switch_io_event_hook_video_read_frame *) 0 ;
+  
+  arg1 = (switch_io_event_hook_video_read_frame *)jarg1; 
+  arg2 = (switch_io_event_hook_video_read_frame *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_video_read_frame_next_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_video_read_frame *arg1 = (switch_io_event_hook_video_read_frame *) 0 ;
+  switch_io_event_hook_video_read_frame *result = 0 ;
+  
+  arg1 = (switch_io_event_hook_video_read_frame *)jarg1; 
+  result = (switch_io_event_hook_video_read_frame *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_video_read_frame() {
+  void * jresult ;
+  switch_io_event_hook_video_read_frame *result = 0 ;
+  
+  result = (switch_io_event_hook_video_read_frame *)new switch_io_event_hook_video_read_frame();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_video_read_frame(void * jarg1) {
+  switch_io_event_hook_video_read_frame *arg1 = (switch_io_event_hook_video_read_frame *) 0 ;
+  
+  arg1 = (switch_io_event_hook_video_read_frame *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_write_frame_write_frame_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_write_frame *arg1 = (switch_io_event_hook_write_frame *) 0 ;
+  switch_write_frame_hook_t arg2 = (switch_write_frame_hook_t) 0 ;
+  
+  arg1 = (switch_io_event_hook_write_frame *)jarg1; 
+  arg2 = (switch_write_frame_hook_t)jarg2; 
+  if (arg1) (arg1)->write_frame = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_write_frame_write_frame_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_write_frame *arg1 = (switch_io_event_hook_write_frame *) 0 ;
+  switch_write_frame_hook_t result;
+  
+  arg1 = (switch_io_event_hook_write_frame *)jarg1; 
+  result = (switch_write_frame_hook_t) ((arg1)->write_frame);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_write_frame_next_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_write_frame *arg1 = (switch_io_event_hook_write_frame *) 0 ;
+  switch_io_event_hook_write_frame *arg2 = (switch_io_event_hook_write_frame *) 0 ;
+  
+  arg1 = (switch_io_event_hook_write_frame *)jarg1; 
+  arg2 = (switch_io_event_hook_write_frame *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_write_frame_next_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_write_frame *arg1 = (switch_io_event_hook_write_frame *) 0 ;
+  switch_io_event_hook_write_frame *result = 0 ;
+  
+  arg1 = (switch_io_event_hook_write_frame *)jarg1; 
+  result = (switch_io_event_hook_write_frame *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_write_frame() {
+  void * jresult ;
+  switch_io_event_hook_write_frame *result = 0 ;
+  
+  result = (switch_io_event_hook_write_frame *)new switch_io_event_hook_write_frame();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_write_frame(void * jarg1) {
+  switch_io_event_hook_write_frame *arg1 = (switch_io_event_hook_write_frame *) 0 ;
+  
+  arg1 = (switch_io_event_hook_write_frame *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_video_write_frame_video_write_frame_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_video_write_frame *arg1 = (switch_io_event_hook_video_write_frame *) 0 ;
+  switch_video_write_frame_hook_t arg2 = (switch_video_write_frame_hook_t) 0 ;
+  
+  arg1 = (switch_io_event_hook_video_write_frame *)jarg1; 
+  arg2 = (switch_video_write_frame_hook_t)jarg2; 
+  if (arg1) (arg1)->video_write_frame = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_video_write_frame_video_write_frame_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_video_write_frame *arg1 = (switch_io_event_hook_video_write_frame *) 0 ;
+  switch_video_write_frame_hook_t result;
+  
+  arg1 = (switch_io_event_hook_video_write_frame *)jarg1; 
+  result = (switch_video_write_frame_hook_t) ((arg1)->video_write_frame);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_video_write_frame_next_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_video_write_frame *arg1 = (switch_io_event_hook_video_write_frame *) 0 ;
+  switch_io_event_hook_video_write_frame *arg2 = (switch_io_event_hook_video_write_frame *) 0 ;
+  
+  arg1 = (switch_io_event_hook_video_write_frame *)jarg1; 
+  arg2 = (switch_io_event_hook_video_write_frame *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_video_write_frame_next_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_video_write_frame *arg1 = (switch_io_event_hook_video_write_frame *) 0 ;
+  switch_io_event_hook_video_write_frame *result = 0 ;
+  
+  arg1 = (switch_io_event_hook_video_write_frame *)jarg1; 
+  result = (switch_io_event_hook_video_write_frame *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_video_write_frame() {
+  void * jresult ;
+  switch_io_event_hook_video_write_frame *result = 0 ;
+  
+  result = (switch_io_event_hook_video_write_frame *)new switch_io_event_hook_video_write_frame();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_video_write_frame(void * jarg1) {
+  switch_io_event_hook_video_write_frame *arg1 = (switch_io_event_hook_video_write_frame *) 0 ;
+  
+  arg1 = (switch_io_event_hook_video_write_frame *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_kill_channel_kill_channel_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_kill_channel *arg1 = (switch_io_event_hook_kill_channel *) 0 ;
+  switch_kill_channel_hook_t arg2 = (switch_kill_channel_hook_t) 0 ;
+  
+  arg1 = (switch_io_event_hook_kill_channel *)jarg1; 
+  arg2 = (switch_kill_channel_hook_t)jarg2; 
+  if (arg1) (arg1)->kill_channel = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_kill_channel_kill_channel_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_kill_channel *arg1 = (switch_io_event_hook_kill_channel *) 0 ;
+  switch_kill_channel_hook_t result;
+  
+  arg1 = (switch_io_event_hook_kill_channel *)jarg1; 
+  result = (switch_kill_channel_hook_t) ((arg1)->kill_channel);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_kill_channel_next_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_kill_channel *arg1 = (switch_io_event_hook_kill_channel *) 0 ;
+  switch_io_event_hook_kill_channel *arg2 = (switch_io_event_hook_kill_channel *) 0 ;
+  
+  arg1 = (switch_io_event_hook_kill_channel *)jarg1; 
+  arg2 = (switch_io_event_hook_kill_channel *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_kill_channel_next_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_kill_channel *arg1 = (switch_io_event_hook_kill_channel *) 0 ;
+  switch_io_event_hook_kill_channel *result = 0 ;
+  
+  arg1 = (switch_io_event_hook_kill_channel *)jarg1; 
+  result = (switch_io_event_hook_kill_channel *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_kill_channel() {
+  void * jresult ;
+  switch_io_event_hook_kill_channel *result = 0 ;
+  
+  result = (switch_io_event_hook_kill_channel *)new switch_io_event_hook_kill_channel();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_kill_channel(void * jarg1) {
+  switch_io_event_hook_kill_channel *arg1 = (switch_io_event_hook_kill_channel *) 0 ;
+  
+  arg1 = (switch_io_event_hook_kill_channel *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_send_dtmf_send_dtmf_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_send_dtmf *arg1 = (switch_io_event_hook_send_dtmf *) 0 ;
+  switch_send_dtmf_hook_t arg2 = (switch_send_dtmf_hook_t) 0 ;
+  
+  arg1 = (switch_io_event_hook_send_dtmf *)jarg1; 
+  arg2 = (switch_send_dtmf_hook_t)jarg2; 
+  if (arg1) (arg1)->send_dtmf = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_send_dtmf_send_dtmf_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_send_dtmf *arg1 = (switch_io_event_hook_send_dtmf *) 0 ;
+  switch_send_dtmf_hook_t result;
+  
+  arg1 = (switch_io_event_hook_send_dtmf *)jarg1; 
+  result = (switch_send_dtmf_hook_t) ((arg1)->send_dtmf);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_send_dtmf_next_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_send_dtmf *arg1 = (switch_io_event_hook_send_dtmf *) 0 ;
+  switch_io_event_hook_send_dtmf *arg2 = (switch_io_event_hook_send_dtmf *) 0 ;
+  
+  arg1 = (switch_io_event_hook_send_dtmf *)jarg1; 
+  arg2 = (switch_io_event_hook_send_dtmf *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_send_dtmf_next_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_send_dtmf *arg1 = (switch_io_event_hook_send_dtmf *) 0 ;
+  switch_io_event_hook_send_dtmf *result = 0 ;
+  
+  arg1 = (switch_io_event_hook_send_dtmf *)jarg1; 
+  result = (switch_io_event_hook_send_dtmf *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_send_dtmf() {
+  void * jresult ;
+  switch_io_event_hook_send_dtmf *result = 0 ;
+  
+  result = (switch_io_event_hook_send_dtmf *)new switch_io_event_hook_send_dtmf();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_send_dtmf(void * jarg1) {
+  switch_io_event_hook_send_dtmf *arg1 = (switch_io_event_hook_send_dtmf *) 0 ;
+  
+  arg1 = (switch_io_event_hook_send_dtmf *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_recv_dtmf_recv_dtmf_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_recv_dtmf *arg1 = (switch_io_event_hook_recv_dtmf *) 0 ;
+  switch_recv_dtmf_hook_t arg2 = (switch_recv_dtmf_hook_t) 0 ;
+  
+  arg1 = (switch_io_event_hook_recv_dtmf *)jarg1; 
+  arg2 = (switch_recv_dtmf_hook_t)jarg2; 
+  if (arg1) (arg1)->recv_dtmf = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_recv_dtmf_recv_dtmf_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_recv_dtmf *arg1 = (switch_io_event_hook_recv_dtmf *) 0 ;
+  switch_recv_dtmf_hook_t result;
+  
+  arg1 = (switch_io_event_hook_recv_dtmf *)jarg1; 
+  result = (switch_recv_dtmf_hook_t) ((arg1)->recv_dtmf);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_recv_dtmf_next_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_recv_dtmf *arg1 = (switch_io_event_hook_recv_dtmf *) 0 ;
+  switch_io_event_hook_recv_dtmf *arg2 = (switch_io_event_hook_recv_dtmf *) 0 ;
+  
+  arg1 = (switch_io_event_hook_recv_dtmf *)jarg1; 
+  arg2 = (switch_io_event_hook_recv_dtmf *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_recv_dtmf_next_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_recv_dtmf *arg1 = (switch_io_event_hook_recv_dtmf *) 0 ;
+  switch_io_event_hook_recv_dtmf *result = 0 ;
+  
+  arg1 = (switch_io_event_hook_recv_dtmf *)jarg1; 
+  result = (switch_io_event_hook_recv_dtmf *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_recv_dtmf() {
+  void * jresult ;
+  switch_io_event_hook_recv_dtmf *result = 0 ;
+  
+  result = (switch_io_event_hook_recv_dtmf *)new switch_io_event_hook_recv_dtmf();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_recv_dtmf(void * jarg1) {
+  switch_io_event_hook_recv_dtmf *arg1 = (switch_io_event_hook_recv_dtmf *) 0 ;
+  
+  arg1 = (switch_io_event_hook_recv_dtmf *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_state_change_state_change_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_state_change *arg1 = (switch_io_event_hook_state_change *) 0 ;
+  switch_state_change_hook_t arg2 = (switch_state_change_hook_t) 0 ;
+  
+  arg1 = (switch_io_event_hook_state_change *)jarg1; 
+  arg2 = (switch_state_change_hook_t)jarg2; 
+  if (arg1) (arg1)->state_change = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_state_change_state_change_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_state_change *arg1 = (switch_io_event_hook_state_change *) 0 ;
+  switch_state_change_hook_t result;
+  
+  arg1 = (switch_io_event_hook_state_change *)jarg1; 
+  result = (switch_state_change_hook_t) ((arg1)->state_change);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_state_change_next_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_state_change *arg1 = (switch_io_event_hook_state_change *) 0 ;
+  switch_io_event_hook_state_change *arg2 = (switch_io_event_hook_state_change *) 0 ;
+  
+  arg1 = (switch_io_event_hook_state_change *)jarg1; 
+  arg2 = (switch_io_event_hook_state_change *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_state_change_next_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_state_change *arg1 = (switch_io_event_hook_state_change *) 0 ;
+  switch_io_event_hook_state_change *result = 0 ;
+  
+  arg1 = (switch_io_event_hook_state_change *)jarg1; 
+  result = (switch_io_event_hook_state_change *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_state_change() {
+  void * jresult ;
+  switch_io_event_hook_state_change *result = 0 ;
+  
+  result = (switch_io_event_hook_state_change *)new switch_io_event_hook_state_change();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_state_change(void * jarg1) {
+  switch_io_event_hook_state_change *arg1 = (switch_io_event_hook_state_change *) 0 ;
+  
+  arg1 = (switch_io_event_hook_state_change *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_resurrect_session_resurrect_session_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_resurrect_session *arg1 = (switch_io_event_hook_resurrect_session *) 0 ;
+  switch_resurrect_session_hook_t arg2 = (switch_resurrect_session_hook_t) 0 ;
+  
+  arg1 = (switch_io_event_hook_resurrect_session *)jarg1; 
+  arg2 = (switch_resurrect_session_hook_t)jarg2; 
+  if (arg1) (arg1)->resurrect_session = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_resurrect_session_resurrect_session_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_resurrect_session *arg1 = (switch_io_event_hook_resurrect_session *) 0 ;
+  switch_resurrect_session_hook_t result;
+  
+  arg1 = (switch_io_event_hook_resurrect_session *)jarg1; 
+  result = (switch_resurrect_session_hook_t) ((arg1)->resurrect_session);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_resurrect_session_next_set(void * jarg1, void * jarg2) {
+  switch_io_event_hook_resurrect_session *arg1 = (switch_io_event_hook_resurrect_session *) 0 ;
+  switch_io_event_hook_resurrect_session *arg2 = (switch_io_event_hook_resurrect_session *) 0 ;
+  
+  arg1 = (switch_io_event_hook_resurrect_session *)jarg1; 
+  arg2 = (switch_io_event_hook_resurrect_session *)jarg2; 
+  if (arg1) (arg1)->next = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hook_resurrect_session_next_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hook_resurrect_session *arg1 = (switch_io_event_hook_resurrect_session *) 0 ;
+  switch_io_event_hook_resurrect_session *result = 0 ;
+  
+  arg1 = (switch_io_event_hook_resurrect_session *)jarg1; 
+  result = (switch_io_event_hook_resurrect_session *) ((arg1)->next);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hook_resurrect_session() {
+  void * jresult ;
+  switch_io_event_hook_resurrect_session *result = 0 ;
+  
+  result = (switch_io_event_hook_resurrect_session *)new switch_io_event_hook_resurrect_session();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hook_resurrect_session(void * jarg1) {
+  switch_io_event_hook_resurrect_session *arg1 = (switch_io_event_hook_resurrect_session *) 0 ;
+  
+  arg1 = (switch_io_event_hook_resurrect_session *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_outgoing_channel_set(void * jarg1, void * jarg2) {
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_outgoing_channel_t *arg2 = (switch_io_event_hook_outgoing_channel_t *) 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  arg2 = (switch_io_event_hook_outgoing_channel_t *)jarg2; 
+  if (arg1) (arg1)->outgoing_channel = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_outgoing_channel_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_outgoing_channel_t *result = 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  result = (switch_io_event_hook_outgoing_channel_t *) ((arg1)->outgoing_channel);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_receive_message_set(void * jarg1, void * jarg2) {
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_receive_message_t *arg2 = (switch_io_event_hook_receive_message_t *) 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  arg2 = (switch_io_event_hook_receive_message_t *)jarg2; 
+  if (arg1) (arg1)->receive_message = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_receive_message_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_receive_message_t *result = 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  result = (switch_io_event_hook_receive_message_t *) ((arg1)->receive_message);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_receive_event_set(void * jarg1, void * jarg2) {
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_receive_event_t *arg2 = (switch_io_event_hook_receive_event_t *) 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  arg2 = (switch_io_event_hook_receive_event_t *)jarg2; 
+  if (arg1) (arg1)->receive_event = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_receive_event_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_receive_event_t *result = 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  result = (switch_io_event_hook_receive_event_t *) ((arg1)->receive_event);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_read_frame_set(void * jarg1, void * jarg2) {
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_read_frame_t *arg2 = (switch_io_event_hook_read_frame_t *) 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  arg2 = (switch_io_event_hook_read_frame_t *)jarg2; 
+  if (arg1) (arg1)->read_frame = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_read_frame_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_read_frame_t *result = 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  result = (switch_io_event_hook_read_frame_t *) ((arg1)->read_frame);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_video_read_frame_set(void * jarg1, void * jarg2) {
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_video_read_frame_t *arg2 = (switch_io_event_hook_video_read_frame_t *) 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  arg2 = (switch_io_event_hook_video_read_frame_t *)jarg2; 
+  if (arg1) (arg1)->video_read_frame = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_video_read_frame_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_video_read_frame_t *result = 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  result = (switch_io_event_hook_video_read_frame_t *) ((arg1)->video_read_frame);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_write_frame_set(void * jarg1, void * jarg2) {
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_write_frame_t *arg2 = (switch_io_event_hook_write_frame_t *) 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  arg2 = (switch_io_event_hook_write_frame_t *)jarg2; 
+  if (arg1) (arg1)->write_frame = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_write_frame_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_write_frame_t *result = 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  result = (switch_io_event_hook_write_frame_t *) ((arg1)->write_frame);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_video_write_frame_set(void * jarg1, void * jarg2) {
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_video_write_frame_t *arg2 = (switch_io_event_hook_video_write_frame_t *) 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  arg2 = (switch_io_event_hook_video_write_frame_t *)jarg2; 
+  if (arg1) (arg1)->video_write_frame = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_video_write_frame_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_video_write_frame_t *result = 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  result = (switch_io_event_hook_video_write_frame_t *) ((arg1)->video_write_frame);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_kill_channel_set(void * jarg1, void * jarg2) {
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_kill_channel_t *arg2 = (switch_io_event_hook_kill_channel_t *) 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  arg2 = (switch_io_event_hook_kill_channel_t *)jarg2; 
+  if (arg1) (arg1)->kill_channel = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_kill_channel_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_kill_channel_t *result = 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  result = (switch_io_event_hook_kill_channel_t *) ((arg1)->kill_channel);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_send_dtmf_set(void * jarg1, void * jarg2) {
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_send_dtmf_t *arg2 = (switch_io_event_hook_send_dtmf_t *) 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  arg2 = (switch_io_event_hook_send_dtmf_t *)jarg2; 
+  if (arg1) (arg1)->send_dtmf = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_send_dtmf_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_send_dtmf_t *result = 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  result = (switch_io_event_hook_send_dtmf_t *) ((arg1)->send_dtmf);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_recv_dtmf_set(void * jarg1, void * jarg2) {
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_recv_dtmf_t *arg2 = (switch_io_event_hook_recv_dtmf_t *) 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  arg2 = (switch_io_event_hook_recv_dtmf_t *)jarg2; 
+  if (arg1) (arg1)->recv_dtmf = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_recv_dtmf_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_recv_dtmf_t *result = 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  result = (switch_io_event_hook_recv_dtmf_t *) ((arg1)->recv_dtmf);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_state_change_set(void * jarg1, void * jarg2) {
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_state_change_t *arg2 = (switch_io_event_hook_state_change_t *) 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  arg2 = (switch_io_event_hook_state_change_t *)jarg2; 
+  if (arg1) (arg1)->state_change = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_state_change_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_state_change_t *result = 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  result = (switch_io_event_hook_state_change_t *) ((arg1)->state_change);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hooks_resurrect_session_set(void * jarg1, void * jarg2) {
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_resurrect_session_t *arg2 = (switch_io_event_hook_resurrect_session_t *) 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  arg2 = (switch_io_event_hook_resurrect_session_t *)jarg2; 
+  if (arg1) (arg1)->resurrect_session = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_io_event_hooks_resurrect_session_get(void * jarg1) {
+  void * jresult ;
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  switch_io_event_hook_resurrect_session_t *result = 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  result = (switch_io_event_hook_resurrect_session_t *) ((arg1)->resurrect_session);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_io_event_hooks() {
+  void * jresult ;
+  switch_io_event_hooks *result = 0 ;
+  
+  result = (switch_io_event_hooks *)new switch_io_event_hooks();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_io_event_hooks(void * jarg1) {
+  switch_io_event_hooks *arg1 = (switch_io_event_hooks *) 0 ;
+  
+  arg1 = (switch_io_event_hooks *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_outgoing_channel(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_outgoing_channel_hook_t arg2 = (switch_outgoing_channel_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_outgoing_channel_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_add_outgoing_channel(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_receive_message(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_receive_message_hook_t arg2 = (switch_receive_message_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_receive_message_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_add_receive_message(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_receive_event(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_receive_event_hook_t arg2 = (switch_receive_event_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_receive_event_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_add_receive_event(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_state_change(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_state_change_hook_t arg2 = (switch_state_change_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_state_change_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_add_state_change(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_read_frame(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_read_frame_hook_t arg2 = (switch_read_frame_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_read_frame_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_add_read_frame(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_write_frame(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_write_frame_hook_t arg2 = (switch_write_frame_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_write_frame_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_add_write_frame(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_video_read_frame(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_video_read_frame_hook_t arg2 = (switch_video_read_frame_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_video_read_frame_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_add_video_read_frame(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_video_write_frame(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_video_write_frame_hook_t arg2 = (switch_video_write_frame_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_video_write_frame_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_add_video_write_frame(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_kill_channel(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_kill_channel_hook_t arg2 = (switch_kill_channel_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_kill_channel_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_add_kill_channel(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_send_dtmf(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_send_dtmf_hook_t arg2 = (switch_send_dtmf_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_send_dtmf_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_add_send_dtmf(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_recv_dtmf(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_recv_dtmf_hook_t arg2 = (switch_recv_dtmf_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_recv_dtmf_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_add_recv_dtmf(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_add_resurrect_session(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_resurrect_session_hook_t arg2 = (switch_resurrect_session_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_resurrect_session_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_add_resurrect_session(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_outgoing_channel(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_outgoing_channel_hook_t arg2 = (switch_outgoing_channel_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_outgoing_channel_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_remove_outgoing_channel(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_receive_message(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_receive_message_hook_t arg2 = (switch_receive_message_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_receive_message_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_remove_receive_message(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_receive_event(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_receive_event_hook_t arg2 = (switch_receive_event_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_receive_event_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_remove_receive_event(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_state_change(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_state_change_hook_t arg2 = (switch_state_change_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_state_change_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_remove_state_change(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_read_frame(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_read_frame_hook_t arg2 = (switch_read_frame_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_read_frame_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_remove_read_frame(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_write_frame(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_write_frame_hook_t arg2 = (switch_write_frame_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_write_frame_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_remove_write_frame(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_video_read_frame(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_video_read_frame_hook_t arg2 = (switch_video_read_frame_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_video_read_frame_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_remove_video_read_frame(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_video_write_frame(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_video_write_frame_hook_t arg2 = (switch_video_write_frame_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_video_write_frame_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_remove_video_write_frame(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_kill_channel(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_kill_channel_hook_t arg2 = (switch_kill_channel_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_kill_channel_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_remove_kill_channel(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_send_dtmf(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_send_dtmf_hook_t arg2 = (switch_send_dtmf_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_send_dtmf_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_remove_send_dtmf(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_recv_dtmf(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_recv_dtmf_hook_t arg2 = (switch_recv_dtmf_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_recv_dtmf_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_remove_recv_dtmf(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_event_hook_remove_resurrect_session(void * jarg1, void * jarg2) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_resurrect_session_hook_t arg2 = (switch_resurrect_session_hook_t) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (switch_resurrect_session_hook_t)jarg2; 
+  result = (switch_status_t)switch_core_event_hook_remove_resurrect_session(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_scheduler_task_created_set(void * jarg1, long long jarg2) {
+  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
+  int64_t arg2 ;
+  
+  arg1 = (switch_scheduler_task *)jarg1; 
+  arg2 = (int64_t)jarg2; 
+  if (arg1) (arg1)->created = arg2;
+  
+}
+
+
+SWIGEXPORT long long SWIGSTDCALL CSharp_switch_scheduler_task_created_get(void * jarg1) {
+  long long jresult ;
+  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
+  int64_t result;
+  
+  arg1 = (switch_scheduler_task *)jarg1; 
+  result = (int64_t) ((arg1)->created);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_scheduler_task_runtime_set(void * jarg1, long long jarg2) {
+  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
+  int64_t arg2 ;
+  
+  arg1 = (switch_scheduler_task *)jarg1; 
+  arg2 = (int64_t)jarg2; 
+  if (arg1) (arg1)->runtime = arg2;
+  
+}
+
+
+SWIGEXPORT long long SWIGSTDCALL CSharp_switch_scheduler_task_runtime_get(void * jarg1) {
+  long long jresult ;
+  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
+  int64_t result;
+  
+  arg1 = (switch_scheduler_task *)jarg1; 
+  result = (int64_t) ((arg1)->runtime);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_scheduler_task_cmd_id_set(void * jarg1, unsigned long jarg2) {
+  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_scheduler_task *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->cmd_id = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_scheduler_task_cmd_id_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_scheduler_task *)jarg1; 
+  result = (uint32_t) ((arg1)->cmd_id);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_scheduler_task_group_set(void * jarg1, char * jarg2) {
+  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (switch_scheduler_task *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->group) delete [] arg1->group;
+    if (arg2) {
+      arg1->group = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->group, (const char *)arg2);
+    } else {
+      arg1->group = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_scheduler_task_group_get(void * jarg1) {
+  char * jresult ;
+  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_scheduler_task *)jarg1; 
+  result = (char *) ((arg1)->group);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_scheduler_task_cmd_arg_set(void * jarg1, void * jarg2) {
+  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (switch_scheduler_task *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->cmd_arg = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_scheduler_task_cmd_arg_get(void * jarg1) {
+  void * jresult ;
+  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (switch_scheduler_task *)jarg1; 
+  result = (void *) ((arg1)->cmd_arg);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_scheduler_task_task_id_set(void * jarg1, unsigned long jarg2) {
+  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (switch_scheduler_task *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->task_id = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_scheduler_task_task_id_get(void * jarg1) {
+  unsigned long jresult ;
+  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
+  uint32_t result;
+  
+  arg1 = (switch_scheduler_task *)jarg1; 
+  result = (uint32_t) ((arg1)->task_id);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_scheduler_task() {
+  void * jresult ;
+  switch_scheduler_task *result = 0 ;
+  
+  result = (switch_scheduler_task *)new switch_scheduler_task();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_scheduler_task(void * jarg1) {
+  switch_scheduler_task *arg1 = (switch_scheduler_task *) 0 ;
+  
+  arg1 = (switch_scheduler_task *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_scheduler_add_task(void * jarg1, void * jarg2, char * jarg3, char * jarg4, unsigned long jarg5, void * jarg6, unsigned long jarg7) {
+  unsigned long jresult ;
+  time_t arg1 ;
+  switch_scheduler_func_t arg2 = (switch_scheduler_func_t) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  uint32_t arg5 ;
+  void *arg6 = (void *) 0 ;
+  switch_scheduler_flag_t arg7 ;
+  uint32_t result;
+  time_t *argp1 ;
+  
+  argp1 = (time_t *)jarg1; 
+  if (!argp1) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null time_t", 0);
+    return 0;
+  }
+  arg1 = *argp1; 
+  arg2 = (switch_scheduler_func_t)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (uint32_t)jarg5; 
+  arg6 = (void *)jarg6; 
+  arg7 = (switch_scheduler_flag_t)jarg7; 
+  result = (uint32_t)switch_scheduler_add_task(arg1,arg2,(char const *)arg3,(char const *)arg4,arg5,arg6,arg7);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_scheduler_del_task_id(unsigned long jarg1) {
+  unsigned long jresult ;
+  uint32_t arg1 ;
+  uint32_t result;
+  
+  arg1 = (uint32_t)jarg1; 
+  result = (uint32_t)switch_scheduler_del_task_id(arg1);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_scheduler_del_task_group(char * jarg1) {
+  unsigned long jresult ;
+  char *arg1 = (char *) 0 ;
+  uint32_t result;
+  
+  arg1 = (char *)jarg1; 
+  result = (uint32_t)switch_scheduler_del_task_group((char const *)arg1);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_scheduler_task_thread_start() {
+  switch_scheduler_task_thread_start();
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_scheduler_task_thread_stop() {
+  switch_scheduler_task_thread_stop();
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_config_file_set(void * jarg1, void * jarg2) {
+  switch_config *arg1 = (switch_config *) 0 ;
+  FILE *arg2 = (FILE *) 0 ;
+  
+  arg1 = (switch_config *)jarg1; 
+  arg2 = (FILE *)jarg2; 
+  if (arg1) (arg1)->file = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_switch_config_file_get(void * jarg1) {
+  void * jresult ;
+  switch_config *arg1 = (switch_config *) 0 ;
+  FILE *result = 0 ;
+  
+  arg1 = (switch_config *)jarg1; 
+  result = (FILE *) ((arg1)->file);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_config_path_set(void * jarg1, char * jarg2) {
+  switch_config *arg1 = (switch_config *) 0 ;
+  char *arg2 ;
+  
+  arg1 = (switch_config *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) strncpy((char *)arg1->path, (const char *)arg2, 512);
+    else arg1->path[0] = 0;
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_config_path_get(void * jarg1) {
+  char * jresult ;
+  switch_config *arg1 = (switch_config *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_config *)jarg1; 
+  result = (char *)(char *) ((arg1)->path);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_config_category_set(void * jarg1, char * jarg2) {
+  switch_config *arg1 = (switch_config *) 0 ;
+  char *arg2 ;
+  
+  arg1 = (switch_config *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) strncpy((char *)arg1->category, (const char *)arg2, 256);
+    else arg1->category[0] = 0;
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_config_category_get(void * jarg1) {
+  char * jresult ;
+  switch_config *arg1 = (switch_config *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_config *)jarg1; 
+  result = (char *)(char *) ((arg1)->category);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_config_section_set(void * jarg1, char * jarg2) {
+  switch_config *arg1 = (switch_config *) 0 ;
+  char *arg2 ;
+  
+  arg1 = (switch_config *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) strncpy((char *)arg1->section, (const char *)arg2, 256);
+    else arg1->section[0] = 0;
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_config_section_get(void * jarg1) {
+  char * jresult ;
+  switch_config *arg1 = (switch_config *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_config *)jarg1; 
+  result = (char *)(char *) ((arg1)->section);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_config_buf_set(void * jarg1, char * jarg2) {
+  switch_config *arg1 = (switch_config *) 0 ;
+  char *arg2 ;
+  
+  arg1 = (switch_config *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg2) strncpy((char *)arg1->buf, (const char *)arg2, 1024);
+    else arg1->buf[0] = 0;
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_switch_config_buf_get(void * jarg1) {
+  char * jresult ;
+  switch_config *arg1 = (switch_config *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (switch_config *)jarg1; 
+  result = (char *)(char *) ((arg1)->buf);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_config_lineno_set(void * jarg1, int jarg2) {
+  switch_config *arg1 = (switch_config *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_config *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->lineno = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_config_lineno_get(void * jarg1) {
+  int jresult ;
+  switch_config *arg1 = (switch_config *) 0 ;
+  int result;
+  
+  arg1 = (switch_config *)jarg1; 
+  result = (int) ((arg1)->lineno);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_config_catno_set(void * jarg1, int jarg2) {
+  switch_config *arg1 = (switch_config *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_config *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->catno = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_config_catno_get(void * jarg1) {
+  int jresult ;
+  switch_config *arg1 = (switch_config *) 0 ;
+  int result;
+  
+  arg1 = (switch_config *)jarg1; 
+  result = (int) ((arg1)->catno);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_config_sectno_set(void * jarg1, int jarg2) {
+  switch_config *arg1 = (switch_config *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_config *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->sectno = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_config_sectno_get(void * jarg1) {
+  int jresult ;
+  switch_config *arg1 = (switch_config *) 0 ;
+  int result;
+  
+  arg1 = (switch_config *)jarg1; 
+  result = (int) ((arg1)->sectno);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_config_lockto_set(void * jarg1, int jarg2) {
+  switch_config *arg1 = (switch_config *) 0 ;
+  int arg2 ;
+  
+  arg1 = (switch_config *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->lockto = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_config_lockto_get(void * jarg1) {
+  int jresult ;
+  switch_config *arg1 = (switch_config *) 0 ;
+  int result;
+  
+  arg1 = (switch_config *)jarg1; 
+  result = (int) ((arg1)->lockto);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_config() {
+  void * jresult ;
+  switch_config *result = 0 ;
+  
+  result = (switch_config *)new switch_config();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_switch_config(void * jarg1) {
+  switch_config *arg1 = (switch_config *) 0 ;
+  
+  arg1 = (switch_config *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_config_open_file(void * jarg1, char * jarg2) {
+  int jresult ;
+  switch_config_t *arg1 = (switch_config_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  
+  arg1 = (switch_config_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (int)switch_config_open_file(arg1,arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_switch_config_close_file(void * jarg1) {
+  switch_config_t *arg1 = (switch_config_t *) 0 ;
+  
+  arg1 = (switch_config_t *)jarg1; 
+  switch_config_close_file(arg1);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_switch_config_next_pair(void * jarg1, void * jarg2, void * jarg3) {
+  int jresult ;
+  switch_config_t *arg1 = (switch_config_t *) 0 ;
+  char **arg2 = (char **) 0 ;
+  char **arg3 = (char **) 0 ;
+  int result;
+  
+  arg1 = (switch_config_t *)jarg1; 
+  arg2 = (char **)jarg2; 
+  arg3 = (char **)jarg3; 
+  result = (int)switch_config_next_pair(arg1,arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_consoleLog(char * jarg1, char * jarg2) {
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  consoleLog(arg1,arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_consoleCleanLog(char * jarg1) {
+  char *arg1 = (char *) 0 ;
+  
+  arg1 = (char *)jarg1; 
+  consoleCleanLog(arg1);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_IvrMenu(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10, int jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16) {
+  void * jresult ;
+  IVRMenu *arg1 = (IVRMenu *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  char *arg5 = (char *) 0 ;
+  char *arg6 = (char *) 0 ;
+  char *arg7 = (char *) 0 ;
+  char *arg8 = (char *) 0 ;
+  char *arg9 = (char *) 0 ;
+  char *arg10 = (char *) 0 ;
+  int arg11 ;
+  int arg12 ;
+  int arg13 ;
+  int arg14 ;
+  int arg15 ;
+  int arg16 ;
+  IVRMenu *result = 0 ;
+  
+  arg1 = (IVRMenu *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (char *)jarg5; 
+  arg6 = (char *)jarg6; 
+  arg7 = (char *)jarg7; 
+  arg8 = (char *)jarg8; 
+  arg9 = (char *)jarg9; 
+  arg10 = (char *)jarg10; 
+  arg11 = (int)jarg11; 
+  arg12 = (int)jarg12; 
+  arg13 = (int)jarg13; 
+  arg14 = (int)jarg14; 
+  arg15 = (int)jarg15; 
+  arg16 = (int)jarg16; 
+  result = (IVRMenu *)new IVRMenu(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,(char const *)arg9,(char const *)arg10,arg11,arg12,arg13,arg14,arg15,arg16);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_IvrMenu(void * jarg1) {
+  IVRMenu *arg1 = (IVRMenu *) 0 ;
+  
+  arg1 = (IVRMenu *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_IvrMenu_bindAction(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
+  IVRMenu *arg1 = (IVRMenu *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  
+  arg1 = (IVRMenu *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  (arg1)->bindAction(arg2,(char const *)arg3,(char const *)arg4);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_IvrMenu_Execute(void * jarg1, void * jarg2, char * jarg3) {
+  IVRMenu *arg1 = (IVRMenu *) 0 ;
+  CoreSession *arg2 = (CoreSession *) 0 ;
+  char *arg3 = (char *) 0 ;
+  
+  arg1 = (IVRMenu *)jarg1; 
+  arg2 = (CoreSession *)jarg2; 
+  arg3 = (char *)jarg3; 
+  (arg1)->execute(arg2,(char const *)arg3);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_Api() {
+  void * jresult ;
+  API *result = 0 ;
+  
+  result = (API *)new API();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_Api(void * jarg1) {
+  API *arg1 = (API *) 0 ;
+  
+  arg1 = (API *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_Api_Execute(void * jarg1, char * jarg2, char * jarg3) {
+  char * jresult ;
+  API *arg1 = (API *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  char *result = 0 ;
+  
+  arg1 = (API *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (char *)(arg1)->execute((char const *)arg2,(char const *)arg3);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_Api_ExecuteString(void * jarg1, char * jarg2) {
+  char * jresult ;
+  API *arg1 = (API *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (API *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (char *)(arg1)->executeString((char const *)arg2);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_Api_getTime(void * jarg1) {
+  char * jresult ;
+  API *arg1 = (API *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (API *)jarg1; 
+  result = (char *)(arg1)->getTime();
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_input_callback_state_t_function_set(void * jarg1, void * jarg2) {
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (input_callback_state_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->function = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_input_callback_state_t_function_get(void * jarg1) {
+  void * jresult ;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (input_callback_state_t *)jarg1; 
+  result = (void *) ((arg1)->function);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_input_callback_state_t_threadState_set(void * jarg1, void * jarg2) {
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (input_callback_state_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->threadState = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_input_callback_state_t_threadState_get(void * jarg1) {
+  void * jresult ;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (input_callback_state_t *)jarg1; 
+  result = (void *) ((arg1)->threadState);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_input_callback_state_t_extra_set(void * jarg1, void * jarg2) {
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  
+  arg1 = (input_callback_state_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  if (arg1) (arg1)->extra = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_input_callback_state_t_extra_get(void * jarg1) {
+  void * jresult ;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (input_callback_state_t *)jarg1; 
+  result = (void *) ((arg1)->extra);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_input_callback_state_t_funcargs_set(void * jarg1, char * jarg2) {
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (input_callback_state_t *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->funcargs) delete [] arg1->funcargs;
+    if (arg2) {
+      arg1->funcargs = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->funcargs, (const char *)arg2);
+    } else {
+      arg1->funcargs = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_input_callback_state_t_funcargs_get(void * jarg1) {
+  char * jresult ;
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (input_callback_state_t *)jarg1; 
+  result = (char *) ((arg1)->funcargs);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_input_callback_state_t() {
+  void * jresult ;
+  input_callback_state_t *result = 0 ;
+  
+  result = (input_callback_state_t *)new input_callback_state_t();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_input_callback_state_t(void * jarg1) {
+  input_callback_state_t *arg1 = (input_callback_state_t *) 0 ;
+  
+  arg1 = (input_callback_state_t *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_DTMF_digit_set(void * jarg1, char jarg2) {
+  DTMF *arg1 = (DTMF *) 0 ;
+  char arg2 ;
+  
+  arg1 = (DTMF *)jarg1; 
+  arg2 = (char)jarg2; 
+  if (arg1) (arg1)->digit = arg2;
+  
+}
+
+
+SWIGEXPORT char SWIGSTDCALL CSharp_DTMF_digit_get(void * jarg1) {
+  char jresult ;
+  DTMF *arg1 = (DTMF *) 0 ;
+  char result;
+  
+  arg1 = (DTMF *)jarg1; 
+  result = (char) ((arg1)->digit);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_DTMF_duration_set(void * jarg1, unsigned long jarg2) {
+  DTMF *arg1 = (DTMF *) 0 ;
+  uint32_t arg2 ;
+  
+  arg1 = (DTMF *)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  if (arg1) (arg1)->duration = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned long SWIGSTDCALL CSharp_DTMF_duration_get(void * jarg1) {
+  unsigned long jresult ;
+  DTMF *arg1 = (DTMF *) 0 ;
+  uint32_t result;
+  
+  arg1 = (DTMF *)jarg1; 
+  result = (uint32_t) ((arg1)->duration);
+  jresult = (unsigned long)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_DTMF(char jarg1, unsigned long jarg2) {
+  void * jresult ;
+  char arg1 ;
+  uint32_t arg2 = (uint32_t) 2000 ;
+  DTMF *result = 0 ;
+  
+  arg1 = (char)jarg1; 
+  arg2 = (uint32_t)jarg2; 
+  result = (DTMF *)new DTMF(arg1,arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_DTMF(void * jarg1) {
+  DTMF *arg1 = (DTMF *) 0 ;
+  
+  arg1 = (DTMF *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_Stream__SWIG_0() {
+  void * jresult ;
+  Stream *result = 0 ;
+  
+  result = (Stream *)new Stream();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_Stream__SWIG_1(void * jarg1) {
+  void * jresult ;
+  switch_stream_handle_t *arg1 = (switch_stream_handle_t *) 0 ;
+  Stream *result = 0 ;
+  
+  arg1 = (switch_stream_handle_t *)jarg1; 
+  result = (Stream *)new Stream(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_Stream(void * jarg1) {
+  Stream *arg1 = (Stream *) 0 ;
+  
+  arg1 = (Stream *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_Stream_Write(void * jarg1, char * jarg2) {
+  Stream *arg1 = (Stream *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (Stream *)jarg1; 
+  arg2 = (char *)jarg2; 
+  (arg1)->write((char const *)arg2);
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_Stream_get_data(void * jarg1) {
+  char * jresult ;
+  Stream *arg1 = (Stream *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (Stream *)jarg1; 
+  result = (char *)(arg1)->get_data();
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_Event_InternalEvent_set(void * jarg1, void * jarg2) {
+  Event *arg1 = (Event *) 0 ;
+  switch_event_t *arg2 = (switch_event_t *) 0 ;
+  
+  arg1 = (Event *)jarg1; 
+  arg2 = (switch_event_t *)jarg2; 
+  if (arg1) (arg1)->event = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_Event_InternalEvent_get(void * jarg1) {
+  void * jresult ;
+  Event *arg1 = (Event *) 0 ;
+  switch_event_t *result = 0 ;
+  
+  arg1 = (Event *)jarg1; 
+  result = (switch_event_t *) ((arg1)->event);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_Event_serialized_string_set(void * jarg1, char * jarg2) {
+  Event *arg1 = (Event *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (Event *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->serialized_string) delete [] arg1->serialized_string;
+    if (arg2) {
+      arg1->serialized_string = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->serialized_string, (const char *)arg2);
+    } else {
+      arg1->serialized_string = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_Event_serialized_string_get(void * jarg1) {
+  char * jresult ;
+  Event *arg1 = (Event *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (Event *)jarg1; 
+  result = (char *) ((arg1)->serialized_string);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_Event_mine_set(void * jarg1, int jarg2) {
+  Event *arg1 = (Event *) 0 ;
+  int arg2 ;
+  
+  arg1 = (Event *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->mine = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_Event_mine_get(void * jarg1) {
+  int jresult ;
+  Event *arg1 = (Event *) 0 ;
+  int result;
+  
+  arg1 = (Event *)jarg1; 
+  result = (int) ((arg1)->mine);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_Event__SWIG_0(char * jarg1, char * jarg2) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) NULL ;
+  Event *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (Event *)new Event((char const *)arg1,(char const *)arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_Event__SWIG_1(void * jarg1, int jarg2) {
+  void * jresult ;
+  switch_event_t *arg1 = (switch_event_t *) 0 ;
+  int arg2 = (int) 0 ;
+  Event *result = 0 ;
+  
+  arg1 = (switch_event_t *)jarg1; 
+  arg2 = (int)jarg2; 
+  result = (Event *)new Event(arg1,arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_Event(void * jarg1) {
+  Event *arg1 = (Event *) 0 ;
+  
+  arg1 = (Event *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_Event_Serialize(void * jarg1, char * jarg2) {
+  char * jresult ;
+  Event *arg1 = (Event *) 0 ;
+  char *arg2 = (char *) NULL ;
+  char *result = 0 ;
+  
+  arg1 = (Event *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (char *)(arg1)->serialize((char const *)arg2);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_Event_SetPriority(void * jarg1, int jarg2) {
+  unsigned int jresult ;
+  Event *arg1 = (Event *) 0 ;
+  switch_priority_t arg2 = (switch_priority_t) SWITCH_PRIORITY_NORMAL ;
+  bool result;
+  
+  arg1 = (Event *)jarg1; 
+  arg2 = (switch_priority_t)jarg2; 
+  result = (bool)(arg1)->setPriority(arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_Event_GetHeader(void * jarg1, char * jarg2) {
+  char * jresult ;
+  Event *arg1 = (Event *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (Event *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (char *)(arg1)->getHeader((char const *)arg2);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_Event_GetBody(void * jarg1) {
+  char * jresult ;
+  Event *arg1 = (Event *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (Event *)jarg1; 
+  result = (char *)(arg1)->getBody();
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_Event_GetEventType(void * jarg1) {
+  char * jresult ;
+  Event *arg1 = (Event *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (Event *)jarg1; 
+  result = (char *)(arg1)->getType();
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_Event_AddBody(void * jarg1, char * jarg2) {
+  unsigned int jresult ;
+  Event *arg1 = (Event *) 0 ;
+  char *arg2 = (char *) 0 ;
+  bool result;
+  
+  arg1 = (Event *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (bool)(arg1)->addBody((char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_Event_AddHeader(void * jarg1, char * jarg2, char * jarg3) {
+  unsigned int jresult ;
+  Event *arg1 = (Event *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  bool result;
+  
+  arg1 = (Event *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  result = (bool)(arg1)->addHeader((char const *)arg2,(char const *)arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_Event_DeleteHeader(void * jarg1, char * jarg2) {
+  unsigned int jresult ;
+  Event *arg1 = (Event *) 0 ;
+  char *arg2 = (char *) 0 ;
+  bool result;
+  
+  arg1 = (Event *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (bool)(arg1)->delHeader((char const *)arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_Event_Fire(void * jarg1) {
+  unsigned int jresult ;
+  Event *arg1 = (Event *) 0 ;
+  bool result;
+  
+  arg1 = (Event *)jarg1; 
+  result = (bool)(arg1)->fire();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_EventConsumer_events_set(void * jarg1, void * jarg2) {
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_queue_t *arg2 = (switch_queue_t *) 0 ;
+  
+  arg1 = (EventConsumer *)jarg1; 
+  arg2 = (switch_queue_t *)jarg2; 
+  if (arg1) (arg1)->events = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_EventConsumer_events_get(void * jarg1) {
+  void * jresult ;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_queue_t *result = 0 ;
+  
+  arg1 = (EventConsumer *)jarg1; 
+  result = (switch_queue_t *) ((arg1)->events);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_EventConsumer_e_event_id_set(void * jarg1, int jarg2) {
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_event_types_t arg2 ;
+  
+  arg1 = (EventConsumer *)jarg1; 
+  arg2 = (switch_event_types_t)jarg2; 
+  if (arg1) (arg1)->e_event_id = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_EventConsumer_e_event_id_get(void * jarg1) {
+  int jresult ;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_event_types_t result;
+  
+  arg1 = (EventConsumer *)jarg1; 
+  result = (switch_event_types_t) ((arg1)->e_event_id);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_EventConsumer_node_set(void * jarg1, void * jarg2) {
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_event_node_t *arg2 = (switch_event_node_t *) 0 ;
+  
+  arg1 = (EventConsumer *)jarg1; 
+  arg2 = (switch_event_node_t *)jarg2; 
+  if (arg1) (arg1)->node = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_EventConsumer_node_get(void * jarg1) {
+  void * jresult ;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  switch_event_node_t *result = 0 ;
+  
+  arg1 = (EventConsumer *)jarg1; 
+  result = (switch_event_node_t *) ((arg1)->node);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_EventConsumer_e_callback_set(void * jarg1, char * jarg2) {
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (EventConsumer *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->e_callback) delete [] arg1->e_callback;
+    if (arg2) {
+      arg1->e_callback = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->e_callback, (const char *)arg2);
+    } else {
+      arg1->e_callback = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_EventConsumer_e_callback_get(void * jarg1) {
+  char * jresult ;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (EventConsumer *)jarg1; 
+  result = (char *) ((arg1)->e_callback);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_EventConsumer_e_subclass_name_set(void * jarg1, char * jarg2) {
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (EventConsumer *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->e_subclass_name) delete [] arg1->e_subclass_name;
+    if (arg2) {
+      arg1->e_subclass_name = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->e_subclass_name, (const char *)arg2);
+    } else {
+      arg1->e_subclass_name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_EventConsumer_e_subclass_name_get(void * jarg1) {
+  char * jresult ;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (EventConsumer *)jarg1; 
+  result = (char *) ((arg1)->e_subclass_name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_EventConsumer_e_cb_arg_set(void * jarg1, char * jarg2) {
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (EventConsumer *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->e_cb_arg) delete [] arg1->e_cb_arg;
+    if (arg2) {
+      arg1->e_cb_arg = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->e_cb_arg, (const char *)arg2);
+    } else {
+      arg1->e_cb_arg = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_EventConsumer_e_cb_arg_get(void * jarg1) {
+  char * jresult ;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (EventConsumer *)jarg1; 
+  result = (char *) ((arg1)->e_cb_arg);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_EventConsumer(char * jarg1, char * jarg2) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) "" ;
+  EventConsumer *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (EventConsumer *)new EventConsumer((char const *)arg1,(char const *)arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_EventConsumer(void * jarg1) {
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  
+  arg1 = (EventConsumer *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_EventConsumer_pop(void * jarg1, int jarg2) {
+  void * jresult ;
+  EventConsumer *arg1 = (EventConsumer *) 0 ;
+  int arg2 = (int) 0 ;
+  Event *result = 0 ;
+  
+  arg1 = (EventConsumer *)jarg1; 
+  arg2 = (int)jarg2; 
+  result = (Event *)(arg1)->pop(arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_CoreSession(void * jarg1) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_InternalSession_set(void * jarg1, void * jarg2) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_core_session_t *arg2 = (switch_core_session_t *) 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (switch_core_session_t *)jarg2; 
+  if (arg1) (arg1)->session = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_CoreSession_InternalSession_get(void * jarg1) {
+  void * jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_core_session_t *result = 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (switch_core_session_t *) ((arg1)->session);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_channel_set(void * jarg1, void * jarg2) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_channel_t *arg2 = (switch_channel_t *) 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (switch_channel_t *)jarg2; 
+  if (arg1) (arg1)->channel = arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_CoreSession_channel_get(void * jarg1) {
+  void * jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_channel_t *result = 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (switch_channel_t *) ((arg1)->channel);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_flags_set(void * jarg1, unsigned int jarg2) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  unsigned int arg2 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (unsigned int)jarg2; 
+  if (arg1) (arg1)->flags = arg2;
+  
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_CoreSession_flags_get(void * jarg1) {
+  unsigned int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  unsigned int result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (unsigned int) ((arg1)->flags);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_allocated_set(void * jarg1, int jarg2) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (int)jarg2; 
+  if (arg1) (arg1)->allocated = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_allocated_get(void * jarg1) {
+  int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (int) ((arg1)->allocated);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_cb_state_set(void * jarg1, void * jarg2) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  input_callback_state *arg2 = (input_callback_state *) 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (input_callback_state *)jarg2; 
+  if (arg1) (arg1)->cb_state = *arg2;
+  
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_CoreSession_cb_state_get(void * jarg1) {
+  void * jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  input_callback_state *result = 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (input_callback_state *)& ((arg1)->cb_state);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_HookState_set(void * jarg1, int jarg2) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_channel_state_t arg2 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (switch_channel_state_t)jarg2; 
+  if (arg1) (arg1)->hook_state = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_HookState_get(void * jarg1) {
+  int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_channel_state_t result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (switch_channel_state_t) ((arg1)->hook_state);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_cause_set(void * jarg1, int jarg2) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_call_cause_t arg2 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (switch_call_cause_t)jarg2; 
+  if (arg1) (arg1)->cause = arg2;
+  
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_cause_get(void * jarg1) {
+  int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_call_cause_t result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (switch_call_cause_t) ((arg1)->cause);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_uuid_set(void * jarg1, char * jarg2) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->uuid) delete [] arg1->uuid;
+    if (arg2) {
+      arg1->uuid = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->uuid, (const char *)arg2);
+    } else {
+      arg1->uuid = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_uuid_get(void * jarg1) {
+  char * jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (char *) ((arg1)->uuid);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_tts_name_set(void * jarg1, char * jarg2) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->tts_name) delete [] arg1->tts_name;
+    if (arg2) {
+      arg1->tts_name = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->tts_name, (const char *)arg2);
+    } else {
+      arg1->tts_name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_tts_name_get(void * jarg1) {
+  char * jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (char *) ((arg1)->tts_name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_voice_name_set(void * jarg1, char * jarg2) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (char *)jarg2; 
+  {
+    if (arg1->voice_name) delete [] arg1->voice_name;
+    if (arg2) {
+      arg1->voice_name = (char *) (new char[strlen((const char *)arg2)+1]);
+      strcpy((char *)arg1->voice_name, (const char *)arg2);
+    } else {
+      arg1->voice_name = 0;
+    }
+  }
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_voice_name_get(void * jarg1) {
+  char * jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (char *) ((arg1)->voice_name);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_Answer(void * jarg1) {
+  int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (int)(arg1)->answer();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_preAnswer(void * jarg1) {
+  int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (int)(arg1)->preAnswer();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_Hangup(void * jarg1, char * jarg2) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) "normal_clearing" ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (char *)jarg2; 
+  (arg1)->hangup((char const *)arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_hangupState(void * jarg1) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  (arg1)->hangupState();
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_SetVariable(void * jarg1, char * jarg2, char * jarg3) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  (arg1)->setVariable(arg2,arg3);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_SetPrivate(void * jarg1, char * jarg2, void * jarg3) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *arg3 = (void *) 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (void *)jarg3; 
+  (arg1)->setPrivate(arg2,arg3);
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_CoreSession_GetPrivate(void * jarg1, char * jarg2) {
+  void * jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  void *result = 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (void *)(arg1)->getPrivate(arg2);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_GetVariable(void * jarg1, char * jarg2) {
+  char * jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (char *)(arg1)->getVariable(arg2);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_Say(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *arg4 = (char *) 0 ;
+  char *arg5 = (char *) 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (char *)jarg5; 
+  (arg1)->say((char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_SayPhrase(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) "" ;
+  char *arg4 = (char *) NULL ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  (arg1)->sayPhrase((char const *)arg2,(char const *)arg3,(char const *)arg4);
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_hangupCause(void * jarg1) {
+  char * jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (char *)(arg1)->hangupCause();
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_getState(void * jarg1) {
+  char * jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (char *)(arg1)->getState();
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_RecordFile(void * jarg1, char * jarg2, int jarg3, int jarg4, int jarg5) {
+  int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 = (int) 0 ;
+  int arg4 = (int) 0 ;
+  int arg5 = (int) 0 ;
+  int result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (int)jarg3; 
+  arg4 = (int)jarg4; 
+  arg5 = (int)jarg5; 
+  result = (int)(arg1)->recordFile(arg2,arg3,arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_originate(void * jarg1, void * jarg2, char * jarg3, int jarg4, void * jarg5) {
+  int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  CoreSession *arg2 = (CoreSession *) 0 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 = (int) 60 ;
+  switch_state_handler_table_t *arg5 = (switch_state_handler_table_t *) NULL ;
+  int result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (CoreSession *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int)jarg4; 
+  arg5 = (switch_state_handler_table_t *)jarg5; 
+  result = (int)(arg1)->originate(arg2,arg3,arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_destroy(void * jarg1) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  (arg1)->destroy();
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_Speak(void * jarg1, char * jarg2) {
+  int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (char *)jarg2; 
+  result = (int)(arg1)->speak(arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_SetTtsParameters(void * jarg1, char * jarg2, char * jarg3) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  (arg1)->set_tts_parms(arg2,arg3);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_CollectDigits__SWIG_0(void * jarg1, int jarg2) {
+  int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  int result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (int)jarg2; 
+  result = (int)(arg1)->collectDigits(arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_CollectDigits__SWIG_1(void * jarg1, int jarg2, int jarg3) {
+  int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  int arg3 ;
+  int result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (int)jarg2; 
+  arg3 = (int)jarg3; 
+  result = (int)(arg1)->collectDigits(arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_GetDigits__SWIG_0(void * jarg1, int jarg2, char * jarg3, int jarg4) {
+  char * jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  char *result = 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (int)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int)jarg4; 
+  result = (char *)(arg1)->getDigits(arg2,arg3,arg4);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_GetDigits__SWIG_1(void * jarg1, int jarg2, char * jarg3, int jarg4, int jarg5) {
+  char * jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  char *arg3 = (char *) 0 ;
+  int arg4 ;
+  int arg5 ;
+  char *result = 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (int)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (int)jarg4; 
+  arg5 = (int)jarg5; 
+  result = (char *)(arg1)->getDigits(arg2,arg3,arg4,arg5);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_Transfer(void * jarg1, char * jarg2, char * jarg3, char * jarg4) {
+  int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  char *arg4 = (char *) NULL ;
+  int result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  arg4 = (char *)jarg4; 
+  result = (int)(arg1)->transfer(arg2,arg3,arg4);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_read(void * jarg1, int jarg2, int jarg3, char * jarg4, int jarg5, char * jarg6) {
+  char * jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  int arg3 ;
+  char *arg4 = (char *) 0 ;
+  int arg5 ;
+  char *arg6 = (char *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (int)jarg2; 
+  arg3 = (int)jarg3; 
+  arg4 = (char *)jarg4; 
+  arg5 = (int)jarg5; 
+  arg6 = (char *)jarg6; 
+  result = (char *)(arg1)->read(arg2,arg3,(char const *)arg4,arg5,(char const *)arg6);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_PlayAndGetDigits(void * jarg1, int jarg2, int jarg3, int jarg4, int jarg5, char * jarg6, char * jarg7, char * jarg8, char * jarg9, char * jarg10) {
+  char * jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  int arg3 ;
+  int arg4 ;
+  int arg5 ;
+  char *arg6 = (char *) 0 ;
+  char *arg7 = (char *) 0 ;
+  char *arg8 = (char *) 0 ;
+  char *arg9 = (char *) 0 ;
+  char *arg10 = (char *) NULL ;
+  char *result = 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (int)jarg2; 
+  arg3 = (int)jarg3; 
+  arg4 = (int)jarg4; 
+  arg5 = (int)jarg5; 
+  arg6 = (char *)jarg6; 
+  arg7 = (char *)jarg7; 
+  arg8 = (char *)jarg8; 
+  arg9 = (char *)jarg9; 
+  arg10 = (char *)jarg10; 
+  result = (char *)(arg1)->playAndGetDigits(arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,(char const *)arg10);
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_StreamFile(void * jarg1, char * jarg2, int jarg3) {
+  int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  int arg3 = (int) 0 ;
+  int result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (int)jarg3; 
+  result = (int)(arg1)->streamFile(arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_sleep(void * jarg1, int jarg2, int jarg3) {
+  int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int arg2 ;
+  int arg3 = (int) 0 ;
+  int result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (int)jarg2; 
+  arg3 = (int)jarg3; 
+  result = (int)(arg1)->sleep(arg2,arg3);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_flushEvents(void * jarg1) {
+  int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (int)(arg1)->flushEvents();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_flushDigits(void * jarg1) {
+  int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  int result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (int)(arg1)->flushDigits();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_CoreSession_SetAutoHangup(void * jarg1, unsigned int jarg2) {
+  int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool arg2 ;
+  int result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = jarg2 ? true : false; 
+  result = (int)(arg1)->setAutoHangup(arg2);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_CoreSession_Ready(void * jarg1) {
+  unsigned int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (bool)(arg1)->ready();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_CoreSession_answered(void * jarg1) {
+  unsigned int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (bool)(arg1)->answered();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_CoreSession_mediaReady(void * jarg1) {
+  unsigned int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (bool)(arg1)->mediaReady();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_waitForAnswer(void * jarg1, void * jarg2) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  CoreSession *arg2 = (CoreSession *) 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (CoreSession *)jarg2; 
+  (arg1)->waitForAnswer(arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_Execute(void * jarg1, char * jarg2, char * jarg3) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *arg2 = (char *) 0 ;
+  char *arg3 = (char *) NULL ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (char *)jarg2; 
+  arg3 = (char *)jarg3; 
+  (arg1)->execute((char const *)arg2,(char const *)arg3);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_sendEvent(void * jarg1, void * jarg2) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  Event *arg2 = (Event *) 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (Event *)jarg2; 
+  (arg1)->sendEvent(arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_setEventData(void * jarg1, void * jarg2) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  Event *arg2 = (Event *) 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  arg2 = (Event *)jarg2; 
+  (arg1)->setEventData(arg2);
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_getXMLCDR(void * jarg1) {
+  char * jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (char *)(arg1)->getXMLCDR();
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_CoreSession_begin_allow_threads(void * jarg1) {
+  unsigned int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (bool)(arg1)->begin_allow_threads();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT unsigned int SWIGSTDCALL CSharp_CoreSession_end_allow_threads(void * jarg1) {
+  unsigned int jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  bool result;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (bool)(arg1)->end_allow_threads();
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT char * SWIGSTDCALL CSharp_CoreSession_GetUuid(void * jarg1) {
+  char * jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  char *result = 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  result = (char *)((CoreSession const *)arg1)->get_uuid();
+  jresult = SWIG_csharp_string_callback((const char *)result); 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_CoreSession_get_cb_args(void * jarg1) {
+  void * jresult ;
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  switch_input_args_t *result = 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  {
+    switch_input_args_t const &_result_ref = ((CoreSession const *)arg1)->get_cb_args();
+    result = (switch_input_args_t *) &_result_ref;
+  }
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_CoreSession_check_hangup_hook(void * jarg1) {
+  CoreSession *arg1 = (CoreSession *) 0 ;
+  
+  arg1 = (CoreSession *)jarg1; 
+  (arg1)->check_hangup_hook();
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_console_log(char * jarg1, char * jarg2) {
+  char *arg1 = (char *) 0 ;
+  char *arg2 = (char *) 0 ;
+  
+  arg1 = (char *)jarg1; 
+  arg2 = (char *)jarg2; 
+  console_log(arg1,arg2);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_console_clean_log(char * jarg1) {
+  char *arg1 = (char *) 0 ;
+  
+  arg1 = (char *)jarg1; 
+  console_clean_log(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_msleep(unsigned int jarg1) {
+  unsigned int arg1 ;
+  
+  arg1 = (unsigned int)jarg1; 
+  msleep(arg1);
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_bridge(void * jarg1, void * jarg2) {
+  CoreSession *arg1 = 0 ;
+  CoreSession *arg2 = 0 ;
+  
+  arg1 = (CoreSession *)jarg1;
+  if(!arg1) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "CoreSession & type is null", 0);
+    return ;
+  } 
+  arg2 = (CoreSession *)jarg2;
+  if(!arg2) {
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "CoreSession & type is null", 0);
+    return ;
+  } 
+  bridge(*arg1,*arg2);
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_hanguphook(void * jarg1) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (switch_status_t)hanguphook(arg1);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT int SWIGSTDCALL CSharp_dtmf_callback(void * jarg1, void * jarg2, int jarg3, void * jarg4, unsigned int jarg5) {
+  int jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  void *arg2 = (void *) 0 ;
+  switch_input_type_t arg3 ;
+  void *arg4 = (void *) 0 ;
+  unsigned int arg5 ;
+  switch_status_t result;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  arg2 = (void *)jarg2; 
+  arg3 = (switch_input_type_t)jarg3; 
+  arg4 = (void *)jarg4; 
+  arg5 = (unsigned int)jarg5; 
+  result = (switch_status_t)dtmf_callback(arg1,arg2,arg3,arg4,arg5);
+  jresult = result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_ManagedSession__SWIG_0() {
+  void * jresult ;
+  ManagedSession *result = 0 ;
+  
+  result = (ManagedSession *)new ManagedSession();
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_ManagedSession__SWIG_1(char * jarg1) {
+  void * jresult ;
+  char *arg1 = (char *) 0 ;
+  ManagedSession *result = 0 ;
+  
+  arg1 = (char *)jarg1; 
+  result = (ManagedSession *)new ManagedSession(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void * SWIGSTDCALL CSharp_new_ManagedSession__SWIG_2(void * jarg1) {
+  void * jresult ;
+  switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
+  ManagedSession *result = 0 ;
+  
+  arg1 = (switch_core_session_t *)jarg1; 
+  result = (ManagedSession *)new ManagedSession(arg1);
+  jresult = (void *)result; 
+  return jresult;
+}
+
+
+SWIGEXPORT void SWIGSTDCALL CSharp_delete_ManagedSession(void * jarg1) {
+  ManagedSession *arg1 = (ManagedSession *) 0 ;
+  
+  arg1 = (ManagedSession *)jarg1; 
+  delete arg1;
+  
+}
+
+
+SWIGEXPORT CoreSession * SWIGSTDCALL CSharp_ManagedSessionUpcast(ManagedSession *objectRef) {
+    return (CoreSession *)objectRef;
+}
+
+#ifdef __cplusplus
+}
+#endif
+

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_managed/managed/FreeSWITCH.Managed.dll


(Binary files differ)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_managed/managed/swig.cs (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_managed/managed/swig.cs	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_managed/managed/swig.cs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,27719 +1,28370 @@
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public partial class Api : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal Api(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(Api obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~Api() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_Api(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public Api() : this(freeswitchPINVOKE.new_Api(), true) {
-  }
-
-  public string Execute(string command, string data) {
-    string ret = freeswitchPINVOKE.Api_Execute(swigCPtr, command, data);
-    return ret;
-  }
-
-  public string ExecuteString(string command) {
-    string ret = freeswitchPINVOKE.Api_ExecuteString(swigCPtr, command);
-    return ret;
-  }
-
-  public string getTime() {
-    string ret = freeswitchPINVOKE.Api_getTime(swigCPtr);
-    return ret;
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum cache_db_flag_t {
-  CDF_INUSE = (1 << 0)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class CoreSession : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal CoreSession(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(CoreSession obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~CoreSession() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_CoreSession(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_switch_core_session InternalSession {
-    set {
-      freeswitchPINVOKE.CoreSession_InternalSession_set(swigCPtr, SWIGTYPE_p_switch_core_session.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.CoreSession_InternalSession_get(swigCPtr);
-      SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_channel Channel {
-    set {
-      freeswitchPINVOKE.CoreSession_Channel_set(swigCPtr, SWIGTYPE_p_switch_channel.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.CoreSession_Channel_get(swigCPtr);
-      SWIGTYPE_p_switch_channel ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_channel(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public uint Flags {
-    set {
-      freeswitchPINVOKE.CoreSession_Flags_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.CoreSession_Flags_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int Allocated {
-    set {
-      freeswitchPINVOKE.CoreSession_Allocated_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.CoreSession_Allocated_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public input_callback_state_t CallbackState {
-    set {
-      freeswitchPINVOKE.CoreSession_CallbackState_set(swigCPtr, input_callback_state_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.CoreSession_CallbackState_get(swigCPtr);
-      input_callback_state_t ret = (cPtr == IntPtr.Zero) ? null : new input_callback_state_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_channel_state_t HookState {
-    set {
-      freeswitchPINVOKE.CoreSession_HookState_set(swigCPtr, (int)value);
-    } 
-    get {
-      switch_channel_state_t ret = (switch_channel_state_t)freeswitchPINVOKE.CoreSession_HookState_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_call_cause_t CallCause {
-    set {
-      freeswitchPINVOKE.CoreSession_CallCause_set(swigCPtr, (int)value);
-    } 
-    get {
-      switch_call_cause_t ret = (switch_call_cause_t)freeswitchPINVOKE.CoreSession_CallCause_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string UuidString {
-    set {
-      freeswitchPINVOKE.CoreSession_UuidString_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.CoreSession_UuidString_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string TextToSpeechEngine {
-    set {
-      freeswitchPINVOKE.CoreSession_TextToSpeechEngine_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.CoreSession_TextToSpeechEngine_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string TextToSpeechVoice {
-    set {
-      freeswitchPINVOKE.CoreSession_TextToSpeechVoice_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.CoreSession_TextToSpeechVoice_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int Answer() {
-    int ret = freeswitchPINVOKE.CoreSession_Answer(swigCPtr);
-    return ret;
-  }
-
-  public int PreAnswer() {
-    int ret = freeswitchPINVOKE.CoreSession_PreAnswer(swigCPtr);
-    return ret;
-  }
-
-  public void Hangup(string cause) {
-    freeswitchPINVOKE.CoreSession_Hangup(swigCPtr, cause);
-  }
-
-  public void HangupState() {
-    freeswitchPINVOKE.CoreSession_HangupState(swigCPtr);
-  }
-
-  public void SetVariable(string var, string val) {
-    freeswitchPINVOKE.CoreSession_SetVariable(swigCPtr, var, val);
-  }
-
-  public void SetPrivate(string var, SWIGTYPE_p_void val) {
-    freeswitchPINVOKE.CoreSession_SetPrivate(swigCPtr, var, SWIGTYPE_p_void.getCPtr(val));
-  }
-
-  public SWIGTYPE_p_void GetPrivate(string var) {
-    IntPtr cPtr = freeswitchPINVOKE.CoreSession_GetPrivate(swigCPtr, var);
-    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-    return ret;
-  }
-
-  public string GetVariable(string var) {
-    string ret = freeswitchPINVOKE.CoreSession_GetVariable(swigCPtr, var);
-    return ret;
-  }
-
-  public void Say(string tosay, string module_name, string say_type, string say_method) {
-    freeswitchPINVOKE.CoreSession_Say(swigCPtr, tosay, module_name, say_type, say_method);
-  }
-
-  public void SayPhrase(string phrase_name, string phrase_data, string phrase_lang) {
-    freeswitchPINVOKE.CoreSession_SayPhrase(swigCPtr, phrase_name, phrase_data, phrase_lang);
-  }
-
-  public string HangupCause() {
-    string ret = freeswitchPINVOKE.CoreSession_HangupCause(swigCPtr);
-    return ret;
-  }
-
-  public string GetState() {
-    string ret = freeswitchPINVOKE.CoreSession_GetState(swigCPtr);
-    return ret;
-  }
-
-  public int RecordFile(string file_name, int time_limit, int silence_threshold, int silence_hits) {
-    int ret = freeswitchPINVOKE.CoreSession_RecordFile(swigCPtr, file_name, time_limit, silence_threshold, silence_hits);
-    return ret;
-  }
-
-  protected int originate(CoreSession a_leg_session, string dest, int timeout, switch_state_handler_table handlers) {
-    int ret = freeswitchPINVOKE.CoreSession_originate(swigCPtr, CoreSession.getCPtr(a_leg_session), dest, timeout, switch_state_handler_table.getCPtr(handlers));
-    return ret;
-  }
-
-  public virtual void Destroy() {
-    freeswitchPINVOKE.CoreSession_Destroy(swigCPtr);
-  }
-
-  public int Speak(string text) {
-    int ret = freeswitchPINVOKE.CoreSession_Speak(swigCPtr, text);
-    return ret;
-  }
-
-  public void SetTtsParameters(string tts_name, string voice_name) {
-    freeswitchPINVOKE.CoreSession_SetTtsParameters(swigCPtr, tts_name, voice_name);
-  }
-
-  public int CollectDigits(int abs_timeout) {
-    int ret = freeswitchPINVOKE.CoreSession_CollectDigits__SWIG_0(swigCPtr, abs_timeout);
-    return ret;
-  }
-
-  public int CollectDigits(int digit_timeout, int abs_timeout) {
-    int ret = freeswitchPINVOKE.CoreSession_CollectDigits__SWIG_1(swigCPtr, digit_timeout, abs_timeout);
-    return ret;
-  }
-
-  public string GetDigits(int maxdigits, string terminators, int timeout) {
-    string ret = freeswitchPINVOKE.CoreSession_GetDigits__SWIG_0(swigCPtr, maxdigits, terminators, timeout);
-    return ret;
-  }
-
-  public string GetDigits(int maxdigits, string terminators, int timeout, int interdigit) {
-    string ret = freeswitchPINVOKE.CoreSession_GetDigits__SWIG_1(swigCPtr, maxdigits, terminators, timeout, interdigit);
-    return ret;
-  }
-
-  public int Transfer(string extension, string dialplan, string context) {
-    int ret = freeswitchPINVOKE.CoreSession_Transfer(swigCPtr, extension, dialplan, context);
-    return ret;
-  }
-
-  public string Read(int min_digits, int max_digits, string prompt_audio_file, int timeout, string valid_terminators) {
-    string ret = freeswitchPINVOKE.CoreSession_Read(swigCPtr, min_digits, max_digits, prompt_audio_file, timeout, valid_terminators);
-    return ret;
-  }
-
-  public string PlayAndGetDigits(int min_digits, int max_digits, int max_tries, int timeout, string terminators, string audio_files, string bad_input_audio_files, string digits_regex, string var_name) {
-    string ret = freeswitchPINVOKE.CoreSession_PlayAndGetDigits(swigCPtr, min_digits, max_digits, max_tries, timeout, terminators, audio_files, bad_input_audio_files, digits_regex, var_name);
-    return ret;
-  }
-
-  public int StreamFile(string file, int starting_sample_count) {
-    int ret = freeswitchPINVOKE.CoreSession_StreamFile(swigCPtr, file, starting_sample_count);
-    return ret;
-  }
-
-  public int Sleep(int ms, int sync) {
-    int ret = freeswitchPINVOKE.CoreSession_Sleep(swigCPtr, ms, sync);
-    return ret;
-  }
-
-  public int FlushEvents() {
-    int ret = freeswitchPINVOKE.CoreSession_FlushEvents(swigCPtr);
-    return ret;
-  }
-
-  public int FlushDigits() {
-    int ret = freeswitchPINVOKE.CoreSession_FlushDigits(swigCPtr);
-    return ret;
-  }
-
-  public int SetAutoHangup(bool val) {
-    int ret = freeswitchPINVOKE.CoreSession_SetAutoHangup(swigCPtr, val);
-    return ret;
-  }
-
-  public bool Ready() {
-    bool ret = freeswitchPINVOKE.CoreSession_Ready(swigCPtr);
-    return ret;
-  }
-
-  public bool Answered() {
-    bool ret = freeswitchPINVOKE.CoreSession_Answered(swigCPtr);
-    return ret;
-  }
-
-  public bool MediaReady() {
-    bool ret = freeswitchPINVOKE.CoreSession_MediaReady(swigCPtr);
-    return ret;
-  }
-
-  public void WaitForAnswer(CoreSession calling_session) {
-    freeswitchPINVOKE.CoreSession_WaitForAnswer(swigCPtr, CoreSession.getCPtr(calling_session));
-  }
-
-  public void Execute(string app, string data) {
-    freeswitchPINVOKE.CoreSession_Execute(swigCPtr, app, data);
-  }
-
-  public void SendEvent(Event sendME) {
-    freeswitchPINVOKE.CoreSession_SendEvent(swigCPtr, Event.getCPtr(sendME));
-  }
-
-  public void QueuePrivateEvent(Event sendME) {
-    freeswitchPINVOKE.CoreSession_QueuePrivateEvent(swigCPtr, Event.getCPtr(sendME));
-  }
-
-  public void SetEventData(Event e) {
-    freeswitchPINVOKE.CoreSession_SetEventData(swigCPtr, Event.getCPtr(e));
-  }
-
-  public string GetXmlCdr() {
-    string ret = freeswitchPINVOKE.CoreSession_GetXmlCdr(swigCPtr);
-    return ret;
-  }
-
-  public virtual bool BeginAllowThreads() {
-    bool ret = freeswitchPINVOKE.CoreSession_BeginAllowThreads(swigCPtr);
-    return ret;
-  }
-
-  public virtual bool EndAllowThreads() {
-    bool ret = freeswitchPINVOKE.CoreSession_EndAllowThreads(swigCPtr);
-    return ret;
-  }
-
-  public string GetUuid() {
-    string ret = freeswitchPINVOKE.CoreSession_GetUuid(swigCPtr);
-    return ret;
-  }
-
-  public switch_input_args_t GetCallbackArguments() {
-    switch_input_args_t ret = new switch_input_args_t(freeswitchPINVOKE.CoreSession_GetCallbackArguments(swigCPtr), false);
-    return ret;
-  }
-
-  public virtual void CheckHangupHook() {
-    freeswitchPINVOKE.CoreSession_CheckHangupHook(swigCPtr);
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class DTMF : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal DTMF(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(DTMF obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~DTMF() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_DTMF(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public char digit {
-    set {
-      freeswitchPINVOKE.DTMF_digit_set(swigCPtr, value);
-    } 
-    get {
-      char ret = freeswitchPINVOKE.DTMF_digit_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint duration {
-    set {
-      freeswitchPINVOKE.DTMF_duration_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.DTMF_duration_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public DTMF(char idigit, uint iduration) : this(freeswitchPINVOKE.new_DTMF(idigit, iduration), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public partial class Event : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal Event(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(Event obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~Event() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_Event(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public switch_event InternalEvent {
-    set {
-      freeswitchPINVOKE.Event_InternalEvent_set(swigCPtr, switch_event.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.Event_InternalEvent_get(swigCPtr);
-      switch_event ret = (cPtr == IntPtr.Zero) ? null : new switch_event(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public string serialized_string {
-    set {
-      freeswitchPINVOKE.Event_serialized_string_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.Event_serialized_string_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int mine {
-    set {
-      freeswitchPINVOKE.Event_mine_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.Event_mine_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public Event(string type, string subclass_name) : this(freeswitchPINVOKE.new_Event__SWIG_0(type, subclass_name), true) {
-  }
-
-  public Event(switch_event wrap_me, int free_me) : this(freeswitchPINVOKE.new_Event__SWIG_1(switch_event.getCPtr(wrap_me), free_me), true) {
-  }
-
-  public string Serialize(string format) {
-    string ret = freeswitchPINVOKE.Event_Serialize(swigCPtr, format);
-    return ret;
-  }
-
-  public bool SetPriority(switch_priority_t priority) {
-    bool ret = freeswitchPINVOKE.Event_SetPriority(swigCPtr, (int)priority);
-    return ret;
-  }
-
-  public string GetHeader(string header_name) {
-    string ret = freeswitchPINVOKE.Event_GetHeader(swigCPtr, header_name);
-    return ret;
-  }
-
-  public string GetBody() {
-    string ret = freeswitchPINVOKE.Event_GetBody(swigCPtr);
-    return ret;
-  }
-
-  public string GetEventType() {
-    string ret = freeswitchPINVOKE.Event_GetEventType(swigCPtr);
-    return ret;
-  }
-
-  public bool AddBody(string value) {
-    bool ret = freeswitchPINVOKE.Event_AddBody(swigCPtr, value);
-    return ret;
-  }
-
-  public bool AddHeader(string header_name, string value) {
-    bool ret = freeswitchPINVOKE.Event_AddHeader(swigCPtr, header_name, value);
-    return ret;
-  }
-
-  public bool DeleteHeader(string header_name) {
-    bool ret = freeswitchPINVOKE.Event_DeleteHeader(swigCPtr, header_name);
-    return ret;
-  }
-
-  public bool Fire() {
-    bool ret = freeswitchPINVOKE.Event_Fire(swigCPtr);
-    return ret;
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class EventConsumer : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal EventConsumer(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(EventConsumer obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~EventConsumer() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_EventConsumer(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_switch_queue_t events {
-    set {
-      freeswitchPINVOKE.EventConsumer_events_set(swigCPtr, SWIGTYPE_p_switch_queue_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.EventConsumer_events_get(swigCPtr);
-      SWIGTYPE_p_switch_queue_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_queue_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_event_types_t e_event_id {
-    set {
-      freeswitchPINVOKE.EventConsumer_e_event_id_set(swigCPtr, (int)value);
-    } 
-    get {
-      switch_event_types_t ret = (switch_event_types_t)freeswitchPINVOKE.EventConsumer_e_event_id_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_event_node node {
-    set {
-      freeswitchPINVOKE.EventConsumer_node_set(swigCPtr, SWIGTYPE_p_switch_event_node.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.EventConsumer_node_get(swigCPtr);
-      SWIGTYPE_p_switch_event_node ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_event_node(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public string e_callback {
-    set {
-      freeswitchPINVOKE.EventConsumer_e_callback_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.EventConsumer_e_callback_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string e_subclass_name {
-    set {
-      freeswitchPINVOKE.EventConsumer_e_subclass_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.EventConsumer_e_subclass_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string e_cb_arg {
-    set {
-      freeswitchPINVOKE.EventConsumer_e_cb_arg_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.EventConsumer_e_cb_arg_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public EventConsumer(string event_name, string subclass_name) : this(freeswitchPINVOKE.new_EventConsumer(event_name, subclass_name), true) {
-  }
-
-  public Event pop(int block) {
-    IntPtr cPtr = freeswitchPINVOKE.EventConsumer_pop(swigCPtr, block);
-    Event ret = (cPtr == IntPtr.Zero) ? null : new Event(cPtr, true);
-    return ret;
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class freeswitch {
-  public static switch_directories SWITCH_GLOBAL_dirs {
-    set {
-      freeswitchPINVOKE.SWITCH_GLOBAL_dirs_set(switch_directories.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.SWITCH_GLOBAL_dirs_get();
-      switch_directories ret = (cPtr == IntPtr.Zero) ? null : new switch_directories(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public static int switch_core_db_close(SWIGTYPE_p_sqlite3 db) {
-    int ret = freeswitchPINVOKE.switch_core_db_close(SWIGTYPE_p_sqlite3.getCPtr(db));
-    return ret;
-  }
-
-  public static int switch_core_db_open(string filename, SWIGTYPE_p_p_sqlite3 ppDb) {
-    int ret = freeswitchPINVOKE.switch_core_db_open(filename, SWIGTYPE_p_p_sqlite3.getCPtr(ppDb));
-    return ret;
-  }
-
-  public static SWIGTYPE_p_unsigned_char switch_core_db_column_text(SWIGTYPE_p_sqlite3_stmt stmt, int iCol) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_db_column_text(SWIGTYPE_p_sqlite3_stmt.getCPtr(stmt), iCol);
-    SWIGTYPE_p_unsigned_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
-    return ret;
-  }
-
-  public static string switch_core_db_column_name(SWIGTYPE_p_sqlite3_stmt stmt, int N) {
-    string ret = freeswitchPINVOKE.switch_core_db_column_name(SWIGTYPE_p_sqlite3_stmt.getCPtr(stmt), N);
-    return ret;
-  }
-
-  public static int switch_core_db_column_count(SWIGTYPE_p_sqlite3_stmt pStmt) {
-    int ret = freeswitchPINVOKE.switch_core_db_column_count(SWIGTYPE_p_sqlite3_stmt.getCPtr(pStmt));
-    return ret;
-  }
-
-  public static string switch_core_db_errmsg(SWIGTYPE_p_sqlite3 db) {
-    string ret = freeswitchPINVOKE.switch_core_db_errmsg(SWIGTYPE_p_sqlite3.getCPtr(db));
-    return ret;
-  }
-
-  public static int switch_core_db_exec(SWIGTYPE_p_sqlite3 db, string sql, SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int callback, SWIGTYPE_p_void data, ref string errmsg) {
-    int ret = freeswitchPINVOKE.switch_core_db_exec(SWIGTYPE_p_sqlite3.getCPtr(db), sql, SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int.getCPtr(callback), SWIGTYPE_p_void.getCPtr(data), ref errmsg);
-    return ret;
-  }
-
-  public static int switch_core_db_finalize(SWIGTYPE_p_sqlite3_stmt pStmt) {
-    int ret = freeswitchPINVOKE.switch_core_db_finalize(SWIGTYPE_p_sqlite3_stmt.getCPtr(pStmt));
-    return ret;
-  }
-
-  public static int switch_core_db_prepare(SWIGTYPE_p_sqlite3 db, string zSql, int nBytes, SWIGTYPE_p_p_sqlite3_stmt ppStmt, ref string pzTail) {
-    int ret = freeswitchPINVOKE.switch_core_db_prepare(SWIGTYPE_p_sqlite3.getCPtr(db), zSql, nBytes, SWIGTYPE_p_p_sqlite3_stmt.getCPtr(ppStmt), ref pzTail);
-    return ret;
-  }
-
-  public static int switch_core_db_step(SWIGTYPE_p_sqlite3_stmt stmt) {
-    int ret = freeswitchPINVOKE.switch_core_db_step(SWIGTYPE_p_sqlite3_stmt.getCPtr(stmt));
-    return ret;
-  }
-
-  public static int switch_core_db_reset(SWIGTYPE_p_sqlite3_stmt pStmt) {
-    int ret = freeswitchPINVOKE.switch_core_db_reset(SWIGTYPE_p_sqlite3_stmt.getCPtr(pStmt));
-    return ret;
-  }
-
-  public static int switch_core_db_bind_int(SWIGTYPE_p_sqlite3_stmt pStmt, int i, int iValue) {
-    int ret = freeswitchPINVOKE.switch_core_db_bind_int(SWIGTYPE_p_sqlite3_stmt.getCPtr(pStmt), i, iValue);
-    return ret;
-  }
-
-  public static int switch_core_db_bind_int64(SWIGTYPE_p_sqlite3_stmt pStmt, int i, long iValue) {
-    int ret = freeswitchPINVOKE.switch_core_db_bind_int64(SWIGTYPE_p_sqlite3_stmt.getCPtr(pStmt), i, iValue);
-    return ret;
-  }
-
-  public static int switch_core_db_bind_text(SWIGTYPE_p_sqlite3_stmt pStmt, int i, string zData, int nData, SWIGTYPE_p_f_p_void__void xDel) {
-    int ret = freeswitchPINVOKE.switch_core_db_bind_text(SWIGTYPE_p_sqlite3_stmt.getCPtr(pStmt), i, zData, nData, SWIGTYPE_p_f_p_void__void.getCPtr(xDel));
-    return ret;
-  }
-
-  public static int switch_core_db_bind_double(SWIGTYPE_p_sqlite3_stmt pStmt, int i, double dValue) {
-    int ret = freeswitchPINVOKE.switch_core_db_bind_double(SWIGTYPE_p_sqlite3_stmt.getCPtr(pStmt), i, dValue);
-    return ret;
-  }
-
-  public static long switch_core_db_last_insert_rowid(SWIGTYPE_p_sqlite3 db) {
-    long ret = freeswitchPINVOKE.switch_core_db_last_insert_rowid(SWIGTYPE_p_sqlite3.getCPtr(db));
-    return ret;
-  }
-
-  public static int switch_core_db_get_table(SWIGTYPE_p_sqlite3 db, string sql, SWIGTYPE_p_p_p_char resultp, SWIGTYPE_p_int nrow, SWIGTYPE_p_int ncolumn, ref string errmsg) {
-    int ret = freeswitchPINVOKE.switch_core_db_get_table(SWIGTYPE_p_sqlite3.getCPtr(db), sql, SWIGTYPE_p_p_p_char.getCPtr(resultp), SWIGTYPE_p_int.getCPtr(nrow), SWIGTYPE_p_int.getCPtr(ncolumn), ref errmsg);
-    return ret;
-  }
-
-  public static void switch_core_db_free_table(ref string result) {
-    freeswitchPINVOKE.switch_core_db_free_table(ref result);
-  }
-
-  public static void switch_core_db_free(string z) {
-    freeswitchPINVOKE.switch_core_db_free(z);
-  }
-
-  public static int switch_core_db_changes(SWIGTYPE_p_sqlite3 db) {
-    int ret = freeswitchPINVOKE.switch_core_db_changes(SWIGTYPE_p_sqlite3.getCPtr(db));
-    return ret;
-  }
-
-  public static string switch_mprintf(string zFormat) {
-    string ret = freeswitchPINVOKE.switch_mprintf(zFormat);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_real_pcre switch_regex_compile(string pattern, int options, ref string errorptr, SWIGTYPE_p_int erroroffset, SWIGTYPE_p_unsigned_char tables) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_regex_compile(pattern, options, ref errorptr, SWIGTYPE_p_int.getCPtr(erroroffset), SWIGTYPE_p_unsigned_char.getCPtr(tables));
-    SWIGTYPE_p_real_pcre ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_real_pcre(cPtr, false);
-    return ret;
-  }
-
-  public static int switch_regex_copy_substring(string subject, SWIGTYPE_p_int ovector, int stringcount, int stringnumber, string buffer, int size) {
-    int ret = freeswitchPINVOKE.switch_regex_copy_substring(subject, SWIGTYPE_p_int.getCPtr(ovector), stringcount, stringnumber, buffer, size);
-    return ret;
-  }
-
-  public static void switch_regex_free(SWIGTYPE_p_void data) {
-    freeswitchPINVOKE.switch_regex_free(SWIGTYPE_p_void.getCPtr(data));
-  }
-
-  public static int switch_regex_perform(string field, string expression, SWIGTYPE_p_p_real_pcre new_re, SWIGTYPE_p_int ovector, uint olen) {
-    int ret = freeswitchPINVOKE.switch_regex_perform(field, expression, SWIGTYPE_p_p_real_pcre.getCPtr(new_re), SWIGTYPE_p_int.getCPtr(ovector), olen);
-    return ret;
-  }
-
-  public static void switch_perform_substitution(SWIGTYPE_p_real_pcre re, int match_count, string data, string field_data, string substituted, SWIGTYPE_p_switch_size_t len, SWIGTYPE_p_int ovector) {
-    freeswitchPINVOKE.switch_perform_substitution(SWIGTYPE_p_real_pcre.getCPtr(re), match_count, data, field_data, substituted, SWIGTYPE_p_switch_size_t.getCPtr(len), SWIGTYPE_p_int.getCPtr(ovector));
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-  }
-
-  public static switch_status_t switch_regex_match(string target, string expression) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_regex_match(target, expression);
-    return ret;
-  }
-
-  public static switch_status_t switch_regex_match_partial(string target, string expression, SWIGTYPE_p_int partial_match) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_regex_match_partial(target, expression, SWIGTYPE_p_int.getCPtr(partial_match));
-    return ret;
-  }
-
-  public static void switch_core_session_sched_heartbeat(SWIGTYPE_p_switch_core_session session, uint seconds) {
-    freeswitchPINVOKE.switch_core_session_sched_heartbeat(SWIGTYPE_p_switch_core_session.getCPtr(session), seconds);
-  }
-
-  public static void switch_core_session_unsched_heartbeat(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_core_session_unsched_heartbeat(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static void switch_core_session_enable_heartbeat(SWIGTYPE_p_switch_core_session session, uint seconds) {
-    freeswitchPINVOKE.switch_core_session_enable_heartbeat(SWIGTYPE_p_switch_core_session.getCPtr(session), seconds);
-  }
-
-  public static void switch_core_session_disable_heartbeat(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_core_session_disable_heartbeat(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static switch_status_t switch_core_media_bug_add(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t callback, SWIGTYPE_p_void user_data, SWIGTYPE_p_time_t stop_time, uint flags, SWIGTYPE_p_p_switch_media_bug new_bug) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_add(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data), SWIGTYPE_p_time_t.getCPtr(stop_time), flags, SWIGTYPE_p_p_switch_media_bug.getCPtr(new_bug));
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static void switch_core_media_bug_pause(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_core_media_bug_pause(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static void switch_core_media_bug_resume(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_core_media_bug_resume(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static void switch_core_media_bug_inuse(SWIGTYPE_p_switch_media_bug bug, SWIGTYPE_p_switch_size_t readp, SWIGTYPE_p_switch_size_t writep) {
-    freeswitchPINVOKE.switch_core_media_bug_inuse(SWIGTYPE_p_switch_media_bug.getCPtr(bug), SWIGTYPE_p_switch_size_t.getCPtr(readp), SWIGTYPE_p_switch_size_t.getCPtr(writep));
-  }
-
-  public static SWIGTYPE_p_void switch_core_media_bug_get_user_data(SWIGTYPE_p_switch_media_bug bug) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_media_bug_get_user_data(SWIGTYPE_p_switch_media_bug.getCPtr(bug));
-    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-    return ret;
-  }
-
-  public static switch_frame switch_core_media_bug_get_write_replace_frame(SWIGTYPE_p_switch_media_bug bug) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_media_bug_get_write_replace_frame(SWIGTYPE_p_switch_media_bug.getCPtr(bug));
-    switch_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_frame(cPtr, false);
-    return ret;
-  }
-
-  public static void switch_core_media_bug_set_write_replace_frame(SWIGTYPE_p_switch_media_bug bug, switch_frame frame) {
-    freeswitchPINVOKE.switch_core_media_bug_set_write_replace_frame(SWIGTYPE_p_switch_media_bug.getCPtr(bug), switch_frame.getCPtr(frame));
-  }
-
-  public static switch_frame switch_core_media_bug_get_read_replace_frame(SWIGTYPE_p_switch_media_bug bug) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_media_bug_get_read_replace_frame(SWIGTYPE_p_switch_media_bug.getCPtr(bug));
-    switch_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_frame(cPtr, false);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_core_session switch_core_media_bug_get_session(SWIGTYPE_p_switch_media_bug bug) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_media_bug_get_session(SWIGTYPE_p_switch_media_bug.getCPtr(bug));
-    SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
-    return ret;
-  }
-
-  public static uint switch_core_media_bug_test_flag(SWIGTYPE_p_switch_media_bug bug, uint flag) {
-    uint ret = freeswitchPINVOKE.switch_core_media_bug_test_flag(SWIGTYPE_p_switch_media_bug.getCPtr(bug), flag);
-    return ret;
-  }
-
-  public static void switch_core_media_bug_set_read_replace_frame(SWIGTYPE_p_switch_media_bug bug, switch_frame frame) {
-    freeswitchPINVOKE.switch_core_media_bug_set_read_replace_frame(SWIGTYPE_p_switch_media_bug.getCPtr(bug), switch_frame.getCPtr(frame));
-  }
-
-  public static switch_status_t switch_core_media_bug_remove(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_media_bug bug) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_remove(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_media_bug.getCPtr(bug));
-    return ret;
-  }
-
-  public static uint switch_core_media_bug_prune(SWIGTYPE_p_switch_core_session session) {
-    uint ret = freeswitchPINVOKE.switch_core_media_bug_prune(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_media_bug_remove_callback(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t callback) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_remove_callback(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t.getCPtr(callback));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_media_bug_close(SWIGTYPE_p_p_switch_media_bug bug) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_close(SWIGTYPE_p_p_switch_media_bug.getCPtr(bug));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_media_bug_remove_all(SWIGTYPE_p_switch_core_session session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_remove_all(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_media_bug_read(SWIGTYPE_p_switch_media_bug bug, switch_frame frame, switch_bool_t fill) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_read(SWIGTYPE_p_switch_media_bug.getCPtr(bug), switch_frame.getCPtr(frame), (int)fill);
-    return ret;
-  }
-
-  public static void switch_core_media_bug_flush(SWIGTYPE_p_switch_media_bug bug) {
-    freeswitchPINVOKE.switch_core_media_bug_flush(SWIGTYPE_p_switch_media_bug.getCPtr(bug));
-  }
-
-  public static switch_status_t switch_core_media_bug_flush_all(SWIGTYPE_p_switch_core_session session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_flush_all(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_port_allocator_new(ushort start, ushort end, uint flags, SWIGTYPE_p_p_switch_core_port_allocator new_allocator) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_port_allocator_new(start, end, flags, SWIGTYPE_p_p_switch_core_port_allocator.getCPtr(new_allocator));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_port_allocator_request_port(SWIGTYPE_p_switch_core_port_allocator alloc, SWIGTYPE_p_unsigned_short port_ptr) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_port_allocator_request_port(SWIGTYPE_p_switch_core_port_allocator.getCPtr(alloc), SWIGTYPE_p_unsigned_short.getCPtr(port_ptr));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_port_allocator_free_port(SWIGTYPE_p_switch_core_port_allocator alloc, ushort port) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_port_allocator_free_port(SWIGTYPE_p_switch_core_port_allocator.getCPtr(alloc), port);
-    return ret;
-  }
-
-  public static void switch_core_port_allocator_destroy(SWIGTYPE_p_p_switch_core_port_allocator alloc) {
-    freeswitchPINVOKE.switch_core_port_allocator_destroy(SWIGTYPE_p_p_switch_core_port_allocator.getCPtr(alloc));
-  }
-
-  public static switch_status_t switch_core_init(uint flags, switch_bool_t console, ref string err) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_init(flags, (int)console, ref err);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_init_and_modload(uint flags, switch_bool_t console, ref string err) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_init_and_modload(flags, (int)console, ref err);
-    return ret;
-  }
-
-  public static uint switch_core_session_limit(uint new_limit) {
-    uint ret = freeswitchPINVOKE.switch_core_session_limit(new_limit);
-    return ret;
-  }
-
-  public static uint switch_core_sessions_per_second(uint new_limit) {
-    uint ret = freeswitchPINVOKE.switch_core_sessions_per_second(new_limit);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_destroy() {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_destroy();
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_read_lock(SWIGTYPE_p_switch_core_session session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_read_lock(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_read_lock_hangup(SWIGTYPE_p_switch_core_session session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_read_lock_hangup(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static void switch_core_session_write_lock(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_core_session_write_lock(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static void switch_core_session_rwunlock(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_core_session_rwunlock(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static int switch_core_add_state_handler(switch_state_handler_table state_handler) {
-    int ret = freeswitchPINVOKE.switch_core_add_state_handler(switch_state_handler_table.getCPtr(state_handler));
-    return ret;
-  }
-
-  public static void switch_core_remove_state_handler(switch_state_handler_table state_handler) {
-    freeswitchPINVOKE.switch_core_remove_state_handler(switch_state_handler_table.getCPtr(state_handler));
-  }
-
-  public static switch_state_handler_table switch_core_get_state_handler(int index) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_get_state_handler(index);
-    switch_state_handler_table ret = (cPtr == IntPtr.Zero) ? null : new switch_state_handler_table(cPtr, false);
-    return ret;
-  }
-
-  public static void switch_core_memory_pool_tag(SWIGTYPE_p_apr_pool_t pool, string tag) {
-    freeswitchPINVOKE.switch_core_memory_pool_tag(SWIGTYPE_p_apr_pool_t.getCPtr(pool), tag);
-  }
-
-  public static switch_status_t switch_core_perform_new_memory_pool(SWIGTYPE_p_p_apr_pool_t pool, string file, string func, int line) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_perform_new_memory_pool(SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), file, func, line);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_perform_destroy_memory_pool(SWIGTYPE_p_p_apr_pool_t pool, string file, string func, int line) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_perform_destroy_memory_pool(SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), file, func, line);
-    return ret;
-  }
-
-  public static void switch_core_memory_pool_set_data(SWIGTYPE_p_apr_pool_t pool, string key, SWIGTYPE_p_void data) {
-    freeswitchPINVOKE.switch_core_memory_pool_set_data(SWIGTYPE_p_apr_pool_t.getCPtr(pool), key, SWIGTYPE_p_void.getCPtr(data));
-  }
-
-  public static SWIGTYPE_p_void switch_core_memory_pool_get_data(SWIGTYPE_p_apr_pool_t pool, string key) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_memory_pool_get_data(SWIGTYPE_p_apr_pool_t.getCPtr(pool), key);
-    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-    return ret;
-  }
-
-  public static void switch_core_session_run(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_core_session_run(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static uint switch_core_session_running(SWIGTYPE_p_switch_core_session session) {
-    uint ret = freeswitchPINVOKE.switch_core_session_running(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static SWIGTYPE_p_void switch_core_perform_permanent_alloc(SWIGTYPE_p_switch_size_t memory, string file, string func, int line) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_perform_permanent_alloc(SWIGTYPE_p_switch_size_t.getCPtr(memory), file, func, line);
-    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static SWIGTYPE_p_void switch_core_perform_alloc(SWIGTYPE_p_apr_pool_t pool, SWIGTYPE_p_switch_size_t memory, string file, string func, int line) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_perform_alloc(SWIGTYPE_p_apr_pool_t.getCPtr(pool), SWIGTYPE_p_switch_size_t.getCPtr(memory), file, func, line);
-    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static SWIGTYPE_p_void switch_core_perform_session_alloc(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_size_t memory, string file, string func, int line) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_perform_session_alloc(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_size_t.getCPtr(memory), file, func, line);
-    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static string switch_core_perform_permanent_strdup(string todup, string file, string func, int line) {
-    string ret = freeswitchPINVOKE.switch_core_perform_permanent_strdup(todup, file, func, line);
-    return ret;
-  }
-
-  public static string switch_core_perform_session_strdup(SWIGTYPE_p_switch_core_session session, string todup, string file, string func, int line) {
-    string ret = freeswitchPINVOKE.switch_core_perform_session_strdup(SWIGTYPE_p_switch_core_session.getCPtr(session), todup, file, func, line);
-    return ret;
-  }
-
-  public static string switch_core_perform_strdup(SWIGTYPE_p_apr_pool_t pool, string todup, string file, string func, int line) {
-    string ret = freeswitchPINVOKE.switch_core_perform_strdup(SWIGTYPE_p_apr_pool_t.getCPtr(pool), todup, file, func, line);
-    return ret;
-  }
-
-  public static string switch_core_session_sprintf(SWIGTYPE_p_switch_core_session session, string fmt) {
-    string ret = freeswitchPINVOKE.switch_core_session_sprintf(SWIGTYPE_p_switch_core_session.getCPtr(session), fmt);
-    return ret;
-  }
-
-  public static string switch_core_sprintf(SWIGTYPE_p_apr_pool_t pool, string fmt) {
-    string ret = freeswitchPINVOKE.switch_core_sprintf(SWIGTYPE_p_apr_pool_t.getCPtr(pool), fmt);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_apr_pool_t switch_core_session_get_pool(SWIGTYPE_p_switch_core_session session) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_pool(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_core_session switch_core_session_request_uuid(switch_endpoint_interface endpoint_interface, switch_call_direction_t direction, SWIGTYPE_p_p_apr_pool_t pool, string use_uuid) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_request_uuid(switch_endpoint_interface.getCPtr(endpoint_interface), (int)direction, SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), use_uuid);
-    SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_set_uuid(SWIGTYPE_p_switch_core_session session, string use_uuid) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_uuid(SWIGTYPE_p_switch_core_session.getCPtr(session), use_uuid);
-    return ret;
-  }
-
-  public static void switch_core_session_perform_destroy(SWIGTYPE_p_p_switch_core_session session, string file, string func, int line) {
-    freeswitchPINVOKE.switch_core_session_perform_destroy(SWIGTYPE_p_p_switch_core_session.getCPtr(session), file, func, line);
-  }
-
-  public static void switch_core_session_destroy_state(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_core_session_destroy_state(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static void switch_core_session_reporting_state(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_core_session_reporting_state(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static void switch_core_session_hangup_state(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_core_session_hangup_state(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static uint switch_core_session_count() {
-    uint ret = freeswitchPINVOKE.switch_core_session_count();
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_size_t switch_core_session_get_id(SWIGTYPE_p_switch_core_session session) {
-    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_core_session_get_id(SWIGTYPE_p_switch_core_session.getCPtr(session)), true);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_size_t switch_core_session_id() {
-    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_core_session_id(), true);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_core_session switch_core_session_request_by_name(string endpoint_name, switch_call_direction_t direction, SWIGTYPE_p_p_apr_pool_t pool) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_request_by_name(endpoint_name, (int)direction, SWIGTYPE_p_p_apr_pool_t.getCPtr(pool));
-    SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_thread_launch(SWIGTYPE_p_switch_core_session session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_thread_launch(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_channel switch_core_session_get_channel(SWIGTYPE_p_switch_core_session session) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_channel(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    SWIGTYPE_p_switch_channel ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_channel(cPtr, false);
-    return ret;
-  }
-
-  public static void switch_core_session_wake_session_thread(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_core_session_wake_session_thread(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static void switch_core_session_signal_state_change(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_core_session_signal_state_change(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static string switch_core_session_get_uuid(SWIGTYPE_p_switch_core_session session) {
-    string ret = freeswitchPINVOKE.switch_core_session_get_uuid(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static string switch_core_get_uuid() {
-    string ret = freeswitchPINVOKE.switch_core_get_uuid();
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_core_session switch_core_session_locate(string uuid_str) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_locate(uuid_str);
-    SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_core_session switch_core_session_force_locate(string uuid_str) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_force_locate(uuid_str);
-    SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
-    return ret;
-  }
-
-  public static string switch_core_get_variable(string varname) {
-    string ret = freeswitchPINVOKE.switch_core_get_variable(varname);
-    return ret;
-  }
-
-  public static void switch_core_set_variable(string varname, string value) {
-    freeswitchPINVOKE.switch_core_set_variable(varname, value);
-  }
-
-  public static void switch_core_dump_variables(switch_stream_handle stream) {
-    freeswitchPINVOKE.switch_core_dump_variables(switch_stream_handle.getCPtr(stream));
-  }
-
-  public static void switch_core_session_hupall(switch_call_cause_t cause) {
-    freeswitchPINVOKE.switch_core_session_hupall((int)cause);
-  }
-
-  public static void switch_core_session_hupall_matching_var(string var_name, string var_val, switch_call_cause_t cause) {
-    freeswitchPINVOKE.switch_core_session_hupall_matching_var(var_name, var_val, (int)cause);
-  }
-
-  public static void switch_core_session_hupall_endpoint(switch_endpoint_interface endpoint_interface, switch_call_cause_t cause) {
-    freeswitchPINVOKE.switch_core_session_hupall_endpoint(switch_endpoint_interface.getCPtr(endpoint_interface), (int)cause);
-  }
-
-  public static switch_status_t switch_core_session_get_partner(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_core_session partner) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_get_partner(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_core_session.getCPtr(partner));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_message_send(string uuid_str, switch_core_session_message message) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_message_send(uuid_str, switch_core_session_message.getCPtr(message));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_queue_message(SWIGTYPE_p_switch_core_session session, switch_core_session_message message) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_queue_message(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_core_session_message.getCPtr(message));
-    return ret;
-  }
-
-  public static void switch_core_session_free_message(SWIGTYPE_p_p_switch_core_session_message message) {
-    freeswitchPINVOKE.switch_core_session_free_message(SWIGTYPE_p_p_switch_core_session_message.getCPtr(message));
-  }
-
-  public static switch_status_t switch_core_session_pass_indication(SWIGTYPE_p_switch_core_session session, switch_core_session_message_types_t indication) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_pass_indication(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)indication);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_queue_indication(SWIGTYPE_p_switch_core_session session, switch_core_session_message_types_t indication) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_queue_indication(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)indication);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_dequeue_message(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_core_session_message message) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_dequeue_message(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_core_session_message.getCPtr(message));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_flush_message(SWIGTYPE_p_switch_core_session session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_flush_message(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_event_send(string uuid_str, SWIGTYPE_p_p_switch_event arg1) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_event_send(uuid_str, SWIGTYPE_p_p_switch_event.getCPtr(arg1));
-    return ret;
-  }
-
-  public static switch_app_log switch_core_session_get_app_log(SWIGTYPE_p_switch_core_session session) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_app_log(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    switch_app_log ret = (cPtr == IntPtr.Zero) ? null : new switch_app_log(cPtr, false);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_exec(SWIGTYPE_p_switch_core_session session, switch_application_interface application_interface, string arg) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_exec(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_application_interface.getCPtr(application_interface), arg);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_execute_application(SWIGTYPE_p_switch_core_session session, string app, string arg) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_execute_application(SWIGTYPE_p_switch_core_session.getCPtr(session), app, arg);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_execute_exten(SWIGTYPE_p_switch_core_session session, string exten, string dialplan, string context) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_execute_exten(SWIGTYPE_p_switch_core_session.getCPtr(session), exten, dialplan, context);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_receive_event(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_event arg1) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_receive_event(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_event.getCPtr(arg1));
-    return ret;
-  }
-
-  public static SWIGTYPE_p_void switch_core_session_get_private(SWIGTYPE_p_switch_core_session session) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_private(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_set_private(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_void private_info) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_private(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_void.getCPtr(private_info));
-    return ret;
-  }
-
-  public static int switch_core_session_add_stream(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_void private_info) {
-    int ret = freeswitchPINVOKE.switch_core_session_add_stream(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_void.getCPtr(private_info));
-    return ret;
-  }
-
-  public static SWIGTYPE_p_void switch_core_session_get_stream(SWIGTYPE_p_switch_core_session session, int index) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_stream(SWIGTYPE_p_switch_core_session.getCPtr(session), index);
-    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-    return ret;
-  }
-
-  public static int switch_core_session_get_stream_count(SWIGTYPE_p_switch_core_session session) {
-    int ret = freeswitchPINVOKE.switch_core_session_get_stream_count(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static void switch_core_session_launch_thread(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void func, SWIGTYPE_p_void obj) {
-    freeswitchPINVOKE.switch_core_session_launch_thread(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void.getCPtr(func), SWIGTYPE_p_void.getCPtr(obj));
-  }
-
-  public static void switch_core_thread_session_end(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_core_thread_session_end(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static void switch_core_service_session(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_core_service_session(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static switch_call_cause_t switch_core_session_outgoing_channel(SWIGTYPE_p_switch_core_session session, switch_event var_event, string endpoint_name, switch_caller_profile caller_profile, SWIGTYPE_p_p_switch_core_session new_session, SWIGTYPE_p_p_apr_pool_t pool, uint flags, SWIGTYPE_p_switch_call_cause_t cancel_cause) {
-    switch_call_cause_t ret = (switch_call_cause_t)freeswitchPINVOKE.switch_core_session_outgoing_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_event.getCPtr(var_event), endpoint_name, switch_caller_profile.getCPtr(caller_profile), SWIGTYPE_p_p_switch_core_session.getCPtr(new_session), SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), flags, SWIGTYPE_p_switch_call_cause_t.getCPtr(cancel_cause));
-    return ret;
-  }
-
-  public static switch_call_cause_t switch_core_session_resurrect_channel(string endpoint_name, SWIGTYPE_p_p_switch_core_session new_session, SWIGTYPE_p_p_apr_pool_t pool, SWIGTYPE_p_void data) {
-    switch_call_cause_t ret = (switch_call_cause_t)freeswitchPINVOKE.switch_core_session_resurrect_channel(endpoint_name, SWIGTYPE_p_p_switch_core_session.getCPtr(new_session), SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), SWIGTYPE_p_void.getCPtr(data));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_perform_receive_message(SWIGTYPE_p_switch_core_session session, switch_core_session_message message, string file, string func, int line) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_perform_receive_message(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_core_session_message.getCPtr(message), file, func, line);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_queue_event(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_event arg1) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_queue_event(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_event.getCPtr(arg1));
-    return ret;
-  }
-
-  public static uint switch_core_session_event_count(SWIGTYPE_p_switch_core_session session) {
-    uint ret = freeswitchPINVOKE.switch_core_session_event_count(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_dequeue_event(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_event arg1, switch_bool_t force) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_dequeue_event(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_event.getCPtr(arg1), (int)force);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_queue_private_event(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_event arg1) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_queue_private_event(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_event.getCPtr(arg1));
-    return ret;
-  }
-
-  public static uint switch_core_session_private_event_count(SWIGTYPE_p_switch_core_session session) {
-    uint ret = freeswitchPINVOKE.switch_core_session_private_event_count(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_dequeue_private_event(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_event arg1) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_dequeue_private_event(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_event.getCPtr(arg1));
-    return ret;
-  }
-
-  public static uint switch_core_session_flush_private_events(SWIGTYPE_p_switch_core_session session) {
-    uint ret = freeswitchPINVOKE.switch_core_session_flush_private_events(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_frame frame, uint flags, int stream_id) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_frame.getCPtr(frame), flags, stream_id);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_read_video_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_frame frame, uint flags, int stream_id) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_read_video_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_frame.getCPtr(frame), flags, stream_id);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_write_video_frame(SWIGTYPE_p_switch_core_session session, switch_frame frame, uint flags, int stream_id) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_write_video_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_frame.getCPtr(frame), flags, stream_id);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_set_read_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_read_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_set_write_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_write_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_set_video_read_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_video_read_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_set_video_write_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_video_write_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp));
-    return ret;
-  }
-
-  public static void switch_core_session_reset(SWIGTYPE_p_switch_core_session session, switch_bool_t flush_dtmf, switch_bool_t reset_read_codec) {
-    freeswitchPINVOKE.switch_core_session_reset(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)flush_dtmf, (int)reset_read_codec);
-  }
-
-  public static switch_status_t switch_core_session_write_frame(SWIGTYPE_p_switch_core_session session, switch_frame frame, uint flags, int stream_id) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_write_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_frame.getCPtr(frame), flags, stream_id);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_perform_kill_channel(SWIGTYPE_p_switch_core_session session, string file, string func, int line, switch_signal_t sig) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_perform_kill_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), file, func, line, (int)sig);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_send_dtmf(SWIGTYPE_p_switch_core_session session, switch_dtmf_t dtmf) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_send_dtmf(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_dtmf_t.getCPtr(dtmf));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_send_dtmf_string(SWIGTYPE_p_switch_core_session session, string dtmf_string) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_send_dtmf_string(SWIGTYPE_p_switch_core_session.getCPtr(session), dtmf_string);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_recv_dtmf(SWIGTYPE_p_switch_core_session session, switch_dtmf_t dtmf) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_recv_dtmf(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_dtmf_t.getCPtr(dtmf));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_hash_init_case(SWIGTYPE_p_p_switch_hash hash, SWIGTYPE_p_apr_pool_t pool, switch_bool_t case_sensitive) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_hash_init_case(SWIGTYPE_p_p_switch_hash.getCPtr(hash), SWIGTYPE_p_apr_pool_t.getCPtr(pool), (int)case_sensitive);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_hash_destroy(SWIGTYPE_p_p_switch_hash hash) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_hash_destroy(SWIGTYPE_p_p_switch_hash.getCPtr(hash));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_hash_insert(SWIGTYPE_p_switch_hash hash, string key, SWIGTYPE_p_void data) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_hash_insert(SWIGTYPE_p_switch_hash.getCPtr(hash), key, SWIGTYPE_p_void.getCPtr(data));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_hash_insert_locked(SWIGTYPE_p_switch_hash hash, string key, SWIGTYPE_p_void data, SWIGTYPE_p_switch_mutex_t mutex) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_hash_insert_locked(SWIGTYPE_p_switch_hash.getCPtr(hash), key, SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_mutex_t.getCPtr(mutex));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_hash_delete(SWIGTYPE_p_switch_hash hash, string key) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_hash_delete(SWIGTYPE_p_switch_hash.getCPtr(hash), key);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_hash_delete_locked(SWIGTYPE_p_switch_hash hash, string key, SWIGTYPE_p_switch_mutex_t mutex) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_hash_delete_locked(SWIGTYPE_p_switch_hash.getCPtr(hash), key, SWIGTYPE_p_switch_mutex_t.getCPtr(mutex));
-    return ret;
-  }
-
-  public static SWIGTYPE_p_void switch_core_hash_find(SWIGTYPE_p_switch_hash hash, string key) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_hash_find(SWIGTYPE_p_switch_hash.getCPtr(hash), key);
-    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_void switch_core_hash_find_locked(SWIGTYPE_p_switch_hash hash, string key, SWIGTYPE_p_switch_mutex_t mutex) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_hash_find_locked(SWIGTYPE_p_switch_hash.getCPtr(hash), key, SWIGTYPE_p_switch_mutex_t.getCPtr(mutex));
-    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_HashElem switch_hash_first(string depricate_me, SWIGTYPE_p_switch_hash hash) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_hash_first(depricate_me, SWIGTYPE_p_switch_hash.getCPtr(hash));
-    SWIGTYPE_p_HashElem ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_HashElem(cPtr, false);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_HashElem switch_hash_next(SWIGTYPE_p_HashElem hi) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_hash_next(SWIGTYPE_p_HashElem.getCPtr(hi));
-    SWIGTYPE_p_HashElem ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_HashElem(cPtr, false);
-    return ret;
-  }
-
-  public static void switch_hash_this(SWIGTYPE_p_HashElem hi, SWIGTYPE_p_p_void key, SWIGTYPE_p_switch_ssize_t klen, SWIGTYPE_p_p_void val) {
-    freeswitchPINVOKE.switch_hash_this(SWIGTYPE_p_HashElem.getCPtr(hi), SWIGTYPE_p_p_void.getCPtr(key), SWIGTYPE_p_switch_ssize_t.getCPtr(klen), SWIGTYPE_p_p_void.getCPtr(val));
-  }
-
-  public static switch_status_t switch_core_timer_init(switch_timer timer, string timer_name, int interval, int samples, SWIGTYPE_p_apr_pool_t pool) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_timer_init(switch_timer.getCPtr(timer), timer_name, interval, samples, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_timer_next(switch_timer timer) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_timer_next(switch_timer.getCPtr(timer));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_timer_step(switch_timer timer) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_timer_step(switch_timer.getCPtr(timer));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_timer_sync(switch_timer timer) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_timer_sync(switch_timer.getCPtr(timer));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_timer_check(switch_timer timer, switch_bool_t step) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_timer_check(switch_timer.getCPtr(timer), (int)step);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_timer_destroy(switch_timer timer) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_timer_destroy(switch_timer.getCPtr(timer));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_codec_init(switch_codec codec, string codec_name, string fmtp, uint rate, int ms, int channels, uint flags, switch_codec_settings codec_settings, SWIGTYPE_p_apr_pool_t pool) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_init(switch_codec.getCPtr(codec), codec_name, fmtp, rate, ms, channels, flags, switch_codec_settings.getCPtr(codec_settings), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_codec_copy(switch_codec codec, switch_codec new_codec, SWIGTYPE_p_apr_pool_t pool) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_copy(switch_codec.getCPtr(codec), switch_codec.getCPtr(new_codec), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_codec_encode(switch_codec codec, switch_codec other_codec, SWIGTYPE_p_void decoded_data, uint decoded_data_len, uint decoded_rate, SWIGTYPE_p_void encoded_data, SWIGTYPE_p_unsigned_long encoded_data_len, SWIGTYPE_p_unsigned_long encoded_rate, SWIGTYPE_p_unsigned_int flag) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_encode(switch_codec.getCPtr(codec), switch_codec.getCPtr(other_codec), SWIGTYPE_p_void.getCPtr(decoded_data), decoded_data_len, decoded_rate, SWIGTYPE_p_void.getCPtr(encoded_data), SWIGTYPE_p_unsigned_long.getCPtr(encoded_data_len), SWIGTYPE_p_unsigned_long.getCPtr(encoded_rate), SWIGTYPE_p_unsigned_int.getCPtr(flag));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_codec_decode(switch_codec codec, switch_codec other_codec, SWIGTYPE_p_void encoded_data, uint encoded_data_len, uint encoded_rate, SWIGTYPE_p_void decoded_data, SWIGTYPE_p_unsigned_long decoded_data_len, SWIGTYPE_p_unsigned_long decoded_rate, SWIGTYPE_p_unsigned_int flag) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_decode(switch_codec.getCPtr(codec), switch_codec.getCPtr(other_codec), SWIGTYPE_p_void.getCPtr(encoded_data), encoded_data_len, encoded_rate, SWIGTYPE_p_void.getCPtr(decoded_data), SWIGTYPE_p_unsigned_long.getCPtr(decoded_data_len), SWIGTYPE_p_unsigned_long.getCPtr(decoded_rate), SWIGTYPE_p_unsigned_int.getCPtr(flag));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_codec_destroy(switch_codec codec) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_destroy(switch_codec.getCPtr(codec));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_set_read_codec(SWIGTYPE_p_switch_core_session session, switch_codec codec) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_read_codec(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec.getCPtr(codec));
-    return ret;
-  }
-
-  public static void switch_core_session_unset_read_codec(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_core_session_unset_read_codec(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static void switch_core_session_unset_write_codec(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_core_session_unset_write_codec(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static void switch_core_session_lock_codec_write(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_core_session_lock_codec_write(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static void switch_core_session_unlock_codec_write(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_core_session_unlock_codec_write(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static void switch_core_session_lock_codec_read(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_core_session_lock_codec_read(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static void switch_core_session_unlock_codec_read(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_core_session_unlock_codec_read(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static switch_status_t switch_core_session_get_read_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_get_read_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_get_write_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_get_write_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_get_video_read_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_get_video_read_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_get_video_write_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_get_video_write_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp));
-    return ret;
-  }
-
-  public static switch_codec switch_core_session_get_read_codec(SWIGTYPE_p_switch_core_session session) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_read_codec(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    switch_codec ret = (cPtr == IntPtr.Zero) ? null : new switch_codec(cPtr, false);
-    return ret;
-  }
-
-  public static switch_codec switch_core_session_get_effective_read_codec(SWIGTYPE_p_switch_core_session session) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_effective_read_codec(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    switch_codec ret = (cPtr == IntPtr.Zero) ? null : new switch_codec(cPtr, false);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_set_write_codec(SWIGTYPE_p_switch_core_session session, switch_codec codec) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_write_codec(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec.getCPtr(codec));
-    return ret;
-  }
-
-  public static switch_codec switch_core_session_get_write_codec(SWIGTYPE_p_switch_core_session session) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_write_codec(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    switch_codec ret = (cPtr == IntPtr.Zero) ? null : new switch_codec(cPtr, false);
-    return ret;
-  }
-
-  public static switch_codec switch_core_session_get_effective_write_codec(SWIGTYPE_p_switch_core_session session) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_effective_write_codec(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    switch_codec ret = (cPtr == IntPtr.Zero) ? null : new switch_codec(cPtr, false);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_set_video_read_codec(SWIGTYPE_p_switch_core_session session, switch_codec codec) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_video_read_codec(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec.getCPtr(codec));
-    return ret;
-  }
-
-  public static switch_codec switch_core_session_get_video_read_codec(SWIGTYPE_p_switch_core_session session) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_video_read_codec(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    switch_codec ret = (cPtr == IntPtr.Zero) ? null : new switch_codec(cPtr, false);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_session_set_video_write_codec(SWIGTYPE_p_switch_core_session session, switch_codec codec) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_video_write_codec(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec.getCPtr(codec));
-    return ret;
-  }
-
-  public static switch_codec switch_core_session_get_video_write_codec(SWIGTYPE_p_switch_core_session session) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_video_write_codec(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    switch_codec ret = (cPtr == IntPtr.Zero) ? null : new switch_codec(cPtr, false);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_sqlite3 switch_core_db_open_file(string filename) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_db_open_file(filename);
-    SWIGTYPE_p_sqlite3 ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_sqlite3(cPtr, false);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_db_persistant_execute(SWIGTYPE_p_sqlite3 db, string sql, uint retries) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_db_persistant_execute(SWIGTYPE_p_sqlite3.getCPtr(db), sql, retries);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_db_persistant_execute_trans(SWIGTYPE_p_sqlite3 db, string sql, uint retries) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_db_persistant_execute_trans(SWIGTYPE_p_sqlite3.getCPtr(db), sql, retries);
-    return ret;
-  }
-
-  public static void switch_core_db_test_reactive(SWIGTYPE_p_sqlite3 db, string test_sql, string drop_sql, string reactive_sql) {
-    freeswitchPINVOKE.switch_core_db_test_reactive(SWIGTYPE_p_sqlite3.getCPtr(db), test_sql, drop_sql, reactive_sql);
-  }
-
-  public static switch_status_t switch_core_perform_file_open(string file, string func, int line, switch_file_handle fh, string file_path, byte channels, uint rate, uint flags, SWIGTYPE_p_apr_pool_t pool) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_perform_file_open(file, func, line, switch_file_handle.getCPtr(fh), file_path, channels, rate, flags, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_file_read(switch_file_handle fh, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t len) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_file_read(switch_file_handle.getCPtr(fh), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(len));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_file_write(switch_file_handle fh, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t len) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_file_write(switch_file_handle.getCPtr(fh), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(len));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_file_seek(switch_file_handle fh, SWIGTYPE_p_unsigned_int cur_pos, long samples, int whence) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_file_seek(switch_file_handle.getCPtr(fh), SWIGTYPE_p_unsigned_int.getCPtr(cur_pos), samples, whence);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_file_set_string(switch_file_handle fh, switch_audio_col_t col, string arg2) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_file_set_string(switch_file_handle.getCPtr(fh), (int)col, arg2);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_file_get_string(switch_file_handle fh, switch_audio_col_t col, ref string arg2) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_file_get_string(switch_file_handle.getCPtr(fh), (int)col, ref arg2);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_file_close(switch_file_handle fh) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_file_close(switch_file_handle.getCPtr(fh));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_file_truncate(switch_file_handle fh, long offset) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_file_truncate(switch_file_handle.getCPtr(fh), offset);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_speech_open(switch_speech_handle sh, string module_name, string voice_name, uint rate, uint interval, SWIGTYPE_p_unsigned_long flags, SWIGTYPE_p_apr_pool_t pool) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_open(switch_speech_handle.getCPtr(sh), module_name, voice_name, rate, interval, SWIGTYPE_p_unsigned_long.getCPtr(flags), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_speech_feed_tts(switch_speech_handle sh, string text, SWIGTYPE_p_unsigned_long flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_feed_tts(switch_speech_handle.getCPtr(sh), text, SWIGTYPE_p_unsigned_long.getCPtr(flags));
-    return ret;
-  }
-
-  public static void switch_core_speech_flush_tts(switch_speech_handle sh) {
-    freeswitchPINVOKE.switch_core_speech_flush_tts(switch_speech_handle.getCPtr(sh));
-  }
-
-  public static void switch_core_speech_text_param_tts(switch_speech_handle sh, string param, string val) {
-    freeswitchPINVOKE.switch_core_speech_text_param_tts(switch_speech_handle.getCPtr(sh), param, val);
-  }
-
-  public static void switch_core_speech_numeric_param_tts(switch_speech_handle sh, string param, int val) {
-    freeswitchPINVOKE.switch_core_speech_numeric_param_tts(switch_speech_handle.getCPtr(sh), param, val);
-  }
-
-  public static void switch_core_speech_float_param_tts(switch_speech_handle sh, string param, double val) {
-    freeswitchPINVOKE.switch_core_speech_float_param_tts(switch_speech_handle.getCPtr(sh), param, val);
-  }
-
-  public static switch_status_t switch_core_speech_read_tts(switch_speech_handle sh, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen, SWIGTYPE_p_unsigned_long flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_read_tts(switch_speech_handle.getCPtr(sh), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen), SWIGTYPE_p_unsigned_long.getCPtr(flags));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_speech_close(switch_speech_handle sh, SWIGTYPE_p_unsigned_long flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_close(switch_speech_handle.getCPtr(sh), SWIGTYPE_p_unsigned_long.getCPtr(flags));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_asr_open(switch_asr_handle ah, string module_name, string codec, int rate, string dest, SWIGTYPE_p_unsigned_long flags, SWIGTYPE_p_apr_pool_t pool) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_open(switch_asr_handle.getCPtr(ah), module_name, codec, rate, dest, SWIGTYPE_p_unsigned_long.getCPtr(flags), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_asr_close(switch_asr_handle ah, SWIGTYPE_p_unsigned_long flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_close(switch_asr_handle.getCPtr(ah), SWIGTYPE_p_unsigned_long.getCPtr(flags));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_asr_feed(switch_asr_handle ah, SWIGTYPE_p_void data, uint len, SWIGTYPE_p_unsigned_long flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_feed(switch_asr_handle.getCPtr(ah), SWIGTYPE_p_void.getCPtr(data), len, SWIGTYPE_p_unsigned_long.getCPtr(flags));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_asr_check_results(switch_asr_handle ah, SWIGTYPE_p_unsigned_long flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_check_results(switch_asr_handle.getCPtr(ah), SWIGTYPE_p_unsigned_long.getCPtr(flags));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_asr_get_results(switch_asr_handle ah, ref string xmlstr, SWIGTYPE_p_unsigned_long flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_get_results(switch_asr_handle.getCPtr(ah), ref xmlstr, SWIGTYPE_p_unsigned_long.getCPtr(flags));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_asr_load_grammar(switch_asr_handle ah, string grammar, string name) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_load_grammar(switch_asr_handle.getCPtr(ah), grammar, name);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_asr_unload_grammar(switch_asr_handle ah, string name) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_unload_grammar(switch_asr_handle.getCPtr(ah), name);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_asr_pause(switch_asr_handle ah) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_pause(switch_asr_handle.getCPtr(ah));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_asr_resume(switch_asr_handle ah) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_resume(switch_asr_handle.getCPtr(ah));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_asr_start_input_timers(switch_asr_handle ah) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_start_input_timers(switch_asr_handle.getCPtr(ah));
-    return ret;
-  }
-
-  public static void switch_core_asr_text_param(switch_asr_handle ah, string param, string val) {
-    freeswitchPINVOKE.switch_core_asr_text_param(switch_asr_handle.getCPtr(ah), param, val);
-  }
-
-  public static void switch_core_asr_numeric_param(switch_asr_handle ah, string param, int val) {
-    freeswitchPINVOKE.switch_core_asr_numeric_param(switch_asr_handle.getCPtr(ah), param, val);
-  }
-
-  public static void switch_core_asr_float_param(switch_asr_handle ah, string param, double val) {
-    freeswitchPINVOKE.switch_core_asr_float_param(switch_asr_handle.getCPtr(ah), param, val);
-  }
-
-  public static switch_status_t switch_core_directory_open(switch_directory_handle dh, string module_name, string source, string dsn, string passwd, SWIGTYPE_p_apr_pool_t pool) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_directory_open(switch_directory_handle.getCPtr(dh), module_name, source, dsn, passwd, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_directory_query(switch_directory_handle dh, string arg1, string query) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_directory_query(switch_directory_handle.getCPtr(dh), arg1, query);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_directory_next(switch_directory_handle dh) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_directory_next(switch_directory_handle.getCPtr(dh));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_directory_next_pair(switch_directory_handle dh, ref string var, ref string val) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_directory_next_pair(switch_directory_handle.getCPtr(dh), ref var, ref val);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_directory_close(switch_directory_handle dh) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_directory_close(switch_directory_handle.getCPtr(dh));
-    return ret;
-  }
-
-  public static SWIGTYPE_p_FILE switch_core_data_channel(switch_text_channel_t channel) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_data_channel((int)channel);
-    SWIGTYPE_p_FILE ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_FILE(cPtr, false);
-    return ret;
-  }
-
-  public static switch_bool_t switch_core_ready() {
-    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_core_ready();
-    return ret;
-  }
-
-  public static uint switch_core_flags() {
-    uint ret = freeswitchPINVOKE.switch_core_flags();
-    return ret;
-  }
-
-  public static switch_status_t switch_core_management_exec(string relative_oid, switch_management_action_t action, string data, SWIGTYPE_p_switch_size_t datalen) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_management_exec(relative_oid, (int)action, data, SWIGTYPE_p_switch_size_t.getCPtr(datalen));
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static int set_high_priority() {
-    int ret = freeswitchPINVOKE.set_high_priority();
-    return ret;
-  }
-
-  public static int change_user_group(string user, string group) {
-    int ret = freeswitchPINVOKE.change_user_group(user, group);
-    return ret;
-  }
-
-  public static void switch_core_runtime_loop(int bg) {
-    freeswitchPINVOKE.switch_core_runtime_loop(bg);
-  }
-
-  public static switch_status_t switch_core_set_console(string console) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_set_console(console);
-    return ret;
-  }
-
-  public static void switch_core_measure_time(SWIGTYPE_p_switch_time_t total_ms, switch_core_time_duration duration) {
-    freeswitchPINVOKE.switch_core_measure_time(SWIGTYPE_p_switch_time_t.getCPtr(total_ms), switch_core_time_duration.getCPtr(duration));
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-  }
-
-  public static SWIGTYPE_p_switch_time_t switch_core_uptime() {
-    SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_core_uptime(), true);
-    return ret;
-  }
-
-  public static int switch_core_session_ctl(switch_session_ctl_t cmd, SWIGTYPE_p_int val) {
-    int ret = freeswitchPINVOKE.switch_core_session_ctl((int)cmd, SWIGTYPE_p_int.getCPtr(val));
-    return ret;
-  }
-
-  public static SWIGTYPE_p_FILE switch_core_get_console() {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_get_console();
-    SWIGTYPE_p_FILE ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_FILE(cPtr, false);
-    return ret;
-  }
-
-  public static void switch_core_set_globals() {
-    freeswitchPINVOKE.switch_core_set_globals();
-  }
-
-  public static byte switch_core_session_compare(SWIGTYPE_p_switch_core_session a, SWIGTYPE_p_switch_core_session b) {
-    byte ret = freeswitchPINVOKE.switch_core_session_compare(SWIGTYPE_p_switch_core_session.getCPtr(a), SWIGTYPE_p_switch_core_session.getCPtr(b));
-    return ret;
-  }
-
-  public static byte switch_core_session_check_interface(SWIGTYPE_p_switch_core_session session, switch_endpoint_interface endpoint_interface) {
-    byte ret = freeswitchPINVOKE.switch_core_session_check_interface(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_endpoint_interface.getCPtr(endpoint_interface));
-    return ret;
-  }
-
-  public static SWIGTYPE_p_HashElem switch_core_mime_index() {
-    IntPtr cPtr = freeswitchPINVOKE.switch_core_mime_index();
-    SWIGTYPE_p_HashElem ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_HashElem(cPtr, false);
-    return ret;
-  }
-
-  public static string switch_core_mime_ext2type(string ext) {
-    string ret = freeswitchPINVOKE.switch_core_mime_ext2type(ext);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_mime_add_type(string type, string ext) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_mime_add_type(type, ext);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_loadable_module_interface switch_loadable_module_create_module_interface(SWIGTYPE_p_apr_pool_t pool, string name) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_create_module_interface(SWIGTYPE_p_apr_pool_t.getCPtr(pool), name);
-    SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_void switch_loadable_module_create_interface(SWIGTYPE_p_switch_loadable_module_interface mod, switch_module_interface_name_t iname) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_create_interface(SWIGTYPE_p_switch_loadable_module_interface.getCPtr(mod), (int)iname);
-    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_time_t switch_micro_time_now() {
-    SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_micro_time_now(), true);
-    return ret;
-  }
-
-  public static void switch_core_memory_reclaim() {
-    freeswitchPINVOKE.switch_core_memory_reclaim();
-  }
-
-  public static void switch_core_memory_reclaim_events() {
-    freeswitchPINVOKE.switch_core_memory_reclaim_events();
-  }
-
-  public static void switch_core_memory_reclaim_logger() {
-    freeswitchPINVOKE.switch_core_memory_reclaim_logger();
-  }
-
-  public static void switch_core_memory_reclaim_all() {
-    freeswitchPINVOKE.switch_core_memory_reclaim_all();
-  }
-
-  public static void switch_core_setrlimits() {
-    freeswitchPINVOKE.switch_core_setrlimits();
-  }
-
-  public static void switch_time_sync() {
-    freeswitchPINVOKE.switch_time_sync();
-  }
-
-  public static SWIGTYPE_p_time_t switch_epoch_time_now(SWIGTYPE_p_time_t t) {
-    SWIGTYPE_p_time_t ret = new SWIGTYPE_p_time_t(freeswitchPINVOKE.switch_epoch_time_now(SWIGTYPE_p_time_t.getCPtr(t)), true);
-    return ret;
-  }
-
-  public static switch_status_t switch_strftime_tz(string tz, string format, string date, uint len, SWIGTYPE_p_switch_time_t thetime) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_strftime_tz(tz, format, date, len, SWIGTYPE_p_switch_time_t.getCPtr(thetime));
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static switch_status_t switch_time_exp_tz_name(string tz, SWIGTYPE_p_switch_time_exp_t tm, SWIGTYPE_p_switch_time_t thetime) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_time_exp_tz_name(tz, SWIGTYPE_p_switch_time_exp_t.getCPtr(tm), SWIGTYPE_p_switch_time_t.getCPtr(thetime));
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static void switch_load_network_lists(switch_bool_t reload) {
-    freeswitchPINVOKE.switch_load_network_lists((int)reload);
-  }
-
-  public static switch_bool_t switch_check_network_list_ip_token(string ip_str, string list_name, ref string token) {
-    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_check_network_list_ip_token(ip_str, list_name, ref token);
-    return ret;
-  }
-
-  public static void switch_time_set_monotonic(switch_bool_t enable) {
-    freeswitchPINVOKE.switch_time_set_monotonic((int)enable);
-  }
-
-  public static uint switch_core_min_dtmf_duration(uint duration) {
-    uint ret = freeswitchPINVOKE.switch_core_min_dtmf_duration(duration);
-    return ret;
-  }
-
-  public static uint switch_core_max_dtmf_duration(uint duration) {
-    uint ret = freeswitchPINVOKE.switch_core_max_dtmf_duration(duration);
-    return ret;
-  }
-
-  public static uint switch_core_default_dtmf_duration(uint duration) {
-    uint ret = freeswitchPINVOKE.switch_core_default_dtmf_duration(duration);
-    return ret;
-  }
-
-  public static switch_status_t switch_console_set_complete(string arg0) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_console_set_complete(arg0);
-    return ret;
-  }
-
-  public static switch_status_t switch_console_set_alias(string arg0) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_console_set_alias(arg0);
-    return ret;
-  }
-
-  public static int switch_system(string cmd, switch_bool_t wait) {
-    int ret = freeswitchPINVOKE.switch_system(cmd, (int)wait);
-    return ret;
-  }
-
-  public static void switch_cond_yield(SWIGTYPE_p_switch_interval_time_t t) {
-    freeswitchPINVOKE.switch_cond_yield(SWIGTYPE_p_switch_interval_time_t.getCPtr(t));
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-  }
-
-  public static void switch_cond_next() {
-    freeswitchPINVOKE.switch_cond_next();
-  }
-
-  public static switch_status_t switch_core_chat_send(string name, string proto, string from, string to, string subject, string body, string type, string hint) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_chat_send(name, proto, from, to, subject, body, type, hint);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_preprocess_session(SWIGTYPE_p_switch_core_session session, string cmds) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_preprocess_session(SWIGTYPE_p_switch_core_session.getCPtr(session), cmds);
-    return ret;
-  }
-
-  public static string switch_cache_db_type_name(switch_cache_db_handle_type_t type) {
-    string ret = freeswitchPINVOKE.switch_cache_db_type_name((int)type);
-    return ret;
-  }
-
-  public static void switch_cache_db_release_db_handle(SWIGTYPE_p_p_switch_cache_db_handle_t dbh) {
-    freeswitchPINVOKE.switch_cache_db_release_db_handle(SWIGTYPE_p_p_switch_cache_db_handle_t.getCPtr(dbh));
-  }
-
-  public static void switch_cache_db_destroy_db_handle(SWIGTYPE_p_p_switch_cache_db_handle_t dbh) {
-    freeswitchPINVOKE.switch_cache_db_destroy_db_handle(SWIGTYPE_p_p_switch_cache_db_handle_t.getCPtr(dbh));
-  }
-
-  public static switch_status_t _switch_cache_db_get_db_handle(SWIGTYPE_p_p_switch_cache_db_handle_t dbh, switch_cache_db_handle_type_t type, switch_cache_db_connection_options_t connection_options, string file, string func, int line) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE._switch_cache_db_get_db_handle(SWIGTYPE_p_p_switch_cache_db_handle_t.getCPtr(dbh), (int)type, switch_cache_db_connection_options_t.getCPtr(connection_options), file, func, line);
-    return ret;
-  }
-
-  public static string switch_cache_db_execute_sql2str(switch_cache_db_handle_t dbh, string sql, string str, uint len, ref string err) {
-    string ret = freeswitchPINVOKE.switch_cache_db_execute_sql2str(switch_cache_db_handle_t.getCPtr(dbh), sql, str, len, ref err);
-    return ret;
-  }
-
-  public static switch_status_t switch_cache_db_execute_sql(switch_cache_db_handle_t dbh, string sql, ref string err) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_cache_db_execute_sql(switch_cache_db_handle_t.getCPtr(dbh), sql, ref err);
-    return ret;
-  }
-
-  public static switch_status_t switch_cache_db_execute_sql_callback(switch_cache_db_handle_t dbh, string sql, SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int callback, SWIGTYPE_p_void pdata, ref string err) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_cache_db_execute_sql_callback(switch_cache_db_handle_t.getCPtr(dbh), sql, SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int.getCPtr(callback), SWIGTYPE_p_void.getCPtr(pdata), ref err);
-    return ret;
-  }
-
-  public static void switch_cache_db_status(switch_stream_handle stream) {
-    freeswitchPINVOKE.switch_cache_db_status(switch_stream_handle.getCPtr(stream));
-  }
-
-  public static switch_status_t _switch_core_db_handle(SWIGTYPE_p_p_switch_cache_db_handle_t dbh, string file, string func, int line) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE._switch_core_db_handle(SWIGTYPE_p_p_switch_cache_db_handle_t.getCPtr(dbh), file, func, line);
-    return ret;
-  }
-
-  public static void switch_cache_db_test_reactive(switch_cache_db_handle_t db, string test_sql, string drop_sql, string reactive_sql) {
-    freeswitchPINVOKE.switch_cache_db_test_reactive(switch_cache_db_handle_t.getCPtr(db), test_sql, drop_sql, reactive_sql);
-  }
-
-  public static switch_status_t switch_cache_db_persistant_execute(switch_cache_db_handle_t dbh, string sql, uint retries) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_cache_db_persistant_execute(switch_cache_db_handle_t.getCPtr(dbh), sql, retries);
-    return ret;
-  }
-
-  public static switch_status_t switch_cache_db_persistant_execute_trans(switch_cache_db_handle_t dbh, string sql, uint retries) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_cache_db_persistant_execute_trans(switch_cache_db_handle_t.getCPtr(dbh), sql, retries);
-    return ret;
-  }
-
-  public static void switch_cache_db_detach() {
-    freeswitchPINVOKE.switch_cache_db_detach();
-  }
-
-  public static uint switch_core_debug_level() {
-    uint ret = freeswitchPINVOKE.switch_core_debug_level();
-    return ret;
-  }
-
-  public static void switch_console_loop() {
-    freeswitchPINVOKE.switch_console_loop();
-  }
-
-  public static switch_status_t switch_console_stream_raw_write(switch_stream_handle handle, SWIGTYPE_p_unsigned_char data, SWIGTYPE_p_switch_size_t datalen) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_console_stream_raw_write(switch_stream_handle.getCPtr(handle), SWIGTYPE_p_unsigned_char.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen));
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static switch_status_t switch_stream_write_file_contents(switch_stream_handle stream, string path) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_stream_write_file_contents(switch_stream_handle.getCPtr(stream), path);
-    return ret;
-  }
-
-  public static int switch_toupper(int c) {
-    int ret = freeswitchPINVOKE.switch_toupper(c);
-    return ret;
-  }
-
-  public static int switch_tolower(int c) {
-    int ret = freeswitchPINVOKE.switch_tolower(c);
-    return ret;
-  }
-
-  public static int switch_isalnum(int c) {
-    int ret = freeswitchPINVOKE.switch_isalnum(c);
-    return ret;
-  }
-
-  public static int switch_isalpha(int c) {
-    int ret = freeswitchPINVOKE.switch_isalpha(c);
-    return ret;
-  }
-
-  public static int switch_iscntrl(int c) {
-    int ret = freeswitchPINVOKE.switch_iscntrl(c);
-    return ret;
-  }
-
-  public static int switch_isdigit(int c) {
-    int ret = freeswitchPINVOKE.switch_isdigit(c);
-    return ret;
-  }
-
-  public static int switch_isgraph(int c) {
-    int ret = freeswitchPINVOKE.switch_isgraph(c);
-    return ret;
-  }
-
-  public static int switch_islower(int c) {
-    int ret = freeswitchPINVOKE.switch_islower(c);
-    return ret;
-  }
-
-  public static int switch_isprint(int c) {
-    int ret = freeswitchPINVOKE.switch_isprint(c);
-    return ret;
-  }
-
-  public static int switch_ispunct(int c) {
-    int ret = freeswitchPINVOKE.switch_ispunct(c);
-    return ret;
-  }
-
-  public static int switch_isspace(int c) {
-    int ret = freeswitchPINVOKE.switch_isspace(c);
-    return ret;
-  }
-
-  public static int switch_isupper(int c) {
-    int ret = freeswitchPINVOKE.switch_isupper(c);
-    return ret;
-  }
-
-  public static int switch_isxdigit(int c) {
-    int ret = freeswitchPINVOKE.switch_isxdigit(c);
-    return ret;
-  }
-
-  public static int zstr(string s) {
-    int ret = freeswitchPINVOKE.zstr(s);
-    return ret;
-  }
-
-  public static switch_bool_t switch_is_moh(string s) {
-    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_is_moh(s);
-    return ret;
-  }
-
-  public static int switch_string_has_escaped_data(string arg0) {
-    int ret = freeswitchPINVOKE.switch_string_has_escaped_data(arg0);
-    return ret;
-  }
-
-  public static switch_status_t switch_b64_encode(SWIGTYPE_p_unsigned_char arg0, SWIGTYPE_p_switch_size_t ilen, SWIGTYPE_p_unsigned_char arg2, SWIGTYPE_p_switch_size_t olen) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_b64_encode(SWIGTYPE_p_unsigned_char.getCPtr(arg0), SWIGTYPE_p_switch_size_t.getCPtr(ilen), SWIGTYPE_p_unsigned_char.getCPtr(arg2), SWIGTYPE_p_switch_size_t.getCPtr(olen));
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_size_t switch_b64_decode(string arg0, string arg1, SWIGTYPE_p_switch_size_t olen) {
-    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_b64_decode(arg0, arg1, SWIGTYPE_p_switch_size_t.getCPtr(olen)), true);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static string switch_amp_encode(string s, string buf, SWIGTYPE_p_switch_size_t len) {
-    string ret = freeswitchPINVOKE.switch_amp_encode(s, buf, SWIGTYPE_p_switch_size_t.getCPtr(len));
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static switch_bool_t switch_is_digit_string(string s) {
-    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_is_digit_string(s);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_size_t switch_fd_read_line(int fd, string buf, SWIGTYPE_p_switch_size_t len) {
-    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_fd_read_line(fd, buf, SWIGTYPE_p_switch_size_t.getCPtr(len)), true);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static switch_status_t switch_frame_alloc(SWIGTYPE_p_p_switch_frame frame, SWIGTYPE_p_switch_size_t size) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_frame_alloc(SWIGTYPE_p_p_switch_frame.getCPtr(frame), SWIGTYPE_p_switch_size_t.getCPtr(size));
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static switch_status_t switch_frame_dup(switch_frame orig, SWIGTYPE_p_p_switch_frame clone) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_frame_dup(switch_frame.getCPtr(orig), SWIGTYPE_p_p_switch_frame.getCPtr(clone));
-    return ret;
-  }
-
-  public static switch_status_t switch_frame_free(SWIGTYPE_p_p_switch_frame frame) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_frame_free(SWIGTYPE_p_p_switch_frame.getCPtr(frame));
-    return ret;
-  }
-
-  public static switch_status_t switch_resolve_host(string host, string buf, uint buflen) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_resolve_host(host, buf, buflen);
-    return ret;
-  }
-
-  public static switch_status_t switch_find_local_ip(string buf, int len, SWIGTYPE_p_int mask, int family) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_find_local_ip(buf, len, SWIGTYPE_p_int.getCPtr(mask), family);
-    return ret;
-  }
-
-  public static string get_addr(string buf, SWIGTYPE_p_switch_size_t len, SWIGTYPE_p_sockaddr sa, SWIGTYPE_p_socklen_t salen) {
-    string ret = freeswitchPINVOKE.get_addr(buf, SWIGTYPE_p_switch_size_t.getCPtr(len), SWIGTYPE_p_sockaddr.getCPtr(sa), SWIGTYPE_p_socklen_t.getCPtr(salen));
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static int get_addr_int(SWIGTYPE_p_switch_sockaddr_t sa) {
-    int ret = freeswitchPINVOKE.get_addr_int(SWIGTYPE_p_switch_sockaddr_t.getCPtr(sa));
-    return ret;
-  }
-
-  public static int switch_cmp_addr(SWIGTYPE_p_switch_sockaddr_t sa1, SWIGTYPE_p_switch_sockaddr_t sa2) {
-    int ret = freeswitchPINVOKE.switch_cmp_addr(SWIGTYPE_p_switch_sockaddr_t.getCPtr(sa1), SWIGTYPE_p_switch_sockaddr_t.getCPtr(sa2));
-    return ret;
-  }
-
-  public static ushort get_port(SWIGTYPE_p_sockaddr sa) {
-    ushort ret = freeswitchPINVOKE.get_port(SWIGTYPE_p_sockaddr.getCPtr(sa));
-    return ret;
-  }
-
-  public static int switch_build_uri(string uri, SWIGTYPE_p_switch_size_t size, string scheme, string user, SWIGTYPE_p_switch_sockaddr_t sa, int flags) {
-    int ret = freeswitchPINVOKE.switch_build_uri(uri, SWIGTYPE_p_switch_size_t.getCPtr(size), scheme, user, SWIGTYPE_p_switch_sockaddr_t.getCPtr(sa), flags);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static string switch_priority_name(switch_priority_t priority) {
-    string ret = freeswitchPINVOKE.switch_priority_name((int)priority);
-    return ret;
-  }
-
-  public static char switch_rfc2833_to_char(int arg0) {
-    char ret = freeswitchPINVOKE.switch_rfc2833_to_char(arg0);
-    return ret;
-  }
-
-  public static byte switch_char_to_rfc2833(char key) {
-    byte ret = freeswitchPINVOKE.switch_char_to_rfc2833(key);
-    return ret;
-  }
-
-  public static string switch_sanitize_number(string number) {
-    string ret = freeswitchPINVOKE.switch_sanitize_number(number);
-    return ret;
-  }
-
-  public static switch_bool_t switch_string_var_check(string s, switch_bool_t disable) {
-    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_string_var_check(s, (int)disable);
-    return ret;
-  }
-
-  public static switch_bool_t switch_string_var_check_const(string s) {
-    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_string_var_check_const(s);
-    return ret;
-  }
-
-  public static string switch_var_clean_string(string s) {
-    string ret = freeswitchPINVOKE.switch_var_clean_string(s);
-    return ret;
-  }
-
-  public static string switch_clean_string(string s) {
-    string ret = freeswitchPINVOKE.switch_clean_string(s);
-    return ret;
-  }
-
-  public static string switch_safe_strdup(string it) {
-    string ret = freeswitchPINVOKE.switch_safe_strdup(it);
-    return ret;
-  }
-
-  public static string switch_lc_strdup(string it) {
-    string ret = freeswitchPINVOKE.switch_lc_strdup(it);
-    return ret;
-  }
-
-  public static string switch_uc_strdup(string it) {
-    string ret = freeswitchPINVOKE.switch_uc_strdup(it);
-    return ret;
-  }
-
-  public static switch_bool_t switch_strstr(string s, string q) {
-    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_strstr(s, q);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_time_t switch_str_time(string arg0) {
-    SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_str_time(arg0), true);
-    return ret;
-  }
-
-  public static uint switch_separate_string(string buf, char delim, ref string array, uint arraylen) {
-    uint ret = freeswitchPINVOKE.switch_separate_string(buf, delim, ref array, arraylen);
-    return ret;
-  }
-
-  public static uint switch_separate_string_string(string buf, string delim, ref string array, uint arraylen) {
-    uint ret = freeswitchPINVOKE.switch_separate_string_string(buf, delim, ref array, arraylen);
-    return ret;
-  }
-
-  public static switch_bool_t switch_is_number(string str) {
-    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_is_number(str);
-    return ret;
-  }
-
-  public static string switch_strip_spaces(string str) {
-    string ret = freeswitchPINVOKE.switch_strip_spaces(str);
-    return ret;
-  }
-
-  public static string switch_separate_paren_args(string str) {
-    string ret = freeswitchPINVOKE.switch_separate_paren_args(str);
-    return ret;
-  }
-
-  public static string switch_stristr(string instr, string str) {
-    string ret = freeswitchPINVOKE.switch_stristr(instr, str);
-    return ret;
-  }
-
-  public static switch_bool_t switch_is_lan_addr(string ip) {
-    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_is_lan_addr(ip);
-    return ret;
-  }
-
-  public static string switch_replace_char(string str, char from, char to, switch_bool_t dup) {
-    string ret = freeswitchPINVOKE.switch_replace_char(str, from, to, (int)dup);
-    return ret;
-  }
-
-  public static switch_bool_t switch_ast2regex(string pat, string rbuf, uint len) {
-    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_ast2regex(pat, rbuf, len);
-    return ret;
-  }
-
-  public static string switch_escape_char(SWIGTYPE_p_apr_pool_t pool, string arg1, string delim, char esc) {
-    string ret = freeswitchPINVOKE.switch_escape_char(SWIGTYPE_p_apr_pool_t.getCPtr(pool), arg1, delim, esc);
-    return ret;
-  }
-
-  public static int switch_socket_waitfor(SWIGTYPE_p_switch_pollfd_t poll, int ms) {
-    int ret = freeswitchPINVOKE.switch_socket_waitfor(SWIGTYPE_p_switch_pollfd_t.getCPtr(poll), ms);
-    return ret;
-  }
-
-  public static string switch_cut_path(string arg0) {
-    string ret = freeswitchPINVOKE.switch_cut_path(arg0);
-    return ret;
-  }
-
-  public static string switch_string_replace(string arg0, string search, string replace) {
-    string ret = freeswitchPINVOKE.switch_string_replace(arg0, search, replace);
-    return ret;
-  }
-
-  public static switch_status_t switch_string_match(string arg0, uint string_len, string search, uint search_len) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_string_match(arg0, string_len, search, search_len);
-    return ret;
-  }
-
-  public static string switch_util_quote_shell_arg(string arg0) {
-    string ret = freeswitchPINVOKE.switch_util_quote_shell_arg(arg0);
-    return ret;
-  }
-
-  public static uint switch_url_encode(string url, string buf, uint len) {
-    uint ret = freeswitchPINVOKE.switch_url_encode(url, buf, len);
-    return ret;
-  }
-
-  public static string switch_url_decode(string s) {
-    string ret = freeswitchPINVOKE.switch_url_decode(s);
-    return ret;
-  }
-
-  public static switch_bool_t switch_simple_email(string to, string from, string headers, string body, string file, string convert_cmd, string convert_ext) {
-    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_simple_email(to, from, headers, body, file, convert_cmd, convert_ext);
-    return ret;
-  }
-
-  public static string switch_find_end_paren(string s, char open, char close) {
-    string ret = freeswitchPINVOKE.switch_find_end_paren(s, open, close);
-    return ret;
-  }
-
-  public static switch_bool_t switch_is_file_path(string file) {
-    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_is_file_path(file);
-    return ret;
-  }
-
-  public static int switch_parse_cidr(string arg0, SWIGTYPE_p_unsigned_long ip, SWIGTYPE_p_unsigned_long mask, SWIGTYPE_p_unsigned_long bitp) {
-    int ret = freeswitchPINVOKE.switch_parse_cidr(arg0, SWIGTYPE_p_unsigned_long.getCPtr(ip), SWIGTYPE_p_unsigned_long.getCPtr(mask), SWIGTYPE_p_unsigned_long.getCPtr(bitp));
-    return ret;
-  }
-
-  public static switch_status_t switch_network_list_create(SWIGTYPE_p_p_switch_network_list list, string name, switch_bool_t default_type, SWIGTYPE_p_apr_pool_t pool) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_network_list_create(SWIGTYPE_p_p_switch_network_list.getCPtr(list), name, (int)default_type, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
-    return ret;
-  }
-
-  public static switch_status_t switch_network_list_add_cidr_token(SWIGTYPE_p_switch_network_list list, string cidr_str, switch_bool_t ok, string token) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_network_list_add_cidr_token(SWIGTYPE_p_switch_network_list.getCPtr(list), cidr_str, (int)ok, token);
-    return ret;
-  }
-
-  public static switch_status_t switch_network_list_add_host_mask(SWIGTYPE_p_switch_network_list list, string host, string mask_str, switch_bool_t ok) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_network_list_add_host_mask(SWIGTYPE_p_switch_network_list.getCPtr(list), host, mask_str, (int)ok);
-    return ret;
-  }
-
-  public static switch_bool_t switch_network_list_validate_ip_token(SWIGTYPE_p_switch_network_list list, uint ip, ref string token) {
-    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_network_list_validate_ip_token(SWIGTYPE_p_switch_network_list.getCPtr(list), ip, ref token);
-    return ret;
-  }
-
-  public static int switch_number_cmp(string exp, int val) {
-    int ret = freeswitchPINVOKE.switch_number_cmp(exp, val);
-    return ret;
-  }
-
-  public static switch_caller_extension switch_caller_extension_new(SWIGTYPE_p_switch_core_session session, string extension_name, string extension_number) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_caller_extension_new(SWIGTYPE_p_switch_core_session.getCPtr(session), extension_name, extension_number);
-    switch_caller_extension ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_extension(cPtr, false);
-    return ret;
-  }
-
-  public static switch_status_t switch_caller_extension_clone(SWIGTYPE_p_p_switch_caller_extension new_ext, switch_caller_extension orig, SWIGTYPE_p_apr_pool_t pool) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_caller_extension_clone(SWIGTYPE_p_p_switch_caller_extension.getCPtr(new_ext), switch_caller_extension.getCPtr(orig), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
-    return ret;
-  }
-
-  public static void switch_caller_extension_add_application(SWIGTYPE_p_switch_core_session session, switch_caller_extension caller_extension, string application_name, string extra_data) {
-    freeswitchPINVOKE.switch_caller_extension_add_application(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_caller_extension.getCPtr(caller_extension), application_name, extra_data);
-  }
-
-  public static void switch_caller_extension_add_application_printf(SWIGTYPE_p_switch_core_session session, switch_caller_extension caller_extension, string application_name, string fmt) {
-    freeswitchPINVOKE.switch_caller_extension_add_application_printf(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_caller_extension.getCPtr(caller_extension), application_name, fmt);
-  }
-
-  public static string switch_caller_get_field_by_name(switch_caller_profile caller_profile, string name) {
-    string ret = freeswitchPINVOKE.switch_caller_get_field_by_name(switch_caller_profile.getCPtr(caller_profile), name);
-    return ret;
-  }
-
-  public static switch_caller_profile switch_caller_profile_new(SWIGTYPE_p_apr_pool_t pool, string username, string dialplan, string caller_id_name, string caller_id_number, string network_addr, string ani, string aniii, string rdnis, string source, string context, string destination_number) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_new(SWIGTYPE_p_apr_pool_t.getCPtr(pool), username, dialplan, caller_id_name, caller_id_number, network_addr, ani, aniii, rdnis, source, context, destination_number);
-    switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
-    return ret;
-  }
-
-  public static switch_caller_profile switch_caller_profile_clone(SWIGTYPE_p_switch_core_session session, switch_caller_profile tocopy) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_clone(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_caller_profile.getCPtr(tocopy));
-    switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
-    return ret;
-  }
-
-  public static switch_caller_profile switch_caller_profile_dup(SWIGTYPE_p_apr_pool_t pool, switch_caller_profile tocopy) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_dup(SWIGTYPE_p_apr_pool_t.getCPtr(pool), switch_caller_profile.getCPtr(tocopy));
-    switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
-    return ret;
-  }
-
-  public static void switch_caller_profile_event_set_data(switch_caller_profile caller_profile, string prefix, switch_event arg2) {
-    freeswitchPINVOKE.switch_caller_profile_event_set_data(switch_caller_profile.getCPtr(caller_profile), prefix, switch_event.getCPtr(arg2));
-  }
-
-  public static switch_channel_state_t switch_channel_get_state(SWIGTYPE_p_switch_channel channel) {
-    switch_channel_state_t ret = (switch_channel_state_t)freeswitchPINVOKE.switch_channel_get_state(SWIGTYPE_p_switch_channel.getCPtr(channel));
-    return ret;
-  }
-
-  public static switch_channel_state_t switch_channel_get_running_state(SWIGTYPE_p_switch_channel channel) {
-    switch_channel_state_t ret = (switch_channel_state_t)freeswitchPINVOKE.switch_channel_get_running_state(SWIGTYPE_p_switch_channel.getCPtr(channel));
-    return ret;
-  }
-
-  public static int switch_channel_test_ready(SWIGTYPE_p_switch_channel channel, switch_bool_t media) {
-    int ret = freeswitchPINVOKE.switch_channel_test_ready(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)media);
-    return ret;
-  }
-
-  public static void switch_channel_wait_for_state(SWIGTYPE_p_switch_channel channel, SWIGTYPE_p_switch_channel other_channel, switch_channel_state_t want_state) {
-    freeswitchPINVOKE.switch_channel_wait_for_state(SWIGTYPE_p_switch_channel.getCPtr(channel), SWIGTYPE_p_switch_channel.getCPtr(other_channel), (int)want_state);
-  }
-
-  public static void switch_channel_wait_for_state_timeout(SWIGTYPE_p_switch_channel other_channel, switch_channel_state_t want_state, uint timeout) {
-    freeswitchPINVOKE.switch_channel_wait_for_state_timeout(SWIGTYPE_p_switch_channel.getCPtr(other_channel), (int)want_state, timeout);
-  }
-
-  public static switch_status_t switch_channel_wait_for_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t want_flag, switch_bool_t pres, uint to, SWIGTYPE_p_switch_channel super_channel) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_wait_for_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)want_flag, (int)pres, to, SWIGTYPE_p_switch_channel.getCPtr(super_channel));
-    return ret;
-  }
-
-  public static switch_channel_state_t switch_channel_perform_set_state(SWIGTYPE_p_switch_channel channel, string file, string func, int line, switch_channel_state_t state) {
-    switch_channel_state_t ret = (switch_channel_state_t)freeswitchPINVOKE.switch_channel_perform_set_state(SWIGTYPE_p_switch_channel.getCPtr(channel), file, func, line, (int)state);
-    return ret;
-  }
-
-  public static switch_channel_state_t switch_channel_perform_set_running_state(SWIGTYPE_p_switch_channel channel, switch_channel_state_t state, string file, string func, int line) {
-    switch_channel_state_t ret = (switch_channel_state_t)freeswitchPINVOKE.switch_channel_perform_set_running_state(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)state, file, func, line);
-    return ret;
-  }
-
-  public static switch_call_cause_t switch_channel_str2cause(string str) {
-    switch_call_cause_t ret = (switch_call_cause_t)freeswitchPINVOKE.switch_channel_str2cause(str);
-    return ret;
-  }
-
-  public static switch_call_cause_t switch_channel_get_cause(SWIGTYPE_p_switch_channel channel) {
-    switch_call_cause_t ret = (switch_call_cause_t)freeswitchPINVOKE.switch_channel_get_cause(SWIGTYPE_p_switch_channel.getCPtr(channel));
-    return ret;
-  }
-
-  public static switch_call_cause_t switch_channel_cause_q850(switch_call_cause_t cause) {
-    switch_call_cause_t ret = (switch_call_cause_t)freeswitchPINVOKE.switch_channel_cause_q850((int)cause);
-    return ret;
-  }
-
-  public static switch_call_cause_t switch_channel_get_cause_q850(SWIGTYPE_p_switch_channel channel) {
-    switch_call_cause_t ret = (switch_call_cause_t)freeswitchPINVOKE.switch_channel_get_cause_q850(SWIGTYPE_p_switch_channel.getCPtr(channel));
-    return ret;
-  }
-
-  public static string switch_channel_cause2str(switch_call_cause_t cause) {
-    string ret = freeswitchPINVOKE.switch_channel_cause2str((int)cause);
-    return ret;
-  }
-
-  public static switch_channel_timetable switch_channel_get_timetable(SWIGTYPE_p_switch_channel channel) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_timetable(SWIGTYPE_p_switch_channel.getCPtr(channel));
-    switch_channel_timetable ret = (cPtr == IntPtr.Zero) ? null : new switch_channel_timetable(cPtr, false);
-    return ret;
-  }
-
-  public static switch_status_t switch_channel_alloc(SWIGTYPE_p_p_switch_channel channel, switch_call_direction_t direction, SWIGTYPE_p_apr_pool_t pool) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_alloc(SWIGTYPE_p_p_switch_channel.getCPtr(channel), (int)direction, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
-    return ret;
-  }
-
-  public static switch_status_t switch_channel_init(SWIGTYPE_p_switch_channel channel, SWIGTYPE_p_switch_core_session session, switch_channel_state_t state, switch_channel_flag_t flag) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_init(SWIGTYPE_p_switch_channel.getCPtr(channel), SWIGTYPE_p_switch_core_session.getCPtr(session), (int)state, (int)flag);
-    return ret;
-  }
-
-  public static void switch_channel_presence(SWIGTYPE_p_switch_channel channel, string rpid, string status, string id) {
-    freeswitchPINVOKE.switch_channel_presence(SWIGTYPE_p_switch_channel.getCPtr(channel), rpid, status, id);
-  }
-
-  public static void switch_channel_uninit(SWIGTYPE_p_switch_channel channel) {
-    freeswitchPINVOKE.switch_channel_uninit(SWIGTYPE_p_switch_channel.getCPtr(channel));
-  }
-
-  public static void switch_channel_set_caller_profile(SWIGTYPE_p_switch_channel channel, switch_caller_profile caller_profile) {
-    freeswitchPINVOKE.switch_channel_set_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_profile.getCPtr(caller_profile));
-  }
-
-  public static switch_caller_profile switch_channel_get_caller_profile(SWIGTYPE_p_switch_channel channel) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel));
-    switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
-    return ret;
-  }
-
-  public static void switch_channel_set_originator_caller_profile(SWIGTYPE_p_switch_channel channel, switch_caller_profile caller_profile) {
-    freeswitchPINVOKE.switch_channel_set_originator_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_profile.getCPtr(caller_profile));
-  }
-
-  public static void switch_channel_set_hunt_caller_profile(SWIGTYPE_p_switch_channel channel, switch_caller_profile caller_profile) {
-    freeswitchPINVOKE.switch_channel_set_hunt_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_profile.getCPtr(caller_profile));
-  }
-
-  public static switch_caller_profile switch_channel_get_originator_caller_profile(SWIGTYPE_p_switch_channel channel) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_originator_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel));
-    switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
-    return ret;
-  }
-
-  public static void switch_channel_set_originatee_caller_profile(SWIGTYPE_p_switch_channel channel, switch_caller_profile caller_profile) {
-    freeswitchPINVOKE.switch_channel_set_originatee_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_profile.getCPtr(caller_profile));
-  }
-
-  public static switch_caller_profile switch_channel_get_originatee_caller_profile(SWIGTYPE_p_switch_channel channel) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_originatee_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel));
-    switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
-    return ret;
-  }
-
-  public static string switch_channel_get_uuid(SWIGTYPE_p_switch_channel channel) {
-    string ret = freeswitchPINVOKE.switch_channel_get_uuid(SWIGTYPE_p_switch_channel.getCPtr(channel));
-    return ret;
-  }
-
-  public static switch_status_t switch_channel_set_profile_var(SWIGTYPE_p_switch_channel channel, string name, string val) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_set_profile_var(SWIGTYPE_p_switch_channel.getCPtr(channel), name, val);
-    return ret;
-  }
-
-  public static switch_status_t switch_channel_set_variable_var_check(SWIGTYPE_p_switch_channel channel, string varname, string value, switch_bool_t var_check) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_set_variable_var_check(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, value, (int)var_check);
-    return ret;
-  }
-
-  public static switch_status_t switch_channel_set_variable_printf(SWIGTYPE_p_switch_channel channel, string varname, string fmt) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_set_variable_printf(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, fmt);
-    return ret;
-  }
-
-  public static switch_status_t switch_channel_set_variable_partner_var_check(SWIGTYPE_p_switch_channel channel, string varname, string value, switch_bool_t var_check) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_set_variable_partner_var_check(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, value, (int)var_check);
-    return ret;
-  }
-
-  public static string switch_channel_get_variable_partner(SWIGTYPE_p_switch_channel channel, string varname) {
-    string ret = freeswitchPINVOKE.switch_channel_get_variable_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), varname);
-    return ret;
-  }
-
-  public static string switch_channel_get_variable(SWIGTYPE_p_switch_channel channel, string varname) {
-    string ret = freeswitchPINVOKE.switch_channel_get_variable(SWIGTYPE_p_switch_channel.getCPtr(channel), varname);
-    return ret;
-  }
-
-  public static switch_status_t switch_channel_get_variables(SWIGTYPE_p_switch_channel channel, SWIGTYPE_p_p_switch_event arg1) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_get_variables(SWIGTYPE_p_switch_channel.getCPtr(channel), SWIGTYPE_p_p_switch_event.getCPtr(arg1));
-    return ret;
-  }
-
-  public static switch_status_t switch_channel_pass_callee_id(SWIGTYPE_p_switch_channel channel, SWIGTYPE_p_switch_channel other_channel) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_pass_callee_id(SWIGTYPE_p_switch_channel.getCPtr(channel), SWIGTYPE_p_switch_channel.getCPtr(other_channel));
-    return ret;
-  }
-
-  public static switch_event_header switch_channel_variable_first(SWIGTYPE_p_switch_channel channel) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_channel_variable_first(SWIGTYPE_p_switch_channel.getCPtr(channel));
-    switch_event_header ret = (cPtr == IntPtr.Zero) ? null : new switch_event_header(cPtr, false);
-    return ret;
-  }
-
-  public static void switch_channel_variable_last(SWIGTYPE_p_switch_channel channel) {
-    freeswitchPINVOKE.switch_channel_variable_last(SWIGTYPE_p_switch_channel.getCPtr(channel));
-  }
-
-  public static void switch_channel_restart(SWIGTYPE_p_switch_channel channel) {
-    freeswitchPINVOKE.switch_channel_restart(SWIGTYPE_p_switch_channel.getCPtr(channel));
-  }
-
-  public static switch_status_t switch_channel_caller_extension_masquerade(SWIGTYPE_p_switch_channel orig_channel, SWIGTYPE_p_switch_channel new_channel, uint offset) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_caller_extension_masquerade(SWIGTYPE_p_switch_channel.getCPtr(orig_channel), SWIGTYPE_p_switch_channel.getCPtr(new_channel), offset);
-    return ret;
-  }
-
-  public static void switch_channel_set_caller_extension(SWIGTYPE_p_switch_channel channel, switch_caller_extension caller_extension) {
-    freeswitchPINVOKE.switch_channel_set_caller_extension(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_extension.getCPtr(caller_extension));
-  }
-
-  public static switch_caller_extension switch_channel_get_caller_extension(SWIGTYPE_p_switch_channel channel) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_caller_extension(SWIGTYPE_p_switch_channel.getCPtr(channel));
-    switch_caller_extension ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_extension(cPtr, false);
-    return ret;
-  }
-
-  public static uint switch_channel_test_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
-    uint ret = freeswitchPINVOKE.switch_channel_test_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
-    return ret;
-  }
-
-  public static void switch_channel_set_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
-    freeswitchPINVOKE.switch_channel_set_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
-  }
-
-  public static void switch_channel_set_flag_recursive(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
-    freeswitchPINVOKE.switch_channel_set_flag_recursive(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
-  }
-
-  public static void switch_channel_set_cap(SWIGTYPE_p_switch_channel channel, switch_channel_cap_t cap) {
-    freeswitchPINVOKE.switch_channel_set_cap(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)cap);
-  }
-
-  public static void switch_channel_clear_cap(SWIGTYPE_p_switch_channel channel, switch_channel_cap_t cap) {
-    freeswitchPINVOKE.switch_channel_clear_cap(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)cap);
-  }
-
-  public static uint switch_channel_test_cap(SWIGTYPE_p_switch_channel channel, switch_channel_cap_t cap) {
-    uint ret = freeswitchPINVOKE.switch_channel_test_cap(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)cap);
-    return ret;
-  }
-
-  public static switch_bool_t switch_channel_set_flag_partner(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
-    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_channel_set_flag_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
-    return ret;
-  }
-
-  public static switch_bool_t switch_channel_clear_flag_partner(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
-    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_channel_clear_flag_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
-    return ret;
-  }
-
-  public static uint switch_channel_test_flag_partner(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
-    uint ret = freeswitchPINVOKE.switch_channel_test_flag_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
-    return ret;
-  }
-
-  public static void switch_channel_set_state_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
-    freeswitchPINVOKE.switch_channel_set_state_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
-  }
-
-  public static void switch_channel_clear_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
-    freeswitchPINVOKE.switch_channel_clear_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
-  }
-
-  public static void switch_channel_clear_flag_recursive(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
-    freeswitchPINVOKE.switch_channel_clear_flag_recursive(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
-  }
-
-  public static switch_status_t switch_channel_perform_answer(SWIGTYPE_p_switch_channel channel, string file, string func, int line) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_perform_answer(SWIGTYPE_p_switch_channel.getCPtr(channel), file, func, line);
-    return ret;
-  }
-
-  public static switch_status_t switch_channel_perform_mark_answered(SWIGTYPE_p_switch_channel channel, string file, string func, int line) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_perform_mark_answered(SWIGTYPE_p_switch_channel.getCPtr(channel), file, func, line);
-    return ret;
-  }
-
-  public static switch_status_t switch_channel_perform_ring_ready(SWIGTYPE_p_switch_channel channel, string file, string func, int line) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_perform_ring_ready(SWIGTYPE_p_switch_channel.getCPtr(channel), file, func, line);
-    return ret;
-  }
-
-  public static switch_status_t switch_channel_perform_pre_answer(SWIGTYPE_p_switch_channel channel, string file, string func, int line) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_perform_pre_answer(SWIGTYPE_p_switch_channel.getCPtr(channel), file, func, line);
-    return ret;
-  }
-
-  public static switch_status_t switch_channel_perform_mark_pre_answered(SWIGTYPE_p_switch_channel channel, string file, string func, int line) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_perform_mark_pre_answered(SWIGTYPE_p_switch_channel.getCPtr(channel), file, func, line);
-    return ret;
-  }
-
-  public static switch_status_t switch_channel_perform_mark_ring_ready(SWIGTYPE_p_switch_channel channel, string file, string func, int line) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_perform_mark_ring_ready(SWIGTYPE_p_switch_channel.getCPtr(channel), file, func, line);
-    return ret;
-  }
-
-  public static int switch_channel_add_state_handler(SWIGTYPE_p_switch_channel channel, switch_state_handler_table state_handler) {
-    int ret = freeswitchPINVOKE.switch_channel_add_state_handler(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_state_handler_table.getCPtr(state_handler));
-    return ret;
-  }
-
-  public static void switch_channel_clear_state_handler(SWIGTYPE_p_switch_channel channel, switch_state_handler_table state_handler) {
-    freeswitchPINVOKE.switch_channel_clear_state_handler(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_state_handler_table.getCPtr(state_handler));
-  }
-
-  public static switch_state_handler_table switch_channel_get_state_handler(SWIGTYPE_p_switch_channel channel, int index) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_state_handler(SWIGTYPE_p_switch_channel.getCPtr(channel), index);
-    switch_state_handler_table ret = (cPtr == IntPtr.Zero) ? null : new switch_state_handler_table(cPtr, false);
-    return ret;
-  }
-
-  public static switch_status_t switch_channel_set_private(SWIGTYPE_p_switch_channel channel, string key, SWIGTYPE_p_void private_info) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_set_private(SWIGTYPE_p_switch_channel.getCPtr(channel), key, SWIGTYPE_p_void.getCPtr(private_info));
-    return ret;
-  }
-
-  public static SWIGTYPE_p_void switch_channel_get_private(SWIGTYPE_p_switch_channel channel, string key) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_private(SWIGTYPE_p_switch_channel.getCPtr(channel), key);
-    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-    return ret;
-  }
-
-  public static switch_status_t switch_channel_set_name(SWIGTYPE_p_switch_channel channel, string name) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_set_name(SWIGTYPE_p_switch_channel.getCPtr(channel), name);
-    return ret;
-  }
-
-  public static string switch_channel_get_name(SWIGTYPE_p_switch_channel channel) {
-    string ret = freeswitchPINVOKE.switch_channel_get_name(SWIGTYPE_p_switch_channel.getCPtr(channel));
-    return ret;
-  }
-
-  public static switch_channel_state_t switch_channel_perform_hangup(SWIGTYPE_p_switch_channel channel, string file, string func, int line, switch_call_cause_t hangup_cause) {
-    switch_channel_state_t ret = (switch_channel_state_t)freeswitchPINVOKE.switch_channel_perform_hangup(SWIGTYPE_p_switch_channel.getCPtr(channel), file, func, line, (int)hangup_cause);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_size_t switch_channel_has_dtmf(SWIGTYPE_p_switch_channel channel) {
-    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_channel_has_dtmf(SWIGTYPE_p_switch_channel.getCPtr(channel)), true);
-    return ret;
-  }
-
-  public static switch_status_t switch_channel_queue_dtmf(SWIGTYPE_p_switch_channel channel, switch_dtmf_t dtmf) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_queue_dtmf(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_dtmf_t.getCPtr(dtmf));
-    return ret;
-  }
-
-  public static switch_status_t switch_channel_queue_dtmf_string(SWIGTYPE_p_switch_channel channel, string dtmf_string) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_queue_dtmf_string(SWIGTYPE_p_switch_channel.getCPtr(channel), dtmf_string);
-    return ret;
-  }
-
-  public static switch_status_t switch_channel_dequeue_dtmf(SWIGTYPE_p_switch_channel channel, switch_dtmf_t dtmf) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_dequeue_dtmf(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_dtmf_t.getCPtr(dtmf));
-    return ret;
-  }
-
-  public static void switch_channel_flush_dtmf(SWIGTYPE_p_switch_channel channel) {
-    freeswitchPINVOKE.switch_channel_flush_dtmf(SWIGTYPE_p_switch_channel.getCPtr(channel));
-  }
-
-  public static SWIGTYPE_p_switch_size_t switch_channel_dequeue_dtmf_string(SWIGTYPE_p_switch_channel channel, string dtmf_str, SWIGTYPE_p_switch_size_t len) {
-    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_channel_dequeue_dtmf_string(SWIGTYPE_p_switch_channel.getCPtr(channel), dtmf_str, SWIGTYPE_p_switch_size_t.getCPtr(len)), true);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static string switch_channel_state_name(switch_channel_state_t state) {
-    string ret = freeswitchPINVOKE.switch_channel_state_name((int)state);
-    return ret;
-  }
-
-  public static switch_channel_state_t switch_channel_name_state(string name) {
-    switch_channel_state_t ret = (switch_channel_state_t)freeswitchPINVOKE.switch_channel_name_state(name);
-    return ret;
-  }
-
-  public static void switch_channel_event_set_data(SWIGTYPE_p_switch_channel channel, switch_event arg1) {
-    freeswitchPINVOKE.switch_channel_event_set_data(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_event.getCPtr(arg1));
-  }
-
-  public static void switch_channel_event_set_basic_data(SWIGTYPE_p_switch_channel channel, switch_event arg1) {
-    freeswitchPINVOKE.switch_channel_event_set_basic_data(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_event.getCPtr(arg1));
-  }
-
-  public static void switch_channel_event_set_extended_data(SWIGTYPE_p_switch_channel channel, switch_event arg1) {
-    freeswitchPINVOKE.switch_channel_event_set_extended_data(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_event.getCPtr(arg1));
-  }
-
-  public static string switch_channel_expand_variables(SWIGTYPE_p_switch_channel channel, string arg1) {
-    string ret = freeswitchPINVOKE.switch_channel_expand_variables(SWIGTYPE_p_switch_channel.getCPtr(channel), arg1);
-    return ret;
-  }
-
-  public static string switch_channel_build_param_string(SWIGTYPE_p_switch_channel channel, switch_caller_profile caller_profile, string prefix) {
-    string ret = freeswitchPINVOKE.switch_channel_build_param_string(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_profile.getCPtr(caller_profile), prefix);
-    return ret;
-  }
-
-  public static switch_status_t switch_channel_set_timestamps(SWIGTYPE_p_switch_channel channel) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_set_timestamps(SWIGTYPE_p_switch_channel.getCPtr(channel));
-    return ret;
-  }
-
-  public static void switch_channel_audio_sync(SWIGTYPE_p_switch_channel channel) {
-    freeswitchPINVOKE.switch_channel_audio_sync(SWIGTYPE_p_switch_channel.getCPtr(channel));
-  }
-
-  public static void switch_channel_set_private_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
-    freeswitchPINVOKE.switch_channel_set_private_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
-  }
-
-  public static void switch_channel_clear_private_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
-    freeswitchPINVOKE.switch_channel_clear_private_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
-  }
-
-  public static int switch_channel_test_private_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
-    int ret = freeswitchPINVOKE.switch_channel_test_private_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
-    return ret;
-  }
-
-  public static void switch_channel_set_app_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
-    freeswitchPINVOKE.switch_channel_set_app_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
-  }
-
-  public static void switch_channel_clear_app_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
-    freeswitchPINVOKE.switch_channel_clear_app_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
-  }
-
-  public static int switch_channel_test_app_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
-    int ret = freeswitchPINVOKE.switch_channel_test_app_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
-    return ret;
-  }
-
-  public static void switch_channel_set_hangup_time(SWIGTYPE_p_switch_channel channel) {
-    freeswitchPINVOKE.switch_channel_set_hangup_time(SWIGTYPE_p_switch_channel.getCPtr(channel));
-  }
-
-  public static switch_call_direction_t switch_channel_direction(SWIGTYPE_p_switch_channel channel) {
-    switch_call_direction_t ret = (switch_call_direction_t)freeswitchPINVOKE.switch_channel_direction(SWIGTYPE_p_switch_channel.getCPtr(channel));
-    return ret;
-  }
-
-  public static switch_status_t switch_buffer_create(SWIGTYPE_p_apr_pool_t pool, SWIGTYPE_p_p_switch_buffer buffer, SWIGTYPE_p_switch_size_t max_len) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_buffer_create(SWIGTYPE_p_apr_pool_t.getCPtr(pool), SWIGTYPE_p_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_switch_size_t.getCPtr(max_len));
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static switch_status_t switch_buffer_create_dynamic(SWIGTYPE_p_p_switch_buffer buffer, SWIGTYPE_p_switch_size_t blocksize, SWIGTYPE_p_switch_size_t start_len, SWIGTYPE_p_switch_size_t max_len) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_buffer_create_dynamic(SWIGTYPE_p_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_switch_size_t.getCPtr(blocksize), SWIGTYPE_p_switch_size_t.getCPtr(start_len), SWIGTYPE_p_switch_size_t.getCPtr(max_len));
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static void switch_buffer_add_mutex(SWIGTYPE_p_switch_buffer buffer, SWIGTYPE_p_switch_mutex_t mutex) {
-    freeswitchPINVOKE.switch_buffer_add_mutex(SWIGTYPE_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_switch_mutex_t.getCPtr(mutex));
-  }
-
-  public static void switch_buffer_lock(SWIGTYPE_p_switch_buffer buffer) {
-    freeswitchPINVOKE.switch_buffer_lock(SWIGTYPE_p_switch_buffer.getCPtr(buffer));
-  }
-
-  public static switch_status_t switch_buffer_trylock(SWIGTYPE_p_switch_buffer buffer) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_buffer_trylock(SWIGTYPE_p_switch_buffer.getCPtr(buffer));
-    return ret;
-  }
-
-  public static void switch_buffer_unlock(SWIGTYPE_p_switch_buffer buffer) {
-    freeswitchPINVOKE.switch_buffer_unlock(SWIGTYPE_p_switch_buffer.getCPtr(buffer));
-  }
-
-  public static SWIGTYPE_p_switch_size_t switch_buffer_len(SWIGTYPE_p_switch_buffer buffer) {
-    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_buffer_len(SWIGTYPE_p_switch_buffer.getCPtr(buffer)), true);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_size_t switch_buffer_freespace(SWIGTYPE_p_switch_buffer buffer) {
-    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_buffer_freespace(SWIGTYPE_p_switch_buffer.getCPtr(buffer)), true);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_size_t switch_buffer_inuse(SWIGTYPE_p_switch_buffer buffer) {
-    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_buffer_inuse(SWIGTYPE_p_switch_buffer.getCPtr(buffer)), true);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_size_t switch_buffer_read(SWIGTYPE_p_switch_buffer buffer, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen) {
-    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_buffer_read(SWIGTYPE_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen)), true);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_size_t switch_buffer_read_loop(SWIGTYPE_p_switch_buffer buffer, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen) {
-    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_buffer_read_loop(SWIGTYPE_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen)), true);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static void switch_buffer_set_loops(SWIGTYPE_p_switch_buffer buffer, int loops) {
-    freeswitchPINVOKE.switch_buffer_set_loops(SWIGTYPE_p_switch_buffer.getCPtr(buffer), loops);
-  }
-
-  public static SWIGTYPE_p_switch_size_t switch_buffer_write(SWIGTYPE_p_switch_buffer buffer, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen) {
-    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_buffer_write(SWIGTYPE_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen)), true);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_size_t switch_buffer_toss(SWIGTYPE_p_switch_buffer buffer, SWIGTYPE_p_switch_size_t datalen) {
-    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_buffer_toss(SWIGTYPE_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_switch_size_t.getCPtr(datalen)), true);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static void switch_buffer_zero(SWIGTYPE_p_switch_buffer buffer) {
-    freeswitchPINVOKE.switch_buffer_zero(SWIGTYPE_p_switch_buffer.getCPtr(buffer));
-  }
-
-  public static SWIGTYPE_p_switch_size_t switch_buffer_slide_write(SWIGTYPE_p_switch_buffer buffer, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen) {
-    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_buffer_slide_write(SWIGTYPE_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen)), true);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static void switch_buffer_destroy(SWIGTYPE_p_p_switch_buffer buffer) {
-    freeswitchPINVOKE.switch_buffer_destroy(SWIGTYPE_p_p_switch_buffer.getCPtr(buffer));
-  }
-
-  public static SWIGTYPE_p_switch_size_t switch_buffer_zwrite(SWIGTYPE_p_switch_buffer buffer, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen) {
-    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_buffer_zwrite(SWIGTYPE_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen)), true);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static switch_status_t switch_event_init(SWIGTYPE_p_apr_pool_t pool) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_init(SWIGTYPE_p_apr_pool_t.getCPtr(pool));
-    return ret;
-  }
-
-  public static switch_status_t switch_event_shutdown() {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_shutdown();
-    return ret;
-  }
-
-  public static switch_status_t switch_event_create_subclass_detailed(string file, string func, int line, SWIGTYPE_p_p_switch_event arg3, switch_event_types_t event_id, string subclass_name) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_create_subclass_detailed(file, func, line, SWIGTYPE_p_p_switch_event.getCPtr(arg3), (int)event_id, subclass_name);
-    return ret;
-  }
-
-  public static switch_status_t switch_event_set_priority(switch_event arg0, switch_priority_t priority) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_set_priority(switch_event.getCPtr(arg0), (int)priority);
-    return ret;
-  }
-
-  public static string switch_event_get_header(switch_event arg0, string header_name) {
-    string ret = freeswitchPINVOKE.switch_event_get_header(switch_event.getCPtr(arg0), header_name);
-    return ret;
-  }
-
-  public static string switch_event_get_body(switch_event arg0) {
-    string ret = freeswitchPINVOKE.switch_event_get_body(switch_event.getCPtr(arg0));
-    return ret;
-  }
-
-  public static switch_status_t switch_event_set_subclass_name(switch_event arg0, string subclass_name) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_set_subclass_name(switch_event.getCPtr(arg0), subclass_name);
-    return ret;
-  }
-
-  public static switch_status_t switch_event_add_header_string(switch_event arg0, switch_stack_t stack, string header_name, string data) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_add_header_string(switch_event.getCPtr(arg0), (int)stack, header_name, data);
-    return ret;
-  }
-
-  public static switch_status_t switch_event_del_header(switch_event arg0, string header_name) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_del_header(switch_event.getCPtr(arg0), header_name);
-    return ret;
-  }
-
-  public static void switch_event_destroy(SWIGTYPE_p_p_switch_event arg0) {
-    freeswitchPINVOKE.switch_event_destroy(SWIGTYPE_p_p_switch_event.getCPtr(arg0));
-  }
-
-  public static switch_status_t switch_event_dup(SWIGTYPE_p_p_switch_event arg0, switch_event todup) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_dup(SWIGTYPE_p_p_switch_event.getCPtr(arg0), switch_event.getCPtr(todup));
-    return ret;
-  }
-
-  public static switch_status_t switch_event_fire_detailed(string file, string func, int line, SWIGTYPE_p_p_switch_event arg3, SWIGTYPE_p_void user_data) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_fire_detailed(file, func, line, SWIGTYPE_p_p_switch_event.getCPtr(arg3), SWIGTYPE_p_void.getCPtr(user_data));
-    return ret;
-  }
-
-  public static void switch_event_prep_for_delivery_detailed(string file, string func, int line, switch_event arg3) {
-    freeswitchPINVOKE.switch_event_prep_for_delivery_detailed(file, func, line, switch_event.getCPtr(arg3));
-  }
-
-  public static switch_status_t switch_event_bind(string id, switch_event_types_t arg1, string subclass_name, SWIGTYPE_p_f_p_switch_event__void callback, SWIGTYPE_p_void user_data) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_bind(id, (int)arg1, subclass_name, SWIGTYPE_p_f_p_switch_event__void.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data));
-    return ret;
-  }
-
-  public static switch_status_t switch_event_bind_removable(string id, switch_event_types_t arg1, string subclass_name, SWIGTYPE_p_f_p_switch_event__void callback, SWIGTYPE_p_void user_data, SWIGTYPE_p_p_switch_event_node node) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_bind_removable(id, (int)arg1, subclass_name, SWIGTYPE_p_f_p_switch_event__void.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data), SWIGTYPE_p_p_switch_event_node.getCPtr(node));
-    return ret;
-  }
-
-  public static switch_status_t switch_event_unbind(SWIGTYPE_p_p_switch_event_node node) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_unbind(SWIGTYPE_p_p_switch_event_node.getCPtr(node));
-    return ret;
-  }
-
-  public static switch_status_t switch_event_unbind_callback(SWIGTYPE_p_f_p_switch_event__void callback) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_unbind_callback(SWIGTYPE_p_f_p_switch_event__void.getCPtr(callback));
-    return ret;
-  }
-
-  public static string switch_event_name(switch_event_types_t arg0) {
-    string ret = freeswitchPINVOKE.switch_event_name((int)arg0);
-    return ret;
-  }
-
-  public static switch_status_t switch_name_event(string name, SWIGTYPE_p_switch_event_types_t type) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_name_event(name, SWIGTYPE_p_switch_event_types_t.getCPtr(type));
-    return ret;
-  }
-
-  public static switch_status_t switch_event_reserve_subclass_detailed(string owner, string subclass_name) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_reserve_subclass_detailed(owner, subclass_name);
-    return ret;
-  }
-
-  public static switch_status_t switch_event_free_subclass_detailed(string owner, string subclass_name) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_free_subclass_detailed(owner, subclass_name);
-    return ret;
-  }
-
-  public static switch_status_t switch_event_serialize(switch_event arg0, ref string str, switch_bool_t encode) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_serialize(switch_event.getCPtr(arg0), ref str, (int)encode);
-    return ret;
-  }
-
-  public static switch_status_t switch_event_running() {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_running();
-    return ret;
-  }
-
-  public static string switch_event_expand_headers(switch_event arg0, string arg1) {
-    string ret = freeswitchPINVOKE.switch_event_expand_headers(switch_event.getCPtr(arg0), arg1);
-    return ret;
-  }
-
-  public static switch_status_t switch_event_create_pres_in_detailed(string file, string func, int line, string proto, string login, string from, string from_domain, string status, string event_type, string alt_event_type, int event_count, string unique_id, string channel_state, string answer_state, string call_direction) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_create_pres_in_detailed(file, func, line, proto, login, from, from_domain, status, event_type, alt_event_type, event_count, unique_id, channel_state, answer_state, call_direction);
-    return ret;
-  }
-
-  public static switch_status_t switch_event_create_plain(SWIGTYPE_p_p_switch_event arg0, switch_event_types_t event_id) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_create_plain(SWIGTYPE_p_p_switch_event.getCPtr(arg0), (int)event_id);
-    return ret;
-  }
-
-  public static void switch_event_deliver(SWIGTYPE_p_p_switch_event arg0) {
-    freeswitchPINVOKE.switch_event_deliver(SWIGTYPE_p_p_switch_event.getCPtr(arg0));
-  }
-
-  public static string switch_event_build_param_string(switch_event arg0, string prefix, SWIGTYPE_p_switch_hash vars_map) {
-    string ret = freeswitchPINVOKE.switch_event_build_param_string(switch_event.getCPtr(arg0), prefix, SWIGTYPE_p_switch_hash.getCPtr(vars_map));
-    return ret;
-  }
-
-  public static switch_status_t switch_resample_perform_create(SWIGTYPE_p_p_switch_audio_resampler_t new_resampler, uint from_rate, uint to_rate, uint to_size, int quality, uint channels, string file, string func, int line) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_resample_perform_create(SWIGTYPE_p_p_switch_audio_resampler_t.getCPtr(new_resampler), from_rate, to_rate, to_size, quality, channels, file, func, line);
-    return ret;
-  }
-
-  public static void switch_resample_destroy(SWIGTYPE_p_p_switch_audio_resampler_t resampler) {
-    freeswitchPINVOKE.switch_resample_destroy(SWIGTYPE_p_p_switch_audio_resampler_t.getCPtr(resampler));
-  }
-
-  public static uint switch_resample_process(switch_audio_resampler_t resampler, SWIGTYPE_p_short src, uint srclen) {
-    uint ret = freeswitchPINVOKE.switch_resample_process(switch_audio_resampler_t.getCPtr(resampler), SWIGTYPE_p_short.getCPtr(src), srclen);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_size_t switch_float_to_short(SWIGTYPE_p_float f, SWIGTYPE_p_short s, SWIGTYPE_p_switch_size_t len) {
-    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_float_to_short(SWIGTYPE_p_float.getCPtr(f), SWIGTYPE_p_short.getCPtr(s), SWIGTYPE_p_switch_size_t.getCPtr(len)), true);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static int switch_char_to_float(string c, SWIGTYPE_p_float f, int len) {
-    int ret = freeswitchPINVOKE.switch_char_to_float(c, SWIGTYPE_p_float.getCPtr(f), len);
-    return ret;
-  }
-
-  public static int switch_float_to_char(SWIGTYPE_p_float f, string c, int len) {
-    int ret = freeswitchPINVOKE.switch_float_to_char(SWIGTYPE_p_float.getCPtr(f), c, len);
-    return ret;
-  }
-
-  public static int switch_short_to_float(SWIGTYPE_p_short s, SWIGTYPE_p_float f, int len) {
-    int ret = freeswitchPINVOKE.switch_short_to_float(SWIGTYPE_p_short.getCPtr(s), SWIGTYPE_p_float.getCPtr(f), len);
-    return ret;
-  }
-
-  public static void switch_swap_linear(SWIGTYPE_p_short buf, int len) {
-    freeswitchPINVOKE.switch_swap_linear(SWIGTYPE_p_short.getCPtr(buf), len);
-  }
-
-  public static void switch_generate_sln_silence(SWIGTYPE_p_short data, uint samples, uint divisor) {
-    freeswitchPINVOKE.switch_generate_sln_silence(SWIGTYPE_p_short.getCPtr(data), samples, divisor);
-  }
-
-  public static void switch_change_sln_volume(SWIGTYPE_p_short data, uint samples, int vol) {
-    freeswitchPINVOKE.switch_change_sln_volume(SWIGTYPE_p_short.getCPtr(data), samples, vol);
-  }
-
-  public static uint switch_merge_sln(SWIGTYPE_p_short data, uint samples, SWIGTYPE_p_short other_data, uint other_samples) {
-    uint ret = freeswitchPINVOKE.switch_merge_sln(SWIGTYPE_p_short.getCPtr(data), samples, SWIGTYPE_p_short.getCPtr(other_data), other_samples);
-    return ret;
-  }
-
-  public static void switch_mux_channels(SWIGTYPE_p_short data, SWIGTYPE_p_switch_size_t samples, uint channels) {
-    freeswitchPINVOKE.switch_mux_channels(SWIGTYPE_p_short.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(samples), channels);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-  }
-
-  public static switch_status_t switch_ivr_deactivate_unicast(SWIGTYPE_p_switch_core_session session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_deactivate_unicast(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_activate_unicast(SWIGTYPE_p_switch_core_session session, string local_ip, ushort local_port, string remote_ip, ushort remote_port, string transport, string flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_activate_unicast(SWIGTYPE_p_switch_core_session.getCPtr(session), local_ip, local_port, remote_ip, remote_port, transport, flags);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_generate_xml_cdr(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_xml xml_cdr) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_generate_xml_cdr(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_xml.getCPtr(xml_cdr));
-    return ret;
-  }
-
-  public static int switch_ivr_set_xml_profile_data(switch_xml xml, switch_caller_profile caller_profile, int off) {
-    int ret = freeswitchPINVOKE.switch_ivr_set_xml_profile_data(switch_xml.getCPtr(xml), switch_caller_profile.getCPtr(caller_profile), off);
-    return ret;
-  }
-
-  public static int switch_ivr_set_xml_chan_vars(switch_xml xml, SWIGTYPE_p_switch_channel channel, int off) {
-    int ret = freeswitchPINVOKE.switch_ivr_set_xml_chan_vars(switch_xml.getCPtr(xml), SWIGTYPE_p_switch_channel.getCPtr(channel), off);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_parse_event(SWIGTYPE_p_switch_core_session session, switch_event arg1) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_parse_event(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_event.getCPtr(arg1));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_parse_all_events(SWIGTYPE_p_switch_core_session session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_parse_all_events(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_parse_next_event(SWIGTYPE_p_switch_core_session session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_parse_next_event(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_parse_all_messages(SWIGTYPE_p_switch_core_session session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_parse_all_messages(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_sleep(SWIGTYPE_p_switch_core_session session, uint ms, switch_bool_t sync, switch_input_args_t args) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_sleep(SWIGTYPE_p_switch_core_session.getCPtr(session), ms, (int)sync, switch_input_args_t.getCPtr(args));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_park(SWIGTYPE_p_switch_core_session session, switch_input_args_t args) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_park(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_input_args_t.getCPtr(args));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_collect_digits_callback(SWIGTYPE_p_switch_core_session session, switch_input_args_t args, uint digit_timeout, uint abs_timeout) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_collect_digits_callback(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_input_args_t.getCPtr(args), digit_timeout, abs_timeout);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_collect_digits_count(SWIGTYPE_p_switch_core_session session, string buf, SWIGTYPE_p_switch_size_t buflen, SWIGTYPE_p_switch_size_t maxdigits, string terminators, string terminator, uint first_timeout, uint digit_timeout, uint abs_timeout) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_collect_digits_count(SWIGTYPE_p_switch_core_session.getCPtr(session), buf, SWIGTYPE_p_switch_size_t.getCPtr(buflen), SWIGTYPE_p_switch_size_t.getCPtr(maxdigits), terminators, terminator, first_timeout, digit_timeout, abs_timeout);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_detect_speech(SWIGTYPE_p_switch_core_session session, string mod_name, string grammar, string name, string dest, switch_asr_handle ah) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech(SWIGTYPE_p_switch_core_session.getCPtr(session), mod_name, grammar, name, dest, switch_asr_handle.getCPtr(ah));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_stop_detect_speech(SWIGTYPE_p_switch_core_session session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_stop_detect_speech(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_pause_detect_speech(SWIGTYPE_p_switch_core_session session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_pause_detect_speech(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_resume_detect_speech(SWIGTYPE_p_switch_core_session session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_resume_detect_speech(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_detect_speech_load_grammar(SWIGTYPE_p_switch_core_session session, string grammar, string name) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech_load_grammar(SWIGTYPE_p_switch_core_session.getCPtr(session), grammar, name);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_detect_speech_unload_grammar(SWIGTYPE_p_switch_core_session session, string name) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech_unload_grammar(SWIGTYPE_p_switch_core_session.getCPtr(session), name);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_record_session(SWIGTYPE_p_switch_core_session session, string file, uint limit, switch_file_handle fh) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_record_session(SWIGTYPE_p_switch_core_session.getCPtr(session), file, limit, switch_file_handle.getCPtr(fh));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_eavesdrop_session(SWIGTYPE_p_switch_core_session session, string uuid, string require_group, uint flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_eavesdrop_session(SWIGTYPE_p_switch_core_session.getCPtr(session), uuid, require_group, flags);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_displace_session(SWIGTYPE_p_switch_core_session session, string file, uint limit, string flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_displace_session(SWIGTYPE_p_switch_core_session.getCPtr(session), file, limit, flags);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_stop_displace_session(SWIGTYPE_p_switch_core_session session, string file) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_stop_displace_session(SWIGTYPE_p_switch_core_session.getCPtr(session), file);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_stop_record_session(SWIGTYPE_p_switch_core_session session, string file) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_stop_record_session(SWIGTYPE_p_switch_core_session.getCPtr(session), file);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_inband_dtmf_session(SWIGTYPE_p_switch_core_session session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_inband_dtmf_session(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_stop_inband_dtmf_session(SWIGTYPE_p_switch_core_session session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_stop_inband_dtmf_session(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_inband_dtmf_generate_session(SWIGTYPE_p_switch_core_session session, switch_bool_t read_stream) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_inband_dtmf_generate_session(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)read_stream);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_stop_inband_dtmf_generate_session(SWIGTYPE_p_switch_core_session session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_stop_inband_dtmf_generate_session(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static void switch_ivr_session_echo(SWIGTYPE_p_switch_core_session session, switch_input_args_t args) {
-    freeswitchPINVOKE.switch_ivr_session_echo(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_input_args_t.getCPtr(args));
-  }
-
-  public static switch_status_t switch_ivr_stop_tone_detect_session(SWIGTYPE_p_switch_core_session session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_stop_tone_detect_session(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_tone_detect_session(SWIGTYPE_p_switch_core_session session, string key, string tone_spec, string flags, SWIGTYPE_p_time_t timeout, int hits, string app, string data, SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_bool_t callback) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_tone_detect_session(SWIGTYPE_p_switch_core_session.getCPtr(session), key, tone_spec, flags, SWIGTYPE_p_time_t.getCPtr(timeout), hits, app, data, SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_bool_t.getCPtr(callback));
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_play_file(SWIGTYPE_p_switch_core_session session, switch_file_handle fh, string file, switch_input_args_t args) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_play_file(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_file_handle.getCPtr(fh), file, switch_input_args_t.getCPtr(args));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_wait_for_silence(SWIGTYPE_p_switch_core_session session, uint thresh, uint silence_hits, uint listen_hits, uint timeout_ms, string file) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_wait_for_silence(SWIGTYPE_p_switch_core_session.getCPtr(session), thresh, silence_hits, listen_hits, timeout_ms, file);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_gentones(SWIGTYPE_p_switch_core_session session, string script, int loops, switch_input_args_t args) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_gentones(SWIGTYPE_p_switch_core_session.getCPtr(session), script, loops, switch_input_args_t.getCPtr(args));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_record_file(SWIGTYPE_p_switch_core_session session, switch_file_handle fh, string file, switch_input_args_t args, uint limit) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_record_file(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_file_handle.getCPtr(fh), file, switch_input_args_t.getCPtr(args), limit);
-    return ret;
-  }
-
-  public static switch_status_t switch_play_and_get_digits(SWIGTYPE_p_switch_core_session session, uint min_digits, uint max_digits, uint max_tries, uint timeout, string valid_terminators, string audio_file, string bad_input_audio_file, string var_name, string digit_buffer, uint digit_buffer_length, string digits_regex) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_play_and_get_digits(SWIGTYPE_p_switch_core_session.getCPtr(session), min_digits, max_digits, max_tries, timeout, valid_terminators, audio_file, bad_input_audio_file, var_name, digit_buffer, digit_buffer_length, digits_regex);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_speak_text_handle(SWIGTYPE_p_switch_core_session session, switch_speech_handle sh, switch_codec codec, switch_timer timer, string text, switch_input_args_t args) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_speak_text_handle(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_speech_handle.getCPtr(sh), switch_codec.getCPtr(codec), switch_timer.getCPtr(timer), text, switch_input_args_t.getCPtr(args));
-    return ret;
-  }
-
-  public static void switch_ivr_clear_speech_cache(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_ivr_clear_speech_cache(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static switch_status_t switch_ivr_speak_text(SWIGTYPE_p_switch_core_session session, string tts_name, string voice_name, string text, switch_input_args_t args) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_speak_text(SWIGTYPE_p_switch_core_session.getCPtr(session), tts_name, voice_name, text, switch_input_args_t.getCPtr(args));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_originate(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_core_session bleg, SWIGTYPE_p_switch_call_cause_t cause, string bridgeto, uint timelimit_sec, switch_state_handler_table table, string cid_name_override, string cid_num_override, switch_caller_profile caller_profile_override, switch_event ovars, uint flags, SWIGTYPE_p_switch_call_cause_t cancel_cause) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_originate(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_core_session.getCPtr(bleg), SWIGTYPE_p_switch_call_cause_t.getCPtr(cause), bridgeto, timelimit_sec, switch_state_handler_table.getCPtr(table), cid_name_override, cid_num_override, switch_caller_profile.getCPtr(caller_profile_override), switch_event.getCPtr(ovars), flags, SWIGTYPE_p_switch_call_cause_t.getCPtr(cancel_cause));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_enterprise_originate(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_core_session bleg, SWIGTYPE_p_switch_call_cause_t cause, string bridgeto, uint timelimit_sec, switch_state_handler_table table, string cid_name_override, string cid_num_override, switch_caller_profile caller_profile_override, switch_event ovars, uint flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_enterprise_originate(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_core_session.getCPtr(bleg), SWIGTYPE_p_switch_call_cause_t.getCPtr(cause), bridgeto, timelimit_sec, switch_state_handler_table.getCPtr(table), cid_name_override, cid_num_override, switch_caller_profile.getCPtr(caller_profile_override), switch_event.getCPtr(ovars), flags);
-    return ret;
-  }
-
-  public static void switch_ivr_bridge_display(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_core_session peer_session) {
-    freeswitchPINVOKE.switch_ivr_bridge_display(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_core_session.getCPtr(peer_session));
-  }
-
-  public static switch_status_t switch_ivr_multi_threaded_bridge(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_core_session peer_session, SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t dtmf_callback, SWIGTYPE_p_void session_data, SWIGTYPE_p_void peer_session_data) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_multi_threaded_bridge(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_core_session.getCPtr(peer_session), SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t.getCPtr(dtmf_callback), SWIGTYPE_p_void.getCPtr(session_data), SWIGTYPE_p_void.getCPtr(peer_session_data));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_signal_bridge(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_core_session peer_session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_signal_bridge(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_core_session.getCPtr(peer_session));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_session_transfer(SWIGTYPE_p_switch_core_session session, string extension, string dialplan, string context) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_session_transfer(SWIGTYPE_p_switch_core_session.getCPtr(session), extension, dialplan, context);
-    return ret;
-  }
-
-  public static uint switch_ivr_schedule_transfer(SWIGTYPE_p_time_t runtime, string uuid, string extension, string dialplan, string context) {
-    uint ret = freeswitchPINVOKE.switch_ivr_schedule_transfer(SWIGTYPE_p_time_t.getCPtr(runtime), uuid, extension, dialplan, context);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static uint switch_ivr_schedule_hangup(SWIGTYPE_p_time_t runtime, string uuid, switch_call_cause_t cause, switch_bool_t bleg) {
-    uint ret = freeswitchPINVOKE.switch_ivr_schedule_hangup(SWIGTYPE_p_time_t.getCPtr(runtime), uuid, (int)cause, (int)bleg);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_uuid_bridge(string originator_uuid, string originatee_uuid) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_uuid_bridge(originator_uuid, originatee_uuid);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_media(string uuid, uint flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_media(uuid, flags);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_nomedia(string uuid, uint flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_nomedia(uuid, flags);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_hold_uuid(string uuid, string message, switch_bool_t moh) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_hold_uuid(uuid, message, (int)moh);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_unhold_uuid(string uuid) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_unhold_uuid(uuid);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_hold(SWIGTYPE_p_switch_core_session session, string message, switch_bool_t moh) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_hold(SWIGTYPE_p_switch_core_session.getCPtr(session), message, (int)moh);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_unhold(SWIGTYPE_p_switch_core_session session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_unhold(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static uint switch_ivr_schedule_broadcast(SWIGTYPE_p_time_t runtime, string uuid, string path, uint flags) {
-    uint ret = freeswitchPINVOKE.switch_ivr_schedule_broadcast(SWIGTYPE_p_time_t.getCPtr(runtime), uuid, path, flags);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_broadcast(string uuid, string path, uint flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_broadcast(uuid, path, flags);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_transfer_variable(SWIGTYPE_p_switch_core_session sessa, SWIGTYPE_p_switch_core_session sessb, string var) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_transfer_variable(SWIGTYPE_p_switch_core_session.getCPtr(sessa), SWIGTYPE_p_switch_core_session.getCPtr(sessb), var);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_digit_stream_parser_new(SWIGTYPE_p_apr_pool_t pool, SWIGTYPE_p_p_switch_ivr_digit_stream_parser parser) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_digit_stream_parser_new(SWIGTYPE_p_apr_pool_t.getCPtr(pool), SWIGTYPE_p_p_switch_ivr_digit_stream_parser.getCPtr(parser));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_digit_stream_parser_destroy(SWIGTYPE_p_switch_ivr_digit_stream_parser parser) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_digit_stream_parser_destroy(SWIGTYPE_p_switch_ivr_digit_stream_parser.getCPtr(parser));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_digit_stream_new(SWIGTYPE_p_switch_ivr_digit_stream_parser parser, SWIGTYPE_p_p_switch_ivr_digit_stream stream) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_digit_stream_new(SWIGTYPE_p_switch_ivr_digit_stream_parser.getCPtr(parser), SWIGTYPE_p_p_switch_ivr_digit_stream.getCPtr(stream));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_digit_stream_destroy(SWIGTYPE_p_p_switch_ivr_digit_stream stream) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_digit_stream_destroy(SWIGTYPE_p_p_switch_ivr_digit_stream.getCPtr(stream));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_digit_stream_parser_set_event(SWIGTYPE_p_switch_ivr_digit_stream_parser parser, string digits, SWIGTYPE_p_void data) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_digit_stream_parser_set_event(SWIGTYPE_p_switch_ivr_digit_stream_parser.getCPtr(parser), digits, SWIGTYPE_p_void.getCPtr(data));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_digit_stream_parser_del_event(SWIGTYPE_p_switch_ivr_digit_stream_parser parser, string digits) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_digit_stream_parser_del_event(SWIGTYPE_p_switch_ivr_digit_stream_parser.getCPtr(parser), digits);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_void switch_ivr_digit_stream_parser_feed(SWIGTYPE_p_switch_ivr_digit_stream_parser parser, SWIGTYPE_p_switch_ivr_digit_stream stream, char digit) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_ivr_digit_stream_parser_feed(SWIGTYPE_p_switch_ivr_digit_stream_parser.getCPtr(parser), SWIGTYPE_p_switch_ivr_digit_stream.getCPtr(stream), digit);
-    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_digit_stream_reset(SWIGTYPE_p_switch_ivr_digit_stream stream) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_digit_stream_reset(SWIGTYPE_p_switch_ivr_digit_stream.getCPtr(stream));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_digit_stream_parser_set_terminator(SWIGTYPE_p_switch_ivr_digit_stream_parser parser, char digit) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_digit_stream_parser_set_terminator(SWIGTYPE_p_switch_ivr_digit_stream_parser.getCPtr(parser), digit);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_menu_init(SWIGTYPE_p_p_switch_ivr_menu new_menu, SWIGTYPE_p_switch_ivr_menu main, string name, string greeting_sound, string short_greeting_sound, string invalid_sound, string exit_sound, string confirm_macro, string confirm_key, string tts_engine, string tts_voice, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts, SWIGTYPE_p_apr_pool_t pool) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_init(SWIGTYPE_p_p_switch_ivr_menu.getCPtr(new_menu), SWIGTYPE_p_switch_ivr_menu.getCPtr(main), name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_menu_bind_action(SWIGTYPE_p_switch_ivr_menu menu, switch_ivr_action_t ivr_action, string arg, string bind) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_bind_action(SWIGTYPE_p_switch_ivr_menu.getCPtr(menu), (int)ivr_action, arg, bind);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_menu_bind_function(SWIGTYPE_p_switch_ivr_menu menu, SWIGTYPE_p_switch_ivr_menu_action_function_t function, string arg, string bind) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_bind_function(SWIGTYPE_p_switch_ivr_menu.getCPtr(menu), SWIGTYPE_p_switch_ivr_menu_action_function_t.getCPtr(function), arg, bind);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_menu_execute(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_ivr_menu stack, string name, SWIGTYPE_p_void obj) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_execute(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_ivr_menu.getCPtr(stack), name, SWIGTYPE_p_void.getCPtr(obj));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_menu_stack_free(SWIGTYPE_p_switch_ivr_menu stack) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_stack_free(SWIGTYPE_p_switch_ivr_menu.getCPtr(stack));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_menu_stack_xml_build(SWIGTYPE_p_switch_ivr_menu_xml_ctx xml_menu_ctx, SWIGTYPE_p_p_switch_ivr_menu menu_stack, switch_xml xml_menus, switch_xml xml_menu) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_stack_xml_build(SWIGTYPE_p_switch_ivr_menu_xml_ctx.getCPtr(xml_menu_ctx), SWIGTYPE_p_p_switch_ivr_menu.getCPtr(menu_stack), switch_xml.getCPtr(xml_menus), switch_xml.getCPtr(xml_menu));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_menu_str2action(string action_name, SWIGTYPE_p_switch_ivr_action_t action) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_str2action(action_name, SWIGTYPE_p_switch_ivr_action_t.getCPtr(action));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_menu_stack_xml_add_custom(SWIGTYPE_p_switch_ivr_menu_xml_ctx xml_menu_ctx, string name, SWIGTYPE_p_switch_ivr_menu_action_function_t function) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_stack_xml_add_custom(SWIGTYPE_p_switch_ivr_menu_xml_ctx.getCPtr(xml_menu_ctx), name, SWIGTYPE_p_switch_ivr_menu_action_function_t.getCPtr(function));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_menu_stack_xml_init(SWIGTYPE_p_p_switch_ivr_menu_xml_ctx xml_menu_ctx, SWIGTYPE_p_apr_pool_t pool) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_stack_xml_init(SWIGTYPE_p_p_switch_ivr_menu_xml_ctx.getCPtr(xml_menu_ctx), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_phrase_macro(SWIGTYPE_p_switch_core_session session, string macro_name, string data, string lang, switch_input_args_t args) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_phrase_macro(SWIGTYPE_p_switch_core_session.getCPtr(session), macro_name, data, lang, switch_input_args_t.getCPtr(args));
-    return ret;
-  }
-
-  public static void switch_ivr_delay_echo(SWIGTYPE_p_switch_core_session session, uint delay_ms) {
-    freeswitchPINVOKE.switch_ivr_delay_echo(SWIGTYPE_p_switch_core_session.getCPtr(session), delay_ms);
-  }
-
-  public static switch_status_t switch_ivr_find_bridged_uuid(string uuid, string b_uuid, SWIGTYPE_p_switch_size_t blen) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_find_bridged_uuid(uuid, b_uuid, SWIGTYPE_p_switch_size_t.getCPtr(blen));
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static void switch_ivr_intercept_session(SWIGTYPE_p_switch_core_session session, string uuid, switch_bool_t bleg) {
-    freeswitchPINVOKE.switch_ivr_intercept_session(SWIGTYPE_p_switch_core_session.getCPtr(session), uuid, (int)bleg);
-  }
-
-  public static void switch_ivr_park_session(SWIGTYPE_p_switch_core_session session) {
-    freeswitchPINVOKE.switch_ivr_park_session(SWIGTYPE_p_switch_core_session.getCPtr(session));
-  }
-
-  public static switch_status_t switch_ivr_wait_for_answer(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_core_session peer_session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_wait_for_answer(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_core_session.getCPtr(peer_session));
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_read(SWIGTYPE_p_switch_core_session session, uint min_digits, uint max_digits, string prompt_audio_file, string var_name, string digit_buffer, SWIGTYPE_p_switch_size_t digit_buffer_length, uint timeout, string valid_terminators) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_read(SWIGTYPE_p_switch_core_session.getCPtr(session), min_digits, max_digits, prompt_audio_file, var_name, digit_buffer, SWIGTYPE_p_switch_size_t.getCPtr(digit_buffer_length), timeout, valid_terminators);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_bind_dtmf_meta_session(SWIGTYPE_p_switch_core_session session, uint key, uint bind_flags, string app) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_bind_dtmf_meta_session(SWIGTYPE_p_switch_core_session.getCPtr(session), key, bind_flags, app);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_unbind_dtmf_meta_session(SWIGTYPE_p_switch_core_session session, uint key) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_unbind_dtmf_meta_session(SWIGTYPE_p_switch_core_session.getCPtr(session), key);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_soft_hold(SWIGTYPE_p_switch_core_session session, string unhold_key, string moh_a, string moh_b) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_soft_hold(SWIGTYPE_p_switch_core_session.getCPtr(session), unhold_key, moh_a, moh_b);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_say(SWIGTYPE_p_switch_core_session session, string tosay, string module_name, string say_type, string say_method, switch_input_args_t args) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_say(SWIGTYPE_p_switch_core_session.getCPtr(session), tosay, module_name, say_type, say_method, switch_input_args_t.getCPtr(args));
-    return ret;
-  }
-
-  public static switch_say_method_t switch_ivr_get_say_method_by_name(string name) {
-    switch_say_method_t ret = (switch_say_method_t)freeswitchPINVOKE.switch_ivr_get_say_method_by_name(name);
-    return ret;
-  }
-
-  public static switch_say_type_t switch_ivr_get_say_type_by_name(string name) {
-    switch_say_type_t ret = (switch_say_type_t)freeswitchPINVOKE.switch_ivr_get_say_type_by_name(name);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_set_user(SWIGTYPE_p_switch_core_session session, string data) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_set_user(SWIGTYPE_p_switch_core_session.getCPtr(session), data);
-    return ret;
-  }
-
-  public static switch_status_t switch_ivr_sound_test(SWIGTYPE_p_switch_core_session session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_sound_test(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static void switch_process_import(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_channel peer_channel, string varname) {
-    freeswitchPINVOKE.switch_process_import(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_channel.getCPtr(peer_channel), varname);
-  }
-
-  public static switch_bool_t switch_ivr_uuid_exists(string uuid) {
-    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_ivr_uuid_exists(uuid);
-    return ret;
-  }
-
-  public static switch_status_t switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_crypto_direction_t direction, uint index, switch_rtp_crypto_key_type_t type, SWIGTYPE_p_unsigned_char key, SWIGTYPE_p_switch_size_t keylen) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)direction, index, (int)type, SWIGTYPE_p_unsigned_char.getCPtr(key), SWIGTYPE_p_switch_size_t.getCPtr(keylen));
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static void switch_rtp_get_random(SWIGTYPE_p_void buf, uint len) {
-    freeswitchPINVOKE.switch_rtp_get_random(SWIGTYPE_p_void.getCPtr(buf), len);
-  }
-
-  public static void switch_rtp_init(SWIGTYPE_p_apr_pool_t pool) {
-    freeswitchPINVOKE.switch_rtp_init(SWIGTYPE_p_apr_pool_t.getCPtr(pool));
-  }
-
-  public static void switch_rtp_shutdown() {
-    freeswitchPINVOKE.switch_rtp_shutdown();
-  }
-
-  public static ushort switch_rtp_set_start_port(ushort port) {
-    ushort ret = freeswitchPINVOKE.switch_rtp_set_start_port(port);
-    return ret;
-  }
-
-  public static ushort switch_rtp_set_end_port(ushort port) {
-    ushort ret = freeswitchPINVOKE.switch_rtp_set_end_port(port);
-    return ret;
-  }
-
-  public static ushort switch_rtp_request_port(string ip) {
-    ushort ret = freeswitchPINVOKE.switch_rtp_request_port(ip);
-    return ret;
-  }
-
-  public static void switch_rtp_release_port(string ip, ushort port) {
-    freeswitchPINVOKE.switch_rtp_release_port(ip, port);
-  }
-
-  public static switch_status_t switch_rtp_set_interval(SWIGTYPE_p_switch_rtp rtp_session, uint ms_per_packet, uint samples_per_interval) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_set_interval(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), ms_per_packet, samples_per_interval);
-    return ret;
-  }
-
-  public static switch_status_t switch_rtp_change_interval(SWIGTYPE_p_switch_rtp rtp_session, uint ms_per_packet, uint samples_per_interval) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_change_interval(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), ms_per_packet, samples_per_interval);
-    return ret;
-  }
-
-  public static switch_status_t switch_rtp_create(SWIGTYPE_p_p_switch_rtp new_rtp_session, byte payload, uint samples_per_interval, uint ms_per_packet, uint flags, string timer_name, ref string err, SWIGTYPE_p_apr_pool_t pool) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_create(SWIGTYPE_p_p_switch_rtp.getCPtr(new_rtp_session), payload, samples_per_interval, ms_per_packet, flags, timer_name, ref err, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_rtp switch_rtp_new(string rx_host, ushort rx_port, string tx_host, ushort tx_port, byte payload, uint samples_per_interval, uint ms_per_packet, uint flags, string timer_name, ref string err, SWIGTYPE_p_apr_pool_t pool) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_rtp_new(rx_host, rx_port, tx_host, tx_port, payload, samples_per_interval, ms_per_packet, flags, timer_name, ref err, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
-    SWIGTYPE_p_switch_rtp ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_rtp(cPtr, false);
-    return ret;
-  }
-
-  public static switch_status_t switch_rtp_set_remote_address(SWIGTYPE_p_switch_rtp rtp_session, string host, ushort port, switch_bool_t change_adv_addr, ref string err) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_set_remote_address(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), host, port, (int)change_adv_addr, ref err);
-    return ret;
-  }
-
-  public static string switch_rtp_get_remote_host(SWIGTYPE_p_switch_rtp rtp_session) {
-    string ret = freeswitchPINVOKE.switch_rtp_get_remote_host(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
-    return ret;
-  }
-
-  public static ushort switch_rtp_get_remote_port(SWIGTYPE_p_switch_rtp rtp_session) {
-    ushort ret = freeswitchPINVOKE.switch_rtp_get_remote_port(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
-    return ret;
-  }
-
-  public static void switch_rtp_reset_media_timer(SWIGTYPE_p_switch_rtp rtp_session) {
-    freeswitchPINVOKE.switch_rtp_reset_media_timer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
-  }
-
-  public static void switch_rtp_set_max_missed_packets(SWIGTYPE_p_switch_rtp rtp_session, uint max) {
-    freeswitchPINVOKE.switch_rtp_set_max_missed_packets(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), max);
-  }
-
-  public static switch_status_t switch_rtp_set_local_address(SWIGTYPE_p_switch_rtp rtp_session, string host, ushort port, ref string err) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_set_local_address(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), host, port, ref err);
-    return ret;
-  }
-
-  public static void switch_rtp_kill_socket(SWIGTYPE_p_switch_rtp rtp_session) {
-    freeswitchPINVOKE.switch_rtp_kill_socket(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
-  }
-
-  public static void switch_rtp_break(SWIGTYPE_p_switch_rtp rtp_session) {
-    freeswitchPINVOKE.switch_rtp_break(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
-  }
-
-  public static byte switch_rtp_ready(SWIGTYPE_p_switch_rtp rtp_session) {
-    byte ret = freeswitchPINVOKE.switch_rtp_ready(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
-    return ret;
-  }
-
-  public static void switch_rtp_destroy(SWIGTYPE_p_p_switch_rtp rtp_session) {
-    freeswitchPINVOKE.switch_rtp_destroy(SWIGTYPE_p_p_switch_rtp.getCPtr(rtp_session));
-  }
-
-  public static switch_status_t switch_rtp_activate_ice(SWIGTYPE_p_switch_rtp rtp_session, string login, string rlogin) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_activate_ice(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), login, rlogin);
-    return ret;
-  }
-
-  public static switch_status_t switch_rtp_activate_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session, uint queue_frames) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_activate_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), queue_frames);
-    return ret;
-  }
-
-  public static void switch_rtp_set_flag(SWIGTYPE_p_switch_rtp rtp_session, uint flags) {
-    freeswitchPINVOKE.switch_rtp_set_flag(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), flags);
-  }
-
-  public static uint switch_rtp_test_flag(SWIGTYPE_p_switch_rtp rtp_session, uint flags) {
-    uint ret = freeswitchPINVOKE.switch_rtp_test_flag(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), flags);
-    return ret;
-  }
-
-  public static void switch_rtp_clear_flag(SWIGTYPE_p_switch_rtp rtp_session, uint flags) {
-    freeswitchPINVOKE.switch_rtp_clear_flag(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), flags);
-  }
-
-  public static SWIGTYPE_p_switch_socket_t switch_rtp_get_rtp_socket(SWIGTYPE_p_switch_rtp rtp_session) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_rtp_get_rtp_socket(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
-    SWIGTYPE_p_switch_socket_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_socket_t(cPtr, false);
-    return ret;
-  }
-
-  public static uint switch_rtp_get_default_samples_per_interval(SWIGTYPE_p_switch_rtp rtp_session) {
-    uint ret = freeswitchPINVOKE.switch_rtp_get_default_samples_per_interval(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
-    return ret;
-  }
-
-  public static void switch_rtp_set_default_payload(SWIGTYPE_p_switch_rtp rtp_session, byte payload) {
-    freeswitchPINVOKE.switch_rtp_set_default_payload(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), payload);
-  }
-
-  public static uint switch_rtp_get_default_payload(SWIGTYPE_p_switch_rtp rtp_session) {
-    uint ret = freeswitchPINVOKE.switch_rtp_get_default_payload(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
-    return ret;
-  }
-
-  public static void switch_rtp_set_invald_handler(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void on_invalid) {
-    freeswitchPINVOKE.switch_rtp_set_invald_handler(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void.getCPtr(on_invalid));
-  }
-
-  public static switch_status_t switch_rtp_read(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_void data, SWIGTYPE_p_unsigned_long datalen, SWIGTYPE_p_unsigned_char payload_type, SWIGTYPE_p_unsigned_long flags, uint io_flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_read(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_unsigned_long.getCPtr(datalen), SWIGTYPE_p_unsigned_char.getCPtr(payload_type), SWIGTYPE_p_unsigned_long.getCPtr(flags), io_flags);
-    return ret;
-  }
-
-  public static switch_status_t switch_rtp_queue_rfc2833(SWIGTYPE_p_switch_rtp rtp_session, switch_dtmf_t dtmf) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_queue_rfc2833(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), switch_dtmf_t.getCPtr(dtmf));
-    return ret;
-  }
-
-  public static switch_status_t switch_rtp_queue_rfc2833_in(SWIGTYPE_p_switch_rtp rtp_session, switch_dtmf_t dtmf) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_queue_rfc2833_in(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), switch_dtmf_t.getCPtr(dtmf));
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_size_t switch_rtp_has_dtmf(SWIGTYPE_p_switch_rtp rtp_session) {
-    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_has_dtmf(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session)), true);
-    return ret;
-  }
-
-  public static SWIGTYPE_p_switch_size_t switch_rtp_dequeue_dtmf(SWIGTYPE_p_switch_rtp rtp_session, switch_dtmf_t dtmf) {
-    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_dequeue_dtmf(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), switch_dtmf_t.getCPtr(dtmf)), true);
-    return ret;
-  }
-
-  public static switch_status_t switch_rtp_zerocopy_read(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_p_void data, SWIGTYPE_p_unsigned_long datalen, SWIGTYPE_p_unsigned_char payload_type, SWIGTYPE_p_unsigned_long flags, uint io_flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_zerocopy_read(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_p_void.getCPtr(data), SWIGTYPE_p_unsigned_long.getCPtr(datalen), SWIGTYPE_p_unsigned_char.getCPtr(payload_type), SWIGTYPE_p_unsigned_long.getCPtr(flags), io_flags);
-    return ret;
-  }
-
-  public static switch_status_t switch_rtp_zerocopy_read_frame(SWIGTYPE_p_switch_rtp rtp_session, switch_frame frame, uint io_flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_zerocopy_read_frame(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), switch_frame.getCPtr(frame), io_flags);
-    return ret;
-  }
-
-  public static void rtp_flush_read_buffer(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_flush_t flush) {
-    freeswitchPINVOKE.rtp_flush_read_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)flush);
-  }
-
-  public static switch_status_t switch_rtp_enable_vad(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_switch_core_session session, switch_codec codec, uint flags) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_enable_vad(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec.getCPtr(codec), flags);
-    return ret;
-  }
-
-  public static switch_status_t switch_rtp_disable_vad(SWIGTYPE_p_switch_rtp rtp_session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_disable_vad(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
-    return ret;
-  }
-
-  public static int switch_rtp_write_frame(SWIGTYPE_p_switch_rtp rtp_session, switch_frame frame) {
-    int ret = freeswitchPINVOKE.switch_rtp_write_frame(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), switch_frame.getCPtr(frame));
-    return ret;
-  }
-
-  public static int switch_rtp_write_manual(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_void data, uint datalen, byte m, byte payload, uint ts, SWIGTYPE_p_unsigned_long flags) {
-    int ret = freeswitchPINVOKE.switch_rtp_write_manual(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_void.getCPtr(data), datalen, m, payload, ts, SWIGTYPE_p_unsigned_long.getCPtr(flags));
-    return ret;
-  }
-
-  public static uint switch_rtp_get_ssrc(SWIGTYPE_p_switch_rtp rtp_session) {
-    uint ret = freeswitchPINVOKE.switch_rtp_get_ssrc(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
-    return ret;
-  }
-
-  public static void switch_rtp_set_private(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_void private_data) {
-    freeswitchPINVOKE.switch_rtp_set_private(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_void.getCPtr(private_data));
-  }
-
-  public static void switch_rtp_set_telephony_event(SWIGTYPE_p_switch_rtp rtp_session, byte te) {
-    freeswitchPINVOKE.switch_rtp_set_telephony_event(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), te);
-  }
-
-  public static void switch_rtp_set_cng_pt(SWIGTYPE_p_switch_rtp rtp_session, byte pt) {
-    freeswitchPINVOKE.switch_rtp_set_cng_pt(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), pt);
-  }
-
-  public static SWIGTYPE_p_void switch_rtp_get_private(SWIGTYPE_p_switch_rtp rtp_session) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_rtp_get_private(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
-    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-    return ret;
-  }
-
-  public static switch_status_t switch_rtp_activate_stun_ping(SWIGTYPE_p_switch_rtp rtp_session, string stun_ip, ushort stun_port, uint packet_count, switch_bool_t funny) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_activate_stun_ping(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), stun_ip, stun_port, packet_count, (int)funny);
-    return ret;
-  }
-
-  public static void switch_rtp_intentional_bugs(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_bug_flag_t bugs) {
-    freeswitchPINVOKE.switch_rtp_intentional_bugs(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)bugs);
-  }
-
-  public static switch_rtp_stats_t switch_rtp_get_stats(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_apr_pool_t pool) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_rtp_get_stats(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
-    switch_rtp_stats_t ret = (cPtr == IntPtr.Zero) ? null : new switch_rtp_stats_t(cPtr, false);
-    return ret;
-  }
-
-  public static switch_status_t switch_log_init(SWIGTYPE_p_apr_pool_t pool, switch_bool_t colorize) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_log_init(SWIGTYPE_p_apr_pool_t.getCPtr(pool), (int)colorize);
-    return ret;
-  }
-
-  public static switch_status_t switch_log_shutdown() {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_log_shutdown();
-    return ret;
-  }
-
-  public static switch_status_t switch_log_bind_logger(SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t function, switch_log_level_t level, switch_bool_t is_console) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_log_bind_logger(SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t.getCPtr(function), (int)level, (int)is_console);
-    return ret;
-  }
-
-  public static switch_status_t switch_log_unbind_logger(SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t function) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_log_unbind_logger(SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t.getCPtr(function));
-    return ret;
-  }
-
-  public static string switch_log_level2str(switch_log_level_t level) {
-    string ret = freeswitchPINVOKE.switch_log_level2str((int)level);
-    return ret;
-  }
-
-  public static switch_log_level_t switch_log_str2level(string str) {
-    switch_log_level_t ret = (switch_log_level_t)freeswitchPINVOKE.switch_log_str2level(str);
-    return ret;
-  }
-
-  public static uint switch_log_str2mask(string str) {
-    uint ret = freeswitchPINVOKE.switch_log_str2mask(str);
-    return ret;
-  }
-
-  public static switch_log_node_t switch_log_node_dup(switch_log_node_t node) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_log_node_dup(switch_log_node_t.getCPtr(node));
-    switch_log_node_t ret = (cPtr == IntPtr.Zero) ? null : new switch_log_node_t(cPtr, false);
-    return ret;
-  }
-
-  public static void switch_log_node_free(SWIGTYPE_p_p_switch_log_node_t pnode) {
-    freeswitchPINVOKE.switch_log_node_free(SWIGTYPE_p_p_switch_log_node_t.getCPtr(pnode));
-  }
-
-  public static switch_xml switch_xml_parse_str_dynamic(string s, switch_bool_t dup) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_xml_parse_str_dynamic(s, (int)dup);
-    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-    return ret;
-  }
-
-  public static switch_xml switch_xml_parse_str(string s, SWIGTYPE_p_switch_size_t len) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_xml_parse_str(s, SWIGTYPE_p_switch_size_t.getCPtr(len));
-    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static switch_xml switch_xml_parse_fd(int fd) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_xml_parse_fd(fd);
-    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-    return ret;
-  }
-
-  public static switch_xml switch_xml_parse_file(string file) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_xml_parse_file(file);
-    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-    return ret;
-  }
-
-  public static switch_xml switch_xml_parse_file_simple(string file) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_xml_parse_file_simple(file);
-    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-    return ret;
-  }
-
-  public static switch_xml switch_xml_parse_fp(SWIGTYPE_p_FILE fp) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_xml_parse_fp(SWIGTYPE_p_FILE.getCPtr(fp));
-    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-    return ret;
-  }
-
-  public static switch_xml switch_xml_child(switch_xml xml, string name) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_xml_child(switch_xml.getCPtr(xml), name);
-    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-    return ret;
-  }
-
-  public static switch_xml switch_xml_find_child(switch_xml node, string childname, string attrname, string value) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_xml_find_child(switch_xml.getCPtr(node), childname, attrname, value);
-    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-    return ret;
-  }
-
-  public static switch_xml switch_xml_find_child_multi(switch_xml node, string childname) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_xml_find_child_multi(switch_xml.getCPtr(node), childname);
-    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-    return ret;
-  }
-
-  public static string switch_xml_attr(switch_xml xml, string attr) {
-    string ret = freeswitchPINVOKE.switch_xml_attr(switch_xml.getCPtr(xml), attr);
-    return ret;
-  }
-
-  public static string switch_xml_attr_soft(switch_xml xml, string attr) {
-    string ret = freeswitchPINVOKE.switch_xml_attr_soft(switch_xml.getCPtr(xml), attr);
-    return ret;
-  }
-
-  public static switch_xml switch_xml_get(switch_xml xml) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_xml_get(switch_xml.getCPtr(xml));
-    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-    return ret;
-  }
-
-  public static string switch_xml_toxml(switch_xml xml, switch_bool_t prn_header) {
-    string ret = freeswitchPINVOKE.switch_xml_toxml(switch_xml.getCPtr(xml), (int)prn_header);
-    return ret;
-  }
-
-  public static string switch_xml_toxml_buf(switch_xml xml, string buf, SWIGTYPE_p_switch_size_t buflen, SWIGTYPE_p_switch_size_t offset, switch_bool_t prn_header) {
-    string ret = freeswitchPINVOKE.switch_xml_toxml_buf(switch_xml.getCPtr(xml), buf, SWIGTYPE_p_switch_size_t.getCPtr(buflen), SWIGTYPE_p_switch_size_t.getCPtr(offset), (int)prn_header);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static void switch_xml_free(switch_xml xml) {
-    freeswitchPINVOKE.switch_xml_free(switch_xml.getCPtr(xml));
-  }
-
-  public static void switch_xml_free_in_thread(switch_xml xml, int stacksize) {
-    freeswitchPINVOKE.switch_xml_free_in_thread(switch_xml.getCPtr(xml), stacksize);
-  }
-
-  public static string switch_xml_error(switch_xml xml) {
-    string ret = freeswitchPINVOKE.switch_xml_error(switch_xml.getCPtr(xml));
-    return ret;
-  }
-
-  public static switch_xml switch_xml_new(string name) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_xml_new(name);
-    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-    return ret;
-  }
-
-  public static switch_xml switch_xml_add_child(switch_xml xml, string name, SWIGTYPE_p_switch_size_t off) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_xml_add_child(switch_xml.getCPtr(xml), name, SWIGTYPE_p_switch_size_t.getCPtr(off));
-    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static switch_xml switch_xml_set_txt(switch_xml xml, string txt) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_xml_set_txt(switch_xml.getCPtr(xml), txt);
-    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-    return ret;
-  }
-
-  public static switch_xml switch_xml_set_attr(switch_xml xml, string name, string value) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_xml_set_attr(switch_xml.getCPtr(xml), name, value);
-    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-    return ret;
-  }
-
-  public static switch_xml switch_xml_set_flag(switch_xml xml, switch_xml_flag_t flag) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_xml_set_flag(switch_xml.getCPtr(xml), (int)flag);
-    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-    return ret;
-  }
-
-  public static switch_xml switch_xml_cut(switch_xml xml) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_xml_cut(switch_xml.getCPtr(xml));
-    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-    return ret;
-  }
-
-  public static switch_xml switch_xml_insert(switch_xml xml, switch_xml dest, SWIGTYPE_p_switch_size_t off) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_xml_insert(switch_xml.getCPtr(xml), switch_xml.getCPtr(dest), SWIGTYPE_p_switch_size_t.getCPtr(off));
-    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static switch_xml switch_xml_open_root(byte reload, ref string err) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_xml_open_root(reload, ref err);
-    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-    return ret;
-  }
-
-  public static switch_status_t switch_xml_init(SWIGTYPE_p_apr_pool_t pool, ref string err) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_init(SWIGTYPE_p_apr_pool_t.getCPtr(pool), ref err);
-    return ret;
-  }
-
-  public static switch_status_t switch_xml_destroy() {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_destroy();
-    return ret;
-  }
-
-  public static switch_xml switch_xml_root() {
-    IntPtr cPtr = freeswitchPINVOKE.switch_xml_root();
-    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-    return ret;
-  }
-
-  public static switch_status_t switch_xml_locate(string section, string tag_name, string key_name, string key_value, SWIGTYPE_p_p_switch_xml root, SWIGTYPE_p_p_switch_xml node, switch_event arg6, switch_bool_t clone) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_locate(section, tag_name, key_name, key_value, SWIGTYPE_p_p_switch_xml.getCPtr(root), SWIGTYPE_p_p_switch_xml.getCPtr(node), switch_event.getCPtr(arg6), (int)clone);
-    return ret;
-  }
-
-  public static switch_status_t switch_xml_locate_domain(string domain_name, switch_event arg1, SWIGTYPE_p_p_switch_xml root, SWIGTYPE_p_p_switch_xml domain) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_locate_domain(domain_name, switch_event.getCPtr(arg1), SWIGTYPE_p_p_switch_xml.getCPtr(root), SWIGTYPE_p_p_switch_xml.getCPtr(domain));
-    return ret;
-  }
-
-  public static switch_status_t switch_xml_locate_group(string group_name, string domain_name, SWIGTYPE_p_p_switch_xml root, SWIGTYPE_p_p_switch_xml domain, SWIGTYPE_p_p_switch_xml group, switch_event arg5) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_locate_group(group_name, domain_name, SWIGTYPE_p_p_switch_xml.getCPtr(root), SWIGTYPE_p_p_switch_xml.getCPtr(domain), SWIGTYPE_p_p_switch_xml.getCPtr(group), switch_event.getCPtr(arg5));
-    return ret;
-  }
-
-  public static switch_status_t switch_xml_locate_user(string key, string user_name, string domain_name, string ip, SWIGTYPE_p_p_switch_xml root, SWIGTYPE_p_p_switch_xml domain, SWIGTYPE_p_p_switch_xml user, SWIGTYPE_p_p_switch_xml ingroup, switch_event arg8) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_locate_user(key, user_name, domain_name, ip, SWIGTYPE_p_p_switch_xml.getCPtr(root), SWIGTYPE_p_p_switch_xml.getCPtr(domain), SWIGTYPE_p_p_switch_xml.getCPtr(user), SWIGTYPE_p_p_switch_xml.getCPtr(ingroup), switch_event.getCPtr(arg8));
-    return ret;
-  }
-
-  public static switch_status_t switch_xml_locate_user_in_domain(string user_name, switch_xml domain, SWIGTYPE_p_p_switch_xml user, SWIGTYPE_p_p_switch_xml ingroup) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_locate_user_in_domain(user_name, switch_xml.getCPtr(domain), SWIGTYPE_p_p_switch_xml.getCPtr(user), SWIGTYPE_p_p_switch_xml.getCPtr(ingroup));
-    return ret;
-  }
-
-  public static switch_xml switch_xml_open_cfg(string file_path, SWIGTYPE_p_p_switch_xml node, switch_event arg2) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_xml_open_cfg(file_path, SWIGTYPE_p_p_switch_xml.getCPtr(node), switch_event.getCPtr(arg2));
-    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-    return ret;
-  }
-
-  public static void switch_xml_set_binding_sections(SWIGTYPE_p_switch_xml_binding binding, uint sections) {
-    freeswitchPINVOKE.switch_xml_set_binding_sections(SWIGTYPE_p_switch_xml_binding.getCPtr(binding), sections);
-  }
-
-  public static void switch_xml_set_binding_user_data(SWIGTYPE_p_switch_xml_binding binding, SWIGTYPE_p_void user_data) {
-    freeswitchPINVOKE.switch_xml_set_binding_user_data(SWIGTYPE_p_switch_xml_binding.getCPtr(binding), SWIGTYPE_p_void.getCPtr(user_data));
-  }
-
-  public static uint switch_xml_get_binding_sections(SWIGTYPE_p_switch_xml_binding binding) {
-    uint ret = freeswitchPINVOKE.switch_xml_get_binding_sections(SWIGTYPE_p_switch_xml_binding.getCPtr(binding));
-    return ret;
-  }
-
-  public static SWIGTYPE_p_void switch_xml_get_binding_user_data(SWIGTYPE_p_switch_xml_binding binding) {
-    IntPtr cPtr = freeswitchPINVOKE.switch_xml_get_binding_user_data(SWIGTYPE_p_switch_xml_binding.getCPtr(binding));
-    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-    return ret;
-  }
-
-  public static switch_status_t switch_xml_bind_search_function_ret(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml function, uint sections, SWIGTYPE_p_void user_data, SWIGTYPE_p_p_switch_xml_binding ret_binding) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_bind_search_function_ret(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml.getCPtr(function), sections, SWIGTYPE_p_void.getCPtr(user_data), SWIGTYPE_p_p_switch_xml_binding.getCPtr(ret_binding));
-    return ret;
-  }
-
-  public static switch_status_t switch_xml_unbind_search_function(SWIGTYPE_p_p_switch_xml_binding binding) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_unbind_search_function(SWIGTYPE_p_p_switch_xml_binding.getCPtr(binding));
-    return ret;
-  }
-
-  public static switch_status_t switch_xml_unbind_search_function_ptr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml function) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_unbind_search_function_ptr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml.getCPtr(function));
-    return ret;
-  }
-
-  public static uint switch_xml_parse_section_string(string str) {
-    uint ret = freeswitchPINVOKE.switch_xml_parse_section_string(str);
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_add_outgoing_channel(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t outgoing_channel) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_outgoing_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t.getCPtr(outgoing_channel));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_add_receive_message(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t receive_message) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_receive_message(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t.getCPtr(receive_message));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_add_receive_event(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t receive_event) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_receive_event(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t.getCPtr(receive_event));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_add_state_change(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session__switch_status_t state_change) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_state_change(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(state_change));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_add_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t read_frame) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(read_frame));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_add_write_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t write_frame) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_write_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(write_frame));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_add_video_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t video_read_frame) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_video_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(video_read_frame));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_add_video_write_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t video_write_frame) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_video_write_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(video_write_frame));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_add_kill_channel(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t kill_channel) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_kill_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t.getCPtr(kill_channel));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_add_send_dtmf(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t send_dtmf) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_send_dtmf(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t.getCPtr(send_dtmf));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_add_recv_dtmf(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t recv_dtmf) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_recv_dtmf(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t.getCPtr(recv_dtmf));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_add_resurrect_session(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t resurrect_session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_resurrect_session(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t.getCPtr(resurrect_session));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_remove_outgoing_channel(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t outgoing_channel) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_outgoing_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t.getCPtr(outgoing_channel));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_remove_receive_message(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t receive_message) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_receive_message(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t.getCPtr(receive_message));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_remove_receive_event(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t receive_event) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_receive_event(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t.getCPtr(receive_event));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_remove_state_change(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session__switch_status_t state_change) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_state_change(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(state_change));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_remove_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t read_frame) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(read_frame));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_remove_write_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t write_frame) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_write_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(write_frame));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_remove_video_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t video_read_frame) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_video_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(video_read_frame));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_remove_video_write_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t video_write_frame) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_video_write_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(video_write_frame));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_remove_kill_channel(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t kill_channel) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_kill_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t.getCPtr(kill_channel));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_remove_send_dtmf(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t send_dtmf) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_send_dtmf(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t.getCPtr(send_dtmf));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_remove_recv_dtmf(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t recv_dtmf) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_recv_dtmf(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t.getCPtr(recv_dtmf));
-    return ret;
-  }
-
-  public static switch_status_t switch_core_event_hook_remove_resurrect_session(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t resurrect_session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_resurrect_session(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t.getCPtr(resurrect_session));
-    return ret;
-  }
-
-  public static uint switch_scheduler_add_task(SWIGTYPE_p_time_t task_runtime, SWIGTYPE_p_f_p_switch_scheduler_task__void func, string desc, string group, uint cmd_id, SWIGTYPE_p_void cmd_arg, uint flags) {
-    uint ret = freeswitchPINVOKE.switch_scheduler_add_task(SWIGTYPE_p_time_t.getCPtr(task_runtime), SWIGTYPE_p_f_p_switch_scheduler_task__void.getCPtr(func), desc, group, cmd_id, SWIGTYPE_p_void.getCPtr(cmd_arg), flags);
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    return ret;
-  }
-
-  public static uint switch_scheduler_del_task_id(uint task_id) {
-    uint ret = freeswitchPINVOKE.switch_scheduler_del_task_id(task_id);
-    return ret;
-  }
-
-  public static uint switch_scheduler_del_task_group(string group) {
-    uint ret = freeswitchPINVOKE.switch_scheduler_del_task_group(group);
-    return ret;
-  }
-
-  public static void switch_scheduler_task_thread_start() {
-    freeswitchPINVOKE.switch_scheduler_task_thread_start();
-  }
-
-  public static void switch_scheduler_task_thread_stop() {
-    freeswitchPINVOKE.switch_scheduler_task_thread_stop();
-  }
-
-  public static int switch_config_open_file(switch_config cfg, string file_path) {
-    int ret = freeswitchPINVOKE.switch_config_open_file(switch_config.getCPtr(cfg), file_path);
-    return ret;
-  }
-
-  public static void switch_config_close_file(switch_config cfg) {
-    freeswitchPINVOKE.switch_config_close_file(switch_config.getCPtr(cfg));
-  }
-
-  public static int switch_config_next_pair(switch_config cfg, ref string var, ref string val) {
-    int ret = freeswitchPINVOKE.switch_config_next_pair(switch_config.getCPtr(cfg), ref var, ref val);
-    return ret;
-  }
-
-  public static void consoleLog(string level_str, string msg) {
-    freeswitchPINVOKE.consoleLog(level_str, msg);
-  }
-
-  public static void consoleCleanLog(string msg) {
-    freeswitchPINVOKE.consoleCleanLog(msg);
-  }
-
-  public static void console_log(string level_str, string msg) {
-    freeswitchPINVOKE.console_log(level_str, msg);
-  }
-
-  public static void console_clean_log(string msg) {
-    freeswitchPINVOKE.console_clean_log(msg);
-  }
-
-  public static void msleep(uint ms) {
-    freeswitchPINVOKE.msleep(ms);
-  }
-
-  public static void bridge(CoreSession session_a, CoreSession session_b) {
-    freeswitchPINVOKE.bridge(CoreSession.getCPtr(session_a), CoreSession.getCPtr(session_b));
-    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-  }
-
-  public static switch_status_t hanguphook(SWIGTYPE_p_switch_core_session session) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.hanguphook(SWIGTYPE_p_switch_core_session.getCPtr(session));
-    return ret;
-  }
-
-  public static switch_status_t dtmf_callback(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_void input, switch_input_type_t itype, SWIGTYPE_p_void buf, uint buflen) {
-    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.dtmf_callback(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_void.getCPtr(input), (int)itype, SWIGTYPE_p_void.getCPtr(buf), buflen);
-    return ret;
-  }
-
-  public static readonly string FREESWITCH_PEN = freeswitchPINVOKE.FREESWITCH_PEN_get();
-  public static readonly string FREESWITCH_OID_PREFIX = freeswitchPINVOKE.FREESWITCH_OID_PREFIX_get();
-  public static readonly string FREESWITCH_ITAD = freeswitchPINVOKE.FREESWITCH_ITAD_get();
-  public static readonly int __EXTENSIONS__ = freeswitchPINVOKE.__EXTENSIONS___get();
-  public static readonly int __BSD_VISIBLE = freeswitchPINVOKE.__BSD_VISIBLE_get();
-  public static readonly string SWITCH_ENT_ORIGINATE_DELIM = freeswitchPINVOKE.SWITCH_ENT_ORIGINATE_DELIM_get();
-  public static readonly string SWITCH_BLANK_STRING = freeswitchPINVOKE.SWITCH_BLANK_STRING_get();
-  public static readonly string SWITCH_SEQ_ESC = freeswitchPINVOKE.SWITCH_SEQ_ESC_get();
-  public static readonly char SWITCH_SEQ_HOME_CHAR = freeswitchPINVOKE.SWITCH_SEQ_HOME_CHAR_get();
-  public static readonly string SWITCH_SEQ_HOME_CHAR_STR = freeswitchPINVOKE.SWITCH_SEQ_HOME_CHAR_STR_get();
-  public static readonly char SWITCH_SEQ_CLEARLINE_CHAR = freeswitchPINVOKE.SWITCH_SEQ_CLEARLINE_CHAR_get();
-  public static readonly string SWITCH_SEQ_CLEARLINE_CHAR_STR = freeswitchPINVOKE.SWITCH_SEQ_CLEARLINE_CHAR_STR_get();
-  public static readonly string SWITCH_SEQ_CLEARLINEEND_CHAR = freeswitchPINVOKE.SWITCH_SEQ_CLEARLINEEND_CHAR_get();
-  public static readonly char SWITCH_SEQ_CLEARSCR_CHAR0 = freeswitchPINVOKE.SWITCH_SEQ_CLEARSCR_CHAR0_get();
-  public static readonly char SWITCH_SEQ_CLEARSCR_CHAR1 = freeswitchPINVOKE.SWITCH_SEQ_CLEARSCR_CHAR1_get();
-  public static readonly string SWITCH_SEQ_CLEARSCR_CHAR = freeswitchPINVOKE.SWITCH_SEQ_CLEARSCR_CHAR_get();
-  public static readonly string SWITCH_SEQ_AND_COLOR = freeswitchPINVOKE.SWITCH_SEQ_AND_COLOR_get();
-  public static readonly string SWITCH_SEQ_END_COLOR = freeswitchPINVOKE.SWITCH_SEQ_END_COLOR_get();
-  public static readonly string SWITCH_SEQ_F_BLACK = freeswitchPINVOKE.SWITCH_SEQ_F_BLACK_get();
-  public static readonly string SWITCH_SEQ_F_RED = freeswitchPINVOKE.SWITCH_SEQ_F_RED_get();
-  public static readonly string SWITCH_SEQ_F_GREEN = freeswitchPINVOKE.SWITCH_SEQ_F_GREEN_get();
-  public static readonly string SWITCH_SEQ_F_YELLOW = freeswitchPINVOKE.SWITCH_SEQ_F_YELLOW_get();
-  public static readonly string SWITCH_SEQ_F_BLUE = freeswitchPINVOKE.SWITCH_SEQ_F_BLUE_get();
-  public static readonly string SWITCH_SEQ_F_MAGEN = freeswitchPINVOKE.SWITCH_SEQ_F_MAGEN_get();
-  public static readonly string SWITCH_SEQ_F_CYAN = freeswitchPINVOKE.SWITCH_SEQ_F_CYAN_get();
-  public static readonly string SWITCH_SEQ_F_WHITE = freeswitchPINVOKE.SWITCH_SEQ_F_WHITE_get();
-  public static readonly string SWITCH_SEQ_B_BLACK = freeswitchPINVOKE.SWITCH_SEQ_B_BLACK_get();
-  public static readonly string SWITCH_SEQ_B_RED = freeswitchPINVOKE.SWITCH_SEQ_B_RED_get();
-  public static readonly string SWITCH_SEQ_B_GREEN = freeswitchPINVOKE.SWITCH_SEQ_B_GREEN_get();
-  public static readonly string SWITCH_SEQ_B_YELLOW = freeswitchPINVOKE.SWITCH_SEQ_B_YELLOW_get();
-  public static readonly string SWITCH_SEQ_B_BLUE = freeswitchPINVOKE.SWITCH_SEQ_B_BLUE_get();
-  public static readonly string SWITCH_SEQ_B_MAGEN = freeswitchPINVOKE.SWITCH_SEQ_B_MAGEN_get();
-  public static readonly string SWITCH_SEQ_B_CYAN = freeswitchPINVOKE.SWITCH_SEQ_B_CYAN_get();
-  public static readonly string SWITCH_SEQ_B_WHITE = freeswitchPINVOKE.SWITCH_SEQ_B_WHITE_get();
-  public static readonly string SWITCH_SEQ_FBLACK = freeswitchPINVOKE.SWITCH_SEQ_FBLACK_get();
-  public static readonly string SWITCH_SEQ_FRED = freeswitchPINVOKE.SWITCH_SEQ_FRED_get();
-  public static readonly string SWITCH_SEQ_FGREEN = freeswitchPINVOKE.SWITCH_SEQ_FGREEN_get();
-  public static readonly string SWITCH_SEQ_FYELLOW = freeswitchPINVOKE.SWITCH_SEQ_FYELLOW_get();
-  public static readonly string SWITCH_SEQ_FBLUE = freeswitchPINVOKE.SWITCH_SEQ_FBLUE_get();
-  public static readonly string SWITCH_SEQ_FMAGEN = freeswitchPINVOKE.SWITCH_SEQ_FMAGEN_get();
-  public static readonly string SWITCH_SEQ_FCYAN = freeswitchPINVOKE.SWITCH_SEQ_FCYAN_get();
-  public static readonly string SWITCH_SEQ_FWHITE = freeswitchPINVOKE.SWITCH_SEQ_FWHITE_get();
-  public static readonly string SWITCH_SEQ_BBLACK = freeswitchPINVOKE.SWITCH_SEQ_BBLACK_get();
-  public static readonly string SWITCH_SEQ_BRED = freeswitchPINVOKE.SWITCH_SEQ_BRED_get();
-  public static readonly string SWITCH_SEQ_BGREEN = freeswitchPINVOKE.SWITCH_SEQ_BGREEN_get();
-  public static readonly string SWITCH_SEQ_BYELLOW = freeswitchPINVOKE.SWITCH_SEQ_BYELLOW_get();
-  public static readonly string SWITCH_SEQ_BBLUE = freeswitchPINVOKE.SWITCH_SEQ_BBLUE_get();
-  public static readonly string SWITCH_SEQ_BMAGEN = freeswitchPINVOKE.SWITCH_SEQ_BMAGEN_get();
-  public static readonly string SWITCH_SEQ_BCYAN = freeswitchPINVOKE.SWITCH_SEQ_BCYAN_get();
-  public static readonly string SWITCH_SEQ_BWHITE = freeswitchPINVOKE.SWITCH_SEQ_BWHITE_get();
-  public static readonly string SWITCH_SEQ_HOME = freeswitchPINVOKE.SWITCH_SEQ_HOME_get();
-  public static readonly string SWITCH_SEQ_CLEARLINE = freeswitchPINVOKE.SWITCH_SEQ_CLEARLINE_get();
-  public static readonly string SWITCH_SEQ_CLEARLINEEND = freeswitchPINVOKE.SWITCH_SEQ_CLEARLINEEND_get();
-  public static readonly string SWITCH_SEQ_CLEARSCR = freeswitchPINVOKE.SWITCH_SEQ_CLEARSCR_get();
-  public static readonly int SWITCH_DEFAULT_DTMF_DURATION = freeswitchPINVOKE.SWITCH_DEFAULT_DTMF_DURATION_get();
-  public static readonly int SWITCH_MIN_DTMF_DURATION = freeswitchPINVOKE.SWITCH_MIN_DTMF_DURATION_get();
-  public static readonly int SWITCH_MAX_DTMF_DURATION = freeswitchPINVOKE.SWITCH_MAX_DTMF_DURATION_get();
-  public static readonly string SWITCH_PATH_SEPARATOR = freeswitchPINVOKE.SWITCH_PATH_SEPARATOR_get();
-  public static readonly string SWITCH_URL_SEPARATOR = freeswitchPINVOKE.SWITCH_URL_SEPARATOR_get();
-  public static readonly string SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE = freeswitchPINVOKE.SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE_get();
-  public static readonly string SWITCH_AUDIO_SPOOL_PATH_VARIABLE = freeswitchPINVOKE.SWITCH_AUDIO_SPOOL_PATH_VARIABLE_get();
-  public static readonly string SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE = freeswitchPINVOKE.SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE_get();
-  public static readonly string SWITCH_READ_TERMINATOR_USED_VARIABLE = freeswitchPINVOKE.SWITCH_READ_TERMINATOR_USED_VARIABLE_get();
-  public static readonly string SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE = freeswitchPINVOKE.SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE_get();
-  public static readonly string SWITCH_CURRENT_APPLICATION_VARIABLE = freeswitchPINVOKE.SWITCH_CURRENT_APPLICATION_VARIABLE_get();
-  public static readonly string SWITCH_CURRENT_APPLICATION_DATA_VARIABLE = freeswitchPINVOKE.SWITCH_CURRENT_APPLICATION_DATA_VARIABLE_get();
-  public static readonly string SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE = freeswitchPINVOKE.SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE_get();
-  public static readonly string SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE = freeswitchPINVOKE.SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get();
-  public static readonly string SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE_get();
-  public static readonly string SWITCH_READ_RESULT_VARIABLE = freeswitchPINVOKE.SWITCH_READ_RESULT_VARIABLE_get();
-  public static readonly string SWITCH_COPY_XML_CDR_VARIABLE = freeswitchPINVOKE.SWITCH_COPY_XML_CDR_VARIABLE_get();
-  public static readonly string SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE = freeswitchPINVOKE.SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE_get();
-  public static readonly string SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE_get();
-  public static readonly string SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE_get();
-  public static readonly string SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE_get();
-  public static readonly string SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE_get();
-  public static readonly string SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get();
-  public static readonly string SWITCH_CALL_TIMEOUT_VARIABLE = freeswitchPINVOKE.SWITCH_CALL_TIMEOUT_VARIABLE_get();
-  public static readonly string SWITCH_HOLDING_UUID_VARIABLE = freeswitchPINVOKE.SWITCH_HOLDING_UUID_VARIABLE_get();
-  public static readonly string SWITCH_SOFT_HOLDING_UUID_VARIABLE = freeswitchPINVOKE.SWITCH_SOFT_HOLDING_UUID_VARIABLE_get();
-  public static readonly string SWITCH_API_BRIDGE_END_VARIABLE = freeswitchPINVOKE.SWITCH_API_BRIDGE_END_VARIABLE_get();
-  public static readonly string SWITCH_API_HANGUP_HOOK_VARIABLE = freeswitchPINVOKE.SWITCH_API_HANGUP_HOOK_VARIABLE_get();
-  public static readonly string SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE = freeswitchPINVOKE.SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE_get();
-  public static readonly string SWITCH_PROCESS_CDR_VARIABLE = freeswitchPINVOKE.SWITCH_PROCESS_CDR_VARIABLE_get();
-  public static readonly string SWITCH_BRIDGE_CHANNEL_VARIABLE = freeswitchPINVOKE.SWITCH_BRIDGE_CHANNEL_VARIABLE_get();
-  public static readonly string SWITCH_CHANNEL_NAME_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_NAME_VARIABLE_get();
-  public static readonly string SWITCH_BRIDGE_UUID_VARIABLE = freeswitchPINVOKE.SWITCH_BRIDGE_UUID_VARIABLE_get();
-  public static readonly string SWITCH_CONTINUE_ON_FAILURE_VARIABLE = freeswitchPINVOKE.SWITCH_CONTINUE_ON_FAILURE_VARIABLE_get();
-  public static readonly string SWITCH_PLAYBACK_TERMINATORS_VARIABLE = freeswitchPINVOKE.SWITCH_PLAYBACK_TERMINATORS_VARIABLE_get();
-  public static readonly string SWITCH_PLAYBACK_TERMINATOR_USED = freeswitchPINVOKE.SWITCH_PLAYBACK_TERMINATOR_USED_get();
-  public static readonly string SWITCH_CACHE_SPEECH_HANDLES_VARIABLE = freeswitchPINVOKE.SWITCH_CACHE_SPEECH_HANDLES_VARIABLE_get();
-  public static readonly string SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME = freeswitchPINVOKE.SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME_get();
-  public static readonly string SWITCH_BYPASS_MEDIA_VARIABLE = freeswitchPINVOKE.SWITCH_BYPASS_MEDIA_VARIABLE_get();
-  public static readonly string SWITCH_PROXY_MEDIA_VARIABLE = freeswitchPINVOKE.SWITCH_PROXY_MEDIA_VARIABLE_get();
-  public static readonly string SWITCH_ENDPOINT_DISPOSITION_VARIABLE = freeswitchPINVOKE.SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get();
-  public static readonly string SWITCH_HOLD_MUSIC_VARIABLE = freeswitchPINVOKE.SWITCH_HOLD_MUSIC_VARIABLE_get();
-  public static readonly string SWITCH_EXPORT_VARS_VARIABLE = freeswitchPINVOKE.SWITCH_EXPORT_VARS_VARIABLE_get();
-  public static readonly string SWITCH_R_SDP_VARIABLE = freeswitchPINVOKE.SWITCH_R_SDP_VARIABLE_get();
-  public static readonly string SWITCH_L_SDP_VARIABLE = freeswitchPINVOKE.SWITCH_L_SDP_VARIABLE_get();
-  public static readonly string SWITCH_B_SDP_VARIABLE = freeswitchPINVOKE.SWITCH_B_SDP_VARIABLE_get();
-  public static readonly string SWITCH_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_BRIDGE_VARIABLE_get();
-  public static readonly string SWITCH_SIGNAL_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_SIGNAL_BRIDGE_VARIABLE_get();
-  public static readonly string SWITCH_SIGNAL_BOND_VARIABLE = freeswitchPINVOKE.SWITCH_SIGNAL_BOND_VARIABLE_get();
-  public static readonly string SWITCH_ORIGINATOR_VARIABLE = freeswitchPINVOKE.SWITCH_ORIGINATOR_VARIABLE_get();
-  public static readonly string SWITCH_ORIGINATOR_CODEC_VARIABLE = freeswitchPINVOKE.SWITCH_ORIGINATOR_CODEC_VARIABLE_get();
-  public static readonly string SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE = freeswitchPINVOKE.SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE_get();
-  public static readonly string SWITCH_LOCAL_MEDIA_IP_VARIABLE = freeswitchPINVOKE.SWITCH_LOCAL_MEDIA_IP_VARIABLE_get();
-  public static readonly string SWITCH_LOCAL_MEDIA_PORT_VARIABLE = freeswitchPINVOKE.SWITCH_LOCAL_MEDIA_PORT_VARIABLE_get();
-  public static readonly string SWITCH_REMOTE_MEDIA_IP_VARIABLE = freeswitchPINVOKE.SWITCH_REMOTE_MEDIA_IP_VARIABLE_get();
-  public static readonly string SWITCH_REMOTE_MEDIA_PORT_VARIABLE = freeswitchPINVOKE.SWITCH_REMOTE_MEDIA_PORT_VARIABLE_get();
-  public static readonly string SWITCH_REMOTE_VIDEO_IP_VARIABLE = freeswitchPINVOKE.SWITCH_REMOTE_VIDEO_IP_VARIABLE_get();
-  public static readonly string SWITCH_REMOTE_VIDEO_PORT_VARIABLE = freeswitchPINVOKE.SWITCH_REMOTE_VIDEO_PORT_VARIABLE_get();
-  public static readonly string SWITCH_LOCAL_VIDEO_IP_VARIABLE = freeswitchPINVOKE.SWITCH_LOCAL_VIDEO_IP_VARIABLE_get();
-  public static readonly string SWITCH_LOCAL_VIDEO_PORT_VARIABLE = freeswitchPINVOKE.SWITCH_LOCAL_VIDEO_PORT_VARIABLE_get();
-  public static readonly string SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE_get();
-  public static readonly string SWITCH_PARK_AFTER_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_PARK_AFTER_BRIDGE_VARIABLE_get();
-  public static readonly string SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE_get();
-  public static readonly string SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE = freeswitchPINVOKE.SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE_get();
-  public static readonly string SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE = freeswitchPINVOKE.SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE_get();
-  public static readonly string SWITCH_MAX_FORWARDS_VARIABLE = freeswitchPINVOKE.SWITCH_MAX_FORWARDS_VARIABLE_get();
-  public static readonly string SWITCH_DISABLE_APP_LOG_VARIABLE = freeswitchPINVOKE.SWITCH_DISABLE_APP_LOG_VARIABLE_get();
-  public static readonly string SWITCH_SPEECH_KEY = freeswitchPINVOKE.SWITCH_SPEECH_KEY_get();
-  public static readonly string SWITCH_UUID_BRIDGE = freeswitchPINVOKE.SWITCH_UUID_BRIDGE_get();
-  public static readonly int SWITCH_BITS_PER_BYTE = freeswitchPINVOKE.SWITCH_BITS_PER_BYTE_get();
-  public static readonly int SWITCH_DEFAULT_FILE_BUFFER_LEN = freeswitchPINVOKE.SWITCH_DEFAULT_FILE_BUFFER_LEN_get();
-  public static readonly int SWITCH_DTMF_LOG_LEN = freeswitchPINVOKE.SWITCH_DTMF_LOG_LEN_get();
-  public static readonly int SWITCH_MAX_STACKS = freeswitchPINVOKE.SWITCH_MAX_STACKS_get();
-  public static readonly int SWITCH_THREAD_STACKSIZE = freeswitchPINVOKE.SWITCH_THREAD_STACKSIZE_get();
-  public static readonly int SWITCH_SYSTEM_THREAD_STACKSIZE = freeswitchPINVOKE.SWITCH_SYSTEM_THREAD_STACKSIZE_get();
-  public static readonly int SWITCH_MAX_INTERVAL = freeswitchPINVOKE.SWITCH_MAX_INTERVAL_get();
-  public static readonly int SWITCH_INTERVAL_PAD = freeswitchPINVOKE.SWITCH_INTERVAL_PAD_get();
-  public static readonly int SWITCH_MAX_SAMPLE_LEN = freeswitchPINVOKE.SWITCH_MAX_SAMPLE_LEN_get();
-  public static readonly int SWITCH_BYTES_PER_SAMPLE = freeswitchPINVOKE.SWITCH_BYTES_PER_SAMPLE_get();
-  public static readonly int SWITCH_RECOMMENDED_BUFFER_SIZE = freeswitchPINVOKE.SWITCH_RECOMMENDED_BUFFER_SIZE_get();
-  public static readonly int SWITCH_MAX_CODECS = freeswitchPINVOKE.SWITCH_MAX_CODECS_get();
-  public static readonly int SWITCH_MAX_STATE_HANDLERS = freeswitchPINVOKE.SWITCH_MAX_STATE_HANDLERS_get();
-  public static readonly int SWITCH_CORE_QUEUE_LEN = freeswitchPINVOKE.SWITCH_CORE_QUEUE_LEN_get();
-  public static readonly int SWITCH_MAX_MANAGEMENT_BUFFER_LEN = freeswitchPINVOKE.SWITCH_MAX_MANAGEMENT_BUFFER_LEN_get();
-  public static readonly int SWITCH_RTP_CNG_PAYLOAD = freeswitchPINVOKE.SWITCH_RTP_CNG_PAYLOAD_get();
-  public static readonly int SWITCH_API_VERSION = freeswitchPINVOKE.SWITCH_API_VERSION_get();
-  public static readonly int SWITCH_CORE_DB_OK = freeswitchPINVOKE.SWITCH_CORE_DB_OK_get();
-  public static readonly int SWITCH_CORE_DB_ERROR = freeswitchPINVOKE.SWITCH_CORE_DB_ERROR_get();
-  public static readonly int SWITCH_CORE_DB_INTERNAL = freeswitchPINVOKE.SWITCH_CORE_DB_INTERNAL_get();
-  public static readonly int SWITCH_CORE_DB_PERM = freeswitchPINVOKE.SWITCH_CORE_DB_PERM_get();
-  public static readonly int SWITCH_CORE_DB_ABORT = freeswitchPINVOKE.SWITCH_CORE_DB_ABORT_get();
-  public static readonly int SWITCH_CORE_DB_BUSY = freeswitchPINVOKE.SWITCH_CORE_DB_BUSY_get();
-  public static readonly int SWITCH_CORE_DB_LOCKED = freeswitchPINVOKE.SWITCH_CORE_DB_LOCKED_get();
-  public static readonly int SWITCH_CORE_DB_NOMEM = freeswitchPINVOKE.SWITCH_CORE_DB_NOMEM_get();
-  public static readonly int SWITCH_CORE_DB_READONLY = freeswitchPINVOKE.SWITCH_CORE_DB_READONLY_get();
-  public static readonly int SWITCH_CORE_DB_INTERRUPT = freeswitchPINVOKE.SWITCH_CORE_DB_INTERRUPT_get();
-  public static readonly int SWITCH_CORE_DB_IOERR = freeswitchPINVOKE.SWITCH_CORE_DB_IOERR_get();
-  public static readonly int SWITCH_CORE_DB_CORRUPT = freeswitchPINVOKE.SWITCH_CORE_DB_CORRUPT_get();
-  public static readonly int SWITCH_CORE_DB_NOTFOUND = freeswitchPINVOKE.SWITCH_CORE_DB_NOTFOUND_get();
-  public static readonly int SWITCH_CORE_DB_FULL = freeswitchPINVOKE.SWITCH_CORE_DB_FULL_get();
-  public static readonly int SWITCH_CORE_DB_CANTOPEN = freeswitchPINVOKE.SWITCH_CORE_DB_CANTOPEN_get();
-  public static readonly int SWITCH_CORE_DB_PROTOCOL = freeswitchPINVOKE.SWITCH_CORE_DB_PROTOCOL_get();
-  public static readonly int SWITCH_CORE_DB_EMPTY = freeswitchPINVOKE.SWITCH_CORE_DB_EMPTY_get();
-  public static readonly int SWITCH_CORE_DB_SCHEMA = freeswitchPINVOKE.SWITCH_CORE_DB_SCHEMA_get();
-  public static readonly int SWITCH_CORE_DB_TOOBIG = freeswitchPINVOKE.SWITCH_CORE_DB_TOOBIG_get();
-  public static readonly int SWITCH_CORE_DB_CONSTRAINT = freeswitchPINVOKE.SWITCH_CORE_DB_CONSTRAINT_get();
-  public static readonly int SWITCH_CORE_DB_MISMATCH = freeswitchPINVOKE.SWITCH_CORE_DB_MISMATCH_get();
-  public static readonly int SWITCH_CORE_DB_MISUSE = freeswitchPINVOKE.SWITCH_CORE_DB_MISUSE_get();
-  public static readonly int SWITCH_CORE_DB_NOLFS = freeswitchPINVOKE.SWITCH_CORE_DB_NOLFS_get();
-  public static readonly int SWITCH_CORE_DB_AUTH = freeswitchPINVOKE.SWITCH_CORE_DB_AUTH_get();
-  public static readonly int SWITCH_CORE_DB_FORMAT = freeswitchPINVOKE.SWITCH_CORE_DB_FORMAT_get();
-  public static readonly int SWITCH_CORE_DB_RANGE = freeswitchPINVOKE.SWITCH_CORE_DB_RANGE_get();
-  public static readonly int SWITCH_CORE_DB_NOTADB = freeswitchPINVOKE.SWITCH_CORE_DB_NOTADB_get();
-  public static readonly int SWITCH_CORE_DB_ROW = freeswitchPINVOKE.SWITCH_CORE_DB_ROW_get();
-  public static readonly int SWITCH_CORE_DB_DONE = freeswitchPINVOKE.SWITCH_CORE_DB_DONE_get();
-  public static readonly int SWITCH_MAX_CORE_THREAD_SESSION_OBJS = freeswitchPINVOKE.SWITCH_MAX_CORE_THREAD_SESSION_OBJS_get();
-  public static readonly int SWITCH_MAX_STREAMS = freeswitchPINVOKE.SWITCH_MAX_STREAMS_get();
-  public static readonly int MESSAGE_STRING_ARG_MAX = freeswitchPINVOKE.MESSAGE_STRING_ARG_MAX_get();
-  public static readonly int CACHE_DB_LEN = freeswitchPINVOKE.CACHE_DB_LEN_get();
-  public static readonly int SWITCH_CMD_CHUNK_LEN = freeswitchPINVOKE.SWITCH_CMD_CHUNK_LEN_get();
-  public static readonly int SWITCH_SMAX = freeswitchPINVOKE.SWITCH_SMAX_get();
-  public static readonly int SWITCH_SMIN = freeswitchPINVOKE.SWITCH_SMIN_get();
-  public static readonly int SWITCH_RESAMPLE_QUALITY = freeswitchPINVOKE.SWITCH_RESAMPLE_QUALITY_get();
-  public static readonly int SWITCH_RTP_MAX_BUF_LEN = freeswitchPINVOKE.SWITCH_RTP_MAX_BUF_LEN_get();
-  public static readonly int SWITCH_RTP_MAX_CRYPTO_LEN = freeswitchPINVOKE.SWITCH_RTP_MAX_CRYPTO_LEN_get();
-  public static readonly int SWITCH_RTP_KEY_LEN = freeswitchPINVOKE.SWITCH_RTP_KEY_LEN_get();
-  public static readonly string SWITCH_RTP_CRYPTO_KEY_32 = freeswitchPINVOKE.SWITCH_RTP_CRYPTO_KEY_32_get();
-  public static readonly string SWITCH_RTP_CRYPTO_KEY_80 = freeswitchPINVOKE.SWITCH_RTP_CRYPTO_KEY_80_get();
-  public static readonly int SWITCH_XML_BUFSIZE = freeswitchPINVOKE.SWITCH_XML_BUFSIZE_get();
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-class freeswitchPINVOKE {
-
-  protected class SWIGExceptionHelper {
-
-    public delegate void ExceptionDelegate(string message);
-    public delegate void ExceptionArgumentDelegate(string message, string paramName);
-
-    static ExceptionDelegate applicationDelegate = new ExceptionDelegate(SetPendingApplicationException);
-    static ExceptionDelegate arithmeticDelegate = new ExceptionDelegate(SetPendingArithmeticException);
-    static ExceptionDelegate divideByZeroDelegate = new ExceptionDelegate(SetPendingDivideByZeroException);
-    static ExceptionDelegate indexOutOfRangeDelegate = new ExceptionDelegate(SetPendingIndexOutOfRangeException);
-    static ExceptionDelegate invalidCastDelegate = new ExceptionDelegate(SetPendingInvalidCastException);
-    static ExceptionDelegate invalidOperationDelegate = new ExceptionDelegate(SetPendingInvalidOperationException);
-    static ExceptionDelegate ioDelegate = new ExceptionDelegate(SetPendingIOException);
-    static ExceptionDelegate nullReferenceDelegate = new ExceptionDelegate(SetPendingNullReferenceException);
-    static ExceptionDelegate outOfMemoryDelegate = new ExceptionDelegate(SetPendingOutOfMemoryException);
-    static ExceptionDelegate overflowDelegate = new ExceptionDelegate(SetPendingOverflowException);
-    static ExceptionDelegate systemDelegate = new ExceptionDelegate(SetPendingSystemException);
-
-    static ExceptionArgumentDelegate argumentDelegate = new ExceptionArgumentDelegate(SetPendingArgumentException);
-    static ExceptionArgumentDelegate argumentNullDelegate = new ExceptionArgumentDelegate(SetPendingArgumentNullException);
-    static ExceptionArgumentDelegate argumentOutOfRangeDelegate = new ExceptionArgumentDelegate(SetPendingArgumentOutOfRangeException);
-
-    [DllImport("mod_managed", EntryPoint="SWIGRegisterExceptionCallbacks_freeswitch")]
-    public static extern void SWIGRegisterExceptionCallbacks_freeswitch(
-                                ExceptionDelegate applicationDelegate,
-                                ExceptionDelegate arithmeticDelegate,
-                                ExceptionDelegate divideByZeroDelegate, 
-                                ExceptionDelegate indexOutOfRangeDelegate, 
-                                ExceptionDelegate invalidCastDelegate,
-                                ExceptionDelegate invalidOperationDelegate,
-                                ExceptionDelegate ioDelegate,
-                                ExceptionDelegate nullReferenceDelegate,
-                                ExceptionDelegate outOfMemoryDelegate, 
-                                ExceptionDelegate overflowDelegate, 
-                                ExceptionDelegate systemExceptionDelegate);
-
-    [DllImport("mod_managed", EntryPoint="SWIGRegisterExceptionArgumentCallbacks_freeswitch")]
-    public static extern void SWIGRegisterExceptionCallbacksArgument_freeswitch(
-                                ExceptionArgumentDelegate argumentDelegate,
-                                ExceptionArgumentDelegate argumentNullDelegate,
-                                ExceptionArgumentDelegate argumentOutOfRangeDelegate);
-
-    static void SetPendingApplicationException(string message) {
-      SWIGPendingException.Set(new System.ApplicationException(message, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingArithmeticException(string message) {
-      SWIGPendingException.Set(new System.ArithmeticException(message, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingDivideByZeroException(string message) {
-      SWIGPendingException.Set(new System.DivideByZeroException(message, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingIndexOutOfRangeException(string message) {
-      SWIGPendingException.Set(new System.IndexOutOfRangeException(message, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingInvalidCastException(string message) {
-      SWIGPendingException.Set(new System.InvalidCastException(message, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingInvalidOperationException(string message) {
-      SWIGPendingException.Set(new System.InvalidOperationException(message, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingIOException(string message) {
-      SWIGPendingException.Set(new System.IO.IOException(message, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingNullReferenceException(string message) {
-      SWIGPendingException.Set(new System.NullReferenceException(message, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingOutOfMemoryException(string message) {
-      SWIGPendingException.Set(new System.OutOfMemoryException(message, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingOverflowException(string message) {
-      SWIGPendingException.Set(new System.OverflowException(message, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingSystemException(string message) {
-      SWIGPendingException.Set(new System.SystemException(message, SWIGPendingException.Retrieve()));
-    }
-
-    static void SetPendingArgumentException(string message, string paramName) {
-      SWIGPendingException.Set(new System.ArgumentException(message, paramName, SWIGPendingException.Retrieve()));
-    }
-    static void SetPendingArgumentNullException(string message, string paramName) {
-      Exception e = SWIGPendingException.Retrieve();
-      if (e != null) message = message + " Inner Exception: " + e.Message;
-      SWIGPendingException.Set(new System.ArgumentNullException(paramName, message));
-    }
-    static void SetPendingArgumentOutOfRangeException(string message, string paramName) {
-      Exception e = SWIGPendingException.Retrieve();
-      if (e != null) message = message + " Inner Exception: " + e.Message;
-      SWIGPendingException.Set(new System.ArgumentOutOfRangeException(paramName, message));
-    }
-
-    static SWIGExceptionHelper() {
-      SWIGRegisterExceptionCallbacks_freeswitch(
-                                applicationDelegate,
-                                arithmeticDelegate,
-                                divideByZeroDelegate,
-                                indexOutOfRangeDelegate,
-                                invalidCastDelegate,
-                                invalidOperationDelegate,
-                                ioDelegate,
-                                nullReferenceDelegate,
-                                outOfMemoryDelegate,
-                                overflowDelegate,
-                                systemDelegate);
-
-      SWIGRegisterExceptionCallbacksArgument_freeswitch(
-                                argumentDelegate,
-                                argumentNullDelegate,
-                                argumentOutOfRangeDelegate);
-    }
-  }
-
-  protected static SWIGExceptionHelper swigExceptionHelper = new SWIGExceptionHelper();
-
-  public class SWIGPendingException {
-    [ThreadStatic]
-    private static Exception pendingException = null;
-    private static int numExceptionsPending = 0;
-
-    public static bool Pending {
-      get {
-        bool pending = false;
-        if (numExceptionsPending > 0)
-          if (pendingException != null)
-            pending = true;
-        return pending;
-      } 
-    }
-
-    public static void Set(Exception e) {
-      if (pendingException != null)
-        throw new ApplicationException("FATAL: An earlier pending exception from unmanaged code was missed and thus not thrown (" + pendingException.ToString() + ")", e);
-      pendingException = e;
-      lock(typeof(freeswitchPINVOKE)) {
-        numExceptionsPending++;
-      }
-    }
-
-    public static Exception Retrieve() {
-      Exception e = null;
-      if (numExceptionsPending > 0) {
-        if (pendingException != null) {
-          e = pendingException;
-          pendingException = null;
-          lock(typeof(freeswitchPINVOKE)) {
-            numExceptionsPending--;
-          }
-        }
-      }
-      return e;
-    }
-  }
-
-
-
-  protected class SWIGStringHelper {
-
-    public delegate string SWIGStringDelegate(string message);
-    static SWIGStringDelegate stringDelegate = new SWIGStringDelegate(CreateString);
-
-    [DllImport("mod_managed", EntryPoint="SWIGRegisterStringCallback_freeswitch")]
-    public static extern void SWIGRegisterStringCallback_freeswitch(SWIGStringDelegate stringDelegate);
-
-    static string CreateString(string cString) {
-      return cString;
-    }
-
-    static SWIGStringHelper() {
-      SWIGRegisterStringCallback_freeswitch(stringDelegate);
-    }
-  }
-
-  static protected SWIGStringHelper swigStringHelper = new SWIGStringHelper();
-
-
-  [DllImport("mod_managed", EntryPoint="CSharp_FREESWITCH_PEN_get")]
-  public static extern string FREESWITCH_PEN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_FREESWITCH_OID_PREFIX_get")]
-  public static extern string FREESWITCH_OID_PREFIX_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_FREESWITCH_ITAD_get")]
-  public static extern string FREESWITCH_ITAD_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp___EXTENSIONS___get")]
-  public static extern int __EXTENSIONS___get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp___BSD_VISIBLE_get")]
-  public static extern int __BSD_VISIBLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ENT_ORIGINATE_DELIM_get")]
-  public static extern string SWITCH_ENT_ORIGINATE_DELIM_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BLANK_STRING_get")]
-  public static extern string SWITCH_BLANK_STRING_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_ESC_get")]
-  public static extern string SWITCH_SEQ_ESC_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_HOME_CHAR_get")]
-  public static extern char SWITCH_SEQ_HOME_CHAR_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_HOME_CHAR_STR_get")]
-  public static extern string SWITCH_SEQ_HOME_CHAR_STR_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_CLEARLINE_CHAR_get")]
-  public static extern char SWITCH_SEQ_CLEARLINE_CHAR_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_CLEARLINE_CHAR_STR_get")]
-  public static extern string SWITCH_SEQ_CLEARLINE_CHAR_STR_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_CLEARLINEEND_CHAR_get")]
-  public static extern string SWITCH_SEQ_CLEARLINEEND_CHAR_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_CLEARSCR_CHAR0_get")]
-  public static extern char SWITCH_SEQ_CLEARSCR_CHAR0_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_CLEARSCR_CHAR1_get")]
-  public static extern char SWITCH_SEQ_CLEARSCR_CHAR1_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_CLEARSCR_CHAR_get")]
-  public static extern string SWITCH_SEQ_CLEARSCR_CHAR_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_AND_COLOR_get")]
-  public static extern string SWITCH_SEQ_AND_COLOR_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_END_COLOR_get")]
-  public static extern string SWITCH_SEQ_END_COLOR_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_F_BLACK_get")]
-  public static extern string SWITCH_SEQ_F_BLACK_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_F_RED_get")]
-  public static extern string SWITCH_SEQ_F_RED_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_F_GREEN_get")]
-  public static extern string SWITCH_SEQ_F_GREEN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_F_YELLOW_get")]
-  public static extern string SWITCH_SEQ_F_YELLOW_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_F_BLUE_get")]
-  public static extern string SWITCH_SEQ_F_BLUE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_F_MAGEN_get")]
-  public static extern string SWITCH_SEQ_F_MAGEN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_F_CYAN_get")]
-  public static extern string SWITCH_SEQ_F_CYAN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_F_WHITE_get")]
-  public static extern string SWITCH_SEQ_F_WHITE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_B_BLACK_get")]
-  public static extern string SWITCH_SEQ_B_BLACK_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_B_RED_get")]
-  public static extern string SWITCH_SEQ_B_RED_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_B_GREEN_get")]
-  public static extern string SWITCH_SEQ_B_GREEN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_B_YELLOW_get")]
-  public static extern string SWITCH_SEQ_B_YELLOW_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_B_BLUE_get")]
-  public static extern string SWITCH_SEQ_B_BLUE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_B_MAGEN_get")]
-  public static extern string SWITCH_SEQ_B_MAGEN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_B_CYAN_get")]
-  public static extern string SWITCH_SEQ_B_CYAN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_B_WHITE_get")]
-  public static extern string SWITCH_SEQ_B_WHITE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_FBLACK_get")]
-  public static extern string SWITCH_SEQ_FBLACK_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_FRED_get")]
-  public static extern string SWITCH_SEQ_FRED_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_FGREEN_get")]
-  public static extern string SWITCH_SEQ_FGREEN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_FYELLOW_get")]
-  public static extern string SWITCH_SEQ_FYELLOW_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_FBLUE_get")]
-  public static extern string SWITCH_SEQ_FBLUE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_FMAGEN_get")]
-  public static extern string SWITCH_SEQ_FMAGEN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_FCYAN_get")]
-  public static extern string SWITCH_SEQ_FCYAN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_FWHITE_get")]
-  public static extern string SWITCH_SEQ_FWHITE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_BBLACK_get")]
-  public static extern string SWITCH_SEQ_BBLACK_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_BRED_get")]
-  public static extern string SWITCH_SEQ_BRED_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_BGREEN_get")]
-  public static extern string SWITCH_SEQ_BGREEN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_BYELLOW_get")]
-  public static extern string SWITCH_SEQ_BYELLOW_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_BBLUE_get")]
-  public static extern string SWITCH_SEQ_BBLUE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_BMAGEN_get")]
-  public static extern string SWITCH_SEQ_BMAGEN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_BCYAN_get")]
-  public static extern string SWITCH_SEQ_BCYAN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_BWHITE_get")]
-  public static extern string SWITCH_SEQ_BWHITE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_HOME_get")]
-  public static extern string SWITCH_SEQ_HOME_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_CLEARLINE_get")]
-  public static extern string SWITCH_SEQ_CLEARLINE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_CLEARLINEEND_get")]
-  public static extern string SWITCH_SEQ_CLEARLINEEND_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_CLEARSCR_get")]
-  public static extern string SWITCH_SEQ_CLEARSCR_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_DEFAULT_DTMF_DURATION_get")]
-  public static extern int SWITCH_DEFAULT_DTMF_DURATION_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MIN_DTMF_DURATION_get")]
-  public static extern int SWITCH_MIN_DTMF_DURATION_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_DTMF_DURATION_get")]
-  public static extern int SWITCH_MAX_DTMF_DURATION_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PATH_SEPARATOR_get")]
-  public static extern string SWITCH_PATH_SEPARATOR_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_URL_SEPARATOR_get")]
-  public static extern string SWITCH_URL_SEPARATOR_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE_get")]
-  public static extern string SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_AUDIO_SPOOL_PATH_VARIABLE_get")]
-  public static extern string SWITCH_AUDIO_SPOOL_PATH_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE_get")]
-  public static extern string SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_READ_TERMINATOR_USED_VARIABLE_get")]
-  public static extern string SWITCH_READ_TERMINATOR_USED_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE_get")]
-  public static extern string SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CURRENT_APPLICATION_VARIABLE_get")]
-  public static extern string SWITCH_CURRENT_APPLICATION_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CURRENT_APPLICATION_DATA_VARIABLE_get")]
-  public static extern string SWITCH_CURRENT_APPLICATION_DATA_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE_get")]
-  public static extern string SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get")]
-  public static extern string SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE_get")]
-  public static extern string SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_READ_RESULT_VARIABLE_get")]
-  public static extern string SWITCH_READ_RESULT_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_COPY_XML_CDR_VARIABLE_get")]
-  public static extern string SWITCH_COPY_XML_CDR_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE_get")]
-  public static extern string SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE_get")]
-  public static extern string SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE_get")]
-  public static extern string SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE_get")]
-  public static extern string SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE_get")]
-  public static extern string SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get")]
-  public static extern string SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CALL_TIMEOUT_VARIABLE_get")]
-  public static extern string SWITCH_CALL_TIMEOUT_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_HOLDING_UUID_VARIABLE_get")]
-  public static extern string SWITCH_HOLDING_UUID_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SOFT_HOLDING_UUID_VARIABLE_get")]
-  public static extern string SWITCH_SOFT_HOLDING_UUID_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_API_BRIDGE_END_VARIABLE_get")]
-  public static extern string SWITCH_API_BRIDGE_END_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_API_HANGUP_HOOK_VARIABLE_get")]
-  public static extern string SWITCH_API_HANGUP_HOOK_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE_get")]
-  public static extern string SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PROCESS_CDR_VARIABLE_get")]
-  public static extern string SWITCH_PROCESS_CDR_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BRIDGE_CHANNEL_VARIABLE_get")]
-  public static extern string SWITCH_BRIDGE_CHANNEL_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_NAME_VARIABLE_get")]
-  public static extern string SWITCH_CHANNEL_NAME_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BRIDGE_UUID_VARIABLE_get")]
-  public static extern string SWITCH_BRIDGE_UUID_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CONTINUE_ON_FAILURE_VARIABLE_get")]
-  public static extern string SWITCH_CONTINUE_ON_FAILURE_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PLAYBACK_TERMINATORS_VARIABLE_get")]
-  public static extern string SWITCH_PLAYBACK_TERMINATORS_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PLAYBACK_TERMINATOR_USED_get")]
-  public static extern string SWITCH_PLAYBACK_TERMINATOR_USED_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CACHE_SPEECH_HANDLES_VARIABLE_get")]
-  public static extern string SWITCH_CACHE_SPEECH_HANDLES_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME_get")]
-  public static extern string SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BYPASS_MEDIA_VARIABLE_get")]
-  public static extern string SWITCH_BYPASS_MEDIA_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PROXY_MEDIA_VARIABLE_get")]
-  public static extern string SWITCH_PROXY_MEDIA_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get")]
-  public static extern string SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_HOLD_MUSIC_VARIABLE_get")]
-  public static extern string SWITCH_HOLD_MUSIC_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_EXPORT_VARS_VARIABLE_get")]
-  public static extern string SWITCH_EXPORT_VARS_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_R_SDP_VARIABLE_get")]
-  public static extern string SWITCH_R_SDP_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_L_SDP_VARIABLE_get")]
-  public static extern string SWITCH_L_SDP_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_B_SDP_VARIABLE_get")]
-  public static extern string SWITCH_B_SDP_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BRIDGE_VARIABLE_get")]
-  public static extern string SWITCH_BRIDGE_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SIGNAL_BRIDGE_VARIABLE_get")]
-  public static extern string SWITCH_SIGNAL_BRIDGE_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SIGNAL_BOND_VARIABLE_get")]
-  public static extern string SWITCH_SIGNAL_BOND_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ORIGINATOR_VARIABLE_get")]
-  public static extern string SWITCH_ORIGINATOR_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ORIGINATOR_CODEC_VARIABLE_get")]
-  public static extern string SWITCH_ORIGINATOR_CODEC_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE_get")]
-  public static extern string SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_LOCAL_MEDIA_IP_VARIABLE_get")]
-  public static extern string SWITCH_LOCAL_MEDIA_IP_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_LOCAL_MEDIA_PORT_VARIABLE_get")]
-  public static extern string SWITCH_LOCAL_MEDIA_PORT_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_REMOTE_MEDIA_IP_VARIABLE_get")]
-  public static extern string SWITCH_REMOTE_MEDIA_IP_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_REMOTE_MEDIA_PORT_VARIABLE_get")]
-  public static extern string SWITCH_REMOTE_MEDIA_PORT_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_REMOTE_VIDEO_IP_VARIABLE_get")]
-  public static extern string SWITCH_REMOTE_VIDEO_IP_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_REMOTE_VIDEO_PORT_VARIABLE_get")]
-  public static extern string SWITCH_REMOTE_VIDEO_PORT_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_LOCAL_VIDEO_IP_VARIABLE_get")]
-  public static extern string SWITCH_LOCAL_VIDEO_IP_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_LOCAL_VIDEO_PORT_VARIABLE_get")]
-  public static extern string SWITCH_LOCAL_VIDEO_PORT_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE_get")]
-  public static extern string SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PARK_AFTER_BRIDGE_VARIABLE_get")]
-  public static extern string SWITCH_PARK_AFTER_BRIDGE_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE_get")]
-  public static extern string SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE_get")]
-  public static extern string SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE_get")]
-  public static extern string SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_FORWARDS_VARIABLE_get")]
-  public static extern string SWITCH_MAX_FORWARDS_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_DISABLE_APP_LOG_VARIABLE_get")]
-  public static extern string SWITCH_DISABLE_APP_LOG_VARIABLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SPEECH_KEY_get")]
-  public static extern string SWITCH_SPEECH_KEY_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_UUID_BRIDGE_get")]
-  public static extern string SWITCH_UUID_BRIDGE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BITS_PER_BYTE_get")]
-  public static extern int SWITCH_BITS_PER_BYTE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_DEFAULT_FILE_BUFFER_LEN_get")]
-  public static extern int SWITCH_DEFAULT_FILE_BUFFER_LEN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_DTMF_LOG_LEN_get")]
-  public static extern int SWITCH_DTMF_LOG_LEN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_digit_set")]
-  public static extern void switch_dtmf_t_digit_set(HandleRef jarg1, char jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_digit_get")]
-  public static extern char switch_dtmf_t_digit_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_duration_set")]
-  public static extern void switch_dtmf_t_duration_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_duration_get")]
-  public static extern uint switch_dtmf_t_duration_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_dtmf_t")]
-  public static extern IntPtr new_switch_dtmf_t();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_dtmf_t")]
-  public static extern void delete_switch_dtmf_t(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_buf_set")]
-  public static extern void switch_bitpack_t_buf_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_buf_get")]
-  public static extern IntPtr switch_bitpack_t_buf_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_buflen_set")]
-  public static extern void switch_bitpack_t_buflen_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_buflen_get")]
-  public static extern uint switch_bitpack_t_buflen_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_cur_set")]
-  public static extern void switch_bitpack_t_cur_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_cur_get")]
-  public static extern IntPtr switch_bitpack_t_cur_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_bytes_set")]
-  public static extern void switch_bitpack_t_bytes_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_bytes_get")]
-  public static extern uint switch_bitpack_t_bytes_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_bits_tot_set")]
-  public static extern void switch_bitpack_t_bits_tot_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_bits_tot_get")]
-  public static extern uint switch_bitpack_t_bits_tot_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_bits_cur_set")]
-  public static extern void switch_bitpack_t_bits_cur_set(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_bits_cur_get")]
-  public static extern byte switch_bitpack_t_bits_cur_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_bits_rem_set")]
-  public static extern void switch_bitpack_t_bits_rem_set(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_bits_rem_get")]
-  public static extern byte switch_bitpack_t_bits_rem_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_frame_bits_set")]
-  public static extern void switch_bitpack_t_frame_bits_set(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_frame_bits_get")]
-  public static extern byte switch_bitpack_t_frame_bits_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_shiftby_set")]
-  public static extern void switch_bitpack_t_shiftby_set(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_shiftby_get")]
-  public static extern byte switch_bitpack_t_shiftby_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_this_byte_set")]
-  public static extern void switch_bitpack_t_this_byte_set(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_this_byte_get")]
-  public static extern byte switch_bitpack_t_this_byte_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_under_set")]
-  public static extern void switch_bitpack_t_under_set(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_under_get")]
-  public static extern byte switch_bitpack_t_under_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_over_set")]
-  public static extern void switch_bitpack_t_over_set(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_over_get")]
-  public static extern byte switch_bitpack_t_over_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_mode_set")]
-  public static extern void switch_bitpack_t_mode_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_mode_get")]
-  public static extern int switch_bitpack_t_mode_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_bitpack_t")]
-  public static extern IntPtr new_switch_bitpack_t();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_bitpack_t")]
-  public static extern void delete_switch_bitpack_t(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_base_dir_set")]
-  public static extern void switch_directories_base_dir_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_base_dir_get")]
-  public static extern string switch_directories_base_dir_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_mod_dir_set")]
-  public static extern void switch_directories_mod_dir_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_mod_dir_get")]
-  public static extern string switch_directories_mod_dir_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_conf_dir_set")]
-  public static extern void switch_directories_conf_dir_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_conf_dir_get")]
-  public static extern string switch_directories_conf_dir_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_log_dir_set")]
-  public static extern void switch_directories_log_dir_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_log_dir_get")]
-  public static extern string switch_directories_log_dir_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_run_dir_set")]
-  public static extern void switch_directories_run_dir_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_run_dir_get")]
-  public static extern string switch_directories_run_dir_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_db_dir_set")]
-  public static extern void switch_directories_db_dir_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_db_dir_get")]
-  public static extern string switch_directories_db_dir_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_script_dir_set")]
-  public static extern void switch_directories_script_dir_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_script_dir_get")]
-  public static extern string switch_directories_script_dir_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_temp_dir_set")]
-  public static extern void switch_directories_temp_dir_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_temp_dir_get")]
-  public static extern string switch_directories_temp_dir_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_htdocs_dir_set")]
-  public static extern void switch_directories_htdocs_dir_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_htdocs_dir_get")]
-  public static extern string switch_directories_htdocs_dir_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_grammar_dir_set")]
-  public static extern void switch_directories_grammar_dir_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_grammar_dir_get")]
-  public static extern string switch_directories_grammar_dir_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_storage_dir_set")]
-  public static extern void switch_directories_storage_dir_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_storage_dir_get")]
-  public static extern string switch_directories_storage_dir_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_directories")]
-  public static extern IntPtr new_switch_directories();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_directories")]
-  public static extern void delete_switch_directories(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_GLOBAL_dirs_set")]
-  public static extern void SWITCH_GLOBAL_dirs_set(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_GLOBAL_dirs_get")]
-  public static extern IntPtr SWITCH_GLOBAL_dirs_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_STACKS_get")]
-  public static extern int SWITCH_MAX_STACKS_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_THREAD_STACKSIZE_get")]
-  public static extern int SWITCH_THREAD_STACKSIZE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SYSTEM_THREAD_STACKSIZE_get")]
-  public static extern int SWITCH_SYSTEM_THREAD_STACKSIZE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_INTERVAL_get")]
-  public static extern int SWITCH_MAX_INTERVAL_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_INTERVAL_PAD_get")]
-  public static extern int SWITCH_INTERVAL_PAD_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_SAMPLE_LEN_get")]
-  public static extern int SWITCH_MAX_SAMPLE_LEN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BYTES_PER_SAMPLE_get")]
-  public static extern int SWITCH_BYTES_PER_SAMPLE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RECOMMENDED_BUFFER_SIZE_get")]
-  public static extern int SWITCH_RECOMMENDED_BUFFER_SIZE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_CODECS_get")]
-  public static extern int SWITCH_MAX_CODECS_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_STATE_HANDLERS_get")]
-  public static extern int SWITCH_MAX_STATE_HANDLERS_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_QUEUE_LEN_get")]
-  public static extern int SWITCH_CORE_QUEUE_LEN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_MANAGEMENT_BUFFER_LEN_get")]
-  public static extern int SWITCH_MAX_MANAGEMENT_BUFFER_LEN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_raw_bytes_set")]
-  public static extern void switch_rtp_numbers_t_raw_bytes_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_raw_bytes_get")]
-  public static extern IntPtr switch_rtp_numbers_t_raw_bytes_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_media_bytes_set")]
-  public static extern void switch_rtp_numbers_t_media_bytes_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_media_bytes_get")]
-  public static extern IntPtr switch_rtp_numbers_t_media_bytes_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_packet_count_set")]
-  public static extern void switch_rtp_numbers_t_packet_count_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_packet_count_get")]
-  public static extern IntPtr switch_rtp_numbers_t_packet_count_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_media_packet_count_set")]
-  public static extern void switch_rtp_numbers_t_media_packet_count_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_media_packet_count_get")]
-  public static extern IntPtr switch_rtp_numbers_t_media_packet_count_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_skip_packet_count_set")]
-  public static extern void switch_rtp_numbers_t_skip_packet_count_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_skip_packet_count_get")]
-  public static extern IntPtr switch_rtp_numbers_t_skip_packet_count_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_jb_packet_count_set")]
-  public static extern void switch_rtp_numbers_t_jb_packet_count_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_jb_packet_count_get")]
-  public static extern IntPtr switch_rtp_numbers_t_jb_packet_count_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_dtmf_packet_count_set")]
-  public static extern void switch_rtp_numbers_t_dtmf_packet_count_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_dtmf_packet_count_get")]
-  public static extern IntPtr switch_rtp_numbers_t_dtmf_packet_count_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_cng_packet_count_set")]
-  public static extern void switch_rtp_numbers_t_cng_packet_count_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_cng_packet_count_get")]
-  public static extern IntPtr switch_rtp_numbers_t_cng_packet_count_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_flush_packet_count_set")]
-  public static extern void switch_rtp_numbers_t_flush_packet_count_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_flush_packet_count_get")]
-  public static extern IntPtr switch_rtp_numbers_t_flush_packet_count_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_rtp_numbers_t")]
-  public static extern IntPtr new_switch_rtp_numbers_t();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_rtp_numbers_t")]
-  public static extern void delete_switch_rtp_numbers_t(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_inbound_set")]
-  public static extern void switch_rtp_stats_t_inbound_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_inbound_get")]
-  public static extern IntPtr switch_rtp_stats_t_inbound_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_outbound_set")]
-  public static extern void switch_rtp_stats_t_outbound_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_outbound_get")]
-  public static extern IntPtr switch_rtp_stats_t_outbound_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_rtp_stats_t")]
-  public static extern IntPtr new_switch_rtp_stats_t();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_rtp_stats_t")]
-  public static extern void delete_switch_rtp_stats_t(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_CNG_PAYLOAD_get")]
-  public static extern int SWITCH_RTP_CNG_PAYLOAD_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_version_set")]
-  public static extern void switch_rtp_hdr_t_version_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_version_get")]
-  public static extern uint switch_rtp_hdr_t_version_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_p_set")]
-  public static extern void switch_rtp_hdr_t_p_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_p_get")]
-  public static extern uint switch_rtp_hdr_t_p_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_x_set")]
-  public static extern void switch_rtp_hdr_t_x_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_x_get")]
-  public static extern uint switch_rtp_hdr_t_x_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_cc_set")]
-  public static extern void switch_rtp_hdr_t_cc_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_cc_get")]
-  public static extern uint switch_rtp_hdr_t_cc_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_m_set")]
-  public static extern void switch_rtp_hdr_t_m_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_m_get")]
-  public static extern uint switch_rtp_hdr_t_m_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_pt_set")]
-  public static extern void switch_rtp_hdr_t_pt_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_pt_get")]
-  public static extern uint switch_rtp_hdr_t_pt_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_seq_set")]
-  public static extern void switch_rtp_hdr_t_seq_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_seq_get")]
-  public static extern uint switch_rtp_hdr_t_seq_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_ts_set")]
-  public static extern void switch_rtp_hdr_t_ts_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_ts_get")]
-  public static extern uint switch_rtp_hdr_t_ts_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_ssrc_set")]
-  public static extern void switch_rtp_hdr_t_ssrc_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_ssrc_get")]
-  public static extern uint switch_rtp_hdr_t_ssrc_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_rtp_hdr_t")]
-  public static extern IntPtr new_switch_rtp_hdr_t();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_rtp_hdr_t")]
-  public static extern void delete_switch_rtp_hdr_t(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38MaxBitRate_set")]
-  public static extern void switch_t38_options_t_T38MaxBitRate_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38MaxBitRate_get")]
-  public static extern uint switch_t38_options_t_T38MaxBitRate_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxFillBitRemoval_set")]
-  public static extern void switch_t38_options_t_T38FaxFillBitRemoval_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxFillBitRemoval_get")]
-  public static extern int switch_t38_options_t_T38FaxFillBitRemoval_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxTranscodingMMR_set")]
-  public static extern void switch_t38_options_t_T38FaxTranscodingMMR_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxTranscodingMMR_get")]
-  public static extern int switch_t38_options_t_T38FaxTranscodingMMR_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxTranscodingJBIG_set")]
-  public static extern void switch_t38_options_t_T38FaxTranscodingJBIG_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxTranscodingJBIG_get")]
-  public static extern int switch_t38_options_t_T38FaxTranscodingJBIG_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxRateManagement_set")]
-  public static extern void switch_t38_options_t_T38FaxRateManagement_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxRateManagement_get")]
-  public static extern string switch_t38_options_t_T38FaxRateManagement_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxMaxBuffer_set")]
-  public static extern void switch_t38_options_t_T38FaxMaxBuffer_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxMaxBuffer_get")]
-  public static extern uint switch_t38_options_t_T38FaxMaxBuffer_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxMaxDatagram_set")]
-  public static extern void switch_t38_options_t_T38FaxMaxDatagram_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxMaxDatagram_get")]
-  public static extern uint switch_t38_options_t_T38FaxMaxDatagram_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxUdpEC_set")]
-  public static extern void switch_t38_options_t_T38FaxUdpEC_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxUdpEC_get")]
-  public static extern string switch_t38_options_t_T38FaxUdpEC_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38VendorInfo_set")]
-  public static extern void switch_t38_options_t_T38VendorInfo_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38VendorInfo_get")]
-  public static extern string switch_t38_options_t_T38VendorInfo_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_ip_set")]
-  public static extern void switch_t38_options_t_ip_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_ip_get")]
-  public static extern string switch_t38_options_t_ip_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_port_set")]
-  public static extern void switch_t38_options_t_port_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_port_get")]
-  public static extern uint switch_t38_options_t_port_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_t38_options_t")]
-  public static extern IntPtr new_switch_t38_options_t();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_t38_options_t")]
-  public static extern void delete_switch_t38_options_t(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_input_callback_set")]
-  public static extern void switch_input_args_t_input_callback_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_input_callback_get")]
-  public static extern IntPtr switch_input_args_t_input_callback_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_buf_set")]
-  public static extern void switch_input_args_t_buf_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_buf_get")]
-  public static extern IntPtr switch_input_args_t_buf_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_buflen_set")]
-  public static extern void switch_input_args_t_buflen_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_buflen_get")]
-  public static extern uint switch_input_args_t_buflen_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_read_frame_callback_set")]
-  public static extern void switch_input_args_t_read_frame_callback_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_read_frame_callback_get")]
-  public static extern IntPtr switch_input_args_t_read_frame_callback_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_user_data_set")]
-  public static extern void switch_input_args_t_user_data_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_user_data_get")]
-  public static extern IntPtr switch_input_args_t_user_data_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_input_args_t")]
-  public static extern IntPtr new_switch_input_args_t();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_input_args_t")]
-  public static extern void delete_switch_input_args_t(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_API_VERSION_get")]
-  public static extern int SWITCH_API_VERSION_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_function_table_t_switch_api_version_set")]
-  public static extern void switch_loadable_module_function_table_t_switch_api_version_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_function_table_t_switch_api_version_get")]
-  public static extern int switch_loadable_module_function_table_t_switch_api_version_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_function_table_t_load_set")]
-  public static extern void switch_loadable_module_function_table_t_load_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_function_table_t_load_get")]
-  public static extern IntPtr switch_loadable_module_function_table_t_load_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_function_table_t_shutdown_set")]
-  public static extern void switch_loadable_module_function_table_t_shutdown_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_function_table_t_shutdown_get")]
-  public static extern IntPtr switch_loadable_module_function_table_t_shutdown_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_function_table_t_runtime_set")]
-  public static extern void switch_loadable_module_function_table_t_runtime_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_function_table_t_runtime_get")]
-  public static extern IntPtr switch_loadable_module_function_table_t_runtime_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_function_table_t_flags_set")]
-  public static extern void switch_loadable_module_function_table_t_flags_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_function_table_t_flags_get")]
-  public static extern uint switch_loadable_module_function_table_t_flags_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_loadable_module_function_table_t")]
-  public static extern IntPtr new_switch_loadable_module_function_table_t();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_loadable_module_function_table_t")]
-  public static extern void delete_switch_loadable_module_function_table_t(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_close")]
-  public static extern int switch_core_db_close(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_open")]
-  public static extern int switch_core_db_open(string jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_column_text")]
-  public static extern IntPtr switch_core_db_column_text(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_column_name")]
-  public static extern string switch_core_db_column_name(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_column_count")]
-  public static extern int switch_core_db_column_count(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_errmsg")]
-  public static extern string switch_core_db_errmsg(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_exec")]
-  public static extern int switch_core_db_exec(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, ref string jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_finalize")]
-  public static extern int switch_core_db_finalize(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_prepare")]
-  public static extern int switch_core_db_prepare(HandleRef jarg1, string jarg2, int jarg3, HandleRef jarg4, ref string jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_step")]
-  public static extern int switch_core_db_step(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_reset")]
-  public static extern int switch_core_db_reset(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_bind_int")]
-  public static extern int switch_core_db_bind_int(HandleRef jarg1, int jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_bind_int64")]
-  public static extern int switch_core_db_bind_int64(HandleRef jarg1, int jarg2, long jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_bind_text")]
-  public static extern int switch_core_db_bind_text(HandleRef jarg1, int jarg2, string jarg3, int jarg4, HandleRef jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_bind_double")]
-  public static extern int switch_core_db_bind_double(HandleRef jarg1, int jarg2, double jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_last_insert_rowid")]
-  public static extern long switch_core_db_last_insert_rowid(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_get_table")]
-  public static extern int switch_core_db_get_table(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5, ref string jarg6);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_free_table")]
-  public static extern void switch_core_db_free_table(ref string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_free")]
-  public static extern void switch_core_db_free(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_changes")]
-  public static extern int switch_core_db_changes(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_OK_get")]
-  public static extern int SWITCH_CORE_DB_OK_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_ERROR_get")]
-  public static extern int SWITCH_CORE_DB_ERROR_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_INTERNAL_get")]
-  public static extern int SWITCH_CORE_DB_INTERNAL_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_PERM_get")]
-  public static extern int SWITCH_CORE_DB_PERM_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_ABORT_get")]
-  public static extern int SWITCH_CORE_DB_ABORT_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_BUSY_get")]
-  public static extern int SWITCH_CORE_DB_BUSY_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_LOCKED_get")]
-  public static extern int SWITCH_CORE_DB_LOCKED_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_NOMEM_get")]
-  public static extern int SWITCH_CORE_DB_NOMEM_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_READONLY_get")]
-  public static extern int SWITCH_CORE_DB_READONLY_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_INTERRUPT_get")]
-  public static extern int SWITCH_CORE_DB_INTERRUPT_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_IOERR_get")]
-  public static extern int SWITCH_CORE_DB_IOERR_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_CORRUPT_get")]
-  public static extern int SWITCH_CORE_DB_CORRUPT_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_NOTFOUND_get")]
-  public static extern int SWITCH_CORE_DB_NOTFOUND_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_FULL_get")]
-  public static extern int SWITCH_CORE_DB_FULL_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_CANTOPEN_get")]
-  public static extern int SWITCH_CORE_DB_CANTOPEN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_PROTOCOL_get")]
-  public static extern int SWITCH_CORE_DB_PROTOCOL_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_EMPTY_get")]
-  public static extern int SWITCH_CORE_DB_EMPTY_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_SCHEMA_get")]
-  public static extern int SWITCH_CORE_DB_SCHEMA_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_TOOBIG_get")]
-  public static extern int SWITCH_CORE_DB_TOOBIG_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_CONSTRAINT_get")]
-  public static extern int SWITCH_CORE_DB_CONSTRAINT_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_MISMATCH_get")]
-  public static extern int SWITCH_CORE_DB_MISMATCH_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_MISUSE_get")]
-  public static extern int SWITCH_CORE_DB_MISUSE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_NOLFS_get")]
-  public static extern int SWITCH_CORE_DB_NOLFS_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_AUTH_get")]
-  public static extern int SWITCH_CORE_DB_AUTH_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_FORMAT_get")]
-  public static extern int SWITCH_CORE_DB_FORMAT_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_RANGE_get")]
-  public static extern int SWITCH_CORE_DB_RANGE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_NOTADB_get")]
-  public static extern int SWITCH_CORE_DB_NOTADB_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_ROW_get")]
-  public static extern int SWITCH_CORE_DB_ROW_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_DONE_get")]
-  public static extern int SWITCH_CORE_DB_DONE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_mprintf")]
-  public static extern string switch_mprintf(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_regex_compile")]
-  public static extern IntPtr switch_regex_compile(string jarg1, int jarg2, ref string jarg3, HandleRef jarg4, HandleRef jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_regex_copy_substring")]
-  public static extern int switch_regex_copy_substring(string jarg1, HandleRef jarg2, int jarg3, int jarg4, string jarg5, int jarg6);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_regex_free")]
-  public static extern void switch_regex_free(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_regex_perform")]
-  public static extern int switch_regex_perform(string jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, uint jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_perform_substitution")]
-  public static extern void switch_perform_substitution(HandleRef jarg1, int jarg2, string jarg3, string jarg4, string jarg5, HandleRef jarg6, HandleRef jarg7);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_regex_match")]
-  public static extern int switch_regex_match(string jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_regex_match_partial")]
-  public static extern int switch_regex_match_partial(string jarg1, string jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_CORE_THREAD_SESSION_OBJS_get")]
-  public static extern int SWITCH_MAX_CORE_THREAD_SESSION_OBJS_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_STREAMS_get")]
-  public static extern int SWITCH_MAX_STREAMS_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_mms_set")]
-  public static extern void switch_core_time_duration_mms_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_mms_get")]
-  public static extern uint switch_core_time_duration_mms_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_ms_set")]
-  public static extern void switch_core_time_duration_ms_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_ms_get")]
-  public static extern uint switch_core_time_duration_ms_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_sec_set")]
-  public static extern void switch_core_time_duration_sec_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_sec_get")]
-  public static extern uint switch_core_time_duration_sec_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_min_set")]
-  public static extern void switch_core_time_duration_min_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_min_get")]
-  public static extern uint switch_core_time_duration_min_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_hr_set")]
-  public static extern void switch_core_time_duration_hr_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_hr_get")]
-  public static extern uint switch_core_time_duration_hr_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_day_set")]
-  public static extern void switch_core_time_duration_day_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_day_get")]
-  public static extern uint switch_core_time_duration_day_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_yr_set")]
-  public static extern void switch_core_time_duration_yr_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_yr_get")]
-  public static extern uint switch_core_time_duration_yr_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_core_time_duration")]
-  public static extern IntPtr new_switch_core_time_duration();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_core_time_duration")]
-  public static extern void delete_switch_core_time_duration(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_app_log_app_set")]
-  public static extern void switch_app_log_app_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_app_log_app_get")]
-  public static extern string switch_app_log_app_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_app_log_arg_set")]
-  public static extern void switch_app_log_arg_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_app_log_arg_get")]
-  public static extern string switch_app_log_arg_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_app_log_next_set")]
-  public static extern void switch_app_log_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_app_log_next_get")]
-  public static extern IntPtr switch_app_log_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_app_log")]
-  public static extern IntPtr new_switch_app_log();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_app_log")]
-  public static extern void delete_switch_app_log(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_MESSAGE_STRING_ARG_MAX_get")]
-  public static extern int MESSAGE_STRING_ARG_MAX_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_from_set")]
-  public static extern void switch_core_session_message_from_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_from_get")]
-  public static extern string switch_core_session_message_from_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_message_id_set")]
-  public static extern void switch_core_session_message_message_id_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_message_id_get")]
-  public static extern int switch_core_session_message_message_id_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_numeric_arg_set")]
-  public static extern void switch_core_session_message_numeric_arg_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_numeric_arg_get")]
-  public static extern int switch_core_session_message_numeric_arg_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_string_arg_set")]
-  public static extern void switch_core_session_message_string_arg_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_string_arg_get")]
-  public static extern string switch_core_session_message_string_arg_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_string_arg_size_set")]
-  public static extern void switch_core_session_message_string_arg_size_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_string_arg_size_get")]
-  public static extern IntPtr switch_core_session_message_string_arg_size_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_pointer_arg_set")]
-  public static extern void switch_core_session_message_pointer_arg_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_pointer_arg_get")]
-  public static extern IntPtr switch_core_session_message_pointer_arg_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_pointer_arg_size_set")]
-  public static extern void switch_core_session_message_pointer_arg_size_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_pointer_arg_size_get")]
-  public static extern IntPtr switch_core_session_message_pointer_arg_size_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_numeric_reply_set")]
-  public static extern void switch_core_session_message_numeric_reply_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_numeric_reply_get")]
-  public static extern int switch_core_session_message_numeric_reply_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_string_reply_set")]
-  public static extern void switch_core_session_message_string_reply_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_string_reply_get")]
-  public static extern string switch_core_session_message_string_reply_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_string_reply_size_set")]
-  public static extern void switch_core_session_message_string_reply_size_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_string_reply_size_get")]
-  public static extern IntPtr switch_core_session_message_string_reply_size_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_pointer_reply_set")]
-  public static extern void switch_core_session_message_pointer_reply_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_pointer_reply_get")]
-  public static extern IntPtr switch_core_session_message_pointer_reply_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_pointer_reply_size_set")]
-  public static extern void switch_core_session_message_pointer_reply_size_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_pointer_reply_size_get")]
-  public static extern IntPtr switch_core_session_message_pointer_reply_size_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_flags_set")]
-  public static extern void switch_core_session_message_flags_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_flags_get")]
-  public static extern uint switch_core_session_message_flags_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message__file_set")]
-  public static extern void switch_core_session_message__file_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message__file_get")]
-  public static extern string switch_core_session_message__file_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message__func_set")]
-  public static extern void switch_core_session_message__func_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message__func_get")]
-  public static extern string switch_core_session_message__func_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message__line_set")]
-  public static extern void switch_core_session_message__line_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message__line_get")]
-  public static extern int switch_core_session_message__line_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_string_array_arg_set")]
-  public static extern void switch_core_session_message_string_array_arg_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_string_array_arg_get")]
-  public static extern IntPtr switch_core_session_message_string_array_arg_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_delivery_time_set")]
-  public static extern void switch_core_session_message_delivery_time_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_delivery_time_get")]
-  public static extern IntPtr switch_core_session_message_delivery_time_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_core_session_message")]
-  public static extern IntPtr new_switch_core_session_message();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_core_session_message")]
-  public static extern void delete_switch_core_session_message(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_running_set")]
-  public static extern void switch_core_thread_session_running_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_running_get")]
-  public static extern int switch_core_thread_session_running_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_mutex_set")]
-  public static extern void switch_core_thread_session_mutex_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_mutex_get")]
-  public static extern IntPtr switch_core_thread_session_mutex_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_objs_set")]
-  public static extern void switch_core_thread_session_objs_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_objs_get")]
-  public static extern IntPtr switch_core_thread_session_objs_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_input_callback_set")]
-  public static extern void switch_core_thread_session_input_callback_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_input_callback_get")]
-  public static extern IntPtr switch_core_thread_session_input_callback_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_pool_set")]
-  public static extern void switch_core_thread_session_pool_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_pool_get")]
-  public static extern IntPtr switch_core_thread_session_pool_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_core_thread_session")]
-  public static extern IntPtr new_switch_core_thread_session();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_core_thread_session")]
-  public static extern void delete_switch_core_thread_session(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_sched_heartbeat")]
-  public static extern void switch_core_session_sched_heartbeat(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_unsched_heartbeat")]
-  public static extern void switch_core_session_unsched_heartbeat(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_enable_heartbeat")]
-  public static extern void switch_core_session_enable_heartbeat(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_disable_heartbeat")]
-  public static extern void switch_core_session_disable_heartbeat(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_add")]
-  public static extern int switch_core_media_bug_add(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, uint jarg5, HandleRef jarg6);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_pause")]
-  public static extern void switch_core_media_bug_pause(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_resume")]
-  public static extern void switch_core_media_bug_resume(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_inuse")]
-  public static extern void switch_core_media_bug_inuse(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_get_user_data")]
-  public static extern IntPtr switch_core_media_bug_get_user_data(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_get_write_replace_frame")]
-  public static extern IntPtr switch_core_media_bug_get_write_replace_frame(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_set_write_replace_frame")]
-  public static extern void switch_core_media_bug_set_write_replace_frame(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_get_read_replace_frame")]
-  public static extern IntPtr switch_core_media_bug_get_read_replace_frame(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_get_session")]
-  public static extern IntPtr switch_core_media_bug_get_session(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_test_flag")]
-  public static extern uint switch_core_media_bug_test_flag(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_set_read_replace_frame")]
-  public static extern void switch_core_media_bug_set_read_replace_frame(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_remove")]
-  public static extern int switch_core_media_bug_remove(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_prune")]
-  public static extern uint switch_core_media_bug_prune(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_remove_callback")]
-  public static extern int switch_core_media_bug_remove_callback(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_close")]
-  public static extern int switch_core_media_bug_close(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_remove_all")]
-  public static extern int switch_core_media_bug_remove_all(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_read")]
-  public static extern int switch_core_media_bug_read(HandleRef jarg1, HandleRef jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_flush")]
-  public static extern void switch_core_media_bug_flush(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_flush_all")]
-  public static extern int switch_core_media_bug_flush_all(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_port_allocator_new")]
-  public static extern int switch_core_port_allocator_new(ushort jarg1, ushort jarg2, uint jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_port_allocator_request_port")]
-  public static extern int switch_core_port_allocator_request_port(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_port_allocator_free_port")]
-  public static extern int switch_core_port_allocator_free_port(HandleRef jarg1, ushort jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_port_allocator_destroy")]
-  public static extern void switch_core_port_allocator_destroy(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_init")]
-  public static extern int switch_core_init(uint jarg1, int jarg2, ref string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_init_and_modload")]
-  public static extern int switch_core_init_and_modload(uint jarg1, int jarg2, ref string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_limit")]
-  public static extern uint switch_core_session_limit(uint jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_sessions_per_second")]
-  public static extern uint switch_core_sessions_per_second(uint jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_destroy")]
-  public static extern int switch_core_destroy();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_read_lock")]
-  public static extern int switch_core_session_read_lock(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_read_lock_hangup")]
-  public static extern int switch_core_session_read_lock_hangup(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_write_lock")]
-  public static extern void switch_core_session_write_lock(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_rwunlock")]
-  public static extern void switch_core_session_rwunlock(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_add_state_handler")]
-  public static extern int switch_core_add_state_handler(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_remove_state_handler")]
-  public static extern void switch_core_remove_state_handler(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_state_handler")]
-  public static extern IntPtr switch_core_get_state_handler(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_memory_pool_tag")]
-  public static extern void switch_core_memory_pool_tag(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_perform_new_memory_pool")]
-  public static extern int switch_core_perform_new_memory_pool(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_perform_destroy_memory_pool")]
-  public static extern int switch_core_perform_destroy_memory_pool(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_memory_pool_set_data")]
-  public static extern void switch_core_memory_pool_set_data(HandleRef jarg1, string jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_memory_pool_get_data")]
-  public static extern IntPtr switch_core_memory_pool_get_data(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_run")]
-  public static extern void switch_core_session_run(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_running")]
-  public static extern uint switch_core_session_running(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_perform_permanent_alloc")]
-  public static extern IntPtr switch_core_perform_permanent_alloc(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_perform_alloc")]
-  public static extern IntPtr switch_core_perform_alloc(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4, int jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_perform_session_alloc")]
-  public static extern IntPtr switch_core_perform_session_alloc(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4, int jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_perform_permanent_strdup")]
-  public static extern string switch_core_perform_permanent_strdup(string jarg1, string jarg2, string jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_perform_session_strdup")]
-  public static extern string switch_core_perform_session_strdup(HandleRef jarg1, string jarg2, string jarg3, string jarg4, int jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_perform_strdup")]
-  public static extern string switch_core_perform_strdup(HandleRef jarg1, string jarg2, string jarg3, string jarg4, int jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_sprintf")]
-  public static extern string switch_core_session_sprintf(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_sprintf")]
-  public static extern string switch_core_sprintf(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_pool")]
-  public static extern IntPtr switch_core_session_get_pool(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_request_uuid")]
-  public static extern IntPtr switch_core_session_request_uuid(HandleRef jarg1, int jarg2, HandleRef jarg3, string jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_uuid")]
-  public static extern int switch_core_session_set_uuid(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_perform_destroy")]
-  public static extern void switch_core_session_perform_destroy(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_destroy_state")]
-  public static extern void switch_core_session_destroy_state(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_reporting_state")]
-  public static extern void switch_core_session_reporting_state(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_hangup_state")]
-  public static extern void switch_core_session_hangup_state(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_count")]
-  public static extern uint switch_core_session_count();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_id")]
-  public static extern IntPtr switch_core_session_get_id(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_id")]
-  public static extern IntPtr switch_core_session_id();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_request_by_name")]
-  public static extern IntPtr switch_core_session_request_by_name(string jarg1, int jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_thread_launch")]
-  public static extern int switch_core_session_thread_launch(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_channel")]
-  public static extern IntPtr switch_core_session_get_channel(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_wake_session_thread")]
-  public static extern void switch_core_session_wake_session_thread(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_signal_state_change")]
-  public static extern void switch_core_session_signal_state_change(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_uuid")]
-  public static extern string switch_core_session_get_uuid(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_uuid")]
-  public static extern string switch_core_get_uuid();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_locate")]
-  public static extern IntPtr switch_core_session_locate(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_force_locate")]
-  public static extern IntPtr switch_core_session_force_locate(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_variable")]
-  public static extern string switch_core_get_variable(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_set_variable")]
-  public static extern void switch_core_set_variable(string jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_dump_variables")]
-  public static extern void switch_core_dump_variables(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_hupall")]
-  public static extern void switch_core_session_hupall(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_hupall_matching_var")]
-  public static extern void switch_core_session_hupall_matching_var(string jarg1, string jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_hupall_endpoint")]
-  public static extern void switch_core_session_hupall_endpoint(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_partner")]
-  public static extern int switch_core_session_get_partner(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_send")]
-  public static extern int switch_core_session_message_send(string jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_queue_message")]
-  public static extern int switch_core_session_queue_message(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_free_message")]
-  public static extern void switch_core_session_free_message(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_pass_indication")]
-  public static extern int switch_core_session_pass_indication(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_queue_indication")]
-  public static extern int switch_core_session_queue_indication(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_dequeue_message")]
-  public static extern int switch_core_session_dequeue_message(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_flush_message")]
-  public static extern int switch_core_session_flush_message(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_event_send")]
-  public static extern int switch_core_session_event_send(string jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_app_log")]
-  public static extern IntPtr switch_core_session_get_app_log(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_exec")]
-  public static extern int switch_core_session_exec(HandleRef jarg1, HandleRef jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_execute_application")]
-  public static extern int switch_core_session_execute_application(HandleRef jarg1, string jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_execute_exten")]
-  public static extern int switch_core_session_execute_exten(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_receive_event")]
-  public static extern int switch_core_session_receive_event(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_private")]
-  public static extern IntPtr switch_core_session_get_private(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_private")]
-  public static extern int switch_core_session_set_private(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_add_stream")]
-  public static extern int switch_core_session_add_stream(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_stream")]
-  public static extern IntPtr switch_core_session_get_stream(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_stream_count")]
-  public static extern int switch_core_session_get_stream_count(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_launch_thread")]
-  public static extern void switch_core_session_launch_thread(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_end")]
-  public static extern void switch_core_thread_session_end(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_service_session")]
-  public static extern void switch_core_service_session(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_outgoing_channel")]
-  public static extern int switch_core_session_outgoing_channel(HandleRef jarg1, HandleRef jarg2, string jarg3, HandleRef jarg4, HandleRef jarg5, HandleRef jarg6, uint jarg7, HandleRef jarg8);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_resurrect_channel")]
-  public static extern int switch_core_session_resurrect_channel(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_perform_receive_message")]
-  public static extern int switch_core_session_perform_receive_message(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4, int jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_queue_event")]
-  public static extern int switch_core_session_queue_event(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_event_count")]
-  public static extern uint switch_core_session_event_count(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_dequeue_event")]
-  public static extern int switch_core_session_dequeue_event(HandleRef jarg1, HandleRef jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_queue_private_event")]
-  public static extern int switch_core_session_queue_private_event(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_private_event_count")]
-  public static extern uint switch_core_session_private_event_count(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_dequeue_private_event")]
-  public static extern int switch_core_session_dequeue_private_event(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_flush_private_events")]
-  public static extern uint switch_core_session_flush_private_events(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_read_frame")]
-  public static extern int switch_core_session_read_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_read_video_frame")]
-  public static extern int switch_core_session_read_video_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_write_video_frame")]
-  public static extern int switch_core_session_write_video_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_read_impl")]
-  public static extern int switch_core_session_set_read_impl(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_write_impl")]
-  public static extern int switch_core_session_set_write_impl(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_video_read_impl")]
-  public static extern int switch_core_session_set_video_read_impl(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_video_write_impl")]
-  public static extern int switch_core_session_set_video_write_impl(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_reset")]
-  public static extern void switch_core_session_reset(HandleRef jarg1, int jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_write_frame")]
-  public static extern int switch_core_session_write_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_perform_kill_channel")]
-  public static extern int switch_core_session_perform_kill_channel(HandleRef jarg1, string jarg2, string jarg3, int jarg4, int jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_send_dtmf")]
-  public static extern int switch_core_session_send_dtmf(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_send_dtmf_string")]
-  public static extern int switch_core_session_send_dtmf_string(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_recv_dtmf")]
-  public static extern int switch_core_session_recv_dtmf(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_hash_init_case")]
-  public static extern int switch_core_hash_init_case(HandleRef jarg1, HandleRef jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_hash_destroy")]
-  public static extern int switch_core_hash_destroy(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_hash_insert")]
-  public static extern int switch_core_hash_insert(HandleRef jarg1, string jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_hash_insert_locked")]
-  public static extern int switch_core_hash_insert_locked(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_hash_delete")]
-  public static extern int switch_core_hash_delete(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_hash_delete_locked")]
-  public static extern int switch_core_hash_delete_locked(HandleRef jarg1, string jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_hash_find")]
-  public static extern IntPtr switch_core_hash_find(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_hash_find_locked")]
-  public static extern IntPtr switch_core_hash_find_locked(HandleRef jarg1, string jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_hash_first")]
-  public static extern IntPtr switch_hash_first(string jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_hash_next")]
-  public static extern IntPtr switch_hash_next(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_hash_this")]
-  public static extern void switch_hash_this(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_timer_init")]
-  public static extern int switch_core_timer_init(HandleRef jarg1, string jarg2, int jarg3, int jarg4, HandleRef jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_timer_next")]
-  public static extern int switch_core_timer_next(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_timer_step")]
-  public static extern int switch_core_timer_step(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_timer_sync")]
-  public static extern int switch_core_timer_sync(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_timer_check")]
-  public static extern int switch_core_timer_check(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_timer_destroy")]
-  public static extern int switch_core_timer_destroy(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_init")]
-  public static extern int switch_core_codec_init(HandleRef jarg1, string jarg2, string jarg3, uint jarg4, int jarg5, int jarg6, uint jarg7, HandleRef jarg8, HandleRef jarg9);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_copy")]
-  public static extern int switch_core_codec_copy(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_encode")]
-  public static extern int switch_core_codec_encode(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, uint jarg4, uint jarg5, HandleRef jarg6, HandleRef jarg7, HandleRef jarg8, HandleRef jarg9);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_decode")]
-  public static extern int switch_core_codec_decode(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, uint jarg4, uint jarg5, HandleRef jarg6, HandleRef jarg7, HandleRef jarg8, HandleRef jarg9);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_destroy")]
-  public static extern int switch_core_codec_destroy(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_read_codec")]
-  public static extern int switch_core_session_set_read_codec(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_unset_read_codec")]
-  public static extern void switch_core_session_unset_read_codec(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_unset_write_codec")]
-  public static extern void switch_core_session_unset_write_codec(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_lock_codec_write")]
-  public static extern void switch_core_session_lock_codec_write(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_unlock_codec_write")]
-  public static extern void switch_core_session_unlock_codec_write(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_lock_codec_read")]
-  public static extern void switch_core_session_lock_codec_read(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_unlock_codec_read")]
-  public static extern void switch_core_session_unlock_codec_read(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_read_impl")]
-  public static extern int switch_core_session_get_read_impl(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_write_impl")]
-  public static extern int switch_core_session_get_write_impl(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_video_read_impl")]
-  public static extern int switch_core_session_get_video_read_impl(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_video_write_impl")]
-  public static extern int switch_core_session_get_video_write_impl(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_read_codec")]
-  public static extern IntPtr switch_core_session_get_read_codec(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_effective_read_codec")]
-  public static extern IntPtr switch_core_session_get_effective_read_codec(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_write_codec")]
-  public static extern int switch_core_session_set_write_codec(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_write_codec")]
-  public static extern IntPtr switch_core_session_get_write_codec(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_effective_write_codec")]
-  public static extern IntPtr switch_core_session_get_effective_write_codec(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_video_read_codec")]
-  public static extern int switch_core_session_set_video_read_codec(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_video_read_codec")]
-  public static extern IntPtr switch_core_session_get_video_read_codec(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_video_write_codec")]
-  public static extern int switch_core_session_set_video_write_codec(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_video_write_codec")]
-  public static extern IntPtr switch_core_session_get_video_write_codec(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_open_file")]
-  public static extern IntPtr switch_core_db_open_file(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_persistant_execute")]
-  public static extern int switch_core_db_persistant_execute(HandleRef jarg1, string jarg2, uint jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_persistant_execute_trans")]
-  public static extern int switch_core_db_persistant_execute_trans(HandleRef jarg1, string jarg2, uint jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_test_reactive")]
-  public static extern void switch_core_db_test_reactive(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_perform_file_open")]
-  public static extern int switch_core_perform_file_open(string jarg1, string jarg2, int jarg3, HandleRef jarg4, string jarg5, byte jarg6, uint jarg7, uint jarg8, HandleRef jarg9);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_file_read")]
-  public static extern int switch_core_file_read(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_file_write")]
-  public static extern int switch_core_file_write(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_file_seek")]
-  public static extern int switch_core_file_seek(HandleRef jarg1, HandleRef jarg2, long jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_file_set_string")]
-  public static extern int switch_core_file_set_string(HandleRef jarg1, int jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_file_get_string")]
-  public static extern int switch_core_file_get_string(HandleRef jarg1, int jarg2, ref string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_file_close")]
-  public static extern int switch_core_file_close(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_file_truncate")]
-  public static extern int switch_core_file_truncate(HandleRef jarg1, long jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_speech_open")]
-  public static extern int switch_core_speech_open(HandleRef jarg1, string jarg2, string jarg3, uint jarg4, uint jarg5, HandleRef jarg6, HandleRef jarg7);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_speech_feed_tts")]
-  public static extern int switch_core_speech_feed_tts(HandleRef jarg1, string jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_speech_flush_tts")]
-  public static extern void switch_core_speech_flush_tts(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_speech_text_param_tts")]
-  public static extern void switch_core_speech_text_param_tts(HandleRef jarg1, string jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_speech_numeric_param_tts")]
-  public static extern void switch_core_speech_numeric_param_tts(HandleRef jarg1, string jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_speech_float_param_tts")]
-  public static extern void switch_core_speech_float_param_tts(HandleRef jarg1, string jarg2, double jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_speech_read_tts")]
-  public static extern int switch_core_speech_read_tts(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_speech_close")]
-  public static extern int switch_core_speech_close(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_open")]
-  public static extern int switch_core_asr_open(HandleRef jarg1, string jarg2, string jarg3, int jarg4, string jarg5, HandleRef jarg6, HandleRef jarg7);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_close")]
-  public static extern int switch_core_asr_close(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_feed")]
-  public static extern int switch_core_asr_feed(HandleRef jarg1, HandleRef jarg2, uint jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_check_results")]
-  public static extern int switch_core_asr_check_results(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_get_results")]
-  public static extern int switch_core_asr_get_results(HandleRef jarg1, ref string jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_load_grammar")]
-  public static extern int switch_core_asr_load_grammar(HandleRef jarg1, string jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_unload_grammar")]
-  public static extern int switch_core_asr_unload_grammar(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_pause")]
-  public static extern int switch_core_asr_pause(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_resume")]
-  public static extern int switch_core_asr_resume(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_start_input_timers")]
-  public static extern int switch_core_asr_start_input_timers(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_text_param")]
-  public static extern void switch_core_asr_text_param(HandleRef jarg1, string jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_numeric_param")]
-  public static extern void switch_core_asr_numeric_param(HandleRef jarg1, string jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_float_param")]
-  public static extern void switch_core_asr_float_param(HandleRef jarg1, string jarg2, double jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_directory_open")]
-  public static extern int switch_core_directory_open(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, HandleRef jarg6);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_directory_query")]
-  public static extern int switch_core_directory_query(HandleRef jarg1, string jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_directory_next")]
-  public static extern int switch_core_directory_next(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_directory_next_pair")]
-  public static extern int switch_core_directory_next_pair(HandleRef jarg1, ref string jarg2, ref string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_directory_close")]
-  public static extern int switch_core_directory_close(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_data_channel")]
-  public static extern IntPtr switch_core_data_channel(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_ready")]
-  public static extern int switch_core_ready();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_flags")]
-  public static extern uint switch_core_flags();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_management_exec")]
-  public static extern int switch_core_management_exec(string jarg1, int jarg2, string jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_set_high_priority")]
-  public static extern int set_high_priority();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_change_user_group")]
-  public static extern int change_user_group(string jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_runtime_loop")]
-  public static extern void switch_core_runtime_loop(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_set_console")]
-  public static extern int switch_core_set_console(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_measure_time")]
-  public static extern void switch_core_measure_time(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_uptime")]
-  public static extern IntPtr switch_core_uptime();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_ctl")]
-  public static extern int switch_core_session_ctl(int jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_console")]
-  public static extern IntPtr switch_core_get_console();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_set_globals")]
-  public static extern void switch_core_set_globals();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_compare")]
-  public static extern byte switch_core_session_compare(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_check_interface")]
-  public static extern byte switch_core_session_check_interface(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_mime_index")]
-  public static extern IntPtr switch_core_mime_index();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_mime_ext2type")]
-  public static extern string switch_core_mime_ext2type(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_mime_add_type")]
-  public static extern int switch_core_mime_add_type(string jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_create_module_interface")]
-  public static extern IntPtr switch_loadable_module_create_module_interface(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_create_interface")]
-  public static extern IntPtr switch_loadable_module_create_interface(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_micro_time_now")]
-  public static extern IntPtr switch_micro_time_now();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_memory_reclaim")]
-  public static extern void switch_core_memory_reclaim();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_memory_reclaim_events")]
-  public static extern void switch_core_memory_reclaim_events();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_memory_reclaim_logger")]
-  public static extern void switch_core_memory_reclaim_logger();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_memory_reclaim_all")]
-  public static extern void switch_core_memory_reclaim_all();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_setrlimits")]
-  public static extern void switch_core_setrlimits();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_time_sync")]
-  public static extern void switch_time_sync();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_epoch_time_now")]
-  public static extern IntPtr switch_epoch_time_now(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_strftime_tz")]
-  public static extern int switch_strftime_tz(string jarg1, string jarg2, string jarg3, uint jarg4, HandleRef jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_time_exp_tz_name")]
-  public static extern int switch_time_exp_tz_name(string jarg1, HandleRef jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_load_network_lists")]
-  public static extern void switch_load_network_lists(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_check_network_list_ip_token")]
-  public static extern int switch_check_network_list_ip_token(string jarg1, string jarg2, ref string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_time_set_monotonic")]
-  public static extern void switch_time_set_monotonic(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_min_dtmf_duration")]
-  public static extern uint switch_core_min_dtmf_duration(uint jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_max_dtmf_duration")]
-  public static extern uint switch_core_max_dtmf_duration(uint jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_default_dtmf_duration")]
-  public static extern uint switch_core_default_dtmf_duration(uint jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_set_complete")]
-  public static extern int switch_console_set_complete(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_set_alias")]
-  public static extern int switch_console_set_alias(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_system")]
-  public static extern int switch_system(string jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cond_yield")]
-  public static extern void switch_cond_yield(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cond_next")]
-  public static extern void switch_cond_next();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_chat_send")]
-  public static extern int switch_core_chat_send(string jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_preprocess_session")]
-  public static extern int switch_ivr_preprocess_session(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CACHE_DB_LEN_get")]
-  public static extern int CACHE_DB_LEN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_native_handle_t_core_db_dbh_set")]
-  public static extern void switch_cache_db_native_handle_t_core_db_dbh_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_native_handle_t_core_db_dbh_get")]
-  public static extern IntPtr switch_cache_db_native_handle_t_core_db_dbh_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_native_handle_t_odbc_dbh_set")]
-  public static extern void switch_cache_db_native_handle_t_odbc_dbh_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_native_handle_t_odbc_dbh_get")]
-  public static extern IntPtr switch_cache_db_native_handle_t_odbc_dbh_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_cache_db_native_handle_t")]
-  public static extern IntPtr new_switch_cache_db_native_handle_t();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_cache_db_native_handle_t")]
-  public static extern void delete_switch_cache_db_native_handle_t(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_core_db_options_t_db_path_set")]
-  public static extern void switch_cache_db_core_db_options_t_db_path_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_core_db_options_t_db_path_get")]
-  public static extern string switch_cache_db_core_db_options_t_db_path_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_cache_db_core_db_options_t")]
-  public static extern IntPtr new_switch_cache_db_core_db_options_t();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_cache_db_core_db_options_t")]
-  public static extern void delete_switch_cache_db_core_db_options_t(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_odbc_options_t_dsn_set")]
-  public static extern void switch_cache_db_odbc_options_t_dsn_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_odbc_options_t_dsn_get")]
-  public static extern string switch_cache_db_odbc_options_t_dsn_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_odbc_options_t_user_set")]
-  public static extern void switch_cache_db_odbc_options_t_user_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_odbc_options_t_user_get")]
-  public static extern string switch_cache_db_odbc_options_t_user_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_odbc_options_t_pass_set")]
-  public static extern void switch_cache_db_odbc_options_t_pass_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_odbc_options_t_pass_get")]
-  public static extern string switch_cache_db_odbc_options_t_pass_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_cache_db_odbc_options_t")]
-  public static extern IntPtr new_switch_cache_db_odbc_options_t();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_cache_db_odbc_options_t")]
-  public static extern void delete_switch_cache_db_odbc_options_t(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_connection_options_t_core_db_options_set")]
-  public static extern void switch_cache_db_connection_options_t_core_db_options_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_connection_options_t_core_db_options_get")]
-  public static extern IntPtr switch_cache_db_connection_options_t_core_db_options_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_connection_options_t_odbc_options_set")]
-  public static extern void switch_cache_db_connection_options_t_odbc_options_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_connection_options_t_odbc_options_get")]
-  public static extern IntPtr switch_cache_db_connection_options_t_odbc_options_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_cache_db_connection_options_t")]
-  public static extern IntPtr new_switch_cache_db_connection_options_t();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_cache_db_connection_options_t")]
-  public static extern void delete_switch_cache_db_connection_options_t(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_name_set")]
-  public static extern void switch_cache_db_handle_t_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_name_get")]
-  public static extern string switch_cache_db_handle_t_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_type_set")]
-  public static extern void switch_cache_db_handle_t_type_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_type_get")]
-  public static extern int switch_cache_db_handle_t_type_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_native_handle_set")]
-  public static extern void switch_cache_db_handle_t_native_handle_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_native_handle_get")]
-  public static extern IntPtr switch_cache_db_handle_t_native_handle_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_last_used_set")]
-  public static extern void switch_cache_db_handle_t_last_used_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_last_used_get")]
-  public static extern IntPtr switch_cache_db_handle_t_last_used_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_mutex_set")]
-  public static extern void switch_cache_db_handle_t_mutex_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_mutex_get")]
-  public static extern IntPtr switch_cache_db_handle_t_mutex_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_pool_set")]
-  public static extern void switch_cache_db_handle_t_pool_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_pool_get")]
-  public static extern IntPtr switch_cache_db_handle_t_pool_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_flags_set")]
-  public static extern void switch_cache_db_handle_t_flags_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_flags_get")]
-  public static extern int switch_cache_db_handle_t_flags_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_hash_set")]
-  public static extern void switch_cache_db_handle_t_hash_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_hash_get")]
-  public static extern uint switch_cache_db_handle_t_hash_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_creator_set")]
-  public static extern void switch_cache_db_handle_t_creator_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_creator_get")]
-  public static extern string switch_cache_db_handle_t_creator_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_last_user_set")]
-  public static extern void switch_cache_db_handle_t_last_user_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_last_user_get")]
-  public static extern string switch_cache_db_handle_t_last_user_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_cache_db_handle_t")]
-  public static extern IntPtr new_switch_cache_db_handle_t();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_cache_db_handle_t")]
-  public static extern void delete_switch_cache_db_handle_t(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_type_name")]
-  public static extern string switch_cache_db_type_name(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_release_db_handle")]
-  public static extern void switch_cache_db_release_db_handle(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_destroy_db_handle")]
-  public static extern void switch_cache_db_destroy_db_handle(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp__switch_cache_db_get_db_handle")]
-  public static extern int _switch_cache_db_get_db_handle(HandleRef jarg1, int jarg2, HandleRef jarg3, string jarg4, string jarg5, int jarg6);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_execute_sql2str")]
-  public static extern string switch_cache_db_execute_sql2str(HandleRef jarg1, string jarg2, string jarg3, uint jarg4, ref string jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_execute_sql")]
-  public static extern int switch_cache_db_execute_sql(HandleRef jarg1, string jarg2, ref string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_execute_sql_callback")]
-  public static extern int switch_cache_db_execute_sql_callback(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, ref string jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_status")]
-  public static extern void switch_cache_db_status(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp__switch_core_db_handle")]
-  public static extern int _switch_core_db_handle(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_test_reactive")]
-  public static extern void switch_cache_db_test_reactive(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_persistant_execute")]
-  public static extern int switch_cache_db_persistant_execute(HandleRef jarg1, string jarg2, uint jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_persistant_execute_trans")]
-  public static extern int switch_cache_db_persistant_execute_trans(HandleRef jarg1, string jarg2, uint jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_detach")]
-  public static extern void switch_cache_db_detach();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_debug_level")]
-  public static extern uint switch_core_debug_level();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CMD_CHUNK_LEN_get")]
-  public static extern int SWITCH_CMD_CHUNK_LEN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_loop")]
-  public static extern void switch_console_loop();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_stream_raw_write")]
-  public static extern int switch_console_stream_raw_write(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_write_file_contents")]
-  public static extern int switch_stream_write_file_contents(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_toupper")]
-  public static extern int switch_toupper(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_tolower")]
-  public static extern int switch_tolower(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_isalnum")]
-  public static extern int switch_isalnum(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_isalpha")]
-  public static extern int switch_isalpha(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_iscntrl")]
-  public static extern int switch_iscntrl(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_isdigit")]
-  public static extern int switch_isdigit(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_isgraph")]
-  public static extern int switch_isgraph(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_islower")]
-  public static extern int switch_islower(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_isprint")]
-  public static extern int switch_isprint(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ispunct")]
-  public static extern int switch_ispunct(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_isspace")]
-  public static extern int switch_isspace(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_isupper")]
-  public static extern int switch_isupper(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_isxdigit")]
-  public static extern int switch_isxdigit(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SMAX_get")]
-  public static extern int SWITCH_SMAX_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SMIN_get")]
-  public static extern int SWITCH_SMIN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_zstr")]
-  public static extern int zstr(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_is_moh")]
-  public static extern int switch_is_moh(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_string_has_escaped_data")]
-  public static extern int switch_string_has_escaped_data(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_b64_encode")]
-  public static extern int switch_b64_encode(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_b64_decode")]
-  public static extern IntPtr switch_b64_decode(string jarg1, string jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_amp_encode")]
-  public static extern string switch_amp_encode(string jarg1, string jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_is_digit_string")]
-  public static extern int switch_is_digit_string(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_fd_read_line")]
-  public static extern IntPtr switch_fd_read_line(int jarg1, string jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_alloc")]
-  public static extern int switch_frame_alloc(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_dup")]
-  public static extern int switch_frame_dup(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_free")]
-  public static extern int switch_frame_free(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_resolve_host")]
-  public static extern int switch_resolve_host(string jarg1, string jarg2, uint jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_find_local_ip")]
-  public static extern int switch_find_local_ip(string jarg1, int jarg2, HandleRef jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_get_addr")]
-  public static extern string get_addr(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_get_addr_int")]
-  public static extern int get_addr_int(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cmp_addr")]
-  public static extern int switch_cmp_addr(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_get_port")]
-  public static extern ushort get_port(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_build_uri")]
-  public static extern int switch_build_uri(string jarg1, HandleRef jarg2, string jarg3, string jarg4, HandleRef jarg5, int jarg6);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_priority_name")]
-  public static extern string switch_priority_name(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rfc2833_to_char")]
-  public static extern char switch_rfc2833_to_char(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_char_to_rfc2833")]
-  public static extern byte switch_char_to_rfc2833(char jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_sanitize_number")]
-  public static extern string switch_sanitize_number(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_string_var_check")]
-  public static extern int switch_string_var_check(string jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_string_var_check_const")]
-  public static extern int switch_string_var_check_const(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_var_clean_string")]
-  public static extern string switch_var_clean_string(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_clean_string")]
-  public static extern string switch_clean_string(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_safe_strdup")]
-  public static extern string switch_safe_strdup(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_lc_strdup")]
-  public static extern string switch_lc_strdup(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_uc_strdup")]
-  public static extern string switch_uc_strdup(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_strstr")]
-  public static extern int switch_strstr(string jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_str_time")]
-  public static extern IntPtr switch_str_time(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_separate_string")]
-  public static extern uint switch_separate_string(string jarg1, char jarg2, ref string jarg3, uint jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_separate_string_string")]
-  public static extern uint switch_separate_string_string(string jarg1, string jarg2, ref string jarg3, uint jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_is_number")]
-  public static extern int switch_is_number(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_strip_spaces")]
-  public static extern string switch_strip_spaces(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_separate_paren_args")]
-  public static extern string switch_separate_paren_args(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_stristr")]
-  public static extern string switch_stristr(string jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_is_lan_addr")]
-  public static extern int switch_is_lan_addr(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_replace_char")]
-  public static extern string switch_replace_char(string jarg1, char jarg2, char jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ast2regex")]
-  public static extern int switch_ast2regex(string jarg1, string jarg2, uint jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_escape_char")]
-  public static extern string switch_escape_char(HandleRef jarg1, string jarg2, string jarg3, char jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_socket_waitfor")]
-  public static extern int switch_socket_waitfor(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_cut_path")]
-  public static extern string switch_cut_path(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_string_replace")]
-  public static extern string switch_string_replace(string jarg1, string jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_string_match")]
-  public static extern int switch_string_match(string jarg1, uint jarg2, string jarg3, uint jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_util_quote_shell_arg")]
-  public static extern string switch_util_quote_shell_arg(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_url_encode")]
-  public static extern uint switch_url_encode(string jarg1, string jarg2, uint jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_url_decode")]
-  public static extern string switch_url_decode(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_simple_email")]
-  public static extern int switch_simple_email(string jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_find_end_paren")]
-  public static extern string switch_find_end_paren(string jarg1, char jarg2, char jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_is_file_path")]
-  public static extern int switch_is_file_path(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_parse_cidr")]
-  public static extern int switch_parse_cidr(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_create")]
-  public static extern int switch_network_list_create(HandleRef jarg1, string jarg2, int jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_add_cidr_token")]
-  public static extern int switch_network_list_add_cidr_token(HandleRef jarg1, string jarg2, int jarg3, string jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_add_host_mask")]
-  public static extern int switch_network_list_add_host_mask(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_validate_ip_token")]
-  public static extern int switch_network_list_validate_ip_token(HandleRef jarg1, uint jarg2, ref string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_number_cmp")]
-  public static extern int switch_number_cmp(string jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_username_set")]
-  public static extern void switch_caller_profile_username_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_username_get")]
-  public static extern string switch_caller_profile_username_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_dialplan_set")]
-  public static extern void switch_caller_profile_dialplan_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_dialplan_get")]
-  public static extern string switch_caller_profile_dialplan_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_caller_id_name_set")]
-  public static extern void switch_caller_profile_caller_id_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_caller_id_name_get")]
-  public static extern string switch_caller_profile_caller_id_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_caller_id_number_set")]
-  public static extern void switch_caller_profile_caller_id_number_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_caller_id_number_get")]
-  public static extern string switch_caller_profile_caller_id_number_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_callee_id_name_set")]
-  public static extern void switch_caller_profile_callee_id_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_callee_id_name_get")]
-  public static extern string switch_caller_profile_callee_id_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_callee_id_number_set")]
-  public static extern void switch_caller_profile_callee_id_number_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_callee_id_number_get")]
-  public static extern string switch_caller_profile_callee_id_number_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_caller_ton_set")]
-  public static extern void switch_caller_profile_caller_ton_set(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_caller_ton_get")]
-  public static extern byte switch_caller_profile_caller_ton_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_caller_numplan_set")]
-  public static extern void switch_caller_profile_caller_numplan_set(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_caller_numplan_get")]
-  public static extern byte switch_caller_profile_caller_numplan_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_network_addr_set")]
-  public static extern void switch_caller_profile_network_addr_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_network_addr_get")]
-  public static extern string switch_caller_profile_network_addr_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_ani_set")]
-  public static extern void switch_caller_profile_ani_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_ani_get")]
-  public static extern string switch_caller_profile_ani_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_ani_ton_set")]
-  public static extern void switch_caller_profile_ani_ton_set(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_ani_ton_get")]
-  public static extern byte switch_caller_profile_ani_ton_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_ani_numplan_set")]
-  public static extern void switch_caller_profile_ani_numplan_set(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_ani_numplan_get")]
-  public static extern byte switch_caller_profile_ani_numplan_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_aniii_set")]
-  public static extern void switch_caller_profile_aniii_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_aniii_get")]
-  public static extern string switch_caller_profile_aniii_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_rdnis_set")]
-  public static extern void switch_caller_profile_rdnis_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_rdnis_get")]
-  public static extern string switch_caller_profile_rdnis_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_rdnis_ton_set")]
-  public static extern void switch_caller_profile_rdnis_ton_set(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_rdnis_ton_get")]
-  public static extern byte switch_caller_profile_rdnis_ton_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_rdnis_numplan_set")]
-  public static extern void switch_caller_profile_rdnis_numplan_set(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_rdnis_numplan_get")]
-  public static extern byte switch_caller_profile_rdnis_numplan_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_destination_number_set")]
-  public static extern void switch_caller_profile_destination_number_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_destination_number_get")]
-  public static extern string switch_caller_profile_destination_number_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_destination_number_ton_set")]
-  public static extern void switch_caller_profile_destination_number_ton_set(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_destination_number_ton_get")]
-  public static extern byte switch_caller_profile_destination_number_ton_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_destination_number_numplan_set")]
-  public static extern void switch_caller_profile_destination_number_numplan_set(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_destination_number_numplan_get")]
-  public static extern byte switch_caller_profile_destination_number_numplan_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_source_set")]
-  public static extern void switch_caller_profile_source_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_source_get")]
-  public static extern string switch_caller_profile_source_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_chan_name_set")]
-  public static extern void switch_caller_profile_chan_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_chan_name_get")]
-  public static extern string switch_caller_profile_chan_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_uuid_set")]
-  public static extern void switch_caller_profile_uuid_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_uuid_get")]
-  public static extern string switch_caller_profile_uuid_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_context_set")]
-  public static extern void switch_caller_profile_context_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_context_get")]
-  public static extern string switch_caller_profile_context_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_profile_index_set")]
-  public static extern void switch_caller_profile_profile_index_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_profile_index_get")]
-  public static extern string switch_caller_profile_profile_index_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_flags_set")]
-  public static extern void switch_caller_profile_flags_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_flags_get")]
-  public static extern uint switch_caller_profile_flags_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_originator_caller_profile_set")]
-  public static extern void switch_caller_profile_originator_caller_profile_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_originator_caller_profile_get")]
-  public static extern IntPtr switch_caller_profile_originator_caller_profile_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_originatee_caller_profile_set")]
-  public static extern void switch_caller_profile_originatee_caller_profile_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_originatee_caller_profile_get")]
-  public static extern IntPtr switch_caller_profile_originatee_caller_profile_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_hunt_caller_profile_set")]
-  public static extern void switch_caller_profile_hunt_caller_profile_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_hunt_caller_profile_get")]
-  public static extern IntPtr switch_caller_profile_hunt_caller_profile_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_times_set")]
-  public static extern void switch_caller_profile_times_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_times_get")]
-  public static extern IntPtr switch_caller_profile_times_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_caller_extension_set")]
-  public static extern void switch_caller_profile_caller_extension_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_caller_extension_get")]
-  public static extern IntPtr switch_caller_profile_caller_extension_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_pool_set")]
-  public static extern void switch_caller_profile_pool_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_pool_get")]
-  public static extern IntPtr switch_caller_profile_pool_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_next_set")]
-  public static extern void switch_caller_profile_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_next_get")]
-  public static extern IntPtr switch_caller_profile_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_caller_profile")]
-  public static extern IntPtr new_switch_caller_profile();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_caller_profile")]
-  public static extern void delete_switch_caller_profile(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_application_application_name_set")]
-  public static extern void switch_caller_application_application_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_application_application_name_get")]
-  public static extern string switch_caller_application_application_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_application_application_data_set")]
-  public static extern void switch_caller_application_application_data_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_application_application_data_get")]
-  public static extern string switch_caller_application_application_data_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_application_application_function_set")]
-  public static extern void switch_caller_application_application_function_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_application_application_function_get")]
-  public static extern IntPtr switch_caller_application_application_function_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_application_next_set")]
-  public static extern void switch_caller_application_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_application_next_get")]
-  public static extern IntPtr switch_caller_application_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_caller_application")]
-  public static extern IntPtr new_switch_caller_application();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_caller_application")]
-  public static extern void delete_switch_caller_application(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_extension_name_set")]
-  public static extern void switch_caller_extension_extension_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_extension_name_get")]
-  public static extern string switch_caller_extension_extension_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_extension_number_set")]
-  public static extern void switch_caller_extension_extension_number_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_extension_number_get")]
-  public static extern string switch_caller_extension_extension_number_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_current_application_set")]
-  public static extern void switch_caller_extension_current_application_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_current_application_get")]
-  public static extern IntPtr switch_caller_extension_current_application_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_last_application_set")]
-  public static extern void switch_caller_extension_last_application_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_last_application_get")]
-  public static extern IntPtr switch_caller_extension_last_application_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_applications_set")]
-  public static extern void switch_caller_extension_applications_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_applications_get")]
-  public static extern IntPtr switch_caller_extension_applications_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_children_set")]
-  public static extern void switch_caller_extension_children_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_children_get")]
-  public static extern IntPtr switch_caller_extension_children_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_next_set")]
-  public static extern void switch_caller_extension_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_next_get")]
-  public static extern IntPtr switch_caller_extension_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_caller_extension")]
-  public static extern IntPtr new_switch_caller_extension();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_caller_extension")]
-  public static extern void delete_switch_caller_extension(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_new")]
-  public static extern IntPtr switch_caller_extension_new(HandleRef jarg1, string jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_clone")]
-  public static extern int switch_caller_extension_clone(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_add_application")]
-  public static extern void switch_caller_extension_add_application(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_add_application_printf")]
-  public static extern void switch_caller_extension_add_application_printf(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_get_field_by_name")]
-  public static extern string switch_caller_get_field_by_name(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_new")]
-  public static extern IntPtr switch_caller_profile_new(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, string jarg11, string jarg12);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_clone")]
-  public static extern IntPtr switch_caller_profile_clone(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_dup")]
-  public static extern IntPtr switch_caller_profile_dup(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_event_set_data")]
-  public static extern void switch_caller_profile_event_set_data(HandleRef jarg1, string jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_codec_set")]
-  public static extern void switch_frame_codec_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_codec_get")]
-  public static extern IntPtr switch_frame_codec_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_source_set")]
-  public static extern void switch_frame_source_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_source_get")]
-  public static extern string switch_frame_source_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_packet_set")]
-  public static extern void switch_frame_packet_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_packet_get")]
-  public static extern IntPtr switch_frame_packet_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_packetlen_set")]
-  public static extern void switch_frame_packetlen_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_packetlen_get")]
-  public static extern uint switch_frame_packetlen_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_extra_data_set")]
-  public static extern void switch_frame_extra_data_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_extra_data_get")]
-  public static extern IntPtr switch_frame_extra_data_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_data_set")]
-  public static extern void switch_frame_data_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_data_get")]
-  public static extern IntPtr switch_frame_data_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_datalen_set")]
-  public static extern void switch_frame_datalen_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_datalen_get")]
-  public static extern uint switch_frame_datalen_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_buflen_set")]
-  public static extern void switch_frame_buflen_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_buflen_get")]
-  public static extern uint switch_frame_buflen_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_samples_set")]
-  public static extern void switch_frame_samples_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_samples_get")]
-  public static extern uint switch_frame_samples_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_rate_set")]
-  public static extern void switch_frame_rate_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_rate_get")]
-  public static extern uint switch_frame_rate_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_payload_set")]
-  public static extern void switch_frame_payload_set(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_payload_get")]
-  public static extern byte switch_frame_payload_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_timestamp_set")]
-  public static extern void switch_frame_timestamp_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_timestamp_get")]
-  public static extern IntPtr switch_frame_timestamp_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_seq_set")]
-  public static extern void switch_frame_seq_set(HandleRef jarg1, ushort jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_seq_get")]
-  public static extern ushort switch_frame_seq_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_ssrc_set")]
-  public static extern void switch_frame_ssrc_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_ssrc_get")]
-  public static extern uint switch_frame_ssrc_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_m_set")]
-  public static extern void switch_frame_m_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_m_get")]
-  public static extern int switch_frame_m_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_flags_set")]
-  public static extern void switch_frame_flags_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_flags_get")]
-  public static extern uint switch_frame_flags_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_frame")]
-  public static extern IntPtr new_switch_frame();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_frame")]
-  public static extern void delete_switch_frame(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_init_set")]
-  public static extern void switch_state_handler_table_on_init_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_init_get")]
-  public static extern IntPtr switch_state_handler_table_on_init_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_routing_set")]
-  public static extern void switch_state_handler_table_on_routing_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_routing_get")]
-  public static extern IntPtr switch_state_handler_table_on_routing_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_execute_set")]
-  public static extern void switch_state_handler_table_on_execute_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_execute_get")]
-  public static extern IntPtr switch_state_handler_table_on_execute_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_hangup_set")]
-  public static extern void switch_state_handler_table_on_hangup_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_hangup_get")]
-  public static extern IntPtr switch_state_handler_table_on_hangup_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_exchange_media_set")]
-  public static extern void switch_state_handler_table_on_exchange_media_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_exchange_media_get")]
-  public static extern IntPtr switch_state_handler_table_on_exchange_media_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_soft_execute_set")]
-  public static extern void switch_state_handler_table_on_soft_execute_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_soft_execute_get")]
-  public static extern IntPtr switch_state_handler_table_on_soft_execute_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_consume_media_set")]
-  public static extern void switch_state_handler_table_on_consume_media_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_consume_media_get")]
-  public static extern IntPtr switch_state_handler_table_on_consume_media_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_hibernate_set")]
-  public static extern void switch_state_handler_table_on_hibernate_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_hibernate_get")]
-  public static extern IntPtr switch_state_handler_table_on_hibernate_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_reset_set")]
-  public static extern void switch_state_handler_table_on_reset_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_reset_get")]
-  public static extern IntPtr switch_state_handler_table_on_reset_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_park_set")]
-  public static extern void switch_state_handler_table_on_park_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_park_get")]
-  public static extern IntPtr switch_state_handler_table_on_park_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_reporting_set")]
-  public static extern void switch_state_handler_table_on_reporting_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_reporting_get")]
-  public static extern IntPtr switch_state_handler_table_on_reporting_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_destroy_set")]
-  public static extern void switch_state_handler_table_on_destroy_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_destroy_get")]
-  public static extern IntPtr switch_state_handler_table_on_destroy_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_flags_set")]
-  public static extern void switch_state_handler_table_flags_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_flags_get")]
-  public static extern int switch_state_handler_table_flags_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_padding_set")]
-  public static extern void switch_state_handler_table_padding_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_padding_get")]
-  public static extern IntPtr switch_state_handler_table_padding_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_state_handler_table")]
-  public static extern IntPtr new_switch_state_handler_table();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_state_handler_table")]
-  public static extern void delete_switch_state_handler_table(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_write_function_set")]
-  public static extern void switch_stream_handle_write_function_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_write_function_get")]
-  public static extern IntPtr switch_stream_handle_write_function_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_raw_write_function_set")]
-  public static extern void switch_stream_handle_raw_write_function_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_raw_write_function_get")]
-  public static extern IntPtr switch_stream_handle_raw_write_function_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_data_set")]
-  public static extern void switch_stream_handle_data_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_data_get")]
-  public static extern IntPtr switch_stream_handle_data_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_end_set")]
-  public static extern void switch_stream_handle_end_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_end_get")]
-  public static extern IntPtr switch_stream_handle_end_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_data_size_set")]
-  public static extern void switch_stream_handle_data_size_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_data_size_get")]
-  public static extern IntPtr switch_stream_handle_data_size_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_data_len_set")]
-  public static extern void switch_stream_handle_data_len_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_data_len_get")]
-  public static extern IntPtr switch_stream_handle_data_len_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_alloc_len_set")]
-  public static extern void switch_stream_handle_alloc_len_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_alloc_len_get")]
-  public static extern IntPtr switch_stream_handle_alloc_len_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_alloc_chunk_set")]
-  public static extern void switch_stream_handle_alloc_chunk_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_alloc_chunk_get")]
-  public static extern IntPtr switch_stream_handle_alloc_chunk_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_param_event_set")]
-  public static extern void switch_stream_handle_param_event_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_param_event_get")]
-  public static extern IntPtr switch_stream_handle_param_event_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_stream_handle")]
-  public static extern IntPtr new_switch_stream_handle();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_stream_handle")]
-  public static extern void delete_switch_stream_handle(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_outgoing_channel_set")]
-  public static extern void switch_io_routines_outgoing_channel_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_outgoing_channel_get")]
-  public static extern IntPtr switch_io_routines_outgoing_channel_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_read_frame_set")]
-  public static extern void switch_io_routines_read_frame_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_read_frame_get")]
-  public static extern IntPtr switch_io_routines_read_frame_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_write_frame_set")]
-  public static extern void switch_io_routines_write_frame_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_write_frame_get")]
-  public static extern IntPtr switch_io_routines_write_frame_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_kill_channel_set")]
-  public static extern void switch_io_routines_kill_channel_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_kill_channel_get")]
-  public static extern IntPtr switch_io_routines_kill_channel_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_send_dtmf_set")]
-  public static extern void switch_io_routines_send_dtmf_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_send_dtmf_get")]
-  public static extern IntPtr switch_io_routines_send_dtmf_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_receive_message_set")]
-  public static extern void switch_io_routines_receive_message_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_receive_message_get")]
-  public static extern IntPtr switch_io_routines_receive_message_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_receive_event_set")]
-  public static extern void switch_io_routines_receive_event_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_receive_event_get")]
-  public static extern IntPtr switch_io_routines_receive_event_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_state_change_set")]
-  public static extern void switch_io_routines_state_change_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_state_change_get")]
-  public static extern IntPtr switch_io_routines_state_change_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_read_video_frame_set")]
-  public static extern void switch_io_routines_read_video_frame_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_read_video_frame_get")]
-  public static extern IntPtr switch_io_routines_read_video_frame_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_write_video_frame_set")]
-  public static extern void switch_io_routines_write_video_frame_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_write_video_frame_get")]
-  public static extern IntPtr switch_io_routines_write_video_frame_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_resurrect_session_set")]
-  public static extern void switch_io_routines_resurrect_session_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_resurrect_session_get")]
-  public static extern IntPtr switch_io_routines_resurrect_session_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_padding_set")]
-  public static extern void switch_io_routines_padding_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_padding_get")]
-  public static extern IntPtr switch_io_routines_padding_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_routines")]
-  public static extern IntPtr new_switch_io_routines();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_routines")]
-  public static extern void delete_switch_io_routines(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_interface_name_set")]
-  public static extern void switch_endpoint_interface_interface_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_interface_name_get")]
-  public static extern string switch_endpoint_interface_interface_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_io_routines_set")]
-  public static extern void switch_endpoint_interface_io_routines_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_io_routines_get")]
-  public static extern IntPtr switch_endpoint_interface_io_routines_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_state_handler_set")]
-  public static extern void switch_endpoint_interface_state_handler_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_state_handler_get")]
-  public static extern IntPtr switch_endpoint_interface_state_handler_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_private_info_set")]
-  public static extern void switch_endpoint_interface_private_info_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_private_info_get")]
-  public static extern IntPtr switch_endpoint_interface_private_info_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_rwlock_set")]
-  public static extern void switch_endpoint_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_rwlock_get")]
-  public static extern IntPtr switch_endpoint_interface_rwlock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_refs_set")]
-  public static extern void switch_endpoint_interface_refs_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_refs_get")]
-  public static extern int switch_endpoint_interface_refs_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_reflock_set")]
-  public static extern void switch_endpoint_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_reflock_get")]
-  public static extern IntPtr switch_endpoint_interface_reflock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_parent_set")]
-  public static extern void switch_endpoint_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_parent_get")]
-  public static extern IntPtr switch_endpoint_interface_parent_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_next_set")]
-  public static extern void switch_endpoint_interface_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_next_get")]
-  public static extern IntPtr switch_endpoint_interface_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_endpoint_interface")]
-  public static extern IntPtr new_switch_endpoint_interface();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_endpoint_interface")]
-  public static extern void delete_switch_endpoint_interface(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interval_set")]
-  public static extern void switch_timer_interval_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interval_get")]
-  public static extern int switch_timer_interval_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_flags_set")]
-  public static extern void switch_timer_flags_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_flags_get")]
-  public static extern uint switch_timer_flags_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_samples_set")]
-  public static extern void switch_timer_samples_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_samples_get")]
-  public static extern uint switch_timer_samples_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_samplecount_set")]
-  public static extern void switch_timer_samplecount_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_samplecount_get")]
-  public static extern uint switch_timer_samplecount_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_timer_interface_set")]
-  public static extern void switch_timer_timer_interface_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_timer_interface_get")]
-  public static extern IntPtr switch_timer_timer_interface_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_memory_pool_set")]
-  public static extern void switch_timer_memory_pool_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_memory_pool_get")]
-  public static extern IntPtr switch_timer_memory_pool_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_private_info_set")]
-  public static extern void switch_timer_private_info_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_private_info_get")]
-  public static extern IntPtr switch_timer_private_info_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_diff_set")]
-  public static extern void switch_timer_diff_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_diff_get")]
-  public static extern IntPtr switch_timer_diff_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_tick_set")]
-  public static extern void switch_timer_tick_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_tick_get")]
-  public static extern IntPtr switch_timer_tick_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_timer")]
-  public static extern IntPtr new_switch_timer();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_timer")]
-  public static extern void delete_switch_timer(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_interface_name_set")]
-  public static extern void switch_timer_interface_interface_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_interface_name_get")]
-  public static extern string switch_timer_interface_interface_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_init_set")]
-  public static extern void switch_timer_interface_timer_init_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_init_get")]
-  public static extern IntPtr switch_timer_interface_timer_init_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_next_set")]
-  public static extern void switch_timer_interface_timer_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_next_get")]
-  public static extern IntPtr switch_timer_interface_timer_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_step_set")]
-  public static extern void switch_timer_interface_timer_step_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_step_get")]
-  public static extern IntPtr switch_timer_interface_timer_step_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_sync_set")]
-  public static extern void switch_timer_interface_timer_sync_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_sync_get")]
-  public static extern IntPtr switch_timer_interface_timer_sync_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_check_set")]
-  public static extern void switch_timer_interface_timer_check_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_check_get")]
-  public static extern IntPtr switch_timer_interface_timer_check_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_destroy_set")]
-  public static extern void switch_timer_interface_timer_destroy_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_destroy_get")]
-  public static extern IntPtr switch_timer_interface_timer_destroy_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_rwlock_set")]
-  public static extern void switch_timer_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_rwlock_get")]
-  public static extern IntPtr switch_timer_interface_rwlock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_refs_set")]
-  public static extern void switch_timer_interface_refs_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_refs_get")]
-  public static extern int switch_timer_interface_refs_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_reflock_set")]
-  public static extern void switch_timer_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_reflock_get")]
-  public static extern IntPtr switch_timer_interface_reflock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_parent_set")]
-  public static extern void switch_timer_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_parent_get")]
-  public static extern IntPtr switch_timer_interface_parent_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_next_set")]
-  public static extern void switch_timer_interface_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_next_get")]
-  public static extern IntPtr switch_timer_interface_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_timer_interface")]
-  public static extern IntPtr new_switch_timer_interface();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_timer_interface")]
-  public static extern void delete_switch_timer_interface(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_interface_name_set")]
-  public static extern void switch_dialplan_interface_interface_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_interface_name_get")]
-  public static extern string switch_dialplan_interface_interface_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_hunt_function_set")]
-  public static extern void switch_dialplan_interface_hunt_function_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_hunt_function_get")]
-  public static extern IntPtr switch_dialplan_interface_hunt_function_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_rwlock_set")]
-  public static extern void switch_dialplan_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_rwlock_get")]
-  public static extern IntPtr switch_dialplan_interface_rwlock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_refs_set")]
-  public static extern void switch_dialplan_interface_refs_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_refs_get")]
-  public static extern int switch_dialplan_interface_refs_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_reflock_set")]
-  public static extern void switch_dialplan_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_reflock_get")]
-  public static extern IntPtr switch_dialplan_interface_reflock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_parent_set")]
-  public static extern void switch_dialplan_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_parent_get")]
-  public static extern IntPtr switch_dialplan_interface_parent_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_next_set")]
-  public static extern void switch_dialplan_interface_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_next_get")]
-  public static extern IntPtr switch_dialplan_interface_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_dialplan_interface")]
-  public static extern IntPtr new_switch_dialplan_interface();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_dialplan_interface")]
-  public static extern void delete_switch_dialplan_interface(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_interface_name_set")]
-  public static extern void switch_file_interface_interface_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_interface_name_get")]
-  public static extern string switch_file_interface_interface_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_open_set")]
-  public static extern void switch_file_interface_file_open_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_open_get")]
-  public static extern IntPtr switch_file_interface_file_open_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_close_set")]
-  public static extern void switch_file_interface_file_close_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_close_get")]
-  public static extern IntPtr switch_file_interface_file_close_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_truncate_set")]
-  public static extern void switch_file_interface_file_truncate_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_truncate_get")]
-  public static extern IntPtr switch_file_interface_file_truncate_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_read_set")]
-  public static extern void switch_file_interface_file_read_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_read_get")]
-  public static extern IntPtr switch_file_interface_file_read_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_write_set")]
-  public static extern void switch_file_interface_file_write_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_write_get")]
-  public static extern IntPtr switch_file_interface_file_write_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_seek_set")]
-  public static extern void switch_file_interface_file_seek_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_seek_get")]
-  public static extern IntPtr switch_file_interface_file_seek_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_set_string_set")]
-  public static extern void switch_file_interface_file_set_string_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_set_string_get")]
-  public static extern IntPtr switch_file_interface_file_set_string_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_get_string_set")]
-  public static extern void switch_file_interface_file_get_string_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_get_string_get")]
-  public static extern IntPtr switch_file_interface_file_get_string_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_extens_set")]
-  public static extern void switch_file_interface_extens_set(HandleRef jarg1, ref string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_extens_get")]
-  public static extern string switch_file_interface_extens_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_rwlock_set")]
-  public static extern void switch_file_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_rwlock_get")]
-  public static extern IntPtr switch_file_interface_rwlock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_refs_set")]
-  public static extern void switch_file_interface_refs_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_refs_get")]
-  public static extern int switch_file_interface_refs_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_reflock_set")]
-  public static extern void switch_file_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_reflock_get")]
-  public static extern IntPtr switch_file_interface_reflock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_parent_set")]
-  public static extern void switch_file_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_parent_get")]
-  public static extern IntPtr switch_file_interface_parent_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_next_set")]
-  public static extern void switch_file_interface_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_next_get")]
-  public static extern IntPtr switch_file_interface_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_file_interface")]
-  public static extern IntPtr new_switch_file_interface();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_file_interface")]
-  public static extern void delete_switch_file_interface(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_file_interface_set")]
-  public static extern void switch_file_handle_file_interface_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_file_interface_get")]
-  public static extern IntPtr switch_file_handle_file_interface_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_flags_set")]
-  public static extern void switch_file_handle_flags_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_flags_get")]
-  public static extern uint switch_file_handle_flags_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_fd_set")]
-  public static extern void switch_file_handle_fd_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_fd_get")]
-  public static extern IntPtr switch_file_handle_fd_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_samples_set")]
-  public static extern void switch_file_handle_samples_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_samples_get")]
-  public static extern uint switch_file_handle_samples_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_samplerate_set")]
-  public static extern void switch_file_handle_samplerate_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_samplerate_get")]
-  public static extern uint switch_file_handle_samplerate_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_native_rate_set")]
-  public static extern void switch_file_handle_native_rate_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_native_rate_get")]
-  public static extern uint switch_file_handle_native_rate_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_channels_set")]
-  public static extern void switch_file_handle_channels_set(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_channels_get")]
-  public static extern byte switch_file_handle_channels_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_format_set")]
-  public static extern void switch_file_handle_format_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_format_get")]
-  public static extern uint switch_file_handle_format_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_sections_set")]
-  public static extern void switch_file_handle_sections_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_sections_get")]
-  public static extern uint switch_file_handle_sections_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_seekable_set")]
-  public static extern void switch_file_handle_seekable_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_seekable_get")]
-  public static extern int switch_file_handle_seekable_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_sample_count_set")]
-  public static extern void switch_file_handle_sample_count_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_sample_count_get")]
-  public static extern IntPtr switch_file_handle_sample_count_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_speed_set")]
-  public static extern void switch_file_handle_speed_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_speed_get")]
-  public static extern int switch_file_handle_speed_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_memory_pool_set")]
-  public static extern void switch_file_handle_memory_pool_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_memory_pool_get")]
-  public static extern IntPtr switch_file_handle_memory_pool_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_prebuf_set")]
-  public static extern void switch_file_handle_prebuf_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_prebuf_get")]
-  public static extern uint switch_file_handle_prebuf_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_interval_set")]
-  public static extern void switch_file_handle_interval_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_interval_get")]
-  public static extern uint switch_file_handle_interval_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_private_info_set")]
-  public static extern void switch_file_handle_private_info_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_private_info_get")]
-  public static extern IntPtr switch_file_handle_private_info_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_handler_set")]
-  public static extern void switch_file_handle_handler_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_handler_get")]
-  public static extern string switch_file_handle_handler_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pos_set")]
-  public static extern void switch_file_handle_pos_set(HandleRef jarg1, long jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pos_get")]
-  public static extern long switch_file_handle_pos_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_audio_buffer_set")]
-  public static extern void switch_file_handle_audio_buffer_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_audio_buffer_get")]
-  public static extern IntPtr switch_file_handle_audio_buffer_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_sp_audio_buffer_set")]
-  public static extern void switch_file_handle_sp_audio_buffer_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_sp_audio_buffer_get")]
-  public static extern IntPtr switch_file_handle_sp_audio_buffer_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_thresh_set")]
-  public static extern void switch_file_handle_thresh_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_thresh_get")]
-  public static extern uint switch_file_handle_thresh_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_silence_hits_set")]
-  public static extern void switch_file_handle_silence_hits_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_silence_hits_get")]
-  public static extern uint switch_file_handle_silence_hits_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_offset_pos_set")]
-  public static extern void switch_file_handle_offset_pos_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_offset_pos_get")]
-  public static extern uint switch_file_handle_offset_pos_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_samples_in_set")]
-  public static extern void switch_file_handle_samples_in_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_samples_in_get")]
-  public static extern IntPtr switch_file_handle_samples_in_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_samples_out_set")]
-  public static extern void switch_file_handle_samples_out_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_samples_out_get")]
-  public static extern IntPtr switch_file_handle_samples_out_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_vol_set")]
-  public static extern void switch_file_handle_vol_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_vol_get")]
-  public static extern int switch_file_handle_vol_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_resampler_set")]
-  public static extern void switch_file_handle_resampler_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_resampler_get")]
-  public static extern IntPtr switch_file_handle_resampler_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_buffer_set")]
-  public static extern void switch_file_handle_buffer_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_buffer_get")]
-  public static extern IntPtr switch_file_handle_buffer_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_dbuf_set")]
-  public static extern void switch_file_handle_dbuf_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_dbuf_get")]
-  public static extern IntPtr switch_file_handle_dbuf_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_dbuflen_set")]
-  public static extern void switch_file_handle_dbuflen_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_dbuflen_get")]
-  public static extern IntPtr switch_file_handle_dbuflen_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pre_buffer_set")]
-  public static extern void switch_file_handle_pre_buffer_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pre_buffer_get")]
-  public static extern IntPtr switch_file_handle_pre_buffer_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pre_buffer_data_set")]
-  public static extern void switch_file_handle_pre_buffer_data_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pre_buffer_data_get")]
-  public static extern IntPtr switch_file_handle_pre_buffer_data_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pre_buffer_datalen_set")]
-  public static extern void switch_file_handle_pre_buffer_datalen_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pre_buffer_datalen_get")]
-  public static extern IntPtr switch_file_handle_pre_buffer_datalen_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_file_set")]
-  public static extern void switch_file_handle_file_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_file_get")]
-  public static extern string switch_file_handle_file_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_func_set")]
-  public static extern void switch_file_handle_func_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_func_get")]
-  public static extern string switch_file_handle_func_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_line_set")]
-  public static extern void switch_file_handle_line_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_line_get")]
-  public static extern int switch_file_handle_line_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_file_path_set")]
-  public static extern void switch_file_handle_file_path_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_file_path_get")]
-  public static extern string switch_file_handle_file_path_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_spool_path_set")]
-  public static extern void switch_file_handle_spool_path_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_spool_path_get")]
-  public static extern string switch_file_handle_spool_path_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_file_handle")]
-  public static extern IntPtr new_switch_file_handle();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_file_handle")]
-  public static extern void delete_switch_file_handle(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_interface_name_set")]
-  public static extern void switch_asr_interface_interface_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_interface_name_get")]
-  public static extern string switch_asr_interface_interface_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_open_set")]
-  public static extern void switch_asr_interface_asr_open_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_open_get")]
-  public static extern IntPtr switch_asr_interface_asr_open_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_load_grammar_set")]
-  public static extern void switch_asr_interface_asr_load_grammar_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_load_grammar_get")]
-  public static extern IntPtr switch_asr_interface_asr_load_grammar_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_unload_grammar_set")]
-  public static extern void switch_asr_interface_asr_unload_grammar_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_unload_grammar_get")]
-  public static extern IntPtr switch_asr_interface_asr_unload_grammar_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_close_set")]
-  public static extern void switch_asr_interface_asr_close_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_close_get")]
-  public static extern IntPtr switch_asr_interface_asr_close_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_feed_set")]
-  public static extern void switch_asr_interface_asr_feed_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_feed_get")]
-  public static extern IntPtr switch_asr_interface_asr_feed_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_resume_set")]
-  public static extern void switch_asr_interface_asr_resume_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_resume_get")]
-  public static extern IntPtr switch_asr_interface_asr_resume_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_pause_set")]
-  public static extern void switch_asr_interface_asr_pause_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_pause_get")]
-  public static extern IntPtr switch_asr_interface_asr_pause_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_check_results_set")]
-  public static extern void switch_asr_interface_asr_check_results_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_check_results_get")]
-  public static extern IntPtr switch_asr_interface_asr_check_results_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_get_results_set")]
-  public static extern void switch_asr_interface_asr_get_results_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_get_results_get")]
-  public static extern IntPtr switch_asr_interface_asr_get_results_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_start_input_timers_set")]
-  public static extern void switch_asr_interface_asr_start_input_timers_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_start_input_timers_get")]
-  public static extern IntPtr switch_asr_interface_asr_start_input_timers_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_text_param_set")]
-  public static extern void switch_asr_interface_asr_text_param_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_text_param_get")]
-  public static extern IntPtr switch_asr_interface_asr_text_param_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_numeric_param_set")]
-  public static extern void switch_asr_interface_asr_numeric_param_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_numeric_param_get")]
-  public static extern IntPtr switch_asr_interface_asr_numeric_param_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_float_param_set")]
-  public static extern void switch_asr_interface_asr_float_param_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_float_param_get")]
-  public static extern IntPtr switch_asr_interface_asr_float_param_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_rwlock_set")]
-  public static extern void switch_asr_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_rwlock_get")]
-  public static extern IntPtr switch_asr_interface_rwlock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_refs_set")]
-  public static extern void switch_asr_interface_refs_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_refs_get")]
-  public static extern int switch_asr_interface_refs_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_reflock_set")]
-  public static extern void switch_asr_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_reflock_get")]
-  public static extern IntPtr switch_asr_interface_reflock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_parent_set")]
-  public static extern void switch_asr_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_parent_get")]
-  public static extern IntPtr switch_asr_interface_parent_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_next_set")]
-  public static extern void switch_asr_interface_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_next_get")]
-  public static extern IntPtr switch_asr_interface_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_asr_interface")]
-  public static extern IntPtr new_switch_asr_interface();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_asr_interface")]
-  public static extern void delete_switch_asr_interface(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_asr_interface_set")]
-  public static extern void switch_asr_handle_asr_interface_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_asr_interface_get")]
-  public static extern IntPtr switch_asr_handle_asr_interface_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_flags_set")]
-  public static extern void switch_asr_handle_flags_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_flags_get")]
-  public static extern uint switch_asr_handle_flags_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_name_set")]
-  public static extern void switch_asr_handle_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_name_get")]
-  public static extern string switch_asr_handle_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_codec_set")]
-  public static extern void switch_asr_handle_codec_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_codec_get")]
-  public static extern string switch_asr_handle_codec_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_rate_set")]
-  public static extern void switch_asr_handle_rate_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_rate_get")]
-  public static extern uint switch_asr_handle_rate_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_grammar_set")]
-  public static extern void switch_asr_handle_grammar_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_grammar_get")]
-  public static extern string switch_asr_handle_grammar_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_param_set")]
-  public static extern void switch_asr_handle_param_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_param_get")]
-  public static extern string switch_asr_handle_param_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_memory_pool_set")]
-  public static extern void switch_asr_handle_memory_pool_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_memory_pool_get")]
-  public static extern IntPtr switch_asr_handle_memory_pool_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_private_info_set")]
-  public static extern void switch_asr_handle_private_info_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_private_info_get")]
-  public static extern IntPtr switch_asr_handle_private_info_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_asr_handle")]
-  public static extern IntPtr new_switch_asr_handle();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_asr_handle")]
-  public static extern void delete_switch_asr_handle(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_interface_name_set")]
-  public static extern void switch_speech_interface_interface_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_interface_name_get")]
-  public static extern string switch_speech_interface_interface_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_open_set")]
-  public static extern void switch_speech_interface_speech_open_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_open_get")]
-  public static extern IntPtr switch_speech_interface_speech_open_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_close_set")]
-  public static extern void switch_speech_interface_speech_close_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_close_get")]
-  public static extern IntPtr switch_speech_interface_speech_close_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_feed_tts_set")]
-  public static extern void switch_speech_interface_speech_feed_tts_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_feed_tts_get")]
-  public static extern IntPtr switch_speech_interface_speech_feed_tts_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_read_tts_set")]
-  public static extern void switch_speech_interface_speech_read_tts_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_read_tts_get")]
-  public static extern IntPtr switch_speech_interface_speech_read_tts_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_flush_tts_set")]
-  public static extern void switch_speech_interface_speech_flush_tts_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_flush_tts_get")]
-  public static extern IntPtr switch_speech_interface_speech_flush_tts_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_text_param_tts_set")]
-  public static extern void switch_speech_interface_speech_text_param_tts_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_text_param_tts_get")]
-  public static extern IntPtr switch_speech_interface_speech_text_param_tts_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_numeric_param_tts_set")]
-  public static extern void switch_speech_interface_speech_numeric_param_tts_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_numeric_param_tts_get")]
-  public static extern IntPtr switch_speech_interface_speech_numeric_param_tts_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_float_param_tts_set")]
-  public static extern void switch_speech_interface_speech_float_param_tts_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_float_param_tts_get")]
-  public static extern IntPtr switch_speech_interface_speech_float_param_tts_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_rwlock_set")]
-  public static extern void switch_speech_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_rwlock_get")]
-  public static extern IntPtr switch_speech_interface_rwlock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_refs_set")]
-  public static extern void switch_speech_interface_refs_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_refs_get")]
-  public static extern int switch_speech_interface_refs_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_reflock_set")]
-  public static extern void switch_speech_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_reflock_get")]
-  public static extern IntPtr switch_speech_interface_reflock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_parent_set")]
-  public static extern void switch_speech_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_parent_get")]
-  public static extern IntPtr switch_speech_interface_parent_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_next_set")]
-  public static extern void switch_speech_interface_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_next_get")]
-  public static extern IntPtr switch_speech_interface_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_speech_interface")]
-  public static extern IntPtr new_switch_speech_interface();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_speech_interface")]
-  public static extern void delete_switch_speech_interface(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_speech_interface_set")]
-  public static extern void switch_speech_handle_speech_interface_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_speech_interface_get")]
-  public static extern IntPtr switch_speech_handle_speech_interface_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_flags_set")]
-  public static extern void switch_speech_handle_flags_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_flags_get")]
-  public static extern uint switch_speech_handle_flags_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_name_set")]
-  public static extern void switch_speech_handle_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_name_get")]
-  public static extern string switch_speech_handle_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_rate_set")]
-  public static extern void switch_speech_handle_rate_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_rate_get")]
-  public static extern uint switch_speech_handle_rate_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_speed_set")]
-  public static extern void switch_speech_handle_speed_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_speed_get")]
-  public static extern uint switch_speech_handle_speed_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_samples_set")]
-  public static extern void switch_speech_handle_samples_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_samples_get")]
-  public static extern uint switch_speech_handle_samples_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_voice_set")]
-  public static extern void switch_speech_handle_voice_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_voice_get")]
-  public static extern string switch_speech_handle_voice_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_engine_set")]
-  public static extern void switch_speech_handle_engine_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_engine_get")]
-  public static extern string switch_speech_handle_engine_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_param_set")]
-  public static extern void switch_speech_handle_param_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_param_get")]
-  public static extern string switch_speech_handle_param_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_memory_pool_set")]
-  public static extern void switch_speech_handle_memory_pool_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_memory_pool_get")]
-  public static extern IntPtr switch_speech_handle_memory_pool_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_resampler_set")]
-  public static extern void switch_speech_handle_resampler_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_resampler_get")]
-  public static extern IntPtr switch_speech_handle_resampler_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_buffer_set")]
-  public static extern void switch_speech_handle_buffer_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_buffer_get")]
-  public static extern IntPtr switch_speech_handle_buffer_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_dbuf_set")]
-  public static extern void switch_speech_handle_dbuf_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_dbuf_get")]
-  public static extern IntPtr switch_speech_handle_dbuf_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_dbuflen_set")]
-  public static extern void switch_speech_handle_dbuflen_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_dbuflen_get")]
-  public static extern IntPtr switch_speech_handle_dbuflen_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_samplerate_set")]
-  public static extern void switch_speech_handle_samplerate_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_samplerate_get")]
-  public static extern uint switch_speech_handle_samplerate_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_native_rate_set")]
-  public static extern void switch_speech_handle_native_rate_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_native_rate_get")]
-  public static extern uint switch_speech_handle_native_rate_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_private_info_set")]
-  public static extern void switch_speech_handle_private_info_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_private_info_get")]
-  public static extern IntPtr switch_speech_handle_private_info_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_speech_handle")]
-  public static extern IntPtr new_switch_speech_handle();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_speech_handle")]
-  public static extern void delete_switch_speech_handle(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_interface_name_set")]
-  public static extern void switch_say_interface_interface_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_interface_name_get")]
-  public static extern string switch_say_interface_interface_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_say_function_set")]
-  public static extern void switch_say_interface_say_function_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_say_function_get")]
-  public static extern IntPtr switch_say_interface_say_function_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_rwlock_set")]
-  public static extern void switch_say_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_rwlock_get")]
-  public static extern IntPtr switch_say_interface_rwlock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_refs_set")]
-  public static extern void switch_say_interface_refs_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_refs_get")]
-  public static extern int switch_say_interface_refs_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_reflock_set")]
-  public static extern void switch_say_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_reflock_get")]
-  public static extern IntPtr switch_say_interface_reflock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_parent_set")]
-  public static extern void switch_say_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_parent_get")]
-  public static extern IntPtr switch_say_interface_parent_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_next_set")]
-  public static extern void switch_say_interface_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_next_get")]
-  public static extern IntPtr switch_say_interface_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_say_interface")]
-  public static extern IntPtr new_switch_say_interface();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_say_interface")]
-  public static extern void delete_switch_say_interface(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_interface_name_set")]
-  public static extern void switch_chat_interface_interface_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_interface_name_get")]
-  public static extern string switch_chat_interface_interface_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_chat_send_set")]
-  public static extern void switch_chat_interface_chat_send_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_chat_send_get")]
-  public static extern IntPtr switch_chat_interface_chat_send_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_rwlock_set")]
-  public static extern void switch_chat_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_rwlock_get")]
-  public static extern IntPtr switch_chat_interface_rwlock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_refs_set")]
-  public static extern void switch_chat_interface_refs_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_refs_get")]
-  public static extern int switch_chat_interface_refs_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_reflock_set")]
-  public static extern void switch_chat_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_reflock_get")]
-  public static extern IntPtr switch_chat_interface_reflock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_parent_set")]
-  public static extern void switch_chat_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_parent_get")]
-  public static extern IntPtr switch_chat_interface_parent_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_next_set")]
-  public static extern void switch_chat_interface_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_next_get")]
-  public static extern IntPtr switch_chat_interface_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_chat_interface")]
-  public static extern IntPtr new_switch_chat_interface();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_chat_interface")]
-  public static extern void delete_switch_chat_interface(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_relative_oid_set")]
-  public static extern void switch_management_interface_relative_oid_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_relative_oid_get")]
-  public static extern string switch_management_interface_relative_oid_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_management_function_set")]
-  public static extern void switch_management_interface_management_function_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_management_function_get")]
-  public static extern IntPtr switch_management_interface_management_function_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_rwlock_set")]
-  public static extern void switch_management_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_rwlock_get")]
-  public static extern IntPtr switch_management_interface_rwlock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_refs_set")]
-  public static extern void switch_management_interface_refs_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_refs_get")]
-  public static extern int switch_management_interface_refs_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_reflock_set")]
-  public static extern void switch_management_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_reflock_get")]
-  public static extern IntPtr switch_management_interface_reflock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_parent_set")]
-  public static extern void switch_management_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_parent_get")]
-  public static extern IntPtr switch_management_interface_parent_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_next_set")]
-  public static extern void switch_management_interface_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_next_get")]
-  public static extern IntPtr switch_management_interface_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_management_interface")]
-  public static extern IntPtr new_switch_management_interface();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_management_interface")]
-  public static extern void delete_switch_management_interface(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_interface_name_set")]
-  public static extern void switch_directory_interface_interface_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_interface_name_get")]
-  public static extern string switch_directory_interface_interface_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_directory_open_set")]
-  public static extern void switch_directory_interface_directory_open_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_directory_open_get")]
-  public static extern IntPtr switch_directory_interface_directory_open_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_directory_close_set")]
-  public static extern void switch_directory_interface_directory_close_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_directory_close_get")]
-  public static extern IntPtr switch_directory_interface_directory_close_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_directory_query_set")]
-  public static extern void switch_directory_interface_directory_query_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_directory_query_get")]
-  public static extern IntPtr switch_directory_interface_directory_query_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_directory_next_set")]
-  public static extern void switch_directory_interface_directory_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_directory_next_get")]
-  public static extern IntPtr switch_directory_interface_directory_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_directory_next_pair_set")]
-  public static extern void switch_directory_interface_directory_next_pair_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_directory_next_pair_get")]
-  public static extern IntPtr switch_directory_interface_directory_next_pair_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_rwlock_set")]
-  public static extern void switch_directory_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_rwlock_get")]
-  public static extern IntPtr switch_directory_interface_rwlock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_refs_set")]
-  public static extern void switch_directory_interface_refs_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_refs_get")]
-  public static extern int switch_directory_interface_refs_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_reflock_set")]
-  public static extern void switch_directory_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_reflock_get")]
-  public static extern IntPtr switch_directory_interface_reflock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_parent_set")]
-  public static extern void switch_directory_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_parent_get")]
-  public static extern IntPtr switch_directory_interface_parent_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_next_set")]
-  public static extern void switch_directory_interface_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_next_get")]
-  public static extern IntPtr switch_directory_interface_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_directory_interface")]
-  public static extern IntPtr new_switch_directory_interface();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_directory_interface")]
-  public static extern void delete_switch_directory_interface(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_handle_directory_interface_set")]
-  public static extern void switch_directory_handle_directory_interface_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_handle_directory_interface_get")]
-  public static extern IntPtr switch_directory_handle_directory_interface_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_handle_flags_set")]
-  public static extern void switch_directory_handle_flags_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_handle_flags_get")]
-  public static extern uint switch_directory_handle_flags_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_handle_memory_pool_set")]
-  public static extern void switch_directory_handle_memory_pool_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_handle_memory_pool_get")]
-  public static extern IntPtr switch_directory_handle_memory_pool_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_handle_private_info_set")]
-  public static extern void switch_directory_handle_private_info_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_handle_private_info_get")]
-  public static extern IntPtr switch_directory_handle_private_info_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_directory_handle")]
-  public static extern IntPtr new_switch_directory_handle();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_directory_handle")]
-  public static extern void delete_switch_directory_handle(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_quality_set")]
-  public static extern void switch_codec_settings_quality_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_quality_get")]
-  public static extern int switch_codec_settings_quality_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_complexity_set")]
-  public static extern void switch_codec_settings_complexity_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_complexity_get")]
-  public static extern int switch_codec_settings_complexity_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_enhancement_set")]
-  public static extern void switch_codec_settings_enhancement_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_enhancement_get")]
-  public static extern int switch_codec_settings_enhancement_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vad_set")]
-  public static extern void switch_codec_settings_vad_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vad_get")]
-  public static extern int switch_codec_settings_vad_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vbr_set")]
-  public static extern void switch_codec_settings_vbr_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vbr_get")]
-  public static extern int switch_codec_settings_vbr_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vbr_quality_set")]
-  public static extern void switch_codec_settings_vbr_quality_set(HandleRef jarg1, float jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vbr_quality_get")]
-  public static extern float switch_codec_settings_vbr_quality_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_abr_set")]
-  public static extern void switch_codec_settings_abr_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_abr_get")]
-  public static extern int switch_codec_settings_abr_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_dtx_set")]
-  public static extern void switch_codec_settings_dtx_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_dtx_get")]
-  public static extern int switch_codec_settings_dtx_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_preproc_set")]
-  public static extern void switch_codec_settings_preproc_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_preproc_get")]
-  public static extern int switch_codec_settings_preproc_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_vad_set")]
-  public static extern void switch_codec_settings_pp_vad_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_vad_get")]
-  public static extern int switch_codec_settings_pp_vad_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_agc_set")]
-  public static extern void switch_codec_settings_pp_agc_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_agc_get")]
-  public static extern int switch_codec_settings_pp_agc_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_agc_level_set")]
-  public static extern void switch_codec_settings_pp_agc_level_set(HandleRef jarg1, float jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_agc_level_get")]
-  public static extern float switch_codec_settings_pp_agc_level_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_denoise_set")]
-  public static extern void switch_codec_settings_pp_denoise_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_denoise_get")]
-  public static extern int switch_codec_settings_pp_denoise_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_set")]
-  public static extern void switch_codec_settings_pp_dereverb_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_get")]
-  public static extern int switch_codec_settings_pp_dereverb_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_decay_set")]
-  public static extern void switch_codec_settings_pp_dereverb_decay_set(HandleRef jarg1, float jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_decay_get")]
-  public static extern float switch_codec_settings_pp_dereverb_decay_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_level_set")]
-  public static extern void switch_codec_settings_pp_dereverb_level_set(HandleRef jarg1, float jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_level_get")]
-  public static extern float switch_codec_settings_pp_dereverb_level_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_codec_settings")]
-  public static extern IntPtr new_switch_codec_settings();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_codec_settings")]
-  public static extern void delete_switch_codec_settings(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_codec_interface_set")]
-  public static extern void switch_codec_codec_interface_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_codec_interface_get")]
-  public static extern IntPtr switch_codec_codec_interface_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_set")]
-  public static extern void switch_codec_implementation_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_get")]
-  public static extern IntPtr switch_codec_implementation_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_in_set")]
-  public static extern void switch_codec_fmtp_in_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_in_get")]
-  public static extern string switch_codec_fmtp_in_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_out_set")]
-  public static extern void switch_codec_fmtp_out_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_out_get")]
-  public static extern string switch_codec_fmtp_out_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_codec_settings_set")]
-  public static extern void switch_codec_codec_settings_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_codec_settings_get")]
-  public static extern IntPtr switch_codec_codec_settings_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_flags_set")]
-  public static extern void switch_codec_flags_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_flags_get")]
-  public static extern uint switch_codec_flags_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_memory_pool_set")]
-  public static extern void switch_codec_memory_pool_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_memory_pool_get")]
-  public static extern IntPtr switch_codec_memory_pool_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_private_info_set")]
-  public static extern void switch_codec_private_info_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_private_info_get")]
-  public static extern IntPtr switch_codec_private_info_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_agreed_pt_set")]
-  public static extern void switch_codec_agreed_pt_set(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_agreed_pt_get")]
-  public static extern byte switch_codec_agreed_pt_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_mutex_set")]
-  public static extern void switch_codec_mutex_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_mutex_get")]
-  public static extern IntPtr switch_codec_mutex_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_codec")]
-  public static extern IntPtr new_switch_codec();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_codec")]
-  public static extern void delete_switch_codec(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_codec_type_set")]
-  public static extern void switch_codec_implementation_codec_type_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_codec_type_get")]
-  public static extern int switch_codec_implementation_codec_type_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_ianacode_set")]
-  public static extern void switch_codec_implementation_ianacode_set(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_ianacode_get")]
-  public static extern byte switch_codec_implementation_ianacode_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_iananame_set")]
-  public static extern void switch_codec_implementation_iananame_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_iananame_get")]
-  public static extern string switch_codec_implementation_iananame_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_fmtp_set")]
-  public static extern void switch_codec_implementation_fmtp_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_fmtp_get")]
-  public static extern string switch_codec_implementation_fmtp_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_samples_per_second_set")]
-  public static extern void switch_codec_implementation_samples_per_second_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_samples_per_second_get")]
-  public static extern uint switch_codec_implementation_samples_per_second_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_actual_samples_per_second_set")]
-  public static extern void switch_codec_implementation_actual_samples_per_second_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_actual_samples_per_second_get")]
-  public static extern uint switch_codec_implementation_actual_samples_per_second_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_bits_per_second_set")]
-  public static extern void switch_codec_implementation_bits_per_second_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_bits_per_second_get")]
-  public static extern int switch_codec_implementation_bits_per_second_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_microseconds_per_packet_set")]
-  public static extern void switch_codec_implementation_microseconds_per_packet_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_microseconds_per_packet_get")]
-  public static extern int switch_codec_implementation_microseconds_per_packet_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_samples_per_packet_set")]
-  public static extern void switch_codec_implementation_samples_per_packet_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_samples_per_packet_get")]
-  public static extern uint switch_codec_implementation_samples_per_packet_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_decoded_bytes_per_packet_set")]
-  public static extern void switch_codec_implementation_decoded_bytes_per_packet_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_decoded_bytes_per_packet_get")]
-  public static extern uint switch_codec_implementation_decoded_bytes_per_packet_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_encoded_bytes_per_packet_set")]
-  public static extern void switch_codec_implementation_encoded_bytes_per_packet_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_encoded_bytes_per_packet_get")]
-  public static extern uint switch_codec_implementation_encoded_bytes_per_packet_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_number_of_channels_set")]
-  public static extern void switch_codec_implementation_number_of_channels_set(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_number_of_channels_get")]
-  public static extern byte switch_codec_implementation_number_of_channels_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_codec_frames_per_packet_set")]
-  public static extern void switch_codec_implementation_codec_frames_per_packet_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_codec_frames_per_packet_get")]
-  public static extern int switch_codec_implementation_codec_frames_per_packet_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_init_set")]
-  public static extern void switch_codec_implementation_init_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_init_get")]
-  public static extern IntPtr switch_codec_implementation_init_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_encode_set")]
-  public static extern void switch_codec_implementation_encode_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_encode_get")]
-  public static extern IntPtr switch_codec_implementation_encode_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_decode_set")]
-  public static extern void switch_codec_implementation_decode_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_decode_get")]
-  public static extern IntPtr switch_codec_implementation_decode_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_destroy_set")]
-  public static extern void switch_codec_implementation_destroy_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_destroy_get")]
-  public static extern IntPtr switch_codec_implementation_destroy_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_codec_id_set")]
-  public static extern void switch_codec_implementation_codec_id_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_codec_id_get")]
-  public static extern uint switch_codec_implementation_codec_id_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_impl_id_set")]
-  public static extern void switch_codec_implementation_impl_id_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_impl_id_get")]
-  public static extern uint switch_codec_implementation_impl_id_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_next_set")]
-  public static extern void switch_codec_implementation_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_next_get")]
-  public static extern IntPtr switch_codec_implementation_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_codec_implementation")]
-  public static extern IntPtr new_switch_codec_implementation();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_codec_implementation")]
-  public static extern void delete_switch_codec_implementation(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_interface_name_set")]
-  public static extern void switch_codec_interface_interface_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_interface_name_get")]
-  public static extern string switch_codec_interface_interface_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_implementations_set")]
-  public static extern void switch_codec_interface_implementations_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_implementations_get")]
-  public static extern IntPtr switch_codec_interface_implementations_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_codec_id_set")]
-  public static extern void switch_codec_interface_codec_id_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_codec_id_get")]
-  public static extern uint switch_codec_interface_codec_id_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_rwlock_set")]
-  public static extern void switch_codec_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_rwlock_get")]
-  public static extern IntPtr switch_codec_interface_rwlock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_refs_set")]
-  public static extern void switch_codec_interface_refs_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_refs_get")]
-  public static extern int switch_codec_interface_refs_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_reflock_set")]
-  public static extern void switch_codec_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_reflock_get")]
-  public static extern IntPtr switch_codec_interface_reflock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_parent_set")]
-  public static extern void switch_codec_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_parent_get")]
-  public static extern IntPtr switch_codec_interface_parent_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_next_set")]
-  public static extern void switch_codec_interface_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_next_get")]
-  public static extern IntPtr switch_codec_interface_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_codec_interface")]
-  public static extern IntPtr new_switch_codec_interface();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_codec_interface")]
-  public static extern void delete_switch_codec_interface(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_interface_name_set")]
-  public static extern void switch_application_interface_interface_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_interface_name_get")]
-  public static extern string switch_application_interface_interface_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_application_function_set")]
-  public static extern void switch_application_interface_application_function_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_application_function_get")]
-  public static extern IntPtr switch_application_interface_application_function_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_long_desc_set")]
-  public static extern void switch_application_interface_long_desc_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_long_desc_get")]
-  public static extern string switch_application_interface_long_desc_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_short_desc_set")]
-  public static extern void switch_application_interface_short_desc_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_short_desc_get")]
-  public static extern string switch_application_interface_short_desc_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_syntax_set")]
-  public static extern void switch_application_interface_syntax_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_syntax_get")]
-  public static extern string switch_application_interface_syntax_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_flags_set")]
-  public static extern void switch_application_interface_flags_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_flags_get")]
-  public static extern uint switch_application_interface_flags_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_rwlock_set")]
-  public static extern void switch_application_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_rwlock_get")]
-  public static extern IntPtr switch_application_interface_rwlock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_refs_set")]
-  public static extern void switch_application_interface_refs_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_refs_get")]
-  public static extern int switch_application_interface_refs_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_reflock_set")]
-  public static extern void switch_application_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_reflock_get")]
-  public static extern IntPtr switch_application_interface_reflock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_parent_set")]
-  public static extern void switch_application_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_parent_get")]
-  public static extern IntPtr switch_application_interface_parent_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_next_set")]
-  public static extern void switch_application_interface_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_next_get")]
-  public static extern IntPtr switch_application_interface_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_application_interface")]
-  public static extern IntPtr new_switch_application_interface();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_application_interface")]
-  public static extern void delete_switch_application_interface(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_interface_name_set")]
-  public static extern void switch_api_interface_interface_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_interface_name_get")]
-  public static extern string switch_api_interface_interface_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_desc_set")]
-  public static extern void switch_api_interface_desc_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_desc_get")]
-  public static extern string switch_api_interface_desc_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_function_set")]
-  public static extern void switch_api_interface_function_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_function_get")]
-  public static extern IntPtr switch_api_interface_function_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_syntax_set")]
-  public static extern void switch_api_interface_syntax_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_syntax_get")]
-  public static extern string switch_api_interface_syntax_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_rwlock_set")]
-  public static extern void switch_api_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_rwlock_get")]
-  public static extern IntPtr switch_api_interface_rwlock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_refs_set")]
-  public static extern void switch_api_interface_refs_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_refs_get")]
-  public static extern int switch_api_interface_refs_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_reflock_set")]
-  public static extern void switch_api_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_reflock_get")]
-  public static extern IntPtr switch_api_interface_reflock_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_parent_set")]
-  public static extern void switch_api_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_parent_get")]
-  public static extern IntPtr switch_api_interface_parent_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_next_set")]
-  public static extern void switch_api_interface_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_next_get")]
-  public static extern IntPtr switch_api_interface_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_api_interface")]
-  public static extern IntPtr new_switch_api_interface();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_api_interface")]
-  public static extern void delete_switch_api_interface(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_profile_created_set")]
-  public static extern void switch_channel_timetable_profile_created_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_profile_created_get")]
-  public static extern IntPtr switch_channel_timetable_profile_created_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_created_set")]
-  public static extern void switch_channel_timetable_created_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_created_get")]
-  public static extern IntPtr switch_channel_timetable_created_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_answered_set")]
-  public static extern void switch_channel_timetable_answered_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_answered_get")]
-  public static extern IntPtr switch_channel_timetable_answered_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_progress_set")]
-  public static extern void switch_channel_timetable_progress_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_progress_get")]
-  public static extern IntPtr switch_channel_timetable_progress_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_progress_media_set")]
-  public static extern void switch_channel_timetable_progress_media_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_progress_media_get")]
-  public static extern IntPtr switch_channel_timetable_progress_media_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_hungup_set")]
-  public static extern void switch_channel_timetable_hungup_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_hungup_get")]
-  public static extern IntPtr switch_channel_timetable_hungup_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_transferred_set")]
-  public static extern void switch_channel_timetable_transferred_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_transferred_get")]
-  public static extern IntPtr switch_channel_timetable_transferred_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_next_set")]
-  public static extern void switch_channel_timetable_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_next_get")]
-  public static extern IntPtr switch_channel_timetable_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_channel_timetable")]
-  public static extern IntPtr new_switch_channel_timetable();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_channel_timetable")]
-  public static extern void delete_switch_channel_timetable(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_state")]
-  public static extern int switch_channel_get_state(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_running_state")]
-  public static extern int switch_channel_get_running_state(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_ready")]
-  public static extern int switch_channel_test_ready(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_wait_for_state")]
-  public static extern void switch_channel_wait_for_state(HandleRef jarg1, HandleRef jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_wait_for_state_timeout")]
-  public static extern void switch_channel_wait_for_state_timeout(HandleRef jarg1, int jarg2, uint jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_wait_for_flag")]
-  public static extern int switch_channel_wait_for_flag(HandleRef jarg1, int jarg2, int jarg3, uint jarg4, HandleRef jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_set_state")]
-  public static extern int switch_channel_perform_set_state(HandleRef jarg1, string jarg2, string jarg3, int jarg4, int jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_set_running_state")]
-  public static extern int switch_channel_perform_set_running_state(HandleRef jarg1, int jarg2, string jarg3, string jarg4, int jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_str2cause")]
-  public static extern int switch_channel_str2cause(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_cause")]
-  public static extern int switch_channel_get_cause(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_cause_q850")]
-  public static extern int switch_channel_cause_q850(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_cause_q850")]
-  public static extern int switch_channel_get_cause_q850(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_cause2str")]
-  public static extern string switch_channel_cause2str(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_timetable")]
-  public static extern IntPtr switch_channel_get_timetable(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_alloc")]
-  public static extern int switch_channel_alloc(HandleRef jarg1, int jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_init")]
-  public static extern int switch_channel_init(HandleRef jarg1, HandleRef jarg2, int jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_presence")]
-  public static extern void switch_channel_presence(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_uninit")]
-  public static extern void switch_channel_uninit(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_caller_profile")]
-  public static extern void switch_channel_set_caller_profile(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_caller_profile")]
-  public static extern IntPtr switch_channel_get_caller_profile(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_originator_caller_profile")]
-  public static extern void switch_channel_set_originator_caller_profile(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_hunt_caller_profile")]
-  public static extern void switch_channel_set_hunt_caller_profile(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_originator_caller_profile")]
-  public static extern IntPtr switch_channel_get_originator_caller_profile(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_originatee_caller_profile")]
-  public static extern void switch_channel_set_originatee_caller_profile(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_originatee_caller_profile")]
-  public static extern IntPtr switch_channel_get_originatee_caller_profile(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_uuid")]
-  public static extern string switch_channel_get_uuid(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_profile_var")]
-  public static extern int switch_channel_set_profile_var(HandleRef jarg1, string jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_variable_var_check")]
-  public static extern int switch_channel_set_variable_var_check(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_variable_printf")]
-  public static extern int switch_channel_set_variable_printf(HandleRef jarg1, string jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_variable_partner_var_check")]
-  public static extern int switch_channel_set_variable_partner_var_check(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_variable_partner")]
-  public static extern string switch_channel_get_variable_partner(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_variable")]
-  public static extern string switch_channel_get_variable(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_variables")]
-  public static extern int switch_channel_get_variables(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_pass_callee_id")]
-  public static extern int switch_channel_pass_callee_id(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_variable_first")]
-  public static extern IntPtr switch_channel_variable_first(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_variable_last")]
-  public static extern void switch_channel_variable_last(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_restart")]
-  public static extern void switch_channel_restart(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_caller_extension_masquerade")]
-  public static extern int switch_channel_caller_extension_masquerade(HandleRef jarg1, HandleRef jarg2, uint jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_caller_extension")]
-  public static extern void switch_channel_set_caller_extension(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_caller_extension")]
-  public static extern IntPtr switch_channel_get_caller_extension(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_flag")]
-  public static extern uint switch_channel_test_flag(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_flag")]
-  public static extern void switch_channel_set_flag(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_flag_recursive")]
-  public static extern void switch_channel_set_flag_recursive(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_cap")]
-  public static extern void switch_channel_set_cap(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_cap")]
-  public static extern void switch_channel_clear_cap(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_cap")]
-  public static extern uint switch_channel_test_cap(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_flag_partner")]
-  public static extern int switch_channel_set_flag_partner(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_flag_partner")]
-  public static extern int switch_channel_clear_flag_partner(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_flag_partner")]
-  public static extern uint switch_channel_test_flag_partner(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_state_flag")]
-  public static extern void switch_channel_set_state_flag(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_flag")]
-  public static extern void switch_channel_clear_flag(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_flag_recursive")]
-  public static extern void switch_channel_clear_flag_recursive(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_answer")]
-  public static extern int switch_channel_perform_answer(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_mark_answered")]
-  public static extern int switch_channel_perform_mark_answered(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_ring_ready")]
-  public static extern int switch_channel_perform_ring_ready(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_pre_answer")]
-  public static extern int switch_channel_perform_pre_answer(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_mark_pre_answered")]
-  public static extern int switch_channel_perform_mark_pre_answered(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_mark_ring_ready")]
-  public static extern int switch_channel_perform_mark_ring_ready(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_add_state_handler")]
-  public static extern int switch_channel_add_state_handler(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_state_handler")]
-  public static extern void switch_channel_clear_state_handler(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_state_handler")]
-  public static extern IntPtr switch_channel_get_state_handler(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_private")]
-  public static extern int switch_channel_set_private(HandleRef jarg1, string jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_private")]
-  public static extern IntPtr switch_channel_get_private(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_name")]
-  public static extern int switch_channel_set_name(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_name")]
-  public static extern string switch_channel_get_name(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_hangup")]
-  public static extern int switch_channel_perform_hangup(HandleRef jarg1, string jarg2, string jarg3, int jarg4, int jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_has_dtmf")]
-  public static extern IntPtr switch_channel_has_dtmf(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_queue_dtmf")]
-  public static extern int switch_channel_queue_dtmf(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_queue_dtmf_string")]
-  public static extern int switch_channel_queue_dtmf_string(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_dequeue_dtmf")]
-  public static extern int switch_channel_dequeue_dtmf(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_flush_dtmf")]
-  public static extern void switch_channel_flush_dtmf(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_dequeue_dtmf_string")]
-  public static extern IntPtr switch_channel_dequeue_dtmf_string(HandleRef jarg1, string jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_state_name")]
-  public static extern string switch_channel_state_name(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_name_state")]
-  public static extern int switch_channel_name_state(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_event_set_data")]
-  public static extern void switch_channel_event_set_data(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_event_set_basic_data")]
-  public static extern void switch_channel_event_set_basic_data(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_event_set_extended_data")]
-  public static extern void switch_channel_event_set_extended_data(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_expand_variables")]
-  public static extern string switch_channel_expand_variables(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_build_param_string")]
-  public static extern string switch_channel_build_param_string(HandleRef jarg1, HandleRef jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_timestamps")]
-  public static extern int switch_channel_set_timestamps(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_audio_sync")]
-  public static extern void switch_channel_audio_sync(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_private_flag")]
-  public static extern void switch_channel_set_private_flag(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_private_flag")]
-  public static extern void switch_channel_clear_private_flag(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_private_flag")]
-  public static extern int switch_channel_test_private_flag(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_app_flag")]
-  public static extern void switch_channel_set_app_flag(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_app_flag")]
-  public static extern void switch_channel_clear_app_flag(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_app_flag")]
-  public static extern int switch_channel_test_app_flag(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_hangup_time")]
-  public static extern void switch_channel_set_hangup_time(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_direction")]
-  public static extern int switch_channel_direction(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_create")]
-  public static extern int switch_buffer_create(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_create_dynamic")]
-  public static extern int switch_buffer_create_dynamic(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_add_mutex")]
-  public static extern void switch_buffer_add_mutex(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_lock")]
-  public static extern void switch_buffer_lock(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_trylock")]
-  public static extern int switch_buffer_trylock(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_unlock")]
-  public static extern void switch_buffer_unlock(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_len")]
-  public static extern IntPtr switch_buffer_len(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_freespace")]
-  public static extern IntPtr switch_buffer_freespace(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_inuse")]
-  public static extern IntPtr switch_buffer_inuse(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_read")]
-  public static extern IntPtr switch_buffer_read(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_read_loop")]
-  public static extern IntPtr switch_buffer_read_loop(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_set_loops")]
-  public static extern void switch_buffer_set_loops(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_write")]
-  public static extern IntPtr switch_buffer_write(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_toss")]
-  public static extern IntPtr switch_buffer_toss(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_zero")]
-  public static extern void switch_buffer_zero(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_slide_write")]
-  public static extern IntPtr switch_buffer_slide_write(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_destroy")]
-  public static extern void switch_buffer_destroy(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_zwrite")]
-  public static extern IntPtr switch_buffer_zwrite(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_name_set")]
-  public static extern void switch_event_header_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_name_get")]
-  public static extern string switch_event_header_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_value_set")]
-  public static extern void switch_event_header_value_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_value_get")]
-  public static extern string switch_event_header_value_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_hash_set")]
-  public static extern void switch_event_header_hash_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_hash_get")]
-  public static extern uint switch_event_header_hash_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_next_set")]
-  public static extern void switch_event_header_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_next_get")]
-  public static extern IntPtr switch_event_header_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_event_header")]
-  public static extern IntPtr new_switch_event_header();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_event_header")]
-  public static extern void delete_switch_event_header(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_event_id_set")]
-  public static extern void switch_event_event_id_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_event_id_get")]
-  public static extern int switch_event_event_id_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_priority_set")]
-  public static extern void switch_event_priority_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_priority_get")]
-  public static extern int switch_event_priority_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_owner_set")]
-  public static extern void switch_event_owner_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_owner_get")]
-  public static extern string switch_event_owner_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_subclass_name_set")]
-  public static extern void switch_event_subclass_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_subclass_name_get")]
-  public static extern string switch_event_subclass_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_headers_set")]
-  public static extern void switch_event_headers_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_headers_get")]
-  public static extern IntPtr switch_event_headers_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_last_header_set")]
-  public static extern void switch_event_last_header_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_last_header_get")]
-  public static extern IntPtr switch_event_last_header_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_body_set")]
-  public static extern void switch_event_body_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_body_get")]
-  public static extern string switch_event_body_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_bind_user_data_set")]
-  public static extern void switch_event_bind_user_data_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_bind_user_data_get")]
-  public static extern IntPtr switch_event_bind_user_data_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_event_user_data_set")]
-  public static extern void switch_event_event_user_data_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_event_user_data_get")]
-  public static extern IntPtr switch_event_event_user_data_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_key_set")]
-  public static extern void switch_event_key_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_key_get")]
-  public static extern uint switch_event_key_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_next_set")]
-  public static extern void switch_event_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_next_get")]
-  public static extern IntPtr switch_event_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_flags_set")]
-  public static extern void switch_event_flags_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_flags_get")]
-  public static extern int switch_event_flags_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_event")]
-  public static extern IntPtr new_switch_event();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_event")]
-  public static extern void delete_switch_event(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_init")]
-  public static extern int switch_event_init(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_shutdown")]
-  public static extern int switch_event_shutdown();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_create_subclass_detailed")]
-  public static extern int switch_event_create_subclass_detailed(string jarg1, string jarg2, int jarg3, HandleRef jarg4, int jarg5, string jarg6);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_set_priority")]
-  public static extern int switch_event_set_priority(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_get_header")]
-  public static extern string switch_event_get_header(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_get_body")]
-  public static extern string switch_event_get_body(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_set_subclass_name")]
-  public static extern int switch_event_set_subclass_name(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_add_header_string")]
-  public static extern int switch_event_add_header_string(HandleRef jarg1, int jarg2, string jarg3, string jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_del_header")]
-  public static extern int switch_event_del_header(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_destroy")]
-  public static extern void switch_event_destroy(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_dup")]
-  public static extern int switch_event_dup(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_fire_detailed")]
-  public static extern int switch_event_fire_detailed(string jarg1, string jarg2, int jarg3, HandleRef jarg4, HandleRef jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_prep_for_delivery_detailed")]
-  public static extern void switch_event_prep_for_delivery_detailed(string jarg1, string jarg2, int jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_bind")]
-  public static extern int switch_event_bind(string jarg1, int jarg2, string jarg3, HandleRef jarg4, HandleRef jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_bind_removable")]
-  public static extern int switch_event_bind_removable(string jarg1, int jarg2, string jarg3, HandleRef jarg4, HandleRef jarg5, HandleRef jarg6);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_unbind")]
-  public static extern int switch_event_unbind(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_unbind_callback")]
-  public static extern int switch_event_unbind_callback(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_name")]
-  public static extern string switch_event_name(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_name_event")]
-  public static extern int switch_name_event(string jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_reserve_subclass_detailed")]
-  public static extern int switch_event_reserve_subclass_detailed(string jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_free_subclass_detailed")]
-  public static extern int switch_event_free_subclass_detailed(string jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_serialize")]
-  public static extern int switch_event_serialize(HandleRef jarg1, ref string jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_running")]
-  public static extern int switch_event_running();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_expand_headers")]
-  public static extern string switch_event_expand_headers(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_create_pres_in_detailed")]
-  public static extern int switch_event_create_pres_in_detailed(string jarg1, string jarg2, int jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, int jarg11, string jarg12, string jarg13, string jarg14, string jarg15);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_create_plain")]
-  public static extern int switch_event_create_plain(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_deliver")]
-  public static extern void switch_event_deliver(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_build_param_string")]
-  public static extern string switch_event_build_param_string(HandleRef jarg1, string jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RESAMPLE_QUALITY_get")]
-  public static extern int SWITCH_RESAMPLE_QUALITY_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_resampler_set")]
-  public static extern void switch_audio_resampler_t_resampler_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_resampler_get")]
-  public static extern IntPtr switch_audio_resampler_t_resampler_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_from_rate_set")]
-  public static extern void switch_audio_resampler_t_from_rate_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_from_rate_get")]
-  public static extern int switch_audio_resampler_t_from_rate_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_to_rate_set")]
-  public static extern void switch_audio_resampler_t_to_rate_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_to_rate_get")]
-  public static extern int switch_audio_resampler_t_to_rate_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_factor_set")]
-  public static extern void switch_audio_resampler_t_factor_set(HandleRef jarg1, double jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_factor_get")]
-  public static extern double switch_audio_resampler_t_factor_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_rfactor_set")]
-  public static extern void switch_audio_resampler_t_rfactor_set(HandleRef jarg1, double jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_rfactor_get")]
-  public static extern double switch_audio_resampler_t_rfactor_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_to_set")]
-  public static extern void switch_audio_resampler_t_to_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_to_get")]
-  public static extern IntPtr switch_audio_resampler_t_to_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_to_len_set")]
-  public static extern void switch_audio_resampler_t_to_len_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_to_len_get")]
-  public static extern uint switch_audio_resampler_t_to_len_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_to_size_set")]
-  public static extern void switch_audio_resampler_t_to_size_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_to_size_get")]
-  public static extern uint switch_audio_resampler_t_to_size_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_audio_resampler_t")]
-  public static extern IntPtr new_switch_audio_resampler_t();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_audio_resampler_t")]
-  public static extern void delete_switch_audio_resampler_t(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_resample_perform_create")]
-  public static extern int switch_resample_perform_create(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, int jarg5, uint jarg6, string jarg7, string jarg8, int jarg9);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_resample_destroy")]
-  public static extern void switch_resample_destroy(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_resample_process")]
-  public static extern uint switch_resample_process(HandleRef jarg1, HandleRef jarg2, uint jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_float_to_short")]
-  public static extern IntPtr switch_float_to_short(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_char_to_float")]
-  public static extern int switch_char_to_float(string jarg1, HandleRef jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_float_to_char")]
-  public static extern int switch_float_to_char(HandleRef jarg1, string jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_short_to_float")]
-  public static extern int switch_short_to_float(HandleRef jarg1, HandleRef jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_swap_linear")]
-  public static extern void switch_swap_linear(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_generate_sln_silence")]
-  public static extern void switch_generate_sln_silence(HandleRef jarg1, uint jarg2, uint jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_change_sln_volume")]
-  public static extern void switch_change_sln_volume(HandleRef jarg1, uint jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_merge_sln")]
-  public static extern uint switch_merge_sln(HandleRef jarg1, uint jarg2, HandleRef jarg3, uint jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_mux_channels")]
-  public static extern void switch_mux_channels(HandleRef jarg1, HandleRef jarg2, uint jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_session_set")]
-  public static extern void switch_unicast_conninfo_session_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_session_get")]
-  public static extern IntPtr switch_unicast_conninfo_session_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_read_codec_set")]
-  public static extern void switch_unicast_conninfo_read_codec_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_read_codec_get")]
-  public static extern IntPtr switch_unicast_conninfo_read_codec_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_write_frame_set")]
-  public static extern void switch_unicast_conninfo_write_frame_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_write_frame_get")]
-  public static extern IntPtr switch_unicast_conninfo_write_frame_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_write_frame_data_set")]
-  public static extern void switch_unicast_conninfo_write_frame_data_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_write_frame_data_get")]
-  public static extern IntPtr switch_unicast_conninfo_write_frame_data_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_socket_set")]
-  public static extern void switch_unicast_conninfo_socket_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_socket_get")]
-  public static extern IntPtr switch_unicast_conninfo_socket_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_local_ip_set")]
-  public static extern void switch_unicast_conninfo_local_ip_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_local_ip_get")]
-  public static extern string switch_unicast_conninfo_local_ip_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_local_port_set")]
-  public static extern void switch_unicast_conninfo_local_port_set(HandleRef jarg1, ushort jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_local_port_get")]
-  public static extern ushort switch_unicast_conninfo_local_port_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_remote_ip_set")]
-  public static extern void switch_unicast_conninfo_remote_ip_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_remote_ip_get")]
-  public static extern string switch_unicast_conninfo_remote_ip_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_remote_port_set")]
-  public static extern void switch_unicast_conninfo_remote_port_set(HandleRef jarg1, ushort jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_remote_port_get")]
-  public static extern ushort switch_unicast_conninfo_remote_port_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_local_addr_set")]
-  public static extern void switch_unicast_conninfo_local_addr_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_local_addr_get")]
-  public static extern IntPtr switch_unicast_conninfo_local_addr_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_remote_addr_set")]
-  public static extern void switch_unicast_conninfo_remote_addr_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_remote_addr_get")]
-  public static extern IntPtr switch_unicast_conninfo_remote_addr_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_flag_mutex_set")]
-  public static extern void switch_unicast_conninfo_flag_mutex_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_flag_mutex_get")]
-  public static extern IntPtr switch_unicast_conninfo_flag_mutex_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_flags_set")]
-  public static extern void switch_unicast_conninfo_flags_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_flags_get")]
-  public static extern int switch_unicast_conninfo_flags_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_type_set")]
-  public static extern void switch_unicast_conninfo_type_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_type_get")]
-  public static extern int switch_unicast_conninfo_type_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_transport_set")]
-  public static extern void switch_unicast_conninfo_transport_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_transport_get")]
-  public static extern int switch_unicast_conninfo_transport_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_stream_id_set")]
-  public static extern void switch_unicast_conninfo_stream_id_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_stream_id_get")]
-  public static extern int switch_unicast_conninfo_stream_id_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_unicast_conninfo")]
-  public static extern IntPtr new_switch_unicast_conninfo();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_unicast_conninfo")]
-  public static extern void delete_switch_unicast_conninfo(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_deactivate_unicast")]
-  public static extern int switch_ivr_deactivate_unicast(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_activate_unicast")]
-  public static extern int switch_ivr_activate_unicast(HandleRef jarg1, string jarg2, ushort jarg3, string jarg4, ushort jarg5, string jarg6, string jarg7);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_generate_xml_cdr")]
-  public static extern int switch_ivr_generate_xml_cdr(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_set_xml_profile_data")]
-  public static extern int switch_ivr_set_xml_profile_data(HandleRef jarg1, HandleRef jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_set_xml_chan_vars")]
-  public static extern int switch_ivr_set_xml_chan_vars(HandleRef jarg1, HandleRef jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_parse_event")]
-  public static extern int switch_ivr_parse_event(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_parse_all_events")]
-  public static extern int switch_ivr_parse_all_events(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_parse_next_event")]
-  public static extern int switch_ivr_parse_next_event(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_parse_all_messages")]
-  public static extern int switch_ivr_parse_all_messages(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_sleep")]
-  public static extern int switch_ivr_sleep(HandleRef jarg1, uint jarg2, int jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_park")]
-  public static extern int switch_ivr_park(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_collect_digits_callback")]
-  public static extern int switch_ivr_collect_digits_callback(HandleRef jarg1, HandleRef jarg2, uint jarg3, uint jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_collect_digits_count")]
-  public static extern int switch_ivr_collect_digits_count(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, string jarg5, string jarg6, uint jarg7, uint jarg8, uint jarg9);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_detect_speech")]
-  public static extern int switch_ivr_detect_speech(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, HandleRef jarg6);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_stop_detect_speech")]
-  public static extern int switch_ivr_stop_detect_speech(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_pause_detect_speech")]
-  public static extern int switch_ivr_pause_detect_speech(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_resume_detect_speech")]
-  public static extern int switch_ivr_resume_detect_speech(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_detect_speech_load_grammar")]
-  public static extern int switch_ivr_detect_speech_load_grammar(HandleRef jarg1, string jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_detect_speech_unload_grammar")]
-  public static extern int switch_ivr_detect_speech_unload_grammar(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_record_session")]
-  public static extern int switch_ivr_record_session(HandleRef jarg1, string jarg2, uint jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_eavesdrop_session")]
-  public static extern int switch_ivr_eavesdrop_session(HandleRef jarg1, string jarg2, string jarg3, uint jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_displace_session")]
-  public static extern int switch_ivr_displace_session(HandleRef jarg1, string jarg2, uint jarg3, string jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_stop_displace_session")]
-  public static extern int switch_ivr_stop_displace_session(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_stop_record_session")]
-  public static extern int switch_ivr_stop_record_session(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_inband_dtmf_session")]
-  public static extern int switch_ivr_inband_dtmf_session(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_stop_inband_dtmf_session")]
-  public static extern int switch_ivr_stop_inband_dtmf_session(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_inband_dtmf_generate_session")]
-  public static extern int switch_ivr_inband_dtmf_generate_session(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_stop_inband_dtmf_generate_session")]
-  public static extern int switch_ivr_stop_inband_dtmf_generate_session(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_session_echo")]
-  public static extern void switch_ivr_session_echo(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_stop_tone_detect_session")]
-  public static extern int switch_ivr_stop_tone_detect_session(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_tone_detect_session")]
-  public static extern int switch_ivr_tone_detect_session(HandleRef jarg1, string jarg2, string jarg3, string jarg4, HandleRef jarg5, int jarg6, string jarg7, string jarg8, HandleRef jarg9);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_play_file")]
-  public static extern int switch_ivr_play_file(HandleRef jarg1, HandleRef jarg2, string jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_wait_for_silence")]
-  public static extern int switch_ivr_wait_for_silence(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, uint jarg5, string jarg6);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_gentones")]
-  public static extern int switch_ivr_gentones(HandleRef jarg1, string jarg2, int jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_record_file")]
-  public static extern int switch_ivr_record_file(HandleRef jarg1, HandleRef jarg2, string jarg3, HandleRef jarg4, uint jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_play_and_get_digits")]
-  public static extern int switch_play_and_get_digits(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, uint jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, uint jarg11, string jarg12);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_speak_text_handle")]
-  public static extern int switch_ivr_speak_text_handle(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, string jarg5, HandleRef jarg6);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_clear_speech_cache")]
-  public static extern void switch_ivr_clear_speech_cache(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_speak_text")]
-  public static extern int switch_ivr_speak_text(HandleRef jarg1, string jarg2, string jarg3, string jarg4, HandleRef jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_originate")]
-  public static extern int switch_ivr_originate(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, string jarg4, uint jarg5, HandleRef jarg6, string jarg7, string jarg8, HandleRef jarg9, HandleRef jarg10, uint jarg11, HandleRef jarg12);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_enterprise_originate")]
-  public static extern int switch_ivr_enterprise_originate(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, string jarg4, uint jarg5, HandleRef jarg6, string jarg7, string jarg8, HandleRef jarg9, HandleRef jarg10, uint jarg11);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_bridge_display")]
-  public static extern void switch_ivr_bridge_display(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_multi_threaded_bridge")]
-  public static extern int switch_ivr_multi_threaded_bridge(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_signal_bridge")]
-  public static extern int switch_ivr_signal_bridge(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_session_transfer")]
-  public static extern int switch_ivr_session_transfer(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_schedule_transfer")]
-  public static extern uint switch_ivr_schedule_transfer(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_schedule_hangup")]
-  public static extern uint switch_ivr_schedule_hangup(HandleRef jarg1, string jarg2, int jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_uuid_bridge")]
-  public static extern int switch_ivr_uuid_bridge(string jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_media")]
-  public static extern int switch_ivr_media(string jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_nomedia")]
-  public static extern int switch_ivr_nomedia(string jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_hold_uuid")]
-  public static extern int switch_ivr_hold_uuid(string jarg1, string jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_unhold_uuid")]
-  public static extern int switch_ivr_unhold_uuid(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_hold")]
-  public static extern int switch_ivr_hold(HandleRef jarg1, string jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_unhold")]
-  public static extern int switch_ivr_unhold(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_schedule_broadcast")]
-  public static extern uint switch_ivr_schedule_broadcast(HandleRef jarg1, string jarg2, string jarg3, uint jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_broadcast")]
-  public static extern int switch_ivr_broadcast(string jarg1, string jarg2, uint jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_transfer_variable")]
-  public static extern int switch_ivr_transfer_variable(HandleRef jarg1, HandleRef jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_digit_stream_parser_new")]
-  public static extern int switch_ivr_digit_stream_parser_new(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_digit_stream_parser_destroy")]
-  public static extern int switch_ivr_digit_stream_parser_destroy(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_digit_stream_new")]
-  public static extern int switch_ivr_digit_stream_new(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_digit_stream_destroy")]
-  public static extern int switch_ivr_digit_stream_destroy(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_digit_stream_parser_set_event")]
-  public static extern int switch_ivr_digit_stream_parser_set_event(HandleRef jarg1, string jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_digit_stream_parser_del_event")]
-  public static extern int switch_ivr_digit_stream_parser_del_event(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_digit_stream_parser_feed")]
-  public static extern IntPtr switch_ivr_digit_stream_parser_feed(HandleRef jarg1, HandleRef jarg2, char jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_digit_stream_reset")]
-  public static extern int switch_ivr_digit_stream_reset(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_digit_stream_parser_set_terminator")]
-  public static extern int switch_ivr_digit_stream_parser_set_terminator(HandleRef jarg1, char jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_init")]
-  public static extern int switch_ivr_menu_init(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, string jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16, int jarg17, HandleRef jarg18);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_bind_action")]
-  public static extern int switch_ivr_menu_bind_action(HandleRef jarg1, int jarg2, string jarg3, string jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_bind_function")]
-  public static extern int switch_ivr_menu_bind_function(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_execute")]
-  public static extern int switch_ivr_menu_execute(HandleRef jarg1, HandleRef jarg2, string jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_stack_free")]
-  public static extern int switch_ivr_menu_stack_free(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_stack_xml_build")]
-  public static extern int switch_ivr_menu_stack_xml_build(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_str2action")]
-  public static extern int switch_ivr_menu_str2action(string jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_stack_xml_add_custom")]
-  public static extern int switch_ivr_menu_stack_xml_add_custom(HandleRef jarg1, string jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_stack_xml_init")]
-  public static extern int switch_ivr_menu_stack_xml_init(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_phrase_macro")]
-  public static extern int switch_ivr_phrase_macro(HandleRef jarg1, string jarg2, string jarg3, string jarg4, HandleRef jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_delay_echo")]
-  public static extern void switch_ivr_delay_echo(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_find_bridged_uuid")]
-  public static extern int switch_ivr_find_bridged_uuid(string jarg1, string jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_intercept_session")]
-  public static extern void switch_ivr_intercept_session(HandleRef jarg1, string jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_park_session")]
-  public static extern void switch_ivr_park_session(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_wait_for_answer")]
-  public static extern int switch_ivr_wait_for_answer(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_read")]
-  public static extern int switch_ivr_read(HandleRef jarg1, uint jarg2, uint jarg3, string jarg4, string jarg5, string jarg6, HandleRef jarg7, uint jarg8, string jarg9);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_bind_dtmf_meta_session")]
-  public static extern int switch_ivr_bind_dtmf_meta_session(HandleRef jarg1, uint jarg2, uint jarg3, string jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_unbind_dtmf_meta_session")]
-  public static extern int switch_ivr_unbind_dtmf_meta_session(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_soft_hold")]
-  public static extern int switch_ivr_soft_hold(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_say")]
-  public static extern int switch_ivr_say(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, HandleRef jarg6);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_get_say_method_by_name")]
-  public static extern int switch_ivr_get_say_method_by_name(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_get_say_type_by_name")]
-  public static extern int switch_ivr_get_say_type_by_name(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_set_user")]
-  public static extern int switch_ivr_set_user(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_sound_test")]
-  public static extern int switch_ivr_sound_test(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_process_import")]
-  public static extern void switch_process_import(HandleRef jarg1, HandleRef jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_uuid_exists")]
-  public static extern int switch_ivr_uuid_exists(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_MAX_BUF_LEN_get")]
-  public static extern int SWITCH_RTP_MAX_BUF_LEN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_MAX_CRYPTO_LEN_get")]
-  public static extern int SWITCH_RTP_MAX_CRYPTO_LEN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_KEY_LEN_get")]
-  public static extern int SWITCH_RTP_KEY_LEN_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_CRYPTO_KEY_32_get")]
-  public static extern string SWITCH_RTP_CRYPTO_KEY_32_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_CRYPTO_KEY_80_get")]
-  public static extern string SWITCH_RTP_CRYPTO_KEY_80_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_crypto_key_index_set")]
-  public static extern void switch_rtp_crypto_key_index_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_crypto_key_index_get")]
-  public static extern uint switch_rtp_crypto_key_index_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_crypto_key_type_set")]
-  public static extern void switch_rtp_crypto_key_type_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_crypto_key_type_get")]
-  public static extern int switch_rtp_crypto_key_type_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_crypto_key_key_set")]
-  public static extern void switch_rtp_crypto_key_key_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_crypto_key_key_get")]
-  public static extern IntPtr switch_rtp_crypto_key_key_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_crypto_key_keylen_set")]
-  public static extern void switch_rtp_crypto_key_keylen_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_crypto_key_keylen_get")]
-  public static extern IntPtr switch_rtp_crypto_key_keylen_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_crypto_key_next_set")]
-  public static extern void switch_rtp_crypto_key_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_crypto_key_next_get")]
-  public static extern IntPtr switch_rtp_crypto_key_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_rtp_crypto_key")]
-  public static extern IntPtr new_switch_rtp_crypto_key();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_rtp_crypto_key")]
-  public static extern void delete_switch_rtp_crypto_key(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_add_crypto_key")]
-  public static extern int switch_rtp_add_crypto_key(HandleRef jarg1, int jarg2, uint jarg3, int jarg4, HandleRef jarg5, HandleRef jarg6);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_random")]
-  public static extern void switch_rtp_get_random(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_init")]
-  public static extern void switch_rtp_init(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_shutdown")]
-  public static extern void switch_rtp_shutdown();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_start_port")]
-  public static extern ushort switch_rtp_set_start_port(ushort jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_end_port")]
-  public static extern ushort switch_rtp_set_end_port(ushort jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_request_port")]
-  public static extern ushort switch_rtp_request_port(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_release_port")]
-  public static extern void switch_rtp_release_port(string jarg1, ushort jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_interval")]
-  public static extern int switch_rtp_set_interval(HandleRef jarg1, uint jarg2, uint jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_change_interval")]
-  public static extern int switch_rtp_change_interval(HandleRef jarg1, uint jarg2, uint jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_create")]
-  public static extern int switch_rtp_create(HandleRef jarg1, byte jarg2, uint jarg3, uint jarg4, uint jarg5, string jarg6, ref string jarg7, HandleRef jarg8);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_new")]
-  public static extern IntPtr switch_rtp_new(string jarg1, ushort jarg2, string jarg3, ushort jarg4, byte jarg5, uint jarg6, uint jarg7, uint jarg8, string jarg9, ref string jarg10, HandleRef jarg11);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_remote_address")]
-  public static extern int switch_rtp_set_remote_address(HandleRef jarg1, string jarg2, ushort jarg3, int jarg4, ref string jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_remote_host")]
-  public static extern string switch_rtp_get_remote_host(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_remote_port")]
-  public static extern ushort switch_rtp_get_remote_port(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_reset_media_timer")]
-  public static extern void switch_rtp_reset_media_timer(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_max_missed_packets")]
-  public static extern void switch_rtp_set_max_missed_packets(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_local_address")]
-  public static extern int switch_rtp_set_local_address(HandleRef jarg1, string jarg2, ushort jarg3, ref string jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_kill_socket")]
-  public static extern void switch_rtp_kill_socket(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_break")]
-  public static extern void switch_rtp_break(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_ready")]
-  public static extern byte switch_rtp_ready(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_destroy")]
-  public static extern void switch_rtp_destroy(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_ice")]
-  public static extern int switch_rtp_activate_ice(HandleRef jarg1, string jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_jitter_buffer")]
-  public static extern int switch_rtp_activate_jitter_buffer(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_flag")]
-  public static extern void switch_rtp_set_flag(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_test_flag")]
-  public static extern uint switch_rtp_test_flag(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_clear_flag")]
-  public static extern void switch_rtp_clear_flag(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_rtp_socket")]
-  public static extern IntPtr switch_rtp_get_rtp_socket(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_default_samples_per_interval")]
-  public static extern uint switch_rtp_get_default_samples_per_interval(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_default_payload")]
-  public static extern void switch_rtp_set_default_payload(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_default_payload")]
-  public static extern uint switch_rtp_get_default_payload(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_invald_handler")]
-  public static extern void switch_rtp_set_invald_handler(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_read")]
-  public static extern int switch_rtp_read(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5, uint jarg6);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_queue_rfc2833")]
-  public static extern int switch_rtp_queue_rfc2833(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_queue_rfc2833_in")]
-  public static extern int switch_rtp_queue_rfc2833_in(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_has_dtmf")]
-  public static extern IntPtr switch_rtp_has_dtmf(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_dequeue_dtmf")]
-  public static extern IntPtr switch_rtp_dequeue_dtmf(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_zerocopy_read")]
-  public static extern int switch_rtp_zerocopy_read(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5, uint jarg6);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_zerocopy_read_frame")]
-  public static extern int switch_rtp_zerocopy_read_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_rtp_flush_read_buffer")]
-  public static extern void rtp_flush_read_buffer(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_enable_vad")]
-  public static extern int switch_rtp_enable_vad(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, uint jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_disable_vad")]
-  public static extern int switch_rtp_disable_vad(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_write_frame")]
-  public static extern int switch_rtp_write_frame(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_write_manual")]
-  public static extern int switch_rtp_write_manual(HandleRef jarg1, HandleRef jarg2, uint jarg3, byte jarg4, byte jarg5, uint jarg6, HandleRef jarg7);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_ssrc")]
-  public static extern uint switch_rtp_get_ssrc(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_private")]
-  public static extern void switch_rtp_set_private(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_telephony_event")]
-  public static extern void switch_rtp_set_telephony_event(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_cng_pt")]
-  public static extern void switch_rtp_set_cng_pt(HandleRef jarg1, byte jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_private")]
-  public static extern IntPtr switch_rtp_get_private(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_stun_ping")]
-  public static extern int switch_rtp_activate_stun_ping(HandleRef jarg1, string jarg2, ushort jarg3, uint jarg4, int jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_intentional_bugs")]
-  public static extern void switch_rtp_intentional_bugs(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_stats")]
-  public static extern IntPtr switch_rtp_get_stats(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_data_set")]
-  public static extern void switch_log_node_t_data_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_data_get")]
-  public static extern string switch_log_node_t_data_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_file_set")]
-  public static extern void switch_log_node_t_file_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_file_get")]
-  public static extern string switch_log_node_t_file_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_line_set")]
-  public static extern void switch_log_node_t_line_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_line_get")]
-  public static extern uint switch_log_node_t_line_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_func_set")]
-  public static extern void switch_log_node_t_func_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_func_get")]
-  public static extern string switch_log_node_t_func_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_level_set")]
-  public static extern void switch_log_node_t_level_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_level_get")]
-  public static extern int switch_log_node_t_level_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_timestamp_set")]
-  public static extern void switch_log_node_t_timestamp_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_timestamp_get")]
-  public static extern IntPtr switch_log_node_t_timestamp_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_content_set")]
-  public static extern void switch_log_node_t_content_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_content_get")]
-  public static extern string switch_log_node_t_content_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_userdata_set")]
-  public static extern void switch_log_node_t_userdata_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_userdata_get")]
-  public static extern string switch_log_node_t_userdata_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_channel_set")]
-  public static extern void switch_log_node_t_channel_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_channel_get")]
-  public static extern int switch_log_node_t_channel_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_log_node_t")]
-  public static extern IntPtr new_switch_log_node_t();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_log_node_t")]
-  public static extern void delete_switch_log_node_t(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_init")]
-  public static extern int switch_log_init(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_shutdown")]
-  public static extern int switch_log_shutdown();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_bind_logger")]
-  public static extern int switch_log_bind_logger(HandleRef jarg1, int jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_unbind_logger")]
-  public static extern int switch_log_unbind_logger(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_level2str")]
-  public static extern string switch_log_level2str(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_str2level")]
-  public static extern int switch_log_str2level(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_str2mask")]
-  public static extern uint switch_log_str2mask(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_dup")]
-  public static extern IntPtr switch_log_node_dup(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_free")]
-  public static extern void switch_log_node_free(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_XML_BUFSIZE_get")]
-  public static extern int SWITCH_XML_BUFSIZE_get();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_name_set")]
-  public static extern void switch_xml_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_name_get")]
-  public static extern string switch_xml_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_attr_set")]
-  public static extern void switch_xml_attr_set(HandleRef jarg1, ref string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_attr_get")]
-  public static extern string switch_xml_attr_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_txt_set")]
-  public static extern void switch_xml_txt_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_txt_get")]
-  public static extern string switch_xml_txt_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_free_path_set")]
-  public static extern void switch_xml_free_path_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_free_path_get")]
-  public static extern string switch_xml_free_path_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_off_set")]
-  public static extern void switch_xml_off_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_off_get")]
-  public static extern IntPtr switch_xml_off_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_next_set")]
-  public static extern void switch_xml_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_next_get")]
-  public static extern IntPtr switch_xml_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_sibling_set")]
-  public static extern void switch_xml_sibling_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_sibling_get")]
-  public static extern IntPtr switch_xml_sibling_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_ordered_set")]
-  public static extern void switch_xml_ordered_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_ordered_get")]
-  public static extern IntPtr switch_xml_ordered_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_child_set")]
-  public static extern void switch_xml_child_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_child_get")]
-  public static extern IntPtr switch_xml_child_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parent_set")]
-  public static extern void switch_xml_parent_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parent_get")]
-  public static extern IntPtr switch_xml_parent_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_flags_set")]
-  public static extern void switch_xml_flags_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_flags_get")]
-  public static extern uint switch_xml_flags_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_xml")]
-  public static extern IntPtr new_switch_xml();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_xml")]
-  public static extern void delete_switch_xml(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parse_str_dynamic")]
-  public static extern IntPtr switch_xml_parse_str_dynamic(string jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parse_str")]
-  public static extern IntPtr switch_xml_parse_str(string jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parse_fd")]
-  public static extern IntPtr switch_xml_parse_fd(int jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parse_file")]
-  public static extern IntPtr switch_xml_parse_file(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parse_file_simple")]
-  public static extern IntPtr switch_xml_parse_file_simple(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parse_fp")]
-  public static extern IntPtr switch_xml_parse_fp(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_child")]
-  public static extern IntPtr switch_xml_child(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_find_child")]
-  public static extern IntPtr switch_xml_find_child(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_find_child_multi")]
-  public static extern IntPtr switch_xml_find_child_multi(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_attr")]
-  public static extern string switch_xml_attr(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_attr_soft")]
-  public static extern string switch_xml_attr_soft(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_get")]
-  public static extern IntPtr switch_xml_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_toxml")]
-  public static extern string switch_xml_toxml(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_toxml_buf")]
-  public static extern string switch_xml_toxml_buf(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, int jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_free")]
-  public static extern void switch_xml_free(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_free_in_thread")]
-  public static extern void switch_xml_free_in_thread(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_error")]
-  public static extern string switch_xml_error(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_new")]
-  public static extern IntPtr switch_xml_new(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_add_child")]
-  public static extern IntPtr switch_xml_add_child(HandleRef jarg1, string jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_set_txt")]
-  public static extern IntPtr switch_xml_set_txt(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_set_attr")]
-  public static extern IntPtr switch_xml_set_attr(HandleRef jarg1, string jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_set_flag")]
-  public static extern IntPtr switch_xml_set_flag(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_cut")]
-  public static extern IntPtr switch_xml_cut(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_insert")]
-  public static extern IntPtr switch_xml_insert(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_open_root")]
-  public static extern IntPtr switch_xml_open_root(byte jarg1, ref string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_init")]
-  public static extern int switch_xml_init(HandleRef jarg1, ref string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_destroy")]
-  public static extern int switch_xml_destroy();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_root")]
-  public static extern IntPtr switch_xml_root();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_locate")]
-  public static extern int switch_xml_locate(string jarg1, string jarg2, string jarg3, string jarg4, HandleRef jarg5, HandleRef jarg6, HandleRef jarg7, int jarg8);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_locate_domain")]
-  public static extern int switch_xml_locate_domain(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_locate_group")]
-  public static extern int switch_xml_locate_group(string jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5, HandleRef jarg6);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_locate_user")]
-  public static extern int switch_xml_locate_user(string jarg1, string jarg2, string jarg3, string jarg4, HandleRef jarg5, HandleRef jarg6, HandleRef jarg7, HandleRef jarg8, HandleRef jarg9);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_locate_user_in_domain")]
-  public static extern int switch_xml_locate_user_in_domain(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_open_cfg")]
-  public static extern IntPtr switch_xml_open_cfg(string jarg1, HandleRef jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_set_binding_sections")]
-  public static extern void switch_xml_set_binding_sections(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_set_binding_user_data")]
-  public static extern void switch_xml_set_binding_user_data(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_get_binding_sections")]
-  public static extern uint switch_xml_get_binding_sections(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_get_binding_user_data")]
-  public static extern IntPtr switch_xml_get_binding_user_data(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_bind_search_function_ret")]
-  public static extern int switch_xml_bind_search_function_ret(HandleRef jarg1, uint jarg2, HandleRef jarg3, HandleRef jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_unbind_search_function")]
-  public static extern int switch_xml_unbind_search_function(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_unbind_search_function_ptr")]
-  public static extern int switch_xml_unbind_search_function_ptr(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parse_section_string")]
-  public static extern uint switch_xml_parse_section_string(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_outgoing_channel_outgoing_channel_set")]
-  public static extern void switch_io_event_hook_outgoing_channel_outgoing_channel_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_outgoing_channel_outgoing_channel_get")]
-  public static extern IntPtr switch_io_event_hook_outgoing_channel_outgoing_channel_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_outgoing_channel_next_set")]
-  public static extern void switch_io_event_hook_outgoing_channel_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_outgoing_channel_next_get")]
-  public static extern IntPtr switch_io_event_hook_outgoing_channel_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_outgoing_channel")]
-  public static extern IntPtr new_switch_io_event_hook_outgoing_channel();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_outgoing_channel")]
-  public static extern void delete_switch_io_event_hook_outgoing_channel(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_receive_message_receive_message_set")]
-  public static extern void switch_io_event_hook_receive_message_receive_message_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_receive_message_receive_message_get")]
-  public static extern IntPtr switch_io_event_hook_receive_message_receive_message_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_receive_message_next_set")]
-  public static extern void switch_io_event_hook_receive_message_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_receive_message_next_get")]
-  public static extern IntPtr switch_io_event_hook_receive_message_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_receive_message")]
-  public static extern IntPtr new_switch_io_event_hook_receive_message();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_receive_message")]
-  public static extern void delete_switch_io_event_hook_receive_message(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_receive_event_receive_event_set")]
-  public static extern void switch_io_event_hook_receive_event_receive_event_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_receive_event_receive_event_get")]
-  public static extern IntPtr switch_io_event_hook_receive_event_receive_event_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_receive_event_next_set")]
-  public static extern void switch_io_event_hook_receive_event_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_receive_event_next_get")]
-  public static extern IntPtr switch_io_event_hook_receive_event_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_receive_event")]
-  public static extern IntPtr new_switch_io_event_hook_receive_event();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_receive_event")]
-  public static extern void delete_switch_io_event_hook_receive_event(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_read_frame_read_frame_set")]
-  public static extern void switch_io_event_hook_read_frame_read_frame_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_read_frame_read_frame_get")]
-  public static extern IntPtr switch_io_event_hook_read_frame_read_frame_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_read_frame_next_set")]
-  public static extern void switch_io_event_hook_read_frame_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_read_frame_next_get")]
-  public static extern IntPtr switch_io_event_hook_read_frame_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_read_frame")]
-  public static extern IntPtr new_switch_io_event_hook_read_frame();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_read_frame")]
-  public static extern void delete_switch_io_event_hook_read_frame(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_video_read_frame_video_read_frame_set")]
-  public static extern void switch_io_event_hook_video_read_frame_video_read_frame_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_video_read_frame_video_read_frame_get")]
-  public static extern IntPtr switch_io_event_hook_video_read_frame_video_read_frame_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_video_read_frame_next_set")]
-  public static extern void switch_io_event_hook_video_read_frame_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_video_read_frame_next_get")]
-  public static extern IntPtr switch_io_event_hook_video_read_frame_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_video_read_frame")]
-  public static extern IntPtr new_switch_io_event_hook_video_read_frame();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_video_read_frame")]
-  public static extern void delete_switch_io_event_hook_video_read_frame(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_write_frame_write_frame_set")]
-  public static extern void switch_io_event_hook_write_frame_write_frame_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_write_frame_write_frame_get")]
-  public static extern IntPtr switch_io_event_hook_write_frame_write_frame_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_write_frame_next_set")]
-  public static extern void switch_io_event_hook_write_frame_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_write_frame_next_get")]
-  public static extern IntPtr switch_io_event_hook_write_frame_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_write_frame")]
-  public static extern IntPtr new_switch_io_event_hook_write_frame();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_write_frame")]
-  public static extern void delete_switch_io_event_hook_write_frame(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_video_write_frame_video_write_frame_set")]
-  public static extern void switch_io_event_hook_video_write_frame_video_write_frame_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_video_write_frame_video_write_frame_get")]
-  public static extern IntPtr switch_io_event_hook_video_write_frame_video_write_frame_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_video_write_frame_next_set")]
-  public static extern void switch_io_event_hook_video_write_frame_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_video_write_frame_next_get")]
-  public static extern IntPtr switch_io_event_hook_video_write_frame_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_video_write_frame")]
-  public static extern IntPtr new_switch_io_event_hook_video_write_frame();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_video_write_frame")]
-  public static extern void delete_switch_io_event_hook_video_write_frame(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_kill_channel_kill_channel_set")]
-  public static extern void switch_io_event_hook_kill_channel_kill_channel_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_kill_channel_kill_channel_get")]
-  public static extern IntPtr switch_io_event_hook_kill_channel_kill_channel_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_kill_channel_next_set")]
-  public static extern void switch_io_event_hook_kill_channel_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_kill_channel_next_get")]
-  public static extern IntPtr switch_io_event_hook_kill_channel_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_kill_channel")]
-  public static extern IntPtr new_switch_io_event_hook_kill_channel();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_kill_channel")]
-  public static extern void delete_switch_io_event_hook_kill_channel(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_send_dtmf_send_dtmf_set")]
-  public static extern void switch_io_event_hook_send_dtmf_send_dtmf_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_send_dtmf_send_dtmf_get")]
-  public static extern IntPtr switch_io_event_hook_send_dtmf_send_dtmf_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_send_dtmf_next_set")]
-  public static extern void switch_io_event_hook_send_dtmf_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_send_dtmf_next_get")]
-  public static extern IntPtr switch_io_event_hook_send_dtmf_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_send_dtmf")]
-  public static extern IntPtr new_switch_io_event_hook_send_dtmf();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_send_dtmf")]
-  public static extern void delete_switch_io_event_hook_send_dtmf(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_recv_dtmf_recv_dtmf_set")]
-  public static extern void switch_io_event_hook_recv_dtmf_recv_dtmf_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_recv_dtmf_recv_dtmf_get")]
-  public static extern IntPtr switch_io_event_hook_recv_dtmf_recv_dtmf_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_recv_dtmf_next_set")]
-  public static extern void switch_io_event_hook_recv_dtmf_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_recv_dtmf_next_get")]
-  public static extern IntPtr switch_io_event_hook_recv_dtmf_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_recv_dtmf")]
-  public static extern IntPtr new_switch_io_event_hook_recv_dtmf();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_recv_dtmf")]
-  public static extern void delete_switch_io_event_hook_recv_dtmf(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_state_change_state_change_set")]
-  public static extern void switch_io_event_hook_state_change_state_change_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_state_change_state_change_get")]
-  public static extern IntPtr switch_io_event_hook_state_change_state_change_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_state_change_next_set")]
-  public static extern void switch_io_event_hook_state_change_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_state_change_next_get")]
-  public static extern IntPtr switch_io_event_hook_state_change_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_state_change")]
-  public static extern IntPtr new_switch_io_event_hook_state_change();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_state_change")]
-  public static extern void delete_switch_io_event_hook_state_change(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_resurrect_session_resurrect_session_set")]
-  public static extern void switch_io_event_hook_resurrect_session_resurrect_session_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_resurrect_session_resurrect_session_get")]
-  public static extern IntPtr switch_io_event_hook_resurrect_session_resurrect_session_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_resurrect_session_next_set")]
-  public static extern void switch_io_event_hook_resurrect_session_next_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_resurrect_session_next_get")]
-  public static extern IntPtr switch_io_event_hook_resurrect_session_next_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_resurrect_session")]
-  public static extern IntPtr new_switch_io_event_hook_resurrect_session();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_resurrect_session")]
-  public static extern void delete_switch_io_event_hook_resurrect_session(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_outgoing_channel_set")]
-  public static extern void switch_io_event_hooks_outgoing_channel_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_outgoing_channel_get")]
-  public static extern IntPtr switch_io_event_hooks_outgoing_channel_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_receive_message_set")]
-  public static extern void switch_io_event_hooks_receive_message_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_receive_message_get")]
-  public static extern IntPtr switch_io_event_hooks_receive_message_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_receive_event_set")]
-  public static extern void switch_io_event_hooks_receive_event_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_receive_event_get")]
-  public static extern IntPtr switch_io_event_hooks_receive_event_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_read_frame_set")]
-  public static extern void switch_io_event_hooks_read_frame_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_read_frame_get")]
-  public static extern IntPtr switch_io_event_hooks_read_frame_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_video_read_frame_set")]
-  public static extern void switch_io_event_hooks_video_read_frame_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_video_read_frame_get")]
-  public static extern IntPtr switch_io_event_hooks_video_read_frame_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_write_frame_set")]
-  public static extern void switch_io_event_hooks_write_frame_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_write_frame_get")]
-  public static extern IntPtr switch_io_event_hooks_write_frame_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_video_write_frame_set")]
-  public static extern void switch_io_event_hooks_video_write_frame_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_video_write_frame_get")]
-  public static extern IntPtr switch_io_event_hooks_video_write_frame_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_kill_channel_set")]
-  public static extern void switch_io_event_hooks_kill_channel_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_kill_channel_get")]
-  public static extern IntPtr switch_io_event_hooks_kill_channel_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_send_dtmf_set")]
-  public static extern void switch_io_event_hooks_send_dtmf_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_send_dtmf_get")]
-  public static extern IntPtr switch_io_event_hooks_send_dtmf_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_recv_dtmf_set")]
-  public static extern void switch_io_event_hooks_recv_dtmf_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_recv_dtmf_get")]
-  public static extern IntPtr switch_io_event_hooks_recv_dtmf_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_state_change_set")]
-  public static extern void switch_io_event_hooks_state_change_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_state_change_get")]
-  public static extern IntPtr switch_io_event_hooks_state_change_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_resurrect_session_set")]
-  public static extern void switch_io_event_hooks_resurrect_session_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_resurrect_session_get")]
-  public static extern IntPtr switch_io_event_hooks_resurrect_session_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hooks")]
-  public static extern IntPtr new_switch_io_event_hooks();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hooks")]
-  public static extern void delete_switch_io_event_hooks(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_outgoing_channel")]
-  public static extern int switch_core_event_hook_add_outgoing_channel(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_receive_message")]
-  public static extern int switch_core_event_hook_add_receive_message(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_receive_event")]
-  public static extern int switch_core_event_hook_add_receive_event(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_state_change")]
-  public static extern int switch_core_event_hook_add_state_change(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_read_frame")]
-  public static extern int switch_core_event_hook_add_read_frame(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_write_frame")]
-  public static extern int switch_core_event_hook_add_write_frame(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_video_read_frame")]
-  public static extern int switch_core_event_hook_add_video_read_frame(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_video_write_frame")]
-  public static extern int switch_core_event_hook_add_video_write_frame(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_kill_channel")]
-  public static extern int switch_core_event_hook_add_kill_channel(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_send_dtmf")]
-  public static extern int switch_core_event_hook_add_send_dtmf(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_recv_dtmf")]
-  public static extern int switch_core_event_hook_add_recv_dtmf(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_resurrect_session")]
-  public static extern int switch_core_event_hook_add_resurrect_session(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_outgoing_channel")]
-  public static extern int switch_core_event_hook_remove_outgoing_channel(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_receive_message")]
-  public static extern int switch_core_event_hook_remove_receive_message(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_receive_event")]
-  public static extern int switch_core_event_hook_remove_receive_event(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_state_change")]
-  public static extern int switch_core_event_hook_remove_state_change(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_read_frame")]
-  public static extern int switch_core_event_hook_remove_read_frame(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_write_frame")]
-  public static extern int switch_core_event_hook_remove_write_frame(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_video_read_frame")]
-  public static extern int switch_core_event_hook_remove_video_read_frame(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_video_write_frame")]
-  public static extern int switch_core_event_hook_remove_video_write_frame(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_kill_channel")]
-  public static extern int switch_core_event_hook_remove_kill_channel(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_send_dtmf")]
-  public static extern int switch_core_event_hook_remove_send_dtmf(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_recv_dtmf")]
-  public static extern int switch_core_event_hook_remove_recv_dtmf(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_resurrect_session")]
-  public static extern int switch_core_event_hook_remove_resurrect_session(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_created_set")]
-  public static extern void switch_scheduler_task_created_set(HandleRef jarg1, long jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_created_get")]
-  public static extern long switch_scheduler_task_created_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_runtime_set")]
-  public static extern void switch_scheduler_task_runtime_set(HandleRef jarg1, long jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_runtime_get")]
-  public static extern long switch_scheduler_task_runtime_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_cmd_id_set")]
-  public static extern void switch_scheduler_task_cmd_id_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_cmd_id_get")]
-  public static extern uint switch_scheduler_task_cmd_id_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_group_set")]
-  public static extern void switch_scheduler_task_group_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_group_get")]
-  public static extern string switch_scheduler_task_group_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_cmd_arg_set")]
-  public static extern void switch_scheduler_task_cmd_arg_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_cmd_arg_get")]
-  public static extern IntPtr switch_scheduler_task_cmd_arg_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_task_id_set")]
-  public static extern void switch_scheduler_task_task_id_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_task_id_get")]
-  public static extern uint switch_scheduler_task_task_id_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_scheduler_task")]
-  public static extern IntPtr new_switch_scheduler_task();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_scheduler_task")]
-  public static extern void delete_switch_scheduler_task(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_add_task")]
-  public static extern uint switch_scheduler_add_task(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4, uint jarg5, HandleRef jarg6, uint jarg7);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_del_task_id")]
-  public static extern uint switch_scheduler_del_task_id(uint jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_del_task_group")]
-  public static extern uint switch_scheduler_del_task_group(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_thread_start")]
-  public static extern void switch_scheduler_task_thread_start();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_thread_stop")]
-  public static extern void switch_scheduler_task_thread_stop();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_file_set")]
-  public static extern void switch_config_file_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_file_get")]
-  public static extern IntPtr switch_config_file_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_path_set")]
-  public static extern void switch_config_path_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_path_get")]
-  public static extern string switch_config_path_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_category_set")]
-  public static extern void switch_config_category_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_category_get")]
-  public static extern string switch_config_category_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_section_set")]
-  public static extern void switch_config_section_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_section_get")]
-  public static extern string switch_config_section_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_buf_set")]
-  public static extern void switch_config_buf_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_buf_get")]
-  public static extern string switch_config_buf_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_lineno_set")]
-  public static extern void switch_config_lineno_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_lineno_get")]
-  public static extern int switch_config_lineno_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_catno_set")]
-  public static extern void switch_config_catno_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_catno_get")]
-  public static extern int switch_config_catno_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_sectno_set")]
-  public static extern void switch_config_sectno_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_sectno_get")]
-  public static extern int switch_config_sectno_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_lockto_set")]
-  public static extern void switch_config_lockto_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_lockto_get")]
-  public static extern int switch_config_lockto_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_config")]
-  public static extern IntPtr new_switch_config();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_config")]
-  public static extern void delete_switch_config(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_open_file")]
-  public static extern int switch_config_open_file(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_close_file")]
-  public static extern void switch_config_close_file(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_next_pair")]
-  public static extern int switch_config_next_pair(HandleRef jarg1, ref string jarg2, ref string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_consoleLog")]
-  public static extern void consoleLog(string jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_consoleCleanLog")]
-  public static extern void consoleCleanLog(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_IvrMenu")]
-  public static extern IntPtr new_IvrMenu(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, int jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_IvrMenu")]
-  public static extern void delete_IvrMenu(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_IvrMenu_bindAction")]
-  public static extern void IvrMenu_bindAction(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_IvrMenu_Execute")]
-  public static extern void IvrMenu_Execute(HandleRef jarg1, HandleRef jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_Api")]
-  public static extern IntPtr new_Api();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_Api")]
-  public static extern void delete_Api(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_Api_Execute")]
-  public static extern string Api_Execute(HandleRef jarg1, string jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_Api_ExecuteString")]
-  public static extern string Api_ExecuteString(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_Api_getTime")]
-  public static extern string Api_getTime(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_input_callback_state_t_function_set")]
-  public static extern void input_callback_state_t_function_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_input_callback_state_t_function_get")]
-  public static extern IntPtr input_callback_state_t_function_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_input_callback_state_t_threadState_set")]
-  public static extern void input_callback_state_t_threadState_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_input_callback_state_t_threadState_get")]
-  public static extern IntPtr input_callback_state_t_threadState_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_input_callback_state_t_extra_set")]
-  public static extern void input_callback_state_t_extra_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_input_callback_state_t_extra_get")]
-  public static extern IntPtr input_callback_state_t_extra_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_input_callback_state_t_funcargs_set")]
-  public static extern void input_callback_state_t_funcargs_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_input_callback_state_t_funcargs_get")]
-  public static extern string input_callback_state_t_funcargs_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_input_callback_state_t")]
-  public static extern IntPtr new_input_callback_state_t();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_input_callback_state_t")]
-  public static extern void delete_input_callback_state_t(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_DTMF_digit_set")]
-  public static extern void DTMF_digit_set(HandleRef jarg1, char jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_DTMF_digit_get")]
-  public static extern char DTMF_digit_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_DTMF_duration_set")]
-  public static extern void DTMF_duration_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_DTMF_duration_get")]
-  public static extern uint DTMF_duration_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_DTMF")]
-  public static extern IntPtr new_DTMF(char jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_DTMF")]
-  public static extern void delete_DTMF(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_Stream__SWIG_0")]
-  public static extern IntPtr new_Stream__SWIG_0();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_Stream__SWIG_1")]
-  public static extern IntPtr new_Stream__SWIG_1(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_Stream")]
-  public static extern void delete_Stream(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_Stream_Write")]
-  public static extern void Stream_Write(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_Stream_get_data")]
-  public static extern string Stream_get_data(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_Event_InternalEvent_set")]
-  public static extern void Event_InternalEvent_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_Event_InternalEvent_get")]
-  public static extern IntPtr Event_InternalEvent_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_Event_serialized_string_set")]
-  public static extern void Event_serialized_string_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_Event_serialized_string_get")]
-  public static extern string Event_serialized_string_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_Event_mine_set")]
-  public static extern void Event_mine_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_Event_mine_get")]
-  public static extern int Event_mine_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_Event__SWIG_0")]
-  public static extern IntPtr new_Event__SWIG_0(string jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_Event__SWIG_1")]
-  public static extern IntPtr new_Event__SWIG_1(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_Event")]
-  public static extern void delete_Event(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_Event_Serialize")]
-  public static extern string Event_Serialize(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_Event_SetPriority")]
-  public static extern bool Event_SetPriority(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_Event_GetHeader")]
-  public static extern string Event_GetHeader(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_Event_GetBody")]
-  public static extern string Event_GetBody(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_Event_GetEventType")]
-  public static extern string Event_GetEventType(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_Event_AddBody")]
-  public static extern bool Event_AddBody(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_Event_AddHeader")]
-  public static extern bool Event_AddHeader(HandleRef jarg1, string jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_Event_DeleteHeader")]
-  public static extern bool Event_DeleteHeader(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_Event_Fire")]
-  public static extern bool Event_Fire(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_events_set")]
-  public static extern void EventConsumer_events_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_events_get")]
-  public static extern IntPtr EventConsumer_events_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_e_event_id_set")]
-  public static extern void EventConsumer_e_event_id_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_e_event_id_get")]
-  public static extern int EventConsumer_e_event_id_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_node_set")]
-  public static extern void EventConsumer_node_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_node_get")]
-  public static extern IntPtr EventConsumer_node_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_e_callback_set")]
-  public static extern void EventConsumer_e_callback_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_e_callback_get")]
-  public static extern string EventConsumer_e_callback_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_e_subclass_name_set")]
-  public static extern void EventConsumer_e_subclass_name_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_e_subclass_name_get")]
-  public static extern string EventConsumer_e_subclass_name_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_e_cb_arg_set")]
-  public static extern void EventConsumer_e_cb_arg_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_e_cb_arg_get")]
-  public static extern string EventConsumer_e_cb_arg_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_EventConsumer")]
-  public static extern IntPtr new_EventConsumer(string jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_EventConsumer")]
-  public static extern void delete_EventConsumer(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_pop")]
-  public static extern IntPtr EventConsumer_pop(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_CoreSession")]
-  public static extern void delete_CoreSession(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_InternalSession_set")]
-  public static extern void CoreSession_InternalSession_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_InternalSession_get")]
-  public static extern IntPtr CoreSession_InternalSession_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Channel_set")]
-  public static extern void CoreSession_Channel_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Channel_get")]
-  public static extern IntPtr CoreSession_Channel_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Flags_set")]
-  public static extern void CoreSession_Flags_set(HandleRef jarg1, uint jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Flags_get")]
-  public static extern uint CoreSession_Flags_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Allocated_set")]
-  public static extern void CoreSession_Allocated_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Allocated_get")]
-  public static extern int CoreSession_Allocated_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_CallbackState_set")]
-  public static extern void CoreSession_CallbackState_set(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_CallbackState_get")]
-  public static extern IntPtr CoreSession_CallbackState_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_HookState_set")]
-  public static extern void CoreSession_HookState_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_HookState_get")]
-  public static extern int CoreSession_HookState_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_CallCause_set")]
-  public static extern void CoreSession_CallCause_set(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_CallCause_get")]
-  public static extern int CoreSession_CallCause_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_UuidString_set")]
-  public static extern void CoreSession_UuidString_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_UuidString_get")]
-  public static extern string CoreSession_UuidString_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_TextToSpeechEngine_set")]
-  public static extern void CoreSession_TextToSpeechEngine_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_TextToSpeechEngine_get")]
-  public static extern string CoreSession_TextToSpeechEngine_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_TextToSpeechVoice_set")]
-  public static extern void CoreSession_TextToSpeechVoice_set(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_TextToSpeechVoice_get")]
-  public static extern string CoreSession_TextToSpeechVoice_get(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Answer")]
-  public static extern int CoreSession_Answer(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_PreAnswer")]
-  public static extern int CoreSession_PreAnswer(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Hangup")]
-  public static extern void CoreSession_Hangup(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_HangupState")]
-  public static extern void CoreSession_HangupState(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_SetVariable")]
-  public static extern void CoreSession_SetVariable(HandleRef jarg1, string jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_SetPrivate")]
-  public static extern void CoreSession_SetPrivate(HandleRef jarg1, string jarg2, HandleRef jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_GetPrivate")]
-  public static extern IntPtr CoreSession_GetPrivate(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_GetVariable")]
-  public static extern string CoreSession_GetVariable(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Say")]
-  public static extern void CoreSession_Say(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_SayPhrase")]
-  public static extern void CoreSession_SayPhrase(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_HangupCause")]
-  public static extern string CoreSession_HangupCause(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_GetState")]
-  public static extern string CoreSession_GetState(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_RecordFile")]
-  public static extern int CoreSession_RecordFile(HandleRef jarg1, string jarg2, int jarg3, int jarg4, int jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_originate")]
-  public static extern int CoreSession_originate(HandleRef jarg1, HandleRef jarg2, string jarg3, int jarg4, HandleRef jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Destroy")]
-  public static extern void CoreSession_Destroy(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Speak")]
-  public static extern int CoreSession_Speak(HandleRef jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_SetTtsParameters")]
-  public static extern void CoreSession_SetTtsParameters(HandleRef jarg1, string jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_CollectDigits__SWIG_0")]
-  public static extern int CoreSession_CollectDigits__SWIG_0(HandleRef jarg1, int jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_CollectDigits__SWIG_1")]
-  public static extern int CoreSession_CollectDigits__SWIG_1(HandleRef jarg1, int jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_GetDigits__SWIG_0")]
-  public static extern string CoreSession_GetDigits__SWIG_0(HandleRef jarg1, int jarg2, string jarg3, int jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_GetDigits__SWIG_1")]
-  public static extern string CoreSession_GetDigits__SWIG_1(HandleRef jarg1, int jarg2, string jarg3, int jarg4, int jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Transfer")]
-  public static extern int CoreSession_Transfer(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Read")]
-  public static extern string CoreSession_Read(HandleRef jarg1, int jarg2, int jarg3, string jarg4, int jarg5, string jarg6);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_PlayAndGetDigits")]
-  public static extern string CoreSession_PlayAndGetDigits(HandleRef jarg1, int jarg2, int jarg3, int jarg4, int jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_StreamFile")]
-  public static extern int CoreSession_StreamFile(HandleRef jarg1, string jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Sleep")]
-  public static extern int CoreSession_Sleep(HandleRef jarg1, int jarg2, int jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_FlushEvents")]
-  public static extern int CoreSession_FlushEvents(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_FlushDigits")]
-  public static extern int CoreSession_FlushDigits(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_SetAutoHangup")]
-  public static extern int CoreSession_SetAutoHangup(HandleRef jarg1, bool jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Ready")]
-  public static extern bool CoreSession_Ready(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Answered")]
-  public static extern bool CoreSession_Answered(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_MediaReady")]
-  public static extern bool CoreSession_MediaReady(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_WaitForAnswer")]
-  public static extern void CoreSession_WaitForAnswer(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Execute")]
-  public static extern void CoreSession_Execute(HandleRef jarg1, string jarg2, string jarg3);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_SendEvent")]
-  public static extern void CoreSession_SendEvent(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_QueuePrivateEvent")]
-  public static extern void CoreSession_QueuePrivateEvent(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_SetEventData")]
-  public static extern void CoreSession_SetEventData(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_GetXmlCdr")]
-  public static extern string CoreSession_GetXmlCdr(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_BeginAllowThreads")]
-  public static extern bool CoreSession_BeginAllowThreads(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_EndAllowThreads")]
-  public static extern bool CoreSession_EndAllowThreads(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_GetUuid")]
-  public static extern string CoreSession_GetUuid(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_GetCallbackArguments")]
-  public static extern IntPtr CoreSession_GetCallbackArguments(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_CheckHangupHook")]
-  public static extern void CoreSession_CheckHangupHook(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_console_log")]
-  public static extern void console_log(string jarg1, string jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_console_clean_log")]
-  public static extern void console_clean_log(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_msleep")]
-  public static extern void msleep(uint jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_bridge")]
-  public static extern void bridge(HandleRef jarg1, HandleRef jarg2);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_hanguphook")]
-  public static extern int hanguphook(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_dtmf_callback")]
-  public static extern int dtmf_callback(HandleRef jarg1, HandleRef jarg2, int jarg3, HandleRef jarg4, uint jarg5);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_ManagedSession__SWIG_0")]
-  public static extern IntPtr new_ManagedSession__SWIG_0();
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_ManagedSession__SWIG_1")]
-  public static extern IntPtr new_ManagedSession__SWIG_1(string jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_new_ManagedSession__SWIG_2")]
-  public static extern IntPtr new_ManagedSession__SWIG_2(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_delete_ManagedSession")]
-  public static extern void delete_ManagedSession(HandleRef jarg1);
-
-  [DllImport("mod_managed", EntryPoint="CSharp_ManagedSessionUpcast")]
-  public static extern IntPtr ManagedSessionUpcast(IntPtr objectRef);
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class input_callback_state_t : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal input_callback_state_t(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(input_callback_state_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~input_callback_state_t() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_input_callback_state_t(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_void function {
-    set {
-      freeswitchPINVOKE.input_callback_state_t_function_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.input_callback_state_t_function_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_void threadState {
-    set {
-      freeswitchPINVOKE.input_callback_state_t_threadState_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.input_callback_state_t_threadState_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_void extra {
-    set {
-      freeswitchPINVOKE.input_callback_state_t_extra_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.input_callback_state_t_extra_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public string funcargs {
-    set {
-      freeswitchPINVOKE.input_callback_state_t_funcargs_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.input_callback_state_t_funcargs_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public input_callback_state_t() : this(freeswitchPINVOKE.new_input_callback_state_t(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class IvrMenu : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal IvrMenu(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(IvrMenu obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~IvrMenu() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_IvrMenu(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public IvrMenu(IvrMenu main, string name, string greeting_sound, string short_greeting_sound, string invalid_sound, string exit_sound, string confirm_macro, string confirm_key, string tts_engine, string tts_voice, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts) : this(freeswitchPINVOKE.new_IvrMenu(IvrMenu.getCPtr(main), name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts), true) {
-  }
-
-  public void bindAction(string action, string arg, string bind) {
-    freeswitchPINVOKE.IvrMenu_bindAction(swigCPtr, action, arg, bind);
-  }
-
-  public void Execute(CoreSession session, string name) {
-    freeswitchPINVOKE.IvrMenu_Execute(swigCPtr, CoreSession.getCPtr(session), name);
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public partial class ManagedSession : CoreSession {
-  private HandleRef swigCPtr;
-
-  internal ManagedSession(IntPtr cPtr, bool cMemoryOwn) : base(freeswitchPINVOKE.ManagedSessionUpcast(cPtr), cMemoryOwn) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(ManagedSession obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~ManagedSession() {
-    Dispose();
-  }
-
-  public override void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_ManagedSession(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-      base.Dispose();
-    }
-  }
-
-  public ManagedSession() : this(freeswitchPINVOKE.new_ManagedSession__SWIG_0(), true) {
-  }
-
-  public ManagedSession(string uuid) : this(freeswitchPINVOKE.new_ManagedSession__SWIG_1(uuid), true) {
-  }
-
-  public ManagedSession(SWIGTYPE_p_switch_core_session session) : this(freeswitchPINVOKE.new_ManagedSession__SWIG_2(SWIGTYPE_p_switch_core_session.getCPtr(session)), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum session_flag_t {
-  S_HUP = (1 << 0),
-  S_FREE = (1 << 1),
-  S_RDLOCK = (1 << 2)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public partial class Stream : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal Stream(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(Stream obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~Stream() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_Stream(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public Stream() : this(freeswitchPINVOKE.new_Stream__SWIG_0(), true) {
-  }
-
-  public Stream(switch_stream_handle arg0) : this(freeswitchPINVOKE.new_Stream__SWIG_1(switch_stream_handle.getCPtr(arg0)), true) {
-  }
-
-  public void Write(string data) {
-    freeswitchPINVOKE.Stream_Write(swigCPtr, data);
-  }
-
-  public string get_data() {
-    string ret = freeswitchPINVOKE.Stream_get_data(swigCPtr);
-    return ret;
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_apr_pool_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_apr_pool_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_apr_pool_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_apr_pool_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_FILE {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_FILE(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_FILE() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_FILE obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_float {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_float(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_float() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_float obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_codec__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_codec__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_codec__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_codec__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_core_session_p_char_enum_switch_say_type_t_enum_switch_say_method_t_p_switch_input_args_t__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_core_session_p_char_enum_switch_say_type_t_enum_switch_say_method_t_p_switch_input_args_t__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_core_session_p_char_enum_switch_say_type_t_enum_switch_say_method_t_p_switch_input_args_t__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_char_enum_switch_say_type_t_enum_switch_say_method_t_p_switch_input_args_t__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_bool_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_bool_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_bool_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_bool_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_core_session__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_core_session__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_core_session__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_event__void {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_event__void(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_event__void() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_event__void obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_file_handle__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_file_handle__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_file_handle__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_file_handle__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_scheduler_task__void {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_scheduler_task__void(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_scheduler_task__void() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_scheduler_task__void obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_speech_handle__void {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_speech_handle__void(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_speech_handle__void() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_speech_handle__void obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_switch_timer__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_switch_timer__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_switch_timer__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_timer__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_p_void__void {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_p_void__void(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_p_void__void() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_void__void obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_f_void__switch_status_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_f_void__switch_status_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_f_void__switch_status_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_f_void__switch_status_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_HashElem {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_HashElem(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_HashElem() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_HashElem obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_int {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_int(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_int() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_int obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_apr_pool_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_apr_pool_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_apr_pool_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_apr_pool_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_char {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_char(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_char() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_char obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_p_char {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_p_char(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_p_char() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_p_char obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_real_pcre {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_real_pcre(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_real_pcre() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_real_pcre obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_sqlite3 {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_sqlite3(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_sqlite3() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_sqlite3 obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_sqlite3_stmt {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_sqlite3_stmt(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_sqlite3_stmt() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_sqlite3_stmt obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_audio_resampler_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_audio_resampler_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_audio_resampler_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_audio_resampler_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_buffer {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_buffer(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_buffer() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_buffer obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_cache_db_handle_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_cache_db_handle_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_cache_db_handle_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_cache_db_handle_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_caller_extension {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_caller_extension(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_caller_extension() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_caller_extension obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_channel {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_channel(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_channel() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_channel obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_core_port_allocator {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_core_port_allocator(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_core_port_allocator() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_core_port_allocator obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_core_session {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_core_session(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_core_session() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_core_session obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_core_session_message {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_core_session_message(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_core_session_message() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_core_session_message obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_event {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_event(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_event() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_event obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_event_node {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_event_node(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_event_node() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_event_node obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_frame {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_frame(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_frame() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_frame obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_hash {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_hash(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_hash() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_hash obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_ivr_digit_stream {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_ivr_digit_stream(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_ivr_digit_stream() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_digit_stream obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_ivr_digit_stream_parser {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_ivr_digit_stream_parser(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_ivr_digit_stream_parser() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_digit_stream_parser obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_ivr_menu {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_ivr_menu(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_ivr_menu() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_menu obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_ivr_menu_xml_ctx {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_ivr_menu_xml_ctx(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_ivr_menu_xml_ctx() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_menu_xml_ctx obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_log_node_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_log_node_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_log_node_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_log_node_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_media_bug {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_media_bug(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_media_bug() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_media_bug obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_network_list {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_network_list(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_network_list() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_network_list obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_rtp {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_rtp(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_rtp() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_rtp obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_xml {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_xml(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_xml() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_xml obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_switch_xml_binding {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_switch_xml_binding(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_switch_xml_binding() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_xml_binding obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_p_void {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_p_void(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_p_void() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_p_void obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_real_pcre {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_real_pcre(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_real_pcre() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_real_pcre obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_short {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_short(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_short() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_short obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_sockaddr {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_sockaddr(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_sockaddr() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_sockaddr obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_socklen_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_socklen_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_socklen_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_socklen_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_sqlite3 {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_sqlite3(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_sqlite3() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_sqlite3 obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_sqlite3_stmt {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_sqlite3_stmt(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_sqlite3_stmt() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_sqlite3_stmt obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_buffer {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_buffer(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_buffer() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_buffer obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_call_cause_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_call_cause_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_call_cause_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_call_cause_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_channel {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_channel(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_channel() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_channel obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_core_port_allocator {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_core_port_allocator(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_core_port_allocator() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_core_port_allocator obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_core_session {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_core_session(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_core_session() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_core_session obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_event_node {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_event_node(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_event_node() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_event_node obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_event_types_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_event_types_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_event_types_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_event_types_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_file_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_file_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_file_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_file_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_hash {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_hash(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_hash() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_hash obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_interval_time_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_interval_time_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_interval_time_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_interval_time_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_ivr_action_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_ivr_action_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_ivr_action_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_ivr_action_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_ivr_digit_stream {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_ivr_digit_stream(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_ivr_digit_stream() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_ivr_digit_stream obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_ivr_digit_stream_parser {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_ivr_digit_stream_parser(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_ivr_digit_stream_parser() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_ivr_digit_stream_parser obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_ivr_menu {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_ivr_menu(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_ivr_menu() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_ivr_menu obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_ivr_menu_action_function_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_ivr_menu_action_function_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_ivr_menu_action_function_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_ivr_menu_action_function_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_ivr_menu_xml_ctx {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_ivr_menu_xml_ctx(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_ivr_menu_xml_ctx() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_ivr_menu_xml_ctx obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_loadable_module_interface {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_loadable_module_interface(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_loadable_module_interface() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_loadable_module_interface obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_media_bug {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_media_bug(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_media_bug() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_media_bug obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_mutex_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_mutex_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_mutex_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_mutex_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_network_list {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_network_list(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_network_list() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_network_list obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_odbc_handle {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_odbc_handle(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_odbc_handle() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_odbc_handle obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_pollfd_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_pollfd_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_pollfd_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_pollfd_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_queue_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_queue_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_queue_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_queue_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_rtp {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_rtp(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_rtp() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_rtp obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_size_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_size_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_size_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_size_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_sockaddr_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_sockaddr_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_sockaddr_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_sockaddr_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_socket_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_socket_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_socket_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_socket_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_ssize_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_ssize_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_ssize_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_ssize_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_thread_rwlock_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_thread_rwlock_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_thread_rwlock_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_thread_rwlock_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_time_exp_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_time_exp_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_time_exp_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_time_exp_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_time_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_time_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_time_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_time_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_switch_xml_binding {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_switch_xml_binding(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_switch_xml_binding() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_switch_xml_binding obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_time_t {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_time_t(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_time_t() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_time_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_unsigned_char {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_unsigned_char(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_unsigned_char() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_unsigned_char obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_unsigned_int {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_unsigned_int(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_unsigned_int() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_unsigned_int obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_unsigned_long {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_unsigned_long(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_unsigned_long() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_unsigned_long obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_unsigned_short {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_unsigned_short(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_unsigned_short() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_unsigned_short obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class SWIGTYPE_p_void {
-  private HandleRef swigCPtr;
-
-  internal SWIGTYPE_p_void(IntPtr cPtr, bool futureUse) {
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  protected SWIGTYPE_p_void() {
-    swigCPtr = new HandleRef(null, IntPtr.Zero);
-  }
-
-  internal static HandleRef getCPtr(SWIGTYPE_p_void obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_abc_type_t {
-  SWITCH_ABC_TYPE_INIT,
-  SWITCH_ABC_TYPE_READ,
-  SWITCH_ABC_TYPE_WRITE,
-  SWITCH_ABC_TYPE_WRITE_REPLACE,
-  SWITCH_ABC_TYPE_READ_REPLACE,
-  SWITCH_ABC_TYPE_READ_PING,
-  SWITCH_ABC_TYPE_CLOSE
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_api_interface : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_api_interface(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_api_interface obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_api_interface() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_api_interface(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string interface_name {
-    set {
-      freeswitchPINVOKE.switch_api_interface_interface_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_api_interface_interface_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string desc {
-    set {
-      freeswitchPINVOKE.switch_api_interface_desc_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_api_interface_desc_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t function {
-    set {
-      freeswitchPINVOKE.switch_api_interface_function_set(swigCPtr, SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_api_interface_function_get(swigCPtr);
-      SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public string syntax {
-    set {
-      freeswitchPINVOKE.switch_api_interface_syntax_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_api_interface_syntax_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
-    set {
-      freeswitchPINVOKE.switch_api_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_api_interface_rwlock_get(swigCPtr);
-      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public int refs {
-    set {
-      freeswitchPINVOKE.switch_api_interface_refs_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_api_interface_refs_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_mutex_t reflock {
-    set {
-      freeswitchPINVOKE.switch_api_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_api_interface_reflock_get(swigCPtr);
-      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_loadable_module_interface parent {
-    set {
-      freeswitchPINVOKE.switch_api_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_api_interface_parent_get(swigCPtr);
-      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_api_interface next {
-    set {
-      freeswitchPINVOKE.switch_api_interface_next_set(swigCPtr, switch_api_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_api_interface_next_get(swigCPtr);
-      switch_api_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_api_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_api_interface() : this(freeswitchPINVOKE.new_switch_api_interface(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_application_flag_enum_t {
-  SAF_NONE = 0,
-  SAF_SUPPORT_NOMEDIA = (1 << 0),
-  SAF_ROUTING_EXEC = (1 << 1)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_application_interface : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_application_interface(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_application_interface obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_application_interface() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_application_interface(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string interface_name {
-    set {
-      freeswitchPINVOKE.switch_application_interface_interface_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_application_interface_interface_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void application_function {
-    set {
-      freeswitchPINVOKE.switch_application_interface_application_function_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_application_interface_application_function_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public string long_desc {
-    set {
-      freeswitchPINVOKE.switch_application_interface_long_desc_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_application_interface_long_desc_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string short_desc {
-    set {
-      freeswitchPINVOKE.switch_application_interface_short_desc_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_application_interface_short_desc_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string syntax {
-    set {
-      freeswitchPINVOKE.switch_application_interface_syntax_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_application_interface_syntax_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint flags {
-    set {
-      freeswitchPINVOKE.switch_application_interface_flags_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_application_interface_flags_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
-    set {
-      freeswitchPINVOKE.switch_application_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_application_interface_rwlock_get(swigCPtr);
-      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public int refs {
-    set {
-      freeswitchPINVOKE.switch_application_interface_refs_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_application_interface_refs_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_mutex_t reflock {
-    set {
-      freeswitchPINVOKE.switch_application_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_application_interface_reflock_get(swigCPtr);
-      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_loadable_module_interface parent {
-    set {
-      freeswitchPINVOKE.switch_application_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_application_interface_parent_get(swigCPtr);
-      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_application_interface next {
-    set {
-      freeswitchPINVOKE.switch_application_interface_next_set(swigCPtr, switch_application_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_application_interface_next_get(swigCPtr);
-      switch_application_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_application_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_application_interface() : this(freeswitchPINVOKE.new_switch_application_interface(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_app_log : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_app_log(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_app_log obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_app_log() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_app_log(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string app {
-    set {
-      freeswitchPINVOKE.switch_app_log_app_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_app_log_app_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string arg {
-    set {
-      freeswitchPINVOKE.switch_app_log_arg_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_app_log_arg_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_app_log next {
-    set {
-      freeswitchPINVOKE.switch_app_log_next_set(swigCPtr, switch_app_log.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_app_log_next_get(swigCPtr);
-      switch_app_log ret = (cPtr == IntPtr.Zero) ? null : new switch_app_log(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_app_log() : this(freeswitchPINVOKE.new_switch_app_log(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_asr_flag_enum_t {
-  SWITCH_ASR_FLAG_NONE = 0,
-  SWITCH_ASR_FLAG_DATA = (1 << 0),
-  SWITCH_ASR_FLAG_FREE_POOL = (1 << 1),
-  SWITCH_ASR_FLAG_CLOSED = (1 << 2),
-  SWITCH_ASR_FLAG_FIRE_EVENTS = (1 << 3),
-  SWITCH_ASR_FLAG_AUTO_RESUME = (1 << 4)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_asr_handle : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_asr_handle(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_asr_handle obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_asr_handle() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_asr_handle(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public switch_asr_interface asr_interface {
-    set {
-      freeswitchPINVOKE.switch_asr_handle_asr_interface_set(swigCPtr, switch_asr_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_asr_handle_asr_interface_get(swigCPtr);
-      switch_asr_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_asr_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public uint flags {
-    set {
-      freeswitchPINVOKE.switch_asr_handle_flags_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_asr_handle_flags_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string name {
-    set {
-      freeswitchPINVOKE.switch_asr_handle_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_asr_handle_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string codec {
-    set {
-      freeswitchPINVOKE.switch_asr_handle_codec_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_asr_handle_codec_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint rate {
-    set {
-      freeswitchPINVOKE.switch_asr_handle_rate_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_asr_handle_rate_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string grammar {
-    set {
-      freeswitchPINVOKE.switch_asr_handle_grammar_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_asr_handle_grammar_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string param {
-    set {
-      freeswitchPINVOKE.switch_asr_handle_param_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_asr_handle_param_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_apr_pool_t memory_pool {
-    set {
-      freeswitchPINVOKE.switch_asr_handle_memory_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_asr_handle_memory_pool_get(swigCPtr);
-      SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_void private_info {
-    set {
-      freeswitchPINVOKE.switch_asr_handle_private_info_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_asr_handle_private_info_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_asr_handle() : this(freeswitchPINVOKE.new_switch_asr_handle(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_asr_interface : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_asr_interface(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_asr_interface obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_asr_interface() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_asr_interface(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string interface_name {
-    set {
-      freeswitchPINVOKE.switch_asr_interface_interface_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_asr_interface_interface_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t asr_open {
-    set {
-      freeswitchPINVOKE.switch_asr_interface_asr_open_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_open_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t asr_load_grammar {
-    set {
-      freeswitchPINVOKE.switch_asr_interface_asr_load_grammar_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_load_grammar_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t asr_unload_grammar {
-    set {
-      freeswitchPINVOKE.switch_asr_interface_asr_unload_grammar_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_unload_grammar_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t asr_close {
-    set {
-      freeswitchPINVOKE.switch_asr_interface_asr_close_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_close_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t asr_feed {
-    set {
-      freeswitchPINVOKE.switch_asr_interface_asr_feed_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_feed_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t asr_resume {
-    set {
-      freeswitchPINVOKE.switch_asr_interface_asr_resume_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_resume_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t asr_pause {
-    set {
-      freeswitchPINVOKE.switch_asr_interface_asr_pause_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_pause_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t asr_check_results {
-    set {
-      freeswitchPINVOKE.switch_asr_interface_asr_check_results_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_check_results_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t asr_get_results {
-    set {
-      freeswitchPINVOKE.switch_asr_interface_asr_get_results_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_get_results_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t asr_start_input_timers {
-    set {
-      freeswitchPINVOKE.switch_asr_interface_asr_start_input_timers_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_start_input_timers_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void asr_text_param {
-    set {
-      freeswitchPINVOKE.switch_asr_interface_asr_text_param_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_text_param_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void asr_numeric_param {
-    set {
-      freeswitchPINVOKE.switch_asr_interface_asr_numeric_param_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_numeric_param_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void asr_float_param {
-    set {
-      freeswitchPINVOKE.switch_asr_interface_asr_float_param_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_float_param_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
-    set {
-      freeswitchPINVOKE.switch_asr_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_rwlock_get(swigCPtr);
-      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public int refs {
-    set {
-      freeswitchPINVOKE.switch_asr_interface_refs_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_asr_interface_refs_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_mutex_t reflock {
-    set {
-      freeswitchPINVOKE.switch_asr_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_reflock_get(swigCPtr);
-      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_loadable_module_interface parent {
-    set {
-      freeswitchPINVOKE.switch_asr_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_parent_get(swigCPtr);
-      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_asr_interface next {
-    set {
-      freeswitchPINVOKE.switch_asr_interface_next_set(swigCPtr, switch_asr_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_next_get(swigCPtr);
-      switch_asr_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_asr_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_asr_interface() : this(freeswitchPINVOKE.new_switch_asr_interface(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_audio_col_t {
-  SWITCH_AUDIO_COL_STR_TITLE = 0x01,
-  SWITCH_AUDIO_COL_STR_COPYRIGHT = 0x02,
-  SWITCH_AUDIO_COL_STR_SOFTWARE = 0x03,
-  SWITCH_AUDIO_COL_STR_ARTIST = 0x04,
-  SWITCH_AUDIO_COL_STR_COMMENT = 0x05,
-  SWITCH_AUDIO_COL_STR_DATE = 0x06
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_audio_resampler_t : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_audio_resampler_t(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_audio_resampler_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_audio_resampler_t() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_audio_resampler_t(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_void resampler {
-    set {
-      freeswitchPINVOKE.switch_audio_resampler_t_resampler_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_audio_resampler_t_resampler_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public int from_rate {
-    set {
-      freeswitchPINVOKE.switch_audio_resampler_t_from_rate_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_audio_resampler_t_from_rate_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int to_rate {
-    set {
-      freeswitchPINVOKE.switch_audio_resampler_t_to_rate_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_audio_resampler_t_to_rate_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public double factor {
-    set {
-      freeswitchPINVOKE.switch_audio_resampler_t_factor_set(swigCPtr, value);
-    } 
-    get {
-      double ret = freeswitchPINVOKE.switch_audio_resampler_t_factor_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public double rfactor {
-    set {
-      freeswitchPINVOKE.switch_audio_resampler_t_rfactor_set(swigCPtr, value);
-    } 
-    get {
-      double ret = freeswitchPINVOKE.switch_audio_resampler_t_rfactor_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_short to {
-    set {
-      freeswitchPINVOKE.switch_audio_resampler_t_to_set(swigCPtr, SWIGTYPE_p_short.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_audio_resampler_t_to_get(swigCPtr);
-      SWIGTYPE_p_short ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_short(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public uint to_len {
-    set {
-      freeswitchPINVOKE.switch_audio_resampler_t_to_len_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_audio_resampler_t_to_len_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint to_size {
-    set {
-      freeswitchPINVOKE.switch_audio_resampler_t_to_size_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_audio_resampler_t_to_size_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_audio_resampler_t() : this(freeswitchPINVOKE.new_switch_audio_resampler_t(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_bind_flag_enum_t {
-  SBF_DIAL_ALEG = (1 << 0),
-  SBF_EXEC_ALEG = (1 << 1),
-  SBF_DIAL_BLEG = (1 << 2),
-  SBF_EXEC_BLEG = (1 << 3),
-  SBF_EXEC_OPPOSITE = (1 << 4),
-  SBF_EXEC_SAME = (1 << 5),
-  SBF_ONCE = (1 << 6),
-  SBF_EXEC_INLINE = (1 << 7)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_bitpack_mode_t {
-  SWITCH_BITPACK_MODE_RFC3551,
-  SWITCH_BITPACK_MODE_AAL2
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_bitpack_t : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_bitpack_t(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_bitpack_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_bitpack_t() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_bitpack_t(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_unsigned_char buf {
-    set {
-      freeswitchPINVOKE.switch_bitpack_t_buf_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_bitpack_t_buf_get(swigCPtr);
-      SWIGTYPE_p_unsigned_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public uint buflen {
-    set {
-      freeswitchPINVOKE.switch_bitpack_t_buflen_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_bitpack_t_buflen_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_unsigned_char cur {
-    set {
-      freeswitchPINVOKE.switch_bitpack_t_cur_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_bitpack_t_cur_get(swigCPtr);
-      SWIGTYPE_p_unsigned_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public uint bytes {
-    set {
-      freeswitchPINVOKE.switch_bitpack_t_bytes_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_bitpack_t_bytes_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint bits_tot {
-    set {
-      freeswitchPINVOKE.switch_bitpack_t_bits_tot_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_bitpack_t_bits_tot_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public byte bits_cur {
-    set {
-      freeswitchPINVOKE.switch_bitpack_t_bits_cur_set(swigCPtr, value);
-    } 
-    get {
-      byte ret = freeswitchPINVOKE.switch_bitpack_t_bits_cur_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public byte bits_rem {
-    set {
-      freeswitchPINVOKE.switch_bitpack_t_bits_rem_set(swigCPtr, value);
-    } 
-    get {
-      byte ret = freeswitchPINVOKE.switch_bitpack_t_bits_rem_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public byte frame_bits {
-    set {
-      freeswitchPINVOKE.switch_bitpack_t_frame_bits_set(swigCPtr, value);
-    } 
-    get {
-      byte ret = freeswitchPINVOKE.switch_bitpack_t_frame_bits_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public byte shiftby {
-    set {
-      freeswitchPINVOKE.switch_bitpack_t_shiftby_set(swigCPtr, value);
-    } 
-    get {
-      byte ret = freeswitchPINVOKE.switch_bitpack_t_shiftby_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public byte this_byte {
-    set {
-      freeswitchPINVOKE.switch_bitpack_t_this_byte_set(swigCPtr, value);
-    } 
-    get {
-      byte ret = freeswitchPINVOKE.switch_bitpack_t_this_byte_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public byte under {
-    set {
-      freeswitchPINVOKE.switch_bitpack_t_under_set(swigCPtr, value);
-    } 
-    get {
-      byte ret = freeswitchPINVOKE.switch_bitpack_t_under_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public byte over {
-    set {
-      freeswitchPINVOKE.switch_bitpack_t_over_set(swigCPtr, value);
-    } 
-    get {
-      byte ret = freeswitchPINVOKE.switch_bitpack_t_over_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_bitpack_mode_t mode {
-    set {
-      freeswitchPINVOKE.switch_bitpack_t_mode_set(swigCPtr, (int)value);
-    } 
-    get {
-      switch_bitpack_mode_t ret = (switch_bitpack_mode_t)freeswitchPINVOKE.switch_bitpack_t_mode_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_bitpack_t() : this(freeswitchPINVOKE.new_switch_bitpack_t(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_bool_t {
-  SWITCH_FALSE = 0,
-  SWITCH_TRUE = 1
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_cache_db_connection_options_t : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_cache_db_connection_options_t(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_cache_db_connection_options_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_cache_db_connection_options_t() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_cache_db_connection_options_t(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public switch_cache_db_core_db_options_t core_db_options {
-    set {
-      freeswitchPINVOKE.switch_cache_db_connection_options_t_core_db_options_set(swigCPtr, switch_cache_db_core_db_options_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_cache_db_connection_options_t_core_db_options_get(swigCPtr);
-      switch_cache_db_core_db_options_t ret = (cPtr == IntPtr.Zero) ? null : new switch_cache_db_core_db_options_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_cache_db_odbc_options_t odbc_options {
-    set {
-      freeswitchPINVOKE.switch_cache_db_connection_options_t_odbc_options_set(swigCPtr, switch_cache_db_odbc_options_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_cache_db_connection_options_t_odbc_options_get(swigCPtr);
-      switch_cache_db_odbc_options_t ret = (cPtr == IntPtr.Zero) ? null : new switch_cache_db_odbc_options_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_cache_db_connection_options_t() : this(freeswitchPINVOKE.new_switch_cache_db_connection_options_t(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_cache_db_core_db_options_t : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_cache_db_core_db_options_t(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_cache_db_core_db_options_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_cache_db_core_db_options_t() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_cache_db_core_db_options_t(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string db_path {
-    set {
-      freeswitchPINVOKE.switch_cache_db_core_db_options_t_db_path_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_cache_db_core_db_options_t_db_path_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_cache_db_core_db_options_t() : this(freeswitchPINVOKE.new_switch_cache_db_core_db_options_t(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_cache_db_handle_t : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_cache_db_handle_t(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_cache_db_handle_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_cache_db_handle_t() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_cache_db_handle_t(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string name {
-    set {
-      freeswitchPINVOKE.switch_cache_db_handle_t_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_cache_db_handle_t_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_cache_db_handle_type_t type {
-    set {
-      freeswitchPINVOKE.switch_cache_db_handle_t_type_set(swigCPtr, (int)value);
-    } 
-    get {
-      switch_cache_db_handle_type_t ret = (switch_cache_db_handle_type_t)freeswitchPINVOKE.switch_cache_db_handle_t_type_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_cache_db_native_handle_t native_handle {
-    set {
-      freeswitchPINVOKE.switch_cache_db_handle_t_native_handle_set(swigCPtr, switch_cache_db_native_handle_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_cache_db_handle_t_native_handle_get(swigCPtr);
-      switch_cache_db_native_handle_t ret = (cPtr == IntPtr.Zero) ? null : new switch_cache_db_native_handle_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_time_t last_used {
-    set {
-      freeswitchPINVOKE.switch_cache_db_handle_t_last_used_set(swigCPtr, SWIGTYPE_p_time_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_time_t ret = new SWIGTYPE_p_time_t(freeswitchPINVOKE.switch_cache_db_handle_t_last_used_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_mutex_t mutex {
-    set {
-      freeswitchPINVOKE.switch_cache_db_handle_t_mutex_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_cache_db_handle_t_mutex_get(swigCPtr);
-      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_apr_pool_t pool {
-    set {
-      freeswitchPINVOKE.switch_cache_db_handle_t_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_cache_db_handle_t_pool_get(swigCPtr);
-      SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public int flags {
-    set {
-      freeswitchPINVOKE.switch_cache_db_handle_t_flags_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_cache_db_handle_t_flags_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint hash {
-    set {
-      freeswitchPINVOKE.switch_cache_db_handle_t_hash_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_cache_db_handle_t_hash_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string creator {
-    set {
-      freeswitchPINVOKE.switch_cache_db_handle_t_creator_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_cache_db_handle_t_creator_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string last_user {
-    set {
-      freeswitchPINVOKE.switch_cache_db_handle_t_last_user_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_cache_db_handle_t_last_user_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_cache_db_handle_t() : this(freeswitchPINVOKE.new_switch_cache_db_handle_t(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_cache_db_handle_type_t {
-  SCDB_TYPE_CORE_DB,
-  SCDB_TYPE_ODBC
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_cache_db_native_handle_t : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_cache_db_native_handle_t(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_cache_db_native_handle_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_cache_db_native_handle_t() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_cache_db_native_handle_t(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_sqlite3 core_db_dbh {
-    set {
-      freeswitchPINVOKE.switch_cache_db_native_handle_t_core_db_dbh_set(swigCPtr, SWIGTYPE_p_sqlite3.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_cache_db_native_handle_t_core_db_dbh_get(swigCPtr);
-      SWIGTYPE_p_sqlite3 ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_sqlite3(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_odbc_handle odbc_dbh {
-    set {
-      freeswitchPINVOKE.switch_cache_db_native_handle_t_odbc_dbh_set(swigCPtr, SWIGTYPE_p_switch_odbc_handle.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_cache_db_native_handle_t_odbc_dbh_get(swigCPtr);
-      SWIGTYPE_p_switch_odbc_handle ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_odbc_handle(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_cache_db_native_handle_t() : this(freeswitchPINVOKE.new_switch_cache_db_native_handle_t(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_cache_db_odbc_options_t : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_cache_db_odbc_options_t(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_cache_db_odbc_options_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_cache_db_odbc_options_t() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_cache_db_odbc_options_t(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string dsn {
-    set {
-      freeswitchPINVOKE.switch_cache_db_odbc_options_t_dsn_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_cache_db_odbc_options_t_dsn_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string user {
-    set {
-      freeswitchPINVOKE.switch_cache_db_odbc_options_t_user_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_cache_db_odbc_options_t_user_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string pass {
-    set {
-      freeswitchPINVOKE.switch_cache_db_odbc_options_t_pass_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_cache_db_odbc_options_t_pass_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_cache_db_odbc_options_t() : this(freeswitchPINVOKE.new_switch_cache_db_odbc_options_t(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_caller_application : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_caller_application(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_caller_application obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_caller_application() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_caller_application(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string application_name {
-    set {
-      freeswitchPINVOKE.switch_caller_application_application_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_caller_application_application_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string application_data {
-    set {
-      freeswitchPINVOKE.switch_caller_application_application_data_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_caller_application_application_data_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void application_function {
-    set {
-      freeswitchPINVOKE.switch_caller_application_application_function_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_caller_application_application_function_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_caller_application next {
-    set {
-      freeswitchPINVOKE.switch_caller_application_next_set(swigCPtr, switch_caller_application.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_caller_application_next_get(swigCPtr);
-      switch_caller_application ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_application(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_caller_application() : this(freeswitchPINVOKE.new_switch_caller_application(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_caller_extension : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_caller_extension(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_caller_extension obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_caller_extension() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_caller_extension(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string extension_name {
-    set {
-      freeswitchPINVOKE.switch_caller_extension_extension_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_caller_extension_extension_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string extension_number {
-    set {
-      freeswitchPINVOKE.switch_caller_extension_extension_number_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_caller_extension_extension_number_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_caller_application current_application {
-    set {
-      freeswitchPINVOKE.switch_caller_extension_current_application_set(swigCPtr, switch_caller_application.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_caller_extension_current_application_get(swigCPtr);
-      switch_caller_application ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_application(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_caller_application last_application {
-    set {
-      freeswitchPINVOKE.switch_caller_extension_last_application_set(swigCPtr, switch_caller_application.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_caller_extension_last_application_get(swigCPtr);
-      switch_caller_application ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_application(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_caller_application applications {
-    set {
-      freeswitchPINVOKE.switch_caller_extension_applications_set(swigCPtr, switch_caller_application.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_caller_extension_applications_get(swigCPtr);
-      switch_caller_application ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_application(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_caller_profile children {
-    set {
-      freeswitchPINVOKE.switch_caller_extension_children_set(swigCPtr, switch_caller_profile.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_caller_extension_children_get(swigCPtr);
-      switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_caller_extension next {
-    set {
-      freeswitchPINVOKE.switch_caller_extension_next_set(swigCPtr, switch_caller_extension.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_caller_extension_next_get(swigCPtr);
-      switch_caller_extension ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_extension(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_caller_extension() : this(freeswitchPINVOKE.new_switch_caller_extension(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_caller_profile : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_caller_profile(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_caller_profile obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_caller_profile() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_caller_profile(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string username {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_username_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_caller_profile_username_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string dialplan {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_dialplan_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_caller_profile_dialplan_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string caller_id_name {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_caller_id_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_caller_profile_caller_id_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string caller_id_number {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_caller_id_number_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_caller_profile_caller_id_number_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string callee_id_name {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_callee_id_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_caller_profile_callee_id_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string callee_id_number {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_callee_id_number_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_caller_profile_callee_id_number_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public byte caller_ton {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_caller_ton_set(swigCPtr, value);
-    } 
-    get {
-      byte ret = freeswitchPINVOKE.switch_caller_profile_caller_ton_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public byte caller_numplan {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_caller_numplan_set(swigCPtr, value);
-    } 
-    get {
-      byte ret = freeswitchPINVOKE.switch_caller_profile_caller_numplan_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string network_addr {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_network_addr_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_caller_profile_network_addr_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string ani {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_ani_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_caller_profile_ani_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public byte ani_ton {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_ani_ton_set(swigCPtr, value);
-    } 
-    get {
-      byte ret = freeswitchPINVOKE.switch_caller_profile_ani_ton_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public byte ani_numplan {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_ani_numplan_set(swigCPtr, value);
-    } 
-    get {
-      byte ret = freeswitchPINVOKE.switch_caller_profile_ani_numplan_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string aniii {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_aniii_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_caller_profile_aniii_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string rdnis {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_rdnis_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_caller_profile_rdnis_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public byte rdnis_ton {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_rdnis_ton_set(swigCPtr, value);
-    } 
-    get {
-      byte ret = freeswitchPINVOKE.switch_caller_profile_rdnis_ton_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public byte rdnis_numplan {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_rdnis_numplan_set(swigCPtr, value);
-    } 
-    get {
-      byte ret = freeswitchPINVOKE.switch_caller_profile_rdnis_numplan_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string destination_number {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_destination_number_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_caller_profile_destination_number_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public byte destination_number_ton {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_destination_number_ton_set(swigCPtr, value);
-    } 
-    get {
-      byte ret = freeswitchPINVOKE.switch_caller_profile_destination_number_ton_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public byte destination_number_numplan {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_destination_number_numplan_set(swigCPtr, value);
-    } 
-    get {
-      byte ret = freeswitchPINVOKE.switch_caller_profile_destination_number_numplan_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string source {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_source_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_caller_profile_source_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string chan_name {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_chan_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_caller_profile_chan_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string uuid {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_uuid_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_caller_profile_uuid_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string context {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_context_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_caller_profile_context_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string profile_index {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_profile_index_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_caller_profile_profile_index_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint flags {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_flags_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_caller_profile_flags_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_caller_profile originator_caller_profile {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_originator_caller_profile_set(swigCPtr, switch_caller_profile.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_originator_caller_profile_get(swigCPtr);
-      switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_caller_profile originatee_caller_profile {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_originatee_caller_profile_set(swigCPtr, switch_caller_profile.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_originatee_caller_profile_get(swigCPtr);
-      switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_caller_profile hunt_caller_profile {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_hunt_caller_profile_set(swigCPtr, switch_caller_profile.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_hunt_caller_profile_get(swigCPtr);
-      switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_channel_timetable times {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_times_set(swigCPtr, switch_channel_timetable.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_times_get(swigCPtr);
-      switch_channel_timetable ret = (cPtr == IntPtr.Zero) ? null : new switch_channel_timetable(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_caller_extension caller_extension {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_caller_extension_set(swigCPtr, switch_caller_extension.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_caller_extension_get(swigCPtr);
-      switch_caller_extension ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_extension(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_apr_pool_t pool {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_pool_get(swigCPtr);
-      SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_caller_profile next {
-    set {
-      freeswitchPINVOKE.switch_caller_profile_next_set(swigCPtr, switch_caller_profile.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_next_get(swigCPtr);
-      switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_caller_profile() : this(freeswitchPINVOKE.new_switch_caller_profile(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_caller_profile_flag_enum_t {
-  SWITCH_CPF_NONE = 0,
-  SWITCH_CPF_SCREEN = (1 << 0),
-  SWITCH_CPF_HIDE_NAME = (1 << 1),
-  SWITCH_CPF_HIDE_NUMBER = (1 << 2)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_call_cause_t {
-  SWITCH_CAUSE_NONE = 0,
-  SWITCH_CAUSE_UNALLOCATED_NUMBER = 1,
-  SWITCH_CAUSE_NO_ROUTE_TRANSIT_NET = 2,
-  SWITCH_CAUSE_NO_ROUTE_DESTINATION = 3,
-  SWITCH_CAUSE_CHANNEL_UNACCEPTABLE = 6,
-  SWITCH_CAUSE_CALL_AWARDED_DELIVERED = 7,
-  SWITCH_CAUSE_NORMAL_CLEARING = 16,
-  SWITCH_CAUSE_USER_BUSY = 17,
-  SWITCH_CAUSE_NO_USER_RESPONSE = 18,
-  SWITCH_CAUSE_NO_ANSWER = 19,
-  SWITCH_CAUSE_SUBSCRIBER_ABSENT = 20,
-  SWITCH_CAUSE_CALL_REJECTED = 21,
-  SWITCH_CAUSE_NUMBER_CHANGED = 22,
-  SWITCH_CAUSE_REDIRECTION_TO_NEW_DESTINATION = 23,
-  SWITCH_CAUSE_EXCHANGE_ROUTING_ERROR = 25,
-  SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER = 27,
-  SWITCH_CAUSE_INVALID_NUMBER_FORMAT = 28,
-  SWITCH_CAUSE_FACILITY_REJECTED = 29,
-  SWITCH_CAUSE_RESPONSE_TO_STATUS_ENQUIRY = 30,
-  SWITCH_CAUSE_NORMAL_UNSPECIFIED = 31,
-  SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION = 34,
-  SWITCH_CAUSE_NETWORK_OUT_OF_ORDER = 38,
-  SWITCH_CAUSE_NORMAL_TEMPORARY_FAILURE = 41,
-  SWITCH_CAUSE_SWITCH_CONGESTION = 42,
-  SWITCH_CAUSE_ACCESS_INFO_DISCARDED = 43,
-  SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL = 44,
-  SWITCH_CAUSE_PRE_EMPTED = 45,
-  SWITCH_CAUSE_FACILITY_NOT_SUBSCRIBED = 50,
-  SWITCH_CAUSE_OUTGOING_CALL_BARRED = 52,
-  SWITCH_CAUSE_INCOMING_CALL_BARRED = 54,
-  SWITCH_CAUSE_BEARERCAPABILITY_NOTAUTH = 57,
-  SWITCH_CAUSE_BEARERCAPABILITY_NOTAVAIL = 58,
-  SWITCH_CAUSE_SERVICE_UNAVAILABLE = 63,
-  SWITCH_CAUSE_BEARERCAPABILITY_NOTIMPL = 65,
-  SWITCH_CAUSE_CHAN_NOT_IMPLEMENTED = 66,
-  SWITCH_CAUSE_FACILITY_NOT_IMPLEMENTED = 69,
-  SWITCH_CAUSE_SERVICE_NOT_IMPLEMENTED = 79,
-  SWITCH_CAUSE_INVALID_CALL_REFERENCE = 81,
-  SWITCH_CAUSE_INCOMPATIBLE_DESTINATION = 88,
-  SWITCH_CAUSE_INVALID_MSG_UNSPECIFIED = 95,
-  SWITCH_CAUSE_MANDATORY_IE_MISSING = 96,
-  SWITCH_CAUSE_MESSAGE_TYPE_NONEXIST = 97,
-  SWITCH_CAUSE_WRONG_MESSAGE = 98,
-  SWITCH_CAUSE_IE_NONEXIST = 99,
-  SWITCH_CAUSE_INVALID_IE_CONTENTS = 100,
-  SWITCH_CAUSE_WRONG_CALL_STATE = 101,
-  SWITCH_CAUSE_RECOVERY_ON_TIMER_EXPIRE = 102,
-  SWITCH_CAUSE_MANDATORY_IE_LENGTH_ERROR = 103,
-  SWITCH_CAUSE_PROTOCOL_ERROR = 111,
-  SWITCH_CAUSE_INTERWORKING = 127,
-  SWITCH_CAUSE_SUCCESS = 142,
-  SWITCH_CAUSE_ORIGINATOR_CANCEL = 487,
-  SWITCH_CAUSE_CRASH = 500,
-  SWITCH_CAUSE_SYSTEM_SHUTDOWN = 501,
-  SWITCH_CAUSE_LOSE_RACE = 502,
-  SWITCH_CAUSE_MANAGER_REQUEST = 503,
-  SWITCH_CAUSE_BLIND_TRANSFER = 600,
-  SWITCH_CAUSE_ATTENDED_TRANSFER = 601,
-  SWITCH_CAUSE_ALLOTTED_TIMEOUT = 602,
-  SWITCH_CAUSE_USER_CHALLENGE = 603,
-  SWITCH_CAUSE_MEDIA_TIMEOUT = 604,
-  SWITCH_CAUSE_PICKED_OFF = 605,
-  SWITCH_CAUSE_USER_NOT_REGISTERED = 606,
-  SWITCH_CAUSE_PROGRESS_TIMEOUT = 607
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_call_direction_t {
-  SWITCH_CALL_DIRECTION_INBOUND,
-  SWITCH_CALL_DIRECTION_OUTBOUND
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_channel_app_flag_t {
-  CF_APP_TAGGED = (1 << 0)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_channel_cap_t {
-  CC_MEDIA_ACK = 1,
-  CC_BYPASS_MEDIA,
-  CC_PROXY_MEDIA,
-  CC_FLAG_MAX
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_channel_flag_t {
-  CF_ANSWERED = 1,
-  CF_OUTBOUND,
-  CF_EARLY_MEDIA,
-  CF_BRIDGE_ORIGINATOR,
-  CF_TRANSFER,
-  CF_ACCEPT_CNG,
-  CF_REDIRECT,
-  CF_BRIDGED,
-  CF_HOLD,
-  CF_SERVICE,
-  CF_TAGGED,
-  CF_WINNER,
-  CF_CONTROLLED,
-  CF_PROXY_MODE,
-  CF_SUSPEND,
-  CF_EVENT_PARSE,
-  CF_GEN_RINGBACK,
-  CF_RING_READY,
-  CF_BREAK,
-  CF_BROADCAST,
-  CF_UNICAST,
-  CF_VIDEO,
-  CF_EVENT_LOCK,
-  CF_RESET,
-  CF_ORIGINATING,
-  CF_STOP_BROADCAST,
-  CF_PROXY_MEDIA,
-  CF_INNER_BRIDGE,
-  CF_REQ_MEDIA,
-  CF_VERBOSE_EVENTS,
-  CF_PAUSE_BUGS,
-  CF_DIVERT_EVENTS,
-  CF_BLOCK_STATE,
-  CF_FS_RTP,
-  CF_REPORTING,
-  CF_PARK,
-  CF_TIMESTAMP_SET,
-  CF_ORIGINATOR,
-  CF_XFER_ZOMBIE,
-  CF_MEDIA_ACK,
-  CF_THREAD_SLEEPING,
-  CF_DISABLE_RINGBACK,
-  CF_NOT_READY,
-  CF_SIGNAL_BRIDGE_TTL,
-  CF_MEDIA_BRIDGE_TTL,
-  CF_BYPASS_MEDIA_AFTER_BRIDGE,
-  CF_LEG_HOLDING,
-  CF_FLAG_MAX
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_channel_state_t {
-  CS_NEW,
-  CS_INIT,
-  CS_ROUTING,
-  CS_SOFT_EXECUTE,
-  CS_EXECUTE,
-  CS_EXCHANGE_MEDIA,
-  CS_PARK,
-  CS_CONSUME_MEDIA,
-  CS_HIBERNATE,
-  CS_RESET,
-  CS_HANGUP,
-  CS_REPORTING,
-  CS_DESTROY,
-  CS_NONE
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_channel_timetable : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_channel_timetable(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_channel_timetable obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_channel_timetable() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_channel_timetable(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_switch_time_t profile_created {
-    set {
-      freeswitchPINVOKE.switch_channel_timetable_profile_created_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_channel_timetable_profile_created_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_time_t created {
-    set {
-      freeswitchPINVOKE.switch_channel_timetable_created_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_channel_timetable_created_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_time_t answered {
-    set {
-      freeswitchPINVOKE.switch_channel_timetable_answered_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_channel_timetable_answered_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_time_t progress {
-    set {
-      freeswitchPINVOKE.switch_channel_timetable_progress_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_channel_timetable_progress_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_time_t progress_media {
-    set {
-      freeswitchPINVOKE.switch_channel_timetable_progress_media_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_channel_timetable_progress_media_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_time_t hungup {
-    set {
-      freeswitchPINVOKE.switch_channel_timetable_hungup_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_channel_timetable_hungup_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_time_t transferred {
-    set {
-      freeswitchPINVOKE.switch_channel_timetable_transferred_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_channel_timetable_transferred_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public switch_channel_timetable next {
-    set {
-      freeswitchPINVOKE.switch_channel_timetable_next_set(swigCPtr, switch_channel_timetable.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_channel_timetable_next_get(swigCPtr);
-      switch_channel_timetable ret = (cPtr == IntPtr.Zero) ? null : new switch_channel_timetable(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_channel_timetable() : this(freeswitchPINVOKE.new_switch_channel_timetable(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_chat_interface : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_chat_interface(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_chat_interface obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_chat_interface() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_chat_interface(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string interface_name {
-    set {
-      freeswitchPINVOKE.switch_chat_interface_interface_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_chat_interface_interface_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__switch_status_t chat_send {
-    set {
-      freeswitchPINVOKE.switch_chat_interface_chat_send_set(swigCPtr, SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_chat_interface_chat_send_get(swigCPtr);
-      SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
-    set {
-      freeswitchPINVOKE.switch_chat_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_chat_interface_rwlock_get(swigCPtr);
-      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public int refs {
-    set {
-      freeswitchPINVOKE.switch_chat_interface_refs_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_chat_interface_refs_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_mutex_t reflock {
-    set {
-      freeswitchPINVOKE.switch_chat_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_chat_interface_reflock_get(swigCPtr);
-      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_loadable_module_interface parent {
-    set {
-      freeswitchPINVOKE.switch_chat_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_chat_interface_parent_get(swigCPtr);
-      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_chat_interface next {
-    set {
-      freeswitchPINVOKE.switch_chat_interface_next_set(swigCPtr, switch_chat_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_chat_interface_next_get(swigCPtr);
-      switch_chat_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_chat_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_chat_interface() : this(freeswitchPINVOKE.new_switch_chat_interface(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_codec : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_codec(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_codec obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_codec() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_codec(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public switch_codec_interface codec_interface {
-    set {
-      freeswitchPINVOKE.switch_codec_codec_interface_set(swigCPtr, switch_codec_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_codec_codec_interface_get(swigCPtr);
-      switch_codec_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_codec_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_codec_implementation implementation {
-    set {
-      freeswitchPINVOKE.switch_codec_implementation_set(swigCPtr, switch_codec_implementation.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_codec_implementation_get(swigCPtr);
-      switch_codec_implementation ret = (cPtr == IntPtr.Zero) ? null : new switch_codec_implementation(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public string fmtp_in {
-    set {
-      freeswitchPINVOKE.switch_codec_fmtp_in_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_codec_fmtp_in_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string fmtp_out {
-    set {
-      freeswitchPINVOKE.switch_codec_fmtp_out_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_codec_fmtp_out_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_codec_settings codec_settings {
-    set {
-      freeswitchPINVOKE.switch_codec_codec_settings_set(swigCPtr, switch_codec_settings.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_codec_codec_settings_get(swigCPtr);
-      switch_codec_settings ret = (cPtr == IntPtr.Zero) ? null : new switch_codec_settings(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public uint flags {
-    set {
-      freeswitchPINVOKE.switch_codec_flags_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_codec_flags_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_apr_pool_t memory_pool {
-    set {
-      freeswitchPINVOKE.switch_codec_memory_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_codec_memory_pool_get(swigCPtr);
-      SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_void private_info {
-    set {
-      freeswitchPINVOKE.switch_codec_private_info_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_codec_private_info_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public byte agreed_pt {
-    set {
-      freeswitchPINVOKE.switch_codec_agreed_pt_set(swigCPtr, value);
-    } 
-    get {
-      byte ret = freeswitchPINVOKE.switch_codec_agreed_pt_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_mutex_t mutex {
-    set {
-      freeswitchPINVOKE.switch_codec_mutex_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_codec_mutex_get(swigCPtr);
-      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_codec() : this(freeswitchPINVOKE.new_switch_codec(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_codec_flag_enum_t {
-  SWITCH_CODEC_FLAG_ENCODE = (1 << 0),
-  SWITCH_CODEC_FLAG_DECODE = (1 << 1),
-  SWITCH_CODEC_FLAG_SILENCE_START = (1 << 2),
-  SWITCH_CODEC_FLAG_SILENCE_STOP = (1 << 3),
-  SWITCH_CODEC_FLAG_SILENCE = (1 << 4),
-  SWITCH_CODEC_FLAG_FREE_POOL = (1 << 5),
-  SWITCH_CODEC_FLAG_AAL2 = (1 << 6),
-  SWITCH_CODEC_FLAG_PASSTHROUGH = (1 << 7),
-  SWITCH_CODEC_FLAG_READY = (1 << 8)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_codec_implementation : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_codec_implementation(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_codec_implementation obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_codec_implementation() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_codec_implementation(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public switch_codec_type_t codec_type {
-    set {
-      freeswitchPINVOKE.switch_codec_implementation_codec_type_set(swigCPtr, (int)value);
-    } 
-    get {
-      switch_codec_type_t ret = (switch_codec_type_t)freeswitchPINVOKE.switch_codec_implementation_codec_type_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public byte ianacode {
-    set {
-      freeswitchPINVOKE.switch_codec_implementation_ianacode_set(swigCPtr, value);
-    } 
-    get {
-      byte ret = freeswitchPINVOKE.switch_codec_implementation_ianacode_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string iananame {
-    set {
-      freeswitchPINVOKE.switch_codec_implementation_iananame_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_codec_implementation_iananame_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string fmtp {
-    set {
-      freeswitchPINVOKE.switch_codec_implementation_fmtp_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_codec_implementation_fmtp_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint samples_per_second {
-    set {
-      freeswitchPINVOKE.switch_codec_implementation_samples_per_second_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_codec_implementation_samples_per_second_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint actual_samples_per_second {
-    set {
-      freeswitchPINVOKE.switch_codec_implementation_actual_samples_per_second_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_codec_implementation_actual_samples_per_second_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int bits_per_second {
-    set {
-      freeswitchPINVOKE.switch_codec_implementation_bits_per_second_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_codec_implementation_bits_per_second_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int microseconds_per_packet {
-    set {
-      freeswitchPINVOKE.switch_codec_implementation_microseconds_per_packet_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_codec_implementation_microseconds_per_packet_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint samples_per_packet {
-    set {
-      freeswitchPINVOKE.switch_codec_implementation_samples_per_packet_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_codec_implementation_samples_per_packet_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint decoded_bytes_per_packet {
-    set {
-      freeswitchPINVOKE.switch_codec_implementation_decoded_bytes_per_packet_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_codec_implementation_decoded_bytes_per_packet_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint encoded_bytes_per_packet {
-    set {
-      freeswitchPINVOKE.switch_codec_implementation_encoded_bytes_per_packet_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_codec_implementation_encoded_bytes_per_packet_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public byte number_of_channels {
-    set {
-      freeswitchPINVOKE.switch_codec_implementation_number_of_channels_set(swigCPtr, value);
-    } 
-    get {
-      byte ret = freeswitchPINVOKE.switch_codec_implementation_number_of_channels_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int codec_frames_per_packet {
-    set {
-      freeswitchPINVOKE.switch_codec_implementation_codec_frames_per_packet_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_codec_implementation_codec_frames_per_packet_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t init {
-    set {
-      freeswitchPINVOKE.switch_codec_implementation_init_set(swigCPtr, SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_codec_implementation_init_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t encode {
-    set {
-      freeswitchPINVOKE.switch_codec_implementation_encode_set(swigCPtr, SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_codec_implementation_encode_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t decode {
-    set {
-      freeswitchPINVOKE.switch_codec_implementation_decode_set(swigCPtr, SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_codec_implementation_decode_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_codec__switch_status_t destroy {
-    set {
-      freeswitchPINVOKE.switch_codec_implementation_destroy_set(swigCPtr, SWIGTYPE_p_f_p_switch_codec__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_codec_implementation_destroy_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_codec__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_codec__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public uint codec_id {
-    set {
-      freeswitchPINVOKE.switch_codec_implementation_codec_id_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_codec_implementation_codec_id_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint impl_id {
-    set {
-      freeswitchPINVOKE.switch_codec_implementation_impl_id_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_codec_implementation_impl_id_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_codec_implementation next {
-    set {
-      freeswitchPINVOKE.switch_codec_implementation_next_set(swigCPtr, switch_codec_implementation.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_codec_implementation_next_get(swigCPtr);
-      switch_codec_implementation ret = (cPtr == IntPtr.Zero) ? null : new switch_codec_implementation(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_codec_implementation() : this(freeswitchPINVOKE.new_switch_codec_implementation(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_codec_interface : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_codec_interface(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_codec_interface obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_codec_interface() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_codec_interface(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string interface_name {
-    set {
-      freeswitchPINVOKE.switch_codec_interface_interface_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_codec_interface_interface_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_codec_implementation implementations {
-    set {
-      freeswitchPINVOKE.switch_codec_interface_implementations_set(swigCPtr, switch_codec_implementation.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_codec_interface_implementations_get(swigCPtr);
-      switch_codec_implementation ret = (cPtr == IntPtr.Zero) ? null : new switch_codec_implementation(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public uint codec_id {
-    set {
-      freeswitchPINVOKE.switch_codec_interface_codec_id_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_codec_interface_codec_id_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
-    set {
-      freeswitchPINVOKE.switch_codec_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_codec_interface_rwlock_get(swigCPtr);
-      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public int refs {
-    set {
-      freeswitchPINVOKE.switch_codec_interface_refs_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_codec_interface_refs_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_mutex_t reflock {
-    set {
-      freeswitchPINVOKE.switch_codec_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_codec_interface_reflock_get(swigCPtr);
-      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_loadable_module_interface parent {
-    set {
-      freeswitchPINVOKE.switch_codec_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_codec_interface_parent_get(swigCPtr);
-      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_codec_interface next {
-    set {
-      freeswitchPINVOKE.switch_codec_interface_next_set(swigCPtr, switch_codec_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_codec_interface_next_get(swigCPtr);
-      switch_codec_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_codec_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_codec_interface() : this(freeswitchPINVOKE.new_switch_codec_interface(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_codec_settings : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_codec_settings(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_codec_settings obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_codec_settings() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_codec_settings(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public int quality {
-    set {
-      freeswitchPINVOKE.switch_codec_settings_quality_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_codec_settings_quality_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int complexity {
-    set {
-      freeswitchPINVOKE.switch_codec_settings_complexity_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_codec_settings_complexity_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int enhancement {
-    set {
-      freeswitchPINVOKE.switch_codec_settings_enhancement_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_codec_settings_enhancement_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int vad {
-    set {
-      freeswitchPINVOKE.switch_codec_settings_vad_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_codec_settings_vad_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int vbr {
-    set {
-      freeswitchPINVOKE.switch_codec_settings_vbr_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_codec_settings_vbr_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public float vbr_quality {
-    set {
-      freeswitchPINVOKE.switch_codec_settings_vbr_quality_set(swigCPtr, value);
-    } 
-    get {
-      float ret = freeswitchPINVOKE.switch_codec_settings_vbr_quality_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int abr {
-    set {
-      freeswitchPINVOKE.switch_codec_settings_abr_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_codec_settings_abr_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int dtx {
-    set {
-      freeswitchPINVOKE.switch_codec_settings_dtx_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_codec_settings_dtx_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int preproc {
-    set {
-      freeswitchPINVOKE.switch_codec_settings_preproc_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_codec_settings_preproc_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int pp_vad {
-    set {
-      freeswitchPINVOKE.switch_codec_settings_pp_vad_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_codec_settings_pp_vad_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int pp_agc {
-    set {
-      freeswitchPINVOKE.switch_codec_settings_pp_agc_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_codec_settings_pp_agc_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public float pp_agc_level {
-    set {
-      freeswitchPINVOKE.switch_codec_settings_pp_agc_level_set(swigCPtr, value);
-    } 
-    get {
-      float ret = freeswitchPINVOKE.switch_codec_settings_pp_agc_level_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int pp_denoise {
-    set {
-      freeswitchPINVOKE.switch_codec_settings_pp_denoise_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_codec_settings_pp_denoise_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int pp_dereverb {
-    set {
-      freeswitchPINVOKE.switch_codec_settings_pp_dereverb_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_codec_settings_pp_dereverb_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public float pp_dereverb_decay {
-    set {
-      freeswitchPINVOKE.switch_codec_settings_pp_dereverb_decay_set(swigCPtr, value);
-    } 
-    get {
-      float ret = freeswitchPINVOKE.switch_codec_settings_pp_dereverb_decay_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public float pp_dereverb_level {
-    set {
-      freeswitchPINVOKE.switch_codec_settings_pp_dereverb_level_set(swigCPtr, value);
-    } 
-    get {
-      float ret = freeswitchPINVOKE.switch_codec_settings_pp_dereverb_level_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_codec_settings() : this(freeswitchPINVOKE.new_switch_codec_settings(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_codec_type_t {
-  SWITCH_CODEC_TYPE_AUDIO,
-  SWITCH_CODEC_TYPE_VIDEO,
-  SWITCH_CODEC_TYPE_T38,
-  SWITCH_CODEC_TYPE_APP
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_config : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_config(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_config obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_config() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_config(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_FILE file {
-    set {
-      freeswitchPINVOKE.switch_config_file_set(swigCPtr, SWIGTYPE_p_FILE.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_config_file_get(swigCPtr);
-      SWIGTYPE_p_FILE ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_FILE(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public string path {
-    set {
-      freeswitchPINVOKE.switch_config_path_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_config_path_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string category {
-    set {
-      freeswitchPINVOKE.switch_config_category_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_config_category_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string section {
-    set {
-      freeswitchPINVOKE.switch_config_section_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_config_section_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string buf {
-    set {
-      freeswitchPINVOKE.switch_config_buf_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_config_buf_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int lineno {
-    set {
-      freeswitchPINVOKE.switch_config_lineno_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_config_lineno_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int catno {
-    set {
-      freeswitchPINVOKE.switch_config_catno_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_config_catno_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int sectno {
-    set {
-      freeswitchPINVOKE.switch_config_sectno_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_config_sectno_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int lockto {
-    set {
-      freeswitchPINVOKE.switch_config_lockto_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_config_lockto_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_config() : this(freeswitchPINVOKE.new_switch_config(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_core_flag_enum_t {
-  SCF_NONE = 0,
-  SCF_USE_SQL = (1 << 0),
-  SCF_NO_NEW_SESSIONS = (1 << 1),
-  SCF_SHUTTING_DOWN = (1 << 2),
-  SCF_VG = (1 << 3),
-  SCF_RESTART = (1 << 4),
-  SCF_SHUTDOWN_REQUESTED = (1 << 5),
-  SCF_USE_AUTO_NAT = (1 << 6)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_core_session_message : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_core_session_message(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_core_session_message obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_core_session_message() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_core_session_message(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string from {
-    set {
-      freeswitchPINVOKE.switch_core_session_message_from_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_core_session_message_from_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_core_session_message_types_t message_id {
-    set {
-      freeswitchPINVOKE.switch_core_session_message_message_id_set(swigCPtr, (int)value);
-    } 
-    get {
-      switch_core_session_message_types_t ret = (switch_core_session_message_types_t)freeswitchPINVOKE.switch_core_session_message_message_id_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int numeric_arg {
-    set {
-      freeswitchPINVOKE.switch_core_session_message_numeric_arg_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_core_session_message_numeric_arg_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string string_arg {
-    set {
-      freeswitchPINVOKE.switch_core_session_message_string_arg_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_core_session_message_string_arg_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t string_arg_size {
-    set {
-      freeswitchPINVOKE.switch_core_session_message_string_arg_size_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_core_session_message_string_arg_size_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_void pointer_arg {
-    set {
-      freeswitchPINVOKE.switch_core_session_message_pointer_arg_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_core_session_message_pointer_arg_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t pointer_arg_size {
-    set {
-      freeswitchPINVOKE.switch_core_session_message_pointer_arg_size_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_core_session_message_pointer_arg_size_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public int numeric_reply {
-    set {
-      freeswitchPINVOKE.switch_core_session_message_numeric_reply_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_core_session_message_numeric_reply_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string string_reply {
-    set {
-      freeswitchPINVOKE.switch_core_session_message_string_reply_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_core_session_message_string_reply_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t string_reply_size {
-    set {
-      freeswitchPINVOKE.switch_core_session_message_string_reply_size_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_core_session_message_string_reply_size_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_void pointer_reply {
-    set {
-      freeswitchPINVOKE.switch_core_session_message_pointer_reply_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_core_session_message_pointer_reply_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t pointer_reply_size {
-    set {
-      freeswitchPINVOKE.switch_core_session_message_pointer_reply_size_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_core_session_message_pointer_reply_size_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public uint flags {
-    set {
-      freeswitchPINVOKE.switch_core_session_message_flags_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_core_session_message_flags_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string _file {
-    set {
-      freeswitchPINVOKE.switch_core_session_message__file_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_core_session_message__file_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string _func {
-    set {
-      freeswitchPINVOKE.switch_core_session_message__func_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_core_session_message__func_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int _line {
-    set {
-      freeswitchPINVOKE.switch_core_session_message__line_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_core_session_message__line_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_p_char string_array_arg {
-    set {
-      freeswitchPINVOKE.switch_core_session_message_string_array_arg_set(swigCPtr, SWIGTYPE_p_p_char.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_core_session_message_string_array_arg_get(swigCPtr);
-      SWIGTYPE_p_p_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_p_char(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_time_t delivery_time {
-    set {
-      freeswitchPINVOKE.switch_core_session_message_delivery_time_set(swigCPtr, SWIGTYPE_p_time_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_time_t ret = new SWIGTYPE_p_time_t(freeswitchPINVOKE.switch_core_session_message_delivery_time_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public switch_core_session_message() : this(freeswitchPINVOKE.new_switch_core_session_message(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_core_session_message_flag_enum_t {
-  SCSMF_DYNAMIC = (1 << 0),
-  SCSMF_FREE_STRING_REPLY = (1 << 1),
-  SCSMF_FREE_POINTER_REPLY = (1 << 2)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_core_session_message_types_t {
-  SWITCH_MESSAGE_REDIRECT_AUDIO,
-  SWITCH_MESSAGE_TRANSMIT_TEXT,
-  SWITCH_MESSAGE_INDICATE_ANSWER,
-  SWITCH_MESSAGE_INDICATE_PROGRESS,
-  SWITCH_MESSAGE_INDICATE_BRIDGE,
-  SWITCH_MESSAGE_INDICATE_UNBRIDGE,
-  SWITCH_MESSAGE_INDICATE_TRANSFER,
-  SWITCH_MESSAGE_INDICATE_RINGING,
-  SWITCH_MESSAGE_INDICATE_MEDIA,
-  SWITCH_MESSAGE_INDICATE_NOMEDIA,
-  SWITCH_MESSAGE_INDICATE_HOLD,
-  SWITCH_MESSAGE_INDICATE_UNHOLD,
-  SWITCH_MESSAGE_INDICATE_REDIRECT,
-  SWITCH_MESSAGE_INDICATE_RESPOND,
-  SWITCH_MESSAGE_INDICATE_BROADCAST,
-  SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT,
-  SWITCH_MESSAGE_INDICATE_DEFLECT,
-  SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ,
-  SWITCH_MESSAGE_INDICATE_DISPLAY,
-  SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY,
-  SWITCH_MESSAGE_INDICATE_AUDIO_SYNC,
-  SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA,
-  SWITCH_MESSAGE_INDICATE_UUID_CHANGE,
-  SWITCH_MESSAGE_INDICATE_WARNING,
-  SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO,
-  SWITCH_MESSAGE_INVALID
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_core_thread_session : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_core_thread_session(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_core_thread_session obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_core_thread_session() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_core_thread_session(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public int running {
-    set {
-      freeswitchPINVOKE.switch_core_thread_session_running_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_core_thread_session_running_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_mutex_t mutex {
-    set {
-      freeswitchPINVOKE.switch_core_thread_session_mutex_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_core_thread_session_mutex_get(swigCPtr);
-      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_p_void objs {
-    set {
-      freeswitchPINVOKE.switch_core_thread_session_objs_set(swigCPtr, SWIGTYPE_p_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_core_thread_session_objs_get(swigCPtr);
-      SWIGTYPE_p_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t input_callback {
-    set {
-      freeswitchPINVOKE.switch_core_thread_session_input_callback_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_core_thread_session_input_callback_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_apr_pool_t pool {
-    set {
-      freeswitchPINVOKE.switch_core_thread_session_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_core_thread_session_pool_get(swigCPtr);
-      SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_core_thread_session() : this(freeswitchPINVOKE.new_switch_core_thread_session(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_core_time_duration : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_core_time_duration(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_core_time_duration obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_core_time_duration() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_core_time_duration(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public uint mms {
-    set {
-      freeswitchPINVOKE.switch_core_time_duration_mms_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_core_time_duration_mms_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint ms {
-    set {
-      freeswitchPINVOKE.switch_core_time_duration_ms_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_core_time_duration_ms_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint sec {
-    set {
-      freeswitchPINVOKE.switch_core_time_duration_sec_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_core_time_duration_sec_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint min {
-    set {
-      freeswitchPINVOKE.switch_core_time_duration_min_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_core_time_duration_min_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint hr {
-    set {
-      freeswitchPINVOKE.switch_core_time_duration_hr_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_core_time_duration_hr_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint day {
-    set {
-      freeswitchPINVOKE.switch_core_time_duration_day_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_core_time_duration_day_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint yr {
-    set {
-      freeswitchPINVOKE.switch_core_time_duration_yr_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_core_time_duration_yr_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_core_time_duration() : this(freeswitchPINVOKE.new_switch_core_time_duration(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_dialplan_interface : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_dialplan_interface(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_dialplan_interface obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_dialplan_interface() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_dialplan_interface(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string interface_name {
-    set {
-      freeswitchPINVOKE.switch_dialplan_interface_interface_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_dialplan_interface_interface_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension hunt_function {
-    set {
-      freeswitchPINVOKE.switch_dialplan_interface_hunt_function_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_dialplan_interface_hunt_function_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
-    set {
-      freeswitchPINVOKE.switch_dialplan_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_dialplan_interface_rwlock_get(swigCPtr);
-      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public int refs {
-    set {
-      freeswitchPINVOKE.switch_dialplan_interface_refs_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_dialplan_interface_refs_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_mutex_t reflock {
-    set {
-      freeswitchPINVOKE.switch_dialplan_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_dialplan_interface_reflock_get(swigCPtr);
-      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_loadable_module_interface parent {
-    set {
-      freeswitchPINVOKE.switch_dialplan_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_dialplan_interface_parent_get(swigCPtr);
-      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_dialplan_interface next {
-    set {
-      freeswitchPINVOKE.switch_dialplan_interface_next_set(swigCPtr, switch_dialplan_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_dialplan_interface_next_get(swigCPtr);
-      switch_dialplan_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_dialplan_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_dialplan_interface() : this(freeswitchPINVOKE.new_switch_dialplan_interface(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_directories : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_directories(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_directories obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_directories() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_directories(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string base_dir {
-    set {
-      freeswitchPINVOKE.switch_directories_base_dir_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_directories_base_dir_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string mod_dir {
-    set {
-      freeswitchPINVOKE.switch_directories_mod_dir_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_directories_mod_dir_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string conf_dir {
-    set {
-      freeswitchPINVOKE.switch_directories_conf_dir_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_directories_conf_dir_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string log_dir {
-    set {
-      freeswitchPINVOKE.switch_directories_log_dir_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_directories_log_dir_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string run_dir {
-    set {
-      freeswitchPINVOKE.switch_directories_run_dir_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_directories_run_dir_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string db_dir {
-    set {
-      freeswitchPINVOKE.switch_directories_db_dir_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_directories_db_dir_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string script_dir {
-    set {
-      freeswitchPINVOKE.switch_directories_script_dir_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_directories_script_dir_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string temp_dir {
-    set {
-      freeswitchPINVOKE.switch_directories_temp_dir_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_directories_temp_dir_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string htdocs_dir {
-    set {
-      freeswitchPINVOKE.switch_directories_htdocs_dir_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_directories_htdocs_dir_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string grammar_dir {
-    set {
-      freeswitchPINVOKE.switch_directories_grammar_dir_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_directories_grammar_dir_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string storage_dir {
-    set {
-      freeswitchPINVOKE.switch_directories_storage_dir_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_directories_storage_dir_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_directories() : this(freeswitchPINVOKE.new_switch_directories(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_directory_flag_enum_t {
-  SWITCH_DIRECTORY_FLAG_FREE_POOL = (1 << 0)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_directory_handle : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_directory_handle(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_directory_handle obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_directory_handle() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_directory_handle(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public switch_directory_interface directory_interface {
-    set {
-      freeswitchPINVOKE.switch_directory_handle_directory_interface_set(swigCPtr, switch_directory_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_directory_handle_directory_interface_get(swigCPtr);
-      switch_directory_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_directory_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public uint flags {
-    set {
-      freeswitchPINVOKE.switch_directory_handle_flags_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_directory_handle_flags_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_apr_pool_t memory_pool {
-    set {
-      freeswitchPINVOKE.switch_directory_handle_memory_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_directory_handle_memory_pool_get(swigCPtr);
-      SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_void private_info {
-    set {
-      freeswitchPINVOKE.switch_directory_handle_private_info_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_directory_handle_private_info_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_directory_handle() : this(freeswitchPINVOKE.new_switch_directory_handle(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_directory_interface : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_directory_interface(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_directory_interface obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_directory_interface() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_directory_interface(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string interface_name {
-    set {
-      freeswitchPINVOKE.switch_directory_interface_interface_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_directory_interface_interface_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t directory_open {
-    set {
-      freeswitchPINVOKE.switch_directory_interface_directory_open_set(swigCPtr, SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_directory_interface_directory_open_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t directory_close {
-    set {
-      freeswitchPINVOKE.switch_directory_interface_directory_close_set(swigCPtr, SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_directory_interface_directory_close_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t directory_query {
-    set {
-      freeswitchPINVOKE.switch_directory_interface_directory_query_set(swigCPtr, SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_directory_interface_directory_query_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t directory_next {
-    set {
-      freeswitchPINVOKE.switch_directory_interface_directory_next_set(swigCPtr, SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_directory_interface_directory_next_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t directory_next_pair {
-    set {
-      freeswitchPINVOKE.switch_directory_interface_directory_next_pair_set(swigCPtr, SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_directory_interface_directory_next_pair_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
-    set {
-      freeswitchPINVOKE.switch_directory_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_directory_interface_rwlock_get(swigCPtr);
-      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public int refs {
-    set {
-      freeswitchPINVOKE.switch_directory_interface_refs_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_directory_interface_refs_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_mutex_t reflock {
-    set {
-      freeswitchPINVOKE.switch_directory_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_directory_interface_reflock_get(swigCPtr);
-      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_loadable_module_interface parent {
-    set {
-      freeswitchPINVOKE.switch_directory_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_directory_interface_parent_get(swigCPtr);
-      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_directory_interface next {
-    set {
-      freeswitchPINVOKE.switch_directory_interface_next_set(swigCPtr, switch_directory_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_directory_interface_next_get(swigCPtr);
-      switch_directory_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_directory_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_directory_interface() : this(freeswitchPINVOKE.new_switch_directory_interface(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_dtmf_direction_t {
-  SWITCH_DTMF_RECV = 0,
-  SWITCH_DTMF_SEND = 1
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_dtmf_t : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_dtmf_t(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_dtmf_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_dtmf_t() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_dtmf_t(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public char digit {
-    set {
-      freeswitchPINVOKE.switch_dtmf_t_digit_set(swigCPtr, value);
-    } 
-    get {
-      char ret = freeswitchPINVOKE.switch_dtmf_t_digit_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint duration {
-    set {
-      freeswitchPINVOKE.switch_dtmf_t_duration_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_dtmf_t_duration_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_dtmf_t() : this(freeswitchPINVOKE.new_switch_dtmf_t(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_eavesdrop_flag_enum_t {
-  ED_MUX_READ = (1 << 0),
-  ED_MUX_WRITE = (1 << 1),
-  ED_DTMF = (1 << 2)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_endpoint_interface : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_endpoint_interface(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_endpoint_interface obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_endpoint_interface() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_endpoint_interface(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string interface_name {
-    set {
-      freeswitchPINVOKE.switch_endpoint_interface_interface_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_endpoint_interface_interface_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_io_routines io_routines {
-    set {
-      freeswitchPINVOKE.switch_endpoint_interface_io_routines_set(swigCPtr, switch_io_routines.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_endpoint_interface_io_routines_get(swigCPtr);
-      switch_io_routines ret = (cPtr == IntPtr.Zero) ? null : new switch_io_routines(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_state_handler_table state_handler {
-    set {
-      freeswitchPINVOKE.switch_endpoint_interface_state_handler_set(swigCPtr, switch_state_handler_table.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_endpoint_interface_state_handler_get(swigCPtr);
-      switch_state_handler_table ret = (cPtr == IntPtr.Zero) ? null : new switch_state_handler_table(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_void private_info {
-    set {
-      freeswitchPINVOKE.switch_endpoint_interface_private_info_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_endpoint_interface_private_info_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
-    set {
-      freeswitchPINVOKE.switch_endpoint_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_endpoint_interface_rwlock_get(swigCPtr);
-      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public int refs {
-    set {
-      freeswitchPINVOKE.switch_endpoint_interface_refs_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_endpoint_interface_refs_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_mutex_t reflock {
-    set {
-      freeswitchPINVOKE.switch_endpoint_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_endpoint_interface_reflock_get(swigCPtr);
-      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_loadable_module_interface parent {
-    set {
-      freeswitchPINVOKE.switch_endpoint_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_endpoint_interface_parent_get(swigCPtr);
-      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_endpoint_interface next {
-    set {
-      freeswitchPINVOKE.switch_endpoint_interface_next_set(swigCPtr, switch_endpoint_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_endpoint_interface_next_get(swigCPtr);
-      switch_endpoint_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_endpoint_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_endpoint_interface() : this(freeswitchPINVOKE.new_switch_endpoint_interface(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_event : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_event(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_event obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_event() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_event(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public switch_event_types_t event_id {
-    set {
-      freeswitchPINVOKE.switch_event_event_id_set(swigCPtr, (int)value);
-    } 
-    get {
-      switch_event_types_t ret = (switch_event_types_t)freeswitchPINVOKE.switch_event_event_id_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_priority_t priority {
-    set {
-      freeswitchPINVOKE.switch_event_priority_set(swigCPtr, (int)value);
-    } 
-    get {
-      switch_priority_t ret = (switch_priority_t)freeswitchPINVOKE.switch_event_priority_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string owner {
-    set {
-      freeswitchPINVOKE.switch_event_owner_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_event_owner_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string subclass_name {
-    set {
-      freeswitchPINVOKE.switch_event_subclass_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_event_subclass_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_event_header headers {
-    set {
-      freeswitchPINVOKE.switch_event_headers_set(swigCPtr, switch_event_header.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_event_headers_get(swigCPtr);
-      switch_event_header ret = (cPtr == IntPtr.Zero) ? null : new switch_event_header(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_event_header last_header {
-    set {
-      freeswitchPINVOKE.switch_event_last_header_set(swigCPtr, switch_event_header.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_event_last_header_get(swigCPtr);
-      switch_event_header ret = (cPtr == IntPtr.Zero) ? null : new switch_event_header(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public string body {
-    set {
-      freeswitchPINVOKE.switch_event_body_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_event_body_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_void bind_user_data {
-    set {
-      freeswitchPINVOKE.switch_event_bind_user_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_event_bind_user_data_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_void event_user_data {
-    set {
-      freeswitchPINVOKE.switch_event_event_user_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_event_event_user_data_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public uint key {
-    set {
-      freeswitchPINVOKE.switch_event_key_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_event_key_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_event next {
-    set {
-      freeswitchPINVOKE.switch_event_next_set(swigCPtr, switch_event.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_event_next_get(swigCPtr);
-      switch_event ret = (cPtr == IntPtr.Zero) ? null : new switch_event(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public int flags {
-    set {
-      freeswitchPINVOKE.switch_event_flags_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_event_flags_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_event() : this(freeswitchPINVOKE.new_switch_event(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_event_flag_t {
-  EF_UNIQ_HEADERS = (1 << 0)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_event_header : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_event_header(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_event_header obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_event_header() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_event_header(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string name {
-    set {
-      freeswitchPINVOKE.switch_event_header_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_event_header_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string value {
-    set {
-      freeswitchPINVOKE.switch_event_header_value_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_event_header_value_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint hash {
-    set {
-      freeswitchPINVOKE.switch_event_header_hash_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_event_header_hash_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_event_header next {
-    set {
-      freeswitchPINVOKE.switch_event_header_next_set(swigCPtr, switch_event_header.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_event_header_next_get(swigCPtr);
-      switch_event_header ret = (cPtr == IntPtr.Zero) ? null : new switch_event_header(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_event_header() : this(freeswitchPINVOKE.new_switch_event_header(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_event_types_t {
-  SWITCH_EVENT_CUSTOM,
-  SWITCH_EVENT_CLONE,
-  SWITCH_EVENT_CHANNEL_CREATE,
-  SWITCH_EVENT_CHANNEL_DESTROY,
-  SWITCH_EVENT_CHANNEL_STATE,
-  SWITCH_EVENT_CHANNEL_ANSWER,
-  SWITCH_EVENT_CHANNEL_HANGUP,
-  SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE,
-  SWITCH_EVENT_CHANNEL_EXECUTE,
-  SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE,
-  SWITCH_EVENT_CHANNEL_BRIDGE,
-  SWITCH_EVENT_CHANNEL_UNBRIDGE,
-  SWITCH_EVENT_CHANNEL_PROGRESS,
-  SWITCH_EVENT_CHANNEL_PROGRESS_MEDIA,
-  SWITCH_EVENT_CHANNEL_OUTGOING,
-  SWITCH_EVENT_CHANNEL_PARK,
-  SWITCH_EVENT_CHANNEL_UNPARK,
-  SWITCH_EVENT_CHANNEL_APPLICATION,
-  SWITCH_EVENT_CHANNEL_ORIGINATE,
-  SWITCH_EVENT_CHANNEL_UUID,
-  SWITCH_EVENT_API,
-  SWITCH_EVENT_LOG,
-  SWITCH_EVENT_INBOUND_CHAN,
-  SWITCH_EVENT_OUTBOUND_CHAN,
-  SWITCH_EVENT_STARTUP,
-  SWITCH_EVENT_SHUTDOWN,
-  SWITCH_EVENT_PUBLISH,
-  SWITCH_EVENT_UNPUBLISH,
-  SWITCH_EVENT_TALK,
-  SWITCH_EVENT_NOTALK,
-  SWITCH_EVENT_SESSION_CRASH,
-  SWITCH_EVENT_MODULE_LOAD,
-  SWITCH_EVENT_MODULE_UNLOAD,
-  SWITCH_EVENT_DTMF,
-  SWITCH_EVENT_MESSAGE,
-  SWITCH_EVENT_PRESENCE_IN,
-  SWITCH_EVENT_NOTIFY_IN,
-  SWITCH_EVENT_PRESENCE_OUT,
-  SWITCH_EVENT_PRESENCE_PROBE,
-  SWITCH_EVENT_MESSAGE_WAITING,
-  SWITCH_EVENT_MESSAGE_QUERY,
-  SWITCH_EVENT_ROSTER,
-  SWITCH_EVENT_CODEC,
-  SWITCH_EVENT_BACKGROUND_JOB,
-  SWITCH_EVENT_DETECTED_SPEECH,
-  SWITCH_EVENT_DETECTED_TONE,
-  SWITCH_EVENT_PRIVATE_COMMAND,
-  SWITCH_EVENT_HEARTBEAT,
-  SWITCH_EVENT_TRAP,
-  SWITCH_EVENT_ADD_SCHEDULE,
-  SWITCH_EVENT_DEL_SCHEDULE,
-  SWITCH_EVENT_EXE_SCHEDULE,
-  SWITCH_EVENT_RE_SCHEDULE,
-  SWITCH_EVENT_RELOADXML,
-  SWITCH_EVENT_NOTIFY,
-  SWITCH_EVENT_SEND_MESSAGE,
-  SWITCH_EVENT_RECV_MESSAGE,
-  SWITCH_EVENT_REQUEST_PARAMS,
-  SWITCH_EVENT_CHANNEL_DATA,
-  SWITCH_EVENT_GENERAL,
-  SWITCH_EVENT_COMMAND,
-  SWITCH_EVENT_SESSION_HEARTBEAT,
-  SWITCH_EVENT_CLIENT_DISCONNECTED,
-  SWITCH_EVENT_SERVER_DISCONNECTED,
-  SWITCH_EVENT_SEND_INFO,
-  SWITCH_EVENT_RECV_INFO,
-  SWITCH_EVENT_CALL_SECURE,
-  SWITCH_EVENT_NAT,
-  SWITCH_EVENT_RECORD_START,
-  SWITCH_EVENT_RECORD_STOP,
-  SWITCH_EVENT_CALL_UPDATE,
-  SWITCH_EVENT_ALL
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_file_flag_enum_t {
-  SWITCH_FILE_FLAG_READ = (1 << 0),
-  SWITCH_FILE_FLAG_WRITE = (1 << 1),
-  SWITCH_FILE_FLAG_FREE_POOL = (1 << 2),
-  SWITCH_FILE_DATA_SHORT = (1 << 3),
-  SWITCH_FILE_DATA_INT = (1 << 4),
-  SWITCH_FILE_DATA_FLOAT = (1 << 5),
-  SWITCH_FILE_DATA_DOUBLE = (1 << 6),
-  SWITCH_FILE_DATA_RAW = (1 << 7),
-  SWITCH_FILE_PAUSE = (1 << 8),
-  SWITCH_FILE_NATIVE = (1 << 9),
-  SWITCH_FILE_SEEK = (1 << 10),
-  SWITCH_FILE_OPEN = (1 << 11),
-  SWITCH_FILE_CALLBACK = (1 << 12),
-  SWITCH_FILE_DONE = (1 << 13),
-  SWITCH_FILE_BUFFER_DONE = (1 << 14),
-  SWITCH_FILE_WRITE_APPEND = (1 << 15)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_file_handle : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_file_handle(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_file_handle obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_file_handle() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_file_handle(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public switch_file_interface file_interface {
-    set {
-      freeswitchPINVOKE.switch_file_handle_file_interface_set(swigCPtr, switch_file_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_file_interface_get(swigCPtr);
-      switch_file_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_file_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public uint flags {
-    set {
-      freeswitchPINVOKE.switch_file_handle_flags_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_file_handle_flags_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_file_t fd {
-    set {
-      freeswitchPINVOKE.switch_file_handle_fd_set(swigCPtr, SWIGTYPE_p_switch_file_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_fd_get(swigCPtr);
-      SWIGTYPE_p_switch_file_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_file_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public uint samples {
-    set {
-      freeswitchPINVOKE.switch_file_handle_samples_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_file_handle_samples_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint samplerate {
-    set {
-      freeswitchPINVOKE.switch_file_handle_samplerate_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_file_handle_samplerate_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint native_rate {
-    set {
-      freeswitchPINVOKE.switch_file_handle_native_rate_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_file_handle_native_rate_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public byte channels {
-    set {
-      freeswitchPINVOKE.switch_file_handle_channels_set(swigCPtr, value);
-    } 
-    get {
-      byte ret = freeswitchPINVOKE.switch_file_handle_channels_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint format {
-    set {
-      freeswitchPINVOKE.switch_file_handle_format_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_file_handle_format_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint sections {
-    set {
-      freeswitchPINVOKE.switch_file_handle_sections_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_file_handle_sections_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int seekable {
-    set {
-      freeswitchPINVOKE.switch_file_handle_seekable_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_file_handle_seekable_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t sample_count {
-    set {
-      freeswitchPINVOKE.switch_file_handle_sample_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_file_handle_sample_count_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public int speed {
-    set {
-      freeswitchPINVOKE.switch_file_handle_speed_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_file_handle_speed_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_apr_pool_t memory_pool {
-    set {
-      freeswitchPINVOKE.switch_file_handle_memory_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_memory_pool_get(swigCPtr);
-      SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public uint prebuf {
-    set {
-      freeswitchPINVOKE.switch_file_handle_prebuf_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_file_handle_prebuf_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint interval {
-    set {
-      freeswitchPINVOKE.switch_file_handle_interval_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_file_handle_interval_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_void private_info {
-    set {
-      freeswitchPINVOKE.switch_file_handle_private_info_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_private_info_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public string handler {
-    set {
-      freeswitchPINVOKE.switch_file_handle_handler_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_file_handle_handler_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public long pos {
-    set {
-      freeswitchPINVOKE.switch_file_handle_pos_set(swigCPtr, value);
-    } 
-    get {
-      long ret = freeswitchPINVOKE.switch_file_handle_pos_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_buffer audio_buffer {
-    set {
-      freeswitchPINVOKE.switch_file_handle_audio_buffer_set(swigCPtr, SWIGTYPE_p_switch_buffer.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_audio_buffer_get(swigCPtr);
-      SWIGTYPE_p_switch_buffer ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_buffer(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_buffer sp_audio_buffer {
-    set {
-      freeswitchPINVOKE.switch_file_handle_sp_audio_buffer_set(swigCPtr, SWIGTYPE_p_switch_buffer.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_sp_audio_buffer_get(swigCPtr);
-      SWIGTYPE_p_switch_buffer ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_buffer(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public uint thresh {
-    set {
-      freeswitchPINVOKE.switch_file_handle_thresh_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_file_handle_thresh_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint silence_hits {
-    set {
-      freeswitchPINVOKE.switch_file_handle_silence_hits_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_file_handle_silence_hits_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint offset_pos {
-    set {
-      freeswitchPINVOKE.switch_file_handle_offset_pos_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_file_handle_offset_pos_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t samples_in {
-    set {
-      freeswitchPINVOKE.switch_file_handle_samples_in_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_file_handle_samples_in_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t samples_out {
-    set {
-      freeswitchPINVOKE.switch_file_handle_samples_out_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_file_handle_samples_out_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public int vol {
-    set {
-      freeswitchPINVOKE.switch_file_handle_vol_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_file_handle_vol_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_audio_resampler_t resampler {
-    set {
-      freeswitchPINVOKE.switch_file_handle_resampler_set(swigCPtr, switch_audio_resampler_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_resampler_get(swigCPtr);
-      switch_audio_resampler_t ret = (cPtr == IntPtr.Zero) ? null : new switch_audio_resampler_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_buffer buffer {
-    set {
-      freeswitchPINVOKE.switch_file_handle_buffer_set(swigCPtr, SWIGTYPE_p_switch_buffer.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_buffer_get(swigCPtr);
-      SWIGTYPE_p_switch_buffer ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_buffer(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_unsigned_char dbuf {
-    set {
-      freeswitchPINVOKE.switch_file_handle_dbuf_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_dbuf_get(swigCPtr);
-      SWIGTYPE_p_unsigned_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t dbuflen {
-    set {
-      freeswitchPINVOKE.switch_file_handle_dbuflen_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_file_handle_dbuflen_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_buffer pre_buffer {
-    set {
-      freeswitchPINVOKE.switch_file_handle_pre_buffer_set(swigCPtr, SWIGTYPE_p_switch_buffer.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_pre_buffer_get(swigCPtr);
-      SWIGTYPE_p_switch_buffer ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_buffer(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_unsigned_char pre_buffer_data {
-    set {
-      freeswitchPINVOKE.switch_file_handle_pre_buffer_data_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_pre_buffer_data_get(swigCPtr);
-      SWIGTYPE_p_unsigned_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t pre_buffer_datalen {
-    set {
-      freeswitchPINVOKE.switch_file_handle_pre_buffer_datalen_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_file_handle_pre_buffer_datalen_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public string file {
-    set {
-      freeswitchPINVOKE.switch_file_handle_file_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_file_handle_file_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string func {
-    set {
-      freeswitchPINVOKE.switch_file_handle_func_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_file_handle_func_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int line {
-    set {
-      freeswitchPINVOKE.switch_file_handle_line_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_file_handle_line_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string file_path {
-    set {
-      freeswitchPINVOKE.switch_file_handle_file_path_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_file_handle_file_path_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string spool_path {
-    set {
-      freeswitchPINVOKE.switch_file_handle_spool_path_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_file_handle_spool_path_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_file_handle() : this(freeswitchPINVOKE.new_switch_file_handle(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_file_interface : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_file_interface(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_file_interface obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_file_interface() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_file_interface(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string interface_name {
-    set {
-      freeswitchPINVOKE.switch_file_interface_interface_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_file_interface_interface_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t file_open {
-    set {
-      freeswitchPINVOKE.switch_file_interface_file_open_set(swigCPtr, SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_file_open_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_file_handle__switch_status_t file_close {
-    set {
-      freeswitchPINVOKE.switch_file_interface_file_close_set(swigCPtr, SWIGTYPE_p_f_p_switch_file_handle__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_file_close_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_file_handle__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_file_handle__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t file_truncate {
-    set {
-      freeswitchPINVOKE.switch_file_interface_file_truncate_set(swigCPtr, SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_file_truncate_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t file_read {
-    set {
-      freeswitchPINVOKE.switch_file_interface_file_read_set(swigCPtr, SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_file_read_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t file_write {
-    set {
-      freeswitchPINVOKE.switch_file_interface_file_write_set(swigCPtr, SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_file_write_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t file_seek {
-    set {
-      freeswitchPINVOKE.switch_file_interface_file_seek_set(swigCPtr, SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_file_seek_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t file_set_string {
-    set {
-      freeswitchPINVOKE.switch_file_interface_file_set_string_set(swigCPtr, SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_file_set_string_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t file_get_string {
-    set {
-      freeswitchPINVOKE.switch_file_interface_file_get_string_set(swigCPtr, SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_file_get_string_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public string extens {
-  set { freeswitchPINVOKE.switch_file_interface_extens_set(swigCPtr, ref value); }
-
-  get {
-    return freeswitchPINVOKE.switch_file_interface_extens_get(swigCPtr);
-  }
-
-  }
-
-  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
-    set {
-      freeswitchPINVOKE.switch_file_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_rwlock_get(swigCPtr);
-      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public int refs {
-    set {
-      freeswitchPINVOKE.switch_file_interface_refs_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_file_interface_refs_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_mutex_t reflock {
-    set {
-      freeswitchPINVOKE.switch_file_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_reflock_get(swigCPtr);
-      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_loadable_module_interface parent {
-    set {
-      freeswitchPINVOKE.switch_file_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_parent_get(swigCPtr);
-      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_file_interface next {
-    set {
-      freeswitchPINVOKE.switch_file_interface_next_set(swigCPtr, switch_file_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_next_get(swigCPtr);
-      switch_file_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_file_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_file_interface() : this(freeswitchPINVOKE.new_switch_file_interface(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_frame : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_frame(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_frame obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_frame() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_frame(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public switch_codec codec {
-    set {
-      freeswitchPINVOKE.switch_frame_codec_set(swigCPtr, switch_codec.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_frame_codec_get(swigCPtr);
-      switch_codec ret = (cPtr == IntPtr.Zero) ? null : new switch_codec(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public string source {
-    set {
-      freeswitchPINVOKE.switch_frame_source_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_frame_source_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_void packet {
-    set {
-      freeswitchPINVOKE.switch_frame_packet_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_frame_packet_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public uint packetlen {
-    set {
-      freeswitchPINVOKE.switch_frame_packetlen_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_frame_packetlen_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_void extra_data {
-    set {
-      freeswitchPINVOKE.switch_frame_extra_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_frame_extra_data_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_void data {
-    set {
-      freeswitchPINVOKE.switch_frame_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_frame_data_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public uint datalen {
-    set {
-      freeswitchPINVOKE.switch_frame_datalen_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_frame_datalen_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint buflen {
-    set {
-      freeswitchPINVOKE.switch_frame_buflen_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_frame_buflen_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint samples {
-    set {
-      freeswitchPINVOKE.switch_frame_samples_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_frame_samples_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint rate {
-    set {
-      freeswitchPINVOKE.switch_frame_rate_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_frame_rate_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public byte payload {
-    set {
-      freeswitchPINVOKE.switch_frame_payload_set(swigCPtr, value);
-    } 
-    get {
-      byte ret = freeswitchPINVOKE.switch_frame_payload_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t timestamp {
-    set {
-      freeswitchPINVOKE.switch_frame_timestamp_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_frame_timestamp_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public ushort seq {
-    set {
-      freeswitchPINVOKE.switch_frame_seq_set(swigCPtr, value);
-    } 
-    get {
-      ushort ret = freeswitchPINVOKE.switch_frame_seq_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint ssrc {
-    set {
-      freeswitchPINVOKE.switch_frame_ssrc_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_frame_ssrc_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_bool_t m {
-    set {
-      freeswitchPINVOKE.switch_frame_m_set(swigCPtr, (int)value);
-    } 
-    get {
-      switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_frame_m_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint flags {
-    set {
-      freeswitchPINVOKE.switch_frame_flags_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_frame_flags_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_frame() : this(freeswitchPINVOKE.new_switch_frame(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_frame_flag_enum_t {
-  SFF_NONE = 0,
-  SFF_CNG = (1 << 0),
-  SFF_RAW_RTP = (1 << 1),
-  SFF_RTP_HEADER = (1 << 2),
-  SFF_PLC = (1 << 3),
-  SFF_RFC2833 = (1 << 4),
-  SFF_PROXY_PACKET = (1 << 5),
-  SFF_DYNAMIC = (1 << 6),
-  SFF_ZRTP = (1 << 7)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_input_args_t : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_input_args_t(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_input_args_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_input_args_t() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_input_args_t(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t input_callback {
-    set {
-      freeswitchPINVOKE.switch_input_args_t_input_callback_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_input_args_t_input_callback_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_void buf {
-    set {
-      freeswitchPINVOKE.switch_input_args_t_buf_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_input_args_t_buf_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public uint buflen {
-    set {
-      freeswitchPINVOKE.switch_input_args_t_buflen_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_input_args_t_buflen_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t read_frame_callback {
-    set {
-      freeswitchPINVOKE.switch_input_args_t_read_frame_callback_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_input_args_t_read_frame_callback_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_void user_data {
-    set {
-      freeswitchPINVOKE.switch_input_args_t_user_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_input_args_t_user_data_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_input_args_t() : this(freeswitchPINVOKE.new_switch_input_args_t(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_input_type_t {
-  SWITCH_INPUT_TYPE_DTMF,
-  SWITCH_INPUT_TYPE_EVENT
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_io_event_hooks : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_io_event_hooks(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_io_event_hooks obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_io_event_hooks() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_io_event_hooks(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public switch_io_event_hook_outgoing_channel outgoing_channel {
-    set {
-      freeswitchPINVOKE.switch_io_event_hooks_outgoing_channel_set(swigCPtr, switch_io_event_hook_outgoing_channel.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_outgoing_channel_get(swigCPtr);
-      switch_io_event_hook_outgoing_channel ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_outgoing_channel(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_receive_message receive_message {
-    set {
-      freeswitchPINVOKE.switch_io_event_hooks_receive_message_set(swigCPtr, switch_io_event_hook_receive_message.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_receive_message_get(swigCPtr);
-      switch_io_event_hook_receive_message ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_receive_message(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_receive_event receive_event {
-    set {
-      freeswitchPINVOKE.switch_io_event_hooks_receive_event_set(swigCPtr, switch_io_event_hook_receive_event.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_receive_event_get(swigCPtr);
-      switch_io_event_hook_receive_event ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_receive_event(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_read_frame read_frame {
-    set {
-      freeswitchPINVOKE.switch_io_event_hooks_read_frame_set(swigCPtr, switch_io_event_hook_read_frame.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_read_frame_get(swigCPtr);
-      switch_io_event_hook_read_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_read_frame(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_video_read_frame video_read_frame {
-    set {
-      freeswitchPINVOKE.switch_io_event_hooks_video_read_frame_set(swigCPtr, switch_io_event_hook_video_read_frame.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_video_read_frame_get(swigCPtr);
-      switch_io_event_hook_video_read_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_video_read_frame(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_write_frame write_frame {
-    set {
-      freeswitchPINVOKE.switch_io_event_hooks_write_frame_set(swigCPtr, switch_io_event_hook_write_frame.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_write_frame_get(swigCPtr);
-      switch_io_event_hook_write_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_write_frame(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_video_write_frame video_write_frame {
-    set {
-      freeswitchPINVOKE.switch_io_event_hooks_video_write_frame_set(swigCPtr, switch_io_event_hook_video_write_frame.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_video_write_frame_get(swigCPtr);
-      switch_io_event_hook_video_write_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_video_write_frame(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_kill_channel kill_channel {
-    set {
-      freeswitchPINVOKE.switch_io_event_hooks_kill_channel_set(swigCPtr, switch_io_event_hook_kill_channel.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_kill_channel_get(swigCPtr);
-      switch_io_event_hook_kill_channel ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_kill_channel(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_send_dtmf send_dtmf {
-    set {
-      freeswitchPINVOKE.switch_io_event_hooks_send_dtmf_set(swigCPtr, switch_io_event_hook_send_dtmf.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_send_dtmf_get(swigCPtr);
-      switch_io_event_hook_send_dtmf ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_send_dtmf(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_recv_dtmf recv_dtmf {
-    set {
-      freeswitchPINVOKE.switch_io_event_hooks_recv_dtmf_set(swigCPtr, switch_io_event_hook_recv_dtmf.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_recv_dtmf_get(swigCPtr);
-      switch_io_event_hook_recv_dtmf ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_recv_dtmf(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_state_change state_change {
-    set {
-      freeswitchPINVOKE.switch_io_event_hooks_state_change_set(swigCPtr, switch_io_event_hook_state_change.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_state_change_get(swigCPtr);
-      switch_io_event_hook_state_change ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_state_change(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_resurrect_session resurrect_session {
-    set {
-      freeswitchPINVOKE.switch_io_event_hooks_resurrect_session_set(swigCPtr, switch_io_event_hook_resurrect_session.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_resurrect_session_get(swigCPtr);
-      switch_io_event_hook_resurrect_session ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_resurrect_session(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hooks() : this(freeswitchPINVOKE.new_switch_io_event_hooks(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_io_event_hook_kill_channel : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_io_event_hook_kill_channel(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_io_event_hook_kill_channel obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_io_event_hook_kill_channel() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_io_event_hook_kill_channel(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t kill_channel {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_kill_channel_kill_channel_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_kill_channel_kill_channel_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_kill_channel next {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_kill_channel_next_set(swigCPtr, switch_io_event_hook_kill_channel.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_kill_channel_next_get(swigCPtr);
-      switch_io_event_hook_kill_channel ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_kill_channel(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_kill_channel() : this(freeswitchPINVOKE.new_switch_io_event_hook_kill_channel(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_io_event_hook_outgoing_channel : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_io_event_hook_outgoing_channel(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_io_event_hook_outgoing_channel obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_io_event_hook_outgoing_channel() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_io_event_hook_outgoing_channel(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t outgoing_channel {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_outgoing_channel_outgoing_channel_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_outgoing_channel_outgoing_channel_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_outgoing_channel next {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_outgoing_channel_next_set(swigCPtr, switch_io_event_hook_outgoing_channel.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_outgoing_channel_next_get(swigCPtr);
-      switch_io_event_hook_outgoing_channel ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_outgoing_channel(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_outgoing_channel() : this(freeswitchPINVOKE.new_switch_io_event_hook_outgoing_channel(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_io_event_hook_read_frame : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_io_event_hook_read_frame(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_io_event_hook_read_frame obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_io_event_hook_read_frame() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_io_event_hook_read_frame(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t read_frame {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_read_frame_read_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_read_frame_read_frame_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_read_frame next {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_read_frame_next_set(swigCPtr, switch_io_event_hook_read_frame.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_read_frame_next_get(swigCPtr);
-      switch_io_event_hook_read_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_read_frame(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_read_frame() : this(freeswitchPINVOKE.new_switch_io_event_hook_read_frame(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_io_event_hook_receive_event : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_io_event_hook_receive_event(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_io_event_hook_receive_event obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_io_event_hook_receive_event() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_io_event_hook_receive_event(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t receive_event {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_receive_event_receive_event_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_receive_event_receive_event_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_receive_event next {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_receive_event_next_set(swigCPtr, switch_io_event_hook_receive_event.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_receive_event_next_get(swigCPtr);
-      switch_io_event_hook_receive_event ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_receive_event(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_receive_event() : this(freeswitchPINVOKE.new_switch_io_event_hook_receive_event(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_io_event_hook_receive_message : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_io_event_hook_receive_message(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_io_event_hook_receive_message obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_io_event_hook_receive_message() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_io_event_hook_receive_message(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t receive_message {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_receive_message_receive_message_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_receive_message_receive_message_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_receive_message next {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_receive_message_next_set(swigCPtr, switch_io_event_hook_receive_message.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_receive_message_next_get(swigCPtr);
-      switch_io_event_hook_receive_message ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_receive_message(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_receive_message() : this(freeswitchPINVOKE.new_switch_io_event_hook_receive_message(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_io_event_hook_recv_dtmf : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_io_event_hook_recv_dtmf(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_io_event_hook_recv_dtmf obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_io_event_hook_recv_dtmf() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_io_event_hook_recv_dtmf(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t recv_dtmf {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_recv_dtmf_recv_dtmf_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_recv_dtmf_recv_dtmf_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_recv_dtmf next {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_recv_dtmf_next_set(swigCPtr, switch_io_event_hook_recv_dtmf.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_recv_dtmf_next_get(swigCPtr);
-      switch_io_event_hook_recv_dtmf ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_recv_dtmf(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_recv_dtmf() : this(freeswitchPINVOKE.new_switch_io_event_hook_recv_dtmf(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_io_event_hook_resurrect_session : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_io_event_hook_resurrect_session(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_io_event_hook_resurrect_session obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_io_event_hook_resurrect_session() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_io_event_hook_resurrect_session(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t resurrect_session {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_resurrect_session_resurrect_session_set(swigCPtr, SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_resurrect_session_resurrect_session_get(swigCPtr);
-      SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_resurrect_session next {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_resurrect_session_next_set(swigCPtr, switch_io_event_hook_resurrect_session.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_resurrect_session_next_get(swigCPtr);
-      switch_io_event_hook_resurrect_session ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_resurrect_session(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_resurrect_session() : this(freeswitchPINVOKE.new_switch_io_event_hook_resurrect_session(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_io_event_hook_send_dtmf : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_io_event_hook_send_dtmf(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_io_event_hook_send_dtmf obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_io_event_hook_send_dtmf() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_io_event_hook_send_dtmf(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t send_dtmf {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_send_dtmf_send_dtmf_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_send_dtmf_send_dtmf_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_send_dtmf next {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_send_dtmf_next_set(swigCPtr, switch_io_event_hook_send_dtmf.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_send_dtmf_next_get(swigCPtr);
-      switch_io_event_hook_send_dtmf ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_send_dtmf(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_send_dtmf() : this(freeswitchPINVOKE.new_switch_io_event_hook_send_dtmf(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_io_event_hook_state_change : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_io_event_hook_state_change(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_io_event_hook_state_change obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_io_event_hook_state_change() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_io_event_hook_state_change(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t state_change {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_state_change_state_change_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_state_change_state_change_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_state_change next {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_state_change_next_set(swigCPtr, switch_io_event_hook_state_change.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_state_change_next_get(swigCPtr);
-      switch_io_event_hook_state_change ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_state_change(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_state_change() : this(freeswitchPINVOKE.new_switch_io_event_hook_state_change(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_io_event_hook_video_read_frame : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_io_event_hook_video_read_frame(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_io_event_hook_video_read_frame obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_io_event_hook_video_read_frame() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_io_event_hook_video_read_frame(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t video_read_frame {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_video_read_frame_video_read_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_video_read_frame_video_read_frame_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_video_read_frame next {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_video_read_frame_next_set(swigCPtr, switch_io_event_hook_video_read_frame.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_video_read_frame_next_get(swigCPtr);
-      switch_io_event_hook_video_read_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_video_read_frame(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_video_read_frame() : this(freeswitchPINVOKE.new_switch_io_event_hook_video_read_frame(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_io_event_hook_video_write_frame : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_io_event_hook_video_write_frame(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_io_event_hook_video_write_frame obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_io_event_hook_video_write_frame() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_io_event_hook_video_write_frame(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t video_write_frame {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_video_write_frame_video_write_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_video_write_frame_video_write_frame_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_video_write_frame next {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_video_write_frame_next_set(swigCPtr, switch_io_event_hook_video_write_frame.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_video_write_frame_next_get(swigCPtr);
-      switch_io_event_hook_video_write_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_video_write_frame(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_video_write_frame() : this(freeswitchPINVOKE.new_switch_io_event_hook_video_write_frame(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_io_event_hook_write_frame : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_io_event_hook_write_frame(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_io_event_hook_write_frame obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_io_event_hook_write_frame() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_io_event_hook_write_frame(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t write_frame {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_write_frame_write_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_write_frame_write_frame_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_write_frame next {
-    set {
-      freeswitchPINVOKE.switch_io_event_hook_write_frame_next_set(swigCPtr, switch_io_event_hook_write_frame.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_write_frame_next_get(swigCPtr);
-      switch_io_event_hook_write_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_write_frame(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_event_hook_write_frame() : this(freeswitchPINVOKE.new_switch_io_event_hook_write_frame(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_io_flag_enum_t {
-  SWITCH_IO_FLAG_NONE = 0,
-  SWITCH_IO_FLAG_NOBLOCK = (1 << 0)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_io_routines : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_io_routines(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_io_routines obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_io_routines() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_io_routines(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t outgoing_channel {
-    set {
-      freeswitchPINVOKE.switch_io_routines_outgoing_channel_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_outgoing_channel_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t read_frame {
-    set {
-      freeswitchPINVOKE.switch_io_routines_read_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_read_frame_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t write_frame {
-    set {
-      freeswitchPINVOKE.switch_io_routines_write_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_write_frame_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t kill_channel {
-    set {
-      freeswitchPINVOKE.switch_io_routines_kill_channel_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_kill_channel_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t send_dtmf {
-    set {
-      freeswitchPINVOKE.switch_io_routines_send_dtmf_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_send_dtmf_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t receive_message {
-    set {
-      freeswitchPINVOKE.switch_io_routines_receive_message_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_receive_message_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t receive_event {
-    set {
-      freeswitchPINVOKE.switch_io_routines_receive_event_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_receive_event_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t state_change {
-    set {
-      freeswitchPINVOKE.switch_io_routines_state_change_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_state_change_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t read_video_frame {
-    set {
-      freeswitchPINVOKE.switch_io_routines_read_video_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_read_video_frame_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t write_video_frame {
-    set {
-      freeswitchPINVOKE.switch_io_routines_write_video_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_write_video_frame_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t resurrect_session {
-    set {
-      freeswitchPINVOKE.switch_io_routines_resurrect_session_set(swigCPtr, SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_resurrect_session_get(swigCPtr);
-      SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_p_void padding {
-    set {
-      freeswitchPINVOKE.switch_io_routines_padding_set(swigCPtr, SWIGTYPE_p_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_padding_get(swigCPtr);
-      SWIGTYPE_p_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_io_routines() : this(freeswitchPINVOKE.new_switch_io_routines(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_io_routine_name_t {
-  SWITCH_IO_OUTGOING_CHANNEL,
-  SWITCH_IO_READ_FRAME,
-  SWITCH_IO_WRITE_FRAME,
-  SWITCH_IO_KILL_CHANNEL,
-  SWITCH_IO_SEND_DTMF,
-  SWITCH_IO_RECEIVE_MESSAGE,
-  SWITCH_IO_RECEIVE_EVENT,
-  SWITCH_IO_STATE_CHANGE,
-  SWITCH_IO_READ_VIDEO_FRAME,
-  SWITCH_IO_WRITE_VIDEO_FRAME,
-  SWITCH_IO_RESURRECT_SESSION
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_ivr_action_t {
-  SWITCH_IVR_ACTION_DIE,
-  SWITCH_IVR_ACTION_EXECMENU,
-  SWITCH_IVR_ACTION_EXECAPP,
-  SWITCH_IVR_ACTION_PLAYSOUND,
-  SWITCH_IVR_ACTION_BACK,
-  SWITCH_IVR_ACTION_TOMAIN,
-  SWITCH_IVR_ACTION_NOOP
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_ivr_menu_flags {
-  SWITCH_IVR_MENU_FLAG_FALLTOMAIN = (1 << 0),
-  SWITCH_IVR_MENU_FLAG_FREEPOOL = (1 << 1),
-  SWITCH_IVR_MENU_FLAG_STACK = (1 << 2)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_ivr_option_enum_t {
-  SWITCH_IVR_OPTION_NONE = 0,
-  SWITCH_IVR_OPTION_ASYNC = (1 << 0),
-  SWITCH_IVR_OPTION_FILE = (1 << 1)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_loadable_module_function_table_t : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_loadable_module_function_table_t(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_loadable_module_function_table_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_loadable_module_function_table_t() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_loadable_module_function_table_t(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public int switch_api_version {
-    set {
-      freeswitchPINVOKE.switch_loadable_module_function_table_t_switch_api_version_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_loadable_module_function_table_t_switch_api_version_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t load {
-    set {
-      freeswitchPINVOKE.switch_loadable_module_function_table_t_load_set(swigCPtr, SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_function_table_t_load_get(swigCPtr);
-      SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_void__switch_status_t shutdown {
-    set {
-      freeswitchPINVOKE.switch_loadable_module_function_table_t_shutdown_set(swigCPtr, SWIGTYPE_p_f_void__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_function_table_t_shutdown_get(swigCPtr);
-      SWIGTYPE_p_f_void__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_void__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_void__switch_status_t runtime {
-    set {
-      freeswitchPINVOKE.switch_loadable_module_function_table_t_runtime_set(swigCPtr, SWIGTYPE_p_f_void__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_function_table_t_runtime_get(swigCPtr);
-      SWIGTYPE_p_f_void__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_void__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public uint flags {
-    set {
-      freeswitchPINVOKE.switch_loadable_module_function_table_t_flags_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_loadable_module_function_table_t_flags_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_loadable_module_function_table_t() : this(freeswitchPINVOKE.new_switch_loadable_module_function_table_t(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_log_level_t {
-  SWITCH_LOG_DEBUG10 = 110,
-  SWITCH_LOG_DEBUG9 = 109,
-  SWITCH_LOG_DEBUG8 = 108,
-  SWITCH_LOG_DEBUG7 = 107,
-  SWITCH_LOG_DEBUG6 = 106,
-  SWITCH_LOG_DEBUG5 = 105,
-  SWITCH_LOG_DEBUG4 = 104,
-  SWITCH_LOG_DEBUG3 = 103,
-  SWITCH_LOG_DEBUG2 = 102,
-  SWITCH_LOG_DEBUG1 = 101,
-  SWITCH_LOG_DEBUG = 7,
-  SWITCH_LOG_INFO = 6,
-  SWITCH_LOG_NOTICE = 5,
-  SWITCH_LOG_WARNING = 4,
-  SWITCH_LOG_ERROR = 3,
-  SWITCH_LOG_CRIT = 2,
-  SWITCH_LOG_ALERT = 1,
-  SWITCH_LOG_CONSOLE = 0,
-  SWITCH_LOG_INVALID = 64
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_log_node_t : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_log_node_t(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_log_node_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_log_node_t() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_log_node_t(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string data {
-    set {
-      freeswitchPINVOKE.switch_log_node_t_data_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_log_node_t_data_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string file {
-    set {
-      freeswitchPINVOKE.switch_log_node_t_file_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_log_node_t_file_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint line {
-    set {
-      freeswitchPINVOKE.switch_log_node_t_line_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_log_node_t_line_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string func {
-    set {
-      freeswitchPINVOKE.switch_log_node_t_func_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_log_node_t_func_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_log_level_t level {
-    set {
-      freeswitchPINVOKE.switch_log_node_t_level_set(swigCPtr, (int)value);
-    } 
-    get {
-      switch_log_level_t ret = (switch_log_level_t)freeswitchPINVOKE.switch_log_node_t_level_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_time_t timestamp {
-    set {
-      freeswitchPINVOKE.switch_log_node_t_timestamp_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_log_node_t_timestamp_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public string content {
-    set {
-      freeswitchPINVOKE.switch_log_node_t_content_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_log_node_t_content_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string userdata {
-    set {
-      freeswitchPINVOKE.switch_log_node_t_userdata_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_log_node_t_userdata_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_text_channel_t channel {
-    set {
-      freeswitchPINVOKE.switch_log_node_t_channel_set(swigCPtr, (int)value);
-    } 
-    get {
-      switch_text_channel_t ret = (switch_text_channel_t)freeswitchPINVOKE.switch_log_node_t_channel_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_log_node_t() : this(freeswitchPINVOKE.new_switch_log_node_t(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_management_action_t {
-  SMA_NONE,
-  SMA_GET,
-  SMA_SET
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_management_interface : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_management_interface(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_management_interface obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_management_interface() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_management_interface(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string relative_oid {
-    set {
-      freeswitchPINVOKE.switch_management_interface_relative_oid_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_management_interface_relative_oid_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t management_function {
-    set {
-      freeswitchPINVOKE.switch_management_interface_management_function_set(swigCPtr, SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_management_interface_management_function_get(swigCPtr);
-      SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
-    set {
-      freeswitchPINVOKE.switch_management_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_management_interface_rwlock_get(swigCPtr);
-      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public int refs {
-    set {
-      freeswitchPINVOKE.switch_management_interface_refs_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_management_interface_refs_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_mutex_t reflock {
-    set {
-      freeswitchPINVOKE.switch_management_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_management_interface_reflock_get(swigCPtr);
-      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_loadable_module_interface parent {
-    set {
-      freeswitchPINVOKE.switch_management_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_management_interface_parent_get(swigCPtr);
-      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_management_interface next {
-    set {
-      freeswitchPINVOKE.switch_management_interface_next_set(swigCPtr, switch_management_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_management_interface_next_get(swigCPtr);
-      switch_management_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_management_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_management_interface() : this(freeswitchPINVOKE.new_switch_management_interface(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_media_bug_flag_enum_t {
-  SMBF_BOTH = 0,
-  SMBF_READ_STREAM = (1 << 0),
-  SMBF_WRITE_STREAM = (1 << 1),
-  SMBF_WRITE_REPLACE = (1 << 2),
-  SMBF_READ_REPLACE = (1 << 3),
-  SMBF_READ_PING = (1 << 4),
-  SMBF_STEREO = (1 << 5),
-  SMBF_ANSWER_REQ = (1 << 6),
-  SMBF_THREAD_LOCK = (1 << 7),
-  SMBF_PRUNE = (1 << 8)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_media_flag_enum_t {
-  SMF_NONE = 0,
-  SMF_REBRIDGE = (1 << 0),
-  SMF_ECHO_ALEG = (1 << 1),
-  SMF_ECHO_BLEG = (1 << 2),
-  SMF_FORCE = (1 << 3),
-  SMF_LOOP = (1 << 4),
-  SMF_HOLD_BLEG = (1 << 5),
-  SMF_IMMEDIATE = (1 << 6),
-  SMF_EXEC_INLINE = (1 << 7)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_module_flag_enum_t {
-  SMODF_NONE = 0,
-  SMODF_GLOBAL_SYMBOLS = (1 << 0)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_module_interface_name_t {
-  SWITCH_ENDPOINT_INTERFACE,
-  SWITCH_TIMER_INTERFACE,
-  SWITCH_DIALPLAN_INTERFACE,
-  SWITCH_CODEC_INTERFACE,
-  SWITCH_APPLICATION_INTERFACE,
-  SWITCH_API_INTERFACE,
-  SWITCH_FILE_INTERFACE,
-  SWITCH_SPEECH_INTERFACE,
-  SWITCH_DIRECTORY_INTERFACE,
-  SWITCH_CHAT_INTERFACE,
-  SWITCH_SAY_INTERFACE,
-  SWITCH_ASR_INTERFACE,
-  SWITCH_MANAGEMENT_INTERFACE
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_originate_flag_enum_t {
-  SOF_NONE = 0,
-  SOF_NOBLOCK = (1 << 0),
-  SOF_FORKED_DIAL = (1 << 1),
-  SOF_NO_EFFECTIVE_CID_NUM = (1 << 2),
-  SOF_NO_EFFECTIVE_CID_NAME = (1 << 3)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_port_flag_enum_t {
-  SPF_NONE = 0,
-  SPF_ODD = (1 << 0),
-  SPF_EVEN = (1 << 1)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_priority_t {
-  SWITCH_PRIORITY_NORMAL,
-  SWITCH_PRIORITY_LOW,
-  SWITCH_PRIORITY_HIGH
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_rtp_bug_flag_t {
-  RTP_BUG_NONE = 0,
-  RTP_BUG_CISCO_SKIP_MARK_BIT_2833 = (1 << 0),
-  RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833 = (1 << 1)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_rtp_crypto_direction_t {
-  SWITCH_RTP_CRYPTO_SEND,
-  SWITCH_RTP_CRYPTO_RECV,
-  SWITCH_RTP_CRYPTO_MAX
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_rtp_crypto_key : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_rtp_crypto_key(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_rtp_crypto_key obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_rtp_crypto_key() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_rtp_crypto_key(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public uint index {
-    set {
-      freeswitchPINVOKE.switch_rtp_crypto_key_index_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_rtp_crypto_key_index_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_rtp_crypto_key_type_t type {
-    set {
-      freeswitchPINVOKE.switch_rtp_crypto_key_type_set(swigCPtr, (int)value);
-    } 
-    get {
-      switch_rtp_crypto_key_type_t ret = (switch_rtp_crypto_key_type_t)freeswitchPINVOKE.switch_rtp_crypto_key_type_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_unsigned_char key {
-    set {
-      freeswitchPINVOKE.switch_rtp_crypto_key_key_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_rtp_crypto_key_key_get(swigCPtr);
-      SWIGTYPE_p_unsigned_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t keylen {
-    set {
-      freeswitchPINVOKE.switch_rtp_crypto_key_keylen_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_crypto_key_keylen_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public switch_rtp_crypto_key next {
-    set {
-      freeswitchPINVOKE.switch_rtp_crypto_key_next_set(swigCPtr, switch_rtp_crypto_key.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_rtp_crypto_key_next_get(swigCPtr);
-      switch_rtp_crypto_key ret = (cPtr == IntPtr.Zero) ? null : new switch_rtp_crypto_key(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_rtp_crypto_key() : this(freeswitchPINVOKE.new_switch_rtp_crypto_key(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_rtp_crypto_key_type_t {
-  NO_CRYPTO,
-  AES_CM_128_HMAC_SHA1_80,
-  AES_CM_128_HMAC_SHA1_32,
-  AES_CM_128_NULL_AUTH
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_rtp_flag_enum_t {
-  SWITCH_RTP_FLAG_NOBLOCK = (1 << 0),
-  SWITCH_RTP_FLAG_IO = (1 << 1),
-  SWITCH_RTP_FLAG_USE_TIMER = (1 << 2),
-  SWITCH_RTP_FLAG_TIMER_RECLOCK = (1 << 3),
-  SWITCH_RTP_FLAG_SECURE_SEND = (1 << 4),
-  SWITCH_RTP_FLAG_SECURE_RECV = (1 << 5),
-  SWITCH_RTP_FLAG_AUTOADJ = (1 << 6),
-  SWITCH_RTP_FLAG_RAW_WRITE = (1 << 7),
-  SWITCH_RTP_FLAG_GOOGLEHACK = (1 << 8),
-  SWITCH_RTP_FLAG_VAD = (1 << 9),
-  SWITCH_RTP_FLAG_BREAK = (1 << 10),
-  SWITCH_RTP_FLAG_MINI = (1 << 11),
-  SWITCH_RTP_FLAG_DATAWAIT = (1 << 12),
-  SWITCH_RTP_FLAG_BUGGY_2833 = (1 << 13),
-  SWITCH_RTP_FLAG_PASS_RFC2833 = (1 << 14),
-  SWITCH_RTP_FLAG_AUTO_CNG = (1 << 15),
-  SWITCH_RTP_FLAG_SECURE_SEND_RESET = (1 << 16),
-  SWITCH_RTP_FLAG_SECURE_RECV_RESET = (1 << 17),
-  SWITCH_RTP_FLAG_PROXY_MEDIA = (1 << 18),
-  SWITCH_RTP_FLAG_SHUTDOWN = (1 << 19),
-  SWITCH_RTP_FLAG_FLUSH = (1 << 20),
-  SWITCH_RTP_FLAG_AUTOFLUSH = (1 << 21),
-  SWITCH_RTP_FLAG_STICKY_FLUSH = (1 << 22),
-  SWITCH_ZRTP_FLAG_SECURE_SEND = (1 << 23),
-  SWITCH_ZRTP_FLAG_SECURE_RECV = (1 << 24),
-  SWITCH_ZRTP_FLAG_SECURE_MITM_SEND = (1 << 25),
-  SWITCH_ZRTP_FLAG_SECURE_MITM_RECV = (1 << 26),
-  SWITCH_RTP_FLAG_DEBUG_RTP_READ = (1 << 27),
-  SWITCH_RTP_FLAG_DEBUG_RTP_WRITE = (1 << 28),
-  SWITCH_RTP_FLAG_VIDEO = (1 << 29)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_rtp_flush_t {
-  SWITCH_RTP_FLUSH_ONCE,
-  SWITCH_RTP_FLUSH_STICK,
-  SWITCH_RTP_FLUSH_UNSTICK
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_rtp_hdr_t : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_rtp_hdr_t(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_rtp_hdr_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_rtp_hdr_t() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_rtp_hdr_t(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public uint version {
-    set {
-      freeswitchPINVOKE.switch_rtp_hdr_t_version_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_rtp_hdr_t_version_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint p {
-    set {
-      freeswitchPINVOKE.switch_rtp_hdr_t_p_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_rtp_hdr_t_p_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint x {
-    set {
-      freeswitchPINVOKE.switch_rtp_hdr_t_x_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_rtp_hdr_t_x_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint cc {
-    set {
-      freeswitchPINVOKE.switch_rtp_hdr_t_cc_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_rtp_hdr_t_cc_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint m {
-    set {
-      freeswitchPINVOKE.switch_rtp_hdr_t_m_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_rtp_hdr_t_m_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint pt {
-    set {
-      freeswitchPINVOKE.switch_rtp_hdr_t_pt_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_rtp_hdr_t_pt_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint seq {
-    set {
-      freeswitchPINVOKE.switch_rtp_hdr_t_seq_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_rtp_hdr_t_seq_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint ts {
-    set {
-      freeswitchPINVOKE.switch_rtp_hdr_t_ts_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_rtp_hdr_t_ts_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint ssrc {
-    set {
-      freeswitchPINVOKE.switch_rtp_hdr_t_ssrc_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_rtp_hdr_t_ssrc_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_rtp_hdr_t() : this(freeswitchPINVOKE.new_switch_rtp_hdr_t(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_rtp_numbers_t : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_rtp_numbers_t(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_rtp_numbers_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_rtp_numbers_t() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_rtp_numbers_t(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_switch_size_t raw_bytes {
-    set {
-      freeswitchPINVOKE.switch_rtp_numbers_t_raw_bytes_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_raw_bytes_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t media_bytes {
-    set {
-      freeswitchPINVOKE.switch_rtp_numbers_t_media_bytes_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_media_bytes_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t packet_count {
-    set {
-      freeswitchPINVOKE.switch_rtp_numbers_t_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_packet_count_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t media_packet_count {
-    set {
-      freeswitchPINVOKE.switch_rtp_numbers_t_media_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_media_packet_count_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t skip_packet_count {
-    set {
-      freeswitchPINVOKE.switch_rtp_numbers_t_skip_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_skip_packet_count_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t jb_packet_count {
-    set {
-      freeswitchPINVOKE.switch_rtp_numbers_t_jb_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_jb_packet_count_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t dtmf_packet_count {
-    set {
-      freeswitchPINVOKE.switch_rtp_numbers_t_dtmf_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_dtmf_packet_count_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t cng_packet_count {
-    set {
-      freeswitchPINVOKE.switch_rtp_numbers_t_cng_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_cng_packet_count_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t flush_packet_count {
-    set {
-      freeswitchPINVOKE.switch_rtp_numbers_t_flush_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_flush_packet_count_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public switch_rtp_numbers_t() : this(freeswitchPINVOKE.new_switch_rtp_numbers_t(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_rtp_stats_t : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_rtp_stats_t(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_rtp_stats_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_rtp_stats_t() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_rtp_stats_t(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public switch_rtp_numbers_t inbound {
-    set {
-      freeswitchPINVOKE.switch_rtp_stats_t_inbound_set(swigCPtr, switch_rtp_numbers_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_rtp_stats_t_inbound_get(swigCPtr);
-      switch_rtp_numbers_t ret = (cPtr == IntPtr.Zero) ? null : new switch_rtp_numbers_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_rtp_numbers_t outbound {
-    set {
-      freeswitchPINVOKE.switch_rtp_stats_t_outbound_set(swigCPtr, switch_rtp_numbers_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_rtp_stats_t_outbound_get(swigCPtr);
-      switch_rtp_numbers_t ret = (cPtr == IntPtr.Zero) ? null : new switch_rtp_numbers_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_rtp_stats_t() : this(freeswitchPINVOKE.new_switch_rtp_stats_t(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_say_interface : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_say_interface(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_say_interface obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_say_interface() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_say_interface(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string interface_name {
-    set {
-      freeswitchPINVOKE.switch_say_interface_interface_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_say_interface_interface_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session_p_char_enum_switch_say_type_t_enum_switch_say_method_t_p_switch_input_args_t__switch_status_t say_function {
-    set {
-      freeswitchPINVOKE.switch_say_interface_say_function_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_char_enum_switch_say_type_t_enum_switch_say_method_t_p_switch_input_args_t__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_say_interface_say_function_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session_p_char_enum_switch_say_type_t_enum_switch_say_method_t_p_switch_input_args_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_char_enum_switch_say_type_t_enum_switch_say_method_t_p_switch_input_args_t__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
-    set {
-      freeswitchPINVOKE.switch_say_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_say_interface_rwlock_get(swigCPtr);
-      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public int refs {
-    set {
-      freeswitchPINVOKE.switch_say_interface_refs_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_say_interface_refs_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_mutex_t reflock {
-    set {
-      freeswitchPINVOKE.switch_say_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_say_interface_reflock_get(swigCPtr);
-      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_loadable_module_interface parent {
-    set {
-      freeswitchPINVOKE.switch_say_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_say_interface_parent_get(swigCPtr);
-      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_say_interface next {
-    set {
-      freeswitchPINVOKE.switch_say_interface_next_set(swigCPtr, switch_say_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_say_interface_next_get(swigCPtr);
-      switch_say_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_say_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_say_interface() : this(freeswitchPINVOKE.new_switch_say_interface(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_say_method_t {
-  SSM_NA,
-  SSM_PRONOUNCED,
-  SSM_ITERATED,
-  SSM_COUNTED
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_say_type_t {
-  SST_NUMBER,
-  SST_ITEMS,
-  SST_PERSONS,
-  SST_MESSAGES,
-  SST_CURRENCY,
-  SST_TIME_MEASUREMENT,
-  SST_CURRENT_DATE,
-  SST_CURRENT_TIME,
-  SST_CURRENT_DATE_TIME,
-  SST_TELEPHONE_NUMBER,
-  SST_TELEPHONE_EXTENSION,
-  SST_URL,
-  SST_IP_ADDRESS,
-  SST_EMAIL_ADDRESS,
-  SST_POSTAL_ADDRESS,
-  SST_ACCOUNT_NUMBER,
-  SST_NAME_SPELLED,
-  SST_NAME_PHONETIC,
-  SST_SHORT_DATE_TIME
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_scheduler_flag_enum_t {
-  SSHF_NONE = 0,
-  SSHF_OWN_THREAD = (1 << 0),
-  SSHF_FREE_ARG = (1 << 1),
-  SSHF_NO_DEL = (1 << 2)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_scheduler_task : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_scheduler_task(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_scheduler_task obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_scheduler_task() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_scheduler_task(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public long created {
-    set {
-      freeswitchPINVOKE.switch_scheduler_task_created_set(swigCPtr, value);
-    } 
-    get {
-      long ret = freeswitchPINVOKE.switch_scheduler_task_created_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public long runtime {
-    set {
-      freeswitchPINVOKE.switch_scheduler_task_runtime_set(swigCPtr, value);
-    } 
-    get {
-      long ret = freeswitchPINVOKE.switch_scheduler_task_runtime_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint cmd_id {
-    set {
-      freeswitchPINVOKE.switch_scheduler_task_cmd_id_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_scheduler_task_cmd_id_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string group {
-    set {
-      freeswitchPINVOKE.switch_scheduler_task_group_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_scheduler_task_group_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_void cmd_arg {
-    set {
-      freeswitchPINVOKE.switch_scheduler_task_cmd_arg_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_scheduler_task_cmd_arg_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public uint task_id {
-    set {
-      freeswitchPINVOKE.switch_scheduler_task_task_id_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_scheduler_task_task_id_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_scheduler_task() : this(freeswitchPINVOKE.new_switch_scheduler_task(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_session_ctl_t {
-  SCSC_PAUSE_INBOUND,
-  SCSC_HUPALL,
-  SCSC_SHUTDOWN,
-  SCSC_CHECK_RUNNING,
-  SCSC_LOGLEVEL,
-  SCSC_SPS,
-  SCSC_LAST_SPS,
-  SCSC_RECLAIM,
-  SCSC_MAX_SESSIONS,
-  SCSC_SYNC_CLOCK,
-  SCSC_MAX_DTMF_DURATION,
-  SCSC_MIN_DTMF_DURATION,
-  SCSC_DEFAULT_DTMF_DURATION,
-  SCSC_SHUTDOWN_ELEGANT,
-  SCSC_SHUTDOWN_ASAP,
-  SCSC_CANCEL_SHUTDOWN,
-  SCSC_SEND_SIGHUP,
-  SCSC_DEBUG_LEVEL
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_signal_t {
-  SWITCH_SIG_NONE,
-  SWITCH_SIG_KILL,
-  SWITCH_SIG_XFER,
-  SWITCH_SIG_BREAK
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_speech_flag_enum_t {
-  SWITCH_SPEECH_FLAG_NONE = 0,
-  SWITCH_SPEECH_FLAG_HASTEXT = (1 << 0),
-  SWITCH_SPEECH_FLAG_PEEK = (1 << 1),
-  SWITCH_SPEECH_FLAG_FREE_POOL = (1 << 2),
-  SWITCH_SPEECH_FLAG_BLOCKING = (1 << 3),
-  SWITCH_SPEECH_FLAG_PAUSE = (1 << 4),
-  SWITCH_SPEECH_FLAG_OPEN = (1 << 5),
-  SWITCH_SPEECH_FLAG_DONE = (1 << 6)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_speech_handle : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_speech_handle(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_speech_handle obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_speech_handle() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_speech_handle(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public switch_speech_interface speech_interface {
-    set {
-      freeswitchPINVOKE.switch_speech_handle_speech_interface_set(swigCPtr, switch_speech_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_speech_handle_speech_interface_get(swigCPtr);
-      switch_speech_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_speech_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public uint flags {
-    set {
-      freeswitchPINVOKE.switch_speech_handle_flags_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_speech_handle_flags_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string name {
-    set {
-      freeswitchPINVOKE.switch_speech_handle_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_speech_handle_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint rate {
-    set {
-      freeswitchPINVOKE.switch_speech_handle_rate_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_speech_handle_rate_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint speed {
-    set {
-      freeswitchPINVOKE.switch_speech_handle_speed_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_speech_handle_speed_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint samples {
-    set {
-      freeswitchPINVOKE.switch_speech_handle_samples_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_speech_handle_samples_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string voice {
-    set {
-      freeswitchPINVOKE.switch_speech_handle_voice_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_speech_handle_voice_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string engine {
-    set {
-      freeswitchPINVOKE.switch_speech_handle_engine_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_speech_handle_engine_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string param {
-    set {
-      freeswitchPINVOKE.switch_speech_handle_param_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_speech_handle_param_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_apr_pool_t memory_pool {
-    set {
-      freeswitchPINVOKE.switch_speech_handle_memory_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_speech_handle_memory_pool_get(swigCPtr);
-      SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_audio_resampler_t resampler {
-    set {
-      freeswitchPINVOKE.switch_speech_handle_resampler_set(swigCPtr, switch_audio_resampler_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_speech_handle_resampler_get(swigCPtr);
-      switch_audio_resampler_t ret = (cPtr == IntPtr.Zero) ? null : new switch_audio_resampler_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_buffer buffer {
-    set {
-      freeswitchPINVOKE.switch_speech_handle_buffer_set(swigCPtr, SWIGTYPE_p_switch_buffer.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_speech_handle_buffer_get(swigCPtr);
-      SWIGTYPE_p_switch_buffer ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_buffer(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_unsigned_char dbuf {
-    set {
-      freeswitchPINVOKE.switch_speech_handle_dbuf_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_speech_handle_dbuf_get(swigCPtr);
-      SWIGTYPE_p_unsigned_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t dbuflen {
-    set {
-      freeswitchPINVOKE.switch_speech_handle_dbuflen_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_speech_handle_dbuflen_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public uint samplerate {
-    set {
-      freeswitchPINVOKE.switch_speech_handle_samplerate_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_speech_handle_samplerate_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint native_rate {
-    set {
-      freeswitchPINVOKE.switch_speech_handle_native_rate_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_speech_handle_native_rate_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_void private_info {
-    set {
-      freeswitchPINVOKE.switch_speech_handle_private_info_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_speech_handle_private_info_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_speech_handle() : this(freeswitchPINVOKE.new_switch_speech_handle(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_speech_interface : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_speech_interface(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_speech_interface obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_speech_interface() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_speech_interface(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string interface_name {
-    set {
-      freeswitchPINVOKE.switch_speech_interface_interface_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_speech_interface_interface_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t speech_open {
-    set {
-      freeswitchPINVOKE.switch_speech_interface_speech_open_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_open_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t speech_close {
-    set {
-      freeswitchPINVOKE.switch_speech_interface_speech_close_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_close_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t speech_feed_tts {
-    set {
-      freeswitchPINVOKE.switch_speech_interface_speech_feed_tts_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_feed_tts_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t speech_read_tts {
-    set {
-      freeswitchPINVOKE.switch_speech_interface_speech_read_tts_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_read_tts_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_speech_handle__void speech_flush_tts {
-    set {
-      freeswitchPINVOKE.switch_speech_interface_speech_flush_tts_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle__void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_flush_tts_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_speech_handle__void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle__void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void speech_text_param_tts {
-    set {
-      freeswitchPINVOKE.switch_speech_interface_speech_text_param_tts_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_text_param_tts_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void speech_numeric_param_tts {
-    set {
-      freeswitchPINVOKE.switch_speech_interface_speech_numeric_param_tts_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_numeric_param_tts_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void speech_float_param_tts {
-    set {
-      freeswitchPINVOKE.switch_speech_interface_speech_float_param_tts_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_float_param_tts_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
-    set {
-      freeswitchPINVOKE.switch_speech_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_rwlock_get(swigCPtr);
-      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public int refs {
-    set {
-      freeswitchPINVOKE.switch_speech_interface_refs_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_speech_interface_refs_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_mutex_t reflock {
-    set {
-      freeswitchPINVOKE.switch_speech_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_reflock_get(swigCPtr);
-      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_loadable_module_interface parent {
-    set {
-      freeswitchPINVOKE.switch_speech_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_parent_get(swigCPtr);
-      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_speech_interface next {
-    set {
-      freeswitchPINVOKE.switch_speech_interface_next_set(swigCPtr, switch_speech_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_next_get(swigCPtr);
-      switch_speech_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_speech_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_speech_interface() : this(freeswitchPINVOKE.new_switch_speech_interface(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_stack_t {
-  SWITCH_STACK_BOTTOM,
-  SWITCH_STACK_TOP
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_state_handler_flag_t {
-  SSH_FLAG_STICKY = (1 << 0)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_state_handler_name_t {
-  SWITCH_SHN_ON_INIT,
-  SWITCH_SHN_ON_ROUTING,
-  SWITCH_SHN_ON_EXECUTE,
-  SWITCH_SHN_ON_HANGUP,
-  SWITCH_SHN_ON_EXCHANGE_MEDIA,
-  SWITCH_SHN_ON_SOFT_EXECUTE,
-  SWITCH_SHN_ON_CONSUME_MEDIA,
-  SWITCH_SHN_ON_HIBERNATE,
-  SWITCH_SHN_ON_RESET,
-  SWITCH_SHN_ON_PARK,
-  SWITCH_SHN_ON_REPORTING,
-  SWITCH_SHN_ON_DESTROY
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_state_handler_table : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_state_handler_table(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_state_handler_table obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_state_handler_table() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_state_handler_table(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_init {
-    set {
-      freeswitchPINVOKE.switch_state_handler_table_on_init_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_init_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_routing {
-    set {
-      freeswitchPINVOKE.switch_state_handler_table_on_routing_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_routing_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_execute {
-    set {
-      freeswitchPINVOKE.switch_state_handler_table_on_execute_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_execute_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_hangup {
-    set {
-      freeswitchPINVOKE.switch_state_handler_table_on_hangup_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_hangup_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_exchange_media {
-    set {
-      freeswitchPINVOKE.switch_state_handler_table_on_exchange_media_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_exchange_media_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_soft_execute {
-    set {
-      freeswitchPINVOKE.switch_state_handler_table_on_soft_execute_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_soft_execute_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_consume_media {
-    set {
-      freeswitchPINVOKE.switch_state_handler_table_on_consume_media_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_consume_media_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_hibernate {
-    set {
-      freeswitchPINVOKE.switch_state_handler_table_on_hibernate_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_hibernate_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_reset {
-    set {
-      freeswitchPINVOKE.switch_state_handler_table_on_reset_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_reset_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_park {
-    set {
-      freeswitchPINVOKE.switch_state_handler_table_on_park_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_park_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_reporting {
-    set {
-      freeswitchPINVOKE.switch_state_handler_table_on_reporting_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_reporting_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_destroy {
-    set {
-      freeswitchPINVOKE.switch_state_handler_table_on_destroy_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_destroy_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public int flags {
-    set {
-      freeswitchPINVOKE.switch_state_handler_table_flags_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_state_handler_table_flags_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_p_void padding {
-    set {
-      freeswitchPINVOKE.switch_state_handler_table_padding_set(swigCPtr, SWIGTYPE_p_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_padding_get(swigCPtr);
-      SWIGTYPE_p_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_state_handler_table() : this(freeswitchPINVOKE.new_switch_state_handler_table(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_status_t {
-  SWITCH_STATUS_SUCCESS,
-  SWITCH_STATUS_FALSE,
-  SWITCH_STATUS_TIMEOUT,
-  SWITCH_STATUS_RESTART,
-  SWITCH_STATUS_TERM,
-  SWITCH_STATUS_NOTIMPL,
-  SWITCH_STATUS_MEMERR,
-  SWITCH_STATUS_NOOP,
-  SWITCH_STATUS_RESAMPLE,
-  SWITCH_STATUS_GENERR,
-  SWITCH_STATUS_INUSE,
-  SWITCH_STATUS_BREAK,
-  SWITCH_STATUS_SOCKERR,
-  SWITCH_STATUS_MORE_DATA,
-  SWITCH_STATUS_NOTFOUND,
-  SWITCH_STATUS_UNLOAD,
-  SWITCH_STATUS_NOUNLOAD,
-  SWITCH_STATUS_IGNORE,
-  SWITCH_STATUS_TOO_SMALL,
-  SWITCH_STATUS_NOT_INITALIZED
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_stream_handle : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_stream_handle(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_stream_handle obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_stream_handle() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_stream_handle(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t write_function {
-    set {
-      freeswitchPINVOKE.switch_stream_handle_write_function_set(swigCPtr, SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_stream_handle_write_function_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t raw_write_function {
-    set {
-      freeswitchPINVOKE.switch_stream_handle_raw_write_function_set(swigCPtr, SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_stream_handle_raw_write_function_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_void data {
-    set {
-      freeswitchPINVOKE.switch_stream_handle_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_stream_handle_data_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_void end {
-    set {
-      freeswitchPINVOKE.switch_stream_handle_end_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_stream_handle_end_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t data_size {
-    set {
-      freeswitchPINVOKE.switch_stream_handle_data_size_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_stream_handle_data_size_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t data_len {
-    set {
-      freeswitchPINVOKE.switch_stream_handle_data_len_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_stream_handle_data_len_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t alloc_len {
-    set {
-      freeswitchPINVOKE.switch_stream_handle_alloc_len_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_stream_handle_alloc_len_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t alloc_chunk {
-    set {
-      freeswitchPINVOKE.switch_stream_handle_alloc_chunk_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_stream_handle_alloc_chunk_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public switch_event param_event {
-    set {
-      freeswitchPINVOKE.switch_stream_handle_param_event_set(swigCPtr, switch_event.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_stream_handle_param_event_get(swigCPtr);
-      switch_event ret = (cPtr == IntPtr.Zero) ? null : new switch_event(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_stream_handle() : this(freeswitchPINVOKE.new_switch_stream_handle(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_t38_options_t : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_t38_options_t(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_t38_options_t obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_t38_options_t() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_t38_options_t(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public uint T38MaxBitRate {
-    set {
-      freeswitchPINVOKE.switch_t38_options_t_T38MaxBitRate_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_t38_options_t_T38MaxBitRate_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_bool_t T38FaxFillBitRemoval {
-    set {
-      freeswitchPINVOKE.switch_t38_options_t_T38FaxFillBitRemoval_set(swigCPtr, (int)value);
-    } 
-    get {
-      switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_t38_options_t_T38FaxFillBitRemoval_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_bool_t T38FaxTranscodingMMR {
-    set {
-      freeswitchPINVOKE.switch_t38_options_t_T38FaxTranscodingMMR_set(swigCPtr, (int)value);
-    } 
-    get {
-      switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_t38_options_t_T38FaxTranscodingMMR_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_bool_t T38FaxTranscodingJBIG {
-    set {
-      freeswitchPINVOKE.switch_t38_options_t_T38FaxTranscodingJBIG_set(swigCPtr, (int)value);
-    } 
-    get {
-      switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_t38_options_t_T38FaxTranscodingJBIG_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string T38FaxRateManagement {
-    set {
-      freeswitchPINVOKE.switch_t38_options_t_T38FaxRateManagement_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_t38_options_t_T38FaxRateManagement_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint T38FaxMaxBuffer {
-    set {
-      freeswitchPINVOKE.switch_t38_options_t_T38FaxMaxBuffer_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_t38_options_t_T38FaxMaxBuffer_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint T38FaxMaxDatagram {
-    set {
-      freeswitchPINVOKE.switch_t38_options_t_T38FaxMaxDatagram_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_t38_options_t_T38FaxMaxDatagram_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string T38FaxUdpEC {
-    set {
-      freeswitchPINVOKE.switch_t38_options_t_T38FaxUdpEC_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_t38_options_t_T38FaxUdpEC_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string T38VendorInfo {
-    set {
-      freeswitchPINVOKE.switch_t38_options_t_T38VendorInfo_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_t38_options_t_T38VendorInfo_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string ip {
-    set {
-      freeswitchPINVOKE.switch_t38_options_t_ip_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_t38_options_t_ip_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint port {
-    set {
-      freeswitchPINVOKE.switch_t38_options_t_port_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_t38_options_t_port_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_t38_options_t() : this(freeswitchPINVOKE.new_switch_t38_options_t(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_text_channel_t {
-  SWITCH_CHANNEL_ID_LOG,
-  SWITCH_CHANNEL_ID_LOG_CLEAN,
-  SWITCH_CHANNEL_ID_EVENT
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_timer : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_timer(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_timer obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_timer() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_timer(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public int interval {
-    set {
-      freeswitchPINVOKE.switch_timer_interval_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_timer_interval_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint flags {
-    set {
-      freeswitchPINVOKE.switch_timer_flags_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_timer_flags_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint samples {
-    set {
-      freeswitchPINVOKE.switch_timer_samples_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_timer_samples_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public uint samplecount {
-    set {
-      freeswitchPINVOKE.switch_timer_samplecount_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_timer_samplecount_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_timer_interface timer_interface {
-    set {
-      freeswitchPINVOKE.switch_timer_timer_interface_set(swigCPtr, switch_timer_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_timer_timer_interface_get(swigCPtr);
-      switch_timer_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_timer_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_apr_pool_t memory_pool {
-    set {
-      freeswitchPINVOKE.switch_timer_memory_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_timer_memory_pool_get(swigCPtr);
-      SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_void private_info {
-    set {
-      freeswitchPINVOKE.switch_timer_private_info_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_timer_private_info_get(swigCPtr);
-      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t diff {
-    set {
-      freeswitchPINVOKE.switch_timer_diff_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_timer_diff_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t tick {
-    set {
-      freeswitchPINVOKE.switch_timer_tick_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_timer_tick_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public switch_timer() : this(freeswitchPINVOKE.new_switch_timer(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_timer_flag_enum_t {
-  SWITCH_TIMER_FLAG_FREE_POOL = (1 << 0)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_timer_func_name_t {
-  SWITCH_TIMER_FUNC_TIMER_INIT,
-  SWITCH_TIMER_FUNC_TIMER_NEXT,
-  SWITCH_TIMER_FUNC_TIMER_STEP,
-  SWITCH_TIMER_FUNC_TIMER_SYNC,
-  SWITCH_TIMER_FUNC_TIMER_CHECK,
-  SWITCH_TIMER_FUNC_TIMER_DESTROY
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_timer_interface : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_timer_interface(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_timer_interface obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_timer_interface() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_timer_interface(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string interface_name {
-    set {
-      freeswitchPINVOKE.switch_timer_interface_interface_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_timer_interface_interface_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_timer__switch_status_t timer_init {
-    set {
-      freeswitchPINVOKE.switch_timer_interface_timer_init_set(swigCPtr, SWIGTYPE_p_f_p_switch_timer__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_timer_init_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_timer__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_timer__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_timer__switch_status_t timer_next {
-    set {
-      freeswitchPINVOKE.switch_timer_interface_timer_next_set(swigCPtr, SWIGTYPE_p_f_p_switch_timer__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_timer_next_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_timer__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_timer__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_timer__switch_status_t timer_step {
-    set {
-      freeswitchPINVOKE.switch_timer_interface_timer_step_set(swigCPtr, SWIGTYPE_p_f_p_switch_timer__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_timer_step_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_timer__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_timer__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_timer__switch_status_t timer_sync {
-    set {
-      freeswitchPINVOKE.switch_timer_interface_timer_sync_set(swigCPtr, SWIGTYPE_p_f_p_switch_timer__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_timer_sync_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_timer__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_timer__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t timer_check {
-    set {
-      freeswitchPINVOKE.switch_timer_interface_timer_check_set(swigCPtr, SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_timer_check_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_f_p_switch_timer__switch_status_t timer_destroy {
-    set {
-      freeswitchPINVOKE.switch_timer_interface_timer_destroy_set(swigCPtr, SWIGTYPE_p_f_p_switch_timer__switch_status_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_timer_destroy_get(swigCPtr);
-      SWIGTYPE_p_f_p_switch_timer__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_timer__switch_status_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
-    set {
-      freeswitchPINVOKE.switch_timer_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_rwlock_get(swigCPtr);
-      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public int refs {
-    set {
-      freeswitchPINVOKE.switch_timer_interface_refs_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_timer_interface_refs_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_mutex_t reflock {
-    set {
-      freeswitchPINVOKE.switch_timer_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_reflock_get(swigCPtr);
-      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_loadable_module_interface parent {
-    set {
-      freeswitchPINVOKE.switch_timer_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_parent_get(swigCPtr);
-      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_timer_interface next {
-    set {
-      freeswitchPINVOKE.switch_timer_interface_next_set(swigCPtr, switch_timer_interface.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_next_get(swigCPtr);
-      switch_timer_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_timer_interface(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_timer_interface() : this(freeswitchPINVOKE.new_switch_timer_interface(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_unicast_conninfo : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_unicast_conninfo(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_unicast_conninfo obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_unicast_conninfo() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_unicast_conninfo(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public SWIGTYPE_p_switch_core_session session {
-    set {
-      freeswitchPINVOKE.switch_unicast_conninfo_session_set(swigCPtr, SWIGTYPE_p_switch_core_session.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_unicast_conninfo_session_get(swigCPtr);
-      SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_codec read_codec {
-    set {
-      freeswitchPINVOKE.switch_unicast_conninfo_read_codec_set(swigCPtr, switch_codec.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_unicast_conninfo_read_codec_get(swigCPtr);
-      switch_codec ret = (cPtr == IntPtr.Zero) ? null : new switch_codec(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_frame write_frame {
-    set {
-      freeswitchPINVOKE.switch_unicast_conninfo_write_frame_set(swigCPtr, switch_frame.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_unicast_conninfo_write_frame_get(swigCPtr);
-      switch_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_frame(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_unsigned_char write_frame_data {
-    set {
-      freeswitchPINVOKE.switch_unicast_conninfo_write_frame_data_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_unicast_conninfo_write_frame_data_get(swigCPtr);
-      SWIGTYPE_p_unsigned_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_socket_t socket {
-    set {
-      freeswitchPINVOKE.switch_unicast_conninfo_socket_set(swigCPtr, SWIGTYPE_p_switch_socket_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_unicast_conninfo_socket_get(swigCPtr);
-      SWIGTYPE_p_switch_socket_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_socket_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public string local_ip {
-    set {
-      freeswitchPINVOKE.switch_unicast_conninfo_local_ip_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_unicast_conninfo_local_ip_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public ushort local_port {
-    set {
-      freeswitchPINVOKE.switch_unicast_conninfo_local_port_set(swigCPtr, value);
-    } 
-    get {
-      ushort ret = freeswitchPINVOKE.switch_unicast_conninfo_local_port_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string remote_ip {
-    set {
-      freeswitchPINVOKE.switch_unicast_conninfo_remote_ip_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_unicast_conninfo_remote_ip_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public ushort remote_port {
-    set {
-      freeswitchPINVOKE.switch_unicast_conninfo_remote_port_set(swigCPtr, value);
-    } 
-    get {
-      ushort ret = freeswitchPINVOKE.switch_unicast_conninfo_remote_port_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_sockaddr_t local_addr {
-    set {
-      freeswitchPINVOKE.switch_unicast_conninfo_local_addr_set(swigCPtr, SWIGTYPE_p_switch_sockaddr_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_unicast_conninfo_local_addr_get(swigCPtr);
-      SWIGTYPE_p_switch_sockaddr_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_sockaddr_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_sockaddr_t remote_addr {
-    set {
-      freeswitchPINVOKE.switch_unicast_conninfo_remote_addr_set(swigCPtr, SWIGTYPE_p_switch_sockaddr_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_unicast_conninfo_remote_addr_get(swigCPtr);
-      SWIGTYPE_p_switch_sockaddr_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_sockaddr_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_mutex_t flag_mutex {
-    set {
-      freeswitchPINVOKE.switch_unicast_conninfo_flag_mutex_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_unicast_conninfo_flag_mutex_get(swigCPtr);
-      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public int flags {
-    set {
-      freeswitchPINVOKE.switch_unicast_conninfo_flags_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_unicast_conninfo_flags_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int type {
-    set {
-      freeswitchPINVOKE.switch_unicast_conninfo_type_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_unicast_conninfo_type_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int transport {
-    set {
-      freeswitchPINVOKE.switch_unicast_conninfo_transport_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_unicast_conninfo_transport_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public int stream_id {
-    set {
-      freeswitchPINVOKE.switch_unicast_conninfo_stream_id_set(swigCPtr, value);
-    } 
-    get {
-      int ret = freeswitchPINVOKE.switch_unicast_conninfo_stream_id_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_unicast_conninfo() : this(freeswitchPINVOKE.new_switch_unicast_conninfo(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_unicast_flag_enum_t {
-  SUF_NONE = 0,
-  SUF_THREAD_RUNNING = (1 << 0),
-  SUF_READY = (1 << 1),
-  SUF_NATIVE = (1 << 2)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-public enum switch_uri_flags {
-  SWITCH_URI_NUMERIC_HOST = 1,
-  SWITCH_URI_NUMERIC_PORT = 2,
-  SWITCH_URI_NO_SCOPE = 4
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_vad_flag_enum_t {
-  SWITCH_VAD_FLAG_TALKING = (1 << 0),
-  SWITCH_VAD_FLAG_EVENTS_TALK = (1 << 1),
-  SWITCH_VAD_FLAG_EVENTS_NOTALK = (1 << 2),
-  SWITCH_VAD_FLAG_CNG = (1 << 3)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-using System;
-using System.Runtime.InteropServices;
-
-public class switch_xml : IDisposable {
-  private HandleRef swigCPtr;
-  protected bool swigCMemOwn;
-
-  internal switch_xml(IntPtr cPtr, bool cMemoryOwn) {
-    swigCMemOwn = cMemoryOwn;
-    swigCPtr = new HandleRef(this, cPtr);
-  }
-
-  internal static HandleRef getCPtr(switch_xml obj) {
-    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
-  }
-
-  ~switch_xml() {
-    Dispose();
-  }
-
-  public virtual void Dispose() {
-    lock(this) {
-      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
-        swigCMemOwn = false;
-        freeswitchPINVOKE.delete_switch_xml(swigCPtr);
-      }
-      swigCPtr = new HandleRef(null, IntPtr.Zero);
-      GC.SuppressFinalize(this);
-    }
-  }
-
-  public string name {
-    set {
-      freeswitchPINVOKE.switch_xml_name_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_xml_name_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string attr {
-  set { freeswitchPINVOKE.switch_xml_attr_set(swigCPtr, ref value); }
-
-  get {
-    return freeswitchPINVOKE.switch_xml_attr_get(swigCPtr);
-  }
-
-  }
-
-  public string txt {
-    set {
-      freeswitchPINVOKE.switch_xml_txt_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_xml_txt_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public string free_path {
-    set {
-      freeswitchPINVOKE.switch_xml_free_path_set(swigCPtr, value);
-    } 
-    get {
-      string ret = freeswitchPINVOKE.switch_xml_free_path_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public SWIGTYPE_p_switch_size_t off {
-    set {
-      freeswitchPINVOKE.switch_xml_off_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-    } 
-    get {
-      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_xml_off_get(swigCPtr), true);
-      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
-      return ret;
-    } 
-  }
-
-  public switch_xml next {
-    set {
-      freeswitchPINVOKE.switch_xml_next_set(swigCPtr, switch_xml.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_xml_next_get(swigCPtr);
-      switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_xml sibling {
-    set {
-      freeswitchPINVOKE.switch_xml_sibling_set(swigCPtr, switch_xml.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_xml_sibling_get(swigCPtr);
-      switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_xml ordered {
-    set {
-      freeswitchPINVOKE.switch_xml_ordered_set(swigCPtr, switch_xml.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_xml_ordered_get(swigCPtr);
-      switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_xml child {
-    set {
-      freeswitchPINVOKE.switch_xml_child_set(swigCPtr, switch_xml.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_xml_child_get(swigCPtr);
-      switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public switch_xml parent {
-    set {
-      freeswitchPINVOKE.switch_xml_parent_set(swigCPtr, switch_xml.getCPtr(value));
-    } 
-    get {
-      IntPtr cPtr = freeswitchPINVOKE.switch_xml_parent_get(swigCPtr);
-      switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
-      return ret;
-    } 
-  }
-
-  public uint flags {
-    set {
-      freeswitchPINVOKE.switch_xml_flags_set(swigCPtr, value);
-    } 
-    get {
-      uint ret = freeswitchPINVOKE.switch_xml_flags_get(swigCPtr);
-      return ret;
-    } 
-  }
-
-  public switch_xml() : this(freeswitchPINVOKE.new_switch_xml(), true) {
-  }
-
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_xml_flag_t {
-  SWITCH_XML_ROOT = (1 << 0),
-  SWITCH_XML_NAMEM = (1 << 1),
-  SWITCH_XML_TXTM = (1 << 2),
-  SWITCH_XML_DUP = (1 << 3)
-}
-
-}
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.35
- *
- * Do not make changes to this file unless you know what you are doing--modify
- * the SWIG interface file instead.
- * ----------------------------------------------------------------------------- */
-
-namespace FreeSWITCH.Native {
-
-[System.Flags] public enum switch_xml_section_enum_t {
-  SWITCH_XML_SECTION_RESULT = 0,
-  SWITCH_XML_SECTION_CONFIG = (1 << 0),
-  SWITCH_XML_SECTION_DIRECTORY = (1 << 1),
-  SWITCH_XML_SECTION_DIALPLAN = (1 << 2),
-  SWITCH_XML_SECTION_PHRASES = (1 << 3),
-  SWITCH_XML_SECTION_MAX = (1 << 4)
-}
-
-}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class Api : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal Api(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(Api obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~Api() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_Api(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public Api() : this(freeswitchPINVOKE.new_Api(), true) {
+  }
+
+  public string Execute(string command, string data) {
+    string ret = freeswitchPINVOKE.Api_Execute(swigCPtr, command, data);
+    return ret;
+  }
+
+  public string ExecuteString(string command) {
+    string ret = freeswitchPINVOKE.Api_ExecuteString(swigCPtr, command);
+    return ret;
+  }
+
+  public string getTime() {
+    string ret = freeswitchPINVOKE.Api_getTime(swigCPtr);
+    return ret;
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum cache_db_flag_t {
+  CDF_INUSE = (1 << 0)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class CoreSession : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal CoreSession(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(CoreSession obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~CoreSession() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_CoreSession(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_switch_core_session InternalSession {
+    set {
+      freeswitchPINVOKE.CoreSession_InternalSession_set(swigCPtr, SWIGTYPE_p_switch_core_session.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.CoreSession_InternalSession_get(swigCPtr);
+      SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_channel channel {
+    set {
+      freeswitchPINVOKE.CoreSession_channel_set(swigCPtr, SWIGTYPE_p_switch_channel.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.CoreSession_channel_get(swigCPtr);
+      SWIGTYPE_p_switch_channel ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_channel(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public uint flags {
+    set {
+      freeswitchPINVOKE.CoreSession_flags_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.CoreSession_flags_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int allocated {
+    set {
+      freeswitchPINVOKE.CoreSession_allocated_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.CoreSession_allocated_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public input_callback_state_t cb_state {
+    set {
+      freeswitchPINVOKE.CoreSession_cb_state_set(swigCPtr, input_callback_state_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.CoreSession_cb_state_get(swigCPtr);
+      input_callback_state_t ret = (cPtr == IntPtr.Zero) ? null : new input_callback_state_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_channel_state_t HookState {
+    set {
+      freeswitchPINVOKE.CoreSession_HookState_set(swigCPtr, (int)value);
+    } 
+    get {
+      switch_channel_state_t ret = (switch_channel_state_t)freeswitchPINVOKE.CoreSession_HookState_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_call_cause_t cause {
+    set {
+      freeswitchPINVOKE.CoreSession_cause_set(swigCPtr, (int)value);
+    } 
+    get {
+      switch_call_cause_t ret = (switch_call_cause_t)freeswitchPINVOKE.CoreSession_cause_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string uuid {
+    set {
+      freeswitchPINVOKE.CoreSession_uuid_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.CoreSession_uuid_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string tts_name {
+    set {
+      freeswitchPINVOKE.CoreSession_tts_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.CoreSession_tts_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string voice_name {
+    set {
+      freeswitchPINVOKE.CoreSession_voice_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.CoreSession_voice_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int Answer() {
+    int ret = freeswitchPINVOKE.CoreSession_Answer(swigCPtr);
+    return ret;
+  }
+
+  public int preAnswer() {
+    int ret = freeswitchPINVOKE.CoreSession_preAnswer(swigCPtr);
+    return ret;
+  }
+
+  public void Hangup(string cause) {
+    freeswitchPINVOKE.CoreSession_Hangup(swigCPtr, cause);
+  }
+
+  public void hangupState() {
+    freeswitchPINVOKE.CoreSession_hangupState(swigCPtr);
+  }
+
+  public void SetVariable(string var, string val) {
+    freeswitchPINVOKE.CoreSession_SetVariable(swigCPtr, var, val);
+  }
+
+  public void SetPrivate(string var, SWIGTYPE_p_void val) {
+    freeswitchPINVOKE.CoreSession_SetPrivate(swigCPtr, var, SWIGTYPE_p_void.getCPtr(val));
+  }
+
+  public SWIGTYPE_p_void GetPrivate(string var) {
+    IntPtr cPtr = freeswitchPINVOKE.CoreSession_GetPrivate(swigCPtr, var);
+    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+    return ret;
+  }
+
+  public string GetVariable(string var) {
+    string ret = freeswitchPINVOKE.CoreSession_GetVariable(swigCPtr, var);
+    return ret;
+  }
+
+  public void Say(string tosay, string module_name, string say_type, string say_method) {
+    freeswitchPINVOKE.CoreSession_Say(swigCPtr, tosay, module_name, say_type, say_method);
+  }
+
+  public void SayPhrase(string phrase_name, string phrase_data, string phrase_lang) {
+    freeswitchPINVOKE.CoreSession_SayPhrase(swigCPtr, phrase_name, phrase_data, phrase_lang);
+  }
+
+  public string hangupCause() {
+    string ret = freeswitchPINVOKE.CoreSession_hangupCause(swigCPtr);
+    return ret;
+  }
+
+  public string getState() {
+    string ret = freeswitchPINVOKE.CoreSession_getState(swigCPtr);
+    return ret;
+  }
+
+  public int RecordFile(string file_name, int time_limit, int silence_threshold, int silence_hits) {
+    int ret = freeswitchPINVOKE.CoreSession_RecordFile(swigCPtr, file_name, time_limit, silence_threshold, silence_hits);
+    return ret;
+  }
+
+  protected int originate(CoreSession a_leg_session, string dest, int timeout, switch_state_handler_table handlers) {
+    int ret = freeswitchPINVOKE.CoreSession_originate(swigCPtr, CoreSession.getCPtr(a_leg_session), dest, timeout, switch_state_handler_table.getCPtr(handlers));
+    return ret;
+  }
+
+  public virtual void destroy() {
+    freeswitchPINVOKE.CoreSession_destroy(swigCPtr);
+  }
+
+  public int Speak(string text) {
+    int ret = freeswitchPINVOKE.CoreSession_Speak(swigCPtr, text);
+    return ret;
+  }
+
+  public void SetTtsParameters(string tts_name, string voice_name) {
+    freeswitchPINVOKE.CoreSession_SetTtsParameters(swigCPtr, tts_name, voice_name);
+  }
+
+  public int CollectDigits(int abs_timeout) {
+    int ret = freeswitchPINVOKE.CoreSession_CollectDigits__SWIG_0(swigCPtr, abs_timeout);
+    return ret;
+  }
+
+  public int CollectDigits(int digit_timeout, int abs_timeout) {
+    int ret = freeswitchPINVOKE.CoreSession_CollectDigits__SWIG_1(swigCPtr, digit_timeout, abs_timeout);
+    return ret;
+  }
+
+  public string GetDigits(int maxdigits, string terminators, int timeout) {
+    string ret = freeswitchPINVOKE.CoreSession_GetDigits__SWIG_0(swigCPtr, maxdigits, terminators, timeout);
+    return ret;
+  }
+
+  public string GetDigits(int maxdigits, string terminators, int timeout, int interdigit) {
+    string ret = freeswitchPINVOKE.CoreSession_GetDigits__SWIG_1(swigCPtr, maxdigits, terminators, timeout, interdigit);
+    return ret;
+  }
+
+  public int Transfer(string extension, string dialplan, string context) {
+    int ret = freeswitchPINVOKE.CoreSession_Transfer(swigCPtr, extension, dialplan, context);
+    return ret;
+  }
+
+  public string read(int min_digits, int max_digits, string prompt_audio_file, int timeout, string valid_terminators) {
+    string ret = freeswitchPINVOKE.CoreSession_read(swigCPtr, min_digits, max_digits, prompt_audio_file, timeout, valid_terminators);
+    return ret;
+  }
+
+  public string PlayAndGetDigits(int min_digits, int max_digits, int max_tries, int timeout, string terminators, string audio_files, string bad_input_audio_files, string digits_regex, string var_name) {
+    string ret = freeswitchPINVOKE.CoreSession_PlayAndGetDigits(swigCPtr, min_digits, max_digits, max_tries, timeout, terminators, audio_files, bad_input_audio_files, digits_regex, var_name);
+    return ret;
+  }
+
+  public int StreamFile(string file, int starting_sample_count) {
+    int ret = freeswitchPINVOKE.CoreSession_StreamFile(swigCPtr, file, starting_sample_count);
+    return ret;
+  }
+
+  public int sleep(int ms, int sync) {
+    int ret = freeswitchPINVOKE.CoreSession_sleep(swigCPtr, ms, sync);
+    return ret;
+  }
+
+  public int flushEvents() {
+    int ret = freeswitchPINVOKE.CoreSession_flushEvents(swigCPtr);
+    return ret;
+  }
+
+  public int flushDigits() {
+    int ret = freeswitchPINVOKE.CoreSession_flushDigits(swigCPtr);
+    return ret;
+  }
+
+  public int SetAutoHangup(bool val) {
+    int ret = freeswitchPINVOKE.CoreSession_SetAutoHangup(swigCPtr, val);
+    return ret;
+  }
+
+  public bool Ready() {
+    bool ret = freeswitchPINVOKE.CoreSession_Ready(swigCPtr);
+    return ret;
+  }
+
+  public bool answered() {
+    bool ret = freeswitchPINVOKE.CoreSession_answered(swigCPtr);
+    return ret;
+  }
+
+  public bool mediaReady() {
+    bool ret = freeswitchPINVOKE.CoreSession_mediaReady(swigCPtr);
+    return ret;
+  }
+
+  public void waitForAnswer(CoreSession calling_session) {
+    freeswitchPINVOKE.CoreSession_waitForAnswer(swigCPtr, CoreSession.getCPtr(calling_session));
+  }
+
+  public void Execute(string app, string data) {
+    freeswitchPINVOKE.CoreSession_Execute(swigCPtr, app, data);
+  }
+
+  public void sendEvent(Event sendME) {
+    freeswitchPINVOKE.CoreSession_sendEvent(swigCPtr, Event.getCPtr(sendME));
+  }
+
+  public void setEventData(Event e) {
+    freeswitchPINVOKE.CoreSession_setEventData(swigCPtr, Event.getCPtr(e));
+  }
+
+  public string getXMLCDR() {
+    string ret = freeswitchPINVOKE.CoreSession_getXMLCDR(swigCPtr);
+    return ret;
+  }
+
+  public virtual bool begin_allow_threads() {
+    bool ret = freeswitchPINVOKE.CoreSession_begin_allow_threads(swigCPtr);
+    return ret;
+  }
+
+  public virtual bool end_allow_threads() {
+    bool ret = freeswitchPINVOKE.CoreSession_end_allow_threads(swigCPtr);
+    return ret;
+  }
+
+  public string GetUuid() {
+    string ret = freeswitchPINVOKE.CoreSession_GetUuid(swigCPtr);
+    return ret;
+  }
+
+  public switch_input_args_t get_cb_args() {
+    switch_input_args_t ret = new switch_input_args_t(freeswitchPINVOKE.CoreSession_get_cb_args(swigCPtr), false);
+    return ret;
+  }
+
+  public virtual void check_hangup_hook() {
+    freeswitchPINVOKE.CoreSession_check_hangup_hook(swigCPtr);
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class DTMF : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal DTMF(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(DTMF obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~DTMF() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_DTMF(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public char digit {
+    set {
+      freeswitchPINVOKE.DTMF_digit_set(swigCPtr, value);
+    } 
+    get {
+      char ret = freeswitchPINVOKE.DTMF_digit_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint duration {
+    set {
+      freeswitchPINVOKE.DTMF_duration_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.DTMF_duration_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public DTMF(char idigit, uint iduration) : this(freeswitchPINVOKE.new_DTMF(idigit, iduration), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class EventConsumer : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal EventConsumer(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(EventConsumer obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~EventConsumer() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_EventConsumer(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_switch_queue_t events {
+    set {
+      freeswitchPINVOKE.EventConsumer_events_set(swigCPtr, SWIGTYPE_p_switch_queue_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.EventConsumer_events_get(swigCPtr);
+      SWIGTYPE_p_switch_queue_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_queue_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_event_types_t e_event_id {
+    set {
+      freeswitchPINVOKE.EventConsumer_e_event_id_set(swigCPtr, (int)value);
+    } 
+    get {
+      switch_event_types_t ret = (switch_event_types_t)freeswitchPINVOKE.EventConsumer_e_event_id_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_event_node node {
+    set {
+      freeswitchPINVOKE.EventConsumer_node_set(swigCPtr, SWIGTYPE_p_switch_event_node.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.EventConsumer_node_get(swigCPtr);
+      SWIGTYPE_p_switch_event_node ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_event_node(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public string e_callback {
+    set {
+      freeswitchPINVOKE.EventConsumer_e_callback_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.EventConsumer_e_callback_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string e_subclass_name {
+    set {
+      freeswitchPINVOKE.EventConsumer_e_subclass_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.EventConsumer_e_subclass_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string e_cb_arg {
+    set {
+      freeswitchPINVOKE.EventConsumer_e_cb_arg_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.EventConsumer_e_cb_arg_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public EventConsumer(string event_name, string subclass_name) : this(freeswitchPINVOKE.new_EventConsumer(event_name, subclass_name), true) {
+  }
+
+  public Event pop(int block) {
+    IntPtr cPtr = freeswitchPINVOKE.EventConsumer_pop(swigCPtr, block);
+    Event ret = (cPtr == IntPtr.Zero) ? null : new Event(cPtr, true);
+    return ret;
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public partial class Event : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal Event(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(Event obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~Event() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_Event(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public switch_event InternalEvent {
+    set {
+      freeswitchPINVOKE.Event_InternalEvent_set(swigCPtr, switch_event.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.Event_InternalEvent_get(swigCPtr);
+      switch_event ret = (cPtr == IntPtr.Zero) ? null : new switch_event(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public string serialized_string {
+    set {
+      freeswitchPINVOKE.Event_serialized_string_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.Event_serialized_string_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int mine {
+    set {
+      freeswitchPINVOKE.Event_mine_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.Event_mine_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public Event(string type, string subclass_name) : this(freeswitchPINVOKE.new_Event__SWIG_0(type, subclass_name), true) {
+  }
+
+  public Event(switch_event wrap_me, int free_me) : this(freeswitchPINVOKE.new_Event__SWIG_1(switch_event.getCPtr(wrap_me), free_me), true) {
+  }
+
+  public string Serialize(string format) {
+    string ret = freeswitchPINVOKE.Event_Serialize(swigCPtr, format);
+    return ret;
+  }
+
+  public bool SetPriority(switch_priority_t priority) {
+    bool ret = freeswitchPINVOKE.Event_SetPriority(swigCPtr, (int)priority);
+    return ret;
+  }
+
+  public string GetHeader(string header_name) {
+    string ret = freeswitchPINVOKE.Event_GetHeader(swigCPtr, header_name);
+    return ret;
+  }
+
+  public string GetBody() {
+    string ret = freeswitchPINVOKE.Event_GetBody(swigCPtr);
+    return ret;
+  }
+
+  public string GetEventType() {
+    string ret = freeswitchPINVOKE.Event_GetEventType(swigCPtr);
+    return ret;
+  }
+
+  public bool AddBody(string value) {
+    bool ret = freeswitchPINVOKE.Event_AddBody(swigCPtr, value);
+    return ret;
+  }
+
+  public bool AddHeader(string header_name, string value) {
+    bool ret = freeswitchPINVOKE.Event_AddHeader(swigCPtr, header_name, value);
+    return ret;
+  }
+
+  public bool DeleteHeader(string header_name) {
+    bool ret = freeswitchPINVOKE.Event_DeleteHeader(swigCPtr, header_name);
+    return ret;
+  }
+
+  public bool Fire() {
+    bool ret = freeswitchPINVOKE.Event_Fire(swigCPtr);
+    return ret;
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class freeswitch {
+  public static switch_directories SWITCH_GLOBAL_dirs {
+    set {
+      freeswitchPINVOKE.SWITCH_GLOBAL_dirs_set(switch_directories.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.SWITCH_GLOBAL_dirs_get();
+      switch_directories ret = (cPtr == IntPtr.Zero) ? null : new switch_directories(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public static int switch_core_db_close(SWIGTYPE_p_sqlite3 db) {
+    int ret = freeswitchPINVOKE.switch_core_db_close(SWIGTYPE_p_sqlite3.getCPtr(db));
+    return ret;
+  }
+
+  public static int switch_core_db_open(string filename, SWIGTYPE_p_p_sqlite3 ppDb) {
+    int ret = freeswitchPINVOKE.switch_core_db_open(filename, SWIGTYPE_p_p_sqlite3.getCPtr(ppDb));
+    return ret;
+  }
+
+  public static SWIGTYPE_p_unsigned_char switch_core_db_column_text(SWIGTYPE_p_sqlite3_stmt stmt, int iCol) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_db_column_text(SWIGTYPE_p_sqlite3_stmt.getCPtr(stmt), iCol);
+    SWIGTYPE_p_unsigned_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+    return ret;
+  }
+
+  public static string switch_core_db_column_name(SWIGTYPE_p_sqlite3_stmt stmt, int N) {
+    string ret = freeswitchPINVOKE.switch_core_db_column_name(SWIGTYPE_p_sqlite3_stmt.getCPtr(stmt), N);
+    return ret;
+  }
+
+  public static int switch_core_db_column_count(SWIGTYPE_p_sqlite3_stmt pStmt) {
+    int ret = freeswitchPINVOKE.switch_core_db_column_count(SWIGTYPE_p_sqlite3_stmt.getCPtr(pStmt));
+    return ret;
+  }
+
+  public static string switch_core_db_errmsg(SWIGTYPE_p_sqlite3 db) {
+    string ret = freeswitchPINVOKE.switch_core_db_errmsg(SWIGTYPE_p_sqlite3.getCPtr(db));
+    return ret;
+  }
+
+  public static int switch_core_db_exec(SWIGTYPE_p_sqlite3 db, string sql, SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int callback, SWIGTYPE_p_void data, ref string errmsg) {
+    int ret = freeswitchPINVOKE.switch_core_db_exec(SWIGTYPE_p_sqlite3.getCPtr(db), sql, SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int.getCPtr(callback), SWIGTYPE_p_void.getCPtr(data), ref errmsg);
+    return ret;
+  }
+
+  public static int switch_core_db_finalize(SWIGTYPE_p_sqlite3_stmt pStmt) {
+    int ret = freeswitchPINVOKE.switch_core_db_finalize(SWIGTYPE_p_sqlite3_stmt.getCPtr(pStmt));
+    return ret;
+  }
+
+  public static int switch_core_db_prepare(SWIGTYPE_p_sqlite3 db, string zSql, int nBytes, SWIGTYPE_p_p_sqlite3_stmt ppStmt, ref string pzTail) {
+    int ret = freeswitchPINVOKE.switch_core_db_prepare(SWIGTYPE_p_sqlite3.getCPtr(db), zSql, nBytes, SWIGTYPE_p_p_sqlite3_stmt.getCPtr(ppStmt), ref pzTail);
+    return ret;
+  }
+
+  public static int switch_core_db_step(SWIGTYPE_p_sqlite3_stmt stmt) {
+    int ret = freeswitchPINVOKE.switch_core_db_step(SWIGTYPE_p_sqlite3_stmt.getCPtr(stmt));
+    return ret;
+  }
+
+  public static int switch_core_db_reset(SWIGTYPE_p_sqlite3_stmt pStmt) {
+    int ret = freeswitchPINVOKE.switch_core_db_reset(SWIGTYPE_p_sqlite3_stmt.getCPtr(pStmt));
+    return ret;
+  }
+
+  public static int switch_core_db_bind_int(SWIGTYPE_p_sqlite3_stmt pStmt, int i, int iValue) {
+    int ret = freeswitchPINVOKE.switch_core_db_bind_int(SWIGTYPE_p_sqlite3_stmt.getCPtr(pStmt), i, iValue);
+    return ret;
+  }
+
+  public static int switch_core_db_bind_int64(SWIGTYPE_p_sqlite3_stmt pStmt, int i, long iValue) {
+    int ret = freeswitchPINVOKE.switch_core_db_bind_int64(SWIGTYPE_p_sqlite3_stmt.getCPtr(pStmt), i, iValue);
+    return ret;
+  }
+
+  public static int switch_core_db_bind_text(SWIGTYPE_p_sqlite3_stmt pStmt, int i, string zData, int nData, SWIGTYPE_p_f_p_void__void xDel) {
+    int ret = freeswitchPINVOKE.switch_core_db_bind_text(SWIGTYPE_p_sqlite3_stmt.getCPtr(pStmt), i, zData, nData, SWIGTYPE_p_f_p_void__void.getCPtr(xDel));
+    return ret;
+  }
+
+  public static int switch_core_db_bind_double(SWIGTYPE_p_sqlite3_stmt pStmt, int i, double dValue) {
+    int ret = freeswitchPINVOKE.switch_core_db_bind_double(SWIGTYPE_p_sqlite3_stmt.getCPtr(pStmt), i, dValue);
+    return ret;
+  }
+
+  public static long switch_core_db_last_insert_rowid(SWIGTYPE_p_sqlite3 db) {
+    long ret = freeswitchPINVOKE.switch_core_db_last_insert_rowid(SWIGTYPE_p_sqlite3.getCPtr(db));
+    return ret;
+  }
+
+  public static int switch_core_db_get_table(SWIGTYPE_p_sqlite3 db, string sql, SWIGTYPE_p_p_p_char resultp, SWIGTYPE_p_int nrow, SWIGTYPE_p_int ncolumn, ref string errmsg) {
+    int ret = freeswitchPINVOKE.switch_core_db_get_table(SWIGTYPE_p_sqlite3.getCPtr(db), sql, SWIGTYPE_p_p_p_char.getCPtr(resultp), SWIGTYPE_p_int.getCPtr(nrow), SWIGTYPE_p_int.getCPtr(ncolumn), ref errmsg);
+    return ret;
+  }
+
+  public static void switch_core_db_free_table(ref string result) {
+    freeswitchPINVOKE.switch_core_db_free_table(ref result);
+  }
+
+  public static void switch_core_db_free(string z) {
+    freeswitchPINVOKE.switch_core_db_free(z);
+  }
+
+  public static int switch_core_db_changes(SWIGTYPE_p_sqlite3 db) {
+    int ret = freeswitchPINVOKE.switch_core_db_changes(SWIGTYPE_p_sqlite3.getCPtr(db));
+    return ret;
+  }
+
+  public static SWIGTYPE_p_real_pcre switch_regex_compile(string pattern, int options, ref string errorptr, SWIGTYPE_p_int erroroffset, SWIGTYPE_p_unsigned_char tables) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_regex_compile(pattern, options, ref errorptr, SWIGTYPE_p_int.getCPtr(erroroffset), SWIGTYPE_p_unsigned_char.getCPtr(tables));
+    SWIGTYPE_p_real_pcre ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_real_pcre(cPtr, false);
+    return ret;
+  }
+
+  public static int switch_regex_copy_substring(string subject, SWIGTYPE_p_int ovector, int stringcount, int stringnumber, string buffer, int size) {
+    int ret = freeswitchPINVOKE.switch_regex_copy_substring(subject, SWIGTYPE_p_int.getCPtr(ovector), stringcount, stringnumber, buffer, size);
+    return ret;
+  }
+
+  public static void switch_regex_free(SWIGTYPE_p_void data) {
+    freeswitchPINVOKE.switch_regex_free(SWIGTYPE_p_void.getCPtr(data));
+  }
+
+  public static int switch_regex_perform(string field, string expression, SWIGTYPE_p_p_real_pcre new_re, SWIGTYPE_p_int ovector, uint olen) {
+    int ret = freeswitchPINVOKE.switch_regex_perform(field, expression, SWIGTYPE_p_p_real_pcre.getCPtr(new_re), SWIGTYPE_p_int.getCPtr(ovector), olen);
+    return ret;
+  }
+
+  public static void switch_perform_substitution(SWIGTYPE_p_real_pcre re, int match_count, string data, string field_data, string substituted, SWIGTYPE_p_switch_size_t len, SWIGTYPE_p_int ovector) {
+    freeswitchPINVOKE.switch_perform_substitution(SWIGTYPE_p_real_pcre.getCPtr(re), match_count, data, field_data, substituted, SWIGTYPE_p_switch_size_t.getCPtr(len), SWIGTYPE_p_int.getCPtr(ovector));
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+  }
+
+  public static switch_status_t switch_regex_match(string target, string expression) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_regex_match(target, expression);
+    return ret;
+  }
+
+  public static switch_status_t switch_regex_match_partial(string target, string expression, SWIGTYPE_p_int partial_match) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_regex_match_partial(target, expression, SWIGTYPE_p_int.getCPtr(partial_match));
+    return ret;
+  }
+
+  public static void switch_core_session_sched_heartbeat(SWIGTYPE_p_switch_core_session session, uint seconds) {
+    freeswitchPINVOKE.switch_core_session_sched_heartbeat(SWIGTYPE_p_switch_core_session.getCPtr(session), seconds);
+  }
+
+  public static void switch_core_session_unsched_heartbeat(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_session_unsched_heartbeat(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static void switch_core_session_enable_heartbeat(SWIGTYPE_p_switch_core_session session, uint seconds) {
+    freeswitchPINVOKE.switch_core_session_enable_heartbeat(SWIGTYPE_p_switch_core_session.getCPtr(session), seconds);
+  }
+
+  public static void switch_core_session_disable_heartbeat(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_session_disable_heartbeat(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static switch_status_t switch_core_media_bug_add(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t callback, SWIGTYPE_p_void user_data, SWIGTYPE_p_time_t stop_time, uint flags, SWIGTYPE_p_p_switch_media_bug new_bug) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_add(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data), SWIGTYPE_p_time_t.getCPtr(stop_time), flags, SWIGTYPE_p_p_switch_media_bug.getCPtr(new_bug));
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static void switch_core_media_bug_pause(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_media_bug_pause(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static void switch_core_media_bug_resume(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_media_bug_resume(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static void switch_core_media_bug_inuse(SWIGTYPE_p_switch_media_bug bug, SWIGTYPE_p_switch_size_t readp, SWIGTYPE_p_switch_size_t writep) {
+    freeswitchPINVOKE.switch_core_media_bug_inuse(SWIGTYPE_p_switch_media_bug.getCPtr(bug), SWIGTYPE_p_switch_size_t.getCPtr(readp), SWIGTYPE_p_switch_size_t.getCPtr(writep));
+  }
+
+  public static SWIGTYPE_p_void switch_core_media_bug_get_user_data(SWIGTYPE_p_switch_media_bug bug) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_media_bug_get_user_data(SWIGTYPE_p_switch_media_bug.getCPtr(bug));
+    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+    return ret;
+  }
+
+  public static switch_frame switch_core_media_bug_get_write_replace_frame(SWIGTYPE_p_switch_media_bug bug) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_media_bug_get_write_replace_frame(SWIGTYPE_p_switch_media_bug.getCPtr(bug));
+    switch_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_frame(cPtr, false);
+    return ret;
+  }
+
+  public static void switch_core_media_bug_set_write_replace_frame(SWIGTYPE_p_switch_media_bug bug, switch_frame frame) {
+    freeswitchPINVOKE.switch_core_media_bug_set_write_replace_frame(SWIGTYPE_p_switch_media_bug.getCPtr(bug), switch_frame.getCPtr(frame));
+  }
+
+  public static switch_frame switch_core_media_bug_get_read_replace_frame(SWIGTYPE_p_switch_media_bug bug) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_media_bug_get_read_replace_frame(SWIGTYPE_p_switch_media_bug.getCPtr(bug));
+    switch_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_frame(cPtr, false);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_core_session switch_core_media_bug_get_session(SWIGTYPE_p_switch_media_bug bug) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_media_bug_get_session(SWIGTYPE_p_switch_media_bug.getCPtr(bug));
+    SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
+    return ret;
+  }
+
+  public static uint switch_core_media_bug_test_flag(SWIGTYPE_p_switch_media_bug bug, uint flag) {
+    uint ret = freeswitchPINVOKE.switch_core_media_bug_test_flag(SWIGTYPE_p_switch_media_bug.getCPtr(bug), flag);
+    return ret;
+  }
+
+  public static uint switch_core_media_bug_set_flag(SWIGTYPE_p_switch_media_bug bug, uint flag) {
+    uint ret = freeswitchPINVOKE.switch_core_media_bug_set_flag(SWIGTYPE_p_switch_media_bug.getCPtr(bug), flag);
+    return ret;
+  }
+
+  public static uint switch_core_media_bug_clear_flag(SWIGTYPE_p_switch_media_bug bug, uint flag) {
+    uint ret = freeswitchPINVOKE.switch_core_media_bug_clear_flag(SWIGTYPE_p_switch_media_bug.getCPtr(bug), flag);
+    return ret;
+  }
+
+  public static void switch_core_media_bug_set_read_replace_frame(SWIGTYPE_p_switch_media_bug bug, switch_frame frame) {
+    freeswitchPINVOKE.switch_core_media_bug_set_read_replace_frame(SWIGTYPE_p_switch_media_bug.getCPtr(bug), switch_frame.getCPtr(frame));
+  }
+
+  public static switch_status_t switch_core_media_bug_remove(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_media_bug bug) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_remove(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_media_bug.getCPtr(bug));
+    return ret;
+  }
+
+  public static uint switch_core_media_bug_prune(SWIGTYPE_p_switch_core_session session) {
+    uint ret = freeswitchPINVOKE.switch_core_media_bug_prune(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_media_bug_remove_callback(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t callback) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_remove_callback(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t.getCPtr(callback));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_media_bug_close(SWIGTYPE_p_p_switch_media_bug bug) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_close(SWIGTYPE_p_p_switch_media_bug.getCPtr(bug));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_media_bug_remove_all(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_remove_all(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_media_bug_read(SWIGTYPE_p_switch_media_bug bug, switch_frame frame, switch_bool_t fill) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_read(SWIGTYPE_p_switch_media_bug.getCPtr(bug), switch_frame.getCPtr(frame), (int)fill);
+    return ret;
+  }
+
+  public static void switch_core_media_bug_flush(SWIGTYPE_p_switch_media_bug bug) {
+    freeswitchPINVOKE.switch_core_media_bug_flush(SWIGTYPE_p_switch_media_bug.getCPtr(bug));
+  }
+
+  public static switch_status_t switch_core_media_bug_flush_all(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_media_bug_flush_all(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_port_allocator_new(ushort start, ushort end, uint flags, SWIGTYPE_p_p_switch_core_port_allocator new_allocator) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_port_allocator_new(start, end, flags, SWIGTYPE_p_p_switch_core_port_allocator.getCPtr(new_allocator));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_port_allocator_request_port(SWIGTYPE_p_switch_core_port_allocator alloc, SWIGTYPE_p_unsigned_short port_ptr) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_port_allocator_request_port(SWIGTYPE_p_switch_core_port_allocator.getCPtr(alloc), SWIGTYPE_p_unsigned_short.getCPtr(port_ptr));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_port_allocator_free_port(SWIGTYPE_p_switch_core_port_allocator alloc, ushort port) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_port_allocator_free_port(SWIGTYPE_p_switch_core_port_allocator.getCPtr(alloc), port);
+    return ret;
+  }
+
+  public static void switch_core_port_allocator_destroy(SWIGTYPE_p_p_switch_core_port_allocator alloc) {
+    freeswitchPINVOKE.switch_core_port_allocator_destroy(SWIGTYPE_p_p_switch_core_port_allocator.getCPtr(alloc));
+  }
+
+  public static switch_status_t switch_core_init(uint flags, switch_bool_t console, ref string err) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_init(flags, (int)console, ref err);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_init_and_modload(uint flags, switch_bool_t console, ref string err) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_init_and_modload(flags, (int)console, ref err);
+    return ret;
+  }
+
+  public static uint switch_core_session_limit(uint new_limit) {
+    uint ret = freeswitchPINVOKE.switch_core_session_limit(new_limit);
+    return ret;
+  }
+
+  public static uint switch_core_sessions_per_second(uint new_limit) {
+    uint ret = freeswitchPINVOKE.switch_core_sessions_per_second(new_limit);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_destroy() {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_destroy();
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_read_lock(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_read_lock(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_read_lock_hangup(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_read_lock_hangup(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static void switch_core_session_write_lock(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_session_write_lock(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static void switch_core_session_rwunlock(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_session_rwunlock(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static int switch_core_add_state_handler(switch_state_handler_table state_handler) {
+    int ret = freeswitchPINVOKE.switch_core_add_state_handler(switch_state_handler_table.getCPtr(state_handler));
+    return ret;
+  }
+
+  public static void switch_core_remove_state_handler(switch_state_handler_table state_handler) {
+    freeswitchPINVOKE.switch_core_remove_state_handler(switch_state_handler_table.getCPtr(state_handler));
+  }
+
+  public static switch_state_handler_table switch_core_get_state_handler(int index) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_get_state_handler(index);
+    switch_state_handler_table ret = (cPtr == IntPtr.Zero) ? null : new switch_state_handler_table(cPtr, false);
+    return ret;
+  }
+
+  public static void switch_core_memory_pool_tag(SWIGTYPE_p_apr_pool_t pool, string tag) {
+    freeswitchPINVOKE.switch_core_memory_pool_tag(SWIGTYPE_p_apr_pool_t.getCPtr(pool), tag);
+  }
+
+  public static switch_status_t switch_core_perform_new_memory_pool(SWIGTYPE_p_p_apr_pool_t pool, string file, string func, int line) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_perform_new_memory_pool(SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), file, func, line);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_perform_destroy_memory_pool(SWIGTYPE_p_p_apr_pool_t pool, string file, string func, int line) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_perform_destroy_memory_pool(SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), file, func, line);
+    return ret;
+  }
+
+  public static void switch_core_memory_pool_set_data(SWIGTYPE_p_apr_pool_t pool, string key, SWIGTYPE_p_void data) {
+    freeswitchPINVOKE.switch_core_memory_pool_set_data(SWIGTYPE_p_apr_pool_t.getCPtr(pool), key, SWIGTYPE_p_void.getCPtr(data));
+  }
+
+  public static SWIGTYPE_p_void switch_core_memory_pool_get_data(SWIGTYPE_p_apr_pool_t pool, string key) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_memory_pool_get_data(SWIGTYPE_p_apr_pool_t.getCPtr(pool), key);
+    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+    return ret;
+  }
+
+  public static void switch_core_session_run(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_session_run(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static uint switch_core_session_running(SWIGTYPE_p_switch_core_session session) {
+    uint ret = freeswitchPINVOKE.switch_core_session_running(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static SWIGTYPE_p_void switch_core_perform_permanent_alloc(SWIGTYPE_p_switch_size_t memory, string file, string func, int line) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_perform_permanent_alloc(SWIGTYPE_p_switch_size_t.getCPtr(memory), file, func, line);
+    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static SWIGTYPE_p_void switch_core_perform_alloc(SWIGTYPE_p_apr_pool_t pool, SWIGTYPE_p_switch_size_t memory, string file, string func, int line) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_perform_alloc(SWIGTYPE_p_apr_pool_t.getCPtr(pool), SWIGTYPE_p_switch_size_t.getCPtr(memory), file, func, line);
+    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static SWIGTYPE_p_void switch_core_perform_session_alloc(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_size_t memory, string file, string func, int line) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_perform_session_alloc(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_size_t.getCPtr(memory), file, func, line);
+    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static string switch_core_perform_permanent_strdup(string todup, string file, string func, int line) {
+    string ret = freeswitchPINVOKE.switch_core_perform_permanent_strdup(todup, file, func, line);
+    return ret;
+  }
+
+  public static string switch_core_perform_session_strdup(SWIGTYPE_p_switch_core_session session, string todup, string file, string func, int line) {
+    string ret = freeswitchPINVOKE.switch_core_perform_session_strdup(SWIGTYPE_p_switch_core_session.getCPtr(session), todup, file, func, line);
+    return ret;
+  }
+
+  public static string switch_core_perform_strdup(SWIGTYPE_p_apr_pool_t pool, string todup, string file, string func, int line) {
+    string ret = freeswitchPINVOKE.switch_core_perform_strdup(SWIGTYPE_p_apr_pool_t.getCPtr(pool), todup, file, func, line);
+    return ret;
+  }
+
+  public static string switch_core_session_sprintf(SWIGTYPE_p_switch_core_session session, string fmt) {
+    string ret = freeswitchPINVOKE.switch_core_session_sprintf(SWIGTYPE_p_switch_core_session.getCPtr(session), fmt);
+    return ret;
+  }
+
+  public static string switch_core_sprintf(SWIGTYPE_p_apr_pool_t pool, string fmt) {
+    string ret = freeswitchPINVOKE.switch_core_sprintf(SWIGTYPE_p_apr_pool_t.getCPtr(pool), fmt);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_apr_pool_t switch_core_session_get_pool(SWIGTYPE_p_switch_core_session session) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_pool(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_core_session switch_core_session_request_xml(switch_endpoint_interface endpoint_interface, SWIGTYPE_p_p_apr_pool_t pool, switch_xml xml) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_request_xml(switch_endpoint_interface.getCPtr(endpoint_interface), SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), switch_xml.getCPtr(xml));
+    SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_core_session switch_core_session_request_uuid(switch_endpoint_interface endpoint_interface, switch_call_direction_t direction, SWIGTYPE_p_p_apr_pool_t pool, string use_uuid) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_request_uuid(switch_endpoint_interface.getCPtr(endpoint_interface), (int)direction, SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), use_uuid);
+    SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_set_uuid(SWIGTYPE_p_switch_core_session session, string use_uuid) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_uuid(SWIGTYPE_p_switch_core_session.getCPtr(session), use_uuid);
+    return ret;
+  }
+
+  public static void switch_core_session_perform_destroy(SWIGTYPE_p_p_switch_core_session session, string file, string func, int line) {
+    freeswitchPINVOKE.switch_core_session_perform_destroy(SWIGTYPE_p_p_switch_core_session.getCPtr(session), file, func, line);
+  }
+
+  public static void switch_core_session_destroy_state(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_session_destroy_state(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static void switch_core_session_reporting_state(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_session_reporting_state(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static void switch_core_session_hangup_state(SWIGTYPE_p_switch_core_session session, switch_bool_t force) {
+    freeswitchPINVOKE.switch_core_session_hangup_state(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)force);
+  }
+
+  public static uint switch_core_session_count() {
+    uint ret = freeswitchPINVOKE.switch_core_session_count();
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_size_t switch_core_session_get_id(SWIGTYPE_p_switch_core_session session) {
+    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_core_session_get_id(SWIGTYPE_p_switch_core_session.getCPtr(session)), true);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_size_t switch_core_session_id() {
+    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_core_session_id(), true);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_core_session switch_core_session_request_by_name(string endpoint_name, switch_call_direction_t direction, SWIGTYPE_p_p_apr_pool_t pool) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_request_by_name(endpoint_name, (int)direction, SWIGTYPE_p_p_apr_pool_t.getCPtr(pool));
+    SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_thread_launch(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_thread_launch(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_channel switch_core_session_get_channel(SWIGTYPE_p_switch_core_session session) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_channel(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    SWIGTYPE_p_switch_channel ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_channel(cPtr, false);
+    return ret;
+  }
+
+  public static void switch_core_session_wake_session_thread(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_session_wake_session_thread(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static void switch_core_session_signal_state_change(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_session_signal_state_change(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static string switch_core_session_get_uuid(SWIGTYPE_p_switch_core_session session) {
+    string ret = freeswitchPINVOKE.switch_core_session_get_uuid(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_set_loglevel(SWIGTYPE_p_switch_core_session session, switch_log_level_t loglevel) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_loglevel(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)loglevel);
+    return ret;
+  }
+
+  public static switch_log_level_t switch_core_session_get_loglevel(SWIGTYPE_p_switch_core_session session) {
+    switch_log_level_t ret = (switch_log_level_t)freeswitchPINVOKE.switch_core_session_get_loglevel(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static string switch_core_get_uuid() {
+    string ret = freeswitchPINVOKE.switch_core_get_uuid();
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_core_session switch_core_session_locate(string uuid_str) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_locate(uuid_str);
+    SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_core_session switch_core_session_force_locate(string uuid_str) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_force_locate(uuid_str);
+    SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
+    return ret;
+  }
+
+  public static string switch_core_get_variable(string varname) {
+    string ret = freeswitchPINVOKE.switch_core_get_variable(varname);
+    return ret;
+  }
+
+  public static void switch_core_set_variable(string varname, string value) {
+    freeswitchPINVOKE.switch_core_set_variable(varname, value);
+  }
+
+  public static void switch_core_dump_variables(switch_stream_handle stream) {
+    freeswitchPINVOKE.switch_core_dump_variables(switch_stream_handle.getCPtr(stream));
+  }
+
+  public static void switch_core_session_hupall(switch_call_cause_t cause) {
+    freeswitchPINVOKE.switch_core_session_hupall((int)cause);
+  }
+
+  public static void switch_core_session_hupall_matching_var(string var_name, string var_val, switch_call_cause_t cause) {
+    freeswitchPINVOKE.switch_core_session_hupall_matching_var(var_name, var_val, (int)cause);
+  }
+
+  public static void switch_core_session_hupall_endpoint(switch_endpoint_interface endpoint_interface, switch_call_cause_t cause) {
+    freeswitchPINVOKE.switch_core_session_hupall_endpoint(switch_endpoint_interface.getCPtr(endpoint_interface), (int)cause);
+  }
+
+  public static switch_status_t switch_core_session_get_partner(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_core_session partner) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_get_partner(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_core_session.getCPtr(partner));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_message_send(string uuid_str, switch_core_session_message message) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_message_send(uuid_str, switch_core_session_message.getCPtr(message));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_queue_message(SWIGTYPE_p_switch_core_session session, switch_core_session_message message) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_queue_message(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_core_session_message.getCPtr(message));
+    return ret;
+  }
+
+  public static void switch_core_session_free_message(SWIGTYPE_p_p_switch_core_session_message message) {
+    freeswitchPINVOKE.switch_core_session_free_message(SWIGTYPE_p_p_switch_core_session_message.getCPtr(message));
+  }
+
+  public static switch_status_t switch_core_session_pass_indication(SWIGTYPE_p_switch_core_session session, switch_core_session_message_types_t indication) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_pass_indication(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)indication);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_queue_indication(SWIGTYPE_p_switch_core_session session, switch_core_session_message_types_t indication) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_queue_indication(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)indication);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_dequeue_message(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_core_session_message message) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_dequeue_message(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_core_session_message.getCPtr(message));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_flush_message(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_flush_message(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_event_send(string uuid_str, SWIGTYPE_p_p_switch_event arg1) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_event_send(uuid_str, SWIGTYPE_p_p_switch_event.getCPtr(arg1));
+    return ret;
+  }
+
+  public static switch_app_log switch_core_session_get_app_log(SWIGTYPE_p_switch_core_session session) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_app_log(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    switch_app_log ret = (cPtr == IntPtr.Zero) ? null : new switch_app_log(cPtr, false);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_exec(SWIGTYPE_p_switch_core_session session, switch_application_interface application_interface, string arg) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_exec(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_application_interface.getCPtr(application_interface), arg);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_execute_application_get_flags(SWIGTYPE_p_switch_core_session session, string app, string arg, SWIGTYPE_p_int flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_execute_application_get_flags(SWIGTYPE_p_switch_core_session.getCPtr(session), app, arg, SWIGTYPE_p_int.getCPtr(flags));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_get_app_flags(string app, SWIGTYPE_p_int flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_get_app_flags(app, SWIGTYPE_p_int.getCPtr(flags));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_execute_exten(SWIGTYPE_p_switch_core_session session, string exten, string dialplan, string context) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_execute_exten(SWIGTYPE_p_switch_core_session.getCPtr(session), exten, dialplan, context);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_receive_event(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_event arg1) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_receive_event(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_event.getCPtr(arg1));
+    return ret;
+  }
+
+  public static SWIGTYPE_p_void switch_core_session_get_private(SWIGTYPE_p_switch_core_session session) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_private(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_set_private(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_void private_info) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_private(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_void.getCPtr(private_info));
+    return ret;
+  }
+
+  public static int switch_core_session_add_stream(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_void private_info) {
+    int ret = freeswitchPINVOKE.switch_core_session_add_stream(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_void.getCPtr(private_info));
+    return ret;
+  }
+
+  public static SWIGTYPE_p_void switch_core_session_get_stream(SWIGTYPE_p_switch_core_session session, int index) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_stream(SWIGTYPE_p_switch_core_session.getCPtr(session), index);
+    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+    return ret;
+  }
+
+  public static int switch_core_session_get_stream_count(SWIGTYPE_p_switch_core_session session) {
+    int ret = freeswitchPINVOKE.switch_core_session_get_stream_count(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static void switch_core_session_launch_thread(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void func, SWIGTYPE_p_void obj) {
+    freeswitchPINVOKE.switch_core_session_launch_thread(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void.getCPtr(func), SWIGTYPE_p_void.getCPtr(obj));
+  }
+
+  public static void switch_core_thread_session_end(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_thread_session_end(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static void switch_core_service_session(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_service_session(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static switch_call_cause_t switch_core_session_outgoing_channel(SWIGTYPE_p_switch_core_session session, switch_event var_event, string endpoint_name, switch_caller_profile caller_profile, SWIGTYPE_p_p_switch_core_session new_session, SWIGTYPE_p_p_apr_pool_t pool, uint flags, SWIGTYPE_p_switch_call_cause_t cancel_cause) {
+    switch_call_cause_t ret = (switch_call_cause_t)freeswitchPINVOKE.switch_core_session_outgoing_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_event.getCPtr(var_event), endpoint_name, switch_caller_profile.getCPtr(caller_profile), SWIGTYPE_p_p_switch_core_session.getCPtr(new_session), SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), flags, SWIGTYPE_p_switch_call_cause_t.getCPtr(cancel_cause));
+    return ret;
+  }
+
+  public static switch_call_cause_t switch_core_session_resurrect_channel(string endpoint_name, SWIGTYPE_p_p_switch_core_session new_session, SWIGTYPE_p_p_apr_pool_t pool, SWIGTYPE_p_void data) {
+    switch_call_cause_t ret = (switch_call_cause_t)freeswitchPINVOKE.switch_core_session_resurrect_channel(endpoint_name, SWIGTYPE_p_p_switch_core_session.getCPtr(new_session), SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), SWIGTYPE_p_void.getCPtr(data));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_perform_receive_message(SWIGTYPE_p_switch_core_session session, switch_core_session_message message, string file, string func, int line) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_perform_receive_message(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_core_session_message.getCPtr(message), file, func, line);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_queue_event(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_event arg1) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_queue_event(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_event.getCPtr(arg1));
+    return ret;
+  }
+
+  public static uint switch_core_session_event_count(SWIGTYPE_p_switch_core_session session) {
+    uint ret = freeswitchPINVOKE.switch_core_session_event_count(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_dequeue_event(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_event arg1, switch_bool_t force) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_dequeue_event(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_event.getCPtr(arg1), (int)force);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_queue_private_event(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_event arg1, switch_bool_t priority) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_queue_private_event(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_event.getCPtr(arg1), (int)priority);
+    return ret;
+  }
+
+  public static uint switch_core_session_private_event_count(SWIGTYPE_p_switch_core_session session) {
+    uint ret = freeswitchPINVOKE.switch_core_session_private_event_count(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_dequeue_private_event(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_event arg1) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_dequeue_private_event(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_event.getCPtr(arg1));
+    return ret;
+  }
+
+  public static uint switch_core_session_flush_private_events(SWIGTYPE_p_switch_core_session session) {
+    uint ret = freeswitchPINVOKE.switch_core_session_flush_private_events(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_frame frame, uint flags, int stream_id) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_frame.getCPtr(frame), flags, stream_id);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_read_video_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_frame frame, uint flags, int stream_id) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_read_video_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_frame.getCPtr(frame), flags, stream_id);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_write_video_frame(SWIGTYPE_p_switch_core_session session, switch_frame frame, uint flags, int stream_id) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_write_video_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_frame.getCPtr(frame), flags, stream_id);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_set_read_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_read_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_set_write_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_write_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_set_video_read_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_video_read_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_set_video_write_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_video_write_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp));
+    return ret;
+  }
+
+  public static void switch_core_session_reset(SWIGTYPE_p_switch_core_session session, switch_bool_t flush_dtmf, switch_bool_t reset_read_codec) {
+    freeswitchPINVOKE.switch_core_session_reset(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)flush_dtmf, (int)reset_read_codec);
+  }
+
+  public static switch_status_t switch_core_session_write_frame(SWIGTYPE_p_switch_core_session session, switch_frame frame, uint flags, int stream_id) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_write_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_frame.getCPtr(frame), flags, stream_id);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_perform_kill_channel(SWIGTYPE_p_switch_core_session session, string file, string func, int line, switch_signal_t sig) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_perform_kill_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), file, func, line, (int)sig);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_send_dtmf(SWIGTYPE_p_switch_core_session session, switch_dtmf_t dtmf) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_send_dtmf(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_dtmf_t.getCPtr(dtmf));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_send_dtmf_string(SWIGTYPE_p_switch_core_session session, string dtmf_string) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_send_dtmf_string(SWIGTYPE_p_switch_core_session.getCPtr(session), dtmf_string);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_recv_dtmf(SWIGTYPE_p_switch_core_session session, switch_dtmf_t dtmf) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_recv_dtmf(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_dtmf_t.getCPtr(dtmf));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_hash_init_case(SWIGTYPE_p_p_switch_hash hash, SWIGTYPE_p_apr_pool_t pool, switch_bool_t case_sensitive) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_hash_init_case(SWIGTYPE_p_p_switch_hash.getCPtr(hash), SWIGTYPE_p_apr_pool_t.getCPtr(pool), (int)case_sensitive);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_hash_destroy(SWIGTYPE_p_p_switch_hash hash) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_hash_destroy(SWIGTYPE_p_p_switch_hash.getCPtr(hash));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_hash_insert(SWIGTYPE_p_switch_hash hash, string key, SWIGTYPE_p_void data) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_hash_insert(SWIGTYPE_p_switch_hash.getCPtr(hash), key, SWIGTYPE_p_void.getCPtr(data));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_hash_insert_locked(SWIGTYPE_p_switch_hash hash, string key, SWIGTYPE_p_void data, SWIGTYPE_p_switch_mutex_t mutex) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_hash_insert_locked(SWIGTYPE_p_switch_hash.getCPtr(hash), key, SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_mutex_t.getCPtr(mutex));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_hash_delete(SWIGTYPE_p_switch_hash hash, string key) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_hash_delete(SWIGTYPE_p_switch_hash.getCPtr(hash), key);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_hash_delete_locked(SWIGTYPE_p_switch_hash hash, string key, SWIGTYPE_p_switch_mutex_t mutex) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_hash_delete_locked(SWIGTYPE_p_switch_hash.getCPtr(hash), key, SWIGTYPE_p_switch_mutex_t.getCPtr(mutex));
+    return ret;
+  }
+
+  public static SWIGTYPE_p_void switch_core_hash_find(SWIGTYPE_p_switch_hash hash, string key) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_hash_find(SWIGTYPE_p_switch_hash.getCPtr(hash), key);
+    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_void switch_core_hash_find_locked(SWIGTYPE_p_switch_hash hash, string key, SWIGTYPE_p_switch_mutex_t mutex) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_hash_find_locked(SWIGTYPE_p_switch_hash.getCPtr(hash), key, SWIGTYPE_p_switch_mutex_t.getCPtr(mutex));
+    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_HashElem switch_hash_first(string depricate_me, SWIGTYPE_p_switch_hash hash) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_hash_first(depricate_me, SWIGTYPE_p_switch_hash.getCPtr(hash));
+    SWIGTYPE_p_HashElem ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_HashElem(cPtr, false);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_HashElem switch_hash_next(SWIGTYPE_p_HashElem hi) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_hash_next(SWIGTYPE_p_HashElem.getCPtr(hi));
+    SWIGTYPE_p_HashElem ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_HashElem(cPtr, false);
+    return ret;
+  }
+
+  public static void switch_hash_this(SWIGTYPE_p_HashElem hi, SWIGTYPE_p_p_void key, SWIGTYPE_p_switch_ssize_t klen, SWIGTYPE_p_p_void val) {
+    freeswitchPINVOKE.switch_hash_this(SWIGTYPE_p_HashElem.getCPtr(hi), SWIGTYPE_p_p_void.getCPtr(key), SWIGTYPE_p_switch_ssize_t.getCPtr(klen), SWIGTYPE_p_p_void.getCPtr(val));
+  }
+
+  public static switch_status_t switch_core_timer_init(switch_timer timer, string timer_name, int interval, int samples, SWIGTYPE_p_apr_pool_t pool) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_timer_init(switch_timer.getCPtr(timer), timer_name, interval, samples, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+    return ret;
+  }
+
+  public static void switch_time_calibrate_clock() {
+    freeswitchPINVOKE.switch_time_calibrate_clock();
+  }
+
+  public static switch_status_t switch_core_timer_next(switch_timer timer) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_timer_next(switch_timer.getCPtr(timer));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_timer_step(switch_timer timer) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_timer_step(switch_timer.getCPtr(timer));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_timer_sync(switch_timer timer) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_timer_sync(switch_timer.getCPtr(timer));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_timer_check(switch_timer timer, switch_bool_t step) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_timer_check(switch_timer.getCPtr(timer), (int)step);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_timer_destroy(switch_timer timer) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_timer_destroy(switch_timer.getCPtr(timer));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_codec_init(switch_codec codec, string codec_name, string fmtp, uint rate, int ms, int channels, uint flags, switch_codec_settings codec_settings, SWIGTYPE_p_apr_pool_t pool) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_init(switch_codec.getCPtr(codec), codec_name, fmtp, rate, ms, channels, flags, switch_codec_settings.getCPtr(codec_settings), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_codec_copy(switch_codec codec, switch_codec new_codec, SWIGTYPE_p_apr_pool_t pool) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_copy(switch_codec.getCPtr(codec), switch_codec.getCPtr(new_codec), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_codec_encode(switch_codec codec, switch_codec other_codec, SWIGTYPE_p_void decoded_data, uint decoded_data_len, uint decoded_rate, SWIGTYPE_p_void encoded_data, SWIGTYPE_p_unsigned_long encoded_data_len, SWIGTYPE_p_unsigned_long encoded_rate, SWIGTYPE_p_unsigned_int flag) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_encode(switch_codec.getCPtr(codec), switch_codec.getCPtr(other_codec), SWIGTYPE_p_void.getCPtr(decoded_data), decoded_data_len, decoded_rate, SWIGTYPE_p_void.getCPtr(encoded_data), SWIGTYPE_p_unsigned_long.getCPtr(encoded_data_len), SWIGTYPE_p_unsigned_long.getCPtr(encoded_rate), SWIGTYPE_p_unsigned_int.getCPtr(flag));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_codec_decode(switch_codec codec, switch_codec other_codec, SWIGTYPE_p_void encoded_data, uint encoded_data_len, uint encoded_rate, SWIGTYPE_p_void decoded_data, SWIGTYPE_p_unsigned_long decoded_data_len, SWIGTYPE_p_unsigned_long decoded_rate, SWIGTYPE_p_unsigned_int flag) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_decode(switch_codec.getCPtr(codec), switch_codec.getCPtr(other_codec), SWIGTYPE_p_void.getCPtr(encoded_data), encoded_data_len, encoded_rate, SWIGTYPE_p_void.getCPtr(decoded_data), SWIGTYPE_p_unsigned_long.getCPtr(decoded_data_len), SWIGTYPE_p_unsigned_long.getCPtr(decoded_rate), SWIGTYPE_p_unsigned_int.getCPtr(flag));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_codec_destroy(switch_codec codec) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_destroy(switch_codec.getCPtr(codec));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_set_read_codec(SWIGTYPE_p_switch_core_session session, switch_codec codec) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_read_codec(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec.getCPtr(codec));
+    return ret;
+  }
+
+  public static void switch_core_session_unset_read_codec(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_session_unset_read_codec(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static void switch_core_session_unset_write_codec(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_session_unset_write_codec(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static void switch_core_session_lock_codec_write(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_session_lock_codec_write(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static void switch_core_session_unlock_codec_write(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_session_unlock_codec_write(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static void switch_core_session_lock_codec_read(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_session_lock_codec_read(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static void switch_core_session_unlock_codec_read(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_core_session_unlock_codec_read(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static switch_status_t switch_core_session_get_read_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_get_read_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_get_write_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_get_write_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_get_video_read_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_get_video_read_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_get_video_write_impl(SWIGTYPE_p_switch_core_session session, switch_codec_implementation impp) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_get_video_write_impl(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec_implementation.getCPtr(impp));
+    return ret;
+  }
+
+  public static switch_codec switch_core_session_get_read_codec(SWIGTYPE_p_switch_core_session session) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_read_codec(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    switch_codec ret = (cPtr == IntPtr.Zero) ? null : new switch_codec(cPtr, false);
+    return ret;
+  }
+
+  public static switch_codec switch_core_session_get_effective_read_codec(SWIGTYPE_p_switch_core_session session) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_effective_read_codec(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    switch_codec ret = (cPtr == IntPtr.Zero) ? null : new switch_codec(cPtr, false);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_set_write_codec(SWIGTYPE_p_switch_core_session session, switch_codec codec) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_write_codec(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec.getCPtr(codec));
+    return ret;
+  }
+
+  public static switch_codec switch_core_session_get_write_codec(SWIGTYPE_p_switch_core_session session) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_write_codec(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    switch_codec ret = (cPtr == IntPtr.Zero) ? null : new switch_codec(cPtr, false);
+    return ret;
+  }
+
+  public static switch_codec switch_core_session_get_effective_write_codec(SWIGTYPE_p_switch_core_session session) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_effective_write_codec(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    switch_codec ret = (cPtr == IntPtr.Zero) ? null : new switch_codec(cPtr, false);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_set_video_read_codec(SWIGTYPE_p_switch_core_session session, switch_codec codec) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_video_read_codec(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec.getCPtr(codec));
+    return ret;
+  }
+
+  public static switch_codec switch_core_session_get_video_read_codec(SWIGTYPE_p_switch_core_session session) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_video_read_codec(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    switch_codec ret = (cPtr == IntPtr.Zero) ? null : new switch_codec(cPtr, false);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_session_set_video_write_codec(SWIGTYPE_p_switch_core_session session, switch_codec codec) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_session_set_video_write_codec(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec.getCPtr(codec));
+    return ret;
+  }
+
+  public static switch_codec switch_core_session_get_video_write_codec(SWIGTYPE_p_switch_core_session session) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_video_write_codec(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    switch_codec ret = (cPtr == IntPtr.Zero) ? null : new switch_codec(cPtr, false);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_sqlite3 switch_core_db_open_file(string filename) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_db_open_file(filename);
+    SWIGTYPE_p_sqlite3 ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_sqlite3(cPtr, false);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_db_persistant_execute(SWIGTYPE_p_sqlite3 db, string sql, uint retries) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_db_persistant_execute(SWIGTYPE_p_sqlite3.getCPtr(db), sql, retries);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_db_persistant_execute_trans(SWIGTYPE_p_sqlite3 db, string sql, uint retries) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_db_persistant_execute_trans(SWIGTYPE_p_sqlite3.getCPtr(db), sql, retries);
+    return ret;
+  }
+
+  public static void switch_core_db_test_reactive(SWIGTYPE_p_sqlite3 db, string test_sql, string drop_sql, string reactive_sql) {
+    freeswitchPINVOKE.switch_core_db_test_reactive(SWIGTYPE_p_sqlite3.getCPtr(db), test_sql, drop_sql, reactive_sql);
+  }
+
+  public static switch_status_t switch_core_perform_file_open(string file, string func, int line, switch_file_handle fh, string file_path, byte channels, uint rate, uint flags, SWIGTYPE_p_apr_pool_t pool) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_perform_file_open(file, func, line, switch_file_handle.getCPtr(fh), file_path, channels, rate, flags, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_file_read(switch_file_handle fh, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t len) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_file_read(switch_file_handle.getCPtr(fh), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(len));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_file_write(switch_file_handle fh, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t len) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_file_write(switch_file_handle.getCPtr(fh), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(len));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_file_seek(switch_file_handle fh, SWIGTYPE_p_unsigned_int cur_pos, long samples, int whence) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_file_seek(switch_file_handle.getCPtr(fh), SWIGTYPE_p_unsigned_int.getCPtr(cur_pos), samples, whence);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_file_set_string(switch_file_handle fh, switch_audio_col_t col, string arg2) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_file_set_string(switch_file_handle.getCPtr(fh), (int)col, arg2);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_file_get_string(switch_file_handle fh, switch_audio_col_t col, ref string arg2) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_file_get_string(switch_file_handle.getCPtr(fh), (int)col, ref arg2);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_file_close(switch_file_handle fh) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_file_close(switch_file_handle.getCPtr(fh));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_file_truncate(switch_file_handle fh, long offset) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_file_truncate(switch_file_handle.getCPtr(fh), offset);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_speech_open(switch_speech_handle sh, string module_name, string voice_name, uint rate, uint interval, SWIGTYPE_p_unsigned_long flags, SWIGTYPE_p_apr_pool_t pool) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_open(switch_speech_handle.getCPtr(sh), module_name, voice_name, rate, interval, SWIGTYPE_p_unsigned_long.getCPtr(flags), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_speech_feed_tts(switch_speech_handle sh, string text, SWIGTYPE_p_unsigned_long flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_feed_tts(switch_speech_handle.getCPtr(sh), text, SWIGTYPE_p_unsigned_long.getCPtr(flags));
+    return ret;
+  }
+
+  public static void switch_core_speech_flush_tts(switch_speech_handle sh) {
+    freeswitchPINVOKE.switch_core_speech_flush_tts(switch_speech_handle.getCPtr(sh));
+  }
+
+  public static void switch_core_speech_text_param_tts(switch_speech_handle sh, string param, string val) {
+    freeswitchPINVOKE.switch_core_speech_text_param_tts(switch_speech_handle.getCPtr(sh), param, val);
+  }
+
+  public static void switch_core_speech_numeric_param_tts(switch_speech_handle sh, string param, int val) {
+    freeswitchPINVOKE.switch_core_speech_numeric_param_tts(switch_speech_handle.getCPtr(sh), param, val);
+  }
+
+  public static void switch_core_speech_float_param_tts(switch_speech_handle sh, string param, double val) {
+    freeswitchPINVOKE.switch_core_speech_float_param_tts(switch_speech_handle.getCPtr(sh), param, val);
+  }
+
+  public static switch_status_t switch_core_speech_read_tts(switch_speech_handle sh, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen, SWIGTYPE_p_unsigned_long flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_read_tts(switch_speech_handle.getCPtr(sh), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen), SWIGTYPE_p_unsigned_long.getCPtr(flags));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_speech_close(switch_speech_handle sh, SWIGTYPE_p_unsigned_long flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_close(switch_speech_handle.getCPtr(sh), SWIGTYPE_p_unsigned_long.getCPtr(flags));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_asr_open(switch_asr_handle ah, string module_name, string codec, int rate, string dest, SWIGTYPE_p_unsigned_long flags, SWIGTYPE_p_apr_pool_t pool) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_open(switch_asr_handle.getCPtr(ah), module_name, codec, rate, dest, SWIGTYPE_p_unsigned_long.getCPtr(flags), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_asr_close(switch_asr_handle ah, SWIGTYPE_p_unsigned_long flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_close(switch_asr_handle.getCPtr(ah), SWIGTYPE_p_unsigned_long.getCPtr(flags));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_asr_feed(switch_asr_handle ah, SWIGTYPE_p_void data, uint len, SWIGTYPE_p_unsigned_long flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_feed(switch_asr_handle.getCPtr(ah), SWIGTYPE_p_void.getCPtr(data), len, SWIGTYPE_p_unsigned_long.getCPtr(flags));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_asr_check_results(switch_asr_handle ah, SWIGTYPE_p_unsigned_long flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_check_results(switch_asr_handle.getCPtr(ah), SWIGTYPE_p_unsigned_long.getCPtr(flags));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_asr_get_results(switch_asr_handle ah, ref string xmlstr, SWIGTYPE_p_unsigned_long flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_get_results(switch_asr_handle.getCPtr(ah), ref xmlstr, SWIGTYPE_p_unsigned_long.getCPtr(flags));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_asr_load_grammar(switch_asr_handle ah, string grammar, string name) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_load_grammar(switch_asr_handle.getCPtr(ah), grammar, name);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_asr_unload_grammar(switch_asr_handle ah, string name) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_unload_grammar(switch_asr_handle.getCPtr(ah), name);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_asr_pause(switch_asr_handle ah) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_pause(switch_asr_handle.getCPtr(ah));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_asr_resume(switch_asr_handle ah) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_resume(switch_asr_handle.getCPtr(ah));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_asr_start_input_timers(switch_asr_handle ah) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_start_input_timers(switch_asr_handle.getCPtr(ah));
+    return ret;
+  }
+
+  public static void switch_core_asr_text_param(switch_asr_handle ah, string param, string val) {
+    freeswitchPINVOKE.switch_core_asr_text_param(switch_asr_handle.getCPtr(ah), param, val);
+  }
+
+  public static void switch_core_asr_numeric_param(switch_asr_handle ah, string param, int val) {
+    freeswitchPINVOKE.switch_core_asr_numeric_param(switch_asr_handle.getCPtr(ah), param, val);
+  }
+
+  public static void switch_core_asr_float_param(switch_asr_handle ah, string param, double val) {
+    freeswitchPINVOKE.switch_core_asr_float_param(switch_asr_handle.getCPtr(ah), param, val);
+  }
+
+  public static switch_status_t switch_core_directory_open(switch_directory_handle dh, string module_name, string source, string dsn, string passwd, SWIGTYPE_p_apr_pool_t pool) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_directory_open(switch_directory_handle.getCPtr(dh), module_name, source, dsn, passwd, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_directory_query(switch_directory_handle dh, string arg1, string query) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_directory_query(switch_directory_handle.getCPtr(dh), arg1, query);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_directory_next(switch_directory_handle dh) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_directory_next(switch_directory_handle.getCPtr(dh));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_directory_next_pair(switch_directory_handle dh, ref string var, ref string val) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_directory_next_pair(switch_directory_handle.getCPtr(dh), ref var, ref val);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_directory_close(switch_directory_handle dh) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_directory_close(switch_directory_handle.getCPtr(dh));
+    return ret;
+  }
+
+  public static SWIGTYPE_p_FILE switch_core_data_channel(switch_text_channel_t channel) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_data_channel((int)channel);
+    SWIGTYPE_p_FILE ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_FILE(cPtr, false);
+    return ret;
+  }
+
+  public static switch_bool_t switch_core_ready() {
+    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_core_ready();
+    return ret;
+  }
+
+  public static uint switch_core_flags() {
+    uint ret = freeswitchPINVOKE.switch_core_flags();
+    return ret;
+  }
+
+  public static switch_status_t switch_core_management_exec(string relative_oid, switch_management_action_t action, string data, SWIGTYPE_p_switch_size_t datalen) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_management_exec(relative_oid, (int)action, data, SWIGTYPE_p_switch_size_t.getCPtr(datalen));
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static int set_high_priority() {
+    int ret = freeswitchPINVOKE.set_high_priority();
+    return ret;
+  }
+
+  public static int change_user_group(string user, string group) {
+    int ret = freeswitchPINVOKE.change_user_group(user, group);
+    return ret;
+  }
+
+  public static void switch_core_runtime_loop(int bg) {
+    freeswitchPINVOKE.switch_core_runtime_loop(bg);
+  }
+
+  public static switch_status_t switch_core_set_console(string console) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_set_console(console);
+    return ret;
+  }
+
+  public static void switch_core_measure_time(SWIGTYPE_p_switch_time_t total_ms, switch_core_time_duration duration) {
+    freeswitchPINVOKE.switch_core_measure_time(SWIGTYPE_p_switch_time_t.getCPtr(total_ms), switch_core_time_duration.getCPtr(duration));
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+  }
+
+  public static SWIGTYPE_p_switch_time_t switch_core_uptime() {
+    SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_core_uptime(), true);
+    return ret;
+  }
+
+  public static int switch_core_session_ctl(switch_session_ctl_t cmd, SWIGTYPE_p_int val) {
+    int ret = freeswitchPINVOKE.switch_core_session_ctl((int)cmd, SWIGTYPE_p_int.getCPtr(val));
+    return ret;
+  }
+
+  public static SWIGTYPE_p_FILE switch_core_get_console() {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_get_console();
+    SWIGTYPE_p_FILE ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_FILE(cPtr, false);
+    return ret;
+  }
+
+  public static void switch_core_set_globals() {
+    freeswitchPINVOKE.switch_core_set_globals();
+  }
+
+  public static byte switch_core_session_compare(SWIGTYPE_p_switch_core_session a, SWIGTYPE_p_switch_core_session b) {
+    byte ret = freeswitchPINVOKE.switch_core_session_compare(SWIGTYPE_p_switch_core_session.getCPtr(a), SWIGTYPE_p_switch_core_session.getCPtr(b));
+    return ret;
+  }
+
+  public static byte switch_core_session_check_interface(SWIGTYPE_p_switch_core_session session, switch_endpoint_interface endpoint_interface) {
+    byte ret = freeswitchPINVOKE.switch_core_session_check_interface(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_endpoint_interface.getCPtr(endpoint_interface));
+    return ret;
+  }
+
+  public static SWIGTYPE_p_HashElem switch_core_mime_index() {
+    IntPtr cPtr = freeswitchPINVOKE.switch_core_mime_index();
+    SWIGTYPE_p_HashElem ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_HashElem(cPtr, false);
+    return ret;
+  }
+
+  public static string switch_core_mime_ext2type(string ext) {
+    string ret = freeswitchPINVOKE.switch_core_mime_ext2type(ext);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_mime_add_type(string type, string ext) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_mime_add_type(type, ext);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_loadable_module_interface switch_loadable_module_create_module_interface(SWIGTYPE_p_apr_pool_t pool, string name) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_create_module_interface(SWIGTYPE_p_apr_pool_t.getCPtr(pool), name);
+    SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_void switch_loadable_module_create_interface(SWIGTYPE_p_switch_loadable_module_interface mod, switch_module_interface_name_t iname) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_create_interface(SWIGTYPE_p_switch_loadable_module_interface.getCPtr(mod), (int)iname);
+    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_time_t switch_micro_time_now() {
+    SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_micro_time_now(), true);
+    return ret;
+  }
+
+  public static void switch_core_memory_reclaim() {
+    freeswitchPINVOKE.switch_core_memory_reclaim();
+  }
+
+  public static void switch_core_memory_reclaim_events() {
+    freeswitchPINVOKE.switch_core_memory_reclaim_events();
+  }
+
+  public static void switch_core_memory_reclaim_logger() {
+    freeswitchPINVOKE.switch_core_memory_reclaim_logger();
+  }
+
+  public static void switch_core_memory_reclaim_all() {
+    freeswitchPINVOKE.switch_core_memory_reclaim_all();
+  }
+
+  public static void switch_core_setrlimits() {
+    freeswitchPINVOKE.switch_core_setrlimits();
+  }
+
+  public static void switch_time_sync() {
+    freeswitchPINVOKE.switch_time_sync();
+  }
+
+  public static SWIGTYPE_p_time_t switch_epoch_time_now(SWIGTYPE_p_time_t t) {
+    SWIGTYPE_p_time_t ret = new SWIGTYPE_p_time_t(freeswitchPINVOKE.switch_epoch_time_now(SWIGTYPE_p_time_t.getCPtr(t)), true);
+    return ret;
+  }
+
+  public static switch_status_t switch_strftime_tz(string tz, string format, string date, uint len, SWIGTYPE_p_switch_time_t thetime) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_strftime_tz(tz, format, date, len, SWIGTYPE_p_switch_time_t.getCPtr(thetime));
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static switch_status_t switch_time_exp_tz_name(string tz, SWIGTYPE_p_switch_time_exp_t tm, SWIGTYPE_p_switch_time_t thetime) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_time_exp_tz_name(tz, SWIGTYPE_p_switch_time_exp_t.getCPtr(tm), SWIGTYPE_p_switch_time_t.getCPtr(thetime));
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static void switch_load_network_lists(switch_bool_t reload) {
+    freeswitchPINVOKE.switch_load_network_lists((int)reload);
+  }
+
+  public static switch_bool_t switch_check_network_list_ip_token(string ip_str, string list_name, ref string token) {
+    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_check_network_list_ip_token(ip_str, list_name, ref token);
+    return ret;
+  }
+
+  public static void switch_time_set_monotonic(switch_bool_t enable) {
+    freeswitchPINVOKE.switch_time_set_monotonic((int)enable);
+  }
+
+  public static void switch_time_set_nanosleep(switch_bool_t enable) {
+    freeswitchPINVOKE.switch_time_set_nanosleep((int)enable);
+  }
+
+  public static void switch_time_set_matrix(switch_bool_t enable) {
+    freeswitchPINVOKE.switch_time_set_matrix((int)enable);
+  }
+
+  public static void switch_time_set_cond_yield(switch_bool_t enable) {
+    freeswitchPINVOKE.switch_time_set_cond_yield((int)enable);
+  }
+
+  public static uint switch_core_min_dtmf_duration(uint duration) {
+    uint ret = freeswitchPINVOKE.switch_core_min_dtmf_duration(duration);
+    return ret;
+  }
+
+  public static uint switch_core_max_dtmf_duration(uint duration) {
+    uint ret = freeswitchPINVOKE.switch_core_max_dtmf_duration(duration);
+    return ret;
+  }
+
+  public static uint switch_core_default_dtmf_duration(uint duration) {
+    uint ret = freeswitchPINVOKE.switch_core_default_dtmf_duration(duration);
+    return ret;
+  }
+
+  public static switch_status_t switch_console_set_complete(string arg0) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_console_set_complete(arg0);
+    return ret;
+  }
+
+  public static switch_status_t switch_console_set_alias(string arg0) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_console_set_alias(arg0);
+    return ret;
+  }
+
+  public static int switch_system(string cmd, switch_bool_t wait) {
+    int ret = freeswitchPINVOKE.switch_system(cmd, (int)wait);
+    return ret;
+  }
+
+  public static void switch_cond_yield(SWIGTYPE_p_switch_interval_time_t t) {
+    freeswitchPINVOKE.switch_cond_yield(SWIGTYPE_p_switch_interval_time_t.getCPtr(t));
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+  }
+
+  public static void switch_cond_next() {
+    freeswitchPINVOKE.switch_cond_next();
+  }
+
+  public static switch_status_t switch_core_chat_send(string name, string proto, string from, string to, string subject, string body, string type, string hint) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_chat_send(name, proto, from, to, subject, body, type, hint);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_preprocess_session(SWIGTYPE_p_switch_core_session session, string cmds) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_preprocess_session(SWIGTYPE_p_switch_core_session.getCPtr(session), cmds);
+    return ret;
+  }
+
+  public static string switch_cache_db_type_name(switch_cache_db_handle_type_t type) {
+    string ret = freeswitchPINVOKE.switch_cache_db_type_name((int)type);
+    return ret;
+  }
+
+  public static void switch_cache_db_release_db_handle(SWIGTYPE_p_p_switch_cache_db_handle_t dbh) {
+    freeswitchPINVOKE.switch_cache_db_release_db_handle(SWIGTYPE_p_p_switch_cache_db_handle_t.getCPtr(dbh));
+  }
+
+  public static void switch_cache_db_destroy_db_handle(SWIGTYPE_p_p_switch_cache_db_handle_t dbh) {
+    freeswitchPINVOKE.switch_cache_db_destroy_db_handle(SWIGTYPE_p_p_switch_cache_db_handle_t.getCPtr(dbh));
+  }
+
+  public static switch_status_t _switch_cache_db_get_db_handle(SWIGTYPE_p_p_switch_cache_db_handle_t dbh, switch_cache_db_handle_type_t type, switch_cache_db_connection_options_t connection_options, string file, string func, int line) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE._switch_cache_db_get_db_handle(SWIGTYPE_p_p_switch_cache_db_handle_t.getCPtr(dbh), (int)type, switch_cache_db_connection_options_t.getCPtr(connection_options), file, func, line);
+    return ret;
+  }
+
+  public static string switch_cache_db_execute_sql2str(switch_cache_db_handle_t dbh, string sql, string str, uint len, ref string err) {
+    string ret = freeswitchPINVOKE.switch_cache_db_execute_sql2str(switch_cache_db_handle_t.getCPtr(dbh), sql, str, len, ref err);
+    return ret;
+  }
+
+  public static switch_status_t switch_cache_db_execute_sql(switch_cache_db_handle_t dbh, string sql, ref string err) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_cache_db_execute_sql(switch_cache_db_handle_t.getCPtr(dbh), sql, ref err);
+    return ret;
+  }
+
+  public static switch_status_t switch_cache_db_execute_sql_callback(switch_cache_db_handle_t dbh, string sql, SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int callback, SWIGTYPE_p_void pdata, ref string err) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_cache_db_execute_sql_callback(switch_cache_db_handle_t.getCPtr(dbh), sql, SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int.getCPtr(callback), SWIGTYPE_p_void.getCPtr(pdata), ref err);
+    return ret;
+  }
+
+  public static void switch_cache_db_status(switch_stream_handle stream) {
+    freeswitchPINVOKE.switch_cache_db_status(switch_stream_handle.getCPtr(stream));
+  }
+
+  public static switch_status_t _switch_core_db_handle(SWIGTYPE_p_p_switch_cache_db_handle_t dbh, string file, string func, int line) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE._switch_core_db_handle(SWIGTYPE_p_p_switch_cache_db_handle_t.getCPtr(dbh), file, func, line);
+    return ret;
+  }
+
+  public static switch_bool_t switch_cache_db_test_reactive(switch_cache_db_handle_t db, string test_sql, string drop_sql, string reactive_sql) {
+    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_cache_db_test_reactive(switch_cache_db_handle_t.getCPtr(db), test_sql, drop_sql, reactive_sql);
+    return ret;
+  }
+
+  public static switch_status_t switch_cache_db_persistant_execute(switch_cache_db_handle_t dbh, string sql, uint retries) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_cache_db_persistant_execute(switch_cache_db_handle_t.getCPtr(dbh), sql, retries);
+    return ret;
+  }
+
+  public static switch_status_t switch_cache_db_persistant_execute_trans(switch_cache_db_handle_t dbh, string sql, uint retries) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_cache_db_persistant_execute_trans(switch_cache_db_handle_t.getCPtr(dbh), sql, retries);
+    return ret;
+  }
+
+  public static void switch_cache_db_detach() {
+    freeswitchPINVOKE.switch_cache_db_detach();
+  }
+
+  public static uint switch_core_debug_level() {
+    uint ret = freeswitchPINVOKE.switch_core_debug_level();
+    return ret;
+  }
+
+  public static void switch_cache_db_flush_handles() {
+    freeswitchPINVOKE.switch_cache_db_flush_handles();
+  }
+
+  public static string switch_core_banner() {
+    string ret = freeswitchPINVOKE.switch_core_banner();
+    return ret;
+  }
+
+  public static switch_bool_t switch_core_session_in_thread(SWIGTYPE_p_switch_core_session session) {
+    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_core_session_in_thread(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static void switch_console_loop() {
+    freeswitchPINVOKE.switch_console_loop();
+  }
+
+  public static switch_status_t switch_console_stream_raw_write(switch_stream_handle handle, SWIGTYPE_p_unsigned_char data, SWIGTYPE_p_switch_size_t datalen) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_console_stream_raw_write(switch_stream_handle.getCPtr(handle), SWIGTYPE_p_unsigned_char.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen));
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static switch_status_t switch_stream_write_file_contents(switch_stream_handle stream, string path) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_stream_write_file_contents(switch_stream_handle.getCPtr(stream), path);
+    return ret;
+  }
+
+  public static switch_status_t switch_console_init(SWIGTYPE_p_apr_pool_t pool) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_console_init(SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+    return ret;
+  }
+
+  public static switch_status_t switch_console_shutdown() {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_console_shutdown();
+    return ret;
+  }
+
+  public static switch_status_t switch_console_add_complete_func(string name, SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_p_switch_console_callback_match__switch_status_t cb) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_console_add_complete_func(name, SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_p_switch_console_callback_match__switch_status_t.getCPtr(cb));
+    return ret;
+  }
+
+  public static switch_status_t switch_console_del_complete_func(string name) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_console_del_complete_func(name);
+    return ret;
+  }
+
+  public static switch_status_t switch_console_run_complete_func(string func, string line, string last_word, SWIGTYPE_p_p_switch_console_callback_match matches) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_console_run_complete_func(func, line, last_word, SWIGTYPE_p_p_switch_console_callback_match.getCPtr(matches));
+    return ret;
+  }
+
+  public static void switch_console_push_match(SWIGTYPE_p_p_switch_console_callback_match matches, string new_val) {
+    freeswitchPINVOKE.switch_console_push_match(SWIGTYPE_p_p_switch_console_callback_match.getCPtr(matches), new_val);
+  }
+
+  public static void switch_console_free_matches(SWIGTYPE_p_p_switch_console_callback_match matches) {
+    freeswitchPINVOKE.switch_console_free_matches(SWIGTYPE_p_p_switch_console_callback_match.getCPtr(matches));
+  }
+
+  public static byte switch_console_complete(string line, string last_word, SWIGTYPE_p_FILE console_out, switch_stream_handle stream, switch_xml xml) {
+    byte ret = freeswitchPINVOKE.switch_console_complete(line, last_word, SWIGTYPE_p_FILE.getCPtr(console_out), switch_stream_handle.getCPtr(stream), switch_xml.getCPtr(xml));
+    return ret;
+  }
+
+  public static void switch_console_sort_matches(switch_console_callback_match matches) {
+    freeswitchPINVOKE.switch_console_sort_matches(switch_console_callback_match.getCPtr(matches));
+  }
+
+  public static void switch_console_save_history() {
+    freeswitchPINVOKE.switch_console_save_history();
+  }
+
+  public static string switch_console_expand_alias(string cmd, string arg) {
+    string ret = freeswitchPINVOKE.switch_console_expand_alias(cmd, arg);
+    return ret;
+  }
+
+  public static switch_status_t switch_console_execute(string xcmd, int rec, switch_stream_handle istream) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_console_execute(xcmd, rec, switch_stream_handle.getCPtr(istream));
+    return ret;
+  }
+
+  public static int switch_toupper(int c) {
+    int ret = freeswitchPINVOKE.switch_toupper(c);
+    return ret;
+  }
+
+  public static int switch_tolower(int c) {
+    int ret = freeswitchPINVOKE.switch_tolower(c);
+    return ret;
+  }
+
+  public static int switch_isalnum(int c) {
+    int ret = freeswitchPINVOKE.switch_isalnum(c);
+    return ret;
+  }
+
+  public static int switch_isalpha(int c) {
+    int ret = freeswitchPINVOKE.switch_isalpha(c);
+    return ret;
+  }
+
+  public static int switch_iscntrl(int c) {
+    int ret = freeswitchPINVOKE.switch_iscntrl(c);
+    return ret;
+  }
+
+  public static int switch_isdigit(int c) {
+    int ret = freeswitchPINVOKE.switch_isdigit(c);
+    return ret;
+  }
+
+  public static int switch_isgraph(int c) {
+    int ret = freeswitchPINVOKE.switch_isgraph(c);
+    return ret;
+  }
+
+  public static int switch_islower(int c) {
+    int ret = freeswitchPINVOKE.switch_islower(c);
+    return ret;
+  }
+
+  public static int switch_isprint(int c) {
+    int ret = freeswitchPINVOKE.switch_isprint(c);
+    return ret;
+  }
+
+  public static int switch_ispunct(int c) {
+    int ret = freeswitchPINVOKE.switch_ispunct(c);
+    return ret;
+  }
+
+  public static int switch_isspace(int c) {
+    int ret = freeswitchPINVOKE.switch_isspace(c);
+    return ret;
+  }
+
+  public static int switch_isupper(int c) {
+    int ret = freeswitchPINVOKE.switch_isupper(c);
+    return ret;
+  }
+
+  public static int switch_isxdigit(int c) {
+    int ret = freeswitchPINVOKE.switch_isxdigit(c);
+    return ret;
+  }
+
+  public static int zstr(string s) {
+    int ret = freeswitchPINVOKE.zstr(s);
+    return ret;
+  }
+
+  public static switch_bool_t switch_is_moh(string s) {
+    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_is_moh(s);
+    return ret;
+  }
+
+  public static int switch_string_has_escaped_data(string arg0) {
+    int ret = freeswitchPINVOKE.switch_string_has_escaped_data(arg0);
+    return ret;
+  }
+
+  public static switch_status_t switch_b64_encode(SWIGTYPE_p_unsigned_char arg0, SWIGTYPE_p_switch_size_t ilen, SWIGTYPE_p_unsigned_char arg2, SWIGTYPE_p_switch_size_t olen) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_b64_encode(SWIGTYPE_p_unsigned_char.getCPtr(arg0), SWIGTYPE_p_switch_size_t.getCPtr(ilen), SWIGTYPE_p_unsigned_char.getCPtr(arg2), SWIGTYPE_p_switch_size_t.getCPtr(olen));
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_size_t switch_b64_decode(string arg0, string arg1, SWIGTYPE_p_switch_size_t olen) {
+    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_b64_decode(arg0, arg1, SWIGTYPE_p_switch_size_t.getCPtr(olen)), true);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static string switch_amp_encode(string s, string buf, SWIGTYPE_p_switch_size_t len) {
+    string ret = freeswitchPINVOKE.switch_amp_encode(s, buf, SWIGTYPE_p_switch_size_t.getCPtr(len));
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static switch_bool_t switch_is_digit_string(string s) {
+    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_is_digit_string(s);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_size_t switch_fd_read_line(int fd, string buf, SWIGTYPE_p_switch_size_t len) {
+    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_fd_read_line(fd, buf, SWIGTYPE_p_switch_size_t.getCPtr(len)), true);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static switch_status_t switch_frame_alloc(SWIGTYPE_p_p_switch_frame frame, SWIGTYPE_p_switch_size_t size) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_frame_alloc(SWIGTYPE_p_p_switch_frame.getCPtr(frame), SWIGTYPE_p_switch_size_t.getCPtr(size));
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static switch_status_t switch_frame_dup(switch_frame orig, SWIGTYPE_p_p_switch_frame clone) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_frame_dup(switch_frame.getCPtr(orig), SWIGTYPE_p_p_switch_frame.getCPtr(clone));
+    return ret;
+  }
+
+  public static switch_status_t switch_frame_free(SWIGTYPE_p_p_switch_frame frame) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_frame_free(SWIGTYPE_p_p_switch_frame.getCPtr(frame));
+    return ret;
+  }
+
+  public static switch_status_t switch_resolve_host(string host, string buf, uint buflen) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_resolve_host(host, buf, buflen);
+    return ret;
+  }
+
+  public static switch_status_t switch_find_local_ip(string buf, int len, SWIGTYPE_p_int mask, int family) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_find_local_ip(buf, len, SWIGTYPE_p_int.getCPtr(mask), family);
+    return ret;
+  }
+
+  public static string get_addr(string buf, SWIGTYPE_p_switch_size_t len, SWIGTYPE_p_sockaddr sa, SWIGTYPE_p_socklen_t salen) {
+    string ret = freeswitchPINVOKE.get_addr(buf, SWIGTYPE_p_switch_size_t.getCPtr(len), SWIGTYPE_p_sockaddr.getCPtr(sa), SWIGTYPE_p_socklen_t.getCPtr(salen));
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static int get_addr_int(SWIGTYPE_p_switch_sockaddr_t sa) {
+    int ret = freeswitchPINVOKE.get_addr_int(SWIGTYPE_p_switch_sockaddr_t.getCPtr(sa));
+    return ret;
+  }
+
+  public static int switch_cmp_addr(SWIGTYPE_p_switch_sockaddr_t sa1, SWIGTYPE_p_switch_sockaddr_t sa2) {
+    int ret = freeswitchPINVOKE.switch_cmp_addr(SWIGTYPE_p_switch_sockaddr_t.getCPtr(sa1), SWIGTYPE_p_switch_sockaddr_t.getCPtr(sa2));
+    return ret;
+  }
+
+  public static ushort get_port(SWIGTYPE_p_sockaddr sa) {
+    ushort ret = freeswitchPINVOKE.get_port(SWIGTYPE_p_sockaddr.getCPtr(sa));
+    return ret;
+  }
+
+  public static int switch_build_uri(string uri, SWIGTYPE_p_switch_size_t size, string scheme, string user, SWIGTYPE_p_switch_sockaddr_t sa, int flags) {
+    int ret = freeswitchPINVOKE.switch_build_uri(uri, SWIGTYPE_p_switch_size_t.getCPtr(size), scheme, user, SWIGTYPE_p_switch_sockaddr_t.getCPtr(sa), flags);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static string switch_priority_name(switch_priority_t priority) {
+    string ret = freeswitchPINVOKE.switch_priority_name((int)priority);
+    return ret;
+  }
+
+  public static char switch_rfc2833_to_char(int arg0) {
+    char ret = freeswitchPINVOKE.switch_rfc2833_to_char(arg0);
+    return ret;
+  }
+
+  public static byte switch_char_to_rfc2833(char key) {
+    byte ret = freeswitchPINVOKE.switch_char_to_rfc2833(key);
+    return ret;
+  }
+
+  public static string switch_sanitize_number(string number) {
+    string ret = freeswitchPINVOKE.switch_sanitize_number(number);
+    return ret;
+  }
+
+  public static switch_bool_t switch_string_var_check(string s, switch_bool_t disable) {
+    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_string_var_check(s, (int)disable);
+    return ret;
+  }
+
+  public static switch_bool_t switch_string_var_check_const(string s) {
+    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_string_var_check_const(s);
+    return ret;
+  }
+
+  public static string switch_var_clean_string(string s) {
+    string ret = freeswitchPINVOKE.switch_var_clean_string(s);
+    return ret;
+  }
+
+  public static string switch_clean_string(string s) {
+    string ret = freeswitchPINVOKE.switch_clean_string(s);
+    return ret;
+  }
+
+  public static string switch_safe_strdup(string it) {
+    string ret = freeswitchPINVOKE.switch_safe_strdup(it);
+    return ret;
+  }
+
+  public static string switch_lc_strdup(string it) {
+    string ret = freeswitchPINVOKE.switch_lc_strdup(it);
+    return ret;
+  }
+
+  public static string switch_uc_strdup(string it) {
+    string ret = freeswitchPINVOKE.switch_uc_strdup(it);
+    return ret;
+  }
+
+  public static switch_bool_t switch_strstr(string s, string q) {
+    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_strstr(s, q);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_time_t switch_str_time(string arg0) {
+    SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_str_time(arg0), true);
+    return ret;
+  }
+
+  public static uint switch_separate_string(string buf, char delim, ref string array, uint arraylen) {
+    uint ret = freeswitchPINVOKE.switch_separate_string(buf, delim, ref array, arraylen);
+    return ret;
+  }
+
+  public static uint switch_separate_string_string(string buf, string delim, ref string array, uint arraylen) {
+    uint ret = freeswitchPINVOKE.switch_separate_string_string(buf, delim, ref array, arraylen);
+    return ret;
+  }
+
+  public static switch_bool_t switch_is_number(string str) {
+    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_is_number(str);
+    return ret;
+  }
+
+  public static string switch_strip_spaces(string str) {
+    string ret = freeswitchPINVOKE.switch_strip_spaces(str);
+    return ret;
+  }
+
+  public static string switch_separate_paren_args(string str) {
+    string ret = freeswitchPINVOKE.switch_separate_paren_args(str);
+    return ret;
+  }
+
+  public static string switch_stristr(string instr, string str) {
+    string ret = freeswitchPINVOKE.switch_stristr(instr, str);
+    return ret;
+  }
+
+  public static switch_bool_t switch_is_lan_addr(string ip) {
+    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_is_lan_addr(ip);
+    return ret;
+  }
+
+  public static string switch_replace_char(string str, char from, char to, switch_bool_t dup) {
+    string ret = freeswitchPINVOKE.switch_replace_char(str, from, to, (int)dup);
+    return ret;
+  }
+
+  public static switch_bool_t switch_ast2regex(string pat, string rbuf, uint len) {
+    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_ast2regex(pat, rbuf, len);
+    return ret;
+  }
+
+  public static string switch_escape_char(SWIGTYPE_p_apr_pool_t pool, string arg1, string delim, char esc) {
+    string ret = freeswitchPINVOKE.switch_escape_char(SWIGTYPE_p_apr_pool_t.getCPtr(pool), arg1, delim, esc);
+    return ret;
+  }
+
+  public static string switch_escape_string(string arg0, string arg1, SWIGTYPE_p_switch_size_t outlen) {
+    string ret = freeswitchPINVOKE.switch_escape_string(arg0, arg1, SWIGTYPE_p_switch_size_t.getCPtr(outlen));
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static string switch_escape_string_pool(string arg0, SWIGTYPE_p_apr_pool_t pool) {
+    string ret = freeswitchPINVOKE.switch_escape_string_pool(arg0, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+    return ret;
+  }
+
+  public static int switch_socket_waitfor(SWIGTYPE_p_switch_pollfd_t poll, int ms) {
+    int ret = freeswitchPINVOKE.switch_socket_waitfor(SWIGTYPE_p_switch_pollfd_t.getCPtr(poll), ms);
+    return ret;
+  }
+
+  public static string switch_cut_path(string arg0) {
+    string ret = freeswitchPINVOKE.switch_cut_path(arg0);
+    return ret;
+  }
+
+  public static string switch_string_replace(string arg0, string search, string replace) {
+    string ret = freeswitchPINVOKE.switch_string_replace(arg0, search, replace);
+    return ret;
+  }
+
+  public static switch_status_t switch_string_match(string arg0, uint string_len, string search, uint search_len) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_string_match(arg0, string_len, search, search_len);
+    return ret;
+  }
+
+  public static string switch_util_quote_shell_arg(string arg0) {
+    string ret = freeswitchPINVOKE.switch_util_quote_shell_arg(arg0);
+    return ret;
+  }
+
+  public static uint switch_url_encode(string url, string buf, uint len) {
+    uint ret = freeswitchPINVOKE.switch_url_encode(url, buf, len);
+    return ret;
+  }
+
+  public static string switch_url_decode(string s) {
+    string ret = freeswitchPINVOKE.switch_url_decode(s);
+    return ret;
+  }
+
+  public static switch_bool_t switch_simple_email(string to, string from, string headers, string body, string file, string convert_cmd, string convert_ext) {
+    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_simple_email(to, from, headers, body, file, convert_cmd, convert_ext);
+    return ret;
+  }
+
+  public static string switch_find_end_paren(string s, char open, char close) {
+    string ret = freeswitchPINVOKE.switch_find_end_paren(s, open, close);
+    return ret;
+  }
+
+  public static switch_bool_t switch_is_file_path(string file) {
+    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_is_file_path(file);
+    return ret;
+  }
+
+  public static int switch_parse_cidr(string arg0, SWIGTYPE_p_unsigned_long ip, SWIGTYPE_p_unsigned_long mask, SWIGTYPE_p_unsigned_long bitp) {
+    int ret = freeswitchPINVOKE.switch_parse_cidr(arg0, SWIGTYPE_p_unsigned_long.getCPtr(ip), SWIGTYPE_p_unsigned_long.getCPtr(mask), SWIGTYPE_p_unsigned_long.getCPtr(bitp));
+    return ret;
+  }
+
+  public static switch_status_t switch_network_list_create(SWIGTYPE_p_p_switch_network_list list, string name, switch_bool_t default_type, SWIGTYPE_p_apr_pool_t pool) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_network_list_create(SWIGTYPE_p_p_switch_network_list.getCPtr(list), name, (int)default_type, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+    return ret;
+  }
+
+  public static switch_status_t switch_network_list_add_cidr_token(SWIGTYPE_p_switch_network_list list, string cidr_str, switch_bool_t ok, string token) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_network_list_add_cidr_token(SWIGTYPE_p_switch_network_list.getCPtr(list), cidr_str, (int)ok, token);
+    return ret;
+  }
+
+  public static switch_status_t switch_network_list_add_host_mask(SWIGTYPE_p_switch_network_list list, string host, string mask_str, switch_bool_t ok) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_network_list_add_host_mask(SWIGTYPE_p_switch_network_list.getCPtr(list), host, mask_str, (int)ok);
+    return ret;
+  }
+
+  public static switch_bool_t switch_network_list_validate_ip_token(SWIGTYPE_p_switch_network_list list, uint ip, ref string token) {
+    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_network_list_validate_ip_token(SWIGTYPE_p_switch_network_list.getCPtr(list), ip, ref token);
+    return ret;
+  }
+
+  public static int switch_number_cmp(string exp, int val) {
+    int ret = freeswitchPINVOKE.switch_number_cmp(exp, val);
+    return ret;
+  }
+
+  public static switch_caller_extension switch_caller_extension_new(SWIGTYPE_p_switch_core_session session, string extension_name, string extension_number) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_caller_extension_new(SWIGTYPE_p_switch_core_session.getCPtr(session), extension_name, extension_number);
+    switch_caller_extension ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_extension(cPtr, false);
+    return ret;
+  }
+
+  public static switch_status_t switch_caller_extension_clone(SWIGTYPE_p_p_switch_caller_extension new_ext, switch_caller_extension orig, SWIGTYPE_p_apr_pool_t pool) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_caller_extension_clone(SWIGTYPE_p_p_switch_caller_extension.getCPtr(new_ext), switch_caller_extension.getCPtr(orig), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+    return ret;
+  }
+
+  public static void switch_caller_extension_add_application(SWIGTYPE_p_switch_core_session session, switch_caller_extension caller_extension, string application_name, string extra_data) {
+    freeswitchPINVOKE.switch_caller_extension_add_application(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_caller_extension.getCPtr(caller_extension), application_name, extra_data);
+  }
+
+  public static void switch_caller_extension_add_application_printf(SWIGTYPE_p_switch_core_session session, switch_caller_extension caller_extension, string application_name, string fmt) {
+    freeswitchPINVOKE.switch_caller_extension_add_application_printf(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_caller_extension.getCPtr(caller_extension), application_name, fmt);
+  }
+
+  public static string switch_caller_get_field_by_name(switch_caller_profile caller_profile, string name) {
+    string ret = freeswitchPINVOKE.switch_caller_get_field_by_name(switch_caller_profile.getCPtr(caller_profile), name);
+    return ret;
+  }
+
+  public static switch_caller_profile switch_caller_profile_new(SWIGTYPE_p_apr_pool_t pool, string username, string dialplan, string caller_id_name, string caller_id_number, string network_addr, string ani, string aniii, string rdnis, string source, string context, string destination_number) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_new(SWIGTYPE_p_apr_pool_t.getCPtr(pool), username, dialplan, caller_id_name, caller_id_number, network_addr, ani, aniii, rdnis, source, context, destination_number);
+    switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
+    return ret;
+  }
+
+  public static switch_caller_profile switch_caller_profile_clone(SWIGTYPE_p_switch_core_session session, switch_caller_profile tocopy) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_clone(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_caller_profile.getCPtr(tocopy));
+    switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
+    return ret;
+  }
+
+  public static switch_caller_profile switch_caller_profile_dup(SWIGTYPE_p_apr_pool_t pool, switch_caller_profile tocopy) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_dup(SWIGTYPE_p_apr_pool_t.getCPtr(pool), switch_caller_profile.getCPtr(tocopy));
+    switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
+    return ret;
+  }
+
+  public static void switch_caller_profile_event_set_data(switch_caller_profile caller_profile, string prefix, switch_event arg2) {
+    freeswitchPINVOKE.switch_caller_profile_event_set_data(switch_caller_profile.getCPtr(caller_profile), prefix, switch_event.getCPtr(arg2));
+  }
+
+  public static switch_channel_state_t switch_channel_get_state(SWIGTYPE_p_switch_channel channel) {
+    switch_channel_state_t ret = (switch_channel_state_t)freeswitchPINVOKE.switch_channel_get_state(SWIGTYPE_p_switch_channel.getCPtr(channel));
+    return ret;
+  }
+
+  public static switch_channel_state_t switch_channel_get_running_state(SWIGTYPE_p_switch_channel channel) {
+    switch_channel_state_t ret = (switch_channel_state_t)freeswitchPINVOKE.switch_channel_get_running_state(SWIGTYPE_p_switch_channel.getCPtr(channel));
+    return ret;
+  }
+
+  public static int switch_channel_test_ready(SWIGTYPE_p_switch_channel channel, switch_bool_t check_ready, switch_bool_t check_media) {
+    int ret = freeswitchPINVOKE.switch_channel_test_ready(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)check_ready, (int)check_media);
+    return ret;
+  }
+
+  public static void switch_channel_wait_for_state(SWIGTYPE_p_switch_channel channel, SWIGTYPE_p_switch_channel other_channel, switch_channel_state_t want_state) {
+    freeswitchPINVOKE.switch_channel_wait_for_state(SWIGTYPE_p_switch_channel.getCPtr(channel), SWIGTYPE_p_switch_channel.getCPtr(other_channel), (int)want_state);
+  }
+
+  public static void switch_channel_wait_for_state_timeout(SWIGTYPE_p_switch_channel other_channel, switch_channel_state_t want_state, uint timeout) {
+    freeswitchPINVOKE.switch_channel_wait_for_state_timeout(SWIGTYPE_p_switch_channel.getCPtr(other_channel), (int)want_state, timeout);
+  }
+
+  public static switch_status_t switch_channel_wait_for_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t want_flag, switch_bool_t pres, uint to, SWIGTYPE_p_switch_channel super_channel) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_wait_for_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)want_flag, (int)pres, to, SWIGTYPE_p_switch_channel.getCPtr(super_channel));
+    return ret;
+  }
+
+  public static switch_channel_state_t switch_channel_perform_set_state(SWIGTYPE_p_switch_channel channel, string file, string func, int line, switch_channel_state_t state) {
+    switch_channel_state_t ret = (switch_channel_state_t)freeswitchPINVOKE.switch_channel_perform_set_state(SWIGTYPE_p_switch_channel.getCPtr(channel), file, func, line, (int)state);
+    return ret;
+  }
+
+  public static switch_channel_state_t switch_channel_perform_set_running_state(SWIGTYPE_p_switch_channel channel, switch_channel_state_t state, string file, string func, int line) {
+    switch_channel_state_t ret = (switch_channel_state_t)freeswitchPINVOKE.switch_channel_perform_set_running_state(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)state, file, func, line);
+    return ret;
+  }
+
+  public static switch_call_cause_t switch_channel_str2cause(string str) {
+    switch_call_cause_t ret = (switch_call_cause_t)freeswitchPINVOKE.switch_channel_str2cause(str);
+    return ret;
+  }
+
+  public static switch_call_cause_t switch_channel_get_cause(SWIGTYPE_p_switch_channel channel) {
+    switch_call_cause_t ret = (switch_call_cause_t)freeswitchPINVOKE.switch_channel_get_cause(SWIGTYPE_p_switch_channel.getCPtr(channel));
+    return ret;
+  }
+
+  public static switch_call_cause_t switch_channel_cause_q850(switch_call_cause_t cause) {
+    switch_call_cause_t ret = (switch_call_cause_t)freeswitchPINVOKE.switch_channel_cause_q850((int)cause);
+    return ret;
+  }
+
+  public static switch_call_cause_t switch_channel_get_cause_q850(SWIGTYPE_p_switch_channel channel) {
+    switch_call_cause_t ret = (switch_call_cause_t)freeswitchPINVOKE.switch_channel_get_cause_q850(SWIGTYPE_p_switch_channel.getCPtr(channel));
+    return ret;
+  }
+
+  public static string switch_channel_cause2str(switch_call_cause_t cause) {
+    string ret = freeswitchPINVOKE.switch_channel_cause2str((int)cause);
+    return ret;
+  }
+
+  public static switch_channel_timetable switch_channel_get_timetable(SWIGTYPE_p_switch_channel channel) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_timetable(SWIGTYPE_p_switch_channel.getCPtr(channel));
+    switch_channel_timetable ret = (cPtr == IntPtr.Zero) ? null : new switch_channel_timetable(cPtr, false);
+    return ret;
+  }
+
+  public static switch_status_t switch_channel_alloc(SWIGTYPE_p_p_switch_channel channel, switch_call_direction_t direction, SWIGTYPE_p_apr_pool_t pool) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_alloc(SWIGTYPE_p_p_switch_channel.getCPtr(channel), (int)direction, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+    return ret;
+  }
+
+  public static switch_status_t switch_channel_init(SWIGTYPE_p_switch_channel channel, SWIGTYPE_p_switch_core_session session, switch_channel_state_t state, switch_channel_flag_t flag) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_init(SWIGTYPE_p_switch_channel.getCPtr(channel), SWIGTYPE_p_switch_core_session.getCPtr(session), (int)state, (int)flag);
+    return ret;
+  }
+
+  public static void switch_channel_presence(SWIGTYPE_p_switch_channel channel, string rpid, string status, string id) {
+    freeswitchPINVOKE.switch_channel_presence(SWIGTYPE_p_switch_channel.getCPtr(channel), rpid, status, id);
+  }
+
+  public static void switch_channel_uninit(SWIGTYPE_p_switch_channel channel) {
+    freeswitchPINVOKE.switch_channel_uninit(SWIGTYPE_p_switch_channel.getCPtr(channel));
+  }
+
+  public static void switch_channel_set_caller_profile(SWIGTYPE_p_switch_channel channel, switch_caller_profile caller_profile) {
+    freeswitchPINVOKE.switch_channel_set_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_profile.getCPtr(caller_profile));
+  }
+
+  public static switch_caller_profile switch_channel_get_caller_profile(SWIGTYPE_p_switch_channel channel) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel));
+    switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
+    return ret;
+  }
+
+  public static void switch_channel_set_originator_caller_profile(SWIGTYPE_p_switch_channel channel, switch_caller_profile caller_profile) {
+    freeswitchPINVOKE.switch_channel_set_originator_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_profile.getCPtr(caller_profile));
+  }
+
+  public static void switch_channel_set_hunt_caller_profile(SWIGTYPE_p_switch_channel channel, switch_caller_profile caller_profile) {
+    freeswitchPINVOKE.switch_channel_set_hunt_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_profile.getCPtr(caller_profile));
+  }
+
+  public static switch_caller_profile switch_channel_get_originator_caller_profile(SWIGTYPE_p_switch_channel channel) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_originator_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel));
+    switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
+    return ret;
+  }
+
+  public static void switch_channel_set_originatee_caller_profile(SWIGTYPE_p_switch_channel channel, switch_caller_profile caller_profile) {
+    freeswitchPINVOKE.switch_channel_set_originatee_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_profile.getCPtr(caller_profile));
+  }
+
+  public static switch_caller_profile switch_channel_get_originatee_caller_profile(SWIGTYPE_p_switch_channel channel) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_originatee_caller_profile(SWIGTYPE_p_switch_channel.getCPtr(channel));
+    switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
+    return ret;
+  }
+
+  public static string switch_channel_get_uuid(SWIGTYPE_p_switch_channel channel) {
+    string ret = freeswitchPINVOKE.switch_channel_get_uuid(SWIGTYPE_p_switch_channel.getCPtr(channel));
+    return ret;
+  }
+
+  public static switch_status_t switch_channel_set_profile_var(SWIGTYPE_p_switch_channel channel, string name, string val) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_set_profile_var(SWIGTYPE_p_switch_channel.getCPtr(channel), name, val);
+    return ret;
+  }
+
+  public static switch_status_t switch_channel_set_variable_var_check(SWIGTYPE_p_switch_channel channel, string varname, string value, switch_bool_t var_check) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_set_variable_var_check(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, value, (int)var_check);
+    return ret;
+  }
+
+  public static switch_status_t switch_channel_set_variable_printf(SWIGTYPE_p_switch_channel channel, string varname, string fmt) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_set_variable_printf(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, fmt);
+    return ret;
+  }
+
+  public static switch_status_t switch_channel_set_variable_name_printf(SWIGTYPE_p_switch_channel channel, string val, string fmt) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_set_variable_name_printf(SWIGTYPE_p_switch_channel.getCPtr(channel), val, fmt);
+    return ret;
+  }
+
+  public static switch_status_t switch_channel_set_variable_partner_var_check(SWIGTYPE_p_switch_channel channel, string varname, string value, switch_bool_t var_check) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_set_variable_partner_var_check(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, value, (int)var_check);
+    return ret;
+  }
+
+  public static string switch_channel_get_variable_partner(SWIGTYPE_p_switch_channel channel, string varname) {
+    string ret = freeswitchPINVOKE.switch_channel_get_variable_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), varname);
+    return ret;
+  }
+
+  public static string switch_channel_get_variable_dup(SWIGTYPE_p_switch_channel channel, string varname, switch_bool_t dup) {
+    string ret = freeswitchPINVOKE.switch_channel_get_variable_dup(SWIGTYPE_p_switch_channel.getCPtr(channel), varname, (int)dup);
+    return ret;
+  }
+
+  public static switch_status_t switch_channel_get_variables(SWIGTYPE_p_switch_channel channel, SWIGTYPE_p_p_switch_event arg1) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_get_variables(SWIGTYPE_p_switch_channel.getCPtr(channel), SWIGTYPE_p_p_switch_event.getCPtr(arg1));
+    return ret;
+  }
+
+  public static switch_status_t switch_channel_pass_callee_id(SWIGTYPE_p_switch_channel channel, SWIGTYPE_p_switch_channel other_channel) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_pass_callee_id(SWIGTYPE_p_switch_channel.getCPtr(channel), SWIGTYPE_p_switch_channel.getCPtr(other_channel));
+    return ret;
+  }
+
+  public static switch_event_header switch_channel_variable_first(SWIGTYPE_p_switch_channel channel) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_channel_variable_first(SWIGTYPE_p_switch_channel.getCPtr(channel));
+    switch_event_header ret = (cPtr == IntPtr.Zero) ? null : new switch_event_header(cPtr, false);
+    return ret;
+  }
+
+  public static void switch_channel_variable_last(SWIGTYPE_p_switch_channel channel) {
+    freeswitchPINVOKE.switch_channel_variable_last(SWIGTYPE_p_switch_channel.getCPtr(channel));
+  }
+
+  public static void switch_channel_restart(SWIGTYPE_p_switch_channel channel) {
+    freeswitchPINVOKE.switch_channel_restart(SWIGTYPE_p_switch_channel.getCPtr(channel));
+  }
+
+  public static switch_status_t switch_channel_caller_extension_masquerade(SWIGTYPE_p_switch_channel orig_channel, SWIGTYPE_p_switch_channel new_channel, uint offset) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_caller_extension_masquerade(SWIGTYPE_p_switch_channel.getCPtr(orig_channel), SWIGTYPE_p_switch_channel.getCPtr(new_channel), offset);
+    return ret;
+  }
+
+  public static void switch_channel_set_caller_extension(SWIGTYPE_p_switch_channel channel, switch_caller_extension caller_extension) {
+    freeswitchPINVOKE.switch_channel_set_caller_extension(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_extension.getCPtr(caller_extension));
+  }
+
+  public static switch_caller_extension switch_channel_get_caller_extension(SWIGTYPE_p_switch_channel channel) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_caller_extension(SWIGTYPE_p_switch_channel.getCPtr(channel));
+    switch_caller_extension ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_extension(cPtr, false);
+    return ret;
+  }
+
+  public static uint switch_channel_test_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
+    uint ret = freeswitchPINVOKE.switch_channel_test_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
+    return ret;
+  }
+
+  public static void switch_channel_set_flag_value(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag, uint value) {
+    freeswitchPINVOKE.switch_channel_set_flag_value(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag, value);
+  }
+
+  public static void switch_channel_set_flag_recursive(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
+    freeswitchPINVOKE.switch_channel_set_flag_recursive(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
+  }
+
+  public static void switch_channel_set_cap_value(SWIGTYPE_p_switch_channel channel, switch_channel_cap_t cap, uint value) {
+    freeswitchPINVOKE.switch_channel_set_cap_value(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)cap, value);
+  }
+
+  public static void switch_channel_clear_cap(SWIGTYPE_p_switch_channel channel, switch_channel_cap_t cap) {
+    freeswitchPINVOKE.switch_channel_clear_cap(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)cap);
+  }
+
+  public static uint switch_channel_test_cap(SWIGTYPE_p_switch_channel channel, switch_channel_cap_t cap) {
+    uint ret = freeswitchPINVOKE.switch_channel_test_cap(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)cap);
+    return ret;
+  }
+
+  public static switch_bool_t switch_channel_set_flag_partner(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
+    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_channel_set_flag_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
+    return ret;
+  }
+
+  public static switch_bool_t switch_channel_clear_flag_partner(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
+    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_channel_clear_flag_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
+    return ret;
+  }
+
+  public static uint switch_channel_test_flag_partner(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
+    uint ret = freeswitchPINVOKE.switch_channel_test_flag_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
+    return ret;
+  }
+
+  public static void switch_channel_set_state_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
+    freeswitchPINVOKE.switch_channel_set_state_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
+  }
+
+  public static void switch_channel_clear_flag(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
+    freeswitchPINVOKE.switch_channel_clear_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
+  }
+
+  public static void switch_channel_clear_flag_recursive(SWIGTYPE_p_switch_channel channel, switch_channel_flag_t flag) {
+    freeswitchPINVOKE.switch_channel_clear_flag_recursive(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)flag);
+  }
+
+  public static switch_status_t switch_channel_perform_answer(SWIGTYPE_p_switch_channel channel, string file, string func, int line) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_perform_answer(SWIGTYPE_p_switch_channel.getCPtr(channel), file, func, line);
+    return ret;
+  }
+
+  public static switch_status_t switch_channel_perform_mark_answered(SWIGTYPE_p_switch_channel channel, string file, string func, int line) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_perform_mark_answered(SWIGTYPE_p_switch_channel.getCPtr(channel), file, func, line);
+    return ret;
+  }
+
+  public static switch_status_t switch_channel_perform_ring_ready(SWIGTYPE_p_switch_channel channel, string file, string func, int line) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_perform_ring_ready(SWIGTYPE_p_switch_channel.getCPtr(channel), file, func, line);
+    return ret;
+  }
+
+  public static switch_status_t switch_channel_perform_pre_answer(SWIGTYPE_p_switch_channel channel, string file, string func, int line) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_perform_pre_answer(SWIGTYPE_p_switch_channel.getCPtr(channel), file, func, line);
+    return ret;
+  }
+
+  public static switch_status_t switch_channel_perform_mark_pre_answered(SWIGTYPE_p_switch_channel channel, string file, string func, int line) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_perform_mark_pre_answered(SWIGTYPE_p_switch_channel.getCPtr(channel), file, func, line);
+    return ret;
+  }
+
+  public static switch_status_t switch_channel_perform_mark_ring_ready(SWIGTYPE_p_switch_channel channel, string file, string func, int line) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_perform_mark_ring_ready(SWIGTYPE_p_switch_channel.getCPtr(channel), file, func, line);
+    return ret;
+  }
+
+  public static int switch_channel_add_state_handler(SWIGTYPE_p_switch_channel channel, switch_state_handler_table state_handler) {
+    int ret = freeswitchPINVOKE.switch_channel_add_state_handler(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_state_handler_table.getCPtr(state_handler));
+    return ret;
+  }
+
+  public static void switch_channel_clear_state_handler(SWIGTYPE_p_switch_channel channel, switch_state_handler_table state_handler) {
+    freeswitchPINVOKE.switch_channel_clear_state_handler(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_state_handler_table.getCPtr(state_handler));
+  }
+
+  public static switch_state_handler_table switch_channel_get_state_handler(SWIGTYPE_p_switch_channel channel, int index) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_state_handler(SWIGTYPE_p_switch_channel.getCPtr(channel), index);
+    switch_state_handler_table ret = (cPtr == IntPtr.Zero) ? null : new switch_state_handler_table(cPtr, false);
+    return ret;
+  }
+
+  public static switch_status_t switch_channel_set_private(SWIGTYPE_p_switch_channel channel, string key, SWIGTYPE_p_void private_info) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_set_private(SWIGTYPE_p_switch_channel.getCPtr(channel), key, SWIGTYPE_p_void.getCPtr(private_info));
+    return ret;
+  }
+
+  public static SWIGTYPE_p_void switch_channel_get_private(SWIGTYPE_p_switch_channel channel, string key) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_private(SWIGTYPE_p_switch_channel.getCPtr(channel), key);
+    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_void switch_channel_get_private_partner(SWIGTYPE_p_switch_channel channel, string key) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_private_partner(SWIGTYPE_p_switch_channel.getCPtr(channel), key);
+    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+    return ret;
+  }
+
+  public static switch_status_t switch_channel_set_name(SWIGTYPE_p_switch_channel channel, string name) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_set_name(SWIGTYPE_p_switch_channel.getCPtr(channel), name);
+    return ret;
+  }
+
+  public static string switch_channel_get_name(SWIGTYPE_p_switch_channel channel) {
+    string ret = freeswitchPINVOKE.switch_channel_get_name(SWIGTYPE_p_switch_channel.getCPtr(channel));
+    return ret;
+  }
+
+  public static switch_channel_state_t switch_channel_perform_hangup(SWIGTYPE_p_switch_channel channel, string file, string func, int line, switch_call_cause_t hangup_cause) {
+    switch_channel_state_t ret = (switch_channel_state_t)freeswitchPINVOKE.switch_channel_perform_hangup(SWIGTYPE_p_switch_channel.getCPtr(channel), file, func, line, (int)hangup_cause);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_size_t switch_channel_has_dtmf(SWIGTYPE_p_switch_channel channel) {
+    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_channel_has_dtmf(SWIGTYPE_p_switch_channel.getCPtr(channel)), true);
+    return ret;
+  }
+
+  public static switch_status_t switch_channel_queue_dtmf(SWIGTYPE_p_switch_channel channel, switch_dtmf_t dtmf) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_queue_dtmf(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_dtmf_t.getCPtr(dtmf));
+    return ret;
+  }
+
+  public static switch_status_t switch_channel_queue_dtmf_string(SWIGTYPE_p_switch_channel channel, string dtmf_string) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_queue_dtmf_string(SWIGTYPE_p_switch_channel.getCPtr(channel), dtmf_string);
+    return ret;
+  }
+
+  public static switch_status_t switch_channel_dequeue_dtmf(SWIGTYPE_p_switch_channel channel, switch_dtmf_t dtmf) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_dequeue_dtmf(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_dtmf_t.getCPtr(dtmf));
+    return ret;
+  }
+
+  public static void switch_channel_flush_dtmf(SWIGTYPE_p_switch_channel channel) {
+    freeswitchPINVOKE.switch_channel_flush_dtmf(SWIGTYPE_p_switch_channel.getCPtr(channel));
+  }
+
+  public static SWIGTYPE_p_switch_size_t switch_channel_dequeue_dtmf_string(SWIGTYPE_p_switch_channel channel, string dtmf_str, SWIGTYPE_p_switch_size_t len) {
+    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_channel_dequeue_dtmf_string(SWIGTYPE_p_switch_channel.getCPtr(channel), dtmf_str, SWIGTYPE_p_switch_size_t.getCPtr(len)), true);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static string switch_channel_state_name(switch_channel_state_t state) {
+    string ret = freeswitchPINVOKE.switch_channel_state_name((int)state);
+    return ret;
+  }
+
+  public static switch_channel_state_t switch_channel_name_state(string name) {
+    switch_channel_state_t ret = (switch_channel_state_t)freeswitchPINVOKE.switch_channel_name_state(name);
+    return ret;
+  }
+
+  public static void switch_channel_event_set_data(SWIGTYPE_p_switch_channel channel, switch_event arg1) {
+    freeswitchPINVOKE.switch_channel_event_set_data(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_event.getCPtr(arg1));
+  }
+
+  public static void switch_channel_event_set_basic_data(SWIGTYPE_p_switch_channel channel, switch_event arg1) {
+    freeswitchPINVOKE.switch_channel_event_set_basic_data(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_event.getCPtr(arg1));
+  }
+
+  public static void switch_channel_event_set_extended_data(SWIGTYPE_p_switch_channel channel, switch_event arg1) {
+    freeswitchPINVOKE.switch_channel_event_set_extended_data(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_event.getCPtr(arg1));
+  }
+
+  public static string switch_channel_expand_variables(SWIGTYPE_p_switch_channel channel, string arg1) {
+    string ret = freeswitchPINVOKE.switch_channel_expand_variables(SWIGTYPE_p_switch_channel.getCPtr(channel), arg1);
+    return ret;
+  }
+
+  public static string switch_channel_build_param_string(SWIGTYPE_p_switch_channel channel, switch_caller_profile caller_profile, string prefix) {
+    string ret = freeswitchPINVOKE.switch_channel_build_param_string(SWIGTYPE_p_switch_channel.getCPtr(channel), switch_caller_profile.getCPtr(caller_profile), prefix);
+    return ret;
+  }
+
+  public static switch_status_t switch_channel_set_timestamps(SWIGTYPE_p_switch_channel channel) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_set_timestamps(SWIGTYPE_p_switch_channel.getCPtr(channel));
+    return ret;
+  }
+
+  public static void switch_channel_audio_sync(SWIGTYPE_p_switch_channel channel) {
+    freeswitchPINVOKE.switch_channel_audio_sync(SWIGTYPE_p_switch_channel.getCPtr(channel));
+  }
+
+  public static void switch_channel_set_private_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
+    freeswitchPINVOKE.switch_channel_set_private_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
+  }
+
+  public static void switch_channel_clear_private_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
+    freeswitchPINVOKE.switch_channel_clear_private_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
+  }
+
+  public static int switch_channel_test_private_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
+    int ret = freeswitchPINVOKE.switch_channel_test_private_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
+    return ret;
+  }
+
+  public static void switch_channel_set_app_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
+    freeswitchPINVOKE.switch_channel_set_app_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
+  }
+
+  public static void switch_channel_clear_app_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
+    freeswitchPINVOKE.switch_channel_clear_app_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
+  }
+
+  public static int switch_channel_test_app_flag(SWIGTYPE_p_switch_channel channel, uint flags) {
+    int ret = freeswitchPINVOKE.switch_channel_test_app_flag(SWIGTYPE_p_switch_channel.getCPtr(channel), flags);
+    return ret;
+  }
+
+  public static void switch_channel_set_hangup_time(SWIGTYPE_p_switch_channel channel) {
+    freeswitchPINVOKE.switch_channel_set_hangup_time(SWIGTYPE_p_switch_channel.getCPtr(channel));
+  }
+
+  public static switch_call_direction_t switch_channel_direction(SWIGTYPE_p_switch_channel channel) {
+    switch_call_direction_t ret = (switch_call_direction_t)freeswitchPINVOKE.switch_channel_direction(SWIGTYPE_p_switch_channel.getCPtr(channel));
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_core_session switch_channel_get_session(SWIGTYPE_p_switch_channel channel) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_channel_get_session(SWIGTYPE_p_switch_channel.getCPtr(channel));
+    SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
+    return ret;
+  }
+
+  public static string switch_channel_get_flag_string(SWIGTYPE_p_switch_channel channel) {
+    string ret = freeswitchPINVOKE.switch_channel_get_flag_string(SWIGTYPE_p_switch_channel.getCPtr(channel));
+    return ret;
+  }
+
+  public static string switch_channel_get_cap_string(SWIGTYPE_p_switch_channel channel) {
+    string ret = freeswitchPINVOKE.switch_channel_get_cap_string(SWIGTYPE_p_switch_channel.getCPtr(channel));
+    return ret;
+  }
+
+  public static switch_status_t switch_buffer_create(SWIGTYPE_p_apr_pool_t pool, SWIGTYPE_p_p_switch_buffer buffer, SWIGTYPE_p_switch_size_t max_len) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_buffer_create(SWIGTYPE_p_apr_pool_t.getCPtr(pool), SWIGTYPE_p_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_switch_size_t.getCPtr(max_len));
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static switch_status_t switch_buffer_create_dynamic(SWIGTYPE_p_p_switch_buffer buffer, SWIGTYPE_p_switch_size_t blocksize, SWIGTYPE_p_switch_size_t start_len, SWIGTYPE_p_switch_size_t max_len) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_buffer_create_dynamic(SWIGTYPE_p_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_switch_size_t.getCPtr(blocksize), SWIGTYPE_p_switch_size_t.getCPtr(start_len), SWIGTYPE_p_switch_size_t.getCPtr(max_len));
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static void switch_buffer_add_mutex(SWIGTYPE_p_switch_buffer buffer, SWIGTYPE_p_switch_mutex_t mutex) {
+    freeswitchPINVOKE.switch_buffer_add_mutex(SWIGTYPE_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_switch_mutex_t.getCPtr(mutex));
+  }
+
+  public static void switch_buffer_lock(SWIGTYPE_p_switch_buffer buffer) {
+    freeswitchPINVOKE.switch_buffer_lock(SWIGTYPE_p_switch_buffer.getCPtr(buffer));
+  }
+
+  public static switch_status_t switch_buffer_trylock(SWIGTYPE_p_switch_buffer buffer) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_buffer_trylock(SWIGTYPE_p_switch_buffer.getCPtr(buffer));
+    return ret;
+  }
+
+  public static void switch_buffer_unlock(SWIGTYPE_p_switch_buffer buffer) {
+    freeswitchPINVOKE.switch_buffer_unlock(SWIGTYPE_p_switch_buffer.getCPtr(buffer));
+  }
+
+  public static SWIGTYPE_p_switch_size_t switch_buffer_len(SWIGTYPE_p_switch_buffer buffer) {
+    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_buffer_len(SWIGTYPE_p_switch_buffer.getCPtr(buffer)), true);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_size_t switch_buffer_freespace(SWIGTYPE_p_switch_buffer buffer) {
+    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_buffer_freespace(SWIGTYPE_p_switch_buffer.getCPtr(buffer)), true);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_size_t switch_buffer_inuse(SWIGTYPE_p_switch_buffer buffer) {
+    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_buffer_inuse(SWIGTYPE_p_switch_buffer.getCPtr(buffer)), true);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_size_t switch_buffer_read(SWIGTYPE_p_switch_buffer buffer, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen) {
+    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_buffer_read(SWIGTYPE_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen)), true);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_size_t switch_buffer_read_loop(SWIGTYPE_p_switch_buffer buffer, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen) {
+    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_buffer_read_loop(SWIGTYPE_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen)), true);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static void switch_buffer_set_loops(SWIGTYPE_p_switch_buffer buffer, int loops) {
+    freeswitchPINVOKE.switch_buffer_set_loops(SWIGTYPE_p_switch_buffer.getCPtr(buffer), loops);
+  }
+
+  public static SWIGTYPE_p_switch_size_t switch_buffer_write(SWIGTYPE_p_switch_buffer buffer, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen) {
+    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_buffer_write(SWIGTYPE_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen)), true);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_size_t switch_buffer_toss(SWIGTYPE_p_switch_buffer buffer, SWIGTYPE_p_switch_size_t datalen) {
+    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_buffer_toss(SWIGTYPE_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_switch_size_t.getCPtr(datalen)), true);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static void switch_buffer_zero(SWIGTYPE_p_switch_buffer buffer) {
+    freeswitchPINVOKE.switch_buffer_zero(SWIGTYPE_p_switch_buffer.getCPtr(buffer));
+  }
+
+  public static SWIGTYPE_p_switch_size_t switch_buffer_slide_write(SWIGTYPE_p_switch_buffer buffer, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen) {
+    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_buffer_slide_write(SWIGTYPE_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen)), true);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static void switch_buffer_destroy(SWIGTYPE_p_p_switch_buffer buffer) {
+    freeswitchPINVOKE.switch_buffer_destroy(SWIGTYPE_p_p_switch_buffer.getCPtr(buffer));
+  }
+
+  public static SWIGTYPE_p_switch_size_t switch_buffer_zwrite(SWIGTYPE_p_switch_buffer buffer, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen) {
+    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_buffer_zwrite(SWIGTYPE_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen)), true);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static switch_status_t switch_event_init(SWIGTYPE_p_apr_pool_t pool) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_init(SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+    return ret;
+  }
+
+  public static switch_status_t switch_event_shutdown() {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_shutdown();
+    return ret;
+  }
+
+  public static switch_status_t switch_event_create_subclass_detailed(string file, string func, int line, SWIGTYPE_p_p_switch_event arg3, switch_event_types_t event_id, string subclass_name) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_create_subclass_detailed(file, func, line, SWIGTYPE_p_p_switch_event.getCPtr(arg3), (int)event_id, subclass_name);
+    return ret;
+  }
+
+  public static switch_status_t switch_event_set_priority(switch_event arg0, switch_priority_t priority) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_set_priority(switch_event.getCPtr(arg0), (int)priority);
+    return ret;
+  }
+
+  public static string switch_event_get_header(switch_event arg0, string header_name) {
+    string ret = freeswitchPINVOKE.switch_event_get_header(switch_event.getCPtr(arg0), header_name);
+    return ret;
+  }
+
+  public static string switch_event_get_body(switch_event arg0) {
+    string ret = freeswitchPINVOKE.switch_event_get_body(switch_event.getCPtr(arg0));
+    return ret;
+  }
+
+  public static switch_status_t switch_event_set_subclass_name(switch_event arg0, string subclass_name) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_set_subclass_name(switch_event.getCPtr(arg0), subclass_name);
+    return ret;
+  }
+
+  public static switch_status_t switch_event_add_header_string(switch_event arg0, switch_stack_t stack, string header_name, string data) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_add_header_string(switch_event.getCPtr(arg0), (int)stack, header_name, data);
+    return ret;
+  }
+
+  public static switch_status_t switch_event_del_header_val(switch_event arg0, string header_name, string val) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_del_header_val(switch_event.getCPtr(arg0), header_name, val);
+    return ret;
+  }
+
+  public static void switch_event_destroy(SWIGTYPE_p_p_switch_event arg0) {
+    freeswitchPINVOKE.switch_event_destroy(SWIGTYPE_p_p_switch_event.getCPtr(arg0));
+  }
+
+  public static switch_status_t switch_event_dup(SWIGTYPE_p_p_switch_event arg0, switch_event todup) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_dup(SWIGTYPE_p_p_switch_event.getCPtr(arg0), switch_event.getCPtr(todup));
+    return ret;
+  }
+
+  public static switch_status_t switch_event_fire_detailed(string file, string func, int line, SWIGTYPE_p_p_switch_event arg3, SWIGTYPE_p_void user_data) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_fire_detailed(file, func, line, SWIGTYPE_p_p_switch_event.getCPtr(arg3), SWIGTYPE_p_void.getCPtr(user_data));
+    return ret;
+  }
+
+  public static void switch_event_prep_for_delivery_detailed(string file, string func, int line, switch_event arg3) {
+    freeswitchPINVOKE.switch_event_prep_for_delivery_detailed(file, func, line, switch_event.getCPtr(arg3));
+  }
+
+  public static switch_status_t switch_event_bind(string id, switch_event_types_t arg1, string subclass_name, SWIGTYPE_p_f_p_switch_event__void callback, SWIGTYPE_p_void user_data) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_bind(id, (int)arg1, subclass_name, SWIGTYPE_p_f_p_switch_event__void.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data));
+    return ret;
+  }
+
+  public static switch_status_t switch_event_bind_removable(string id, switch_event_types_t arg1, string subclass_name, SWIGTYPE_p_f_p_switch_event__void callback, SWIGTYPE_p_void user_data, SWIGTYPE_p_p_switch_event_node node) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_bind_removable(id, (int)arg1, subclass_name, SWIGTYPE_p_f_p_switch_event__void.getCPtr(callback), SWIGTYPE_p_void.getCPtr(user_data), SWIGTYPE_p_p_switch_event_node.getCPtr(node));
+    return ret;
+  }
+
+  public static switch_status_t switch_event_unbind(SWIGTYPE_p_p_switch_event_node node) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_unbind(SWIGTYPE_p_p_switch_event_node.getCPtr(node));
+    return ret;
+  }
+
+  public static switch_status_t switch_event_unbind_callback(SWIGTYPE_p_f_p_switch_event__void callback) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_unbind_callback(SWIGTYPE_p_f_p_switch_event__void.getCPtr(callback));
+    return ret;
+  }
+
+  public static string switch_event_name(switch_event_types_t arg0) {
+    string ret = freeswitchPINVOKE.switch_event_name((int)arg0);
+    return ret;
+  }
+
+  public static switch_status_t switch_name_event(string name, SWIGTYPE_p_switch_event_types_t type) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_name_event(name, SWIGTYPE_p_switch_event_types_t.getCPtr(type));
+    return ret;
+  }
+
+  public static switch_status_t switch_event_reserve_subclass_detailed(string owner, string subclass_name) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_reserve_subclass_detailed(owner, subclass_name);
+    return ret;
+  }
+
+  public static switch_status_t switch_event_free_subclass_detailed(string owner, string subclass_name) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_free_subclass_detailed(owner, subclass_name);
+    return ret;
+  }
+
+  public static switch_status_t switch_event_serialize(switch_event arg0, ref string str, switch_bool_t encode) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_serialize(switch_event.getCPtr(arg0), ref str, (int)encode);
+    return ret;
+  }
+
+  public static switch_status_t switch_event_running() {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_running();
+    return ret;
+  }
+
+  public static string switch_event_expand_headers(switch_event arg0, string arg1) {
+    string ret = freeswitchPINVOKE.switch_event_expand_headers(switch_event.getCPtr(arg0), arg1);
+    return ret;
+  }
+
+  public static switch_status_t switch_event_create_pres_in_detailed(string file, string func, int line, string proto, string login, string from, string from_domain, string status, string event_type, string alt_event_type, int event_count, string unique_id, string channel_state, string answer_state, string call_direction) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_create_pres_in_detailed(file, func, line, proto, login, from, from_domain, status, event_type, alt_event_type, event_count, unique_id, channel_state, answer_state, call_direction);
+    return ret;
+  }
+
+  public static switch_status_t switch_event_create_plain(SWIGTYPE_p_p_switch_event arg0, switch_event_types_t event_id) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_create_plain(SWIGTYPE_p_p_switch_event.getCPtr(arg0), (int)event_id);
+    return ret;
+  }
+
+  public static void switch_event_deliver(SWIGTYPE_p_p_switch_event arg0) {
+    freeswitchPINVOKE.switch_event_deliver(SWIGTYPE_p_p_switch_event.getCPtr(arg0));
+  }
+
+  public static string switch_event_build_param_string(switch_event arg0, string prefix, SWIGTYPE_p_switch_hash vars_map) {
+    string ret = freeswitchPINVOKE.switch_event_build_param_string(switch_event.getCPtr(arg0), prefix, SWIGTYPE_p_switch_hash.getCPtr(vars_map));
+    return ret;
+  }
+
+  public static switch_status_t switch_resample_perform_create(SWIGTYPE_p_p_switch_audio_resampler_t new_resampler, uint from_rate, uint to_rate, uint to_size, int quality, uint channels, string file, string func, int line) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_resample_perform_create(SWIGTYPE_p_p_switch_audio_resampler_t.getCPtr(new_resampler), from_rate, to_rate, to_size, quality, channels, file, func, line);
+    return ret;
+  }
+
+  public static void switch_resample_destroy(SWIGTYPE_p_p_switch_audio_resampler_t resampler) {
+    freeswitchPINVOKE.switch_resample_destroy(SWIGTYPE_p_p_switch_audio_resampler_t.getCPtr(resampler));
+  }
+
+  public static uint switch_resample_process(switch_audio_resampler_t resampler, SWIGTYPE_p_short src, uint srclen) {
+    uint ret = freeswitchPINVOKE.switch_resample_process(switch_audio_resampler_t.getCPtr(resampler), SWIGTYPE_p_short.getCPtr(src), srclen);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_size_t switch_float_to_short(SWIGTYPE_p_float f, SWIGTYPE_p_short s, SWIGTYPE_p_switch_size_t len) {
+    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_float_to_short(SWIGTYPE_p_float.getCPtr(f), SWIGTYPE_p_short.getCPtr(s), SWIGTYPE_p_switch_size_t.getCPtr(len)), true);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static int switch_char_to_float(string c, SWIGTYPE_p_float f, int len) {
+    int ret = freeswitchPINVOKE.switch_char_to_float(c, SWIGTYPE_p_float.getCPtr(f), len);
+    return ret;
+  }
+
+  public static int switch_float_to_char(SWIGTYPE_p_float f, string c, int len) {
+    int ret = freeswitchPINVOKE.switch_float_to_char(SWIGTYPE_p_float.getCPtr(f), c, len);
+    return ret;
+  }
+
+  public static int switch_short_to_float(SWIGTYPE_p_short s, SWIGTYPE_p_float f, int len) {
+    int ret = freeswitchPINVOKE.switch_short_to_float(SWIGTYPE_p_short.getCPtr(s), SWIGTYPE_p_float.getCPtr(f), len);
+    return ret;
+  }
+
+  public static void switch_swap_linear(SWIGTYPE_p_short buf, int len) {
+    freeswitchPINVOKE.switch_swap_linear(SWIGTYPE_p_short.getCPtr(buf), len);
+  }
+
+  public static void switch_generate_sln_silence(SWIGTYPE_p_short data, uint samples, uint divisor) {
+    freeswitchPINVOKE.switch_generate_sln_silence(SWIGTYPE_p_short.getCPtr(data), samples, divisor);
+  }
+
+  public static void switch_change_sln_volume(SWIGTYPE_p_short data, uint samples, int vol) {
+    freeswitchPINVOKE.switch_change_sln_volume(SWIGTYPE_p_short.getCPtr(data), samples, vol);
+  }
+
+  public static uint switch_merge_sln(SWIGTYPE_p_short data, uint samples, SWIGTYPE_p_short other_data, uint other_samples) {
+    uint ret = freeswitchPINVOKE.switch_merge_sln(SWIGTYPE_p_short.getCPtr(data), samples, SWIGTYPE_p_short.getCPtr(other_data), other_samples);
+    return ret;
+  }
+
+  public static void switch_mux_channels(SWIGTYPE_p_short data, SWIGTYPE_p_switch_size_t samples, uint channels) {
+    freeswitchPINVOKE.switch_mux_channels(SWIGTYPE_p_short.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(samples), channels);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+  }
+
+  public static switch_status_t switch_ivr_deactivate_unicast(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_deactivate_unicast(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_activate_unicast(SWIGTYPE_p_switch_core_session session, string local_ip, ushort local_port, string remote_ip, ushort remote_port, string transport, string flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_activate_unicast(SWIGTYPE_p_switch_core_session.getCPtr(session), local_ip, local_port, remote_ip, remote_port, transport, flags);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_generate_xml_cdr(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_xml xml_cdr) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_generate_xml_cdr(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_xml.getCPtr(xml_cdr));
+    return ret;
+  }
+
+  public static int switch_ivr_set_xml_profile_data(switch_xml xml, switch_caller_profile caller_profile, int off) {
+    int ret = freeswitchPINVOKE.switch_ivr_set_xml_profile_data(switch_xml.getCPtr(xml), switch_caller_profile.getCPtr(caller_profile), off);
+    return ret;
+  }
+
+  public static int switch_ivr_set_xml_chan_vars(switch_xml xml, SWIGTYPE_p_switch_channel channel, int off) {
+    int ret = freeswitchPINVOKE.switch_ivr_set_xml_chan_vars(switch_xml.getCPtr(xml), SWIGTYPE_p_switch_channel.getCPtr(channel), off);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_parse_event(SWIGTYPE_p_switch_core_session session, switch_event arg1) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_parse_event(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_event.getCPtr(arg1));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_parse_all_events(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_parse_all_events(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_parse_next_event(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_parse_next_event(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_parse_all_messages(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_parse_all_messages(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_sleep(SWIGTYPE_p_switch_core_session session, uint ms, switch_bool_t sync, switch_input_args_t args) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_sleep(SWIGTYPE_p_switch_core_session.getCPtr(session), ms, (int)sync, switch_input_args_t.getCPtr(args));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_park(SWIGTYPE_p_switch_core_session session, switch_input_args_t args) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_park(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_input_args_t.getCPtr(args));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_collect_digits_callback(SWIGTYPE_p_switch_core_session session, switch_input_args_t args, uint digit_timeout, uint abs_timeout) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_collect_digits_callback(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_input_args_t.getCPtr(args), digit_timeout, abs_timeout);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_collect_digits_count(SWIGTYPE_p_switch_core_session session, string buf, SWIGTYPE_p_switch_size_t buflen, SWIGTYPE_p_switch_size_t maxdigits, string terminators, string terminator, uint first_timeout, uint digit_timeout, uint abs_timeout) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_collect_digits_count(SWIGTYPE_p_switch_core_session.getCPtr(session), buf, SWIGTYPE_p_switch_size_t.getCPtr(buflen), SWIGTYPE_p_switch_size_t.getCPtr(maxdigits), terminators, terminator, first_timeout, digit_timeout, abs_timeout);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_detect_speech(SWIGTYPE_p_switch_core_session session, string mod_name, string grammar, string name, string dest, switch_asr_handle ah) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech(SWIGTYPE_p_switch_core_session.getCPtr(session), mod_name, grammar, name, dest, switch_asr_handle.getCPtr(ah));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_stop_detect_speech(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_stop_detect_speech(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_pause_detect_speech(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_pause_detect_speech(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_resume_detect_speech(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_resume_detect_speech(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_detect_speech_load_grammar(SWIGTYPE_p_switch_core_session session, string grammar, string name) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech_load_grammar(SWIGTYPE_p_switch_core_session.getCPtr(session), grammar, name);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_detect_speech_unload_grammar(SWIGTYPE_p_switch_core_session session, string name) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_detect_speech_unload_grammar(SWIGTYPE_p_switch_core_session.getCPtr(session), name);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_record_session(SWIGTYPE_p_switch_core_session session, string file, uint limit, switch_file_handle fh) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_record_session(SWIGTYPE_p_switch_core_session.getCPtr(session), file, limit, switch_file_handle.getCPtr(fh));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_eavesdrop_session(SWIGTYPE_p_switch_core_session session, string uuid, string require_group, uint flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_eavesdrop_session(SWIGTYPE_p_switch_core_session.getCPtr(session), uuid, require_group, flags);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_displace_session(SWIGTYPE_p_switch_core_session session, string file, uint limit, string flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_displace_session(SWIGTYPE_p_switch_core_session.getCPtr(session), file, limit, flags);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_stop_displace_session(SWIGTYPE_p_switch_core_session session, string file) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_stop_displace_session(SWIGTYPE_p_switch_core_session.getCPtr(session), file);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_stop_record_session(SWIGTYPE_p_switch_core_session session, string file) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_stop_record_session(SWIGTYPE_p_switch_core_session.getCPtr(session), file);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_session_audio(SWIGTYPE_p_switch_core_session session, string cmd, string direction, int level) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_session_audio(SWIGTYPE_p_switch_core_session.getCPtr(session), cmd, direction, level);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_stop_session_audio(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_stop_session_audio(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_inband_dtmf_session(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_inband_dtmf_session(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_stop_inband_dtmf_session(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_stop_inband_dtmf_session(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_inband_dtmf_generate_session(SWIGTYPE_p_switch_core_session session, switch_bool_t read_stream) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_inband_dtmf_generate_session(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)read_stream);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_stop_inband_dtmf_generate_session(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_stop_inband_dtmf_generate_session(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static void switch_ivr_session_echo(SWIGTYPE_p_switch_core_session session, switch_input_args_t args) {
+    freeswitchPINVOKE.switch_ivr_session_echo(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_input_args_t.getCPtr(args));
+  }
+
+  public static switch_status_t switch_ivr_stop_tone_detect_session(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_stop_tone_detect_session(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_tone_detect_session(SWIGTYPE_p_switch_core_session session, string key, string tone_spec, string flags, SWIGTYPE_p_time_t timeout, int hits, string app, string data, SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_bool_t callback) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_tone_detect_session(SWIGTYPE_p_switch_core_session.getCPtr(session), key, tone_spec, flags, SWIGTYPE_p_time_t.getCPtr(timeout), hits, app, data, SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_bool_t.getCPtr(callback));
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_play_file(SWIGTYPE_p_switch_core_session session, switch_file_handle fh, string file, switch_input_args_t args) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_play_file(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_file_handle.getCPtr(fh), file, switch_input_args_t.getCPtr(args));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_wait_for_silence(SWIGTYPE_p_switch_core_session session, uint thresh, uint silence_hits, uint listen_hits, uint timeout_ms, string file) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_wait_for_silence(SWIGTYPE_p_switch_core_session.getCPtr(session), thresh, silence_hits, listen_hits, timeout_ms, file);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_gentones(SWIGTYPE_p_switch_core_session session, string script, int loops, switch_input_args_t args) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_gentones(SWIGTYPE_p_switch_core_session.getCPtr(session), script, loops, switch_input_args_t.getCPtr(args));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_record_file(SWIGTYPE_p_switch_core_session session, switch_file_handle fh, string file, switch_input_args_t args, uint limit) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_record_file(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_file_handle.getCPtr(fh), file, switch_input_args_t.getCPtr(args), limit);
+    return ret;
+  }
+
+  public static switch_status_t switch_play_and_get_digits(SWIGTYPE_p_switch_core_session session, uint min_digits, uint max_digits, uint max_tries, uint timeout, string valid_terminators, string audio_file, string bad_input_audio_file, string var_name, string digit_buffer, uint digit_buffer_length, string digits_regex) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_play_and_get_digits(SWIGTYPE_p_switch_core_session.getCPtr(session), min_digits, max_digits, max_tries, timeout, valid_terminators, audio_file, bad_input_audio_file, var_name, digit_buffer, digit_buffer_length, digits_regex);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_speak_text_handle(SWIGTYPE_p_switch_core_session session, switch_speech_handle sh, switch_codec codec, switch_timer timer, string text, switch_input_args_t args) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_speak_text_handle(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_speech_handle.getCPtr(sh), switch_codec.getCPtr(codec), switch_timer.getCPtr(timer), text, switch_input_args_t.getCPtr(args));
+    return ret;
+  }
+
+  public static void switch_ivr_clear_speech_cache(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_ivr_clear_speech_cache(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static switch_status_t switch_ivr_speak_text(SWIGTYPE_p_switch_core_session session, string tts_name, string voice_name, string text, switch_input_args_t args) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_speak_text(SWIGTYPE_p_switch_core_session.getCPtr(session), tts_name, voice_name, text, switch_input_args_t.getCPtr(args));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_originate(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_core_session bleg, SWIGTYPE_p_switch_call_cause_t cause, string bridgeto, uint timelimit_sec, switch_state_handler_table table, string cid_name_override, string cid_num_override, switch_caller_profile caller_profile_override, switch_event ovars, uint flags, SWIGTYPE_p_switch_call_cause_t cancel_cause) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_originate(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_core_session.getCPtr(bleg), SWIGTYPE_p_switch_call_cause_t.getCPtr(cause), bridgeto, timelimit_sec, switch_state_handler_table.getCPtr(table), cid_name_override, cid_num_override, switch_caller_profile.getCPtr(caller_profile_override), switch_event.getCPtr(ovars), flags, SWIGTYPE_p_switch_call_cause_t.getCPtr(cancel_cause));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_enterprise_originate(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_p_switch_core_session bleg, SWIGTYPE_p_switch_call_cause_t cause, string bridgeto, uint timelimit_sec, switch_state_handler_table table, string cid_name_override, string cid_num_override, switch_caller_profile caller_profile_override, switch_event ovars, uint flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_enterprise_originate(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_p_switch_core_session.getCPtr(bleg), SWIGTYPE_p_switch_call_cause_t.getCPtr(cause), bridgeto, timelimit_sec, switch_state_handler_table.getCPtr(table), cid_name_override, cid_num_override, switch_caller_profile.getCPtr(caller_profile_override), switch_event.getCPtr(ovars), flags);
+    return ret;
+  }
+
+  public static void switch_ivr_bridge_display(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_core_session peer_session) {
+    freeswitchPINVOKE.switch_ivr_bridge_display(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_core_session.getCPtr(peer_session));
+  }
+
+  public static switch_status_t switch_ivr_multi_threaded_bridge(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_core_session peer_session, SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t dtmf_callback, SWIGTYPE_p_void session_data, SWIGTYPE_p_void peer_session_data) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_multi_threaded_bridge(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_core_session.getCPtr(peer_session), SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t.getCPtr(dtmf_callback), SWIGTYPE_p_void.getCPtr(session_data), SWIGTYPE_p_void.getCPtr(peer_session_data));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_signal_bridge(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_core_session peer_session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_signal_bridge(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_core_session.getCPtr(peer_session));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_session_transfer(SWIGTYPE_p_switch_core_session session, string extension, string dialplan, string context) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_session_transfer(SWIGTYPE_p_switch_core_session.getCPtr(session), extension, dialplan, context);
+    return ret;
+  }
+
+  public static uint switch_ivr_schedule_transfer(SWIGTYPE_p_time_t runtime, string uuid, string extension, string dialplan, string context) {
+    uint ret = freeswitchPINVOKE.switch_ivr_schedule_transfer(SWIGTYPE_p_time_t.getCPtr(runtime), uuid, extension, dialplan, context);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static uint switch_ivr_schedule_hangup(SWIGTYPE_p_time_t runtime, string uuid, switch_call_cause_t cause, switch_bool_t bleg) {
+    uint ret = freeswitchPINVOKE.switch_ivr_schedule_hangup(SWIGTYPE_p_time_t.getCPtr(runtime), uuid, (int)cause, (int)bleg);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_uuid_bridge(string originator_uuid, string originatee_uuid) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_uuid_bridge(originator_uuid, originatee_uuid);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_media(string uuid, uint flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_media(uuid, flags);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_nomedia(string uuid, uint flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_nomedia(uuid, flags);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_hold_uuid(string uuid, string message, switch_bool_t moh) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_hold_uuid(uuid, message, (int)moh);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_unhold_uuid(string uuid) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_unhold_uuid(uuid);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_hold(SWIGTYPE_p_switch_core_session session, string message, switch_bool_t moh) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_hold(SWIGTYPE_p_switch_core_session.getCPtr(session), message, (int)moh);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_unhold(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_unhold(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static uint switch_ivr_schedule_broadcast(SWIGTYPE_p_time_t runtime, string uuid, string path, uint flags) {
+    uint ret = freeswitchPINVOKE.switch_ivr_schedule_broadcast(SWIGTYPE_p_time_t.getCPtr(runtime), uuid, path, flags);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_broadcast(string uuid, string path, uint flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_broadcast(uuid, path, flags);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_transfer_variable(SWIGTYPE_p_switch_core_session sessa, SWIGTYPE_p_switch_core_session sessb, string var) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_transfer_variable(SWIGTYPE_p_switch_core_session.getCPtr(sessa), SWIGTYPE_p_switch_core_session.getCPtr(sessb), var);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_digit_stream_parser_new(SWIGTYPE_p_apr_pool_t pool, SWIGTYPE_p_p_switch_ivr_digit_stream_parser parser) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_digit_stream_parser_new(SWIGTYPE_p_apr_pool_t.getCPtr(pool), SWIGTYPE_p_p_switch_ivr_digit_stream_parser.getCPtr(parser));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_digit_stream_parser_destroy(SWIGTYPE_p_switch_ivr_digit_stream_parser parser) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_digit_stream_parser_destroy(SWIGTYPE_p_switch_ivr_digit_stream_parser.getCPtr(parser));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_digit_stream_new(SWIGTYPE_p_switch_ivr_digit_stream_parser parser, SWIGTYPE_p_p_switch_ivr_digit_stream stream) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_digit_stream_new(SWIGTYPE_p_switch_ivr_digit_stream_parser.getCPtr(parser), SWIGTYPE_p_p_switch_ivr_digit_stream.getCPtr(stream));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_digit_stream_destroy(SWIGTYPE_p_p_switch_ivr_digit_stream stream) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_digit_stream_destroy(SWIGTYPE_p_p_switch_ivr_digit_stream.getCPtr(stream));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_digit_stream_parser_set_event(SWIGTYPE_p_switch_ivr_digit_stream_parser parser, string digits, SWIGTYPE_p_void data) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_digit_stream_parser_set_event(SWIGTYPE_p_switch_ivr_digit_stream_parser.getCPtr(parser), digits, SWIGTYPE_p_void.getCPtr(data));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_digit_stream_parser_del_event(SWIGTYPE_p_switch_ivr_digit_stream_parser parser, string digits) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_digit_stream_parser_del_event(SWIGTYPE_p_switch_ivr_digit_stream_parser.getCPtr(parser), digits);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_void switch_ivr_digit_stream_parser_feed(SWIGTYPE_p_switch_ivr_digit_stream_parser parser, SWIGTYPE_p_switch_ivr_digit_stream stream, char digit) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_ivr_digit_stream_parser_feed(SWIGTYPE_p_switch_ivr_digit_stream_parser.getCPtr(parser), SWIGTYPE_p_switch_ivr_digit_stream.getCPtr(stream), digit);
+    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_digit_stream_reset(SWIGTYPE_p_switch_ivr_digit_stream stream) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_digit_stream_reset(SWIGTYPE_p_switch_ivr_digit_stream.getCPtr(stream));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_digit_stream_parser_set_terminator(SWIGTYPE_p_switch_ivr_digit_stream_parser parser, char digit) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_digit_stream_parser_set_terminator(SWIGTYPE_p_switch_ivr_digit_stream_parser.getCPtr(parser), digit);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_menu_init(SWIGTYPE_p_p_switch_ivr_menu new_menu, SWIGTYPE_p_switch_ivr_menu main, string name, string greeting_sound, string short_greeting_sound, string invalid_sound, string exit_sound, string confirm_macro, string confirm_key, string tts_engine, string tts_voice, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts, SWIGTYPE_p_apr_pool_t pool) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_init(SWIGTYPE_p_p_switch_ivr_menu.getCPtr(new_menu), SWIGTYPE_p_switch_ivr_menu.getCPtr(main), name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_menu_bind_action(SWIGTYPE_p_switch_ivr_menu menu, switch_ivr_action_t ivr_action, string arg, string bind) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_bind_action(SWIGTYPE_p_switch_ivr_menu.getCPtr(menu), (int)ivr_action, arg, bind);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_menu_bind_function(SWIGTYPE_p_switch_ivr_menu menu, SWIGTYPE_p_switch_ivr_menu_action_function_t function, string arg, string bind) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_bind_function(SWIGTYPE_p_switch_ivr_menu.getCPtr(menu), SWIGTYPE_p_switch_ivr_menu_action_function_t.getCPtr(function), arg, bind);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_menu_execute(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_ivr_menu stack, string name, SWIGTYPE_p_void obj) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_execute(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_ivr_menu.getCPtr(stack), name, SWIGTYPE_p_void.getCPtr(obj));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_menu_stack_free(SWIGTYPE_p_switch_ivr_menu stack) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_stack_free(SWIGTYPE_p_switch_ivr_menu.getCPtr(stack));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_menu_stack_xml_build(SWIGTYPE_p_switch_ivr_menu_xml_ctx xml_menu_ctx, SWIGTYPE_p_p_switch_ivr_menu menu_stack, switch_xml xml_menus, switch_xml xml_menu) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_stack_xml_build(SWIGTYPE_p_switch_ivr_menu_xml_ctx.getCPtr(xml_menu_ctx), SWIGTYPE_p_p_switch_ivr_menu.getCPtr(menu_stack), switch_xml.getCPtr(xml_menus), switch_xml.getCPtr(xml_menu));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_menu_str2action(string action_name, SWIGTYPE_p_switch_ivr_action_t action) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_str2action(action_name, SWIGTYPE_p_switch_ivr_action_t.getCPtr(action));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_menu_stack_xml_add_custom(SWIGTYPE_p_switch_ivr_menu_xml_ctx xml_menu_ctx, string name, SWIGTYPE_p_switch_ivr_menu_action_function_t function) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_stack_xml_add_custom(SWIGTYPE_p_switch_ivr_menu_xml_ctx.getCPtr(xml_menu_ctx), name, SWIGTYPE_p_switch_ivr_menu_action_function_t.getCPtr(function));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_menu_stack_xml_init(SWIGTYPE_p_p_switch_ivr_menu_xml_ctx xml_menu_ctx, SWIGTYPE_p_apr_pool_t pool) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_stack_xml_init(SWIGTYPE_p_p_switch_ivr_menu_xml_ctx.getCPtr(xml_menu_ctx), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_phrase_macro(SWIGTYPE_p_switch_core_session session, string macro_name, string data, string lang, switch_input_args_t args) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_phrase_macro(SWIGTYPE_p_switch_core_session.getCPtr(session), macro_name, data, lang, switch_input_args_t.getCPtr(args));
+    return ret;
+  }
+
+  public static void switch_ivr_delay_echo(SWIGTYPE_p_switch_core_session session, uint delay_ms) {
+    freeswitchPINVOKE.switch_ivr_delay_echo(SWIGTYPE_p_switch_core_session.getCPtr(session), delay_ms);
+  }
+
+  public static switch_status_t switch_ivr_find_bridged_uuid(string uuid, string b_uuid, SWIGTYPE_p_switch_size_t blen) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_find_bridged_uuid(uuid, b_uuid, SWIGTYPE_p_switch_size_t.getCPtr(blen));
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static void switch_ivr_intercept_session(SWIGTYPE_p_switch_core_session session, string uuid, switch_bool_t bleg) {
+    freeswitchPINVOKE.switch_ivr_intercept_session(SWIGTYPE_p_switch_core_session.getCPtr(session), uuid, (int)bleg);
+  }
+
+  public static void switch_ivr_park_session(SWIGTYPE_p_switch_core_session session) {
+    freeswitchPINVOKE.switch_ivr_park_session(SWIGTYPE_p_switch_core_session.getCPtr(session));
+  }
+
+  public static switch_status_t switch_ivr_wait_for_answer(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_core_session peer_session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_wait_for_answer(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_core_session.getCPtr(peer_session));
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_read(SWIGTYPE_p_switch_core_session session, uint min_digits, uint max_digits, string prompt_audio_file, string var_name, string digit_buffer, SWIGTYPE_p_switch_size_t digit_buffer_length, uint timeout, string valid_terminators) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_read(SWIGTYPE_p_switch_core_session.getCPtr(session), min_digits, max_digits, prompt_audio_file, var_name, digit_buffer, SWIGTYPE_p_switch_size_t.getCPtr(digit_buffer_length), timeout, valid_terminators);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_bind_dtmf_meta_session(SWIGTYPE_p_switch_core_session session, uint key, uint bind_flags, string app) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_bind_dtmf_meta_session(SWIGTYPE_p_switch_core_session.getCPtr(session), key, bind_flags, app);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_unbind_dtmf_meta_session(SWIGTYPE_p_switch_core_session session, uint key) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_unbind_dtmf_meta_session(SWIGTYPE_p_switch_core_session.getCPtr(session), key);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_soft_hold(SWIGTYPE_p_switch_core_session session, string unhold_key, string moh_a, string moh_b) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_soft_hold(SWIGTYPE_p_switch_core_session.getCPtr(session), unhold_key, moh_a, moh_b);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_say(SWIGTYPE_p_switch_core_session session, string tosay, string module_name, string say_type, string say_method, switch_input_args_t args) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_say(SWIGTYPE_p_switch_core_session.getCPtr(session), tosay, module_name, say_type, say_method, switch_input_args_t.getCPtr(args));
+    return ret;
+  }
+
+  public static switch_say_method_t switch_ivr_get_say_method_by_name(string name) {
+    switch_say_method_t ret = (switch_say_method_t)freeswitchPINVOKE.switch_ivr_get_say_method_by_name(name);
+    return ret;
+  }
+
+  public static switch_say_type_t switch_ivr_get_say_type_by_name(string name) {
+    switch_say_type_t ret = (switch_say_type_t)freeswitchPINVOKE.switch_ivr_get_say_type_by_name(name);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_set_user(SWIGTYPE_p_switch_core_session session, string data) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_set_user(SWIGTYPE_p_switch_core_session.getCPtr(session), data);
+    return ret;
+  }
+
+  public static switch_status_t switch_ivr_sound_test(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_sound_test(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static void switch_process_import(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_switch_channel peer_channel, string varname) {
+    freeswitchPINVOKE.switch_process_import(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_switch_channel.getCPtr(peer_channel), varname);
+  }
+
+  public static switch_bool_t switch_ivr_uuid_exists(string uuid) {
+    switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_ivr_uuid_exists(uuid);
+    return ret;
+  }
+
+  public static switch_status_t switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_crypto_direction_t direction, uint index, switch_rtp_crypto_key_type_t type, SWIGTYPE_p_unsigned_char key, SWIGTYPE_p_switch_size_t keylen) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_add_crypto_key(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)direction, index, (int)type, SWIGTYPE_p_unsigned_char.getCPtr(key), SWIGTYPE_p_switch_size_t.getCPtr(keylen));
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static void switch_rtp_get_random(SWIGTYPE_p_void buf, uint len) {
+    freeswitchPINVOKE.switch_rtp_get_random(SWIGTYPE_p_void.getCPtr(buf), len);
+  }
+
+  public static void switch_rtp_init(SWIGTYPE_p_apr_pool_t pool) {
+    freeswitchPINVOKE.switch_rtp_init(SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+  }
+
+  public static void switch_rtp_shutdown() {
+    freeswitchPINVOKE.switch_rtp_shutdown();
+  }
+
+  public static ushort switch_rtp_set_start_port(ushort port) {
+    ushort ret = freeswitchPINVOKE.switch_rtp_set_start_port(port);
+    return ret;
+  }
+
+  public static switch_status_t switch_rtp_set_ssrc(SWIGTYPE_p_switch_rtp rtp_session, uint ssrc) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_set_ssrc(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), ssrc);
+    return ret;
+  }
+
+  public static ushort switch_rtp_set_end_port(ushort port) {
+    ushort ret = freeswitchPINVOKE.switch_rtp_set_end_port(port);
+    return ret;
+  }
+
+  public static ushort switch_rtp_request_port(string ip) {
+    ushort ret = freeswitchPINVOKE.switch_rtp_request_port(ip);
+    return ret;
+  }
+
+  public static void switch_rtp_release_port(string ip, ushort port) {
+    freeswitchPINVOKE.switch_rtp_release_port(ip, port);
+  }
+
+  public static switch_status_t switch_rtp_set_interval(SWIGTYPE_p_switch_rtp rtp_session, uint ms_per_packet, uint samples_per_interval) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_set_interval(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), ms_per_packet, samples_per_interval);
+    return ret;
+  }
+
+  public static switch_status_t switch_rtp_change_interval(SWIGTYPE_p_switch_rtp rtp_session, uint ms_per_packet, uint samples_per_interval) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_change_interval(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), ms_per_packet, samples_per_interval);
+    return ret;
+  }
+
+  public static switch_status_t switch_rtp_create(SWIGTYPE_p_p_switch_rtp new_rtp_session, byte payload, uint samples_per_interval, uint ms_per_packet, uint flags, string timer_name, ref string err, SWIGTYPE_p_apr_pool_t pool) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_create(SWIGTYPE_p_p_switch_rtp.getCPtr(new_rtp_session), payload, samples_per_interval, ms_per_packet, flags, timer_name, ref err, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_rtp switch_rtp_new(string rx_host, ushort rx_port, string tx_host, ushort tx_port, byte payload, uint samples_per_interval, uint ms_per_packet, uint flags, string timer_name, ref string err, SWIGTYPE_p_apr_pool_t pool) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_rtp_new(rx_host, rx_port, tx_host, tx_port, payload, samples_per_interval, ms_per_packet, flags, timer_name, ref err, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+    SWIGTYPE_p_switch_rtp ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_rtp(cPtr, false);
+    return ret;
+  }
+
+  public static switch_status_t switch_rtp_set_remote_address(SWIGTYPE_p_switch_rtp rtp_session, string host, ushort port, switch_bool_t change_adv_addr, ref string err) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_set_remote_address(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), host, port, (int)change_adv_addr, ref err);
+    return ret;
+  }
+
+  public static string switch_rtp_get_remote_host(SWIGTYPE_p_switch_rtp rtp_session) {
+    string ret = freeswitchPINVOKE.switch_rtp_get_remote_host(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
+    return ret;
+  }
+
+  public static ushort switch_rtp_get_remote_port(SWIGTYPE_p_switch_rtp rtp_session) {
+    ushort ret = freeswitchPINVOKE.switch_rtp_get_remote_port(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
+    return ret;
+  }
+
+  public static void switch_rtp_reset_media_timer(SWIGTYPE_p_switch_rtp rtp_session) {
+    freeswitchPINVOKE.switch_rtp_reset_media_timer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
+  }
+
+  public static void switch_rtp_set_max_missed_packets(SWIGTYPE_p_switch_rtp rtp_session, uint max) {
+    freeswitchPINVOKE.switch_rtp_set_max_missed_packets(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), max);
+  }
+
+  public static switch_status_t switch_rtp_set_local_address(SWIGTYPE_p_switch_rtp rtp_session, string host, ushort port, ref string err) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_set_local_address(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), host, port, ref err);
+    return ret;
+  }
+
+  public static void switch_rtp_kill_socket(SWIGTYPE_p_switch_rtp rtp_session) {
+    freeswitchPINVOKE.switch_rtp_kill_socket(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
+  }
+
+  public static void switch_rtp_break(SWIGTYPE_p_switch_rtp rtp_session) {
+    freeswitchPINVOKE.switch_rtp_break(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
+  }
+
+  public static byte switch_rtp_ready(SWIGTYPE_p_switch_rtp rtp_session) {
+    byte ret = freeswitchPINVOKE.switch_rtp_ready(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
+    return ret;
+  }
+
+  public static void switch_rtp_destroy(SWIGTYPE_p_p_switch_rtp rtp_session) {
+    freeswitchPINVOKE.switch_rtp_destroy(SWIGTYPE_p_p_switch_rtp.getCPtr(rtp_session));
+  }
+
+  public static switch_status_t switch_rtp_activate_ice(SWIGTYPE_p_switch_rtp rtp_session, string login, string rlogin) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_activate_ice(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), login, rlogin);
+    return ret;
+  }
+
+  public static switch_status_t switch_rtp_activate_jitter_buffer(SWIGTYPE_p_switch_rtp rtp_session, uint queue_frames) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_activate_jitter_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), queue_frames);
+    return ret;
+  }
+
+  public static void switch_rtp_set_flag(SWIGTYPE_p_switch_rtp rtp_session, uint flags) {
+    freeswitchPINVOKE.switch_rtp_set_flag(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), flags);
+  }
+
+  public static uint switch_rtp_test_flag(SWIGTYPE_p_switch_rtp rtp_session, uint flags) {
+    uint ret = freeswitchPINVOKE.switch_rtp_test_flag(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), flags);
+    return ret;
+  }
+
+  public static void switch_rtp_clear_flag(SWIGTYPE_p_switch_rtp rtp_session, uint flags) {
+    freeswitchPINVOKE.switch_rtp_clear_flag(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), flags);
+  }
+
+  public static SWIGTYPE_p_switch_socket_t switch_rtp_get_rtp_socket(SWIGTYPE_p_switch_rtp rtp_session) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_rtp_get_rtp_socket(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
+    SWIGTYPE_p_switch_socket_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_socket_t(cPtr, false);
+    return ret;
+  }
+
+  public static uint switch_rtp_get_default_samples_per_interval(SWIGTYPE_p_switch_rtp rtp_session) {
+    uint ret = freeswitchPINVOKE.switch_rtp_get_default_samples_per_interval(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
+    return ret;
+  }
+
+  public static void switch_rtp_set_default_payload(SWIGTYPE_p_switch_rtp rtp_session, byte payload) {
+    freeswitchPINVOKE.switch_rtp_set_default_payload(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), payload);
+  }
+
+  public static uint switch_rtp_get_default_payload(SWIGTYPE_p_switch_rtp rtp_session) {
+    uint ret = freeswitchPINVOKE.switch_rtp_get_default_payload(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
+    return ret;
+  }
+
+  public static void switch_rtp_set_invald_handler(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void on_invalid) {
+    freeswitchPINVOKE.switch_rtp_set_invald_handler(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void.getCPtr(on_invalid));
+  }
+
+  public static switch_status_t switch_rtp_read(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_void data, SWIGTYPE_p_unsigned_long datalen, SWIGTYPE_p_unsigned_char payload_type, SWIGTYPE_p_unsigned_long flags, uint io_flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_read(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_unsigned_long.getCPtr(datalen), SWIGTYPE_p_unsigned_char.getCPtr(payload_type), SWIGTYPE_p_unsigned_long.getCPtr(flags), io_flags);
+    return ret;
+  }
+
+  public static switch_status_t switch_rtp_queue_rfc2833(SWIGTYPE_p_switch_rtp rtp_session, switch_dtmf_t dtmf) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_queue_rfc2833(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), switch_dtmf_t.getCPtr(dtmf));
+    return ret;
+  }
+
+  public static switch_status_t switch_rtp_queue_rfc2833_in(SWIGTYPE_p_switch_rtp rtp_session, switch_dtmf_t dtmf) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_queue_rfc2833_in(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), switch_dtmf_t.getCPtr(dtmf));
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_size_t switch_rtp_has_dtmf(SWIGTYPE_p_switch_rtp rtp_session) {
+    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_has_dtmf(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session)), true);
+    return ret;
+  }
+
+  public static SWIGTYPE_p_switch_size_t switch_rtp_dequeue_dtmf(SWIGTYPE_p_switch_rtp rtp_session, switch_dtmf_t dtmf) {
+    SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_dequeue_dtmf(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), switch_dtmf_t.getCPtr(dtmf)), true);
+    return ret;
+  }
+
+  public static switch_status_t switch_rtp_zerocopy_read(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_p_void data, SWIGTYPE_p_unsigned_long datalen, SWIGTYPE_p_unsigned_char payload_type, SWIGTYPE_p_unsigned_long flags, uint io_flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_zerocopy_read(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_p_void.getCPtr(data), SWIGTYPE_p_unsigned_long.getCPtr(datalen), SWIGTYPE_p_unsigned_char.getCPtr(payload_type), SWIGTYPE_p_unsigned_long.getCPtr(flags), io_flags);
+    return ret;
+  }
+
+  public static switch_status_t switch_rtp_zerocopy_read_frame(SWIGTYPE_p_switch_rtp rtp_session, switch_frame frame, uint io_flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_zerocopy_read_frame(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), switch_frame.getCPtr(frame), io_flags);
+    return ret;
+  }
+
+  public static void rtp_flush_read_buffer(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_flush_t flush) {
+    freeswitchPINVOKE.rtp_flush_read_buffer(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)flush);
+  }
+
+  public static switch_status_t switch_rtp_enable_vad(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_switch_core_session session, switch_codec codec, uint flags) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_enable_vad(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_switch_core_session.getCPtr(session), switch_codec.getCPtr(codec), flags);
+    return ret;
+  }
+
+  public static switch_status_t switch_rtp_disable_vad(SWIGTYPE_p_switch_rtp rtp_session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_disable_vad(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
+    return ret;
+  }
+
+  public static int switch_rtp_write_frame(SWIGTYPE_p_switch_rtp rtp_session, switch_frame frame) {
+    int ret = freeswitchPINVOKE.switch_rtp_write_frame(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), switch_frame.getCPtr(frame));
+    return ret;
+  }
+
+  public static int switch_rtp_write_manual(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_void data, uint datalen, byte m, byte payload, uint ts, SWIGTYPE_p_unsigned_long flags) {
+    int ret = freeswitchPINVOKE.switch_rtp_write_manual(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_void.getCPtr(data), datalen, m, payload, ts, SWIGTYPE_p_unsigned_long.getCPtr(flags));
+    return ret;
+  }
+
+  public static uint switch_rtp_get_ssrc(SWIGTYPE_p_switch_rtp rtp_session) {
+    uint ret = freeswitchPINVOKE.switch_rtp_get_ssrc(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
+    return ret;
+  }
+
+  public static void switch_rtp_set_private(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_void private_data) {
+    freeswitchPINVOKE.switch_rtp_set_private(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_void.getCPtr(private_data));
+  }
+
+  public static void switch_rtp_set_telephony_event(SWIGTYPE_p_switch_rtp rtp_session, byte te) {
+    freeswitchPINVOKE.switch_rtp_set_telephony_event(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), te);
+  }
+
+  public static void switch_rtp_set_cng_pt(SWIGTYPE_p_switch_rtp rtp_session, byte pt) {
+    freeswitchPINVOKE.switch_rtp_set_cng_pt(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), pt);
+  }
+
+  public static SWIGTYPE_p_void switch_rtp_get_private(SWIGTYPE_p_switch_rtp rtp_session) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_rtp_get_private(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session));
+    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+    return ret;
+  }
+
+  public static switch_status_t switch_rtp_activate_stun_ping(SWIGTYPE_p_switch_rtp rtp_session, string stun_ip, ushort stun_port, uint packet_count, switch_bool_t funny) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_activate_stun_ping(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), stun_ip, stun_port, packet_count, (int)funny);
+    return ret;
+  }
+
+  public static void switch_rtp_intentional_bugs(SWIGTYPE_p_switch_rtp rtp_session, switch_rtp_bug_flag_t bugs) {
+    freeswitchPINVOKE.switch_rtp_intentional_bugs(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)bugs);
+  }
+
+  public static switch_rtp_stats_t switch_rtp_get_stats(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_apr_pool_t pool) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_rtp_get_stats(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
+    switch_rtp_stats_t ret = (cPtr == IntPtr.Zero) ? null : new switch_rtp_stats_t(cPtr, false);
+    return ret;
+  }
+
+  public static switch_status_t switch_log_init(SWIGTYPE_p_apr_pool_t pool, switch_bool_t colorize) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_log_init(SWIGTYPE_p_apr_pool_t.getCPtr(pool), (int)colorize);
+    return ret;
+  }
+
+  public static switch_status_t switch_log_shutdown() {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_log_shutdown();
+    return ret;
+  }
+
+  public static switch_status_t switch_log_bind_logger(SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t function, switch_log_level_t level, switch_bool_t is_console) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_log_bind_logger(SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t.getCPtr(function), (int)level, (int)is_console);
+    return ret;
+  }
+
+  public static switch_status_t switch_log_unbind_logger(SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t function) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_log_unbind_logger(SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t.getCPtr(function));
+    return ret;
+  }
+
+  public static string switch_log_level2str(switch_log_level_t level) {
+    string ret = freeswitchPINVOKE.switch_log_level2str((int)level);
+    return ret;
+  }
+
+  public static switch_log_level_t switch_log_str2level(string str) {
+    switch_log_level_t ret = (switch_log_level_t)freeswitchPINVOKE.switch_log_str2level(str);
+    return ret;
+  }
+
+  public static uint switch_log_str2mask(string str) {
+    uint ret = freeswitchPINVOKE.switch_log_str2mask(str);
+    return ret;
+  }
+
+  public static switch_log_node_t switch_log_node_dup(switch_log_node_t node) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_log_node_dup(switch_log_node_t.getCPtr(node));
+    switch_log_node_t ret = (cPtr == IntPtr.Zero) ? null : new switch_log_node_t(cPtr, false);
+    return ret;
+  }
+
+  public static void switch_log_node_free(SWIGTYPE_p_p_switch_log_node_t pnode) {
+    freeswitchPINVOKE.switch_log_node_free(SWIGTYPE_p_p_switch_log_node_t.getCPtr(pnode));
+  }
+
+  public static switch_xml switch_xml_parse_str_dynamic(string s, switch_bool_t dup) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_parse_str_dynamic(s, (int)dup);
+    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+    return ret;
+  }
+
+  public static switch_xml switch_xml_parse_str(string s, SWIGTYPE_p_switch_size_t len) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_parse_str(s, SWIGTYPE_p_switch_size_t.getCPtr(len));
+    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static switch_xml switch_xml_parse_fd(int fd) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_parse_fd(fd);
+    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+    return ret;
+  }
+
+  public static switch_xml switch_xml_parse_file(string file) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_parse_file(file);
+    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+    return ret;
+  }
+
+  public static switch_xml switch_xml_parse_file_simple(string file) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_parse_file_simple(file);
+    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+    return ret;
+  }
+
+  public static switch_xml switch_xml_parse_fp(SWIGTYPE_p_FILE fp) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_parse_fp(SWIGTYPE_p_FILE.getCPtr(fp));
+    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+    return ret;
+  }
+
+  public static switch_xml switch_xml_child(switch_xml xml, string name) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_child(switch_xml.getCPtr(xml), name);
+    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+    return ret;
+  }
+
+  public static switch_xml switch_xml_find_child(switch_xml node, string childname, string attrname, string value) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_find_child(switch_xml.getCPtr(node), childname, attrname, value);
+    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+    return ret;
+  }
+
+  public static switch_xml switch_xml_find_child_multi(switch_xml node, string childname) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_find_child_multi(switch_xml.getCPtr(node), childname);
+    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+    return ret;
+  }
+
+  public static string switch_xml_attr(switch_xml xml, string attr) {
+    string ret = freeswitchPINVOKE.switch_xml_attr(switch_xml.getCPtr(xml), attr);
+    return ret;
+  }
+
+  public static string switch_xml_attr_soft(switch_xml xml, string attr) {
+    string ret = freeswitchPINVOKE.switch_xml_attr_soft(switch_xml.getCPtr(xml), attr);
+    return ret;
+  }
+
+  public static switch_xml switch_xml_get(switch_xml xml) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_get(switch_xml.getCPtr(xml));
+    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+    return ret;
+  }
+
+  public static string switch_xml_toxml(switch_xml xml, switch_bool_t prn_header) {
+    string ret = freeswitchPINVOKE.switch_xml_toxml(switch_xml.getCPtr(xml), (int)prn_header);
+    return ret;
+  }
+
+  public static string switch_xml_toxml_buf(switch_xml xml, string buf, SWIGTYPE_p_switch_size_t buflen, SWIGTYPE_p_switch_size_t offset, switch_bool_t prn_header) {
+    string ret = freeswitchPINVOKE.switch_xml_toxml_buf(switch_xml.getCPtr(xml), buf, SWIGTYPE_p_switch_size_t.getCPtr(buflen), SWIGTYPE_p_switch_size_t.getCPtr(offset), (int)prn_header);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static void switch_xml_free(switch_xml xml) {
+    freeswitchPINVOKE.switch_xml_free(switch_xml.getCPtr(xml));
+  }
+
+  public static void switch_xml_free_in_thread(switch_xml xml, int stacksize) {
+    freeswitchPINVOKE.switch_xml_free_in_thread(switch_xml.getCPtr(xml), stacksize);
+  }
+
+  public static string switch_xml_error(switch_xml xml) {
+    string ret = freeswitchPINVOKE.switch_xml_error(switch_xml.getCPtr(xml));
+    return ret;
+  }
+
+  public static switch_xml switch_xml_new(string name) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_new(name);
+    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+    return ret;
+  }
+
+  public static switch_xml switch_xml_add_child(switch_xml xml, string name, SWIGTYPE_p_switch_size_t off) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_add_child(switch_xml.getCPtr(xml), name, SWIGTYPE_p_switch_size_t.getCPtr(off));
+    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static switch_xml switch_xml_set_txt(switch_xml xml, string txt) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_set_txt(switch_xml.getCPtr(xml), txt);
+    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+    return ret;
+  }
+
+  public static switch_xml switch_xml_set_attr(switch_xml xml, string name, string value) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_set_attr(switch_xml.getCPtr(xml), name, value);
+    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+    return ret;
+  }
+
+  public static switch_xml switch_xml_set_flag(switch_xml xml, switch_xml_flag_t flag) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_set_flag(switch_xml.getCPtr(xml), (int)flag);
+    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+    return ret;
+  }
+
+  public static switch_xml switch_xml_cut(switch_xml xml) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_cut(switch_xml.getCPtr(xml));
+    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+    return ret;
+  }
+
+  public static switch_xml switch_xml_insert(switch_xml xml, switch_xml dest, SWIGTYPE_p_switch_size_t off) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_insert(switch_xml.getCPtr(xml), switch_xml.getCPtr(dest), SWIGTYPE_p_switch_size_t.getCPtr(off));
+    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static switch_xml switch_xml_open_root(byte reload, ref string err) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_open_root(reload, ref err);
+    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+    return ret;
+  }
+
+  public static switch_status_t switch_xml_init(SWIGTYPE_p_apr_pool_t pool, ref string err) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_init(SWIGTYPE_p_apr_pool_t.getCPtr(pool), ref err);
+    return ret;
+  }
+
+  public static switch_status_t switch_xml_destroy() {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_destroy();
+    return ret;
+  }
+
+  public static switch_xml switch_xml_root() {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_root();
+    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+    return ret;
+  }
+
+  public static switch_status_t switch_xml_locate(string section, string tag_name, string key_name, string key_value, SWIGTYPE_p_p_switch_xml root, SWIGTYPE_p_p_switch_xml node, switch_event arg6, switch_bool_t clone) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_locate(section, tag_name, key_name, key_value, SWIGTYPE_p_p_switch_xml.getCPtr(root), SWIGTYPE_p_p_switch_xml.getCPtr(node), switch_event.getCPtr(arg6), (int)clone);
+    return ret;
+  }
+
+  public static switch_status_t switch_xml_locate_domain(string domain_name, switch_event arg1, SWIGTYPE_p_p_switch_xml root, SWIGTYPE_p_p_switch_xml domain) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_locate_domain(domain_name, switch_event.getCPtr(arg1), SWIGTYPE_p_p_switch_xml.getCPtr(root), SWIGTYPE_p_p_switch_xml.getCPtr(domain));
+    return ret;
+  }
+
+  public static switch_status_t switch_xml_locate_group(string group_name, string domain_name, SWIGTYPE_p_p_switch_xml root, SWIGTYPE_p_p_switch_xml domain, SWIGTYPE_p_p_switch_xml group, switch_event arg5) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_locate_group(group_name, domain_name, SWIGTYPE_p_p_switch_xml.getCPtr(root), SWIGTYPE_p_p_switch_xml.getCPtr(domain), SWIGTYPE_p_p_switch_xml.getCPtr(group), switch_event.getCPtr(arg5));
+    return ret;
+  }
+
+  public static switch_status_t switch_xml_locate_user(string key, string user_name, string domain_name, string ip, SWIGTYPE_p_p_switch_xml root, SWIGTYPE_p_p_switch_xml domain, SWIGTYPE_p_p_switch_xml user, SWIGTYPE_p_p_switch_xml ingroup, switch_event arg8) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_locate_user(key, user_name, domain_name, ip, SWIGTYPE_p_p_switch_xml.getCPtr(root), SWIGTYPE_p_p_switch_xml.getCPtr(domain), SWIGTYPE_p_p_switch_xml.getCPtr(user), SWIGTYPE_p_p_switch_xml.getCPtr(ingroup), switch_event.getCPtr(arg8));
+    return ret;
+  }
+
+  public static switch_status_t switch_xml_locate_user_in_domain(string user_name, switch_xml domain, SWIGTYPE_p_p_switch_xml user, SWIGTYPE_p_p_switch_xml ingroup) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_locate_user_in_domain(user_name, switch_xml.getCPtr(domain), SWIGTYPE_p_p_switch_xml.getCPtr(user), SWIGTYPE_p_p_switch_xml.getCPtr(ingroup));
+    return ret;
+  }
+
+  public static switch_xml switch_xml_open_cfg(string file_path, SWIGTYPE_p_p_switch_xml node, switch_event arg2) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_open_cfg(file_path, SWIGTYPE_p_p_switch_xml.getCPtr(node), switch_event.getCPtr(arg2));
+    switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+    return ret;
+  }
+
+  public static void switch_xml_set_binding_sections(SWIGTYPE_p_switch_xml_binding binding, uint sections) {
+    freeswitchPINVOKE.switch_xml_set_binding_sections(SWIGTYPE_p_switch_xml_binding.getCPtr(binding), sections);
+  }
+
+  public static void switch_xml_set_binding_user_data(SWIGTYPE_p_switch_xml_binding binding, SWIGTYPE_p_void user_data) {
+    freeswitchPINVOKE.switch_xml_set_binding_user_data(SWIGTYPE_p_switch_xml_binding.getCPtr(binding), SWIGTYPE_p_void.getCPtr(user_data));
+  }
+
+  public static uint switch_xml_get_binding_sections(SWIGTYPE_p_switch_xml_binding binding) {
+    uint ret = freeswitchPINVOKE.switch_xml_get_binding_sections(SWIGTYPE_p_switch_xml_binding.getCPtr(binding));
+    return ret;
+  }
+
+  public static SWIGTYPE_p_void switch_xml_get_binding_user_data(SWIGTYPE_p_switch_xml_binding binding) {
+    IntPtr cPtr = freeswitchPINVOKE.switch_xml_get_binding_user_data(SWIGTYPE_p_switch_xml_binding.getCPtr(binding));
+    SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+    return ret;
+  }
+
+  public static switch_status_t switch_xml_bind_search_function_ret(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml function, uint sections, SWIGTYPE_p_void user_data, SWIGTYPE_p_p_switch_xml_binding ret_binding) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_bind_search_function_ret(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml.getCPtr(function), sections, SWIGTYPE_p_void.getCPtr(user_data), SWIGTYPE_p_p_switch_xml_binding.getCPtr(ret_binding));
+    return ret;
+  }
+
+  public static switch_status_t switch_xml_unbind_search_function(SWIGTYPE_p_p_switch_xml_binding binding) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_unbind_search_function(SWIGTYPE_p_p_switch_xml_binding.getCPtr(binding));
+    return ret;
+  }
+
+  public static switch_status_t switch_xml_unbind_search_function_ptr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml function) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_unbind_search_function_ptr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml.getCPtr(function));
+    return ret;
+  }
+
+  public static uint switch_xml_parse_section_string(string str) {
+    uint ret = freeswitchPINVOKE.switch_xml_parse_section_string(str);
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_add_outgoing_channel(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t outgoing_channel) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_outgoing_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t.getCPtr(outgoing_channel));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_add_receive_message(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t receive_message) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_receive_message(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t.getCPtr(receive_message));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_add_receive_event(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t receive_event) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_receive_event(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t.getCPtr(receive_event));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_add_state_change(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session__switch_status_t state_change) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_state_change(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(state_change));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_add_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t read_frame) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(read_frame));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_add_write_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t write_frame) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_write_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(write_frame));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_add_video_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t video_read_frame) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_video_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(video_read_frame));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_add_video_write_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t video_write_frame) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_video_write_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(video_write_frame));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_add_kill_channel(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t kill_channel) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_kill_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t.getCPtr(kill_channel));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_add_send_dtmf(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t send_dtmf) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_send_dtmf(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t.getCPtr(send_dtmf));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_add_recv_dtmf(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t recv_dtmf) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_recv_dtmf(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t.getCPtr(recv_dtmf));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_add_resurrect_session(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t resurrect_session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_resurrect_session(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t.getCPtr(resurrect_session));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_remove_outgoing_channel(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t outgoing_channel) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_outgoing_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t.getCPtr(outgoing_channel));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_remove_receive_message(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t receive_message) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_receive_message(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t.getCPtr(receive_message));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_remove_receive_event(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t receive_event) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_receive_event(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t.getCPtr(receive_event));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_remove_state_change(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session__switch_status_t state_change) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_state_change(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(state_change));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_remove_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t read_frame) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(read_frame));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_remove_write_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t write_frame) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_write_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(write_frame));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_remove_video_read_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t video_read_frame) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_video_read_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(video_read_frame));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_remove_video_write_frame(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t video_write_frame) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_video_write_frame(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(video_write_frame));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_remove_kill_channel(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t kill_channel) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_kill_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t.getCPtr(kill_channel));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_remove_send_dtmf(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t send_dtmf) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_send_dtmf(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t.getCPtr(send_dtmf));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_remove_recv_dtmf(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t recv_dtmf) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_recv_dtmf(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t.getCPtr(recv_dtmf));
+    return ret;
+  }
+
+  public static switch_status_t switch_core_event_hook_remove_resurrect_session(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t resurrect_session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_remove_resurrect_session(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t.getCPtr(resurrect_session));
+    return ret;
+  }
+
+  public static uint switch_scheduler_add_task(SWIGTYPE_p_time_t task_runtime, SWIGTYPE_p_f_p_switch_scheduler_task__void func, string desc, string group, uint cmd_id, SWIGTYPE_p_void cmd_arg, uint flags) {
+    uint ret = freeswitchPINVOKE.switch_scheduler_add_task(SWIGTYPE_p_time_t.getCPtr(task_runtime), SWIGTYPE_p_f_p_switch_scheduler_task__void.getCPtr(func), desc, group, cmd_id, SWIGTYPE_p_void.getCPtr(cmd_arg), flags);
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    return ret;
+  }
+
+  public static uint switch_scheduler_del_task_id(uint task_id) {
+    uint ret = freeswitchPINVOKE.switch_scheduler_del_task_id(task_id);
+    return ret;
+  }
+
+  public static uint switch_scheduler_del_task_group(string group) {
+    uint ret = freeswitchPINVOKE.switch_scheduler_del_task_group(group);
+    return ret;
+  }
+
+  public static void switch_scheduler_task_thread_start() {
+    freeswitchPINVOKE.switch_scheduler_task_thread_start();
+  }
+
+  public static void switch_scheduler_task_thread_stop() {
+    freeswitchPINVOKE.switch_scheduler_task_thread_stop();
+  }
+
+  public static int switch_config_open_file(switch_config cfg, string file_path) {
+    int ret = freeswitchPINVOKE.switch_config_open_file(switch_config.getCPtr(cfg), file_path);
+    return ret;
+  }
+
+  public static void switch_config_close_file(switch_config cfg) {
+    freeswitchPINVOKE.switch_config_close_file(switch_config.getCPtr(cfg));
+  }
+
+  public static int switch_config_next_pair(switch_config cfg, ref string var, ref string val) {
+    int ret = freeswitchPINVOKE.switch_config_next_pair(switch_config.getCPtr(cfg), ref var, ref val);
+    return ret;
+  }
+
+  public static void consoleLog(string level_str, string msg) {
+    freeswitchPINVOKE.consoleLog(level_str, msg);
+  }
+
+  public static void consoleCleanLog(string msg) {
+    freeswitchPINVOKE.consoleCleanLog(msg);
+  }
+
+  public static void console_log(string level_str, string msg) {
+    freeswitchPINVOKE.console_log(level_str, msg);
+  }
+
+  public static void console_clean_log(string msg) {
+    freeswitchPINVOKE.console_clean_log(msg);
+  }
+
+  public static void msleep(uint ms) {
+    freeswitchPINVOKE.msleep(ms);
+  }
+
+  public static void bridge(CoreSession session_a, CoreSession session_b) {
+    freeswitchPINVOKE.bridge(CoreSession.getCPtr(session_a), CoreSession.getCPtr(session_b));
+    if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+  }
+
+  public static switch_status_t hanguphook(SWIGTYPE_p_switch_core_session session) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.hanguphook(SWIGTYPE_p_switch_core_session.getCPtr(session));
+    return ret;
+  }
+
+  public static switch_status_t dtmf_callback(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_void input, switch_input_type_t itype, SWIGTYPE_p_void buf, uint buflen) {
+    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.dtmf_callback(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_void.getCPtr(input), (int)itype, SWIGTYPE_p_void.getCPtr(buf), buflen);
+    return ret;
+  }
+
+  public static readonly string FREESWITCH_PEN = freeswitchPINVOKE.FREESWITCH_PEN_get();
+  public static readonly string FREESWITCH_OID_PREFIX = freeswitchPINVOKE.FREESWITCH_OID_PREFIX_get();
+  public static readonly string FREESWITCH_ITAD = freeswitchPINVOKE.FREESWITCH_ITAD_get();
+  public static readonly int __EXTENSIONS__ = freeswitchPINVOKE.__EXTENSIONS___get();
+  public static readonly int __BSD_VISIBLE = freeswitchPINVOKE.__BSD_VISIBLE_get();
+  public static readonly string SWITCH_ENT_ORIGINATE_DELIM = freeswitchPINVOKE.SWITCH_ENT_ORIGINATE_DELIM_get();
+  public static readonly string SWITCH_BLANK_STRING = freeswitchPINVOKE.SWITCH_BLANK_STRING_get();
+  public static readonly string SWITCH_SEQ_ESC = freeswitchPINVOKE.SWITCH_SEQ_ESC_get();
+  public static readonly char SWITCH_SEQ_HOME_CHAR = freeswitchPINVOKE.SWITCH_SEQ_HOME_CHAR_get();
+  public static readonly string SWITCH_SEQ_HOME_CHAR_STR = freeswitchPINVOKE.SWITCH_SEQ_HOME_CHAR_STR_get();
+  public static readonly char SWITCH_SEQ_CLEARLINE_CHAR = freeswitchPINVOKE.SWITCH_SEQ_CLEARLINE_CHAR_get();
+  public static readonly string SWITCH_SEQ_CLEARLINE_CHAR_STR = freeswitchPINVOKE.SWITCH_SEQ_CLEARLINE_CHAR_STR_get();
+  public static readonly string SWITCH_SEQ_CLEARLINEEND_CHAR = freeswitchPINVOKE.SWITCH_SEQ_CLEARLINEEND_CHAR_get();
+  public static readonly char SWITCH_SEQ_CLEARSCR_CHAR0 = freeswitchPINVOKE.SWITCH_SEQ_CLEARSCR_CHAR0_get();
+  public static readonly char SWITCH_SEQ_CLEARSCR_CHAR1 = freeswitchPINVOKE.SWITCH_SEQ_CLEARSCR_CHAR1_get();
+  public static readonly string SWITCH_SEQ_CLEARSCR_CHAR = freeswitchPINVOKE.SWITCH_SEQ_CLEARSCR_CHAR_get();
+  public static readonly string SWITCH_SEQ_AND_COLOR = freeswitchPINVOKE.SWITCH_SEQ_AND_COLOR_get();
+  public static readonly string SWITCH_SEQ_END_COLOR = freeswitchPINVOKE.SWITCH_SEQ_END_COLOR_get();
+  public static readonly string SWITCH_SEQ_F_BLACK = freeswitchPINVOKE.SWITCH_SEQ_F_BLACK_get();
+  public static readonly string SWITCH_SEQ_F_RED = freeswitchPINVOKE.SWITCH_SEQ_F_RED_get();
+  public static readonly string SWITCH_SEQ_F_GREEN = freeswitchPINVOKE.SWITCH_SEQ_F_GREEN_get();
+  public static readonly string SWITCH_SEQ_F_YELLOW = freeswitchPINVOKE.SWITCH_SEQ_F_YELLOW_get();
+  public static readonly string SWITCH_SEQ_F_BLUE = freeswitchPINVOKE.SWITCH_SEQ_F_BLUE_get();
+  public static readonly string SWITCH_SEQ_F_MAGEN = freeswitchPINVOKE.SWITCH_SEQ_F_MAGEN_get();
+  public static readonly string SWITCH_SEQ_F_CYAN = freeswitchPINVOKE.SWITCH_SEQ_F_CYAN_get();
+  public static readonly string SWITCH_SEQ_F_WHITE = freeswitchPINVOKE.SWITCH_SEQ_F_WHITE_get();
+  public static readonly string SWITCH_SEQ_B_BLACK = freeswitchPINVOKE.SWITCH_SEQ_B_BLACK_get();
+  public static readonly string SWITCH_SEQ_B_RED = freeswitchPINVOKE.SWITCH_SEQ_B_RED_get();
+  public static readonly string SWITCH_SEQ_B_GREEN = freeswitchPINVOKE.SWITCH_SEQ_B_GREEN_get();
+  public static readonly string SWITCH_SEQ_B_YELLOW = freeswitchPINVOKE.SWITCH_SEQ_B_YELLOW_get();
+  public static readonly string SWITCH_SEQ_B_BLUE = freeswitchPINVOKE.SWITCH_SEQ_B_BLUE_get();
+  public static readonly string SWITCH_SEQ_B_MAGEN = freeswitchPINVOKE.SWITCH_SEQ_B_MAGEN_get();
+  public static readonly string SWITCH_SEQ_B_CYAN = freeswitchPINVOKE.SWITCH_SEQ_B_CYAN_get();
+  public static readonly string SWITCH_SEQ_B_WHITE = freeswitchPINVOKE.SWITCH_SEQ_B_WHITE_get();
+  public static readonly string SWITCH_SEQ_FBLACK = freeswitchPINVOKE.SWITCH_SEQ_FBLACK_get();
+  public static readonly string SWITCH_SEQ_FRED = freeswitchPINVOKE.SWITCH_SEQ_FRED_get();
+  public static readonly string SWITCH_SEQ_FGREEN = freeswitchPINVOKE.SWITCH_SEQ_FGREEN_get();
+  public static readonly string SWITCH_SEQ_FYELLOW = freeswitchPINVOKE.SWITCH_SEQ_FYELLOW_get();
+  public static readonly string SWITCH_SEQ_FBLUE = freeswitchPINVOKE.SWITCH_SEQ_FBLUE_get();
+  public static readonly string SWITCH_SEQ_FMAGEN = freeswitchPINVOKE.SWITCH_SEQ_FMAGEN_get();
+  public static readonly string SWITCH_SEQ_FCYAN = freeswitchPINVOKE.SWITCH_SEQ_FCYAN_get();
+  public static readonly string SWITCH_SEQ_FWHITE = freeswitchPINVOKE.SWITCH_SEQ_FWHITE_get();
+  public static readonly string SWITCH_SEQ_BBLACK = freeswitchPINVOKE.SWITCH_SEQ_BBLACK_get();
+  public static readonly string SWITCH_SEQ_BRED = freeswitchPINVOKE.SWITCH_SEQ_BRED_get();
+  public static readonly string SWITCH_SEQ_BGREEN = freeswitchPINVOKE.SWITCH_SEQ_BGREEN_get();
+  public static readonly string SWITCH_SEQ_BYELLOW = freeswitchPINVOKE.SWITCH_SEQ_BYELLOW_get();
+  public static readonly string SWITCH_SEQ_BBLUE = freeswitchPINVOKE.SWITCH_SEQ_BBLUE_get();
+  public static readonly string SWITCH_SEQ_BMAGEN = freeswitchPINVOKE.SWITCH_SEQ_BMAGEN_get();
+  public static readonly string SWITCH_SEQ_BCYAN = freeswitchPINVOKE.SWITCH_SEQ_BCYAN_get();
+  public static readonly string SWITCH_SEQ_BWHITE = freeswitchPINVOKE.SWITCH_SEQ_BWHITE_get();
+  public static readonly string SWITCH_SEQ_HOME = freeswitchPINVOKE.SWITCH_SEQ_HOME_get();
+  public static readonly string SWITCH_SEQ_CLEARLINE = freeswitchPINVOKE.SWITCH_SEQ_CLEARLINE_get();
+  public static readonly string SWITCH_SEQ_CLEARLINEEND = freeswitchPINVOKE.SWITCH_SEQ_CLEARLINEEND_get();
+  public static readonly string SWITCH_SEQ_CLEARSCR = freeswitchPINVOKE.SWITCH_SEQ_CLEARSCR_get();
+  public static readonly string SWITCH_DEFAULT_CLID_NAME = freeswitchPINVOKE.SWITCH_DEFAULT_CLID_NAME_get();
+  public static readonly int SWITCH_DEFAULT_DTMF_DURATION = freeswitchPINVOKE.SWITCH_DEFAULT_DTMF_DURATION_get();
+  public static readonly int SWITCH_MIN_DTMF_DURATION = freeswitchPINVOKE.SWITCH_MIN_DTMF_DURATION_get();
+  public static readonly int SWITCH_MAX_DTMF_DURATION = freeswitchPINVOKE.SWITCH_MAX_DTMF_DURATION_get();
+  public static readonly string SWITCH_PATH_SEPARATOR = freeswitchPINVOKE.SWITCH_PATH_SEPARATOR_get();
+  public static readonly string SWITCH_URL_SEPARATOR = freeswitchPINVOKE.SWITCH_URL_SEPARATOR_get();
+  public static readonly string SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE = freeswitchPINVOKE.SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE_get();
+  public static readonly string SWITCH_AUDIO_SPOOL_PATH_VARIABLE = freeswitchPINVOKE.SWITCH_AUDIO_SPOOL_PATH_VARIABLE_get();
+  public static readonly string SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE = freeswitchPINVOKE.SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE_get();
+  public static readonly string SWITCH_READ_TERMINATOR_USED_VARIABLE = freeswitchPINVOKE.SWITCH_READ_TERMINATOR_USED_VARIABLE_get();
+  public static readonly string SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE = freeswitchPINVOKE.SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE_get();
+  public static readonly string SWITCH_CURRENT_APPLICATION_VARIABLE = freeswitchPINVOKE.SWITCH_CURRENT_APPLICATION_VARIABLE_get();
+  public static readonly string SWITCH_CURRENT_APPLICATION_DATA_VARIABLE = freeswitchPINVOKE.SWITCH_CURRENT_APPLICATION_DATA_VARIABLE_get();
+  public static readonly string SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE = freeswitchPINVOKE.SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE_get();
+  public static readonly string SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE = freeswitchPINVOKE.SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get();
+  public static readonly string SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE_get();
+  public static readonly string SWITCH_READ_RESULT_VARIABLE = freeswitchPINVOKE.SWITCH_READ_RESULT_VARIABLE_get();
+  public static readonly string SWITCH_COPY_XML_CDR_VARIABLE = freeswitchPINVOKE.SWITCH_COPY_XML_CDR_VARIABLE_get();
+  public static readonly string SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE = freeswitchPINVOKE.SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE_get();
+  public static readonly string SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE_get();
+  public static readonly string SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE_get();
+  public static readonly string SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE_get();
+  public static readonly string SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE_get();
+  public static readonly string SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get();
+  public static readonly string SWITCH_CALL_TIMEOUT_VARIABLE = freeswitchPINVOKE.SWITCH_CALL_TIMEOUT_VARIABLE_get();
+  public static readonly string SWITCH_HOLDING_UUID_VARIABLE = freeswitchPINVOKE.SWITCH_HOLDING_UUID_VARIABLE_get();
+  public static readonly string SWITCH_SOFT_HOLDING_UUID_VARIABLE = freeswitchPINVOKE.SWITCH_SOFT_HOLDING_UUID_VARIABLE_get();
+  public static readonly string SWITCH_API_BRIDGE_END_VARIABLE = freeswitchPINVOKE.SWITCH_API_BRIDGE_END_VARIABLE_get();
+  public static readonly string SWITCH_API_HANGUP_HOOK_VARIABLE = freeswitchPINVOKE.SWITCH_API_HANGUP_HOOK_VARIABLE_get();
+  public static readonly string SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE = freeswitchPINVOKE.SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE_get();
+  public static readonly string SWITCH_PROCESS_CDR_VARIABLE = freeswitchPINVOKE.SWITCH_PROCESS_CDR_VARIABLE_get();
+  public static readonly string SWITCH_BRIDGE_CHANNEL_VARIABLE = freeswitchPINVOKE.SWITCH_BRIDGE_CHANNEL_VARIABLE_get();
+  public static readonly string SWITCH_CHANNEL_NAME_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_NAME_VARIABLE_get();
+  public static readonly string SWITCH_BRIDGE_UUID_VARIABLE = freeswitchPINVOKE.SWITCH_BRIDGE_UUID_VARIABLE_get();
+  public static readonly string SWITCH_CONTINUE_ON_FAILURE_VARIABLE = freeswitchPINVOKE.SWITCH_CONTINUE_ON_FAILURE_VARIABLE_get();
+  public static readonly string SWITCH_PLAYBACK_TERMINATORS_VARIABLE = freeswitchPINVOKE.SWITCH_PLAYBACK_TERMINATORS_VARIABLE_get();
+  public static readonly string SWITCH_PLAYBACK_TERMINATOR_USED = freeswitchPINVOKE.SWITCH_PLAYBACK_TERMINATOR_USED_get();
+  public static readonly string SWITCH_CACHE_SPEECH_HANDLES_VARIABLE = freeswitchPINVOKE.SWITCH_CACHE_SPEECH_HANDLES_VARIABLE_get();
+  public static readonly string SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME = freeswitchPINVOKE.SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME_get();
+  public static readonly string SWITCH_BYPASS_MEDIA_VARIABLE = freeswitchPINVOKE.SWITCH_BYPASS_MEDIA_VARIABLE_get();
+  public static readonly string SWITCH_PROXY_MEDIA_VARIABLE = freeswitchPINVOKE.SWITCH_PROXY_MEDIA_VARIABLE_get();
+  public static readonly string SWITCH_ENDPOINT_DISPOSITION_VARIABLE = freeswitchPINVOKE.SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get();
+  public static readonly string SWITCH_HOLD_MUSIC_VARIABLE = freeswitchPINVOKE.SWITCH_HOLD_MUSIC_VARIABLE_get();
+  public static readonly string SWITCH_EXPORT_VARS_VARIABLE = freeswitchPINVOKE.SWITCH_EXPORT_VARS_VARIABLE_get();
+  public static readonly string SWITCH_R_SDP_VARIABLE = freeswitchPINVOKE.SWITCH_R_SDP_VARIABLE_get();
+  public static readonly string SWITCH_L_SDP_VARIABLE = freeswitchPINVOKE.SWITCH_L_SDP_VARIABLE_get();
+  public static readonly string SWITCH_B_SDP_VARIABLE = freeswitchPINVOKE.SWITCH_B_SDP_VARIABLE_get();
+  public static readonly string SWITCH_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_BRIDGE_VARIABLE_get();
+  public static readonly string SWITCH_SIGNAL_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_SIGNAL_BRIDGE_VARIABLE_get();
+  public static readonly string SWITCH_SIGNAL_BOND_VARIABLE = freeswitchPINVOKE.SWITCH_SIGNAL_BOND_VARIABLE_get();
+  public static readonly string SWITCH_ORIGINATOR_VARIABLE = freeswitchPINVOKE.SWITCH_ORIGINATOR_VARIABLE_get();
+  public static readonly string SWITCH_ORIGINATOR_CODEC_VARIABLE = freeswitchPINVOKE.SWITCH_ORIGINATOR_CODEC_VARIABLE_get();
+  public static readonly string SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE = freeswitchPINVOKE.SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE_get();
+  public static readonly string SWITCH_LOCAL_MEDIA_IP_VARIABLE = freeswitchPINVOKE.SWITCH_LOCAL_MEDIA_IP_VARIABLE_get();
+  public static readonly string SWITCH_LOCAL_MEDIA_PORT_VARIABLE = freeswitchPINVOKE.SWITCH_LOCAL_MEDIA_PORT_VARIABLE_get();
+  public static readonly string SWITCH_REMOTE_MEDIA_IP_VARIABLE = freeswitchPINVOKE.SWITCH_REMOTE_MEDIA_IP_VARIABLE_get();
+  public static readonly string SWITCH_REMOTE_MEDIA_PORT_VARIABLE = freeswitchPINVOKE.SWITCH_REMOTE_MEDIA_PORT_VARIABLE_get();
+  public static readonly string SWITCH_REMOTE_VIDEO_IP_VARIABLE = freeswitchPINVOKE.SWITCH_REMOTE_VIDEO_IP_VARIABLE_get();
+  public static readonly string SWITCH_REMOTE_VIDEO_PORT_VARIABLE = freeswitchPINVOKE.SWITCH_REMOTE_VIDEO_PORT_VARIABLE_get();
+  public static readonly string SWITCH_LOCAL_VIDEO_IP_VARIABLE = freeswitchPINVOKE.SWITCH_LOCAL_VIDEO_IP_VARIABLE_get();
+  public static readonly string SWITCH_LOCAL_VIDEO_PORT_VARIABLE = freeswitchPINVOKE.SWITCH_LOCAL_VIDEO_PORT_VARIABLE_get();
+  public static readonly string SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE_get();
+  public static readonly string SWITCH_PARK_AFTER_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_PARK_AFTER_BRIDGE_VARIABLE_get();
+  public static readonly string SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE = freeswitchPINVOKE.SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE_get();
+  public static readonly string SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE = freeswitchPINVOKE.SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE_get();
+  public static readonly string SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE = freeswitchPINVOKE.SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE_get();
+  public static readonly string SWITCH_MAX_FORWARDS_VARIABLE = freeswitchPINVOKE.SWITCH_MAX_FORWARDS_VARIABLE_get();
+  public static readonly string SWITCH_DISABLE_APP_LOG_VARIABLE = freeswitchPINVOKE.SWITCH_DISABLE_APP_LOG_VARIABLE_get();
+  public static readonly string SWITCH_SPEECH_KEY = freeswitchPINVOKE.SWITCH_SPEECH_KEY_get();
+  public static readonly string SWITCH_UUID_BRIDGE = freeswitchPINVOKE.SWITCH_UUID_BRIDGE_get();
+  public static readonly int SWITCH_BITS_PER_BYTE = freeswitchPINVOKE.SWITCH_BITS_PER_BYTE_get();
+  public static readonly int SWITCH_DEFAULT_FILE_BUFFER_LEN = freeswitchPINVOKE.SWITCH_DEFAULT_FILE_BUFFER_LEN_get();
+  public static readonly int SWITCH_DTMF_LOG_LEN = freeswitchPINVOKE.SWITCH_DTMF_LOG_LEN_get();
+  public static readonly int SWITCH_MAX_STACKS = freeswitchPINVOKE.SWITCH_MAX_STACKS_get();
+  public static readonly int SWITCH_THREAD_STACKSIZE = freeswitchPINVOKE.SWITCH_THREAD_STACKSIZE_get();
+  public static readonly int SWITCH_SYSTEM_THREAD_STACKSIZE = freeswitchPINVOKE.SWITCH_SYSTEM_THREAD_STACKSIZE_get();
+  public static readonly int SWITCH_MAX_INTERVAL = freeswitchPINVOKE.SWITCH_MAX_INTERVAL_get();
+  public static readonly int SWITCH_INTERVAL_PAD = freeswitchPINVOKE.SWITCH_INTERVAL_PAD_get();
+  public static readonly int SWITCH_MAX_SAMPLE_LEN = freeswitchPINVOKE.SWITCH_MAX_SAMPLE_LEN_get();
+  public static readonly int SWITCH_BYTES_PER_SAMPLE = freeswitchPINVOKE.SWITCH_BYTES_PER_SAMPLE_get();
+  public static readonly int SWITCH_RECOMMENDED_BUFFER_SIZE = freeswitchPINVOKE.SWITCH_RECOMMENDED_BUFFER_SIZE_get();
+  public static readonly int SWITCH_MAX_CODECS = freeswitchPINVOKE.SWITCH_MAX_CODECS_get();
+  public static readonly int SWITCH_MAX_STATE_HANDLERS = freeswitchPINVOKE.SWITCH_MAX_STATE_HANDLERS_get();
+  public static readonly int SWITCH_CORE_QUEUE_LEN = freeswitchPINVOKE.SWITCH_CORE_QUEUE_LEN_get();
+  public static readonly int SWITCH_MAX_MANAGEMENT_BUFFER_LEN = freeswitchPINVOKE.SWITCH_MAX_MANAGEMENT_BUFFER_LEN_get();
+  public static readonly int SWITCH_RTP_CNG_PAYLOAD = freeswitchPINVOKE.SWITCH_RTP_CNG_PAYLOAD_get();
+  public static readonly int SWITCH_API_VERSION = freeswitchPINVOKE.SWITCH_API_VERSION_get();
+  public static readonly int SWITCH_CORE_DB_OK = freeswitchPINVOKE.SWITCH_CORE_DB_OK_get();
+  public static readonly int SWITCH_CORE_DB_ERROR = freeswitchPINVOKE.SWITCH_CORE_DB_ERROR_get();
+  public static readonly int SWITCH_CORE_DB_INTERNAL = freeswitchPINVOKE.SWITCH_CORE_DB_INTERNAL_get();
+  public static readonly int SWITCH_CORE_DB_PERM = freeswitchPINVOKE.SWITCH_CORE_DB_PERM_get();
+  public static readonly int SWITCH_CORE_DB_ABORT = freeswitchPINVOKE.SWITCH_CORE_DB_ABORT_get();
+  public static readonly int SWITCH_CORE_DB_BUSY = freeswitchPINVOKE.SWITCH_CORE_DB_BUSY_get();
+  public static readonly int SWITCH_CORE_DB_LOCKED = freeswitchPINVOKE.SWITCH_CORE_DB_LOCKED_get();
+  public static readonly int SWITCH_CORE_DB_NOMEM = freeswitchPINVOKE.SWITCH_CORE_DB_NOMEM_get();
+  public static readonly int SWITCH_CORE_DB_READONLY = freeswitchPINVOKE.SWITCH_CORE_DB_READONLY_get();
+  public static readonly int SWITCH_CORE_DB_INTERRUPT = freeswitchPINVOKE.SWITCH_CORE_DB_INTERRUPT_get();
+  public static readonly int SWITCH_CORE_DB_IOERR = freeswitchPINVOKE.SWITCH_CORE_DB_IOERR_get();
+  public static readonly int SWITCH_CORE_DB_CORRUPT = freeswitchPINVOKE.SWITCH_CORE_DB_CORRUPT_get();
+  public static readonly int SWITCH_CORE_DB_NOTFOUND = freeswitchPINVOKE.SWITCH_CORE_DB_NOTFOUND_get();
+  public static readonly int SWITCH_CORE_DB_FULL = freeswitchPINVOKE.SWITCH_CORE_DB_FULL_get();
+  public static readonly int SWITCH_CORE_DB_CANTOPEN = freeswitchPINVOKE.SWITCH_CORE_DB_CANTOPEN_get();
+  public static readonly int SWITCH_CORE_DB_PROTOCOL = freeswitchPINVOKE.SWITCH_CORE_DB_PROTOCOL_get();
+  public static readonly int SWITCH_CORE_DB_EMPTY = freeswitchPINVOKE.SWITCH_CORE_DB_EMPTY_get();
+  public static readonly int SWITCH_CORE_DB_SCHEMA = freeswitchPINVOKE.SWITCH_CORE_DB_SCHEMA_get();
+  public static readonly int SWITCH_CORE_DB_TOOBIG = freeswitchPINVOKE.SWITCH_CORE_DB_TOOBIG_get();
+  public static readonly int SWITCH_CORE_DB_CONSTRAINT = freeswitchPINVOKE.SWITCH_CORE_DB_CONSTRAINT_get();
+  public static readonly int SWITCH_CORE_DB_MISMATCH = freeswitchPINVOKE.SWITCH_CORE_DB_MISMATCH_get();
+  public static readonly int SWITCH_CORE_DB_MISUSE = freeswitchPINVOKE.SWITCH_CORE_DB_MISUSE_get();
+  public static readonly int SWITCH_CORE_DB_NOLFS = freeswitchPINVOKE.SWITCH_CORE_DB_NOLFS_get();
+  public static readonly int SWITCH_CORE_DB_AUTH = freeswitchPINVOKE.SWITCH_CORE_DB_AUTH_get();
+  public static readonly int SWITCH_CORE_DB_FORMAT = freeswitchPINVOKE.SWITCH_CORE_DB_FORMAT_get();
+  public static readonly int SWITCH_CORE_DB_RANGE = freeswitchPINVOKE.SWITCH_CORE_DB_RANGE_get();
+  public static readonly int SWITCH_CORE_DB_NOTADB = freeswitchPINVOKE.SWITCH_CORE_DB_NOTADB_get();
+  public static readonly int SWITCH_CORE_DB_ROW = freeswitchPINVOKE.SWITCH_CORE_DB_ROW_get();
+  public static readonly int SWITCH_CORE_DB_DONE = freeswitchPINVOKE.SWITCH_CORE_DB_DONE_get();
+  public static readonly int SWITCH_MAX_CORE_THREAD_SESSION_OBJS = freeswitchPINVOKE.SWITCH_MAX_CORE_THREAD_SESSION_OBJS_get();
+  public static readonly int SWITCH_MAX_STREAMS = freeswitchPINVOKE.SWITCH_MAX_STREAMS_get();
+  public static readonly int MESSAGE_STRING_ARG_MAX = freeswitchPINVOKE.MESSAGE_STRING_ARG_MAX_get();
+  public static readonly int CACHE_DB_LEN = freeswitchPINVOKE.CACHE_DB_LEN_get();
+  public static readonly int SWITCH_CMD_CHUNK_LEN = freeswitchPINVOKE.SWITCH_CMD_CHUNK_LEN_get();
+  public static readonly int SWITCH_SMAX = freeswitchPINVOKE.SWITCH_SMAX_get();
+  public static readonly int SWITCH_SMIN = freeswitchPINVOKE.SWITCH_SMIN_get();
+  public static readonly int SWITCH_RESAMPLE_QUALITY = freeswitchPINVOKE.SWITCH_RESAMPLE_QUALITY_get();
+  public static readonly int SWITCH_RTP_MAX_BUF_LEN = freeswitchPINVOKE.SWITCH_RTP_MAX_BUF_LEN_get();
+  public static readonly int SWITCH_RTP_MAX_CRYPTO_LEN = freeswitchPINVOKE.SWITCH_RTP_MAX_CRYPTO_LEN_get();
+  public static readonly int SWITCH_RTP_KEY_LEN = freeswitchPINVOKE.SWITCH_RTP_KEY_LEN_get();
+  public static readonly string SWITCH_RTP_CRYPTO_KEY_32 = freeswitchPINVOKE.SWITCH_RTP_CRYPTO_KEY_32_get();
+  public static readonly string SWITCH_RTP_CRYPTO_KEY_80 = freeswitchPINVOKE.SWITCH_RTP_CRYPTO_KEY_80_get();
+  public static readonly int SWITCH_XML_BUFSIZE = freeswitchPINVOKE.SWITCH_XML_BUFSIZE_get();
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+class freeswitchPINVOKE {
+
+  protected class SWIGExceptionHelper {
+
+    public delegate void ExceptionDelegate(string message);
+    public delegate void ExceptionArgumentDelegate(string message, string paramName);
+
+    static ExceptionDelegate applicationDelegate = new ExceptionDelegate(SetPendingApplicationException);
+    static ExceptionDelegate arithmeticDelegate = new ExceptionDelegate(SetPendingArithmeticException);
+    static ExceptionDelegate divideByZeroDelegate = new ExceptionDelegate(SetPendingDivideByZeroException);
+    static ExceptionDelegate indexOutOfRangeDelegate = new ExceptionDelegate(SetPendingIndexOutOfRangeException);
+    static ExceptionDelegate invalidCastDelegate = new ExceptionDelegate(SetPendingInvalidCastException);
+    static ExceptionDelegate invalidOperationDelegate = new ExceptionDelegate(SetPendingInvalidOperationException);
+    static ExceptionDelegate ioDelegate = new ExceptionDelegate(SetPendingIOException);
+    static ExceptionDelegate nullReferenceDelegate = new ExceptionDelegate(SetPendingNullReferenceException);
+    static ExceptionDelegate outOfMemoryDelegate = new ExceptionDelegate(SetPendingOutOfMemoryException);
+    static ExceptionDelegate overflowDelegate = new ExceptionDelegate(SetPendingOverflowException);
+    static ExceptionDelegate systemDelegate = new ExceptionDelegate(SetPendingSystemException);
+
+    static ExceptionArgumentDelegate argumentDelegate = new ExceptionArgumentDelegate(SetPendingArgumentException);
+    static ExceptionArgumentDelegate argumentNullDelegate = new ExceptionArgumentDelegate(SetPendingArgumentNullException);
+    static ExceptionArgumentDelegate argumentOutOfRangeDelegate = new ExceptionArgumentDelegate(SetPendingArgumentOutOfRangeException);
+
+    [DllImport("mod_managed", EntryPoint="SWIGRegisterExceptionCallbacks_freeswitch")]
+    public static extern void SWIGRegisterExceptionCallbacks_freeswitch(
+                                ExceptionDelegate applicationDelegate,
+                                ExceptionDelegate arithmeticDelegate,
+                                ExceptionDelegate divideByZeroDelegate, 
+                                ExceptionDelegate indexOutOfRangeDelegate, 
+                                ExceptionDelegate invalidCastDelegate,
+                                ExceptionDelegate invalidOperationDelegate,
+                                ExceptionDelegate ioDelegate,
+                                ExceptionDelegate nullReferenceDelegate,
+                                ExceptionDelegate outOfMemoryDelegate, 
+                                ExceptionDelegate overflowDelegate, 
+                                ExceptionDelegate systemExceptionDelegate);
+
+    [DllImport("mod_managed", EntryPoint="SWIGRegisterExceptionArgumentCallbacks_freeswitch")]
+    public static extern void SWIGRegisterExceptionCallbacksArgument_freeswitch(
+                                ExceptionArgumentDelegate argumentDelegate,
+                                ExceptionArgumentDelegate argumentNullDelegate,
+                                ExceptionArgumentDelegate argumentOutOfRangeDelegate);
+
+    static void SetPendingApplicationException(string message) {
+      SWIGPendingException.Set(new System.ApplicationException(message, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingArithmeticException(string message) {
+      SWIGPendingException.Set(new System.ArithmeticException(message, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingDivideByZeroException(string message) {
+      SWIGPendingException.Set(new System.DivideByZeroException(message, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingIndexOutOfRangeException(string message) {
+      SWIGPendingException.Set(new System.IndexOutOfRangeException(message, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingInvalidCastException(string message) {
+      SWIGPendingException.Set(new System.InvalidCastException(message, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingInvalidOperationException(string message) {
+      SWIGPendingException.Set(new System.InvalidOperationException(message, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingIOException(string message) {
+      SWIGPendingException.Set(new System.IO.IOException(message, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingNullReferenceException(string message) {
+      SWIGPendingException.Set(new System.NullReferenceException(message, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingOutOfMemoryException(string message) {
+      SWIGPendingException.Set(new System.OutOfMemoryException(message, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingOverflowException(string message) {
+      SWIGPendingException.Set(new System.OverflowException(message, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingSystemException(string message) {
+      SWIGPendingException.Set(new System.SystemException(message, SWIGPendingException.Retrieve()));
+    }
+
+    static void SetPendingArgumentException(string message, string paramName) {
+      SWIGPendingException.Set(new System.ArgumentException(message, paramName, SWIGPendingException.Retrieve()));
+    }
+    static void SetPendingArgumentNullException(string message, string paramName) {
+      Exception e = SWIGPendingException.Retrieve();
+      if (e != null) message = message + " Inner Exception: " + e.Message;
+      SWIGPendingException.Set(new System.ArgumentNullException(paramName, message));
+    }
+    static void SetPendingArgumentOutOfRangeException(string message, string paramName) {
+      Exception e = SWIGPendingException.Retrieve();
+      if (e != null) message = message + " Inner Exception: " + e.Message;
+      SWIGPendingException.Set(new System.ArgumentOutOfRangeException(paramName, message));
+    }
+
+    static SWIGExceptionHelper() {
+      SWIGRegisterExceptionCallbacks_freeswitch(
+                                applicationDelegate,
+                                arithmeticDelegate,
+                                divideByZeroDelegate,
+                                indexOutOfRangeDelegate,
+                                invalidCastDelegate,
+                                invalidOperationDelegate,
+                                ioDelegate,
+                                nullReferenceDelegate,
+                                outOfMemoryDelegate,
+                                overflowDelegate,
+                                systemDelegate);
+
+      SWIGRegisterExceptionCallbacksArgument_freeswitch(
+                                argumentDelegate,
+                                argumentNullDelegate,
+                                argumentOutOfRangeDelegate);
+    }
+  }
+
+  protected static SWIGExceptionHelper swigExceptionHelper = new SWIGExceptionHelper();
+
+  public class SWIGPendingException {
+    [ThreadStatic]
+    private static Exception pendingException = null;
+    private static int numExceptionsPending = 0;
+
+    public static bool Pending {
+      get {
+        bool pending = false;
+        if (numExceptionsPending > 0)
+          if (pendingException != null)
+            pending = true;
+        return pending;
+      } 
+    }
+
+    public static void Set(Exception e) {
+      if (pendingException != null)
+        throw new ApplicationException("FATAL: An earlier pending exception from unmanaged code was missed and thus not thrown (" + pendingException.ToString() + ")", e);
+      pendingException = e;
+      lock(typeof(freeswitchPINVOKE)) {
+        numExceptionsPending++;
+      }
+    }
+
+    public static Exception Retrieve() {
+      Exception e = null;
+      if (numExceptionsPending > 0) {
+        if (pendingException != null) {
+          e = pendingException;
+          pendingException = null;
+          lock(typeof(freeswitchPINVOKE)) {
+            numExceptionsPending--;
+          }
+        }
+      }
+      return e;
+    }
+  }
+
+
+
+  protected class SWIGStringHelper {
+
+    public delegate string SWIGStringDelegate(string message);
+    static SWIGStringDelegate stringDelegate = new SWIGStringDelegate(CreateString);
+
+    [DllImport("mod_managed", EntryPoint="SWIGRegisterStringCallback_freeswitch")]
+    public static extern void SWIGRegisterStringCallback_freeswitch(SWIGStringDelegate stringDelegate);
+
+    static string CreateString(string cString) {
+      return cString;
+    }
+
+    static SWIGStringHelper() {
+      SWIGRegisterStringCallback_freeswitch(stringDelegate);
+    }
+  }
+
+  static protected SWIGStringHelper swigStringHelper = new SWIGStringHelper();
+
+
+  [DllImport("mod_managed", EntryPoint="CSharp_FREESWITCH_PEN_get")]
+  public static extern string FREESWITCH_PEN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_FREESWITCH_OID_PREFIX_get")]
+  public static extern string FREESWITCH_OID_PREFIX_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_FREESWITCH_ITAD_get")]
+  public static extern string FREESWITCH_ITAD_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp___EXTENSIONS___get")]
+  public static extern int __EXTENSIONS___get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp___BSD_VISIBLE_get")]
+  public static extern int __BSD_VISIBLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ENT_ORIGINATE_DELIM_get")]
+  public static extern string SWITCH_ENT_ORIGINATE_DELIM_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BLANK_STRING_get")]
+  public static extern string SWITCH_BLANK_STRING_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_ESC_get")]
+  public static extern string SWITCH_SEQ_ESC_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_HOME_CHAR_get")]
+  public static extern char SWITCH_SEQ_HOME_CHAR_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_HOME_CHAR_STR_get")]
+  public static extern string SWITCH_SEQ_HOME_CHAR_STR_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_CLEARLINE_CHAR_get")]
+  public static extern char SWITCH_SEQ_CLEARLINE_CHAR_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_CLEARLINE_CHAR_STR_get")]
+  public static extern string SWITCH_SEQ_CLEARLINE_CHAR_STR_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_CLEARLINEEND_CHAR_get")]
+  public static extern string SWITCH_SEQ_CLEARLINEEND_CHAR_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_CLEARSCR_CHAR0_get")]
+  public static extern char SWITCH_SEQ_CLEARSCR_CHAR0_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_CLEARSCR_CHAR1_get")]
+  public static extern char SWITCH_SEQ_CLEARSCR_CHAR1_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_CLEARSCR_CHAR_get")]
+  public static extern string SWITCH_SEQ_CLEARSCR_CHAR_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_AND_COLOR_get")]
+  public static extern string SWITCH_SEQ_AND_COLOR_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_END_COLOR_get")]
+  public static extern string SWITCH_SEQ_END_COLOR_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_F_BLACK_get")]
+  public static extern string SWITCH_SEQ_F_BLACK_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_F_RED_get")]
+  public static extern string SWITCH_SEQ_F_RED_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_F_GREEN_get")]
+  public static extern string SWITCH_SEQ_F_GREEN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_F_YELLOW_get")]
+  public static extern string SWITCH_SEQ_F_YELLOW_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_F_BLUE_get")]
+  public static extern string SWITCH_SEQ_F_BLUE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_F_MAGEN_get")]
+  public static extern string SWITCH_SEQ_F_MAGEN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_F_CYAN_get")]
+  public static extern string SWITCH_SEQ_F_CYAN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_F_WHITE_get")]
+  public static extern string SWITCH_SEQ_F_WHITE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_B_BLACK_get")]
+  public static extern string SWITCH_SEQ_B_BLACK_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_B_RED_get")]
+  public static extern string SWITCH_SEQ_B_RED_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_B_GREEN_get")]
+  public static extern string SWITCH_SEQ_B_GREEN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_B_YELLOW_get")]
+  public static extern string SWITCH_SEQ_B_YELLOW_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_B_BLUE_get")]
+  public static extern string SWITCH_SEQ_B_BLUE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_B_MAGEN_get")]
+  public static extern string SWITCH_SEQ_B_MAGEN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_B_CYAN_get")]
+  public static extern string SWITCH_SEQ_B_CYAN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_B_WHITE_get")]
+  public static extern string SWITCH_SEQ_B_WHITE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_FBLACK_get")]
+  public static extern string SWITCH_SEQ_FBLACK_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_FRED_get")]
+  public static extern string SWITCH_SEQ_FRED_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_FGREEN_get")]
+  public static extern string SWITCH_SEQ_FGREEN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_FYELLOW_get")]
+  public static extern string SWITCH_SEQ_FYELLOW_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_FBLUE_get")]
+  public static extern string SWITCH_SEQ_FBLUE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_FMAGEN_get")]
+  public static extern string SWITCH_SEQ_FMAGEN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_FCYAN_get")]
+  public static extern string SWITCH_SEQ_FCYAN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_FWHITE_get")]
+  public static extern string SWITCH_SEQ_FWHITE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_BBLACK_get")]
+  public static extern string SWITCH_SEQ_BBLACK_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_BRED_get")]
+  public static extern string SWITCH_SEQ_BRED_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_BGREEN_get")]
+  public static extern string SWITCH_SEQ_BGREEN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_BYELLOW_get")]
+  public static extern string SWITCH_SEQ_BYELLOW_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_BBLUE_get")]
+  public static extern string SWITCH_SEQ_BBLUE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_BMAGEN_get")]
+  public static extern string SWITCH_SEQ_BMAGEN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_BCYAN_get")]
+  public static extern string SWITCH_SEQ_BCYAN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_BWHITE_get")]
+  public static extern string SWITCH_SEQ_BWHITE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_HOME_get")]
+  public static extern string SWITCH_SEQ_HOME_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_CLEARLINE_get")]
+  public static extern string SWITCH_SEQ_CLEARLINE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_CLEARLINEEND_get")]
+  public static extern string SWITCH_SEQ_CLEARLINEEND_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEQ_CLEARSCR_get")]
+  public static extern string SWITCH_SEQ_CLEARSCR_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_DEFAULT_CLID_NAME_get")]
+  public static extern string SWITCH_DEFAULT_CLID_NAME_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_DEFAULT_DTMF_DURATION_get")]
+  public static extern int SWITCH_DEFAULT_DTMF_DURATION_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MIN_DTMF_DURATION_get")]
+  public static extern int SWITCH_MIN_DTMF_DURATION_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_DTMF_DURATION_get")]
+  public static extern int SWITCH_MAX_DTMF_DURATION_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PATH_SEPARATOR_get")]
+  public static extern string SWITCH_PATH_SEPARATOR_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_URL_SEPARATOR_get")]
+  public static extern string SWITCH_URL_SEPARATOR_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE_get")]
+  public static extern string SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_AUDIO_SPOOL_PATH_VARIABLE_get")]
+  public static extern string SWITCH_AUDIO_SPOOL_PATH_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE_get")]
+  public static extern string SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_READ_TERMINATOR_USED_VARIABLE_get")]
+  public static extern string SWITCH_READ_TERMINATOR_USED_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE_get")]
+  public static extern string SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CURRENT_APPLICATION_VARIABLE_get")]
+  public static extern string SWITCH_CURRENT_APPLICATION_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CURRENT_APPLICATION_DATA_VARIABLE_get")]
+  public static extern string SWITCH_CURRENT_APPLICATION_DATA_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE_get")]
+  public static extern string SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get")]
+  public static extern string SWITCH_ENABLE_HEARTBEAT_EVENTS_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE_get")]
+  public static extern string SWITCH_BYPASS_MEDIA_AFTER_BRIDGE_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_READ_RESULT_VARIABLE_get")]
+  public static extern string SWITCH_READ_RESULT_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_COPY_XML_CDR_VARIABLE_get")]
+  public static extern string SWITCH_COPY_XML_CDR_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE_get")]
+  public static extern string SWITCH_PROTO_SPECIFIC_HANGUP_CAUSE_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE_get")]
+  public static extern string SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE_get")]
+  public static extern string SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE_get")]
+  public static extern string SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE_get")]
+  public static extern string SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get")]
+  public static extern string SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CALL_TIMEOUT_VARIABLE_get")]
+  public static extern string SWITCH_CALL_TIMEOUT_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_HOLDING_UUID_VARIABLE_get")]
+  public static extern string SWITCH_HOLDING_UUID_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SOFT_HOLDING_UUID_VARIABLE_get")]
+  public static extern string SWITCH_SOFT_HOLDING_UUID_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_API_BRIDGE_END_VARIABLE_get")]
+  public static extern string SWITCH_API_BRIDGE_END_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_API_HANGUP_HOOK_VARIABLE_get")]
+  public static extern string SWITCH_API_HANGUP_HOOK_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE_get")]
+  public static extern string SWITCH_SESSION_IN_HANGUP_HOOK_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PROCESS_CDR_VARIABLE_get")]
+  public static extern string SWITCH_PROCESS_CDR_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BRIDGE_CHANNEL_VARIABLE_get")]
+  public static extern string SWITCH_BRIDGE_CHANNEL_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_NAME_VARIABLE_get")]
+  public static extern string SWITCH_CHANNEL_NAME_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BRIDGE_UUID_VARIABLE_get")]
+  public static extern string SWITCH_BRIDGE_UUID_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CONTINUE_ON_FAILURE_VARIABLE_get")]
+  public static extern string SWITCH_CONTINUE_ON_FAILURE_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PLAYBACK_TERMINATORS_VARIABLE_get")]
+  public static extern string SWITCH_PLAYBACK_TERMINATORS_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PLAYBACK_TERMINATOR_USED_get")]
+  public static extern string SWITCH_PLAYBACK_TERMINATOR_USED_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CACHE_SPEECH_HANDLES_VARIABLE_get")]
+  public static extern string SWITCH_CACHE_SPEECH_HANDLES_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME_get")]
+  public static extern string SWITCH_CACHE_SPEECH_HANDLES_OBJ_NAME_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BYPASS_MEDIA_VARIABLE_get")]
+  public static extern string SWITCH_BYPASS_MEDIA_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PROXY_MEDIA_VARIABLE_get")]
+  public static extern string SWITCH_PROXY_MEDIA_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get")]
+  public static extern string SWITCH_ENDPOINT_DISPOSITION_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_HOLD_MUSIC_VARIABLE_get")]
+  public static extern string SWITCH_HOLD_MUSIC_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_EXPORT_VARS_VARIABLE_get")]
+  public static extern string SWITCH_EXPORT_VARS_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_R_SDP_VARIABLE_get")]
+  public static extern string SWITCH_R_SDP_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_L_SDP_VARIABLE_get")]
+  public static extern string SWITCH_L_SDP_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_B_SDP_VARIABLE_get")]
+  public static extern string SWITCH_B_SDP_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BRIDGE_VARIABLE_get")]
+  public static extern string SWITCH_BRIDGE_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SIGNAL_BRIDGE_VARIABLE_get")]
+  public static extern string SWITCH_SIGNAL_BRIDGE_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SIGNAL_BOND_VARIABLE_get")]
+  public static extern string SWITCH_SIGNAL_BOND_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ORIGINATOR_VARIABLE_get")]
+  public static extern string SWITCH_ORIGINATOR_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ORIGINATOR_CODEC_VARIABLE_get")]
+  public static extern string SWITCH_ORIGINATOR_CODEC_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE_get")]
+  public static extern string SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_LOCAL_MEDIA_IP_VARIABLE_get")]
+  public static extern string SWITCH_LOCAL_MEDIA_IP_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_LOCAL_MEDIA_PORT_VARIABLE_get")]
+  public static extern string SWITCH_LOCAL_MEDIA_PORT_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_REMOTE_MEDIA_IP_VARIABLE_get")]
+  public static extern string SWITCH_REMOTE_MEDIA_IP_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_REMOTE_MEDIA_PORT_VARIABLE_get")]
+  public static extern string SWITCH_REMOTE_MEDIA_PORT_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_REMOTE_VIDEO_IP_VARIABLE_get")]
+  public static extern string SWITCH_REMOTE_VIDEO_IP_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_REMOTE_VIDEO_PORT_VARIABLE_get")]
+  public static extern string SWITCH_REMOTE_VIDEO_PORT_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_LOCAL_VIDEO_IP_VARIABLE_get")]
+  public static extern string SWITCH_LOCAL_VIDEO_IP_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_LOCAL_VIDEO_PORT_VARIABLE_get")]
+  public static extern string SWITCH_LOCAL_VIDEO_PORT_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE_get")]
+  public static extern string SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_PARK_AFTER_BRIDGE_VARIABLE_get")]
+  public static extern string SWITCH_PARK_AFTER_BRIDGE_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE_get")]
+  public static extern string SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE_get")]
+  public static extern string SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE_get")]
+  public static extern string SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_FORWARDS_VARIABLE_get")]
+  public static extern string SWITCH_MAX_FORWARDS_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_DISABLE_APP_LOG_VARIABLE_get")]
+  public static extern string SWITCH_DISABLE_APP_LOG_VARIABLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SPEECH_KEY_get")]
+  public static extern string SWITCH_SPEECH_KEY_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_UUID_BRIDGE_get")]
+  public static extern string SWITCH_UUID_BRIDGE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BITS_PER_BYTE_get")]
+  public static extern int SWITCH_BITS_PER_BYTE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_DEFAULT_FILE_BUFFER_LEN_get")]
+  public static extern int SWITCH_DEFAULT_FILE_BUFFER_LEN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_DTMF_LOG_LEN_get")]
+  public static extern int SWITCH_DTMF_LOG_LEN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_digit_set")]
+  public static extern void switch_dtmf_t_digit_set(HandleRef jarg1, char jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_digit_get")]
+  public static extern char switch_dtmf_t_digit_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_duration_set")]
+  public static extern void switch_dtmf_t_duration_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_dtmf_t_duration_get")]
+  public static extern uint switch_dtmf_t_duration_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_dtmf_t")]
+  public static extern IntPtr new_switch_dtmf_t();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_dtmf_t")]
+  public static extern void delete_switch_dtmf_t(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_buf_set")]
+  public static extern void switch_bitpack_t_buf_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_buf_get")]
+  public static extern IntPtr switch_bitpack_t_buf_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_buflen_set")]
+  public static extern void switch_bitpack_t_buflen_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_buflen_get")]
+  public static extern uint switch_bitpack_t_buflen_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_cur_set")]
+  public static extern void switch_bitpack_t_cur_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_cur_get")]
+  public static extern IntPtr switch_bitpack_t_cur_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_bytes_set")]
+  public static extern void switch_bitpack_t_bytes_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_bytes_get")]
+  public static extern uint switch_bitpack_t_bytes_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_bits_tot_set")]
+  public static extern void switch_bitpack_t_bits_tot_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_bits_tot_get")]
+  public static extern uint switch_bitpack_t_bits_tot_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_bits_cur_set")]
+  public static extern void switch_bitpack_t_bits_cur_set(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_bits_cur_get")]
+  public static extern byte switch_bitpack_t_bits_cur_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_bits_rem_set")]
+  public static extern void switch_bitpack_t_bits_rem_set(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_bits_rem_get")]
+  public static extern byte switch_bitpack_t_bits_rem_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_frame_bits_set")]
+  public static extern void switch_bitpack_t_frame_bits_set(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_frame_bits_get")]
+  public static extern byte switch_bitpack_t_frame_bits_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_shiftby_set")]
+  public static extern void switch_bitpack_t_shiftby_set(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_shiftby_get")]
+  public static extern byte switch_bitpack_t_shiftby_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_this_byte_set")]
+  public static extern void switch_bitpack_t_this_byte_set(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_this_byte_get")]
+  public static extern byte switch_bitpack_t_this_byte_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_under_set")]
+  public static extern void switch_bitpack_t_under_set(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_under_get")]
+  public static extern byte switch_bitpack_t_under_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_over_set")]
+  public static extern void switch_bitpack_t_over_set(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_over_get")]
+  public static extern byte switch_bitpack_t_over_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_mode_set")]
+  public static extern void switch_bitpack_t_mode_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_bitpack_t_mode_get")]
+  public static extern int switch_bitpack_t_mode_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_bitpack_t")]
+  public static extern IntPtr new_switch_bitpack_t();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_bitpack_t")]
+  public static extern void delete_switch_bitpack_t(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_base_dir_set")]
+  public static extern void switch_directories_base_dir_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_base_dir_get")]
+  public static extern string switch_directories_base_dir_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_mod_dir_set")]
+  public static extern void switch_directories_mod_dir_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_mod_dir_get")]
+  public static extern string switch_directories_mod_dir_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_conf_dir_set")]
+  public static extern void switch_directories_conf_dir_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_conf_dir_get")]
+  public static extern string switch_directories_conf_dir_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_log_dir_set")]
+  public static extern void switch_directories_log_dir_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_log_dir_get")]
+  public static extern string switch_directories_log_dir_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_run_dir_set")]
+  public static extern void switch_directories_run_dir_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_run_dir_get")]
+  public static extern string switch_directories_run_dir_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_db_dir_set")]
+  public static extern void switch_directories_db_dir_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_db_dir_get")]
+  public static extern string switch_directories_db_dir_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_script_dir_set")]
+  public static extern void switch_directories_script_dir_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_script_dir_get")]
+  public static extern string switch_directories_script_dir_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_temp_dir_set")]
+  public static extern void switch_directories_temp_dir_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_temp_dir_get")]
+  public static extern string switch_directories_temp_dir_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_htdocs_dir_set")]
+  public static extern void switch_directories_htdocs_dir_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_htdocs_dir_get")]
+  public static extern string switch_directories_htdocs_dir_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_grammar_dir_set")]
+  public static extern void switch_directories_grammar_dir_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_grammar_dir_get")]
+  public static extern string switch_directories_grammar_dir_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_storage_dir_set")]
+  public static extern void switch_directories_storage_dir_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_storage_dir_get")]
+  public static extern string switch_directories_storage_dir_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_recordings_dir_set")]
+  public static extern void switch_directories_recordings_dir_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_recordings_dir_get")]
+  public static extern string switch_directories_recordings_dir_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_sounds_dir_set")]
+  public static extern void switch_directories_sounds_dir_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directories_sounds_dir_get")]
+  public static extern string switch_directories_sounds_dir_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_directories")]
+  public static extern IntPtr new_switch_directories();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_directories")]
+  public static extern void delete_switch_directories(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_GLOBAL_dirs_set")]
+  public static extern void SWITCH_GLOBAL_dirs_set(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_GLOBAL_dirs_get")]
+  public static extern IntPtr SWITCH_GLOBAL_dirs_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_STACKS_get")]
+  public static extern int SWITCH_MAX_STACKS_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_THREAD_STACKSIZE_get")]
+  public static extern int SWITCH_THREAD_STACKSIZE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SYSTEM_THREAD_STACKSIZE_get")]
+  public static extern int SWITCH_SYSTEM_THREAD_STACKSIZE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_INTERVAL_get")]
+  public static extern int SWITCH_MAX_INTERVAL_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_INTERVAL_PAD_get")]
+  public static extern int SWITCH_INTERVAL_PAD_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_SAMPLE_LEN_get")]
+  public static extern int SWITCH_MAX_SAMPLE_LEN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_BYTES_PER_SAMPLE_get")]
+  public static extern int SWITCH_BYTES_PER_SAMPLE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RECOMMENDED_BUFFER_SIZE_get")]
+  public static extern int SWITCH_RECOMMENDED_BUFFER_SIZE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_CODECS_get")]
+  public static extern int SWITCH_MAX_CODECS_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_STATE_HANDLERS_get")]
+  public static extern int SWITCH_MAX_STATE_HANDLERS_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_QUEUE_LEN_get")]
+  public static extern int SWITCH_CORE_QUEUE_LEN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_MANAGEMENT_BUFFER_LEN_get")]
+  public static extern int SWITCH_MAX_MANAGEMENT_BUFFER_LEN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_raw_bytes_set")]
+  public static extern void switch_rtp_numbers_t_raw_bytes_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_raw_bytes_get")]
+  public static extern IntPtr switch_rtp_numbers_t_raw_bytes_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_media_bytes_set")]
+  public static extern void switch_rtp_numbers_t_media_bytes_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_media_bytes_get")]
+  public static extern IntPtr switch_rtp_numbers_t_media_bytes_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_packet_count_set")]
+  public static extern void switch_rtp_numbers_t_packet_count_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_packet_count_get")]
+  public static extern IntPtr switch_rtp_numbers_t_packet_count_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_media_packet_count_set")]
+  public static extern void switch_rtp_numbers_t_media_packet_count_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_media_packet_count_get")]
+  public static extern IntPtr switch_rtp_numbers_t_media_packet_count_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_skip_packet_count_set")]
+  public static extern void switch_rtp_numbers_t_skip_packet_count_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_skip_packet_count_get")]
+  public static extern IntPtr switch_rtp_numbers_t_skip_packet_count_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_jb_packet_count_set")]
+  public static extern void switch_rtp_numbers_t_jb_packet_count_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_jb_packet_count_get")]
+  public static extern IntPtr switch_rtp_numbers_t_jb_packet_count_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_dtmf_packet_count_set")]
+  public static extern void switch_rtp_numbers_t_dtmf_packet_count_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_dtmf_packet_count_get")]
+  public static extern IntPtr switch_rtp_numbers_t_dtmf_packet_count_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_cng_packet_count_set")]
+  public static extern void switch_rtp_numbers_t_cng_packet_count_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_cng_packet_count_get")]
+  public static extern IntPtr switch_rtp_numbers_t_cng_packet_count_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_flush_packet_count_set")]
+  public static extern void switch_rtp_numbers_t_flush_packet_count_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_flush_packet_count_get")]
+  public static extern IntPtr switch_rtp_numbers_t_flush_packet_count_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_rtp_numbers_t")]
+  public static extern IntPtr new_switch_rtp_numbers_t();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_rtp_numbers_t")]
+  public static extern void delete_switch_rtp_numbers_t(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_inbound_set")]
+  public static extern void switch_rtp_stats_t_inbound_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_inbound_get")]
+  public static extern IntPtr switch_rtp_stats_t_inbound_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_outbound_set")]
+  public static extern void switch_rtp_stats_t_outbound_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_stats_t_outbound_get")]
+  public static extern IntPtr switch_rtp_stats_t_outbound_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_rtp_stats_t")]
+  public static extern IntPtr new_switch_rtp_stats_t();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_rtp_stats_t")]
+  public static extern void delete_switch_rtp_stats_t(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_CNG_PAYLOAD_get")]
+  public static extern int SWITCH_RTP_CNG_PAYLOAD_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_version_set")]
+  public static extern void switch_rtp_hdr_t_version_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_version_get")]
+  public static extern uint switch_rtp_hdr_t_version_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_p_set")]
+  public static extern void switch_rtp_hdr_t_p_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_p_get")]
+  public static extern uint switch_rtp_hdr_t_p_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_x_set")]
+  public static extern void switch_rtp_hdr_t_x_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_x_get")]
+  public static extern uint switch_rtp_hdr_t_x_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_cc_set")]
+  public static extern void switch_rtp_hdr_t_cc_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_cc_get")]
+  public static extern uint switch_rtp_hdr_t_cc_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_m_set")]
+  public static extern void switch_rtp_hdr_t_m_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_m_get")]
+  public static extern uint switch_rtp_hdr_t_m_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_pt_set")]
+  public static extern void switch_rtp_hdr_t_pt_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_pt_get")]
+  public static extern uint switch_rtp_hdr_t_pt_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_seq_set")]
+  public static extern void switch_rtp_hdr_t_seq_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_seq_get")]
+  public static extern uint switch_rtp_hdr_t_seq_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_ts_set")]
+  public static extern void switch_rtp_hdr_t_ts_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_ts_get")]
+  public static extern uint switch_rtp_hdr_t_ts_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_ssrc_set")]
+  public static extern void switch_rtp_hdr_t_ssrc_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_hdr_t_ssrc_get")]
+  public static extern uint switch_rtp_hdr_t_ssrc_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_rtp_hdr_t")]
+  public static extern IntPtr new_switch_rtp_hdr_t();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_rtp_hdr_t")]
+  public static extern void delete_switch_rtp_hdr_t(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38MaxBitRate_set")]
+  public static extern void switch_t38_options_t_T38MaxBitRate_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38MaxBitRate_get")]
+  public static extern uint switch_t38_options_t_T38MaxBitRate_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxFillBitRemoval_set")]
+  public static extern void switch_t38_options_t_T38FaxFillBitRemoval_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxFillBitRemoval_get")]
+  public static extern int switch_t38_options_t_T38FaxFillBitRemoval_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxTranscodingMMR_set")]
+  public static extern void switch_t38_options_t_T38FaxTranscodingMMR_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxTranscodingMMR_get")]
+  public static extern int switch_t38_options_t_T38FaxTranscodingMMR_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxTranscodingJBIG_set")]
+  public static extern void switch_t38_options_t_T38FaxTranscodingJBIG_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxTranscodingJBIG_get")]
+  public static extern int switch_t38_options_t_T38FaxTranscodingJBIG_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxRateManagement_set")]
+  public static extern void switch_t38_options_t_T38FaxRateManagement_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxRateManagement_get")]
+  public static extern string switch_t38_options_t_T38FaxRateManagement_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxMaxBuffer_set")]
+  public static extern void switch_t38_options_t_T38FaxMaxBuffer_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxMaxBuffer_get")]
+  public static extern uint switch_t38_options_t_T38FaxMaxBuffer_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxMaxDatagram_set")]
+  public static extern void switch_t38_options_t_T38FaxMaxDatagram_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxMaxDatagram_get")]
+  public static extern uint switch_t38_options_t_T38FaxMaxDatagram_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxUdpEC_set")]
+  public static extern void switch_t38_options_t_T38FaxUdpEC_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38FaxUdpEC_get")]
+  public static extern string switch_t38_options_t_T38FaxUdpEC_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38VendorInfo_set")]
+  public static extern void switch_t38_options_t_T38VendorInfo_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_T38VendorInfo_get")]
+  public static extern string switch_t38_options_t_T38VendorInfo_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_ip_set")]
+  public static extern void switch_t38_options_t_ip_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_ip_get")]
+  public static extern string switch_t38_options_t_ip_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_port_set")]
+  public static extern void switch_t38_options_t_port_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_t38_options_t_port_get")]
+  public static extern uint switch_t38_options_t_port_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_t38_options_t")]
+  public static extern IntPtr new_switch_t38_options_t();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_t38_options_t")]
+  public static extern void delete_switch_t38_options_t(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_callback_match_node_val_set")]
+  public static extern void switch_console_callback_match_node_val_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_callback_match_node_val_get")]
+  public static extern string switch_console_callback_match_node_val_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_callback_match_node_next_set")]
+  public static extern void switch_console_callback_match_node_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_callback_match_node_next_get")]
+  public static extern IntPtr switch_console_callback_match_node_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_console_callback_match_node")]
+  public static extern IntPtr new_switch_console_callback_match_node();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_console_callback_match_node")]
+  public static extern void delete_switch_console_callback_match_node(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_callback_match_head_set")]
+  public static extern void switch_console_callback_match_head_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_callback_match_head_get")]
+  public static extern IntPtr switch_console_callback_match_head_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_callback_match_end_set")]
+  public static extern void switch_console_callback_match_end_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_callback_match_end_get")]
+  public static extern IntPtr switch_console_callback_match_end_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_callback_match_count_set")]
+  public static extern void switch_console_callback_match_count_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_callback_match_count_get")]
+  public static extern int switch_console_callback_match_count_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_callback_match_dynamic_set")]
+  public static extern void switch_console_callback_match_dynamic_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_callback_match_dynamic_get")]
+  public static extern int switch_console_callback_match_dynamic_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_console_callback_match")]
+  public static extern IntPtr new_switch_console_callback_match();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_console_callback_match")]
+  public static extern void delete_switch_console_callback_match(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_input_callback_set")]
+  public static extern void switch_input_args_t_input_callback_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_input_callback_get")]
+  public static extern IntPtr switch_input_args_t_input_callback_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_buf_set")]
+  public static extern void switch_input_args_t_buf_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_buf_get")]
+  public static extern IntPtr switch_input_args_t_buf_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_buflen_set")]
+  public static extern void switch_input_args_t_buflen_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_buflen_get")]
+  public static extern uint switch_input_args_t_buflen_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_read_frame_callback_set")]
+  public static extern void switch_input_args_t_read_frame_callback_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_read_frame_callback_get")]
+  public static extern IntPtr switch_input_args_t_read_frame_callback_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_user_data_set")]
+  public static extern void switch_input_args_t_user_data_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_input_args_t_user_data_get")]
+  public static extern IntPtr switch_input_args_t_user_data_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_input_args_t")]
+  public static extern IntPtr new_switch_input_args_t();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_input_args_t")]
+  public static extern void delete_switch_input_args_t(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_API_VERSION_get")]
+  public static extern int SWITCH_API_VERSION_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_function_table_t_switch_api_version_set")]
+  public static extern void switch_loadable_module_function_table_t_switch_api_version_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_function_table_t_switch_api_version_get")]
+  public static extern int switch_loadable_module_function_table_t_switch_api_version_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_function_table_t_load_set")]
+  public static extern void switch_loadable_module_function_table_t_load_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_function_table_t_load_get")]
+  public static extern IntPtr switch_loadable_module_function_table_t_load_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_function_table_t_shutdown_set")]
+  public static extern void switch_loadable_module_function_table_t_shutdown_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_function_table_t_shutdown_get")]
+  public static extern IntPtr switch_loadable_module_function_table_t_shutdown_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_function_table_t_runtime_set")]
+  public static extern void switch_loadable_module_function_table_t_runtime_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_function_table_t_runtime_get")]
+  public static extern IntPtr switch_loadable_module_function_table_t_runtime_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_function_table_t_flags_set")]
+  public static extern void switch_loadable_module_function_table_t_flags_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_function_table_t_flags_get")]
+  public static extern uint switch_loadable_module_function_table_t_flags_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_loadable_module_function_table_t")]
+  public static extern IntPtr new_switch_loadable_module_function_table_t();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_loadable_module_function_table_t")]
+  public static extern void delete_switch_loadable_module_function_table_t(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_close")]
+  public static extern int switch_core_db_close(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_open")]
+  public static extern int switch_core_db_open(string jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_column_text")]
+  public static extern IntPtr switch_core_db_column_text(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_column_name")]
+  public static extern string switch_core_db_column_name(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_column_count")]
+  public static extern int switch_core_db_column_count(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_errmsg")]
+  public static extern string switch_core_db_errmsg(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_exec")]
+  public static extern int switch_core_db_exec(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, ref string jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_finalize")]
+  public static extern int switch_core_db_finalize(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_prepare")]
+  public static extern int switch_core_db_prepare(HandleRef jarg1, string jarg2, int jarg3, HandleRef jarg4, ref string jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_step")]
+  public static extern int switch_core_db_step(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_reset")]
+  public static extern int switch_core_db_reset(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_bind_int")]
+  public static extern int switch_core_db_bind_int(HandleRef jarg1, int jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_bind_int64")]
+  public static extern int switch_core_db_bind_int64(HandleRef jarg1, int jarg2, long jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_bind_text")]
+  public static extern int switch_core_db_bind_text(HandleRef jarg1, int jarg2, string jarg3, int jarg4, HandleRef jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_bind_double")]
+  public static extern int switch_core_db_bind_double(HandleRef jarg1, int jarg2, double jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_last_insert_rowid")]
+  public static extern long switch_core_db_last_insert_rowid(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_get_table")]
+  public static extern int switch_core_db_get_table(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5, ref string jarg6);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_free_table")]
+  public static extern void switch_core_db_free_table(ref string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_free")]
+  public static extern void switch_core_db_free(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_changes")]
+  public static extern int switch_core_db_changes(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_OK_get")]
+  public static extern int SWITCH_CORE_DB_OK_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_ERROR_get")]
+  public static extern int SWITCH_CORE_DB_ERROR_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_INTERNAL_get")]
+  public static extern int SWITCH_CORE_DB_INTERNAL_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_PERM_get")]
+  public static extern int SWITCH_CORE_DB_PERM_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_ABORT_get")]
+  public static extern int SWITCH_CORE_DB_ABORT_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_BUSY_get")]
+  public static extern int SWITCH_CORE_DB_BUSY_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_LOCKED_get")]
+  public static extern int SWITCH_CORE_DB_LOCKED_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_NOMEM_get")]
+  public static extern int SWITCH_CORE_DB_NOMEM_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_READONLY_get")]
+  public static extern int SWITCH_CORE_DB_READONLY_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_INTERRUPT_get")]
+  public static extern int SWITCH_CORE_DB_INTERRUPT_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_IOERR_get")]
+  public static extern int SWITCH_CORE_DB_IOERR_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_CORRUPT_get")]
+  public static extern int SWITCH_CORE_DB_CORRUPT_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_NOTFOUND_get")]
+  public static extern int SWITCH_CORE_DB_NOTFOUND_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_FULL_get")]
+  public static extern int SWITCH_CORE_DB_FULL_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_CANTOPEN_get")]
+  public static extern int SWITCH_CORE_DB_CANTOPEN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_PROTOCOL_get")]
+  public static extern int SWITCH_CORE_DB_PROTOCOL_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_EMPTY_get")]
+  public static extern int SWITCH_CORE_DB_EMPTY_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_SCHEMA_get")]
+  public static extern int SWITCH_CORE_DB_SCHEMA_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_TOOBIG_get")]
+  public static extern int SWITCH_CORE_DB_TOOBIG_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_CONSTRAINT_get")]
+  public static extern int SWITCH_CORE_DB_CONSTRAINT_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_MISMATCH_get")]
+  public static extern int SWITCH_CORE_DB_MISMATCH_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_MISUSE_get")]
+  public static extern int SWITCH_CORE_DB_MISUSE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_NOLFS_get")]
+  public static extern int SWITCH_CORE_DB_NOLFS_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_AUTH_get")]
+  public static extern int SWITCH_CORE_DB_AUTH_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_FORMAT_get")]
+  public static extern int SWITCH_CORE_DB_FORMAT_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_RANGE_get")]
+  public static extern int SWITCH_CORE_DB_RANGE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_NOTADB_get")]
+  public static extern int SWITCH_CORE_DB_NOTADB_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_ROW_get")]
+  public static extern int SWITCH_CORE_DB_ROW_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CORE_DB_DONE_get")]
+  public static extern int SWITCH_CORE_DB_DONE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_regex_compile")]
+  public static extern IntPtr switch_regex_compile(string jarg1, int jarg2, ref string jarg3, HandleRef jarg4, HandleRef jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_regex_copy_substring")]
+  public static extern int switch_regex_copy_substring(string jarg1, HandleRef jarg2, int jarg3, int jarg4, string jarg5, int jarg6);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_regex_free")]
+  public static extern void switch_regex_free(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_regex_perform")]
+  public static extern int switch_regex_perform(string jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, uint jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_perform_substitution")]
+  public static extern void switch_perform_substitution(HandleRef jarg1, int jarg2, string jarg3, string jarg4, string jarg5, HandleRef jarg6, HandleRef jarg7);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_regex_match")]
+  public static extern int switch_regex_match(string jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_regex_match_partial")]
+  public static extern int switch_regex_match_partial(string jarg1, string jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_CORE_THREAD_SESSION_OBJS_get")]
+  public static extern int SWITCH_MAX_CORE_THREAD_SESSION_OBJS_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_MAX_STREAMS_get")]
+  public static extern int SWITCH_MAX_STREAMS_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_mms_set")]
+  public static extern void switch_core_time_duration_mms_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_mms_get")]
+  public static extern uint switch_core_time_duration_mms_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_ms_set")]
+  public static extern void switch_core_time_duration_ms_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_ms_get")]
+  public static extern uint switch_core_time_duration_ms_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_sec_set")]
+  public static extern void switch_core_time_duration_sec_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_sec_get")]
+  public static extern uint switch_core_time_duration_sec_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_min_set")]
+  public static extern void switch_core_time_duration_min_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_min_get")]
+  public static extern uint switch_core_time_duration_min_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_hr_set")]
+  public static extern void switch_core_time_duration_hr_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_hr_get")]
+  public static extern uint switch_core_time_duration_hr_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_day_set")]
+  public static extern void switch_core_time_duration_day_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_day_get")]
+  public static extern uint switch_core_time_duration_day_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_yr_set")]
+  public static extern void switch_core_time_duration_yr_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_time_duration_yr_get")]
+  public static extern uint switch_core_time_duration_yr_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_core_time_duration")]
+  public static extern IntPtr new_switch_core_time_duration();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_core_time_duration")]
+  public static extern void delete_switch_core_time_duration(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_app_log_app_set")]
+  public static extern void switch_app_log_app_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_app_log_app_get")]
+  public static extern string switch_app_log_app_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_app_log_arg_set")]
+  public static extern void switch_app_log_arg_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_app_log_arg_get")]
+  public static extern string switch_app_log_arg_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_app_log_next_set")]
+  public static extern void switch_app_log_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_app_log_next_get")]
+  public static extern IntPtr switch_app_log_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_app_log")]
+  public static extern IntPtr new_switch_app_log();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_app_log")]
+  public static extern void delete_switch_app_log(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_MESSAGE_STRING_ARG_MAX_get")]
+  public static extern int MESSAGE_STRING_ARG_MAX_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_from_set")]
+  public static extern void switch_core_session_message_from_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_from_get")]
+  public static extern string switch_core_session_message_from_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_message_id_set")]
+  public static extern void switch_core_session_message_message_id_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_message_id_get")]
+  public static extern int switch_core_session_message_message_id_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_numeric_arg_set")]
+  public static extern void switch_core_session_message_numeric_arg_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_numeric_arg_get")]
+  public static extern int switch_core_session_message_numeric_arg_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_string_arg_set")]
+  public static extern void switch_core_session_message_string_arg_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_string_arg_get")]
+  public static extern string switch_core_session_message_string_arg_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_string_arg_size_set")]
+  public static extern void switch_core_session_message_string_arg_size_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_string_arg_size_get")]
+  public static extern IntPtr switch_core_session_message_string_arg_size_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_pointer_arg_set")]
+  public static extern void switch_core_session_message_pointer_arg_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_pointer_arg_get")]
+  public static extern IntPtr switch_core_session_message_pointer_arg_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_pointer_arg_size_set")]
+  public static extern void switch_core_session_message_pointer_arg_size_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_pointer_arg_size_get")]
+  public static extern IntPtr switch_core_session_message_pointer_arg_size_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_numeric_reply_set")]
+  public static extern void switch_core_session_message_numeric_reply_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_numeric_reply_get")]
+  public static extern int switch_core_session_message_numeric_reply_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_string_reply_set")]
+  public static extern void switch_core_session_message_string_reply_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_string_reply_get")]
+  public static extern string switch_core_session_message_string_reply_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_string_reply_size_set")]
+  public static extern void switch_core_session_message_string_reply_size_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_string_reply_size_get")]
+  public static extern IntPtr switch_core_session_message_string_reply_size_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_pointer_reply_set")]
+  public static extern void switch_core_session_message_pointer_reply_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_pointer_reply_get")]
+  public static extern IntPtr switch_core_session_message_pointer_reply_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_pointer_reply_size_set")]
+  public static extern void switch_core_session_message_pointer_reply_size_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_pointer_reply_size_get")]
+  public static extern IntPtr switch_core_session_message_pointer_reply_size_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_flags_set")]
+  public static extern void switch_core_session_message_flags_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_flags_get")]
+  public static extern uint switch_core_session_message_flags_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message__file_set")]
+  public static extern void switch_core_session_message__file_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message__file_get")]
+  public static extern string switch_core_session_message__file_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message__func_set")]
+  public static extern void switch_core_session_message__func_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message__func_get")]
+  public static extern string switch_core_session_message__func_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message__line_set")]
+  public static extern void switch_core_session_message__line_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message__line_get")]
+  public static extern int switch_core_session_message__line_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_string_array_arg_set")]
+  public static extern void switch_core_session_message_string_array_arg_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_string_array_arg_get")]
+  public static extern IntPtr switch_core_session_message_string_array_arg_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_delivery_time_set")]
+  public static extern void switch_core_session_message_delivery_time_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_delivery_time_get")]
+  public static extern IntPtr switch_core_session_message_delivery_time_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_core_session_message")]
+  public static extern IntPtr new_switch_core_session_message();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_core_session_message")]
+  public static extern void delete_switch_core_session_message(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_running_set")]
+  public static extern void switch_core_thread_session_running_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_running_get")]
+  public static extern int switch_core_thread_session_running_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_mutex_set")]
+  public static extern void switch_core_thread_session_mutex_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_mutex_get")]
+  public static extern IntPtr switch_core_thread_session_mutex_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_objs_set")]
+  public static extern void switch_core_thread_session_objs_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_objs_get")]
+  public static extern IntPtr switch_core_thread_session_objs_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_input_callback_set")]
+  public static extern void switch_core_thread_session_input_callback_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_input_callback_get")]
+  public static extern IntPtr switch_core_thread_session_input_callback_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_pool_set")]
+  public static extern void switch_core_thread_session_pool_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_pool_get")]
+  public static extern IntPtr switch_core_thread_session_pool_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_core_thread_session")]
+  public static extern IntPtr new_switch_core_thread_session();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_core_thread_session")]
+  public static extern void delete_switch_core_thread_session(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_sched_heartbeat")]
+  public static extern void switch_core_session_sched_heartbeat(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_unsched_heartbeat")]
+  public static extern void switch_core_session_unsched_heartbeat(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_enable_heartbeat")]
+  public static extern void switch_core_session_enable_heartbeat(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_disable_heartbeat")]
+  public static extern void switch_core_session_disable_heartbeat(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_add")]
+  public static extern int switch_core_media_bug_add(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, uint jarg5, HandleRef jarg6);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_pause")]
+  public static extern void switch_core_media_bug_pause(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_resume")]
+  public static extern void switch_core_media_bug_resume(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_inuse")]
+  public static extern void switch_core_media_bug_inuse(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_get_user_data")]
+  public static extern IntPtr switch_core_media_bug_get_user_data(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_get_write_replace_frame")]
+  public static extern IntPtr switch_core_media_bug_get_write_replace_frame(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_set_write_replace_frame")]
+  public static extern void switch_core_media_bug_set_write_replace_frame(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_get_read_replace_frame")]
+  public static extern IntPtr switch_core_media_bug_get_read_replace_frame(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_get_session")]
+  public static extern IntPtr switch_core_media_bug_get_session(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_test_flag")]
+  public static extern uint switch_core_media_bug_test_flag(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_set_flag")]
+  public static extern uint switch_core_media_bug_set_flag(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_clear_flag")]
+  public static extern uint switch_core_media_bug_clear_flag(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_set_read_replace_frame")]
+  public static extern void switch_core_media_bug_set_read_replace_frame(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_remove")]
+  public static extern int switch_core_media_bug_remove(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_prune")]
+  public static extern uint switch_core_media_bug_prune(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_remove_callback")]
+  public static extern int switch_core_media_bug_remove_callback(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_close")]
+  public static extern int switch_core_media_bug_close(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_remove_all")]
+  public static extern int switch_core_media_bug_remove_all(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_read")]
+  public static extern int switch_core_media_bug_read(HandleRef jarg1, HandleRef jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_flush")]
+  public static extern void switch_core_media_bug_flush(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_media_bug_flush_all")]
+  public static extern int switch_core_media_bug_flush_all(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_port_allocator_new")]
+  public static extern int switch_core_port_allocator_new(ushort jarg1, ushort jarg2, uint jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_port_allocator_request_port")]
+  public static extern int switch_core_port_allocator_request_port(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_port_allocator_free_port")]
+  public static extern int switch_core_port_allocator_free_port(HandleRef jarg1, ushort jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_port_allocator_destroy")]
+  public static extern void switch_core_port_allocator_destroy(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_init")]
+  public static extern int switch_core_init(uint jarg1, int jarg2, ref string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_init_and_modload")]
+  public static extern int switch_core_init_and_modload(uint jarg1, int jarg2, ref string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_limit")]
+  public static extern uint switch_core_session_limit(uint jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_sessions_per_second")]
+  public static extern uint switch_core_sessions_per_second(uint jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_destroy")]
+  public static extern int switch_core_destroy();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_read_lock")]
+  public static extern int switch_core_session_read_lock(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_read_lock_hangup")]
+  public static extern int switch_core_session_read_lock_hangup(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_write_lock")]
+  public static extern void switch_core_session_write_lock(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_rwunlock")]
+  public static extern void switch_core_session_rwunlock(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_add_state_handler")]
+  public static extern int switch_core_add_state_handler(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_remove_state_handler")]
+  public static extern void switch_core_remove_state_handler(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_state_handler")]
+  public static extern IntPtr switch_core_get_state_handler(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_memory_pool_tag")]
+  public static extern void switch_core_memory_pool_tag(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_perform_new_memory_pool")]
+  public static extern int switch_core_perform_new_memory_pool(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_perform_destroy_memory_pool")]
+  public static extern int switch_core_perform_destroy_memory_pool(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_memory_pool_set_data")]
+  public static extern void switch_core_memory_pool_set_data(HandleRef jarg1, string jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_memory_pool_get_data")]
+  public static extern IntPtr switch_core_memory_pool_get_data(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_run")]
+  public static extern void switch_core_session_run(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_running")]
+  public static extern uint switch_core_session_running(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_perform_permanent_alloc")]
+  public static extern IntPtr switch_core_perform_permanent_alloc(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_perform_alloc")]
+  public static extern IntPtr switch_core_perform_alloc(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4, int jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_perform_session_alloc")]
+  public static extern IntPtr switch_core_perform_session_alloc(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4, int jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_perform_permanent_strdup")]
+  public static extern string switch_core_perform_permanent_strdup(string jarg1, string jarg2, string jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_perform_session_strdup")]
+  public static extern string switch_core_perform_session_strdup(HandleRef jarg1, string jarg2, string jarg3, string jarg4, int jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_perform_strdup")]
+  public static extern string switch_core_perform_strdup(HandleRef jarg1, string jarg2, string jarg3, string jarg4, int jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_sprintf")]
+  public static extern string switch_core_session_sprintf(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_sprintf")]
+  public static extern string switch_core_sprintf(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_pool")]
+  public static extern IntPtr switch_core_session_get_pool(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_request_xml")]
+  public static extern IntPtr switch_core_session_request_xml(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_request_uuid")]
+  public static extern IntPtr switch_core_session_request_uuid(HandleRef jarg1, int jarg2, HandleRef jarg3, string jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_uuid")]
+  public static extern int switch_core_session_set_uuid(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_perform_destroy")]
+  public static extern void switch_core_session_perform_destroy(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_destroy_state")]
+  public static extern void switch_core_session_destroy_state(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_reporting_state")]
+  public static extern void switch_core_session_reporting_state(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_hangup_state")]
+  public static extern void switch_core_session_hangup_state(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_count")]
+  public static extern uint switch_core_session_count();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_id")]
+  public static extern IntPtr switch_core_session_get_id(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_id")]
+  public static extern IntPtr switch_core_session_id();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_request_by_name")]
+  public static extern IntPtr switch_core_session_request_by_name(string jarg1, int jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_thread_launch")]
+  public static extern int switch_core_session_thread_launch(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_channel")]
+  public static extern IntPtr switch_core_session_get_channel(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_wake_session_thread")]
+  public static extern void switch_core_session_wake_session_thread(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_signal_state_change")]
+  public static extern void switch_core_session_signal_state_change(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_uuid")]
+  public static extern string switch_core_session_get_uuid(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_loglevel")]
+  public static extern int switch_core_session_set_loglevel(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_loglevel")]
+  public static extern int switch_core_session_get_loglevel(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_uuid")]
+  public static extern string switch_core_get_uuid();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_locate")]
+  public static extern IntPtr switch_core_session_locate(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_force_locate")]
+  public static extern IntPtr switch_core_session_force_locate(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_variable")]
+  public static extern string switch_core_get_variable(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_set_variable")]
+  public static extern void switch_core_set_variable(string jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_dump_variables")]
+  public static extern void switch_core_dump_variables(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_hupall")]
+  public static extern void switch_core_session_hupall(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_hupall_matching_var")]
+  public static extern void switch_core_session_hupall_matching_var(string jarg1, string jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_hupall_endpoint")]
+  public static extern void switch_core_session_hupall_endpoint(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_partner")]
+  public static extern int switch_core_session_get_partner(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_message_send")]
+  public static extern int switch_core_session_message_send(string jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_queue_message")]
+  public static extern int switch_core_session_queue_message(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_free_message")]
+  public static extern void switch_core_session_free_message(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_pass_indication")]
+  public static extern int switch_core_session_pass_indication(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_queue_indication")]
+  public static extern int switch_core_session_queue_indication(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_dequeue_message")]
+  public static extern int switch_core_session_dequeue_message(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_flush_message")]
+  public static extern int switch_core_session_flush_message(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_event_send")]
+  public static extern int switch_core_session_event_send(string jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_app_log")]
+  public static extern IntPtr switch_core_session_get_app_log(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_exec")]
+  public static extern int switch_core_session_exec(HandleRef jarg1, HandleRef jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_execute_application_get_flags")]
+  public static extern int switch_core_session_execute_application_get_flags(HandleRef jarg1, string jarg2, string jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_app_flags")]
+  public static extern int switch_core_session_get_app_flags(string jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_execute_exten")]
+  public static extern int switch_core_session_execute_exten(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_receive_event")]
+  public static extern int switch_core_session_receive_event(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_private")]
+  public static extern IntPtr switch_core_session_get_private(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_private")]
+  public static extern int switch_core_session_set_private(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_add_stream")]
+  public static extern int switch_core_session_add_stream(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_stream")]
+  public static extern IntPtr switch_core_session_get_stream(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_stream_count")]
+  public static extern int switch_core_session_get_stream_count(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_launch_thread")]
+  public static extern void switch_core_session_launch_thread(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_thread_session_end")]
+  public static extern void switch_core_thread_session_end(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_service_session")]
+  public static extern void switch_core_service_session(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_outgoing_channel")]
+  public static extern int switch_core_session_outgoing_channel(HandleRef jarg1, HandleRef jarg2, string jarg3, HandleRef jarg4, HandleRef jarg5, HandleRef jarg6, uint jarg7, HandleRef jarg8);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_resurrect_channel")]
+  public static extern int switch_core_session_resurrect_channel(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_perform_receive_message")]
+  public static extern int switch_core_session_perform_receive_message(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4, int jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_queue_event")]
+  public static extern int switch_core_session_queue_event(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_event_count")]
+  public static extern uint switch_core_session_event_count(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_dequeue_event")]
+  public static extern int switch_core_session_dequeue_event(HandleRef jarg1, HandleRef jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_queue_private_event")]
+  public static extern int switch_core_session_queue_private_event(HandleRef jarg1, HandleRef jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_private_event_count")]
+  public static extern uint switch_core_session_private_event_count(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_dequeue_private_event")]
+  public static extern int switch_core_session_dequeue_private_event(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_flush_private_events")]
+  public static extern uint switch_core_session_flush_private_events(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_read_frame")]
+  public static extern int switch_core_session_read_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_read_video_frame")]
+  public static extern int switch_core_session_read_video_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_write_video_frame")]
+  public static extern int switch_core_session_write_video_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_read_impl")]
+  public static extern int switch_core_session_set_read_impl(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_write_impl")]
+  public static extern int switch_core_session_set_write_impl(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_video_read_impl")]
+  public static extern int switch_core_session_set_video_read_impl(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_video_write_impl")]
+  public static extern int switch_core_session_set_video_write_impl(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_reset")]
+  public static extern void switch_core_session_reset(HandleRef jarg1, int jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_write_frame")]
+  public static extern int switch_core_session_write_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_perform_kill_channel")]
+  public static extern int switch_core_session_perform_kill_channel(HandleRef jarg1, string jarg2, string jarg3, int jarg4, int jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_send_dtmf")]
+  public static extern int switch_core_session_send_dtmf(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_send_dtmf_string")]
+  public static extern int switch_core_session_send_dtmf_string(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_recv_dtmf")]
+  public static extern int switch_core_session_recv_dtmf(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_hash_init_case")]
+  public static extern int switch_core_hash_init_case(HandleRef jarg1, HandleRef jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_hash_destroy")]
+  public static extern int switch_core_hash_destroy(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_hash_insert")]
+  public static extern int switch_core_hash_insert(HandleRef jarg1, string jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_hash_insert_locked")]
+  public static extern int switch_core_hash_insert_locked(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_hash_delete")]
+  public static extern int switch_core_hash_delete(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_hash_delete_locked")]
+  public static extern int switch_core_hash_delete_locked(HandleRef jarg1, string jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_hash_find")]
+  public static extern IntPtr switch_core_hash_find(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_hash_find_locked")]
+  public static extern IntPtr switch_core_hash_find_locked(HandleRef jarg1, string jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_hash_first")]
+  public static extern IntPtr switch_hash_first(string jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_hash_next")]
+  public static extern IntPtr switch_hash_next(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_hash_this")]
+  public static extern void switch_hash_this(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_timer_init")]
+  public static extern int switch_core_timer_init(HandleRef jarg1, string jarg2, int jarg3, int jarg4, HandleRef jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_time_calibrate_clock")]
+  public static extern void switch_time_calibrate_clock();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_timer_next")]
+  public static extern int switch_core_timer_next(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_timer_step")]
+  public static extern int switch_core_timer_step(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_timer_sync")]
+  public static extern int switch_core_timer_sync(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_timer_check")]
+  public static extern int switch_core_timer_check(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_timer_destroy")]
+  public static extern int switch_core_timer_destroy(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_init")]
+  public static extern int switch_core_codec_init(HandleRef jarg1, string jarg2, string jarg3, uint jarg4, int jarg5, int jarg6, uint jarg7, HandleRef jarg8, HandleRef jarg9);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_copy")]
+  public static extern int switch_core_codec_copy(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_encode")]
+  public static extern int switch_core_codec_encode(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, uint jarg4, uint jarg5, HandleRef jarg6, HandleRef jarg7, HandleRef jarg8, HandleRef jarg9);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_decode")]
+  public static extern int switch_core_codec_decode(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, uint jarg4, uint jarg5, HandleRef jarg6, HandleRef jarg7, HandleRef jarg8, HandleRef jarg9);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_codec_destroy")]
+  public static extern int switch_core_codec_destroy(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_read_codec")]
+  public static extern int switch_core_session_set_read_codec(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_unset_read_codec")]
+  public static extern void switch_core_session_unset_read_codec(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_unset_write_codec")]
+  public static extern void switch_core_session_unset_write_codec(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_lock_codec_write")]
+  public static extern void switch_core_session_lock_codec_write(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_unlock_codec_write")]
+  public static extern void switch_core_session_unlock_codec_write(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_lock_codec_read")]
+  public static extern void switch_core_session_lock_codec_read(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_unlock_codec_read")]
+  public static extern void switch_core_session_unlock_codec_read(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_read_impl")]
+  public static extern int switch_core_session_get_read_impl(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_write_impl")]
+  public static extern int switch_core_session_get_write_impl(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_video_read_impl")]
+  public static extern int switch_core_session_get_video_read_impl(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_video_write_impl")]
+  public static extern int switch_core_session_get_video_write_impl(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_read_codec")]
+  public static extern IntPtr switch_core_session_get_read_codec(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_effective_read_codec")]
+  public static extern IntPtr switch_core_session_get_effective_read_codec(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_write_codec")]
+  public static extern int switch_core_session_set_write_codec(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_write_codec")]
+  public static extern IntPtr switch_core_session_get_write_codec(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_effective_write_codec")]
+  public static extern IntPtr switch_core_session_get_effective_write_codec(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_video_read_codec")]
+  public static extern int switch_core_session_set_video_read_codec(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_video_read_codec")]
+  public static extern IntPtr switch_core_session_get_video_read_codec(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_set_video_write_codec")]
+  public static extern int switch_core_session_set_video_write_codec(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_get_video_write_codec")]
+  public static extern IntPtr switch_core_session_get_video_write_codec(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_open_file")]
+  public static extern IntPtr switch_core_db_open_file(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_persistant_execute")]
+  public static extern int switch_core_db_persistant_execute(HandleRef jarg1, string jarg2, uint jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_persistant_execute_trans")]
+  public static extern int switch_core_db_persistant_execute_trans(HandleRef jarg1, string jarg2, uint jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_db_test_reactive")]
+  public static extern void switch_core_db_test_reactive(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_perform_file_open")]
+  public static extern int switch_core_perform_file_open(string jarg1, string jarg2, int jarg3, HandleRef jarg4, string jarg5, byte jarg6, uint jarg7, uint jarg8, HandleRef jarg9);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_file_read")]
+  public static extern int switch_core_file_read(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_file_write")]
+  public static extern int switch_core_file_write(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_file_seek")]
+  public static extern int switch_core_file_seek(HandleRef jarg1, HandleRef jarg2, long jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_file_set_string")]
+  public static extern int switch_core_file_set_string(HandleRef jarg1, int jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_file_get_string")]
+  public static extern int switch_core_file_get_string(HandleRef jarg1, int jarg2, ref string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_file_close")]
+  public static extern int switch_core_file_close(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_file_truncate")]
+  public static extern int switch_core_file_truncate(HandleRef jarg1, long jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_speech_open")]
+  public static extern int switch_core_speech_open(HandleRef jarg1, string jarg2, string jarg3, uint jarg4, uint jarg5, HandleRef jarg6, HandleRef jarg7);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_speech_feed_tts")]
+  public static extern int switch_core_speech_feed_tts(HandleRef jarg1, string jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_speech_flush_tts")]
+  public static extern void switch_core_speech_flush_tts(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_speech_text_param_tts")]
+  public static extern void switch_core_speech_text_param_tts(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_speech_numeric_param_tts")]
+  public static extern void switch_core_speech_numeric_param_tts(HandleRef jarg1, string jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_speech_float_param_tts")]
+  public static extern void switch_core_speech_float_param_tts(HandleRef jarg1, string jarg2, double jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_speech_read_tts")]
+  public static extern int switch_core_speech_read_tts(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_speech_close")]
+  public static extern int switch_core_speech_close(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_open")]
+  public static extern int switch_core_asr_open(HandleRef jarg1, string jarg2, string jarg3, int jarg4, string jarg5, HandleRef jarg6, HandleRef jarg7);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_close")]
+  public static extern int switch_core_asr_close(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_feed")]
+  public static extern int switch_core_asr_feed(HandleRef jarg1, HandleRef jarg2, uint jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_check_results")]
+  public static extern int switch_core_asr_check_results(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_get_results")]
+  public static extern int switch_core_asr_get_results(HandleRef jarg1, ref string jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_load_grammar")]
+  public static extern int switch_core_asr_load_grammar(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_unload_grammar")]
+  public static extern int switch_core_asr_unload_grammar(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_pause")]
+  public static extern int switch_core_asr_pause(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_resume")]
+  public static extern int switch_core_asr_resume(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_start_input_timers")]
+  public static extern int switch_core_asr_start_input_timers(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_text_param")]
+  public static extern void switch_core_asr_text_param(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_numeric_param")]
+  public static extern void switch_core_asr_numeric_param(HandleRef jarg1, string jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_asr_float_param")]
+  public static extern void switch_core_asr_float_param(HandleRef jarg1, string jarg2, double jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_directory_open")]
+  public static extern int switch_core_directory_open(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, HandleRef jarg6);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_directory_query")]
+  public static extern int switch_core_directory_query(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_directory_next")]
+  public static extern int switch_core_directory_next(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_directory_next_pair")]
+  public static extern int switch_core_directory_next_pair(HandleRef jarg1, ref string jarg2, ref string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_directory_close")]
+  public static extern int switch_core_directory_close(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_data_channel")]
+  public static extern IntPtr switch_core_data_channel(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_ready")]
+  public static extern int switch_core_ready();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_flags")]
+  public static extern uint switch_core_flags();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_management_exec")]
+  public static extern int switch_core_management_exec(string jarg1, int jarg2, string jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_set_high_priority")]
+  public static extern int set_high_priority();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_change_user_group")]
+  public static extern int change_user_group(string jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_runtime_loop")]
+  public static extern void switch_core_runtime_loop(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_set_console")]
+  public static extern int switch_core_set_console(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_measure_time")]
+  public static extern void switch_core_measure_time(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_uptime")]
+  public static extern IntPtr switch_core_uptime();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_ctl")]
+  public static extern int switch_core_session_ctl(int jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_console")]
+  public static extern IntPtr switch_core_get_console();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_set_globals")]
+  public static extern void switch_core_set_globals();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_compare")]
+  public static extern byte switch_core_session_compare(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_check_interface")]
+  public static extern byte switch_core_session_check_interface(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_mime_index")]
+  public static extern IntPtr switch_core_mime_index();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_mime_ext2type")]
+  public static extern string switch_core_mime_ext2type(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_mime_add_type")]
+  public static extern int switch_core_mime_add_type(string jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_create_module_interface")]
+  public static extern IntPtr switch_loadable_module_create_module_interface(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_create_interface")]
+  public static extern IntPtr switch_loadable_module_create_interface(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_micro_time_now")]
+  public static extern IntPtr switch_micro_time_now();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_memory_reclaim")]
+  public static extern void switch_core_memory_reclaim();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_memory_reclaim_events")]
+  public static extern void switch_core_memory_reclaim_events();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_memory_reclaim_logger")]
+  public static extern void switch_core_memory_reclaim_logger();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_memory_reclaim_all")]
+  public static extern void switch_core_memory_reclaim_all();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_setrlimits")]
+  public static extern void switch_core_setrlimits();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_time_sync")]
+  public static extern void switch_time_sync();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_epoch_time_now")]
+  public static extern IntPtr switch_epoch_time_now(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_strftime_tz")]
+  public static extern int switch_strftime_tz(string jarg1, string jarg2, string jarg3, uint jarg4, HandleRef jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_time_exp_tz_name")]
+  public static extern int switch_time_exp_tz_name(string jarg1, HandleRef jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_load_network_lists")]
+  public static extern void switch_load_network_lists(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_check_network_list_ip_token")]
+  public static extern int switch_check_network_list_ip_token(string jarg1, string jarg2, ref string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_time_set_monotonic")]
+  public static extern void switch_time_set_monotonic(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_time_set_nanosleep")]
+  public static extern void switch_time_set_nanosleep(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_time_set_matrix")]
+  public static extern void switch_time_set_matrix(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_time_set_cond_yield")]
+  public static extern void switch_time_set_cond_yield(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_min_dtmf_duration")]
+  public static extern uint switch_core_min_dtmf_duration(uint jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_max_dtmf_duration")]
+  public static extern uint switch_core_max_dtmf_duration(uint jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_default_dtmf_duration")]
+  public static extern uint switch_core_default_dtmf_duration(uint jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_set_complete")]
+  public static extern int switch_console_set_complete(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_set_alias")]
+  public static extern int switch_console_set_alias(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_system")]
+  public static extern int switch_system(string jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cond_yield")]
+  public static extern void switch_cond_yield(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cond_next")]
+  public static extern void switch_cond_next();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_chat_send")]
+  public static extern int switch_core_chat_send(string jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_preprocess_session")]
+  public static extern int switch_ivr_preprocess_session(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CACHE_DB_LEN_get")]
+  public static extern int CACHE_DB_LEN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_native_handle_t_core_db_dbh_set")]
+  public static extern void switch_cache_db_native_handle_t_core_db_dbh_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_native_handle_t_core_db_dbh_get")]
+  public static extern IntPtr switch_cache_db_native_handle_t_core_db_dbh_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_native_handle_t_odbc_dbh_set")]
+  public static extern void switch_cache_db_native_handle_t_odbc_dbh_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_native_handle_t_odbc_dbh_get")]
+  public static extern IntPtr switch_cache_db_native_handle_t_odbc_dbh_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_cache_db_native_handle_t")]
+  public static extern IntPtr new_switch_cache_db_native_handle_t();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_cache_db_native_handle_t")]
+  public static extern void delete_switch_cache_db_native_handle_t(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_core_db_options_t_db_path_set")]
+  public static extern void switch_cache_db_core_db_options_t_db_path_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_core_db_options_t_db_path_get")]
+  public static extern string switch_cache_db_core_db_options_t_db_path_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_cache_db_core_db_options_t")]
+  public static extern IntPtr new_switch_cache_db_core_db_options_t();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_cache_db_core_db_options_t")]
+  public static extern void delete_switch_cache_db_core_db_options_t(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_odbc_options_t_dsn_set")]
+  public static extern void switch_cache_db_odbc_options_t_dsn_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_odbc_options_t_dsn_get")]
+  public static extern string switch_cache_db_odbc_options_t_dsn_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_odbc_options_t_user_set")]
+  public static extern void switch_cache_db_odbc_options_t_user_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_odbc_options_t_user_get")]
+  public static extern string switch_cache_db_odbc_options_t_user_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_odbc_options_t_pass_set")]
+  public static extern void switch_cache_db_odbc_options_t_pass_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_odbc_options_t_pass_get")]
+  public static extern string switch_cache_db_odbc_options_t_pass_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_cache_db_odbc_options_t")]
+  public static extern IntPtr new_switch_cache_db_odbc_options_t();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_cache_db_odbc_options_t")]
+  public static extern void delete_switch_cache_db_odbc_options_t(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_connection_options_t_core_db_options_set")]
+  public static extern void switch_cache_db_connection_options_t_core_db_options_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_connection_options_t_core_db_options_get")]
+  public static extern IntPtr switch_cache_db_connection_options_t_core_db_options_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_connection_options_t_odbc_options_set")]
+  public static extern void switch_cache_db_connection_options_t_odbc_options_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_connection_options_t_odbc_options_get")]
+  public static extern IntPtr switch_cache_db_connection_options_t_odbc_options_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_cache_db_connection_options_t")]
+  public static extern IntPtr new_switch_cache_db_connection_options_t();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_cache_db_connection_options_t")]
+  public static extern void delete_switch_cache_db_connection_options_t(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_name_set")]
+  public static extern void switch_cache_db_handle_t_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_name_get")]
+  public static extern string switch_cache_db_handle_t_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_type_set")]
+  public static extern void switch_cache_db_handle_t_type_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_type_get")]
+  public static extern int switch_cache_db_handle_t_type_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_native_handle_set")]
+  public static extern void switch_cache_db_handle_t_native_handle_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_native_handle_get")]
+  public static extern IntPtr switch_cache_db_handle_t_native_handle_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_last_used_set")]
+  public static extern void switch_cache_db_handle_t_last_used_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_last_used_get")]
+  public static extern IntPtr switch_cache_db_handle_t_last_used_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_mutex_set")]
+  public static extern void switch_cache_db_handle_t_mutex_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_mutex_get")]
+  public static extern IntPtr switch_cache_db_handle_t_mutex_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_io_mutex_set")]
+  public static extern void switch_cache_db_handle_t_io_mutex_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_io_mutex_get")]
+  public static extern IntPtr switch_cache_db_handle_t_io_mutex_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_pool_set")]
+  public static extern void switch_cache_db_handle_t_pool_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_pool_get")]
+  public static extern IntPtr switch_cache_db_handle_t_pool_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_flags_set")]
+  public static extern void switch_cache_db_handle_t_flags_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_flags_get")]
+  public static extern int switch_cache_db_handle_t_flags_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_hash_set")]
+  public static extern void switch_cache_db_handle_t_hash_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_hash_get")]
+  public static extern uint switch_cache_db_handle_t_hash_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_creator_set")]
+  public static extern void switch_cache_db_handle_t_creator_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_creator_get")]
+  public static extern string switch_cache_db_handle_t_creator_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_last_user_set")]
+  public static extern void switch_cache_db_handle_t_last_user_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_handle_t_last_user_get")]
+  public static extern string switch_cache_db_handle_t_last_user_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_cache_db_handle_t")]
+  public static extern IntPtr new_switch_cache_db_handle_t();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_cache_db_handle_t")]
+  public static extern void delete_switch_cache_db_handle_t(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_type_name")]
+  public static extern string switch_cache_db_type_name(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_release_db_handle")]
+  public static extern void switch_cache_db_release_db_handle(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_destroy_db_handle")]
+  public static extern void switch_cache_db_destroy_db_handle(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp__switch_cache_db_get_db_handle")]
+  public static extern int _switch_cache_db_get_db_handle(HandleRef jarg1, int jarg2, HandleRef jarg3, string jarg4, string jarg5, int jarg6);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_execute_sql2str")]
+  public static extern string switch_cache_db_execute_sql2str(HandleRef jarg1, string jarg2, string jarg3, uint jarg4, ref string jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_execute_sql")]
+  public static extern int switch_cache_db_execute_sql(HandleRef jarg1, string jarg2, ref string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_execute_sql_callback")]
+  public static extern int switch_cache_db_execute_sql_callback(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, ref string jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_status")]
+  public static extern void switch_cache_db_status(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp__switch_core_db_handle")]
+  public static extern int _switch_core_db_handle(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_test_reactive")]
+  public static extern int switch_cache_db_test_reactive(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_persistant_execute")]
+  public static extern int switch_cache_db_persistant_execute(HandleRef jarg1, string jarg2, uint jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_persistant_execute_trans")]
+  public static extern int switch_cache_db_persistant_execute_trans(HandleRef jarg1, string jarg2, uint jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_detach")]
+  public static extern void switch_cache_db_detach();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_debug_level")]
+  public static extern uint switch_core_debug_level();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_flush_handles")]
+  public static extern void switch_cache_db_flush_handles();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_banner")]
+  public static extern string switch_core_banner();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_session_in_thread")]
+  public static extern int switch_core_session_in_thread(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CMD_CHUNK_LEN_get")]
+  public static extern int SWITCH_CMD_CHUNK_LEN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_loop")]
+  public static extern void switch_console_loop();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_stream_raw_write")]
+  public static extern int switch_console_stream_raw_write(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_write_file_contents")]
+  public static extern int switch_stream_write_file_contents(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_init")]
+  public static extern int switch_console_init(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_shutdown")]
+  public static extern int switch_console_shutdown();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_add_complete_func")]
+  public static extern int switch_console_add_complete_func(string jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_del_complete_func")]
+  public static extern int switch_console_del_complete_func(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_run_complete_func")]
+  public static extern int switch_console_run_complete_func(string jarg1, string jarg2, string jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_push_match")]
+  public static extern void switch_console_push_match(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_free_matches")]
+  public static extern void switch_console_free_matches(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_complete")]
+  public static extern byte switch_console_complete(string jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_sort_matches")]
+  public static extern void switch_console_sort_matches(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_save_history")]
+  public static extern void switch_console_save_history();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_expand_alias")]
+  public static extern string switch_console_expand_alias(string jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_console_execute")]
+  public static extern int switch_console_execute(string jarg1, int jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_toupper")]
+  public static extern int switch_toupper(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_tolower")]
+  public static extern int switch_tolower(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_isalnum")]
+  public static extern int switch_isalnum(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_isalpha")]
+  public static extern int switch_isalpha(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_iscntrl")]
+  public static extern int switch_iscntrl(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_isdigit")]
+  public static extern int switch_isdigit(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_isgraph")]
+  public static extern int switch_isgraph(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_islower")]
+  public static extern int switch_islower(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_isprint")]
+  public static extern int switch_isprint(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ispunct")]
+  public static extern int switch_ispunct(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_isspace")]
+  public static extern int switch_isspace(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_isupper")]
+  public static extern int switch_isupper(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_isxdigit")]
+  public static extern int switch_isxdigit(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SMAX_get")]
+  public static extern int SWITCH_SMAX_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_SMIN_get")]
+  public static extern int SWITCH_SMIN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_zstr")]
+  public static extern int zstr(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_is_moh")]
+  public static extern int switch_is_moh(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_string_has_escaped_data")]
+  public static extern int switch_string_has_escaped_data(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_b64_encode")]
+  public static extern int switch_b64_encode(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_b64_decode")]
+  public static extern IntPtr switch_b64_decode(string jarg1, string jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_amp_encode")]
+  public static extern string switch_amp_encode(string jarg1, string jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_is_digit_string")]
+  public static extern int switch_is_digit_string(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_fd_read_line")]
+  public static extern IntPtr switch_fd_read_line(int jarg1, string jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_alloc")]
+  public static extern int switch_frame_alloc(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_dup")]
+  public static extern int switch_frame_dup(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_free")]
+  public static extern int switch_frame_free(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_resolve_host")]
+  public static extern int switch_resolve_host(string jarg1, string jarg2, uint jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_find_local_ip")]
+  public static extern int switch_find_local_ip(string jarg1, int jarg2, HandleRef jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_get_addr")]
+  public static extern string get_addr(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_get_addr_int")]
+  public static extern int get_addr_int(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cmp_addr")]
+  public static extern int switch_cmp_addr(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_get_port")]
+  public static extern ushort get_port(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_build_uri")]
+  public static extern int switch_build_uri(string jarg1, HandleRef jarg2, string jarg3, string jarg4, HandleRef jarg5, int jarg6);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_priority_name")]
+  public static extern string switch_priority_name(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rfc2833_to_char")]
+  public static extern char switch_rfc2833_to_char(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_char_to_rfc2833")]
+  public static extern byte switch_char_to_rfc2833(char jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_sanitize_number")]
+  public static extern string switch_sanitize_number(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_string_var_check")]
+  public static extern int switch_string_var_check(string jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_string_var_check_const")]
+  public static extern int switch_string_var_check_const(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_var_clean_string")]
+  public static extern string switch_var_clean_string(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_clean_string")]
+  public static extern string switch_clean_string(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_safe_strdup")]
+  public static extern string switch_safe_strdup(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_lc_strdup")]
+  public static extern string switch_lc_strdup(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_uc_strdup")]
+  public static extern string switch_uc_strdup(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_strstr")]
+  public static extern int switch_strstr(string jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_str_time")]
+  public static extern IntPtr switch_str_time(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_separate_string")]
+  public static extern uint switch_separate_string(string jarg1, char jarg2, ref string jarg3, uint jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_separate_string_string")]
+  public static extern uint switch_separate_string_string(string jarg1, string jarg2, ref string jarg3, uint jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_is_number")]
+  public static extern int switch_is_number(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_strip_spaces")]
+  public static extern string switch_strip_spaces(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_separate_paren_args")]
+  public static extern string switch_separate_paren_args(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_stristr")]
+  public static extern string switch_stristr(string jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_is_lan_addr")]
+  public static extern int switch_is_lan_addr(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_replace_char")]
+  public static extern string switch_replace_char(string jarg1, char jarg2, char jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ast2regex")]
+  public static extern int switch_ast2regex(string jarg1, string jarg2, uint jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_escape_char")]
+  public static extern string switch_escape_char(HandleRef jarg1, string jarg2, string jarg3, char jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_escape_string")]
+  public static extern string switch_escape_string(string jarg1, string jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_escape_string_pool")]
+  public static extern string switch_escape_string_pool(string jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_socket_waitfor")]
+  public static extern int switch_socket_waitfor(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_cut_path")]
+  public static extern string switch_cut_path(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_string_replace")]
+  public static extern string switch_string_replace(string jarg1, string jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_string_match")]
+  public static extern int switch_string_match(string jarg1, uint jarg2, string jarg3, uint jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_util_quote_shell_arg")]
+  public static extern string switch_util_quote_shell_arg(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_url_encode")]
+  public static extern uint switch_url_encode(string jarg1, string jarg2, uint jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_url_decode")]
+  public static extern string switch_url_decode(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_simple_email")]
+  public static extern int switch_simple_email(string jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_find_end_paren")]
+  public static extern string switch_find_end_paren(string jarg1, char jarg2, char jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_is_file_path")]
+  public static extern int switch_is_file_path(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_parse_cidr")]
+  public static extern int switch_parse_cidr(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_create")]
+  public static extern int switch_network_list_create(HandleRef jarg1, string jarg2, int jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_add_cidr_token")]
+  public static extern int switch_network_list_add_cidr_token(HandleRef jarg1, string jarg2, int jarg3, string jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_add_host_mask")]
+  public static extern int switch_network_list_add_host_mask(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_network_list_validate_ip_token")]
+  public static extern int switch_network_list_validate_ip_token(HandleRef jarg1, uint jarg2, ref string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_number_cmp")]
+  public static extern int switch_number_cmp(string jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_username_set")]
+  public static extern void switch_caller_profile_username_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_username_get")]
+  public static extern string switch_caller_profile_username_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_dialplan_set")]
+  public static extern void switch_caller_profile_dialplan_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_dialplan_get")]
+  public static extern string switch_caller_profile_dialplan_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_caller_id_name_set")]
+  public static extern void switch_caller_profile_caller_id_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_caller_id_name_get")]
+  public static extern string switch_caller_profile_caller_id_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_caller_id_number_set")]
+  public static extern void switch_caller_profile_caller_id_number_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_caller_id_number_get")]
+  public static extern string switch_caller_profile_caller_id_number_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_callee_id_name_set")]
+  public static extern void switch_caller_profile_callee_id_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_callee_id_name_get")]
+  public static extern string switch_caller_profile_callee_id_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_callee_id_number_set")]
+  public static extern void switch_caller_profile_callee_id_number_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_callee_id_number_get")]
+  public static extern string switch_caller_profile_callee_id_number_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_caller_ton_set")]
+  public static extern void switch_caller_profile_caller_ton_set(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_caller_ton_get")]
+  public static extern byte switch_caller_profile_caller_ton_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_caller_numplan_set")]
+  public static extern void switch_caller_profile_caller_numplan_set(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_caller_numplan_get")]
+  public static extern byte switch_caller_profile_caller_numplan_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_network_addr_set")]
+  public static extern void switch_caller_profile_network_addr_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_network_addr_get")]
+  public static extern string switch_caller_profile_network_addr_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_ani_set")]
+  public static extern void switch_caller_profile_ani_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_ani_get")]
+  public static extern string switch_caller_profile_ani_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_ani_ton_set")]
+  public static extern void switch_caller_profile_ani_ton_set(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_ani_ton_get")]
+  public static extern byte switch_caller_profile_ani_ton_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_ani_numplan_set")]
+  public static extern void switch_caller_profile_ani_numplan_set(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_ani_numplan_get")]
+  public static extern byte switch_caller_profile_ani_numplan_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_aniii_set")]
+  public static extern void switch_caller_profile_aniii_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_aniii_get")]
+  public static extern string switch_caller_profile_aniii_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_rdnis_set")]
+  public static extern void switch_caller_profile_rdnis_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_rdnis_get")]
+  public static extern string switch_caller_profile_rdnis_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_rdnis_ton_set")]
+  public static extern void switch_caller_profile_rdnis_ton_set(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_rdnis_ton_get")]
+  public static extern byte switch_caller_profile_rdnis_ton_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_rdnis_numplan_set")]
+  public static extern void switch_caller_profile_rdnis_numplan_set(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_rdnis_numplan_get")]
+  public static extern byte switch_caller_profile_rdnis_numplan_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_destination_number_set")]
+  public static extern void switch_caller_profile_destination_number_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_destination_number_get")]
+  public static extern string switch_caller_profile_destination_number_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_destination_number_ton_set")]
+  public static extern void switch_caller_profile_destination_number_ton_set(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_destination_number_ton_get")]
+  public static extern byte switch_caller_profile_destination_number_ton_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_destination_number_numplan_set")]
+  public static extern void switch_caller_profile_destination_number_numplan_set(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_destination_number_numplan_get")]
+  public static extern byte switch_caller_profile_destination_number_numplan_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_source_set")]
+  public static extern void switch_caller_profile_source_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_source_get")]
+  public static extern string switch_caller_profile_source_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_chan_name_set")]
+  public static extern void switch_caller_profile_chan_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_chan_name_get")]
+  public static extern string switch_caller_profile_chan_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_uuid_set")]
+  public static extern void switch_caller_profile_uuid_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_uuid_get")]
+  public static extern string switch_caller_profile_uuid_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_context_set")]
+  public static extern void switch_caller_profile_context_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_context_get")]
+  public static extern string switch_caller_profile_context_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_profile_index_set")]
+  public static extern void switch_caller_profile_profile_index_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_profile_index_get")]
+  public static extern string switch_caller_profile_profile_index_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_flags_set")]
+  public static extern void switch_caller_profile_flags_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_flags_get")]
+  public static extern uint switch_caller_profile_flags_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_originator_caller_profile_set")]
+  public static extern void switch_caller_profile_originator_caller_profile_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_originator_caller_profile_get")]
+  public static extern IntPtr switch_caller_profile_originator_caller_profile_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_originatee_caller_profile_set")]
+  public static extern void switch_caller_profile_originatee_caller_profile_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_originatee_caller_profile_get")]
+  public static extern IntPtr switch_caller_profile_originatee_caller_profile_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_hunt_caller_profile_set")]
+  public static extern void switch_caller_profile_hunt_caller_profile_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_hunt_caller_profile_get")]
+  public static extern IntPtr switch_caller_profile_hunt_caller_profile_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_times_set")]
+  public static extern void switch_caller_profile_times_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_times_get")]
+  public static extern IntPtr switch_caller_profile_times_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_caller_extension_set")]
+  public static extern void switch_caller_profile_caller_extension_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_caller_extension_get")]
+  public static extern IntPtr switch_caller_profile_caller_extension_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_pool_set")]
+  public static extern void switch_caller_profile_pool_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_pool_get")]
+  public static extern IntPtr switch_caller_profile_pool_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_next_set")]
+  public static extern void switch_caller_profile_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_next_get")]
+  public static extern IntPtr switch_caller_profile_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_caller_profile")]
+  public static extern IntPtr new_switch_caller_profile();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_caller_profile")]
+  public static extern void delete_switch_caller_profile(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_application_application_name_set")]
+  public static extern void switch_caller_application_application_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_application_application_name_get")]
+  public static extern string switch_caller_application_application_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_application_application_data_set")]
+  public static extern void switch_caller_application_application_data_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_application_application_data_get")]
+  public static extern string switch_caller_application_application_data_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_application_application_function_set")]
+  public static extern void switch_caller_application_application_function_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_application_application_function_get")]
+  public static extern IntPtr switch_caller_application_application_function_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_application_next_set")]
+  public static extern void switch_caller_application_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_application_next_get")]
+  public static extern IntPtr switch_caller_application_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_caller_application")]
+  public static extern IntPtr new_switch_caller_application();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_caller_application")]
+  public static extern void delete_switch_caller_application(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_extension_name_set")]
+  public static extern void switch_caller_extension_extension_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_extension_name_get")]
+  public static extern string switch_caller_extension_extension_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_extension_number_set")]
+  public static extern void switch_caller_extension_extension_number_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_extension_number_get")]
+  public static extern string switch_caller_extension_extension_number_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_current_application_set")]
+  public static extern void switch_caller_extension_current_application_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_current_application_get")]
+  public static extern IntPtr switch_caller_extension_current_application_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_last_application_set")]
+  public static extern void switch_caller_extension_last_application_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_last_application_get")]
+  public static extern IntPtr switch_caller_extension_last_application_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_applications_set")]
+  public static extern void switch_caller_extension_applications_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_applications_get")]
+  public static extern IntPtr switch_caller_extension_applications_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_children_set")]
+  public static extern void switch_caller_extension_children_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_children_get")]
+  public static extern IntPtr switch_caller_extension_children_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_next_set")]
+  public static extern void switch_caller_extension_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_next_get")]
+  public static extern IntPtr switch_caller_extension_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_caller_extension")]
+  public static extern IntPtr new_switch_caller_extension();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_caller_extension")]
+  public static extern void delete_switch_caller_extension(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_new")]
+  public static extern IntPtr switch_caller_extension_new(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_clone")]
+  public static extern int switch_caller_extension_clone(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_add_application")]
+  public static extern void switch_caller_extension_add_application(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_extension_add_application_printf")]
+  public static extern void switch_caller_extension_add_application_printf(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_get_field_by_name")]
+  public static extern string switch_caller_get_field_by_name(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_new")]
+  public static extern IntPtr switch_caller_profile_new(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, string jarg11, string jarg12);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_clone")]
+  public static extern IntPtr switch_caller_profile_clone(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_dup")]
+  public static extern IntPtr switch_caller_profile_dup(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_caller_profile_event_set_data")]
+  public static extern void switch_caller_profile_event_set_data(HandleRef jarg1, string jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_codec_set")]
+  public static extern void switch_frame_codec_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_codec_get")]
+  public static extern IntPtr switch_frame_codec_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_source_set")]
+  public static extern void switch_frame_source_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_source_get")]
+  public static extern string switch_frame_source_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_packet_set")]
+  public static extern void switch_frame_packet_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_packet_get")]
+  public static extern IntPtr switch_frame_packet_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_packetlen_set")]
+  public static extern void switch_frame_packetlen_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_packetlen_get")]
+  public static extern uint switch_frame_packetlen_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_extra_data_set")]
+  public static extern void switch_frame_extra_data_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_extra_data_get")]
+  public static extern IntPtr switch_frame_extra_data_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_data_set")]
+  public static extern void switch_frame_data_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_data_get")]
+  public static extern IntPtr switch_frame_data_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_datalen_set")]
+  public static extern void switch_frame_datalen_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_datalen_get")]
+  public static extern uint switch_frame_datalen_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_buflen_set")]
+  public static extern void switch_frame_buflen_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_buflen_get")]
+  public static extern uint switch_frame_buflen_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_samples_set")]
+  public static extern void switch_frame_samples_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_samples_get")]
+  public static extern uint switch_frame_samples_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_rate_set")]
+  public static extern void switch_frame_rate_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_rate_get")]
+  public static extern uint switch_frame_rate_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_payload_set")]
+  public static extern void switch_frame_payload_set(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_payload_get")]
+  public static extern byte switch_frame_payload_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_timestamp_set")]
+  public static extern void switch_frame_timestamp_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_timestamp_get")]
+  public static extern IntPtr switch_frame_timestamp_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_seq_set")]
+  public static extern void switch_frame_seq_set(HandleRef jarg1, ushort jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_seq_get")]
+  public static extern ushort switch_frame_seq_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_ssrc_set")]
+  public static extern void switch_frame_ssrc_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_ssrc_get")]
+  public static extern uint switch_frame_ssrc_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_m_set")]
+  public static extern void switch_frame_m_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_m_get")]
+  public static extern int switch_frame_m_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_flags_set")]
+  public static extern void switch_frame_flags_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_flags_get")]
+  public static extern uint switch_frame_flags_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_frame")]
+  public static extern IntPtr new_switch_frame();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_frame")]
+  public static extern void delete_switch_frame(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_init_set")]
+  public static extern void switch_state_handler_table_on_init_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_init_get")]
+  public static extern IntPtr switch_state_handler_table_on_init_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_routing_set")]
+  public static extern void switch_state_handler_table_on_routing_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_routing_get")]
+  public static extern IntPtr switch_state_handler_table_on_routing_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_execute_set")]
+  public static extern void switch_state_handler_table_on_execute_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_execute_get")]
+  public static extern IntPtr switch_state_handler_table_on_execute_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_hangup_set")]
+  public static extern void switch_state_handler_table_on_hangup_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_hangup_get")]
+  public static extern IntPtr switch_state_handler_table_on_hangup_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_exchange_media_set")]
+  public static extern void switch_state_handler_table_on_exchange_media_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_exchange_media_get")]
+  public static extern IntPtr switch_state_handler_table_on_exchange_media_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_soft_execute_set")]
+  public static extern void switch_state_handler_table_on_soft_execute_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_soft_execute_get")]
+  public static extern IntPtr switch_state_handler_table_on_soft_execute_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_consume_media_set")]
+  public static extern void switch_state_handler_table_on_consume_media_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_consume_media_get")]
+  public static extern IntPtr switch_state_handler_table_on_consume_media_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_hibernate_set")]
+  public static extern void switch_state_handler_table_on_hibernate_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_hibernate_get")]
+  public static extern IntPtr switch_state_handler_table_on_hibernate_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_reset_set")]
+  public static extern void switch_state_handler_table_on_reset_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_reset_get")]
+  public static extern IntPtr switch_state_handler_table_on_reset_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_park_set")]
+  public static extern void switch_state_handler_table_on_park_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_park_get")]
+  public static extern IntPtr switch_state_handler_table_on_park_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_reporting_set")]
+  public static extern void switch_state_handler_table_on_reporting_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_reporting_get")]
+  public static extern IntPtr switch_state_handler_table_on_reporting_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_destroy_set")]
+  public static extern void switch_state_handler_table_on_destroy_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_on_destroy_get")]
+  public static extern IntPtr switch_state_handler_table_on_destroy_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_flags_set")]
+  public static extern void switch_state_handler_table_flags_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_flags_get")]
+  public static extern int switch_state_handler_table_flags_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_padding_set")]
+  public static extern void switch_state_handler_table_padding_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_state_handler_table_padding_get")]
+  public static extern IntPtr switch_state_handler_table_padding_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_state_handler_table")]
+  public static extern IntPtr new_switch_state_handler_table();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_state_handler_table")]
+  public static extern void delete_switch_state_handler_table(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_write_function_set")]
+  public static extern void switch_stream_handle_write_function_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_write_function_get")]
+  public static extern IntPtr switch_stream_handle_write_function_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_raw_write_function_set")]
+  public static extern void switch_stream_handle_raw_write_function_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_raw_write_function_get")]
+  public static extern IntPtr switch_stream_handle_raw_write_function_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_data_set")]
+  public static extern void switch_stream_handle_data_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_data_get")]
+  public static extern IntPtr switch_stream_handle_data_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_end_set")]
+  public static extern void switch_stream_handle_end_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_end_get")]
+  public static extern IntPtr switch_stream_handle_end_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_data_size_set")]
+  public static extern void switch_stream_handle_data_size_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_data_size_get")]
+  public static extern IntPtr switch_stream_handle_data_size_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_data_len_set")]
+  public static extern void switch_stream_handle_data_len_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_data_len_get")]
+  public static extern IntPtr switch_stream_handle_data_len_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_alloc_len_set")]
+  public static extern void switch_stream_handle_alloc_len_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_alloc_len_get")]
+  public static extern IntPtr switch_stream_handle_alloc_len_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_alloc_chunk_set")]
+  public static extern void switch_stream_handle_alloc_chunk_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_alloc_chunk_get")]
+  public static extern IntPtr switch_stream_handle_alloc_chunk_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_param_event_set")]
+  public static extern void switch_stream_handle_param_event_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_stream_handle_param_event_get")]
+  public static extern IntPtr switch_stream_handle_param_event_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_stream_handle")]
+  public static extern IntPtr new_switch_stream_handle();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_stream_handle")]
+  public static extern void delete_switch_stream_handle(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_outgoing_channel_set")]
+  public static extern void switch_io_routines_outgoing_channel_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_outgoing_channel_get")]
+  public static extern IntPtr switch_io_routines_outgoing_channel_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_read_frame_set")]
+  public static extern void switch_io_routines_read_frame_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_read_frame_get")]
+  public static extern IntPtr switch_io_routines_read_frame_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_write_frame_set")]
+  public static extern void switch_io_routines_write_frame_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_write_frame_get")]
+  public static extern IntPtr switch_io_routines_write_frame_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_kill_channel_set")]
+  public static extern void switch_io_routines_kill_channel_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_kill_channel_get")]
+  public static extern IntPtr switch_io_routines_kill_channel_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_send_dtmf_set")]
+  public static extern void switch_io_routines_send_dtmf_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_send_dtmf_get")]
+  public static extern IntPtr switch_io_routines_send_dtmf_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_receive_message_set")]
+  public static extern void switch_io_routines_receive_message_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_receive_message_get")]
+  public static extern IntPtr switch_io_routines_receive_message_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_receive_event_set")]
+  public static extern void switch_io_routines_receive_event_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_receive_event_get")]
+  public static extern IntPtr switch_io_routines_receive_event_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_state_change_set")]
+  public static extern void switch_io_routines_state_change_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_state_change_get")]
+  public static extern IntPtr switch_io_routines_state_change_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_read_video_frame_set")]
+  public static extern void switch_io_routines_read_video_frame_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_read_video_frame_get")]
+  public static extern IntPtr switch_io_routines_read_video_frame_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_write_video_frame_set")]
+  public static extern void switch_io_routines_write_video_frame_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_write_video_frame_get")]
+  public static extern IntPtr switch_io_routines_write_video_frame_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_resurrect_session_set")]
+  public static extern void switch_io_routines_resurrect_session_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_resurrect_session_get")]
+  public static extern IntPtr switch_io_routines_resurrect_session_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_padding_set")]
+  public static extern void switch_io_routines_padding_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_routines_padding_get")]
+  public static extern IntPtr switch_io_routines_padding_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_routines")]
+  public static extern IntPtr new_switch_io_routines();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_routines")]
+  public static extern void delete_switch_io_routines(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_interface_name_set")]
+  public static extern void switch_endpoint_interface_interface_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_interface_name_get")]
+  public static extern string switch_endpoint_interface_interface_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_io_routines_set")]
+  public static extern void switch_endpoint_interface_io_routines_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_io_routines_get")]
+  public static extern IntPtr switch_endpoint_interface_io_routines_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_state_handler_set")]
+  public static extern void switch_endpoint_interface_state_handler_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_state_handler_get")]
+  public static extern IntPtr switch_endpoint_interface_state_handler_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_private_info_set")]
+  public static extern void switch_endpoint_interface_private_info_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_private_info_get")]
+  public static extern IntPtr switch_endpoint_interface_private_info_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_rwlock_set")]
+  public static extern void switch_endpoint_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_rwlock_get")]
+  public static extern IntPtr switch_endpoint_interface_rwlock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_refs_set")]
+  public static extern void switch_endpoint_interface_refs_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_refs_get")]
+  public static extern int switch_endpoint_interface_refs_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_reflock_set")]
+  public static extern void switch_endpoint_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_reflock_get")]
+  public static extern IntPtr switch_endpoint_interface_reflock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_parent_set")]
+  public static extern void switch_endpoint_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_parent_get")]
+  public static extern IntPtr switch_endpoint_interface_parent_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_next_set")]
+  public static extern void switch_endpoint_interface_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_endpoint_interface_next_get")]
+  public static extern IntPtr switch_endpoint_interface_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_endpoint_interface")]
+  public static extern IntPtr new_switch_endpoint_interface();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_endpoint_interface")]
+  public static extern void delete_switch_endpoint_interface(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interval_set")]
+  public static extern void switch_timer_interval_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interval_get")]
+  public static extern int switch_timer_interval_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_flags_set")]
+  public static extern void switch_timer_flags_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_flags_get")]
+  public static extern uint switch_timer_flags_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_samples_set")]
+  public static extern void switch_timer_samples_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_samples_get")]
+  public static extern uint switch_timer_samples_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_samplecount_set")]
+  public static extern void switch_timer_samplecount_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_samplecount_get")]
+  public static extern uint switch_timer_samplecount_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_timer_interface_set")]
+  public static extern void switch_timer_timer_interface_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_timer_interface_get")]
+  public static extern IntPtr switch_timer_timer_interface_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_memory_pool_set")]
+  public static extern void switch_timer_memory_pool_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_memory_pool_get")]
+  public static extern IntPtr switch_timer_memory_pool_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_private_info_set")]
+  public static extern void switch_timer_private_info_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_private_info_get")]
+  public static extern IntPtr switch_timer_private_info_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_diff_set")]
+  public static extern void switch_timer_diff_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_diff_get")]
+  public static extern IntPtr switch_timer_diff_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_tick_set")]
+  public static extern void switch_timer_tick_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_tick_get")]
+  public static extern IntPtr switch_timer_tick_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_timer")]
+  public static extern IntPtr new_switch_timer();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_timer")]
+  public static extern void delete_switch_timer(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_interface_name_set")]
+  public static extern void switch_timer_interface_interface_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_interface_name_get")]
+  public static extern string switch_timer_interface_interface_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_init_set")]
+  public static extern void switch_timer_interface_timer_init_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_init_get")]
+  public static extern IntPtr switch_timer_interface_timer_init_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_next_set")]
+  public static extern void switch_timer_interface_timer_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_next_get")]
+  public static extern IntPtr switch_timer_interface_timer_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_step_set")]
+  public static extern void switch_timer_interface_timer_step_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_step_get")]
+  public static extern IntPtr switch_timer_interface_timer_step_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_sync_set")]
+  public static extern void switch_timer_interface_timer_sync_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_sync_get")]
+  public static extern IntPtr switch_timer_interface_timer_sync_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_check_set")]
+  public static extern void switch_timer_interface_timer_check_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_check_get")]
+  public static extern IntPtr switch_timer_interface_timer_check_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_destroy_set")]
+  public static extern void switch_timer_interface_timer_destroy_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_timer_destroy_get")]
+  public static extern IntPtr switch_timer_interface_timer_destroy_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_rwlock_set")]
+  public static extern void switch_timer_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_rwlock_get")]
+  public static extern IntPtr switch_timer_interface_rwlock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_refs_set")]
+  public static extern void switch_timer_interface_refs_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_refs_get")]
+  public static extern int switch_timer_interface_refs_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_reflock_set")]
+  public static extern void switch_timer_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_reflock_get")]
+  public static extern IntPtr switch_timer_interface_reflock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_parent_set")]
+  public static extern void switch_timer_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_parent_get")]
+  public static extern IntPtr switch_timer_interface_parent_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_next_set")]
+  public static extern void switch_timer_interface_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_timer_interface_next_get")]
+  public static extern IntPtr switch_timer_interface_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_timer_interface")]
+  public static extern IntPtr new_switch_timer_interface();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_timer_interface")]
+  public static extern void delete_switch_timer_interface(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_interface_name_set")]
+  public static extern void switch_dialplan_interface_interface_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_interface_name_get")]
+  public static extern string switch_dialplan_interface_interface_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_hunt_function_set")]
+  public static extern void switch_dialplan_interface_hunt_function_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_hunt_function_get")]
+  public static extern IntPtr switch_dialplan_interface_hunt_function_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_rwlock_set")]
+  public static extern void switch_dialplan_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_rwlock_get")]
+  public static extern IntPtr switch_dialplan_interface_rwlock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_refs_set")]
+  public static extern void switch_dialplan_interface_refs_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_refs_get")]
+  public static extern int switch_dialplan_interface_refs_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_reflock_set")]
+  public static extern void switch_dialplan_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_reflock_get")]
+  public static extern IntPtr switch_dialplan_interface_reflock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_parent_set")]
+  public static extern void switch_dialplan_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_parent_get")]
+  public static extern IntPtr switch_dialplan_interface_parent_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_next_set")]
+  public static extern void switch_dialplan_interface_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_dialplan_interface_next_get")]
+  public static extern IntPtr switch_dialplan_interface_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_dialplan_interface")]
+  public static extern IntPtr new_switch_dialplan_interface();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_dialplan_interface")]
+  public static extern void delete_switch_dialplan_interface(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_interface_name_set")]
+  public static extern void switch_file_interface_interface_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_interface_name_get")]
+  public static extern string switch_file_interface_interface_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_open_set")]
+  public static extern void switch_file_interface_file_open_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_open_get")]
+  public static extern IntPtr switch_file_interface_file_open_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_close_set")]
+  public static extern void switch_file_interface_file_close_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_close_get")]
+  public static extern IntPtr switch_file_interface_file_close_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_truncate_set")]
+  public static extern void switch_file_interface_file_truncate_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_truncate_get")]
+  public static extern IntPtr switch_file_interface_file_truncate_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_read_set")]
+  public static extern void switch_file_interface_file_read_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_read_get")]
+  public static extern IntPtr switch_file_interface_file_read_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_write_set")]
+  public static extern void switch_file_interface_file_write_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_write_get")]
+  public static extern IntPtr switch_file_interface_file_write_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_seek_set")]
+  public static extern void switch_file_interface_file_seek_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_seek_get")]
+  public static extern IntPtr switch_file_interface_file_seek_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_set_string_set")]
+  public static extern void switch_file_interface_file_set_string_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_set_string_get")]
+  public static extern IntPtr switch_file_interface_file_set_string_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_get_string_set")]
+  public static extern void switch_file_interface_file_get_string_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_file_get_string_get")]
+  public static extern IntPtr switch_file_interface_file_get_string_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_extens_set")]
+  public static extern void switch_file_interface_extens_set(HandleRef jarg1, ref string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_extens_get")]
+  public static extern string switch_file_interface_extens_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_rwlock_set")]
+  public static extern void switch_file_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_rwlock_get")]
+  public static extern IntPtr switch_file_interface_rwlock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_refs_set")]
+  public static extern void switch_file_interface_refs_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_refs_get")]
+  public static extern int switch_file_interface_refs_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_reflock_set")]
+  public static extern void switch_file_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_reflock_get")]
+  public static extern IntPtr switch_file_interface_reflock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_parent_set")]
+  public static extern void switch_file_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_parent_get")]
+  public static extern IntPtr switch_file_interface_parent_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_next_set")]
+  public static extern void switch_file_interface_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_interface_next_get")]
+  public static extern IntPtr switch_file_interface_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_file_interface")]
+  public static extern IntPtr new_switch_file_interface();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_file_interface")]
+  public static extern void delete_switch_file_interface(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_file_interface_set")]
+  public static extern void switch_file_handle_file_interface_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_file_interface_get")]
+  public static extern IntPtr switch_file_handle_file_interface_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_flags_set")]
+  public static extern void switch_file_handle_flags_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_flags_get")]
+  public static extern uint switch_file_handle_flags_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_fd_set")]
+  public static extern void switch_file_handle_fd_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_fd_get")]
+  public static extern IntPtr switch_file_handle_fd_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_samples_set")]
+  public static extern void switch_file_handle_samples_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_samples_get")]
+  public static extern uint switch_file_handle_samples_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_samplerate_set")]
+  public static extern void switch_file_handle_samplerate_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_samplerate_get")]
+  public static extern uint switch_file_handle_samplerate_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_native_rate_set")]
+  public static extern void switch_file_handle_native_rate_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_native_rate_get")]
+  public static extern uint switch_file_handle_native_rate_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_channels_set")]
+  public static extern void switch_file_handle_channels_set(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_channels_get")]
+  public static extern byte switch_file_handle_channels_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_format_set")]
+  public static extern void switch_file_handle_format_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_format_get")]
+  public static extern uint switch_file_handle_format_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_sections_set")]
+  public static extern void switch_file_handle_sections_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_sections_get")]
+  public static extern uint switch_file_handle_sections_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_seekable_set")]
+  public static extern void switch_file_handle_seekable_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_seekable_get")]
+  public static extern int switch_file_handle_seekable_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_sample_count_set")]
+  public static extern void switch_file_handle_sample_count_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_sample_count_get")]
+  public static extern IntPtr switch_file_handle_sample_count_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_speed_set")]
+  public static extern void switch_file_handle_speed_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_speed_get")]
+  public static extern int switch_file_handle_speed_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_memory_pool_set")]
+  public static extern void switch_file_handle_memory_pool_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_memory_pool_get")]
+  public static extern IntPtr switch_file_handle_memory_pool_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_prebuf_set")]
+  public static extern void switch_file_handle_prebuf_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_prebuf_get")]
+  public static extern uint switch_file_handle_prebuf_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_interval_set")]
+  public static extern void switch_file_handle_interval_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_interval_get")]
+  public static extern uint switch_file_handle_interval_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_private_info_set")]
+  public static extern void switch_file_handle_private_info_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_private_info_get")]
+  public static extern IntPtr switch_file_handle_private_info_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_handler_set")]
+  public static extern void switch_file_handle_handler_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_handler_get")]
+  public static extern string switch_file_handle_handler_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pos_set")]
+  public static extern void switch_file_handle_pos_set(HandleRef jarg1, long jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pos_get")]
+  public static extern long switch_file_handle_pos_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_audio_buffer_set")]
+  public static extern void switch_file_handle_audio_buffer_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_audio_buffer_get")]
+  public static extern IntPtr switch_file_handle_audio_buffer_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_sp_audio_buffer_set")]
+  public static extern void switch_file_handle_sp_audio_buffer_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_sp_audio_buffer_get")]
+  public static extern IntPtr switch_file_handle_sp_audio_buffer_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_thresh_set")]
+  public static extern void switch_file_handle_thresh_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_thresh_get")]
+  public static extern uint switch_file_handle_thresh_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_silence_hits_set")]
+  public static extern void switch_file_handle_silence_hits_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_silence_hits_get")]
+  public static extern uint switch_file_handle_silence_hits_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_offset_pos_set")]
+  public static extern void switch_file_handle_offset_pos_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_offset_pos_get")]
+  public static extern uint switch_file_handle_offset_pos_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_samples_in_set")]
+  public static extern void switch_file_handle_samples_in_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_samples_in_get")]
+  public static extern IntPtr switch_file_handle_samples_in_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_samples_out_set")]
+  public static extern void switch_file_handle_samples_out_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_samples_out_get")]
+  public static extern IntPtr switch_file_handle_samples_out_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_vol_set")]
+  public static extern void switch_file_handle_vol_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_vol_get")]
+  public static extern int switch_file_handle_vol_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_resampler_set")]
+  public static extern void switch_file_handle_resampler_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_resampler_get")]
+  public static extern IntPtr switch_file_handle_resampler_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_buffer_set")]
+  public static extern void switch_file_handle_buffer_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_buffer_get")]
+  public static extern IntPtr switch_file_handle_buffer_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_dbuf_set")]
+  public static extern void switch_file_handle_dbuf_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_dbuf_get")]
+  public static extern IntPtr switch_file_handle_dbuf_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_dbuflen_set")]
+  public static extern void switch_file_handle_dbuflen_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_dbuflen_get")]
+  public static extern IntPtr switch_file_handle_dbuflen_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pre_buffer_set")]
+  public static extern void switch_file_handle_pre_buffer_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pre_buffer_get")]
+  public static extern IntPtr switch_file_handle_pre_buffer_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pre_buffer_data_set")]
+  public static extern void switch_file_handle_pre_buffer_data_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pre_buffer_data_get")]
+  public static extern IntPtr switch_file_handle_pre_buffer_data_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pre_buffer_datalen_set")]
+  public static extern void switch_file_handle_pre_buffer_datalen_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_pre_buffer_datalen_get")]
+  public static extern IntPtr switch_file_handle_pre_buffer_datalen_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_file_set")]
+  public static extern void switch_file_handle_file_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_file_get")]
+  public static extern string switch_file_handle_file_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_func_set")]
+  public static extern void switch_file_handle_func_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_func_get")]
+  public static extern string switch_file_handle_func_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_line_set")]
+  public static extern void switch_file_handle_line_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_line_get")]
+  public static extern int switch_file_handle_line_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_file_path_set")]
+  public static extern void switch_file_handle_file_path_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_file_path_get")]
+  public static extern string switch_file_handle_file_path_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_spool_path_set")]
+  public static extern void switch_file_handle_spool_path_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_spool_path_get")]
+  public static extern string switch_file_handle_spool_path_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_prefix_set")]
+  public static extern void switch_file_handle_prefix_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_file_handle_prefix_get")]
+  public static extern string switch_file_handle_prefix_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_file_handle")]
+  public static extern IntPtr new_switch_file_handle();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_file_handle")]
+  public static extern void delete_switch_file_handle(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_interface_name_set")]
+  public static extern void switch_asr_interface_interface_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_interface_name_get")]
+  public static extern string switch_asr_interface_interface_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_open_set")]
+  public static extern void switch_asr_interface_asr_open_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_open_get")]
+  public static extern IntPtr switch_asr_interface_asr_open_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_load_grammar_set")]
+  public static extern void switch_asr_interface_asr_load_grammar_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_load_grammar_get")]
+  public static extern IntPtr switch_asr_interface_asr_load_grammar_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_unload_grammar_set")]
+  public static extern void switch_asr_interface_asr_unload_grammar_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_unload_grammar_get")]
+  public static extern IntPtr switch_asr_interface_asr_unload_grammar_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_close_set")]
+  public static extern void switch_asr_interface_asr_close_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_close_get")]
+  public static extern IntPtr switch_asr_interface_asr_close_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_feed_set")]
+  public static extern void switch_asr_interface_asr_feed_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_feed_get")]
+  public static extern IntPtr switch_asr_interface_asr_feed_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_resume_set")]
+  public static extern void switch_asr_interface_asr_resume_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_resume_get")]
+  public static extern IntPtr switch_asr_interface_asr_resume_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_pause_set")]
+  public static extern void switch_asr_interface_asr_pause_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_pause_get")]
+  public static extern IntPtr switch_asr_interface_asr_pause_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_check_results_set")]
+  public static extern void switch_asr_interface_asr_check_results_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_check_results_get")]
+  public static extern IntPtr switch_asr_interface_asr_check_results_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_get_results_set")]
+  public static extern void switch_asr_interface_asr_get_results_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_get_results_get")]
+  public static extern IntPtr switch_asr_interface_asr_get_results_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_start_input_timers_set")]
+  public static extern void switch_asr_interface_asr_start_input_timers_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_start_input_timers_get")]
+  public static extern IntPtr switch_asr_interface_asr_start_input_timers_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_text_param_set")]
+  public static extern void switch_asr_interface_asr_text_param_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_text_param_get")]
+  public static extern IntPtr switch_asr_interface_asr_text_param_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_numeric_param_set")]
+  public static extern void switch_asr_interface_asr_numeric_param_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_numeric_param_get")]
+  public static extern IntPtr switch_asr_interface_asr_numeric_param_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_float_param_set")]
+  public static extern void switch_asr_interface_asr_float_param_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_asr_float_param_get")]
+  public static extern IntPtr switch_asr_interface_asr_float_param_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_rwlock_set")]
+  public static extern void switch_asr_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_rwlock_get")]
+  public static extern IntPtr switch_asr_interface_rwlock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_refs_set")]
+  public static extern void switch_asr_interface_refs_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_refs_get")]
+  public static extern int switch_asr_interface_refs_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_reflock_set")]
+  public static extern void switch_asr_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_reflock_get")]
+  public static extern IntPtr switch_asr_interface_reflock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_parent_set")]
+  public static extern void switch_asr_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_parent_get")]
+  public static extern IntPtr switch_asr_interface_parent_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_next_set")]
+  public static extern void switch_asr_interface_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_interface_next_get")]
+  public static extern IntPtr switch_asr_interface_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_asr_interface")]
+  public static extern IntPtr new_switch_asr_interface();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_asr_interface")]
+  public static extern void delete_switch_asr_interface(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_asr_interface_set")]
+  public static extern void switch_asr_handle_asr_interface_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_asr_interface_get")]
+  public static extern IntPtr switch_asr_handle_asr_interface_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_flags_set")]
+  public static extern void switch_asr_handle_flags_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_flags_get")]
+  public static extern uint switch_asr_handle_flags_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_name_set")]
+  public static extern void switch_asr_handle_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_name_get")]
+  public static extern string switch_asr_handle_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_codec_set")]
+  public static extern void switch_asr_handle_codec_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_codec_get")]
+  public static extern string switch_asr_handle_codec_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_rate_set")]
+  public static extern void switch_asr_handle_rate_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_rate_get")]
+  public static extern uint switch_asr_handle_rate_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_grammar_set")]
+  public static extern void switch_asr_handle_grammar_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_grammar_get")]
+  public static extern string switch_asr_handle_grammar_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_param_set")]
+  public static extern void switch_asr_handle_param_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_param_get")]
+  public static extern string switch_asr_handle_param_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_memory_pool_set")]
+  public static extern void switch_asr_handle_memory_pool_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_memory_pool_get")]
+  public static extern IntPtr switch_asr_handle_memory_pool_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_private_info_set")]
+  public static extern void switch_asr_handle_private_info_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_asr_handle_private_info_get")]
+  public static extern IntPtr switch_asr_handle_private_info_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_asr_handle")]
+  public static extern IntPtr new_switch_asr_handle();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_asr_handle")]
+  public static extern void delete_switch_asr_handle(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_interface_name_set")]
+  public static extern void switch_speech_interface_interface_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_interface_name_get")]
+  public static extern string switch_speech_interface_interface_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_open_set")]
+  public static extern void switch_speech_interface_speech_open_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_open_get")]
+  public static extern IntPtr switch_speech_interface_speech_open_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_close_set")]
+  public static extern void switch_speech_interface_speech_close_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_close_get")]
+  public static extern IntPtr switch_speech_interface_speech_close_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_feed_tts_set")]
+  public static extern void switch_speech_interface_speech_feed_tts_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_feed_tts_get")]
+  public static extern IntPtr switch_speech_interface_speech_feed_tts_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_read_tts_set")]
+  public static extern void switch_speech_interface_speech_read_tts_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_read_tts_get")]
+  public static extern IntPtr switch_speech_interface_speech_read_tts_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_flush_tts_set")]
+  public static extern void switch_speech_interface_speech_flush_tts_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_flush_tts_get")]
+  public static extern IntPtr switch_speech_interface_speech_flush_tts_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_text_param_tts_set")]
+  public static extern void switch_speech_interface_speech_text_param_tts_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_text_param_tts_get")]
+  public static extern IntPtr switch_speech_interface_speech_text_param_tts_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_numeric_param_tts_set")]
+  public static extern void switch_speech_interface_speech_numeric_param_tts_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_numeric_param_tts_get")]
+  public static extern IntPtr switch_speech_interface_speech_numeric_param_tts_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_float_param_tts_set")]
+  public static extern void switch_speech_interface_speech_float_param_tts_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_speech_float_param_tts_get")]
+  public static extern IntPtr switch_speech_interface_speech_float_param_tts_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_rwlock_set")]
+  public static extern void switch_speech_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_rwlock_get")]
+  public static extern IntPtr switch_speech_interface_rwlock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_refs_set")]
+  public static extern void switch_speech_interface_refs_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_refs_get")]
+  public static extern int switch_speech_interface_refs_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_reflock_set")]
+  public static extern void switch_speech_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_reflock_get")]
+  public static extern IntPtr switch_speech_interface_reflock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_parent_set")]
+  public static extern void switch_speech_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_parent_get")]
+  public static extern IntPtr switch_speech_interface_parent_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_next_set")]
+  public static extern void switch_speech_interface_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_interface_next_get")]
+  public static extern IntPtr switch_speech_interface_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_speech_interface")]
+  public static extern IntPtr new_switch_speech_interface();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_speech_interface")]
+  public static extern void delete_switch_speech_interface(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_speech_interface_set")]
+  public static extern void switch_speech_handle_speech_interface_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_speech_interface_get")]
+  public static extern IntPtr switch_speech_handle_speech_interface_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_flags_set")]
+  public static extern void switch_speech_handle_flags_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_flags_get")]
+  public static extern uint switch_speech_handle_flags_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_name_set")]
+  public static extern void switch_speech_handle_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_name_get")]
+  public static extern string switch_speech_handle_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_rate_set")]
+  public static extern void switch_speech_handle_rate_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_rate_get")]
+  public static extern uint switch_speech_handle_rate_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_speed_set")]
+  public static extern void switch_speech_handle_speed_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_speed_get")]
+  public static extern uint switch_speech_handle_speed_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_samples_set")]
+  public static extern void switch_speech_handle_samples_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_samples_get")]
+  public static extern uint switch_speech_handle_samples_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_voice_set")]
+  public static extern void switch_speech_handle_voice_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_voice_get")]
+  public static extern string switch_speech_handle_voice_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_engine_set")]
+  public static extern void switch_speech_handle_engine_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_engine_get")]
+  public static extern string switch_speech_handle_engine_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_param_set")]
+  public static extern void switch_speech_handle_param_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_param_get")]
+  public static extern string switch_speech_handle_param_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_memory_pool_set")]
+  public static extern void switch_speech_handle_memory_pool_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_memory_pool_get")]
+  public static extern IntPtr switch_speech_handle_memory_pool_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_resampler_set")]
+  public static extern void switch_speech_handle_resampler_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_resampler_get")]
+  public static extern IntPtr switch_speech_handle_resampler_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_buffer_set")]
+  public static extern void switch_speech_handle_buffer_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_buffer_get")]
+  public static extern IntPtr switch_speech_handle_buffer_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_dbuf_set")]
+  public static extern void switch_speech_handle_dbuf_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_dbuf_get")]
+  public static extern IntPtr switch_speech_handle_dbuf_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_dbuflen_set")]
+  public static extern void switch_speech_handle_dbuflen_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_dbuflen_get")]
+  public static extern IntPtr switch_speech_handle_dbuflen_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_samplerate_set")]
+  public static extern void switch_speech_handle_samplerate_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_samplerate_get")]
+  public static extern uint switch_speech_handle_samplerate_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_native_rate_set")]
+  public static extern void switch_speech_handle_native_rate_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_native_rate_get")]
+  public static extern uint switch_speech_handle_native_rate_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_private_info_set")]
+  public static extern void switch_speech_handle_private_info_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_speech_handle_private_info_get")]
+  public static extern IntPtr switch_speech_handle_private_info_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_speech_handle")]
+  public static extern IntPtr new_switch_speech_handle();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_speech_handle")]
+  public static extern void delete_switch_speech_handle(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_interface_name_set")]
+  public static extern void switch_say_interface_interface_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_interface_name_get")]
+  public static extern string switch_say_interface_interface_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_say_function_set")]
+  public static extern void switch_say_interface_say_function_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_say_function_get")]
+  public static extern IntPtr switch_say_interface_say_function_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_rwlock_set")]
+  public static extern void switch_say_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_rwlock_get")]
+  public static extern IntPtr switch_say_interface_rwlock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_refs_set")]
+  public static extern void switch_say_interface_refs_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_refs_get")]
+  public static extern int switch_say_interface_refs_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_reflock_set")]
+  public static extern void switch_say_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_reflock_get")]
+  public static extern IntPtr switch_say_interface_reflock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_parent_set")]
+  public static extern void switch_say_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_parent_get")]
+  public static extern IntPtr switch_say_interface_parent_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_next_set")]
+  public static extern void switch_say_interface_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_next_get")]
+  public static extern IntPtr switch_say_interface_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_say_interface")]
+  public static extern IntPtr new_switch_say_interface();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_say_interface")]
+  public static extern void delete_switch_say_interface(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_interface_name_set")]
+  public static extern void switch_chat_interface_interface_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_interface_name_get")]
+  public static extern string switch_chat_interface_interface_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_chat_send_set")]
+  public static extern void switch_chat_interface_chat_send_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_chat_send_get")]
+  public static extern IntPtr switch_chat_interface_chat_send_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_rwlock_set")]
+  public static extern void switch_chat_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_rwlock_get")]
+  public static extern IntPtr switch_chat_interface_rwlock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_refs_set")]
+  public static extern void switch_chat_interface_refs_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_refs_get")]
+  public static extern int switch_chat_interface_refs_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_reflock_set")]
+  public static extern void switch_chat_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_reflock_get")]
+  public static extern IntPtr switch_chat_interface_reflock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_parent_set")]
+  public static extern void switch_chat_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_parent_get")]
+  public static extern IntPtr switch_chat_interface_parent_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_next_set")]
+  public static extern void switch_chat_interface_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_chat_interface_next_get")]
+  public static extern IntPtr switch_chat_interface_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_chat_interface")]
+  public static extern IntPtr new_switch_chat_interface();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_chat_interface")]
+  public static extern void delete_switch_chat_interface(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_relative_oid_set")]
+  public static extern void switch_management_interface_relative_oid_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_relative_oid_get")]
+  public static extern string switch_management_interface_relative_oid_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_management_function_set")]
+  public static extern void switch_management_interface_management_function_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_management_function_get")]
+  public static extern IntPtr switch_management_interface_management_function_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_rwlock_set")]
+  public static extern void switch_management_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_rwlock_get")]
+  public static extern IntPtr switch_management_interface_rwlock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_refs_set")]
+  public static extern void switch_management_interface_refs_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_refs_get")]
+  public static extern int switch_management_interface_refs_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_reflock_set")]
+  public static extern void switch_management_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_reflock_get")]
+  public static extern IntPtr switch_management_interface_reflock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_parent_set")]
+  public static extern void switch_management_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_parent_get")]
+  public static extern IntPtr switch_management_interface_parent_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_next_set")]
+  public static extern void switch_management_interface_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_management_interface_next_get")]
+  public static extern IntPtr switch_management_interface_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_management_interface")]
+  public static extern IntPtr new_switch_management_interface();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_management_interface")]
+  public static extern void delete_switch_management_interface(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_interface_name_set")]
+  public static extern void switch_directory_interface_interface_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_interface_name_get")]
+  public static extern string switch_directory_interface_interface_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_directory_open_set")]
+  public static extern void switch_directory_interface_directory_open_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_directory_open_get")]
+  public static extern IntPtr switch_directory_interface_directory_open_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_directory_close_set")]
+  public static extern void switch_directory_interface_directory_close_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_directory_close_get")]
+  public static extern IntPtr switch_directory_interface_directory_close_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_directory_query_set")]
+  public static extern void switch_directory_interface_directory_query_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_directory_query_get")]
+  public static extern IntPtr switch_directory_interface_directory_query_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_directory_next_set")]
+  public static extern void switch_directory_interface_directory_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_directory_next_get")]
+  public static extern IntPtr switch_directory_interface_directory_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_directory_next_pair_set")]
+  public static extern void switch_directory_interface_directory_next_pair_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_directory_next_pair_get")]
+  public static extern IntPtr switch_directory_interface_directory_next_pair_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_rwlock_set")]
+  public static extern void switch_directory_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_rwlock_get")]
+  public static extern IntPtr switch_directory_interface_rwlock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_refs_set")]
+  public static extern void switch_directory_interface_refs_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_refs_get")]
+  public static extern int switch_directory_interface_refs_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_reflock_set")]
+  public static extern void switch_directory_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_reflock_get")]
+  public static extern IntPtr switch_directory_interface_reflock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_parent_set")]
+  public static extern void switch_directory_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_parent_get")]
+  public static extern IntPtr switch_directory_interface_parent_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_next_set")]
+  public static extern void switch_directory_interface_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_interface_next_get")]
+  public static extern IntPtr switch_directory_interface_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_directory_interface")]
+  public static extern IntPtr new_switch_directory_interface();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_directory_interface")]
+  public static extern void delete_switch_directory_interface(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_handle_directory_interface_set")]
+  public static extern void switch_directory_handle_directory_interface_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_handle_directory_interface_get")]
+  public static extern IntPtr switch_directory_handle_directory_interface_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_handle_flags_set")]
+  public static extern void switch_directory_handle_flags_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_handle_flags_get")]
+  public static extern uint switch_directory_handle_flags_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_handle_memory_pool_set")]
+  public static extern void switch_directory_handle_memory_pool_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_handle_memory_pool_get")]
+  public static extern IntPtr switch_directory_handle_memory_pool_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_handle_private_info_set")]
+  public static extern void switch_directory_handle_private_info_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_directory_handle_private_info_get")]
+  public static extern IntPtr switch_directory_handle_private_info_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_directory_handle")]
+  public static extern IntPtr new_switch_directory_handle();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_directory_handle")]
+  public static extern void delete_switch_directory_handle(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_quality_set")]
+  public static extern void switch_codec_settings_quality_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_quality_get")]
+  public static extern int switch_codec_settings_quality_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_complexity_set")]
+  public static extern void switch_codec_settings_complexity_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_complexity_get")]
+  public static extern int switch_codec_settings_complexity_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_enhancement_set")]
+  public static extern void switch_codec_settings_enhancement_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_enhancement_get")]
+  public static extern int switch_codec_settings_enhancement_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vad_set")]
+  public static extern void switch_codec_settings_vad_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vad_get")]
+  public static extern int switch_codec_settings_vad_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vbr_set")]
+  public static extern void switch_codec_settings_vbr_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vbr_get")]
+  public static extern int switch_codec_settings_vbr_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vbr_quality_set")]
+  public static extern void switch_codec_settings_vbr_quality_set(HandleRef jarg1, float jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_vbr_quality_get")]
+  public static extern float switch_codec_settings_vbr_quality_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_abr_set")]
+  public static extern void switch_codec_settings_abr_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_abr_get")]
+  public static extern int switch_codec_settings_abr_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_dtx_set")]
+  public static extern void switch_codec_settings_dtx_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_dtx_get")]
+  public static extern int switch_codec_settings_dtx_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_preproc_set")]
+  public static extern void switch_codec_settings_preproc_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_preproc_get")]
+  public static extern int switch_codec_settings_preproc_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_vad_set")]
+  public static extern void switch_codec_settings_pp_vad_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_vad_get")]
+  public static extern int switch_codec_settings_pp_vad_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_agc_set")]
+  public static extern void switch_codec_settings_pp_agc_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_agc_get")]
+  public static extern int switch_codec_settings_pp_agc_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_agc_level_set")]
+  public static extern void switch_codec_settings_pp_agc_level_set(HandleRef jarg1, float jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_agc_level_get")]
+  public static extern float switch_codec_settings_pp_agc_level_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_denoise_set")]
+  public static extern void switch_codec_settings_pp_denoise_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_denoise_get")]
+  public static extern int switch_codec_settings_pp_denoise_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_set")]
+  public static extern void switch_codec_settings_pp_dereverb_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_get")]
+  public static extern int switch_codec_settings_pp_dereverb_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_decay_set")]
+  public static extern void switch_codec_settings_pp_dereverb_decay_set(HandleRef jarg1, float jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_decay_get")]
+  public static extern float switch_codec_settings_pp_dereverb_decay_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_level_set")]
+  public static extern void switch_codec_settings_pp_dereverb_level_set(HandleRef jarg1, float jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_settings_pp_dereverb_level_get")]
+  public static extern float switch_codec_settings_pp_dereverb_level_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_codec_settings")]
+  public static extern IntPtr new_switch_codec_settings();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_codec_settings")]
+  public static extern void delete_switch_codec_settings(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_codec_interface_set")]
+  public static extern void switch_codec_codec_interface_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_codec_interface_get")]
+  public static extern IntPtr switch_codec_codec_interface_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_set")]
+  public static extern void switch_codec_implementation_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_get")]
+  public static extern IntPtr switch_codec_implementation_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_in_set")]
+  public static extern void switch_codec_fmtp_in_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_in_get")]
+  public static extern string switch_codec_fmtp_in_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_out_set")]
+  public static extern void switch_codec_fmtp_out_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_fmtp_out_get")]
+  public static extern string switch_codec_fmtp_out_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_codec_settings_set")]
+  public static extern void switch_codec_codec_settings_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_codec_settings_get")]
+  public static extern IntPtr switch_codec_codec_settings_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_flags_set")]
+  public static extern void switch_codec_flags_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_flags_get")]
+  public static extern uint switch_codec_flags_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_memory_pool_set")]
+  public static extern void switch_codec_memory_pool_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_memory_pool_get")]
+  public static extern IntPtr switch_codec_memory_pool_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_private_info_set")]
+  public static extern void switch_codec_private_info_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_private_info_get")]
+  public static extern IntPtr switch_codec_private_info_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_agreed_pt_set")]
+  public static extern void switch_codec_agreed_pt_set(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_agreed_pt_get")]
+  public static extern byte switch_codec_agreed_pt_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_mutex_set")]
+  public static extern void switch_codec_mutex_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_mutex_get")]
+  public static extern IntPtr switch_codec_mutex_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_next_set")]
+  public static extern void switch_codec_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_next_get")]
+  public static extern IntPtr switch_codec_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_codec")]
+  public static extern IntPtr new_switch_codec();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_codec")]
+  public static extern void delete_switch_codec(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_codec_type_set")]
+  public static extern void switch_codec_implementation_codec_type_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_codec_type_get")]
+  public static extern int switch_codec_implementation_codec_type_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_ianacode_set")]
+  public static extern void switch_codec_implementation_ianacode_set(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_ianacode_get")]
+  public static extern byte switch_codec_implementation_ianacode_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_iananame_set")]
+  public static extern void switch_codec_implementation_iananame_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_iananame_get")]
+  public static extern string switch_codec_implementation_iananame_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_fmtp_set")]
+  public static extern void switch_codec_implementation_fmtp_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_fmtp_get")]
+  public static extern string switch_codec_implementation_fmtp_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_samples_per_second_set")]
+  public static extern void switch_codec_implementation_samples_per_second_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_samples_per_second_get")]
+  public static extern uint switch_codec_implementation_samples_per_second_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_actual_samples_per_second_set")]
+  public static extern void switch_codec_implementation_actual_samples_per_second_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_actual_samples_per_second_get")]
+  public static extern uint switch_codec_implementation_actual_samples_per_second_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_bits_per_second_set")]
+  public static extern void switch_codec_implementation_bits_per_second_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_bits_per_second_get")]
+  public static extern int switch_codec_implementation_bits_per_second_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_microseconds_per_packet_set")]
+  public static extern void switch_codec_implementation_microseconds_per_packet_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_microseconds_per_packet_get")]
+  public static extern int switch_codec_implementation_microseconds_per_packet_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_samples_per_packet_set")]
+  public static extern void switch_codec_implementation_samples_per_packet_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_samples_per_packet_get")]
+  public static extern uint switch_codec_implementation_samples_per_packet_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_decoded_bytes_per_packet_set")]
+  public static extern void switch_codec_implementation_decoded_bytes_per_packet_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_decoded_bytes_per_packet_get")]
+  public static extern uint switch_codec_implementation_decoded_bytes_per_packet_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_encoded_bytes_per_packet_set")]
+  public static extern void switch_codec_implementation_encoded_bytes_per_packet_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_encoded_bytes_per_packet_get")]
+  public static extern uint switch_codec_implementation_encoded_bytes_per_packet_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_number_of_channels_set")]
+  public static extern void switch_codec_implementation_number_of_channels_set(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_number_of_channels_get")]
+  public static extern byte switch_codec_implementation_number_of_channels_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_codec_frames_per_packet_set")]
+  public static extern void switch_codec_implementation_codec_frames_per_packet_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_codec_frames_per_packet_get")]
+  public static extern int switch_codec_implementation_codec_frames_per_packet_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_init_set")]
+  public static extern void switch_codec_implementation_init_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_init_get")]
+  public static extern IntPtr switch_codec_implementation_init_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_encode_set")]
+  public static extern void switch_codec_implementation_encode_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_encode_get")]
+  public static extern IntPtr switch_codec_implementation_encode_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_decode_set")]
+  public static extern void switch_codec_implementation_decode_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_decode_get")]
+  public static extern IntPtr switch_codec_implementation_decode_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_destroy_set")]
+  public static extern void switch_codec_implementation_destroy_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_destroy_get")]
+  public static extern IntPtr switch_codec_implementation_destroy_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_codec_id_set")]
+  public static extern void switch_codec_implementation_codec_id_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_codec_id_get")]
+  public static extern uint switch_codec_implementation_codec_id_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_impl_id_set")]
+  public static extern void switch_codec_implementation_impl_id_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_impl_id_get")]
+  public static extern uint switch_codec_implementation_impl_id_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_next_set")]
+  public static extern void switch_codec_implementation_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_implementation_next_get")]
+  public static extern IntPtr switch_codec_implementation_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_codec_implementation")]
+  public static extern IntPtr new_switch_codec_implementation();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_codec_implementation")]
+  public static extern void delete_switch_codec_implementation(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_interface_name_set")]
+  public static extern void switch_codec_interface_interface_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_interface_name_get")]
+  public static extern string switch_codec_interface_interface_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_implementations_set")]
+  public static extern void switch_codec_interface_implementations_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_implementations_get")]
+  public static extern IntPtr switch_codec_interface_implementations_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_codec_id_set")]
+  public static extern void switch_codec_interface_codec_id_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_codec_id_get")]
+  public static extern uint switch_codec_interface_codec_id_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_rwlock_set")]
+  public static extern void switch_codec_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_rwlock_get")]
+  public static extern IntPtr switch_codec_interface_rwlock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_refs_set")]
+  public static extern void switch_codec_interface_refs_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_refs_get")]
+  public static extern int switch_codec_interface_refs_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_reflock_set")]
+  public static extern void switch_codec_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_reflock_get")]
+  public static extern IntPtr switch_codec_interface_reflock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_parent_set")]
+  public static extern void switch_codec_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_parent_get")]
+  public static extern IntPtr switch_codec_interface_parent_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_next_set")]
+  public static extern void switch_codec_interface_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_codec_interface_next_get")]
+  public static extern IntPtr switch_codec_interface_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_codec_interface")]
+  public static extern IntPtr new_switch_codec_interface();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_codec_interface")]
+  public static extern void delete_switch_codec_interface(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_interface_name_set")]
+  public static extern void switch_application_interface_interface_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_interface_name_get")]
+  public static extern string switch_application_interface_interface_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_application_function_set")]
+  public static extern void switch_application_interface_application_function_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_application_function_get")]
+  public static extern IntPtr switch_application_interface_application_function_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_long_desc_set")]
+  public static extern void switch_application_interface_long_desc_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_long_desc_get")]
+  public static extern string switch_application_interface_long_desc_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_short_desc_set")]
+  public static extern void switch_application_interface_short_desc_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_short_desc_get")]
+  public static extern string switch_application_interface_short_desc_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_syntax_set")]
+  public static extern void switch_application_interface_syntax_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_syntax_get")]
+  public static extern string switch_application_interface_syntax_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_flags_set")]
+  public static extern void switch_application_interface_flags_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_flags_get")]
+  public static extern uint switch_application_interface_flags_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_rwlock_set")]
+  public static extern void switch_application_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_rwlock_get")]
+  public static extern IntPtr switch_application_interface_rwlock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_refs_set")]
+  public static extern void switch_application_interface_refs_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_refs_get")]
+  public static extern int switch_application_interface_refs_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_reflock_set")]
+  public static extern void switch_application_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_reflock_get")]
+  public static extern IntPtr switch_application_interface_reflock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_parent_set")]
+  public static extern void switch_application_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_parent_get")]
+  public static extern IntPtr switch_application_interface_parent_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_next_set")]
+  public static extern void switch_application_interface_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_application_interface_next_get")]
+  public static extern IntPtr switch_application_interface_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_application_interface")]
+  public static extern IntPtr new_switch_application_interface();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_application_interface")]
+  public static extern void delete_switch_application_interface(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_interface_name_set")]
+  public static extern void switch_api_interface_interface_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_interface_name_get")]
+  public static extern string switch_api_interface_interface_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_desc_set")]
+  public static extern void switch_api_interface_desc_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_desc_get")]
+  public static extern string switch_api_interface_desc_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_function_set")]
+  public static extern void switch_api_interface_function_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_function_get")]
+  public static extern IntPtr switch_api_interface_function_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_syntax_set")]
+  public static extern void switch_api_interface_syntax_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_syntax_get")]
+  public static extern string switch_api_interface_syntax_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_rwlock_set")]
+  public static extern void switch_api_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_rwlock_get")]
+  public static extern IntPtr switch_api_interface_rwlock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_refs_set")]
+  public static extern void switch_api_interface_refs_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_refs_get")]
+  public static extern int switch_api_interface_refs_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_reflock_set")]
+  public static extern void switch_api_interface_reflock_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_reflock_get")]
+  public static extern IntPtr switch_api_interface_reflock_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_parent_set")]
+  public static extern void switch_api_interface_parent_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_parent_get")]
+  public static extern IntPtr switch_api_interface_parent_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_next_set")]
+  public static extern void switch_api_interface_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_api_interface_next_get")]
+  public static extern IntPtr switch_api_interface_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_api_interface")]
+  public static extern IntPtr new_switch_api_interface();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_api_interface")]
+  public static extern void delete_switch_api_interface(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_profile_created_set")]
+  public static extern void switch_channel_timetable_profile_created_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_profile_created_get")]
+  public static extern IntPtr switch_channel_timetable_profile_created_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_created_set")]
+  public static extern void switch_channel_timetable_created_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_created_get")]
+  public static extern IntPtr switch_channel_timetable_created_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_answered_set")]
+  public static extern void switch_channel_timetable_answered_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_answered_get")]
+  public static extern IntPtr switch_channel_timetable_answered_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_progress_set")]
+  public static extern void switch_channel_timetable_progress_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_progress_get")]
+  public static extern IntPtr switch_channel_timetable_progress_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_progress_media_set")]
+  public static extern void switch_channel_timetable_progress_media_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_progress_media_get")]
+  public static extern IntPtr switch_channel_timetable_progress_media_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_hungup_set")]
+  public static extern void switch_channel_timetable_hungup_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_hungup_get")]
+  public static extern IntPtr switch_channel_timetable_hungup_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_transferred_set")]
+  public static extern void switch_channel_timetable_transferred_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_transferred_get")]
+  public static extern IntPtr switch_channel_timetable_transferred_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_resurrected_set")]
+  public static extern void switch_channel_timetable_resurrected_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_resurrected_get")]
+  public static extern IntPtr switch_channel_timetable_resurrected_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_next_set")]
+  public static extern void switch_channel_timetable_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_next_get")]
+  public static extern IntPtr switch_channel_timetable_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_channel_timetable")]
+  public static extern IntPtr new_switch_channel_timetable();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_channel_timetable")]
+  public static extern void delete_switch_channel_timetable(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_state")]
+  public static extern int switch_channel_get_state(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_running_state")]
+  public static extern int switch_channel_get_running_state(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_ready")]
+  public static extern int switch_channel_test_ready(HandleRef jarg1, int jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_wait_for_state")]
+  public static extern void switch_channel_wait_for_state(HandleRef jarg1, HandleRef jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_wait_for_state_timeout")]
+  public static extern void switch_channel_wait_for_state_timeout(HandleRef jarg1, int jarg2, uint jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_wait_for_flag")]
+  public static extern int switch_channel_wait_for_flag(HandleRef jarg1, int jarg2, int jarg3, uint jarg4, HandleRef jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_set_state")]
+  public static extern int switch_channel_perform_set_state(HandleRef jarg1, string jarg2, string jarg3, int jarg4, int jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_set_running_state")]
+  public static extern int switch_channel_perform_set_running_state(HandleRef jarg1, int jarg2, string jarg3, string jarg4, int jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_str2cause")]
+  public static extern int switch_channel_str2cause(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_cause")]
+  public static extern int switch_channel_get_cause(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_cause_q850")]
+  public static extern int switch_channel_cause_q850(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_cause_q850")]
+  public static extern int switch_channel_get_cause_q850(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_cause2str")]
+  public static extern string switch_channel_cause2str(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_timetable")]
+  public static extern IntPtr switch_channel_get_timetable(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_alloc")]
+  public static extern int switch_channel_alloc(HandleRef jarg1, int jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_init")]
+  public static extern int switch_channel_init(HandleRef jarg1, HandleRef jarg2, int jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_presence")]
+  public static extern void switch_channel_presence(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_uninit")]
+  public static extern void switch_channel_uninit(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_caller_profile")]
+  public static extern void switch_channel_set_caller_profile(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_caller_profile")]
+  public static extern IntPtr switch_channel_get_caller_profile(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_originator_caller_profile")]
+  public static extern void switch_channel_set_originator_caller_profile(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_hunt_caller_profile")]
+  public static extern void switch_channel_set_hunt_caller_profile(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_originator_caller_profile")]
+  public static extern IntPtr switch_channel_get_originator_caller_profile(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_originatee_caller_profile")]
+  public static extern void switch_channel_set_originatee_caller_profile(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_originatee_caller_profile")]
+  public static extern IntPtr switch_channel_get_originatee_caller_profile(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_uuid")]
+  public static extern string switch_channel_get_uuid(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_profile_var")]
+  public static extern int switch_channel_set_profile_var(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_variable_var_check")]
+  public static extern int switch_channel_set_variable_var_check(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_variable_printf")]
+  public static extern int switch_channel_set_variable_printf(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_variable_name_printf")]
+  public static extern int switch_channel_set_variable_name_printf(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_variable_partner_var_check")]
+  public static extern int switch_channel_set_variable_partner_var_check(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_variable_partner")]
+  public static extern string switch_channel_get_variable_partner(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_variable_dup")]
+  public static extern string switch_channel_get_variable_dup(HandleRef jarg1, string jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_variables")]
+  public static extern int switch_channel_get_variables(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_pass_callee_id")]
+  public static extern int switch_channel_pass_callee_id(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_variable_first")]
+  public static extern IntPtr switch_channel_variable_first(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_variable_last")]
+  public static extern void switch_channel_variable_last(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_restart")]
+  public static extern void switch_channel_restart(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_caller_extension_masquerade")]
+  public static extern int switch_channel_caller_extension_masquerade(HandleRef jarg1, HandleRef jarg2, uint jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_caller_extension")]
+  public static extern void switch_channel_set_caller_extension(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_caller_extension")]
+  public static extern IntPtr switch_channel_get_caller_extension(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_flag")]
+  public static extern uint switch_channel_test_flag(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_flag_value")]
+  public static extern void switch_channel_set_flag_value(HandleRef jarg1, int jarg2, uint jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_flag_recursive")]
+  public static extern void switch_channel_set_flag_recursive(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_cap_value")]
+  public static extern void switch_channel_set_cap_value(HandleRef jarg1, int jarg2, uint jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_cap")]
+  public static extern void switch_channel_clear_cap(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_cap")]
+  public static extern uint switch_channel_test_cap(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_flag_partner")]
+  public static extern int switch_channel_set_flag_partner(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_flag_partner")]
+  public static extern int switch_channel_clear_flag_partner(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_flag_partner")]
+  public static extern uint switch_channel_test_flag_partner(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_state_flag")]
+  public static extern void switch_channel_set_state_flag(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_flag")]
+  public static extern void switch_channel_clear_flag(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_flag_recursive")]
+  public static extern void switch_channel_clear_flag_recursive(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_answer")]
+  public static extern int switch_channel_perform_answer(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_mark_answered")]
+  public static extern int switch_channel_perform_mark_answered(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_ring_ready")]
+  public static extern int switch_channel_perform_ring_ready(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_pre_answer")]
+  public static extern int switch_channel_perform_pre_answer(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_mark_pre_answered")]
+  public static extern int switch_channel_perform_mark_pre_answered(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_mark_ring_ready")]
+  public static extern int switch_channel_perform_mark_ring_ready(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_add_state_handler")]
+  public static extern int switch_channel_add_state_handler(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_state_handler")]
+  public static extern void switch_channel_clear_state_handler(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_state_handler")]
+  public static extern IntPtr switch_channel_get_state_handler(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_private")]
+  public static extern int switch_channel_set_private(HandleRef jarg1, string jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_private")]
+  public static extern IntPtr switch_channel_get_private(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_private_partner")]
+  public static extern IntPtr switch_channel_get_private_partner(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_name")]
+  public static extern int switch_channel_set_name(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_name")]
+  public static extern string switch_channel_get_name(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_perform_hangup")]
+  public static extern int switch_channel_perform_hangup(HandleRef jarg1, string jarg2, string jarg3, int jarg4, int jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_has_dtmf")]
+  public static extern IntPtr switch_channel_has_dtmf(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_queue_dtmf")]
+  public static extern int switch_channel_queue_dtmf(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_queue_dtmf_string")]
+  public static extern int switch_channel_queue_dtmf_string(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_dequeue_dtmf")]
+  public static extern int switch_channel_dequeue_dtmf(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_flush_dtmf")]
+  public static extern void switch_channel_flush_dtmf(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_dequeue_dtmf_string")]
+  public static extern IntPtr switch_channel_dequeue_dtmf_string(HandleRef jarg1, string jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_state_name")]
+  public static extern string switch_channel_state_name(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_name_state")]
+  public static extern int switch_channel_name_state(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_event_set_data")]
+  public static extern void switch_channel_event_set_data(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_event_set_basic_data")]
+  public static extern void switch_channel_event_set_basic_data(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_event_set_extended_data")]
+  public static extern void switch_channel_event_set_extended_data(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_expand_variables")]
+  public static extern string switch_channel_expand_variables(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_build_param_string")]
+  public static extern string switch_channel_build_param_string(HandleRef jarg1, HandleRef jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_timestamps")]
+  public static extern int switch_channel_set_timestamps(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_audio_sync")]
+  public static extern void switch_channel_audio_sync(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_private_flag")]
+  public static extern void switch_channel_set_private_flag(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_private_flag")]
+  public static extern void switch_channel_clear_private_flag(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_private_flag")]
+  public static extern int switch_channel_test_private_flag(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_app_flag")]
+  public static extern void switch_channel_set_app_flag(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_clear_app_flag")]
+  public static extern void switch_channel_clear_app_flag(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_app_flag")]
+  public static extern int switch_channel_test_app_flag(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_hangup_time")]
+  public static extern void switch_channel_set_hangup_time(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_direction")]
+  public static extern int switch_channel_direction(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_session")]
+  public static extern IntPtr switch_channel_get_session(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_flag_string")]
+  public static extern string switch_channel_get_flag_string(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_get_cap_string")]
+  public static extern string switch_channel_get_cap_string(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_create")]
+  public static extern int switch_buffer_create(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_create_dynamic")]
+  public static extern int switch_buffer_create_dynamic(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_add_mutex")]
+  public static extern void switch_buffer_add_mutex(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_lock")]
+  public static extern void switch_buffer_lock(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_trylock")]
+  public static extern int switch_buffer_trylock(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_unlock")]
+  public static extern void switch_buffer_unlock(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_len")]
+  public static extern IntPtr switch_buffer_len(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_freespace")]
+  public static extern IntPtr switch_buffer_freespace(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_inuse")]
+  public static extern IntPtr switch_buffer_inuse(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_read")]
+  public static extern IntPtr switch_buffer_read(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_read_loop")]
+  public static extern IntPtr switch_buffer_read_loop(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_set_loops")]
+  public static extern void switch_buffer_set_loops(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_write")]
+  public static extern IntPtr switch_buffer_write(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_toss")]
+  public static extern IntPtr switch_buffer_toss(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_zero")]
+  public static extern void switch_buffer_zero(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_slide_write")]
+  public static extern IntPtr switch_buffer_slide_write(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_destroy")]
+  public static extern void switch_buffer_destroy(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_zwrite")]
+  public static extern IntPtr switch_buffer_zwrite(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_name_set")]
+  public static extern void switch_event_header_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_name_get")]
+  public static extern string switch_event_header_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_value_set")]
+  public static extern void switch_event_header_value_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_value_get")]
+  public static extern string switch_event_header_value_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_hash_set")]
+  public static extern void switch_event_header_hash_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_hash_get")]
+  public static extern uint switch_event_header_hash_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_next_set")]
+  public static extern void switch_event_header_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_header_next_get")]
+  public static extern IntPtr switch_event_header_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_event_header")]
+  public static extern IntPtr new_switch_event_header();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_event_header")]
+  public static extern void delete_switch_event_header(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_event_id_set")]
+  public static extern void switch_event_event_id_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_event_id_get")]
+  public static extern int switch_event_event_id_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_priority_set")]
+  public static extern void switch_event_priority_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_priority_get")]
+  public static extern int switch_event_priority_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_owner_set")]
+  public static extern void switch_event_owner_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_owner_get")]
+  public static extern string switch_event_owner_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_subclass_name_set")]
+  public static extern void switch_event_subclass_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_subclass_name_get")]
+  public static extern string switch_event_subclass_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_headers_set")]
+  public static extern void switch_event_headers_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_headers_get")]
+  public static extern IntPtr switch_event_headers_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_last_header_set")]
+  public static extern void switch_event_last_header_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_last_header_get")]
+  public static extern IntPtr switch_event_last_header_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_body_set")]
+  public static extern void switch_event_body_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_body_get")]
+  public static extern string switch_event_body_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_bind_user_data_set")]
+  public static extern void switch_event_bind_user_data_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_bind_user_data_get")]
+  public static extern IntPtr switch_event_bind_user_data_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_event_user_data_set")]
+  public static extern void switch_event_event_user_data_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_event_user_data_get")]
+  public static extern IntPtr switch_event_event_user_data_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_key_set")]
+  public static extern void switch_event_key_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_key_get")]
+  public static extern uint switch_event_key_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_next_set")]
+  public static extern void switch_event_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_next_get")]
+  public static extern IntPtr switch_event_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_flags_set")]
+  public static extern void switch_event_flags_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_flags_get")]
+  public static extern int switch_event_flags_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_event")]
+  public static extern IntPtr new_switch_event();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_event")]
+  public static extern void delete_switch_event(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_init")]
+  public static extern int switch_event_init(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_shutdown")]
+  public static extern int switch_event_shutdown();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_create_subclass_detailed")]
+  public static extern int switch_event_create_subclass_detailed(string jarg1, string jarg2, int jarg3, HandleRef jarg4, int jarg5, string jarg6);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_set_priority")]
+  public static extern int switch_event_set_priority(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_get_header")]
+  public static extern string switch_event_get_header(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_get_body")]
+  public static extern string switch_event_get_body(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_set_subclass_name")]
+  public static extern int switch_event_set_subclass_name(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_add_header_string")]
+  public static extern int switch_event_add_header_string(HandleRef jarg1, int jarg2, string jarg3, string jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_del_header_val")]
+  public static extern int switch_event_del_header_val(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_destroy")]
+  public static extern void switch_event_destroy(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_dup")]
+  public static extern int switch_event_dup(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_fire_detailed")]
+  public static extern int switch_event_fire_detailed(string jarg1, string jarg2, int jarg3, HandleRef jarg4, HandleRef jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_prep_for_delivery_detailed")]
+  public static extern void switch_event_prep_for_delivery_detailed(string jarg1, string jarg2, int jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_bind")]
+  public static extern int switch_event_bind(string jarg1, int jarg2, string jarg3, HandleRef jarg4, HandleRef jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_bind_removable")]
+  public static extern int switch_event_bind_removable(string jarg1, int jarg2, string jarg3, HandleRef jarg4, HandleRef jarg5, HandleRef jarg6);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_unbind")]
+  public static extern int switch_event_unbind(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_unbind_callback")]
+  public static extern int switch_event_unbind_callback(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_name")]
+  public static extern string switch_event_name(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_name_event")]
+  public static extern int switch_name_event(string jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_reserve_subclass_detailed")]
+  public static extern int switch_event_reserve_subclass_detailed(string jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_free_subclass_detailed")]
+  public static extern int switch_event_free_subclass_detailed(string jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_serialize")]
+  public static extern int switch_event_serialize(HandleRef jarg1, ref string jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_running")]
+  public static extern int switch_event_running();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_expand_headers")]
+  public static extern string switch_event_expand_headers(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_create_pres_in_detailed")]
+  public static extern int switch_event_create_pres_in_detailed(string jarg1, string jarg2, int jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, int jarg11, string jarg12, string jarg13, string jarg14, string jarg15);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_create_plain")]
+  public static extern int switch_event_create_plain(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_deliver")]
+  public static extern void switch_event_deliver(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_event_build_param_string")]
+  public static extern string switch_event_build_param_string(HandleRef jarg1, string jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RESAMPLE_QUALITY_get")]
+  public static extern int SWITCH_RESAMPLE_QUALITY_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_resampler_set")]
+  public static extern void switch_audio_resampler_t_resampler_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_resampler_get")]
+  public static extern IntPtr switch_audio_resampler_t_resampler_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_from_rate_set")]
+  public static extern void switch_audio_resampler_t_from_rate_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_from_rate_get")]
+  public static extern int switch_audio_resampler_t_from_rate_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_to_rate_set")]
+  public static extern void switch_audio_resampler_t_to_rate_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_to_rate_get")]
+  public static extern int switch_audio_resampler_t_to_rate_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_factor_set")]
+  public static extern void switch_audio_resampler_t_factor_set(HandleRef jarg1, double jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_factor_get")]
+  public static extern double switch_audio_resampler_t_factor_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_rfactor_set")]
+  public static extern void switch_audio_resampler_t_rfactor_set(HandleRef jarg1, double jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_rfactor_get")]
+  public static extern double switch_audio_resampler_t_rfactor_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_to_set")]
+  public static extern void switch_audio_resampler_t_to_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_to_get")]
+  public static extern IntPtr switch_audio_resampler_t_to_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_to_len_set")]
+  public static extern void switch_audio_resampler_t_to_len_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_to_len_get")]
+  public static extern uint switch_audio_resampler_t_to_len_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_to_size_set")]
+  public static extern void switch_audio_resampler_t_to_size_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_audio_resampler_t_to_size_get")]
+  public static extern uint switch_audio_resampler_t_to_size_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_audio_resampler_t")]
+  public static extern IntPtr new_switch_audio_resampler_t();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_audio_resampler_t")]
+  public static extern void delete_switch_audio_resampler_t(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_resample_perform_create")]
+  public static extern int switch_resample_perform_create(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, int jarg5, uint jarg6, string jarg7, string jarg8, int jarg9);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_resample_destroy")]
+  public static extern void switch_resample_destroy(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_resample_process")]
+  public static extern uint switch_resample_process(HandleRef jarg1, HandleRef jarg2, uint jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_float_to_short")]
+  public static extern IntPtr switch_float_to_short(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_char_to_float")]
+  public static extern int switch_char_to_float(string jarg1, HandleRef jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_float_to_char")]
+  public static extern int switch_float_to_char(HandleRef jarg1, string jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_short_to_float")]
+  public static extern int switch_short_to_float(HandleRef jarg1, HandleRef jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_swap_linear")]
+  public static extern void switch_swap_linear(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_generate_sln_silence")]
+  public static extern void switch_generate_sln_silence(HandleRef jarg1, uint jarg2, uint jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_change_sln_volume")]
+  public static extern void switch_change_sln_volume(HandleRef jarg1, uint jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_merge_sln")]
+  public static extern uint switch_merge_sln(HandleRef jarg1, uint jarg2, HandleRef jarg3, uint jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_mux_channels")]
+  public static extern void switch_mux_channels(HandleRef jarg1, HandleRef jarg2, uint jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_session_set")]
+  public static extern void switch_unicast_conninfo_session_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_session_get")]
+  public static extern IntPtr switch_unicast_conninfo_session_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_read_codec_set")]
+  public static extern void switch_unicast_conninfo_read_codec_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_read_codec_get")]
+  public static extern IntPtr switch_unicast_conninfo_read_codec_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_write_frame_set")]
+  public static extern void switch_unicast_conninfo_write_frame_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_write_frame_get")]
+  public static extern IntPtr switch_unicast_conninfo_write_frame_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_write_frame_data_set")]
+  public static extern void switch_unicast_conninfo_write_frame_data_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_write_frame_data_get")]
+  public static extern IntPtr switch_unicast_conninfo_write_frame_data_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_socket_set")]
+  public static extern void switch_unicast_conninfo_socket_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_socket_get")]
+  public static extern IntPtr switch_unicast_conninfo_socket_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_local_ip_set")]
+  public static extern void switch_unicast_conninfo_local_ip_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_local_ip_get")]
+  public static extern string switch_unicast_conninfo_local_ip_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_local_port_set")]
+  public static extern void switch_unicast_conninfo_local_port_set(HandleRef jarg1, ushort jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_local_port_get")]
+  public static extern ushort switch_unicast_conninfo_local_port_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_remote_ip_set")]
+  public static extern void switch_unicast_conninfo_remote_ip_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_remote_ip_get")]
+  public static extern string switch_unicast_conninfo_remote_ip_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_remote_port_set")]
+  public static extern void switch_unicast_conninfo_remote_port_set(HandleRef jarg1, ushort jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_remote_port_get")]
+  public static extern ushort switch_unicast_conninfo_remote_port_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_local_addr_set")]
+  public static extern void switch_unicast_conninfo_local_addr_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_local_addr_get")]
+  public static extern IntPtr switch_unicast_conninfo_local_addr_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_remote_addr_set")]
+  public static extern void switch_unicast_conninfo_remote_addr_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_remote_addr_get")]
+  public static extern IntPtr switch_unicast_conninfo_remote_addr_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_flag_mutex_set")]
+  public static extern void switch_unicast_conninfo_flag_mutex_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_flag_mutex_get")]
+  public static extern IntPtr switch_unicast_conninfo_flag_mutex_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_flags_set")]
+  public static extern void switch_unicast_conninfo_flags_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_flags_get")]
+  public static extern int switch_unicast_conninfo_flags_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_type_set")]
+  public static extern void switch_unicast_conninfo_type_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_type_get")]
+  public static extern int switch_unicast_conninfo_type_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_transport_set")]
+  public static extern void switch_unicast_conninfo_transport_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_transport_get")]
+  public static extern int switch_unicast_conninfo_transport_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_stream_id_set")]
+  public static extern void switch_unicast_conninfo_stream_id_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_unicast_conninfo_stream_id_get")]
+  public static extern int switch_unicast_conninfo_stream_id_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_unicast_conninfo")]
+  public static extern IntPtr new_switch_unicast_conninfo();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_unicast_conninfo")]
+  public static extern void delete_switch_unicast_conninfo(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_deactivate_unicast")]
+  public static extern int switch_ivr_deactivate_unicast(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_activate_unicast")]
+  public static extern int switch_ivr_activate_unicast(HandleRef jarg1, string jarg2, ushort jarg3, string jarg4, ushort jarg5, string jarg6, string jarg7);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_generate_xml_cdr")]
+  public static extern int switch_ivr_generate_xml_cdr(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_set_xml_profile_data")]
+  public static extern int switch_ivr_set_xml_profile_data(HandleRef jarg1, HandleRef jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_set_xml_chan_vars")]
+  public static extern int switch_ivr_set_xml_chan_vars(HandleRef jarg1, HandleRef jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_parse_event")]
+  public static extern int switch_ivr_parse_event(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_parse_all_events")]
+  public static extern int switch_ivr_parse_all_events(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_parse_next_event")]
+  public static extern int switch_ivr_parse_next_event(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_parse_all_messages")]
+  public static extern int switch_ivr_parse_all_messages(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_sleep")]
+  public static extern int switch_ivr_sleep(HandleRef jarg1, uint jarg2, int jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_park")]
+  public static extern int switch_ivr_park(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_collect_digits_callback")]
+  public static extern int switch_ivr_collect_digits_callback(HandleRef jarg1, HandleRef jarg2, uint jarg3, uint jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_collect_digits_count")]
+  public static extern int switch_ivr_collect_digits_count(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, string jarg5, string jarg6, uint jarg7, uint jarg8, uint jarg9);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_detect_speech")]
+  public static extern int switch_ivr_detect_speech(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, HandleRef jarg6);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_stop_detect_speech")]
+  public static extern int switch_ivr_stop_detect_speech(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_pause_detect_speech")]
+  public static extern int switch_ivr_pause_detect_speech(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_resume_detect_speech")]
+  public static extern int switch_ivr_resume_detect_speech(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_detect_speech_load_grammar")]
+  public static extern int switch_ivr_detect_speech_load_grammar(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_detect_speech_unload_grammar")]
+  public static extern int switch_ivr_detect_speech_unload_grammar(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_record_session")]
+  public static extern int switch_ivr_record_session(HandleRef jarg1, string jarg2, uint jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_eavesdrop_session")]
+  public static extern int switch_ivr_eavesdrop_session(HandleRef jarg1, string jarg2, string jarg3, uint jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_displace_session")]
+  public static extern int switch_ivr_displace_session(HandleRef jarg1, string jarg2, uint jarg3, string jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_stop_displace_session")]
+  public static extern int switch_ivr_stop_displace_session(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_stop_record_session")]
+  public static extern int switch_ivr_stop_record_session(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_session_audio")]
+  public static extern int switch_ivr_session_audio(HandleRef jarg1, string jarg2, string jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_stop_session_audio")]
+  public static extern int switch_ivr_stop_session_audio(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_inband_dtmf_session")]
+  public static extern int switch_ivr_inband_dtmf_session(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_stop_inband_dtmf_session")]
+  public static extern int switch_ivr_stop_inband_dtmf_session(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_inband_dtmf_generate_session")]
+  public static extern int switch_ivr_inband_dtmf_generate_session(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_stop_inband_dtmf_generate_session")]
+  public static extern int switch_ivr_stop_inband_dtmf_generate_session(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_session_echo")]
+  public static extern void switch_ivr_session_echo(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_stop_tone_detect_session")]
+  public static extern int switch_ivr_stop_tone_detect_session(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_tone_detect_session")]
+  public static extern int switch_ivr_tone_detect_session(HandleRef jarg1, string jarg2, string jarg3, string jarg4, HandleRef jarg5, int jarg6, string jarg7, string jarg8, HandleRef jarg9);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_play_file")]
+  public static extern int switch_ivr_play_file(HandleRef jarg1, HandleRef jarg2, string jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_wait_for_silence")]
+  public static extern int switch_ivr_wait_for_silence(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, uint jarg5, string jarg6);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_gentones")]
+  public static extern int switch_ivr_gentones(HandleRef jarg1, string jarg2, int jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_record_file")]
+  public static extern int switch_ivr_record_file(HandleRef jarg1, HandleRef jarg2, string jarg3, HandleRef jarg4, uint jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_play_and_get_digits")]
+  public static extern int switch_play_and_get_digits(HandleRef jarg1, uint jarg2, uint jarg3, uint jarg4, uint jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, uint jarg11, string jarg12);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_speak_text_handle")]
+  public static extern int switch_ivr_speak_text_handle(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, string jarg5, HandleRef jarg6);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_clear_speech_cache")]
+  public static extern void switch_ivr_clear_speech_cache(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_speak_text")]
+  public static extern int switch_ivr_speak_text(HandleRef jarg1, string jarg2, string jarg3, string jarg4, HandleRef jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_originate")]
+  public static extern int switch_ivr_originate(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, string jarg4, uint jarg5, HandleRef jarg6, string jarg7, string jarg8, HandleRef jarg9, HandleRef jarg10, uint jarg11, HandleRef jarg12);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_enterprise_originate")]
+  public static extern int switch_ivr_enterprise_originate(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, string jarg4, uint jarg5, HandleRef jarg6, string jarg7, string jarg8, HandleRef jarg9, HandleRef jarg10, uint jarg11);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_bridge_display")]
+  public static extern void switch_ivr_bridge_display(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_multi_threaded_bridge")]
+  public static extern int switch_ivr_multi_threaded_bridge(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_signal_bridge")]
+  public static extern int switch_ivr_signal_bridge(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_session_transfer")]
+  public static extern int switch_ivr_session_transfer(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_schedule_transfer")]
+  public static extern uint switch_ivr_schedule_transfer(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_schedule_hangup")]
+  public static extern uint switch_ivr_schedule_hangup(HandleRef jarg1, string jarg2, int jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_uuid_bridge")]
+  public static extern int switch_ivr_uuid_bridge(string jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_media")]
+  public static extern int switch_ivr_media(string jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_nomedia")]
+  public static extern int switch_ivr_nomedia(string jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_hold_uuid")]
+  public static extern int switch_ivr_hold_uuid(string jarg1, string jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_unhold_uuid")]
+  public static extern int switch_ivr_unhold_uuid(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_hold")]
+  public static extern int switch_ivr_hold(HandleRef jarg1, string jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_unhold")]
+  public static extern int switch_ivr_unhold(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_schedule_broadcast")]
+  public static extern uint switch_ivr_schedule_broadcast(HandleRef jarg1, string jarg2, string jarg3, uint jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_broadcast")]
+  public static extern int switch_ivr_broadcast(string jarg1, string jarg2, uint jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_transfer_variable")]
+  public static extern int switch_ivr_transfer_variable(HandleRef jarg1, HandleRef jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_digit_stream_parser_new")]
+  public static extern int switch_ivr_digit_stream_parser_new(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_digit_stream_parser_destroy")]
+  public static extern int switch_ivr_digit_stream_parser_destroy(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_digit_stream_new")]
+  public static extern int switch_ivr_digit_stream_new(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_digit_stream_destroy")]
+  public static extern int switch_ivr_digit_stream_destroy(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_digit_stream_parser_set_event")]
+  public static extern int switch_ivr_digit_stream_parser_set_event(HandleRef jarg1, string jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_digit_stream_parser_del_event")]
+  public static extern int switch_ivr_digit_stream_parser_del_event(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_digit_stream_parser_feed")]
+  public static extern IntPtr switch_ivr_digit_stream_parser_feed(HandleRef jarg1, HandleRef jarg2, char jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_digit_stream_reset")]
+  public static extern int switch_ivr_digit_stream_reset(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_digit_stream_parser_set_terminator")]
+  public static extern int switch_ivr_digit_stream_parser_set_terminator(HandleRef jarg1, char jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_init")]
+  public static extern int switch_ivr_menu_init(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, string jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16, int jarg17, HandleRef jarg18);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_bind_action")]
+  public static extern int switch_ivr_menu_bind_action(HandleRef jarg1, int jarg2, string jarg3, string jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_bind_function")]
+  public static extern int switch_ivr_menu_bind_function(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_execute")]
+  public static extern int switch_ivr_menu_execute(HandleRef jarg1, HandleRef jarg2, string jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_stack_free")]
+  public static extern int switch_ivr_menu_stack_free(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_stack_xml_build")]
+  public static extern int switch_ivr_menu_stack_xml_build(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_str2action")]
+  public static extern int switch_ivr_menu_str2action(string jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_stack_xml_add_custom")]
+  public static extern int switch_ivr_menu_stack_xml_add_custom(HandleRef jarg1, string jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_menu_stack_xml_init")]
+  public static extern int switch_ivr_menu_stack_xml_init(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_phrase_macro")]
+  public static extern int switch_ivr_phrase_macro(HandleRef jarg1, string jarg2, string jarg3, string jarg4, HandleRef jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_delay_echo")]
+  public static extern void switch_ivr_delay_echo(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_find_bridged_uuid")]
+  public static extern int switch_ivr_find_bridged_uuid(string jarg1, string jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_intercept_session")]
+  public static extern void switch_ivr_intercept_session(HandleRef jarg1, string jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_park_session")]
+  public static extern void switch_ivr_park_session(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_wait_for_answer")]
+  public static extern int switch_ivr_wait_for_answer(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_read")]
+  public static extern int switch_ivr_read(HandleRef jarg1, uint jarg2, uint jarg3, string jarg4, string jarg5, string jarg6, HandleRef jarg7, uint jarg8, string jarg9);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_bind_dtmf_meta_session")]
+  public static extern int switch_ivr_bind_dtmf_meta_session(HandleRef jarg1, uint jarg2, uint jarg3, string jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_unbind_dtmf_meta_session")]
+  public static extern int switch_ivr_unbind_dtmf_meta_session(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_soft_hold")]
+  public static extern int switch_ivr_soft_hold(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_say")]
+  public static extern int switch_ivr_say(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, HandleRef jarg6);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_get_say_method_by_name")]
+  public static extern int switch_ivr_get_say_method_by_name(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_get_say_type_by_name")]
+  public static extern int switch_ivr_get_say_type_by_name(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_set_user")]
+  public static extern int switch_ivr_set_user(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_sound_test")]
+  public static extern int switch_ivr_sound_test(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_process_import")]
+  public static extern void switch_process_import(HandleRef jarg1, HandleRef jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_uuid_exists")]
+  public static extern int switch_ivr_uuid_exists(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_MAX_BUF_LEN_get")]
+  public static extern int SWITCH_RTP_MAX_BUF_LEN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_MAX_CRYPTO_LEN_get")]
+  public static extern int SWITCH_RTP_MAX_CRYPTO_LEN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_KEY_LEN_get")]
+  public static extern int SWITCH_RTP_KEY_LEN_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_CRYPTO_KEY_32_get")]
+  public static extern string SWITCH_RTP_CRYPTO_KEY_32_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_RTP_CRYPTO_KEY_80_get")]
+  public static extern string SWITCH_RTP_CRYPTO_KEY_80_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_crypto_key_index_set")]
+  public static extern void switch_rtp_crypto_key_index_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_crypto_key_index_get")]
+  public static extern uint switch_rtp_crypto_key_index_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_crypto_key_type_set")]
+  public static extern void switch_rtp_crypto_key_type_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_crypto_key_type_get")]
+  public static extern int switch_rtp_crypto_key_type_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_crypto_key_key_set")]
+  public static extern void switch_rtp_crypto_key_key_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_crypto_key_key_get")]
+  public static extern IntPtr switch_rtp_crypto_key_key_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_crypto_key_keylen_set")]
+  public static extern void switch_rtp_crypto_key_keylen_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_crypto_key_keylen_get")]
+  public static extern IntPtr switch_rtp_crypto_key_keylen_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_crypto_key_next_set")]
+  public static extern void switch_rtp_crypto_key_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_crypto_key_next_get")]
+  public static extern IntPtr switch_rtp_crypto_key_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_rtp_crypto_key")]
+  public static extern IntPtr new_switch_rtp_crypto_key();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_rtp_crypto_key")]
+  public static extern void delete_switch_rtp_crypto_key(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_add_crypto_key")]
+  public static extern int switch_rtp_add_crypto_key(HandleRef jarg1, int jarg2, uint jarg3, int jarg4, HandleRef jarg5, HandleRef jarg6);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_random")]
+  public static extern void switch_rtp_get_random(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_init")]
+  public static extern void switch_rtp_init(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_shutdown")]
+  public static extern void switch_rtp_shutdown();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_start_port")]
+  public static extern ushort switch_rtp_set_start_port(ushort jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_ssrc")]
+  public static extern int switch_rtp_set_ssrc(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_end_port")]
+  public static extern ushort switch_rtp_set_end_port(ushort jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_request_port")]
+  public static extern ushort switch_rtp_request_port(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_release_port")]
+  public static extern void switch_rtp_release_port(string jarg1, ushort jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_interval")]
+  public static extern int switch_rtp_set_interval(HandleRef jarg1, uint jarg2, uint jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_change_interval")]
+  public static extern int switch_rtp_change_interval(HandleRef jarg1, uint jarg2, uint jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_create")]
+  public static extern int switch_rtp_create(HandleRef jarg1, byte jarg2, uint jarg3, uint jarg4, uint jarg5, string jarg6, ref string jarg7, HandleRef jarg8);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_new")]
+  public static extern IntPtr switch_rtp_new(string jarg1, ushort jarg2, string jarg3, ushort jarg4, byte jarg5, uint jarg6, uint jarg7, uint jarg8, string jarg9, ref string jarg10, HandleRef jarg11);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_remote_address")]
+  public static extern int switch_rtp_set_remote_address(HandleRef jarg1, string jarg2, ushort jarg3, int jarg4, ref string jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_remote_host")]
+  public static extern string switch_rtp_get_remote_host(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_remote_port")]
+  public static extern ushort switch_rtp_get_remote_port(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_reset_media_timer")]
+  public static extern void switch_rtp_reset_media_timer(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_max_missed_packets")]
+  public static extern void switch_rtp_set_max_missed_packets(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_local_address")]
+  public static extern int switch_rtp_set_local_address(HandleRef jarg1, string jarg2, ushort jarg3, ref string jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_kill_socket")]
+  public static extern void switch_rtp_kill_socket(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_break")]
+  public static extern void switch_rtp_break(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_ready")]
+  public static extern byte switch_rtp_ready(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_destroy")]
+  public static extern void switch_rtp_destroy(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_ice")]
+  public static extern int switch_rtp_activate_ice(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_jitter_buffer")]
+  public static extern int switch_rtp_activate_jitter_buffer(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_flag")]
+  public static extern void switch_rtp_set_flag(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_test_flag")]
+  public static extern uint switch_rtp_test_flag(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_clear_flag")]
+  public static extern void switch_rtp_clear_flag(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_rtp_socket")]
+  public static extern IntPtr switch_rtp_get_rtp_socket(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_default_samples_per_interval")]
+  public static extern uint switch_rtp_get_default_samples_per_interval(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_default_payload")]
+  public static extern void switch_rtp_set_default_payload(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_default_payload")]
+  public static extern uint switch_rtp_get_default_payload(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_invald_handler")]
+  public static extern void switch_rtp_set_invald_handler(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_read")]
+  public static extern int switch_rtp_read(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5, uint jarg6);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_queue_rfc2833")]
+  public static extern int switch_rtp_queue_rfc2833(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_queue_rfc2833_in")]
+  public static extern int switch_rtp_queue_rfc2833_in(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_has_dtmf")]
+  public static extern IntPtr switch_rtp_has_dtmf(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_dequeue_dtmf")]
+  public static extern IntPtr switch_rtp_dequeue_dtmf(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_zerocopy_read")]
+  public static extern int switch_rtp_zerocopy_read(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5, uint jarg6);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_zerocopy_read_frame")]
+  public static extern int switch_rtp_zerocopy_read_frame(HandleRef jarg1, HandleRef jarg2, uint jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_rtp_flush_read_buffer")]
+  public static extern void rtp_flush_read_buffer(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_enable_vad")]
+  public static extern int switch_rtp_enable_vad(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, uint jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_disable_vad")]
+  public static extern int switch_rtp_disable_vad(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_write_frame")]
+  public static extern int switch_rtp_write_frame(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_write_manual")]
+  public static extern int switch_rtp_write_manual(HandleRef jarg1, HandleRef jarg2, uint jarg3, byte jarg4, byte jarg5, uint jarg6, HandleRef jarg7);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_ssrc")]
+  public static extern uint switch_rtp_get_ssrc(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_private")]
+  public static extern void switch_rtp_set_private(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_telephony_event")]
+  public static extern void switch_rtp_set_telephony_event(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_set_cng_pt")]
+  public static extern void switch_rtp_set_cng_pt(HandleRef jarg1, byte jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_private")]
+  public static extern IntPtr switch_rtp_get_private(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_activate_stun_ping")]
+  public static extern int switch_rtp_activate_stun_ping(HandleRef jarg1, string jarg2, ushort jarg3, uint jarg4, int jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_intentional_bugs")]
+  public static extern void switch_rtp_intentional_bugs(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_get_stats")]
+  public static extern IntPtr switch_rtp_get_stats(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_data_set")]
+  public static extern void switch_log_node_t_data_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_data_get")]
+  public static extern string switch_log_node_t_data_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_file_set")]
+  public static extern void switch_log_node_t_file_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_file_get")]
+  public static extern string switch_log_node_t_file_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_line_set")]
+  public static extern void switch_log_node_t_line_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_line_get")]
+  public static extern uint switch_log_node_t_line_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_func_set")]
+  public static extern void switch_log_node_t_func_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_func_get")]
+  public static extern string switch_log_node_t_func_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_level_set")]
+  public static extern void switch_log_node_t_level_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_level_get")]
+  public static extern int switch_log_node_t_level_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_timestamp_set")]
+  public static extern void switch_log_node_t_timestamp_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_timestamp_get")]
+  public static extern IntPtr switch_log_node_t_timestamp_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_content_set")]
+  public static extern void switch_log_node_t_content_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_content_get")]
+  public static extern string switch_log_node_t_content_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_userdata_set")]
+  public static extern void switch_log_node_t_userdata_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_userdata_get")]
+  public static extern string switch_log_node_t_userdata_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_channel_set")]
+  public static extern void switch_log_node_t_channel_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_t_channel_get")]
+  public static extern int switch_log_node_t_channel_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_log_node_t")]
+  public static extern IntPtr new_switch_log_node_t();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_log_node_t")]
+  public static extern void delete_switch_log_node_t(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_init")]
+  public static extern int switch_log_init(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_shutdown")]
+  public static extern int switch_log_shutdown();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_bind_logger")]
+  public static extern int switch_log_bind_logger(HandleRef jarg1, int jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_unbind_logger")]
+  public static extern int switch_log_unbind_logger(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_level2str")]
+  public static extern string switch_log_level2str(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_str2level")]
+  public static extern int switch_log_str2level(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_str2mask")]
+  public static extern uint switch_log_str2mask(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_dup")]
+  public static extern IntPtr switch_log_node_dup(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_log_node_free")]
+  public static extern void switch_log_node_free(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_XML_BUFSIZE_get")]
+  public static extern int SWITCH_XML_BUFSIZE_get();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_name_set")]
+  public static extern void switch_xml_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_name_get")]
+  public static extern string switch_xml_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_attr_set")]
+  public static extern void switch_xml_attr_set(HandleRef jarg1, ref string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_attr_get")]
+  public static extern string switch_xml_attr_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_txt_set")]
+  public static extern void switch_xml_txt_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_txt_get")]
+  public static extern string switch_xml_txt_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_free_path_set")]
+  public static extern void switch_xml_free_path_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_free_path_get")]
+  public static extern string switch_xml_free_path_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_off_set")]
+  public static extern void switch_xml_off_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_off_get")]
+  public static extern IntPtr switch_xml_off_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_next_set")]
+  public static extern void switch_xml_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_next_get")]
+  public static extern IntPtr switch_xml_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_sibling_set")]
+  public static extern void switch_xml_sibling_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_sibling_get")]
+  public static extern IntPtr switch_xml_sibling_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_ordered_set")]
+  public static extern void switch_xml_ordered_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_ordered_get")]
+  public static extern IntPtr switch_xml_ordered_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_child_set")]
+  public static extern void switch_xml_child_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_child_get")]
+  public static extern IntPtr switch_xml_child_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parent_set")]
+  public static extern void switch_xml_parent_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parent_get")]
+  public static extern IntPtr switch_xml_parent_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_flags_set")]
+  public static extern void switch_xml_flags_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_flags_get")]
+  public static extern uint switch_xml_flags_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_xml")]
+  public static extern IntPtr new_switch_xml();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_xml")]
+  public static extern void delete_switch_xml(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parse_str_dynamic")]
+  public static extern IntPtr switch_xml_parse_str_dynamic(string jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parse_str")]
+  public static extern IntPtr switch_xml_parse_str(string jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parse_fd")]
+  public static extern IntPtr switch_xml_parse_fd(int jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parse_file")]
+  public static extern IntPtr switch_xml_parse_file(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parse_file_simple")]
+  public static extern IntPtr switch_xml_parse_file_simple(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parse_fp")]
+  public static extern IntPtr switch_xml_parse_fp(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_child")]
+  public static extern IntPtr switch_xml_child(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_find_child")]
+  public static extern IntPtr switch_xml_find_child(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_find_child_multi")]
+  public static extern IntPtr switch_xml_find_child_multi(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_attr")]
+  public static extern string switch_xml_attr(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_attr_soft")]
+  public static extern string switch_xml_attr_soft(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_get")]
+  public static extern IntPtr switch_xml_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_toxml")]
+  public static extern string switch_xml_toxml(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_toxml_buf")]
+  public static extern string switch_xml_toxml_buf(HandleRef jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, int jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_free")]
+  public static extern void switch_xml_free(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_free_in_thread")]
+  public static extern void switch_xml_free_in_thread(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_error")]
+  public static extern string switch_xml_error(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_new")]
+  public static extern IntPtr switch_xml_new(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_add_child")]
+  public static extern IntPtr switch_xml_add_child(HandleRef jarg1, string jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_set_txt")]
+  public static extern IntPtr switch_xml_set_txt(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_set_attr")]
+  public static extern IntPtr switch_xml_set_attr(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_set_flag")]
+  public static extern IntPtr switch_xml_set_flag(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_cut")]
+  public static extern IntPtr switch_xml_cut(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_insert")]
+  public static extern IntPtr switch_xml_insert(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_open_root")]
+  public static extern IntPtr switch_xml_open_root(byte jarg1, ref string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_init")]
+  public static extern int switch_xml_init(HandleRef jarg1, ref string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_destroy")]
+  public static extern int switch_xml_destroy();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_root")]
+  public static extern IntPtr switch_xml_root();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_locate")]
+  public static extern int switch_xml_locate(string jarg1, string jarg2, string jarg3, string jarg4, HandleRef jarg5, HandleRef jarg6, HandleRef jarg7, int jarg8);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_locate_domain")]
+  public static extern int switch_xml_locate_domain(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_locate_group")]
+  public static extern int switch_xml_locate_group(string jarg1, string jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5, HandleRef jarg6);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_locate_user")]
+  public static extern int switch_xml_locate_user(string jarg1, string jarg2, string jarg3, string jarg4, HandleRef jarg5, HandleRef jarg6, HandleRef jarg7, HandleRef jarg8, HandleRef jarg9);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_locate_user_in_domain")]
+  public static extern int switch_xml_locate_user_in_domain(string jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_open_cfg")]
+  public static extern IntPtr switch_xml_open_cfg(string jarg1, HandleRef jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_set_binding_sections")]
+  public static extern void switch_xml_set_binding_sections(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_set_binding_user_data")]
+  public static extern void switch_xml_set_binding_user_data(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_get_binding_sections")]
+  public static extern uint switch_xml_get_binding_sections(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_get_binding_user_data")]
+  public static extern IntPtr switch_xml_get_binding_user_data(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_bind_search_function_ret")]
+  public static extern int switch_xml_bind_search_function_ret(HandleRef jarg1, uint jarg2, HandleRef jarg3, HandleRef jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_unbind_search_function")]
+  public static extern int switch_xml_unbind_search_function(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_unbind_search_function_ptr")]
+  public static extern int switch_xml_unbind_search_function_ptr(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_parse_section_string")]
+  public static extern uint switch_xml_parse_section_string(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_outgoing_channel_outgoing_channel_set")]
+  public static extern void switch_io_event_hook_outgoing_channel_outgoing_channel_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_outgoing_channel_outgoing_channel_get")]
+  public static extern IntPtr switch_io_event_hook_outgoing_channel_outgoing_channel_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_outgoing_channel_next_set")]
+  public static extern void switch_io_event_hook_outgoing_channel_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_outgoing_channel_next_get")]
+  public static extern IntPtr switch_io_event_hook_outgoing_channel_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_outgoing_channel")]
+  public static extern IntPtr new_switch_io_event_hook_outgoing_channel();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_outgoing_channel")]
+  public static extern void delete_switch_io_event_hook_outgoing_channel(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_receive_message_receive_message_set")]
+  public static extern void switch_io_event_hook_receive_message_receive_message_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_receive_message_receive_message_get")]
+  public static extern IntPtr switch_io_event_hook_receive_message_receive_message_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_receive_message_next_set")]
+  public static extern void switch_io_event_hook_receive_message_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_receive_message_next_get")]
+  public static extern IntPtr switch_io_event_hook_receive_message_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_receive_message")]
+  public static extern IntPtr new_switch_io_event_hook_receive_message();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_receive_message")]
+  public static extern void delete_switch_io_event_hook_receive_message(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_receive_event_receive_event_set")]
+  public static extern void switch_io_event_hook_receive_event_receive_event_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_receive_event_receive_event_get")]
+  public static extern IntPtr switch_io_event_hook_receive_event_receive_event_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_receive_event_next_set")]
+  public static extern void switch_io_event_hook_receive_event_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_receive_event_next_get")]
+  public static extern IntPtr switch_io_event_hook_receive_event_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_receive_event")]
+  public static extern IntPtr new_switch_io_event_hook_receive_event();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_receive_event")]
+  public static extern void delete_switch_io_event_hook_receive_event(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_read_frame_read_frame_set")]
+  public static extern void switch_io_event_hook_read_frame_read_frame_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_read_frame_read_frame_get")]
+  public static extern IntPtr switch_io_event_hook_read_frame_read_frame_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_read_frame_next_set")]
+  public static extern void switch_io_event_hook_read_frame_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_read_frame_next_get")]
+  public static extern IntPtr switch_io_event_hook_read_frame_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_read_frame")]
+  public static extern IntPtr new_switch_io_event_hook_read_frame();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_read_frame")]
+  public static extern void delete_switch_io_event_hook_read_frame(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_video_read_frame_video_read_frame_set")]
+  public static extern void switch_io_event_hook_video_read_frame_video_read_frame_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_video_read_frame_video_read_frame_get")]
+  public static extern IntPtr switch_io_event_hook_video_read_frame_video_read_frame_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_video_read_frame_next_set")]
+  public static extern void switch_io_event_hook_video_read_frame_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_video_read_frame_next_get")]
+  public static extern IntPtr switch_io_event_hook_video_read_frame_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_video_read_frame")]
+  public static extern IntPtr new_switch_io_event_hook_video_read_frame();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_video_read_frame")]
+  public static extern void delete_switch_io_event_hook_video_read_frame(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_write_frame_write_frame_set")]
+  public static extern void switch_io_event_hook_write_frame_write_frame_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_write_frame_write_frame_get")]
+  public static extern IntPtr switch_io_event_hook_write_frame_write_frame_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_write_frame_next_set")]
+  public static extern void switch_io_event_hook_write_frame_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_write_frame_next_get")]
+  public static extern IntPtr switch_io_event_hook_write_frame_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_write_frame")]
+  public static extern IntPtr new_switch_io_event_hook_write_frame();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_write_frame")]
+  public static extern void delete_switch_io_event_hook_write_frame(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_video_write_frame_video_write_frame_set")]
+  public static extern void switch_io_event_hook_video_write_frame_video_write_frame_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_video_write_frame_video_write_frame_get")]
+  public static extern IntPtr switch_io_event_hook_video_write_frame_video_write_frame_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_video_write_frame_next_set")]
+  public static extern void switch_io_event_hook_video_write_frame_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_video_write_frame_next_get")]
+  public static extern IntPtr switch_io_event_hook_video_write_frame_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_video_write_frame")]
+  public static extern IntPtr new_switch_io_event_hook_video_write_frame();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_video_write_frame")]
+  public static extern void delete_switch_io_event_hook_video_write_frame(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_kill_channel_kill_channel_set")]
+  public static extern void switch_io_event_hook_kill_channel_kill_channel_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_kill_channel_kill_channel_get")]
+  public static extern IntPtr switch_io_event_hook_kill_channel_kill_channel_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_kill_channel_next_set")]
+  public static extern void switch_io_event_hook_kill_channel_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_kill_channel_next_get")]
+  public static extern IntPtr switch_io_event_hook_kill_channel_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_kill_channel")]
+  public static extern IntPtr new_switch_io_event_hook_kill_channel();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_kill_channel")]
+  public static extern void delete_switch_io_event_hook_kill_channel(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_send_dtmf_send_dtmf_set")]
+  public static extern void switch_io_event_hook_send_dtmf_send_dtmf_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_send_dtmf_send_dtmf_get")]
+  public static extern IntPtr switch_io_event_hook_send_dtmf_send_dtmf_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_send_dtmf_next_set")]
+  public static extern void switch_io_event_hook_send_dtmf_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_send_dtmf_next_get")]
+  public static extern IntPtr switch_io_event_hook_send_dtmf_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_send_dtmf")]
+  public static extern IntPtr new_switch_io_event_hook_send_dtmf();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_send_dtmf")]
+  public static extern void delete_switch_io_event_hook_send_dtmf(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_recv_dtmf_recv_dtmf_set")]
+  public static extern void switch_io_event_hook_recv_dtmf_recv_dtmf_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_recv_dtmf_recv_dtmf_get")]
+  public static extern IntPtr switch_io_event_hook_recv_dtmf_recv_dtmf_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_recv_dtmf_next_set")]
+  public static extern void switch_io_event_hook_recv_dtmf_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_recv_dtmf_next_get")]
+  public static extern IntPtr switch_io_event_hook_recv_dtmf_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_recv_dtmf")]
+  public static extern IntPtr new_switch_io_event_hook_recv_dtmf();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_recv_dtmf")]
+  public static extern void delete_switch_io_event_hook_recv_dtmf(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_state_change_state_change_set")]
+  public static extern void switch_io_event_hook_state_change_state_change_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_state_change_state_change_get")]
+  public static extern IntPtr switch_io_event_hook_state_change_state_change_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_state_change_next_set")]
+  public static extern void switch_io_event_hook_state_change_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_state_change_next_get")]
+  public static extern IntPtr switch_io_event_hook_state_change_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_state_change")]
+  public static extern IntPtr new_switch_io_event_hook_state_change();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_state_change")]
+  public static extern void delete_switch_io_event_hook_state_change(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_resurrect_session_resurrect_session_set")]
+  public static extern void switch_io_event_hook_resurrect_session_resurrect_session_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_resurrect_session_resurrect_session_get")]
+  public static extern IntPtr switch_io_event_hook_resurrect_session_resurrect_session_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_resurrect_session_next_set")]
+  public static extern void switch_io_event_hook_resurrect_session_next_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_resurrect_session_next_get")]
+  public static extern IntPtr switch_io_event_hook_resurrect_session_next_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hook_resurrect_session")]
+  public static extern IntPtr new_switch_io_event_hook_resurrect_session();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hook_resurrect_session")]
+  public static extern void delete_switch_io_event_hook_resurrect_session(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_outgoing_channel_set")]
+  public static extern void switch_io_event_hooks_outgoing_channel_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_outgoing_channel_get")]
+  public static extern IntPtr switch_io_event_hooks_outgoing_channel_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_receive_message_set")]
+  public static extern void switch_io_event_hooks_receive_message_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_receive_message_get")]
+  public static extern IntPtr switch_io_event_hooks_receive_message_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_receive_event_set")]
+  public static extern void switch_io_event_hooks_receive_event_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_receive_event_get")]
+  public static extern IntPtr switch_io_event_hooks_receive_event_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_read_frame_set")]
+  public static extern void switch_io_event_hooks_read_frame_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_read_frame_get")]
+  public static extern IntPtr switch_io_event_hooks_read_frame_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_video_read_frame_set")]
+  public static extern void switch_io_event_hooks_video_read_frame_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_video_read_frame_get")]
+  public static extern IntPtr switch_io_event_hooks_video_read_frame_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_write_frame_set")]
+  public static extern void switch_io_event_hooks_write_frame_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_write_frame_get")]
+  public static extern IntPtr switch_io_event_hooks_write_frame_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_video_write_frame_set")]
+  public static extern void switch_io_event_hooks_video_write_frame_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_video_write_frame_get")]
+  public static extern IntPtr switch_io_event_hooks_video_write_frame_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_kill_channel_set")]
+  public static extern void switch_io_event_hooks_kill_channel_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_kill_channel_get")]
+  public static extern IntPtr switch_io_event_hooks_kill_channel_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_send_dtmf_set")]
+  public static extern void switch_io_event_hooks_send_dtmf_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_send_dtmf_get")]
+  public static extern IntPtr switch_io_event_hooks_send_dtmf_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_recv_dtmf_set")]
+  public static extern void switch_io_event_hooks_recv_dtmf_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_recv_dtmf_get")]
+  public static extern IntPtr switch_io_event_hooks_recv_dtmf_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_state_change_set")]
+  public static extern void switch_io_event_hooks_state_change_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_state_change_get")]
+  public static extern IntPtr switch_io_event_hooks_state_change_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_resurrect_session_set")]
+  public static extern void switch_io_event_hooks_resurrect_session_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hooks_resurrect_session_get")]
+  public static extern IntPtr switch_io_event_hooks_resurrect_session_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_io_event_hooks")]
+  public static extern IntPtr new_switch_io_event_hooks();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_io_event_hooks")]
+  public static extern void delete_switch_io_event_hooks(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_outgoing_channel")]
+  public static extern int switch_core_event_hook_add_outgoing_channel(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_receive_message")]
+  public static extern int switch_core_event_hook_add_receive_message(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_receive_event")]
+  public static extern int switch_core_event_hook_add_receive_event(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_state_change")]
+  public static extern int switch_core_event_hook_add_state_change(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_read_frame")]
+  public static extern int switch_core_event_hook_add_read_frame(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_write_frame")]
+  public static extern int switch_core_event_hook_add_write_frame(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_video_read_frame")]
+  public static extern int switch_core_event_hook_add_video_read_frame(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_video_write_frame")]
+  public static extern int switch_core_event_hook_add_video_write_frame(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_kill_channel")]
+  public static extern int switch_core_event_hook_add_kill_channel(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_send_dtmf")]
+  public static extern int switch_core_event_hook_add_send_dtmf(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_recv_dtmf")]
+  public static extern int switch_core_event_hook_add_recv_dtmf(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_add_resurrect_session")]
+  public static extern int switch_core_event_hook_add_resurrect_session(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_outgoing_channel")]
+  public static extern int switch_core_event_hook_remove_outgoing_channel(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_receive_message")]
+  public static extern int switch_core_event_hook_remove_receive_message(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_receive_event")]
+  public static extern int switch_core_event_hook_remove_receive_event(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_state_change")]
+  public static extern int switch_core_event_hook_remove_state_change(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_read_frame")]
+  public static extern int switch_core_event_hook_remove_read_frame(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_write_frame")]
+  public static extern int switch_core_event_hook_remove_write_frame(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_video_read_frame")]
+  public static extern int switch_core_event_hook_remove_video_read_frame(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_video_write_frame")]
+  public static extern int switch_core_event_hook_remove_video_write_frame(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_kill_channel")]
+  public static extern int switch_core_event_hook_remove_kill_channel(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_send_dtmf")]
+  public static extern int switch_core_event_hook_remove_send_dtmf(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_recv_dtmf")]
+  public static extern int switch_core_event_hook_remove_recv_dtmf(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_core_event_hook_remove_resurrect_session")]
+  public static extern int switch_core_event_hook_remove_resurrect_session(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_created_set")]
+  public static extern void switch_scheduler_task_created_set(HandleRef jarg1, long jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_created_get")]
+  public static extern long switch_scheduler_task_created_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_runtime_set")]
+  public static extern void switch_scheduler_task_runtime_set(HandleRef jarg1, long jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_runtime_get")]
+  public static extern long switch_scheduler_task_runtime_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_cmd_id_set")]
+  public static extern void switch_scheduler_task_cmd_id_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_cmd_id_get")]
+  public static extern uint switch_scheduler_task_cmd_id_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_group_set")]
+  public static extern void switch_scheduler_task_group_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_group_get")]
+  public static extern string switch_scheduler_task_group_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_cmd_arg_set")]
+  public static extern void switch_scheduler_task_cmd_arg_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_cmd_arg_get")]
+  public static extern IntPtr switch_scheduler_task_cmd_arg_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_task_id_set")]
+  public static extern void switch_scheduler_task_task_id_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_task_id_get")]
+  public static extern uint switch_scheduler_task_task_id_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_scheduler_task")]
+  public static extern IntPtr new_switch_scheduler_task();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_scheduler_task")]
+  public static extern void delete_switch_scheduler_task(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_add_task")]
+  public static extern uint switch_scheduler_add_task(HandleRef jarg1, HandleRef jarg2, string jarg3, string jarg4, uint jarg5, HandleRef jarg6, uint jarg7);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_del_task_id")]
+  public static extern uint switch_scheduler_del_task_id(uint jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_del_task_group")]
+  public static extern uint switch_scheduler_del_task_group(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_thread_start")]
+  public static extern void switch_scheduler_task_thread_start();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_scheduler_task_thread_stop")]
+  public static extern void switch_scheduler_task_thread_stop();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_file_set")]
+  public static extern void switch_config_file_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_file_get")]
+  public static extern IntPtr switch_config_file_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_path_set")]
+  public static extern void switch_config_path_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_path_get")]
+  public static extern string switch_config_path_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_category_set")]
+  public static extern void switch_config_category_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_category_get")]
+  public static extern string switch_config_category_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_section_set")]
+  public static extern void switch_config_section_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_section_get")]
+  public static extern string switch_config_section_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_buf_set")]
+  public static extern void switch_config_buf_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_buf_get")]
+  public static extern string switch_config_buf_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_lineno_set")]
+  public static extern void switch_config_lineno_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_lineno_get")]
+  public static extern int switch_config_lineno_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_catno_set")]
+  public static extern void switch_config_catno_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_catno_get")]
+  public static extern int switch_config_catno_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_sectno_set")]
+  public static extern void switch_config_sectno_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_sectno_get")]
+  public static extern int switch_config_sectno_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_lockto_set")]
+  public static extern void switch_config_lockto_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_lockto_get")]
+  public static extern int switch_config_lockto_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_switch_config")]
+  public static extern IntPtr new_switch_config();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_switch_config")]
+  public static extern void delete_switch_config(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_open_file")]
+  public static extern int switch_config_open_file(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_close_file")]
+  public static extern void switch_config_close_file(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_switch_config_next_pair")]
+  public static extern int switch_config_next_pair(HandleRef jarg1, ref string jarg2, ref string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_consoleLog")]
+  public static extern void consoleLog(string jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_consoleCleanLog")]
+  public static extern void consoleCleanLog(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_IvrMenu")]
+  public static extern IntPtr new_IvrMenu(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10, int jarg11, int jarg12, int jarg13, int jarg14, int jarg15, int jarg16);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_IvrMenu")]
+  public static extern void delete_IvrMenu(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_IvrMenu_bindAction")]
+  public static extern void IvrMenu_bindAction(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_IvrMenu_Execute")]
+  public static extern void IvrMenu_Execute(HandleRef jarg1, HandleRef jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_Api")]
+  public static extern IntPtr new_Api();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_Api")]
+  public static extern void delete_Api(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_Api_Execute")]
+  public static extern string Api_Execute(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_Api_ExecuteString")]
+  public static extern string Api_ExecuteString(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_Api_getTime")]
+  public static extern string Api_getTime(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_input_callback_state_t_function_set")]
+  public static extern void input_callback_state_t_function_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_input_callback_state_t_function_get")]
+  public static extern IntPtr input_callback_state_t_function_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_input_callback_state_t_threadState_set")]
+  public static extern void input_callback_state_t_threadState_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_input_callback_state_t_threadState_get")]
+  public static extern IntPtr input_callback_state_t_threadState_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_input_callback_state_t_extra_set")]
+  public static extern void input_callback_state_t_extra_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_input_callback_state_t_extra_get")]
+  public static extern IntPtr input_callback_state_t_extra_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_input_callback_state_t_funcargs_set")]
+  public static extern void input_callback_state_t_funcargs_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_input_callback_state_t_funcargs_get")]
+  public static extern string input_callback_state_t_funcargs_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_input_callback_state_t")]
+  public static extern IntPtr new_input_callback_state_t();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_input_callback_state_t")]
+  public static extern void delete_input_callback_state_t(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_DTMF_digit_set")]
+  public static extern void DTMF_digit_set(HandleRef jarg1, char jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_DTMF_digit_get")]
+  public static extern char DTMF_digit_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_DTMF_duration_set")]
+  public static extern void DTMF_duration_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_DTMF_duration_get")]
+  public static extern uint DTMF_duration_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_DTMF")]
+  public static extern IntPtr new_DTMF(char jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_DTMF")]
+  public static extern void delete_DTMF(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_Stream__SWIG_0")]
+  public static extern IntPtr new_Stream__SWIG_0();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_Stream__SWIG_1")]
+  public static extern IntPtr new_Stream__SWIG_1(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_Stream")]
+  public static extern void delete_Stream(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_Stream_Write")]
+  public static extern void Stream_Write(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_Stream_get_data")]
+  public static extern string Stream_get_data(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_Event_InternalEvent_set")]
+  public static extern void Event_InternalEvent_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_Event_InternalEvent_get")]
+  public static extern IntPtr Event_InternalEvent_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_Event_serialized_string_set")]
+  public static extern void Event_serialized_string_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_Event_serialized_string_get")]
+  public static extern string Event_serialized_string_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_Event_mine_set")]
+  public static extern void Event_mine_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_Event_mine_get")]
+  public static extern int Event_mine_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_Event__SWIG_0")]
+  public static extern IntPtr new_Event__SWIG_0(string jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_Event__SWIG_1")]
+  public static extern IntPtr new_Event__SWIG_1(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_Event")]
+  public static extern void delete_Event(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_Event_Serialize")]
+  public static extern string Event_Serialize(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_Event_SetPriority")]
+  public static extern bool Event_SetPriority(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_Event_GetHeader")]
+  public static extern string Event_GetHeader(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_Event_GetBody")]
+  public static extern string Event_GetBody(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_Event_GetEventType")]
+  public static extern string Event_GetEventType(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_Event_AddBody")]
+  public static extern bool Event_AddBody(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_Event_AddHeader")]
+  public static extern bool Event_AddHeader(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_Event_DeleteHeader")]
+  public static extern bool Event_DeleteHeader(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_Event_Fire")]
+  public static extern bool Event_Fire(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_events_set")]
+  public static extern void EventConsumer_events_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_events_get")]
+  public static extern IntPtr EventConsumer_events_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_e_event_id_set")]
+  public static extern void EventConsumer_e_event_id_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_e_event_id_get")]
+  public static extern int EventConsumer_e_event_id_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_node_set")]
+  public static extern void EventConsumer_node_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_node_get")]
+  public static extern IntPtr EventConsumer_node_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_e_callback_set")]
+  public static extern void EventConsumer_e_callback_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_e_callback_get")]
+  public static extern string EventConsumer_e_callback_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_e_subclass_name_set")]
+  public static extern void EventConsumer_e_subclass_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_e_subclass_name_get")]
+  public static extern string EventConsumer_e_subclass_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_e_cb_arg_set")]
+  public static extern void EventConsumer_e_cb_arg_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_e_cb_arg_get")]
+  public static extern string EventConsumer_e_cb_arg_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_EventConsumer")]
+  public static extern IntPtr new_EventConsumer(string jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_EventConsumer")]
+  public static extern void delete_EventConsumer(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_EventConsumer_pop")]
+  public static extern IntPtr EventConsumer_pop(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_CoreSession")]
+  public static extern void delete_CoreSession(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_InternalSession_set")]
+  public static extern void CoreSession_InternalSession_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_InternalSession_get")]
+  public static extern IntPtr CoreSession_InternalSession_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_channel_set")]
+  public static extern void CoreSession_channel_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_channel_get")]
+  public static extern IntPtr CoreSession_channel_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_flags_set")]
+  public static extern void CoreSession_flags_set(HandleRef jarg1, uint jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_flags_get")]
+  public static extern uint CoreSession_flags_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_allocated_set")]
+  public static extern void CoreSession_allocated_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_allocated_get")]
+  public static extern int CoreSession_allocated_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_cb_state_set")]
+  public static extern void CoreSession_cb_state_set(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_cb_state_get")]
+  public static extern IntPtr CoreSession_cb_state_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_HookState_set")]
+  public static extern void CoreSession_HookState_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_HookState_get")]
+  public static extern int CoreSession_HookState_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_cause_set")]
+  public static extern void CoreSession_cause_set(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_cause_get")]
+  public static extern int CoreSession_cause_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_uuid_set")]
+  public static extern void CoreSession_uuid_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_uuid_get")]
+  public static extern string CoreSession_uuid_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_tts_name_set")]
+  public static extern void CoreSession_tts_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_tts_name_get")]
+  public static extern string CoreSession_tts_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_voice_name_set")]
+  public static extern void CoreSession_voice_name_set(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_voice_name_get")]
+  public static extern string CoreSession_voice_name_get(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Answer")]
+  public static extern int CoreSession_Answer(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_preAnswer")]
+  public static extern int CoreSession_preAnswer(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Hangup")]
+  public static extern void CoreSession_Hangup(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_hangupState")]
+  public static extern void CoreSession_hangupState(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_SetVariable")]
+  public static extern void CoreSession_SetVariable(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_SetPrivate")]
+  public static extern void CoreSession_SetPrivate(HandleRef jarg1, string jarg2, HandleRef jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_GetPrivate")]
+  public static extern IntPtr CoreSession_GetPrivate(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_GetVariable")]
+  public static extern string CoreSession_GetVariable(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Say")]
+  public static extern void CoreSession_Say(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_SayPhrase")]
+  public static extern void CoreSession_SayPhrase(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_hangupCause")]
+  public static extern string CoreSession_hangupCause(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_getState")]
+  public static extern string CoreSession_getState(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_RecordFile")]
+  public static extern int CoreSession_RecordFile(HandleRef jarg1, string jarg2, int jarg3, int jarg4, int jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_originate")]
+  public static extern int CoreSession_originate(HandleRef jarg1, HandleRef jarg2, string jarg3, int jarg4, HandleRef jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_destroy")]
+  public static extern void CoreSession_destroy(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Speak")]
+  public static extern int CoreSession_Speak(HandleRef jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_SetTtsParameters")]
+  public static extern void CoreSession_SetTtsParameters(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_CollectDigits__SWIG_0")]
+  public static extern int CoreSession_CollectDigits__SWIG_0(HandleRef jarg1, int jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_CollectDigits__SWIG_1")]
+  public static extern int CoreSession_CollectDigits__SWIG_1(HandleRef jarg1, int jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_GetDigits__SWIG_0")]
+  public static extern string CoreSession_GetDigits__SWIG_0(HandleRef jarg1, int jarg2, string jarg3, int jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_GetDigits__SWIG_1")]
+  public static extern string CoreSession_GetDigits__SWIG_1(HandleRef jarg1, int jarg2, string jarg3, int jarg4, int jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Transfer")]
+  public static extern int CoreSession_Transfer(HandleRef jarg1, string jarg2, string jarg3, string jarg4);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_read")]
+  public static extern string CoreSession_read(HandleRef jarg1, int jarg2, int jarg3, string jarg4, int jarg5, string jarg6);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_PlayAndGetDigits")]
+  public static extern string CoreSession_PlayAndGetDigits(HandleRef jarg1, int jarg2, int jarg3, int jarg4, int jarg5, string jarg6, string jarg7, string jarg8, string jarg9, string jarg10);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_StreamFile")]
+  public static extern int CoreSession_StreamFile(HandleRef jarg1, string jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_sleep")]
+  public static extern int CoreSession_sleep(HandleRef jarg1, int jarg2, int jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_flushEvents")]
+  public static extern int CoreSession_flushEvents(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_flushDigits")]
+  public static extern int CoreSession_flushDigits(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_SetAutoHangup")]
+  public static extern int CoreSession_SetAutoHangup(HandleRef jarg1, bool jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Ready")]
+  public static extern bool CoreSession_Ready(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_answered")]
+  public static extern bool CoreSession_answered(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_mediaReady")]
+  public static extern bool CoreSession_mediaReady(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_waitForAnswer")]
+  public static extern void CoreSession_waitForAnswer(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_Execute")]
+  public static extern void CoreSession_Execute(HandleRef jarg1, string jarg2, string jarg3);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_sendEvent")]
+  public static extern void CoreSession_sendEvent(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_setEventData")]
+  public static extern void CoreSession_setEventData(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_getXMLCDR")]
+  public static extern string CoreSession_getXMLCDR(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_begin_allow_threads")]
+  public static extern bool CoreSession_begin_allow_threads(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_end_allow_threads")]
+  public static extern bool CoreSession_end_allow_threads(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_GetUuid")]
+  public static extern string CoreSession_GetUuid(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_get_cb_args")]
+  public static extern IntPtr CoreSession_get_cb_args(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_CoreSession_check_hangup_hook")]
+  public static extern void CoreSession_check_hangup_hook(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_console_log")]
+  public static extern void console_log(string jarg1, string jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_console_clean_log")]
+  public static extern void console_clean_log(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_msleep")]
+  public static extern void msleep(uint jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_bridge")]
+  public static extern void bridge(HandleRef jarg1, HandleRef jarg2);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_hanguphook")]
+  public static extern int hanguphook(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_dtmf_callback")]
+  public static extern int dtmf_callback(HandleRef jarg1, HandleRef jarg2, int jarg3, HandleRef jarg4, uint jarg5);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_ManagedSession__SWIG_0")]
+  public static extern IntPtr new_ManagedSession__SWIG_0();
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_ManagedSession__SWIG_1")]
+  public static extern IntPtr new_ManagedSession__SWIG_1(string jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_new_ManagedSession__SWIG_2")]
+  public static extern IntPtr new_ManagedSession__SWIG_2(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_delete_ManagedSession")]
+  public static extern void delete_ManagedSession(HandleRef jarg1);
+
+  [DllImport("mod_managed", EntryPoint="CSharp_ManagedSessionUpcast")]
+  public static extern IntPtr ManagedSessionUpcast(IntPtr objectRef);
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class input_callback_state_t : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal input_callback_state_t(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(input_callback_state_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~input_callback_state_t() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_input_callback_state_t(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_void function {
+    set {
+      freeswitchPINVOKE.input_callback_state_t_function_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.input_callback_state_t_function_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_void threadState {
+    set {
+      freeswitchPINVOKE.input_callback_state_t_threadState_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.input_callback_state_t_threadState_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_void extra {
+    set {
+      freeswitchPINVOKE.input_callback_state_t_extra_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.input_callback_state_t_extra_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public string funcargs {
+    set {
+      freeswitchPINVOKE.input_callback_state_t_funcargs_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.input_callback_state_t_funcargs_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public input_callback_state_t() : this(freeswitchPINVOKE.new_input_callback_state_t(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class IvrMenu : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal IvrMenu(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(IvrMenu obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~IvrMenu() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_IvrMenu(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public IvrMenu(IvrMenu main, string name, string greeting_sound, string short_greeting_sound, string invalid_sound, string exit_sound, string confirm_macro, string confirm_key, string tts_engine, string tts_voice, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts) : this(freeswitchPINVOKE.new_IvrMenu(IvrMenu.getCPtr(main), name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts), true) {
+  }
+
+  public void bindAction(string action, string arg, string bind) {
+    freeswitchPINVOKE.IvrMenu_bindAction(swigCPtr, action, arg, bind);
+  }
+
+  public void Execute(CoreSession session, string name) {
+    freeswitchPINVOKE.IvrMenu_Execute(swigCPtr, CoreSession.getCPtr(session), name);
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public partial class ManagedSession : CoreSession {
+  private HandleRef swigCPtr;
+
+  internal ManagedSession(IntPtr cPtr, bool cMemoryOwn) : base(freeswitchPINVOKE.ManagedSessionUpcast(cPtr), cMemoryOwn) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(ManagedSession obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~ManagedSession() {
+    Dispose();
+  }
+
+  public override void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_ManagedSession(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+      base.Dispose();
+    }
+  }
+
+  public ManagedSession() : this(freeswitchPINVOKE.new_ManagedSession__SWIG_0(), true) {
+  }
+
+  public ManagedSession(string uuid) : this(freeswitchPINVOKE.new_ManagedSession__SWIG_1(uuid), true) {
+  }
+
+  public ManagedSession(SWIGTYPE_p_switch_core_session session) : this(freeswitchPINVOKE.new_ManagedSession__SWIG_2(SWIGTYPE_p_switch_core_session.getCPtr(session)), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum session_flag_t {
+  S_HUP = (1 << 0),
+  S_FREE = (1 << 1),
+  S_RDLOCK = (1 << 2)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public partial class Stream : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal Stream(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(Stream obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~Stream() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_Stream(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public Stream() : this(freeswitchPINVOKE.new_Stream__SWIG_0(), true) {
+  }
+
+  public Stream(switch_stream_handle arg0) : this(freeswitchPINVOKE.new_Stream__SWIG_1(switch_stream_handle.getCPtr(arg0)), true) {
+  }
+
+  public void Write(string data) {
+    freeswitchPINVOKE.Stream_Write(swigCPtr, data);
+  }
+
+  public string get_data() {
+    string ret = freeswitchPINVOKE.Stream_get_data(swigCPtr);
+    return ret;
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_apr_pool_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_apr_pool_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_apr_pool_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_apr_pool_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_FILE {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_FILE(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_FILE() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_FILE obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_float {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_float(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_float() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_float obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_p_switch_console_callback_match__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_p_switch_console_callback_match__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_p_switch_console_callback_match__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_p_switch_console_callback_match__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_switch_event_t_p_void__p_switch_xml obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_q_const__switch_log_node_t_enum_switch_log_level_t__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_codec__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_codec__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_codec__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_codec__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_core_session_p_char_enum_switch_say_type_t_enum_switch_say_method_t_p_switch_input_args_t__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_core_session_p_char_enum_switch_say_type_t_enum_switch_say_method_t_p_switch_input_args_t__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_core_session_p_char_enum_switch_say_type_t_enum_switch_say_method_t_p_switch_input_args_t__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_char_enum_switch_say_type_t_enum_switch_say_method_t_p_switch_input_args_t__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_bool_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_bool_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_bool_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_q_const__char_p_q_const__char__switch_bool_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_core_session__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_core_session__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_core_session__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_event__void {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_event__void(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_event__void() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_event__void obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_file_handle__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_file_handle__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_file_handle__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_file_handle__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_media_bug_p_void_enum_switch_abc_type_t__switch_bool_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_rtp_p_switch_socket_t_p_void_switch_size_t_p_switch_sockaddr_t__void obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_scheduler_task__void {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_scheduler_task__void(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_scheduler_task__void() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_scheduler_task__void obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_speech_handle__void {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_speech_handle__void(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_speech_handle__void() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_speech_handle__void obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_thread_t_p_void__p_void obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_switch_timer__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_switch_timer__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_switch_timer__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_timer__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_void_int_p_p_char_p_p_char__int obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_p_void__void {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_p_void__void(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_p_void__void() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_p_void__void obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_f_void__switch_status_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_f_void__switch_status_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_f_void__switch_status_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_f_void__switch_status_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_HashElem {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_HashElem(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_HashElem() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_HashElem obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_int {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_int(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_int() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_int obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_apr_pool_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_apr_pool_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_apr_pool_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_apr_pool_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_char {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_char(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_char() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_char obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_p_char {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_p_char(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_p_char() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_p_char obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_real_pcre {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_real_pcre(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_real_pcre() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_real_pcre obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_sqlite3 {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_sqlite3(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_sqlite3() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_sqlite3 obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_sqlite3_stmt {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_sqlite3_stmt(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_sqlite3_stmt() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_sqlite3_stmt obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_audio_resampler_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_audio_resampler_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_audio_resampler_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_audio_resampler_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_buffer {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_buffer(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_buffer() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_buffer obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_cache_db_handle_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_cache_db_handle_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_cache_db_handle_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_cache_db_handle_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_caller_extension {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_caller_extension(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_caller_extension() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_caller_extension obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_channel {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_channel(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_channel() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_channel obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_console_callback_match {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_console_callback_match(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_console_callback_match() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_console_callback_match obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_core_port_allocator {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_core_port_allocator(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_core_port_allocator() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_core_port_allocator obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_core_session {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_core_session(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_core_session() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_core_session obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_core_session_message {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_core_session_message(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_core_session_message() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_core_session_message obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_event {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_event(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_event() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_event obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_event_node {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_event_node(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_event_node() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_event_node obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_frame {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_frame(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_frame() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_frame obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_hash {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_hash(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_hash() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_hash obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_ivr_digit_stream {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_ivr_digit_stream(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_ivr_digit_stream() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_digit_stream obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_ivr_digit_stream_parser {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_ivr_digit_stream_parser(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_ivr_digit_stream_parser() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_digit_stream_parser obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_ivr_menu {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_ivr_menu(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_ivr_menu() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_menu obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_ivr_menu_xml_ctx {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_ivr_menu_xml_ctx(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_ivr_menu_xml_ctx() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_ivr_menu_xml_ctx obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_log_node_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_log_node_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_log_node_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_log_node_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_media_bug {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_media_bug(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_media_bug() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_media_bug obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_network_list {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_network_list(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_network_list() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_network_list obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_rtp {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_rtp(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_rtp() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_rtp obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_xml_binding {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_xml_binding(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_xml_binding() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_xml_binding obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_switch_xml {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_switch_xml(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_switch_xml() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_xml obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_p_void {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_p_void(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_p_void() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_p_void obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_real_pcre {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_real_pcre(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_real_pcre() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_real_pcre obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_short {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_short(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_short() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_short obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_sockaddr {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_sockaddr(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_sockaddr() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_sockaddr obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_socklen_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_socklen_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_socklen_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_socklen_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_sqlite3 {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_sqlite3(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_sqlite3() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_sqlite3 obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_sqlite3_stmt {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_sqlite3_stmt(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_sqlite3_stmt() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_sqlite3_stmt obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_buffer {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_buffer(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_buffer() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_buffer obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_call_cause_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_call_cause_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_call_cause_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_call_cause_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_channel {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_channel(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_channel() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_channel obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_core_port_allocator {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_core_port_allocator(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_core_port_allocator() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_core_port_allocator obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_core_session {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_core_session(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_core_session() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_core_session obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_event_node {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_event_node(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_event_node() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_event_node obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_event_types_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_event_types_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_event_types_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_event_types_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_file_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_file_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_file_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_file_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_hash {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_hash(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_hash() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_hash obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_interval_time_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_interval_time_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_interval_time_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_interval_time_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_ivr_action_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_ivr_action_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_ivr_action_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_ivr_action_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_ivr_digit_stream {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_ivr_digit_stream(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_ivr_digit_stream() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_ivr_digit_stream obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_ivr_digit_stream_parser {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_ivr_digit_stream_parser(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_ivr_digit_stream_parser() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_ivr_digit_stream_parser obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_ivr_menu_action_function_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_ivr_menu_action_function_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_ivr_menu_action_function_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_ivr_menu_action_function_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_ivr_menu {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_ivr_menu(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_ivr_menu() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_ivr_menu obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_ivr_menu_xml_ctx {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_ivr_menu_xml_ctx(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_ivr_menu_xml_ctx() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_ivr_menu_xml_ctx obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_loadable_module_interface {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_loadable_module_interface(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_loadable_module_interface() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_loadable_module_interface obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_media_bug {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_media_bug(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_media_bug() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_media_bug obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_mutex_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_mutex_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_mutex_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_mutex_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_network_list {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_network_list(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_network_list() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_network_list obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_odbc_handle {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_odbc_handle(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_odbc_handle() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_odbc_handle obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_pollfd_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_pollfd_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_pollfd_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_pollfd_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_queue_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_queue_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_queue_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_queue_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_rtp {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_rtp(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_rtp() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_rtp obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_size_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_size_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_size_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_size_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_sockaddr_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_sockaddr_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_sockaddr_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_sockaddr_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_socket_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_socket_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_socket_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_socket_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_ssize_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_ssize_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_ssize_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_ssize_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_thread_rwlock_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_thread_rwlock_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_thread_rwlock_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_thread_rwlock_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_time_exp_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_time_exp_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_time_exp_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_time_exp_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_time_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_time_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_time_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_time_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_switch_xml_binding {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_switch_xml_binding(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_switch_xml_binding() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_switch_xml_binding obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_time_t {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_time_t(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_time_t() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_time_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_unsigned_char {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_unsigned_char(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_unsigned_char() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_unsigned_char obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_unsigned_int {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_unsigned_int(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_unsigned_int() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_unsigned_int obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_unsigned_long {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_unsigned_long(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_unsigned_long() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_unsigned_long obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_unsigned_short {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_unsigned_short(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_unsigned_short() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_unsigned_short obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class SWIGTYPE_p_void {
+  private HandleRef swigCPtr;
+
+  internal SWIGTYPE_p_void(IntPtr cPtr, bool futureUse) {
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  protected SWIGTYPE_p_void() {
+    swigCPtr = new HandleRef(null, IntPtr.Zero);
+  }
+
+  internal static HandleRef getCPtr(SWIGTYPE_p_void obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_abc_type_t {
+  SWITCH_ABC_TYPE_INIT,
+  SWITCH_ABC_TYPE_READ,
+  SWITCH_ABC_TYPE_WRITE,
+  SWITCH_ABC_TYPE_WRITE_REPLACE,
+  SWITCH_ABC_TYPE_READ_REPLACE,
+  SWITCH_ABC_TYPE_READ_PING,
+  SWITCH_ABC_TYPE_CLOSE
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_api_interface : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_api_interface(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_api_interface obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_api_interface() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_api_interface(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string interface_name {
+    set {
+      freeswitchPINVOKE.switch_api_interface_interface_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_api_interface_interface_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string desc {
+    set {
+      freeswitchPINVOKE.switch_api_interface_desc_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_api_interface_desc_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t function {
+    set {
+      freeswitchPINVOKE.switch_api_interface_function_set(swigCPtr, SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_api_interface_function_get(swigCPtr);
+      SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_q_const__char_p_switch_core_session_p_switch_stream_handle__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public string syntax {
+    set {
+      freeswitchPINVOKE.switch_api_interface_syntax_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_api_interface_syntax_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
+    set {
+      freeswitchPINVOKE.switch_api_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_api_interface_rwlock_get(swigCPtr);
+      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public int refs {
+    set {
+      freeswitchPINVOKE.switch_api_interface_refs_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_api_interface_refs_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_mutex_t reflock {
+    set {
+      freeswitchPINVOKE.switch_api_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_api_interface_reflock_get(swigCPtr);
+      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_loadable_module_interface parent {
+    set {
+      freeswitchPINVOKE.switch_api_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_api_interface_parent_get(swigCPtr);
+      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_api_interface next {
+    set {
+      freeswitchPINVOKE.switch_api_interface_next_set(swigCPtr, switch_api_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_api_interface_next_get(swigCPtr);
+      switch_api_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_api_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_api_interface() : this(freeswitchPINVOKE.new_switch_api_interface(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_application_flag_enum_t {
+  SAF_NONE = 0,
+  SAF_SUPPORT_NOMEDIA = (1 << 0),
+  SAF_ROUTING_EXEC = (1 << 1),
+  SAF_MEDIA_TAP = (1 << 2)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_application_interface : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_application_interface(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_application_interface obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_application_interface() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_application_interface(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string interface_name {
+    set {
+      freeswitchPINVOKE.switch_application_interface_interface_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_application_interface_interface_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void application_function {
+    set {
+      freeswitchPINVOKE.switch_application_interface_application_function_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_application_interface_application_function_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public string long_desc {
+    set {
+      freeswitchPINVOKE.switch_application_interface_long_desc_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_application_interface_long_desc_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string short_desc {
+    set {
+      freeswitchPINVOKE.switch_application_interface_short_desc_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_application_interface_short_desc_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string syntax {
+    set {
+      freeswitchPINVOKE.switch_application_interface_syntax_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_application_interface_syntax_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint flags {
+    set {
+      freeswitchPINVOKE.switch_application_interface_flags_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_application_interface_flags_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
+    set {
+      freeswitchPINVOKE.switch_application_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_application_interface_rwlock_get(swigCPtr);
+      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public int refs {
+    set {
+      freeswitchPINVOKE.switch_application_interface_refs_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_application_interface_refs_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_mutex_t reflock {
+    set {
+      freeswitchPINVOKE.switch_application_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_application_interface_reflock_get(swigCPtr);
+      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_loadable_module_interface parent {
+    set {
+      freeswitchPINVOKE.switch_application_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_application_interface_parent_get(swigCPtr);
+      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_application_interface next {
+    set {
+      freeswitchPINVOKE.switch_application_interface_next_set(swigCPtr, switch_application_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_application_interface_next_get(swigCPtr);
+      switch_application_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_application_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_application_interface() : this(freeswitchPINVOKE.new_switch_application_interface(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_app_log : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_app_log(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_app_log obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_app_log() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_app_log(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string app {
+    set {
+      freeswitchPINVOKE.switch_app_log_app_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_app_log_app_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string arg {
+    set {
+      freeswitchPINVOKE.switch_app_log_arg_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_app_log_arg_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_app_log next {
+    set {
+      freeswitchPINVOKE.switch_app_log_next_set(swigCPtr, switch_app_log.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_app_log_next_get(swigCPtr);
+      switch_app_log ret = (cPtr == IntPtr.Zero) ? null : new switch_app_log(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_app_log() : this(freeswitchPINVOKE.new_switch_app_log(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_asr_flag_enum_t {
+  SWITCH_ASR_FLAG_NONE = 0,
+  SWITCH_ASR_FLAG_DATA = (1 << 0),
+  SWITCH_ASR_FLAG_FREE_POOL = (1 << 1),
+  SWITCH_ASR_FLAG_CLOSED = (1 << 2),
+  SWITCH_ASR_FLAG_FIRE_EVENTS = (1 << 3),
+  SWITCH_ASR_FLAG_AUTO_RESUME = (1 << 4)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_asr_handle : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_asr_handle(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_asr_handle obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_asr_handle() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_asr_handle(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public switch_asr_interface asr_interface {
+    set {
+      freeswitchPINVOKE.switch_asr_handle_asr_interface_set(swigCPtr, switch_asr_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_handle_asr_interface_get(swigCPtr);
+      switch_asr_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_asr_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public uint flags {
+    set {
+      freeswitchPINVOKE.switch_asr_handle_flags_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_asr_handle_flags_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string name {
+    set {
+      freeswitchPINVOKE.switch_asr_handle_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_asr_handle_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string codec {
+    set {
+      freeswitchPINVOKE.switch_asr_handle_codec_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_asr_handle_codec_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint rate {
+    set {
+      freeswitchPINVOKE.switch_asr_handle_rate_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_asr_handle_rate_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string grammar {
+    set {
+      freeswitchPINVOKE.switch_asr_handle_grammar_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_asr_handle_grammar_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string param {
+    set {
+      freeswitchPINVOKE.switch_asr_handle_param_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_asr_handle_param_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_apr_pool_t memory_pool {
+    set {
+      freeswitchPINVOKE.switch_asr_handle_memory_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_handle_memory_pool_get(swigCPtr);
+      SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_void private_info {
+    set {
+      freeswitchPINVOKE.switch_asr_handle_private_info_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_handle_private_info_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_asr_handle() : this(freeswitchPINVOKE.new_switch_asr_handle(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_asr_interface : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_asr_interface(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_asr_interface obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_asr_interface() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_asr_interface(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string interface_name {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_interface_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_asr_interface_interface_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t asr_open {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_asr_open_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_open_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_int_p_q_const__char_p_unsigned_long__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t asr_load_grammar {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_asr_load_grammar_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_load_grammar_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char_p_q_const__char__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t asr_unload_grammar {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_asr_unload_grammar_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_unload_grammar_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_q_const__char__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t asr_close {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_asr_close_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_close_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t asr_feed {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_asr_feed_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_feed_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_void_unsigned_int_p_unsigned_long__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t asr_resume {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_asr_resume_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_resume_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t asr_pause {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_asr_pause_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_pause_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t asr_check_results {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_asr_check_results_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_check_results_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_unsigned_long__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t asr_get_results {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_asr_get_results_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_get_results_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_p_char_p_unsigned_long__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t asr_start_input_timers {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_asr_start_input_timers_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_start_input_timers_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void asr_text_param {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_asr_text_param_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_text_param_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_char_p_q_const__char__void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void asr_numeric_param {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_asr_numeric_param_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_numeric_param_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_char_int__void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void asr_float_param {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_asr_float_param_set(swigCPtr, SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_asr_float_param_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_asr_handle_p_char_double__void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_rwlock_get(swigCPtr);
+      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public int refs {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_refs_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_asr_interface_refs_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_mutex_t reflock {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_reflock_get(swigCPtr);
+      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_loadable_module_interface parent {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_parent_get(swigCPtr);
+      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_asr_interface next {
+    set {
+      freeswitchPINVOKE.switch_asr_interface_next_set(swigCPtr, switch_asr_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_asr_interface_next_get(swigCPtr);
+      switch_asr_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_asr_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_asr_interface() : this(freeswitchPINVOKE.new_switch_asr_interface(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_audio_col_t {
+  SWITCH_AUDIO_COL_STR_TITLE = 0x01,
+  SWITCH_AUDIO_COL_STR_COPYRIGHT = 0x02,
+  SWITCH_AUDIO_COL_STR_SOFTWARE = 0x03,
+  SWITCH_AUDIO_COL_STR_ARTIST = 0x04,
+  SWITCH_AUDIO_COL_STR_COMMENT = 0x05,
+  SWITCH_AUDIO_COL_STR_DATE = 0x06
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_audio_resampler_t : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_audio_resampler_t(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_audio_resampler_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_audio_resampler_t() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_audio_resampler_t(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_void resampler {
+    set {
+      freeswitchPINVOKE.switch_audio_resampler_t_resampler_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_audio_resampler_t_resampler_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public int from_rate {
+    set {
+      freeswitchPINVOKE.switch_audio_resampler_t_from_rate_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_audio_resampler_t_from_rate_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int to_rate {
+    set {
+      freeswitchPINVOKE.switch_audio_resampler_t_to_rate_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_audio_resampler_t_to_rate_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public double factor {
+    set {
+      freeswitchPINVOKE.switch_audio_resampler_t_factor_set(swigCPtr, value);
+    } 
+    get {
+      double ret = freeswitchPINVOKE.switch_audio_resampler_t_factor_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public double rfactor {
+    set {
+      freeswitchPINVOKE.switch_audio_resampler_t_rfactor_set(swigCPtr, value);
+    } 
+    get {
+      double ret = freeswitchPINVOKE.switch_audio_resampler_t_rfactor_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_short to {
+    set {
+      freeswitchPINVOKE.switch_audio_resampler_t_to_set(swigCPtr, SWIGTYPE_p_short.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_audio_resampler_t_to_get(swigCPtr);
+      SWIGTYPE_p_short ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_short(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public uint to_len {
+    set {
+      freeswitchPINVOKE.switch_audio_resampler_t_to_len_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_audio_resampler_t_to_len_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint to_size {
+    set {
+      freeswitchPINVOKE.switch_audio_resampler_t_to_size_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_audio_resampler_t_to_size_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_audio_resampler_t() : this(freeswitchPINVOKE.new_switch_audio_resampler_t(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_bind_flag_enum_t {
+  SBF_DIAL_ALEG = (1 << 0),
+  SBF_EXEC_ALEG = (1 << 1),
+  SBF_DIAL_BLEG = (1 << 2),
+  SBF_EXEC_BLEG = (1 << 3),
+  SBF_EXEC_OPPOSITE = (1 << 4),
+  SBF_EXEC_SAME = (1 << 5),
+  SBF_ONCE = (1 << 6),
+  SBF_EXEC_INLINE = (1 << 7)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_bitpack_mode_t {
+  SWITCH_BITPACK_MODE_RFC3551,
+  SWITCH_BITPACK_MODE_AAL2
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_bitpack_t : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_bitpack_t(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_bitpack_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_bitpack_t() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_bitpack_t(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_unsigned_char buf {
+    set {
+      freeswitchPINVOKE.switch_bitpack_t_buf_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_bitpack_t_buf_get(swigCPtr);
+      SWIGTYPE_p_unsigned_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public uint buflen {
+    set {
+      freeswitchPINVOKE.switch_bitpack_t_buflen_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_bitpack_t_buflen_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_unsigned_char cur {
+    set {
+      freeswitchPINVOKE.switch_bitpack_t_cur_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_bitpack_t_cur_get(swigCPtr);
+      SWIGTYPE_p_unsigned_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public uint bytes {
+    set {
+      freeswitchPINVOKE.switch_bitpack_t_bytes_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_bitpack_t_bytes_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint bits_tot {
+    set {
+      freeswitchPINVOKE.switch_bitpack_t_bits_tot_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_bitpack_t_bits_tot_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public byte bits_cur {
+    set {
+      freeswitchPINVOKE.switch_bitpack_t_bits_cur_set(swigCPtr, value);
+    } 
+    get {
+      byte ret = freeswitchPINVOKE.switch_bitpack_t_bits_cur_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public byte bits_rem {
+    set {
+      freeswitchPINVOKE.switch_bitpack_t_bits_rem_set(swigCPtr, value);
+    } 
+    get {
+      byte ret = freeswitchPINVOKE.switch_bitpack_t_bits_rem_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public byte frame_bits {
+    set {
+      freeswitchPINVOKE.switch_bitpack_t_frame_bits_set(swigCPtr, value);
+    } 
+    get {
+      byte ret = freeswitchPINVOKE.switch_bitpack_t_frame_bits_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public byte shiftby {
+    set {
+      freeswitchPINVOKE.switch_bitpack_t_shiftby_set(swigCPtr, value);
+    } 
+    get {
+      byte ret = freeswitchPINVOKE.switch_bitpack_t_shiftby_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public byte this_byte {
+    set {
+      freeswitchPINVOKE.switch_bitpack_t_this_byte_set(swigCPtr, value);
+    } 
+    get {
+      byte ret = freeswitchPINVOKE.switch_bitpack_t_this_byte_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public byte under {
+    set {
+      freeswitchPINVOKE.switch_bitpack_t_under_set(swigCPtr, value);
+    } 
+    get {
+      byte ret = freeswitchPINVOKE.switch_bitpack_t_under_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public byte over {
+    set {
+      freeswitchPINVOKE.switch_bitpack_t_over_set(swigCPtr, value);
+    } 
+    get {
+      byte ret = freeswitchPINVOKE.switch_bitpack_t_over_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_bitpack_mode_t mode {
+    set {
+      freeswitchPINVOKE.switch_bitpack_t_mode_set(swigCPtr, (int)value);
+    } 
+    get {
+      switch_bitpack_mode_t ret = (switch_bitpack_mode_t)freeswitchPINVOKE.switch_bitpack_t_mode_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_bitpack_t() : this(freeswitchPINVOKE.new_switch_bitpack_t(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_bool_t {
+  SWITCH_FALSE = 0,
+  SWITCH_TRUE = 1
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_cache_db_connection_options_t : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_cache_db_connection_options_t(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_cache_db_connection_options_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_cache_db_connection_options_t() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_cache_db_connection_options_t(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public switch_cache_db_core_db_options_t core_db_options {
+    set {
+      freeswitchPINVOKE.switch_cache_db_connection_options_t_core_db_options_set(swigCPtr, switch_cache_db_core_db_options_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_cache_db_connection_options_t_core_db_options_get(swigCPtr);
+      switch_cache_db_core_db_options_t ret = (cPtr == IntPtr.Zero) ? null : new switch_cache_db_core_db_options_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_cache_db_odbc_options_t odbc_options {
+    set {
+      freeswitchPINVOKE.switch_cache_db_connection_options_t_odbc_options_set(swigCPtr, switch_cache_db_odbc_options_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_cache_db_connection_options_t_odbc_options_get(swigCPtr);
+      switch_cache_db_odbc_options_t ret = (cPtr == IntPtr.Zero) ? null : new switch_cache_db_odbc_options_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_cache_db_connection_options_t() : this(freeswitchPINVOKE.new_switch_cache_db_connection_options_t(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_cache_db_core_db_options_t : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_cache_db_core_db_options_t(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_cache_db_core_db_options_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_cache_db_core_db_options_t() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_cache_db_core_db_options_t(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string db_path {
+    set {
+      freeswitchPINVOKE.switch_cache_db_core_db_options_t_db_path_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_cache_db_core_db_options_t_db_path_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_cache_db_core_db_options_t() : this(freeswitchPINVOKE.new_switch_cache_db_core_db_options_t(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_cache_db_handle_t : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_cache_db_handle_t(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_cache_db_handle_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_cache_db_handle_t() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_cache_db_handle_t(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string name {
+    set {
+      freeswitchPINVOKE.switch_cache_db_handle_t_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_cache_db_handle_t_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_cache_db_handle_type_t type {
+    set {
+      freeswitchPINVOKE.switch_cache_db_handle_t_type_set(swigCPtr, (int)value);
+    } 
+    get {
+      switch_cache_db_handle_type_t ret = (switch_cache_db_handle_type_t)freeswitchPINVOKE.switch_cache_db_handle_t_type_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_cache_db_native_handle_t native_handle {
+    set {
+      freeswitchPINVOKE.switch_cache_db_handle_t_native_handle_set(swigCPtr, switch_cache_db_native_handle_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_cache_db_handle_t_native_handle_get(swigCPtr);
+      switch_cache_db_native_handle_t ret = (cPtr == IntPtr.Zero) ? null : new switch_cache_db_native_handle_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_time_t last_used {
+    set {
+      freeswitchPINVOKE.switch_cache_db_handle_t_last_used_set(swigCPtr, SWIGTYPE_p_time_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_time_t ret = new SWIGTYPE_p_time_t(freeswitchPINVOKE.switch_cache_db_handle_t_last_used_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_mutex_t mutex {
+    set {
+      freeswitchPINVOKE.switch_cache_db_handle_t_mutex_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_cache_db_handle_t_mutex_get(swigCPtr);
+      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_mutex_t io_mutex {
+    set {
+      freeswitchPINVOKE.switch_cache_db_handle_t_io_mutex_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_cache_db_handle_t_io_mutex_get(swigCPtr);
+      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_apr_pool_t pool {
+    set {
+      freeswitchPINVOKE.switch_cache_db_handle_t_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_cache_db_handle_t_pool_get(swigCPtr);
+      SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public int flags {
+    set {
+      freeswitchPINVOKE.switch_cache_db_handle_t_flags_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_cache_db_handle_t_flags_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint hash {
+    set {
+      freeswitchPINVOKE.switch_cache_db_handle_t_hash_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_cache_db_handle_t_hash_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string creator {
+    set {
+      freeswitchPINVOKE.switch_cache_db_handle_t_creator_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_cache_db_handle_t_creator_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string last_user {
+    set {
+      freeswitchPINVOKE.switch_cache_db_handle_t_last_user_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_cache_db_handle_t_last_user_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_cache_db_handle_t() : this(freeswitchPINVOKE.new_switch_cache_db_handle_t(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_cache_db_handle_type_t {
+  SCDB_TYPE_CORE_DB,
+  SCDB_TYPE_ODBC
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_cache_db_native_handle_t : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_cache_db_native_handle_t(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_cache_db_native_handle_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_cache_db_native_handle_t() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_cache_db_native_handle_t(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_sqlite3 core_db_dbh {
+    set {
+      freeswitchPINVOKE.switch_cache_db_native_handle_t_core_db_dbh_set(swigCPtr, SWIGTYPE_p_sqlite3.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_cache_db_native_handle_t_core_db_dbh_get(swigCPtr);
+      SWIGTYPE_p_sqlite3 ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_sqlite3(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_odbc_handle odbc_dbh {
+    set {
+      freeswitchPINVOKE.switch_cache_db_native_handle_t_odbc_dbh_set(swigCPtr, SWIGTYPE_p_switch_odbc_handle.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_cache_db_native_handle_t_odbc_dbh_get(swigCPtr);
+      SWIGTYPE_p_switch_odbc_handle ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_odbc_handle(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_cache_db_native_handle_t() : this(freeswitchPINVOKE.new_switch_cache_db_native_handle_t(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_cache_db_odbc_options_t : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_cache_db_odbc_options_t(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_cache_db_odbc_options_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_cache_db_odbc_options_t() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_cache_db_odbc_options_t(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string dsn {
+    set {
+      freeswitchPINVOKE.switch_cache_db_odbc_options_t_dsn_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_cache_db_odbc_options_t_dsn_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string user {
+    set {
+      freeswitchPINVOKE.switch_cache_db_odbc_options_t_user_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_cache_db_odbc_options_t_user_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string pass {
+    set {
+      freeswitchPINVOKE.switch_cache_db_odbc_options_t_pass_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_cache_db_odbc_options_t_pass_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_cache_db_odbc_options_t() : this(freeswitchPINVOKE.new_switch_cache_db_odbc_options_t(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_call_cause_t {
+  SWITCH_CAUSE_NONE = 0,
+  SWITCH_CAUSE_UNALLOCATED_NUMBER = 1,
+  SWITCH_CAUSE_NO_ROUTE_TRANSIT_NET = 2,
+  SWITCH_CAUSE_NO_ROUTE_DESTINATION = 3,
+  SWITCH_CAUSE_CHANNEL_UNACCEPTABLE = 6,
+  SWITCH_CAUSE_CALL_AWARDED_DELIVERED = 7,
+  SWITCH_CAUSE_NORMAL_CLEARING = 16,
+  SWITCH_CAUSE_USER_BUSY = 17,
+  SWITCH_CAUSE_NO_USER_RESPONSE = 18,
+  SWITCH_CAUSE_NO_ANSWER = 19,
+  SWITCH_CAUSE_SUBSCRIBER_ABSENT = 20,
+  SWITCH_CAUSE_CALL_REJECTED = 21,
+  SWITCH_CAUSE_NUMBER_CHANGED = 22,
+  SWITCH_CAUSE_REDIRECTION_TO_NEW_DESTINATION = 23,
+  SWITCH_CAUSE_EXCHANGE_ROUTING_ERROR = 25,
+  SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER = 27,
+  SWITCH_CAUSE_INVALID_NUMBER_FORMAT = 28,
+  SWITCH_CAUSE_FACILITY_REJECTED = 29,
+  SWITCH_CAUSE_RESPONSE_TO_STATUS_ENQUIRY = 30,
+  SWITCH_CAUSE_NORMAL_UNSPECIFIED = 31,
+  SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION = 34,
+  SWITCH_CAUSE_NETWORK_OUT_OF_ORDER = 38,
+  SWITCH_CAUSE_NORMAL_TEMPORARY_FAILURE = 41,
+  SWITCH_CAUSE_SWITCH_CONGESTION = 42,
+  SWITCH_CAUSE_ACCESS_INFO_DISCARDED = 43,
+  SWITCH_CAUSE_REQUESTED_CHAN_UNAVAIL = 44,
+  SWITCH_CAUSE_PRE_EMPTED = 45,
+  SWITCH_CAUSE_FACILITY_NOT_SUBSCRIBED = 50,
+  SWITCH_CAUSE_OUTGOING_CALL_BARRED = 52,
+  SWITCH_CAUSE_INCOMING_CALL_BARRED = 54,
+  SWITCH_CAUSE_BEARERCAPABILITY_NOTAUTH = 57,
+  SWITCH_CAUSE_BEARERCAPABILITY_NOTAVAIL = 58,
+  SWITCH_CAUSE_SERVICE_UNAVAILABLE = 63,
+  SWITCH_CAUSE_BEARERCAPABILITY_NOTIMPL = 65,
+  SWITCH_CAUSE_CHAN_NOT_IMPLEMENTED = 66,
+  SWITCH_CAUSE_FACILITY_NOT_IMPLEMENTED = 69,
+  SWITCH_CAUSE_SERVICE_NOT_IMPLEMENTED = 79,
+  SWITCH_CAUSE_INVALID_CALL_REFERENCE = 81,
+  SWITCH_CAUSE_INCOMPATIBLE_DESTINATION = 88,
+  SWITCH_CAUSE_INVALID_MSG_UNSPECIFIED = 95,
+  SWITCH_CAUSE_MANDATORY_IE_MISSING = 96,
+  SWITCH_CAUSE_MESSAGE_TYPE_NONEXIST = 97,
+  SWITCH_CAUSE_WRONG_MESSAGE = 98,
+  SWITCH_CAUSE_IE_NONEXIST = 99,
+  SWITCH_CAUSE_INVALID_IE_CONTENTS = 100,
+  SWITCH_CAUSE_WRONG_CALL_STATE = 101,
+  SWITCH_CAUSE_RECOVERY_ON_TIMER_EXPIRE = 102,
+  SWITCH_CAUSE_MANDATORY_IE_LENGTH_ERROR = 103,
+  SWITCH_CAUSE_PROTOCOL_ERROR = 111,
+  SWITCH_CAUSE_INTERWORKING = 127,
+  SWITCH_CAUSE_SUCCESS = 142,
+  SWITCH_CAUSE_ORIGINATOR_CANCEL = 487,
+  SWITCH_CAUSE_CRASH = 500,
+  SWITCH_CAUSE_SYSTEM_SHUTDOWN = 501,
+  SWITCH_CAUSE_LOSE_RACE = 502,
+  SWITCH_CAUSE_MANAGER_REQUEST = 503,
+  SWITCH_CAUSE_BLIND_TRANSFER = 600,
+  SWITCH_CAUSE_ATTENDED_TRANSFER = 601,
+  SWITCH_CAUSE_ALLOTTED_TIMEOUT = 602,
+  SWITCH_CAUSE_USER_CHALLENGE = 603,
+  SWITCH_CAUSE_MEDIA_TIMEOUT = 604,
+  SWITCH_CAUSE_PICKED_OFF = 605,
+  SWITCH_CAUSE_USER_NOT_REGISTERED = 606,
+  SWITCH_CAUSE_PROGRESS_TIMEOUT = 607
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_call_direction_t {
+  SWITCH_CALL_DIRECTION_INBOUND,
+  SWITCH_CALL_DIRECTION_OUTBOUND
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_caller_application : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_caller_application(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_caller_application obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_caller_application() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_caller_application(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string application_name {
+    set {
+      freeswitchPINVOKE.switch_caller_application_application_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_caller_application_application_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string application_data {
+    set {
+      freeswitchPINVOKE.switch_caller_application_application_data_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_caller_application_application_data_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void application_function {
+    set {
+      freeswitchPINVOKE.switch_caller_application_application_function_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_caller_application_application_function_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_q_const__char__void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_caller_application next {
+    set {
+      freeswitchPINVOKE.switch_caller_application_next_set(swigCPtr, switch_caller_application.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_caller_application_next_get(swigCPtr);
+      switch_caller_application ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_application(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_caller_application() : this(freeswitchPINVOKE.new_switch_caller_application(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_caller_extension : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_caller_extension(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_caller_extension obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_caller_extension() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_caller_extension(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string extension_name {
+    set {
+      freeswitchPINVOKE.switch_caller_extension_extension_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_caller_extension_extension_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string extension_number {
+    set {
+      freeswitchPINVOKE.switch_caller_extension_extension_number_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_caller_extension_extension_number_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_caller_application current_application {
+    set {
+      freeswitchPINVOKE.switch_caller_extension_current_application_set(swigCPtr, switch_caller_application.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_caller_extension_current_application_get(swigCPtr);
+      switch_caller_application ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_application(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_caller_application last_application {
+    set {
+      freeswitchPINVOKE.switch_caller_extension_last_application_set(swigCPtr, switch_caller_application.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_caller_extension_last_application_get(swigCPtr);
+      switch_caller_application ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_application(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_caller_application applications {
+    set {
+      freeswitchPINVOKE.switch_caller_extension_applications_set(swigCPtr, switch_caller_application.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_caller_extension_applications_get(swigCPtr);
+      switch_caller_application ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_application(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_caller_profile children {
+    set {
+      freeswitchPINVOKE.switch_caller_extension_children_set(swigCPtr, switch_caller_profile.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_caller_extension_children_get(swigCPtr);
+      switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_caller_extension next {
+    set {
+      freeswitchPINVOKE.switch_caller_extension_next_set(swigCPtr, switch_caller_extension.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_caller_extension_next_get(swigCPtr);
+      switch_caller_extension ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_extension(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_caller_extension() : this(freeswitchPINVOKE.new_switch_caller_extension(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_caller_profile : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_caller_profile(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_caller_profile obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_caller_profile() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_caller_profile(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string username {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_username_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_caller_profile_username_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string dialplan {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_dialplan_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_caller_profile_dialplan_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string caller_id_name {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_caller_id_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_caller_profile_caller_id_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string caller_id_number {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_caller_id_number_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_caller_profile_caller_id_number_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string callee_id_name {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_callee_id_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_caller_profile_callee_id_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string callee_id_number {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_callee_id_number_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_caller_profile_callee_id_number_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public byte caller_ton {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_caller_ton_set(swigCPtr, value);
+    } 
+    get {
+      byte ret = freeswitchPINVOKE.switch_caller_profile_caller_ton_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public byte caller_numplan {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_caller_numplan_set(swigCPtr, value);
+    } 
+    get {
+      byte ret = freeswitchPINVOKE.switch_caller_profile_caller_numplan_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string network_addr {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_network_addr_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_caller_profile_network_addr_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string ani {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_ani_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_caller_profile_ani_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public byte ani_ton {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_ani_ton_set(swigCPtr, value);
+    } 
+    get {
+      byte ret = freeswitchPINVOKE.switch_caller_profile_ani_ton_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public byte ani_numplan {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_ani_numplan_set(swigCPtr, value);
+    } 
+    get {
+      byte ret = freeswitchPINVOKE.switch_caller_profile_ani_numplan_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string aniii {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_aniii_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_caller_profile_aniii_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string rdnis {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_rdnis_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_caller_profile_rdnis_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public byte rdnis_ton {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_rdnis_ton_set(swigCPtr, value);
+    } 
+    get {
+      byte ret = freeswitchPINVOKE.switch_caller_profile_rdnis_ton_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public byte rdnis_numplan {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_rdnis_numplan_set(swigCPtr, value);
+    } 
+    get {
+      byte ret = freeswitchPINVOKE.switch_caller_profile_rdnis_numplan_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string destination_number {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_destination_number_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_caller_profile_destination_number_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public byte destination_number_ton {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_destination_number_ton_set(swigCPtr, value);
+    } 
+    get {
+      byte ret = freeswitchPINVOKE.switch_caller_profile_destination_number_ton_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public byte destination_number_numplan {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_destination_number_numplan_set(swigCPtr, value);
+    } 
+    get {
+      byte ret = freeswitchPINVOKE.switch_caller_profile_destination_number_numplan_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string source {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_source_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_caller_profile_source_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string chan_name {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_chan_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_caller_profile_chan_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string uuid {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_uuid_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_caller_profile_uuid_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string context {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_context_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_caller_profile_context_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string profile_index {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_profile_index_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_caller_profile_profile_index_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint flags {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_flags_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_caller_profile_flags_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_caller_profile originator_caller_profile {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_originator_caller_profile_set(swigCPtr, switch_caller_profile.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_originator_caller_profile_get(swigCPtr);
+      switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_caller_profile originatee_caller_profile {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_originatee_caller_profile_set(swigCPtr, switch_caller_profile.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_originatee_caller_profile_get(swigCPtr);
+      switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_caller_profile hunt_caller_profile {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_hunt_caller_profile_set(swigCPtr, switch_caller_profile.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_hunt_caller_profile_get(swigCPtr);
+      switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_channel_timetable times {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_times_set(swigCPtr, switch_channel_timetable.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_times_get(swigCPtr);
+      switch_channel_timetable ret = (cPtr == IntPtr.Zero) ? null : new switch_channel_timetable(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_caller_extension caller_extension {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_caller_extension_set(swigCPtr, switch_caller_extension.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_caller_extension_get(swigCPtr);
+      switch_caller_extension ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_extension(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_apr_pool_t pool {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_pool_get(swigCPtr);
+      SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_caller_profile next {
+    set {
+      freeswitchPINVOKE.switch_caller_profile_next_set(swigCPtr, switch_caller_profile.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_next_get(swigCPtr);
+      switch_caller_profile ret = (cPtr == IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_caller_profile() : this(freeswitchPINVOKE.new_switch_caller_profile(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_caller_profile_flag_enum_t {
+  SWITCH_CPF_NONE = 0,
+  SWITCH_CPF_SCREEN = (1 << 0),
+  SWITCH_CPF_HIDE_NAME = (1 << 1),
+  SWITCH_CPF_HIDE_NUMBER = (1 << 2)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_channel_app_flag_t {
+  CF_APP_TAGGED = (1 << 0)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_channel_cap_t {
+  CC_MEDIA_ACK = 1,
+  CC_BYPASS_MEDIA,
+  CC_PROXY_MEDIA,
+  CC_FLAG_MAX
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_channel_flag_t {
+  CF_ANSWERED = 1,
+  CF_OUTBOUND,
+  CF_EARLY_MEDIA,
+  CF_BRIDGE_ORIGINATOR,
+  CF_TRANSFER,
+  CF_ACCEPT_CNG,
+  CF_REDIRECT,
+  CF_BRIDGED,
+  CF_HOLD,
+  CF_SERVICE,
+  CF_TAGGED,
+  CF_WINNER,
+  CF_CONTROLLED,
+  CF_PROXY_MODE,
+  CF_SUSPEND,
+  CF_EVENT_PARSE,
+  CF_GEN_RINGBACK,
+  CF_RING_READY,
+  CF_BREAK,
+  CF_BROADCAST,
+  CF_UNICAST,
+  CF_VIDEO,
+  CF_EVENT_LOCK,
+  CF_EVENT_LOCK_PRI,
+  CF_RESET,
+  CF_ORIGINATING,
+  CF_STOP_BROADCAST,
+  CF_PROXY_MEDIA,
+  CF_INNER_BRIDGE,
+  CF_REQ_MEDIA,
+  CF_VERBOSE_EVENTS,
+  CF_PAUSE_BUGS,
+  CF_DIVERT_EVENTS,
+  CF_BLOCK_STATE,
+  CF_FS_RTP,
+  CF_REPORTING,
+  CF_PARK,
+  CF_TIMESTAMP_SET,
+  CF_ORIGINATOR,
+  CF_XFER_ZOMBIE,
+  CF_MEDIA_ACK,
+  CF_THREAD_SLEEPING,
+  CF_DISABLE_RINGBACK,
+  CF_NOT_READY,
+  CF_SIGNAL_BRIDGE_TTL,
+  CF_MEDIA_BRIDGE_TTL,
+  CF_BYPASS_MEDIA_AFTER_BRIDGE,
+  CF_LEG_HOLDING,
+  CF_BROADCAST_DROP_MEDIA,
+  CF_EARLY_HANGUP,
+  CF_MEDIA_SET,
+  CF_FLAG_MAX
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_channel_state_t {
+  CS_NEW,
+  CS_INIT,
+  CS_ROUTING,
+  CS_SOFT_EXECUTE,
+  CS_EXECUTE,
+  CS_EXCHANGE_MEDIA,
+  CS_PARK,
+  CS_CONSUME_MEDIA,
+  CS_HIBERNATE,
+  CS_RESET,
+  CS_HANGUP,
+  CS_REPORTING,
+  CS_DESTROY,
+  CS_NONE
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_channel_timetable : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_channel_timetable(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_channel_timetable obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_channel_timetable() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_channel_timetable(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_switch_time_t profile_created {
+    set {
+      freeswitchPINVOKE.switch_channel_timetable_profile_created_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_channel_timetable_profile_created_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_time_t created {
+    set {
+      freeswitchPINVOKE.switch_channel_timetable_created_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_channel_timetable_created_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_time_t answered {
+    set {
+      freeswitchPINVOKE.switch_channel_timetable_answered_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_channel_timetable_answered_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_time_t progress {
+    set {
+      freeswitchPINVOKE.switch_channel_timetable_progress_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_channel_timetable_progress_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_time_t progress_media {
+    set {
+      freeswitchPINVOKE.switch_channel_timetable_progress_media_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_channel_timetable_progress_media_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_time_t hungup {
+    set {
+      freeswitchPINVOKE.switch_channel_timetable_hungup_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_channel_timetable_hungup_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_time_t transferred {
+    set {
+      freeswitchPINVOKE.switch_channel_timetable_transferred_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_channel_timetable_transferred_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_time_t resurrected {
+    set {
+      freeswitchPINVOKE.switch_channel_timetable_resurrected_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_channel_timetable_resurrected_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public switch_channel_timetable next {
+    set {
+      freeswitchPINVOKE.switch_channel_timetable_next_set(swigCPtr, switch_channel_timetable.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_channel_timetable_next_get(swigCPtr);
+      switch_channel_timetable ret = (cPtr == IntPtr.Zero) ? null : new switch_channel_timetable(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_channel_timetable() : this(freeswitchPINVOKE.new_switch_channel_timetable(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_chat_interface : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_chat_interface(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_chat_interface obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_chat_interface() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_chat_interface(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string interface_name {
+    set {
+      freeswitchPINVOKE.switch_chat_interface_interface_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_chat_interface_interface_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__switch_status_t chat_send {
+    set {
+      freeswitchPINVOKE.switch_chat_interface_chat_send_set(swigCPtr, SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_chat_interface_chat_send_get(swigCPtr);
+      SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char_p_q_const__char__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
+    set {
+      freeswitchPINVOKE.switch_chat_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_chat_interface_rwlock_get(swigCPtr);
+      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public int refs {
+    set {
+      freeswitchPINVOKE.switch_chat_interface_refs_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_chat_interface_refs_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_mutex_t reflock {
+    set {
+      freeswitchPINVOKE.switch_chat_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_chat_interface_reflock_get(swigCPtr);
+      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_loadable_module_interface parent {
+    set {
+      freeswitchPINVOKE.switch_chat_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_chat_interface_parent_get(swigCPtr);
+      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_chat_interface next {
+    set {
+      freeswitchPINVOKE.switch_chat_interface_next_set(swigCPtr, switch_chat_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_chat_interface_next_get(swigCPtr);
+      switch_chat_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_chat_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_chat_interface() : this(freeswitchPINVOKE.new_switch_chat_interface(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_codec : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_codec(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_codec obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_codec() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_codec(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public switch_codec_interface codec_interface {
+    set {
+      freeswitchPINVOKE.switch_codec_codec_interface_set(swigCPtr, switch_codec_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_codec_codec_interface_get(swigCPtr);
+      switch_codec_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_codec_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_codec_implementation implementation {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_set(swigCPtr, switch_codec_implementation.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_codec_implementation_get(swigCPtr);
+      switch_codec_implementation ret = (cPtr == IntPtr.Zero) ? null : new switch_codec_implementation(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public string fmtp_in {
+    set {
+      freeswitchPINVOKE.switch_codec_fmtp_in_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_codec_fmtp_in_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string fmtp_out {
+    set {
+      freeswitchPINVOKE.switch_codec_fmtp_out_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_codec_fmtp_out_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_codec_settings codec_settings {
+    set {
+      freeswitchPINVOKE.switch_codec_codec_settings_set(swigCPtr, switch_codec_settings.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_codec_codec_settings_get(swigCPtr);
+      switch_codec_settings ret = (cPtr == IntPtr.Zero) ? null : new switch_codec_settings(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public uint flags {
+    set {
+      freeswitchPINVOKE.switch_codec_flags_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_codec_flags_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_apr_pool_t memory_pool {
+    set {
+      freeswitchPINVOKE.switch_codec_memory_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_codec_memory_pool_get(swigCPtr);
+      SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_void private_info {
+    set {
+      freeswitchPINVOKE.switch_codec_private_info_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_codec_private_info_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public byte agreed_pt {
+    set {
+      freeswitchPINVOKE.switch_codec_agreed_pt_set(swigCPtr, value);
+    } 
+    get {
+      byte ret = freeswitchPINVOKE.switch_codec_agreed_pt_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_mutex_t mutex {
+    set {
+      freeswitchPINVOKE.switch_codec_mutex_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_codec_mutex_get(swigCPtr);
+      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_codec next {
+    set {
+      freeswitchPINVOKE.switch_codec_next_set(swigCPtr, switch_codec.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_codec_next_get(swigCPtr);
+      switch_codec ret = (cPtr == IntPtr.Zero) ? null : new switch_codec(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_codec() : this(freeswitchPINVOKE.new_switch_codec(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_codec_flag_enum_t {
+  SWITCH_CODEC_FLAG_ENCODE = (1 << 0),
+  SWITCH_CODEC_FLAG_DECODE = (1 << 1),
+  SWITCH_CODEC_FLAG_SILENCE_START = (1 << 2),
+  SWITCH_CODEC_FLAG_SILENCE_STOP = (1 << 3),
+  SWITCH_CODEC_FLAG_SILENCE = (1 << 4),
+  SWITCH_CODEC_FLAG_FREE_POOL = (1 << 5),
+  SWITCH_CODEC_FLAG_AAL2 = (1 << 6),
+  SWITCH_CODEC_FLAG_PASSTHROUGH = (1 << 7),
+  SWITCH_CODEC_FLAG_READY = (1 << 8)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_codec_implementation : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_codec_implementation(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_codec_implementation obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_codec_implementation() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_codec_implementation(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public switch_codec_type_t codec_type {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_codec_type_set(swigCPtr, (int)value);
+    } 
+    get {
+      switch_codec_type_t ret = (switch_codec_type_t)freeswitchPINVOKE.switch_codec_implementation_codec_type_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public byte ianacode {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_ianacode_set(swigCPtr, value);
+    } 
+    get {
+      byte ret = freeswitchPINVOKE.switch_codec_implementation_ianacode_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string iananame {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_iananame_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_codec_implementation_iananame_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string fmtp {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_fmtp_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_codec_implementation_fmtp_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint samples_per_second {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_samples_per_second_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_codec_implementation_samples_per_second_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint actual_samples_per_second {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_actual_samples_per_second_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_codec_implementation_actual_samples_per_second_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int bits_per_second {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_bits_per_second_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_codec_implementation_bits_per_second_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int microseconds_per_packet {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_microseconds_per_packet_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_codec_implementation_microseconds_per_packet_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint samples_per_packet {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_samples_per_packet_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_codec_implementation_samples_per_packet_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint decoded_bytes_per_packet {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_decoded_bytes_per_packet_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_codec_implementation_decoded_bytes_per_packet_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint encoded_bytes_per_packet {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_encoded_bytes_per_packet_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_codec_implementation_encoded_bytes_per_packet_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public byte number_of_channels {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_number_of_channels_set(swigCPtr, value);
+    } 
+    get {
+      byte ret = freeswitchPINVOKE.switch_codec_implementation_number_of_channels_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int codec_frames_per_packet {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_codec_frames_per_packet_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_codec_implementation_codec_frames_per_packet_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t init {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_init_set(swigCPtr, SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_codec_implementation_init_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t encode {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_encode_set(swigCPtr, SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_codec_implementation_encode_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t decode {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_decode_set(swigCPtr, SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_codec_implementation_decode_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_codec__switch_status_t destroy {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_destroy_set(swigCPtr, SWIGTYPE_p_f_p_switch_codec__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_codec_implementation_destroy_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_codec__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_codec__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public uint codec_id {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_codec_id_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_codec_implementation_codec_id_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint impl_id {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_impl_id_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_codec_implementation_impl_id_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_codec_implementation next {
+    set {
+      freeswitchPINVOKE.switch_codec_implementation_next_set(swigCPtr, switch_codec_implementation.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_codec_implementation_next_get(swigCPtr);
+      switch_codec_implementation ret = (cPtr == IntPtr.Zero) ? null : new switch_codec_implementation(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_codec_implementation() : this(freeswitchPINVOKE.new_switch_codec_implementation(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_codec_interface : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_codec_interface(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_codec_interface obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_codec_interface() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_codec_interface(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string interface_name {
+    set {
+      freeswitchPINVOKE.switch_codec_interface_interface_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_codec_interface_interface_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_codec_implementation implementations {
+    set {
+      freeswitchPINVOKE.switch_codec_interface_implementations_set(swigCPtr, switch_codec_implementation.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_codec_interface_implementations_get(swigCPtr);
+      switch_codec_implementation ret = (cPtr == IntPtr.Zero) ? null : new switch_codec_implementation(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public uint codec_id {
+    set {
+      freeswitchPINVOKE.switch_codec_interface_codec_id_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_codec_interface_codec_id_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
+    set {
+      freeswitchPINVOKE.switch_codec_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_codec_interface_rwlock_get(swigCPtr);
+      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public int refs {
+    set {
+      freeswitchPINVOKE.switch_codec_interface_refs_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_codec_interface_refs_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_mutex_t reflock {
+    set {
+      freeswitchPINVOKE.switch_codec_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_codec_interface_reflock_get(swigCPtr);
+      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_loadable_module_interface parent {
+    set {
+      freeswitchPINVOKE.switch_codec_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_codec_interface_parent_get(swigCPtr);
+      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_codec_interface next {
+    set {
+      freeswitchPINVOKE.switch_codec_interface_next_set(swigCPtr, switch_codec_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_codec_interface_next_get(swigCPtr);
+      switch_codec_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_codec_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_codec_interface() : this(freeswitchPINVOKE.new_switch_codec_interface(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_codec_settings : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_codec_settings(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_codec_settings obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_codec_settings() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_codec_settings(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public int quality {
+    set {
+      freeswitchPINVOKE.switch_codec_settings_quality_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_codec_settings_quality_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int complexity {
+    set {
+      freeswitchPINVOKE.switch_codec_settings_complexity_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_codec_settings_complexity_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int enhancement {
+    set {
+      freeswitchPINVOKE.switch_codec_settings_enhancement_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_codec_settings_enhancement_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int vad {
+    set {
+      freeswitchPINVOKE.switch_codec_settings_vad_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_codec_settings_vad_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int vbr {
+    set {
+      freeswitchPINVOKE.switch_codec_settings_vbr_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_codec_settings_vbr_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public float vbr_quality {
+    set {
+      freeswitchPINVOKE.switch_codec_settings_vbr_quality_set(swigCPtr, value);
+    } 
+    get {
+      float ret = freeswitchPINVOKE.switch_codec_settings_vbr_quality_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int abr {
+    set {
+      freeswitchPINVOKE.switch_codec_settings_abr_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_codec_settings_abr_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int dtx {
+    set {
+      freeswitchPINVOKE.switch_codec_settings_dtx_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_codec_settings_dtx_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int preproc {
+    set {
+      freeswitchPINVOKE.switch_codec_settings_preproc_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_codec_settings_preproc_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int pp_vad {
+    set {
+      freeswitchPINVOKE.switch_codec_settings_pp_vad_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_codec_settings_pp_vad_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int pp_agc {
+    set {
+      freeswitchPINVOKE.switch_codec_settings_pp_agc_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_codec_settings_pp_agc_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public float pp_agc_level {
+    set {
+      freeswitchPINVOKE.switch_codec_settings_pp_agc_level_set(swigCPtr, value);
+    } 
+    get {
+      float ret = freeswitchPINVOKE.switch_codec_settings_pp_agc_level_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int pp_denoise {
+    set {
+      freeswitchPINVOKE.switch_codec_settings_pp_denoise_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_codec_settings_pp_denoise_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int pp_dereverb {
+    set {
+      freeswitchPINVOKE.switch_codec_settings_pp_dereverb_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_codec_settings_pp_dereverb_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public float pp_dereverb_decay {
+    set {
+      freeswitchPINVOKE.switch_codec_settings_pp_dereverb_decay_set(swigCPtr, value);
+    } 
+    get {
+      float ret = freeswitchPINVOKE.switch_codec_settings_pp_dereverb_decay_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public float pp_dereverb_level {
+    set {
+      freeswitchPINVOKE.switch_codec_settings_pp_dereverb_level_set(swigCPtr, value);
+    } 
+    get {
+      float ret = freeswitchPINVOKE.switch_codec_settings_pp_dereverb_level_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_codec_settings() : this(freeswitchPINVOKE.new_switch_codec_settings(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_codec_type_t {
+  SWITCH_CODEC_TYPE_AUDIO,
+  SWITCH_CODEC_TYPE_VIDEO,
+  SWITCH_CODEC_TYPE_T38,
+  SWITCH_CODEC_TYPE_APP
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_config : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_config(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_config obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_config() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_config(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_FILE file {
+    set {
+      freeswitchPINVOKE.switch_config_file_set(swigCPtr, SWIGTYPE_p_FILE.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_config_file_get(swigCPtr);
+      SWIGTYPE_p_FILE ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_FILE(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public string path {
+    set {
+      freeswitchPINVOKE.switch_config_path_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_config_path_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string category {
+    set {
+      freeswitchPINVOKE.switch_config_category_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_config_category_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string section {
+    set {
+      freeswitchPINVOKE.switch_config_section_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_config_section_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string buf {
+    set {
+      freeswitchPINVOKE.switch_config_buf_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_config_buf_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int lineno {
+    set {
+      freeswitchPINVOKE.switch_config_lineno_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_config_lineno_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int catno {
+    set {
+      freeswitchPINVOKE.switch_config_catno_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_config_catno_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int sectno {
+    set {
+      freeswitchPINVOKE.switch_config_sectno_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_config_sectno_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int lockto {
+    set {
+      freeswitchPINVOKE.switch_config_lockto_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_config_lockto_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_config() : this(freeswitchPINVOKE.new_switch_config(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_console_callback_match : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_console_callback_match(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_console_callback_match obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_console_callback_match() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_console_callback_match(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public switch_console_callback_match_node head {
+    set {
+      freeswitchPINVOKE.switch_console_callback_match_head_set(swigCPtr, switch_console_callback_match_node.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_console_callback_match_head_get(swigCPtr);
+      switch_console_callback_match_node ret = (cPtr == IntPtr.Zero) ? null : new switch_console_callback_match_node(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_console_callback_match_node end {
+    set {
+      freeswitchPINVOKE.switch_console_callback_match_end_set(swigCPtr, switch_console_callback_match_node.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_console_callback_match_end_get(swigCPtr);
+      switch_console_callback_match_node ret = (cPtr == IntPtr.Zero) ? null : new switch_console_callback_match_node(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public int count {
+    set {
+      freeswitchPINVOKE.switch_console_callback_match_count_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_console_callback_match_count_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int dynamic {
+    set {
+      freeswitchPINVOKE.switch_console_callback_match_dynamic_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_console_callback_match_dynamic_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_console_callback_match() : this(freeswitchPINVOKE.new_switch_console_callback_match(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_console_callback_match_node : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_console_callback_match_node(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_console_callback_match_node obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_console_callback_match_node() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_console_callback_match_node(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string val {
+    set {
+      freeswitchPINVOKE.switch_console_callback_match_node_val_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_console_callback_match_node_val_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_console_callback_match_node next {
+    set {
+      freeswitchPINVOKE.switch_console_callback_match_node_next_set(swigCPtr, switch_console_callback_match_node.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_console_callback_match_node_next_get(swigCPtr);
+      switch_console_callback_match_node ret = (cPtr == IntPtr.Zero) ? null : new switch_console_callback_match_node(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_console_callback_match_node() : this(freeswitchPINVOKE.new_switch_console_callback_match_node(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_core_flag_enum_t {
+  SCF_NONE = 0,
+  SCF_USE_SQL = (1 << 0),
+  SCF_NO_NEW_SESSIONS = (1 << 1),
+  SCF_SHUTTING_DOWN = (1 << 2),
+  SCF_VG = (1 << 3),
+  SCF_RESTART = (1 << 4),
+  SCF_SHUTDOWN_REQUESTED = (1 << 5),
+  SCF_USE_AUTO_NAT = (1 << 6),
+  SCF_EARLY_HANGUP = (1 << 7),
+  SCF_CALIBRATE_CLOCK = (1 << 8),
+  SCF_USE_COND_TIMING = (1 << 9),
+  SCF_USE_CLOCK_RT = (1 << 10)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_core_session_message : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_core_session_message(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_core_session_message obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_core_session_message() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_core_session_message(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string from {
+    set {
+      freeswitchPINVOKE.switch_core_session_message_from_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_core_session_message_from_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_core_session_message_types_t message_id {
+    set {
+      freeswitchPINVOKE.switch_core_session_message_message_id_set(swigCPtr, (int)value);
+    } 
+    get {
+      switch_core_session_message_types_t ret = (switch_core_session_message_types_t)freeswitchPINVOKE.switch_core_session_message_message_id_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int numeric_arg {
+    set {
+      freeswitchPINVOKE.switch_core_session_message_numeric_arg_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_core_session_message_numeric_arg_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string string_arg {
+    set {
+      freeswitchPINVOKE.switch_core_session_message_string_arg_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_core_session_message_string_arg_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t string_arg_size {
+    set {
+      freeswitchPINVOKE.switch_core_session_message_string_arg_size_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_core_session_message_string_arg_size_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_void pointer_arg {
+    set {
+      freeswitchPINVOKE.switch_core_session_message_pointer_arg_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_core_session_message_pointer_arg_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t pointer_arg_size {
+    set {
+      freeswitchPINVOKE.switch_core_session_message_pointer_arg_size_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_core_session_message_pointer_arg_size_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public int numeric_reply {
+    set {
+      freeswitchPINVOKE.switch_core_session_message_numeric_reply_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_core_session_message_numeric_reply_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string string_reply {
+    set {
+      freeswitchPINVOKE.switch_core_session_message_string_reply_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_core_session_message_string_reply_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t string_reply_size {
+    set {
+      freeswitchPINVOKE.switch_core_session_message_string_reply_size_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_core_session_message_string_reply_size_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_void pointer_reply {
+    set {
+      freeswitchPINVOKE.switch_core_session_message_pointer_reply_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_core_session_message_pointer_reply_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t pointer_reply_size {
+    set {
+      freeswitchPINVOKE.switch_core_session_message_pointer_reply_size_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_core_session_message_pointer_reply_size_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public uint flags {
+    set {
+      freeswitchPINVOKE.switch_core_session_message_flags_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_core_session_message_flags_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string _file {
+    set {
+      freeswitchPINVOKE.switch_core_session_message__file_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_core_session_message__file_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string _func {
+    set {
+      freeswitchPINVOKE.switch_core_session_message__func_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_core_session_message__func_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int _line {
+    set {
+      freeswitchPINVOKE.switch_core_session_message__line_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_core_session_message__line_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_p_char string_array_arg {
+    set {
+      freeswitchPINVOKE.switch_core_session_message_string_array_arg_set(swigCPtr, SWIGTYPE_p_p_char.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_core_session_message_string_array_arg_get(swigCPtr);
+      SWIGTYPE_p_p_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_p_char(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_time_t delivery_time {
+    set {
+      freeswitchPINVOKE.switch_core_session_message_delivery_time_set(swigCPtr, SWIGTYPE_p_time_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_time_t ret = new SWIGTYPE_p_time_t(freeswitchPINVOKE.switch_core_session_message_delivery_time_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public switch_core_session_message() : this(freeswitchPINVOKE.new_switch_core_session_message(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_core_session_message_flag_enum_t {
+  SCSMF_DYNAMIC = (1 << 0),
+  SCSMF_FREE_STRING_REPLY = (1 << 1),
+  SCSMF_FREE_POINTER_REPLY = (1 << 2)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_core_session_message_types_t {
+  SWITCH_MESSAGE_REDIRECT_AUDIO,
+  SWITCH_MESSAGE_TRANSMIT_TEXT,
+  SWITCH_MESSAGE_INDICATE_ANSWER,
+  SWITCH_MESSAGE_INDICATE_PROGRESS,
+  SWITCH_MESSAGE_INDICATE_BRIDGE,
+  SWITCH_MESSAGE_INDICATE_UNBRIDGE,
+  SWITCH_MESSAGE_INDICATE_TRANSFER,
+  SWITCH_MESSAGE_INDICATE_RINGING,
+  SWITCH_MESSAGE_INDICATE_MEDIA,
+  SWITCH_MESSAGE_INDICATE_NOMEDIA,
+  SWITCH_MESSAGE_INDICATE_HOLD,
+  SWITCH_MESSAGE_INDICATE_UNHOLD,
+  SWITCH_MESSAGE_INDICATE_REDIRECT,
+  SWITCH_MESSAGE_INDICATE_RESPOND,
+  SWITCH_MESSAGE_INDICATE_BROADCAST,
+  SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT,
+  SWITCH_MESSAGE_INDICATE_DEFLECT,
+  SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ,
+  SWITCH_MESSAGE_INDICATE_DISPLAY,
+  SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY,
+  SWITCH_MESSAGE_INDICATE_AUDIO_SYNC,
+  SWITCH_MESSAGE_INDICATE_REQUEST_IMAGE_MEDIA,
+  SWITCH_MESSAGE_INDICATE_UUID_CHANGE,
+  SWITCH_MESSAGE_INDICATE_SIMPLIFY,
+  SWITCH_MESSAGE_INDICATE_DEBUG_AUDIO,
+  SWITCH_MESSAGE_INDICATE_PROXY_MEDIA,
+  SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC,
+  SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC_COMPLETE,
+  SWITCH_MESSAGE_INVALID
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_core_thread_session : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_core_thread_session(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_core_thread_session obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_core_thread_session() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_core_thread_session(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public int running {
+    set {
+      freeswitchPINVOKE.switch_core_thread_session_running_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_core_thread_session_running_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_mutex_t mutex {
+    set {
+      freeswitchPINVOKE.switch_core_thread_session_mutex_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_core_thread_session_mutex_get(swigCPtr);
+      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_p_void objs {
+    set {
+      freeswitchPINVOKE.switch_core_thread_session_objs_set(swigCPtr, SWIGTYPE_p_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_core_thread_session_objs_get(swigCPtr);
+      SWIGTYPE_p_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t input_callback {
+    set {
+      freeswitchPINVOKE.switch_core_thread_session_input_callback_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_core_thread_session_input_callback_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_apr_pool_t pool {
+    set {
+      freeswitchPINVOKE.switch_core_thread_session_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_core_thread_session_pool_get(swigCPtr);
+      SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_core_thread_session() : this(freeswitchPINVOKE.new_switch_core_thread_session(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_core_time_duration : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_core_time_duration(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_core_time_duration obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_core_time_duration() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_core_time_duration(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public uint mms {
+    set {
+      freeswitchPINVOKE.switch_core_time_duration_mms_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_core_time_duration_mms_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint ms {
+    set {
+      freeswitchPINVOKE.switch_core_time_duration_ms_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_core_time_duration_ms_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint sec {
+    set {
+      freeswitchPINVOKE.switch_core_time_duration_sec_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_core_time_duration_sec_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint min {
+    set {
+      freeswitchPINVOKE.switch_core_time_duration_min_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_core_time_duration_min_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint hr {
+    set {
+      freeswitchPINVOKE.switch_core_time_duration_hr_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_core_time_duration_hr_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint day {
+    set {
+      freeswitchPINVOKE.switch_core_time_duration_day_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_core_time_duration_day_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint yr {
+    set {
+      freeswitchPINVOKE.switch_core_time_duration_yr_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_core_time_duration_yr_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_core_time_duration() : this(freeswitchPINVOKE.new_switch_core_time_duration(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_dialplan_interface : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_dialplan_interface(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_dialplan_interface obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_dialplan_interface() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_dialplan_interface(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string interface_name {
+    set {
+      freeswitchPINVOKE.switch_dialplan_interface_interface_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_dialplan_interface_interface_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension hunt_function {
+    set {
+      freeswitchPINVOKE.switch_dialplan_interface_hunt_function_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_dialplan_interface_hunt_function_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_t_p_void_p_switch_caller_profile_t__p_switch_caller_extension(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
+    set {
+      freeswitchPINVOKE.switch_dialplan_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_dialplan_interface_rwlock_get(swigCPtr);
+      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public int refs {
+    set {
+      freeswitchPINVOKE.switch_dialplan_interface_refs_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_dialplan_interface_refs_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_mutex_t reflock {
+    set {
+      freeswitchPINVOKE.switch_dialplan_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_dialplan_interface_reflock_get(swigCPtr);
+      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_loadable_module_interface parent {
+    set {
+      freeswitchPINVOKE.switch_dialplan_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_dialplan_interface_parent_get(swigCPtr);
+      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_dialplan_interface next {
+    set {
+      freeswitchPINVOKE.switch_dialplan_interface_next_set(swigCPtr, switch_dialplan_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_dialplan_interface_next_get(swigCPtr);
+      switch_dialplan_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_dialplan_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_dialplan_interface() : this(freeswitchPINVOKE.new_switch_dialplan_interface(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_directories : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_directories(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_directories obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_directories() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_directories(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string base_dir {
+    set {
+      freeswitchPINVOKE.switch_directories_base_dir_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_directories_base_dir_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string mod_dir {
+    set {
+      freeswitchPINVOKE.switch_directories_mod_dir_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_directories_mod_dir_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string conf_dir {
+    set {
+      freeswitchPINVOKE.switch_directories_conf_dir_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_directories_conf_dir_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string log_dir {
+    set {
+      freeswitchPINVOKE.switch_directories_log_dir_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_directories_log_dir_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string run_dir {
+    set {
+      freeswitchPINVOKE.switch_directories_run_dir_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_directories_run_dir_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string db_dir {
+    set {
+      freeswitchPINVOKE.switch_directories_db_dir_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_directories_db_dir_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string script_dir {
+    set {
+      freeswitchPINVOKE.switch_directories_script_dir_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_directories_script_dir_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string temp_dir {
+    set {
+      freeswitchPINVOKE.switch_directories_temp_dir_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_directories_temp_dir_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string htdocs_dir {
+    set {
+      freeswitchPINVOKE.switch_directories_htdocs_dir_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_directories_htdocs_dir_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string grammar_dir {
+    set {
+      freeswitchPINVOKE.switch_directories_grammar_dir_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_directories_grammar_dir_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string storage_dir {
+    set {
+      freeswitchPINVOKE.switch_directories_storage_dir_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_directories_storage_dir_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string recordings_dir {
+    set {
+      freeswitchPINVOKE.switch_directories_recordings_dir_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_directories_recordings_dir_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string sounds_dir {
+    set {
+      freeswitchPINVOKE.switch_directories_sounds_dir_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_directories_sounds_dir_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_directories() : this(freeswitchPINVOKE.new_switch_directories(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_directory_flag_enum_t {
+  SWITCH_DIRECTORY_FLAG_FREE_POOL = (1 << 0)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_directory_handle : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_directory_handle(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_directory_handle obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_directory_handle() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_directory_handle(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public switch_directory_interface directory_interface {
+    set {
+      freeswitchPINVOKE.switch_directory_handle_directory_interface_set(swigCPtr, switch_directory_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_directory_handle_directory_interface_get(swigCPtr);
+      switch_directory_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_directory_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public uint flags {
+    set {
+      freeswitchPINVOKE.switch_directory_handle_flags_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_directory_handle_flags_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_apr_pool_t memory_pool {
+    set {
+      freeswitchPINVOKE.switch_directory_handle_memory_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_directory_handle_memory_pool_get(swigCPtr);
+      SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_void private_info {
+    set {
+      freeswitchPINVOKE.switch_directory_handle_private_info_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_directory_handle_private_info_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_directory_handle() : this(freeswitchPINVOKE.new_switch_directory_handle(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_directory_interface : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_directory_interface(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_directory_interface obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_directory_interface() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_directory_interface(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string interface_name {
+    set {
+      freeswitchPINVOKE.switch_directory_interface_interface_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_directory_interface_interface_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t directory_open {
+    set {
+      freeswitchPINVOKE.switch_directory_interface_directory_open_set(swigCPtr, SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_directory_interface_directory_open_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char_p_char__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t directory_close {
+    set {
+      freeswitchPINVOKE.switch_directory_interface_directory_close_set(swigCPtr, SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_directory_interface_directory_close_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t directory_query {
+    set {
+      freeswitchPINVOKE.switch_directory_interface_directory_query_set(swigCPtr, SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_directory_interface_directory_query_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_directory_handle_p_char_p_char__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t directory_next {
+    set {
+      freeswitchPINVOKE.switch_directory_interface_directory_next_set(swigCPtr, SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_directory_interface_directory_next_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_directory_handle__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t directory_next_pair {
+    set {
+      freeswitchPINVOKE.switch_directory_interface_directory_next_pair_set(swigCPtr, SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_directory_interface_directory_next_pair_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_directory_handle_p_p_char_p_p_char__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
+    set {
+      freeswitchPINVOKE.switch_directory_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_directory_interface_rwlock_get(swigCPtr);
+      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public int refs {
+    set {
+      freeswitchPINVOKE.switch_directory_interface_refs_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_directory_interface_refs_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_mutex_t reflock {
+    set {
+      freeswitchPINVOKE.switch_directory_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_directory_interface_reflock_get(swigCPtr);
+      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_loadable_module_interface parent {
+    set {
+      freeswitchPINVOKE.switch_directory_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_directory_interface_parent_get(swigCPtr);
+      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_directory_interface next {
+    set {
+      freeswitchPINVOKE.switch_directory_interface_next_set(swigCPtr, switch_directory_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_directory_interface_next_get(swigCPtr);
+      switch_directory_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_directory_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_directory_interface() : this(freeswitchPINVOKE.new_switch_directory_interface(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_dtmf_direction_t {
+  SWITCH_DTMF_RECV = 0,
+  SWITCH_DTMF_SEND = 1
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_dtmf_t : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_dtmf_t(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_dtmf_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_dtmf_t() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_dtmf_t(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public char digit {
+    set {
+      freeswitchPINVOKE.switch_dtmf_t_digit_set(swigCPtr, value);
+    } 
+    get {
+      char ret = freeswitchPINVOKE.switch_dtmf_t_digit_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint duration {
+    set {
+      freeswitchPINVOKE.switch_dtmf_t_duration_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_dtmf_t_duration_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_dtmf_t() : this(freeswitchPINVOKE.new_switch_dtmf_t(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_eavesdrop_flag_enum_t {
+  ED_MUX_READ = (1 << 0),
+  ED_MUX_WRITE = (1 << 1),
+  ED_DTMF = (1 << 2)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_endpoint_interface : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_endpoint_interface(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_endpoint_interface obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_endpoint_interface() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_endpoint_interface(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string interface_name {
+    set {
+      freeswitchPINVOKE.switch_endpoint_interface_interface_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_endpoint_interface_interface_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_io_routines io_routines {
+    set {
+      freeswitchPINVOKE.switch_endpoint_interface_io_routines_set(swigCPtr, switch_io_routines.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_endpoint_interface_io_routines_get(swigCPtr);
+      switch_io_routines ret = (cPtr == IntPtr.Zero) ? null : new switch_io_routines(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_state_handler_table state_handler {
+    set {
+      freeswitchPINVOKE.switch_endpoint_interface_state_handler_set(swigCPtr, switch_state_handler_table.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_endpoint_interface_state_handler_get(swigCPtr);
+      switch_state_handler_table ret = (cPtr == IntPtr.Zero) ? null : new switch_state_handler_table(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_void private_info {
+    set {
+      freeswitchPINVOKE.switch_endpoint_interface_private_info_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_endpoint_interface_private_info_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
+    set {
+      freeswitchPINVOKE.switch_endpoint_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_endpoint_interface_rwlock_get(swigCPtr);
+      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public int refs {
+    set {
+      freeswitchPINVOKE.switch_endpoint_interface_refs_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_endpoint_interface_refs_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_mutex_t reflock {
+    set {
+      freeswitchPINVOKE.switch_endpoint_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_endpoint_interface_reflock_get(swigCPtr);
+      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_loadable_module_interface parent {
+    set {
+      freeswitchPINVOKE.switch_endpoint_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_endpoint_interface_parent_get(swigCPtr);
+      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_endpoint_interface next {
+    set {
+      freeswitchPINVOKE.switch_endpoint_interface_next_set(swigCPtr, switch_endpoint_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_endpoint_interface_next_get(swigCPtr);
+      switch_endpoint_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_endpoint_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_endpoint_interface() : this(freeswitchPINVOKE.new_switch_endpoint_interface(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_event : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_event(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_event obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_event() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_event(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public switch_event_types_t event_id {
+    set {
+      freeswitchPINVOKE.switch_event_event_id_set(swigCPtr, (int)value);
+    } 
+    get {
+      switch_event_types_t ret = (switch_event_types_t)freeswitchPINVOKE.switch_event_event_id_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_priority_t priority {
+    set {
+      freeswitchPINVOKE.switch_event_priority_set(swigCPtr, (int)value);
+    } 
+    get {
+      switch_priority_t ret = (switch_priority_t)freeswitchPINVOKE.switch_event_priority_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string owner {
+    set {
+      freeswitchPINVOKE.switch_event_owner_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_event_owner_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string subclass_name {
+    set {
+      freeswitchPINVOKE.switch_event_subclass_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_event_subclass_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_event_header headers {
+    set {
+      freeswitchPINVOKE.switch_event_headers_set(swigCPtr, switch_event_header.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_event_headers_get(swigCPtr);
+      switch_event_header ret = (cPtr == IntPtr.Zero) ? null : new switch_event_header(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_event_header last_header {
+    set {
+      freeswitchPINVOKE.switch_event_last_header_set(swigCPtr, switch_event_header.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_event_last_header_get(swigCPtr);
+      switch_event_header ret = (cPtr == IntPtr.Zero) ? null : new switch_event_header(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public string body {
+    set {
+      freeswitchPINVOKE.switch_event_body_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_event_body_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_void bind_user_data {
+    set {
+      freeswitchPINVOKE.switch_event_bind_user_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_event_bind_user_data_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_void event_user_data {
+    set {
+      freeswitchPINVOKE.switch_event_event_user_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_event_event_user_data_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public uint key {
+    set {
+      freeswitchPINVOKE.switch_event_key_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_event_key_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_event next {
+    set {
+      freeswitchPINVOKE.switch_event_next_set(swigCPtr, switch_event.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_event_next_get(swigCPtr);
+      switch_event ret = (cPtr == IntPtr.Zero) ? null : new switch_event(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public int flags {
+    set {
+      freeswitchPINVOKE.switch_event_flags_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_event_flags_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_event() : this(freeswitchPINVOKE.new_switch_event(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_event_flag_t {
+  EF_UNIQ_HEADERS = (1 << 0)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_event_header : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_event_header(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_event_header obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_event_header() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_event_header(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string name {
+    set {
+      freeswitchPINVOKE.switch_event_header_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_event_header_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string value {
+    set {
+      freeswitchPINVOKE.switch_event_header_value_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_event_header_value_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint hash {
+    set {
+      freeswitchPINVOKE.switch_event_header_hash_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_event_header_hash_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_event_header next {
+    set {
+      freeswitchPINVOKE.switch_event_header_next_set(swigCPtr, switch_event_header.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_event_header_next_get(swigCPtr);
+      switch_event_header ret = (cPtr == IntPtr.Zero) ? null : new switch_event_header(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_event_header() : this(freeswitchPINVOKE.new_switch_event_header(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_event_types_t {
+  SWITCH_EVENT_CUSTOM,
+  SWITCH_EVENT_CLONE,
+  SWITCH_EVENT_CHANNEL_CREATE,
+  SWITCH_EVENT_CHANNEL_DESTROY,
+  SWITCH_EVENT_CHANNEL_STATE,
+  SWITCH_EVENT_CHANNEL_ANSWER,
+  SWITCH_EVENT_CHANNEL_HANGUP,
+  SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE,
+  SWITCH_EVENT_CHANNEL_EXECUTE,
+  SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE,
+  SWITCH_EVENT_CHANNEL_BRIDGE,
+  SWITCH_EVENT_CHANNEL_UNBRIDGE,
+  SWITCH_EVENT_CHANNEL_PROGRESS,
+  SWITCH_EVENT_CHANNEL_PROGRESS_MEDIA,
+  SWITCH_EVENT_CHANNEL_OUTGOING,
+  SWITCH_EVENT_CHANNEL_PARK,
+  SWITCH_EVENT_CHANNEL_UNPARK,
+  SWITCH_EVENT_CHANNEL_APPLICATION,
+  SWITCH_EVENT_CHANNEL_ORIGINATE,
+  SWITCH_EVENT_CHANNEL_UUID,
+  SWITCH_EVENT_API,
+  SWITCH_EVENT_LOG,
+  SWITCH_EVENT_INBOUND_CHAN,
+  SWITCH_EVENT_OUTBOUND_CHAN,
+  SWITCH_EVENT_STARTUP,
+  SWITCH_EVENT_SHUTDOWN,
+  SWITCH_EVENT_PUBLISH,
+  SWITCH_EVENT_UNPUBLISH,
+  SWITCH_EVENT_TALK,
+  SWITCH_EVENT_NOTALK,
+  SWITCH_EVENT_SESSION_CRASH,
+  SWITCH_EVENT_MODULE_LOAD,
+  SWITCH_EVENT_MODULE_UNLOAD,
+  SWITCH_EVENT_DTMF,
+  SWITCH_EVENT_MESSAGE,
+  SWITCH_EVENT_PRESENCE_IN,
+  SWITCH_EVENT_NOTIFY_IN,
+  SWITCH_EVENT_PRESENCE_OUT,
+  SWITCH_EVENT_PRESENCE_PROBE,
+  SWITCH_EVENT_MESSAGE_WAITING,
+  SWITCH_EVENT_MESSAGE_QUERY,
+  SWITCH_EVENT_ROSTER,
+  SWITCH_EVENT_CODEC,
+  SWITCH_EVENT_BACKGROUND_JOB,
+  SWITCH_EVENT_DETECTED_SPEECH,
+  SWITCH_EVENT_DETECTED_TONE,
+  SWITCH_EVENT_PRIVATE_COMMAND,
+  SWITCH_EVENT_HEARTBEAT,
+  SWITCH_EVENT_TRAP,
+  SWITCH_EVENT_ADD_SCHEDULE,
+  SWITCH_EVENT_DEL_SCHEDULE,
+  SWITCH_EVENT_EXE_SCHEDULE,
+  SWITCH_EVENT_RE_SCHEDULE,
+  SWITCH_EVENT_RELOADXML,
+  SWITCH_EVENT_NOTIFY,
+  SWITCH_EVENT_SEND_MESSAGE,
+  SWITCH_EVENT_RECV_MESSAGE,
+  SWITCH_EVENT_REQUEST_PARAMS,
+  SWITCH_EVENT_CHANNEL_DATA,
+  SWITCH_EVENT_GENERAL,
+  SWITCH_EVENT_COMMAND,
+  SWITCH_EVENT_SESSION_HEARTBEAT,
+  SWITCH_EVENT_CLIENT_DISCONNECTED,
+  SWITCH_EVENT_SERVER_DISCONNECTED,
+  SWITCH_EVENT_SEND_INFO,
+  SWITCH_EVENT_RECV_INFO,
+  SWITCH_EVENT_CALL_SECURE,
+  SWITCH_EVENT_NAT,
+  SWITCH_EVENT_RECORD_START,
+  SWITCH_EVENT_RECORD_STOP,
+  SWITCH_EVENT_CALL_UPDATE,
+  SWITCH_EVENT_FAILURE,
+  SWITCH_EVENT_SOCKET_DATA,
+  SWITCH_EVENT_ALL
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_file_flag_enum_t {
+  SWITCH_FILE_FLAG_READ = (1 << 0),
+  SWITCH_FILE_FLAG_WRITE = (1 << 1),
+  SWITCH_FILE_FLAG_FREE_POOL = (1 << 2),
+  SWITCH_FILE_DATA_SHORT = (1 << 3),
+  SWITCH_FILE_DATA_INT = (1 << 4),
+  SWITCH_FILE_DATA_FLOAT = (1 << 5),
+  SWITCH_FILE_DATA_DOUBLE = (1 << 6),
+  SWITCH_FILE_DATA_RAW = (1 << 7),
+  SWITCH_FILE_PAUSE = (1 << 8),
+  SWITCH_FILE_NATIVE = (1 << 9),
+  SWITCH_FILE_SEEK = (1 << 10),
+  SWITCH_FILE_OPEN = (1 << 11),
+  SWITCH_FILE_CALLBACK = (1 << 12),
+  SWITCH_FILE_DONE = (1 << 13),
+  SWITCH_FILE_BUFFER_DONE = (1 << 14),
+  SWITCH_FILE_WRITE_APPEND = (1 << 15)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_file_handle : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_file_handle(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_file_handle obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_file_handle() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_file_handle(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public switch_file_interface file_interface {
+    set {
+      freeswitchPINVOKE.switch_file_handle_file_interface_set(swigCPtr, switch_file_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_file_interface_get(swigCPtr);
+      switch_file_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_file_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public uint flags {
+    set {
+      freeswitchPINVOKE.switch_file_handle_flags_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_file_handle_flags_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_file_t fd {
+    set {
+      freeswitchPINVOKE.switch_file_handle_fd_set(swigCPtr, SWIGTYPE_p_switch_file_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_fd_get(swigCPtr);
+      SWIGTYPE_p_switch_file_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_file_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public uint samples {
+    set {
+      freeswitchPINVOKE.switch_file_handle_samples_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_file_handle_samples_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint samplerate {
+    set {
+      freeswitchPINVOKE.switch_file_handle_samplerate_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_file_handle_samplerate_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint native_rate {
+    set {
+      freeswitchPINVOKE.switch_file_handle_native_rate_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_file_handle_native_rate_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public byte channels {
+    set {
+      freeswitchPINVOKE.switch_file_handle_channels_set(swigCPtr, value);
+    } 
+    get {
+      byte ret = freeswitchPINVOKE.switch_file_handle_channels_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint format {
+    set {
+      freeswitchPINVOKE.switch_file_handle_format_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_file_handle_format_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint sections {
+    set {
+      freeswitchPINVOKE.switch_file_handle_sections_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_file_handle_sections_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int seekable {
+    set {
+      freeswitchPINVOKE.switch_file_handle_seekable_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_file_handle_seekable_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t sample_count {
+    set {
+      freeswitchPINVOKE.switch_file_handle_sample_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_file_handle_sample_count_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public int speed {
+    set {
+      freeswitchPINVOKE.switch_file_handle_speed_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_file_handle_speed_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_apr_pool_t memory_pool {
+    set {
+      freeswitchPINVOKE.switch_file_handle_memory_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_memory_pool_get(swigCPtr);
+      SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public uint prebuf {
+    set {
+      freeswitchPINVOKE.switch_file_handle_prebuf_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_file_handle_prebuf_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint interval {
+    set {
+      freeswitchPINVOKE.switch_file_handle_interval_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_file_handle_interval_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_void private_info {
+    set {
+      freeswitchPINVOKE.switch_file_handle_private_info_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_private_info_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public string handler {
+    set {
+      freeswitchPINVOKE.switch_file_handle_handler_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_file_handle_handler_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public long pos {
+    set {
+      freeswitchPINVOKE.switch_file_handle_pos_set(swigCPtr, value);
+    } 
+    get {
+      long ret = freeswitchPINVOKE.switch_file_handle_pos_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_buffer audio_buffer {
+    set {
+      freeswitchPINVOKE.switch_file_handle_audio_buffer_set(swigCPtr, SWIGTYPE_p_switch_buffer.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_audio_buffer_get(swigCPtr);
+      SWIGTYPE_p_switch_buffer ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_buffer(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_buffer sp_audio_buffer {
+    set {
+      freeswitchPINVOKE.switch_file_handle_sp_audio_buffer_set(swigCPtr, SWIGTYPE_p_switch_buffer.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_sp_audio_buffer_get(swigCPtr);
+      SWIGTYPE_p_switch_buffer ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_buffer(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public uint thresh {
+    set {
+      freeswitchPINVOKE.switch_file_handle_thresh_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_file_handle_thresh_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint silence_hits {
+    set {
+      freeswitchPINVOKE.switch_file_handle_silence_hits_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_file_handle_silence_hits_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint offset_pos {
+    set {
+      freeswitchPINVOKE.switch_file_handle_offset_pos_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_file_handle_offset_pos_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t samples_in {
+    set {
+      freeswitchPINVOKE.switch_file_handle_samples_in_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_file_handle_samples_in_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t samples_out {
+    set {
+      freeswitchPINVOKE.switch_file_handle_samples_out_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_file_handle_samples_out_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public int vol {
+    set {
+      freeswitchPINVOKE.switch_file_handle_vol_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_file_handle_vol_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_audio_resampler_t resampler {
+    set {
+      freeswitchPINVOKE.switch_file_handle_resampler_set(swigCPtr, switch_audio_resampler_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_resampler_get(swigCPtr);
+      switch_audio_resampler_t ret = (cPtr == IntPtr.Zero) ? null : new switch_audio_resampler_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_buffer buffer {
+    set {
+      freeswitchPINVOKE.switch_file_handle_buffer_set(swigCPtr, SWIGTYPE_p_switch_buffer.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_buffer_get(swigCPtr);
+      SWIGTYPE_p_switch_buffer ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_buffer(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_unsigned_char dbuf {
+    set {
+      freeswitchPINVOKE.switch_file_handle_dbuf_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_dbuf_get(swigCPtr);
+      SWIGTYPE_p_unsigned_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t dbuflen {
+    set {
+      freeswitchPINVOKE.switch_file_handle_dbuflen_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_file_handle_dbuflen_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_buffer pre_buffer {
+    set {
+      freeswitchPINVOKE.switch_file_handle_pre_buffer_set(swigCPtr, SWIGTYPE_p_switch_buffer.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_pre_buffer_get(swigCPtr);
+      SWIGTYPE_p_switch_buffer ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_buffer(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_unsigned_char pre_buffer_data {
+    set {
+      freeswitchPINVOKE.switch_file_handle_pre_buffer_data_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_pre_buffer_data_get(swigCPtr);
+      SWIGTYPE_p_unsigned_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t pre_buffer_datalen {
+    set {
+      freeswitchPINVOKE.switch_file_handle_pre_buffer_datalen_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_file_handle_pre_buffer_datalen_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public string file {
+    set {
+      freeswitchPINVOKE.switch_file_handle_file_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_file_handle_file_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string func {
+    set {
+      freeswitchPINVOKE.switch_file_handle_func_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_file_handle_func_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int line {
+    set {
+      freeswitchPINVOKE.switch_file_handle_line_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_file_handle_line_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string file_path {
+    set {
+      freeswitchPINVOKE.switch_file_handle_file_path_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_file_handle_file_path_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string spool_path {
+    set {
+      freeswitchPINVOKE.switch_file_handle_spool_path_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_file_handle_spool_path_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string prefix {
+    set {
+      freeswitchPINVOKE.switch_file_handle_prefix_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_file_handle_prefix_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_file_handle() : this(freeswitchPINVOKE.new_switch_file_handle(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_file_interface : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_file_interface(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_file_interface obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_file_interface() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_file_interface(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string interface_name {
+    set {
+      freeswitchPINVOKE.switch_file_interface_interface_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_file_interface_interface_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t file_open {
+    set {
+      freeswitchPINVOKE.switch_file_interface_file_open_set(swigCPtr, SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_file_open_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_file_handle_p_q_const__char__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_file_handle__switch_status_t file_close {
+    set {
+      freeswitchPINVOKE.switch_file_interface_file_close_set(swigCPtr, SWIGTYPE_p_f_p_switch_file_handle__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_file_close_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_file_handle__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_file_handle__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t file_truncate {
+    set {
+      freeswitchPINVOKE.switch_file_interface_file_truncate_set(swigCPtr, SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_file_truncate_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_file_handle_long_long__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t file_read {
+    set {
+      freeswitchPINVOKE.switch_file_interface_file_read_set(swigCPtr, SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_file_read_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t file_write {
+    set {
+      freeswitchPINVOKE.switch_file_interface_file_write_set(swigCPtr, SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_file_write_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_file_handle_p_void_p_switch_size_t__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t file_seek {
+    set {
+      freeswitchPINVOKE.switch_file_interface_file_seek_set(swigCPtr, SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_file_seek_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_file_handle_p_unsigned_int_long_long_int__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t file_set_string {
+    set {
+      freeswitchPINVOKE.switch_file_interface_file_set_string_set(swigCPtr, SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_file_set_string_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_q_const__char__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t file_get_string {
+    set {
+      freeswitchPINVOKE.switch_file_interface_file_get_string_set(swigCPtr, SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_file_get_string_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_file_handle_enum_switch_audio_col_t_p_p_q_const__char__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public string extens {
+  set { freeswitchPINVOKE.switch_file_interface_extens_set(swigCPtr, ref value); }
+
+  get {
+    return freeswitchPINVOKE.switch_file_interface_extens_get(swigCPtr);
+  }
+
+  }
+
+  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
+    set {
+      freeswitchPINVOKE.switch_file_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_rwlock_get(swigCPtr);
+      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public int refs {
+    set {
+      freeswitchPINVOKE.switch_file_interface_refs_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_file_interface_refs_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_mutex_t reflock {
+    set {
+      freeswitchPINVOKE.switch_file_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_reflock_get(swigCPtr);
+      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_loadable_module_interface parent {
+    set {
+      freeswitchPINVOKE.switch_file_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_parent_get(swigCPtr);
+      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_file_interface next {
+    set {
+      freeswitchPINVOKE.switch_file_interface_next_set(swigCPtr, switch_file_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_file_interface_next_get(swigCPtr);
+      switch_file_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_file_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_file_interface() : this(freeswitchPINVOKE.new_switch_file_interface(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_frame : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_frame(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_frame obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_frame() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_frame(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public switch_codec codec {
+    set {
+      freeswitchPINVOKE.switch_frame_codec_set(swigCPtr, switch_codec.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_frame_codec_get(swigCPtr);
+      switch_codec ret = (cPtr == IntPtr.Zero) ? null : new switch_codec(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public string source {
+    set {
+      freeswitchPINVOKE.switch_frame_source_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_frame_source_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_void packet {
+    set {
+      freeswitchPINVOKE.switch_frame_packet_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_frame_packet_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public uint packetlen {
+    set {
+      freeswitchPINVOKE.switch_frame_packetlen_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_frame_packetlen_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_void extra_data {
+    set {
+      freeswitchPINVOKE.switch_frame_extra_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_frame_extra_data_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_void data {
+    set {
+      freeswitchPINVOKE.switch_frame_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_frame_data_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public uint datalen {
+    set {
+      freeswitchPINVOKE.switch_frame_datalen_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_frame_datalen_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint buflen {
+    set {
+      freeswitchPINVOKE.switch_frame_buflen_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_frame_buflen_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint samples {
+    set {
+      freeswitchPINVOKE.switch_frame_samples_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_frame_samples_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint rate {
+    set {
+      freeswitchPINVOKE.switch_frame_rate_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_frame_rate_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public byte payload {
+    set {
+      freeswitchPINVOKE.switch_frame_payload_set(swigCPtr, value);
+    } 
+    get {
+      byte ret = freeswitchPINVOKE.switch_frame_payload_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t timestamp {
+    set {
+      freeswitchPINVOKE.switch_frame_timestamp_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_frame_timestamp_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public ushort seq {
+    set {
+      freeswitchPINVOKE.switch_frame_seq_set(swigCPtr, value);
+    } 
+    get {
+      ushort ret = freeswitchPINVOKE.switch_frame_seq_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint ssrc {
+    set {
+      freeswitchPINVOKE.switch_frame_ssrc_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_frame_ssrc_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_bool_t m {
+    set {
+      freeswitchPINVOKE.switch_frame_m_set(swigCPtr, (int)value);
+    } 
+    get {
+      switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_frame_m_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint flags {
+    set {
+      freeswitchPINVOKE.switch_frame_flags_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_frame_flags_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_frame() : this(freeswitchPINVOKE.new_switch_frame(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_frame_flag_enum_t {
+  SFF_NONE = 0,
+  SFF_CNG = (1 << 0),
+  SFF_RAW_RTP = (1 << 1),
+  SFF_RTP_HEADER = (1 << 2),
+  SFF_PLC = (1 << 3),
+  SFF_RFC2833 = (1 << 4),
+  SFF_PROXY_PACKET = (1 << 5),
+  SFF_DYNAMIC = (1 << 6),
+  SFF_ZRTP = (1 << 7)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_input_args_t : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_input_args_t(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_input_args_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_input_args_t() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_input_args_t(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t input_callback {
+    set {
+      freeswitchPINVOKE.switch_input_args_t_input_callback_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_input_args_t_input_callback_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_void_enum_switch_input_type_t_p_void_unsigned_int__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_void buf {
+    set {
+      freeswitchPINVOKE.switch_input_args_t_buf_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_input_args_t_buf_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public uint buflen {
+    set {
+      freeswitchPINVOKE.switch_input_args_t_buflen_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_input_args_t_buflen_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t read_frame_callback {
+    set {
+      freeswitchPINVOKE.switch_input_args_t_read_frame_callback_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_input_args_t_read_frame_callback_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_p_void__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_void user_data {
+    set {
+      freeswitchPINVOKE.switch_input_args_t_user_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_input_args_t_user_data_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_input_args_t() : this(freeswitchPINVOKE.new_switch_input_args_t(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_input_type_t {
+  SWITCH_INPUT_TYPE_DTMF,
+  SWITCH_INPUT_TYPE_EVENT
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_io_event_hook_kill_channel : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_io_event_hook_kill_channel(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_io_event_hook_kill_channel obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_io_event_hook_kill_channel() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_io_event_hook_kill_channel(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t kill_channel {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_kill_channel_kill_channel_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_kill_channel_kill_channel_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_kill_channel next {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_kill_channel_next_set(swigCPtr, switch_io_event_hook_kill_channel.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_kill_channel_next_get(swigCPtr);
+      switch_io_event_hook_kill_channel ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_kill_channel(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_kill_channel() : this(freeswitchPINVOKE.new_switch_io_event_hook_kill_channel(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_io_event_hook_outgoing_channel : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_io_event_hook_outgoing_channel(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_io_event_hook_outgoing_channel obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_io_event_hook_outgoing_channel() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_io_event_hook_outgoing_channel(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t outgoing_channel {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_outgoing_channel_outgoing_channel_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_outgoing_channel_outgoing_channel_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_outgoing_channel next {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_outgoing_channel_next_set(swigCPtr, switch_io_event_hook_outgoing_channel.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_outgoing_channel_next_get(swigCPtr);
+      switch_io_event_hook_outgoing_channel ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_outgoing_channel(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_outgoing_channel() : this(freeswitchPINVOKE.new_switch_io_event_hook_outgoing_channel(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_io_event_hook_read_frame : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_io_event_hook_read_frame(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_io_event_hook_read_frame obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_io_event_hook_read_frame() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_io_event_hook_read_frame(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t read_frame {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_read_frame_read_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_read_frame_read_frame_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_read_frame next {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_read_frame_next_set(swigCPtr, switch_io_event_hook_read_frame.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_read_frame_next_get(swigCPtr);
+      switch_io_event_hook_read_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_read_frame(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_read_frame() : this(freeswitchPINVOKE.new_switch_io_event_hook_read_frame(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_io_event_hook_receive_event : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_io_event_hook_receive_event(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_io_event_hook_receive_event obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_io_event_hook_receive_event() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_io_event_hook_receive_event(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t receive_event {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_receive_event_receive_event_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_receive_event_receive_event_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_receive_event next {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_receive_event_next_set(swigCPtr, switch_io_event_hook_receive_event.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_receive_event_next_get(swigCPtr);
+      switch_io_event_hook_receive_event ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_receive_event(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_receive_event() : this(freeswitchPINVOKE.new_switch_io_event_hook_receive_event(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_io_event_hook_receive_message : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_io_event_hook_receive_message(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_io_event_hook_receive_message obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_io_event_hook_receive_message() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_io_event_hook_receive_message(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t receive_message {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_receive_message_receive_message_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_receive_message_receive_message_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_receive_message next {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_receive_message_next_set(swigCPtr, switch_io_event_hook_receive_message.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_receive_message_next_get(swigCPtr);
+      switch_io_event_hook_receive_message ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_receive_message(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_receive_message() : this(freeswitchPINVOKE.new_switch_io_event_hook_receive_message(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_io_event_hook_recv_dtmf : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_io_event_hook_recv_dtmf(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_io_event_hook_recv_dtmf obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_io_event_hook_recv_dtmf() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_io_event_hook_recv_dtmf(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t recv_dtmf {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_recv_dtmf_recv_dtmf_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_recv_dtmf_recv_dtmf_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_recv_dtmf next {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_recv_dtmf_next_set(swigCPtr, switch_io_event_hook_recv_dtmf.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_recv_dtmf_next_get(swigCPtr);
+      switch_io_event_hook_recv_dtmf ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_recv_dtmf(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_recv_dtmf() : this(freeswitchPINVOKE.new_switch_io_event_hook_recv_dtmf(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_io_event_hook_resurrect_session : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_io_event_hook_resurrect_session(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_io_event_hook_resurrect_session obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_io_event_hook_resurrect_session() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_io_event_hook_resurrect_session(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t resurrect_session {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_resurrect_session_resurrect_session_set(swigCPtr, SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_resurrect_session_resurrect_session_get(swigCPtr);
+      SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_resurrect_session next {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_resurrect_session_next_set(swigCPtr, switch_io_event_hook_resurrect_session.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_resurrect_session_next_get(swigCPtr);
+      switch_io_event_hook_resurrect_session ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_resurrect_session(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_resurrect_session() : this(freeswitchPINVOKE.new_switch_io_event_hook_resurrect_session(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_io_event_hooks : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_io_event_hooks(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_io_event_hooks obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_io_event_hooks() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_io_event_hooks(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public switch_io_event_hook_outgoing_channel outgoing_channel {
+    set {
+      freeswitchPINVOKE.switch_io_event_hooks_outgoing_channel_set(swigCPtr, switch_io_event_hook_outgoing_channel.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_outgoing_channel_get(swigCPtr);
+      switch_io_event_hook_outgoing_channel ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_outgoing_channel(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_receive_message receive_message {
+    set {
+      freeswitchPINVOKE.switch_io_event_hooks_receive_message_set(swigCPtr, switch_io_event_hook_receive_message.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_receive_message_get(swigCPtr);
+      switch_io_event_hook_receive_message ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_receive_message(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_receive_event receive_event {
+    set {
+      freeswitchPINVOKE.switch_io_event_hooks_receive_event_set(swigCPtr, switch_io_event_hook_receive_event.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_receive_event_get(swigCPtr);
+      switch_io_event_hook_receive_event ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_receive_event(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_read_frame read_frame {
+    set {
+      freeswitchPINVOKE.switch_io_event_hooks_read_frame_set(swigCPtr, switch_io_event_hook_read_frame.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_read_frame_get(swigCPtr);
+      switch_io_event_hook_read_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_read_frame(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_video_read_frame video_read_frame {
+    set {
+      freeswitchPINVOKE.switch_io_event_hooks_video_read_frame_set(swigCPtr, switch_io_event_hook_video_read_frame.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_video_read_frame_get(swigCPtr);
+      switch_io_event_hook_video_read_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_video_read_frame(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_write_frame write_frame {
+    set {
+      freeswitchPINVOKE.switch_io_event_hooks_write_frame_set(swigCPtr, switch_io_event_hook_write_frame.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_write_frame_get(swigCPtr);
+      switch_io_event_hook_write_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_write_frame(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_video_write_frame video_write_frame {
+    set {
+      freeswitchPINVOKE.switch_io_event_hooks_video_write_frame_set(swigCPtr, switch_io_event_hook_video_write_frame.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_video_write_frame_get(swigCPtr);
+      switch_io_event_hook_video_write_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_video_write_frame(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_kill_channel kill_channel {
+    set {
+      freeswitchPINVOKE.switch_io_event_hooks_kill_channel_set(swigCPtr, switch_io_event_hook_kill_channel.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_kill_channel_get(swigCPtr);
+      switch_io_event_hook_kill_channel ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_kill_channel(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_send_dtmf send_dtmf {
+    set {
+      freeswitchPINVOKE.switch_io_event_hooks_send_dtmf_set(swigCPtr, switch_io_event_hook_send_dtmf.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_send_dtmf_get(swigCPtr);
+      switch_io_event_hook_send_dtmf ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_send_dtmf(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_recv_dtmf recv_dtmf {
+    set {
+      freeswitchPINVOKE.switch_io_event_hooks_recv_dtmf_set(swigCPtr, switch_io_event_hook_recv_dtmf.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_recv_dtmf_get(swigCPtr);
+      switch_io_event_hook_recv_dtmf ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_recv_dtmf(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_state_change state_change {
+    set {
+      freeswitchPINVOKE.switch_io_event_hooks_state_change_set(swigCPtr, switch_io_event_hook_state_change.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_state_change_get(swigCPtr);
+      switch_io_event_hook_state_change ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_state_change(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_resurrect_session resurrect_session {
+    set {
+      freeswitchPINVOKE.switch_io_event_hooks_resurrect_session_set(swigCPtr, switch_io_event_hook_resurrect_session.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hooks_resurrect_session_get(swigCPtr);
+      switch_io_event_hook_resurrect_session ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_resurrect_session(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hooks() : this(freeswitchPINVOKE.new_switch_io_event_hooks(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_io_event_hook_send_dtmf : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_io_event_hook_send_dtmf(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_io_event_hook_send_dtmf obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_io_event_hook_send_dtmf() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_io_event_hook_send_dtmf(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t send_dtmf {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_send_dtmf_send_dtmf_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_send_dtmf_send_dtmf_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t_enum_switch_dtmf_direction_t__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_send_dtmf next {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_send_dtmf_next_set(swigCPtr, switch_io_event_hook_send_dtmf.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_send_dtmf_next_get(swigCPtr);
+      switch_io_event_hook_send_dtmf ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_send_dtmf(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_send_dtmf() : this(freeswitchPINVOKE.new_switch_io_event_hook_send_dtmf(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_io_event_hook_state_change : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_io_event_hook_state_change(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_io_event_hook_state_change obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_io_event_hook_state_change() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_io_event_hook_state_change(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t state_change {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_state_change_state_change_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_state_change_state_change_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_state_change next {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_state_change_next_set(swigCPtr, switch_io_event_hook_state_change.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_state_change_next_get(swigCPtr);
+      switch_io_event_hook_state_change ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_state_change(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_state_change() : this(freeswitchPINVOKE.new_switch_io_event_hook_state_change(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_io_event_hook_video_read_frame : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_io_event_hook_video_read_frame(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_io_event_hook_video_read_frame obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_io_event_hook_video_read_frame() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_io_event_hook_video_read_frame(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t video_read_frame {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_video_read_frame_video_read_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_video_read_frame_video_read_frame_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_video_read_frame next {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_video_read_frame_next_set(swigCPtr, switch_io_event_hook_video_read_frame.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_video_read_frame_next_get(swigCPtr);
+      switch_io_event_hook_video_read_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_video_read_frame(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_video_read_frame() : this(freeswitchPINVOKE.new_switch_io_event_hook_video_read_frame(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_io_event_hook_video_write_frame : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_io_event_hook_video_write_frame(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_io_event_hook_video_write_frame obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_io_event_hook_video_write_frame() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_io_event_hook_video_write_frame(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t video_write_frame {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_video_write_frame_video_write_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_video_write_frame_video_write_frame_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_video_write_frame next {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_video_write_frame_next_set(swigCPtr, switch_io_event_hook_video_write_frame.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_video_write_frame_next_get(swigCPtr);
+      switch_io_event_hook_video_write_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_video_write_frame(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_video_write_frame() : this(freeswitchPINVOKE.new_switch_io_event_hook_video_write_frame(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_io_event_hook_write_frame : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_io_event_hook_write_frame(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_io_event_hook_write_frame obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_io_event_hook_write_frame() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_io_event_hook_write_frame(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t write_frame {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_write_frame_write_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_write_frame_write_frame_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_write_frame next {
+    set {
+      freeswitchPINVOKE.switch_io_event_hook_write_frame_next_set(swigCPtr, switch_io_event_hook_write_frame.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_event_hook_write_frame_next_get(swigCPtr);
+      switch_io_event_hook_write_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_io_event_hook_write_frame(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_event_hook_write_frame() : this(freeswitchPINVOKE.new_switch_io_event_hook_write_frame(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_io_flag_enum_t {
+  SWITCH_IO_FLAG_NONE = 0,
+  SWITCH_IO_FLAG_NOBLOCK = (1 << 0)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_io_routine_name_t {
+  SWITCH_IO_OUTGOING_CHANNEL,
+  SWITCH_IO_READ_FRAME,
+  SWITCH_IO_WRITE_FRAME,
+  SWITCH_IO_KILL_CHANNEL,
+  SWITCH_IO_SEND_DTMF,
+  SWITCH_IO_RECEIVE_MESSAGE,
+  SWITCH_IO_RECEIVE_EVENT,
+  SWITCH_IO_STATE_CHANGE,
+  SWITCH_IO_READ_VIDEO_FRAME,
+  SWITCH_IO_WRITE_VIDEO_FRAME,
+  SWITCH_IO_RESURRECT_SESSION
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_io_routines : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_io_routines(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_io_routines obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_io_routines() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_io_routines(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t outgoing_channel {
+    set {
+      freeswitchPINVOKE.switch_io_routines_outgoing_channel_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_outgoing_channel_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t read_frame {
+    set {
+      freeswitchPINVOKE.switch_io_routines_read_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_read_frame_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t write_frame {
+    set {
+      freeswitchPINVOKE.switch_io_routines_write_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_write_frame_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t kill_channel {
+    set {
+      freeswitchPINVOKE.switch_io_routines_kill_channel_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_kill_channel_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_int__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t send_dtmf {
+    set {
+      freeswitchPINVOKE.switch_io_routines_send_dtmf_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_send_dtmf_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_q_const__switch_dtmf_t__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t receive_message {
+    set {
+      freeswitchPINVOKE.switch_io_routines_receive_message_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_receive_message_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_core_session_message__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t receive_event {
+    set {
+      freeswitchPINVOKE.switch_io_routines_receive_event_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_receive_event_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t state_change {
+    set {
+      freeswitchPINVOKE.switch_io_routines_state_change_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_state_change_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t read_video_frame {
+    set {
+      freeswitchPINVOKE.switch_io_routines_read_video_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_read_video_frame_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t write_video_frame {
+    set {
+      freeswitchPINVOKE.switch_io_routines_write_video_frame_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_write_video_frame_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_frame_unsigned_long_int__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t resurrect_session {
+    set {
+      freeswitchPINVOKE.switch_io_routines_resurrect_session_set(swigCPtr, SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_resurrect_session_get(swigCPtr);
+      SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_p_switch_core_session_p_p_apr_pool_t_p_void__switch_call_cause_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_p_void padding {
+    set {
+      freeswitchPINVOKE.switch_io_routines_padding_set(swigCPtr, SWIGTYPE_p_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_padding_get(swigCPtr);
+      SWIGTYPE_p_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_io_routines() : this(freeswitchPINVOKE.new_switch_io_routines(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_ivr_action_t {
+  SWITCH_IVR_ACTION_DIE,
+  SWITCH_IVR_ACTION_EXECMENU,
+  SWITCH_IVR_ACTION_EXECAPP,
+  SWITCH_IVR_ACTION_PLAYSOUND,
+  SWITCH_IVR_ACTION_BACK,
+  SWITCH_IVR_ACTION_TOMAIN,
+  SWITCH_IVR_ACTION_NOOP
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_ivr_menu_flags {
+  SWITCH_IVR_MENU_FLAG_FALLTOMAIN = (1 << 0),
+  SWITCH_IVR_MENU_FLAG_FREEPOOL = (1 << 1),
+  SWITCH_IVR_MENU_FLAG_STACK = (1 << 2)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_ivr_option_enum_t {
+  SWITCH_IVR_OPTION_NONE = 0,
+  SWITCH_IVR_OPTION_ASYNC = (1 << 0),
+  SWITCH_IVR_OPTION_FILE = (1 << 1)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_loadable_module_function_table_t : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_loadable_module_function_table_t(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_loadable_module_function_table_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_loadable_module_function_table_t() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_loadable_module_function_table_t(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public int switch_api_version {
+    set {
+      freeswitchPINVOKE.switch_loadable_module_function_table_t_switch_api_version_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_loadable_module_function_table_t_switch_api_version_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t load {
+    set {
+      freeswitchPINVOKE.switch_loadable_module_function_table_t_load_set(swigCPtr, SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_function_table_t_load_get(swigCPtr);
+      SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_void__switch_status_t shutdown {
+    set {
+      freeswitchPINVOKE.switch_loadable_module_function_table_t_shutdown_set(swigCPtr, SWIGTYPE_p_f_void__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_function_table_t_shutdown_get(swigCPtr);
+      SWIGTYPE_p_f_void__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_void__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_void__switch_status_t runtime {
+    set {
+      freeswitchPINVOKE.switch_loadable_module_function_table_t_runtime_set(swigCPtr, SWIGTYPE_p_f_void__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_function_table_t_runtime_get(swigCPtr);
+      SWIGTYPE_p_f_void__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_void__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public uint flags {
+    set {
+      freeswitchPINVOKE.switch_loadable_module_function_table_t_flags_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_loadable_module_function_table_t_flags_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_loadable_module_function_table_t() : this(freeswitchPINVOKE.new_switch_loadable_module_function_table_t(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_log_level_t {
+  SWITCH_LOG_DEBUG10 = 110,
+  SWITCH_LOG_DEBUG9 = 109,
+  SWITCH_LOG_DEBUG8 = 108,
+  SWITCH_LOG_DEBUG7 = 107,
+  SWITCH_LOG_DEBUG6 = 106,
+  SWITCH_LOG_DEBUG5 = 105,
+  SWITCH_LOG_DEBUG4 = 104,
+  SWITCH_LOG_DEBUG3 = 103,
+  SWITCH_LOG_DEBUG2 = 102,
+  SWITCH_LOG_DEBUG1 = 101,
+  SWITCH_LOG_DEBUG = 7,
+  SWITCH_LOG_INFO = 6,
+  SWITCH_LOG_NOTICE = 5,
+  SWITCH_LOG_WARNING = 4,
+  SWITCH_LOG_ERROR = 3,
+  SWITCH_LOG_CRIT = 2,
+  SWITCH_LOG_ALERT = 1,
+  SWITCH_LOG_CONSOLE = 0,
+  SWITCH_LOG_INVALID = 64
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_log_node_t : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_log_node_t(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_log_node_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_log_node_t() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_log_node_t(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string data {
+    set {
+      freeswitchPINVOKE.switch_log_node_t_data_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_log_node_t_data_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string file {
+    set {
+      freeswitchPINVOKE.switch_log_node_t_file_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_log_node_t_file_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint line {
+    set {
+      freeswitchPINVOKE.switch_log_node_t_line_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_log_node_t_line_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string func {
+    set {
+      freeswitchPINVOKE.switch_log_node_t_func_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_log_node_t_func_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_log_level_t level {
+    set {
+      freeswitchPINVOKE.switch_log_node_t_level_set(swigCPtr, (int)value);
+    } 
+    get {
+      switch_log_level_t ret = (switch_log_level_t)freeswitchPINVOKE.switch_log_node_t_level_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_time_t timestamp {
+    set {
+      freeswitchPINVOKE.switch_log_node_t_timestamp_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_log_node_t_timestamp_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public string content {
+    set {
+      freeswitchPINVOKE.switch_log_node_t_content_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_log_node_t_content_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string userdata {
+    set {
+      freeswitchPINVOKE.switch_log_node_t_userdata_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_log_node_t_userdata_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_text_channel_t channel {
+    set {
+      freeswitchPINVOKE.switch_log_node_t_channel_set(swigCPtr, (int)value);
+    } 
+    get {
+      switch_text_channel_t ret = (switch_text_channel_t)freeswitchPINVOKE.switch_log_node_t_channel_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_log_node_t() : this(freeswitchPINVOKE.new_switch_log_node_t(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_management_action_t {
+  SMA_NONE,
+  SMA_GET,
+  SMA_SET
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_management_interface : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_management_interface(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_management_interface obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_management_interface() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_management_interface(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string relative_oid {
+    set {
+      freeswitchPINVOKE.switch_management_interface_relative_oid_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_management_interface_relative_oid_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t management_function {
+    set {
+      freeswitchPINVOKE.switch_management_interface_management_function_set(swigCPtr, SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_management_interface_management_function_get(swigCPtr);
+      SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_char_enum_switch_management_action_t_p_char_switch_size_t__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
+    set {
+      freeswitchPINVOKE.switch_management_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_management_interface_rwlock_get(swigCPtr);
+      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public int refs {
+    set {
+      freeswitchPINVOKE.switch_management_interface_refs_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_management_interface_refs_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_mutex_t reflock {
+    set {
+      freeswitchPINVOKE.switch_management_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_management_interface_reflock_get(swigCPtr);
+      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_loadable_module_interface parent {
+    set {
+      freeswitchPINVOKE.switch_management_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_management_interface_parent_get(swigCPtr);
+      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_management_interface next {
+    set {
+      freeswitchPINVOKE.switch_management_interface_next_set(swigCPtr, switch_management_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_management_interface_next_get(swigCPtr);
+      switch_management_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_management_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_management_interface() : this(freeswitchPINVOKE.new_switch_management_interface(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_media_bug_flag_enum_t {
+  SMBF_BOTH = 0,
+  SMBF_READ_STREAM = (1 << 0),
+  SMBF_WRITE_STREAM = (1 << 1),
+  SMBF_WRITE_REPLACE = (1 << 2),
+  SMBF_READ_REPLACE = (1 << 3),
+  SMBF_READ_PING = (1 << 4),
+  SMBF_STEREO = (1 << 5),
+  SMBF_ANSWER_REQ = (1 << 6),
+  SMBF_THREAD_LOCK = (1 << 7),
+  SMBF_PRUNE = (1 << 8)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_media_flag_enum_t {
+  SMF_NONE = 0,
+  SMF_REBRIDGE = (1 << 0),
+  SMF_ECHO_ALEG = (1 << 1),
+  SMF_ECHO_BLEG = (1 << 2),
+  SMF_FORCE = (1 << 3),
+  SMF_LOOP = (1 << 4),
+  SMF_HOLD_BLEG = (1 << 5),
+  SMF_IMMEDIATE = (1 << 6),
+  SMF_EXEC_INLINE = (1 << 7),
+  SMF_PRIORITY = (1 << 8)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_module_flag_enum_t {
+  SMODF_NONE = 0,
+  SMODF_GLOBAL_SYMBOLS = (1 << 0)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_module_interface_name_t {
+  SWITCH_ENDPOINT_INTERFACE,
+  SWITCH_TIMER_INTERFACE,
+  SWITCH_DIALPLAN_INTERFACE,
+  SWITCH_CODEC_INTERFACE,
+  SWITCH_APPLICATION_INTERFACE,
+  SWITCH_API_INTERFACE,
+  SWITCH_FILE_INTERFACE,
+  SWITCH_SPEECH_INTERFACE,
+  SWITCH_DIRECTORY_INTERFACE,
+  SWITCH_CHAT_INTERFACE,
+  SWITCH_SAY_INTERFACE,
+  SWITCH_ASR_INTERFACE,
+  SWITCH_MANAGEMENT_INTERFACE
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_originate_flag_enum_t {
+  SOF_NONE = 0,
+  SOF_NOBLOCK = (1 << 0),
+  SOF_FORKED_DIAL = (1 << 1),
+  SOF_NO_EFFECTIVE_CID_NUM = (1 << 2),
+  SOF_NO_EFFECTIVE_CID_NAME = (1 << 3)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_port_flag_enum_t {
+  SPF_NONE = 0,
+  SPF_ODD = (1 << 0),
+  SPF_EVEN = (1 << 1)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_priority_t {
+  SWITCH_PRIORITY_NORMAL,
+  SWITCH_PRIORITY_LOW,
+  SWITCH_PRIORITY_HIGH
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_rtp_bug_flag_t {
+  RTP_BUG_NONE = 0,
+  RTP_BUG_CISCO_SKIP_MARK_BIT_2833 = (1 << 0),
+  RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833 = (1 << 1)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_rtp_crypto_direction_t {
+  SWITCH_RTP_CRYPTO_SEND,
+  SWITCH_RTP_CRYPTO_RECV,
+  SWITCH_RTP_CRYPTO_MAX
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_rtp_crypto_key : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_rtp_crypto_key(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_rtp_crypto_key obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_rtp_crypto_key() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_rtp_crypto_key(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public uint index {
+    set {
+      freeswitchPINVOKE.switch_rtp_crypto_key_index_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_rtp_crypto_key_index_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_rtp_crypto_key_type_t type {
+    set {
+      freeswitchPINVOKE.switch_rtp_crypto_key_type_set(swigCPtr, (int)value);
+    } 
+    get {
+      switch_rtp_crypto_key_type_t ret = (switch_rtp_crypto_key_type_t)freeswitchPINVOKE.switch_rtp_crypto_key_type_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_unsigned_char key {
+    set {
+      freeswitchPINVOKE.switch_rtp_crypto_key_key_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_rtp_crypto_key_key_get(swigCPtr);
+      SWIGTYPE_p_unsigned_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t keylen {
+    set {
+      freeswitchPINVOKE.switch_rtp_crypto_key_keylen_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_crypto_key_keylen_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public switch_rtp_crypto_key next {
+    set {
+      freeswitchPINVOKE.switch_rtp_crypto_key_next_set(swigCPtr, switch_rtp_crypto_key.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_rtp_crypto_key_next_get(swigCPtr);
+      switch_rtp_crypto_key ret = (cPtr == IntPtr.Zero) ? null : new switch_rtp_crypto_key(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_rtp_crypto_key() : this(freeswitchPINVOKE.new_switch_rtp_crypto_key(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_rtp_crypto_key_type_t {
+  NO_CRYPTO,
+  AES_CM_128_HMAC_SHA1_80,
+  AES_CM_128_HMAC_SHA1_32,
+  AES_CM_128_NULL_AUTH
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_rtp_flag_enum_t {
+  SWITCH_RTP_FLAG_NOBLOCK = (1 << 0),
+  SWITCH_RTP_FLAG_IO = (1 << 1),
+  SWITCH_RTP_FLAG_USE_TIMER = (1 << 2),
+  SWITCH_RTP_FLAG_TIMER_RECLOCK = (1 << 3),
+  SWITCH_RTP_FLAG_SECURE_SEND = (1 << 4),
+  SWITCH_RTP_FLAG_SECURE_RECV = (1 << 5),
+  SWITCH_RTP_FLAG_AUTOADJ = (1 << 6),
+  SWITCH_RTP_FLAG_RAW_WRITE = (1 << 7),
+  SWITCH_RTP_FLAG_GOOGLEHACK = (1 << 8),
+  SWITCH_RTP_FLAG_VAD = (1 << 9),
+  SWITCH_RTP_FLAG_BREAK = (1 << 10),
+  SWITCH_RTP_FLAG_MINI = (1 << 11),
+  SWITCH_RTP_FLAG_DATAWAIT = (1 << 12),
+  SWITCH_RTP_FLAG_BUGGY_2833 = (1 << 13),
+  SWITCH_RTP_FLAG_PASS_RFC2833 = (1 << 14),
+  SWITCH_RTP_FLAG_AUTO_CNG = (1 << 15),
+  SWITCH_RTP_FLAG_SECURE_SEND_RESET = (1 << 16),
+  SWITCH_RTP_FLAG_SECURE_RECV_RESET = (1 << 17),
+  SWITCH_RTP_FLAG_PROXY_MEDIA = (1 << 18),
+  SWITCH_RTP_FLAG_SHUTDOWN = (1 << 19),
+  SWITCH_RTP_FLAG_FLUSH = (1 << 20),
+  SWITCH_RTP_FLAG_AUTOFLUSH = (1 << 21),
+  SWITCH_RTP_FLAG_STICKY_FLUSH = (1 << 22),
+  SWITCH_ZRTP_FLAG_SECURE_SEND = (1 << 23),
+  SWITCH_ZRTP_FLAG_SECURE_RECV = (1 << 24),
+  SWITCH_ZRTP_FLAG_SECURE_MITM_SEND = (1 << 25),
+  SWITCH_ZRTP_FLAG_SECURE_MITM_RECV = (1 << 26),
+  SWITCH_RTP_FLAG_DEBUG_RTP_READ = (1 << 27),
+  SWITCH_RTP_FLAG_DEBUG_RTP_WRITE = (1 << 28),
+  SWITCH_RTP_FLAG_VIDEO = (1 << 29)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_rtp_flush_t {
+  SWITCH_RTP_FLUSH_ONCE,
+  SWITCH_RTP_FLUSH_STICK,
+  SWITCH_RTP_FLUSH_UNSTICK
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_rtp_hdr_t : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_rtp_hdr_t(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_rtp_hdr_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_rtp_hdr_t() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_rtp_hdr_t(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public uint version {
+    set {
+      freeswitchPINVOKE.switch_rtp_hdr_t_version_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_rtp_hdr_t_version_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint p {
+    set {
+      freeswitchPINVOKE.switch_rtp_hdr_t_p_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_rtp_hdr_t_p_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint x {
+    set {
+      freeswitchPINVOKE.switch_rtp_hdr_t_x_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_rtp_hdr_t_x_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint cc {
+    set {
+      freeswitchPINVOKE.switch_rtp_hdr_t_cc_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_rtp_hdr_t_cc_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint m {
+    set {
+      freeswitchPINVOKE.switch_rtp_hdr_t_m_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_rtp_hdr_t_m_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint pt {
+    set {
+      freeswitchPINVOKE.switch_rtp_hdr_t_pt_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_rtp_hdr_t_pt_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint seq {
+    set {
+      freeswitchPINVOKE.switch_rtp_hdr_t_seq_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_rtp_hdr_t_seq_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint ts {
+    set {
+      freeswitchPINVOKE.switch_rtp_hdr_t_ts_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_rtp_hdr_t_ts_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint ssrc {
+    set {
+      freeswitchPINVOKE.switch_rtp_hdr_t_ssrc_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_rtp_hdr_t_ssrc_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_rtp_hdr_t() : this(freeswitchPINVOKE.new_switch_rtp_hdr_t(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_rtp_numbers_t : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_rtp_numbers_t(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_rtp_numbers_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_rtp_numbers_t() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_rtp_numbers_t(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_switch_size_t raw_bytes {
+    set {
+      freeswitchPINVOKE.switch_rtp_numbers_t_raw_bytes_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_raw_bytes_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t media_bytes {
+    set {
+      freeswitchPINVOKE.switch_rtp_numbers_t_media_bytes_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_media_bytes_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t packet_count {
+    set {
+      freeswitchPINVOKE.switch_rtp_numbers_t_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_packet_count_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t media_packet_count {
+    set {
+      freeswitchPINVOKE.switch_rtp_numbers_t_media_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_media_packet_count_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t skip_packet_count {
+    set {
+      freeswitchPINVOKE.switch_rtp_numbers_t_skip_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_skip_packet_count_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t jb_packet_count {
+    set {
+      freeswitchPINVOKE.switch_rtp_numbers_t_jb_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_jb_packet_count_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t dtmf_packet_count {
+    set {
+      freeswitchPINVOKE.switch_rtp_numbers_t_dtmf_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_dtmf_packet_count_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t cng_packet_count {
+    set {
+      freeswitchPINVOKE.switch_rtp_numbers_t_cng_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_cng_packet_count_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t flush_packet_count {
+    set {
+      freeswitchPINVOKE.switch_rtp_numbers_t_flush_packet_count_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_flush_packet_count_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public switch_rtp_numbers_t() : this(freeswitchPINVOKE.new_switch_rtp_numbers_t(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_rtp_stats_t : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_rtp_stats_t(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_rtp_stats_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_rtp_stats_t() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_rtp_stats_t(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public switch_rtp_numbers_t inbound {
+    set {
+      freeswitchPINVOKE.switch_rtp_stats_t_inbound_set(swigCPtr, switch_rtp_numbers_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_rtp_stats_t_inbound_get(swigCPtr);
+      switch_rtp_numbers_t ret = (cPtr == IntPtr.Zero) ? null : new switch_rtp_numbers_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_rtp_numbers_t outbound {
+    set {
+      freeswitchPINVOKE.switch_rtp_stats_t_outbound_set(swigCPtr, switch_rtp_numbers_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_rtp_stats_t_outbound_get(swigCPtr);
+      switch_rtp_numbers_t ret = (cPtr == IntPtr.Zero) ? null : new switch_rtp_numbers_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_rtp_stats_t() : this(freeswitchPINVOKE.new_switch_rtp_stats_t(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_say_interface : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_say_interface(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_say_interface obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_say_interface() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_say_interface(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string interface_name {
+    set {
+      freeswitchPINVOKE.switch_say_interface_interface_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_say_interface_interface_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session_p_char_enum_switch_say_type_t_enum_switch_say_method_t_p_switch_input_args_t__switch_status_t say_function {
+    set {
+      freeswitchPINVOKE.switch_say_interface_say_function_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_char_enum_switch_say_type_t_enum_switch_say_method_t_p_switch_input_args_t__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_say_interface_say_function_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session_p_char_enum_switch_say_type_t_enum_switch_say_method_t_p_switch_input_args_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_char_enum_switch_say_type_t_enum_switch_say_method_t_p_switch_input_args_t__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
+    set {
+      freeswitchPINVOKE.switch_say_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_say_interface_rwlock_get(swigCPtr);
+      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public int refs {
+    set {
+      freeswitchPINVOKE.switch_say_interface_refs_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_say_interface_refs_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_mutex_t reflock {
+    set {
+      freeswitchPINVOKE.switch_say_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_say_interface_reflock_get(swigCPtr);
+      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_loadable_module_interface parent {
+    set {
+      freeswitchPINVOKE.switch_say_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_say_interface_parent_get(swigCPtr);
+      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_say_interface next {
+    set {
+      freeswitchPINVOKE.switch_say_interface_next_set(swigCPtr, switch_say_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_say_interface_next_get(swigCPtr);
+      switch_say_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_say_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_say_interface() : this(freeswitchPINVOKE.new_switch_say_interface(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_say_method_t {
+  SSM_NA,
+  SSM_PRONOUNCED,
+  SSM_ITERATED,
+  SSM_COUNTED
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_say_type_t {
+  SST_NUMBER,
+  SST_ITEMS,
+  SST_PERSONS,
+  SST_MESSAGES,
+  SST_CURRENCY,
+  SST_TIME_MEASUREMENT,
+  SST_CURRENT_DATE,
+  SST_CURRENT_TIME,
+  SST_CURRENT_DATE_TIME,
+  SST_TELEPHONE_NUMBER,
+  SST_TELEPHONE_EXTENSION,
+  SST_URL,
+  SST_IP_ADDRESS,
+  SST_EMAIL_ADDRESS,
+  SST_POSTAL_ADDRESS,
+  SST_ACCOUNT_NUMBER,
+  SST_NAME_SPELLED,
+  SST_NAME_PHONETIC,
+  SST_SHORT_DATE_TIME
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_scheduler_flag_enum_t {
+  SSHF_NONE = 0,
+  SSHF_OWN_THREAD = (1 << 0),
+  SSHF_FREE_ARG = (1 << 1),
+  SSHF_NO_DEL = (1 << 2)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_scheduler_task : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_scheduler_task(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_scheduler_task obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_scheduler_task() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_scheduler_task(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public long created {
+    set {
+      freeswitchPINVOKE.switch_scheduler_task_created_set(swigCPtr, value);
+    } 
+    get {
+      long ret = freeswitchPINVOKE.switch_scheduler_task_created_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public long runtime {
+    set {
+      freeswitchPINVOKE.switch_scheduler_task_runtime_set(swigCPtr, value);
+    } 
+    get {
+      long ret = freeswitchPINVOKE.switch_scheduler_task_runtime_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint cmd_id {
+    set {
+      freeswitchPINVOKE.switch_scheduler_task_cmd_id_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_scheduler_task_cmd_id_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string group {
+    set {
+      freeswitchPINVOKE.switch_scheduler_task_group_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_scheduler_task_group_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_void cmd_arg {
+    set {
+      freeswitchPINVOKE.switch_scheduler_task_cmd_arg_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_scheduler_task_cmd_arg_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public uint task_id {
+    set {
+      freeswitchPINVOKE.switch_scheduler_task_task_id_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_scheduler_task_task_id_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_scheduler_task() : this(freeswitchPINVOKE.new_switch_scheduler_task(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_session_ctl_t {
+  SCSC_PAUSE_INBOUND,
+  SCSC_HUPALL,
+  SCSC_SHUTDOWN,
+  SCSC_CHECK_RUNNING,
+  SCSC_LOGLEVEL,
+  SCSC_SPS,
+  SCSC_LAST_SPS,
+  SCSC_RECLAIM,
+  SCSC_MAX_SESSIONS,
+  SCSC_SYNC_CLOCK,
+  SCSC_MAX_DTMF_DURATION,
+  SCSC_MIN_DTMF_DURATION,
+  SCSC_DEFAULT_DTMF_DURATION,
+  SCSC_SHUTDOWN_ELEGANT,
+  SCSC_SHUTDOWN_ASAP,
+  SCSC_CANCEL_SHUTDOWN,
+  SCSC_SEND_SIGHUP,
+  SCSC_DEBUG_LEVEL,
+  SCSC_FLUSH_DB_HANDLES,
+  SCSC_SHUTDOWN_NOW,
+  SCSC_CALIBRATE_CLOCK,
+  SCSC_SAVE_HISTORY,
+  SCSC_CRASH
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_signal_t {
+  SWITCH_SIG_NONE,
+  SWITCH_SIG_KILL,
+  SWITCH_SIG_XFER,
+  SWITCH_SIG_BREAK
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_speech_flag_enum_t {
+  SWITCH_SPEECH_FLAG_NONE = 0,
+  SWITCH_SPEECH_FLAG_HASTEXT = (1 << 0),
+  SWITCH_SPEECH_FLAG_PEEK = (1 << 1),
+  SWITCH_SPEECH_FLAG_FREE_POOL = (1 << 2),
+  SWITCH_SPEECH_FLAG_BLOCKING = (1 << 3),
+  SWITCH_SPEECH_FLAG_PAUSE = (1 << 4),
+  SWITCH_SPEECH_FLAG_OPEN = (1 << 5),
+  SWITCH_SPEECH_FLAG_DONE = (1 << 6)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_speech_handle : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_speech_handle(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_speech_handle obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_speech_handle() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_speech_handle(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public switch_speech_interface speech_interface {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_speech_interface_set(swigCPtr, switch_speech_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_speech_handle_speech_interface_get(swigCPtr);
+      switch_speech_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_speech_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public uint flags {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_flags_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_speech_handle_flags_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string name {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_speech_handle_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint rate {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_rate_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_speech_handle_rate_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint speed {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_speed_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_speech_handle_speed_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint samples {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_samples_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_speech_handle_samples_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string voice {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_voice_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_speech_handle_voice_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string engine {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_engine_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_speech_handle_engine_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string param {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_param_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_speech_handle_param_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_apr_pool_t memory_pool {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_memory_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_speech_handle_memory_pool_get(swigCPtr);
+      SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_audio_resampler_t resampler {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_resampler_set(swigCPtr, switch_audio_resampler_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_speech_handle_resampler_get(swigCPtr);
+      switch_audio_resampler_t ret = (cPtr == IntPtr.Zero) ? null : new switch_audio_resampler_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_buffer buffer {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_buffer_set(swigCPtr, SWIGTYPE_p_switch_buffer.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_speech_handle_buffer_get(swigCPtr);
+      SWIGTYPE_p_switch_buffer ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_buffer(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_unsigned_char dbuf {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_dbuf_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_speech_handle_dbuf_get(swigCPtr);
+      SWIGTYPE_p_unsigned_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t dbuflen {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_dbuflen_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_speech_handle_dbuflen_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public uint samplerate {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_samplerate_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_speech_handle_samplerate_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint native_rate {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_native_rate_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_speech_handle_native_rate_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_void private_info {
+    set {
+      freeswitchPINVOKE.switch_speech_handle_private_info_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_speech_handle_private_info_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_speech_handle() : this(freeswitchPINVOKE.new_switch_speech_handle(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_speech_interface : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_speech_interface(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_speech_interface obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_speech_interface() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_speech_interface(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string interface_name {
+    set {
+      freeswitchPINVOKE.switch_speech_interface_interface_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_speech_interface_interface_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t speech_open {
+    set {
+      freeswitchPINVOKE.switch_speech_interface_speech_open_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_open_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_q_const__char_int_p_unsigned_long__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t speech_close {
+    set {
+      freeswitchPINVOKE.switch_speech_interface_speech_close_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_close_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_unsigned_long__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t speech_feed_tts {
+    set {
+      freeswitchPINVOKE.switch_speech_interface_speech_feed_tts_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_feed_tts_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_unsigned_long__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t speech_read_tts {
+    set {
+      freeswitchPINVOKE.switch_speech_interface_speech_read_tts_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_read_tts_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_void_p_switch_size_t_p_unsigned_long__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_speech_handle__void speech_flush_tts {
+    set {
+      freeswitchPINVOKE.switch_speech_interface_speech_flush_tts_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle__void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_flush_tts_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_speech_handle__void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle__void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void speech_text_param_tts {
+    set {
+      freeswitchPINVOKE.switch_speech_interface_speech_text_param_tts_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_text_param_tts_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_char_p_q_const__char__void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void speech_numeric_param_tts {
+    set {
+      freeswitchPINVOKE.switch_speech_interface_speech_numeric_param_tts_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_numeric_param_tts_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_char_int__void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void speech_float_param_tts {
+    set {
+      freeswitchPINVOKE.switch_speech_interface_speech_float_param_tts_set(swigCPtr, SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_speech_float_param_tts_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_speech_handle_p_char_double__void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
+    set {
+      freeswitchPINVOKE.switch_speech_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_rwlock_get(swigCPtr);
+      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public int refs {
+    set {
+      freeswitchPINVOKE.switch_speech_interface_refs_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_speech_interface_refs_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_mutex_t reflock {
+    set {
+      freeswitchPINVOKE.switch_speech_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_reflock_get(swigCPtr);
+      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_loadable_module_interface parent {
+    set {
+      freeswitchPINVOKE.switch_speech_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_parent_get(swigCPtr);
+      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_speech_interface next {
+    set {
+      freeswitchPINVOKE.switch_speech_interface_next_set(swigCPtr, switch_speech_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_speech_interface_next_get(swigCPtr);
+      switch_speech_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_speech_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_speech_interface() : this(freeswitchPINVOKE.new_switch_speech_interface(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_stack_t {
+  SWITCH_STACK_BOTTOM,
+  SWITCH_STACK_TOP
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_state_handler_flag_t {
+  SSH_FLAG_STICKY = (1 << 0)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_state_handler_name_t {
+  SWITCH_SHN_ON_INIT,
+  SWITCH_SHN_ON_ROUTING,
+  SWITCH_SHN_ON_EXECUTE,
+  SWITCH_SHN_ON_HANGUP,
+  SWITCH_SHN_ON_EXCHANGE_MEDIA,
+  SWITCH_SHN_ON_SOFT_EXECUTE,
+  SWITCH_SHN_ON_CONSUME_MEDIA,
+  SWITCH_SHN_ON_HIBERNATE,
+  SWITCH_SHN_ON_RESET,
+  SWITCH_SHN_ON_PARK,
+  SWITCH_SHN_ON_REPORTING,
+  SWITCH_SHN_ON_DESTROY
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_state_handler_table : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_state_handler_table(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_state_handler_table obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_state_handler_table() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_state_handler_table(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_init {
+    set {
+      freeswitchPINVOKE.switch_state_handler_table_on_init_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_init_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_routing {
+    set {
+      freeswitchPINVOKE.switch_state_handler_table_on_routing_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_routing_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_execute {
+    set {
+      freeswitchPINVOKE.switch_state_handler_table_on_execute_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_execute_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_hangup {
+    set {
+      freeswitchPINVOKE.switch_state_handler_table_on_hangup_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_hangup_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_exchange_media {
+    set {
+      freeswitchPINVOKE.switch_state_handler_table_on_exchange_media_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_exchange_media_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_soft_execute {
+    set {
+      freeswitchPINVOKE.switch_state_handler_table_on_soft_execute_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_soft_execute_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_consume_media {
+    set {
+      freeswitchPINVOKE.switch_state_handler_table_on_consume_media_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_consume_media_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_hibernate {
+    set {
+      freeswitchPINVOKE.switch_state_handler_table_on_hibernate_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_hibernate_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_reset {
+    set {
+      freeswitchPINVOKE.switch_state_handler_table_on_reset_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_reset_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_park {
+    set {
+      freeswitchPINVOKE.switch_state_handler_table_on_park_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_park_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_reporting {
+    set {
+      freeswitchPINVOKE.switch_state_handler_table_on_reporting_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_reporting_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_core_session__switch_status_t on_destroy {
+    set {
+      freeswitchPINVOKE.switch_state_handler_table_on_destroy_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_on_destroy_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_core_session__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public int flags {
+    set {
+      freeswitchPINVOKE.switch_state_handler_table_flags_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_state_handler_table_flags_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_p_void padding {
+    set {
+      freeswitchPINVOKE.switch_state_handler_table_padding_set(swigCPtr, SWIGTYPE_p_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_state_handler_table_padding_get(swigCPtr);
+      SWIGTYPE_p_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_state_handler_table() : this(freeswitchPINVOKE.new_switch_state_handler_table(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_status_t {
+  SWITCH_STATUS_SUCCESS,
+  SWITCH_STATUS_FALSE,
+  SWITCH_STATUS_TIMEOUT,
+  SWITCH_STATUS_RESTART,
+  SWITCH_STATUS_TERM,
+  SWITCH_STATUS_NOTIMPL,
+  SWITCH_STATUS_MEMERR,
+  SWITCH_STATUS_NOOP,
+  SWITCH_STATUS_RESAMPLE,
+  SWITCH_STATUS_GENERR,
+  SWITCH_STATUS_INUSE,
+  SWITCH_STATUS_BREAK,
+  SWITCH_STATUS_SOCKERR,
+  SWITCH_STATUS_MORE_DATA,
+  SWITCH_STATUS_NOTFOUND,
+  SWITCH_STATUS_UNLOAD,
+  SWITCH_STATUS_NOUNLOAD,
+  SWITCH_STATUS_IGNORE,
+  SWITCH_STATUS_TOO_SMALL,
+  SWITCH_STATUS_NOT_INITALIZED
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_stream_handle : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_stream_handle(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_stream_handle obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_stream_handle() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_stream_handle(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t write_function {
+    set {
+      freeswitchPINVOKE.switch_stream_handle_write_function_set(swigCPtr, SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_stream_handle_write_function_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_stream_handle_p_q_const__char_v_______switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t raw_write_function {
+    set {
+      freeswitchPINVOKE.switch_stream_handle_raw_write_function_set(swigCPtr, SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_stream_handle_raw_write_function_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_stream_handle_p_unsigned_char_switch_size_t__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_void data {
+    set {
+      freeswitchPINVOKE.switch_stream_handle_data_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_stream_handle_data_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_void end {
+    set {
+      freeswitchPINVOKE.switch_stream_handle_end_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_stream_handle_end_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t data_size {
+    set {
+      freeswitchPINVOKE.switch_stream_handle_data_size_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_stream_handle_data_size_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t data_len {
+    set {
+      freeswitchPINVOKE.switch_stream_handle_data_len_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_stream_handle_data_len_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t alloc_len {
+    set {
+      freeswitchPINVOKE.switch_stream_handle_alloc_len_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_stream_handle_alloc_len_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t alloc_chunk {
+    set {
+      freeswitchPINVOKE.switch_stream_handle_alloc_chunk_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_stream_handle_alloc_chunk_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public switch_event param_event {
+    set {
+      freeswitchPINVOKE.switch_stream_handle_param_event_set(swigCPtr, switch_event.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_stream_handle_param_event_get(swigCPtr);
+      switch_event ret = (cPtr == IntPtr.Zero) ? null : new switch_event(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_stream_handle() : this(freeswitchPINVOKE.new_switch_stream_handle(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_t38_options_t : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_t38_options_t(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_t38_options_t obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_t38_options_t() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_t38_options_t(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public uint T38MaxBitRate {
+    set {
+      freeswitchPINVOKE.switch_t38_options_t_T38MaxBitRate_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_t38_options_t_T38MaxBitRate_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_bool_t T38FaxFillBitRemoval {
+    set {
+      freeswitchPINVOKE.switch_t38_options_t_T38FaxFillBitRemoval_set(swigCPtr, (int)value);
+    } 
+    get {
+      switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_t38_options_t_T38FaxFillBitRemoval_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_bool_t T38FaxTranscodingMMR {
+    set {
+      freeswitchPINVOKE.switch_t38_options_t_T38FaxTranscodingMMR_set(swigCPtr, (int)value);
+    } 
+    get {
+      switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_t38_options_t_T38FaxTranscodingMMR_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_bool_t T38FaxTranscodingJBIG {
+    set {
+      freeswitchPINVOKE.switch_t38_options_t_T38FaxTranscodingJBIG_set(swigCPtr, (int)value);
+    } 
+    get {
+      switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_t38_options_t_T38FaxTranscodingJBIG_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string T38FaxRateManagement {
+    set {
+      freeswitchPINVOKE.switch_t38_options_t_T38FaxRateManagement_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_t38_options_t_T38FaxRateManagement_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint T38FaxMaxBuffer {
+    set {
+      freeswitchPINVOKE.switch_t38_options_t_T38FaxMaxBuffer_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_t38_options_t_T38FaxMaxBuffer_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint T38FaxMaxDatagram {
+    set {
+      freeswitchPINVOKE.switch_t38_options_t_T38FaxMaxDatagram_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_t38_options_t_T38FaxMaxDatagram_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string T38FaxUdpEC {
+    set {
+      freeswitchPINVOKE.switch_t38_options_t_T38FaxUdpEC_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_t38_options_t_T38FaxUdpEC_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string T38VendorInfo {
+    set {
+      freeswitchPINVOKE.switch_t38_options_t_T38VendorInfo_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_t38_options_t_T38VendorInfo_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string ip {
+    set {
+      freeswitchPINVOKE.switch_t38_options_t_ip_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_t38_options_t_ip_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint port {
+    set {
+      freeswitchPINVOKE.switch_t38_options_t_port_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_t38_options_t_port_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_t38_options_t() : this(freeswitchPINVOKE.new_switch_t38_options_t(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_text_channel_t {
+  SWITCH_CHANNEL_ID_LOG,
+  SWITCH_CHANNEL_ID_LOG_CLEAN,
+  SWITCH_CHANNEL_ID_EVENT,
+  SWITCH_CHANNEL_ID_SESSION
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_timer : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_timer(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_timer obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_timer() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_timer(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public int interval {
+    set {
+      freeswitchPINVOKE.switch_timer_interval_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_timer_interval_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint flags {
+    set {
+      freeswitchPINVOKE.switch_timer_flags_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_timer_flags_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint samples {
+    set {
+      freeswitchPINVOKE.switch_timer_samples_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_timer_samples_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public uint samplecount {
+    set {
+      freeswitchPINVOKE.switch_timer_samplecount_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_timer_samplecount_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_timer_interface timer_interface {
+    set {
+      freeswitchPINVOKE.switch_timer_timer_interface_set(swigCPtr, switch_timer_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_timer_timer_interface_get(swigCPtr);
+      switch_timer_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_timer_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_apr_pool_t memory_pool {
+    set {
+      freeswitchPINVOKE.switch_timer_memory_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_timer_memory_pool_get(swigCPtr);
+      SWIGTYPE_p_apr_pool_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_void private_info {
+    set {
+      freeswitchPINVOKE.switch_timer_private_info_set(swigCPtr, SWIGTYPE_p_void.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_timer_private_info_get(swigCPtr);
+      SWIGTYPE_p_void ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t diff {
+    set {
+      freeswitchPINVOKE.switch_timer_diff_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_timer_diff_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t tick {
+    set {
+      freeswitchPINVOKE.switch_timer_tick_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_timer_tick_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public switch_timer() : this(freeswitchPINVOKE.new_switch_timer(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_timer_flag_enum_t {
+  SWITCH_TIMER_FLAG_FREE_POOL = (1 << 0)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_timer_func_name_t {
+  SWITCH_TIMER_FUNC_TIMER_INIT,
+  SWITCH_TIMER_FUNC_TIMER_NEXT,
+  SWITCH_TIMER_FUNC_TIMER_STEP,
+  SWITCH_TIMER_FUNC_TIMER_SYNC,
+  SWITCH_TIMER_FUNC_TIMER_CHECK,
+  SWITCH_TIMER_FUNC_TIMER_DESTROY
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_timer_interface : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_timer_interface(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_timer_interface obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_timer_interface() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_timer_interface(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string interface_name {
+    set {
+      freeswitchPINVOKE.switch_timer_interface_interface_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_timer_interface_interface_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_timer__switch_status_t timer_init {
+    set {
+      freeswitchPINVOKE.switch_timer_interface_timer_init_set(swigCPtr, SWIGTYPE_p_f_p_switch_timer__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_timer_init_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_timer__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_timer__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_timer__switch_status_t timer_next {
+    set {
+      freeswitchPINVOKE.switch_timer_interface_timer_next_set(swigCPtr, SWIGTYPE_p_f_p_switch_timer__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_timer_next_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_timer__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_timer__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_timer__switch_status_t timer_step {
+    set {
+      freeswitchPINVOKE.switch_timer_interface_timer_step_set(swigCPtr, SWIGTYPE_p_f_p_switch_timer__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_timer_step_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_timer__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_timer__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_timer__switch_status_t timer_sync {
+    set {
+      freeswitchPINVOKE.switch_timer_interface_timer_sync_set(swigCPtr, SWIGTYPE_p_f_p_switch_timer__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_timer_sync_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_timer__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_timer__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t timer_check {
+    set {
+      freeswitchPINVOKE.switch_timer_interface_timer_check_set(swigCPtr, SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_timer_check_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_timer_enum_switch_bool_t__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_f_p_switch_timer__switch_status_t timer_destroy {
+    set {
+      freeswitchPINVOKE.switch_timer_interface_timer_destroy_set(swigCPtr, SWIGTYPE_p_f_p_switch_timer__switch_status_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_timer_destroy_get(swigCPtr);
+      SWIGTYPE_p_f_p_switch_timer__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_timer__switch_status_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_thread_rwlock_t rwlock {
+    set {
+      freeswitchPINVOKE.switch_timer_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_rwlock_get(swigCPtr);
+      SWIGTYPE_p_switch_thread_rwlock_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_thread_rwlock_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public int refs {
+    set {
+      freeswitchPINVOKE.switch_timer_interface_refs_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_timer_interface_refs_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_mutex_t reflock {
+    set {
+      freeswitchPINVOKE.switch_timer_interface_reflock_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_reflock_get(swigCPtr);
+      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_loadable_module_interface parent {
+    set {
+      freeswitchPINVOKE.switch_timer_interface_parent_set(swigCPtr, SWIGTYPE_p_switch_loadable_module_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_parent_get(swigCPtr);
+      SWIGTYPE_p_switch_loadable_module_interface ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_loadable_module_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_timer_interface next {
+    set {
+      freeswitchPINVOKE.switch_timer_interface_next_set(swigCPtr, switch_timer_interface.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_timer_interface_next_get(swigCPtr);
+      switch_timer_interface ret = (cPtr == IntPtr.Zero) ? null : new switch_timer_interface(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_timer_interface() : this(freeswitchPINVOKE.new_switch_timer_interface(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_unicast_conninfo : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_unicast_conninfo(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_unicast_conninfo obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_unicast_conninfo() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_unicast_conninfo(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public SWIGTYPE_p_switch_core_session session {
+    set {
+      freeswitchPINVOKE.switch_unicast_conninfo_session_set(swigCPtr, SWIGTYPE_p_switch_core_session.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_unicast_conninfo_session_get(swigCPtr);
+      SWIGTYPE_p_switch_core_session ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_codec read_codec {
+    set {
+      freeswitchPINVOKE.switch_unicast_conninfo_read_codec_set(swigCPtr, switch_codec.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_unicast_conninfo_read_codec_get(swigCPtr);
+      switch_codec ret = (cPtr == IntPtr.Zero) ? null : new switch_codec(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_frame write_frame {
+    set {
+      freeswitchPINVOKE.switch_unicast_conninfo_write_frame_set(swigCPtr, switch_frame.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_unicast_conninfo_write_frame_get(swigCPtr);
+      switch_frame ret = (cPtr == IntPtr.Zero) ? null : new switch_frame(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_unsigned_char write_frame_data {
+    set {
+      freeswitchPINVOKE.switch_unicast_conninfo_write_frame_data_set(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_unicast_conninfo_write_frame_data_get(swigCPtr);
+      SWIGTYPE_p_unsigned_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_socket_t socket {
+    set {
+      freeswitchPINVOKE.switch_unicast_conninfo_socket_set(swigCPtr, SWIGTYPE_p_switch_socket_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_unicast_conninfo_socket_get(swigCPtr);
+      SWIGTYPE_p_switch_socket_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_socket_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public string local_ip {
+    set {
+      freeswitchPINVOKE.switch_unicast_conninfo_local_ip_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_unicast_conninfo_local_ip_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public ushort local_port {
+    set {
+      freeswitchPINVOKE.switch_unicast_conninfo_local_port_set(swigCPtr, value);
+    } 
+    get {
+      ushort ret = freeswitchPINVOKE.switch_unicast_conninfo_local_port_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string remote_ip {
+    set {
+      freeswitchPINVOKE.switch_unicast_conninfo_remote_ip_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_unicast_conninfo_remote_ip_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public ushort remote_port {
+    set {
+      freeswitchPINVOKE.switch_unicast_conninfo_remote_port_set(swigCPtr, value);
+    } 
+    get {
+      ushort ret = freeswitchPINVOKE.switch_unicast_conninfo_remote_port_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_sockaddr_t local_addr {
+    set {
+      freeswitchPINVOKE.switch_unicast_conninfo_local_addr_set(swigCPtr, SWIGTYPE_p_switch_sockaddr_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_unicast_conninfo_local_addr_get(swigCPtr);
+      SWIGTYPE_p_switch_sockaddr_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_sockaddr_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_sockaddr_t remote_addr {
+    set {
+      freeswitchPINVOKE.switch_unicast_conninfo_remote_addr_set(swigCPtr, SWIGTYPE_p_switch_sockaddr_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_unicast_conninfo_remote_addr_get(swigCPtr);
+      SWIGTYPE_p_switch_sockaddr_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_sockaddr_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_mutex_t flag_mutex {
+    set {
+      freeswitchPINVOKE.switch_unicast_conninfo_flag_mutex_set(swigCPtr, SWIGTYPE_p_switch_mutex_t.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_unicast_conninfo_flag_mutex_get(swigCPtr);
+      SWIGTYPE_p_switch_mutex_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_switch_mutex_t(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public int flags {
+    set {
+      freeswitchPINVOKE.switch_unicast_conninfo_flags_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_unicast_conninfo_flags_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int type {
+    set {
+      freeswitchPINVOKE.switch_unicast_conninfo_type_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_unicast_conninfo_type_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int transport {
+    set {
+      freeswitchPINVOKE.switch_unicast_conninfo_transport_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_unicast_conninfo_transport_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public int stream_id {
+    set {
+      freeswitchPINVOKE.switch_unicast_conninfo_stream_id_set(swigCPtr, value);
+    } 
+    get {
+      int ret = freeswitchPINVOKE.switch_unicast_conninfo_stream_id_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_unicast_conninfo() : this(freeswitchPINVOKE.new_switch_unicast_conninfo(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_unicast_flag_enum_t {
+  SUF_NONE = 0,
+  SUF_THREAD_RUNNING = (1 << 0),
+  SUF_READY = (1 << 1),
+  SUF_NATIVE = (1 << 2)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+public enum switch_uri_flags {
+  SWITCH_URI_NUMERIC_HOST = 1,
+  SWITCH_URI_NUMERIC_PORT = 2,
+  SWITCH_URI_NO_SCOPE = 4
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_vad_flag_enum_t {
+  SWITCH_VAD_FLAG_TALKING = (1 << 0),
+  SWITCH_VAD_FLAG_EVENTS_TALK = (1 << 1),
+  SWITCH_VAD_FLAG_EVENTS_NOTALK = (1 << 2),
+  SWITCH_VAD_FLAG_CNG = (1 << 3)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+using System;
+using System.Runtime.InteropServices;
+
+public class switch_xml : IDisposable {
+  private HandleRef swigCPtr;
+  protected bool swigCMemOwn;
+
+  internal switch_xml(IntPtr cPtr, bool cMemoryOwn) {
+    swigCMemOwn = cMemoryOwn;
+    swigCPtr = new HandleRef(this, cPtr);
+  }
+
+  internal static HandleRef getCPtr(switch_xml obj) {
+    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+  }
+
+  ~switch_xml() {
+    Dispose();
+  }
+
+  public virtual void Dispose() {
+    lock(this) {
+      if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
+        swigCMemOwn = false;
+        freeswitchPINVOKE.delete_switch_xml(swigCPtr);
+      }
+      swigCPtr = new HandleRef(null, IntPtr.Zero);
+      GC.SuppressFinalize(this);
+    }
+  }
+
+  public string name {
+    set {
+      freeswitchPINVOKE.switch_xml_name_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_xml_name_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string attr {
+  set { freeswitchPINVOKE.switch_xml_attr_set(swigCPtr, ref value); }
+
+  get {
+    return freeswitchPINVOKE.switch_xml_attr_get(swigCPtr);
+  }
+
+  }
+
+  public string txt {
+    set {
+      freeswitchPINVOKE.switch_xml_txt_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_xml_txt_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public string free_path {
+    set {
+      freeswitchPINVOKE.switch_xml_free_path_set(swigCPtr, value);
+    } 
+    get {
+      string ret = freeswitchPINVOKE.switch_xml_free_path_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public SWIGTYPE_p_switch_size_t off {
+    set {
+      freeswitchPINVOKE.switch_xml_off_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value));
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+    } 
+    get {
+      SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_xml_off_get(swigCPtr), true);
+      if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
+      return ret;
+    } 
+  }
+
+  public switch_xml next {
+    set {
+      freeswitchPINVOKE.switch_xml_next_set(swigCPtr, switch_xml.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_xml_next_get(swigCPtr);
+      switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_xml sibling {
+    set {
+      freeswitchPINVOKE.switch_xml_sibling_set(swigCPtr, switch_xml.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_xml_sibling_get(swigCPtr);
+      switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_xml ordered {
+    set {
+      freeswitchPINVOKE.switch_xml_ordered_set(swigCPtr, switch_xml.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_xml_ordered_get(swigCPtr);
+      switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_xml child {
+    set {
+      freeswitchPINVOKE.switch_xml_child_set(swigCPtr, switch_xml.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_xml_child_get(swigCPtr);
+      switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public switch_xml parent {
+    set {
+      freeswitchPINVOKE.switch_xml_parent_set(swigCPtr, switch_xml.getCPtr(value));
+    } 
+    get {
+      IntPtr cPtr = freeswitchPINVOKE.switch_xml_parent_get(swigCPtr);
+      switch_xml ret = (cPtr == IntPtr.Zero) ? null : new switch_xml(cPtr, false);
+      return ret;
+    } 
+  }
+
+  public uint flags {
+    set {
+      freeswitchPINVOKE.switch_xml_flags_set(swigCPtr, value);
+    } 
+    get {
+      uint ret = freeswitchPINVOKE.switch_xml_flags_get(swigCPtr);
+      return ret;
+    } 
+  }
+
+  public switch_xml() : this(freeswitchPINVOKE.new_switch_xml(), true) {
+  }
+
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_xml_flag_t {
+  SWITCH_XML_ROOT = (1 << 0),
+  SWITCH_XML_NAMEM = (1 << 1),
+  SWITCH_XML_TXTM = (1 << 2),
+  SWITCH_XML_DUP = (1 << 3)
+}
+
+}
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 1.3.35
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace FreeSWITCH.Native {
+
+[System.Flags] public enum switch_xml_section_enum_t {
+  SWITCH_XML_SECTION_RESULT = 0,
+  SWITCH_XML_SECTION_CONFIG = (1 << 0),
+  SWITCH_XML_SECTION_DIRECTORY = (1 << 1),
+  SWITCH_XML_SECTION_DIALPLAN = (1 << 2),
+  SWITCH_XML_SECTION_PHRASES = (1 << 3),
+  SWITCH_XML_SECTION_MAX = (1 << 4)
+}
+
+}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_managed/mod_managed.cpp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_managed/mod_managed.cpp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_managed/mod_managed.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -188,7 +188,9 @@
 
 #ifndef WIN32 	
 	// So linux can find the .so
-	mono_config_parse_memory("<configuration><dllmap dll=\"mod_managed\" target=\"mod_managed.so\"/></configuration>");
+	char xmlConfig[300];
+	switch_snprintf(xmlConfig, 300, "<configuration><dllmap dll=\"mod_managed\" target=\"%s%smod_managed.so\"/></configuration>", SWITCH_GLOBAL_dirs.mod_dir, SWITCH_PATH_SEPARATOR);
+	mono_config_parse_memory(xmlConfig);
 #endif
 
 	switch_snprintf(filename, 256, "%s%s%s", SWITCH_GLOBAL_dirs.mod_dir, SWITCH_PATH_SEPARATOR, MOD_MANAGED_DLL);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_perl/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_perl/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_perl/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -37,6 +37,6 @@
 	rm -fr *~ .perlok .libs freeswitch.$(LIBTOOL_LIB_EXTEN) 2>/dev/null
 
 depend_install:
-	mkdir -p $(DESTDIR)$(PREFIX)/perl
-	$(LTINSTALL) freeswitch.$(LIBTOOL_LIB_EXTEN) freeswitch.pm $(DESTDIR)$(PREFIX)/perl
-	if [ ! -f $(DESTDIR)$(PREFIX)/perl/freeswitch.pm ] ; then $(LTINSTALL) freeswitch.pm $(DESTDIR)$(PREFIX)/perl ; fi
+	mkdir -p $(DESTDIR)$(prefix)/perl
+	$(LTINSTALL) freeswitch.$(LIBTOOL_LIB_EXTEN) freeswitch.pm $(DESTDIR)$(prefix)/perl
+	if [ ! -f $(DESTDIR)$(prefix)/perl/freeswitch.pm ] ; then $(LTINSTALL) freeswitch.pm $(DESTDIR)$(prefix)/perl ; fi

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_perl/freeswitch_perl.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_perl/freeswitch_perl.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_perl/freeswitch_perl.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -14,41 +14,39 @@
 #include <perl.h>
 #include <switch.h>
 }
-
 #include <switch_cpp.h>
-
 namespace PERL {
-class Session : public CoreSession {
- private:
-	virtual void do_hangup_hook();
-	PerlInterpreter *getPERL();
-	PerlInterpreter *my_perl;
-	int hh;
-	int mark;
-	SV *me;
- public:
-    Session();
-    Session(char *uuid, CoreSession *a_leg = NULL);
-    Session(switch_core_session_t *session);
-    ~Session();        
+	class Session:public CoreSession {
+	  private:
+		virtual void do_hangup_hook();
+		PerlInterpreter *getPERL();
+		PerlInterpreter *my_perl;
+		int hh;
+		int mark;
+		SV *me;
+	  public:
+		   Session();
+		   Session(char *uuid, CoreSession * a_leg = NULL);
+		     Session(switch_core_session_t *session);
+		                     ~Session();
 
-	virtual void destroy(void);	
-	virtual bool begin_allow_threads();
-	virtual bool end_allow_threads();
-	virtual void check_hangup_hook();
+		virtual void destroy(void);
+		virtual bool begin_allow_threads();
+		virtual bool end_allow_threads();
+		virtual void check_hangup_hook();
 
-	virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
-	void setME(SV *p);
-	void setInputCallback(char *cbfunc = "on_input", char *funcargs = NULL);
-	void unsetInputCallback(void);
-	void setHangupHook(char *func, char *arg=NULL);
-	bool ready();
-	char *suuid;
-	char *cb_function;
-	char *cb_arg;
-	char *hangup_func_str;
-	char *hangup_func_arg;
-	void setPERL(PerlInterpreter *pi);
-};
+		virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
+		void setME(SV * p);
+		void setInputCallback(char *cbfunc = "on_input", char *funcargs = NULL);
+		void unsetInputCallback(void);
+		void setHangupHook(char *func, char *arg = NULL);
+		bool ready();
+		char *suuid;
+		char *cb_function;
+		char *cb_arg;
+		char *hangup_func_str;
+		char *hangup_func_arg;
+		void setPERL(PerlInterpreter * pi);
+	};
 }
 #endif

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_perl/mod_perl.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_perl/mod_perl.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_perl/mod_perl.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -38,6 +38,10 @@
 #pragma comment(lib, PERL_LIB)
 #endif
 
+#if defined (__SVR4) && defined (__sun)
+#include <uconfig.h>
+#endif
+
 #include <EXTERN.h>
 #include <perl.h>
 #include <switch.h>
@@ -278,7 +282,7 @@
 	if (po->d) {
 		free(po);
 	}
-	
+
 	return NULL;
 }
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_perl/mod_perl_extra.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_perl/mod_perl_extra.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_perl/mod_perl_extra.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,9 +1,7 @@
 #ifndef MOD_PERL_EXTRA
 #define MOD_PERL_EXTRA
-SWITCH_BEGIN_EXTERN_C
+SWITCH_BEGIN_EXTERN_C void mod_perl_conjure_event(PerlInterpreter * my_perl, switch_event_t *event, const char *name);
+void mod_perl_conjure_stream(PerlInterpreter * my_perl, switch_stream_handle_t *stream, const char *name);
 
-void mod_perl_conjure_event(PerlInterpreter *my_perl, switch_event_t *event, const char *name);
-void mod_perl_conjure_stream(PerlInterpreter *my_perl, switch_stream_handle_t *stream, const char *name);
-
 SWITCH_END_EXTERN_C
 #endif

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_perl/mod_perl_wrap.cpp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_perl/mod_perl_wrap.cpp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_perl/mod_perl_wrap.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -4191,10 +4191,10 @@
     arg1 = reinterpret_cast< Event * >(argp1);
     res2 = SWIG_AsCharPtrAndSize(ST(1), &buf2, NULL, &alloc2);
     if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getHeader" "', argument " "2"" of type '" "char *""'");
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getHeader" "', argument " "2"" of type '" "char const *""'");
     }
     arg2 = reinterpret_cast< char * >(buf2);
-    result = (char *)(arg1)->getHeader(arg2);
+    result = (char *)(arg1)->getHeader((char const *)arg2);
     ST(argvi) = SWIG_FromCharPtr((const char *)result); argvi++ ;
     
     if (alloc2 == SWIG_NEWOBJ) delete[] buf2;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_perl/perlxsi.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_perl/perlxsi.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_perl/perlxsi.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,4 +1,10 @@
+#if defined (__SVR4) && defined (__sun)
+#include <uconfig.h>
+#endif
 #include <EXTERN.h>
+#if defined (__SVR4) && defined (__sun)
+#include <embed.h>
+#endif
 #include <perl.h>
 
 EXTERN_C void xs_init(pTHX);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/Makefile.in (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/Makefile.in	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/Makefile.in	2010-02-12 00:54:22 UTC (rev 16614)
@@ -21,10 +21,10 @@
 swigclean: clean
 	rm -f mod_python_wrap.* freeswitch.py
 
-mod_python_wrap.cpp: mod_python_extra.c
-	swig -python -c++ -I../../../../src/include -oh mod_python_wrap.h -o mod_python_wrap.cpp mod_python.i
-	echo "#include \"mod_python_extra.c\"" >> mod_python_wrap.cpp
-	patch -s -p0 -i hack.diff
+mod_python_wrap.cpp: mod_python_extra.c hack.diff 
+	which swig 2>&1 >>/dev/null && swig -python -c++ -I../../../../src/include -oh mod_python_wrap.h -o mod_python_wrap.cpp mod_python.i
+	which swig 2>&1 >>/dev/null && echo "#include \"mod_python_extra.c\"" >> mod_python_wrap.cpp
+	which swig 2>&1 >>/dev/null && patch -s -p0 -i hack.diff
 
 local_install:
 	mkdir -m755 -p $(DESTDIR)$(PYTHON_SITE_DIR)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/freeswitch_python.cpp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/freeswitch_python.cpp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/freeswitch_python.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -328,10 +328,6 @@
 	Py_XDECREF(arglist);
 	Py_XDECREF(io);
 
-	if (cb_arg) {
-		Py_XDECREF(cb_arg);
-	}
-
 	if (ts) {
 		begin_allow_threads();
 	}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/freeswitch_python.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/freeswitch_python.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/freeswitch_python.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -5,47 +5,45 @@
 #include <Python.h>
 #include "mod_python_extra.h"
 }
-
 #include <switch_cpp.h>
-
 namespace PYTHON {
-class Session : public CoreSession {
- private:
-	virtual void do_hangup_hook();
-	PyObject *getPython();
-	PyObject *Py;
-	PyObject *Self;
-	int hh;
-	int mark;
-	PyThreadState *TS;
- public:
-    Session();
-    Session(char *nuuid, CoreSession *a_leg = NULL);
-    Session(switch_core_session_t *session);
-    virtual ~Session();        
-	
-	virtual bool begin_allow_threads();
-	virtual bool end_allow_threads();
-	virtual void check_hangup_hook();
-	virtual void destroy(void);
+	class Session:public CoreSession {
+	  private:
+		virtual void do_hangup_hook();
+		PyObject *getPython();
+		PyObject *Py;
+		PyObject *Self;
+		int hh;
+		int mark;
+		PyThreadState *TS;
+	  public:
+		              Session();
+		              Session(char *nuuid, CoreSession * a_leg = NULL);
+		     Session(switch_core_session_t *session);
+		                      virtual ~ Session();
 
-	virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
-	void setInputCallback(PyObject *cbfunc, PyObject *funcargs = NULL);
-	void unsetInputCallback(void);
-	void setHangupHook(PyObject *pyfunc, PyObject *arg = NULL);
-	bool ready();
-	
-	PyObject *cb_function;
-	PyObject *cb_arg;
-	PyObject *hangup_func;
-	PyObject *hangup_func_arg;
+		virtual bool begin_allow_threads();
+		virtual bool end_allow_threads();
+		virtual void check_hangup_hook();
+		virtual void destroy(void);
 
-	/* keep a pointer to parent module, internal use only*/
-	void setPython(PyObject *state);
+		virtual switch_status_t run_dtmf_callback(void *input, switch_input_type_t itype);
+		void setInputCallback(PyObject * cbfunc, PyObject * funcargs = NULL);
+		void unsetInputCallback(void);
+		void setHangupHook(PyObject * pyfunc, PyObject * arg = NULL);
+		bool ready();
 
-	/* keeps the PyObject * version of the Session so it can be used as args to the callback */
-	void setSelf(PyObject *state);
+		PyObject *cb_function;
+		PyObject *cb_arg;
+		PyObject *hangup_func;
+		PyObject *hangup_func_arg;
 
-};
+		/* keep a pointer to parent module, internal use only */
+		void setPython(PyObject * state);
+
+		/* keeps the PyObject * version of the Session so it can be used as args to the callback */
+		void setSelf(PyObject * state);
+
+	};
 }
 #endif

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/hack.diff (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/hack.diff	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/hack.diff	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,26 +1,28 @@
---- mod_python_wrap.cpp.orig	2009-03-21 11:37:16.000000000 +0100
-+++ mod_python_wrap.cpp	2009-03-21 11:33:18.000000000 +0100
-@@ -5469,7 +5469,9 @@
+Index: mod_python_wrap.cpp
+===================================================================
+--- mod_python_wrap.cpp	(revision 16581)
++++ mod_python_wrap.cpp	(working copy)
+@@ -5555,7 +5555,9 @@
      SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EventConsumer_pop" "', argument " "2"" of type '" "int""'");
    } 
    arg2 = static_cast< int >(val2);
 +  Py_BEGIN_ALLOW_THREADS;
    result = (Event *)(arg1)->pop(arg2);
 +  Py_END_ALLOW_THREADS;
-   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, 0 |  0 );
+   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_OWN |  0 );
    return resultobj;
  fail:
-@@ -5491,7 +5493,9 @@
+@@ -5577,7 +5579,9 @@
      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_pop" "', argument " "1"" of type '" "EventConsumer *""'"); 
    }
    arg1 = reinterpret_cast< EventConsumer * >(argp1);
 +  Py_BEGIN_ALLOW_THREADS;
    result = (Event *)(arg1)->pop();
 +  Py_END_ALLOW_THREADS;
-   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, 0 |  0 );
+   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_OWN |  0 );
    return resultobj;
  fail:
-@@ -9206,20 +9210,20 @@
+@@ -9560,20 +9564,20 @@
  }
  
  
@@ -44,7 +46,7 @@
    PyObject *resultobj = 0;
    char *arg1 = (char *) 0 ;
    CoreSession *arg2 = (CoreSession *) 0 ;
-@@ -9244,7 +9248,7 @@
+@@ -9598,7 +9602,7 @@
    }
    arg2 = reinterpret_cast< CoreSession * >(argp2);
    result = (PYTHON::Session *)new PYTHON::Session(arg1,arg2);
@@ -53,7 +55,7 @@
    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
    return resultobj;
  fail:
-@@ -9253,7 +9257,7 @@
+@@ -9607,7 +9611,7 @@
  }
  
  
@@ -62,7 +64,7 @@
    PyObject *resultobj = 0;
    char *arg1 = (char *) 0 ;
    PYTHON::Session *result = 0 ;
-@@ -9269,7 +9273,7 @@
+@@ -9623,7 +9627,7 @@
    }
    arg1 = reinterpret_cast< char * >(buf1);
    result = (PYTHON::Session *)new PYTHON::Session(arg1);
@@ -71,7 +73,7 @@
    if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
    return resultobj;
  fail:
-@@ -9278,7 +9282,7 @@
+@@ -9632,7 +9636,7 @@
  }
  
  
@@ -80,7 +82,7 @@
    PyObject *resultobj = 0;
    switch_core_session_t *arg1 = (switch_core_session_t *) 0 ;
    PYTHON::Session *result = 0 ;
-@@ -9293,7 +9297,7 @@
+@@ -9647,7 +9651,7 @@
    }
    arg1 = reinterpret_cast< switch_core_session_t * >(argp1);
    result = (PYTHON::Session *)new PYTHON::Session(arg1);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/mod_python.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/mod_python.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/mod_python.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -61,7 +61,7 @@
 } globals;
 
 struct switch_py_thread {
-	struct switch_py_thread *prev, *next; 
+	struct switch_py_thread *prev, *next;
 	char *cmd;
 	char *args;
 	switch_memory_pool_t *pool;
@@ -70,7 +70,8 @@
 struct switch_py_thread *thread_pool_head = NULL;
 static switch_mutex_t *THREAD_POOL_LOCK = NULL;
 
-static void eval_some_python(const char *funcname, char *args, switch_core_session_t *session, switch_stream_handle_t *stream, switch_event_t *params, char **str, struct switch_py_thread *pt)
+static void eval_some_python(const char *funcname, char *args, switch_core_session_t *session, switch_stream_handle_t *stream, switch_event_t *params,
+							 char **str, struct switch_py_thread *pt)
 {
 	PyThreadState *tstate = NULL;
 	char *dupargs = NULL;
@@ -103,7 +104,7 @@
 	}
 
 	script = strdup(switch_str_nil(argv[0]));
-	
+
 	lead = 1;
 
 	if ((p = strstr(script, "::"))) {
@@ -115,13 +116,13 @@
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Invoking py module: %s\n", script);
-	
+
 	tstate = PyThreadState_New(mainThreadState->interp);
 	if (!tstate) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error acquiring tstate\n");
 		goto done;
 	}
-	
+
 	/* Save state in thread struct so we can terminate it later if needed */
 	if (pt)
 		pt->tstate = tstate;
@@ -146,9 +147,8 @@
 		PyErr_Clear();
 		goto done_swap_out;
 	}
-
 	// get the handler function to be called
-	function = PyObject_GetAttrString(module, (char *)funcname);
+	function = PyObject_GetAttrString(module, (char *) funcname);
 	if (!function) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Module does not define %s\n", funcname);
 		PyErr_Print();
@@ -183,13 +183,13 @@
 	} else {
 		arg = Py_BuildValue("(s)", switch_str_nil(argv[1]));
 	}
-	
+
 	// invoke the handler 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Call python script \n");
 	result = PyEval_CallObjectWithKeywords(function, arg, (PyObject *) NULL);
 	Py_DECREF(function);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Finished calling python script \n");
-	
+
 	// check the result and print out any errors
 	if (result) {
 		if (str) {
@@ -204,25 +204,25 @@
 		PyGC_Collect();
 	}
 
- done_swap_out:
+  done_swap_out:
 
 	if (arg) {
 		Py_DECREF(arg);
 	}
-	
+
 	if (sp) {
 		Py_DECREF(sp);
 	}
-	
+
 	if (tstate) {
 		// thread state must be cleared explicitly or we'll get memory leaks
 		PyThreadState_Clear(tstate);
 		PyEval_ReleaseThread(tstate);
 		PyThreadState_Delete(tstate);
 	}
-	
- done:
 
+  done:
+
 	switch_safe_free(dupargs);
 	switch_safe_free(script);
 
@@ -231,7 +231,7 @@
 
 
 static switch_xml_t python_fetch(const char *section,
-							  const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params, void *user_data)
+								 const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params, void *user_data)
 {
 
 	switch_xml_t xml = NULL;
@@ -300,20 +300,20 @@
  * we must decrease the default python recursion limit accordingly.  Otherwise, python can easily blow
  * up the stack and the whole switch crashes.  See modlang-134
  */
-static void set_max_recursion_depth(void) {
+static void set_max_recursion_depth(void)
+{
 
 	// assume that a stack frame is approximately 1K, so divide thread stack size (eg, 240K) by
 	// 1K to get the approx number of stack frames we can hold before blowing up.
 	int newMaxRecursionDepth = SWITCH_THREAD_STACKSIZE / 1024;
-	
+
 	PyObject *sysModule = PyImport_ImportModule("sys");
 	PyObject *setRecursionLimit = PyObject_GetAttrString(sysModule, "setrecursionlimit");
-	PyObject *recLimit = Py_BuildValue("(i)",newMaxRecursionDepth);
+	PyObject *recLimit = Py_BuildValue("(i)", newMaxRecursionDepth);
 	PyObject *setrecursion_result = PyEval_CallObjectWithKeywords(setRecursionLimit, recLimit, (PyObject *) NULL);
 	if (setrecursion_result) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set python recursion limit to %d\n", newMaxRecursionDepth);
-	}
-	else {
+	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set recursion limit to %d\n", newMaxRecursionDepth);
 		PyErr_Print();
 		PyErr_Clear();
@@ -365,7 +365,7 @@
 
 SWITCH_STANDARD_API(api_python)
 {
-	
+
 	eval_some_python("fsapi", (char *) cmd, session, stream, NULL, NULL, NULL);
 
 	return SWITCH_STATUS_SUCCESS;
@@ -430,7 +430,7 @@
 
 		// initialize python system
 		Py_Initialize();
-		
+
 		// create GIL and a threadstate
 		PyEval_InitThreads();
 
@@ -479,12 +479,11 @@
 	pt = thread_pool_head;
 	PyEval_AcquireLock();
 	while (pt) {
-		thread_cnt ++;
+		thread_cnt++;
 		nextpt = pt->next;
-		
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
-						  "Forcibly terminating script [%s]\n", pt->args);
 
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Forcibly terminating script [%s]\n", pt->args);
+
 		/* Kill python script */
 		PyThreadState_Swap(pt->tstate);
 		PyThreadState_SetAsyncExc(pt->tstate->thread_id, PyExc_SystemExit);
@@ -495,13 +494,12 @@
 	PyEval_ReleaseLock();
 	switch_yield(1000000);
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
-					  "Had to kill %d threads\n", thread_cnt);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Had to kill %d threads\n", thread_cnt);
 
 	/* Give threads a few seconds to terminate. 
 	   Not using switch_thread_join() since if threads refuse to die
 	   then freeswitch will hang */
-	for (i=0; i < 10 && thread_pool_head; i++) {
+	for (i = 0; i < 10 && thread_pool_head; i++) {
 		switch_yield(1000000);
 	}
 	if (thread_pool_head) {
@@ -509,12 +507,10 @@
 		pt = thread_pool_head;
 		while (pt) {
 			nextpt = pt->next;
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-						  "Script [%s] didn't exit in time\n", pt->args);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Script [%s] didn't exit in time\n", pt->args);
 			pt = nextpt;
 		}
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-						  "Forcing python shutdown. This might cause freeswitch to crash!\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Forcing python shutdown. This might cause freeswitch to crash!\n");
 	}
 
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/mod_python_extra.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/mod_python_extra.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/mod_python_extra.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,11 +1,9 @@
-SWITCH_BEGIN_EXTERN_C 
-
-PyObject *mod_python_conjure_event(switch_event_t *event)
+SWITCH_BEGIN_EXTERN_C PyObject * mod_python_conjure_event(switch_event_t *event)
 {
 	PyObject *obj;
 	Event *result = new Event(event, 0);
 
-	obj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_OWN );
+	obj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_OWN);
 
 	return obj;
 }
@@ -16,18 +14,18 @@
 	PyObject *obj;
 	Stream *result = new Stream(stream);
 
-	obj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_POINTER_OWN );
+	obj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Stream, SWIG_POINTER_OWN);
 
 	return obj;
 }
 
-PyObject *mod_python_conjure_session(PyObject *module, switch_core_session_t *session)
+PyObject *mod_python_conjure_session(PyObject * module, switch_core_session_t *session)
 {
 	PyObject *obj;
-	
-	PYTHON::Session *result = new PYTHON::Session(session);
+
+	PYTHON::Session * result = new PYTHON::Session(session);
 	obj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_PYTHON__Session, SWIG_POINTER_OWN);
-	
+
 	result->setPython(module);
 	result->setSelf(obj);
 
@@ -39,18 +37,18 @@
 #endif
 
 	return obj;
-	
+
 }
 
 PyObject *mod_python_conjure_DTMF(char digit, int32_t duration)
 {
 	PyObject *obj;
-	
+
 	DTMF *result = new DTMF(digit, duration);
 	obj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_DTMF, SWIG_POINTER_OWN);
-	
+
 	return obj;
-	
+
 }
 
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/mod_python_extra.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/mod_python_extra.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/mod_python_extra.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,10 +1,8 @@
 #ifndef MOD_PYTHON_EXTRA
 #define MOD_PYTHON_EXTRA
-SWITCH_BEGIN_EXTERN_C
-
-PyObject *mod_python_conjure_event(switch_event_t *event);
+SWITCH_BEGIN_EXTERN_C PyObject * mod_python_conjure_event(switch_event_t *event);
 PyObject *mod_python_conjure_stream(switch_stream_handle_t *stream);
-PyObject *mod_python_conjure_session(PyObject *module, switch_core_session_t *session);
+PyObject *mod_python_conjure_session(PyObject * module, switch_core_session_t *session);
 PyObject *mod_python_conjure_DTMF(char digit, int32_t duration);
 
 SWITCH_END_EXTERN_C

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/mod_python_wrap.cpp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/mod_python_wrap.cpp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_python/mod_python_wrap.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -4858,10 +4858,10 @@
   arg1 = reinterpret_cast< Event * >(argp1);
   res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2);
   if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getHeader" "', argument " "2"" of type '" "char *""'");
+    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Event_getHeader" "', argument " "2"" of type '" "char const *""'");
   }
   arg2 = reinterpret_cast< char * >(buf2);
-  result = (char *)(arg1)->getHeader(arg2);
+  result = (char *)(arg1)->getHeader((char const *)arg2);
   resultobj = SWIG_FromCharPtr((const char *)result);
   if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
   return resultobj;
@@ -5555,7 +5555,9 @@
     SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "EventConsumer_pop" "', argument " "2"" of type '" "int""'");
   } 
   arg2 = static_cast< int >(val2);
+  Py_BEGIN_ALLOW_THREADS;
   result = (Event *)(arg1)->pop(arg2);
+  Py_END_ALLOW_THREADS;
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:
@@ -5577,7 +5579,9 @@
     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "EventConsumer_pop" "', argument " "1"" of type '" "EventConsumer *""'"); 
   }
   arg1 = reinterpret_cast< EventConsumer * >(argp1);
+  Py_BEGIN_ALLOW_THREADS;
   result = (Event *)(arg1)->pop();
+  Py_END_ALLOW_THREADS;
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_Event, SWIG_POINTER_OWN |  0 );
   return resultobj;
 fail:

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/Makefile

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/Makefile.am (from rev 16612, freeswitch/trunk/src/mod/languages/mod_spidermonkey/Makefile.am) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/Makefile.am	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/Makefile.am	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,71 @@
+include $(top_srcdir)/build/modmake.rulesam
+
+MODNAME=mod_spidermonkey
+
+CURL_DIR=$(switch_srcdir)/libs/curl
+CURL_BUILDDIR=$(switch_builddir)/libs/curl
+CURLLA=${switch_builddir}/libs/curl/lib/libcurl.la
+
+JS_DIR=$(switch_srcdir)/libs/js
+JS_BUILDDIR=$(switch_builddir)/libs/js
+JSLA=$(JS_BUILDDIR)/libjs.la
+
+AM_CFLAGS  += -I. -I$(JS_DIR)/src -I$(JS_DIR)/nsprpub/dist/include/nspr
+AM_CFLAGS  += -DXP_UNIX  -DJS_THREADSAFE -DJS_HAS_FILE_OBJECT=1 -DJS_HAS_XML_SUPPORT=1
+AM_LIBADD   = $(switch_builddir)/libfreeswitch.la $(JSLA)
+AM_LDFLAGS += -avoid-version -module -no-undefined -shared 
+AM_LDFLAGS += -L$(JS_BUILDDIR)/nsprpub/dist/lib -lnspr4 $(JS_BUILDDIR)/nsprpub/pr/src/libnspr4.*
+BUILT_SOURCES = $(JSLA) $(LIBCURL_DEPS)
+
+mod_LTLIBRARIES              = mod_spidermonkey.la 
+mod_spidermonkey_la_SOURCES  = mod_spidermonkey.c
+mod_spidermonkey_la_CFLAGS   = $(AM_CFLAGS) $(LIBCURL_CPPFLAGS)
+mod_spidermonkey_la_LIBADD   = $(AM_LIBADD)
+mod_spidermonkey_la_LDFLAGS  = $(AM_LDFLAGS) $(LIBCURL)
+
+mod_LTLIBRARIES             += mod_spidermonkey_curl.la
+mod_spidermonkey_curl_la_SOURCES  = mod_spidermonkey_curl.c
+mod_spidermonkey_curl_la_CFLAGS   = $(AM_CFLAGS) $(LIBCURL_CPPFLAGS)
+mod_spidermonkey_curl_la_LIBADD   = $(AM_LIBADD)
+mod_spidermonkey_curl_la_LDFLAGS  = $(AM_LDFLAGS) $(LIBCURL)
+
+mod_LTLIBRARIES             += mod_spidermonkey_socket.la
+mod_spidermonkey_socket_la_SOURCES  = mod_spidermonkey_socket.c
+mod_spidermonkey_socket_la_CFLAGS   = $(AM_CFLAGS)
+mod_spidermonkey_socket_la_LIBADD   = $(AM_LIBADD)
+mod_spidermonkey_socket_la_LDFLAGS  = $(AM_LDFLAGS)
+
+mod_LTLIBRARIES             += mod_spidermonkey_core_db.la 
+mod_spidermonkey_core_db_la_SOURCES  = mod_spidermonkey_core_db.c
+mod_spidermonkey_core_db_la_CFLAGS   = $(AM_CFLAGS)
+mod_spidermonkey_core_db_la_LIBADD   = $(AM_LIBADD)
+mod_spidermonkey_core_db_la_LDFLAGS  = $(AM_LDFLAGS)
+
+mod_LTLIBRARIES             += mod_spidermonkey_teletone.la
+mod_spidermonkey_teletone_la_SOURCES  = mod_spidermonkey_teletone.c
+mod_spidermonkey_teletone_la_CFLAGS   = $(AM_CFLAGS) -I$(switch_srcdir)/libs/libteletone/src
+mod_spidermonkey_teletone_la_LIBADD   = $(AM_LIBADD)
+mod_spidermonkey_teletone_la_LDFLAGS  = $(AM_LDFLAGS)
+
+if HAVE_ODBC
+mod_LTLIBRARIES             += mod_spidermonkey_odbc.la
+mod_spidermonkey_odbc_la_SOURCES  = mod_spidermonkey_odbc.c
+mod_spidermonkey_odbc_la_CFLAGS   = $(AM_CFLAGS)
+mod_spidermonkey_odbc_la_LIBADD   = $(AM_LIBADD)
+mod_spidermonkey_odbc_la_LDFLAGS  = $(AM_LDFLAGS)
+endif
+
+$(SOURCES): $(BUILT_SOURCES)
+
+$(JSLA): $(JS_DIR) $(JS_DIR)/.update
+	cd $(JS_BUILDDIR)/nsprpub && $(MAKE) -j1 && cd $(JS_BUILDDIR) && $(MAKE)
+	$(TOUCH_TARGET)
+
+$(CURLLA):
+	@cd $(CURL_BUILDDIR) && $(MAKE)
+	$(TOUCH_TARGET)
+
+install-exec-local: $(DESTDIR)$(libdir)/libjs.la
+
+$(DESTDIR)$(libdir)/libjs.la: $(JSLA)
+	cd $(JS_BUILDDIR)/nsprpub/ && $(MAKE) -j1 install && cd $(JS_BUILDDIR) && $(MAKE) install

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -38,7 +38,7 @@
 #include <curl/curl.h>
 #endif
 static int foo = 0;
-static jsval check_hangup_hook(struct js_session *jss, jsval *rp);
+static jsval check_hangup_hook(struct js_session *jss, jsval * rp);
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_spidermonkey_load);
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_spidermonkey_shutdown);
@@ -924,7 +924,7 @@
 		err = "Could not allocate memory\n";
 	}
 
- err:
+  err:
 
 	if (err || !module) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Loading module %s\n**%s**\n", filename, switch_str_nil(err));
@@ -1104,7 +1104,7 @@
 	char var_name[SWITCH_UUID_FORMATTED_LENGTH + 25];
 	char *p;
 	switch_status_t status = SWITCH_STATUS_FALSE;
-	
+
 	if (!jss || !jss->session) {
 		return SWITCH_STATUS_FALSE;
 	}
@@ -1117,13 +1117,13 @@
 
 	switch_uuid_get(&uuid);
 	switch_uuid_format(uuid_str, &uuid);
-	
+
 	switch_snprintf(var_name, sizeof(var_name), "__event_%s", uuid_str);
-	for(p = var_name; p && *p; p++) {
+	for (p = var_name; p && *p; p++) {
 		if (*p == '-') {
 			*p = '_';
 		}
-	}	
+	}
 
 	JS_ResumeRequest(cb_state->cx, cb_state->saveDepth);
 	METHOD_SANITY_CHECK();
@@ -1151,7 +1151,7 @@
 	case SWITCH_INPUT_TYPE_DTMF:
 		{
 			switch_dtmf_t *dtmf = (switch_dtmf_t *) input;
-			
+
 			if (dtmf) {
 				if ((Event = new_js_dtmf(dtmf, var_name, cb_state->cx, cb_state->obj))) {
 					argv[argc++] = STRING_TO_JSVAL(JS_NewStringCopyZ(cb_state->cx, "dtmf"));
@@ -1175,7 +1175,7 @@
 	}
 
 	status = SWITCH_STATUS_SUCCESS;
-done:
+  done:
 	cb_state->saveDepth = JS_SuspendRequest(cb_state->cx);
 	jss->stack_depth--;
 	return status;
@@ -1450,7 +1450,7 @@
 	args.input_callback = dtmf_func;
 	args.buf = bp;
 	args.buflen = len;
-	
+
 	switch_ivr_record_file(jss->session, &fh, file_name, &args, limit);
 	JS_ResumeRequest(cx, cb_state.saveDepth);
 	check_hangup_hook(jss, &ret);
@@ -1594,7 +1594,7 @@
 	return ret;
 }
 
-static jsval check_hangup_hook(struct js_session *jss, jsval *rp)
+static jsval check_hangup_hook(struct js_session *jss, jsval * rp)
 {
 	jsval argv[3] = { 0 };
 	int argc = 0;
@@ -1753,7 +1753,7 @@
 	int32 ms = 0;
 	jsval ret = JS_TRUE;
 	int32 sync = 0;
-	
+
 	METHOD_SANITY_CHECK();
 	channel = switch_core_session_get_channel(jss->session);
 	CHANNEL_SANITY_CHECK();
@@ -2123,7 +2123,9 @@
 {
 	struct js_session *jss = JS_GetPrivate(cx, obj);
 
-	*rval = BOOLEAN_TO_JSVAL((jss && jss->session && switch_channel_test_flag(switch_core_session_get_channel(jss->session), CF_ANSWERED)) ? JS_TRUE : JS_FALSE);
+	*rval =
+		BOOLEAN_TO_JSVAL((jss && jss->session
+						  && switch_channel_test_flag(switch_core_session_get_channel(jss->session), CF_ANSWERED)) ? JS_TRUE : JS_FALSE);
 
 	return JS_TRUE;
 }
@@ -2186,7 +2188,7 @@
 	int32 timeout = 60000;
 	jsrefcount saveDepth;
 	jsval ret = JS_TRUE;
-	
+
 	METHOD_SANITY_CHECK();
 	channel = switch_core_session_get_channel(jss->session);
 
@@ -2200,8 +2202,8 @@
 	}
 
 	if (check_hangup_hook(jss, NULL) != JS_TRUE) {
-        return JS_FALSE;
-    }
+		return JS_FALSE;
+	}
 
 	saveDepth = JS_SuspendRequest(cx);
 	for (;;) {
@@ -2245,7 +2247,7 @@
 				cause = switch_channel_str2cause(cause_name);
 			}
 		}
-		
+
 		if (cause) {
 			channel = switch_core_session_get_channel(session);
 			switch_channel_hangup(channel, cause);
@@ -2289,7 +2291,7 @@
 				if (check_hangup_hook(jss, NULL) != JS_TRUE) {
 					return JS_FALSE;
 				}
-				
+
 				saveDepth = JS_SuspendRequest(cx);
 				switch_core_session_exec(jss->session, application_interface, app_arg);
 				JS_ResumeRequest(cx, saveDepth);
@@ -2826,7 +2828,7 @@
 {
 	struct js_session *jss = NULL;
 	JSObject *session_obj = NULL;
-	
+
 	jss = malloc(sizeof(*jss));
 	switch_assert(jss);
 	memset(jss, 0, sizeof(*jss));
@@ -2835,7 +2837,7 @@
 	JS_SetPrivate(cx, obj, jss);
 
 	*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
-	
+
 	if (argc > 0) {
 		char *uuid = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
 
@@ -2851,7 +2853,7 @@
 					old_jss = JS_GetPrivate(cx, session_obj);
 				}
 			}
-			if (switch_ivr_originate(old_jss ? old_jss->session : NULL, 
+			if (switch_ivr_originate(old_jss ? old_jss->session : NULL,
 									 &jss->session, &jss->cause, uuid, 60, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL) == SWITCH_STATUS_SUCCESS) {
 				switch_set_flag(jss, S_HUP);
 				switch_channel_set_state(switch_core_session_get_channel(jss->session), CS_SOFT_EXECUTE);
@@ -2948,18 +2950,18 @@
 		if (JS_ValueToObject(cx, argv[0], &session_obj)) {
 			struct js_session *old_jss = NULL;
 			if (session_obj && (old_jss = JS_GetPrivate(cx, session_obj))) {
-				
+
 				if (old_jss == jss) {
 					eval_some_js("~throw new Error(\"Supplied a_leg session is the same as our session\");", cx, obj, rval);
 					return JS_FALSE;
-					
+
 				};
-				
+
 				if (!old_jss->session) {
 					eval_some_js("~throw new Error(\"Supplied a_leg session is not initilaized!\");", cx, obj, rval);
 					return JS_FALSE;
 				}
-				
+
 				session = old_jss->session;
 				orig_caller_profile = switch_channel_get_caller_profile(switch_core_session_get_channel(session));
 				dialplan = orig_caller_profile->dialplan;
@@ -3013,7 +3015,8 @@
 		caller_profile = switch_caller_profile_new(pool, username, dialplan, cid_name, cid_num, network_addr, ani, aniii, rdnis, modname, context, dest);
 
 		saveDepth = JS_SuspendRequest(cx);
-		status = switch_ivr_originate(session, &peer_session, &jss->cause, dest, to ? atoi(to) : 60, NULL, NULL, NULL, caller_profile, NULL, SOF_NONE, NULL);
+		status =
+			switch_ivr_originate(session, &peer_session, &jss->cause, dest, to ? atoi(to) : 60, NULL, NULL, NULL, caller_profile, NULL, SOF_NONE, NULL);
 		JS_ResumeRequest(cx, saveDepth);
 
 		if (status != SWITCH_STATUS_SUCCESS) {
@@ -3374,7 +3377,7 @@
 
 	if (argc > 0) {
 		JS_ValueToInt32(cx, argv[0], &msec);
-	} 
+	}
 
 	if (msec) {
 		switch_yield(msec * 1000);
@@ -3437,7 +3440,7 @@
 		SWITCH_STANDARD_STREAM(stream);
 		switch_api_execute(cmd, arg, session, &stream);
 
-		*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, switch_str_nil((char *)stream.data)));
+		*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, switch_str_nil((char *) stream.data)));
 		switch_safe_free(stream.data);
 
 	} else {
@@ -3597,7 +3600,7 @@
 	struct js_session *jss;
 	JSContext *cx = NULL;
 	jsval rval;
-	
+
 	if (zstr(input_code)) {
 		return;
 	}
@@ -3624,7 +3627,7 @@
 
 	script = input_code;
 
-	if (*script != '~') {	
+	if (*script != '~') {
 		if ((arg = strchr(script, ' '))) {
 			*arg++ = '\0';
 			argc = switch_separate_string(arg, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
@@ -3771,7 +3774,7 @@
 {
 	// this causes a crash
 	//JS_DestroyRuntime(globals.rt);
-	
+
 	curl_global_cleanup();
 
 	switch_core_hash_destroy(&module_manager.mod_hash);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -150,7 +150,7 @@
 	struct js_session_speech *speech;
 };
 
-JSBool DEFAULT_SET_PROPERTY(JSContext * cx, JSObject *obj, jsval id, jsval *vp)
+JSBool DEFAULT_SET_PROPERTY(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
 {
 	eval_some_js("~throw new Error(\"this property cannot be changed!\");", cx, obj, vp);
 	return JS_FALSE;

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_core_db.2008.vcproj (from rev 16612, freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey_core_db.2008.vcproj) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_core_db.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_core_db.2008.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,295 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="mod_spidermonkey_core_db"
+	ProjectGUID="{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}"
+	RootNamespace="mod_spidermonkey_core_db"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\mod_spidermonkey_core_db.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_core_db.c (from rev 16612, freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey_core_db.c) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_core_db.c	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_core_db.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,474 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Anthony Minessale II <anthm@freeswitch.org>
+ *
+ *
+ * mod_spidermonkey_DB.c -- DB Javascript Module
+ *
+ */
+#include "mod_spidermonkey.h"
+
+static const char modname[] = "CoreDB";
+
+struct db_obj {
+	switch_memory_pool_t *pool;
+	switch_core_db_t *db;
+	switch_core_db_stmt_t *stmt;
+	char *dbname;
+	char code_buffer[2048];
+	JSContext *cx;
+	JSObject *obj;
+};
+
+
+/* DB Object */
+/*********************************************************************************/
+static JSBool db_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	switch_memory_pool_t *pool;
+	switch_core_db_t *db;
+	struct db_obj *dbo;
+
+	if (argc > 0) {
+		char *dbname = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+		switch_core_new_memory_pool(&pool);
+		if (!(db = switch_core_db_open_file(dbname))) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Open DB!\n");
+			switch_core_destroy_memory_pool(&pool);
+			return JS_FALSE;
+		}
+		dbo = switch_core_alloc(pool, sizeof(*dbo));
+		dbo->pool = pool;
+		dbo->dbname = switch_core_strdup(pool, dbname);
+		dbo->cx = cx;
+		dbo->obj = obj;
+		dbo->db = db;
+		JS_SetPrivate(cx, obj, dbo);
+		return JS_TRUE;
+	}
+
+	return JS_FALSE;
+}
+
+static JSBool db_close(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	struct db_obj *dbo = JS_GetPrivate(cx, obj);
+
+	if (dbo) {
+		if (dbo->stmt) {
+			switch_core_db_finalize(dbo->stmt);
+			dbo->stmt = NULL;
+		}
+		if (dbo->db) {
+			switch_core_db_close(dbo->db);
+			dbo->db = NULL;
+		}
+	}
+
+	return JS_TRUE;
+}
+
+static void db_destroy(JSContext * cx, JSObject * obj)
+{
+	struct db_obj *dbo = JS_GetPrivate(cx, obj);
+
+	if (dbo) {
+		switch_memory_pool_t *pool = dbo->pool;
+		jsval rval = JS_TRUE;
+
+		db_close(cx, obj, 0, NULL, &rval);
+		switch_core_destroy_memory_pool(&pool);
+		pool = NULL;
+	}
+}
+
+
+static int db_callback(void *pArg, int argc, char **argv, char **columnNames)
+{
+	struct db_obj *dbo = pArg;
+	char code[1024];
+	jsval rval;
+	int x = 0;
+
+	switch_snprintf(code, sizeof(code), "~var _Db_RoW_ = {}");
+	eval_some_js(code, dbo->cx, dbo->obj, &rval);
+
+	for (x = 0; x < argc; x++) {
+		switch_snprintf(code, sizeof(code), "~_Db_RoW_[\"%s\"] = \"%s\"", columnNames[x], argv[x]);
+		eval_some_js(code, dbo->cx, dbo->obj, &rval);
+	}
+
+	switch_snprintf(code, sizeof(code), "~%s(_Db_RoW_)", dbo->code_buffer);
+	eval_some_js(code, dbo->cx, dbo->obj, &rval);
+
+	switch_snprintf(code, sizeof(code), "~delete _Db_RoW_");
+	eval_some_js(code, dbo->cx, dbo->obj, &rval);
+
+	return 0;
+}
+
+static JSBool db_exec(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	struct db_obj *dbo = JS_GetPrivate(cx, obj);
+	*rval = INT_TO_JSVAL(0);
+
+	if (!dbo->db) {
+		return JS_FALSE;
+	}
+
+	if (argc > 0) {
+		char *sql = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+		char *err = NULL;
+		void *arg = NULL;
+		switch_core_db_callback_func_t cb_func = NULL;
+
+
+		if (argc > 1) {
+			char *js_func = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
+			switch_copy_string(dbo->code_buffer, js_func, sizeof(dbo->code_buffer));
+			cb_func = db_callback;
+			arg = dbo;
+		}
+
+		switch_core_db_exec(dbo->db, sql, cb_func, arg, &err);
+		if (err) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error %s\n", err);
+			switch_core_db_free(err);
+			*rval = INT_TO_JSVAL(-1);
+		} else {
+			int count = switch_core_db_changes(dbo->db);
+
+			*rval = INT_TO_JSVAL(count);
+		}
+	}
+	return JS_TRUE;
+}
+
+
+/* Evaluate a prepared statement
+  stepSuccessCode expected success code from switch_core_db_step() 
+  return true if step return expected success code, false otherwise
+*/
+static JSBool db_step_ex(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval, int stepSuccessCode)
+{
+	struct db_obj *dbo = JS_GetPrivate(cx, obj);
+	*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
+
+	if (!dbo->db) {
+		return JS_FALSE;
+	}
+
+	if (dbo->stmt) {
+		int running = 1;
+		while (running < 5000) {
+			int result = switch_core_db_step(dbo->stmt);
+			if (result == stepSuccessCode) {
+				*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
+				break;
+			} else if (result == SWITCH_CORE_DB_BUSY) {
+				running++;
+				switch_cond_next();	/* wait a bit before retrying */
+				continue;
+			}
+			if (switch_core_db_finalize(dbo->stmt) != SWITCH_CORE_DB_OK) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error %s\n", switch_core_db_errmsg(dbo->db));
+			}
+			dbo->stmt = NULL;
+			break;
+		}
+	}
+
+	return JS_TRUE;
+}
+
+/* Evaluate a prepared statement, to be used with statements that return data 
+  return true while data is available, false when done or error
+*/
+static JSBool db_next(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	/* return true until no more rows available */
+	return db_step_ex(cx, obj, argc, argv, rval, SWITCH_CORE_DB_ROW);
+}
+
+/* Evaluate a prepared statement, to be used with statements that return no data 
+  return true if statement has finished executing successfully, false otherwise 
+*/
+static JSBool db_step(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	/* return true when the statement has finished executing successfully */
+	return db_step_ex(cx, obj, argc, argv, rval, SWITCH_CORE_DB_DONE);
+}
+
+
+static JSBool db_fetch(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	struct db_obj *dbo = JS_GetPrivate(cx, obj);
+	int colcount = switch_core_db_column_count(dbo->stmt);
+	char code[1024];
+	int x;
+
+	if (!dbo->db) {
+		return JS_FALSE;
+	}
+
+	switch_snprintf(code, sizeof(code), "~var _dB_RoW_DaTa_ = {}");
+	eval_some_js(code, dbo->cx, dbo->obj, rval);
+	if (*rval == JS_FALSE) {
+		return JS_TRUE;
+	}
+	for (x = 0; x < colcount; x++) {
+		const char *var = (char *) switch_core_db_column_name(dbo->stmt, x);
+		const char *val = (char *) switch_core_db_column_text(dbo->stmt, x);
+
+		if (var && val) {
+			switch_snprintf(code, sizeof(code), "~_dB_RoW_DaTa_[\"%s\"] = \"%s\"", var, val);
+			eval_some_js(code, dbo->cx, dbo->obj, rval);
+			if (*rval == JS_FALSE) {
+				return JS_TRUE;
+			}
+		}
+	}
+
+	JS_GetProperty(cx, obj, "_dB_RoW_DaTa_", rval);
+
+	return JS_TRUE;
+}
+
+
+static JSBool db_prepare(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	struct db_obj *dbo = JS_GetPrivate(cx, obj);
+
+	*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
+
+	if (!dbo->db) {
+		return JS_FALSE;
+	}
+
+	if (dbo->stmt) {
+		switch_core_db_finalize(dbo->stmt);
+		dbo->stmt = NULL;
+	}
+
+	if (argc > 0) {
+		char *sql = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+		if (switch_core_db_prepare(dbo->db, sql, -1, &dbo->stmt, 0)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error %s\n", switch_core_db_errmsg(dbo->db));
+		} else {
+			*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
+		}
+	}
+	return JS_TRUE;
+}
+
+static JSBool db_bind_text(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	struct db_obj *dbo = JS_GetPrivate(cx, obj);
+	JSBool status;
+	int32 param_index = -1;
+	char *param_value = NULL;
+
+	*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
+
+	if (!dbo->db) {
+		return JS_FALSE;
+	}
+
+	/* db_prepare() must be called first */
+	if (!dbo->stmt) {
+		return JS_FALSE;
+	}
+
+	/* argv[0] = parameter index
+	   argv[1] = parameter value
+	 */
+	if (argc < 2) {
+		return JS_FALSE;
+	}
+
+
+
+	/* convert args */
+	status = JS_ValueToECMAUint32(cx, argv[0], (uint32 *) & param_index);
+	switch_assert(status == JS_TRUE);
+	param_value = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
+	if ((param_index < 1) || (NULL == param_value)) {
+		return JS_FALSE;
+	}
+
+	/* bind param */
+	if (switch_core_db_bind_text(dbo->stmt, param_index, param_value, -1, SWITCH_CORE_DB_STATIC)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error %s\n", switch_core_db_errmsg(dbo->db));
+		return JS_FALSE;
+	} else {
+		*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
+	}
+
+	return JS_TRUE;
+}
+
+static JSBool db_bind_int(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	struct db_obj *dbo = JS_GetPrivate(cx, obj);
+	JSBool status;
+	int32 param_index = -1;
+	int32 param_value = -1;
+
+	*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
+
+	if (!dbo->db) {
+		return JS_FALSE;
+	}
+
+	/* db_prepare() must be called first */
+	if (!dbo->stmt) {
+		return JS_FALSE;
+	}
+
+	/* argv[0] = parameter index
+	   argv[1] = parameter value
+	 */
+	if (argc < 2) {
+		return JS_FALSE;
+	}
+
+	/* convert args */
+	status = JS_ValueToECMAUint32(cx, argv[0], (uint32 *) & param_index);
+	switch_assert(status == JS_TRUE);
+	status = JS_ValueToECMAUint32(cx, argv[1], (uint32 *) & param_value);
+	switch_assert(status == JS_TRUE);
+
+	if (param_index < 1) {
+		return JS_FALSE;
+	}
+
+	/* bind param */
+	if (switch_core_db_bind_int(dbo->stmt, param_index, param_value)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error %s\n", switch_core_db_errmsg(dbo->db));
+		return JS_FALSE;
+	} else {
+		*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
+	}
+
+	return JS_TRUE;
+}
+
+enum db_tinyid {
+	DB_NAME
+};
+
+static JSFunctionSpec db_methods[] = {
+	{"exec", db_exec, 1},
+	{"close", db_close, 0},
+	{"next", db_next, 0},
+	{"step", db_step, 0},
+	{"fetch", db_fetch, 1},
+	{"prepare", db_prepare, 0},
+	{"bindText", db_bind_text, 2},
+	{"bindInt", db_bind_int, 2},
+	{0}
+};
+
+
+static JSPropertySpec db_props[] = {
+	{"path", DB_NAME, JSPROP_READONLY | JSPROP_PERMANENT},
+	{0}
+};
+
+
+static JSBool db_setProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
+{
+	char *name = JS_GetStringBytes(JS_ValueToString(cx, id));
+
+	if (strcmp(name, "_dB_RoW_DaTa_")) {
+		eval_some_js("~throw new Error(\"this property cannot be changed!\");", cx, obj, vp);
+		*vp = BOOLEAN_TO_JSVAL(JS_FALSE);
+	}
+	return JS_TRUE;
+}
+
+static JSBool db_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
+{
+	JSBool res = JS_TRUE;
+	struct db_obj *dbo = JS_GetPrivate(cx, obj);
+	char *name;
+	int param = 0;
+
+	name = JS_GetStringBytes(JS_ValueToString(cx, id));
+	/* numbers are our props anything else is a method */
+	if (name[0] >= 48 && name[0] <= 57) {
+		param = atoi(name);
+	} else {
+		return JS_TRUE;
+	}
+
+	switch (param) {
+	case DB_NAME:
+		*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, dbo->dbname));
+		break;
+	}
+
+	return res;
+}
+
+JSClass db_class = {
+	modname, JSCLASS_HAS_PRIVATE,
+	JS_PropertyStub, JS_PropertyStub, db_getProperty, db_setProperty,
+	JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, db_destroy, NULL, NULL, NULL,
+	db_construct
+};
+
+
+switch_status_t db_load(JSContext * cx, JSObject * obj)
+{
+
+	JS_InitClass(cx, obj, NULL, &db_class, db_construct, 3, db_props, db_methods, db_props, db_methods);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+const sm_module_interface_t DB_module_interface = {
+	/*.name = */ modname,
+	/*.spidermonkey_load */ db_load,
+	/*.next */ NULL
+};
+
+SWITCH_MOD_DECLARE_NONSTD(switch_status_t) spidermonkey_init(const sm_module_interface_t ** module_interface)
+{
+	*module_interface = &DB_module_interface;
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_core_db.vcproj (from rev 16612, freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey_core_db.vcproj) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_core_db.vcproj	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_core_db.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mod_spidermonkey_core_db"
+	ProjectGUID="{ACFFF684-4D19-4D48-AF12-88EA1D778BDF}"
+	RootNamespace="mod_spidermonkey_core_db"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalLibraryDirectories=""
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalLibraryDirectories=""
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\mod_spidermonkey_core_db.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_curl.2008.vcproj (from rev 16612, freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey_curl.2008.vcproj) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_curl.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_curl.2008.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,295 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="mod_spidermonkey_curl"
+	ProjectGUID="{36E854E3-CE12-4348-A125-CCF3F9D74813}"
+	RootNamespace="mod_spidermonkey_curl"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\mod_spidermonkey_curl.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_curl.c (from rev 16612, freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey_curl.c) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_curl.c	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_curl.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,259 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Anthony Minessale II <anthm@freeswitch.org>
+ *
+ *
+ * mod_spidermonkey_teletone.c -- TeleTone Javascript Module
+ *
+ */
+#include "mod_spidermonkey.h"
+#include <curl/curl.h>
+
+static const char modname[] = "CURL";
+
+struct curl_obj {
+	CURL *curl_handle;
+	JSContext *cx;
+	JSObject *obj;
+	JSFunction *function;
+	JSObject *user_data;
+	jsrefcount saveDepth;
+	jsval ret;
+};
+
+
+static size_t file_callback(void *ptr, size_t size, size_t nmemb, void *data)
+{
+	register unsigned int realsize = (unsigned int) (size * nmemb);
+	struct curl_obj *co = data;
+	uintN argc = 0;
+	jsval argv[4];
+
+
+	if (!co) {
+		return 0;
+	}
+	if (co->function) {
+		char *ret;
+		argv[argc++] = STRING_TO_JSVAL(JS_NewStringCopyZ(co->cx, (char *) ptr));
+		if (co->user_data) {
+			argv[argc++] = OBJECT_TO_JSVAL(co->user_data);
+		}
+		JS_ResumeRequest(co->cx, co->saveDepth);
+		JS_CallFunction(co->cx, co->obj, co->function, argc, argv, &co->ret);
+		co->saveDepth = JS_SuspendRequest(co->cx);
+
+		if ((ret = JS_GetStringBytes(JS_ValueToString(co->cx, co->ret)))) {
+			if (!strcmp(ret, "true") || !strcmp(ret, "undefined")) {
+				return realsize;
+			} else {
+				return 0;
+			}
+		}
+	}
+
+	return realsize;
+}
+
+
+/* Curl Object */
+/*********************************************************************************/
+static JSBool curl_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	struct curl_obj *co = NULL;
+
+	co = malloc(sizeof(*co));
+	switch_assert(co);
+
+	memset(co, 0, sizeof(*co));
+
+	co->cx = cx;
+	co->obj = obj;
+
+	JS_SetPrivate(cx, obj, co);
+
+	return JS_TRUE;
+}
+
+static void curl_destroy(JSContext * cx, JSObject * obj)
+{
+	struct curl_obj *co = JS_GetPrivate(cx, obj);
+	switch_safe_free(co);
+	JS_SetPrivate(cx, obj, NULL);
+}
+
+static JSBool curl_run(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	struct curl_obj *co = JS_GetPrivate(cx, obj);
+	char *method = NULL, *url, *cred = NULL;
+	char *url_p = NULL, *data = NULL, *durl = NULL;
+	long httpRes = 0;
+	struct curl_slist *headers = NULL;
+	int32 timeout = 0;
+	char ct[80] = "Content-Type: application/x-www-form-urlencoded";
+
+	if (argc < 2 || !co) {
+		return JS_FALSE;
+	}
+
+
+	method = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+	url = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
+
+	co->curl_handle = curl_easy_init();
+	if (!strncasecmp(url, "https", 5)) {
+		curl_easy_setopt(co->curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
+		curl_easy_setopt(co->curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
+	}
+
+
+	if (argc > 2) {
+		data = JS_GetStringBytes(JS_ValueToString(cx, argv[2]));
+	}
+
+	if (argc > 3) {
+		co->function = JS_ValueToFunction(cx, argv[3]);
+	}
+
+	if (argc > 4) {
+		JS_ValueToObject(cx, argv[4], &co->user_data);
+	}
+
+	if (argc > 5) {
+		cred = JS_GetStringBytes(JS_ValueToString(cx, argv[5]));
+		if (!zstr(cred)) {
+			curl_easy_setopt(co->curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
+			curl_easy_setopt(co->curl_handle, CURLOPT_USERPWD, cred);
+		}
+	}
+
+	if (argc > 6) {
+		JS_ValueToInt32(cx, argv[6], &timeout);
+		if (timeout > 0) {
+			curl_easy_setopt(co->curl_handle, CURLOPT_TIMEOUT, timeout);
+		}
+	}
+
+	if (argc > 7) {
+		char *content_type = JS_GetStringBytes(JS_ValueToString(cx, argv[7]));
+		switch_snprintf(ct, sizeof(ct), "Content-Type: %s", content_type);
+	}
+
+	headers = curl_slist_append(headers, ct);
+
+	curl_easy_setopt(co->curl_handle, CURLOPT_HTTPHEADER, headers);
+
+	url_p = url;
+
+	if (!strcasecmp(method, "post")) {
+		curl_easy_setopt(co->curl_handle, CURLOPT_POST, 1);
+		if (!data) {
+			data = "";
+		}
+		curl_easy_setopt(co->curl_handle, CURLOPT_POSTFIELDS, data);
+	} else if (!zstr(data)) {
+		durl = switch_mprintf("%s?%s", url, data);
+		url_p = durl;
+	}
+
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Running: method: [%s] url: [%s] data: [%s] cred=[%s] cb: [%s]\n",
+					  method, url_p, data, switch_str_nil(cred), co->function ? "yes" : "no");
+
+	curl_easy_setopt(co->curl_handle, CURLOPT_URL, url_p);
+	curl_easy_setopt(co->curl_handle, CURLOPT_WRITEFUNCTION, file_callback);
+	curl_easy_setopt(co->curl_handle, CURLOPT_WRITEDATA, (void *) co);
+
+	curl_easy_setopt(co->curl_handle, CURLOPT_USERAGENT, "freeswitch-spidermonkey-curl/1.0");
+
+	co->saveDepth = JS_SuspendRequest(cx);
+	curl_easy_perform(co->curl_handle);
+
+	curl_easy_getinfo(co->curl_handle, CURLINFO_RESPONSE_CODE, &httpRes);
+	curl_easy_cleanup(co->curl_handle);
+	curl_slist_free_all(headers);
+	co->curl_handle = NULL;
+	co->function = NULL;
+	JS_ResumeRequest(cx, co->saveDepth);
+	switch_safe_free(durl);
+
+
+	return JS_TRUE;
+}
+
+static JSFunctionSpec curl_methods[] = {
+	{"run", curl_run, 2},
+	{0}
+};
+
+
+static JSPropertySpec curl_props[] = {
+	{0}
+};
+
+static JSBool curl_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
+{
+	JSBool res = JS_TRUE;
+	return res;
+}
+
+JSClass curl_class = {
+	modname, JSCLASS_HAS_PRIVATE,
+	JS_PropertyStub, JS_PropertyStub, curl_getProperty, DEFAULT_SET_PROPERTY,
+	JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, curl_destroy, NULL, NULL, NULL,
+	curl_construct
+};
+
+
+switch_status_t curl_load(JSContext * cx, JSObject * obj)
+{
+	JS_InitClass(cx, obj, NULL, &curl_class, curl_construct, 3, curl_props, curl_methods, curl_props, curl_methods);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+const sm_module_interface_t curl_module_interface = {
+	/*.name = */ modname,
+	/*.spidermonkey_load */ curl_load,
+	/*.next */ NULL
+};
+
+SWITCH_MOD_DECLARE_NONSTD(switch_status_t) spidermonkey_init(const sm_module_interface_t ** module_interface)
+{
+	curl_global_init(CURL_GLOBAL_ALL);
+	*module_interface = &curl_module_interface;
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_curl.vcproj (from rev 16612, freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey_curl.vcproj) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_curl.vcproj	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_curl.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mod_spidermonkey_curl"
+	ProjectGUID="{2CCED6DC-26FF-40F2-9585-E9E1049A4599}"
+	RootNamespace="mod_spidermonkey_curl"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalLibraryDirectories=""
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalLibraryDirectories=""
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCWebDeploymentTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\mod_spidermonkey_curl.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_odbc.2008.vcproj (from rev 16612, freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey_odbc.2008.vcproj) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_odbc.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_odbc.2008.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,305 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="mod_spidermonkey_odbc"
+	ProjectGUID="{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}"
+	RootNamespace="mod_spidermonkey_odbc"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				WholeProgramOptimization="true"
+				AdditionalIncludeDirectories=""
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalLibraryDirectories=""
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				LinkTimeCodeGeneration="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				WholeProgramOptimization="true"
+				AdditionalIncludeDirectories=""
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				LinkTimeCodeGeneration="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\mod_spidermonkey_odbc.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_odbc.c (from rev 16612, freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey_odbc.c) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_odbc.c	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_odbc.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,561 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Anthony Minessale II <anthm@freeswitch.org>
+ *
+ *
+ * mod_spidermonkey_odbc.c -- ODBC Javascript Module
+ *
+ */
+#include "mod_spidermonkey.h"
+
+#include <sql.h>
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4201)
+#include <sqlext.h>
+#pragma warning(pop)
+#else
+#include <sqlext.h>
+#endif
+#include <sqltypes.h>
+
+static const char modname[] = "ODBC";
+
+struct odbc_obj {
+	switch_odbc_handle_t *handle;
+	SQLHSTMT stmt;
+	SQLCHAR *colbuf;
+	int32 cblen;
+	SQLCHAR *code;
+	int32 codelen;
+};
+typedef struct odbc_obj odbc_obj_t;
+
+static odbc_obj_t *new_odbc_obj(char *dsn, char *username, char *password)
+{
+	odbc_obj_t *new_obj;
+
+	if (!(new_obj = malloc(sizeof(*new_obj)))) {
+		goto err;
+	}
+
+	memset(new_obj, 0, sizeof(odbc_obj_t));
+	if (!(new_obj->handle = switch_odbc_handle_new(dsn, username, password))) {
+		goto err;
+	}
+
+	return new_obj;
+
+  err:
+	if (new_obj) {
+		if (new_obj->handle) {
+			switch_odbc_handle_destroy(&new_obj->handle);
+		}
+		switch_safe_free(new_obj);
+	}
+
+	return NULL;
+}
+
+switch_odbc_status_t odbc_obj_connect(odbc_obj_t *obj)
+{
+
+	return switch_odbc_handle_connect(obj->handle);
+}
+
+static void destroy_odbc_obj(odbc_obj_t ** objp)
+{
+	odbc_obj_t *obj = *objp;
+	if (obj == NULL)
+		return;
+	if (obj->stmt) {
+		SQLFreeHandle(SQL_HANDLE_STMT, obj->stmt);
+	}
+	if (obj->handle) {
+		switch_odbc_handle_destroy(&obj->handle);
+	}
+	switch_safe_free(obj->colbuf);
+	switch_safe_free(obj->code);
+	switch_safe_free(obj);
+}
+
+
+/* ODBC Object */
+/*********************************************************************************/
+static JSBool odbc_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	odbc_obj_t *odbc_obj = NULL;
+	char *dsn, *username, *password;
+	int32 blen = 1024;
+
+	if (argc < 3) {
+		return JS_FALSE;
+	}
+
+	dsn = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+	username = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
+	password = JS_GetStringBytes(JS_ValueToString(cx, argv[2]));
+
+	if (argc > 3) {
+		int32 len;
+		JS_ValueToInt32(cx, argv[3], &len);
+
+		if (len > 0) {
+			blen = len;
+		}
+	}
+
+	if (zstr(username)) {
+		username = NULL;
+	}
+
+	if (zstr(password)) {
+		password = NULL;
+	}
+
+	if (dsn) {
+		odbc_obj = new_odbc_obj(dsn, username, password);
+	}
+
+	if (!odbc_obj) {
+		return JS_FALSE;
+	}
+
+	if (!(odbc_obj->colbuf = (SQLCHAR *) malloc(blen))) {
+		destroy_odbc_obj(&odbc_obj);
+		return JS_FALSE;
+	}
+
+	odbc_obj->cblen = blen;
+
+	blen += 1536;
+
+	if (!(odbc_obj->code = (SQLCHAR *) malloc(blen))) {
+		destroy_odbc_obj(&odbc_obj);
+		return JS_FALSE;
+	}
+
+	odbc_obj->codelen = blen;
+
+	JS_SetPrivate(cx, obj, odbc_obj);
+
+	return JS_TRUE;
+}
+
+static void odbc_destroy(JSContext * cx, JSObject * obj)
+{
+	odbc_obj_t *odbc_obj;
+	if (obj == NULL)
+		return;
+	odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
+	if (odbc_obj) {
+		destroy_odbc_obj(&odbc_obj);
+		JS_SetPrivate(cx, obj, NULL);
+	}
+}
+
+static JSBool odbc_connect(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	odbc_obj_t *odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
+	JSBool tf = JS_TRUE;
+
+	if (odbc_obj) {
+		if (odbc_obj_connect(odbc_obj) == SWITCH_ODBC_SUCCESS) {
+			tf = JS_TRUE;
+		} else {
+			tf = JS_FALSE;
+		}
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database handle is not initialized!\n");
+	}
+
+	*rval = BOOLEAN_TO_JSVAL(tf);
+
+	return JS_TRUE;
+}
+
+static JSBool odbc_execute(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	odbc_obj_t *odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
+	char *sql;
+	JSBool tf = JS_FALSE;
+	SQLHSTMT stmt;
+
+	if (argc < 1) {
+		goto done;
+	}
+
+	if (!odbc_obj || switch_odbc_handle_get_state(odbc_obj->handle) != SWITCH_ODBC_STATE_CONNECTED) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database is not connected!\n");
+		goto done;
+	}
+
+	sql = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+
+	if (switch_odbc_handle_exec(odbc_obj->handle, sql, &stmt, NULL) != SWITCH_ODBC_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[ODBC] Execute failed for: %s\n", sql);
+		goto done;
+	}
+
+	SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+
+	tf = JS_TRUE;
+
+  done:
+
+	*rval = BOOLEAN_TO_JSVAL(tf);
+
+	return JS_TRUE;
+}
+
+static JSBool odbc_exec(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	odbc_obj_t *odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
+	char *sql;
+	JSBool tf = JS_FALSE;
+
+	if (argc < 1) {
+		goto done;
+	}
+
+	if (!odbc_obj || switch_odbc_handle_get_state(odbc_obj->handle) != SWITCH_ODBC_STATE_CONNECTED) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database is not connected!\n");
+		goto done;
+	}
+
+	if (odbc_obj->stmt) {
+		SQLFreeHandle(SQL_HANDLE_STMT, odbc_obj->stmt);
+		odbc_obj->stmt = NULL;
+	}
+
+	sql = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+
+	if (switch_odbc_handle_exec(odbc_obj->handle, sql, &odbc_obj->stmt, NULL) != SWITCH_ODBC_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[ODBC] query failed: %s\n", sql);
+		goto done;
+	}
+
+	tf = JS_TRUE;
+
+  done:
+
+	*rval = BOOLEAN_TO_JSVAL(tf);
+
+	return JS_TRUE;
+}
+
+static JSBool odbc_num_rows(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	odbc_obj_t *odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
+	SQLLEN row_count = 0;
+
+	if (!odbc_obj || switch_odbc_handle_get_state(odbc_obj->handle) != SWITCH_ODBC_STATE_CONNECTED) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database is not connected!\n");
+		goto done;
+	}
+
+	if (odbc_obj->stmt) {
+		SQLRowCount(odbc_obj->stmt, &row_count);
+	}
+
+  done:
+
+	*rval = INT_TO_JSVAL(row_count);
+
+	return JS_TRUE;
+
+}
+
+
+static JSBool odbc_num_cols(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	odbc_obj_t *odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
+
+	SQLSMALLINT cols = 0;
+
+	if (!odbc_obj || switch_odbc_handle_get_state(odbc_obj->handle) != SWITCH_ODBC_STATE_CONNECTED) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database is not connected!\n");
+		goto done;
+	}
+
+	if (odbc_obj->stmt) {
+		SQLNumResultCols(odbc_obj->stmt, &cols);
+	}
+
+  done:
+
+	*rval = INT_TO_JSVAL(cols);
+
+	return JS_TRUE;
+
+}
+
+
+static JSBool odbc_next_row(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	odbc_obj_t *odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
+	int result = 0;
+	JSBool tf = JS_FALSE;
+
+	if (!odbc_obj || switch_odbc_handle_get_state(odbc_obj->handle) != SWITCH_ODBC_STATE_CONNECTED) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database is not connected!\n");
+		goto done;
+	}
+
+
+	if (odbc_obj->stmt) {
+		if ((result = SQLFetch(odbc_obj->stmt) == SQL_SUCCESS)) {
+			tf = JS_TRUE;
+		}
+	}
+
+  done:
+
+	*rval = BOOLEAN_TO_JSVAL(tf);
+
+	return JS_TRUE;
+}
+
+static char *escape_data(char *in, char escapeChar)
+{
+	switch_size_t nlen = strlen(in);
+	uint32_t qc = 0;
+	char *p, *q, *r;
+
+	for (p = in; p && *p; p++) {
+		if (*p == '"') {
+			qc += 2;
+		}
+		if (*p == '\'') {
+			qc += 2;
+		}
+	}
+
+	nlen += qc + 1;
+
+	if (!(q = (char *) malloc(nlen))) {
+		return NULL;
+	}
+
+	r = q;
+	qc = 0;
+	for (p = in; p && *p; p++) {
+		if (*p == '"') {
+			*r++ = escapeChar;
+		}
+		if (*p == '\'') {
+			*r++ = escapeChar;
+		}
+		*r++ = *p;
+		if (++qc > nlen) {
+			break;
+		}
+	}
+
+	*r++ = '\0';
+
+	return q;
+
+}
+
+
+static JSBool odbc_get_data(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+
+	odbc_obj_t *odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
+	JSBool tf = JS_FALSE;
+
+	if (!odbc_obj || switch_odbc_handle_get_state(odbc_obj->handle) != SWITCH_ODBC_STATE_CONNECTED) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database is not connected!\n");
+		goto done;
+	}
+
+	if (odbc_obj->stmt) {
+		SQLSMALLINT nColumns = 0, x = 0;
+
+		eval_some_js("~var _oDbC_dB_RoW_DaTa_ = {}", cx, obj, rval);
+		if (*rval == JS_FALSE) {
+			return JS_TRUE;
+		}
+
+		if (SQLNumResultCols(odbc_obj->stmt, &nColumns) != SQL_SUCCESS)
+			return JS_FALSE;
+
+		for (x = 1; x <= nColumns; x++) {
+			SQLSMALLINT NameLength, DataType, DecimalDigits, Nullable;
+			SQLULEN ColumnSize;
+			SQLCHAR name[1024] = "";
+			SQLCHAR *data = odbc_obj->colbuf;
+			SQLCHAR *esc = NULL;
+
+			SQLDescribeCol(odbc_obj->stmt, x, name, sizeof(name), &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
+			SQLGetData(odbc_obj->stmt, x, SQL_C_CHAR, odbc_obj->colbuf, odbc_obj->cblen, NULL);
+
+			if (strchr((char *) odbc_obj->colbuf, '"')) {	/* please don't */
+				esc = (SQLCHAR *) escape_data((char *) odbc_obj->colbuf, '\\');
+				data = esc;
+			}
+
+			switch_snprintf((char *) odbc_obj->code, odbc_obj->codelen, "~_oDbC_dB_RoW_DaTa_[\"%s\"] = \"%s\"", name, data);
+			switch_safe_free(esc);
+
+			eval_some_js((char *) odbc_obj->code, cx, obj, rval);
+
+			if (*rval == JS_FALSE) {
+				return JS_TRUE;
+			}
+		}
+
+		JS_GetProperty(cx, obj, "_oDbC_dB_RoW_DaTa_", rval);
+		return JS_TRUE;
+
+
+	}
+
+  done:
+
+	*rval = BOOLEAN_TO_JSVAL(tf);
+
+	return JS_TRUE;
+
+}
+
+static JSBool odbc_close(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	odbc_destroy(cx, obj);
+	return JS_TRUE;
+}
+
+
+static JSBool odbc_disconnect(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	odbc_obj_t *odbc_obj = (odbc_obj_t *) JS_GetPrivate(cx, obj);
+
+	if (!odbc_obj) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database handle is not initialized!\n");
+		goto done;
+	}
+
+	if (switch_odbc_handle_get_state(odbc_obj->handle) != SWITCH_ODBC_STATE_CONNECTED) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database is not connected!\n");
+		goto done;
+	}
+
+	switch_odbc_handle_disconnect(odbc_obj->handle);
+
+  done:
+
+	return JS_TRUE;
+}
+
+enum odbc_tinyid {
+	odbc_NAME
+};
+
+static JSFunctionSpec odbc_methods[] = {
+	{"connect", odbc_connect, 1},
+	{"disconnect", odbc_disconnect, 1},
+	{"exec", odbc_exec, 1},
+	{"query", odbc_exec, 1},
+	{"execute", odbc_execute, 1},
+	{"numRows", odbc_num_rows, 1},
+	{"numCols", odbc_num_cols, 1},
+	{"nextRow", odbc_next_row, 1},
+	{"getData", odbc_get_data, 1},
+	{"close", odbc_close, 1},
+	{0}
+};
+
+
+static JSPropertySpec odbc_props[] = {
+	{"name", odbc_NAME, JSPROP_READONLY | JSPROP_PERMANENT},
+	{0}
+};
+
+static JSBool odbc_setProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
+{
+	char *name = JS_GetStringBytes(JS_ValueToString(cx, id));
+
+	if (strcmp(name, "_oDbC_dB_RoW_DaTa_")) {
+		eval_some_js("~throw new Error(\"this property cannot be changed!\");", cx, obj, vp);
+		*vp = BOOLEAN_TO_JSVAL(JS_FALSE);
+	}
+	return JS_TRUE;
+}
+
+static JSBool odbc_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
+{
+	int param;
+	char *name = JS_GetStringBytes(JS_ValueToString(cx, id));
+
+	/* numbers are our props anything else is a method */
+	if (name[0] >= 48 && name[0] <= 57) {
+		param = atoi(name);
+	} else {
+		return JS_TRUE;
+	}
+
+	*vp = BOOLEAN_TO_JSVAL(JS_FALSE);
+	return JS_TRUE;
+}
+
+JSClass odbc_class = {
+	modname, JSCLASS_HAS_PRIVATE,
+	JS_PropertyStub, JS_PropertyStub, odbc_getProperty, odbc_setProperty,
+	JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, odbc_destroy, NULL, NULL, NULL,
+	odbc_construct
+};
+
+
+switch_status_t odbc_load(JSContext * cx, JSObject * obj)
+{
+	JS_InitClass(cx, obj, NULL, &odbc_class, odbc_construct, 3, odbc_props, odbc_methods, odbc_props, odbc_methods);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+const sm_module_interface_t odbc_module_interface = {
+	/*.name = */ modname,
+	/*.spidermonkey_load */ odbc_load,
+	/*.next */ NULL
+};
+
+SWITCH_MOD_DECLARE_NONSTD(switch_status_t) spidermonkey_init(const sm_module_interface_t ** module_interface)
+{
+	*module_interface = &odbc_module_interface;
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_odbc.vcproj (from rev 16612, freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey_odbc.vcproj) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_odbc.vcproj	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_odbc.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mod_spidermonkey_odbc"
+	ProjectGUID="{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}"
+	RootNamespace="mod_spidermonkey_odbc"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalLibraryDirectories=""
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				WholeProgramOptimization="true"
+				AdditionalIncludeDirectories=""
+				RuntimeLibrary="2"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalLibraryDirectories=""
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				LinkTimeCodeGeneration="1"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\mod_spidermonkey_odbc.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_skel.c (from rev 16612, freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey_skel.c) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_skel.c	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_skel.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,111 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Anthony Minessale II <anthm@freeswitch.org>
+ *
+ *
+ * mod_spidermonkey_skel.c -- Skel Javascript Module
+ *
+ */
+#include "mod_spidermonkey.h"
+
+static const char modname[] = "Skel";
+
+/* Skel Object */
+/*********************************************************************************/
+static JSBool skel_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	return JS_TRUE;
+}
+
+static void skel_destroy(JSContext * cx, JSObject * obj)
+{
+}
+
+static JSBool skel_my_method(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	return JS_FALSE;
+}
+
+enum skel_tinyid {
+	SKEL_NAME
+};
+
+static JSFunctionSpec skel_methods[] = {
+	{"myMethod", skel_my_method, 1},
+	{0}
+};
+
+
+static JSPropertySpec skel_props[] = {
+	{"name", SKEL_NAME, JSPROP_READONLY | JSPROP_PERMANENT},
+	{0}
+};
+
+
+static JSBool skel_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
+{
+	JSBool res = JS_TRUE;
+
+	return res;
+}
+
+JSClass skel_class = {
+	modname, JSCLASS_HAS_PRIVATE,
+	JS_PropertyStub, JS_PropertyStub, skel_getProperty, DEFAULT_SET_PROPERTY,
+	JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, skel_destroy, NULL, NULL, NULL,
+	skel_construct
+};
+
+
+switch_status_t spidermonkey_load(JSContext * cx, JSObject * obj)
+{
+	JS_InitClass(cx, obj, NULL, &skel_class, skel_construct, 3, skel_props, skel_methods, skel_props, skel_methods);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+const sm_module_interface_t skel_module_interface = {
+	/*.name = */ modname,
+	/*.spidermonkey_load */ spidermonkey_load,
+	/*.next */ NULL
+};
+
+SWITCH_MOD_DECLARE(switch_status_t) spidermonkey_init(const sm_module_interface_t ** module_interface)
+{
+	*module_interface = &skel_module_interface;
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_socket.2008.vcproj (from rev 16612, freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey_socket.2008.vcproj) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_socket.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_socket.2008.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,291 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="mod_spidermonkey_socket"
+	ProjectGUID="{028C7278-05D7-4E18-82FE-BE231B844F41}"
+	RootNamespace="mod_spidermonkey_socket"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\mod_spidermonkey_socket.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_socket.c (from rev 16612, freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey_socket.c) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_socket.c	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_socket.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,342 @@
+/* 
+ * Spidermonkey Socket Module
+ * Copyright (C) 2007, Jonas Gauffin <jonas.gauffin@gmail.com>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * Jonas Gauffin
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Jonas Gauffin <jonas.gauffin@gmail.com>
+ *
+ *
+ * mod_spidermonkey_socket.c -- Socket Javascript Module
+ *
+ */
+#include "mod_spidermonkey.h"
+
+static const char modname[] = "Socket";
+
+struct js_socket_obj {
+	switch_socket_t *socket;
+	switch_memory_pool_t *pool;
+	char *read_buffer;
+	switch_size_t buffer_size;
+	int state;
+	jsrefcount saveDepth;
+};
+typedef struct js_socket_obj js_socket_obj_t;
+
+/* Socket Object */
+/*********************************************************************************/
+static JSBool socket_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	js_socket_obj_t *js_socket_obj = 0;
+	switch_memory_pool_t *pool;
+	switch_socket_t *socket;
+	switch_status_t ret;
+
+	switch_core_new_memory_pool(&pool);
+	ret = switch_socket_create(&socket, AF_INET, SOCK_STREAM, SWITCH_PROTO_TCP, pool);
+	if (ret != SWITCH_STATUS_SUCCESS) {
+		switch_core_destroy_memory_pool(&pool);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Failed to create socket, reason: %d.\n", ret);
+		return JS_FALSE;
+	}
+	// allocate information needed by JS to be able to write to the log.
+	// (needed since multitple js sessions can write to the same log)
+	js_socket_obj = switch_core_alloc(pool, sizeof(js_socket_obj_t));
+	js_socket_obj->pool = pool;
+	js_socket_obj->socket = socket;
+	JS_SetPrivate(cx, obj, js_socket_obj);
+	return JS_TRUE;
+}
+
+static void socket_destroy(JSContext * cx, JSObject * obj)
+{
+	js_socket_obj_t *socket = JS_GetPrivate(cx, obj);
+	if (socket == NULL)
+		return;
+
+	if (socket->socket != 0) {
+		socket->saveDepth = JS_SuspendRequest(cx);
+		switch_socket_shutdown(socket->socket, SWITCH_SHUTDOWN_READWRITE);
+		switch_socket_close(socket->socket);
+		switch_core_destroy_memory_pool(&socket->pool);
+		JS_ResumeRequest(cx, socket->saveDepth);
+	}
+
+}
+
+static JSBool socket_connect(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	js_socket_obj_t *socket = JS_GetPrivate(cx, obj);
+	if (socket == NULL) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find js object.\n");
+		return JS_FALSE;
+	}
+
+	if (argc == 2) {
+		char *host = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+		int32 port;
+		switch_sockaddr_t *addr;
+		switch_status_t ret;
+
+		JS_ValueToInt32(cx, argv[1], &port);
+
+		ret = switch_sockaddr_info_get(&addr, host, AF_INET, (switch_port_t) port, 0, socket->pool);
+		if (ret != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "switch_sockaddr_info_get failed: %d.\n", ret);
+			return JS_FALSE;
+		}
+
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Connecting to: %s:%d.\n", host, port);
+		socket->saveDepth = JS_SuspendRequest(cx);
+		ret = switch_socket_connect(socket->socket, addr);
+		JS_ResumeRequest(cx, socket->saveDepth);
+		if (ret != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "switch_socket_connect failed: %d.\n", ret);
+			*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
+		} else
+			*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
+
+	}
+
+	return JS_TRUE;
+}
+
+static JSBool socket_send(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	js_socket_obj_t *socket = JS_GetPrivate(cx, obj);
+	if (socket == NULL) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find js object.\n");
+		return JS_FALSE;
+	}
+
+	if (argc == 1) {
+		switch_status_t ret;
+		char *buffer = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+		switch_size_t len = strlen(buffer);
+		socket->saveDepth = JS_SuspendRequest(cx);
+		ret = switch_socket_send(socket->socket, buffer, &len);
+		JS_ResumeRequest(cx, socket->saveDepth);
+		if (ret != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "switch_socket_send failed: %d.\n", ret);
+			*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
+		} else
+			*rval = BOOLEAN_TO_JSVAL(JS_TRUE);
+	}
+
+	return JS_TRUE;
+}
+
+static JSBool socket_read_bytes(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	js_socket_obj_t *socket = JS_GetPrivate(cx, obj);
+	if (socket == NULL) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find js object.\n");
+		return JS_FALSE;
+	}
+
+	if (argc == 1) {
+		int32 bytes_to_read;
+		switch_status_t ret;
+		switch_size_t len;
+
+		JS_ValueToInt32(cx, argv[0], &bytes_to_read);
+		len = (switch_size_t) bytes_to_read;
+
+		if (socket->buffer_size < len) {
+			socket->read_buffer = switch_core_alloc(socket->pool, len + 1);
+			socket->buffer_size = bytes_to_read + 1;
+		}
+
+		socket->saveDepth = JS_SuspendRequest(cx);
+		ret = switch_socket_recv(socket->socket, socket->read_buffer, &len);
+		JS_ResumeRequest(cx, socket->saveDepth);
+		if (ret != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "switch_socket_send failed: %d.\n", ret);
+			*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
+		} else {
+			socket->read_buffer[len] = 0;
+			*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, socket->read_buffer));
+		}
+	}
+
+	return JS_TRUE;
+}
+
+static JSBool socket_read(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	js_socket_obj_t *socket = JS_GetPrivate(cx, obj);
+	if (socket == NULL) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find js object.\n");
+		return JS_FALSE;
+	}
+
+	if (argc >= 0) {
+		char *delimiter = "\n";
+		switch_status_t ret = SWITCH_STATUS_FALSE;
+		switch_size_t len = 1;
+		switch_size_t total_length = 0;
+		int can_run = TRUE;
+		char tempbuf[2];
+
+		if (argc == 1)
+			delimiter = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+
+
+		if (socket->read_buffer == 0)
+			socket->read_buffer = switch_core_alloc(socket->pool, socket->buffer_size);
+
+		socket->saveDepth = JS_SuspendRequest(cx);
+		while (can_run == TRUE) {
+			ret = switch_socket_recv(socket->socket, tempbuf, &len);
+			if (ret != SWITCH_STATUS_SUCCESS)
+				break;
+
+			tempbuf[1] = 0;
+			if (tempbuf[0] == delimiter[0])
+				break;
+			else if (tempbuf[0] == '\r' && delimiter[0] == '\n')
+				continue;
+			else {
+				// Buffer is full, let's increase it.
+				if (total_length == socket->buffer_size - 1) {
+					switch_size_t new_size = socket->buffer_size + 4196;
+					char *new_buffer = switch_core_alloc(socket->pool, socket->buffer_size);
+					memcpy(new_buffer, socket->read_buffer, total_length);
+					socket->buffer_size = new_size;
+					socket->read_buffer = new_buffer;
+				}
+				socket->read_buffer[total_length] = tempbuf[0];
+				++total_length;
+			}
+		}
+		JS_ResumeRequest(cx, socket->saveDepth);
+
+		if (ret != SWITCH_STATUS_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "socket receive failed: %d.\n", ret);
+			*rval = BOOLEAN_TO_JSVAL(JS_FALSE);
+		} else {
+			socket->read_buffer[total_length] = 0;
+			*rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, socket->read_buffer));
+		}
+	}
+
+	return JS_TRUE;
+}
+
+static JSBool socket_close(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	js_socket_obj_t *socket = JS_GetPrivate(cx, obj);
+	if (socket == NULL) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to find js object.\n");
+		return JS_FALSE;
+	}
+
+	socket->saveDepth = JS_SuspendRequest(cx);
+	switch_socket_shutdown(socket->socket, SWITCH_SHUTDOWN_READWRITE);
+	switch_socket_close(socket->socket);
+	socket->socket = NULL;
+	JS_ResumeRequest(cx, socket->saveDepth);
+	return JS_TRUE;
+}
+
+static JSFunctionSpec socket_methods[] = {
+	{"connect", socket_connect, 1},
+	{"close", socket_close, 1},
+	{"send", socket_send, 1},
+	{"readBytes", socket_read_bytes, 1},
+	{"read", socket_read, 1},
+	{0}
+};
+
+#define SOCKET_ADDRESS 1
+#define SOCKET_PORT 2
+
+static JSPropertySpec socket_props[] = {
+	{"address", SOCKET_ADDRESS, JSPROP_READONLY | JSPROP_PERMANENT},
+	{"port", SOCKET_PORT, JSPROP_READONLY | JSPROP_PERMANENT},
+	{0}
+};
+
+
+static JSBool socket_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
+{
+	JSBool res = JS_TRUE;
+//  js_socket_obj_t *socket = JS_GetPrivate(cx, obj);
+	char *name;
+	int param = 0;
+
+	name = JS_GetStringBytes(JS_ValueToString(cx, id));
+	/* numbers are our props anything else is a method */
+	if (name[0] >= 48 && name[0] <= 57) {
+		param = atoi(name);
+	} else {
+		return JS_TRUE;
+	}
+
+	switch (param) {
+	case SOCKET_ADDRESS:
+		*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, "unknown"));
+		break;
+	case SOCKET_PORT:
+		*vp = INT_TO_JSVAL(1234);
+		break;
+	}
+
+	return res;
+}
+
+JSClass socket_class = {
+	modname, JSCLASS_HAS_PRIVATE,
+	JS_PropertyStub, JS_PropertyStub, socket_getProperty, JS_PropertyStub,
+	JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, socket_destroy, NULL, NULL, NULL,
+	socket_construct
+};
+
+
+switch_status_t socket_load(JSContext * cx, JSObject * obj)
+{
+	JS_InitClass(cx, obj, NULL, &socket_class, socket_construct, 3, socket_props, socket_methods, socket_props, socket_methods);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+const sm_module_interface_t socket_module_interface = {
+	/*.name = */ modname,
+	/*.spidermonkey_load */ socket_load,
+	/*.next */ NULL
+};
+
+SWITCH_MOD_DECLARE_NONSTD(switch_status_t) spidermonkey_init(const sm_module_interface_t ** module_interface)
+{
+	*module_interface = &socket_module_interface;
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_socket.vcproj (from rev 16612, freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey_socket.vcproj) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_socket.vcproj	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_socket.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mod_spidermonkey_socket"
+	ProjectGUID="{028C7278-05D7-4E18-82FE-BE231B844F41}"
+	RootNamespace="mod_spidermonkey_socket"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalLibraryDirectories=""
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="1"
+			WholeProgramOptimization="1"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories=""
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\mod_spidermonkey_socket.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_teletone.2008.vcproj (from rev 16612, freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey_teletone.2008.vcproj) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_teletone.2008.vcproj	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_teletone.2008.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,301 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="9.00"
+	Name="mod_spidermonkey_teletone"
+	ProjectGUID="{8F992C49-6C51-412F-B2A3-34EAB708EB65}"
+	RootNamespace="mod_spidermonkey_teletone"
+	Keyword="Win32Proj"
+	TargetFrameworkVersion="131072"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+		<Platform
+			Name="x64"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\libteletone\src&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Debug|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\libteletone\src&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\libteletone\src&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalLibraryDirectories=""
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				LinkTimeCodeGeneration="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|x64"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+				TargetEnvironment="3"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\libteletone\src&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCManagedResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCResourceCompilerTool"
+			/>
+			<Tool
+				Name="VCPreLinkEventTool"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+				AdditionalLibraryDirectories=""
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				LinkTimeCodeGeneration="1"
+				RandomizedBaseAddress="1"
+				DataExecutionPrevention="0"
+				TargetMachine="17"
+			/>
+			<Tool
+				Name="VCALinkTool"
+			/>
+			<Tool
+				Name="VCManifestTool"
+			/>
+			<Tool
+				Name="VCXDCMakeTool"
+			/>
+			<Tool
+				Name="VCBscMakeTool"
+			/>
+			<Tool
+				Name="VCFxCopTool"
+			/>
+			<Tool
+				Name="VCAppVerifierTool"
+			/>
+			<Tool
+				Name="VCPostBuildEventTool"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\mod_spidermonkey_teletone.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_teletone.c (from rev 16612, freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey_teletone.c) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_teletone.c	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_teletone.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,361 @@
+/* 
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * 
+ * Anthony Minessale II <anthm@freeswitch.org>
+ *
+ *
+ * mod_spidermonkey_teletone.c -- TeleTone Javascript Module
+ *
+ */
+#include "mod_spidermonkey.h"
+#include <libteletone.h>
+
+static const char modname[] = "TeleTone";
+
+typedef enum {
+	TTF_DTMF = (1 << 0)
+} teletone_flag_t;
+
+
+struct teletone_obj {
+	teletone_generation_session_t ts;
+	JSContext *cx;
+	JSObject *obj;
+	switch_core_session_t *session;
+	switch_codec_t codec;
+	switch_buffer_t *audio_buffer;
+	switch_memory_pool_t *pool;
+	switch_timer_t *timer;
+	switch_timer_t timer_base;
+	JSFunction *function;
+	jsval arg;
+	jsval ret;
+	unsigned int flags;
+};
+
+
+static int teletone_handler(teletone_generation_session_t *ts, teletone_tone_map_t *map)
+{
+	struct teletone_obj *tto = ts->user_data;
+	int wrote;
+
+	if (!tto) {
+		return -1;
+	}
+	wrote = teletone_mux_tones(ts, map);
+	switch_buffer_write(tto->audio_buffer, ts->buffer, wrote * 2);
+
+	return 0;
+}
+
+
+/* TeleTone Object */
+/*********************************************************************************/
+static JSBool teletone_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	JSObject *session_obj;
+	struct teletone_obj *tto = NULL;
+	struct js_session *jss = NULL;
+	switch_memory_pool_t *pool;
+	char *timer_name = NULL;
+	switch_codec_implementation_t read_impl = { 0 };
+
+
+
+	if (argc > 0) {
+		if (JS_ValueToObject(cx, argv[0], &session_obj)) {
+			if (!(jss = JS_GetPrivate(cx, session_obj))) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Find Session [1]\n");
+				return JS_FALSE;
+			}
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Find Session [2]\n");
+			return JS_FALSE;
+		}
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Session Arg\n");
+		return JS_FALSE;
+	}
+	if (argc > 1) {
+		timer_name = JS_GetStringBytes(JS_ValueToString(cx, argv[1]));
+	}
+
+	switch_core_new_memory_pool(&pool);
+
+	if (!(tto = switch_core_alloc(pool, sizeof(*tto)))) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error\n");
+		return JS_FALSE;
+	}
+
+	switch_core_session_get_read_impl(jss->session, &read_impl);
+
+	if (switch_core_codec_init(&tto->codec,
+							   "L16",
+							   NULL,
+							   read_impl.actual_samples_per_second,
+							   read_impl.microseconds_per_packet / 1000,
+							   read_impl.number_of_channels, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, pool) == SWITCH_STATUS_SUCCESS) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activated\n");
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed\n");
+		return JS_FALSE;
+	}
+
+	if (timer_name) {
+		unsigned int ms = read_impl.microseconds_per_packet / 1000;
+		if (switch_core_timer_init(&tto->timer_base,
+								   timer_name, ms, (read_impl.samples_per_second / 50) * read_impl.number_of_channels, pool) == SWITCH_STATUS_SUCCESS) {
+			tto->timer = &tto->timer_base;
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Timer INIT Success %u\n", ms);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Timer INIT Failed\n");
+		}
+	}
+
+	switch_buffer_create_dynamic(&tto->audio_buffer, JS_BLOCK_SIZE, JS_BUFFER_SIZE, 0);
+	tto->pool = pool;
+	tto->obj = obj;
+	tto->cx = cx;
+	tto->session = jss->session;
+	teletone_init_session(&tto->ts, 0, teletone_handler, tto);
+	JS_SetPrivate(cx, obj, tto);
+
+	return JS_TRUE;
+}
+
+static void teletone_destroy(JSContext * cx, JSObject * obj)
+{
+	struct teletone_obj *tto = JS_GetPrivate(cx, obj);
+	switch_memory_pool_t *pool;
+	if (tto) {
+		if (tto->timer) {
+			switch_core_timer_destroy(tto->timer);
+		}
+		teletone_destroy_session(&tto->ts);
+		switch_buffer_destroy(&tto->audio_buffer);
+		switch_core_codec_destroy(&tto->codec);
+		pool = tto->pool;
+		tto->pool = NULL;
+		if (pool) {
+			switch_core_destroy_memory_pool(&pool);
+		}
+	}
+}
+
+static JSBool teletone_add_tone(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	struct teletone_obj *tto = JS_GetPrivate(cx, obj);
+	if (argc > 2) {
+		int x;
+		char *fval;
+		char *map_str;
+		map_str = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+
+		for (x = 1; x < TELETONE_MAX_TONES; x++) {
+			fval = JS_GetStringBytes(JS_ValueToString(cx, argv[x]));
+			tto->ts.TONES[(int) *map_str].freqs[x - 1] = strtod(fval, NULL);
+		}
+		return JS_TRUE;
+	}
+
+	return JS_FALSE;
+}
+
+static JSBool teletone_on_dtmf(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	struct teletone_obj *tto = JS_GetPrivate(cx, obj);
+	if (argc > 0) {
+		tto->function = JS_ValueToFunction(cx, argv[0]);
+		if (argc > 1) {
+			tto->arg = argv[1];
+		}
+		switch_set_flag(tto, TTF_DTMF);
+	}
+	return JS_TRUE;
+}
+
+static JSBool teletone_generate(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval)
+{
+	struct teletone_obj *tto = JS_GetPrivate(cx, obj);
+	int32 loops = 0;
+
+	if (argc > 0) {
+		char *script;
+		switch_core_session_t *session;
+		switch_frame_t write_frame = { 0 };
+		unsigned char *fdata[1024];
+		switch_frame_t *read_frame;
+		switch_channel_t *channel;
+
+		if (argc > 1) {
+			if (!JS_ValueToInt32(cx, argv[1], &loops)) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot Convert to INT\n");
+				return JS_FALSE;
+			}
+			loops--;
+		}
+
+		if (tto->audio_buffer) {
+			switch_buffer_zero(tto->audio_buffer);
+		}
+
+		tto->ts.debug = 1;
+		tto->ts.debug_stream = switch_core_get_console();
+
+		script = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
+		teletone_run(&tto->ts, script);
+
+		session = tto->session;
+		write_frame.codec = &tto->codec;
+		write_frame.data = fdata;
+		write_frame.buflen = sizeof(fdata);
+
+		channel = switch_core_session_get_channel(session);
+
+		if (tto->timer) {
+			switch_core_service_session(session);
+		}
+
+		if (loops) {
+			switch_buffer_set_loops(tto->audio_buffer, loops);
+		}
+
+		for (;;) {
+
+			if (switch_test_flag(tto, TTF_DTMF)) {
+				char dtmf[128];
+				char *ret;
+
+				if (switch_channel_has_dtmf(channel)) {
+					uintN aargc = 0;
+					jsval aargv[4];
+
+					switch_channel_dequeue_dtmf_string(channel, dtmf, sizeof(dtmf));
+					aargv[aargc++] = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, dtmf));
+					JS_CallFunction(cx, obj, tto->function, aargc, aargv, &tto->ret);
+					ret = JS_GetStringBytes(JS_ValueToString(cx, tto->ret));
+					if (strcmp(ret, "true") && strcmp(ret, "undefined")) {
+						*rval = tto->ret;
+						return JS_TRUE;
+					}
+				}
+			}
+
+			if (tto->timer) {
+				if (switch_core_timer_next(tto->timer) != SWITCH_STATUS_SUCCESS) {
+					break;
+				}
+
+			} else {
+				switch_status_t status;
+				status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
+
+				if (!SWITCH_READ_ACCEPTABLE(status)) {
+					break;
+				}
+			}
+			if ((write_frame.datalen = (uint32_t) switch_buffer_read_loop(tto->audio_buffer,
+																		  fdata, write_frame.codec->implementation->decoded_bytes_per_packet)) <= 0) {
+				break;
+			}
+
+			write_frame.samples = write_frame.datalen / 2;
+			if (switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bad Write\n");
+				break;
+			}
+		}
+
+		if (tto->timer) {
+			switch_core_thread_session_end(session);
+		}
+		return JS_TRUE;
+	}
+
+	return JS_FALSE;
+}
+
+enum teletone_tinyid {
+	TELETONE_NAME
+};
+
+static JSFunctionSpec teletone_methods[] = {
+	{"generate", teletone_generate, 1},
+	{"onDTMF", teletone_on_dtmf, 1},
+	{"addTone", teletone_add_tone, 10},
+	{0}
+};
+
+
+static JSPropertySpec teletone_props[] = {
+	{"name", TELETONE_NAME, JSPROP_READONLY | JSPROP_PERMANENT},
+	{0}
+};
+
+
+static JSBool teletone_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp)
+{
+	JSBool res = JS_TRUE;
+
+	return res;
+}
+
+JSClass teletone_class = {
+	modname, JSCLASS_HAS_PRIVATE,
+	JS_PropertyStub, JS_PropertyStub, teletone_getProperty, DEFAULT_SET_PROPERTY,
+	JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, teletone_destroy, NULL, NULL, NULL,
+	teletone_construct
+};
+
+
+switch_status_t teletone_load(JSContext * cx, JSObject * obj)
+{
+	JS_InitClass(cx, obj, NULL, &teletone_class, teletone_construct, 3, teletone_props, teletone_methods, teletone_props, teletone_methods);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+const sm_module_interface_t teletone_module_interface = {
+	/*.name = */ modname,
+	/*.spidermonkey_load */ teletone_load,
+	/*.next */ NULL
+};
+
+SWITCH_MOD_DECLARE_NONSTD(switch_status_t) spidermonkey_init(const sm_module_interface_t ** module_interface)
+{
+	*module_interface = &teletone_module_interface;
+	return SWITCH_STATUS_SUCCESS;
+}
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
+ */

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_teletone.vcproj (from rev 16612, freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey_teletone.vcproj) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_teletone.vcproj	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/mod_spidermonkey_teletone.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+	ProjectType="Visual C++"
+	Version="8.00"
+	Name="mod_spidermonkey_teletone"
+	ProjectGUID="{8F992C49-6C51-412F-B2A3-34EAB708EB65}"
+	RootNamespace="mod_spidermonkey_teletone"
+	Keyword="Win32Proj"
+	>
+	<Platforms>
+		<Platform
+			Name="Win32"
+		/>
+	</Platforms>
+	<ToolFiles>
+	</ToolFiles>
+	<Configurations>
+		<Configuration
+			Name="Debug|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\libteletone\src&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalLibraryDirectories=""
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|Win32"
+			ConfigurationType="2"
+			InheritedPropertySheets="..\..\..\..\w32\winlibs.vsprops;..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\spidermonkey.vsprops"
+			CharacterSet="2"
+			>
+			<Tool
+				Name="VCPreBuildEventTool"
+				CommandLine=""
+			/>
+			<Tool
+				Name="VCCustomBuildTool"
+			/>
+			<Tool
+				Name="VCXMLDataGeneratorTool"
+			/>
+			<Tool
+				Name="VCWebServiceProxyGeneratorTool"
+			/>
+			<Tool
+				Name="VCMIDLTool"
+			/>
+			<Tool
+				Name="VCCLCompilerTool"
+				AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\..\libs\libteletone\src&quot;"
+				UsePrecompiledHeader="0"
+			/>
+			<Tool
+				Name="VCLinkerTool"
+				AdditionalLibraryDirectories=""
+				OptimizeReferences="2"
+				EnableCOMDATFolding="2"
+				LinkTimeCodeGeneration="1"
+			/>
+		</Configuration>
+	</Configurations>
+	<References>
+	</References>
+	<Files>
+		<File
+			RelativePath=".\mod_spidermonkey_teletone.c"
+			>
+		</File>
+	</Files>
+	<Globals>
+	</Globals>
+</VisualStudioProject>

Deleted: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_spidermonkey/sm.mak

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_yaml/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_yaml/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_yaml/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,8 @@
 BASE=../../../..
-YAMLLIB=$(BASE)/libs/yaml
-LIBYAML_A=$(YAMLLIB)/src/.libs/libyaml.a
+
+YAMLLIB=$(switch_srcdir)/libs/yaml
+YAMLBUILDLIB=$(switch_builddir)/libs/yaml
+LIBYAML_A=$(YAMLBUILDLIB)/src/.libs/libyaml.a
 LOCAL_CFLAGS=-I$(YAMLLIB)/include
 LOCAL_LIBADD=$(LIBYAML_A)
 VERBOSE=1
@@ -10,9 +12,10 @@
 local_depend: $(LIBYAML_A)
 
 $(LIBYAML_A):
-	cd $(YAMLLIB) && ./configure $(DEFAULT_ARGS) --disable-shared --with-pic
-	cd $(YAMLLIB) && $(MAKE)
+	mkdir -p $(YAMLBUILDLIB)
+	cd $(YAMLBUILDLIB) && $(DEFAULT_VARS) $(YAMLLIB)/configure $(DEFAULT_ARGS) --srcdir=$(YAMLLIB)
+	cd $(YAMLBUILDLIB) && $(MAKE)
 
 yamlclean:
-	cd $(YAMLLIB) && $(MAKE) clean
+	cd $(YAMLBUILDLIB) && $(MAKE) clean
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_yaml/mod_yaml.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_yaml/mod_yaml.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/languages/mod_yaml/mod_yaml.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -37,65 +37,56 @@
 
 static void print_error(yaml_parser_t *parser)
 {
-    switch (parser->error)
-		{
-		case YAML_MEMORY_ERROR:
-            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory error: Not enough memory for parsing\n");
-            break;
+	switch (parser->error) {
+	case YAML_MEMORY_ERROR:
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory error: Not enough memory for parsing\n");
+		break;
 
-        case YAML_READER_ERROR:
-            if (parser->problem_value != -1) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Reader error: %s: #%X at %d\n", parser->problem,
-								  parser->problem_value, (int) parser->problem_offset);
-            }
-            else {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Reader error: %s at %d\n", parser->problem,
-								  (int) parser->problem_offset);
-            }
-            break;
+	case YAML_READER_ERROR:
+		if (parser->problem_value != -1) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Reader error: %s: #%X at %d\n", parser->problem,
+							  parser->problem_value, (int) parser->problem_offset);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Reader error: %s at %d\n", parser->problem, (int) parser->problem_offset);
+		}
+		break;
 
-        case YAML_SCANNER_ERROR:
-            if (parser->context) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Scanner error: %s at line %d, column %d\n"
-								  "%s at line %d, column %d\n", parser->context,
-								  (int)parser->context_mark.line+1, (int)parser->context_mark.column+1,
-								  parser->problem, (int)parser->problem_mark.line+1,
-								  (int)parser->problem_mark.column+1);
-            }
-            else {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Scanner error: %s at line %d, column %d\n",
-								  parser->problem, (int)parser->problem_mark.line+1,
-								  (int)parser->problem_mark.column+1);
-            }
-            break;
+	case YAML_SCANNER_ERROR:
+		if (parser->context) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Scanner error: %s at line %d, column %d\n"
+							  "%s at line %d, column %d\n", parser->context,
+							  (int) parser->context_mark.line + 1, (int) parser->context_mark.column + 1,
+							  parser->problem, (int) parser->problem_mark.line + 1, (int) parser->problem_mark.column + 1);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Scanner error: %s at line %d, column %d\n",
+							  parser->problem, (int) parser->problem_mark.line + 1, (int) parser->problem_mark.column + 1);
+		}
+		break;
 
-        case YAML_PARSER_ERROR:
-            if (parser->context) {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parser error: %s at line %d, column %d\n"
-								  "%s at line %d, column %d\n", parser->context,
-								  (int)parser->context_mark.line+1, (int)parser->context_mark.column+1,
-								  parser->problem, (int)parser->problem_mark.line+1,
-								  (int)parser->problem_mark.column+1);
-            }
-            else {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parser error: %s at line %d, column %d\n",
-								  parser->problem, (int)parser->problem_mark.line+1,
-								  (int)parser->problem_mark.column+1);
-            }
-            break;
-
-        default:
-            /* Couldn't happen. */
-            switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Internal error\n");
-            break;
+	case YAML_PARSER_ERROR:
+		if (parser->context) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parser error: %s at line %d, column %d\n"
+							  "%s at line %d, column %d\n", parser->context,
+							  (int) parser->context_mark.line + 1, (int) parser->context_mark.column + 1,
+							  parser->problem, (int) parser->problem_mark.line + 1, (int) parser->problem_mark.column + 1);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parser error: %s at line %d, column %d\n",
+							  parser->problem, (int) parser->problem_mark.line + 1, (int) parser->problem_mark.column + 1);
 		}
+		break;
+
+	default:
+		/* Couldn't happen. */
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Internal error\n");
+		break;
+	}
 }
 
 
-static switch_xml_t parse_file(FILE *input, const char *file_name)
+static switch_xml_t parse_file(FILE * input, const char *file_name)
 {
 	yaml_parser_t parser;
-	yaml_event_t event = {0};
+	yaml_event_t event = { 0 };
 	char *scalar_data;
 	int done = 0;
 	int depth = 0;
@@ -108,7 +99,7 @@
 	yaml_parser_initialize(&parser);
 	yaml_parser_set_input_file(&parser, input);
 
-	
+
 	if (!(xml = switch_xml_new("document"))) {
 		return NULL;
 	}
@@ -119,7 +110,7 @@
 
 	top = switch_xml_add_child_d(current, "configuration", 0);
 	switch_xml_set_attr_d(top, "name", file_name);
-	
+
 	while (!done) {
 		if (!yaml_parser_parse(&parser, &event)) {
 			print_error(&parser);
@@ -139,7 +130,7 @@
 				scalar_data = (char *) event.data.scalar.value;
 				switch (depth) {
 				case 1:
-					if (!(current = switch_xml_add_child_d(top, scalar_data, depth-1))) {
+					if (!(current = switch_xml_add_child_d(top, scalar_data, depth - 1))) {
 						done = 1;
 					}
 					switch_set_string(category, scalar_data);
@@ -161,7 +152,7 @@
 					}
 					break;
 				}
-				
+
 				break;
 			default:
 				break;
@@ -169,14 +160,13 @@
 		}
 
 		yaml_event_delete(&event);
-	} 
+	}
 
 	yaml_parser_delete(&parser);
 
 	if (input) {
 		fclose(input);
 	}
-
 #ifdef DEBUG_XML
 	if (xml) {
 		char *foo = switch_xml_toxml(xml, SWITCH_FALSE);
@@ -186,11 +176,11 @@
 #endif
 
 	return xml;
-	
+
 }
 
 static switch_xml_t yaml_fetch(const char *section,
-							  const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params, void *user_data)
+							   const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params, void *user_data)
 {
 	char *path;
 	FILE *input;
@@ -201,17 +191,17 @@
 		xml = parse_file(input, key_value);
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "cannot open %s\n", path);
-	} 
-	
+	}
+
 	switch_safe_free(path);
 	return xml;
 }
 
 
-static switch_caller_extension_t *parse_dp(FILE *input, switch_core_session_t *session, switch_caller_profile_t *caller_profile)
+static switch_caller_extension_t *parse_dp(FILE * input, switch_core_session_t *session, switch_caller_profile_t *caller_profile)
 {
 	yaml_parser_t parser;
-	yaml_event_t event = {0};
+	yaml_event_t event = { 0 };
 	char *scalar_data;
 	int done = 0;
 	int depth = 0;
@@ -221,7 +211,7 @@
 	char *last_field = NULL;
 	int nv = 0;
 	switch_caller_extension_t *extension = NULL;
-    switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_channel_t *channel = switch_core_session_get_channel(session);
 	int context_hit = 0;
 	int proceed = 0;
 	switch_regex_t *re = NULL;
@@ -244,7 +234,7 @@
 
 	yaml_parser_initialize(&parser);
 	yaml_parser_set_input_file(&parser, input);
-	
+
 	while (!done) {
 		if (!yaml_parser_parse(&parser, &event)) {
 			print_error(&parser);
@@ -273,19 +263,19 @@
 						char *field = switch_core_session_strdup(session, scalar_data);
 						char *p, *e, *expression = NULL, *field_expanded = NULL, *expression_expanded = NULL;
 						const char *field_data = NULL;
-						
+
 						parens = 0;
 						proceed = 0;
 						switch_regex_safe_free(re);
 
 						if ((p = strstr(field, "=~"))) {
 							*p = '\0';
-							e = p-1;
-							while(*e == ' ') {
+							e = p - 1;
+							while (*e == ' ') {
 								*e-- = '\0';
 							}
-							e = p+2;
-							while(*e == ' ') {
+							e = p + 2;
+							while (*e == ' ') {
 								*e++ = '\0';
 							}
 							expression = e;
@@ -313,7 +303,7 @@
 							}
 							switch_safe_free(last_field);
 							last_field = strdup(field_data);
-							
+
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "test conditions %s(%s) =~ /%s/\n", field, field_data, expression);
 							if (!(proceed = switch_regex_perform(field_data, expression, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
 								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Regex mismatch\n");
@@ -344,12 +334,12 @@
 							char *substituted = NULL;
 							char *app_data;
 
-							
+
 							if (!extension) {
 								extension = switch_caller_extension_new(session, "YAML", caller_profile->destination_number);
 								switch_assert(extension);
 							}
-							
+
 							if (parens) {
 								len = (uint32_t) (strlen(value) + strlen(last_field) + 10) * proceed;
 								switch_zmalloc(substituted, len);
@@ -358,14 +348,14 @@
 							} else {
 								app_data = value;
 							}
-							
+
 							switch_caller_extension_add_application(session, extension, name, app_data);
 							switch_safe_free(substituted);
 						}
 					}
 					break;
-									}
-				
+				}
+
 				break;
 			default:
 				break;
@@ -375,7 +365,7 @@
 		yaml_event_delete(&event);
 	}
 
- end:
+  end:
 
 	switch_safe_free(last_field);
 	switch_regex_safe_free(re);
@@ -384,7 +374,6 @@
 	if (input) {
 		fclose(input);
 	}
-
 #ifdef DEBUG_XML
 	if (xml) {
 		char *foo = switch_xml_toxml(xml, SWITCH_FALSE);
@@ -394,7 +383,7 @@
 #endif
 
 	return extension;
-	
+
 }
 
 SWITCH_STANDARD_DIALPLAN(yaml_dialplan_hunt)
@@ -414,9 +403,9 @@
 		extension = parse_dp(input, session, caller_profile);
 	} else {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening %s\n", path);
-	} 
-	
-	switch_safe_free(path);	
+	}
+
+	switch_safe_free(path);
 	return extension;
 }
 
@@ -424,7 +413,7 @@
 static switch_status_t do_config(void)
 {
 	yaml_parser_t parser;
-	yaml_event_t event = {0};
+	yaml_event_t event = { 0 };
 	char *path;
 	const char *cfg = "mod_yaml.yaml";
 	FILE *input;
@@ -438,7 +427,7 @@
 	int nv = 0;
 
 	path = switch_mprintf("%s/yaml/%s", SWITCH_GLOBAL_dirs.conf_dir, cfg);
-	
+
 	if (!(input = fopen(path, "r"))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening %s\n", path);
 		goto end;
@@ -485,7 +474,7 @@
 					}
 					break;
 				}
-				
+
 				break;
 			default:
 				break;
@@ -493,28 +482,29 @@
 		}
 
 		yaml_event_delete(&event);
-	} 
+	}
 
 	yaml_parser_delete(&parser);
 	status = SWITCH_STATUS_SUCCESS;
 
- end:
+  end:
 
 	if (input) {
 		fclose(input);
 	}
-	
+
 	switch_safe_free(path);
 
 	return status;
-	
+
 }
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_yaml_load)
 {
+	switch_dialplan_interface_t *dp_interface;
+
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
-	switch_dialplan_interface_t *dp_interface;
 
 	if (do_config() != SWITCH_STATUS_SUCCESS) {
 		return SWITCH_STATUS_TERM;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/loggers/mod_console/mod_console.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/loggers/mod_console/mod_console.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/loggers/mod_console/mod_console.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -43,11 +43,17 @@
 static WORD wOldColorAttrs;
 static CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
 
-static WORD 
+static WORD
 #else
-static const char*
+static const char *
 #endif
-COLORS[] = { SWITCH_SEQ_DEFAULT_COLOR, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FMAGEN, SWITCH_SEQ_FCYAN, SWITCH_SEQ_FGREEN, SWITCH_SEQ_FYELLOW };
+ 
+	
+	
+	
+	COLORS[] =
+	{ SWITCH_SEQ_DEFAULT_COLOR, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FMAGEN, SWITCH_SEQ_FCYAN, SWITCH_SEQ_FGREEN,
+SWITCH_SEQ_FYELLOW };
 
 
 static switch_memory_pool_t *module_pool = NULL;
@@ -261,8 +267,7 @@
 		"--------------------------------------------------------------------------------\n"
 		"console help\n"
 		"console loglevel [[0-7] | <loglevel_string>]\n"
-		"console colorize [on|off|toggle]\n"
-		"--------------------------------------------------------------------------------\n";
+		"console colorize [on|off|toggle]\n" "--------------------------------------------------------------------------------\n";
 	const char *loglevel_usage_string = "USAGE:\n"
 		"--------------------------------------------------------------------------------\n"
 		"console loglevel [[0-7] | <loglevel_string>]\n"
@@ -274,17 +279,11 @@
 		"  1 alert\n"
 		"  2 crit\n"
 		"  3 err\n"
-		"  4 warning\n"
-		"  5 notice\n"
-		"  6 info\n"
-		"  7 debug\n"
-		"--------------------------------------------------------------------------------\n";
+		"  4 warning\n" "  5 notice\n" "  6 info\n" "  7 debug\n" "--------------------------------------------------------------------------------\n";
 	const char *colorize_usage_string = "USAGE:\n"
 		"--------------------------------------------------------------------------------\n"
 		"console colorize [on|off|toggle]\n"
-		"\n"
-		"Enable, disable, or toggle console coloring.\n"
-		"--------------------------------------------------------------------------------\n";
+		"\n" "Enable, disable, or toggle console coloring.\n" "--------------------------------------------------------------------------------\n";
 
 	if (session)
 		return SWITCH_STATUS_FALSE;
@@ -315,10 +314,10 @@
 				level = atoi(argv[1]);
 			} else {
 				level = switch_log_str2level(argv[1]);
-			} 
+			}
 		}
 		if (level == SWITCH_LOG_INVALID) {
-			stream->write_function(stream, "-ERR Invalid console loglevel (%s)!\n\n", argc>1? argv[1] : "");
+			stream->write_function(stream, "-ERR Invalid console loglevel (%s)!\n\n", argc > 1 ? argv[1] : "");
 		} else {
 			hard_log_level = level;
 			stream->write_function(stream, "+OK console log level set to %s\n", switch_log_level2str(hard_log_level));
@@ -337,11 +336,11 @@
 		}
 		stream->write_function(stream, "+OK console color %s\n", COLORIZE ? "enabled" : "disabled");
 
-	} else { /* if (!strcasecmp(argv[0], "help")) { */
+	} else {					/* if (!strcasecmp(argv[0], "help")) { */
 		stream->write_function(stream, "%s", usage_string);
 	}
 
-done:
+  done:
 	switch_safe_free(mycmd);
 	return status;
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/loggers/mod_logfile/mod_logfile.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/loggers/mod_logfile/mod_logfile.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/loggers/mod_logfile/mod_logfile.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -154,11 +154,11 @@
 		}
 		break;
 	}
-	
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "New log started.\n");
 
   end:
-	
+
 	if (pool) {
 		switch_core_destroy_memory_pool(&pool);
 	}
@@ -231,7 +231,7 @@
 		if (ok) {
 			if (profile->log_uuid && !zstr(node->userdata)) {
 				char buf[2048];
-				switch_snprintf(buf, sizeof(buf), "%s %s", node->userdata, node->data);	
+				switch_snprintf(buf, sizeof(buf), "%s %s", node->userdata, node->data);
 				mod_logfile_raw_write(profile, buf);
 			} else {
 				mod_logfile_raw_write(profile, node->data);
@@ -387,7 +387,7 @@
 {
 	switch_hash_index_t *hi;
 	const void *var;
-    void *val;
+	void *val;
 
 	switch_log_unbind_logger(mod_logfile_logger);
 	switch_event_unbind(&globals.node);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/loggers/mod_syslog/mod_syslog.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/loggers/mod_syslog/mod_syslog.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/loggers/mod_syslog/mod_syslog.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, James Martelletti <james@nerdc0re.com>
+ * Copyright (C) 2005-2010, James Martelletti <james@nerdc0re.com>
  *
  * Version: MPL 1.1
  *
@@ -49,12 +49,13 @@
 static struct {
 	char *ident;
 	char *format;
-	int   facility;
+	int facility;
+	switch_bool_t log_uuid;
 } globals;
 
 struct _facility_table_entry {
 	char *description;
-	int  facility;
+	int facility;
 };
 
 SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_ident, globals.ident);
@@ -63,33 +64,33 @@
 switch_status_t set_global_facility(const char *facility)
 {
 	const struct _facility_table_entry facilities[] = {
-		{ "auth",     LOG_AUTH     },
- #if !defined (__SVR4) && !defined (__sun)
-		{ "authpriv", LOG_AUTHPRIV },
-                { "ftp",      LOG_FTP      },
+		{"auth", LOG_AUTH},
+#if !defined (__SVR4) && !defined (__sun)
+		{"authpriv", LOG_AUTHPRIV},
+		{"ftp", LOG_FTP},
 #endif
-		{ "cron",     LOG_CRON     },
-		{ "daemon",   LOG_DAEMON   },
-		{ "kern",     LOG_KERN     },
-		{ "local0",   LOG_LOCAL0   },
-		{ "local1",   LOG_LOCAL1   },
-		{ "local2",   LOG_LOCAL2   },
-		{ "local3",   LOG_LOCAL3   },
-		{ "local4",   LOG_LOCAL4   },
-		{ "local5",   LOG_LOCAL5   },
-		{ "local6",   LOG_LOCAL6   },
-		{ "local7",   LOG_LOCAL7   },
-		{ "lpr",      LOG_LPR      },
-		{ "mail",     LOG_MAIL     },
-		{ "news",     LOG_NEWS     },
-		{ "syslog",   LOG_SYSLOG   },
-		{ "user",     LOG_USER     },
-		{ "uucp",     LOG_UUCP     },
-		{ NULL,       0            }
+		{"cron", LOG_CRON},
+		{"daemon", LOG_DAEMON},
+		{"kern", LOG_KERN},
+		{"local0", LOG_LOCAL0},
+		{"local1", LOG_LOCAL1},
+		{"local2", LOG_LOCAL2},
+		{"local3", LOG_LOCAL3},
+		{"local4", LOG_LOCAL4},
+		{"local5", LOG_LOCAL5},
+		{"local6", LOG_LOCAL6},
+		{"local7", LOG_LOCAL7},
+		{"lpr", LOG_LPR},
+		{"mail", LOG_MAIL},
+		{"news", LOG_NEWS},
+		{"syslog", LOG_SYSLOG},
+		{"user", LOG_USER},
+		{"uucp", LOG_UUCP},
+		{NULL, 0}
 	};
 	const struct _facility_table_entry *entry = facilities;
 
-	while(!zstr(entry->description)) {
+	while (!zstr(entry->description)) {
 		if (!strcasecmp(entry->description, facility)) {
 			globals.facility = entry->facility;
 			return SWITCH_STATUS_SUCCESS;
@@ -146,7 +147,11 @@
 
 	/* don't log blank lines */
 	if (!zstr(node->data) && (strspn(node->data, " \t\r\n") < strlen(node->data))) {
-		syslog(syslog_level, "%s", node->data);
+		if (globals.log_uuid && !zstr(node->userdata)) {
+			syslog(syslog_level, "%s %s", node->userdata, node->data);
+		} else {
+			syslog(syslog_level, "%s", node->data);
+		}
 	}
 
 	return SWITCH_STATUS_SUCCESS;
@@ -156,10 +161,10 @@
 {
 	char *cf = "syslog.conf";
 	switch_xml_t cfg, xml, settings, param;
-    
-    /* default log level */
-    log_level = SWITCH_LOG_WARNING;
 
+	/* default log level */
+	log_level = SWITCH_LOG_WARNING;
+
 	/* default facility */
 	globals.facility = DEFAULT_FACILITY;
 
@@ -182,6 +187,8 @@
 					if (log_level == SWITCH_LOG_INVALID) {
 						log_level = SWITCH_LOG_WARNING;
 					}
+				} else if (!strcasecmp(var, "uuid")) {
+					globals.log_uuid = switch_true(val);
 				}
 			}
 		}
@@ -201,7 +208,7 @@
 {
 	switch_status_t status;
 	*module_interface = &console_module_interface;
-	
+
 	memset(&globals, 0, sizeof(globals));
 
 	if ((status = load_config()) != SWITCH_STATUS_SUCCESS) {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_en/mod_say_en.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_en/mod_say_en.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_en/mod_say_en.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -101,11 +101,11 @@
 
 	if (b) {
 		if (b > 1) {
-		   if ((c==0) && (method == SSM_COUNTED)) {
-		     say_file("digits/h-%d0.wav", b);
-		   } else {
-		     say_file("digits/%d0.wav", b);
-		   }
+			if ((c == 0) && (method == SSM_COUNTED)) {
+				say_file("digits/h-%d0.wav", b);
+			} else {
+				say_file("digits/%d0.wav", b);
+			}
 		} else {
 			say_file("digits/%d%d.wav", b, c);
 			c = 0;
@@ -176,9 +176,22 @@
 	int in;
 	int x = 0;
 	int places[9] = { 0 };
-	char sbuf[13] = "";
+	char sbuf[128] = "";
 	switch_status_t status;
 
+	if (method == SSM_ITERATED) {
+		if ((tosay = strip_commas(tosay, sbuf, sizeof(sbuf)))) {
+			char *p;
+			for (p = tosay; p && *p; p++) {
+				say_file("digits/%c.wav", *p);
+			}
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
+			return SWITCH_STATUS_GENERR;
+		}
+		return SWITCH_STATUS_SUCCESS;
+	}
+
 	if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
 		return SWITCH_STATUS_GENERR;
@@ -207,14 +220,6 @@
 				return status;
 			}
 			break;
-		case SSM_ITERATED:
-			{
-				char *p;
-				for (p = tosay; p && *p; p++) {
-					say_file("digits/%c.wav", *p);
-				}
-			}
-			break;
 		default:
 			break;
 		}
@@ -272,7 +277,7 @@
 	uint8_t say_date = 0, say_time = 0, say_year = 0, say_month = 0, say_dow = 0, say_day = 0, say_yesterday = 0, say_today = 0;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	const char *tz = switch_channel_get_variable(channel, "timezone");
-	
+
 	if (type == SST_TIME_MEASUREMENT) {
 		int64_t hours = 0;
 		int64_t minutes = 0;
@@ -360,7 +365,7 @@
 		target = switch_micro_time_now();
 		target_now = switch_micro_time_now();
 	}
-	
+
 	if (tz) {
 		int check = atoi(tz);
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Timezone is [%s]\n", tz);
@@ -410,7 +415,7 @@
 		}
 
 		say_month = say_day = say_dow = 1;
-		
+
 		break;
 	default:
 		break;
@@ -444,9 +449,9 @@
 	if (say_time) {
 		int32_t hour = tm.tm_hour, pm = 0;
 
-		 if (say_date || say_today || say_yesterday || say_dow) {
+		if (say_date || say_today || say_yesterday || say_dow) {
 			say_file("time/at.wav");
-		 }
+		}
 
 		if (hour > 12) {
 			hour -= 12;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_es/mod_say_es.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_es/mod_say_es.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_es/mod_say_es.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -91,67 +91,67 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t play_group(switch_say_method_t method, int a, int b, int c, char *what, switch_core_session_t *session,switch_input_args_t *args) 
-{ 
-	if (a) { 
-		switch(a) { 
-			case 1: 
-				if (b || c) { 
-					say_file("digits/hundred.wav"); 
-				} else { 
-					say_file("digits/100.wav"); 
-				} 
-				break; 
-			case 5: 
-				say_file("digits/500.wav"); 
-				break; 
-			case 7: 
-				say_file("digits/700.wav"); 
-				break; 
-			case 9: 
-				say_file("digits/900.wav"); 
-				break; 
-			default: 
-				say_file("digits/%d.wav", a); 
-				say_file("digits/hundred.wav"); 
-				break; 
-		} 
-	} 
+static switch_status_t play_group(switch_say_method_t method, int a, int b, int c, char *what, switch_core_session_t *session, switch_input_args_t *args)
+{
+	if (a) {
+		switch (a) {
+		case 1:
+			if (b || c) {
+				say_file("digits/hundred.wav");
+			} else {
+				say_file("digits/100.wav");
+			}
+			break;
+		case 5:
+			say_file("digits/500.wav");
+			break;
+		case 7:
+			say_file("digits/700.wav");
+			break;
+		case 9:
+			say_file("digits/900.wav");
+			break;
+		default:
+			say_file("digits/%d.wav", a);
+			say_file("digits/hundred.wav");
+			break;
+		}
+	}
 
-	if (b) { 
-		if (b > 1) { 
-			switch (b) { 
-						case 2: if (c) { 
-							say_file("digits/veinti.wav"); 
-														} else { 
-															say_file("digits/20.wav"); 
-														} 
-														break; 
-						default: 
-							say_file("digits/%d0.wav", b); 
-							if (c) 
-							{ 
-								say_file("currency/and.wav"); 
-							} 
-							break; 
-			} 
-		} else { 
-			say_file("digits/%d%d.wav", b, c); 
-			c = 0; 
-		} 
-	} 
-	if (c) { 
-		if (method == SSM_COUNTED) { 
-			say_file("digits/h-%d.wav", c); 
-		} else { 
-			say_file("digits/%d.wav", c); 
-		} 
-	} 
-	if (what && (a || b || c)) { 
-		say_file(what); 
-	} 
-	return SWITCH_STATUS_SUCCESS; 
-} 
+	if (b) {
+		if (b > 1) {
+			switch (b) {
+			case 2:
+				if (c) {
+					say_file("digits/veinti.wav");
+				} else {
+					say_file("digits/20.wav");
+				}
+				break;
+			default:
+				say_file("digits/%d0.wav", b);
+				if (c) {
+					say_file("currency/and.wav");
+				}
+				break;
+			}
+		} else {
+			say_file("digits/%d%d.wav", b, c);
+			c = 0;
+		}
+	}
+	if (c) {
+		if (method == SSM_COUNTED) {
+			say_file("digits/h-%d.wav", c);
+		} else {
+			say_file("digits/%d.wav", c);
+		}
+	}
+	if (what && (a || b || c)) {
+		say_file(what);
+	}
+	return SWITCH_STATUS_SUCCESS;
+}
 
 static char *strip_commas(char *in, char *out, switch_size_t len)
 {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_hu/mod_say_hu.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_hu/mod_say_hu.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_hu/mod_say_hu.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -91,7 +91,8 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t play_group(switch_say_method_t method, int a, int b, int c, char *what, int tosay, switch_core_session_t *session, switch_input_args_t *args)
+static switch_status_t play_group(switch_say_method_t method, int a, int b, int c, char *what, int tosay, switch_core_session_t *session,
+								  switch_input_args_t *args)
 {
 	if (a) {
 		say_file("digits/%d.wav", a);
@@ -100,11 +101,11 @@
 
 	if (b) {
 		if (b > 2) {
-		   if ((c==0) && (method == SSM_COUNTED)) {
-		     say_file("digits/h-%d0.wav", b);
-		   } else {
-		     say_file("digits/%d0.wav", b);
-		   }
+			if ((c == 0) && (method == SSM_COUNTED)) {
+				say_file("digits/h-%d0.wav", b);
+			} else {
+				say_file("digits/%d0.wav", b);
+			}
 		} else {
 			say_file("digits/%d%d.wav", b, c);
 			c = 0;
@@ -198,10 +199,12 @@
 		switch (method) {
 		case SSM_COUNTED:
 		case SSM_PRONOUNCED:
-			if ((status = play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/million.wav", number, session, args)) != SWITCH_STATUS_SUCCESS) {
+			if ((status =
+				 play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/million.wav", number, session, args)) != SWITCH_STATUS_SUCCESS) {
 				return status;
 			}
-			if ((status = play_group(SSM_PRONOUNCED, places[5], places[4], places[3], "digits/thousand.wav", number, session, args)) != SWITCH_STATUS_SUCCESS) {
+			if ((status =
+				 play_group(SSM_PRONOUNCED, places[5], places[4], places[3], "digits/thousand.wav", number, session, args)) != SWITCH_STATUS_SUCCESS) {
 				return status;
 			}
 			if ((status = play_group(method, places[2], places[1], places[0], NULL, number, session, args)) != SWITCH_STATUS_SUCCESS) {
@@ -273,7 +276,7 @@
 	uint8_t say_date = 0, say_time = 0, say_year = 0, say_month = 0, say_dow = 0, say_day = 0, say_yesterday = 0, say_today = 0;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	const char *tz = switch_channel_get_variable(channel, "timezone");
-	
+
 	if (type == SST_TIME_MEASUREMENT) {
 		int64_t hours = 0;
 		int64_t minutes = 0;
@@ -349,7 +352,7 @@
 		target = switch_micro_time_now();
 		target_now = switch_micro_time_now();
 	}
-	
+
 	if (tz) {
 		int check = atoi(tz);
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Timezone is [%s]\n", tz);
@@ -399,7 +402,7 @@
 		}
 
 		say_month = say_day = say_dow = 1;
-		
+
 		break;
 	default:
 		break;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_it/mod_say_it.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_it/mod_say_it.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_it/mod_say_it.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -181,65 +181,66 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
 		return SWITCH_STATUS_GENERR;
 	}
-    
-    /* Get in */
+
+	/* Get in */
 	in = atoi(tosay);
-    
-    /* Check if number too big */
-    if (in > 999999999) {
-        /* Fail */
-        return SWITCH_STATUS_FALSE;
-    }
 
-    /* Check if number isin't zero */
+	/* Check if number too big */
+	if (in > 999999999) {
+		/* Fail */
+		return SWITCH_STATUS_FALSE;
+	}
+
+	/* Check if number isin't zero */
 	if (in != 0) {
-        
-        /* Init x to 0 */
-        places_count = 0;
-        
-        /* Loop until in is greater than zero */
-        do {
-            /* Get last digit */
-            places[places_count] = in % 10;
-            
-            /* Drop last digit */
-            in = in / 10;
-        }
-        while(in > 0 && ++places_count > 0 /* fake check to put in while */);
-        
+
+		/* Init x to 0 */
+		places_count = 0;
+
+		/* Loop until in is greater than zero */
+		do {
+			/* Get last digit */
+			places[places_count] = in % 10;
+
+			/* Drop last digit */
+			in = in / 10;
+		}
+		while (in > 0 && ++places_count > 0 /* fake check to put in while */ );
+
 		switch (method) {
 		case SSM_COUNTED:
 		case SSM_PRONOUNCED:
-            
-            /* Check for milions */
-            if (places_count > 5) {
-                /* Check if the millions digit is one (digit 6 = 1, digit 7 and 8 = 0) */
-                if (places[6] == 1 && places[7] == 0 && places[8] == 0) {
-                    say_file("digits/un.wav");
-                    say_file("digits/million.wav");
-                } else {
-                    /* Play millions group (digits/million.wav should be digits/millions.wav) */
-                    if ((status = play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/million.wav", session, args)) != SWITCH_STATUS_SUCCESS) {
-                        return status;
-                    }
-                }
-                
-            }
-			
-            /* Check for thousands */
-            if (places_count > 2) {
-                if (places[3] == 1 && places[4] == 0 && places[5] == 0) {
-                    say_file("digits/thousand.wav");
-                } else {
-                    /* Play thousand group */
-                    if ((status = play_group(SSM_PRONOUNCED, places[5], places[4], places[3],
+
+			/* Check for milions */
+			if (places_count > 5) {
+				/* Check if the millions digit is one (digit 6 = 1, digit 7 and 8 = 0) */
+				if (places[6] == 1 && places[7] == 0 && places[8] == 0) {
+					say_file("digits/un.wav");
+					say_file("digits/million.wav");
+				} else {
+					/* Play millions group (digits/million.wav should be digits/millions.wav) */
+					if ((status =
+						 play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/million.wav", session, args)) != SWITCH_STATUS_SUCCESS) {
+						return status;
+					}
+				}
+
+			}
+
+			/* Check for thousands */
+			if (places_count > 2) {
+				if (places[3] == 1 && places[4] == 0 && places[5] == 0) {
+					say_file("digits/thousand.wav");
+				} else {
+					/* Play thousand group */
+					if ((status = play_group(SSM_PRONOUNCED, places[5], places[4], places[3],
 											 "digits/thousands.wav", session, args)) != SWITCH_STATUS_SUCCESS) {
-                        return status;
-                    }
-                }
-            }
-            
-            /* Play last group */
+						return status;
+					}
+				}
+			}
+
+			/* Play last group */
 			if ((status = play_group(method, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) {
 				return status;
 			}
@@ -417,11 +418,11 @@
 	}
 
 	if (say_time) {
-        say_file("time/hours.wav");
+		say_file("time/hours.wav");
 		say_num(tm.tm_hour, SSM_PRONOUNCED);
 
 		if (tm.tm_min) {
-            say_file("time/and.wav");
+			say_file("time/and.wav");
 			say_num(tm.tm_min, SSM_PRONOUNCED);
 		}
 	}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_ru/mod_say_ru.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_ru/mod_say_ru.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_ru/mod_say_ru.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -49,13 +49,14 @@
 #include "mod_say_ru.h"
 
 /* инициализируем массив вариантов произношения цифр описано в define mod_say_ru.h */
-struct say_t matrix[7][8]= {{m_00, m_01, m_02, m_03, m_04, m_05, m_06, m_07},
-				{m_10, m_11, m_12, m_13, m_14, m_15, m_16, m_17},
-				{m_20, m_21, m_22, m_23, m_24, m_25, m_26, m_27},
-				{m_30, m_31, m_32, m_33, m_34, m_35, m_36, m_37},
-				{m_40, m_41, m_42, m_43, m_44, m_45, m_46, m_47},
-				{m_50, m_51, m_52, m_53, m_54, m_55, m_56, m_57},
-				{m_60, m_61, m_62, m_63, m_64, m_65, m_66, m_67}};
+struct say_t matrix[7][8] = { {m_00, m_01, m_02, m_03, m_04, m_05, m_06, m_07},
+{m_10, m_11, m_12, m_13, m_14, m_15, m_16, m_17},
+{m_20, m_21, m_22, m_23, m_24, m_25, m_26, m_27},
+{m_30, m_31, m_32, m_33, m_34, m_35, m_36, m_37},
+{m_40, m_41, m_42, m_43, m_44, m_45, m_46, m_47},
+{m_50, m_51, m_52, m_53, m_54, m_55, m_56, m_57},
+{m_60, m_61, m_62, m_63, m_64, m_65, m_66, m_67}
+};
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_say_ru_load);
 SWITCH_MODULE_DEFINITION(mod_say_ru, mod_say_ru_load, NULL, NULL);
@@ -108,8 +109,8 @@
 		}
 	}
 	return ret;
-}                       
-                       
+}
+
 static switch_status_t ru_spell(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
 {
 	char *p;
@@ -133,83 +134,83 @@
 								  unit_t what, switch_core_session_t *session, switch_input_args_t *args)
 {
 	if (a) {
-		if (((b==0)&&(c==0))||(matrix[casus][say_type].all==1)) { //если b и с равны 0 то сказать шестьсот, сестисотый, шестисотая
-			if (what==million)	{              //префикс		      число          окончание
+		if (((b == 0) && (c == 0)) || (matrix[casus][say_type].all == 1)) {	//если b и с равны 0 то сказать шестьсот, сестисотый, шестисотая
+			if (what == million) {	//префикс           число          окончание
 				say_file("digits/%s%d00%s.wav", matrix[casus][say_type].million[12], a, matrix[casus][say_type].million[13]);
 				say_file("digits/%s.wav", matrix[casus][say_type].million[11]);
-			} else if (what==thousand) {
+			} else if (what == thousand) {
 				say_file("digits/%s%d00%s.wav", matrix[casus][say_type].thousand[12], a, matrix[casus][say_type].thousand[13]);
 				say_file("digits/%s.wav", matrix[casus][say_type].thousand[11]);
 			} else {
 				say_file("digits/%s%d00%s.wav", matrix[casus][say_type].num[6], a, matrix[casus][say_type].num[7]);
 			}
-		} else { //если дальше есть цифры то тысячи и миллионы не прозносить пока
-			say_file("digits/%d00.wav",a);
+		} else {				//если дальше есть цифры то тысячи и миллионы не прозносить пока
+			say_file("digits/%d00.wav", a);
 		}
 	}
 
 	if (b) {
-		if (b>1) { //если 20 и больше
-			if ((c==0)||(matrix[casus][say_type].all==1)) { //если с равны 0 то сказать 20, двадцати, двадцатая
-				if (what==million) {              //префикс		      число          окончание
+		if (b > 1) {			//если 20 и больше
+			if ((c == 0) || (matrix[casus][say_type].all == 1)) {	//если с равны 0 то сказать 20, двадцати, двадцатая
+				if (what == million) {	//префикс            число          окончание
 					say_file("digits/%s%d0%s.wav", matrix[casus][say_type].million[12], b, matrix[casus][say_type].million[13]);
 					say_file("digits/%s.wav", matrix[casus][say_type].million[11]);
-				} else if (what==thousand) {
+				} else if (what == thousand) {
 					say_file("digits/%s%d0%s.wav", matrix[casus][say_type].thousand[12], b, matrix[casus][say_type].thousand[13]);
 					say_file("digits/%s.wav", matrix[casus][say_type].thousand[11]);
 				} else {
 					say_file("digits/%s%d0%s.wav", matrix[casus][say_type].num[6], b, matrix[casus][say_type].num[7]);
 				}
-			} else { //если есть дальше цифры
-				say_file("digits/%d0.wav",b);
+			} else {			//если есть дальше цифры
+				say_file("digits/%d0.wav", b);
 			}
-		} else { //от 10 до 19
-			if (what==million) {
+		} else {				//от 10 до 19
+			if (what == million) {
 				say_file("digits/%s%d%d%s.wav", matrix[casus][say_type].million[12], b, c, matrix[casus][say_type].million[13]);
 				say_file("digits/%s.wav", matrix[casus][say_type].million[11]);
-			} else if (what==thousand) {
+			} else if (what == thousand) {
 				say_file("digits/%s%d%d%s.wav", matrix[casus][say_type].thousand[12], b, c, matrix[casus][say_type].thousand[13]);
 				say_file("digits/%s.wav", matrix[casus][say_type].thousand[11]);
-			} else { //просто произнести цифры с префиксом и окончанием
+			} else {			//просто произнести цифры с префиксом и окончанием
 				say_file("digits/%s%d%d%s.wav", matrix[casus][say_type].num[6], b, c, matrix[casus][say_type].num[7]);
 			}
-			c=0;
+			c = 0;
 		}
 	}
 
-	if (c||what==zero) {
-		if (c<=5) {
-			if (what==million) {
-				if ((strlen(matrix[casus][say_type].million[c*2])) > 0) { // не произносить если не заданно например 1 миллион а просто миллион
-					say_file("digits/%s.wav", matrix[casus][say_type].million[c*2])
+	if (c || what == zero) {
+		if (c <= 5) {
+			if (what == million) {
+				if ((strlen(matrix[casus][say_type].million[c * 2])) > 0) {	// не произносить если не заданно например 1 миллион а просто миллион
+					say_file("digits/%s.wav", matrix[casus][say_type].million[c * 2])
 				}
-				say_file("digits/%s.wav", matrix[casus][say_type].million[c*2+1]);
-			} else if (what==thousand) {
-				if ((strlen(matrix[casus][say_type].thousand[c*2])) > 0) { // не произносить если не заданно например одна тысячас  а просто тысяча
-					say_file("digits/%s.wav", matrix[casus][say_type].thousand[c*2])
+				say_file("digits/%s.wav", matrix[casus][say_type].million[c * 2 + 1]);
+			} else if (what == thousand) {
+				if ((strlen(matrix[casus][say_type].thousand[c * 2])) > 0) {	// не произносить если не заданно например одна тысячас  а просто тысяча
+					say_file("digits/%s.wav", matrix[casus][say_type].thousand[c * 2])
 				}
-				say_file("digits/%s.wav", matrix[casus][say_type].thousand[c*2+1]);
-			} else { //просто произнести цифры с префиксом и окончанием
+				say_file("digits/%s.wav", matrix[casus][say_type].thousand[c * 2 + 1]);
+			} else {			//просто произнести цифры с префиксом и окончанием
 				say_file("digits/%s.wav", matrix[casus][say_type].num[c]);
 			}
-		} else /* больше 5 */ {
-			if (what==million) {
+		} else {				/* больше 5 */
+
+			if (what == million) {
 				say_file("digits/%s%d%s.wav", matrix[casus][say_type].million[12], c, matrix[casus][say_type].million[13]);
 				say_file("digits/%s.wav", matrix[casus][say_type].million[11]);
-			} else if (what==thousand) {
+			} else if (what == thousand) {
 				say_file("digits/%s%d%s.wav", matrix[casus][say_type].thousand[12], c, matrix[casus][say_type].thousand[13]);
 				say_file("digits/%s.wav", matrix[casus][say_type].thousand[11]);
-			} else { //просто произнести цифры с префиксом и окончанием
+			} else {			//просто произнести цифры с префиксом и окончанием
 				say_file("digits/%s%d%s.wav", matrix[casus][say_type].num[6], c, matrix[casus][say_type].num[7]);
 			}
 		}
 	}
 	return SWITCH_STATUS_SUCCESS;
-}                                                                                                                                                                                                                                                                                                    
+}
 
 
-static switch_status_t ru_say_count(switch_core_session_t *session,
-									char *tosay, say_type_t say_type, casus_t casus, switch_input_args_t *args)
+static switch_status_t ru_say_count(switch_core_session_t *session, char *tosay, say_type_t say_type, casus_t casus, switch_input_args_t *args)
 {
 	int in;
 	int x = 0;
@@ -237,41 +238,45 @@
 			}
 		}
 
-		//миллионы		
-		if (places[8] || places[7] || places[6])	{
-			if ((in_%1000000>0)&&(matrix[casus][say_type].all != 1))   {// если поле миллионов  есть цифры поизнести как числительое именительного падежа
+		//миллионы      
+		if (places[8] || places[7] || places[6]) {
+			if ((in_ % 1000000 > 0) && (matrix[casus][say_type].all != 1)) {	// если поле миллионов  есть цифры поизнести как числительое именительного падежа
 				if ((status = play_group(male_c, nominativus, places[8], places[7], places[6], million, session, args)) != SWITCH_STATUS_SUCCESS) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d million! status=%d\n", places[8], places[7], places[6],status);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d million! status=%d\n", places[8], places[7], places[6],
+									  status);
 					return status;
 				}
-			} else {// иначе произнести в нужном падеже
-				if ((status = play_group(say_type,casus, places[8], places[7], places[6],million, session, args)) != SWITCH_STATUS_SUCCESS) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d million! status=%d\n", places[8], places[7], places[6],status);
+			} else {			// иначе произнести в нужном падеже
+				if ((status = play_group(say_type, casus, places[8], places[7], places[6], million, session, args)) != SWITCH_STATUS_SUCCESS) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d million! status=%d\n", places[8], places[7], places[6],
+									  status);
 					return status;
 				}
 			}
 		}
-		//тысячи		
-		if (places[5]||places[4]||places[3])	{
-			if ((in_%1000>0)&&(matrix[casus][say_type].all != 1))   {// если поле миллионов  есть цифры поизнести как числительое именительного падежа
-				if ((status = play_group(male_c, nominativus, places[5], places[4], places[3],thousand,  session, args)) != SWITCH_STATUS_SUCCESS) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d thousand! status=%d\n", places[5], places[4], places[3],status);
+		//тысячи      
+		if (places[5] || places[4] || places[3]) {
+			if ((in_ % 1000 > 0) && (matrix[casus][say_type].all != 1)) {	// если поле миллионов  есть цифры поизнести как числительое именительного падежа
+				if ((status = play_group(male_c, nominativus, places[5], places[4], places[3], thousand, session, args)) != SWITCH_STATUS_SUCCESS) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d thousand! status=%d\n", places[5], places[4], places[3],
+									  status);
 					return status;
 				}
-			} else {// иначе произнести в нужном падеже
-				if ((status = play_group(say_type, casus, places[5], places[4], places[3], thousand,session, args)) != SWITCH_STATUS_SUCCESS) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d thousand! status=%d\n", places[5], places[4], places[3],status);
+			} else {			// иначе произнести в нужном падеже
+				if ((status = play_group(say_type, casus, places[5], places[4], places[3], thousand, session, args)) != SWITCH_STATUS_SUCCESS) {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d thousand! status=%d\n", places[5], places[4], places[3],
+									  status);
 					return status;
 				}
 			}
 		}
 		// сотни
 		if ((status = play_group(say_type, casus, places[2], places[1], places[0], empty, session, args)) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d thousand! status=%d\n", places[5], places[4], places[3],status);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d thousand! status=%d\n", places[5], places[4], places[3], status);
 			return status;
 		}
-	} else { 
-		if ((status = play_group(say_type, casus, places[2], places[1], places[0], zero, session, args)) != SWITCH_STATUS_SUCCESS)  {
+	} else {
+		if ((status = play_group(say_type, casus, places[2], places[1], places[0], zero, session, args)) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d other!\n", places[2], places[1], places[0]);
 			return status;
 		}
@@ -285,26 +290,26 @@
 											char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
 {
 	switch_status_t status;
-	casus_t casus; //падеж
-	say_type_t say_type;//тип произношения
+	casus_t casus;				//падеж
+	say_type_t say_type;		//тип произношения
 
 	switch (type) {
-		case SST_MESSAGES:
-			say_type=it_c;
-			casus=nominativus;
-			break;
-		default:
-			say_type=male_c;
-			casus=nominativus;
-			break;                                                	    
+	case SST_MESSAGES:
+		say_type = it_c;
+		casus = nominativus;
+		break;
+	default:
+		say_type = male_c;
+		casus = nominativus;
+		break;
 	};
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " type=%d   casus=%d\n", say_type,casus);
-	status=ru_say_count(session,tosay,say_type,casus,args);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " type=%d   casus=%d\n", say_type, casus);
+	status = ru_say_count(session, tosay, say_type, casus, args);
 	return status;
 }
 
 static switch_status_t ru_say_money(switch_core_session_t *session, char *tosay, switch_say_type_t type,
-									switch_say_method_t method,switch_input_args_t *args)
+									switch_say_method_t method, switch_input_args_t *args)
 {
 	char sbuf[16] = "";
 	char *rubles = NULL;
@@ -314,7 +319,7 @@
 	int ikopecks = 0;
 	int ikopeck = 0;
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_money %s\n",tosay );
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_money %s\n", tosay);
 
 	if (strlen(tosay) > 15 || !(tosay = strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@@ -338,24 +343,24 @@
 		rubles++;
 	}
 
-	ru_say_count(session,rubles ,male_c,nominativus ,args);
+	ru_say_count(session, rubles, male_c, nominativus, args);
 
 	if (rubles) {
-		irubles = atoi(rubles)%100;
-		iruble = atoi(rubles)%10;
+		irubles = atoi(rubles) % 100;
+		iruble = atoi(rubles) % 10;
 	}
 
-	if (irubles == 1 || (irubles > 20 && iruble == 1)) {/* рубль */
+	if (irubles == 1 || (irubles > 20 && iruble == 1)) {	/* рубль */
 		say_file("currency/ruble.wav");
-	} else if ((irubles > 1 && irubles < 5) || (irubles > 20 && iruble > 1 && iruble < 5)) {  /*рубля */
+	} else if ((irubles > 1 && irubles < 5) || (irubles > 20 && iruble > 1 && iruble < 5)) {	/*рубля */
 		say_file("currency/ruble-a.wav");
-	} else { /*рублей */
+	} else {					/*рублей */
 		say_file("currency/rubles.wav");
 	}
 
 	/* Say kopecks */
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " %s\n",kopecks );
-	ru_say_count(session, kopecks ,female_c, nominativus, args);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " %s\n", kopecks);
+	ru_say_count(session, kopecks, female_c, nominativus, args);
 
 	if (kopecks) {
 		ikopecks = atoi(kopecks) % 100;
@@ -386,7 +391,7 @@
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	const char *tz = switch_channel_get_variable(channel, "timezone");
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_time %s  type=%d method=%d\n",tosay, type,method );
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_time %s  type=%d method=%d\n", tosay, type, method);
 
 	if (type == SST_TIME_MEASUREMENT) {
 		int64_t hours = 0;
@@ -428,38 +433,38 @@
 			}
 		}
 
-		switch_snprintf(buf, sizeof(buf), "%u", (unsigned)hours);
-		ru_say_count(session,buf ,male_c,nominativus,args);
+		switch_snprintf(buf, sizeof(buf), "%u", (unsigned) hours);
+		ru_say_count(session, buf, male_c, nominativus, args);
 
-		if (((hours%10) == 1) && (hours!=11)) {
+		if (((hours % 10) == 1) && (hours != 11)) {
 			/* час */
 			say_file("time/hour.wav");
-		} else if (((hours%10>1)&&(hours%10<5)) &&((hours<12)||(hours>14))) {
-			say_file("time/hours-a.wav");  /* часа */
+		} else if (((hours % 10 > 1) && (hours % 10 < 5)) && ((hours < 12) || (hours > 14))) {
+			say_file("time/hours-a.wav");	/* часа */
 		} else {
-			say_file("time/hours.wav"); /* часов*/
+			say_file("time/hours.wav");	/* часов */
 		}
 
-		switch_snprintf(buf, sizeof(buf), "%u", (unsigned)minutes); //перевести минуты в *char
-		ru_say_count(session,buf ,female_c,nominativus,args);
+		switch_snprintf(buf, sizeof(buf), "%u", (unsigned) minutes);	//перевести минуты в *char
+		ru_say_count(session, buf, female_c, nominativus, args);
 
-		if (((minutes%10) == 1) && (minutes!=11)) {
-			say_file("time/minute.wav"); //минута
-		} else if (((minutes%10>1)&&(minutes%10<5))&&((minutes<12)||(minutes>14))){
-			say_file("time/minutes-i.wav"); // минуты
+		if (((minutes % 10) == 1) && (minutes != 11)) {
+			say_file("time/minute.wav");	//минута
+		} else if (((minutes % 10 > 1) && (minutes % 10 < 5)) && ((minutes < 12) || (minutes > 14))) {
+			say_file("time/minutes-i.wav");	// минуты
 		} else {
-			say_file("time/minutes.wav"); //минут
+			say_file("time/minutes.wav");	//минут
 		}
 
-		if (seconds!=0) {
-			switch_snprintf(buf, sizeof(buf), "%u", (unsigned)seconds);
-			ru_say_count(session,buf ,female_c,nominativus,args);
-			if (((seconds%10) == 1) && (seconds!=11)) {
-				say_file("time/second.wav"); // секунда
-			} else if (((seconds%10>1)&&(seconds%10<5))&&((seconds<12)||(seconds>14))) {
-				say_file("time/seconds-i.wav"); // секуны
+		if (seconds != 0) {
+			switch_snprintf(buf, sizeof(buf), "%u", (unsigned) seconds);
+			ru_say_count(session, buf, female_c, nominativus, args);
+			if (((seconds % 10) == 1) && (seconds != 11)) {
+				say_file("time/second.wav");	// секунда
+			} else if (((seconds % 10 > 1) && (seconds % 10 < 5)) && ((seconds < 12) || (seconds > 14))) {
+				say_file("time/seconds-i.wav");	// секуны
 			} else {
-				say_file("time/seconds.wav"); //секунд
+				say_file("time/seconds.wav");	//секунд
 			}
 		}
 		return SWITCH_STATUS_SUCCESS;
@@ -488,43 +493,43 @@
 	}
 
 	switch (type) {
-		case SST_CURRENT_DATE_TIME:
-			say_date = say_time = 1;
-			break;
-		case SST_CURRENT_DATE:
+	case SST_CURRENT_DATE_TIME:
+		say_date = say_time = 1;
+		break;
+	case SST_CURRENT_DATE:
+		say_date = 1;
+		break;
+	case SST_CURRENT_TIME:
+		say_time = 1;
+		break;
+	case SST_SHORT_DATE_TIME:
+		say_time = 1;
+		if (tm.tm_year != tm_now.tm_year) {
 			say_date = 1;
 			break;
-		case SST_CURRENT_TIME:
-			say_time = 1;
+		}
+		if (tm.tm_yday == tm_now.tm_yday) {
+			say_today = 1;
 			break;
-		case SST_SHORT_DATE_TIME:
-			say_time = 1;
-			if (tm.tm_year != tm_now.tm_year) {
-				say_date = 1;
-				break;
-			}
-			if (tm.tm_yday == tm_now.tm_yday) {
-				say_today = 1;
-				break;
-			}
-			if (tm.tm_yday == tm_now.tm_yday - 1) {
-				say_yesterday = 1;
-				break;
-			}
-			if (tm.tm_yday >= tm_now.tm_yday - 5) {
-				say_dow = 1;
-				break;
-			}
-			if (tm.tm_mon != tm_now.tm_mon) {
-				say_month = say_day = say_dow = 1;
-				break;
-			}
-
+		}
+		if (tm.tm_yday == tm_now.tm_yday - 1) {
+			say_yesterday = 1;
+			break;
+		}
+		if (tm.tm_yday >= tm_now.tm_yday - 5) {
+			say_dow = 1;
+			break;
+		}
+		if (tm.tm_mon != tm_now.tm_mon) {
 			say_month = say_day = say_dow = 1;
+			break;
+		}
 
-			break;
-		default:
-			break;
+		say_month = say_day = say_dow = 1;
+
+		break;
+	default:
+		break;
 	}
 
 	if (say_today) {
@@ -541,30 +546,28 @@
 		say_today = say_yesterday = 0;
 	}
 	if (say_day) {
-		switch_snprintf(buf, sizeof(buf), "%u", (unsigned)tm.tm_mday);
-		ru_say_count(session,buf ,male_h,genitivus,args);
+		switch_snprintf(buf, sizeof(buf), "%u", (unsigned) tm.tm_mday);
+		ru_say_count(session, buf, male_h, genitivus, args);
 	}
 	if (say_month) {
 		say_file("time/mon-%d.wav", tm.tm_mon);
 	}
 	if (say_year) {
-		switch_snprintf(buf, sizeof(buf), "%u", (unsigned)(tm.tm_year + 1900));
-		ru_say_count(session,buf ,male_h,genitivus,args);
+		switch_snprintf(buf, sizeof(buf), "%u", (unsigned) (tm.tm_year + 1900));
+		ru_say_count(session, buf, male_h, genitivus, args);
 		say_file("time/h-year.wav");
 	}
-	if (say_month||say_year||say_date||say_dow)
-	{
+	if (say_month || say_year || say_date || say_dow) {
 		say_file("time/at.wav");
 	}
 	if (say_time) {
-		switch_snprintf(buf, sizeof(buf), "%d:%d:%d",tm.tm_hour+1,tm.tm_min,tm.tm_sec);
+		switch_snprintf(buf, sizeof(buf), "%d:%d:%d", tm.tm_hour + 1, tm.tm_min, tm.tm_sec);
 		ru_say_time(session, buf, SST_TIME_MEASUREMENT, method, args);
 	}
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t ru_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method,
-							 switch_input_args_t *args)
+static switch_status_t ru_ip(switch_core_session_t *session, char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
 {
 	char *a, *b, *c, *d;
 	if (!(a = switch_core_session_strdup(session, tosay))) {
@@ -589,16 +592,16 @@
 
 	*d++ = '\0';
 
-	ru_say_count(session,a ,male_c,nominativus,args);
+	ru_say_count(session, a, male_c, nominativus, args);
 	say_file("digits/dot.wav");
 
-	ru_say_count(session,b ,male_c,nominativus,args);
+	ru_say_count(session, b, male_c, nominativus, args);
 	say_file("digits/dot.wav");
 
-	ru_say_count(session,c ,male_c,nominativus,args);
+	ru_say_count(session, c, male_c, nominativus, args);
 	say_file("digits/dot.wav");
 
-	ru_say_count(session,d ,male_c,nominativus,args);
+	ru_say_count(session, d, male_c, nominativus, args);
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -607,40 +610,40 @@
 	switch_say_callback_t say_cb = NULL;
 
 	switch (type) {
-			case SST_NUMBER:
-			case SST_ITEMS:
-			case SST_PERSONS:
-			case SST_MESSAGES:
-				say_cb = ru_say_general_count;
-				break;
-			case SST_TIME_MEASUREMENT:
-				say_cb = ru_say_time;
-				break;
+	case SST_NUMBER:
+	case SST_ITEMS:
+	case SST_PERSONS:
+	case SST_MESSAGES:
+		say_cb = ru_say_general_count;
+		break;
+	case SST_TIME_MEASUREMENT:
+		say_cb = ru_say_time;
+		break;
 
-			case SST_CURRENT_DATE:
-				say_cb = ru_say_time;
-				break;
+	case SST_CURRENT_DATE:
+		say_cb = ru_say_time;
+		break;
 
-			case SST_CURRENT_TIME:
-				say_cb = ru_say_time;
-				break;
+	case SST_CURRENT_TIME:
+		say_cb = ru_say_time;
+		break;
 
-			case SST_CURRENT_DATE_TIME:
-				say_cb = ru_say_time;
-				break;
-			case SST_IP_ADDRESS:
-				say_cb = ru_ip;
-				break;
-			case SST_NAME_SPELLED:
-			case SST_NAME_PHONETIC:
-				say_cb = ru_spell;
-				break;
-			case SST_CURRENCY:
-				say_cb = ru_say_money;
-				break;
-			default:
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", type);
-				break;
+	case SST_CURRENT_DATE_TIME:
+		say_cb = ru_say_time;
+		break;
+	case SST_IP_ADDRESS:
+		say_cb = ru_ip;
+		break;
+	case SST_NAME_SPELLED:
+	case SST_NAME_PHONETIC:
+		say_cb = ru_spell;
+		break;
+	case SST_CURRENCY:
+		say_cb = ru_say_money;
+		break;
+	default:
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", type);
+		break;
 	}
 
 	if (say_cb) {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_ru/mod_say_ru.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_ru/mod_say_ru.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_ru/mod_say_ru.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -5,52 +5,52 @@
  * mod_say_ru.c -- Say for Russian
  *
  */
-         
 
+
 //слишком много падежей поэтому пришлось сделать массив значений
 //пример таблицы склонений для 1 ниже по ссылкам
 //http://ru.wiktionary.org/wiki/%D0%BE%D0%B4%D0%B8%D0%BD
 //http://ru.wiktionary.org/wiki/%D0%BF%D0%B5%D1%80%D0%B2%D1%8B%D0%B9
 
 typedef enum {
-    million,
-    thousand,
-    zero,
-    empty       
+	million,
+	thousand,
+	zero,
+	empty
 } unit_t;
 
 //тип числа порядковое или количественное
-typedef enum{
-    nominativus,        // именительный Кто? Что?
-    genitivus,          // Родительный  Кого? Чего?
-    dativus,            // дательный    Кого? Что?
-    accusativus_a,      // Винительный  Кого? animate - одушевлённый
-    accusativus_i,      // Винительный  Что?  inanimate - неодушевлённый
-    instrumentalis,     // Творительный Кем? Чем?
-    prepositive         // Предложный   О ком? О чём?
+typedef enum {
+	nominativus,				// именительный Кто? Что?
+	genitivus,					// Родительный  Кого? Чего?
+	dativus,					// дательный    Кого? Что?
+	accusativus_a,				// Винительный  Кого? animate - одушевлённый
+	accusativus_i,				// Винительный  Что?  inanimate - неодушевлённый
+	instrumentalis,				// Творительный Кем? Чем?
+	prepositive					// Предложный   О ком? О чём?
 } casus_t;
-                            
 
+
 typedef enum {
-   //количественный
-    male_c,       //мужского пола
-    it_c,         //среднего
-    female_c,     //женского
-    plural_c,     //множественное число
-    //порядковый
-    male_h,       //порядковое мужского пола
-    it_h,         //порядковое среднего
-    female_h,     //порядковое женского
-    plural_h      //порядковое множественное число
+	//количественный
+	male_c,						//мужского пола
+	it_c,						//среднего
+	female_c,					//женского
+	plural_c,					//множественное число
+	//порядковый
+	male_h,						//порядковое мужского пола
+	it_h,						//порядковое среднего
+	female_h,					//порядковое женского
+	plural_h					//порядковое множественное число
 } say_type_t;
-                    
 
 
-struct say_t{
-    char *num[8];
-    char *thousand[14];
-    char *million[14];
-    int all;
+
+struct say_t {
+	char *num[8];
+	char *thousand[14];
+	char *million[14];
+	int all;
 };
 
 
@@ -69,7 +69,7 @@
 	{"","","1","million","2","million-a","3","million-a","4","million-a","5","millions","",""},\
 	0,\
 }\
-//средний род именительный падеж
+								//средний род именительный падеж
 #define m_01 {\
 	{"0","1n","2","3","4","5","",""},\
 	{"","","1f","thousand","2f","thousands-i","3","thousands-i","4","thousands-i","5","thousands","",""},\
@@ -101,14 +101,14 @@
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//средний
+								//средний
 #define m_05 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//женский
+								//женский
 #define m_06 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
@@ -135,7 +135,7 @@
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//средний
+								//средний
 #define m_11 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
@@ -168,14 +168,14 @@
 	{"","","","h-millionx","h-2xx","h-millionx","h-3xx","h-millionx","h-4xx","h-millionx","h-5xx","h-millionx","h-","xx"},\
 	0,\
 }\
-//средний
+								//средний
 #define m_15 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//женский
+								//женский
 #define m_16 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
@@ -202,7 +202,7 @@
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//средний
+								//средний
 #define m_21 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
@@ -234,14 +234,14 @@
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//средний
+								//средний
 #define m_25 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//женский
+								//женский
 #define m_26 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
@@ -268,7 +268,7 @@
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//средний
+								//средний
 #define m_31 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
@@ -300,14 +300,14 @@
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//средний
+								//средний
 #define m_35 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//женский
+								//женский
 #define m_36 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
@@ -334,7 +334,7 @@
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//средний
+								//средний
 #define m_41 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
@@ -366,14 +366,14 @@
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//средний
+								//средний
 #define m_45 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//женский
+								//женский
 #define m_46 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
@@ -400,7 +400,7 @@
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//средний
+								//средний
 #define m_51 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
@@ -432,14 +432,14 @@
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//средний
+								//средний
 #define m_55 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//женский
+								//женский
 #define m_56 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
@@ -466,7 +466,7 @@
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//средний
+								//средний
 #define m_61 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
@@ -498,14 +498,14 @@
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//средний
+								//средний
 #define m_65 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//женский
+								//женский
 #define m_66 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
@@ -532,7 +532,7 @@
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//средний
+								//средний
 #define m_61 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
@@ -564,14 +564,14 @@
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//средний
+								//средний
 #define m_65 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
 	0,\
 }\
-//женский
+								//женский
 #define m_66 {\
 	{"","","","","","","",""},\
 	{"","","","","","","","","","","","","",""},\
@@ -587,5 +587,3 @@
 	0,\
 }\
 
-
-

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_th/mod_say_th.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_th/mod_say_th.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_th/mod_say_th.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -103,11 +103,11 @@
 static char *strip_commas(char *in, char *out, switch_size_t len)
 {
 	char *p = in;
-    char *q = out;
+	char *q = out;
 	char *ret = out;
 	switch_size_t x = 0;
 
-	for ( ; p && *p; p++) {
+	for (; p && *p; p++) {
 		if ((*p >= '0' && *p <= '9')) {
 			*q++ = *p;
 		} else if (*p != ',') {
@@ -127,7 +127,7 @@
 static char *strip_nonnumerics(char *in, char *out, switch_size_t len)
 {
 	char *p = in;
-    char *q = out;
+	char *q = out;
 	char *ret = out;
 	switch_size_t x = 0;
 
@@ -151,8 +151,8 @@
 {
 	int in;
 	char sbuf[13] = "";
-    char digits[11];
-    int i;
+	char digits[11];
+	int i;
 
 	if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@@ -163,123 +163,108 @@
 
 	if (in != 0) {
 		snprintf(digits, sizeof(digits), "%10.10d", in);
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Say: %s \n",digits);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Say: %s \n", digits);
 		switch (method) {
 		case SSM_COUNTED:
 			say_file("digits/ordinal.wav");
 			/* Fall through */
 		case SSM_PRONOUNCED:
-            for (i = 0;  i <= 9;  i++)
-            {
-                switch (i)
-                {
-                case 0:
-                    /* Billions column */
-                    if (digits[i] != '0')
-                    {
-                        if (digits[i] != '1')
-                    		say_file("digits/%c.wav", digits[i]);
-                  		say_file("digits/10.wav");
-                    }
-                    break;
-                case 1:
-                    /* Hundred millions columns */
-                    if (digits[i] != '0')
-                   		say_file("digits/%c.wav", digits[i]);
-                    if (memcmp (digits, "00", 2) != 0)
-                  		say_file("digits/100000000.wav");
-                    break;
-                case 2:
-                    /* ten Millions column */
-                    if (digits[i] != '0')
-                    {
-                   		say_file("digits/%c.wav", digits[i]);
-                   		say_file("digits/10000000.wav");
-                    }
-                    break;
-                case 3:
-                    /* Millions column */
-                    if (digits[i] != '0')
-                    {
-                   		say_file("digits/%c.wav", digits[i]);
-                   		say_file("digits/1000000.wav");
-                    }
-                    break;
-                case 4:
-                    /* Hundred thousands column */
-                    if (digits[i] != '0')
-                    {
-                   		say_file("digits/%c.wav", digits[i]);
-                        if (memcmp (digits + 2, "00000", 4) != 0)
-                       		say_file("digits/100000.wav");
-                    }
+			for (i = 0; i <= 9; i++) {
+				switch (i) {
+				case 0:
+					/* Billions column */
+					if (digits[i] != '0') {
+						if (digits[i] != '1')
+							say_file("digits/%c.wav", digits[i]);
+						say_file("digits/10.wav");
+					}
+					break;
+				case 1:
+					/* Hundred millions columns */
+					if (digits[i] != '0')
+						say_file("digits/%c.wav", digits[i]);
+					if (memcmp(digits, "00", 2) != 0)
+						say_file("digits/100000000.wav");
+					break;
+				case 2:
+					/* ten Millions column */
+					if (digits[i] != '0') {
+						say_file("digits/%c.wav", digits[i]);
+						say_file("digits/10000000.wav");
+					}
+					break;
+				case 3:
+					/* Millions column */
+					if (digits[i] != '0') {
+						say_file("digits/%c.wav", digits[i]);
+						say_file("digits/1000000.wav");
+					}
+					break;
+				case 4:
+					/* Hundred thousands column */
+					if (digits[i] != '0') {
+						say_file("digits/%c.wav", digits[i]);
+						if (memcmp(digits + 2, "00000", 4) != 0)
+							say_file("digits/100000.wav");
+					}
 
-                    break;
-        
-                case 5:
-                    /* Ten thousands column */
-                    if (digits[i] != '0')
-                    {
-                   		say_file("digits/%c.wav", digits[i]);
-                        if (memcmp (digits + 2, "0000", 4) != 0)
-                       		say_file("digits/10000.wav");
-                    }
-                    break;
-                case 6:
-                    /* Ten millions or thousands column */
-                    if (digits[i] != '0')
-                    {
-                   		say_file("digits/%c.wav", digits[i]);
-                  		say_file("digits/1000.wav");
-                    }
-                    break;
-                case 7:
-                    /* hundreds column */
-                    if (digits[i] != '0')
-                    {
-                   		say_file("digits/%c.wav", digits[i]);
-                   		say_file("digits/100.wav");
-                    }
-                    break;
-                case 8:
-                    /* Tens column */
-                    if (digits[i] != '0')
-                    {
-                        if (digits[i] == '2')
-                        {
-                       		say_file("digits/20.wav");
-				break;
-                        }
-                        if (digits[i] == '1')
-                        {
-                       		say_file("digits/10.wav");
-				break;
-                        }
-                        if (digits[i] != '1'
-                            ||
-                            memcmp (digits, "00000000", 8) != 0)
-                        {
-                       		say_file("digits/%c.wav", digits[i]);
-                        }
-                    }
-                    if (digits[8] != '0')
-                   		say_file("digits/10.wav");
-                    break;
-                case 9:
-                    /* Units column */
-                    if (digits[9] == '1'){
-                	    if (digits[8] != '0'){
-                   		say_file("digits/ed.wav", digits[i]);
-			    }else{	
-                   		say_file("digits/%c.wav", digits[i]);
-			    }	
-                	    break;
-		    }
-                    if (digits[9] != '0')
-                   		say_file("digits/%c.wav", digits[i]);
-                    break;
-                }
-            }
+					break;
+
+				case 5:
+					/* Ten thousands column */
+					if (digits[i] != '0') {
+						say_file("digits/%c.wav", digits[i]);
+						if (memcmp(digits + 2, "0000", 4) != 0)
+							say_file("digits/10000.wav");
+					}
+					break;
+				case 6:
+					/* Ten millions or thousands column */
+					if (digits[i] != '0') {
+						say_file("digits/%c.wav", digits[i]);
+						say_file("digits/1000.wav");
+					}
+					break;
+				case 7:
+					/* hundreds column */
+					if (digits[i] != '0') {
+						say_file("digits/%c.wav", digits[i]);
+						say_file("digits/100.wav");
+					}
+					break;
+				case 8:
+					/* Tens column */
+					if (digits[i] != '0') {
+						if (digits[i] == '2') {
+							say_file("digits/20.wav");
+							break;
+						}
+						if (digits[i] == '1') {
+							say_file("digits/10.wav");
+							break;
+						}
+						if (digits[i] != '1' || memcmp(digits, "00000000", 8) != 0) {
+							say_file("digits/%c.wav", digits[i]);
+						}
+					}
+					if (digits[8] != '0')
+						say_file("digits/10.wav");
+					break;
+				case 9:
+					/* Units column */
+					if (digits[9] == '1') {
+						if (digits[8] != '0') {
+							say_file("digits/ed.wav", digits[i]);
+						} else {
+							say_file("digits/%c.wav", digits[i]);
+						}
+						break;
+					}
+					if (digits[9] != '0')
+						say_file("digits/%c.wav", digits[i]);
+					break;
+				}
+			}
 			break;
 		case SSM_ITERATED:
 			{
@@ -338,10 +323,7 @@
 }
 
 static switch_status_t th_say_time(switch_core_session_t *session,
-								   char *tosay,
-								   switch_say_type_t type,
-								   switch_say_method_t method,
-								   switch_input_args_t *args)
+								   char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
 {
 	int32_t t;
 	switch_time_t target = 0;
@@ -351,7 +333,7 @@
 	switch_time_exp_t tm2;
 #endif
 	uint8_t say_date = 0;
-    uint8_t say_time = 0;
+	uint8_t say_time = 0;
 
 	if (type == SST_TIME_MEASUREMENT) {
 		int64_t hours = 0;
@@ -397,16 +379,16 @@
 		if (hours) {
 			if (hours == 2) {
 				say_file("time/2s.wav");
- 			} else {
-			    say_num(hours, SSM_PRONOUNCED);
+			} else {
+				say_num(hours, SSM_PRONOUNCED);
 			}
 			say_file("time/hours.wav");
 		}
 		if (minutes) {
 			if (minutes == 2) {
 				say_file("time/2s.wav");
- 			} else {
-			    say_num(minutes, SSM_PRONOUNCED);
+			} else {
+				say_num(minutes, SSM_PRONOUNCED);
 			}
 			say_file("time/minute.wav");
 		} else {
@@ -419,12 +401,12 @@
 		if (seconds) {
 			if (seconds == 2) {
 				say_file("time/2s.wav");
- 			} else {
-			    say_num(hours, SSM_PRONOUNCED);
+			} else {
+				say_num(hours, SSM_PRONOUNCED);
 			}
 			say_file("time/seconds.wav");
 		} else {
-			if (hours  ||  minutes) {
+			if (hours || minutes) {
 				say_file("digits/0.wav");
 				say_file("time/second.wav");
 			}
@@ -441,8 +423,7 @@
 
 	switch (type) {
 	case SST_CURRENT_DATE_TIME:
-		say_date =
-		say_time = 1;
+		say_date = say_time = 1;
 		break;
 	case SST_CURRENT_DATE:
 		say_date = 1;
@@ -455,7 +436,7 @@
 	}
 
 	if (say_date) {
-        say_num(tm.tm_year + 1900, SSM_ITERATED);
+		say_num(tm.tm_year + 1900, SSM_ITERATED);
 		say_file("time/year.wav");
 		say_num(tm.tm_mon + 1, SSM_PRONOUNCED);
 		say_file("time/month.wav");
@@ -464,52 +445,39 @@
 		say_file("time/day-%d.wav", tm.tm_wday);
 
 #if 0
-        tm = *localtime(&then);
+		tm = *localtime(&then);
 
-        this_morning = switch_micro_time_now();
-    	switch_time_exp_lt(&tm2, this_morning);
-        tm2->tm_hour = 0;
-        tm2->tm_min = 0;
-        tm2->tm_sec = 0;
-        this_morning = mktime(tm2);
+		this_morning = switch_micro_time_now();
+		switch_time_exp_lt(&tm2, this_morning);
+		tm2->tm_hour = 0;
+		tm2->tm_min = 0;
+		tm2->tm_sec = 0;
+		this_morning = mktime(tm2);
 
-        if (this_morning <= then  &&  then < (this_morning + 86400L))
-        {
+		if (this_morning <= then && then < (this_morning + 86400L)) {
 			say_file("time/today.wav");
-        }
-        else if ((this_morning - 86400L) <= then  &&  then < this_morning)
-        {
+		} else if ((this_morning - 86400L) <= then && then < this_morning) {
 			say_file("time/yesterday.wav");
-        }
-        else if ((this_morning + 86400L) <= then  &&  then < (this_morning + 2*86400L))
-        {
+		} else if ((this_morning + 86400L) <= then && then < (this_morning + 2 * 86400L)) {
 			say_file("time/tomorrow.wav");
-        }
-        else if ((this_morning - 7*86400L) <= then  &&  then < this_morning)
-        {
-    		say_file("time/day-%d.wav", tm.tm_wday);
-        }
-        else
-        {
-            if (tm2->tm_year != tm.tm_year)
-            {
-                say_num(tm.tm_year + 1900, SSM_ITERATED);
-		        say_file("time/year.wav");
-            }
-            /*endif*/
-            if (tm2->tm_year != tm.tm_year
-                ||
-                tm2->tm_mon != tm.tm_mon)
-            {
-        		say_num(tm.tm_mon + 1, SSM_PRONOUNCED);
-        		say_file("time/month.wav");
-            }
-            /*endif*/
-            /* Always say the day and the day of the week */
-    		say_num(tm.tm_mday, SSM_PRONOUNCED);
-	    	say_file("time/day.wav");
-    		say_file("time/day-%d.wav", tm.tm_wday);
-        }
+		} else if ((this_morning - 7 * 86400L) <= then && then < this_morning) {
+			say_file("time/day-%d.wav", tm.tm_wday);
+		} else {
+			if (tm2->tm_year != tm.tm_year) {
+				say_num(tm.tm_year + 1900, SSM_ITERATED);
+				say_file("time/year.wav");
+			}
+			/*endif */
+			if (tm2->tm_year != tm.tm_year || tm2->tm_mon != tm.tm_mon) {
+				say_num(tm.tm_mon + 1, SSM_PRONOUNCED);
+				say_file("time/month.wav");
+			}
+			/*endif */
+			/* Always say the day and the day of the week */
+			say_num(tm.tm_mday, SSM_PRONOUNCED);
+			say_file("time/day.wav");
+			say_file("time/day-%d.wav", tm.tm_wday);
+		}
 #endif
 	}
 
@@ -517,13 +485,13 @@
 		int32_t hour = tm.tm_hour;
 
 		if (hour < 6) {
-            say_file("time/morning.wav");
+			say_file("time/morning.wav");
 		} else if (hour < 12) {
-            say_file("time/am.wav");
+			say_file("time/am.wav");
 		} else if (tm.tm_hour < 18) {
-            say_file("time/pm.wav");
+			say_file("time/pm.wav");
 		} else {
-            say_file("time/evening.wav");
+			say_file("time/evening.wav");
 		}
 		if (hour > 12)
 			hour -= 12;
@@ -541,7 +509,7 @@
 		} else {
 			say_num(tm.tm_min, SSM_PRONOUNCED);
 		}
-		say_file("time/minute.wav");  
+		say_file("time/minute.wav");
 	}
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_zh/mod_say_zh.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_zh/mod_say_zh.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/say/mod_say_zh/mod_say_zh.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -103,11 +103,11 @@
 static char *strip_commas(char *in, char *out, switch_size_t len)
 {
 	char *p = in;
-    char *q = out;
+	char *q = out;
 	char *ret = out;
 	switch_size_t x = 0;
 
-	for ( ; p && *p; p++) {
+	for (; p && *p; p++) {
 		if ((*p >= '0' && *p <= '9')) {
 			*q++ = *p;
 		} else if (*p != ',') {
@@ -127,7 +127,7 @@
 static char *strip_nonnumerics(char *in, char *out, switch_size_t len)
 {
 	char *p = in;
-    char *q = out;
+	char *q = out;
 	char *ret = out;
 	switch_size_t x = 0;
 
@@ -151,8 +151,8 @@
 {
 	int in;
 	char sbuf[13] = "";
-    char digits[11];
-    int i;
+	char digits[11];
+	int i;
 
 	if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n");
@@ -168,107 +168,83 @@
 			say_file("digits/ordinal.wav");
 			/* Fall through */
 		case SSM_PRONOUNCED:
-            for (i = 0;  i <= 9;  i++)
-            {
-                switch (i)
-                {
-                case 0:
-                    /* Billions column */
-                    if (digits[i] != '0')
-                    {
-                        if (digits[i] != '1')
-                    		say_file("digits/%c.wav", digits[i]);
-                  		say_file("digits/10.wav");
-                    }
-                    break;
-                case 1:
-                    /* Hundred millions columns */
-                    if (digits[i] != '0')
-                   		say_file("digits/%c.wav", digits[i]);
-                    if (memcmp (digits, "00", 2) != 0)
-                  		say_file("digits/100000000.wav");
-                    break;
-                case 2:
-                case 6:
-                    /* Ten millions or thousands column */
-                    if (digits[i] != '0')
-                    {
-                   		say_file("digits/%c.wav", digits[i]);
-                  		say_file("digits/1000.wav");
-                    }
-                    break;
-                case 3:
-                case 7:
-                    /* Millions or hundreds column */
-                    if (digits[i] != '0')
-                    {
-                   		say_file("digits/%c.wav", digits[i]);
-                   		say_file("digits/100.wav");
-                    }
-                    break;
-                case 4:
-                    /* Hundred thousands column */
-                    if (digits[i] != '0')
-                    {
-                        if (digits[i] != '1'
-                            ||
-                            memcmp (digits, "0000", 4) != 0)
-                        {
-                       		say_file("digits/%c.wav", digits[i]);
-                        }
-                    }
-                    else
-                    {
-                        if (digits[i + 1] != '0'
-                            &&
-                            memcmp (digits, "0000", 4) != 0)
-                        {
-                       		say_file("digits/%c.wav", digits[i]);
-                        }
-                    }
-                    if (digits[i] != '0')
-                   		say_file("digits/10.wav");
-                    break;
-        
-                case 5:
-                    /* Ten thousands column */
-                    if (digits[i] != '0')
-                    {
-                   		say_file("digits/%c.wav", digits[i]);
-                        if (memcmp (digits + 2, "0000", 4) != 0)
-                       		say_file("digits/10000.wav");
-                    }
-                    break;
-                case 8:
-                    /* Tens column */
-                    if (digits[i] != '0')
-                    {
-                        if (digits[i] != '1'
-                            ||
-                            memcmp (digits, "00000000", 8) != 0)
-                        {
-                       		say_file("digits/%c.wav", digits[i]);
-                        }
-                    }
-                    else
-                    {
-                        if (digits[9] != '0'
-                            &&
-                            memcmp (digits, "00000000", 8) != 0)
-                        {
-                       		say_file("digits/%c.wav", digits[i]);
-                        }
-                    }
-                    if (digits[8] != '0')
-                   		say_file("digits/10.wav");
-                    break;
-                case 9:
-                    /* Units column */
-                    if (digits[9] != '0')
-                   		say_file("digits/%c.wav", digits[i]);
-                    break;
-                }
-            }
+			for (i = 0; i <= 9; i++) {
+				switch (i) {
+				case 0:
+					/* Billions column */
+					if (digits[i] != '0') {
+						if (digits[i] != '1')
+							say_file("digits/%c.wav", digits[i]);
+						say_file("digits/10.wav");
+					}
+					break;
+				case 1:
+					/* Hundred millions columns */
+					if (digits[i] != '0')
+						say_file("digits/%c.wav", digits[i]);
+					if (memcmp(digits, "00", 2) != 0)
+						say_file("digits/100000000.wav");
+					break;
+				case 2:
+				case 6:
+					/* Ten millions or thousands column */
+					if (digits[i] != '0') {
+						say_file("digits/%c.wav", digits[i]);
+						say_file("digits/1000.wav");
+					}
+					break;
+				case 3:
+				case 7:
+					/* Millions or hundreds column */
+					if (digits[i] != '0') {
+						say_file("digits/%c.wav", digits[i]);
+						say_file("digits/100.wav");
+					}
+					break;
+				case 4:
+					/* Hundred thousands column */
+					if (digits[i] != '0') {
+						if (digits[i] != '1' || memcmp(digits, "0000", 4) != 0) {
+							say_file("digits/%c.wav", digits[i]);
+						}
+					} else {
+						if (digits[i + 1] != '0' && memcmp(digits, "0000", 4) != 0) {
+							say_file("digits/%c.wav", digits[i]);
+						}
+					}
+					if (digits[i] != '0')
+						say_file("digits/10.wav");
+					break;
+
+				case 5:
+					/* Ten thousands column */
+					if (digits[i] != '0') {
+						say_file("digits/%c.wav", digits[i]);
+						if (memcmp(digits + 2, "0000", 4) != 0)
+							say_file("digits/10000.wav");
+					}
+					break;
+				case 8:
+					/* Tens column */
+					if (digits[i] != '0') {
+						if (digits[i] != '1' || memcmp(digits, "00000000", 8) != 0) {
+							say_file("digits/%c.wav", digits[i]);
+						}
+					} else {
+						if (digits[9] != '0' && memcmp(digits, "00000000", 8) != 0) {
+							say_file("digits/%c.wav", digits[i]);
+						}
+					}
+					if (digits[8] != '0')
+						say_file("digits/10.wav");
+					break;
+				case 9:
+					/* Units column */
+					if (digits[9] != '0')
+						say_file("digits/%c.wav", digits[i]);
+					break;
+				}
+			}
 			break;
 		case SSM_ITERATED:
 			{
@@ -327,10 +303,7 @@
 }
 
 static switch_status_t zh_say_time(switch_core_session_t *session,
-								   char *tosay,
-								   switch_say_type_t type,
-								   switch_say_method_t method,
-								   switch_input_args_t *args)
+								   char *tosay, switch_say_type_t type, switch_say_method_t method, switch_input_args_t *args)
 {
 	int32_t t;
 	switch_time_t target = 0;
@@ -340,7 +313,7 @@
 	switch_time_exp_t tm2;
 #endif
 	uint8_t say_date = 0;
-    uint8_t say_time = 0;
+	uint8_t say_time = 0;
 
 	if (type == SST_TIME_MEASUREMENT) {
 		int64_t hours = 0;
@@ -386,16 +359,16 @@
 		if (hours) {
 			if (hours == 2) {
 				say_file("time/2s.wav");
- 			} else {
-			    say_num(hours, SSM_PRONOUNCED);
+			} else {
+				say_num(hours, SSM_PRONOUNCED);
 			}
 			say_file("time/hours.wav");
 		}
 		if (minutes) {
 			if (minutes == 2) {
 				say_file("time/2s.wav");
- 			} else {
-			    say_num(minutes, SSM_PRONOUNCED);
+			} else {
+				say_num(minutes, SSM_PRONOUNCED);
 			}
 			say_file("time/minute.wav");
 		} else {
@@ -408,12 +381,12 @@
 		if (seconds) {
 			if (seconds == 2) {
 				say_file("time/2s.wav");
- 			} else {
-			    say_num(hours, SSM_PRONOUNCED);
+			} else {
+				say_num(hours, SSM_PRONOUNCED);
 			}
 			say_file("time/seconds.wav");
 		} else {
-			if (hours  ||  minutes) {
+			if (hours || minutes) {
 				say_file("digits/0.wav");
 				say_file("time/second.wav");
 			}
@@ -430,8 +403,7 @@
 
 	switch (type) {
 	case SST_CURRENT_DATE_TIME:
-		say_date =
-		say_time = 1;
+		say_date = say_time = 1;
 		break;
 	case SST_CURRENT_DATE:
 		say_date = 1;
@@ -444,7 +416,7 @@
 	}
 
 	if (say_date) {
-        say_num(tm.tm_year + 1900, SSM_ITERATED);
+		say_num(tm.tm_year + 1900, SSM_ITERATED);
 		say_file("time/year.wav");
 		say_num(tm.tm_mon + 1, SSM_PRONOUNCED);
 		say_file("time/month.wav");
@@ -453,52 +425,39 @@
 		say_file("time/day-%d.wav", tm.tm_wday);
 
 #if 0
-        tm = *localtime(&then);
+		tm = *localtime(&then);
 
-        this_morning = switch_micro_time_now();
-    	switch_time_exp_lt(&tm2, this_morning);
-        tm2->tm_hour = 0;
-        tm2->tm_min = 0;
-        tm2->tm_sec = 0;
-        this_morning = mktime(tm2);
+		this_morning = switch_micro_time_now();
+		switch_time_exp_lt(&tm2, this_morning);
+		tm2->tm_hour = 0;
+		tm2->tm_min = 0;
+		tm2->tm_sec = 0;
+		this_morning = mktime(tm2);
 
-        if (this_morning <= then  &&  then < (this_morning + 86400L))
-        {
+		if (this_morning <= then && then < (this_morning + 86400L)) {
 			say_file("time/today.wav");
-        }
-        else if ((this_morning - 86400L) <= then  &&  then < this_morning)
-        {
+		} else if ((this_morning - 86400L) <= then && then < this_morning) {
 			say_file("time/yesterday.wav");
-        }
-        else if ((this_morning + 86400L) <= then  &&  then < (this_morning + 2*86400L))
-        {
+		} else if ((this_morning + 86400L) <= then && then < (this_morning + 2 * 86400L)) {
 			say_file("time/tomorrow.wav");
-        }
-        else if ((this_morning - 7*86400L) <= then  &&  then < this_morning)
-        {
-    		say_file("time/day-%d.wav", tm.tm_wday);
-        }
-        else
-        {
-            if (tm2->tm_year != tm.tm_year)
-            {
-                say_num(tm.tm_year + 1900, SSM_ITERATED);
-		        say_file("time/year.wav");
-            }
-            /*endif*/
-            if (tm2->tm_year != tm.tm_year
-                ||
-                tm2->tm_mon != tm.tm_mon)
-            {
-        		say_num(tm.tm_mon + 1, SSM_PRONOUNCED);
-        		say_file("time/month.wav");
-            }
-            /*endif*/
-            /* Always say the day and the day of the week */
-    		say_num(tm.tm_mday, SSM_PRONOUNCED);
-	    	say_file("time/day.wav");
-    		say_file("time/day-%d.wav", tm.tm_wday);
-        }
+		} else if ((this_morning - 7 * 86400L) <= then && then < this_morning) {
+			say_file("time/day-%d.wav", tm.tm_wday);
+		} else {
+			if (tm2->tm_year != tm.tm_year) {
+				say_num(tm.tm_year + 1900, SSM_ITERATED);
+				say_file("time/year.wav");
+			}
+			/*endif */
+			if (tm2->tm_year != tm.tm_year || tm2->tm_mon != tm.tm_mon) {
+				say_num(tm.tm_mon + 1, SSM_PRONOUNCED);
+				say_file("time/month.wav");
+			}
+			/*endif */
+			/* Always say the day and the day of the week */
+			say_num(tm.tm_mday, SSM_PRONOUNCED);
+			say_file("time/day.wav");
+			say_file("time/day-%d.wav", tm.tm_wday);
+		}
 #endif
 	}
 
@@ -506,13 +465,13 @@
 		int32_t hour = tm.tm_hour;
 
 		if (hour < 6) {
-            say_file("time/morning.wav");
+			say_file("time/morning.wav");
 		} else if (hour < 12) {
-            say_file("time/am.wav");
+			say_file("time/am.wav");
 		} else if (tm.tm_hour < 18) {
-            say_file("time/pm.wav");
+			say_file("time/pm.wav");
 		} else {
-            say_file("time/evening.wav");
+			say_file("time/evening.wav");
 		}
 		if (hour > 12)
 			hour -= 12;
@@ -530,7 +489,7 @@
 		} else {
 			say_num(tm.tm_min, SSM_PRONOUNCED);
 		}
-		say_file("time/minute.wav");  
+		say_file("time/minute.wav");
 	}
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -35,9 +35,14 @@
 #include <curl/curl.h>
 #define MAX_URLS 20
 
+#define ENCODING_NONE 0
+#define ENCODING_DEFAULT 1
+#define ENCODING_BASE64 2
+#define ENCODING_TEXTXML 2
+
 static struct {
 	char *cred;
-	char *urls[MAX_URLS+1];
+	char *urls[MAX_URLS + 1];
 	int url_count;
 	int url_index;
 	switch_thread_rwlock_t *log_path_lock;
@@ -60,6 +65,7 @@
 	int prefix_a;
 	int disable100continue;
 	int rotate;
+	int auth_scheme;
 	switch_memory_pool_t *pool;
 } globals;
 
@@ -104,27 +110,23 @@
 					switch_safe_free(globals.log_dir);
 					globals.log_dir = path;
 					switch_thread_rwlock_unlock(globals.log_path_lock);
-				}
-				else {
+				} else {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create new mod_xml_cdr log_dir path\n");
 					switch_safe_free(path);
 					status = SWITCH_STATUS_FALSE;
 				}
-			}
-			else {
+			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to generate new mod_xml_cdr log_dir path\n");
 				status = SWITCH_STATUS_FALSE;
 			}
-		}
-		else {
+		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Setting log file path to %s\n", globals.base_log_dir);
 			if ((path = switch_safe_strdup(globals.base_log_dir))) {
 				switch_thread_rwlock_wrlock(globals.log_path_lock);
 				switch_safe_free(globals.log_dir);
 				globals.log_dir = path;
 				switch_thread_rwlock_unlock(globals.log_path_lock);
-			}
-			else {
+			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set log_dir path\n");
 				status = SWITCH_STATUS_FALSE;
 			}
@@ -146,27 +148,23 @@
 					switch_safe_free(globals.err_log_dir);
 					globals.err_log_dir = path;
 					switch_thread_rwlock_unlock(globals.log_path_lock);
-				}
-				else {
+				} else {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create new mod_xml_cdr err_log_dir path\n");
 					switch_safe_free(path);
 					status = SWITCH_STATUS_FALSE;
 				}
-			}
-			else {
+			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to generate new mod_xml_cdr err_log_dir path\n");
 				status = SWITCH_STATUS_FALSE;
 			}
-		}
-		else {
+		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Setting err log file path to %s\n", globals.base_err_log_dir);
 			if ((path = switch_safe_strdup(globals.base_err_log_dir))) {
 				switch_thread_rwlock_wrlock(globals.log_path_lock);
 				switch_safe_free(globals.err_log_dir);
 				globals.err_log_dir = path;
 				switch_thread_rwlock_unlock(globals.log_path_lock);
-			}
-			else {
+			} else {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set err_log_dir path\n");
 				status = SWITCH_STATUS_FALSE;
 			}
@@ -193,7 +191,7 @@
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	int is_b;
-	const char * a_prefix = "";
+	const char *a_prefix = "";
 
 	if (globals.shutdown) {
 		return SWITCH_STATUS_SUCCESS;
@@ -203,7 +201,8 @@
 	if (!globals.log_b && is_b) {
 		return SWITCH_STATUS_SUCCESS;
 	}
-	if (!is_b && globals.prefix_a) a_prefix = "a_";
+	if (!is_b && globals.prefix_a)
+		a_prefix = "a_";
 
 	if (switch_ivr_generate_xml_cdr(session, &cdr) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Generating Data!\n");
@@ -223,14 +222,14 @@
 		logdir = globals.log_dir;
 	}
 
-	if (!zstr(logdir)) {
+	if (!zstr(logdir) && !globals.url_count) {
 		path = switch_mprintf("%s%s%s%s.cdr.xml", logdir, SWITCH_PATH_SEPARATOR, a_prefix, switch_core_session_get_uuid(session));
 		switch_thread_rwlock_unlock(globals.log_path_lock);
 		if (path) {
 #ifdef _MSC_VER
 			if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
 #else
-			if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR| S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) > -1) {
+			if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) > -1) {
 #endif
 				int wrote;
 				wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
@@ -247,22 +246,24 @@
 			}
 			switch_safe_free(path);
 		}
-	}
-	else {
+	} else {
 		switch_thread_rwlock_unlock(globals.log_path_lock);
 	}
 
 	/* try to post it to the web server */
 	if (globals.url_count) {
+		char *destUrl = NULL;
 		curl_handle = curl_easy_init();
 
-		if (globals.encode) {
+		if (globals.encode == ENCODING_TEXTXML) {
+			headers = curl_slist_append(headers, "Content-Type: text/xml");
+		} else if (globals.encode) {
 			switch_size_t need_bytes = strlen(xml_text) * 3;
 
 			xml_text_escaped = malloc(need_bytes);
 			switch_assert(xml_text_escaped);
 			memset(xml_text_escaped, 0, need_bytes);
-			if (globals.encode == 1) {
+			if (globals.encode == ENCODING_DEFAULT) {
 				headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
 				switch_url_encode(xml_text, xml_text_escaped, need_bytes);
 			} else {
@@ -275,13 +276,15 @@
 			headers = curl_slist_append(headers, "Content-Type: application/x-www-form-plaintext");
 		}
 
-		if (!(curl_xml_text = switch_mprintf("cdr=%s", xml_text))) {
+		if (globals.encode == ENCODING_TEXTXML) {
+			curl_xml_text = xml_text;
+		} else if (!(curl_xml_text = switch_mprintf("cdr=%s", xml_text))) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
 			goto error;
 		}
 
 		if (!zstr(globals.cred)) {
-			curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
+			curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, globals.auth_scheme);
 			curl_easy_setopt(curl_handle, CURLOPT_USERPWD, globals.cred);
 		}
 
@@ -295,19 +298,19 @@
 			slist = curl_slist_append(slist, "Expect:");
 			curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, slist);
 		}
-		
+
 		if (globals.ssl_cert_file) {
 			curl_easy_setopt(curl_handle, CURLOPT_SSLCERT, globals.ssl_cert_file);
 		}
-		
+
 		if (globals.ssl_key_file) {
 			curl_easy_setopt(curl_handle, CURLOPT_SSLKEY, globals.ssl_key_file);
 		}
-		
+
 		if (globals.ssl_key_password) {
 			curl_easy_setopt(curl_handle, CURLOPT_SSLKEYPASSWD, globals.ssl_key_password);
 		}
-		
+
 		if (globals.ssl_version) {
 			if (!strcasecmp(globals.ssl_version, "SSLv3")) {
 				curl_easy_setopt(curl_handle, CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv3);
@@ -315,7 +318,7 @@
 				curl_easy_setopt(curl_handle, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
 			}
 		}
-		
+
 		if (globals.ssl_cacert_file) {
 			curl_easy_setopt(curl_handle, CURLOPT_CAINFO, globals.ssl_cacert_file);
 		}
@@ -329,28 +332,30 @@
 			if (cur_try > 0) {
 				switch_yield(globals.delay * 1000000);
 			}
-			
-			curl_easy_setopt(curl_handle, CURLOPT_URL, globals.urls[globals.url_index]);
 
-			if (!strncasecmp(globals.urls[globals.url_index], "https", 5)) {
+			destUrl = switch_mprintf("%s?uuid=%s", globals.urls[globals.url_index], switch_core_session_get_uuid(session));
+			curl_easy_setopt(curl_handle, CURLOPT_URL, destUrl);
+
+			if (!strncasecmp(destUrl, "https", 5)) {
 				curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
 				curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
 			}
-			
+
 			if (globals.enable_cacert_check) {
 				curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, TRUE);
 			}
-			
+
 			if (globals.enable_ssl_verifyhost) {
 				curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 2);
 			}
 
 			curl_easy_perform(curl_handle);
 			curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes);
+			switch_safe_free(destUrl);
 			if (httpRes == 200) {
 				goto success;
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Got error [%ld] posting to web server [%s]\n", 
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Got error [%ld] posting to web server [%s]\n",
 								  httpRes, globals.urls[globals.url_index]);
 				globals.url_index++;
 				switch_assert(globals.url_count <= MAX_URLS);
@@ -408,7 +413,9 @@
 	if (slist) {
 		curl_slist_free_all(slist);
 	}
-	switch_safe_free(curl_xml_text);
+	if (curl_xml_text != xml_text) {
+		switch_safe_free(curl_xml_text);
+	}
 	switch_safe_free(xml_text);
 	switch_safe_free(path);
 	switch_xml_free(cdr);
@@ -434,11 +441,11 @@
 	/*.on_hangup */ NULL,
 	/*.on_exchange_media */ NULL,
 	/*.on_soft_execute */ NULL,
-	/*.on_consume_media*/ NULL,
-	/*.on_hibernate*/ NULL,
-	/*.on_reset*/ NULL,
-	/*.on_park*/ NULL,
-	/*.on_reporting*/ my_on_reporting
+	/*.on_consume_media */ NULL,
+	/*.on_hibernate */ NULL,
+	/*.on_reset */ NULL,
+	/*.on_park */ NULL,
+	/*.on_reporting */ my_on_reporting
 };
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load)
@@ -461,6 +468,8 @@
 	globals.log_b = 1;
 	globals.disable100continue = 0;
 	globals.pool = pool;
+	globals.auth_scheme = CURLAUTH_BASIC;
+
 	switch_thread_rwlock_create(&globals.log_path_lock, pool);
 
 	/* parse the config */
@@ -492,9 +501,11 @@
 				globals.disable100continue = 1;
 			} else if (!strcasecmp(var, "encode") && !zstr(val)) {
 				if (!strcasecmp(val, "base64")) {
-					globals.encode = 2;
+					globals.encode = ENCODING_BASE64;
+				} else if (!strcasecmp(val, "textxml")) {
+					globals.encode = ENCODING_TEXTXML;
 				} else {
-					globals.encode = switch_true(val) ? 1 : 0;
+					globals.encode = switch_true(val) ? ENCODING_DEFAULT : ENCODING_NONE;
 				}
 			} else if (!strcasecmp(var, "retries") && !zstr(val)) {
 				globals.retries = (uint32_t) atoi(val);
@@ -534,8 +545,25 @@
 				globals.ssl_cacert_file = val;
 			} else if (!strcasecmp(var, "enable-ssl-verifyhost") && switch_true(val)) {
 				globals.enable_ssl_verifyhost = 1;
+			} else if (!strcasecmp(var, "auth-scheme")) {
+				if (*val == '=') {
+					globals.auth_scheme = 0;
+					val++;
+				}
+
+				if (!strcasecmp(val, "basic")) {
+					globals.auth_scheme |= CURLAUTH_BASIC;
+				} else if (!strcasecmp(val, "digest")) {
+					globals.auth_scheme |= CURLAUTH_DIGEST;
+				} else if (!strcasecmp(val, "NTLM")) {
+					globals.auth_scheme |= CURLAUTH_NTLM;
+				} else if (!strcasecmp(val, "GSS-NEGOTIATE")) {
+					globals.auth_scheme |= CURLAUTH_GSSNEGOTIATE;
+				} else if (!strcasecmp(val, "any")) {
+					globals.auth_scheme = CURLAUTH_ANY;
+				}
 			}
-		
+
 			if (zstr(globals.base_err_log_dir)) {
 				if (!zstr(globals.base_log_dir)) {
 					globals.base_err_log_dir = switch_core_strdup(globals.pool, globals.base_log_dir);
@@ -567,7 +595,7 @@
 {
 
 	globals.shutdown = 1;
-	
+
 	switch_core_remove_state_handler(&state_handlers);
 	return SWITCH_STATUS_SUCCESS;
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -74,14 +74,14 @@
 };
 
 typedef struct hash_node {
-    switch_hash_t* hash;
-    struct hash_node* next;
+	switch_hash_t *hash;
+	struct hash_node *next;
 } hash_node_t;
 
 static struct {
-    switch_memory_pool_t* pool;
-    hash_node_t* hash_root;
-    hash_node_t* hash_tail;
+	switch_memory_pool_t *pool;
+	hash_node_t *hash_root;
+	hash_node_t *hash_tail;
 } globals;
 
 #define XML_CURL_SYNTAX "[debug_on|debug_off]"
@@ -120,7 +120,7 @@
 	config_data->bytes += realsize;
 
 	if (config_data->bytes > config_data->max_bytes) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Oversized file detected [%d bytes]\n", (int)config_data->bytes);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Oversized file detected [%d bytes]\n", (int) config_data->bytes);
 		config_data->err = 1;
 		return 0;
 	}
@@ -154,7 +154,7 @@
 	char basic_data[512];
 	char *uri = NULL;
 	char *dynamic_url = NULL;
-	
+
 	gethostname(hostname, sizeof(hostname));
 
 	if (!binding) {
@@ -170,7 +170,7 @@
 
 		return xml;
 	}
-	
+
 	switch_snprintf(basic_data, sizeof(basic_data), "hostname=%s&section=%s&tag_name=%s&key_name=%s&key_value=%s",
 					hostname, section, switch_str_nil(tag_name), switch_str_nil(key_name), switch_str_nil(key_value));
 
@@ -198,7 +198,7 @@
 		uri = malloc(strlen(data) + strlen(dynamic_url) + 16);
 		switch_assert(uri);
 		sprintf(uri, "%s%c%s", dynamic_url, strchr(dynamic_url, '?') != NULL ? '&' : '?', data);
-	} 
+	}
 
 	switch_uuid_get(&uuid);
 	switch_uuid_format(uuid_str, &uuid);
@@ -237,6 +237,7 @@
 
 		if (binding->timeout) {
 			curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, binding->timeout);
+			curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
 		}
 
 		if (binding->disable100continue) {
@@ -247,19 +248,19 @@
 		if (binding->enable_cacert_check) {
 			curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, TRUE);
 		}
-	
+
 		if (binding->ssl_cert_file) {
 			curl_easy_setopt(curl_handle, CURLOPT_SSLCERT, binding->ssl_cert_file);
 		}
-		
+
 		if (binding->ssl_key_file) {
 			curl_easy_setopt(curl_handle, CURLOPT_SSLKEY, binding->ssl_key_file);
 		}
-		
+
 		if (binding->ssl_key_password) {
 			curl_easy_setopt(curl_handle, CURLOPT_SSLKEYPASSWD, binding->ssl_key_password);
 		}
-		
+
 		if (binding->ssl_version) {
 			if (!strcasecmp(binding->ssl_version, "SSLv3")) {
 				curl_easy_setopt(curl_handle, CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv3);
@@ -267,15 +268,15 @@
 				curl_easy_setopt(curl_handle, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
 			}
 		}
-		
+
 		if (binding->ssl_cacert_file) {
 			curl_easy_setopt(curl_handle, CURLOPT_CAINFO, binding->ssl_cacert_file);
 		}
-		
+
 		if (binding->enable_ssl_verifyhost) {
 			curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 2);
 		}
-	
+
 		if (binding->cookie_file) {
 			curl_easy_setopt(curl_handle, CURLOPT_COOKIEJAR, binding->cookie_file);
 			curl_easy_setopt(curl_handle, CURLOPT_COOKIEFILE, binding->cookie_file);
@@ -300,7 +301,8 @@
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Parsing Result!\n");
 			}
 		} else {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received HTTP error %ld trying to fetch %s\ndata: [%s]\n", httpRes, binding->url, data);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Received HTTP error %ld trying to fetch %s\ndata: [%s]\n", httpRes, binding->url,
+							  data);
 			xml = NULL;
 		}
 	}
@@ -358,7 +360,7 @@
 		char *ssl_cacert_file = NULL;
 		uint32_t enable_ssl_verifyhost = 0;
 		char *cookie_file = NULL;
-		hash_node_t* hash_node;
+		hash_node_t *hash_node;
 		int auth_scheme = CURLAUTH_BASIC;
 		need_vars_map = 0;
 		vars_map = NULL;
@@ -380,7 +382,7 @@
 					auth_scheme = 0;
 					val++;
 				}
-				
+
 				if (!strcasecmp(val, "basic")) {
 					auth_scheme |= CURLAUTH_BASIC;
 				} else if (!strcasecmp(val, "digest")) {
@@ -441,13 +443,13 @@
 		if (!url) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Binding has no url!\n");
 			if (vars_map)
-			    switch_core_hash_destroy(&vars_map);
+				switch_core_hash_destroy(&vars_map);
 			continue;
 		}
 
 		if (!(binding = malloc(sizeof(*binding)))) {
 			if (vars_map)
-			    switch_core_hash_destroy(&vars_map);
+				switch_core_hash_destroy(&vars_map);
 			goto done;
 		}
 		memset(binding, 0, sizeof(*binding));
@@ -471,53 +473,53 @@
 		}
 
 		binding->disable100continue = disable100continue;
-		binding->use_get_style = method != NULL && strcasecmp(method,"post") != 0;
+		binding->use_get_style = method != NULL && strcasecmp(method, "post") != 0;
 		binding->use_dynamic_url = use_dynamic_url;
 		binding->enable_cacert_check = enable_cacert_check;
-		
+
 		if (ssl_cert_file) {
 			binding->ssl_cert_file = strdup(ssl_cert_file);
 		}
-		
+
 		if (ssl_key_file) {
 			binding->ssl_key_file = strdup(ssl_key_file);
 		}
-		
+
 		if (ssl_key_password) {
 			binding->ssl_key_password = strdup(ssl_key_password);
 		}
-		
+
 		if (ssl_version) {
 			binding->ssl_version = strdup(ssl_version);
 		}
-		
+
 		if (ssl_cacert_file) {
 			binding->ssl_cacert_file = strdup(ssl_cacert_file);
 		}
-		
+
 		binding->enable_ssl_verifyhost = enable_ssl_verifyhost;
-		
+
 		if (cookie_file) {
 			binding->cookie_file = strdup(cookie_file);
 		}
 
 		binding->vars_map = vars_map;
-		
+
 		if (vars_map) {
-		    switch_zmalloc(hash_node,sizeof(hash_node_t));
-		    hash_node->hash = vars_map;
-		    hash_node->next = NULL;
-		    
-		    if (!globals.hash_root) {
-			globals.hash_root = hash_node;
-			globals.hash_tail = globals.hash_root;
-		    }
-		    
-		    else {
-			globals.hash_tail->next = hash_node;
-			globals.hash_tail = globals.hash_tail->next;
-		    }
-			
+			switch_zmalloc(hash_node, sizeof(hash_node_t));
+			hash_node->hash = vars_map;
+			hash_node->next = NULL;
+
+			if (!globals.hash_root) {
+				globals.hash_root = hash_node;
+				globals.hash_tail = globals.hash_root;
+			}
+
+			else {
+				globals.hash_tail->next = hash_node;
+				globals.hash_tail = globals.hash_tail->next;
+			}
+
 		}
 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Binding [%s] XML Fetch Function [%s] [%s]\n",
@@ -540,7 +542,7 @@
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
-	memset(&globals,0,sizeof(globals));
+	memset(&globals, 0, sizeof(globals));
 	globals.pool = pool;
 	globals.hash_root = NULL;
 	globals.hash_tail = NULL;
@@ -561,15 +563,15 @@
 
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_curl_shutdown)
 {
-	hash_node_t* ptr = NULL;
+	hash_node_t *ptr = NULL;
 
-	while(globals.hash_root) {
-	    ptr = globals.hash_root;
-	    switch_core_hash_destroy(&ptr->hash);
-	    globals.hash_root = ptr->next;
-	    switch_safe_free(ptr);
+	while (globals.hash_root) {
+		ptr = globals.hash_root;
+		switch_core_hash_destroy(&ptr->hash);
+		globals.hash_root = ptr->next;
+		switch_safe_free(ptr);
 	}
-	
+
 	switch_xml_unbind_search_function_ptr(xml_url_fetch);
 	curl_global_cleanup();
 	return SWITCH_STATUS_SUCCESS;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_ldap/Makefile (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_ldap/Makefile	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_ldap/Makefile	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,25 +1,30 @@
-switch_srcdir=../../../..
+BASE=../../../..
 
-LDAP=openldap-2.4.11
+LDAP=openldap-2.4.19
 LDAP_DIR=$(switch_srcdir)/libs/$(LDAP)
+LDAP_BUILDDIR=$(switch_builddir)/libs/$(LDAP)
 
-LDAPLA=$(LDAP_DIR)/libraries/libldap_r/libldap_r.la
-LIBLBERLA=$(LDAP_DIR)/libraries/liblber/liblber.la
-LIBLUTILA=$(LDAP_DIR)/libraries/liblutil/liblutil.a
+LDAPLA=$(LDAP_BUILDDIR)/libraries/libldap_r/libldap_r.la
+LIBLBERLA=$(LDAP_BUILDDIR)/libraries/liblber/liblber.la
+LIBLUTILA=$(LDAP_BUILDDIR)/libraries/liblutil/liblutil.a
 
 LOCAL_CFLAGS=-DWITH_OPENLDAP -DLDAP_DEPRECATED -I$(LDAP_DIR)/include
 
-DEFAULT_ARGS= --prefix=$(PREFIX) --disable-shared --with-pic --disable-slapd
-DEFAULT_ARGS+= --disable-slurpd --disable-relay --disable-bdb --disable-hdb
-
 LOCAL_LIBADD=$(LDAPLA) $(LIBLBERLA) $(LIBLUTILA)
 
-include $(switch_srcdir)/build/modmake.rules
+include $(BASE)/build/modmake.rules
 
+DEFAULT_ARGS+= --disable-slapd --disable-slurpd --disable-relay --disable-bdb --disable-hdb
+
 $(LDAP_DIR):
 	$(GETLIB) $(LDAP).tar.gz
-	cd $(LDAP_DIR) && CFLAGS="`echo $(CFLAGS) | sed -e 's:-std=c99::'`" ./configure $(DEFAULT_ARGS)
 
-$(LIBLUTILA) $(LDAPLA) $(LIBLBERLA): $(LDAP_DIR)
-	cd $(LDAP_DIR) && $(MAKE)
+$(LDAP_BUILDDIR)/Makefile: $(LDAP_DIR)
+	mkdir -p $(LDAP_BUILDDIR)
+	cd $(LDAP_BUILDDIR) && $(DEFAULT_VARS) $(LDAP_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(LDAP_DIR)
 	$(TOUCH_TARGET)
+
+$(LDAPLA) $(LIBLBERLA): $(LDAP_BUILDDIR)/Makefile
+	cd $(LDAP_BUILDDIR) && $(MAKE)
+	$(TOUCH_TARGET)
+

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_ldap/lutil_ldap.h (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_ldap/lutil_ldap.h	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_ldap/lutil_ldap.h	2010-02-12 00:54:22 UTC (rev 16614)
@@ -23,36 +23,23 @@
  * Include file for lutil LDAP routines
  */
 
-LDAP_BEGIN_DECL
+LDAP_BEGIN_DECL LDAP_LUTIL_F(void)
+	 lutil_sasl_freedefs LDAP_P((void *defaults));
 
-LDAP_LUTIL_F( void )
-lutil_sasl_freedefs LDAP_P((
-	void *defaults ));
+LDAP_LUTIL_F(void *)
+	 lutil_sasl_defaults LDAP_P((LDAP * ld, char *mech, char *realm, char *authcid, char *passwd, char *authzid));
 
-LDAP_LUTIL_F( void * )
-lutil_sasl_defaults LDAP_P((
-	LDAP *ld,
-	char *mech,
-	char *realm,
-	char *authcid,
-	char *passwd,
-	char *authzid ));
+LDAP_LUTIL_F(int)
+	 lutil_sasl_interact LDAP_P((LDAP * ld, unsigned flags, void *defaults, void *p));
 
-LDAP_LUTIL_F( int )
-lutil_sasl_interact LDAP_P((
-	LDAP *ld, unsigned flags, void *defaults, void *p ));
-
 LDAP_END_DECL
-
 #endif /* _LUTIL_LDAP_H */
-
-typedef struct lutil_sasl_defaults_s {
-    char *mech;
-    char *realm;
-    char *authcid;
-    char *passwd;
-    char *authzid;
-    char **resps;
-    int nresps;
-} lutilSASLdefaults;
-
+	 typedef struct lutil_sasl_defaults_s {
+		 char *mech;
+		 char *realm;
+		 char *authcid;
+		 char *passwd;
+		 char *authzid;
+		 char **resps;
+		 int nresps;
+	 } lutilSASLdefaults;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -111,7 +111,8 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t xml_ldap_result(void *ldap_connection, xml_binding_t *binding, switch_xml_t *xml, int *off, const xml_ldap_query_type_t query_type)
+static switch_status_t xml_ldap_result(void *ldap_connection, xml_binding_t *binding, switch_xml_t *xml, int *off,
+									   const xml_ldap_query_type_t query_type)
 {
 	switch (query_type) {
 	case XML_LDAP_DIRECTORY:
@@ -334,7 +335,7 @@
 
 
 
-	if ((ldap->ld = (LDAP*)ldap_init(binding->host, LDAP_PORT)) == NULL) {
+	if ((ldap->ld = (LDAP *) ldap_init(binding->host, LDAP_PORT)) == NULL) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to connect to ldap server.%s\n", binding->host);
 		goto cleanup;
 	}
@@ -343,7 +344,7 @@
 		goto cleanup;
 	}
 
-	ldap_set_option( ldap->ld, LDAP_OPT_X_SASL_SECPROPS, &ldap->sp );
+	ldap_set_option(ldap->ld, LDAP_OPT_X_SASL_SECPROPS, &ldap->sp);
 
 
 
@@ -353,8 +354,11 @@
 			goto cleanup;
 		}
 	} else {
-		if (ldap_sasl_interactive_bind_s( ldap->ld, NULL, binding->defaults->mech, NULL, NULL,(unsigned)LDAP_SASL_SIMPLE, lutil_sasl_interact , binding->defaults ) != LDAP_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to sasl_bind to ldap server %s as %s\n", binding->host, binding->defaults->authcid);
+		if (ldap_sasl_interactive_bind_s
+			(ldap->ld, NULL, binding->defaults->mech, NULL, NULL, (unsigned) (intptr_t) LDAP_SASL_SIMPLE, lutil_sasl_interact,
+			 binding->defaults) != LDAP_SUCCESS) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to sasl_bind to ldap server %s as %s\n", binding->host,
+							  binding->defaults->authcid);
 			goto cleanup;
 		}
 	}
@@ -459,8 +463,7 @@
 		}
 
 		if (!binding->basedn || !binding->filter) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-							  "You must define \"basedn\", and \"filter\" in mod_xml_ldap.conf.xml\n");
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You must define \"basedn\", and \"filter\" in mod_xml_ldap.conf.xml\n");
 			continue;
 		}
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_ldap/mod_xml_ldapv2.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_ldap/mod_xml_ldapv2.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_ldap/mod_xml_ldapv2.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -77,12 +77,12 @@
 
 
 static switch_xml_t xml_ldap_search(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
-                                    void *user_data);
+									void *user_data);
 
 static switch_status_t trydir(switch_xml_t *, int *, LDAP *, char *, char *, xml_binding_t *);
 static switch_status_t do_config(void);
-static switch_status_t trysearch( switch_xml_t *pxml, int *xoff, LDAP *ld, char *basedn, char *filter);
-void rec( switch_xml_t *, int*, LDAP *ld, char *);
+static switch_status_t trysearch(switch_xml_t *pxml, int *xoff, LDAP * ld, char *basedn, char *filter);
+void rec(switch_xml_t *, int *, LDAP * ld, char *);
 
 #define XML_LDAP_SYNTAX ""
 
@@ -115,9 +115,10 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t do_config(void) {
+static switch_status_t do_config(void)
+{
 	char *cf = "xml_ldap.conf";
-	switch_xml_t cfg, xml, bindings_tag, binding_tag, param,tran;
+	switch_xml_t cfg, xml, bindings_tag, binding_tag, param, tran;
 	xml_binding_t *binding = NULL;
 	xml_ldap_attribute_t *attr_list = NULL;
 	int x = 0;
@@ -149,14 +150,14 @@
 			if (!strcasecmp(var, "filter")) {
 				binding->bindings = (char *) switch_xml_attr_soft(param, "bindings");
 
-				if (!strncmp(binding->bindings, "configuration",strlen(binding->bindings))) {
+				if (!strncmp(binding->bindings, "configuration", strlen(binding->bindings))) {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setting type XML_LDAP_CONFIG\n");
 					binding->bt = XML_LDAP_CONFIG;
-				} else if (!strncmp(binding->bindings, "directory",strlen(binding->bindings))) {
+				} else if (!strncmp(binding->bindings, "directory", strlen(binding->bindings))) {
 					binding->bt = XML_LDAP_DIRECTORY;
-				} else if (!strncmp(binding->bindings, "dialplain",strlen(binding->bindings))) {
+				} else if (!strncmp(binding->bindings, "dialplain", strlen(binding->bindings))) {
 					binding->bt = XML_LDAP_DIALPLAN;
-				} else if (!strncmp(binding->bindings, "phrases",strlen(binding->bindings))) {
+				} else if (!strncmp(binding->bindings, "phrases", strlen(binding->bindings))) {
 					binding->bt = XML_LDAP_PHRASE;
 				}
 
@@ -176,72 +177,72 @@
 
 		}
 
-		if ( binding && binding->bt == XML_LDAP_DIRECTORY ) {
+		if (binding && binding->bt == XML_LDAP_DIRECTORY) {
 			attr_list = malloc(sizeof(*attr_list));
-			attr_list = memset(attr_list,0,sizeof(*attr_list));
+			attr_list = memset(attr_list, 0, sizeof(*attr_list));
 			binding->attr_list = attr_list;
 
 			param = switch_xml_child(binding_tag, "trans");
-			for ( tran = switch_xml_child(param, "tran"); tran; tran = tran->next) {
+			for (tran = switch_xml_child(param, "tran"); tran; tran = tran->next) {
 				char *n = (char *) switch_xml_attr_soft(tran, "name");
 				char *m = (char *) switch_xml_attr_soft(tran, "mapfrom");
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, " adding map %s => %s\n", m , n);
-				if (!strncasecmp("id",n,strlen(n))) {
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, " adding map %s => %s\n", m, n);
+				if (!strncasecmp("id", n, strlen(n))) {
 					attr_list->type = LDAP_EXTEN_ID;
 					attr_list->len = strlen(m);
 					attr_list->val = strdup(m);
 					attr_list->next = malloc(sizeof(*attr_list));
-					attr_list->next = memset(attr_list->next,0,sizeof(*attr_list));
+					attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
 					attr_list = attr_list->next;
-				} else if ( !strncasecmp("mailbox",n,strlen(n))) {
-                    attr_list->type = LDAP_EXTEN_VM_MAILBOX;
-                    attr_list->len = strlen(m);
-                    attr_list->val = strdup(m);
-                    attr_list->next = malloc(sizeof(*attr_list));
-                    attr_list->next = memset(attr_list->next,0,sizeof(*attr_list));
-                    attr_list = attr_list->next;
-                } else if ( !strncasecmp("password",n,strlen(n))) {
-                    attr_list->type = LDAP_EXTEN_PASSWORD;
-                    attr_list->len = strlen(m);
-                    attr_list->val = strdup(m);
-                    attr_list->next = malloc(sizeof(*attr_list));
-                    attr_list->next = memset(attr_list->next,0,sizeof(*attr_list));
-                    attr_list = attr_list->next;
-                } else if ( !strncasecmp("vm-password",n,strlen(n))) {
-                    attr_list->type = LDAP_EXTEN_VM_PASSWORD;
-                    attr_list->len = strlen(m);
-                    attr_list->val = strdup(m);
-                    attr_list->next = malloc(sizeof(*attr_list));
-                    attr_list->next = memset(attr_list->next,0,sizeof(*attr_list));
-                    attr_list = attr_list->next;
-                } else if ( !strncasecmp("email-addr",n,strlen(n))) {
-                    attr_list->type = LDAP_EXTEN_VM_EMAILADDR;
-                    attr_list->len = strlen(m);
-                    attr_list->val = strdup(m);
-                    attr_list->next = malloc(sizeof(*attr_list));
-                    attr_list->next = memset(attr_list->next,0,sizeof(*attr_list));
-                    attr_list = attr_list->next;
-                } else if ( !strncasecmp("vm-email-all-messages",n,strlen(n))) {
-                    attr_list->type = LDAP_EXTEN_VM_EMAILMSG;
-                    attr_list->len = strlen(m);
-                    attr_list->val = strdup(m);
-                    attr_list->next = malloc(sizeof(*attr_list));
-                    attr_list->next = memset(attr_list->next,0,sizeof(*attr_list));
-                    attr_list = attr_list->next;
-                } else if ( !strncasecmp("vm-delete-file",n,strlen(n))) {
-                    attr_list->type = LDAP_EXTEN_VM_DELETE;
-                    attr_list->len = strlen(m);
-                    attr_list->val = strdup(m);
-                    attr_list->next = malloc(sizeof(*attr_list));
-                    attr_list->next = memset(attr_list->next,0,sizeof(*attr_list));
-                    attr_list = attr_list->next;
-                } else if ( !strncasecmp("vm-attach-file",n,strlen(n))) {
-                    attr_list->type = LDAP_EXTEN_VM_ATTACHAUDIO;
-                    attr_list->len = strlen(m);
-                    attr_list->val = strdup(m);
-                    attr_list->next = malloc(sizeof(*attr_list));
-                    attr_list->next = memset(attr_list->next,0,sizeof(*attr_list));
-                    attr_list = attr_list->next;
+				} else if (!strncasecmp("mailbox", n, strlen(n))) {
+					attr_list->type = LDAP_EXTEN_VM_MAILBOX;
+					attr_list->len = strlen(m);
+					attr_list->val = strdup(m);
+					attr_list->next = malloc(sizeof(*attr_list));
+					attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
+					attr_list = attr_list->next;
+				} else if (!strncasecmp("password", n, strlen(n))) {
+					attr_list->type = LDAP_EXTEN_PASSWORD;
+					attr_list->len = strlen(m);
+					attr_list->val = strdup(m);
+					attr_list->next = malloc(sizeof(*attr_list));
+					attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
+					attr_list = attr_list->next;
+				} else if (!strncasecmp("vm-password", n, strlen(n))) {
+					attr_list->type = LDAP_EXTEN_VM_PASSWORD;
+					attr_list->len = strlen(m);
+					attr_list->val = strdup(m);
+					attr_list->next = malloc(sizeof(*attr_list));
+					attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
+					attr_list = attr_list->next;
+				} else if (!strncasecmp("email-addr", n, strlen(n))) {
+					attr_list->type = LDAP_EXTEN_VM_EMAILADDR;
+					attr_list->len = strlen(m);
+					attr_list->val = strdup(m);
+					attr_list->next = malloc(sizeof(*attr_list));
+					attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
+					attr_list = attr_list->next;
+				} else if (!strncasecmp("vm-email-all-messages", n, strlen(n))) {
+					attr_list->type = LDAP_EXTEN_VM_EMAILMSG;
+					attr_list->len = strlen(m);
+					attr_list->val = strdup(m);
+					attr_list->next = malloc(sizeof(*attr_list));
+					attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
+					attr_list = attr_list->next;
+				} else if (!strncasecmp("vm-delete-file", n, strlen(n))) {
+					attr_list->type = LDAP_EXTEN_VM_DELETE;
+					attr_list->len = strlen(m);
+					attr_list->val = strdup(m);
+					attr_list->next = malloc(sizeof(*attr_list));
+					attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
+					attr_list = attr_list->next;
+				} else if (!strncasecmp("vm-attach-file", n, strlen(n))) {
+					attr_list->type = LDAP_EXTEN_VM_ATTACHAUDIO;
+					attr_list->len = strlen(m);
+					attr_list->val = strdup(m);
+					attr_list->next = malloc(sizeof(*attr_list));
+					attr_list->next = memset(attr_list->next, 0, sizeof(*attr_list));
+					attr_list = attr_list->next;
 				}
 
 			}
@@ -250,8 +251,7 @@
 
 
 		if (!binding->basedn || !binding->filter || !binding->url) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
-							  "You must define \"basedn\", and \"filter\" in mod_xml_ldap.conf.xml\n");
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You must define \"basedn\", and \"filter\" in mod_xml_ldap.conf.xml\n");
 			continue;
 		}
 
@@ -271,26 +271,29 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t trydir(switch_xml_t *pxml, int *xoff, LDAP *ld, char *dir_domain, char *dir_exten, xml_binding_t *binding) {
+static switch_status_t trydir(switch_xml_t *pxml, int *xoff, LDAP * ld, char *dir_domain, char *dir_exten, xml_binding_t *binding)
+{
 	switch_status_t ret = SWITCH_STATUS_FALSE;
 	int off = *xoff;
-    char *key = NULL;
+	char *key = NULL;
 	char *basedn = NULL, *filter = NULL;
-    char **val = NULL;
-    BerElement *ber = NULL;
-    switch_xml_t xml = *pxml, params = NULL, vars = NULL, cur = NULL;
-    LDAPMessage *msg, *entry;
-	static char *fsattr[] = { "id" , "mailbox", "password", "vm-password", "email-addr", "vm-email-all-messages", "vm-delete-file", "vm-attach-file", NULL };
+	char **val = NULL;
+	BerElement *ber = NULL;
+	switch_xml_t xml = *pxml, params = NULL, vars = NULL, cur = NULL;
+	LDAPMessage *msg, *entry;
+	static char *fsattr[] =
+		{ "id", "mailbox", "password", "vm-password", "email-addr", "vm-email-all-messages", "vm-delete-file", "vm-attach-file", NULL };
 
-	basedn = switch_mprintf(binding->basedn,dir_domain);
-	filter = switch_mprintf(binding->filter,dir_exten);
+	basedn = switch_mprintf(binding->basedn, dir_domain);
+	filter = switch_mprintf(binding->filter, dir_exten);
 	xml_ldap_attribute_t *attr = NULL;
 
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "searching in basedn %s with filter %s\n",basedn,filter );
-	
-	if ( (ldap_search_s(ld, basedn,  LDAP_SCOPE_SUB, filter, NULL, 0, &msg) != LDAP_SUCCESS) ) goto cleanup;
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "searching in basedn %s with filter %s\n", basedn, filter);
 
-	if ( ldap_count_entries(ld, msg) > 0 ) {
+	if ((ldap_search_s(ld, basedn, LDAP_SCOPE_SUB, filter, NULL, 0, &msg) != LDAP_SUCCESS))
+		goto cleanup;
+
+	if (ldap_count_entries(ld, msg) > 0) {
 		ret = SWITCH_STATUS_SUCCESS;
 		xml = switch_xml_add_child_d(xml, "section", off++);
 		switch_xml_set_attr_d(xml, "name", "directory");
@@ -304,31 +307,25 @@
 		params = switch_xml_add_child_d(xml, "params", off++);
 
 
-        for (
-            entry = ldap_first_entry(ld, msg);
-            entry != NULL;
-            entry = ldap_next_entry(ld, entry) ) {
+		for (entry = ldap_first_entry(ld, msg); entry != NULL; entry = ldap_next_entry(ld, entry)) {
 
 
-            for (
-                key = ldap_first_attribute(ld, entry, &ber);
-                key != NULL;
-                key = ldap_next_attribute(ld, entry, ber) ) {
+			for (key = ldap_first_attribute(ld, entry, &ber); key != NULL; key = ldap_next_attribute(ld, entry, ber)) {
 
-				for( attr = binding->attr_list; attr ; attr = attr->next ) {
-					if ( strlen(key) == attr->len ) {
-						if ( !strncasecmp(attr->val,key,strlen(key)) ) {
-							val = ldap_get_values(ld,entry,key);
-							if ( ldap_count_values(val) == 1 ) {
+				for (attr = binding->attr_list; attr; attr = attr->next) {
+					if (strlen(key) == attr->len) {
+						if (!strncasecmp(attr->val, key, strlen(key))) {
+							val = ldap_get_values(ld, entry, key);
+							if (ldap_count_values(val) == 1) {
 								if (attr->type < 2) {
 									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "setting %s = %s ", fsattr[attr->type], val[0]);
-									switch_xml_set_attr_d(xml,fsattr[attr->type],val[0]);
-								} else if ( attr->type < 8 ) {
-									cur = switch_xml_add_child_d(params,"param",0);
-									switch_xml_set_attr_d(cur,fsattr[attr->type],val[0]);
+									switch_xml_set_attr_d(xml, fsattr[attr->type], val[0]);
+								} else if (attr->type < 8) {
+									cur = switch_xml_add_child_d(params, "param", 0);
+									switch_xml_set_attr_d(cur, fsattr[attr->type], val[0]);
 								} else {
-									cur = switch_xml_add_child_d(vars,"variable",0);
-									switch_xml_set_attr_d(cur,fsattr[attr->type],val[0]);
+									cur = switch_xml_add_child_d(vars, "variable", 0);
+									switch_xml_set_attr_d(cur, fsattr[attr->type], val[0]);
 								}
 							} else {
 								/* multi val attrs */
@@ -339,29 +336,30 @@
 					}
 				}
 				ldap_memfree(key);
-            }
-            ber_free(ber,0);
-        }
+			}
+			ber_free(ber, 0);
+		}
 
-        ldap_msgfree(entry);
-        ldap_msgfree(msg);
-    } else {
-        ret = SWITCH_STATUS_FALSE;
-    }
+		ldap_msgfree(entry);
+		ldap_msgfree(msg);
+	} else {
+		ret = SWITCH_STATUS_FALSE;
+	}
 
-    cleanup:
-    switch_safe_free(filter);
+  cleanup:
+	switch_safe_free(filter);
 	switch_safe_free(basedn)
-	switch_safe_free(dir_exten);
+		switch_safe_free(dir_exten);
 	switch_safe_free(dir_domain);
 
-    return ret;
+	return ret;
 }
-		
 
 
 
-static switch_status_t trysearch ( switch_xml_t *pxml, int *xoff, LDAP *ld, char *basedn, char *filter) {
+
+static switch_status_t trysearch(switch_xml_t *pxml, int *xoff, LDAP * ld, char *basedn, char *filter)
+{
 	switch_status_t ret;
 	int off = *xoff;
 	char *key = NULL;
@@ -373,43 +371,38 @@
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "trying search in base %s with filter %s\n", basedn, filter);
 
-	if ( (ldap_search_s(ld, basedn,  LDAP_SCOPE_ONE, filter, NULL, 0, &msg) != LDAP_SUCCESS) ) goto cleanup;
+	if ((ldap_search_s(ld, basedn, LDAP_SCOPE_ONE, filter, NULL, 0, &msg) != LDAP_SUCCESS))
+		goto cleanup;
 
 
-	if ( ldap_count_entries(ld, msg) > 0 ) {
+	if (ldap_count_entries(ld, msg) > 0) {
 		ret = SWITCH_STATUS_SUCCESS;
-		for ( 
-			entry = ldap_first_entry(ld, msg); 
-			entry != NULL; 
-			entry = ldap_next_entry(ld, entry) ) {
+		for (entry = ldap_first_entry(ld, msg); entry != NULL; entry = ldap_next_entry(ld, entry)) {
 
-			val = ldap_get_values(ld,entry,"fstag" );
+			val = ldap_get_values(ld, entry, "fstag");
 			xml = switch_xml_add_child_d(xml, val[0], off);
 			ldap_value_free(val);
 
-			for (
-				key = ldap_first_attribute(ld, entry, &ber);
-				key != NULL;
-				key = ldap_next_attribute(ld, entry, ber) ) {
+			for (key = ldap_first_attribute(ld, entry, &ber); key != NULL; key = ldap_next_attribute(ld, entry, ber)) {
 
-				if ( !strncasecmp(key,"fstag",strlen(key)) || !strncasecmp(key,"objectclass",strlen(key)) ) {
+				if (!strncasecmp(key, "fstag", strlen(key)) || !strncasecmp(key, "objectclass", strlen(key))) {
 					ldap_memfree(key);
 					continue;
 				}
 
-				val = ldap_get_values(ld,entry,key);
+				val = ldap_get_values(ld, entry, key);
 				switch_xml_set_attr_d(xml, key, val[0]);
 
 				ldap_memfree(key);
 				ldap_value_free(val);
 
 			}
-			ber_free(ber,0);
+			ber_free(ber, 0);
 
-			dn = ldap_get_dn(ld,entry);
-		    rec(&xml,&off,ld,dn);
+			dn = ldap_get_dn(ld, entry);
+			rec(&xml, &off, ld, dn);
 
-			*xoff=1;
+			*xoff = 1;
 		}
 
 		ldap_msgfree(entry);
@@ -418,19 +411,20 @@
 		ret = SWITCH_STATUS_FALSE;
 	}
 
-	cleanup:
+  cleanup:
 	switch_safe_free(basedn);
 	switch_safe_free(filter);
 	switch_safe_free(key);
 
 	return ret;
-	
+
 }
 
 
 
 
-void rec( switch_xml_t *pxml, int *xoff, LDAP *ld, char *dn) {
+void rec(switch_xml_t *pxml, int *xoff, LDAP * ld, char *dn)
+{
 	int off = *xoff;
 	char *key;
 	char **val;
@@ -443,34 +437,28 @@
 	ldap_search_s(ld, dn, LDAP_SCOPE_ONE, NULL, NULL, 0, &msg);
 	switch_safe_free(dn);
 
-	if ( ldap_count_entries(ld, msg) > 0 ) {
+	if (ldap_count_entries(ld, msg) > 0) {
 
-		for ( 
-			entry = ldap_first_entry(ld, msg);
-			entry != NULL;
-			entry = ldap_next_entry(ld, entry) ) {
+		for (entry = ldap_first_entry(ld, msg); entry != NULL; entry = ldap_next_entry(ld, entry)) {
 
-			val = ldap_get_values(ld,entry,"fstag" );
-			new  = switch_xml_add_child_d(xml, val[0], off);
+			val = ldap_get_values(ld, entry, "fstag");
+			new = switch_xml_add_child_d(xml, val[0], off);
 			ldap_value_free(val);
 
-			for (
-				key = ldap_first_attribute(ld, entry,&ber);
-				key != NULL;
-				key = ldap_next_attribute(ld,entry,ber) ) {
+			for (key = ldap_first_attribute(ld, entry, &ber); key != NULL; key = ldap_next_attribute(ld, entry, ber)) {
 
-				if ( !strncasecmp("fstag",key,5) || !strncasecmp("objectclass",key,10) ) {
+				if (!strncasecmp("fstag", key, 5) || !strncasecmp("objectclass", key, 10)) {
 					ldap_memfree(key);
 					continue;
 				}
 
-                val = ldap_get_values(ld,entry,key);
-                switch_xml_set_attr_d(new, key, val[0]);
+				val = ldap_get_values(ld, entry, key);
+				switch_xml_set_attr_d(new, key, val[0]);
 				ldap_memfree(key);
 				ldap_value_free(val);
 			}
-			ber_free(ber,0);
-			rec( &new, xoff , ld, ldap_get_dn(ld,entry) );
+			ber_free(ber, 0);
+			rec(&new, xoff, ld, ldap_get_dn(ld, entry));
 		}
 
 		ldap_msgfree(entry);
@@ -481,7 +469,8 @@
 
 
 static switch_xml_t xml_ldap_search(const char *section, const char *tag_name, const char *key_name, const char *key_value, switch_event_t *params,
-									void *user_data) {
+									void *user_data)
+{
 
 	xml_binding_t *binding = (xml_binding_t *) user_data;
 	switch_event_header_t *hi;
@@ -492,8 +481,8 @@
 
 	char *basedn = NULL, *filter = NULL;
 	char *dir_domain = NULL, *dir_exten = NULL;
-	
-	char *buf;        
+
+	char *buf;
 	buf = malloc(4096);
 
 	LDAP *ld;
@@ -501,8 +490,8 @@
 
 	int xoff = 0;
 
-    xml = switch_xml_new("document");
-    switch_xml_set_attr_d(xml, "type", "freeswitch/xml");
+	xml = switch_xml_new("document");
+	switch_xml_set_attr_d(xml, "type", "freeswitch/xml");
 
 	if (params) {
 		if ((hi = params->headers)) {
@@ -512,7 +501,7 @@
 					break;
 
 				case XML_LDAP_DIRECTORY:
-				switch_log_printf(SWITCH_CHANNEL_LOG,SWITCH_LOG_ERROR, "from cb got %s=%s\n", hi->name, hi->value);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "from cb got %s=%s\n", hi->name, hi->value);
 					if (!strncmp(hi->name, "user", strlen(hi->name))) {
 						dir_exten = strdup(hi->value);
 					} else if (!strncmp(hi->name, "domain", strlen(hi->name))) {
@@ -530,45 +519,47 @@
 
 
 
-    if ( (ldap_initialize(&ld,binding->url)) != LDAP_SUCCESS ) goto cleanup;
-    if ( (ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &desired_version)) != LDAP_SUCCESS ) goto cleanup;
-    if ( (ldap_bind_s(ld, binding->binddn, binding->bindpass, auth_method)) != LDAP_SUCCESS ) goto cleanup;
+	if ((ldap_initialize(&ld, binding->url)) != LDAP_SUCCESS)
+		goto cleanup;
+	if ((ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &desired_version)) != LDAP_SUCCESS)
+		goto cleanup;
+	if ((ldap_bind_s(ld, binding->binddn, binding->bindpass, auth_method)) != LDAP_SUCCESS)
+		goto cleanup;
 
 	switch (binding->bt) {
-		case XML_LDAP_CONFIG:
-			xml = switch_xml_add_child_d(xml, "section", xoff++);
-			switch_xml_set_attr_d(xml, "name", "configuration");
-			filter = switch_mprintf(binding->filter,key_name,key_value);
-			basedn = switch_mprintf(binding->basedn,tag_name);
-			ret = trysearch(&xml,&xoff,ld, basedn, filter);
-			break;
+	case XML_LDAP_CONFIG:
+		xml = switch_xml_add_child_d(xml, "section", xoff++);
+		switch_xml_set_attr_d(xml, "name", "configuration");
+		filter = switch_mprintf(binding->filter, key_name, key_value);
+		basedn = switch_mprintf(binding->basedn, tag_name);
+		ret = trysearch(&xml, &xoff, ld, basedn, filter);
+		break;
 
-		case XML_LDAP_DIRECTORY:
-			ret = trydir(&xml,&xoff,ld,dir_domain,dir_exten, binding);
-			break;
+	case XML_LDAP_DIRECTORY:
+		ret = trydir(&xml, &xoff, ld, dir_domain, dir_exten, binding);
+		break;
 
-		case XML_LDAP_DIALPLAN:
-			break;
+	case XML_LDAP_DIALPLAN:
+		break;
 
-		case XML_LDAP_PHRASE:
-			break;
+	case XML_LDAP_PHRASE:
+		break;
 	}
 
 
 
 
-	cleanup:
+  cleanup:
 	ldap_unbind_s(ld);
 
-    switch_xml_toxml_buf(xml,buf,0,0,1);
-    printf("providing:\n%s\n", buf);
+	switch_xml_toxml_buf(xml, buf, 0, 0, 1);
+	printf("providing:\n%s\n", buf);
 	switch_safe_free(buf);
 
 	if (ret != SWITCH_STATUS_SUCCESS) {
 		switch_xml_free(xml);
 		return NULL;
 	}
-	
+
 	return xml;
 }
-

Property changes: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_rpc


Name: svn:ignore
   - Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Win32
x64
   + Release
Debug
*.user
*.so
*.pdb
*.dylib
*.o
.libs
debug
Win32
x64
Makefile.in
.deps
Makefile.am

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/mod/xml_int/mod_xml_rpc/mod_xml_rpc.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -161,9 +161,8 @@
 	return ret ? SWITCH_STATUS_FALSE : SWITCH_STATUS_SUCCESS;
 }
 
-static abyss_bool user_attributes (const char *user, const char *domain_name,
-                                   const char **ppasswd, const char **pvm_passwd,
-                                   const char **palias, const char **pallowed_commands)
+static abyss_bool user_attributes(const char *user, const char *domain_name,
+								  const char **ppasswd, const char **pvm_passwd, const char **palias, const char **pallowed_commands)
 {
 	const char *passwd;
 	const char *vm_passwd;
@@ -183,7 +182,7 @@
 	switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS);
 	switch_assert(params);
 	switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "number_alias", "check");
-				
+
 	if (switch_xml_locate_user("id", user, domain_name, NULL, &x_domain_root, &x_domain, &x_user, NULL, params) != SWITCH_STATUS_SUCCESS) {
 		switch_event_destroy(&params);
 		if (x_domain_root) {
@@ -196,11 +195,11 @@
 	alias = switch_xml_attr(x_user, "number-alias");
 
 	if ((x_params = switch_xml_child(x_domain, "params"))) {
-	
+
 		for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
 			const char *var = switch_xml_attr_soft(x_param, "name");
 			const char *val = switch_xml_attr_soft(x_param, "value");
-			
+
 			if (!strcasecmp(var, "password")) {
 				passwd = val;
 			} else if (!strcasecmp(var, "vm-password")) {
@@ -216,7 +215,7 @@
 		for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
 			const char *var = switch_xml_attr_soft(x_param, "name");
 			const char *val = switch_xml_attr_soft(x_param, "value");
-		
+
 			if (!strcasecmp(var, "password")) {
 				passwd = val;
 			} else if (!strcasecmp(var, "vm-password")) {
@@ -227,23 +226,24 @@
 		}
 	}
 
-	if (x_domain_root) {
-		switch_xml_free(x_domain_root);
-	}
-
 	if (ppasswd)
-		*ppasswd = passwd;
+		*ppasswd = strdup(passwd);
 	if (pvm_passwd)
-		*pvm_passwd = vm_passwd;
+		*pvm_passwd = strdup(vm_passwd);
 	if (palias)
-		*palias = alias;
+		*palias = strdup(alias);
 	if (pallowed_commands)
-		*pallowed_commands = allowed_commands;
+		*pallowed_commands = strdup(allowed_commands);
 
+
+	if (x_domain_root) {
+		switch_xml_free(x_domain_root);
+	}
+
 	return TRUE;
 }
 
-static abyss_bool is_authorized (const TSession *r, const char *command)
+static abyss_bool is_authorized(const TSession * r, const char *command)
 {
 	char *user = NULL, *domain_name = NULL;
 	char *allowed_commands;
@@ -262,7 +262,7 @@
 	}
 
 	if (!r->requestInfo.user) {
-		return FALSE;	
+		return FALSE;
 	}
 
 	user = strdup(r->requestInfo.user);
@@ -276,14 +276,14 @@
 		switch_safe_free(user);
 		return TRUE;
 	}
-	
+
 	if (zstr(user) || zstr(domain_name)) {
 		switch_safe_free(user);
 		return FALSE;
 	}
-	
 
-	if (!user_attributes (user, domain_name, NULL, NULL, NULL, &allowed_commands)) {
+
+	if (!user_attributes(user, domain_name, NULL, NULL, NULL, &allowed_commands)) {
 		switch_safe_free(user);
 		return FALSE;
 	}
@@ -293,22 +293,22 @@
 	if (!allowed_commands)
 		return FALSE;
 
-	dup = strdup (allowed_commands);
-	argc = switch_separate_string (dup, ',', argv, (sizeof(argv) / sizeof(argv[0])));
+	dup = allowed_commands;
+	argc = switch_separate_string(dup, ',', argv, (sizeof(argv) / sizeof(argv[0])));
 
 	for (i = 0; i < argc; i++) {
 		if (!strcasecmp(argv[i], command)
-                    || !strcasecmp(argv[i], "any")) {
+			|| !strcasecmp(argv[i], "any")) {
 			break;
 		}
 	}
 
-	switch_safe_free (dup);
+	switch_safe_free(dup);
 
 	return i < argc ? TRUE : FALSE;
 }
 
-static abyss_bool http_directory_auth(TSession *r, char *domain_name)
+static abyss_bool http_directory_auth(TSession * r, char *domain_name)
 {
 	char *p;
 	char *x;
@@ -319,6 +319,7 @@
 	const char *box = NULL;
 	int at = 0;
 	char *dp;
+	abyss_bool rval = FALSE;
 
 	p = RequestHeaderValue(r, "authorization");
 
@@ -332,24 +333,28 @@
 				if ((pass = strchr(user, ':'))) {
 					*pass++ = '\0';
 				}
-				
+
 				if ((dp = strchr(user, '@'))) {
 					*dp++ = '\0';
 					domain_name = dp;
 					at++;
 				}
-				
+
 				if (!domain_name) {
 					if (globals.virtual_host) {
-						domain_name = (char *) r->requestInfo.host;
-						if (!strncasecmp(domain_name, "www.", 3)) {
-							domain_name += 4;
+						if ((domain_name = (char *) r->requestInfo.host)) {
+							if (!strncasecmp(domain_name, "www.", 3)) {
+								domain_name += 4;
+							}
 						}
-					} else if (globals.default_domain) {
-						domain_name = globals.default_domain;
-					} else {
-						domain_name = switch_core_get_variable("domain");
 					}
+					if (!domain_name) {
+						if (globals.default_domain) {
+							domain_name = globals.default_domain;
+						} else {
+							domain_name = switch_core_get_variable("domain");
+						}
+					}
 				}
 
 				if (zstr(user) || zstr(domain_name)) {
@@ -369,7 +374,7 @@
 					}
 				}
 
-				if (!user_attributes (user, domain_name, &mypass1, &mypass2, &box, NULL)) {
+				if (!user_attributes(user, domain_name, &mypass1, &mypass2, &box, NULL)) {
 					goto fail;
 				}
 
@@ -435,14 +440,14 @@
 				goto fail;
 
 			  authed:
-				
+
 				switch_snprintf(z, sizeof(z), "%s@%s", (box ? box : user), domain_name);
 				r->requestInfo.user = strdup(z);
 
 				ResponseAddField(r, "freeswitch-user", (box ? box : user));
 				ResponseAddField(r, "freeswitch-domain", domain_name);
-
-				return TRUE;
+				rval = TRUE;
+				goto done;
 			}
 		}
 	}
@@ -452,7 +457,14 @@
 	switch_snprintf(z, sizeof(z), "Basic realm=\"%s\"", domain_name ? domain_name : globals.realm);
 	ResponseAddField(r, "WWW-Authenticate", z);
 	ResponseStatus(r, 401);
-	return FALSE;
+
+  done:
+
+	switch_safe_free(mypass1);
+	switch_safe_free(mypass2);
+	switch_safe_free(box);
+
+	return rval;
 }
 
 abyss_bool auth_hook(TSession * r)
@@ -601,7 +613,6 @@
 	if (is_authorized(r, command)) {
 		goto auth;
 	}
-
 	//unauth:
 	ResponseStatus(r, 403);
 	ResponseError(r);
@@ -613,7 +624,7 @@
 
 	if (switch_event_create(&stream.param_event, SWITCH_EVENT_API) == SWITCH_STATUS_SUCCESS) {
 		const char *const content_length = RequestHeaderValue(r, "content-length");
-		
+
 		if (html)
 			switch_event_add_header_string(stream.param_event, SWITCH_STACK_BOTTOM, "Content-type", "text/html");
 		else if (text)
@@ -626,7 +637,7 @@
 			switch_event_add_header_string(stream.param_event, SWITCH_STACK_BOTTOM, "FreeSWITCH-Domain", fs_domain);
 		if (path_info)
 			switch_event_add_header_string(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-Path-Info", path_info);
-			switch_event_add_header_string(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-URI", r->requestInfo.uri);
+		switch_event_add_header_string(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-URI", r->requestInfo.uri);
 		if (r->requestInfo.query)
 			switch_event_add_header_string(stream.param_event, SWITCH_STACK_BOTTOM, "HTTP-QUERY", r->requestInfo.query);
 		if (r->requestInfo.host)
@@ -786,7 +797,7 @@
 	//SocketClose(&(r->conn->socket));
 
 	HTTPWriteEnd(r);
-	//if(r->conn->channelP)
+	//if (r->conn->channelP)
 	//ConnKill(r->conn);
 	//ChannelInterrupt(r->conn->channelP);
 	//ConnClose(r->conn);
@@ -814,7 +825,7 @@
 		return NULL;
 	}
 
-	if (!is_authorized((const TSession *)callInfo, command)) {
+	if (!is_authorized((const TSession *) callInfo, command)) {
 		val = xmlrpc_build_value(envP, "s", "UNAUTHORIZED!");
 		goto end;
 	}
@@ -825,7 +836,7 @@
 		freed = 1;
 		command = "bgapi";
 		arg = "unload mod_xml_rpc";
-	} else 	if (switch_stristr("reload", command) && switch_stristr("mod_xml_rpc", arg)) {
+	} else if (switch_stristr("reload", command) && switch_stristr("mod_xml_rpc", arg)) {
 		switch_safe_free(command);
 		switch_safe_free(arg);
 		freed = 1;
@@ -842,7 +853,7 @@
 		val = xmlrpc_build_value(envP, "s", "ERROR!");
 	}
 
-end:
+  end:
 
 	/* xmlrpc-c requires us to free memory it malloced from xmlrpc_decompose_value */
 	if (!freed) {
@@ -964,7 +975,7 @@
 	//globals.abyssServer.running = 0;
 	//shutdown(globals.abyssServer.listensock, 2);
 	ServerTerminate(&globals.abyssServer);
-	
+
 	do {
 		switch_yield(100000);
 	} while (globals.running);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -44,6 +44,7 @@
 #endif
 
 #include <switch.h>
+#include <switch_version.h>
 #include "private/switch_core_pvt.h"
 
 /* pid filename: Stores the process id of the freeswitch process */
@@ -101,8 +102,8 @@
 	}
 
 	/* pull the pid from the file */
-	if (fscanf(f, "%d", (int *)(intptr_t)&pid)!=1) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"Unable to get the pid!\n");
+	if (fscanf(f, "%d", (int *) (intptr_t) & pid) != 1) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to get the pid!\n");
 	}
 
 	/* if we have a valid pid */
@@ -171,7 +172,7 @@
 /* the main service entry point */
 void WINAPI service_main(DWORD numArgs, char **args)
 {
-	switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT;
+	switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT | SCF_CALIBRATE_CLOCK | SCF_USE_CLOCK_RT;
 	const char *err = NULL;		/* error value for return from freeswitch initialization */
 	/*  we have to initialize the service-specific stuff */
 	memset(&status, 0, sizeof(SERVICE_STATUS));
@@ -202,19 +203,20 @@
 
 #else
 
-void daemonize(void) {
+void daemonize(void)
+{
 	int fd;
 	pid_t pid;
 
 	switch (fork()) {
-		case 0:
-			break;
-		case -1:
-			fprintf(stderr, "Error Backgrounding (fork)! %d - %s\n", errno, strerror(errno));
-			exit(0);
-			break;
-		default:
-			exit(0);
+	case 0:
+		break;
+	case -1:
+		fprintf(stderr, "Error Backgrounding (fork)! %d - %s\n", errno, strerror(errno));
+		exit(0);
+		break;
+	default:
+		exit(0);
 	}
 
 	if (setsid() < 0) {
@@ -223,15 +225,15 @@
 	}
 	pid = fork();
 	switch (pid) {
-		case 0:
-			break;
-		case -1:
-			fprintf(stderr, "Error Backgrounding (fork2)! %d - %s\n", errno, strerror(errno));
-			exit(0);
-			break;
-		default:
-			fprintf(stderr, "%d Backgrounding.\n", (int) pid);
-			exit(0);
+	case 0:
+		break;
+	case -1:
+		fprintf(stderr, "Error Backgrounding (fork2)! %d - %s\n", errno, strerror(errno));
+		exit(0);
+		break;
+	default:
+		fprintf(stderr, "%d Backgrounding.\n", (int) pid);
+		exit(0);
 	}
 
 	/* redirect std* to null */
@@ -266,10 +268,12 @@
 	int nf = 0;					/* TRUE if we are running in nofork mode */
 	char *runas_user = NULL;
 	char *runas_group = NULL;
+#else
+	int win32_service = 0;
 #endif
 	int nc = 0;					/* TRUE if we are running in noconsole mode */
 	pid_t pid = 0;
-	int i,x;
+	int i, x;
 	char *opts;
 	char opts_str[1024] = "";
 	char *local_argv[1024] = { 0 };
@@ -282,7 +286,7 @@
 #ifdef __sun
 	switch_core_flag_t flags = SCF_USE_SQL;
 #else
-	switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT;
+	switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT | SCF_CALIBRATE_CLOCK | SCF_USE_CLOCK_RT;
 #endif
 	int ret = 0;
 	switch_status_t destroy_status;
@@ -317,18 +321,19 @@
 		"\t-uninstall             -- remove freeswitch as a service\n"
 #else
 		"\t-nf                    -- no forking\n"
-		"\t-u [user]              -- specify user to switch to\n"
-		"\t-g [group]             -- specify group to switch to\n"
+		"\t-u [user]              -- specify user to switch to\n" "\t-g [group]             -- specify group to switch to\n"
 #endif
-		"\t-help                  -- this message\n"
+		"\t-help                  -- this message\n" "\t-version               -- print the version and exit\n"
 #ifdef HAVE_SETRLIMIT
-		"\t-waste                 -- allow memory waste\n"
-		"\t-core                  -- dump cores\n"
+		"\t-waste                 -- allow memory waste\n" "\t-core                  -- dump cores\n"
 #endif
 		"\t-hp                    -- enable high priority settings\n"
 		"\t-vg                    -- run under valgrind\n"
 		"\t-nosql                 -- disable internal sql scoreboard\n"
+		"\t-vm                    -- use possibly more vm-friendly timing code.\n"
 		"\t-nonat                 -- disable auto nat detection\n"
+		"\t-nocal                 -- disable clock calibration\n"
+		"\t-nort                  -- disable clock clock_realtime\n"
 		"\t-stop                  -- stop freeswitch\n"
 		"\t-nc                    -- do not output to a console and background\n"
 		"\t-c                     -- output to a console and stay in the foreground\n"
@@ -337,8 +342,7 @@
 		"\t-run [rundir]          -- specify an alternate run dir\n"
 		"\t-db [dbdir]            -- specify an alternate db dir\n"
 		"\t-mod [moddir]          -- specify an alternate mod dir\n"
-		"\t-htdocs [htdocsdir]    -- specify an alternate htdocs dir\n"
-		"\t-scripts [scriptsdir]  -- specify an alternate scripts dir\n";
+		"\t-htdocs [htdocsdir]    -- specify an alternate htdocs dir\n" "\t-scripts [scriptsdir]  -- specify an alternate scripts dir\n";
 
 	for (x = 1; x < local_argc; x++) {
 		known_opt = 0;
@@ -352,19 +356,9 @@
 				} else {
 					switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN);
 				}
-				{ /* Attempt to start service */
-					SERVICE_TABLE_ENTRY dispatchTable[] = {
-						{service_name, &service_main},
-						{NULL, NULL}
-					};
-					known_opt++;
-					if (StartServiceCtrlDispatcher(dispatchTable) == 0) {
-						/* Not loaded as a service */
-						fprintf(stderr, "Error Freeswitch loaded as a console app with -service option\n");
-						fprintf(stderr, "To install the service load freeswitch with -install\n");
-					}
-					exit(0);
-				}
+				known_opt++;
+				win32_service++;
+				continue;
 			}
 			if (local_argv[x] && !strcmp(local_argv[x], "-install")) {
 				char exePath[1024];
@@ -378,20 +372,14 @@
 				known_opt++;
 				GetModuleFileName(NULL, exePath, 1024);
 				snprintf(servicePath, sizeof(servicePath), "%s -service %s", exePath, service_name);
-				{ /* Perform service installation */
-					SC_HANDLE hService; 
+				{				/* Perform service installation */
+					SC_HANDLE hService;
 					SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
 					if (!hSCManager) {
 						fprintf(stderr, "Could not open service manager (%d).\n", GetLastError());
 						exit(1);
 					}
-					hService = CreateService(hSCManager,
-							 				 service_name,
-											 service_name,
-											 GENERIC_READ | GENERIC_EXECUTE | SERVICE_CHANGE_CONFIG,
-											 SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_IGNORE, 
-											 servicePath, NULL, NULL, NULL,
-											 NULL,  /* Service start name */
+					hService = CreateService(hSCManager, service_name, service_name, GENERIC_READ | GENERIC_EXECUTE | SERVICE_CHANGE_CONFIG, SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_IGNORE, servicePath, NULL, NULL, NULL, NULL,	/* Service start name */
 											 NULL);
 					if (!hService) {
 						fprintf(stderr, "Error creating freeswitch service (%d).\n", GetLastError());
@@ -416,7 +404,7 @@
 				} else {
 					switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN);
 				}
-				{ /* Do the uninstallation */
+				{				/* Do the uninstallation */
 					SC_HANDLE hService;
 					SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
 					if (!hSCManager) {
@@ -439,7 +427,6 @@
 				}
 			}
 		}
-
 #else
 		if (local_argv[x] && !strcmp(local_argv[x], "-u")) {
 			x++;
@@ -461,6 +448,12 @@
 			nf++;
 			known_opt++;
 		}
+
+		if (local_argv[x] && !strcmp(local_argv[x], "-version")) {
+			fprintf(stdout, "FreeSWITCH version: %s\n", SWITCH_VERSION_FULL);
+			return 0;
+			known_opt++;
+		}
 #endif
 #ifdef HAVE_SETRLIMIT
 		if (local_argv[x] && !strcmp(local_argv[x], "-core")) {
@@ -492,6 +485,21 @@
 			known_opt++;
 		}
 
+		if (local_argv[x] && !strcmp(local_argv[x], "-vm")) {
+			flags |= SCF_USE_COND_TIMING;
+			known_opt++;
+		}
+
+		if (local_argv[x] && !strcmp(local_argv[x], "-nort")) {
+			flags &= ~SCF_USE_CLOCK_RT;
+			known_opt++;
+		}
+
+		if (local_argv[x] && !strcmp(local_argv[x], "-nocal")) {
+			flags &= ~SCF_CALIBRATE_CLOCK;
+			known_opt++;
+		}
+
 		if (local_argv[x] && !strcmp(local_argv[x], "-vg")) {
 			flags |= SCF_VG;
 			known_opt++;
@@ -544,7 +552,7 @@
 			}
 			known_opt++;
 		}
-				
+
 		if (local_argv[x] && !strcmp(local_argv[x], "-log")) {
 			x++;
 			if (local_argv[x] && strlen(local_argv[x])) {
@@ -634,7 +642,7 @@
 			exit(0);
 		}
 	}
-	
+
 	if (log_set && !run_set) {
 		SWITCH_GLOBAL_dirs.run_dir = (char *) malloc(strlen(SWITCH_GLOBAL_dirs.log_dir) + 1);
 		if (!SWITCH_GLOBAL_dirs.run_dir) {
@@ -670,7 +678,6 @@
 		}
 #endif
 	}
-
 #if defined(HAVE_SETRLIMIT) && !defined(__sun)
 	if (!waste && !(flags & SCF_VG)) {
 		memset(&rlp, 0, sizeof(rlp));
@@ -679,8 +686,8 @@
 			char buf[1024] = "";
 			int i = 0;
 
-			fprintf(stderr, "Error: stacksize %d is too large: run ulimit -s %d or run %s -waste.\nauto-adjusting stack size for optimal performance....\n", 
-					(int)(rlp.rlim_max / 1024), SWITCH_THREAD_STACKSIZE / 1024, local_argv[0]);
+			fprintf(stderr, "Error: stacksize %d is too large: run ulimit -s %d or run %s -waste.\nauto-adjusting stack size for optimal performance...\n",
+					(int) (rlp.rlim_max / 1024), SWITCH_THREAD_STACKSIZE / 1024, local_argv[0]);
 
 			memset(&rlp, 0, sizeof(rlp));
 			rlp.rlim_cur = SWITCH_THREAD_STACKSIZE;
@@ -688,14 +695,14 @@
 			setrlimit(RLIMIT_STACK, &rlp);
 
 			apr_terminate();
-			ret = (int)execv(argv[0], argv);
-			
-			for(i = 0; i < argc; i++) {
+			ret = (int) execv(argv[0], argv);
+
+			for (i = 0; i < argc; i++) {
 				switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", argv[i]);
 			}
 
 			return system(buf);
-					
+
 		}
 	}
 #endif
@@ -713,10 +720,26 @@
 #ifndef WIN32
 	if (runas_user || runas_group) {
 		if (change_user_group(runas_user, runas_group) < 0) {
-			fprintf(stderr, "Failed to switch user / group\n" );
+			fprintf(stderr, "Failed to switch user / group\n");
 			return 255;
 		}
 	}
+#else
+	if (win32_service) {
+		{						/* Attempt to start service */
+			SERVICE_TABLE_ENTRY dispatchTable[] = {
+				{service_name, &service_main}
+				,
+				{NULL, NULL}
+			};
+			if (StartServiceCtrlDispatcher(dispatchTable) == 0) {
+				/* Not loaded as a service */
+				fprintf(stderr, "Error Freeswitch loaded as a console app with -service option\n");
+				fprintf(stderr, "To install the service load freeswitch with -install\n");
+			}
+			exit(0);
+		}
+	}
 #endif
 
 	switch_core_set_globals();
@@ -729,14 +752,11 @@
 	pid_len = strlen(pid_buffer);
 
 	apr_pool_create(&pool, NULL);
-	
 
-	if (switch_file_open(&fd,
-						 pid_path,
-						 SWITCH_FOPEN_READ,
-						 SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE,
-						 pool) == SWITCH_STATUS_SUCCESS) {
+	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.run_dir, SWITCH_DEFAULT_DIR_PERMS, pool);
 
+	if (switch_file_open(&fd, pid_path, SWITCH_FOPEN_READ, SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, pool) == SWITCH_STATUS_SUCCESS) {
+
 		old_pid_len = sizeof(old_pid_buffer);
 		switch_file_read(fd, old_pid_buffer, &old_pid_len);
 		switch_file_close(fd);
@@ -745,8 +765,7 @@
 	if (switch_file_open(&fd,
 						 pid_path,
 						 SWITCH_FOPEN_WRITE | SWITCH_FOPEN_CREATE | SWITCH_FOPEN_TRUNCATE,
-						 SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE,
-						 pool) != SWITCH_STATUS_SUCCESS) {
+						 SWITCH_FPROT_UREAD | SWITCH_FPROT_UWRITE, pool) != SWITCH_STATUS_SUCCESS) {
 		fprintf(stderr, "Cannot open pid file %s.\n", pid_path);
 		return 255;
 	}
@@ -770,7 +789,7 @@
 	switch_core_runtime_loop(nc);
 
 	destroy_status = switch_core_destroy();
-	
+
 	switch_file_close(fd);
 
 	if (unlink(pid_path) != 0) {
@@ -780,12 +799,12 @@
 	if (destroy_status == SWITCH_STATUS_RESTART) {
 		char buf[1024] = "";
 		int j = 0;
-		
+
 		switch_sleep(1000000);
-		ret = (int)execv(argv[0], argv);
+		ret = (int) execv(argv[0], argv);
 		fprintf(stderr, "Restart Failed [%s] resorting to plan b\n", strerror(errno));
 
-		for(j = 0; j < argc; j++) {
+		for (j = 0; j < argc; j++) {
 			switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", argv[j]);
 		}
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_apr.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_apr.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_apr.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -34,6 +34,7 @@
 #ifndef WIN32
 #include <switch_private.h>
 #endif
+#include "private/switch_core_pvt.h"
 
 /* apr headers*/
 #include <apr.h>
@@ -74,36 +75,44 @@
 #ifndef WIN32
 	return apr_os_thread_current();
 #else
-	return (switch_thread_id_t)(GetCurrentThreadId());
+	return (switch_thread_id_t) (GetCurrentThreadId());
 #endif
 }
 
+SWITCH_DECLARE(int) switch_thread_equal(switch_thread_id_t tid1, switch_thread_id_t tid2)
+{
+#ifdef WIN32
+	return (tid1 == tid2);
+#else
+	return apr_os_thread_equal(tid1, tid2);
+#endif
+
+}
+
 SWITCH_DECLARE(void) switch_pool_clear(switch_memory_pool_t *p)
 {
 	apr_pool_clear(p);
 }
 
 SWITCH_DECLARE(unsigned int) switch_ci_hashfunc_default(const char *char_key, switch_ssize_t *klen)
-														
 {
-    unsigned int hash = 0;
-    const unsigned char *key = (const unsigned char *)char_key;
-    const unsigned char *p;
-    apr_ssize_t i;
-    
-    if (*klen == APR_HASH_KEY_STRING) {
-        for (p = key; *p; p++) {
-            hash = hash * 33 + tolower(*p);
-        }
-        *klen = p - key;
-    }
-    else {
-        for (p = key, i = *klen; i; i--, p++) {
-            hash = hash * 33 + tolower(*p);
-        }
-    }
+	unsigned int hash = 0;
+	const unsigned char *key = (const unsigned char *) char_key;
+	const unsigned char *p;
+	apr_ssize_t i;
 
-    return hash;
+	if (*klen == APR_HASH_KEY_STRING) {
+		for (p = key; *p; p++) {
+			hash = hash * 33 + tolower(*p);
+		}
+		*klen = p - key;
+	} else {
+		for (p = key, i = *klen; i; i--, p++) {
+			hash = hash * 33 + tolower(*p);
+		}
+	}
+
+	return hash;
 }
 
 
@@ -114,7 +123,7 @@
 
 /* DSO functions */
 
-SWITCH_DECLARE(switch_status_t) switch_dso_load(switch_dso_handle_t **res_handle, const char *path, switch_memory_pool_t *ctx)
+SWITCH_DECLARE(switch_status_t) switch_dso_load(switch_dso_handle_t ** res_handle, const char *path, switch_memory_pool_t *ctx)
 {
 	return apr_dso_load(res_handle, path, ctx);
 }
@@ -139,44 +148,45 @@
 SWITCH_DECLARE(switch_status_t) switch_strftime(char *s, switch_size_t *retsize, switch_size_t max, const char *format, switch_time_exp_t *tm)
 {
 	const char *p = format;
-	
-	if (!p) return SWITCH_STATUS_FALSE;
 
+	if (!p)
+		return SWITCH_STATUS_FALSE;
+
 	while (*p) {
 		if (*p == '%') {
 			switch (*(++p)) {
-            case 'C':
-            case 'D':
-            case 'r':
-            case 'R':
-            case 'T':
-            case 'e':
-            case 'a':
-            case 'A':
-            case 'b':
-            case 'B':
-            case 'c':
-            case 'd':
-            case 'H':
-            case 'I':
-            case 'j':
-            case 'm':
-            case 'M':
-            case 'p':
-            case 'S':
-            case 'U':
-            case 'w':
-            case 'W':
-            case 'x':
-            case 'X':
-            case 'y':
-            case 'Y':
-            case 'z':
-            case 'Z':
-            case '%':
+			case 'C':
+			case 'D':
+			case 'r':
+			case 'R':
+			case 'T':
+			case 'e':
+			case 'a':
+			case 'A':
+			case 'b':
+			case 'B':
+			case 'c':
+			case 'd':
+			case 'H':
+			case 'I':
+			case 'j':
+			case 'm':
+			case 'M':
+			case 'p':
+			case 'S':
+			case 'U':
+			case 'w':
+			case 'W':
+			case 'x':
+			case 'X':
+			case 'y':
+			case 'Y':
+			case 'z':
+			case 'Z':
+			case '%':
 				p++;
 				continue;
-            case '\0':
+			case '\0':
 			default:
 				return SWITCH_STATUS_FALSE;
 			}
@@ -220,7 +230,7 @@
 
 /* thread read write lock functions */
 
-SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_create(switch_thread_rwlock_t **rwlock, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_create(switch_thread_rwlock_t ** rwlock, switch_memory_pool_t *pool)
 {
 	return apr_thread_rwlock_create(rwlock, pool);
 }
@@ -278,7 +288,7 @@
 
 /* thread mutex functions */
 
-SWITCH_DECLARE(switch_status_t) switch_mutex_init(switch_mutex_t **lock, unsigned int flags, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_mutex_init(switch_mutex_t ** lock, unsigned int flags, switch_memory_pool_t *pool)
 {
 	return apr_thread_mutex_create(lock, flags, pool);
 }
@@ -318,12 +328,12 @@
 
 SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt_get(switch_time_t *result, switch_time_exp_t *input)
 {
-	return apr_time_exp_gmt_get((apr_time_t *)result, (apr_time_exp_t *) input);
+	return apr_time_exp_gmt_get((apr_time_t *) result, (apr_time_exp_t *) input);
 }
 
 SWITCH_DECLARE(switch_status_t) switch_time_exp_get(switch_time_t *result, switch_time_exp_t *input)
 {
-	return apr_time_exp_get((apr_time_t *)result, (apr_time_exp_t *) input);
+	return apr_time_exp_get((apr_time_t *) result, (apr_time_exp_t *) input);
 }
 
 SWITCH_DECLARE(switch_status_t) switch_time_exp_lt(switch_time_exp_t *result, switch_time_t input)
@@ -333,7 +343,7 @@
 
 SWITCH_DECLARE(switch_status_t) switch_time_exp_tz(switch_time_exp_t *result, switch_time_t input, switch_int32_t offs)
 {
-	return apr_time_exp_tz((apr_time_exp_t *) result, input, (apr_int32_t )offs);
+	return apr_time_exp_tz((apr_time_exp_t *) result, input, (apr_int32_t) offs);
 }
 
 SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t *result, switch_time_t input)
@@ -353,7 +363,7 @@
 
 /* Thread condition locks */
 
-SWITCH_DECLARE(switch_status_t) switch_thread_cond_create(switch_thread_cond_t **cond, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_thread_cond_create(switch_thread_cond_t ** cond, switch_memory_pool_t *pool)
 {
 	return apr_thread_cond_create(cond, pool);
 }
@@ -391,7 +401,7 @@
 
 /* file i/o stubs */
 
-SWITCH_DECLARE(switch_status_t) switch_file_open(switch_file_t **newf, const char *fname, int32_t flag, switch_fileperms_t perm,
+SWITCH_DECLARE(switch_status_t) switch_file_open(switch_file_t ** newf, const char *fname, int32_t flag, switch_fileperms_t perm,
 												 switch_memory_pool_t *pool)
 {
 	return apr_file_open(newf, fname, flag, perm, pool);
@@ -406,10 +416,7 @@
 	return rv;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_file_copy(const char *from_path, 
-												 const char *to_path,
-												 switch_fileperms_t perms,
-												 switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_file_copy(const char *from_path, const char *to_path, switch_fileperms_t perms, switch_memory_pool_t *pool)
 {
 	return apr_file_copy(from_path, to_path, perms, pool);
 }
@@ -460,7 +467,7 @@
 	return ret;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_file_mktemp(switch_file_t **thefile, char *templ, int32_t flags, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_file_mktemp(switch_file_t ** thefile, char *templ, int32_t flags, switch_memory_pool_t *pool)
 {
 	return apr_file_mktemp(thefile, templ, flags, pool);
 }
@@ -533,7 +540,7 @@
 	apr_finfo_t finfo;
 };
 
-SWITCH_DECLARE(switch_status_t) switch_dir_open(switch_dir_t **new_dir, const char *dirname, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_dir_open(switch_dir_t ** new_dir, const char *dirname, switch_memory_pool_t *pool)
 {
 	switch_status_t status;
 	switch_dir_t *dir = malloc(sizeof(*dir));
@@ -595,7 +602,7 @@
 
 /* thread stubs */
 
-SWITCH_DECLARE(switch_status_t) switch_threadattr_create(switch_threadattr_t **new_attr, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_threadattr_create(switch_threadattr_t ** new_attr, switch_memory_pool_t *pool)
 {
 	return apr_threadattr_create(new_attr, pool);
 }
@@ -637,7 +644,7 @@
 
 static char TT_KEY[] = "1";
 
-SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t **new_thread, switch_threadattr_t *attr,
+SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t ** new_thread, switch_threadattr_t *attr,
 													 switch_thread_start_t func, void *data, switch_memory_pool_t *cont)
 {
 	switch_core_memory_pool_set_data(cont, "_in_thread", TT_KEY);
@@ -646,12 +653,12 @@
 
 /* socket stubs */
 
-SWITCH_DECLARE(switch_status_t) switch_socket_addr_get(switch_sockaddr_t **sa, switch_bool_t remote, switch_socket_t *sock)
+SWITCH_DECLARE(switch_status_t) switch_socket_addr_get(switch_sockaddr_t ** sa, switch_bool_t remote, switch_socket_t *sock)
 {
 	return apr_socket_addr_get(sa, remote, sock);
 }
 
-SWITCH_DECLARE(switch_status_t) switch_socket_create(switch_socket_t **new_sock, int family, int type, int protocol, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_socket_create(switch_socket_t ** new_sock, int family, int type, int protocol, switch_memory_pool_t *pool)
 {
 	return apr_socket_create(new_sock, family, type, protocol, pool);
 }
@@ -676,7 +683,7 @@
 	return apr_socket_listen(sock, backlog);
 }
 
-SWITCH_DECLARE(switch_status_t) switch_socket_accept(switch_socket_t **new_sock, switch_socket_t *sock, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_socket_accept(switch_socket_t ** new_sock, switch_socket_t *sock, switch_memory_pool_t *pool)
 {
 	return apr_socket_accept(new_sock, sock, pool);
 }
@@ -711,7 +718,8 @@
 	return status;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t *sock, switch_sockaddr_t *where, int32_t flags, const char *buf, switch_size_t *len)
+SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t *sock, switch_sockaddr_t *where, int32_t flags, const char *buf,
+													 switch_size_t *len)
 {
 	if (!where || !buf || !len || !*len) {
 		return SWITCH_STATUS_GENERR;
@@ -724,7 +732,7 @@
 	return apr_socket_recv(sock, buf, len);
 }
 
-SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t **sa, const char *hostname, int32_t family,
+SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t ** sa, const char *hostname, int32_t family,
 														 switch_port_t port, int32_t flags, switch_memory_pool_t *pool)
 {
 	return apr_sockaddr_info_get(sa, hostname, family, port, flags, pool);
@@ -768,7 +776,7 @@
 	if (!in) {
 		return "";
 	}
-	return get_addr(buf, len, (struct sockaddr*)&in->sa, in->salen);
+	return get_addr(buf, len, (struct sockaddr *) &in->sa, in->salen);
 }
 
 SWITCH_DECLARE(uint16_t) switch_sockaddr_get_port(switch_sockaddr_t *sa)
@@ -806,7 +814,7 @@
 
 /* poll stubs */
 
-SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t **pollset, uint32_t size, switch_memory_pool_t *p, uint32_t flags)
+SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t ** pollset, uint32_t size, switch_memory_pool_t *p, uint32_t flags)
 {
 	return apr_pollset_create(pollset, size, p, flags);
 }
@@ -816,16 +824,16 @@
 	if (!pollset) {
 		return SWITCH_STATUS_FALSE;
 	}
-	
-	return apr_pollset_add((apr_pollset_t *)pollset, (const apr_pollfd_t *)descriptor);
+
+	return apr_pollset_add((apr_pollset_t *) pollset, (const apr_pollfd_t *) descriptor);
 }
 
 SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t *aprset, int32_t numsock, int32_t *nsds, switch_interval_time_t timeout)
 {
 	apr_status_t st = SWITCH_STATUS_FALSE;
-	
+
 	if (aprset) {
-		st = apr_poll((apr_pollfd_t *)aprset, numsock, nsds, timeout);
+		st = apr_poll((apr_pollfd_t *) aprset, numsock, nsds, timeout);
 
 		if (st == APR_TIMEUP) {
 			st = SWITCH_STATUS_TIMEOUT;
@@ -835,7 +843,7 @@
 	return st;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **poll, switch_socket_t *sock, int16_t flags, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t ** poll, switch_socket_t *sock, int16_t flags, switch_memory_pool_t *pool)
 {
 	switch_pollset_t *pollset;
 
@@ -870,17 +878,34 @@
 
 SWITCH_DECLARE(void) switch_uuid_format(char *buffer, const switch_uuid_t *uuid)
 {
+#ifndef WIN32
 	apr_uuid_format(buffer, (const apr_uuid_t *) uuid);
+#else
+	RPC_CSTR buf;
+	UuidToString((const UUID *) uuid, &buf);
+	strcpy(buffer, (const char *) buf);
+	RpcStringFree(&buf);
+#endif
 }
 
 SWITCH_DECLARE(void) switch_uuid_get(switch_uuid_t *uuid)
 {
+	switch_mutex_lock(runtime.uuid_mutex);
+#ifndef WIN32
 	apr_uuid_get((apr_uuid_t *) uuid);
+#else
+	UuidCreate((UUID *) uuid);
+#endif
+	switch_mutex_unlock(runtime.uuid_mutex);
 }
 
 SWITCH_DECLARE(switch_status_t) switch_uuid_parse(switch_uuid_t *uuid, const char *uuid_str)
 {
+#ifndef WIN32
 	return apr_uuid_parse((apr_uuid_t *) uuid, uuid_str);
+#else
+	return UuidFromString((RPC_CSTR) uuid_str, (UUID *) uuid);
+#endif
 }
 
 SWITCH_DECLARE(switch_status_t) switch_md5(unsigned char digest[SWITCH_MD5_DIGESTSIZE], const void *input, switch_size_t inputLen)
@@ -896,7 +921,7 @@
 
 	digest_str[SWITCH_MD5_DIGEST_STRING_SIZE - 1] = '\0';
 
-	for( x = 0; x < SWITCH_MD5_DIGESTSIZE; x++) {
+	for (x = 0; x < SWITCH_MD5_DIGESTSIZE; x++) {
 		switch_snprintf(digest_str + (x * 2), 3, "%02x", digest[x]);
 	}
 
@@ -905,7 +930,7 @@
 
 /* FIFO queues (apr-util) */
 
-SWITCH_DECLARE(switch_status_t) switch_queue_create(switch_queue_t **queue, unsigned int queue_capacity, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_queue_create(switch_queue_t ** queue, unsigned int queue_capacity, switch_memory_pool_t *pool)
 {
 	return apr_queue_create(queue, queue_capacity, pool);
 }
@@ -988,7 +1013,7 @@
 #endif
 }
 
-SWITCH_DECLARE(switch_status_t) switch_match_glob(const char *pattern, switch_array_header_t **result, switch_memory_pool_t *p)
+SWITCH_DECLARE(switch_status_t) switch_match_glob(const char *pattern, switch_array_header_t ** result, switch_memory_pool_t *p)
 {
 	return apr_match_glob(pattern, (apr_array_header_t **) result, p);
 }
@@ -999,9 +1024,9 @@
  * @param out The file descriptor to use as output from the pipe.
  * @param pool The pool to operate on.
  */
-SWITCH_DECLARE(switch_status_t) switch_file_pipe_create(switch_file_t **in, switch_file_t **out, switch_memory_pool_t *p)
+SWITCH_DECLARE(switch_status_t) switch_file_pipe_create(switch_file_t ** in, switch_file_t ** out, switch_memory_pool_t *p)
 {
-    return apr_file_pipe_create ((apr_file_t **) in, (apr_file_t **) out, p);
+	return apr_file_pipe_create((apr_file_t **) in, (apr_file_t **) out, p);
 }
 
 /**
@@ -1011,7 +1036,7 @@
  */
 SWITCH_DECLARE(switch_status_t) switch_file_pipe_timeout_get(switch_file_t *thepipe, switch_interval_time_t *timeout)
 {
-	return apr_file_pipe_timeout_get( (apr_file_t *)thepipe, (apr_interval_time_t *)timeout);
+	return apr_file_pipe_timeout_get((apr_file_t *) thepipe, (apr_interval_time_t *) timeout);
 }
 
 /**
@@ -1022,7 +1047,7 @@
  */
 SWITCH_DECLARE(switch_status_t) switch_file_pipe_timeout_set(switch_file_t *thepipe, switch_interval_time_t timeout)
 {
-	return apr_file_pipe_timeout_set( (apr_file_t *)thepipe, (apr_interval_time_t)timeout);
+	return apr_file_pipe_timeout_set((apr_file_t *) thepipe, (apr_interval_time_t) timeout);
 }
 
 
@@ -1033,7 +1058,7 @@
  */
 SWITCH_DECLARE(switch_status_t) switch_thread_exit(switch_thread_t *thd, switch_status_t retval)
 {
-	return apr_thread_exit((apr_thread_t *)thd, retval);
+	return apr_thread_exit((apr_thread_t *) thd, retval);
 }
 
 /**
@@ -1043,7 +1068,7 @@
  */
 SWITCH_DECLARE(switch_status_t) switch_thread_join(switch_status_t *retval, switch_thread_t *thd)
 {
-	return apr_thread_join((apr_status_t *)retval, (apr_thread_t *)thd); 
+	return apr_thread_join((apr_status_t *) retval, (apr_thread_t *) thd);
 }
 
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_buffer.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_buffer.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_buffer.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_caller.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_caller.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_caller.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -50,7 +50,7 @@
 	switch_caller_profile_t *profile = NULL;
 
 	profile = switch_core_alloc(pool, sizeof(*profile));
-	switch_assert(profile != NULL);	
+	switch_assert(profile != NULL);
 	memset(profile, 0, sizeof(*profile));
 
 	if (!context) {
@@ -58,7 +58,7 @@
 	}
 
 	if (zstr(caller_id_name)) {
-		caller_id_name = "FreeSWITCH";
+		caller_id_name = SWITCH_DEFAULT_CLID_NAME;
 	}
 
 	if (zstr(caller_id_number)) {
@@ -218,28 +218,28 @@
 		return switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER) ? "true" : "false";
 	}
 	if (!strcasecmp(name, "profile_created_time")) {
-		return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->profile_created);		
+		return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->profile_created);
 	}
 	if (!strcasecmp(name, "created_time")) {
-		return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->created);		
+		return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->created);
 	}
 	if (!strcasecmp(name, "answered_time")) {
-		return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->answered);		
+		return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->answered);
 	}
 	if (!strcasecmp(name, "progress_time")) {
-		return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->progress);		
+		return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->progress);
 	}
 	if (!strcasecmp(name, "progress_media_time")) {
-		return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->progress_media);		
+		return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->progress_media);
 	}
 	if (!strcasecmp(name, "hungup_time")) {
-		return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->hungup);		
+		return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->hungup);
 	}
 	if (!strcasecmp(name, "transferred_time")) {
-		return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->transferred);		
+		return switch_core_sprintf(caller_profile->pool, "%" SWITCH_TIME_T_FMT, caller_profile->times->transferred);
 	}
-	
 
+
 	return NULL;
 }
 
@@ -311,7 +311,7 @@
 		switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Answered-Time", prefix);
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%" SWITCH_TIME_T_FMT, caller_profile->times->answered);
 		switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Progress-Time", prefix);
-		switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%" SWITCH_TIME_T_FMT, caller_profile->times->progress);		
+		switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%" SWITCH_TIME_T_FMT, caller_profile->times->progress);
 		switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Progress-Media-Time", prefix);
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, header_name, "%" SWITCH_TIME_T_FMT, caller_profile->times->progress_media);
 		switch_snprintf(header_name, sizeof(header_name), "%s-Channel-Hangup-Time", prefix);
@@ -330,7 +330,7 @@
 	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, header_name, switch_test_flag(caller_profile, SWITCH_CPF_HIDE_NUMBER) ? "true" : "false");
 }
 
-SWITCH_DECLARE(switch_status_t) switch_caller_extension_clone(switch_caller_extension_t **new_ext, switch_caller_extension_t *orig, 
+SWITCH_DECLARE(switch_status_t) switch_caller_extension_clone(switch_caller_extension_t **new_ext, switch_caller_extension_t *orig,
 															  switch_memory_pool_t *pool)
 {
 	switch_caller_extension_t *caller_extension = NULL;
@@ -341,10 +341,10 @@
 	if ((caller_extension = switch_core_alloc(pool, sizeof(switch_caller_extension_t))) != 0) {
 		int match = 0;
 
-        caller_extension->extension_name = switch_core_strdup(pool, orig->extension_name);
-        caller_extension->extension_number = switch_core_strdup(pool, orig->extension_number);
+		caller_extension->extension_name = switch_core_strdup(pool, orig->extension_name);
+		caller_extension->extension_number = switch_core_strdup(pool, orig->extension_number);
 
-		for(ap = orig->applications; ap; ap = ap->next) {
+		for (ap = orig->applications; ap; ap = ap->next) {
 
 			if (!match) {
 				if (ap == orig->current_application) {
@@ -354,7 +354,7 @@
 				}
 			}
 			caller_application = switch_core_alloc(pool, sizeof(switch_caller_application_t));
-			
+
 			caller_application->application_name = switch_core_strdup(pool, ap->application_name);
 			caller_application->application_data = switch_core_strdup(pool, ap->application_data);
 
@@ -363,7 +363,7 @@
 			} else if (caller_extension->last_application) {
 				caller_extension->last_application->next = caller_application;
 			}
-			
+
 			caller_extension->last_application = caller_application;
 
 			if (ap == orig->current_application) {
@@ -374,9 +374,9 @@
 		*new_ext = caller_extension;
 
 		return SWITCH_STATUS_SUCCESS;
-    }
-	
+	}
 
+
 	return SWITCH_STATUS_MEMERR;
 }
 
@@ -396,18 +396,18 @@
 
 
 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, ...)
+																	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);	
+		switch_caller_extension_add_application(session, caller_extension, application_name, data);
 		free(data);
 	}
 }

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_channel.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_channel.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_channel.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -173,7 +173,7 @@
 }
 
 
-SWITCH_DECLARE(void) switch_channel_audio_sync(switch_channel_t *channel) 
+SWITCH_DECLARE(void) switch_channel_audio_sync(switch_channel_t *channel)
 {
 	if (switch_channel_media_ready(channel)) {
 		switch_core_session_message_t msg = { 0 };
@@ -375,9 +375,9 @@
 		*dtmf = *dt;
 
 		if (switch_queue_trypush(channel->dtmf_log_queue, dt) != SWITCH_STATUS_SUCCESS) {
-			free(dt);			
+			free(dt);
 		}
-		
+
 		dt = NULL;
 
 		if (dtmf->duration > switch_core_max_dtmf_duration(0)) {
@@ -467,6 +467,7 @@
 {
 	switch_event_t *event;
 	switch_event_types_t type = SWITCH_EVENT_PRESENCE_IN;
+	const char *call_info = NULL;
 
 	if (!status) {
 		type = SWITCH_EVENT_PRESENCE_OUT;
@@ -480,6 +481,8 @@
 		return;
 	}
 
+	call_info = switch_channel_get_variable(channel, "presence_call_info");
+
 	if (switch_event_create(&event, type) == SWITCH_STATUS_SUCCESS) {
 		switch_channel_event_set_data(channel, event);
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", __FILE__);
@@ -494,19 +497,45 @@
 		}
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event_type", "presence");
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "alt_event_type", "dialog");
+
+		if (call_info) {
+			char *call_info_state = "active";
+
+			if (!switch_channel_up(channel)) {
+				call_info_state = "idle";
+			} else if (!strcasecmp(status, "hold-private")) {
+				call_info_state = "held-private";
+			} else if (!strcasecmp(status, "hold")) {
+				call_info_state = "held";
+			} else if (!switch_channel_test_flag(channel, CF_ANSWERED)) {
+				if (channel->direction == SWITCH_CALL_DIRECTION_OUTBOUND) {
+					call_info_state = "progressing";
+				} else {
+					call_info_state = "alerting";
+				}
+			}
+
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-info-state", call_info_state);
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-info", call_info);
+		}
+
+		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "presence-call-direction",
+									   channel->direction == SWITCH_CALL_DIRECTION_OUTBOUND ? "outbound" : "inbound");
+
+
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "event_count", "%d", channel->event_count++);
 		switch_event_fire(&event);
 	}
 }
 
-SWITCH_DECLARE(const char *) switch_channel_get_variable(switch_channel_t *channel, const char *varname)
+SWITCH_DECLARE(const char *) switch_channel_get_variable_dup(switch_channel_t *channel, const char *varname, switch_bool_t dup)
 {
 	const char *v = NULL, *r = NULL;
 	switch_assert(channel != NULL);
 
 	switch_mutex_lock(channel->profile_mutex);
 	if (!channel->variables || !(v = switch_event_get_header(channel->variables, varname))) {
-		switch_caller_profile_t *cp = switch_channel_get_caller_profile(channel);
+		switch_caller_profile_t *cp = channel->caller_profile;
 
 		if (cp) {
 			if (!strncmp(varname, "aleg_", 5)) {
@@ -523,8 +552,13 @@
 		}
 	}
 
-	if (v) r = switch_core_session_strdup(channel->session, v);
-	
+	if (dup) {
+		if (v)
+			r = switch_core_session_strdup(channel->session, v);
+	} else {
+		r = v;
+	}
+
 	switch_mutex_unlock(channel->profile_mutex);
 
 	return r;
@@ -535,7 +569,7 @@
 	const char *uuid;
 	const char *val = NULL, *r = NULL;
 	switch_assert(channel != NULL);
-	
+
 	if (!zstr(varname)) {
 		if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
 			switch_core_session_t *session;
@@ -547,7 +581,8 @@
 		}
 	}
 
-	if (val) r = switch_core_session_strdup(channel->session, val);
+	if (val)
+		r = switch_core_session_strdup(channel->session, val);
 
 	return r;
 }
@@ -594,6 +629,24 @@
 	return val;
 }
 
+SWITCH_DECLARE(void *) switch_channel_get_private_partner(switch_channel_t *channel, const char *key)
+{
+	const char *uuid;
+	void *val = NULL;
+
+	switch_assert(channel != NULL);
+
+	if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
+		switch_core_session_t *session;
+		if ((session = switch_core_session_locate(uuid))) {
+			val = switch_core_hash_find_locked(channel->private_hash, key, channel->profile_mutex);
+			switch_core_session_rwunlock(session);
+		}
+	}
+
+	return val;
+}
+
 SWITCH_DECLARE(switch_status_t) switch_channel_set_name(switch_channel_t *channel, const char *name)
 {
 	const char *old = NULL;
@@ -634,7 +687,7 @@
 	} else {
 		v = SWITCH_BLANK_STRING;
 	}
-	
+
 	if (!strcasecmp(name, "dialplan")) {
 		channel->caller_profile->dialplan = v;
 	} else if (!strcasecmp(name, "username")) {
@@ -681,11 +734,11 @@
 	return status;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_var_check(switch_channel_t *channel, 
+SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_var_check(switch_channel_t *channel,
 																	  const char *varname, const char *value, switch_bool_t var_check)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
-	
+
 	switch_assert(channel != NULL);
 
 	switch_mutex_lock(channel->profile_mutex);
@@ -693,7 +746,7 @@
 		switch_event_del_header(channel->variables, varname);
 		if (!zstr(value)) {
 			int ok = 1;
-			
+
 			if (var_check) {
 				ok = !switch_string_var_check_const(value);
 			}
@@ -712,7 +765,7 @@
 
 switch_status_t switch_event_base_add_header(switch_event_t *event, switch_stack_t stack, const char *header_name, char *data);
 
-SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_printf(switch_channel_t *channel, const char *varname,  const char *fmt, ...)
+SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_printf(switch_channel_t *channel, const char *varname, const char *fmt, ...)
 {
 	int ret = 0;
 	char *data;
@@ -734,17 +787,46 @@
 			return SWITCH_STATUS_MEMERR;
 		}
 
-		switch_event_base_add_header(channel->variables, SWITCH_STACK_BOTTOM, varname, data);
+		status = switch_channel_set_variable(channel, varname, data);
+		free(data);
+	}
+	switch_mutex_unlock(channel->profile_mutex);
 
-		status = SWITCH_STATUS_SUCCESS;
+	return status;
+}
+
+
+SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_name_printf(switch_channel_t *channel, const char *val, const char *fmt, ...)
+{
+	int ret = 0;
+	char *varname;
+	va_list ap;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	switch_assert(channel != NULL);
+
+	switch_mutex_lock(channel->profile_mutex);
+
+	va_start(ap, fmt);
+	ret = switch_vasprintf(&varname, fmt, ap);
+	va_end(ap);
+
+	if (ret == -1) {
+		switch_mutex_unlock(channel->profile_mutex);
+		return SWITCH_STATUS_MEMERR;
 	}
+
+	status = switch_channel_set_variable(channel, varname, val);
+
+	free(varname);
+
 	switch_mutex_unlock(channel->profile_mutex);
 
 	return status;
 }
 
 
-SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_partner_var_check(switch_channel_t *channel, 
+SWITCH_DECLARE(switch_status_t) switch_channel_set_variable_partner_var_check(switch_channel_t *channel,
 																			  const char *varname, const char *value, switch_bool_t var_check)
 {
 	const char *uuid;
@@ -767,8 +849,15 @@
 
 SWITCH_DECLARE(uint32_t) switch_channel_test_flag(switch_channel_t *channel, switch_channel_flag_t flag)
 {
+	uint32_t r = 0;
+
 	switch_assert(channel != NULL);
-	return channel->flags[flag];
+
+	switch_mutex_lock(channel->flag_mutex);
+	r = channel->flags[flag];
+	switch_mutex_unlock(channel->flag_mutex);
+
+	return r;
 }
 
 SWITCH_DECLARE(switch_bool_t) switch_channel_set_flag_partner(switch_channel_t *channel, switch_channel_flag_t flag)
@@ -793,7 +882,7 @@
 {
 	const char *uuid;
 	int r = 0;
-	
+
 	switch_assert(channel != NULL);
 
 	if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
@@ -834,7 +923,8 @@
 		state = switch_channel_get_running_state(other_channel);
 		mystate = switch_channel_get_running_state(channel);
 
-		if (mystate != ostate || state >= CS_HANGUP || state >= want_state) {
+		if ((channel->state == channel->running_state && channel->running_state == want_state) ||
+			other_channel->state >= CS_HANGUP || channel->state >= CS_HANGUP) {
 			break;
 		}
 		switch_cond_next();
@@ -860,13 +950,11 @@
 	}
 }
 
-SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_flag(switch_channel_t *channel, 
-															 switch_channel_flag_t want_flag, 
-															 switch_bool_t pres, 
-															 uint32_t to,
-															 switch_channel_t *super_channel)
+SWITCH_DECLARE(switch_status_t) switch_channel_wait_for_flag(switch_channel_t *channel,
+															 switch_channel_flag_t want_flag,
+															 switch_bool_t pres, uint32_t to, switch_channel_t *super_channel)
 {
-	
+
 	if (to) {
 		to++;
 	}
@@ -901,13 +989,13 @@
 }
 
 
-SWITCH_DECLARE(void) switch_channel_set_cap(switch_channel_t *channel, switch_channel_cap_t cap)
+SWITCH_DECLARE(void) switch_channel_set_cap_value(switch_channel_t *channel, switch_channel_cap_t cap, uint32_t value)
 {
 	switch_assert(channel);
 	switch_assert(channel->flag_mutex);
 
 	switch_mutex_lock(channel->flag_mutex);
-	channel->caps[cap] = 1;
+	channel->caps[cap] = value;
 	switch_mutex_unlock(channel->flag_mutex);
 }
 
@@ -927,13 +1015,65 @@
 	return channel->caps[cap] ? 1 : 0;
 }
 
-SWITCH_DECLARE(void) switch_channel_set_flag(switch_channel_t *channel, switch_channel_flag_t flag)
+SWITCH_DECLARE(char *) switch_channel_get_flag_string(switch_channel_t *channel)
 {
+	switch_stream_handle_t stream = { 0 };
+	char *r;
+	int i = 0;
+
+	SWITCH_STANDARD_STREAM(stream);
+
+	switch_mutex_lock(channel->flag_mutex);
+	for (i = 0; i < CF_FLAG_MAX; i++) {
+		if (channel->flags[i]) {
+			stream.write_function(&stream, "%d=%d;", i, channel->flags[i]);
+		}
+	}
+	switch_mutex_unlock(channel->flag_mutex);
+
+	r = (char *) stream.data;
+
+	if (end_of(r) == ';') {
+		end_of(r) = '\0';
+	}
+
+	return r;
+
+}
+
+SWITCH_DECLARE(char *) switch_channel_get_cap_string(switch_channel_t *channel)
+{
+	switch_stream_handle_t stream = { 0 };
+	char *r;
+	int i = 0;
+
+	SWITCH_STANDARD_STREAM(stream);
+
+	switch_mutex_lock(channel->flag_mutex);
+	for (i = 0; i < CC_FLAG_MAX; i++) {
+		if (channel->caps[i]) {
+			stream.write_function(&stream, "%d=%d;", i, channel->caps[i]);
+		}
+	}
+	switch_mutex_unlock(channel->flag_mutex);
+
+	r = (char *) stream.data;
+
+	if (end_of(r) == ';') {
+		end_of(r) = '\0';
+	}
+
+	return r;
+
+}
+
+SWITCH_DECLARE(void) switch_channel_set_flag_value(switch_channel_t *channel, switch_channel_flag_t flag, uint32_t value)
+{
 	switch_assert(channel);
 	switch_assert(channel->flag_mutex);
 
 	switch_mutex_lock(channel->flag_mutex);
-	channel->flags[flag] = 1;
+	channel->flags[flag] = value;
 	switch_mutex_unlock(channel->flag_mutex);
 
 	if (flag == CF_OUTBOUND) {
@@ -1022,6 +1162,7 @@
 	switch_mutex_lock(channel->flag_mutex);
 	channel->flags[flag] = 0;
 	switch_mutex_unlock(channel->flag_mutex);
+
 	if (flag == CF_OUTBOUND) {
 		switch_channel_set_variable(channel, "is_outbound", NULL);
 	}
@@ -1038,6 +1179,7 @@
 		channel->flags[flag]--;
 	}
 	switch_mutex_unlock(channel->flag_mutex);
+
 	if (flag == CF_OUTBOUND) {
 		switch_channel_set_variable(channel, "is_outbound", NULL);
 	}
@@ -1063,20 +1205,24 @@
 	return state;
 }
 
-SWITCH_DECLARE(int) switch_channel_test_ready(switch_channel_t *channel, switch_bool_t media)
+SWITCH_DECLARE(int) switch_channel_test_ready(switch_channel_t *channel, switch_bool_t check_ready, switch_bool_t check_media)
 {
 	int ret = 0;
 
 	switch_assert(channel != NULL);
 
-	if (media) {
-		ret = ((switch_channel_test_flag(channel, CF_ANSWERED) || 
-				switch_channel_test_flag(channel, CF_EARLY_MEDIA)) && !switch_channel_test_flag(channel, CF_PROXY_MODE) && 
+	if (check_media) {
+		ret = ((switch_channel_test_flag(channel, CF_ANSWERED) ||
+				switch_channel_test_flag(channel, CF_EARLY_MEDIA)) && !switch_channel_test_flag(channel, CF_PROXY_MODE) &&
 			   switch_core_session_get_read_codec(channel->session) && switch_core_session_get_write_codec(channel->session));
 
-		if (!ret) return ret;
+		if (!ret)
+			return ret;
 	}
-	
+
+	if (!check_ready)
+		return ret;
+
 	ret = 0;
 
 	if (!channel->hangup_cause && channel->state > CS_ROUTING && channel->state < CS_HANGUP && channel->state != CS_RESET &&
@@ -1127,11 +1273,12 @@
 {
 	int x;
 	switch_mutex_lock(channel->state_mutex);
-	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_channel_get_uuid(channel), SWITCH_LOG_DEBUG, "(%s) Running State Change %s\n", channel->name, state_names[state]);
+	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_channel_get_uuid(channel), SWITCH_LOG_DEBUG, "(%s) Running State Change %s\n",
+					  channel->name, state_names[state]);
 	channel->running_state = state;
 
 	if (channel->state_flags[0]) {
-		for(x = 1; x < CF_FLAG_MAX ; x++ ) {
+		for (x = 1; x < CF_FLAG_MAX; x++) {
 			if (channel->state_flags[x]) {
 				channel->flags[x] = 1;
 				channel->state_flags[x] = 0;
@@ -1401,13 +1548,13 @@
 SWITCH_DECLARE(void) switch_channel_event_set_basic_data(switch_channel_t *channel, switch_event_t *event)
 {
 	switch_caller_profile_t *caller_profile, *originator_caller_profile = NULL, *originatee_caller_profile = NULL;
-	switch_codec_implementation_t impl = {0};
+	switch_codec_implementation_t impl = { 0 };
 	char state_num[25];
 	const char *v;
-	
+
 	switch_mutex_lock(channel->profile_mutex);
 
-	if ((caller_profile = switch_channel_get_caller_profile(channel))) {
+	if ((caller_profile = channel->caller_profile)) {
 		originator_caller_profile = caller_profile->originator_caller_profile;
 		originatee_caller_profile = caller_profile->originatee_caller_profile;
 	}
@@ -1417,7 +1564,7 @@
 	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", state_num);
 	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Name", switch_channel_get_name(channel));
 	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(channel->session));
-	
+
 	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Call-Direction",
 								   channel->direction == SWITCH_CALL_DIRECTION_OUTBOUND ? "outbound" : "inbound");
 	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Presence-Call-Direction",
@@ -1458,11 +1605,11 @@
 	if (caller_profile) {
 		switch_caller_profile_event_set_data(caller_profile, "Caller", event);
 	}
-	
+
 	if (originator_caller_profile && originatee_caller_profile) {
 		/* Index Originator's Profile */
 		switch_caller_profile_event_set_data(originator_caller_profile, "Originator", event);
-		
+
 		/* Index Originatee's Profile */
 		switch_caller_profile_event_set_data(originatee_caller_profile, "Originatee", event);
 	} else {
@@ -1483,8 +1630,8 @@
 	int x;
 
 	switch_mutex_lock(channel->profile_mutex);
-	
-	if (switch_channel_test_flag(channel, CF_VERBOSE_EVENTS) || 
+
+	if (switch_channel_test_flag(channel, CF_VERBOSE_EVENTS) ||
 		event->event_id == SWITCH_EVENT_CHANNEL_ORIGINATE ||
 		event->event_id == SWITCH_EVENT_CHANNEL_UUID ||
 		event->event_id == SWITCH_EVENT_CHANNEL_ANSWER ||
@@ -1502,10 +1649,7 @@
 		event->event_id == SWITCH_EVENT_SESSION_HEARTBEAT ||
 		event->event_id == SWITCH_EVENT_API ||
 		event->event_id == SWITCH_EVENT_RECORD_START ||
-		event->event_id == SWITCH_EVENT_RECORD_STOP ||
-		event->event_id == SWITCH_EVENT_CALL_UPDATE ||
-		event->event_id == SWITCH_EVENT_CUSTOM
-		) {
+		event->event_id == SWITCH_EVENT_RECORD_STOP || event->event_id == SWITCH_EVENT_CALL_UPDATE || event->event_id == SWITCH_EVENT_CUSTOM) {
 
 		x = 0;
 		/* Index Variables */
@@ -1513,7 +1657,7 @@
 			for (hi = channel->variables->headers; hi; hi = hi->next) {
 				char buf[1024];
 				char *vvar = NULL, *vval = NULL;
-				
+
 				vvar = (char *) hi->name;
 				vval = (char *) hi->value;
 				x++;
@@ -1570,8 +1714,10 @@
 		}
 	}
 
-	caller_profile->times = (switch_channel_timetable_t *) switch_core_session_alloc(channel->session, sizeof(*caller_profile->times));
-	caller_profile->times->profile_created = switch_micro_time_now();
+	if (!caller_profile->times) {
+		caller_profile->times = (switch_channel_timetable_t *) switch_core_session_alloc(channel->session, sizeof(*caller_profile->times));
+		caller_profile->times->profile_created = switch_micro_time_now();
+	}
 
 	if (channel->caller_profile && channel->caller_profile->times) {
 		channel->caller_profile->times->transferred = caller_profile->times->profile_created;
@@ -1747,7 +1893,7 @@
 		}
 	} else {
 		for (index = 0; index < i; index++) {
-			if (switch_test_flag(channel->state_handlers[index], SSH_FLAG_STICKY)) {
+			if (channel->state_handlers[index] && switch_test_flag(channel->state_handlers[index], SSH_FLAG_STICKY)) {
 				new_handlers[channel->state_handler_index++] = channel->state_handlers[index];
 			}
 		}
@@ -1802,23 +1948,23 @@
 
 	switch_mutex_lock(orig_channel->profile_mutex);
 	switch_mutex_lock(new_channel->profile_mutex);
-	
-	
+
+
 	caller_profile = switch_caller_profile_clone(new_channel->session, new_channel->caller_profile);
 	switch_assert(caller_profile);
 	extension = switch_caller_extension_new(new_channel->session, caller_profile->destination_number, caller_profile->destination_number);
 	orig_extension = switch_channel_get_caller_extension(orig_channel);
-	
-	
+
+
 	if (extension && orig_extension) {
-		for(ap = orig_extension->current_application; ap && offset > 0; offset--) {
+		for (ap = orig_extension->current_application; ap && offset > 0; offset--) {
 			ap = ap->next;
 		}
-		
+
 		for (; ap; ap = ap->next) {
 			switch_caller_extension_add_application(new_channel->session, extension, ap->application_name, ap->application_data);
 		}
-		
+
 		caller_profile->destination_number = switch_core_strdup(caller_profile->pool, orig_channel->caller_profile->destination_number);
 		switch_channel_set_caller_profile(new_channel, caller_profile);
 		switch_channel_set_caller_extension(new_channel, extension);
@@ -1831,9 +1977,10 @@
 					break;
 				}
 			}
-			
-			if (!ok) continue;
 
+			if (!ok)
+				continue;
+
 			switch_channel_set_variable(new_channel, hi->name, hi->value);
 		}
 
@@ -1889,11 +2036,15 @@
 	switch_assert(channel != NULL);
 
 	switch_channel_clear_flag(channel, CF_BLOCK_STATE);
-	
+
 	if (channel->state < CS_HANGUP) {
 		switch_channel_state_t last_state;
 		switch_event_t *event;
 
+		if (hangup_cause == SWITCH_CAUSE_LOSE_RACE) {
+			switch_channel_set_variable(channel, "presence_call_info", NULL);
+		}
+
 		switch_mutex_lock(channel->state_mutex);
 		last_state = channel->state;
 		channel->state = CS_HANGUP;
@@ -1911,7 +2062,7 @@
 
 		switch_core_session_kill_channel(channel->session, SWITCH_SIG_KILL);
 		switch_core_session_signal_state_change(channel->session);
-		switch_core_session_hangup_state(channel->session);
+		switch_core_session_hangup_state(channel->session, SWITCH_FALSE);
 	}
 
 	return channel->state;
@@ -1923,7 +2074,8 @@
 	char *app;
 	switch_event_t *event;
 
-	if (!switch_channel_test_flag(channel, CF_RING_READY)) {
+	if (!switch_channel_test_flag(channel, CF_RING_READY) && !switch_channel_test_flag(channel, CF_EARLY_MEDIA &&
+																					   !switch_channel_test_flag(channel, CF_ANSWERED))) {
 		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_channel_get_uuid(channel), SWITCH_LOG_NOTICE, "Ring-Ready %s!\n", channel->name);
 		switch_channel_set_flag(channel, CF_RING_READY);
 		if (channel->caller_profile && channel->caller_profile->times) {
@@ -1972,7 +2124,7 @@
 	const char *var = NULL;
 	char *app;
 
-	if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA)) {
+	if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_ANSWERED)) {
 		const char *uuid;
 		switch_core_session_t *other_session;
 
@@ -1983,7 +2135,7 @@
 			switch_channel_event_set_data(channel, event);
 			switch_event_fire(&event);
 		}
-		
+
 		if (channel->caller_profile && channel->caller_profile->times) {
 			switch_mutex_lock(channel->profile_mutex);
 			channel->caller_profile->times->progress_media = switch_micro_time_now();
@@ -2002,7 +2154,7 @@
 			switch_mutex_unlock(channel->profile_mutex);
 		}
 
-		if (((var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE)) || 
+		if (((var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE)) ||
 			 (var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE))) && !zstr(var)) {
 			char *arg = NULL;
 			app = switch_core_session_strdup(channel->session, var);
@@ -2084,7 +2236,7 @@
 		msg.from = channel->name;
 		status = switch_core_session_perform_receive_message(channel->session, &msg, file, func, line);
 	}
-	
+
 	if (status == SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_channel_get_uuid(channel), SWITCH_LOG_NOTICE, "Ring Ready %s!\n", channel->name);
 	} else {
@@ -2153,23 +2305,25 @@
 	}
 
 	switch_channel_set_variable(channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ANSWER");
-	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_channel_get_uuid(channel), SWITCH_LOG_NOTICE, "Channel [%s] has been answered\n", channel->name);
+	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_channel_get_uuid(channel), SWITCH_LOG_NOTICE, "Channel [%s] has been answered\n",
+					  channel->name);
 
-	if (((var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE)) || 
-		 (!switch_channel_test_flag(channel, CF_EARLY_MEDIA) && (var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE)))) 
+	if (((var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE)) ||
+		 (!switch_channel_test_flag(channel, CF_EARLY_MEDIA) && (var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE))))
 		&& !zstr(var)) {
 		char *arg = NULL;
 
 		app = switch_core_session_strdup(channel->session, var);
-		
-		if ((arg = strchr(app, ':')) && *(arg+1) == ':') {
+
+		if ((arg = strchr(app, ':')) && *(arg + 1) == ':') {
 			switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "%s execute on answer: %s (BROADCAST)\n", channel->name, app);
 			switch_ivr_broadcast(switch_core_session_get_uuid(channel->session), app, SMF_NONE);
 		} else {
 			if ((arg = strchr(app, ' '))) {
 				*arg++ = '\0';
 			}
-			switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "%s execute on answer: %s(%s)\n", channel->name, app, switch_str_nil(arg));
+			switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "%s execute on answer: %s(%s)\n", channel->name, app,
+							  switch_str_nil(arg));
 			switch_core_session_execute_application(channel->session, app, arg);
 		}
 	}
@@ -2186,11 +2340,13 @@
 		SWITCH_STANDARD_STREAM(stream);
 		switch_api_execute(app, arg, NULL, &stream);
 
-		switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "%s api on answer: %s(%s)\n%s\n", 
-						  channel->name, app, switch_str_nil(arg), (char *)stream.data);
+		switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "%s api on answer: %s(%s)\n%s\n",
+						  channel->name, app, switch_str_nil(arg), (char *) stream.data);
 		free(stream.data);
 	}
 
+	switch_channel_presence(channel, "unknown", "answered", NULL);
+
 	switch_channel_audio_sync(channel);
 
 	return SWITCH_STATUS_SUCCESS;
@@ -2210,7 +2366,7 @@
 	if (switch_channel_test_flag(channel, CF_ANSWERED)) {
 		return SWITCH_STATUS_SUCCESS;
 	}
-	
+
 	if (!switch_channel_test_flag(channel, CF_OUTBOUND)) {
 		msg.message_id = SWITCH_MESSAGE_INDICATE_ANSWER;
 		msg.from = channel->name;
@@ -2380,7 +2536,7 @@
 						}
 
 						if (offset >= 0) {
-							if ((size_t)offset > strlen(sub_val)) {
+							if ((size_t) offset > strlen(sub_val)) {
 								*sub_val = '\0';
 							} else {
 								sub_val += offset;
@@ -2614,6 +2770,12 @@
 	return status;
 }
 
+SWITCH_DECLARE(switch_core_session_t *) switch_channel_get_session(switch_channel_t *channel)
+{
+	switch_assert(channel);
+	return channel->session;
+}
+
 SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *channel)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -2621,24 +2783,28 @@
 	switch_caller_profile_t *caller_profile, *ocp;
 	switch_app_log_t *app_log, *ap;
 	char *last_app = NULL, *last_arg = NULL;
-	char start[80] = "", answer[80] = "", progress[80] = "", progress_media[80] = "", end[80] = "", tmp[80] = "", profile_start[80] = "";
+	char start[80] = "", resurrect[80] = "", answer[80] = "", progress[80] = "", progress_media[80] = "", end[80] = "", tmp[80] = "", profile_start[80] =
+		"";
 	int32_t duration = 0, legbillsec = 0, billsec = 0, mduration = 0, billmsec = 0, legbillmsec = 0, progressmsec = 0, progress_mediamsec = 0;
 	int32_t answersec = 0, answermsec = 0;
 	switch_time_t answerusec = 0;
 	switch_time_t uduration = 0, legbillusec = 0, billusec = 0, progresssec = 0, progressusec = 0, progress_mediasec = 0, progress_mediausec = 0;
-	time_t tt_created = 0, tt_answered = 0, tt_progress = 0, tt_progress_media = 0, tt_hungup = 0, mtt_created = 0, mtt_answered = 0, mtt_hungup =
-		0, tt_prof_created, mtt_prof_created, mtt_progress = 0, mtt_progress_media = 0;
+	time_t tt_created = 0, tt_answered = 0, tt_resurrected = 0,
+		tt_progress = 0, tt_progress_media = 0, tt_hungup = 0, mtt_created = 0, mtt_answered = 0, mtt_resurrected = 0,
+		mtt_hungup = 0, tt_prof_created, mtt_prof_created, mtt_progress = 0, mtt_progress_media = 0;
 	void *pop;
-	char dtstr[SWITCH_DTMF_LOG_LEN+1] = "";
+	char dtstr[SWITCH_DTMF_LOG_LEN + 1] = "";
 	int x = 0;
 
+	switch_mutex_lock(channel->profile_mutex);
+
 	if (switch_channel_test_flag(channel, CF_TIMESTAMP_SET)) {
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	switch_channel_set_flag(channel, CF_TIMESTAMP_SET);
 
-	if (!(caller_profile = switch_channel_get_caller_profile(channel)) || !channel->variables) {
+	if (!(caller_profile = channel->caller_profile) || !channel->variables) {
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -2668,7 +2834,7 @@
 			dt = NULL;
 		}
 	}
-	
+
 	if (x) {
 		switch_channel_set_variable(channel, "digits_dialed", dtstr);
 	} else {
@@ -2694,6 +2860,12 @@
 			switch_channel_set_variable(channel, "answer_stamp", answer);
 		}
 
+		if (caller_profile->times->resurrected) {
+			switch_time_exp_lt(&tm, caller_profile->times->resurrected);
+			switch_strftime_nocheck(answer, &retsize, sizeof(resurrect), fmt, &tm);
+			switch_channel_set_variable(channel, "resurrect_stamp", resurrect);
+		}
+
 		if (caller_profile->times->progress) {
 			switch_time_exp_lt(&tm, caller_profile->times->progress);
 			switch_strftime_nocheck(progress, &retsize, sizeof(progress), fmt, &tm);
@@ -2731,6 +2903,13 @@
 		switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->answered);
 		switch_channel_set_variable(channel, "answer_uepoch", tmp);
 
+		tt_resurrected = (time_t) (caller_profile->times->resurrected / 1000000);
+		mtt_resurrected = (time_t) (caller_profile->times->resurrected / 1000);
+		switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_resurrected);
+		switch_channel_set_variable(channel, "resurrect_epoch", tmp);
+		switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->resurrected);
+		switch_channel_set_variable(channel, "resurrect_uepoch", tmp);
+
 		tt_progress = (time_t) (caller_profile->times->progress / 1000000);
 		mtt_progress = (time_t) (caller_profile->times->progress / 1000);
 		switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_progress);
@@ -2820,7 +2999,7 @@
 	switch_snprintf(tmp, sizeof(tmp), "%d", answermsec);
 	switch_channel_set_variable(channel, "answermsec", tmp);
 
-	switch_snprintf(tmp, sizeof(tmp), "%d" , progressmsec);
+	switch_snprintf(tmp, sizeof(tmp), "%d", progressmsec);
 	switch_channel_set_variable(channel, "progress_mediamsec", tmp);
 
 	switch_snprintf(tmp, sizeof(tmp), "%d", legbillmsec);
@@ -2843,7 +3022,9 @@
 
 	switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, legbillusec);
 	switch_channel_set_variable(channel, "flow_billusec", tmp);
-	
+
+	switch_mutex_unlock(channel->profile_mutex);
+
 	return status;
 }
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_config.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_config.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_config.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_console.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_console.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_console.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -33,9 +33,45 @@
 #include <switch.h>
 #include <switch_console.h>
 #include <switch_version.h>
-#define CMD_BUFLEN 1024;
+#define CMD_BUFLEN 1024
 
 #ifdef SWITCH_HAVE_LIBEDIT
+#include <histedit.h>
+
+static EditLine *el;
+static History *myhistory;
+static HistEvent ev;
+static char *hfile = NULL;
+
+#else
+
+#define CC_NORM         0
+#define CC_NEWLINE      1
+#define CC_EOF          2
+#define CC_ARGHACK      3
+#define CC_REFRESH      4
+#define CC_CURSOR       5
+#define CC_ERROR        6
+#define CC_FATAL        7
+#define CC_REDISPLAY    8
+#define CC_REFRESH_BEEP 9
+
+#ifdef _MSC_VER
+#define HISTLEN 10
+#define KEY_UP 1
+#define KEY_DOWN 2
+#define KEY_TAB 3
+#define CLEAR_OP 4
+#define DELETE_REFRESH_OP 5
+#define KEY_LEFT 6
+#define KEY_RIGHT 7
+#define KEY_INSERT 8
+#define PROMPT_OP 9
+
+static int console_bufferInput(char *buf, int len, char *cmd, int key);
+#endif
+#endif
+
 /*
  * store a strdup() of the string configured in XML
  * bound to each of the 12 function key
@@ -83,12 +119,11 @@
 
 	return SWITCH_STATUS_SUCCESS;
 }
-#endif
 
 SWITCH_DECLARE_NONSTD(switch_status_t) switch_console_stream_raw_write(switch_stream_handle_t *handle, uint8_t *data, switch_size_t datalen)
 {
 	switch_size_t need = handle->data_len + datalen;
-	
+
 	if (need >= handle->data_size) {
 		void *new_data;
 		need += handle->alloc_chunk;
@@ -104,7 +139,7 @@
 	memcpy((uint8_t *) (handle->data) + handle->data_len, data, datalen);
 	handle->data_len += datalen;
 	handle->end = (uint8_t *) (handle->data) + handle->data_len;
-	*(uint8_t *)handle->end = '\0';
+	*(uint8_t *) handle->end = '\0';
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -122,7 +157,10 @@
 	}
 
 	va_start(ap, fmt);
-	ret = switch_vasprintf(&data, fmt, ap);
+	//ret = switch_vasprintf(&data, fmt, ap);
+	if (!(data = switch_vmprintf(fmt, ap))) {
+		ret = -1;
+	}
 	va_end(ap);
 
 	if (data) {
@@ -167,12 +205,12 @@
 	char *dpath = NULL;
 	int fd;
 	switch_status_t status = SWITCH_STATUS_FALSE;
-	
+
 	if (!switch_is_file_path(path)) {
 		dpath = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, path);
 		path = dpath;
 	}
-	
+
 	if ((fd = open(path, O_RDONLY)) > -1) {
 		char buf[2048] = { 0 };
 		while (switch_fd_read_line(fd, buf, sizeof(buf))) {
@@ -181,7 +219,7 @@
 		close(fd);
 		status = SWITCH_STATUS_SUCCESS;
 	}
-	
+
 	switch_safe_free(dpath);
 	return status;
 }
@@ -193,7 +231,7 @@
 	return -1;
 }
 
-char *expand_alias(char *cmd, char *arg)
+SWITCH_DECLARE(char *) switch_console_expand_alias(char *cmd, char *arg)
 {
 	char *errmsg = NULL;
 	char *r = NULL;
@@ -205,8 +243,13 @@
 
 	switch_core_db_handle(&db);
 
-	sql = switch_mprintf("select command from aliases where alias='%q'", cmd);
 
+	if (db->type == SCDB_TYPE_CORE_DB) {
+		sql = switch_mprintf("select command from aliases where alias='%q'", cmd);
+	} else {
+		sql = switch_mprintf("select command from aliases where alias='%w'", cmd);
+	}
+
 	switch_cache_db_execute_sql_callback(db, sql, alias_callback, &r, &errmsg);
 
 	if (errmsg) {
@@ -217,7 +260,11 @@
 	switch_safe_free(sql);
 
 	if (!r) {
-		sql = switch_mprintf("select command from aliases where alias='%q %q'", cmd, arg);
+		if (db->type == SCDB_TYPE_CORE_DB) {
+			sql = switch_mprintf("select command from aliases where alias='%q %q'", cmd, arg);
+		} else {
+			sql = switch_mprintf("select command from aliases where alias='%w %w'", cmd, arg);
+		}
 
 		switch_cache_db_execute_sql_callback(db, sql, alias_callback, &r, &errmsg);
 
@@ -248,54 +295,89 @@
 	return exp;
 }
 
-static int switch_console_process(char *cmd, int rec)
+
+static int switch_console_process(char *xcmd)
 {
-	char *arg = NULL, *alias = NULL;
 	switch_stream_handle_t stream = { 0 };
+	switch_status_t status;
+	FILE *handle = switch_core_get_console();
 
-	if (!strcmp(cmd, "shutdown") || !strcmp(cmd, "...")) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Bye!\n");
-		return 0;
+	SWITCH_STANDARD_STREAM(stream);
+	switch_assert(stream.data);
+
+	status = switch_console_execute(xcmd, 0, &stream);
+
+	if (status == SWITCH_STATUS_SUCCESS) {
+		if (handle) {
+			fprintf(handle, "\n%s\n", (char *) stream.data);
+			fflush(handle);
+		}
+	} else {
+		if (handle) {
+			fprintf(handle, "Unknown Command: %s\n", xcmd);
+			fflush(handle);
+		}
 	}
-	if (!strcmp(cmd, "version")) {
-		switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, "FreeSWITCH Version %s\n", SWITCH_VERSION_FULL);
-		return 1;
+
+	switch_safe_free(stream.data);
+
+	return 1;
+
+}
+
+
+SWITCH_DECLARE(switch_status_t) switch_console_execute(char *xcmd, int rec, switch_stream_handle_t *istream)
+{
+	char *arg = NULL, *alias = NULL;
+
+	char *delim = ";;";
+	int argc;
+	char *argv[128];
+	int x;
+	char *dup = strdup(xcmd);
+	char *cmd;
+
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+
+	if (rec > 100) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Too much recursion!\n");
+		goto end;
 	}
-	if ((arg = strchr(cmd, '\r')) != 0 || (arg = strchr(cmd, '\n')) != 0) {
-		*arg = '\0';
-		arg = NULL;
-	}
-	if ((arg = strchr(cmd, ' ')) != 0) {
-		*arg++ = '\0';
-	}
 
-	if (!rec && (alias = expand_alias(cmd, arg)) && alias != cmd) {
-		int r = switch_console_process(alias, ++rec);
-		free(alias);
-		return r;
+	if (!strncasecmp(xcmd, "alias", 5)) {
+		argc = 1;
+		argv[0] = xcmd;
+	} else {
+		argc = switch_separate_string_string(dup, delim, argv, 128);
 	}
 
-	SWITCH_STANDARD_STREAM(stream);
-	if (stream.data) {
-		FILE *handle = switch_core_get_console();
+	for (x = 0; x < argc; x++) {
+		cmd = argv[x];
+		if ((arg = strchr(cmd, '\r')) != 0 || (arg = strchr(cmd, '\n')) != 0) {
+			*arg = '\0';
+			arg = NULL;
+		}
+		if ((arg = strchr(cmd, ' ')) != 0) {
+			*arg++ = '\0';
+		}
 
-		if (switch_api_execute(cmd, arg, NULL, &stream) == SWITCH_STATUS_SUCCESS) {
-			if (handle) {
-				fprintf(handle, "API CALL [%s(%s)] output:\n%s\n", cmd, arg ? arg : "", (char *) stream.data);
-				fflush(handle);
-			}
-		} else {
-			if (handle) {
-				fprintf(handle, "Unknown Command: %s\n", cmd);
-				fflush(handle);
-			}
+		if ((alias = switch_console_expand_alias(cmd, arg)) && alias != cmd) {
+			istream->write_function(istream, "\nExpand Alias [%s]->[%s]\n\n", cmd, alias);
+			status = switch_console_execute(alias, ++rec, istream);
+			free(alias);
+			continue;
 		}
-		free(stream.data);
-	} else {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Memory Error!\n");
+
+
+		status = switch_api_execute(cmd, arg, NULL, istream);
 	}
 
-	return 1;
+  end:
+
+	switch_safe_free(dup);
+
+	return status;
 }
 
 SWITCH_DECLARE(void) switch_console_printf(switch_text_channel_t channel, const char *file, const char *func, int line, const char *fmt, ...)
@@ -352,208 +434,236 @@
 static char hostname[256] = "";
 static int32_t running = 1;
 
-#ifdef SWITCH_HAVE_LIBEDIT
-#include <histedit.h>
-static char prompt_str[512] = "";
 
-/*
- * If a fnkey is configured then process the command
- */
-static unsigned char console_fnkey_pressed(int i)
+
+struct helper {
+	int len;
+	int hits;
+	int words;
+	char last[512];
+	char partial[512];
+	FILE *out;
+	switch_stream_handle_t *stream;
+	switch_xml_t xml;
+	int xml_off;
+};
+
+static int comp_callback(void *pArg, int argc, char **argv, char **columnNames)
 {
-	char *c, *cmd;
+	struct helper *h = (struct helper *) pArg;
+	char *target = NULL, *str = NULL, *cur = NULL;
+	switch_size_t x, y, i;
 
-	assert((i > 0) && (i <= 12));
 
-	c = console_fnkeys[i - 1];
+	if (argc > 0)
+		target = argv[0];
+	if (argc > 1)
+		str = argv[1];
+	if (argc > 2)
+		cur = argv[2];
 
-	/* This new line is necessary to avoid output to begin after the ">" of the CLI's prompt */
-	switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, "\n");
-
-	if (c == NULL) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "FUNCTION KEY F%d IS NOT BOUND, please edit switch.conf XML file\n", i);
-		return CC_REDISPLAY;
+	if (cur) {
+		while (*cur == ' ')
+			cur++;
 	}
 
-	cmd = strdup(c);
-	switch_console_process(cmd, 0);
-	free(cmd);
+	if (zstr(cur))
+		cur = NULL;
+	if (zstr(str))
+		str = NULL;
 
-	return CC_REDISPLAY;
-}
+	if (!target) {
+		return -1;
+	}
 
-static unsigned char console_f1key(EditLine * el, int ch)
-{
-	return console_fnkey_pressed(1);
-}
-static unsigned char console_f2key(EditLine * el, int ch)
-{
-	return console_fnkey_pressed(2);
-}
-static unsigned char console_f3key(EditLine * el, int ch)
-{
-	return console_fnkey_pressed(3);
-}
-static unsigned char console_f4key(EditLine * el, int ch)
-{
-	return console_fnkey_pressed(4);
-}
-static unsigned char console_f5key(EditLine * el, int ch)
-{
-	return console_fnkey_pressed(5);
-}
-static unsigned char console_f6key(EditLine * el, int ch)
-{
-	return console_fnkey_pressed(6);
-}
-static unsigned char console_f7key(EditLine * el, int ch)
-{
-	return console_fnkey_pressed(7);
-}
-static unsigned char console_f8key(EditLine * el, int ch)
-{
-	return console_fnkey_pressed(8);
-}
-static unsigned char console_f9key(EditLine * el, int ch)
-{
-	return console_fnkey_pressed(9);
-}
-static unsigned char console_f10key(EditLine * el, int ch)
-{
-	return console_fnkey_pressed(10);
-}
-static unsigned char console_f11key(EditLine * el, int ch)
-{
-	return console_fnkey_pressed(11);
-}
-static unsigned char console_f12key(EditLine * el, int ch)
-{
-	return console_fnkey_pressed(12);
-}
+	if (!zstr(target) && *target == ':' && *(target + 1) == ':') {
+		char *r_argv[1] = { 0 }, *r_cols[1] = {
+		0};
+		switch_console_callback_match_t *matches;
+		if (switch_console_run_complete_func(target, str, cur, &matches) == SWITCH_STATUS_SUCCESS) {
+			switch_console_callback_match_node_t *m;
+			for (m = matches->head; m; m = m->next) {
+				if (!cur || !strncmp(m->val, cur, strlen(cur))) {
+					r_argv[0] = m->val;
+					comp_callback(h, 1, r_argv, r_cols);
+				}
+			}
+			switch_console_free_matches(&matches);
+		}
+		return 0;
+	}
 
+	if (!zstr(target)) {
+		if (h->out) {
+			fprintf(h->out, "[%20s]\t", target);
+		}
+		if (h->stream) {
+			h->stream->write_function(h->stream, "[%20s]\t", target);
+		}
+		if (h->xml) {
+			switch_xml_set_txt_d(switch_xml_add_child_d(h->xml, "match", h->xml_off++), target);
+		}
 
-char *prompt(EditLine * e)
-{
-	if (*prompt_str == '\0') {
-		switch_snprintf(prompt_str, sizeof(prompt_str), "freeswitch@%s> ", hostname);
+		switch_copy_string(h->last, target, sizeof(h->last));
+		h->hits++;
 	}
 
-	return prompt_str;
-}
+	x = strlen(h->last);
+	y = strlen(h->partial);
 
-static EditLine *el;
-static History *myhistory;
-static HistEvent ev;
-static char *hfile = NULL;
-
-static void *SWITCH_THREAD_FUNC console_thread(switch_thread_t *thread, void *obj)
-{
-	int count;
-	const char *line;
-	switch_memory_pool_t *pool = (switch_memory_pool_t *) obj;
-
-	while (running) {
-		int32_t arg = 0;
-
-		if (getppid() == 1) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "We've become an orphan, no more console for us.\n");
-			break;
+	if (h->hits > 1) {
+		for (i = 0; i < x && i < y; i++) {
+			if (h->last[i] != h->partial[i]) {
+				h->partial[i] = '\0';
+				break;
+			}
 		}
-		
-		switch_core_session_ctl(SCSC_CHECK_RUNNING, &arg);
-		if (!arg) {
-			break;
-		}
+	} else if (h->hits == 1) {
+		switch_copy_string(h->partial, target, sizeof(h->last));
+	}
 
-		line = el_gets(el, &count);
-
-		if (count > 1) {
-			if (!zstr(line)) {
-				char *cmd = strdup(line);
-				char *p;
-				const LineInfo *lf = el_line(el);
-				char *foo = (char *) lf->buffer;
-				if ((p = strrchr(cmd, '\r')) || (p = strrchr(cmd, '\n'))) {
-					*p = '\0';
-				}
-				assert(cmd != NULL);
-				history(myhistory, &ev, H_ENTER, line);
-				running = switch_console_process(cmd, 0);
-				el_deletestr(el, strlen(foo) + 1);
-				memset(foo, 0, strlen(foo));
-				free(cmd);
+	if (!zstr(target)) {
+#ifdef _MSC_VER
+		if ((h->hits % 3) == 0) {
+#else
+		if ((h->hits % 4) == 0) {
+#endif
+			if (h->out) {
+				fprintf(h->out, "\n");
 			}
+			if (h->stream) {
+				h->stream->write_function(h->stream, "\n");
+			}
 		}
-		switch_cond_next();
 	}
 
-	switch_core_destroy_memory_pool(&pool);
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Editline thread exiting\n");
-	return NULL;
+	return 0;
 }
 
 
-struct helper {
-	EditLine *el;
-	int len;
-	int hits;
-	int words;
-	char last[512];
-	FILE *out;
+
+struct match_helper {
+	switch_console_callback_match_t *my_matches;
 };
 
-static int comp_callback(void *pArg, int argc, char **argv, char **columnNames)
+static int uuid_callback(void *pArg, int argc, char **argv, char **columnNames)
 {
-	struct helper *h = (struct helper *) pArg;
-	char *target = NULL;
+	struct match_helper *h = (struct match_helper *) pArg;
 
-	target = argv[0];
+	switch_console_push_match(&h->my_matches, argv[0]);
+	return 0;
 
-	if (!target) {
-		return -1;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_console_list_uuid(const char *line, const char *cursor, switch_console_callback_match_t **matches)
+{
+	char *sql;
+	struct match_helper h = { 0 };
+	switch_cache_db_handle_t *db = NULL;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+	char *errmsg;
+
+	switch_core_db_handle(&db);
+
+	if (!zstr(cursor)) {
+		sql = switch_mprintf("select distinct uuid from channels where uuid like '%q%%' and hostname='%q' order by uuid",
+							 cursor, switch_core_get_variable("hostname"));
+	} else {
+		sql = switch_mprintf("select distinct uuid from channels where hostname='%q' order by uuid", switch_core_get_variable("hostname"));
 	}
 
-	fprintf(h->out, "[%20s]\t", target);
+	switch_cache_db_execute_sql_callback(db, sql, uuid_callback, &h, &errmsg);
+	free(sql);
 
-	switch_copy_string(h->last, target, sizeof(h->last));
+	switch_cache_db_release_db_handle(&db);
 
-	if (!zstr(target)) {
-		if ((++h->hits % 4) == 0) {
-			fprintf(h->out, "\n");
-		}
+	if (h.my_matches) {
+		*matches = h.my_matches;
+		status = SWITCH_STATUS_SUCCESS;
 	}
 
-	return 0;
+
+	return status;
 }
 
-static unsigned char complete(EditLine * el, int ch)
+
+SWITCH_DECLARE(unsigned char) switch_console_complete(const char *line, const char *cursor, FILE * console_out,
+													  switch_stream_handle_t *stream, switch_xml_t xml)
 {
 	switch_cache_db_handle_t *db = NULL;
-	char *sql;
-	const LineInfo *lf = el_line(el);
-	char *dup = strdup(lf->buffer);
+	char *sql = NULL;
+	char *dup = strdup(line);
 	char *buf = dup;
 	char *p, *lp = NULL;
 	char *errmsg = NULL;
-	struct helper h = { el };
+	struct helper h = { 0 };
 	unsigned char ret = CC_REDISPLAY;
+	int pos = 0;
+	int sc = 0;
 
+#ifndef SWITCH_HAVE_LIBEDIT
+#ifndef _MSC_VER
+	if (!stream) {
+		return CC_ERROR;
+	}
+#endif
+#endif
+
 	switch_core_db_handle(&db);
 
-	h.out = switch_core_get_console();
+	if (!zstr(cursor) && !zstr(line)) {
+		pos = (cursor - line);
+	}
 
+	h.out = console_out;
+	h.stream = stream;
+	h.xml = xml;
+
+	if (pos > 0) {
+		*(buf + pos) = '\0';
+	}
+
 	if ((p = strchr(buf, '\r')) || (p = strchr(buf, '\n'))) {
 		*p = '\0';
 	}
 
 	while (*buf == ' ') {
+		sc++;
 		buf++;
 	}
 
+	if (!*buf) {
+#ifdef SWITCH_HAVE_LIBEDIT
+		if (h.out && sc) {
+			el_deletestr(el, sc);
+		}
+#endif
+	}
+
+	sc = 0;
+	p = end_of_p(buf);
+	while (p >= buf && *p == ' ') {
+		sc++;
+		p--;
+	}
+
+	if (sc > 1) {
+#ifdef SWITCH_HAVE_LIBEDIT
+		if (h.out) {
+			el_deletestr(el, sc - 1);
+		}
+#endif
+		*(p + 2) = '\0';
+	}
+
 	for (p = buf; p && *p; p++) {
 		if (*p == ' ') {
 			lp = p;
 			h.words++;
+			while (*p == ' ')
+				p++;
+			if (!*p)
+				break;
 		}
 	}
 
@@ -563,50 +673,76 @@
 
 	h.len = strlen(buf);
 
-	fprintf(h.out, "\n\n");
+	if (h.out) {
+		fprintf(h.out, "\n\n");
+	}
 
+	if (h.stream) {
+		h.stream->write_function(h.stream, "\n\n");
+	}
+
+
+
 	if (h.words == 0) {
-		sql = switch_mprintf("select distinct name from interfaces where type='api' and name like '%q%%' and hostname='%q' order by name", 
+		sql = switch_mprintf("select distinct name from interfaces where type='api' and name like '%q%%' and hostname='%q' order by name",
 							 buf, switch_core_get_variable("hostname"));
-	} else {
-		sql = switch_mprintf("select distinct uuid from channels where uuid like '%q%%' and hostname='%q' order by uuid", 
-							 buf, switch_core_get_variable("hostname"));
 	}
 
-	switch_cache_db_execute_sql_callback(db, sql, comp_callback, &h, &errmsg);
+	if (sql) {
+		switch_cache_db_execute_sql_callback(db, sql, comp_callback, &h, &errmsg);
 
-	if (errmsg) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error [%s][%s]\n", sql, errmsg);
-		free(errmsg);
-		ret = CC_ERROR;
-		goto end;
+		if (errmsg) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "error [%s][%s]\n", sql, errmsg);
+			free(errmsg);
+			ret = CC_ERROR;
+			goto end;
+		}
+		free(sql);
+		sql = NULL;
 	}
 
-	if (h.hits != 1) {
+	if (h.hits != -1) {
 		char *dupdup = strdup(dup);
-		switch_assert(dupdup);
 		int x, argc = 0;
 		char *argv[10] = { 0 };
 		switch_stream_handle_t stream = { 0 };
 		SWITCH_STANDARD_STREAM(stream);
+		switch_assert(dupdup);
 
-
 		argc = switch_separate_string(dupdup, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
 
 		if (h.words == 0) {
-			stream.write_function(&stream, "select distinct a1 from complete where " "a1 not in (select name from interfaces where hostname='%s') %s ", 
+			stream.write_function(&stream, "select distinct a1 from complete where " "a1 not in (select name from interfaces where hostname='%s') %s ",
 								  switch_core_get_variable("hostname"), argc ? "and" : "");
 		} else {
-			stream.write_function(&stream, "select distinct a%d from complete where ", h.words + 1);
-
+			if (db->type == SCDB_TYPE_CORE_DB) {
+				stream.write_function(&stream, "select distinct a%d,'%q','%q' from complete where ", h.words + 1, switch_str_nil(dup), switch_str_nil(lp));
+			} else {
+				stream.write_function(&stream, "select distinct a%d,'%q','%w' from complete where ", h.words + 1, switch_str_nil(dup), switch_str_nil(lp));
+			}
 		}
 
-		for (x = 0; x < argc; x++) {
-			stream.write_function(&stream, "(a%d = '' or a%d like '%s%%')%s", x + 1, x + 1, switch_str_nil(argv[x]), x == argc - 1 ? "" : " and ");
+		for (x = 0; x < argc && x < 11; x++) {
+			if (h.words + 1 > argc) {
+				if (db->type == SCDB_TYPE_CORE_DB) {
+					stream.write_function(&stream, "(a%d like '::%%' or a%d = '' or a%d = '%q')%q",
+										  x + 1, x + 1, x + 1, switch_str_nil(argv[x]), x == argc - 1 ? "" : " and ");
+				} else {
+					stream.write_function(&stream, "(a%d like '::%%' or a%d = '' or a%d = '%w')%w",
+										  x + 1, x + 1, x + 1, switch_str_nil(argv[x]), x == argc - 1 ? "" : " and ");
+				}
+			} else {
+				if (db->type == SCDB_TYPE_CORE_DB) {
+					stream.write_function(&stream, "(a%d like '::%%' or a%d = '' or a%d like '%q%%')%q",
+										  x + 1, x + 1, x + 1, switch_str_nil(argv[x]), x == argc - 1 ? "" : " and ");
+				} else {
+					stream.write_function(&stream, "(a%d like '::%%' or a%d = '' or a%d like '%w%%')%w",
+										  x + 1, x + 1, x + 1, switch_str_nil(argv[x]), x == argc - 1 ? "" : " and ");
+				}
+			}
 		}
 
 		stream.write_function(&stream, " and hostname='%s'", switch_core_get_variable("hostname"));
-
 		switch_cache_db_execute_sql_callback(db, stream.data, comp_callback, &h, &errmsg);
 
 		if (errmsg) {
@@ -623,16 +759,65 @@
 		}
 	}
 
-	fprintf(h.out, "\n\n");
+	if (h.out) {
+		fprintf(h.out, "\n\n");
+	}
 
-	if (h.hits == 1) {
-		el_deletestr(el, h.len);
-		el_insertstr(el, h.last);
+	if (h.stream) {
+		h.stream->write_function(h.stream, "\n\n");
+		if (h.hits == 1 && !zstr(h.last)) {
+			h.stream->write_function(h.stream, "write=%d:%s ", h.len, h.last);
+		} else if (h.hits > 1 && !zstr(h.partial)) {
+			h.stream->write_function(h.stream, "write=%d:%s", h.len, h.partial);
+		}
 	}
 
+	if (h.xml) {
+		switch_xml_t x_write = switch_xml_add_child_d(h.xml, "write", h.xml_off++);
+		char buf[32];
+
+		snprintf(buf, sizeof(buf), "%d", h.len);
+		switch_xml_set_attr_d_buf(x_write, "length", buf);
+
+		if (h.hits == 1 && !zstr(h.last)) {
+			switch_xml_set_txt_d(x_write, h.last);
+		} else if (h.hits > 1 && !zstr(h.partial)) {
+			switch_xml_set_txt_d(x_write, h.partial);
+		}
+	}
+#ifdef SWITCH_HAVE_LIBEDIT
+	if (h.out) {
+		if (h.hits == 1 && !zstr(h.last)) {
+			el_deletestr(el, h.len);
+			el_insertstr(el, h.last);
+			el_insertstr(el, " ");
+		} else if (h.hits > 1 && !zstr(h.partial)) {
+			el_deletestr(el, h.len);
+			el_insertstr(el, h.partial);
+		}
+	}
+#else
+#ifdef _MSC_VER
+	if (h.out) {
+		if (h.hits == 1 && !zstr(h.last)) {
+			console_bufferInput(0, h.len, (char *) line, DELETE_REFRESH_OP);
+			console_bufferInput(h.last, (int) strlen(h.last), (char *) line, 0);
+			console_bufferInput(" ", 1, (char *) line, 0);
+		} else if (h.hits > 1 && !zstr(h.partial)) {
+			console_bufferInput(0, h.len, (char *) line, DELETE_REFRESH_OP);
+			console_bufferInput(h.partial, (int) strlen(h.partial), (char *) line, 0);
+		} else {
+			console_bufferInput(0, 0, (char *) line, DELETE_REFRESH_OP);
+		}
+	}
+#endif
+#endif
+
   end:
 
-	fflush(h.out);
+	if (h.out) {
+		fflush(h.out);
+	}
 
 	switch_safe_free(sql);
 	switch_safe_free(dup);
@@ -643,113 +828,158 @@
 }
 
 
-SWITCH_DECLARE(switch_status_t) switch_console_set_complete(const char *string)
+
+/*
+ * If a fnkey is configured then process the command
+ */
+static unsigned char console_fnkey_pressed(int i)
 {
-	char *mydata = NULL, *argv[11] = { 0 };
-	int argc, x;
-	switch_status_t status = SWITCH_STATUS_FALSE;
+	char *c, *cmd;
 
-	if (string && (mydata = strdup(string))) {
-		if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
-			switch_cache_db_handle_t *db = NULL;
-			switch_stream_handle_t mystream = { 0 };
-			SWITCH_STANDARD_STREAM(mystream);
+	assert((i > 0) && (i <= 12));
 
-			switch_core_db_handle(&db);
-			
-			if (!strcasecmp(argv[0], "stickyadd")) {
-				mystream.write_function(&mystream, "insert into complete values (1,");
-				for (x = 0; x < 10; x++) {
-					mystream.write_function(&mystream, "'%s', ", switch_str_nil(argv[x + 1]));
-				}
-				mystream.write_function(&mystream, " '%s')", switch_core_get_variable("hostname"));
-				switch_cache_db_persistant_execute(db, mystream.data, 5);
-				status = SWITCH_STATUS_SUCCESS;
-			} else if (!strcasecmp(argv[0], "add")) {
-				mystream.write_function(&mystream, "insert into complete values (0,");
-				for (x = 0; x < 10; x++) {
-					mystream.write_function(&mystream, "'%s', ", switch_str_nil(argv[x + 1]));
-				}
-				mystream.write_function(&mystream, " '%s')", switch_core_get_variable("hostname"));
-				switch_cache_db_persistant_execute(db, mystream.data, 5);
-				status = SWITCH_STATUS_SUCCESS;
-			} else if (!strcasecmp(argv[0], "del")) {
-				char *what = argv[1];
-				if (!strcasecmp(what, "*")) {
-					switch_cache_db_persistant_execute(db, "delete from complete", 1);
-				} else {
-					mystream.write_function(&mystream, "delete from complete where ");
-					for (x = 0; x < argc - 1; x++) {
-						mystream.write_function(&mystream, "a%d = '%s'%s", x + 1, switch_str_nil(argv[x + 1]), x == argc - 2 ? "" : " and ");
-					}
-					mystream.write_function(&mystream, " and hostname='%s'", switch_core_get_variable("hostname"));
-					switch_cache_db_persistant_execute(db, mystream.data, 1);
-				}
-				status = SWITCH_STATUS_SUCCESS;
-			}
-			switch_safe_free(mystream.data);
-			switch_cache_db_release_db_handle(&db);
-		}
+	c = console_fnkeys[i - 1];
+
+	/* This new line is necessary to avoid output to begin after the ">" of the CLI's prompt */
+	switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, "\n");
+
+	if (c == NULL) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "FUNCTION KEY F%d IS NOT BOUND, please edit switch.conf XML file\n", i);
+		return CC_REDISPLAY;
 	}
 
-	switch_safe_free(mydata);
+	cmd = strdup(c);
+	switch_console_process(cmd);
+	free(cmd);
 
-	return status;
+	return CC_REDISPLAY;
+}
 
+SWITCH_DECLARE(void) switch_console_save_history(void)
+{
+#ifdef SWITCH_HAVE_LIBEDIT
+	history(myhistory, &ev, H_SAVE, hfile);
+#else
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "NOT IMPLEMENTED!\n");
+#endif
 }
 
+#ifdef SWITCH_HAVE_LIBEDIT
+static char prompt_str[512] = "";
 
-SWITCH_DECLARE(switch_status_t) switch_console_set_alias(const char *string)
+static unsigned char console_f1key(EditLine * el, int ch)
 {
-	char *mydata = NULL, *argv[3] = { 0 };
-	int argc;
-	switch_status_t status = SWITCH_STATUS_FALSE;
+	return console_fnkey_pressed(1);
+}
+static unsigned char console_f2key(EditLine * el, int ch)
+{
+	return console_fnkey_pressed(2);
+}
+static unsigned char console_f3key(EditLine * el, int ch)
+{
+	return console_fnkey_pressed(3);
+}
+static unsigned char console_f4key(EditLine * el, int ch)
+{
+	return console_fnkey_pressed(4);
+}
+static unsigned char console_f5key(EditLine * el, int ch)
+{
+	return console_fnkey_pressed(5);
+}
+static unsigned char console_f6key(EditLine * el, int ch)
+{
+	return console_fnkey_pressed(6);
+}
+static unsigned char console_f7key(EditLine * el, int ch)
+{
+	return console_fnkey_pressed(7);
+}
+static unsigned char console_f8key(EditLine * el, int ch)
+{
+	return console_fnkey_pressed(8);
+}
+static unsigned char console_f9key(EditLine * el, int ch)
+{
+	return console_fnkey_pressed(9);
+}
+static unsigned char console_f10key(EditLine * el, int ch)
+{
+	return console_fnkey_pressed(10);
+}
+static unsigned char console_f11key(EditLine * el, int ch)
+{
+	return console_fnkey_pressed(11);
+}
+static unsigned char console_f12key(EditLine * el, int ch)
+{
+	return console_fnkey_pressed(12);
+}
 
-	if (string && (mydata = strdup(string))) {
-		if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 2) {
-			switch_cache_db_handle_t *db = NULL;
-			char *sql = NULL;
 
-			switch_core_db_handle(&db);
+char *prompt(EditLine * e)
+{
+	if (*prompt_str == '\0') {
+		switch_snprintf(prompt_str, sizeof(prompt_str), "freeswitch@%s> ", hostname);
+	}
 
-			if (!strcasecmp(argv[0], "stickyadd") && argc == 3) {
-				sql = switch_mprintf("delete from aliases where alias='%q' and hostname='%q'", argv[1], switch_core_get_variable("hostname"));
-				switch_cache_db_persistant_execute(db, sql, 5);
-				switch_safe_free(sql);
-				sql = switch_mprintf("insert into aliases (sticky, alias, command, hostname) values (1, '%q','%q','%q')", 
-									 argv[1], argv[2], switch_core_get_variable("hostname"));
-				switch_cache_db_persistant_execute(db, sql, 5);
-				status = SWITCH_STATUS_SUCCESS;
-			} else if (!strcasecmp(argv[0], "add") && argc == 3) {
-				sql = switch_mprintf("delete from aliases where alias='%q' and hostname='%q'", argv[1], switch_core_get_variable("hostname"));
-				switch_cache_db_persistant_execute(db, sql, 5);
-				switch_safe_free(sql);
-				sql = switch_mprintf("insert into aliases (sticky, alias, command, hostname) values (0, '%q','%q')", 
-									 argv[1], argv[2], switch_core_get_variable("hostname"));
-				switch_cache_db_persistant_execute(db, sql, 5);
-				status = SWITCH_STATUS_SUCCESS;
-			} else if (!strcasecmp(argv[0], "del") && argc == 2) {
-				char *what = argv[1];
-				if (!strcasecmp(what, "*")) {
-					sql = switch_mprintf("delete from aliases where hostname='%q'", switch_core_get_variable("hostname"));
-					switch_cache_db_persistant_execute(db, sql, 1);
-				} else {
-					sql = switch_mprintf("delete from aliases where alias='%q' and hostname='%q'", argv[1], switch_core_get_variable("hostname"));
-					switch_cache_db_persistant_execute(db, sql, 5);
+	return prompt_str;
+}
+
+static void *SWITCH_THREAD_FUNC console_thread(switch_thread_t *thread, void *obj)
+{
+	int count;
+	const char *line;
+	switch_memory_pool_t *pool = (switch_memory_pool_t *) obj;
+
+	while (running) {
+		int32_t arg = 0;
+
+		if (getppid() == 1) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "We've become an orphan, no more console for us.\n");
+			break;
+		}
+
+		switch_core_session_ctl(SCSC_CHECK_RUNNING, &arg);
+		if (!arg) {
+			break;
+		}
+
+		line = el_gets(el, &count);
+
+		if (count > 1) {
+			if (!zstr(line)) {
+				char *cmd = strdup(line);
+				char *p;
+				const LineInfo *lf = el_line(el);
+				char *foo = (char *) lf->buffer;
+				if ((p = strrchr(cmd, '\r')) || (p = strrchr(cmd, '\n'))) {
+					*p = '\0';
 				}
-				status = SWITCH_STATUS_SUCCESS;
+				assert(cmd != NULL);
+				history(myhistory, &ev, H_ENTER, line);
+				running = switch_console_process(cmd);
+				el_deletestr(el, strlen(foo) + 1);
+				memset(foo, 0, strlen(foo));
+				free(cmd);
 			}
-			switch_safe_free(sql);
-			switch_cache_db_release_db_handle(&db);
 		}
+		switch_cond_next();
 	}
 
-	switch_safe_free(mydata);
+	switch_core_destroy_memory_pool(&pool);
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Editline thread exiting\n");
+	return NULL;
+}
 
-	return status;
+static unsigned char complete(EditLine * el, int ch)
+{
+	const LineInfo *lf = el_line(el);
 
+	return switch_console_complete(lf->buffer, lf->cursor, switch_core_get_console(), NULL, NULL);
 }
 
+
 SWITCH_DECLARE(void) switch_console_loop(void)
 {
 	switch_thread_t *thread;
@@ -847,29 +1077,368 @@
 }
 
 #else
-SWITCH_DECLARE(switch_status_t) switch_console_set_alias(const char *string)
+
+#ifdef _MSC_VER
+char history[HISTLEN][CMD_BUFLEN + 1];
+int iHistory = 0;
+int iHistorySel = 0;
+
+static int console_history(char *cmd, int direction)
 {
-	return SWITCH_STATUS_FALSE;
+	int i;
+	static int first;
+
+	if (direction == 0) {
+		first = 1;
+		if (iHistory < HISTLEN) {
+			if (iHistory && strcmp(history[iHistory - 1], cmd)) {
+				iHistorySel = iHistory;
+				strcpy(history[iHistory++], cmd);
+			} else if (iHistory == 0) {
+				iHistorySel = iHistory;
+				strcpy(history[iHistory++], cmd);
+			}
+		} else {
+			iHistory = HISTLEN - 1;
+			for (i = 0; i < HISTLEN - 1; i++) {
+				strcpy(history[i], history[i + 1]);
+			}
+			iHistorySel = iHistory;
+			strcpy(history[iHistory++], cmd);
+		}
+	} else {
+		if (!first) {
+			iHistorySel += direction;
+		}
+		first = 0;
+		if (iHistorySel < 0) {
+			iHistorySel = 0;
+		}
+		if (iHistory && iHistorySel >= iHistory) {
+			iHistorySel = iHistory - 1;
+		}
+		strcpy(cmd, history[iHistorySel]);
+	}
+	return (SWITCH_STATUS_SUCCESS);
 }
 
-SWITCH_DECLARE(switch_status_t) switch_console_set_complete(const char *string)
+static int console_bufferInput(char *addchars, int len, char *cmd, int key)
 {
-	return SWITCH_STATUS_FALSE;
+	static int iCmdBuffer = 0;
+	static int iCmdCursor = 0;
+	static int ignoreNext = 0;
+	static int insertMode = 1;
+	static COORD orgPosition;
+	static char prompt[80];
+	int iBuf;
+	int i;
+
+	HANDLE hOut;
+	CONSOLE_SCREEN_BUFFER_INFO info;
+	COORD position;
+	hOut = GetStdHandle(STD_OUTPUT_HANDLE);
+	GetConsoleScreenBufferInfo(hOut, &info);
+	position = info.dwCursorPosition;
+	if (iCmdCursor == 0) {
+		orgPosition = position;
+	}
+
+	if (key == PROMPT_OP) {
+		if (strlen(cmd) < sizeof(prompt)) {
+			strcpy(prompt, cmd);
+		}
+		return 0;
+	}
+
+	if (key == KEY_TAB) {
+		switch_console_complete(cmd, cmd + iCmdBuffer, switch_core_get_console(), NULL, NULL);
+		return 0;
+	}
+	if (key == KEY_UP || key == KEY_DOWN || key == CLEAR_OP) {
+		SetConsoleCursorPosition(hOut, orgPosition);
+		for (i = 0; i < (int) strlen(cmd); i++) {
+			printf(" ");
+		}
+		SetConsoleCursorPosition(hOut, orgPosition);
+		iCmdBuffer = 0;
+		iCmdCursor = 0;
+		memset(cmd, 0, CMD_BUFLEN);
+	}
+	if (key == DELETE_REFRESH_OP) {
+		int l = len < (int) strlen(cmd) ? len : (int) strlen(cmd);
+		for (i = 0; i < l; i++) {
+			cmd[--iCmdBuffer] = 0;
+		}
+		iCmdCursor = (int) strlen(cmd);
+		printf("%s", prompt);
+		GetConsoleScreenBufferInfo(hOut, &info);
+		orgPosition = info.dwCursorPosition;
+		printf("%s", cmd);
+		return 0;
+	}
+
+	if (key == KEY_LEFT) {
+		if (iCmdCursor) {
+			if (position.X == 0) {
+				position.Y -= 1;
+				position.X = info.dwSize.X - 1;
+			} else {
+				position.X -= 1;
+			}
+
+			SetConsoleCursorPosition(hOut, position);
+			iCmdCursor--;
+		}
+	}
+	if (key == KEY_RIGHT) {
+		if (iCmdCursor < (int) strlen(cmd)) {
+			if (position.X == info.dwSize.X - 1) {
+				position.Y += 1;
+				position.X = 0;
+			} else {
+				position.X += 1;
+			}
+
+			SetConsoleCursorPosition(hOut, position);
+			iCmdCursor++;
+		}
+	}
+	if (key == KEY_INSERT) {
+		insertMode = !insertMode;
+	}
+	for (iBuf = 0; iBuf < len; iBuf++) {
+		switch (addchars[iBuf]) {
+		case '\r':
+		case '\n':
+			if (ignoreNext) {
+				ignoreNext = 0;
+			} else {
+				int ret = iCmdBuffer;
+				if (iCmdBuffer == 0) {
+					strcpy(cmd, "Empty");
+					ret = (int) strlen(cmd);
+				} else {
+					console_history(cmd, 0);
+					cmd[iCmdBuffer] = 0;
+				}
+				iCmdBuffer = 0;
+				iCmdCursor = 0;
+				printf("\n");
+				return (ret);
+			}
+			break;
+		case '\b':
+			if (iCmdCursor) {
+				if (position.X == 0) {
+					position.Y -= 1;
+					position.X = info.dwSize.X - 1;
+					SetConsoleCursorPosition(hOut, position);
+				} else {
+					position.X -= 1;
+					SetConsoleCursorPosition(hOut, position);
+				}
+				printf(" ");
+				if (iCmdCursor < iCmdBuffer) {
+					int pos;
+					iCmdCursor--;
+					for (pos = iCmdCursor; pos < iCmdBuffer; pos++) {
+						cmd[pos] = cmd[pos + 1];
+					}
+					cmd[pos] = 0;
+					iCmdBuffer--;
+
+					SetConsoleCursorPosition(hOut, position);
+					for (pos = iCmdCursor; pos < iCmdBuffer; pos++) {
+						printf("%c", cmd[pos]);
+					}
+					printf(" ");
+					SetConsoleCursorPosition(hOut, position);
+				} else {
+					SetConsoleCursorPosition(hOut, position);
+					iCmdBuffer--;
+					iCmdCursor--;
+					cmd[iCmdBuffer] = 0;
+				}
+			}
+			break;
+		default:
+			if (!ignoreNext) {
+				if (iCmdCursor < iCmdBuffer) {
+					int pos;
+
+					if (position.X == info.dwSize.X - 1) {
+						position.Y += 1;
+						position.X = 0;
+					} else {
+						position.X += 1;
+					}
+
+					if (insertMode) {
+						for (pos = iCmdBuffer - 1; pos >= iCmdCursor; pos--) {
+							cmd[pos + 1] = cmd[pos];
+						}
+					}
+					iCmdBuffer++;
+					cmd[iCmdCursor++] = addchars[iBuf];
+					printf("%c", addchars[iBuf]);
+					for (pos = iCmdCursor; pos < iCmdBuffer; pos++) {
+						GetConsoleScreenBufferInfo(hOut, &info);
+						if (info.dwCursorPosition.X == info.dwSize.X - 1 && info.dwCursorPosition.Y == info.dwSize.Y - 1) {
+							orgPosition.Y -= 1;
+							position.Y -= 1;
+						}
+						printf("%c", cmd[pos]);
+					}
+					SetConsoleCursorPosition(hOut, position);
+				} else {
+					if (position.X == info.dwSize.X - 1 && position.Y == info.dwSize.Y - 1) {
+						orgPosition.Y -= 1;
+					}
+					cmd[iCmdBuffer++] = addchars[iBuf];
+					iCmdCursor++;
+					printf("%c", addchars[iBuf]);
+				}
+			}
+		}
+		if (iCmdBuffer == CMD_BUFLEN) {
+			printf("Read Console... BUFFER OVERRUN\n");
+			iCmdBuffer = 0;
+			ignoreNext = 1;
+		}
+	}
+	return (SWITCH_STATUS_SUCCESS);
 }
 
+
+static BOOL console_readConsole(HANDLE conIn, char *buf, int len, int *pRed, int *key)
+{
+	DWORD recordIndex, bufferIndex, toRead, red;
+	PINPUT_RECORD pInput;
+
+	GetNumberOfConsoleInputEvents(conIn, &toRead);
+	if (len < (int) toRead) {
+		toRead = len;
+	}
+	if (toRead == 0) {
+		return (FALSE);
+	}
+
+	if ((pInput = (PINPUT_RECORD) malloc(toRead * sizeof(INPUT_RECORD))) == NULL) {
+		return (FALSE);
+	}
+	*key = 0;
+	ReadConsoleInput(conIn, pInput, toRead, &red);
+
+	for (recordIndex = bufferIndex = 0; recordIndex < red; recordIndex++) {
+		KEY_EVENT_RECORD keyEvent = pInput[recordIndex].Event.KeyEvent;
+		if (pInput[recordIndex].EventType == KEY_EVENT && keyEvent.bKeyDown) {
+			if (keyEvent.wVirtualKeyCode == 38 && keyEvent.wVirtualScanCode == 72) {
+				buf[0] = 0;
+				console_history(buf, -1);
+				*key = KEY_UP;
+				bufferIndex += (DWORD) strlen(buf);
+			}
+			if (keyEvent.wVirtualKeyCode == 40 && keyEvent.wVirtualScanCode == 80) {
+				buf[0] = 0;
+				console_history(buf, 1);
+				*key = KEY_DOWN;
+				bufferIndex += (DWORD) strlen(buf);
+			}
+			if (keyEvent.wVirtualKeyCode == 112 && keyEvent.wVirtualScanCode == 59) {
+				console_fnkey_pressed(1);
+			}
+			if (keyEvent.wVirtualKeyCode == 113 && keyEvent.wVirtualScanCode == 60) {
+				console_fnkey_pressed(2);
+			}
+			if (keyEvent.wVirtualKeyCode == 114 && keyEvent.wVirtualScanCode == 61) {
+				console_fnkey_pressed(3);
+			}
+			if (keyEvent.wVirtualKeyCode == 115 && keyEvent.wVirtualScanCode == 62) {
+				console_fnkey_pressed(4);
+			}
+			if (keyEvent.wVirtualKeyCode == 116 && keyEvent.wVirtualScanCode == 63) {
+				console_fnkey_pressed(5);
+			}
+			if (keyEvent.wVirtualKeyCode == 117 && keyEvent.wVirtualScanCode == 64) {
+				console_fnkey_pressed(6);
+			}
+			if (keyEvent.wVirtualKeyCode == 118 && keyEvent.wVirtualScanCode == 65) {
+				console_fnkey_pressed(7);
+			}
+			if (keyEvent.wVirtualKeyCode == 119 && keyEvent.wVirtualScanCode == 66) {
+				console_fnkey_pressed(8);
+			}
+			if (keyEvent.wVirtualKeyCode == 120 && keyEvent.wVirtualScanCode == 67) {
+				console_fnkey_pressed(9);
+			}
+			if (keyEvent.wVirtualKeyCode == 121 && keyEvent.wVirtualScanCode == 68) {
+				console_fnkey_pressed(10);
+			}
+			if (keyEvent.wVirtualKeyCode == 122 && keyEvent.wVirtualScanCode == 87) {
+				console_fnkey_pressed(11);
+			}
+			if (keyEvent.wVirtualKeyCode == 123 && keyEvent.wVirtualScanCode == 88) {
+				console_fnkey_pressed(12);
+			}
+			if (keyEvent.uChar.AsciiChar == 9) {
+				*key = KEY_TAB;
+				break;
+			}
+			if (keyEvent.uChar.AsciiChar == 27) {
+				*key = CLEAR_OP;
+				break;
+			}
+			if (keyEvent.wVirtualKeyCode == 37 && keyEvent.wVirtualScanCode == 75) {
+				*key = KEY_LEFT;
+			}
+			if (keyEvent.wVirtualKeyCode == 39 && keyEvent.wVirtualScanCode == 77) {
+				*key = KEY_RIGHT;
+			}
+			if (keyEvent.wVirtualKeyCode == 45 && keyEvent.wVirtualScanCode == 82) {
+				*key = KEY_INSERT;
+			}
+			while (keyEvent.wRepeatCount && keyEvent.uChar.AsciiChar) {
+				buf[bufferIndex] = keyEvent.uChar.AsciiChar;
+				if (buf[bufferIndex] == '\r') {
+					buf[bufferIndex] = '\n';
+				}
+				bufferIndex++;
+				keyEvent.wRepeatCount--;
+			}
+		}
+	}
+
+	free(pInput);
+	*pRed = bufferIndex;
+	return (TRUE);
+}
+#endif
+
+
 SWITCH_DECLARE(void) switch_console_loop(void)
 {
+	char cmd[CMD_BUFLEN + 1] = "";
+	int32_t activity = 1;
+#ifndef _MSC_VER
+	int x = 0;
+#else
+	char keys[80];
+#endif
 
-	char cmd[2048] = "";
-	int32_t activity = 1;	
+	/* Load/Init the config first */
+	console_xml_config();
 	gethostname(hostname, sizeof(hostname));
+#ifdef _MSC_VER
+	sprintf(cmd, "\nfreeswitch@%s> ", hostname);
+	console_bufferInput(0, 0, cmd, PROMPT_OP);
+	memset(cmd, 0, sizeof(cmd));
+#endif
 
 	while (running) {
 		int32_t arg;
 #ifdef _MSC_VER
-		DWORD read, i;
+		int read, key;
 		HANDLE stdinHandle = GetStdHandle(STD_INPUT_HANDLE);
-		INPUT_RECORD in[128];
 #else
 		fd_set rfds, efds;
 		struct timeval tv = { 0, 20000 };
@@ -885,29 +1454,17 @@
 		}
 #ifdef _MSC_VER
 		activity = 0;
-		PeekConsoleInput(stdinHandle, in, 128, &read);
-		for (i = 0; i < read; i++) {
-			if (in[i].EventType == KEY_EVENT && !in[i].Event.KeyEvent.bKeyDown) {
+		if (console_readConsole(stdinHandle, keys, (int) sizeof(keys), &read, &key)) {
+			if (console_bufferInput(keys, read, cmd, key)) {
+				if (!strcmp(cmd, "Empty")) {
+					cmd[0] = '\n';
+					cmd[1] = 0;
+				}
 				activity = 1;
-				break;
+				running = switch_console_process(cmd);
+				memset(cmd, 0, sizeof(cmd));
 			}
 		}
-
-		if (activity) {
-			DWORD bytes = 0;
-			char *end;
-			ReadConsole(stdinHandle, cmd, sizeof(cmd), &bytes, NULL);
-			FlushConsoleInputBuffer(stdinHandle);
-			end = end_of_p(cmd);
-			while(*end == '\r' || *end == '\n') {
-				*end-- = '\0';	
-			}
-		}
-
-		if (cmd[0]) {
-			running = switch_console_process(cmd, 0);
-			memset(cmd, 0, sizeof(cmd));
-		}
 		Sleep(20);
 #else
 		FD_ZERO(&rfds);
@@ -921,7 +1478,7 @@
 		if (FD_ISSET(fileno(stdin), &efds)) {
 			continue;
 		}
-		
+
 		if (!FD_ISSET(fileno(stdin), &rfds)) {
 			activity = 0;
 		}
@@ -949,13 +1506,318 @@
 		}
 
 		if (cmd[0]) {
-			running = switch_console_process(cmd, 0);
+			running = switch_console_process(cmd);
 		}
 #endif
 	}
 }
+
+
+
 #endif
 
+
+static struct {
+	switch_hash_t *func_hash;
+	switch_mutex_t *func_mutex;
+} globals;
+
+SWITCH_DECLARE(switch_status_t) switch_console_init(switch_memory_pool_t *pool)
+{
+	switch_mutex_init(&globals.func_mutex, SWITCH_MUTEX_NESTED, pool);
+	switch_core_hash_init(&globals.func_hash, pool);
+	switch_console_add_complete_func("::console::list_uuid", (switch_console_complete_callback_t) switch_console_list_uuid);
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_console_shutdown(void)
+{
+	return switch_core_hash_destroy(&globals.func_hash);
+}
+
+SWITCH_DECLARE(switch_status_t) switch_console_add_complete_func(const char *name, switch_console_complete_callback_t cb)
+{
+	switch_status_t status;
+
+	switch_mutex_lock(globals.func_mutex);
+	status = switch_core_hash_insert(globals.func_hash, name, (void *) (intptr_t) cb);
+	switch_mutex_unlock(globals.func_mutex);
+
+	return status;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_console_del_complete_func(const char *name)
+{
+	switch_status_t status;
+
+	switch_mutex_lock(globals.func_mutex);
+	status = switch_core_hash_insert(globals.func_hash, name, NULL);
+	switch_mutex_unlock(globals.func_mutex);
+
+	return status;
+}
+
+SWITCH_DECLARE(void) switch_console_free_matches(switch_console_callback_match_t **matches)
+{
+	switch_console_callback_match_t *my_match = *matches;
+	switch_console_callback_match_node_t *m, *cur;
+
+	/* Don't play with matches */
+	*matches = NULL;
+
+	m = my_match->head;
+	while (m) {
+		cur = m;
+		m = m->next;
+		free(cur->val);
+		free(cur);
+	}
+
+	if (my_match->dynamic) {
+		free(my_match);
+	}
+}
+
+SWITCH_DECLARE(void) switch_console_sort_matches(switch_console_callback_match_t *matches)
+{
+	switch_console_callback_match_node_t *p = NULL, *sort[4] = { 0 };
+	int i, j;
+
+	switch_assert(matches);
+
+	if (matches->count < 2) {
+		return;
+	}
+
+	for (i = 1; i < matches->count; i++) {
+		sort[0] = NULL;
+		sort[1] = matches->head;
+		sort[2] = sort[1] ? sort[1]->next : NULL;
+		sort[3] = sort[2] ? sort[2]->next : NULL;
+
+		for (j = 1; j <= (matches->count - i); j++) {
+			if (strcmp(sort[1]->val, sort[2]->val) > 0) {
+				sort[1]->next = sort[3];
+				sort[2]->next = sort[1];
+
+				if (sort[0])
+					sort[0]->next = sort[2];
+				if (sort[1] == matches->head)
+					matches->head = sort[2];
+
+
+
+
+				sort[0] = sort[2];
+				sort[2] = sort[1]->next;
+				if (sort[3] && sort[3]->next)
+					sort[3] = sort[3]->next;
+
+			} else {
+				sort[0] = sort[1];
+				sort[1] = sort[2];
+				sort[2] = sort[3];
+				if (sort[3] && sort[3]->next)
+					sort[3] = sort[3]->next;
+			}
+
+		}
+	}
+
+	p = matches->head;
+
+	for (i = 1; i < matches->count; i++)
+		p = p->next;
+
+	if (p) {
+		p->next = NULL;
+		matches->end = p;
+	}
+}
+
+SWITCH_DECLARE(void) switch_console_push_match(switch_console_callback_match_t **matches, const char *new_val)
+{
+	switch_console_callback_match_node_t *match;
+
+	if (!*matches) {
+		switch_zmalloc(*matches, sizeof(**matches));
+		(*matches)->dynamic = 1;
+	}
+
+	switch_zmalloc(match, sizeof(*match));
+	match->val = strdup(new_val);
+
+	if ((*matches)->head) {
+		(*matches)->end->next = match;
+	} else {
+		(*matches)->head = match;
+	}
+
+	(*matches)->count++;
+
+	(*matches)->end = match;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_console_run_complete_func(const char *func, const char *line, const char *last_word,
+																 switch_console_callback_match_t **matches)
+{
+	switch_console_complete_callback_t cb;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	switch_mutex_lock(globals.func_mutex);
+	if ((cb = (switch_console_complete_callback_t) (intptr_t) switch_core_hash_find(globals.func_hash, func))) {
+		if ((status = cb(line, last_word, matches)) == SWITCH_STATUS_SUCCESS) {
+			switch_console_sort_matches(*matches);
+		}
+	}
+	switch_mutex_unlock(globals.func_mutex);
+
+	return status;
+}
+
+
+SWITCH_DECLARE(switch_status_t) switch_console_set_complete(const char *string)
+{
+	char *mydata = NULL, *argv[11] = { 0 };
+	int argc, x;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	if (string && (mydata = strdup(string))) {
+		if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+			switch_cache_db_handle_t *db = NULL;
+			switch_stream_handle_t mystream = { 0 };
+			SWITCH_STANDARD_STREAM(mystream);
+
+			switch_core_db_handle(&db);
+
+			if (!strcasecmp(argv[0], "stickyadd")) {
+				mystream.write_function(&mystream, "insert into complete values (1,");
+				for (x = 0; x < 10; x++) {
+					if (argv[x + 1] && !strcasecmp(argv[x + 1], "_any_")) {
+						mystream.write_function(&mystream, "%s", "'', ");
+					} else {
+						if (db->type == SCDB_TYPE_CORE_DB) {
+							mystream.write_function(&mystream, "'%q', ", switch_str_nil(argv[x + 1]));
+						} else {
+							mystream.write_function(&mystream, "'%w', ", switch_str_nil(argv[x + 1]));
+						}
+					}
+				}
+				mystream.write_function(&mystream, " '%s')", switch_core_get_variable("hostname"));
+				switch_cache_db_persistant_execute(db, mystream.data, 5);
+				status = SWITCH_STATUS_SUCCESS;
+			} else if (!strcasecmp(argv[0], "add")) {
+				mystream.write_function(&mystream, "insert into complete values (0,");
+				for (x = 0; x < 10; x++) {
+					if (argv[x + 1] && !strcasecmp(argv[x + 1], "_any_")) {
+						mystream.write_function(&mystream, "%s", "'', ");
+					} else {
+						if (db->type == SCDB_TYPE_CORE_DB) {
+							mystream.write_function(&mystream, "'%q', ", switch_str_nil(argv[x + 1]));
+						} else {
+							mystream.write_function(&mystream, "'%w', ", switch_str_nil(argv[x + 1]));
+						}
+					}
+				}
+				mystream.write_function(&mystream, " '%s')", switch_core_get_variable("hostname"));
+
+				switch_cache_db_persistant_execute(db, mystream.data, 5);
+				status = SWITCH_STATUS_SUCCESS;
+			} else if (!strcasecmp(argv[0], "del")) {
+				char *what = argv[1];
+				if (!strcasecmp(what, "*")) {
+					switch_cache_db_persistant_execute(db, "delete from complete", 1);
+				} else {
+					mystream.write_function(&mystream, "delete from complete where ");
+					for (x = 0; x < argc - 1; x++) {
+						if (db->type == SCDB_TYPE_CORE_DB) {
+							mystream.write_function(&mystream, "a%d = '%q'%q", x + 1, switch_str_nil(argv[x + 1]), x == argc - 2 ? "" : " and ");
+						} else {
+							mystream.write_function(&mystream, "a%d = '%w'%w", x + 1, switch_str_nil(argv[x + 1]), x == argc - 2 ? "" : " and ");
+						}
+					}
+					mystream.write_function(&mystream, " and hostname='%s'", switch_core_get_variable("hostname"));
+					switch_cache_db_persistant_execute(db, mystream.data, 1);
+				}
+				status = SWITCH_STATUS_SUCCESS;
+			}
+
+			switch_safe_free(mystream.data);
+			switch_cache_db_release_db_handle(&db);
+		}
+	}
+
+	switch_safe_free(mydata);
+
+	return status;
+
+}
+
+
+SWITCH_DECLARE(switch_status_t) switch_console_set_alias(const char *string)
+{
+	char *mydata = NULL, *argv[3] = { 0 };
+	int argc;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	if (string && (mydata = strdup(string))) {
+		if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 2) {
+			switch_cache_db_handle_t *db = NULL;
+			char *sql = NULL;
+
+			switch_core_db_handle(&db);
+
+			if (!strcasecmp(argv[0], "stickyadd") && argc == 3) {
+				sql = switch_mprintf("delete from aliases where alias='%q' and hostname='%q'", argv[1], switch_core_get_variable("hostname"));
+				switch_cache_db_persistant_execute(db, sql, 5);
+				switch_safe_free(sql);
+				if (db->type == SCDB_TYPE_CORE_DB) {
+					sql = switch_mprintf("insert into aliases (sticky, alias, command, hostname) values (1, '%q','%q','%q')",
+										 argv[1], argv[2], switch_core_get_variable("hostname"));
+				} else {
+					sql = switch_mprintf("insert into aliases (sticky, alias, command, hostname) values (1, '%w','%w','%w')",
+										 argv[1], argv[2], switch_core_get_variable("hostname"));
+				}
+				switch_cache_db_persistant_execute(db, sql, 5);
+				status = SWITCH_STATUS_SUCCESS;
+			} else if (!strcasecmp(argv[0], "add") && argc == 3) {
+				sql = switch_mprintf("delete from aliases where alias='%q' and hostname='%q'", argv[1], switch_core_get_variable("hostname"));
+				switch_cache_db_persistant_execute(db, sql, 5);
+				switch_safe_free(sql);
+				if (db->type == SCDB_TYPE_CORE_DB) {
+					sql = switch_mprintf("insert into aliases (sticky, alias, command, hostname) values (0, '%q','%q','%q')",
+										 argv[1], argv[2], switch_core_get_variable("hostname"));
+				} else {
+					sql = switch_mprintf("insert into aliases (sticky, alias, command, hostname) values (0, '%w','%w','%w')",
+										 argv[1], argv[2], switch_core_get_variable("hostname"));
+				}
+				switch_cache_db_persistant_execute(db, sql, 5);
+				status = SWITCH_STATUS_SUCCESS;
+			} else if (!strcasecmp(argv[0], "del") && argc == 2) {
+				char *what = argv[1];
+				if (!strcasecmp(what, "*")) {
+					sql = switch_mprintf("delete from aliases where hostname='%q'", switch_core_get_variable("hostname"));
+					switch_cache_db_persistant_execute(db, sql, 1);
+				} else {
+					sql = switch_mprintf("delete from aliases where alias='%q' and hostname='%q'", argv[1], switch_core_get_variable("hostname"));
+					switch_cache_db_persistant_execute(db, sql, 5);
+				}
+				status = SWITCH_STATUS_SUCCESS;
+			}
+			switch_safe_free(sql);
+			switch_cache_db_release_db_handle(&db);
+		}
+	}
+
+	switch_safe_free(mydata);
+
+	return status;
+
+}
+
+
+
+
 /* For Emacs:
  * Local Variables:
  * mode:c

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -52,7 +52,7 @@
 SWITCH_DECLARE_DATA switch_directories SWITCH_GLOBAL_dirs = { 0 };
 
 /* The main runtime obj we keep this hidden for ourselves */
-struct switch_runtime runtime;
+struct switch_runtime runtime = { 0 };
 static void switch_load_core_config(const char *file);
 
 static void send_heartbeat(void)
@@ -89,7 +89,8 @@
 static char main_ip4[256] = "";
 static char main_ip6[256] = "";
 
-static void check_ip(void) {
+static void check_ip(void)
+{
 	char guess_ip4[256] = "";
 	char guess_ip6[256] = "";
 	char old_ip4[256] = "";
@@ -127,7 +128,7 @@
 			switch_core_set_variable("local_ip_v6", guess_ip6);
 		}
 	}
-	
+
 	if (!ok4 || !ok6) {
 		switch_event_t *event;
 
@@ -191,8 +192,8 @@
 SWITCH_DECLARE(void) switch_core_remove_state_handler(const switch_state_handler_table_t *state_handler)
 {
 	int index, tmp_index = 0;
-	const switch_state_handler_table_t *tmp[SWITCH_MAX_STATE_HANDLERS+1] = { 0 };
-	
+	const switch_state_handler_table_t *tmp[SWITCH_MAX_STATE_HANDLERS + 1] = { 0 };
+
 	switch_mutex_lock(runtime.global_mutex);
 
 	for (index = 0; index < runtime.state_handler_index; index++) {
@@ -268,8 +269,8 @@
 static void switch_core_unset_variables(void)
 {
 	switch_hash_index_t *hi;
-    const void *var;
-    void *val;
+	const void *var;
+	void *val;
 
 	switch_mutex_lock(runtime.global_var_mutex);
 	for (hi = switch_hash_first(NULL, runtime.global_vars); hi; hi = switch_hash_next(hi)) {
@@ -312,8 +313,8 @@
 	switch_channel_t *channel;
 	switch_frame_t *read_frame;
 
-//	switch_assert(thread != NULL);
-//	switch_assert(session != NULL);
+//  switch_assert(thread != NULL);
+//  switch_assert(session != NULL);
 
 	if (switch_core_session_read_lock(session) != SWITCH_STATUS_SUCCESS) {
 		return NULL;
@@ -346,7 +347,7 @@
 
 	channel = switch_core_session_get_channel(session);
 	switch_assert(channel);
-	
+
 	switch_channel_clear_flag(channel, CF_SERVICE);
 }
 
@@ -357,7 +358,7 @@
 
 	channel = switch_core_session_get_channel(session);
 	switch_assert(channel);
-	
+
 	switch_core_session_launch_thread(session, switch_core_service_thread, session);
 }
 
@@ -454,10 +455,26 @@
 #ifdef SWITCH_RUN_DIR
 		switch_snprintf(SWITCH_GLOBAL_dirs.run_dir, BUFSIZE, "%s", SWITCH_RUN_DIR);
 #else
-		switch_snprintf(SWITCH_GLOBAL_dirs.run_dir, BUFSIZE, "%s%slog", base_dir, SWITCH_PATH_SEPARATOR);
+		switch_snprintf(SWITCH_GLOBAL_dirs.run_dir, BUFSIZE, "%s%srun", base_dir, SWITCH_PATH_SEPARATOR);
 #endif
 	}
 
+	if (!SWITCH_GLOBAL_dirs.recordings_dir && (SWITCH_GLOBAL_dirs.recordings_dir = (char *) malloc(BUFSIZE))) {
+#ifdef SWITCH_RECORDINGS_DIR
+		switch_snprintf(SWITCH_GLOBAL_dirs.recordings_dir, BUFSIZE, "%s", SWITCH_RECORDINGS_DIR);
+#else
+		switch_snprintf(SWITCH_GLOBAL_dirs.recordings_dir, BUFSIZE, "%s%srecordings", base_dir, SWITCH_PATH_SEPARATOR);
+#endif
+	}
+
+	if (!SWITCH_GLOBAL_dirs.sounds_dir && (SWITCH_GLOBAL_dirs.sounds_dir = (char *) malloc(BUFSIZE))) {
+#ifdef SWITCH_SOUNDS_DIR
+		switch_snprintf(SWITCH_GLOBAL_dirs.sounds_dir, BUFSIZE, "%s", SWITCH_SOUNDS_DIR);
+#else
+		switch_snprintf(SWITCH_GLOBAL_dirs.sounds_dir, BUFSIZE, "%s%ssounds", base_dir, SWITCH_PATH_SEPARATOR);
+#endif
+	}
+
 	if (!SWITCH_GLOBAL_dirs.storage_dir && (SWITCH_GLOBAL_dirs.storage_dir = (char *) malloc(BUFSIZE))) {
 #ifdef SWITCH_STORAGE_DIR
 		switch_snprintf(SWITCH_GLOBAL_dirs.storage_dir, BUFSIZE, "%s", SWITCH_STORAGE_DIR);
@@ -520,6 +537,8 @@
 	switch_assert(SWITCH_GLOBAL_dirs.script_dir);
 	switch_assert(SWITCH_GLOBAL_dirs.htdocs_dir);
 	switch_assert(SWITCH_GLOBAL_dirs.grammar_dir);
+	switch_assert(SWITCH_GLOBAL_dirs.recordings_dir);
+	switch_assert(SWITCH_GLOBAL_dirs.sounds_dir);
 	switch_assert(SWITCH_GLOBAL_dirs.temp_dir);
 }
 
@@ -765,7 +784,7 @@
 	if (fd <= 0) {
 		goto end;
 	}
-	
+
 	while ((switch_fd_read_line(fd, line_buf, sizeof(line_buf)))) {
 		char *p;
 		char *type = line_buf;
@@ -795,7 +814,7 @@
 		fd = -1;
 	}
 
- end:
+  end:
 
 	switch_safe_free(mime_path);
 
@@ -867,8 +886,27 @@
 	if ((list = switch_core_hash_find(IP_LIST.hash, list_name))) {
 		ok = switch_network_list_validate_ip_token(list, ip, token);
 	} else if (strchr(list_name, '/')) {
-		switch_parse_cidr(list_name, &net, &mask, &bits);
-		ok = switch_test_subnet(ip, net, mask);
+		if (strchr(list_name, ',')) {
+			char *list_name_dup = strdup(list_name);
+			char *argv[32];
+			int argc;
+
+			switch_assert(list_name_dup);
+
+			if ((argc = switch_separate_string(list_name_dup, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+				int i;
+				for (i = 0; i < argc; i++) {
+					switch_parse_cidr(argv[i], &net, &mask, &bits);
+					if ((ok = switch_test_subnet(ip, net, mask))) {
+						break;
+					}
+				}
+			}
+			free(list_name_dup);
+		} else {
+			switch_parse_cidr(list_name, &net, &mask, &bits);
+			ok = switch_test_subnet(ip, net, mask);
+		}
 	}
 	switch_mutex_unlock(runtime.global_mutex);
 
@@ -889,7 +927,7 @@
 	switch_find_local_ip(guess_ip, sizeof(guess_ip), &mask, AF_INET);
 	in.s_addr = mask;
 	switch_set_string(guess_mask, inet_ntoa(in));
-	
+
 	switch_mutex_lock(runtime.global_mutex);
 
 	if (IP_LIST.hash) {
@@ -911,7 +949,7 @@
 	switch_network_list_add_cidr(rfc_list, "10.0.0.0/8", SWITCH_TRUE);
 	switch_network_list_add_cidr(rfc_list, "172.16.0.0/12", SWITCH_TRUE);
 	switch_network_list_add_cidr(rfc_list, "192.168.0.0/16", SWITCH_TRUE);
-	switch_core_hash_insert(IP_LIST.hash, tmp_name, rfc_list);	
+	switch_core_hash_insert(IP_LIST.hash, tmp_name, rfc_list);
 
 	tmp_name = "wan.auto";
 	switch_network_list_create(&rfc_list, tmp_name, SWITCH_TRUE, IP_LIST.pool);
@@ -919,19 +957,18 @@
 	switch_network_list_add_cidr(rfc_list, "10.0.0.0/8", SWITCH_FALSE);
 	switch_network_list_add_cidr(rfc_list, "172.16.0.0/12", SWITCH_FALSE);
 	switch_network_list_add_cidr(rfc_list, "192.168.0.0/16", SWITCH_FALSE);
-	switch_core_hash_insert(IP_LIST.hash, tmp_name, rfc_list);	
+	switch_core_hash_insert(IP_LIST.hash, tmp_name, rfc_list);
 
 	tmp_name = "nat.auto";
 	switch_network_list_create(&rfc_list, tmp_name, SWITCH_FALSE, IP_LIST.pool);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Created ip list %s default (deny)\n", tmp_name);
 	if (switch_network_list_add_host_mask(rfc_list, guess_ip, guess_mask, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
-						  "Adding %s/%s (deny) to list %s\n", guess_ip, guess_mask, tmp_name);
-        }
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding %s/%s (deny) to list %s\n", guess_ip, guess_mask, tmp_name);
+	}
 	switch_network_list_add_cidr(rfc_list, "10.0.0.0/8", SWITCH_TRUE);
 	switch_network_list_add_cidr(rfc_list, "172.16.0.0/12", SWITCH_TRUE);
 	switch_network_list_add_cidr(rfc_list, "192.168.0.0/16", SWITCH_TRUE);
-	switch_core_hash_insert(IP_LIST.hash, tmp_name, rfc_list);	
+	switch_core_hash_insert(IP_LIST.hash, tmp_name, rfc_list);
 
 	tmp_name = "loopback.auto";
 	switch_network_list_create(&rfc_list, tmp_name, SWITCH_FALSE, IP_LIST.pool);
@@ -942,14 +979,13 @@
 	tmp_name = "localnet.auto";
 	switch_network_list_create(&list, tmp_name, SWITCH_FALSE, IP_LIST.pool);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Created ip list %s default (deny)\n", tmp_name);
-	
+
 	if (switch_network_list_add_host_mask(list, guess_ip, guess_mask, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
-						  "Adding %s/%s (allow) to list %s\n", guess_ip, guess_mask, tmp_name);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding %s/%s (allow) to list %s\n", guess_ip, guess_mask, tmp_name);
 	}
-	switch_core_hash_insert(IP_LIST.hash, tmp_name, list);	
+	switch_core_hash_insert(IP_LIST.hash, tmp_name, list);
 
-	
+
 	if ((xml = switch_xml_open_cfg("acl.conf", &cfg, NULL))) {
 		if ((x_lists = switch_xml_child(cfg, "network-lists"))) {
 			for (x_list = switch_xml_child(x_lists, "list"); x_list; x_list = x_list->next) {
@@ -999,13 +1035,13 @@
 						switch_assert(my_params);
 						switch_event_add_header_string(my_params, SWITCH_STACK_BOTTOM, "domain", domain);
 						switch_event_add_header_string(my_params, SWITCH_STACK_BOTTOM, "purpose", "network-list");
-						
+
 						if (switch_xml_locate_domain(domain, my_params, &xml_root, &x_domain) != SWITCH_STATUS_SUCCESS) {
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Cannot locate domain %s\n", domain);
 							switch_event_destroy(&my_params);
 							continue;
 						}
-						
+
 						switch_event_destroy(&my_params);
 
 						for (ut = switch_xml_child(x_domain, "user"); ut; ut = ut->next) {
@@ -1014,25 +1050,8 @@
 
 							if (id && user_cidr) {
 								char *token = switch_mprintf("%s@%s", id, domain);
-								char *argv[100] = { 0 };
-								char *dup_cidr = strdup(user_cidr);
-								int argc, i = 0;
-								
 								switch_assert(token);
-								switch_assert(dup_cidr);
-
-								if ((argc = switch_separate_string(dup_cidr, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
-									for (i = 0; i < argc; i++) {
-										if (switch_network_list_add_cidr_token(list, argv[i], ok, token) == SWITCH_STATUS_SUCCESS) {
-											switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding %s (%s) [%s] to list %s\n", 
-															  argv[i], ok ? "allow" : "deny", switch_str_nil(token), name);
-										} else {
-											switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Adding %s (%s) [%s] to list %s\n",
-															  argv[i], ok ? "allow" : "deny", switch_str_nil(token), name);
-										}
-									}
-								}
-								free(dup_cidr);
+								switch_network_list_add_cidr_token(list, user_cidr, ok, token);
 								free(token);
 							}
 						}
@@ -1043,35 +1062,18 @@
 									for (ut = switch_xml_child(uts, "user"); ut; ut = ut->next) {
 										const char *user_cidr = switch_xml_attr(ut, "cidr");
 										const char *id = switch_xml_attr(ut, "id");
-										
+
 										if (id && user_cidr) {
 											char *token = switch_mprintf("%s@%s", id, domain);
-											char *argv[100] = { 0 };
-											char *dup_cidr = strdup(user_cidr);
-											int argc, i = 0;
-											
 											switch_assert(token);
-											switch_assert(dup_cidr);
-
-											if ((argc = switch_separate_string(dup_cidr, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
-												for (i = 0; i < argc; i++) {
-													if (switch_network_list_add_cidr_token(list, argv[i], ok, token) == SWITCH_STATUS_SUCCESS) {
-														switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding %s (%s) [%s] to list %s\n", 
-																		  argv[i], ok ? "allow" : "deny", switch_str_nil(token), name);
-													} else {
-														switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Adding %s (%s) [%s] to list %s\n",
-																		  argv[i], ok ? "allow" : "deny", switch_str_nil(token), name);
-													}
-												}
-											}
-											free(dup_cidr);
+											switch_network_list_add_cidr_token(list, user_cidr, ok, token);
 											free(token);
 										}
 									}
 								}
 							}
 						}
-						
+
 						switch_xml_free(xml_root);
 					} else if (cidr) {
 						if (switch_network_list_add_cidr(list, cidr, ok) == SWITCH_STATUS_SUCCESS) {
@@ -1085,7 +1087,7 @@
 							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
 											  "Adding %s/%s (%s) to list %s\n", host, mask, ok ? "allow" : "deny", name);
 						}
-					} 
+					}
 
 					switch_core_hash_insert(IP_LIST.hash, name, list);
 				}
@@ -1143,7 +1145,7 @@
 {
 	char buf[13] = "";
 	char path[256];
-	
+
 	int fd = -1, write_fd = -1;
 	switch_ssize_t bytes = 0;
 
@@ -1157,9 +1159,9 @@
 		int i = 0;
 
 		switch_inet_pton(AF_INET, ip, &ipi);
-		byte = (switch_byte_t *) &ipi;
+		byte = (switch_byte_t *) & ipi;
 
-		for(i = 0; i < 8; i += 2) {
+		for (i = 0; i < 8; i += 2) {
 			switch_snprintf(buf + i, sizeof(buf) - i, "%0.2x", *byte);
 			byte++;
 		}
@@ -1176,22 +1178,25 @@
 		close(fd);
 		fd = -1;
 	}
-	
+
 	switch_core_set_variable("switch_serial", buf);
 }
 
-
 SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switch_bool_t console, const char **err)
 {
 	switch_uuid_t uuid;
 	char guess_ip[256];
-	char *dir_path;
 	int mask = 0;
 	struct in_addr in;
 	char hostname[256] = "";
 
-	memset(&runtime, 0, sizeof(runtime));
+	if (runtime.runlevel > 0) {
+		/* one per customer */
+		return SWITCH_STATUS_SUCCESS;
+	}
 
+	runtime.runlevel++;
+
 	runtime.dummy_cng_frame.data = runtime.dummy_data;
 	runtime.dummy_cng_frame.datalen = sizeof(runtime.dummy_data);
 	runtime.dummy_cng_frame.buflen = sizeof(runtime.dummy_data);
@@ -1217,9 +1222,6 @@
 	}
 	switch_assert(runtime.memory_pool != NULL);
 
-	dir_path = switch_mprintf("%s%ssounds", SWITCH_GLOBAL_dirs.base_dir, SWITCH_PATH_SEPARATOR);
-	switch_dir_make_recursive(dir_path, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
-	switch_safe_free(dir_path);
 	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.base_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
 	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.mod_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
 	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.conf_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
@@ -1229,8 +1231,11 @@
 	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.script_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
 	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.htdocs_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
 	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
+	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.recordings_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
+	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.sounds_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
 	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.temp_dir, SWITCH_DEFAULT_DIR_PERMS, runtime.memory_pool);
 
+	switch_mutex_init(&runtime.uuid_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
 
 	switch_mutex_init(&runtime.throttle_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
 	switch_mutex_init(&runtime.session_hash_mutex, SWITCH_MUTEX_NESTED, runtime.memory_pool);
@@ -1262,8 +1267,12 @@
 	switch_find_local_ip(guess_ip, sizeof(guess_ip), NULL, AF_INET6);
 	switch_core_set_variable("local_ip_v6", guess_ip);
 	switch_core_set_variable("base_dir", SWITCH_GLOBAL_dirs.base_dir);
+	switch_core_set_variable("recordings_dir", SWITCH_GLOBAL_dirs.recordings_dir);
+	switch_core_set_variable("sound_prefix", SWITCH_GLOBAL_dirs.sounds_dir);
+	switch_core_set_variable("sounds_dir", SWITCH_GLOBAL_dirs.sounds_dir);
 	switch_core_set_serial();
 
+	switch_console_init(runtime.memory_pool);
 	switch_event_init(runtime.memory_pool);
 
 	if (switch_xml_init(runtime.memory_pool, err) != SWITCH_STATUS_SUCCESS) {
@@ -1274,7 +1283,7 @@
 	if (switch_test_flag((&runtime), SCF_USE_AUTO_NAT)) {
 		switch_nat_init(runtime.memory_pool);
 	}
-	
+
 	switch_log_init(runtime.memory_pool, runtime.colorize_console);
 
 	switch_load_core_config("switch.conf");
@@ -1291,7 +1300,7 @@
 	switch_rtp_init(runtime.memory_pool);
 
 	runtime.running = 1;
-
+	runtime.tipping_point = 1000;
 	runtime.initiated = switch_time_now();
 
 	switch_scheduler_add_task(switch_epoch_time_now(NULL), heartbeat_callback, "heartbeat", "core", 0, NULL, SSHF_NONE | SSHF_NO_DEL);
@@ -1364,10 +1373,10 @@
 static void switch_load_core_config(const char *file)
 {
 	switch_xml_t xml = NULL, cfg = NULL;
-	
+
 	if ((xml = switch_xml_open_cfg(file, &cfg, NULL))) {
 		switch_xml_t settings, param;
-		
+
 		if ((settings = switch_xml_child(cfg, "settings"))) {
 			for (param = switch_xml_child(settings, "param"); param; param = param->next) {
 				const char *var = switch_xml_attr_soft(param, "name");
@@ -1397,6 +1406,8 @@
 					if (tmp > -1 && tmp < 11) {
 						switch_core_session_ctl(SCSC_DEBUG_LEVEL, &tmp);
 					}
+				} else if (!strcasecmp(var, "enable-early-hangup") && switch_true(val)) {
+					switch_set_flag((&runtime), SCF_EARLY_HANGUP);
 				} else if (!strcasecmp(var, "colorize-console") && switch_true(val)) {
 					runtime.colorize_console = SWITCH_TRUE;
 				} else if (!strcasecmp(var, "mailer-app") && !zstr(val)) {
@@ -1405,25 +1416,33 @@
 					runtime.mailer_app_args = switch_core_strdup(runtime.memory_pool, val);
 				} else if (!strcasecmp(var, "sessions-per-second") && !zstr(val)) {
 					switch_core_sessions_per_second(atoi(val));
-				} else if (!strcasecmp(var, "max_dtmf_duration") && !zstr(val)) {
+				} else if (!strcasecmp(var, "max-dtmf-duration") && !zstr(val)) {
 					int tmp = atoi(val);
 					if (tmp > 0) {
 						switch_core_max_dtmf_duration((uint32_t) tmp);
 					}
-				} else if (!strcasecmp(var, "min_dtmf_duration") && !zstr(val)) {
+				} else if (!strcasecmp(var, "min-dtmf-duration") && !zstr(val)) {
 					int tmp = atoi(val);
 					if (tmp > 0) {
 						switch_core_min_dtmf_duration((uint32_t) tmp);
 					}
-				} else if (!strcasecmp(var, "default_dtmf_duration") && !zstr(val)) {
+				} else if (!strcasecmp(var, "default-dtmf-duration") && !zstr(val)) {
 					int tmp = atoi(val);
 					if (tmp > 0) {
 						switch_core_default_dtmf_duration((uint32_t) tmp);
 					}
-				} else if (!strcasecmp(var, "disable-monotonic-timing")) {
-					switch_time_set_monotonic(SWITCH_FALSE);
+				} else if (!strcasecmp(var, "enable-monotonic-timing")) {
+					switch_time_set_monotonic(switch_true(var));
+				} else if (!strcasecmp(var, "enable-clock-nanosleep")) {
+					switch_time_set_nanosleep(switch_true(var));
+				} else if (!strcasecmp(var, "enable-cond-yield")) {
+					switch_time_set_cond_yield(switch_true(var));
+				} else if (!strcasecmp(var, "enable-timer-matrix")) {
+					switch_time_set_matrix(switch_true(var));
 				} else if (!strcasecmp(var, "max-sessions") && !zstr(val)) {
 					switch_core_session_limit(atoi(val));
+				} else if (!strcasecmp(var, "tipping-point") && !zstr(val)) {
+					runtime.tipping_point = atoi(val);
 				} else if (!strcasecmp(var, "rtp-start-port") && !zstr(val)) {
 					switch_rtp_set_start_port((switch_port_t) atoi(val));
 				} else if (!strcasecmp(var, "rtp-end-port") && !zstr(val)) {
@@ -1464,24 +1483,22 @@
 
 }
 
-#define SWITCH_CORE_DB "core"
-/*!
-  \brief Open the default system database
-*/
-SWITCH_DECLARE(switch_status_t) _switch_core_db_handle(switch_cache_db_handle_t **dbh, const char *file, const char *func, int line)
+SWITCH_DECLARE(const char *) switch_core_banner(void)
 {
-	switch_cache_db_connection_options_t options = { {0} };
 
-	if (runtime.odbc_dsn && runtime.odbc_user && runtime.odbc_pass) {
-		options.odbc_options.dsn = runtime.odbc_dsn;
-		options.odbc_options.user = runtime.odbc_user;
-		options.odbc_options.pass = runtime.odbc_pass;
 
-		return _switch_cache_db_get_db_handle(dbh, SCDB_TYPE_ODBC, &options, file, func, line);
-	} else {
-		options.core_db_options.db_path = SWITCH_CORE_DB;
-		return _switch_cache_db_get_db_handle(dbh, SCDB_TYPE_CORE_DB, &options, file, func, line);
-	}
+	return ("\n"
+			"   _____              ______        _____ _____ ____ _   _  \n"
+			"  |  ___| __ ___  ___/ ___\\ \\      / /_ _|_   _/ ___| | | | \n"
+			"  | |_ | '__/ _ \\/ _ \\___ \\\\ \\ /\\ / / | |  | || |   | |_| | \n"
+			"  |  _|| | |  __/  __/___) |\\ V  V /  | |  | || |___|  _  | \n"
+			"  |_|  |_|  \\___|\\___|____/  \\_/\\_/  |___| |_| \\____|_| |_| \n"
+			"\n"
+			"************************************************************\n"
+			"* Anthony Minessale II, Michael Jerris, Brian West, Others *\n"
+			"* FreeSWITCH (http://www.freeswitch.org)                   *\n"
+			"* Paypal Donations Appreciated: paypal@freeswitch.org      *\n"
+			"* Brought to you by ClueCon http://www.cluecon.com/        *\n" "************************************************************\n" "\n");
 }
 
 
@@ -1493,6 +1510,13 @@
 		return SWITCH_STATUS_GENERR;
 	}
 
+	if (runtime.runlevel > 1) {
+		/* one per customer */
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+	runtime.runlevel++;
+
 	/* set signal handlers */
 	signal(SIGINT, SIG_IGN);
 #ifdef SIGPIPE
@@ -1533,6 +1557,9 @@
 		switch_event_fire(&event);
 	}
 
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s", switch_core_banner());
+
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,
 					  "\nFreeSWITCH Version %s Started.\nMax Sessions[%u]\nSession Rate[%d]\nSQL [%s]\n", SWITCH_VERSION_FULL,
 					  switch_core_session_limit(0),
@@ -1570,15 +1597,15 @@
 #ifdef _MSC_VER
 static void win_shutdown(void)
 {
-	
-	HANDLE shutdown_event;	
+
+	HANDLE shutdown_event;
 	char path[512];
 	/* for windows we need the event to signal for shutting down a background FreeSWITCH */
 	snprintf(path, sizeof(path), "Global\\Freeswitch.%d", getpid());
-	
+
 	/* open the event so we can signal it */
 	shutdown_event = OpenEvent(EVENT_MODIFY_STATE, FALSE, path);
-	
+
 	if (shutdown_event) {
 		/* signal the event to shutdown */
 		SetEvent(shutdown_event);
@@ -1601,6 +1628,12 @@
 	}
 
 	switch (cmd) {
+	case SCSC_CALIBRATE_CLOCK:
+		switch_time_calibrate_clock();
+		break;
+	case SCSC_FLUSH_DB_HANDLES:
+		switch_cache_db_flush_handles();
+		break;
 	case SCSC_SEND_SIGHUP:
 		handle_SIGHUP(1);
 		break;
@@ -1621,6 +1654,18 @@
 	case SCSC_CANCEL_SHUTDOWN:
 		switch_clear_flag((&runtime), SCF_SHUTDOWN_REQUESTED);
 		break;
+	case SCSC_SAVE_HISTORY:
+		switch_console_save_history();
+		break;
+	case SCSC_CRASH:
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Declinatio Mortuus Obfirmo!\n");
+		switch_console_save_history();
+		abort();
+		break;
+	case SCSC_SHUTDOWN_NOW:
+		switch_console_save_history();
+		exit(0);
+		break;
 	case SCSC_SHUTDOWN_ELEGANT:
 	case SCSC_SHUTDOWN_ASAP:
 		{
@@ -1632,17 +1677,16 @@
 				switch_set_flag((&runtime), SCF_NO_NEW_SESSIONS);
 			}
 
-			while(runtime.running && switch_test_flag((&runtime), SCF_SHUTDOWN_REQUESTED) && (count = switch_core_session_count())) {
+			while (runtime.running && switch_test_flag((&runtime), SCF_SHUTDOWN_REQUESTED) && (count = switch_core_session_count())) {
 				switch_yield(500000);
 				if (++x == 20) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
-									  "Shutdown in progress, %u session(s) remain.\nShutting down %s\n", 
-									  count,
-									  cmd == SCSC_SHUTDOWN_ASAP ? "ASAP" : "once there are no active calls.");
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+									  "Shutdown in progress, %u session(s) remain.\nShutting down %s\n",
+									  count, cmd == SCSC_SHUTDOWN_ASAP ? "ASAP" : "once there are no active calls.");
 					x = 0;
 				}
 			}
-			
+
 			if (switch_test_flag((&runtime), SCF_SHUTDOWN_REQUESTED)) {
 				switch_set_flag((&runtime), SCF_NO_NEW_SESSIONS);
 #ifdef _MSC_VER
@@ -1697,7 +1741,8 @@
 		break;
 	case SCSC_DEBUG_LEVEL:
 		if (*val > -1) {
-			if (*val > 10) *val = 10;
+			if (*val > 10)
+				*val = 10;
 			runtime.debug_level = *val;
 		}
 		*val = runtime.debug_level;
@@ -1757,24 +1802,26 @@
 
 	switch_set_flag((&runtime), SCF_NO_NEW_SESSIONS);
 	switch_set_flag((&runtime), SCF_SHUTTING_DOWN);
-	
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "End existing sessions\n");
 	switch_core_session_hupall(SWITCH_CAUSE_SYSTEM_SHUTDOWN);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Clean up modules.\n");
 
 	switch_loadable_module_shutdown();
-	
+
 	if (switch_test_flag((&runtime), SCF_USE_SQL)) {
 		switch_core_sqldb_stop();
 	}
 	switch_scheduler_task_thread_stop();
-	
+
 	switch_rtp_shutdown();
 	if (switch_test_flag((&runtime), SCF_USE_AUTO_NAT)) {
 		switch_nat_shutdown();
 	}
 	switch_xml_destroy();
 
+	switch_console_shutdown();
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Closing Event Engine.\n");
 	switch_event_shutdown();
 
@@ -1797,6 +1844,8 @@
 	switch_safe_free(SWITCH_GLOBAL_dirs.script_dir);
 	switch_safe_free(SWITCH_GLOBAL_dirs.htdocs_dir);
 	switch_safe_free(SWITCH_GLOBAL_dirs.grammar_dir);
+	switch_safe_free(SWITCH_GLOBAL_dirs.recordings_dir);
+	switch_safe_free(SWITCH_GLOBAL_dirs.sounds_dir);
 	switch_safe_free(SWITCH_GLOBAL_dirs.temp_dir);
 
 	switch_core_hash_destroy(&runtime.global_vars);
@@ -1806,11 +1855,11 @@
 		apr_pool_destroy(runtime.memory_pool);
 		apr_terminate();
 	}
-	
+
 	return switch_test_flag((&runtime), SCF_RESTART) ? SWITCH_STATUS_RESTART : SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_chat_send(const char *name, const char *proto, const char *from, const char *to, 
+SWITCH_DECLARE(switch_status_t) switch_core_chat_send(const char *name, const char *proto, const char *from, const char *to,
 													  const char *subject, const char *body, const char *type, const char *hint)
 {
 	switch_chat_interface_t *ci;
@@ -1849,18 +1898,18 @@
 
 
 struct system_thread_handle {
-	const char * cmd;
+	const char *cmd;
 	switch_thread_cond_t *cond;
 	switch_mutex_t *mutex;
 	switch_memory_pool_t *pool;
 	int ret;
 };
 
-static void *SWITCH_THREAD_FUNC system_thread(switch_thread_t *thread, void *obj) 
+static void *SWITCH_THREAD_FUNC system_thread(switch_thread_t *thread, void *obj)
 {
-	struct system_thread_handle *sth = (struct system_thread_handle *)obj;
+	struct system_thread_handle *sth = (struct system_thread_handle *) obj;
 
-#if 0 // if we are a luser we can never turn this back down, didn't we already set the stack size?
+#if 0							// if we are a luser we can never turn this back down, didn't we already set the stack size?
 #if defined(HAVE_SETRLIMIT) && !defined(__FreeBSD__)
 	struct rlimit rlim;
 
@@ -1877,11 +1926,10 @@
 #if 0
 #if defined(HAVE_SETRLIMIT) && !defined(__FreeBSD__)
 	rlim.rlim_cur = SWITCH_THREAD_STACKSIZE;
-	rlim.rlim_max = SWITCH_SYSTEM_THREAD_STACKSIZE; 
+	rlim.rlim_max = SWITCH_SYSTEM_THREAD_STACKSIZE;
 	if (setrlimit(RLIMIT_STACK, &rlim) < 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Setting stack size failed! (%s)\n", strerror(errno));
 	}
-
 #endif
 #endif
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_asr.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_asr.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_asr.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -115,7 +115,7 @@
 		status = SWITCH_STATUS_FALSE;
 		goto done;
 	}
-	
+
 	/* extract params */
 	if (*data == '{') {
 		param_string = data + 1;
@@ -123,7 +123,7 @@
 		if (zstr(data)) {
 			status = SWITCH_STATUS_FALSE;
 			goto done;
-		} else {	
+		} else {
 			*data = '\0';
 			data++;
 		}
@@ -136,7 +136,7 @@
 		int argc = switch_separate_string(param_string, ',', param, (sizeof(param) / sizeof(param[0])));
 		for (i = 0; i < argc && param[i]; ++i) {
 			char *param_pair[2] = { 0 };
-			if(switch_separate_string(param[i], '=', param_pair, (sizeof(param_pair) / sizeof(param_pair[0]))) == 2) {
+			if (switch_separate_string(param[i], '=', param_pair, (sizeof(param_pair) / sizeof(param_pair[0]))) == 2) {
 				switch_core_asr_text_param(ah, param_pair[0], param_pair[1]);
 			}
 		}
@@ -144,7 +144,7 @@
 
 	status = ah->asr_interface->asr_load_grammar(ah, data, name);
 
- done:
+  done:
 
 	switch_safe_free(lgrammar);
 	return status;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_codec.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_codec.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_codec.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -47,14 +47,17 @@
 	switch_mutex_t *mutex = NULL;
 
 	switch_mutex_lock(session->codec_read_mutex);
-	if (session->read_codec) mutex = session->read_codec->mutex;
-	if (mutex) switch_mutex_lock(mutex);
+	if (session->read_codec)
+		mutex = session->read_codec->mutex;
+	if (mutex)
+		switch_mutex_lock(mutex);
 	session->real_read_codec = session->read_codec = NULL;
 	session->raw_read_frame.codec = session->read_codec;
 	session->raw_write_frame.codec = session->read_codec;
 	session->enc_read_frame.codec = session->read_codec;
 	session->enc_write_frame.codec = session->read_codec;
-	if (mutex) switch_mutex_unlock(mutex);
+	if (mutex)
+		switch_mutex_unlock(mutex);
 	switch_mutex_unlock(session->codec_read_mutex);
 }
 
@@ -79,14 +82,17 @@
 }
 
 SWITCH_DECLARE(void) switch_core_session_unset_write_codec(switch_core_session_t *session)
-{	
+{
 	switch_mutex_t *mutex = NULL;
 
 	switch_mutex_lock(session->codec_write_mutex);
-	if (session->write_codec) mutex = session->write_codec->mutex;
-	if (mutex) switch_mutex_lock(mutex);
+	if (session->write_codec)
+		mutex = session->write_codec->mutex;
+	if (mutex)
+		switch_mutex_lock(mutex);
 	session->real_write_codec = session->write_codec = NULL;
-	if (mutex) switch_mutex_unlock(mutex);
+	if (mutex)
+		switch_mutex_unlock(mutex);
 	switch_mutex_unlock(session->codec_write_mutex);
 }
 
@@ -103,12 +109,15 @@
 	if (codec && (!codec->implementation || !switch_core_codec_ready(codec))) {
 		codec = NULL;
 	}
-	
+
 	if (codec) {
 		if (!session->real_read_codec) {
 			session->read_codec = session->real_read_codec = codec;
 			session->read_impl = *codec->implementation;
 		} else {
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Push codec %s:%d\n",
+							  switch_channel_get_name(session->channel), codec->implementation->iananame, codec->implementation->ianacode);
+			codec->next = session->read_codec;
 			session->read_codec = codec;
 			session->read_impl = *codec->implementation;
 		}
@@ -116,7 +125,17 @@
 		if (session->read_codec == session->real_read_codec) {
 			goto end;
 		}
-		if (session->real_read_codec) {
+
+		if (session->read_codec->next) {
+			switch_codec_t *old = session->read_codec;
+			session->read_codec = session->read_codec->next;
+			session->read_impl = *session->read_codec->implementation;
+			old->next = NULL;
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Restore previous codec %s:%d.\n",
+							  switch_channel_get_name(session->channel),
+							  session->read_codec->implementation->iananame, session->read_codec->implementation->ianacode);
+
+		} else if (session->real_read_codec) {
 			session->read_codec = session->real_read_codec;
 			session->read_impl = *session->real_read_codec->implementation;
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Restore original codec.\n");
@@ -125,10 +144,10 @@
 			goto end;
 		}
 	}
-	
+
 	if (!session->read_codec) {
-        status = SWITCH_STATUS_FALSE;
-        goto end;
+		status = SWITCH_STATUS_FALSE;
+		goto end;
 	}
 
 	if (session->read_codec && session->read_impl.decoded_bytes_per_packet) {
@@ -145,15 +164,19 @@
 		switch_channel_set_variable(channel, "read_codec", session->read_impl.iananame);
 		switch_snprintf(tmp, sizeof(tmp), "%d", session->read_impl.actual_samples_per_second);
 		switch_channel_set_variable(channel, "read_rate", tmp);
-		
+
 		session->raw_read_frame.codec = session->read_codec;
 		session->raw_write_frame.codec = session->read_codec;
 		session->enc_read_frame.codec = session->read_codec;
 		session->enc_write_frame.codec = session->read_codec;
 	}
 
- end:
+  end:
 
+	if (session->read_codec) {
+		switch_channel_set_flag(channel, CF_MEDIA_SET);
+	}
+
 	switch_mutex_unlock(session->codec_read_mutex);
 	return status;
 
@@ -161,17 +184,19 @@
 
 SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_effective_read_codec(switch_core_session_t *session)
 {
-	switch_codec_t *codec;	codec = session->read_codec;
+	switch_codec_t *codec;
+	codec = session->read_codec;
 	return codec;
 }
 
 SWITCH_DECLARE(switch_codec_t *) switch_core_session_get_read_codec(switch_core_session_t *session)
 {
-	switch_codec_t *codec;	codec = session->real_read_codec ? session->real_read_codec : session->read_codec;
+	switch_codec_t *codec;
+	codec = session->real_read_codec ? session->real_read_codec : session->read_codec;
 	return codec;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_get_read_impl(switch_core_session_t *session,  switch_codec_implementation_t *impp)
+SWITCH_DECLARE(switch_status_t) switch_core_session_get_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
 {
 	if (session->read_impl.decoded_bytes_per_packet) {
 		*impp = session->read_impl;
@@ -181,7 +206,7 @@
 	return SWITCH_STATUS_FALSE;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_get_write_impl(switch_core_session_t *session,  switch_codec_implementation_t *impp)
+SWITCH_DECLARE(switch_status_t) switch_core_session_get_write_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
 {
 	if (session->write_impl.decoded_bytes_per_packet) {
 		*impp = session->write_impl;
@@ -191,7 +216,7 @@
 	return SWITCH_STATUS_FALSE;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_read_impl(switch_core_session_t *session,  switch_codec_implementation_t *impp)
+SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
 {
 	if (session->video_read_impl.decoded_bytes_per_packet) {
 		*impp = session->video_read_impl;
@@ -201,7 +226,7 @@
 	return SWITCH_STATUS_FALSE;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_write_impl(switch_core_session_t *session,  switch_codec_implementation_t *impp)
+SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_write_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
 {
 	if (session->video_write_impl.decoded_bytes_per_packet) {
 		*impp = session->video_write_impl;
@@ -212,25 +237,25 @@
 }
 
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_impl(switch_core_session_t *session,  const switch_codec_implementation_t *impp)
+SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_impl(switch_core_session_t *session, const switch_codec_implementation_t *impp)
 {
-	session->read_impl =*impp;
+	session->read_impl = *impp;
 	return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_set_write_impl(switch_core_session_t *session,  const switch_codec_implementation_t *impp)
+SWITCH_DECLARE(switch_status_t) switch_core_session_set_write_impl(switch_core_session_t *session, const switch_codec_implementation_t *impp)
 {
 	session->write_impl = *impp;
 	return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_read_impl(switch_core_session_t *session,  const switch_codec_implementation_t *impp)
+SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_read_impl(switch_core_session_t *session, const switch_codec_implementation_t *impp)
 {
 	session->video_read_impl = *impp;
 	return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_write_impl(switch_core_session_t *session,  const switch_codec_implementation_t *impp)
+SWITCH_DECLARE(switch_status_t) switch_core_session_set_video_write_impl(switch_core_session_t *session, const switch_codec_implementation_t *impp)
 {
 	session->video_write_impl = *impp;
 	return SWITCH_STATUS_SUCCESS;
@@ -294,7 +319,7 @@
 		switch_channel_set_variable(channel, "write_rate", tmp);
 	}
 
- end:
+  end:
 	switch_mutex_unlock(session->codec_write_mutex);
 
 	return status;
@@ -329,7 +354,7 @@
 	if (!codec || !codec->implementation || !switch_core_codec_ready(codec)) {
 		if (session->video_read_codec) {
 			session->video_read_codec = NULL;
-        	status = SWITCH_STATUS_SUCCESS;
+			status = SWITCH_STATUS_SUCCESS;
 			goto end;
 		}
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot set NULL codec!\n");
@@ -350,7 +375,7 @@
 
 	session->video_read_codec = codec;
 	session->video_read_impl = *codec->implementation;
- end:
+  end:
 
 	return status;
 }
@@ -359,7 +384,7 @@
 {
 	switch_codec_t *codec;
 	codec = session->video_read_codec;
-	
+
 	return codec;
 
 }
@@ -373,7 +398,7 @@
 	if (!codec || !codec->implementation || !switch_core_codec_ready(codec)) {
 		if (session->video_write_codec) {
 			session->video_write_codec = NULL;
-        	status = SWITCH_STATUS_SUCCESS;
+			status = SWITCH_STATUS_SUCCESS;
 			goto end;
 		}
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot set NULL codec!\n");
@@ -381,7 +406,7 @@
 		goto end;
 	}
 
-    if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
+	if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
 		switch_channel_event_set_data(session->channel, event);
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-video-write-codec-name", codec->implementation->iananame);
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-video-write-codec-rate", "%d", codec->implementation->actual_samples_per_second);
@@ -395,8 +420,8 @@
 	session->video_write_codec = codec;
 	session->video_write_impl = *codec->implementation;
 
- end:
-	
+  end:
+
 	return status;
 }
 
@@ -553,13 +578,15 @@
 		return SWITCH_STATUS_NOT_INITALIZED;
 	}
 
-	if (codec->mutex) switch_mutex_lock(codec->mutex);
-	status = codec->implementation->encode(codec, other_codec, decoded_data, decoded_data_len, 
+	if (codec->mutex)
+		switch_mutex_lock(codec->mutex);
+	status = codec->implementation->encode(codec, other_codec, decoded_data, decoded_data_len,
 										   decoded_rate, encoded_data, encoded_data_len, encoded_rate, flag);
-	if (codec->mutex) switch_mutex_unlock(codec->mutex);
+	if (codec->mutex)
+		switch_mutex_unlock(codec->mutex);
 
 	return status;
-										   
+
 }
 
 SWITCH_DECLARE(switch_status_t) switch_core_codec_decode(switch_codec_t *codec,
@@ -585,10 +612,12 @@
 		return SWITCH_STATUS_NOT_INITALIZED;
 	}
 
-	if (codec->mutex) switch_mutex_lock(codec->mutex);
-	status = codec->implementation->decode(codec, other_codec, encoded_data, encoded_data_len, encoded_rate, 
+	if (codec->mutex)
+		switch_mutex_lock(codec->mutex);
+	status = codec->implementation->decode(codec, other_codec, encoded_data, encoded_data_len, encoded_rate,
 										   decoded_data, decoded_data_len, decoded_rate, flag);
-	if (codec->mutex) switch_mutex_unlock(codec->mutex);
+	if (codec->mutex)
+		switch_mutex_unlock(codec->mutex);
 
 	return status;
 }
@@ -598,9 +627,9 @@
 	switch_mutex_t *mutex;
 	switch_memory_pool_t *pool;
 	int free_pool = 0;
-	
-	switch_assert(codec != NULL);	
-	
+
+	switch_assert(codec != NULL);
+
 	if (!codec->implementation || !switch_core_codec_ready(codec)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Codec is not initialized!\n");
 		return SWITCH_STATUS_NOT_INITALIZED;
@@ -613,14 +642,16 @@
 	pool = codec->memory_pool;
 	mutex = codec->mutex;
 
-	if (mutex) switch_mutex_lock(mutex);
+	if (mutex)
+		switch_mutex_lock(mutex);
 
 	codec->implementation->destroy(codec);
 	switch_clear_flag(codec, SWITCH_CODEC_FLAG_READY);
 
 	UNPROTECT_INTERFACE(codec->codec_interface);
 
-	if (mutex) switch_mutex_unlock(mutex);
+	if (mutex)
+		switch_mutex_unlock(mutex);
 
 	if (free_pool) {
 		switch_core_destroy_memory_pool(&pool);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_db.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_db.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_db.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -57,14 +57,14 @@
 
 SWITCH_DECLARE(const unsigned char *) switch_core_db_column_text(switch_core_db_stmt_t *stmt, int iCol)
 {
-    const unsigned char *txt = sqlite3_column_text(stmt, iCol);
+	const unsigned char *txt = sqlite3_column_text(stmt, iCol);
 
-    if (!strcasecmp((char *)stmt, "(null)")) {
+	if (!strcasecmp((char *) stmt, "(null)")) {
 		memset(stmt, 0, 1);
 		txt = NULL;
-    }
+	}
 
-    return txt;
+	return txt;
 
 }
 
@@ -86,12 +86,11 @@
 SWITCH_DECLARE(int) switch_core_db_exec(switch_core_db_t *db, const char *sql, switch_core_db_callback_func_t callback, void *data, char **errmsg)
 {
 	int ret = 0;
-	int sane = 100;
+	int sane = 300;
 	char *err = NULL;
 
 	while (--sane > 0) {
 		ret = sqlite3_exec(db, sql, callback, data, &err);
-
 		if (ret == SQLITE_BUSY || ret == SQLITE_LOCKED) {
 			if (sane > 1) {
 				switch_safe_free(err);
@@ -179,22 +178,6 @@
 	return sqlite3_changes(db);
 }
 
-SWITCH_DECLARE(char *) switch_mprintf(const char *zFormat, ...)
-{
-	va_list ap;
-	char *z;
-	va_start(ap, zFormat);
-	z = sqlite3_vmprintf(zFormat, ap);
-	va_end(ap);
-	return z;
-}
-
-SWITCH_DECLARE(char *) switch_vmprintf(const char *zFormat, va_list ap)
-{
-
-	return sqlite3_vmprintf(zFormat, ap);
-}
-
 SWITCH_DECLARE(switch_core_db_t *) switch_core_db_open_file(const char *filename)
 {
 	switch_core_db_t *db;
@@ -255,7 +238,7 @@
 		retries = 1000;
 	}
 
-again:
+  again:
 
 	while (begin_retries > 0) {
 		again = 0;
@@ -306,7 +289,7 @@
 		}
 	}
 
-done:
+  done:
 
 	switch_core_db_exec(db, "COMMIT", NULL, NULL, NULL);
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_directory.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_directory.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_directory.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_event_hook.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_event_hook.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_event_hook.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_file.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_file.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_file.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -52,7 +52,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Handle already open\n");
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	if (!fh->samplerate) {
 		if (!(fh->samplerate = rate)) {
 			fh->samplerate = 8000;
@@ -93,18 +93,18 @@
 
 			if (*p == '[' && *(p + 1) == *SWITCH_PATH_SEPARATOR) {
 				e = switch_find_end_paren(p, '[', ']');
-				
+
 				if (e) {
 					*e = '\0';
 					spool_path = p + 1;
 					fh->file_path = e + 1;
 				}
-			} 
-			
+			}
+
 			if (!spool_path) {
 				spool_path = switch_core_get_variable(SWITCH_AUDIO_SPOOL_PATH_VARIABLE);
 			}
-			
+
 			file_path = fh->file_path;
 		}
 
@@ -116,8 +116,8 @@
 		fh->file_path = switch_core_strdup(fh->memory_pool, file_path);
 	}
 
-	
 
+
 	if ((fh->file_interface = switch_loadable_module_get_file_interface(ext)) == 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid file format [%s] for [%s]!\n", ext, file_path);
 		switch_goto_status(SWITCH_STATUS_GENERR, fail);
@@ -127,13 +127,13 @@
 	fh->func = func;
 	fh->line = line;
 
-	
+
 	if (spool_path) {
 		char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
 		switch_uuid_t uuid;
 		switch_uuid_get(&uuid);
 		switch_uuid_format(uuid_str, &uuid);
-		
+
 		fh->spool_path = switch_core_sprintf(fh->memory_pool, "%s%s%s.%s", spool_path, SWITCH_PATH_SEPARATOR, uuid_str, ext);
 	}
 
@@ -159,8 +159,7 @@
 	}
 
 
-	if ((flags & SWITCH_FILE_FLAG_WRITE) && 
-		!is_stream && (status = switch_file_exists(file_path, fh->memory_pool)) != SWITCH_STATUS_SUCCESS) {
+	if ((flags & SWITCH_FILE_FLAG_WRITE) && !is_stream && (status = switch_file_exists(file_path, fh->memory_pool)) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "File [%s] not created!\n", file_path);
 		fh->file_interface->file_close(fh);
 		UNPROTECT_INTERFACE(fh->file_interface);
@@ -193,8 +192,8 @@
 	switch_set_flag(fh, SWITCH_FILE_OPEN);
 	return status;
 
- fail:
-	
+  fail:
+
 	if (switch_test_flag(fh, SWITCH_FILE_FLAG_FREE_POOL)) {
 		switch_core_destroy_memory_pool(&fh->memory_pool);
 	}
@@ -206,7 +205,7 @@
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	switch_size_t want, got, orig_len = *len;
-	
+
 	switch_assert(fh != NULL);
 	switch_assert(fh->file_interface != NULL);
 
@@ -214,23 +213,23 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
- top:
+  top:
 
 	if (fh->buffer && switch_buffer_inuse(fh->buffer) >= *len * 2) {
 		*len = switch_buffer_read(fh->buffer, data, orig_len * 2) / 2;
 		return SWITCH_STATUS_SUCCESS;
 	}
-	
+
 	if (switch_test_flag(fh, SWITCH_FILE_DONE)) {
 		switch_clear_flag(fh, SWITCH_FILE_DONE);
 		*len = 0;
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	want = *len;
 
- more:
-	
+  more:
+
 	if (fh->pre_buffer) {
 		switch_size_t rlen;
 		int asis = switch_test_flag(fh, SWITCH_FILE_NATIVE);
@@ -244,7 +243,7 @@
 				} else {
 					fh->samples_in += rlen;
 					if (fh->channels > 1) {
-						switch_mux_channels((int16_t *)fh->pre_buffer_data, rlen, fh->channels);
+						switch_mux_channels((int16_t *) fh->pre_buffer_data, rlen, fh->channels);
 					}
 					switch_buffer_write(fh->pre_buffer, fh->pre_buffer_data, asis ? rlen : rlen * 2);
 				}
@@ -253,10 +252,10 @@
 
 		rlen = switch_buffer_read(fh->pre_buffer, data, asis ? *len : *len * 2);
 		*len = asis ? rlen : rlen / 2;
-		
+
 		if (*len == 0) {
 			switch_set_flag(fh, SWITCH_FILE_DONE);
-            goto top;
+			goto top;
 		} else {
 			status = SWITCH_STATUS_SUCCESS;
 		}
@@ -271,14 +270,14 @@
 		fh->samples_in += *len;
 
 		if (fh->channels > 1) {
-			switch_mux_channels((int16_t *)data, *len, fh->channels);
+			switch_mux_channels((int16_t *) data, *len, fh->channels);
 		}
 
 	}
 
 
 	got = *len;
-	
+
 	if (!switch_test_flag(fh, SWITCH_FILE_NATIVE) && fh->native_rate != fh->samplerate) {
 		if (!fh->resampler) {
 			if (switch_resample_create(&fh->resampler,
@@ -288,8 +287,8 @@
 			}
 		}
 
-		switch_resample_process(fh->resampler, data, (uint32_t)*len);
-		
+		switch_resample_process(fh->resampler, data, (uint32_t) * len);
+
 		if (fh->resampler->to_len < want || fh->resampler->to_len > orig_len) {
 			if (!fh->buffer) {
 				int factor = fh->resampler->to_len * fh->samplerate / 1000;
@@ -316,10 +315,10 @@
 			memcpy(data, fh->resampler->to, fh->resampler->to_len * 2);
 			*len = fh->resampler->to_len;
 		}
-		
 
+
 	}
-	
+
 	return status;
 }
 
@@ -342,17 +341,16 @@
 	if (!switch_test_flag(fh, SWITCH_FILE_NATIVE) && fh->native_rate != fh->samplerate) {
 		if (!fh->resampler) {
 			if (switch_resample_create(&fh->resampler,
-									   fh->native_rate, 
-									   fh->samplerate, 
-									   (uint32_t) orig_len * 2 * fh->channels, 
-									   SWITCH_RESAMPLE_QUALITY, fh->channels) != SWITCH_STATUS_SUCCESS) {
+									   fh->native_rate,
+									   fh->samplerate,
+									   (uint32_t) orig_len * 2 * fh->channels, SWITCH_RESAMPLE_QUALITY, fh->channels) != SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Unable to create resampler!\n");
 				return SWITCH_STATUS_GENERR;
 			}
 		}
 
-		switch_resample_process(fh->resampler, data, (uint32_t)*len);
-		
+		switch_resample_process(fh->resampler, data, (uint32_t) * len);
+
 		if (fh->resampler->to_len > orig_len) {
 			if (!fh->dbuf) {
 				void *mem;
@@ -379,22 +377,24 @@
 		switch_size_t rlen, blen;
 		switch_status_t status = SWITCH_STATUS_SUCCESS;
 		int asis = switch_test_flag(fh, SWITCH_FILE_NATIVE);
-		
+
 		switch_buffer_write(fh->pre_buffer, data, (asis ? *len : *len * 2) * fh->channels);
 
 		rlen = switch_buffer_inuse(fh->pre_buffer);
 
 		if (rlen >= fh->pre_buffer_datalen) {
 			if ((blen = switch_buffer_read(fh->pre_buffer, fh->pre_buffer_data, fh->pre_buffer_datalen))) {
-				if (!asis) blen /= 2;
-				if (fh->channels > 1) blen /= fh->channels;
+				if (!asis)
+					blen /= 2;
+				if (fh->channels > 1)
+					blen /= fh->channels;
 				if ((status = fh->file_interface->file_write(fh, fh->pre_buffer_data, &blen)) != SWITCH_STATUS_SUCCESS) {
 					*len = 0;
 				}
 				fh->samples_out += blen;
 			}
 		}
-		
+
 		return status;
 	} else {
 		switch_status_t status;
@@ -478,7 +478,7 @@
 SWITCH_DECLARE(switch_status_t) switch_core_file_truncate(switch_file_handle_t *fh, int64_t offset)
 {
 	switch_status_t status;
-	
+
 	switch_assert(fh != NULL);
 	switch_assert(fh->file_interface != NULL);
 
@@ -490,7 +490,7 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if ((status=fh->file_interface->file_truncate(fh, offset)) == SWITCH_STATUS_SUCCESS) {
+	if ((status = fh->file_interface->file_truncate(fh, offset)) == SWITCH_STATUS_SUCCESS) {
 		if (fh->buffer) {
 			switch_buffer_zero(fh->buffer);
 		}
@@ -525,11 +525,13 @@
 			switch_size_t rlen, blen;
 			int asis = switch_test_flag(fh, SWITCH_FILE_NATIVE);
 
-			while((rlen = switch_buffer_inuse(fh->pre_buffer))) {
+			while ((rlen = switch_buffer_inuse(fh->pre_buffer))) {
 				if ((blen = switch_buffer_read(fh->pre_buffer, fh->pre_buffer_data, fh->pre_buffer_datalen))) {
-					if (!asis) blen /= 2;
-					if (fh->channels > 1) blen /= fh->channels;
-					
+					if (!asis)
+						blen /= 2;
+					if (fh->channels > 1)
+						blen /= fh->channels;
+
 					if (fh->file_interface->file_write(fh, fh->pre_buffer_data, &blen) != SWITCH_STATUS_SUCCESS) {
 						break;
 					}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_hash.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_hash.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_hash.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -57,7 +57,7 @@
 
 	sqlite3HashInit(&newhash->table, case_sensitive ? SQLITE_HASH_BINARY : SQLITE_HASH_STRING, 1);
 	*hash = newhash;
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_io.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_io.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_io.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -112,7 +112,8 @@
 
 	if (!(session->read_codec && session->read_codec->implementation && switch_core_codec_ready(session->read_codec))) {
 		if (switch_channel_test_flag(session->channel, CF_PROXY_MODE) || switch_channel_get_state(session->channel) == CS_HIBERNATE) {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "%s reading on a session with no media!\n", switch_channel_get_name(session->channel));
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "%s reading on a session with no media!\n",
+							  switch_channel_get_name(session->channel));
 			switch_cond_next();
 			*frame = &runtime.dummy_cng_frame;
 			return SWITCH_STATUS_SUCCESS;
@@ -128,7 +129,8 @@
 
 	if (switch_channel_down(session->channel)) {
 		*frame = NULL;
-		status = SWITCH_STATUS_FALSE; goto even_more_done;
+		status = SWITCH_STATUS_FALSE;
+		goto even_more_done;
 	}
 
 
@@ -140,8 +142,7 @@
 	if (session->read_codec && !session->track_id && session->track_duration) {
 		if (session->read_frame_count == 0) {
 			switch_event_t *event;
-			session->read_frame_count = (session->read_impl.actual_samples_per_second / 
-										 session->read_impl.samples_per_packet) * session->track_duration;
+			session->read_frame_count = (session->read_impl.actual_samples_per_second / session->read_impl.samples_per_packet) * session->track_duration;
 
 			switch_event_create(&event, SWITCH_EVENT_SESSION_HEARTBEAT);
 			switch_channel_event_set_data(session->channel, event);
@@ -168,12 +169,12 @@
 				}
 			}
 		}
-		
+
 		if (!SWITCH_READ_ACCEPTABLE(status) || !session->read_codec || !session->read_codec->mutex) {
 			*frame = NULL;
 			return SWITCH_STATUS_FALSE;
 		}
-		
+
 		switch_mutex_lock(session->codec_read_mutex);
 		switch_mutex_lock(session->read_codec->mutex);
 	}
@@ -271,10 +272,9 @@
 					switch_mutex_lock(session->resample_mutex);
 					status = switch_resample_create(&session->read_resampler,
 													read_frame->codec->implementation->actual_samples_per_second,
-													session->read_impl.actual_samples_per_second, 
-													session->read_impl.decoded_bytes_per_packet,
-													SWITCH_RESAMPLE_QUALITY, 1);
-					
+													session->read_impl.actual_samples_per_second,
+													session->read_impl.decoded_bytes_per_packet, SWITCH_RESAMPLE_QUALITY, 1);
+
 					switch_mutex_unlock(session->resample_mutex);
 
 					if (status != SWITCH_STATUS_SUCCESS) {
@@ -324,7 +324,8 @@
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec init error!\n");
 				goto done;
 			default:
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec %s decoder error!\n", session->read_codec->codec_interface->interface_name);
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec %s decoder error!\n",
+								  session->read_codec->codec_interface->interface_name);
 				goto done;
 			}
 		}
@@ -334,7 +335,7 @@
 			switch_bool_t ok = SWITCH_TRUE;
 			int prune = 0;
 			switch_thread_rwlock_rdlock(session->bug_rwlock);
-			
+
 			for (bp = session->bugs; bp; bp = bp->next) {
 				if (!switch_channel_test_flag(session->channel, CF_ANSWERED) && switch_core_media_bug_test_flag(bp, SMBF_ANSWER_REQ)) {
 					continue;
@@ -352,7 +353,7 @@
 					}
 					switch_mutex_unlock(bp->read_mutex);
 				}
-				
+
 				if (ok && switch_test_flag(bp, SMBF_READ_REPLACE)) {
 					do_bugs = 0;
 					if (bp->callback) {
@@ -363,13 +364,13 @@
 						}
 					}
 				}
-				
+
 				if ((bp->stop_time && bp->stop_time <= switch_epoch_time_now(NULL)) || ok == SWITCH_FALSE) {
 					switch_set_flag(bp, SMBF_PRUNE);
 					prune++;
 				}
-				
-				
+
+
 			}
 			switch_thread_rwlock_unlock(session->bug_rwlock);
 			if (prune) {
@@ -385,11 +386,11 @@
 			if (session->read_resampler) {
 				short *data = read_frame->data;
 				switch_mutex_lock(session->resample_mutex);
-				switch_resample_process(session->read_resampler, data, (int)read_frame->datalen / 2);
+				switch_resample_process(session->read_resampler, data, (int) read_frame->datalen / 2);
 				memcpy(data, session->read_resampler->to, session->read_resampler->to_len * 2);
 				read_frame->samples = session->read_resampler->to_len;
-                read_frame->datalen = session->read_resampler->to_len * 2;
-                read_frame->rate = session->read_resampler->to_rate;
+				read_frame->datalen = session->read_resampler->to_len * 2;
+				read_frame->rate = session->read_resampler->to_rate;
 				switch_mutex_unlock(session->resample_mutex);
 
 			}
@@ -399,7 +400,7 @@
 			} else {
 				if (!session->raw_read_buffer) {
 					switch_size_t bytes = session->read_impl.decoded_bytes_per_packet;
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Engaging Read Buffer at %u bytes vs %u\n", 
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Engaging Read Buffer at %u bytes vs %u\n",
 									  (uint32_t) bytes, (uint32_t) (*frame)->datalen);
 					switch_buffer_create_dynamic(&session->raw_read_buffer, bytes * SWITCH_BUFFER_BLOCK_FRAMES, bytes * SWITCH_BUFFER_START_FRAMES, 0);
 				}
@@ -468,8 +469,8 @@
 				case SWITCH_STATUS_NOT_INITALIZED:
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec init error!\n");
 					*frame = NULL;
-                    status = SWITCH_STATUS_GENERR;
-                    break;
+					status = SWITCH_STATUS_GENERR;
+					break;
 				default:
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec %s encoder error!\n",
 									  session->read_codec->codec_interface->interface_name);
@@ -518,7 +519,7 @@
 
 				if (ok == SWITCH_FALSE) {
 					switch_set_flag(bp, SMBF_PRUNE);
-                    prune++;
+					prune++;
 				}
 			}
 			switch_thread_rwlock_unlock(session->bug_rwlock);
@@ -581,7 +582,7 @@
 		}
 		return SWITCH_STATUS_SUCCESS;
 	}
-	
+
 	if (!(session->write_codec && switch_core_codec_ready(session->write_codec)) && !pass_cng) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s has no write codec.\n", switch_channel_get_name(session->channel));
 		return SWITCH_STATUS_FALSE;
@@ -602,19 +603,19 @@
 	switch_assert(frame->codec != NULL);
 	switch_assert(frame->codec->implementation != NULL);
 
-	switch_mutex_lock(session->codec_write_mutex);	
+	switch_mutex_lock(session->codec_write_mutex);
 
-	if (!(session->write_codec && session->write_codec->mutex && frame->codec) || 
+	if (!(session->write_codec && session->write_codec->mutex && frame->codec) ||
 		!switch_channel_ready(session->channel) || !switch_channel_media_ready(session->channel)) {
-		switch_mutex_unlock(session->codec_write_mutex);	
+		switch_mutex_unlock(session->codec_write_mutex);
 		return SWITCH_STATUS_FALSE;
 	}
 
 	switch_mutex_lock(session->write_codec->mutex);
 	switch_mutex_lock(frame->codec->mutex);
-	
+
 	if ((session->write_codec && frame->codec && session->write_codec->implementation != frame->codec->implementation)) {
-		if (session->write_impl.codec_id == frame->codec->implementation->codec_id || 
+		if (session->write_impl.codec_id == frame->codec->implementation->codec_id ||
 			session->write_impl.microseconds_per_packet != frame->codec->implementation->microseconds_per_packet) {
 			ptime_mismatch = TRUE;
 			if (switch_test_flag(frame->codec, SWITCH_CODEC_FLAG_PASSTHROUGH) || switch_test_flag(session->read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH)) {
@@ -646,11 +647,11 @@
 	}
 
 	if (!switch_test_flag(session, SSF_WARN_TRANSCODE)) {
-			switch_core_session_message_t msg = { 0 };
+		switch_core_session_message_t msg = { 0 };
 
-			msg.message_id = SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY;
-			switch_core_session_receive_message(session, &msg);
-			switch_set_flag(session, SSF_WARN_TRANSCODE);
+		msg.message_id = SWITCH_MESSAGE_INDICATE_TRANSCODING_NECESSARY;
+		switch_core_session_receive_message(session, &msg);
+		switch_set_flag(session, SSF_WARN_TRANSCODE);
 	}
 
 	if (frame->codec) {
@@ -661,10 +662,10 @@
 										  frame->datalen,
 										  session->write_impl.actual_samples_per_second,
 										  session->raw_write_frame.data, &session->raw_write_frame.datalen, &session->raw_write_frame.rate, &flag);
-		
-		
-		
 
+
+
+
 		if (do_resample && status == SWITCH_STATUS_SUCCESS) {
 			status = SWITCH_STATUS_RESAMPLE;
 		}
@@ -678,11 +679,10 @@
 				switch_mutex_lock(session->resample_mutex);
 				status = switch_resample_create(&session->write_resampler,
 												frame->codec->implementation->actual_samples_per_second,
-												session->write_impl.actual_samples_per_second, 
-												session->write_impl.decoded_bytes_per_packet,
-												SWITCH_RESAMPLE_QUALITY, 1);
-												
-				
+												session->write_impl.actual_samples_per_second,
+												session->write_impl.decoded_bytes_per_packet, SWITCH_RESAMPLE_QUALITY, 1);
+
+
 				switch_mutex_unlock(session->resample_mutex);
 				if (status != SWITCH_STATUS_SUCCESS) {
 					goto done;
@@ -700,7 +700,8 @@
 			write_frame = &session->raw_write_frame;
 			break;
 		case SWITCH_STATUS_BREAK:
-			status = SWITCH_STATUS_SUCCESS; goto error;
+			status = SWITCH_STATUS_SUCCESS;
+			goto error;
 		case SWITCH_STATUS_NOOP:
 			if (session->write_resampler) {
 				switch_mutex_lock(session->resample_mutex);
@@ -718,39 +719,41 @@
 			}
 			if (ptime_mismatch) {
 				status = perform_write(session, frame, flags, stream_id);
-				status = SWITCH_STATUS_SUCCESS; goto error;
+				status = SWITCH_STATUS_SUCCESS;
+				goto error;
 			}
-				
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec %s decoder error!\n", frame->codec->codec_interface->interface_name);
+
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec %s decoder error!\n",
+							  frame->codec->codec_interface->interface_name);
 			goto error;
 		}
 	}
 
-	
 
+
 	if (session->write_resampler) {
 		short *data = write_frame->data;
 
 		switch_mutex_lock(session->resample_mutex);
 		if (session->write_resampler) {
-			
+
 			switch_resample_process(session->write_resampler, data, write_frame->datalen / 2);
-			
+
 			memcpy(data, session->write_resampler->to, session->write_resampler->to_len * 2);
-			
+
 			write_frame->samples = session->write_resampler->to_len;
-			
+
 			write_frame->datalen = write_frame->samples * 2;
-			
+
 			write_frame->rate = session->write_resampler->to_rate;
-			
+
 			did_write_resample = 1;
 		}
 		switch_mutex_unlock(session->resample_mutex);
 	}
 
-	
 
+
 	if (session->bugs && !switch_channel_test_flag(session->channel, CF_PAUSE_BUGS)) {
 		switch_media_bug_t *bp;
 		int prune = 0;
@@ -820,10 +823,10 @@
 			perfect = TRUE;
 		}
 
-		
 
+
 		if (perfect) {
-			
+
 			if (write_frame->datalen < session->write_impl.decoded_bytes_per_packet) {
 				memset(write_frame->data, 255, session->write_impl.decoded_bytes_per_packet - write_frame->datalen);
 				write_frame->datalen = session->write_impl.decoded_bytes_per_packet;
@@ -840,8 +843,8 @@
 											  session->enc_write_frame.data, &session->enc_write_frame.datalen, &session->enc_write_frame.rate, &flag);
 
 
-			
 
+
 			switch (status) {
 			case SWITCH_STATUS_RESAMPLE:
 				resample++;
@@ -874,7 +877,7 @@
 			case SWITCH_STATUS_NOT_INITALIZED:
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec init error!\n");
 				write_frame = NULL;
-				goto error;					
+				goto error;
 			default:
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec %s encoder error!\n",
 								  session->read_codec->codec_interface->interface_name);
@@ -900,15 +903,16 @@
 					goto error;
 				}
 			}
-			
+
 			if (!(switch_buffer_write(session->raw_write_buffer, write_frame->data, write_frame->datalen))) {
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Write Buffer %u bytes Failed!\n", write_frame->datalen);
-				status = SWITCH_STATUS_MEMERR; goto error;
+				status = SWITCH_STATUS_MEMERR;
+				goto error;
 			}
-			
+
 			status = SWITCH_STATUS_SUCCESS;
 
-			while(switch_buffer_inuse(session->raw_write_buffer) >= session->write_impl.decoded_bytes_per_packet) {
+			while (switch_buffer_inuse(session->raw_write_buffer) >= session->write_impl.decoded_bytes_per_packet) {
 				int rate;
 
 				if (switch_channel_down(session->channel) || !session->raw_write_buffer) {
@@ -918,29 +922,27 @@
 					 switch_buffer_read(session->raw_write_buffer, session->raw_write_frame.data, session->write_impl.decoded_bytes_per_packet)) == 0) {
 					goto error;
 				}
-				
+
 				enc_frame = &session->raw_write_frame;
 				session->raw_write_frame.rate = session->write_impl.actual_samples_per_second;
 				session->enc_write_frame.datalen = session->enc_write_frame.buflen;
 				session->enc_write_frame.timestamp = 0;
-				
-				
+
+
 				if (frame->codec && frame->codec->implementation && switch_core_codec_ready(frame->codec)) {
 					rate = frame->codec->implementation->actual_samples_per_second;
 				} else {
 					rate = session->write_impl.actual_samples_per_second;
 				}
-						
+
 				status = switch_core_codec_encode(session->write_codec,
 												  frame->codec,
 												  enc_frame->data,
 												  enc_frame->datalen,
 												  rate,
-												  session->enc_write_frame.data,
-												  &session->enc_write_frame.datalen, 
-												  &session->enc_write_frame.rate, &flag);
+												  session->enc_write_frame.data, &session->enc_write_frame.datalen, &session->enc_write_frame.rate, &flag);
 
-				
+
 				switch (status) {
 				case SWITCH_STATUS_RESAMPLE:
 					resample++;
@@ -955,14 +957,13 @@
 						if (!session->write_resampler) {
 							status = switch_resample_create(&session->write_resampler,
 															frame->codec->implementation->actual_samples_per_second,
-															session->write_impl.actual_samples_per_second, 
-															session->write_impl.decoded_bytes_per_packet,
-															SWITCH_RESAMPLE_QUALITY, 1);
+															session->write_impl.actual_samples_per_second,
+															session->write_impl.decoded_bytes_per_packet, SWITCH_RESAMPLE_QUALITY, 1);
 						}
 						switch_mutex_unlock(session->resample_mutex);
 
-								
 
+
 						if (status != SWITCH_STATUS_SUCCESS) {
 							goto done;
 						}
@@ -1021,7 +1022,7 @@
 				if (flag & SFF_CNG) {
 					switch_set_flag(write_frame, SFF_CNG);
 				}
-						
+
 				if (ptime_mismatch || resample) {
 					write_frame->timestamp = 0;
 				}
@@ -1031,27 +1032,27 @@
 				}
 
 			}
-			
+
 			goto error;
 		}
 	}
-		
 
 
 
-	
- done:
 
+
+  done:
+
 	if (ptime_mismatch || resample) {
 		write_frame->timestamp = 0;
 	}
 
 	if (do_write) {
-		status = perform_write(session, write_frame, flags, stream_id);		
+		status = perform_write(session, write_frame, flags, stream_id);
 	}
-	
- error:
 
+  error:
+
 	switch_mutex_unlock(session->write_codec->mutex);
 	switch_mutex_unlock(frame->codec->mutex);
 	switch_mutex_unlock(session->codec_write_mutex);
@@ -1073,8 +1074,8 @@
 	switch_io_event_hook_kill_channel_t *ptr;
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
-	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_core_session_get_uuid(session), SWITCH_LOG_DEBUG, "Send signal %s [%s]\n", switch_channel_get_name(session->channel),
-					  SIG_NAMES[sig]);
+	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_core_session_get_uuid(session), SWITCH_LOG_DEBUG, "Send signal %s [%s]\n",
+					  switch_channel_get_name(session->channel), SIG_NAMES[sig]);
 
 	if (session->endpoint_interface->io_routines->kill_channel) {
 		if ((status = session->endpoint_interface->io_routines->kill_channel(session, sig)) == SWITCH_STATUS_SUCCESS) {
@@ -1230,7 +1231,7 @@
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s send dtmf\ndigit=%c ms=%u samples=%u\n",
 									  switch_channel_get_name(session->channel), dtmf.digit, dur, dtmf.duration);
 					sent++;
-					dur_total += dtmf.duration + 2000; /* account for 250ms pause */
+					dur_total += dtmf.duration + 2000;	/* account for 250ms pause */
 				}
 			}
 		}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_media_bug.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_media_bug.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_media_bug.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -61,6 +61,16 @@
 	return switch_test_flag(bug, flag);
 }
 
+SWITCH_DECLARE(uint32_t) switch_core_media_bug_set_flag(switch_media_bug_t *bug, uint32_t flag)
+{
+	return switch_set_flag(bug, flag);
+}
+
+SWITCH_DECLARE(uint32_t) switch_core_media_bug_clear_flag(switch_media_bug_t *bug, uint32_t flag)
+{
+	return switch_clear_flag(bug, flag);
+}
+
 SWITCH_DECLARE(switch_core_session_t *) switch_core_media_bug_get_session(switch_media_bug_t *bug)
 {
 	return bug->session;
@@ -129,7 +139,7 @@
 	size_t rlen = 0;
 	size_t wlen = 0;
 	uint32_t blen;
-	switch_codec_implementation_t read_impl = {0};
+	switch_codec_implementation_t read_impl = { 0 };
 	int16_t *tp;
 
 	switch_core_session_get_read_impl(bug->session, &read_impl);
@@ -137,12 +147,14 @@
 	bytes = read_impl.decoded_bytes_per_packet;
 
 	if (frame->buflen < bytes) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_ERROR, "%s frame buffer too small!\n", switch_channel_get_name(bug->session->channel));
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_ERROR, "%s frame buffer too small!\n",
+						  switch_channel_get_name(bug->session->channel));
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	if (!(bug->raw_read_buffer && (bug->raw_write_buffer || !switch_test_flag(bug, SMBF_WRITE_STREAM)))) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_ERROR, "%s Buffer Error\n", switch_channel_get_name(bug->session->channel));
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_ERROR, "%s Buffer Error\n",
+						  switch_channel_get_name(bug->session->channel));
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -157,14 +169,14 @@
 	frame->datalen = (uint32_t) switch_buffer_read(bug->raw_read_buffer, frame->data, bytes);
 	ttl += frame->datalen;
 	switch_mutex_unlock(bug->read_mutex);
-	
+
 	if (switch_test_flag(bug, SMBF_WRITE_STREAM)) {
 		switch_assert(bug->raw_write_buffer);
 		switch_mutex_lock(bug->write_mutex);
 		datalen = (uint32_t) switch_buffer_read(bug->raw_write_buffer, bug->data, bytes);
 		ttl += datalen;
 		if (fill && datalen < bytes) {
-			memset(((unsigned char *)bug->data) + datalen, 0, bytes - datalen);
+			memset(((unsigned char *) bug->data) + datalen, 0, bytes - datalen);
 			datalen = bytes;
 		}
 		switch_mutex_unlock(bug->write_mutex);
@@ -184,7 +196,7 @@
 		frame->codec = NULL;
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	if (switch_test_flag(bug, SMBF_STEREO)) {
 		for (x = 0; x < blen; x++) {
 			if (x < rlen) {
@@ -204,10 +216,10 @@
 			int32_t z = 0;
 
 			if (x < rlen) {
-				z += (int32_t) *(fp + x);
+				z += (int32_t) * (fp + x);
 			}
 			if (x < wlen) {
-				z += (int32_t) *(dp + x);
+				z += (int32_t) * (dp + x);
 			}
 			switch_normalize_to_16bit(z);
 			*(fp + x) = (int16_t) z / 2;
@@ -222,7 +234,7 @@
 	frame->samples = bytes / sizeof(int16_t);
 	frame->rate = read_impl.actual_samples_per_second;
 	frame->codec = NULL;
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -233,8 +245,8 @@
 {
 	switch_media_bug_t *bug;	//, *bp;
 	switch_size_t bytes;
-	switch_codec_implementation_t read_impl = {0};
-	switch_codec_implementation_t write_impl = {0};
+	switch_codec_implementation_t read_impl = { 0 };
+	switch_codec_implementation_t write_impl = { 0 };
 	const char *p;
 
 	if (!switch_channel_media_ready(session->channel)) {
@@ -252,7 +264,6 @@
 	if ((p = switch_channel_get_variable(session->channel, "media_bug_answer_req")) && switch_true(p)) {
 		flags |= SMBF_ANSWER_REQ;
 	}
-
 #if 0
 	if (flags & SMBF_WRITE_REPLACE) {
 		switch_thread_rwlock_wrlock(session->bug_rwlock);
@@ -315,7 +326,8 @@
 		switch_bool_t result = bug->callback(bug, bug->user_data, SWITCH_ABC_TYPE_INIT);
 		if (result == SWITCH_FALSE) {
 			switch_core_media_bug_destroy(bug);
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error attaching BUG to %s\n", switch_channel_get_name(session->channel));
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error attaching BUG to %s\n",
+							  switch_channel_get_name(session->channel));
 			return SWITCH_STATUS_GENERR;
 		}
 	}
@@ -395,7 +407,8 @@
 			bp->ready = 0;
 		}
 		switch_core_media_bug_destroy(bp);
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(*bug)), SWITCH_LOG_DEBUG, "Removing BUG from %s\n", switch_channel_get_name(bp->session->channel));
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(*bug)), SWITCH_LOG_DEBUG, "Removing BUG from %s\n",
+						  switch_channel_get_name(bp->session->channel));
 		*bug = NULL;
 		return SWITCH_STATUS_SUCCESS;
 	}
@@ -427,7 +440,7 @@
 			status = switch_core_media_bug_close(&bp);
 		}
 	}
-	
+
 	if (!session->bugs && switch_core_codec_ready(&session->bug_codec)) {
 		switch_core_codec_destroy(&session->bug_codec);
 		memset(&session->bug_codec, 0, sizeof(session->bug_codec));
@@ -444,7 +457,7 @@
 	int ttl = 0;
 
 
- top:
+  top:
 
 	if (session->bugs) {
 		switch_thread_rwlock_wrlock(session->bug_rwlock);
@@ -467,7 +480,7 @@
 			goto top;
 		}
 	}
-	
+
 	if (!session->bugs && switch_core_codec_ready(&session->bug_codec)) {
 		switch_core_codec_destroy(&session->bug_codec);
 		memset(&session->bug_codec, 0, sizeof(session->bug_codec));
@@ -484,7 +497,7 @@
 
 	if (session->bugs) {
 		switch_thread_rwlock_wrlock(session->bug_rwlock);
-		
+
 		bp = session->bugs;
 		while (bp) {
 			cur = bp;
@@ -505,7 +518,7 @@
 		}
 		switch_thread_rwlock_unlock(session->bug_rwlock);
 	}
-	
+
 	if (!session->bugs && switch_core_codec_ready(&session->bug_codec)) {
 		switch_core_codec_destroy(&session->bug_codec);
 		memset(&session->bug_codec, 0, sizeof(session->bug_codec));

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_memory.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_memory.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_memory.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -80,7 +80,8 @@
 
 #ifdef DEBUG_ALLOC
 	if (memory > 500)
-		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_core_session_get_uuid(session), SWITCH_LOG_CONSOLE, "Session Allocate %d\n", (int) memory);
+		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_core_session_get_uuid(session), SWITCH_LOG_CONSOLE, "Session Allocate %d\n",
+						  (int) memory);
 #endif
 
 	ptr = apr_palloc(session->pool, memory);
@@ -142,7 +143,6 @@
 	if (zstr(todup)) {
 		return SWITCH_BLANK_STRING;
 	}
-
 #ifdef LOCK_MORE
 #ifdef USE_MEM_LOCK
 	switch_mutex_lock(memory_manager.mem_lock);
@@ -171,32 +171,20 @@
 	va_list ap;
 	char *result = NULL;
 
-#ifdef LOCK_MORE
-#ifdef USE_MEM_LOCK
-	switch_mutex_lock(memory_manager.mem_lock);
-#endif
-#endif
-
-	switch_assert(session != NULL);
-	switch_assert(session->pool != NULL);
 	va_start(ap, fmt);
-
-	result = apr_pvsprintf(session->pool, fmt, ap);
-	switch_assert(result != NULL);
+	result = switch_core_vsprintf(session->pool, fmt, ap);
 	va_end(ap);
 
-#ifdef LOCK_MORE
-#ifdef USE_MEM_LOCK
-	switch_mutex_unlock(memory_manager.mem_lock);
-#endif
-#endif
-
 	return result;
 }
 
-SWITCH_DECLARE(char *) switch_core_sprintf(switch_memory_pool_t *pool, const char *fmt, ...)
+SWITCH_DECLARE(char *) switch_core_session_vsprintf(switch_core_session_t *session, const char *fmt, va_list ap)
 {
-	va_list ap;
+	return switch_core_vsprintf(session->pool, fmt, ap);
+}
+
+SWITCH_DECLARE(char *) switch_core_vsprintf(switch_memory_pool_t *pool, const char *fmt, va_list ap)
+{
 	char *result = NULL;
 
 	switch_assert(pool != NULL);
@@ -207,11 +195,8 @@
 #endif
 #endif
 
-	va_start(ap, fmt);
-
 	result = apr_pvsprintf(pool, fmt, ap);
 	switch_assert(result != NULL);
-	va_end(ap);
 
 #ifdef LOCK_MORE
 #ifdef USE_MEM_LOCK
@@ -222,6 +207,17 @@
 	return result;
 }
 
+SWITCH_DECLARE(char *) switch_core_sprintf(switch_memory_pool_t *pool, const char *fmt, ...)
+{
+	va_list ap;
+	char *result;
+	va_start(ap, fmt);
+	result = switch_core_vsprintf(pool, fmt, ap);
+	va_end(ap);
+
+	return result;
+}
+
 SWITCH_DECLARE(char *) switch_core_perform_session_strdup(switch_core_session_t *session, const char *todup, const char *file, const char *func, int line)
 {
 	char *duped = NULL;
@@ -238,7 +234,6 @@
 	if (zstr(todup)) {
 		return SWITCH_BLANK_STRING;
 	}
-
 #ifdef LOCK_MORE
 #ifdef USE_MEM_LOCK
 	switch_mutex_lock(memory_manager.mem_lock);
@@ -246,16 +241,17 @@
 #endif
 
 
-	
+
 #ifdef DEBUG_ALLOC
 	len = strlen(todup);
 	if (len > 500)
-		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_core_session_get_uuid(session), SWITCH_LOG_CONSOLE, "Sess Strdup Allocate %d\n", (int) len);
+		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_core_session_get_uuid(session), SWITCH_LOG_CONSOLE, "Sess Strdup Allocate %d\n",
+						  (int) len);
 #endif
 
 	duped = apr_pstrdup(session->pool, todup);
 	switch_assert(duped != NULL);
-	
+
 #ifdef LOCK_MORE
 #ifdef USE_MEM_LOCK
 	switch_mutex_unlock(memory_manager.mem_lock);
@@ -278,7 +274,6 @@
 	if (zstr(todup)) {
 		return SWITCH_BLANK_STRING;
 	}
-
 #ifdef LOCK_MORE
 #ifdef USE_MEM_LOCK
 	switch_mutex_lock(memory_manager.mem_lock);
@@ -366,7 +361,7 @@
 		apr_allocator_owner_set(my_allocator, *pool);
 
 		apr_pool_mutex_set(*pool, my_mutex);
-		
+
 #else
 		apr_pool_create(pool, NULL);
 		switch_assert(*pool != NULL);
@@ -394,7 +389,6 @@
 	if (switch_core_memory_pool_get_data(*pool, "_in_thread")) {
 		switch_cache_db_detach();
 	}
-
 #ifdef DEBUG_ALLOC2
 	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "Free Pool\n");
 #endif
@@ -410,11 +404,11 @@
 #else
 	if ((memory_manager.pool_thread_running != 1) || (switch_queue_push(memory_manager.pool_queue, *pool) != SWITCH_STATUS_SUCCESS)) {
 #ifdef USE_MEM_LOCK
-	switch_mutex_lock(memory_manager.mem_lock);
+		switch_mutex_lock(memory_manager.mem_lock);
 #endif
 		apr_pool_destroy(*pool);
 #ifdef USE_MEM_LOCK
-	switch_mutex_unlock(memory_manager.mem_lock);
+		switch_mutex_unlock(memory_manager.mem_lock);
 #endif
 	}
 #endif
@@ -469,11 +463,11 @@
 			break;
 		}
 #ifdef USE_MEM_LOCK
-	switch_mutex_lock(memory_manager.mem_lock);
+		switch_mutex_lock(memory_manager.mem_lock);
 #endif
 		apr_pool_destroy(pool);
 #ifdef USE_MEM_LOCK
-	switch_mutex_unlock(memory_manager.mem_lock);
+		switch_mutex_unlock(memory_manager.mem_lock);
 #endif
 	}
 #endif
@@ -500,20 +494,19 @@
 					done = 1;
 					break;
 				}
-
 #if defined(PER_POOL_LOCK) || defined(DESTROY_POOLS)
 #ifdef USE_MEM_LOCK
-	switch_mutex_lock(memory_manager.mem_lock);
+				switch_mutex_lock(memory_manager.mem_lock);
 #endif
 				apr_pool_destroy(pop);
 #ifdef USE_MEM_LOCK
-	switch_mutex_unlock(memory_manager.mem_lock);
+				switch_mutex_unlock(memory_manager.mem_lock);
 #endif
 #else
 				apr_pool_clear(pop);
 				if (switch_queue_trypush(memory_manager.pool_recycle_queue, pop) != SWITCH_STATUS_SUCCESS) {
 #ifdef USE_MEM_LOCK
-	switch_mutex_lock(memory_manager.mem_lock);
+					switch_mutex_lock(memory_manager.mem_lock);
 #endif
 					apr_pool_destroy(pop);
 #ifdef USE_MEM_LOCK
@@ -542,7 +535,7 @@
 		void *pop = NULL;
 		while (switch_queue_trypop(memory_manager.pool_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
 #ifdef USE_MEM_LOCK
-	switch_mutex_lock(memory_manager.mem_lock);
+			switch_mutex_lock(memory_manager.mem_lock);
 #endif
 			apr_pool_destroy(pop);
 			pop = NULL;
@@ -617,7 +610,7 @@
 #ifdef INSTANTLY_DESTROY_POOLS
 	{
 		void *foo;
-		foo = (void*)(intptr_t)pool_thread;
+		foo = (void *) (intptr_t) pool_thread;
 	}
 #else
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_port_allocator.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_port_allocator.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_port_allocator.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -118,23 +118,22 @@
 	int odd = switch_test_flag(alloc, SPF_ODD);
 
 	switch_mutex_lock(alloc->mutex);
-	srand((unsigned)((unsigned)(intptr_t)port_ptr + (unsigned)(intptr_t)switch_thread_self() + switch_micro_time_now()));
+	srand((unsigned) ((unsigned) (intptr_t) port_ptr + (unsigned) (intptr_t) switch_thread_self() + switch_micro_time_now()));
 
 	while (alloc->track_used < alloc->track_len) {
 		uint32_t index;
 		uint32_t tries = 0;
-		
+
 		/* randomly pick a port */
 		index = rand() % alloc->track_len;
 
 		/* if it is used walk up the list to find a free one */
-		while (alloc->track[index] && tries < alloc->track_len)
-		{
+		while (alloc->track[index] && tries < alloc->track_len) {
 			tries++;
 			if (alloc->track[index] < 0) {
 				alloc->track[index]++;
 			}
-			if (++index >= alloc->track_len) { 
+			if (++index >= alloc->track_len) {
 				index = 0;
 			}
 		}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_rwlock.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_rwlock.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_rwlock.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -47,7 +47,17 @@
 	if (session->rwlock) {
 		if (switch_test_flag(session, SSF_DESTROYED) || switch_channel_down(session->channel)) {
 			status = SWITCH_STATUS_FALSE;
+			if (switch_thread_rwlock_tryrdlock(session->rwlock) == SWITCH_STATUS_SUCCESS) {
+				if (switch_channel_test_flag(session->channel, CF_THREAD_SLEEPING)) {
 #ifdef SWITCH_DEBUG_RWLOCKS
+					switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_core_session_get_uuid(session), SWITCH_LOG_ERROR, "%s Ping thread\n",
+									  switch_channel_get_name(session->channel));
+#endif
+					switch_core_session_wake_session_thread(session);
+				}
+				switch_thread_rwlock_unlock(session->rwlock);
+			}
+#ifdef SWITCH_DEBUG_RWLOCKS
 			switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_core_session_get_uuid(session), SWITCH_LOG_ERROR, "%s Read lock FAIL\n",
 							  switch_channel_get_name(session->channel));
 #endif

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_session.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_session.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_session.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -36,13 +36,7 @@
 #include "switch_core.h"
 #include "private/switch_core_pvt.h"
 
-static struct {
-	switch_memory_pool_t *memory_pool;
-	switch_hash_t *session_table;
-	uint32_t session_count;
-	uint32_t session_limit;
-	switch_size_t session_id;
-} session_manager;
+struct switch_session_manager session_manager;
 
 #ifdef SWITCH_DEBUG_RWLOCKS
 SWITCH_DECLARE(switch_core_session_t *) switch_core_session_perform_locate(const char *uuid_str, const char *file, const char *func, int line)
@@ -86,7 +80,7 @@
 {
 	switch_core_session_t *session = NULL;
 	switch_status_t status;
-	
+
 	if (uuid_str) {
 		switch_mutex_lock(runtime.session_hash_mutex);
 		if ((session = switch_core_hash_find(session_manager.session_table, uuid_str))) {
@@ -122,7 +116,7 @@
 SWITCH_DECLARE(switch_status_t) switch_core_session_get_partner(switch_core_session_t *session, switch_core_session_t **partner)
 {
 	const char *uuid;
-	
+
 	if ((uuid = switch_channel_get_variable(session->channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
 		if ((*partner = switch_core_session_locate(uuid))) {
 			return SWITCH_STATUS_SUCCESS;
@@ -142,11 +136,12 @@
 	switch_memory_pool_t *pool;
 	switch_queue_t *queue;
 	void *pop;
-	
+
 	switch_core_new_memory_pool(&pool);
 	switch_queue_create(&queue, 250000, pool);
 
-	if (!var_val) return;
+	if (!var_val)
+		return;
 
 	switch_mutex_lock(runtime.session_hash_mutex);
 	for (hi = switch_hash_first(NULL, session_manager.session_table); hi; hi = switch_hash_next(hi)) {
@@ -165,9 +160,9 @@
 	}
 	switch_mutex_unlock(runtime.session_hash_mutex);
 
-	while(switch_queue_trypop(queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
+	while (switch_queue_trypop(queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
 		char *uuid = (char *) pop;
-		
+
 		if ((session = switch_core_session_locate(uuid))) {
 			switch_channel_hangup(session->channel, cause);
 			switch_core_session_rwunlock(session);
@@ -176,7 +171,7 @@
 
 	switch_core_destroy_memory_pool(&pool);
 
-}	
+}
 
 SWITCH_DECLARE(void) switch_core_session_hupall_endpoint(const switch_endpoint_interface_t *endpoint_interface, switch_call_cause_t cause)
 {
@@ -186,7 +181,7 @@
 	switch_memory_pool_t *pool;
 	switch_queue_t *queue;
 	void *pop;
-	
+
 	switch_core_new_memory_pool(&pool);
 	switch_queue_create(&queue, 250000, pool);
 
@@ -205,9 +200,9 @@
 	}
 	switch_mutex_unlock(runtime.session_hash_mutex);
 
-	while(switch_queue_trypop(queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
+	while (switch_queue_trypop(queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
 		char *uuid = (char *) pop;
-		
+
 		if ((session = switch_core_session_locate(uuid))) {
 			switch_channel_hangup(session->channel, cause);
 			switch_core_session_rwunlock(session);
@@ -216,7 +211,7 @@
 
 	switch_core_destroy_memory_pool(&pool);
 
-}	
+}
 
 SWITCH_DECLARE(void) switch_core_session_hupall(switch_call_cause_t cause)
 {
@@ -226,7 +221,7 @@
 	switch_memory_pool_t *pool;
 	switch_queue_t *queue;
 	void *pop;
-	
+
 	switch_core_new_memory_pool(&pool);
 	switch_queue_create(&queue, 250000, pool);
 
@@ -242,10 +237,10 @@
 		}
 	}
 	switch_mutex_unlock(runtime.session_hash_mutex);
-	
-	while(switch_queue_trypop(queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
+
+	while (switch_queue_trypop(queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
 		char *uuid = (char *) pop;
-		
+
 		if ((session = switch_core_session_locate(uuid))) {
 			switch_channel_hangup(session->channel, cause);
 			switch_core_session_rwunlock(session);
@@ -253,10 +248,10 @@
 	}
 
 	switch_core_destroy_memory_pool(&pool);
-	
+
 }
 
- 
+
 SWITCH_DECLARE(switch_status_t) switch_core_session_message_send(const char *uuid_str, switch_core_session_message_t *message)
 {
 	switch_core_session_t *session = NULL;
@@ -303,8 +298,8 @@
 	switch_assert(session != NULL);
 	return session->private_info;
 }
- 
 
+
 SWITCH_DECLARE(switch_status_t) switch_core_session_set_private(switch_core_session_t *session, void *private_info)
 {
 	switch_assert(session != NULL);
@@ -346,9 +341,8 @@
 																		 const char *endpoint_name,
 																		 switch_caller_profile_t *caller_profile,
 																		 switch_core_session_t **new_session,
-																		 switch_memory_pool_t **pool, 
-																		 switch_originate_flag_t flags,
-																		 switch_call_cause_t *cancel_cause)
+																		 switch_memory_pool_t **pool,
+																		 switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
 {
 	switch_io_event_hook_outgoing_channel_t *ptr;
 	switch_status_t status = SWITCH_STATUS_FALSE;
@@ -384,7 +378,7 @@
 
 		if (caller_profile) {
 			const char *ecaller_id_name = NULL, *ecaller_id_number = NULL;
-			
+
 			if (!(flags & SOF_NO_EFFECTIVE_CID_NAME)) {
 				ecaller_id_name = switch_channel_get_variable(channel, "effective_caller_id_name");
 			}
@@ -410,7 +404,8 @@
 	}
 
 	if ((cause =
-		 endpoint_interface->io_routines->outgoing_channel(session, var_event, outgoing_profile, new_session, pool, flags, cancel_cause)) != SWITCH_CAUSE_SUCCESS) {
+		 endpoint_interface->io_routines->outgoing_channel(session, var_event, outgoing_profile, new_session, pool, flags,
+														   cancel_cause)) != SWITCH_CAUSE_SUCCESS) {
 		UNPROTECT_INTERFACE(endpoint_interface);
 		return cause;
 	}
@@ -424,8 +419,9 @@
 	}
 
 	if (!*new_session) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Outgoing method for endpoint: [%s] returned: [%s] but there is no new session!\n",
-						  endpoint_name, switch_channel_cause2str(cause));
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT,
+						  "Outgoing method for endpoint: [%s] returned: [%s] but there is no new session!\n", endpoint_name,
+						  switch_channel_cause2str(cause));
 		UNPROTECT_INTERFACE(endpoint_interface);
 		return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
 	} else {
@@ -437,17 +433,19 @@
 		switch_assert(peer_channel);
 
 		peer_profile = switch_channel_get_caller_profile(peer_channel);
-		
+
 		if ((use_uuid = switch_event_get_header(var_event, "origination_uuid"))) {
 			use_uuid = switch_core_session_strdup(*new_session, use_uuid);
 			if (switch_core_session_set_uuid(*new_session, use_uuid) == SWITCH_STATUS_SUCCESS) {
 				switch_event_del_header(var_event, "origination_uuid");
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG, "%s set UUID=%s\n", switch_channel_get_name(peer_channel), use_uuid);
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG, "%s set UUID=%s\n", switch_channel_get_name(peer_channel),
+								  use_uuid);
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_CRIT, "%s set UUID=%s FAILED\n", switch_channel_get_name(peer_channel), use_uuid);
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_CRIT, "%s set UUID=%s FAILED\n",
+								  switch_channel_get_name(peer_channel), use_uuid);
 			}
 		}
-		
+
 		if (channel) {
 			const char *val;
 			switch_codec_t *vid_read_codec = NULL, *read_codec = switch_core_session_get_read_codec(session);
@@ -461,12 +459,12 @@
 
 			if (read_codec && read_codec->implementation && switch_core_codec_ready(read_codec)) {
 				char rc[80] = "", vrc[80] = "", tmp[160] = "";
-				
+
 				switch_codec2str(read_codec, rc, sizeof(rc));
 				if (vid_read_codec && vid_read_codec->implementation && switch_core_codec_ready(vid_read_codec)) {
 					vrc[0] = ',';
-					switch_codec2str(read_codec, vrc+1, sizeof(vrc) - 1);
-					switch_channel_set_variable(peer_channel, SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE, vrc+1);
+					switch_codec2str(read_codec, vrc + 1, sizeof(vrc) - 1);
+					switch_channel_set_variable(peer_channel, SWITCH_ORIGINATOR_VIDEO_CODEC_VARIABLE, vrc + 1);
 				}
 
 				switch_snprintf(tmp, sizeof(tmp), "%s%s", rc, vrc);
@@ -487,11 +485,10 @@
 
 			if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
 				if (switch_channel_test_cap(peer_channel, CC_BYPASS_MEDIA)) {
-					switch_channel_set_flag(peer_channel, CF_PROXY_MODE);		
+					switch_channel_set_flag(peer_channel, CF_PROXY_MODE);
 				} else {
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, 
-									  "%s does not support the proxy feature, disabling.\n", 
-									  switch_channel_get_name(peer_channel));
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
+									  "%s does not support the proxy feature, disabling.\n", switch_channel_get_name(peer_channel));
 					switch_channel_clear_flag(channel, CF_PROXY_MODE);
 				}
 			}
@@ -503,9 +500,8 @@
 						switch_channel_set_flag(peer_channel, CF_VIDEO);
 					}
 				} else {
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, 
-									  "%s does not support the proxy feature, disabling.\n", 
-									  switch_channel_get_name(peer_channel));
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
+									  "%s does not support the proxy feature, disabling.\n", switch_channel_get_name(peer_channel));
 					switch_channel_clear_flag(channel, CF_PROXY_MEDIA);
 				}
 			}
@@ -515,12 +511,6 @@
 					switch_channel_set_originator_caller_profile(peer_channel, cloned_profile);
 				}
 			}
-
-			if (peer_profile && !(flags & SOF_FORKED_DIAL)) {
-				if ((cloned_profile = switch_caller_profile_clone(session, peer_profile)) != 0) {
-					switch_channel_set_originatee_caller_profile(channel, cloned_profile);
-				}
-			}
 		}
 
 		if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_OUTGOING) == SWITCH_STATUS_SUCCESS) {
@@ -557,12 +547,15 @@
 	"AUDIO_SYNC",
 	"REQUEST_IMAGE_MEDIA",
 	"UUID_CHANGE",
-	"WARNING",
+	"SIMPLIFY",
 	"DEBUG_AUDIO",
+	"PROXY_MEDIA",
+	"APPLICATION_EXEC",
+	"APPLICATION_EXEC_COMPLETE",
 	"INVALID"
 };
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_perform_receive_message(switch_core_session_t *session, 
+SWITCH_DECLARE(switch_status_t) switch_core_session_perform_receive_message(switch_core_session_t *session,
 																			switch_core_session_message_t *message,
 																			const char *file, const char *func, int line)
 {
@@ -595,19 +588,19 @@
 		message->message_id = SWITCH_MESSAGE_INVALID;
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_ID_LOG, message->_file, message->_func, message->_line, 
-					  switch_core_session_get_uuid(session), SWITCH_LOG_DEBUG, "%s receive message [%s]\n",
+	switch_log_printf(SWITCH_CHANNEL_ID_LOG, message->_file, message->_func, message->_line,
+					  switch_core_session_get_uuid(session), SWITCH_LOG_DEBUG1, "%s receive message [%s]\n",
 					  switch_channel_get_name(session->channel), message_names[message->message_id]);
 
-	
-	if (message->message_id == SWITCH_MESSAGE_INDICATE_DISPLAY && 
+
+	if (message->message_id == SWITCH_MESSAGE_INDICATE_DISPLAY &&
 		switch_true(switch_channel_get_variable(session->channel, SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE))) {
 		switch_log_printf(SWITCH_CHANNEL_ID_LOG, message->_file, message->_func, message->_line,
-						  switch_core_session_get_uuid(session), SWITCH_LOG_DEBUG, "Ignoring display update.\n");
+						  switch_core_session_get_uuid(session), SWITCH_LOG_DEBUG1, "Ignoring display update.\n");
 		status = SWITCH_STATUS_SUCCESS;
 		goto end;
 	}
-	
+
 	if (session->endpoint_interface->io_routines->receive_message) {
 		status = session->endpoint_interface->io_routines->receive_message(session, message);
 	}
@@ -623,32 +616,32 @@
 	message->_file = NULL;
 	message->_func = NULL;
 	message->_line = 0;
-	
 
+
 	switch (message->message_id) {
-    case SWITCH_MESSAGE_REDIRECT_AUDIO:
-    case SWITCH_MESSAGE_INDICATE_ANSWER:
-    case SWITCH_MESSAGE_INDICATE_PROGRESS:
-    case SWITCH_MESSAGE_INDICATE_BRIDGE:
-    case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
-    case SWITCH_MESSAGE_INDICATE_TRANSFER:
-    case SWITCH_MESSAGE_INDICATE_RINGING:
-    case SWITCH_MESSAGE_INDICATE_MEDIA:
-    case SWITCH_MESSAGE_INDICATE_NOMEDIA:
-    case SWITCH_MESSAGE_INDICATE_HOLD:
-    case SWITCH_MESSAGE_INDICATE_UNHOLD:
-    case SWITCH_MESSAGE_INDICATE_REDIRECT:
-    case SWITCH_MESSAGE_INDICATE_RESPOND:
-    case SWITCH_MESSAGE_INDICATE_BROADCAST:
-    case SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT:
-    case SWITCH_MESSAGE_INDICATE_DEFLECT:
+	case SWITCH_MESSAGE_REDIRECT_AUDIO:
+	case SWITCH_MESSAGE_INDICATE_ANSWER:
+	case SWITCH_MESSAGE_INDICATE_PROGRESS:
+	case SWITCH_MESSAGE_INDICATE_BRIDGE:
+	case SWITCH_MESSAGE_INDICATE_UNBRIDGE:
+	case SWITCH_MESSAGE_INDICATE_TRANSFER:
+	case SWITCH_MESSAGE_INDICATE_RINGING:
+	case SWITCH_MESSAGE_INDICATE_MEDIA:
+	case SWITCH_MESSAGE_INDICATE_NOMEDIA:
+	case SWITCH_MESSAGE_INDICATE_HOLD:
+	case SWITCH_MESSAGE_INDICATE_UNHOLD:
+	case SWITCH_MESSAGE_INDICATE_REDIRECT:
+	case SWITCH_MESSAGE_INDICATE_RESPOND:
+	case SWITCH_MESSAGE_INDICATE_BROADCAST:
+	case SWITCH_MESSAGE_INDICATE_MEDIA_REDIRECT:
+	case SWITCH_MESSAGE_INDICATE_DEFLECT:
 		switch_core_session_kill_channel(session, SWITCH_SIG_BREAK);
 		break;
 	default:
 		break;
 	}
 
- end:
+  end:
 
 	switch_core_session_free_message(&message);
 	switch_core_session_rwunlock(session);
@@ -722,12 +715,12 @@
 	*message = NULL;
 
 	if (switch_test_flag(to_free, SCSMF_DYNAMIC)) {
-		s = (char *)to_free->string_arg;
+		s = (char *) to_free->string_arg;
 		switch_safe_free(s);
 		switch_safe_free(to_free->pointer_arg);
-		
+
 		for (i = 0; i < MESSAGE_STRING_ARG_MAX; i++) {
-			s = (char *)to_free->string_array_arg[i];
+			s = (char *) to_free->string_array_arg[i];
 			switch_safe_free(s);
 		}
 
@@ -847,15 +840,18 @@
 	return status;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_queue_private_event(switch_core_session_t *session, switch_event_t **event)
+SWITCH_DECLARE(switch_status_t) switch_core_session_queue_private_event(switch_core_session_t *session, switch_event_t **event, switch_bool_t priority)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
+	switch_queue_t *queue;
 
 	switch_assert(session != NULL);
 
 	if (session->private_event_queue) {
+		queue = priority ? session->private_event_queue_pri : session->private_event_queue;
+
 		(*event)->event_id = SWITCH_EVENT_PRIVATE_COMMAND;
-		if (switch_queue_trypush(session->private_event_queue, *event) == SWITCH_STATUS_SUCCESS) {
+		if (switch_queue_trypush(queue, *event) == SWITCH_STATUS_SUCCESS) {
 			*event = NULL;
 			switch_core_session_kill_channel(session, SWITCH_SIG_BREAK);
 			status = SWITCH_STATUS_SUCCESS;
@@ -865,15 +861,35 @@
 	return status;
 }
 
+#define check_media(session)											\
+	{																	\
+		if (switch_channel_test_flag(session->channel, CF_BROADCAST_DROP_MEDIA)) { \
+			switch_channel_clear_flag(session->channel, CF_BROADCAST_DROP_MEDIA); \
+			switch_ivr_nomedia(session->uuid_str, SMF_REBRIDGE);		\
+		}																\
+	}																	\
+
 SWITCH_DECLARE(uint32_t) switch_core_session_private_event_count(switch_core_session_t *session)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
+	uint32_t count = 0;
 
-	if (!switch_channel_test_flag(channel, CF_EVENT_LOCK) && session->private_event_queue) {
-		return switch_queue_size(session->private_event_queue);
+	if (session->private_event_queue) {
+
+		if (!switch_channel_test_flag(channel, CF_EVENT_LOCK)) {
+			count = switch_queue_size(session->private_event_queue);
+		}
+
+		if (!switch_channel_test_flag(channel, CF_EVENT_LOCK_PRI)) {
+			count += switch_queue_size(session->private_event_queue_pri);
+		}
+
+		if (count == 0) {
+			check_media(session);
+		}
 	}
 
-	return 0;
+	return count;
 }
 
 SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_private_event(switch_core_session_t *session, switch_event_t **event)
@@ -881,14 +897,27 @@
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	void *pop;
 	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_queue_t *queue;
 
-	if (switch_channel_test_flag(channel, CF_EVENT_LOCK)) {
-		return status;
-	}
+	if (session->private_event_queue) {
+		if (switch_queue_size(session->private_event_queue_pri)) {
+			queue = session->private_event_queue_pri;
 
-	if (session->private_event_queue) {
-		if ((status = (switch_status_t) switch_queue_trypop(session->private_event_queue, &pop)) == SWITCH_STATUS_SUCCESS) {
+			if (switch_channel_test_flag(channel, CF_EVENT_LOCK_PRI)) {
+				return SWITCH_STATUS_FALSE;
+			}
+		} else {
+			queue = session->private_event_queue;
+
+			if (switch_channel_test_flag(channel, CF_EVENT_LOCK)) {
+				return SWITCH_STATUS_FALSE;
+			}
+		}
+
+		if ((status = (switch_status_t) switch_queue_trypop(queue, &pop)) == SWITCH_STATUS_SUCCESS) {
 			*event = (switch_event_t *) pop;
+		} else {
+			check_media(session);
 		}
 	}
 
@@ -902,9 +931,13 @@
 	void *pop;
 
 	if (session->private_event_queue) {
+		while ((status = (switch_status_t) switch_queue_trypop(session->private_event_queue_pri, &pop)) == SWITCH_STATUS_SUCCESS) {
+			x++;
+		}
 		while ((status = (switch_status_t) switch_queue_trypop(session->private_event_queue, &pop)) == SWITCH_STATUS_SUCCESS) {
 			x++;
 		}
+		check_media(session);
 	}
 
 	return x;
@@ -957,6 +990,7 @@
 SWITCH_DECLARE(void) switch_core_session_wake_session_thread(switch_core_session_t *session)
 {
 	/* If trylock fails the signal is already awake so we needn't bother */
+
 	if (switch_mutex_trylock(session->mutex) == SWITCH_STATUS_SUCCESS) {
 		switch_thread_cond_signal(session->cond);
 		switch_mutex_unlock(session->mutex);
@@ -1001,7 +1035,7 @@
 
 
 	switch_core_session_reset(*session, TRUE, SWITCH_TRUE);
-	
+
 	switch_core_media_bug_remove_all(*session);
 	switch_ivr_deactivate_unicast(*session);
 
@@ -1043,7 +1077,7 @@
 	switch_event_t *event;
 	switch_core_session_t *session;
 	char *uuid = task->cmd_arg;
-	
+
 	if ((session = switch_core_session_locate(uuid))) {
 		switch_event_create(&event, SWITCH_EVENT_SESSION_HEARTBEAT);
 		switch_channel_event_set_data(session->channel, event);
@@ -1068,7 +1102,7 @@
 {
 
 	switch_core_session_unsched_heartbeat(session);
-	session->track_id = switch_scheduler_add_task(switch_epoch_time_now(NULL), sch_heartbeat_callback, (char *) __SWITCH_FUNC__, 
+	session->track_id = switch_scheduler_add_task(switch_epoch_time_now(NULL), sch_heartbeat_callback, (char *) __SWITCH_FUNC__,
 												  switch_core_session_get_uuid(session), 0, strdup(switch_core_session_get_uuid(session)), SSHF_FREE_ARG);
 }
 
@@ -1082,19 +1116,20 @@
 
 	session->track_duration = seconds;
 
-	if (switch_channel_test_flag(session->channel,  CF_PROXY_MODE)) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s using scheduler due to bypass_media mode\n", switch_channel_get_name(session->channel));
+	if (switch_channel_test_flag(session->channel, CF_PROXY_MODE)) {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s using scheduler due to bypass_media mode\n",
+						  switch_channel_get_name(session->channel));
 		switch_core_session_sched_heartbeat(session, seconds);
 		return;
 	}
 
 	switch_core_session_unsched_heartbeat(session);
-	
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "%s setting session heartbeat to %u second(s).\n", 
+
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "%s setting session heartbeat to %u second(s).\n",
 					  switch_channel_get_name(session->channel), seconds);
 
 	session->read_frame_count = 0;
-	
+
 }
 
 SWITCH_DECLARE(void) switch_core_session_disable_heartbeat(switch_core_session_t *session)
@@ -1103,9 +1138,14 @@
 	switch_assert(session != NULL);
 	session->read_frame_count = 0;
 	session->track_duration = 0;
-	
+
 }
 
+SWITCH_DECLARE(switch_bool_t) switch_core_session_in_thread(switch_core_session_t *session)
+{
+	return switch_thread_equal(switch_thread_self(), session->thread_id) ? SWITCH_TRUE : SWITCH_FALSE;
+}
+
 static void *SWITCH_THREAD_FUNC switch_core_session_thread(switch_thread_t *thread, void *obj)
 {
 	switch_core_session_t *session = obj;
@@ -1194,7 +1234,7 @@
 	if (switch_core_hash_find(session_manager.session_table, use_uuid)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Duplicate UUID!\n");
 		switch_mutex_unlock(runtime.session_hash_mutex);
-        return SWITCH_STATUS_FALSE;
+		return SWITCH_STATUS_FALSE;
 	}
 
 	msg.message_id = SWITCH_MESSAGE_INDICATE_UUID_CHANGE;
@@ -1211,16 +1251,222 @@
 	switch_mutex_unlock(runtime.session_hash_mutex);
 	switch_channel_event_set_data(session->channel, event);
 	switch_event_fire(&event);
-	
 
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
+static char *xml_find_var(switch_xml_t vars, const char *name)
+{
+	switch_xml_t var;
+	if ((var = switch_xml_child(vars, name)) && var->txt) {
+		return var->txt;
+	}
+
+	return NULL;
+}
+
+static void parse_array(const char *str, uint32_t *array, int32_t array_len)
+{
+	char *p, *v, *dup, *next = NULL;
+
+	if (zstr(str)) {
+		return;
+	}
+
+	dup = strdup(str);
+
+	p = dup;
+	while (p) {
+		if ((next = strchr(p, ';'))) {
+			*next++ = '\0';
+		}
+
+		if ((v = strchr(p, '='))) {
+			*v++ = '\0';
+		}
+
+		if (p && v) {
+			int x = 0, y = 0;
+
+			x = atoi(p);
+			y = atoi(v);
+
+			if (x < array_len) {
+				array[x] = y;
+			}
+		}
+
+		p = next;
+
+	}
+
+	free(dup);
+}
+
+SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_xml(switch_endpoint_interface_t *endpoint_interface,
+																		switch_memory_pool_t **pool, switch_xml_t xml)
+{
+	switch_core_session_t *session;
+	switch_channel_t *channel;
+	switch_xml_t tag, tag2, tag3, vars, callflow;
+	switch_call_direction_t direction = SWITCH_CALL_DIRECTION_OUTBOUND;
+	char *bridgeto, *flag_str = NULL, *cap_str = NULL, *direction_s = NULL, *uuid = NULL;
+	uint32_t flags[CF_FLAG_MAX] = { 0 };
+	uint32_t caps[CC_FLAG_MAX] = { 0 };
+	int i;
+
+	vars = switch_xml_child(xml, "variables");
+	bridgeto = xml_find_var(vars, SWITCH_SIGNAL_BOND_VARIABLE);
+	uuid = xml_find_var(vars, "uuid");
+
+	if ((tag = switch_xml_child(xml, "channel_data"))) {
+		direction_s = xml_find_var(tag, "direction");
+		direction = !strcmp(direction_s, "outbound") ? SWITCH_CALL_DIRECTION_OUTBOUND : SWITCH_CALL_DIRECTION_INBOUND;
+		flag_str = xml_find_var(tag, "flags");
+		cap_str = xml_find_var(tag, "caps");
+	}
+
+	parse_array(flag_str, flags, CF_FLAG_MAX);
+	parse_array(cap_str, caps, CC_FLAG_MAX);
+
+	if (!(session = switch_core_session_request_uuid(endpoint_interface, direction, pool, uuid))) {
+		return NULL;
+	}
+
+	channel = switch_core_session_get_channel(session);
+
+	for (i = 0; i < CF_FLAG_MAX; i++) {
+		if (flags[i]) {
+			switch_channel_set_flag_value(channel, i, flags[i]);
+		}
+	}
+
+	for (i = 0; i < CC_FLAG_MAX; i++) {
+		if (caps[i]) {
+			switch_channel_set_cap_value(channel, i, caps[i]);
+		}
+	}
+
+	if ((tag2 = switch_xml_child(xml, "variables"))) {
+		for (tag = tag2->child; tag; tag = tag->sibling) {
+			if (tag->name && tag->txt) {
+				char *p = strdup(tag->txt);
+				char *val = p;
+				switch_url_decode(val);
+				switch_channel_set_variable(channel, tag->name, val);
+				free(p);
+			}
+		}
+	}
+
+	if ((callflow = switch_xml_child(xml, "callflow"))) {
+		if ((tag2 = switch_xml_child(callflow, "caller_profile"))) {
+			switch_caller_profile_t *caller_profile;
+			char *name;
+			char *tmp;
+
+			caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
+													   xml_find_var(tag2, "username"),
+													   xml_find_var(tag2, "dialplan"),
+													   xml_find_var(tag2, "caller_id_name"),
+													   xml_find_var(tag2, "caller_id_number"),
+													   xml_find_var(tag2, "network_addr"),
+													   xml_find_var(tag2, "ani"),
+													   xml_find_var(tag2, "aniii"),
+													   xml_find_var(tag2, "rdnis"),
+													   xml_find_var(tag2, "source"),
+													   xml_find_var(tag2, "context"), xml_find_var(tag2, "destination_number"));
+
+			if ((tmp = xml_find_var(tag2, "callee_id_name"))) {
+				caller_profile->callee_id_name = switch_core_session_strdup(session, tmp);
+			}
+
+			if ((tmp = xml_find_var(tag2, "callee_id_number"))) {
+				caller_profile->callee_id_number = switch_core_session_strdup(session, tmp);
+			}
+
+			if ((name = xml_find_var(tag2, "channel_name"))) {
+				switch_channel_set_name(channel, name);
+			}
+
+			if ((tag3 = switch_xml_child(callflow, "times"))) {
+				caller_profile->times = (switch_channel_timetable_t *) switch_core_session_alloc(session, sizeof(*caller_profile->times));
+
+				caller_profile->times->resurrected = switch_time_now();
+
+				for (tag3 = tag3->child; tag3; tag3 = tag3->sibling) {
+					int64_t v;
+
+					if (tag3->name && tag3->txt) {
+						v = atoll(tag3->txt);
+						if (!strcmp(tag3->name, "created_time")) {
+							caller_profile->times->created = v;
+						} else if (!strcmp(tag3->name, "profile_created_time")) {
+							caller_profile->times->profile_created = v;
+						} else if (!strcmp(tag3->name, "progress_time")) {
+							caller_profile->times->progress = v;
+						} else if (!strcmp(tag3->name, "progress_media_time")) {
+							caller_profile->times->progress_media = v;
+						} else if (!strcmp(tag3->name, "answered_time")) {
+							caller_profile->times->answered = v;
+						} else if (!strcmp(tag3->name, "hangup_time")) {
+							caller_profile->times->hungup = v;
+						} else if (!strcmp(tag3->name, "transfer_time")) {
+							caller_profile->times->transferred = v;
+						}
+					}
+
+				}
+			}
+
+			switch_channel_set_caller_profile(channel, caller_profile);
+			if ((tag = switch_xml_child(tag2, "originator")) && (tag = tag->child)) {
+				caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
+														   xml_find_var(tag, "username"),
+														   xml_find_var(tag, "dialplan"),
+														   xml_find_var(tag, "caller_id_name"),
+														   xml_find_var(tag, "caller_id_number"),
+														   xml_find_var(tag, "network_addr"),
+														   xml_find_var(tag, "ani"),
+														   xml_find_var(tag, "aniii"),
+														   xml_find_var(tag, "rdnis"),
+														   xml_find_var(tag, "source"),
+														   xml_find_var(tag, "context"), xml_find_var(tag, "destination_number"));
+
+				switch_channel_set_originator_caller_profile(channel, caller_profile);
+			}
+
+			if ((tag = switch_xml_child(tag2, "originatee")) && (tag = tag->child)) {
+				caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session),
+														   xml_find_var(tag, "username"),
+														   xml_find_var(tag, "dialplan"),
+														   xml_find_var(tag, "caller_id_name"),
+														   xml_find_var(tag, "caller_id_number"),
+														   xml_find_var(tag, "network_addr"),
+														   xml_find_var(tag, "ani"),
+														   xml_find_var(tag, "aniii"),
+														   xml_find_var(tag, "rdnis"),
+														   xml_find_var(tag, "source"),
+														   xml_find_var(tag, "context"), xml_find_var(tag, "destination_number"));
+
+				switch_channel_set_originatee_caller_profile(channel, caller_profile);
+			}
+
+		}
+
+	}
+
+
+	return session;
+}
+
+
+
 SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_uuid(switch_endpoint_interface_t
-																		 *endpoint_interface, 
+																		 *endpoint_interface,
 																		 switch_call_direction_t direction,
-																		 switch_memory_pool_t **pool, 
-																		 const char *use_uuid)
+																		 switch_memory_pool_t **pool, const char *use_uuid)
 {
 	switch_memory_pool_t *usepool;
 	switch_core_session_t *session;
@@ -1231,7 +1477,7 @@
 
 	if (use_uuid && switch_core_hash_find(session_manager.session_table, use_uuid)) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Duplicate UUID!\n");
-        return NULL;
+		return NULL;
 	}
 
 	if (!switch_core_ready() || endpoint_interface == NULL) {
@@ -1247,13 +1493,13 @@
 	switch_mutex_unlock(runtime.throttle_mutex);
 
 	if (sps <= 0) {
-		//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Throttle Error!\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Throttle Error! %d\n", session_manager.session_count);
 		UNPROTECT_INTERFACE(endpoint_interface);
 		return NULL;
 	}
 
 	if ((count + 1) > session_manager.session_limit) {
-		//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Over Session Limit!\n");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Over Session Limit! %d\n", session_manager.session_limit);
 		UNPROTECT_INTERFACE(endpoint_interface);
 		return NULL;
 	}
@@ -1269,7 +1515,7 @@
 	session->pool = usepool;
 
 	switch_core_memory_pool_set_data(session->pool, "__session", session);
-	
+
 	if (switch_channel_alloc(&session->channel, direction, session->pool) != SWITCH_STATUS_SUCCESS) {
 		abort();
 	}
@@ -1279,7 +1525,7 @@
 	if (direction == SWITCH_CALL_DIRECTION_OUTBOUND) {
 		switch_channel_set_flag(session->channel, CF_OUTBOUND);
 	}
-	
+
 	/* The session *IS* the pool you may not alter it because you have no idea how
 	   its all private it will be passed to the thread run function */
 
@@ -1290,6 +1536,8 @@
 		switch_uuid_format(session->uuid_str, &uuid);
 	}
 
+	switch_channel_set_variable(session->channel, "uuid", session->uuid_str);
+
 	session->endpoint_interface = endpoint_interface;
 	session->raw_write_frame.data = session->raw_write_buf;
 	session->raw_write_frame.buflen = sizeof(session->raw_write_buf);
@@ -1312,13 +1560,14 @@
 	switch_queue_create(&session->message_queue, SWITCH_MESSAGE_QUEUE_LEN, session->pool);
 	switch_queue_create(&session->event_queue, SWITCH_EVENT_QUEUE_LEN, session->pool);
 	switch_queue_create(&session->private_event_queue, SWITCH_EVENT_QUEUE_LEN, session->pool);
+	switch_queue_create(&session->private_event_queue_pri, SWITCH_EVENT_QUEUE_LEN, session->pool);
 
 	switch_mutex_lock(runtime.session_hash_mutex);
 	switch_core_hash_insert(session_manager.session_table, session->uuid_str, session);
 	session->id = session_manager.session_id++;
 	session_manager.session_count++;
 	switch_mutex_unlock(runtime.session_hash_mutex);
-	
+
 	return session;
 }
 
@@ -1338,9 +1587,8 @@
 }
 
 
-SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(const char *endpoint_name, 
-																			switch_call_direction_t direction, 
-																			switch_memory_pool_t **pool)
+SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_by_name(const char *endpoint_name,
+																			switch_call_direction_t direction, switch_memory_pool_t **pool)
 {
 	switch_endpoint_interface_t *endpoint_interface;
 	switch_core_session_t *session;
@@ -1420,11 +1668,37 @@
 	return session->app_log;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application(switch_core_session_t *session, const char *app, const char *arg)
+SWITCH_DECLARE(switch_status_t) switch_core_session_get_app_flags(const char *app, int32_t *flags)
 {
 	switch_application_interface_t *application_interface;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	switch_assert(flags);
+
+	*flags = 0;
+
+	if ((application_interface = switch_loadable_module_get_application_interface(app)) == 0) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Application %s\n", app);
+		goto end;
+	} else if (application_interface->flags) {
+		*flags = application_interface->flags;
+		status = SWITCH_STATUS_SUCCESS;
+	}
+
+	UNPROTECT_INTERFACE(application_interface);
+
+  end:
+
+	return status;
+
+}
+
+SWITCH_DECLARE(switch_status_t) switch_core_session_execute_application_get_flags(switch_core_session_t *session, const char *app,
+																				  const char *arg, int32_t *flags)
+{
+	switch_application_interface_t *application_interface;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	
+
 	if (switch_channel_down(session->channel)) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Channel is hungup, aborting execution of application: %s\n", app);
 		return SWITCH_STATUS_FALSE;
@@ -1442,6 +1716,10 @@
 		switch_goto_status(SWITCH_STATUS_FALSE, done);
 	}
 
+	if (flags && application_interface->flags) {
+		*flags = application_interface->flags;
+	}
+
 	if (switch_channel_test_flag(session->channel, CF_PROXY_MODE) && !switch_test_flag(application_interface, SAF_SUPPORT_NOMEDIA)) {
 		switch_ivr_media(session->uuid_str, SMF_NONE);
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Application %s Requires media on channel %s!\n",
@@ -1457,9 +1735,10 @@
 
 	switch_core_session_exec(session, application_interface, arg);
 
-done:
+  done:
+
 	UNPROTECT_INTERFACE(application_interface);
-	
+
 	return status;
 }
 
@@ -1472,16 +1751,17 @@
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	char *expanded = NULL;
 	const char *app;
+	switch_core_session_message_t msg = { 0 };
 
 	switch_assert(application_interface);
 
 	app = application_interface->interface_name;
-	
+
 	if (arg) {
 		expanded = switch_channel_expand_variables(session->channel, arg);
 	}
 
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG, "EXECUTE %s %s(%s)\n", 
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_DEBUG, "EXECUTE %s %s(%s)\n",
 					  switch_channel_get_name(session->channel), app, switch_str_nil(expanded));
 
 	if ((var = switch_channel_get_variable(session->channel, "verbose_presence")) && switch_true(var)) {
@@ -1515,11 +1795,11 @@
 			session->app_log = log;
 		}
 	}
-	
+
 	switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_VARIABLE, application_interface->interface_name);
 	switch_channel_set_variable_var_check(channel, SWITCH_CURRENT_APPLICATION_DATA_VARIABLE, expanded, SWITCH_FALSE);
 	switch_channel_set_variable(channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE, NULL);
-	
+
 	if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE) == SWITCH_STATUS_SUCCESS) {
 		switch_channel_event_set_data(session->channel, event);
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application", application_interface->interface_name);
@@ -1533,8 +1813,14 @@
 
 	switch_channel_set_variable(session->channel, SWITCH_CURRENT_APPLICATION_VARIABLE, application_interface->interface_name);
 
+	msg.from = __FILE__;
+	msg.message_id = SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC;
+	msg.string_array_arg[0] = application_interface->interface_name;
+	msg.string_array_arg[1] = expanded;
+	switch_core_session_receive_message(session, &msg);
+
 	application_interface->application_function(session, expanded);
-	
+
 	if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_EXECUTE_COMPLETE) == SWITCH_STATUS_SUCCESS) {
 		const char *resp = switch_channel_get_variable(session->channel, SWITCH_CURRENT_APPLICATION_RESPONSE_VARIABLE);
 		switch_channel_event_set_data(session->channel, event);
@@ -1544,10 +1830,13 @@
 		switch_event_fire(&event);
 	}
 
+	msg.message_id = SWITCH_MESSAGE_INDICATE_APPLICATION_EXEC_COMPLETE;
+	switch_core_session_receive_message(session, &msg);
+
 	if (expanded != arg) {
 		switch_safe_free(expanded);
 	}
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1568,7 +1857,8 @@
 	}
 
 	if (session->stack_count > SWITCH_MAX_STACKS) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error %s too many stacked extensions\n", switch_channel_get_name(session->channel));
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error %s too many stacked extensions\n",
+						  switch_channel_get_name(session->channel));
 		return SWITCH_STATUS_FALSE;
 	}
 
@@ -1585,7 +1875,7 @@
 		new_profile->context = switch_core_strdup(new_profile->pool, context);
 	}
 
-	dpstr = switch_core_session_strdup(session, new_profile->dialplan);	
+	dpstr = switch_core_session_strdup(session, new_profile->dialplan);
 
 	switch_channel_set_hunt_caller_profile(channel, new_profile);
 	argc = switch_separate_string(dpstr, ',', dp, (sizeof(dp) / sizeof(dp[0])));
@@ -1608,7 +1898,7 @@
 		count++;
 
 		extension = dialplan_interface->hunt_function(session, dparg, new_profile);
-		UNPROTECT_INTERFACE(dialplan_interface);	
+		UNPROTECT_INTERFACE(dialplan_interface);
 
 		if (extension) {
 			break;
@@ -1652,6 +1942,19 @@
 	return status;
 }
 
+SWITCH_DECLARE(switch_status_t) switch_core_session_set_loglevel(switch_core_session_t *session, switch_log_level_t loglevel)
+{
+	switch_assert(session != NULL);
+	session->loglevel = loglevel;
+	return SWITCH_STATUS_SUCCESS;
+}
+
+SWITCH_DECLARE(switch_log_level_t) switch_core_session_get_loglevel(switch_core_session_t *session)
+{
+	switch_assert(session != NULL);
+	return session->loglevel;
+}
+
 /* For Emacs:
  * Local Variables:
  * mode:c

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_speech.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_speech.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_speech.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -121,7 +121,7 @@
 		status = SWITCH_STATUS_FALSE;
 		goto done;
 	}
-	
+
 	/* extract params */
 	if (*data == '{') {
 		param_string = data + 1;
@@ -142,7 +142,7 @@
 		int argc = switch_separate_string(param_string, ',', param, (sizeof(param) / sizeof(param[0])));
 		for (i = 0; i < argc && param[i]; ++i) {
 			char *param_pair[2] = { 0 };
-			if(switch_separate_string(param[i], '=', param_pair, (sizeof(param_pair) / sizeof(param_pair[0]))) == 2) {
+			if (switch_separate_string(param[i], '=', param_pair, (sizeof(param_pair) / sizeof(param_pair[0]))) == 2) {
 				switch_core_speech_text_param_tts(sh, param_pair[0], param_pair[1]);
 			}
 		}
@@ -150,10 +150,10 @@
 
 	status = sh->speech_interface->speech_feed_tts(sh, data, flags);
 
- done:
+  done:
 
 	switch_safe_free(ltext);
-	return status;	
+	return status;
 }
 
 SWITCH_DECLARE(void) switch_core_speech_flush_tts(switch_speech_handle_t *sh)
@@ -192,17 +192,16 @@
 	}
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_speech_read_tts(switch_speech_handle_t *sh,
-															void *data, switch_size_t *datalen, switch_speech_flag_t *flags)
+SWITCH_DECLARE(switch_status_t) switch_core_speech_read_tts(switch_speech_handle_t *sh, void *data, switch_size_t *datalen, switch_speech_flag_t *flags)
 {
 	switch_status_t status;
 	switch_size_t want, orig_len = *datalen;
-	
+
 	switch_assert(sh != NULL);
-	
+
 	want = *datalen;
 
- top:
+  top:
 
 	if (sh->buffer && (switch_buffer_inuse(sh->buffer) >= orig_len || switch_test_flag(sh, SWITCH_SPEECH_FLAG_DONE))) {
 		if ((*datalen = switch_buffer_read(sh->buffer, data, orig_len))) {
@@ -216,14 +215,14 @@
 		return SWITCH_STATUS_BREAK;
 	}
 
- more:
+  more:
 
 	if ((status = sh->speech_interface->speech_read_tts(sh, data, datalen, flags)) != SWITCH_STATUS_SUCCESS) {
 		switch_set_flag(sh, SWITCH_SPEECH_FLAG_DONE);
 		goto top;
 	}
 
-	
+
 	if (sh->native_rate && sh->samplerate && sh->native_rate != sh->samplerate) {
 		if (!sh->resampler) {
 			if (switch_resample_create(&sh->resampler,
@@ -239,16 +238,16 @@
 				int factor = sh->resampler->to_len * sh->samplerate / 1000;
 				switch_buffer_create_dynamic(&sh->buffer, factor, factor, 0);
 				switch_assert(sh->buffer);
-			}			
+			}
 			if (!sh->dbuf || sh->dbuflen < sh->resampler->to_len * 2) {
 				sh->dbuflen = sh->resampler->to_len * 2;
 				sh->dbuf = switch_core_alloc(sh->memory_pool, sh->dbuflen);
 			}
 			switch_assert(sh->resampler->to_len <= sh->dbuflen);
-		
+
 			memcpy((int16_t *) sh->dbuf, sh->resampler->to, sh->resampler->to_len * 2);
 			switch_buffer_write(sh->buffer, sh->dbuf, sh->resampler->to_len * 2);
-			
+
 			if (switch_buffer_inuse(sh->buffer) < want) {
 				*datalen = want;
 				goto more;
@@ -270,7 +269,7 @@
 SWITCH_DECLARE(switch_status_t) switch_core_speech_close(switch_speech_handle_t *sh, switch_speech_flag_t *flags)
 {
 	switch_status_t status = sh->speech_interface->speech_close(sh, flags);
-	
+
 	if (!switch_test_flag(sh, SWITCH_SPEECH_FLAG_OPEN)) {
 		return SWITCH_STATUS_FALSE;
 	}
@@ -288,7 +287,7 @@
 	}
 
 	switch_clear_flag(sh, SWITCH_SPEECH_FLAG_OPEN);
-	
+
 	return status;
 }
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_sqldb.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_sqldb.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_sqldb.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -43,11 +43,40 @@
 	switch_thread_t *thread;
 	int thread_running;
 	switch_bool_t manage;
+	switch_mutex_t *io_mutex;
+	switch_mutex_t *dbh_mutex;
+	switch_hash_t *dbh_hash;
 } sql_manager;
 
-static switch_mutex_t *dbh_mutex = NULL;
-static switch_hash_t *dbh_hash = NULL;
 
+#define SWITCH_CORE_DB "core"
+/*!
+  \brief Open the default system database
+*/
+SWITCH_DECLARE(switch_status_t) _switch_core_db_handle(switch_cache_db_handle_t ** dbh, const char *file, const char *func, int line)
+{
+	switch_cache_db_connection_options_t options = { {0} };
+	switch_status_t r;
+
+	if (!zstr(runtime.odbc_dsn)) {
+		options.odbc_options.dsn = runtime.odbc_dsn;
+		options.odbc_options.user = runtime.odbc_user;
+		options.odbc_options.pass = runtime.odbc_pass;
+
+		r = _switch_cache_db_get_db_handle(dbh, SCDB_TYPE_ODBC, &options, file, func, line);
+	} else {
+		options.core_db_options.db_path = SWITCH_CORE_DB;
+		r = _switch_cache_db_get_db_handle(dbh, SCDB_TYPE_CORE_DB, &options, file, func, line);
+	}
+
+	if (r == SWITCH_STATUS_SUCCESS && !(*dbh)->io_mutex) {
+		(*dbh)->io_mutex = sql_manager.io_mutex;
+	}
+
+	return r;
+}
+
+
 #define SQL_CACHE_TIMEOUT 300
 
 static void sql_close(time_t prune)
@@ -58,12 +87,12 @@
 	switch_cache_db_handle_t *dbh = NULL;
 	int locked = 0;
 	char *key;
-	
-	switch_mutex_lock(dbh_mutex);
- top:
+
+	switch_mutex_lock(sql_manager.dbh_mutex);
+  top:
 	locked = 0;
-	
-	for (hi = switch_hash_first(NULL, dbh_hash); hi; hi = switch_hash_next(hi)) {
+
+	for (hi = switch_hash_first(NULL, sql_manager.dbh_hash); hi; hi = switch_hash_next(hi)) {
 		switch_hash_this(hi, &var, NULL, &val);
 		key = (char *) var;
 
@@ -73,13 +102,13 @@
 			if (prune > 0 && prune > dbh->last_used) {
 				diff = (time_t) prune - dbh->last_used;
 			}
-			
+
 			if (prune > 0 && diff < SQL_CACHE_TIMEOUT) {
 				continue;
 			}
 
 			if (switch_mutex_trylock(dbh->mutex) == SWITCH_STATUS_SUCCESS) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Dropping idle DB connection %s\n", key);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Dropping idle DB connection %s\n", key);
 
 				switch (dbh->type) {
 				case SCDB_TYPE_ODBC:
@@ -90,18 +119,19 @@
 				case SCDB_TYPE_CORE_DB:
 					{
 						switch_core_db_close(dbh->native_handle.core_db_dbh);
-						dbh->native_handle.core_db_dbh = NULL;	
+						dbh->native_handle.core_db_dbh = NULL;
 					}
 					break;
 				}
 
-				switch_core_hash_delete(dbh_hash, key);
+				switch_core_hash_delete(sql_manager.dbh_hash, key);
 				switch_mutex_unlock(dbh->mutex);
 				switch_core_destroy_memory_pool(&dbh->pool);
 				goto top;
-	
+
 			} else {
-				if (!prune) locked++;
+				if (!prune)
+					locked++;
 				continue;
 			}
 		}
@@ -111,12 +141,19 @@
 		goto top;
 	}
 
-	switch_mutex_unlock(dbh_mutex);
+	switch_mutex_unlock(sql_manager.dbh_mutex);
 }
 
 
-SWITCH_DECLARE(void) switch_cache_db_release_db_handle(switch_cache_db_handle_t **dbh)
+SWITCH_DECLARE(void) switch_cache_db_flush_handles(void)
 {
+	sql_close(switch_epoch_time_now(NULL) + SQL_CACHE_TIMEOUT + 1);
+}
+
+
+
+SWITCH_DECLARE(void) switch_cache_db_release_db_handle(switch_cache_db_handle_t ** dbh)
+{
 	if (dbh && *dbh) {
 		switch_mutex_unlock((*dbh)->mutex);
 		*dbh = NULL;
@@ -124,11 +161,11 @@
 }
 
 
-SWITCH_DECLARE(void) switch_cache_db_destroy_db_handle(switch_cache_db_handle_t **dbh)
+SWITCH_DECLARE(void) switch_cache_db_destroy_db_handle(switch_cache_db_handle_t ** dbh)
 {
 	if (dbh && *dbh) {
-		switch_mutex_lock(dbh_mutex);
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleting DB connection %s\n", (*dbh)->name);
+		switch_mutex_lock(sql_manager.dbh_mutex);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Deleting DB connection %s\n", (*dbh)->name);
 
 		switch ((*dbh)->type) {
 		case SCDB_TYPE_ODBC:
@@ -139,17 +176,17 @@
 		case SCDB_TYPE_CORE_DB:
 			{
 				switch_core_db_close((*dbh)->native_handle.core_db_dbh);
-				(*dbh)->native_handle.core_db_dbh = NULL;		
+				(*dbh)->native_handle.core_db_dbh = NULL;
 			}
 			break;
 		}
 
-		
-		switch_core_hash_delete(dbh_hash, (*dbh)->name);		
+
+		switch_core_hash_delete(sql_manager.dbh_hash, (*dbh)->name);
 		switch_mutex_unlock((*dbh)->mutex);
 		switch_core_destroy_memory_pool(&(*dbh)->pool);
 		*dbh = NULL;
-		switch_mutex_unlock(dbh_mutex);
+		switch_mutex_unlock(sql_manager.dbh_mutex);
 	}
 }
 
@@ -162,31 +199,31 @@
 	char *key;
 	switch_cache_db_handle_t *dbh = NULL;
 
-	snprintf(thread_str, sizeof(thread_str) - 1, "%lu", (unsigned long)(intptr_t)switch_thread_self());
-	switch_mutex_lock(dbh_mutex);
+	snprintf(thread_str, sizeof(thread_str) - 1, "%lu", (unsigned long) (intptr_t) switch_thread_self());
+	switch_mutex_lock(sql_manager.dbh_mutex);
 
-	for (hi = switch_hash_first(NULL, dbh_hash); hi; hi = switch_hash_next(hi)) {
+	for (hi = switch_hash_first(NULL, sql_manager.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)) {
 			if (switch_mutex_trylock(dbh->mutex) == SWITCH_STATUS_SUCCESS) {
 				if (strstr(dbh->name, thread_str)) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, 
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10,
 									  "Detach cached DB handle %s [%s]\n", thread_str, switch_cache_db_type_name(dbh->type));
 					switch_clear_flag(dbh, CDF_INUSE);
-				} 
+				}
 				switch_mutex_unlock(dbh->mutex);
 			}
 		}
 	}
 
-	switch_mutex_unlock(dbh_mutex);
+	switch_mutex_unlock(sql_manager.dbh_mutex);
 }
 
-SWITCH_DECLARE(switch_status_t)_switch_cache_db_get_db_handle(switch_cache_db_handle_t **dbh,
-															  switch_cache_db_handle_type_t type,
-															  switch_cache_db_connection_options_t *connection_options,
-															  const char *file, const char *func, int line)
+SWITCH_DECLARE(switch_status_t) _switch_cache_db_get_db_handle(switch_cache_db_handle_t ** dbh,
+															   switch_cache_db_handle_type_t type,
+															   switch_cache_db_connection_options_t *connection_options,
+															   const char *file, const char *func, int line)
 {
 	switch_thread_id_t self = switch_thread_self();
 	char thread_str[CACHE_DB_LEN] = "";
@@ -221,13 +258,13 @@
 	}
 
 	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(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_mutex_lock(sql_manager.dbh_mutex);
+	if ((new_dbh = switch_core_hash_find(sql_manager.dbh_hash, thread_str))) {
 		switch_set_string(new_dbh->last_user, db_callsite_str);
-		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG10, 
+		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;
@@ -235,21 +272,21 @@
 		void *val;
 		char *key;
 		unsigned long hash = 0;
-		
+
 		hash = switch_ci_hashfunc_default(db_str, &hlen);
 
-		for (hi = switch_hash_first(NULL, dbh_hash); hi; hi = switch_hash_next(hi)) {
+		for (hi = switch_hash_first(NULL, sql_manager.dbh_hash); hi; hi = switch_hash_next(hi)) {
 			switch_hash_this(hi, &var, NULL, &val);
 			key = (char *) var;
-			
+
 			if ((new_dbh = (switch_cache_db_handle_t *) val)) {
-				if (hash == new_dbh->hash && !strncasecmp(new_dbh->name, db_str, strlen(db_str)) && 
+				if (hash == new_dbh->hash && !strncasecmp(new_dbh->name, db_str, strlen(db_str)) &&
 					!switch_test_flag(new_dbh, CDF_INUSE) && switch_mutex_trylock(new_dbh->mutex) == SWITCH_STATUS_SUCCESS) {
 					switch_set_flag(new_dbh, CDF_INUSE);
 					switch_set_string(new_dbh->name, thread_str);
 					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, 
+					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;
 				}
@@ -272,15 +309,14 @@
 					goto end;
 				}
 
-				if ((odbc_dbh = switch_odbc_handle_new(connection_options->odbc_options.dsn, 
-													   connection_options->odbc_options.user,
-													   connection_options->odbc_options.pass))) {
+				if ((odbc_dbh = switch_odbc_handle_new(connection_options->odbc_options.dsn,
+													   connection_options->odbc_options.user, connection_options->odbc_options.pass))) {
 					if (switch_odbc_handle_connect(odbc_dbh) != SWITCH_STATUS_SUCCESS) {
 						switch_odbc_handle_destroy(&odbc_dbh);
 					}
 				}
-				
 
+
 			}
 			break;
 		case SCDB_TYPE_CORE_DB:
@@ -298,7 +334,7 @@
 			goto end;
 		}
 
-		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG10, 
+		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG10,
 						  "Create Cached DB handle %s [%s]\n", thread_str, switch_cache_db_type_name(type));
 
 		switch_core_new_memory_pool(&pool);
@@ -310,19 +346,23 @@
 		new_dbh->hash = switch_ci_hashfunc_default(db_str, &hlen);
 
 
-		if (db) new_dbh->native_handle.core_db_dbh = db; else new_dbh->native_handle.odbc_dbh = odbc_dbh;
+		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);
+		switch_core_hash_insert(sql_manager.dbh_hash, new_dbh->name, new_dbh);
 	}
 
- end:
+  end:
 
-	if (new_dbh) new_dbh->last_used = switch_epoch_time_now(NULL);
+	if (new_dbh)
+		new_dbh->last_used = switch_epoch_time_now(NULL);
 
-	switch_mutex_unlock(dbh_mutex);
+	switch_mutex_unlock(sql_manager.dbh_mutex);
 
 	*dbh = new_dbh;
 
@@ -335,13 +375,18 @@
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	char *errmsg = NULL;
 
-	if (err) *err = NULL;
-	
+	if (dbh->io_mutex) {
+		switch_mutex_lock(dbh->io_mutex);
+	}
+
+	if (err)
+		*err = NULL;
+
 	switch (dbh->type) {
 	case SCDB_TYPE_ODBC:
 		{
 			switch_odbc_statement_handle_t stmt = NULL;
-			if ((status = switch_odbc_handle_exec(dbh->native_handle.odbc_dbh, sql, &stmt)) != SWITCH_ODBC_SUCCESS) {
+			if ((status = switch_odbc_handle_exec(dbh->native_handle.odbc_dbh, sql, &stmt, NULL)) != SWITCH_ODBC_SUCCESS) {
 				errmsg = switch_odbc_handle_get_error(dbh->native_handle.odbc_dbh, stmt);
 			}
 			switch_odbc_statement_handle_free(&stmt);
@@ -355,7 +400,7 @@
 	}
 
 	if (errmsg) {
-		if (!switch_stristr("already exists", errmsg)) {
+		if (!switch_stristr("already exists", errmsg) && !switch_stristr("duplicate key name", errmsg)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR [%s]\n%s\n", errmsg, sql);
 		}
 		if (err) {
@@ -364,7 +409,12 @@
 			free(errmsg);
 		}
 	}
-	
+
+
+	if (dbh->io_mutex) {
+		switch_mutex_unlock(dbh->io_mutex);
+	}
+
 	return status;
 }
 
@@ -380,7 +430,8 @@
 
 	switch_assert(chunk_size);
 
-	if (err) *err = NULL;
+	if (err)
+		*err = NULL;
 
 	len = strlen(sql);
 
@@ -391,37 +442,39 @@
 	if (!(chunk_count = strlen(sql) / chunk_size)) {
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	e = end_of_p(sql);
 	s = sql;
 
-	while(s && s < e) {
+	while (s && s < e) {
 		p = s + chunk_size;
 
 		if (p > e) {
 			p = e;
 		}
-		
+
 		while (p > s) {
-			if (*p == '\n' && *(p-1) == ';') {
+			if (*p == '\n' && *(p - 1) == ';') {
 				*p = '\0';
-				*(p-1) = '\0';
+				*(p - 1) = '\0';
+				p++;
 				break;
 			}
-			
+
 			p--;
 		}
 
-		if (p <= s) break;
-		
-		
+		if (p <= s)
+			break;
+
+
 		status = switch_cache_db_execute_sql_real(dbh, s, err);
 		if (status != SWITCH_STATUS_SUCCESS || (err && *err)) {
 			break;
 		}
 
 		s = p;
-	
+
 	}
 
 	return status;
@@ -433,15 +486,22 @@
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
+	if (dbh->io_mutex) {
+		switch_mutex_lock(dbh->io_mutex);
+	}
 
 	switch (dbh->type) {
 	default:
 		{
-			status = switch_cache_db_execute_sql_chunked(dbh, (char *)sql, 32768, err);
+			status = switch_cache_db_execute_sql_chunked(dbh, (char *) sql, 32768, err);
 		}
 		break;
 	}
 
+	if (dbh->io_mutex) {
+		switch_mutex_unlock(dbh->io_mutex);
+	}
+
 	return status;
 
 }
@@ -452,11 +512,15 @@
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
 
+	if (dbh->io_mutex) {
+		switch_mutex_lock(dbh->io_mutex);
+	}
+
 	switch (dbh->type) {
 	case SCDB_TYPE_CORE_DB:
 		{
 			switch_core_db_stmt_t *stmt;
-			
+
 			if (switch_core_db_prepare(dbh->native_handle.core_db_dbh, sql, -1, &stmt, 0)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Statement Error [%s]!\n", sql);
 				return NULL;
@@ -467,7 +531,7 @@
 				while (running < 5000) {
 					int result = switch_core_db_step(stmt);
 					const unsigned char *txt;
-					
+
 					if (result == SWITCH_CORE_DB_ROW) {
 						if ((colcount = switch_core_db_column_count(stmt)) > 0) {
 							if ((txt = switch_core_db_column_text(stmt, 0))) {
@@ -485,20 +549,24 @@
 					}
 					break;
 				}
-				
+
 				switch_core_db_finalize(stmt);
 			}
 		}
 		break;
 	case SCDB_TYPE_ODBC:
 		{
-			status = switch_odbc_handle_exec_string(dbh->native_handle.odbc_dbh, sql, str, len);
+			status = switch_odbc_handle_exec_string(dbh->native_handle.odbc_dbh, sql, str, len, err);
 		}
 		break;
 	}
 
- end:
+  end:
 
+	if (dbh->io_mutex) {
+		switch_mutex_unlock(dbh->io_mutex);
+	}
+
 	return status == SWITCH_STATUS_SUCCESS ? str : NULL;
 
 }
@@ -514,6 +582,10 @@
 		retries = 1000;
 	}
 
+	if (dbh->io_mutex) {
+		switch_mutex_lock(dbh->io_mutex);
+	}
+
 	while (retries > 0) {
 		switch_cache_db_execute_sql_real(dbh, sql, &errmsg);
 		if (errmsg) {
@@ -531,6 +603,10 @@
 		}
 	}
 
+	if (dbh->io_mutex) {
+		switch_mutex_unlock(dbh->io_mutex);
+	}
+
 	return status;
 }
 
@@ -542,18 +618,22 @@
 	uint8_t forever = 0;
 	unsigned begin_retries = 100;
 	uint8_t again = 0;
-	
+
 	if (!retries) {
 		forever = 1;
 		retries = 1000;
 	}
 
-again:
+	if (dbh->io_mutex) {
+		switch_mutex_lock(dbh->io_mutex);
+	}
 
+  again:
+
 	while (begin_retries > 0) {
 		again = 0;
 
-		switch_cache_db_execute_sql_real(dbh,  "BEGIN", &errmsg);
+		switch_cache_db_execute_sql_real(dbh, "BEGIN", &errmsg);
 
 		if (errmsg) {
 			begin_retries--;
@@ -602,22 +682,30 @@
 		}
 	}
 
-done:
+  done:
 
-	switch_cache_db_execute_sql_real(dbh,  "COMMIT", NULL);
+	switch_cache_db_execute_sql_real(dbh, "COMMIT", NULL);
 
+	if (dbh->io_mutex) {
+		switch_mutex_unlock(dbh->io_mutex);
+	}
+
+
 	return status;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_cache_db_execute_sql_callback(switch_cache_db_handle_t *dbh, 
+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_status_t status = SWITCH_STATUS_FALSE;
 	char *errmsg = NULL;
 
-	if (err) *err = NULL;
+	if (err)
+		*err = NULL;
 
+	if (dbh->io_mutex) {
+		switch_mutex_lock(dbh->io_mutex);
+	}
 
 
 	switch (dbh->type) {
@@ -629,7 +717,7 @@
 	case SCDB_TYPE_CORE_DB:
 		{
 			status = switch_core_db_exec(dbh->native_handle.core_db_dbh, sql, callback, pdata, &errmsg);
-			
+
 			if (errmsg) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR: [%s] %s\n", sql, errmsg);
 				free(errmsg);
@@ -637,22 +725,33 @@
 		}
 		break;
 	}
-	
+
+	if (dbh->io_mutex) {
+		switch_mutex_unlock(dbh->io_mutex);
+	}
+
 	return status;
 }
 
-SWITCH_DECLARE(void) switch_cache_db_test_reactive(switch_cache_db_handle_t *dbh, const char *test_sql, const char *drop_sql, const char *reactive_sql)
+SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_handle_t *dbh,
+															const char *test_sql, const char *drop_sql, const char *reactive_sql)
 {
 	char *errmsg;
+	switch_bool_t r = SWITCH_TRUE;
 
+	if (dbh->io_mutex) {
+		switch_mutex_lock(dbh->io_mutex);
+	}
+
 	switch (dbh->type) {
 	case SCDB_TYPE_ODBC:
 		{
-			if (switch_odbc_handle_exec(dbh->native_handle.odbc_dbh, test_sql, NULL) != SWITCH_ODBC_SUCCESS) {
+			if (switch_odbc_handle_exec(dbh->native_handle.odbc_dbh, test_sql, NULL, NULL) != SWITCH_ODBC_SUCCESS) {
+				r = SWITCH_FALSE;
 				if (drop_sql) {
-					switch_odbc_handle_exec(dbh->native_handle.odbc_dbh, drop_sql, NULL);
+					switch_odbc_handle_exec(dbh->native_handle.odbc_dbh, drop_sql, NULL, NULL);
 				}
-				switch_odbc_handle_exec(dbh->native_handle.odbc_dbh, reactive_sql, NULL);
+				switch_odbc_handle_exec(dbh->native_handle.odbc_dbh, reactive_sql, NULL, NULL);
 			}
 		}
 		break;
@@ -662,6 +761,7 @@
 				switch_core_db_exec(dbh->native_handle.core_db_dbh, test_sql, NULL, NULL, &errmsg);
 
 				if (errmsg) {
+					r = SWITCH_FALSE;
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "SQL ERR [%s]\n[%s]\nAuto Generating Table!\n", errmsg, test_sql);
 					switch_core_db_free(errmsg);
 					errmsg = NULL;
@@ -684,17 +784,24 @@
 		}
 		break;
 	}
+
+
+	if (dbh->io_mutex) {
+		switch_mutex_unlock(dbh->io_mutex);
+	}
+
+	return r;
 }
 
 
 
-#define SQLLEN 1024 * 64
-static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t * thread, void *obj)
+#define SQLLEN 1024 * 1024
+static void *SWITCH_THREAD_FUNC switch_core_sql_thread(switch_thread_t *thread, void *obj)
 {
 	void *pop;
 	uint32_t itterations = 0;
 	uint8_t trans = 0, nothing_in_queue = 0;
-	uint32_t target = 50000;
+	uint32_t target = 100000;
 	switch_size_t len = 0, sql_len = SQLLEN;
 	char *tmp, *sqlbuf = (char *) malloc(sql_len);
 	char *sql;
@@ -715,7 +822,7 @@
 
 	sql_manager.thread_running = 1;
 
-	while(sql_manager.thread_running == 1) {
+	while (sql_manager.thread_running == 1) {
 		if (++loops == l1) {
 			if (++sec == SQL_CACHE_TIMEOUT) {
 				sql_close(switch_epoch_time_now(NULL));
@@ -723,13 +830,13 @@
 			}
 			loops = 0;
 		}
-		
+
 		if (!sql_manager.manage) {
 			switch_yield(100000);
 			continue;
 		}
-		
-		if (switch_queue_trypop(sql_manager.sql_queue[0], &pop) == SWITCH_STATUS_SUCCESS || 
+
+		if (switch_queue_trypop(sql_manager.sql_queue[0], &pop) == SWITCH_STATUS_SUCCESS ||
 			switch_queue_trypop(sql_manager.sql_queue[1], &pop) == SWITCH_STATUS_SUCCESS) {
 			sql = (char *) pop;
 
@@ -739,7 +846,7 @@
 				if (itterations == 0) {
 					trans = 1;
 				}
-				
+
 				/* ignore abnormally large strings sql strings as potential buffer overflow */
 				if (newlen < SQLLEN) {
 					itterations++;
@@ -764,8 +871,8 @@
 		} else {
 			nothing_in_queue = 1;
 		}
-		
-		
+
+
 		if (trans && ((itterations == target) || (nothing_in_queue && ++lc >= 500))) {
 			if (switch_cache_db_persistant_execute_trans(sql_manager.event_db, sqlbuf, 1) != SWITCH_STATUS_SUCCESS) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SQL thread unable to commit transaction, records lost!\n");
@@ -777,7 +884,7 @@
 			*sqlbuf = '\0';
 			lc = 0;
 		}
-		
+
 		if (nothing_in_queue) {
 			switch_cond_next();
 		}
@@ -811,45 +918,40 @@
 		{
 			const char *id = switch_event_get_header(event, "task-id");
 			const char *manager = switch_event_get_header(event, "task-sql_manager");
-			
+
 			if (id) {
 				sql = switch_mprintf("insert into tasks values(%q,'%q','%q',%q, '%q')",
 									 id,
 									 switch_event_get_header_nil(event, "task-desc"),
-									 switch_event_get_header_nil(event, "task-group"), 
-									 manager ? manager : "0",
-									 switch_core_get_variable("hostname")
-									 );
+									 switch_event_get_header_nil(event, "task-group"), manager ? manager : "0", switch_core_get_variable("hostname")
+					);
 			}
 		}
 		break;
 	case SWITCH_EVENT_DEL_SCHEDULE:
 	case SWITCH_EVENT_EXE_SCHEDULE:
-		sql = switch_mprintf("delete from tasks where task_id=%q and hostname='%q'", 
+		sql = switch_mprintf("delete from tasks where task_id=%q and hostname='%q'",
 							 switch_event_get_header_nil(event, "task-id"), switch_core_get_variable("hostname"));
 		break;
 	case SWITCH_EVENT_RE_SCHEDULE:
 		{
 			const char *id = switch_event_get_header(event, "task-id");
 			const char *manager = switch_event_get_header(event, "task-sql_manager");
-		
+
 			if (id) {
 				sql = switch_mprintf("update tasks set task_desc='%q',task_group='%q', task_sql_manager=%q where task_id=%q and hostname='%q'",
-									 switch_event_get_header_nil(event, "task-desc"), 
-									 switch_event_get_header_nil(event, "task-group"), 
-									 manager ? manager : "0",
-									 id, switch_core_get_variable("hostname"));
+									 switch_event_get_header_nil(event, "task-desc"),
+									 switch_event_get_header_nil(event, "task-group"), manager ? manager : "0", id, switch_core_get_variable("hostname"));
 			}
 		}
 		break;
 	case SWITCH_EVENT_CHANNEL_DESTROY:
-		sql = switch_mprintf("delete from channels where uuid='%q' and hostname='%q'", 
+		sql = switch_mprintf("delete from channels where uuid='%q' and hostname='%q'",
 							 switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname"));
 		break;
 	case SWITCH_EVENT_CHANNEL_UUID:
 		{
-			sql = switch_mprintf(
-								 "update channels set uuid='%q' where uuid='%q' and hostname='%q';"
+			sql = switch_mprintf("update channels set uuid='%q' where uuid='%q' and hostname='%q';"
 								 "update calls set caller_uuid='%q' where caller_uuid='%q' and hostname='%q';"
 								 "update calls set callee_uuid='%q' where callee_uuid='%q' and hostname='%q'",
 								 switch_event_get_header_nil(event, "unique-id"),
@@ -859,9 +961,8 @@
 								 switch_event_get_header_nil(event, "old-unique-id"),
 								 switch_core_get_variable("hostname"),
 								 switch_event_get_header_nil(event, "unique-id"),
-								 switch_event_get_header_nil(event, "old-unique-id"),
-								 switch_core_get_variable("hostname")
-								 );
+								 switch_event_get_header_nil(event, "old-unique-id"), switch_core_get_variable("hostname")
+				);
 			break;
 		}
 	case SWITCH_EVENT_CHANNEL_CREATE:
@@ -870,21 +971,20 @@
 							 switch_event_get_header_nil(event, "unique-id"),
 							 switch_event_get_header_nil(event, "call-direction"),
 							 switch_event_get_header_nil(event, "event-date-local"),
-							 (long)switch_epoch_time_now(NULL),							 
+							 (long) switch_epoch_time_now(NULL),
 							 switch_event_get_header_nil(event, "channel-name"),
 							 switch_event_get_header_nil(event, "channel-state"),
 							 switch_event_get_header_nil(event, "caller-dialplan"),
-							 switch_event_get_header_nil(event, "caller-context"),
-							 switch_core_get_variable("hostname")
-							 );
+							 switch_event_get_header_nil(event, "caller-context"), switch_core_get_variable("hostname")
+			);
 		break;
 	case SWITCH_EVENT_CODEC:
 		sql =
 			switch_mprintf
 			("update channels set read_codec='%q',read_rate='%q',write_codec='%q',write_rate='%q' where uuid='%q' and hostname='%q'",
-			 switch_event_get_header_nil(event, "channel-read-codec-name"), 
+			 switch_event_get_header_nil(event, "channel-read-codec-name"),
 			 switch_event_get_header_nil(event, "channel-read-codec-rate"),
-			 switch_event_get_header_nil(event, "channel-write-codec-name"), 
+			 switch_event_get_header_nil(event, "channel-write-codec-name"),
 			 switch_event_get_header_nil(event, "channel-write-codec-rate"),
 			 switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname"));
 		break;
@@ -892,12 +992,12 @@
 		sql = switch_mprintf("update channels set application='%q',application_data='%q',"
 							 "presence_id='%q',presence_data='%q' where uuid='%q' and hostname='%q'",
 							 switch_event_get_header_nil(event, "application"),
-							 switch_event_get_header_nil(event, "application-data"), 
+							 switch_event_get_header_nil(event, "application-data"),
 							 switch_event_get_header_nil(event, "channel-presence-id"),
 							 switch_event_get_header_nil(event, "channel-presence-data"),
 							 switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname")
 
-							 );
+			);
 
 		break;
 	case SWITCH_EVENT_CHANNEL_STATE:
@@ -921,8 +1021,8 @@
 									 switch_event_get_header_nil(event, "caller-caller-id-name"),
 									 switch_event_get_header_nil(event, "caller-caller-id-number"),
 									 switch_event_get_header_nil(event, "caller-network-addr"),
-									 switch_event_get_header_nil(event, "caller-destination-number"), 
-									 switch_event_get_header_nil(event, "caller-dialplan"), 
+									 switch_event_get_header_nil(event, "caller-destination-number"),
+									 switch_event_get_header_nil(event, "caller-dialplan"),
 									 switch_event_get_header_nil(event, "caller-context"),
 									 switch_event_get_header_nil(event, "channel-presence-id"),
 									 switch_event_get_header_nil(event, "channel-presence-data"),
@@ -930,7 +1030,7 @@
 				break;
 			default:
 				sql = switch_mprintf("update channels set state='%s' where uuid='%s' and hostname='%q'",
-									 switch_event_get_header_nil(event, "channel-state"), 
+									 switch_event_get_header_nil(event, "channel-state"),
 									 switch_event_get_header_nil(event, "unique-id"), switch_core_get_variable("hostname"));
 				break;
 			}
@@ -939,7 +1039,7 @@
 	case SWITCH_EVENT_CHANNEL_BRIDGE:
 		sql = switch_mprintf("insert into calls values ('%s', '%ld', '%s','%q','%q','%q','%q','%s','%q','%q','%q','%q','%s','%q')",
 							 switch_event_get_header_nil(event, "event-date-local"),
-							 (long)switch_epoch_time_now(NULL),
+							 (long) switch_epoch_time_now(NULL),
 							 switch_event_get_header_nil(event, "event-calling-function"),
 							 switch_event_get_header_nil(event, "caller-caller-id-name"),
 							 switch_event_get_header_nil(event, "caller-caller-id-number"),
@@ -949,23 +1049,20 @@
 							 switch_event_get_header_nil(event, "Other-Leg-caller-id-name"),
 							 switch_event_get_header_nil(event, "Other-Leg-caller-id-number"),
 							 switch_event_get_header_nil(event, "Other-Leg-destination-number"),
-							 switch_event_get_header_nil(event, "Other-Leg-channel-name"), 
-							 switch_event_get_header_nil(event, "Other-Leg-unique-id"),
-							 switch_core_get_variable("hostname")
+							 switch_event_get_header_nil(event, "Other-Leg-channel-name"),
+							 switch_event_get_header_nil(event, "Other-Leg-unique-id"), switch_core_get_variable("hostname")
 			);
 		break;
 	case SWITCH_EVENT_CHANNEL_UNBRIDGE:
-		sql = switch_mprintf("delete from calls where caller_uuid='%s' and hostname='%q'", 
+		sql = switch_mprintf("delete from calls where caller_uuid='%s' and hostname='%q'",
 							 switch_event_get_header_nil(event, "caller-unique-id"), switch_core_get_variable("hostname"));
 		break;
 	case SWITCH_EVENT_SHUTDOWN:
 		sql = switch_mprintf("delete from channels where hostname='%q';"
 							 "delete from interfaces where hostname='%q';"
 							 "delete from calls where hostname='%q'",
-							 switch_core_get_variable("hostname"),
-							 switch_core_get_variable("hostname"),
-							 switch_core_get_variable("hostname")
-							 );
+							 switch_core_get_variable("hostname"), switch_core_get_variable("hostname"), switch_core_get_variable("hostname")
+			);
 		break;
 	case SWITCH_EVENT_LOG:
 		return;
@@ -979,10 +1076,11 @@
 			const char *filename = switch_event_get_header_nil(event, "filename");
 			if (!zstr(type) && !zstr(name)) {
 				sql =
-					switch_mprintf("insert into interfaces (type,name,description,syntax,key,filename,hostname) values('%q','%q','%q','%q','%q','%q','%q')",
-								   type, name, switch_str_nil(description), switch_str_nil(syntax), 
-								   switch_str_nil(key), switch_str_nil(filename), switch_core_get_variable("hostname")
-								   );
+					switch_mprintf
+					("insert into interfaces (type,name,description,syntax,ikey,filename,hostname) values('%q','%q','%q','%q','%q','%q','%q')", type, name,
+					 switch_str_nil(description), switch_str_nil(syntax), switch_str_nil(key), switch_str_nil(filename),
+					 switch_core_get_variable("hostname")
+					);
 			}
 			break;
 		}
@@ -991,7 +1089,7 @@
 			const char *type = switch_event_get_header_nil(event, "type");
 			const char *name = switch_event_get_header_nil(event, "name");
 			if (!zstr(type) && !zstr(name)) {
-				sql = switch_mprintf("delete from interfaces where type='%q' and name='%q' and hostname='%q'", type, name, 
+				sql = switch_mprintf("delete from interfaces where type='%q' and name='%q' and hostname='%q'", type, name,
 									 switch_core_get_variable("hostname"));
 			}
 			break;
@@ -1004,10 +1102,8 @@
 				break;
 			}
 			sql = switch_mprintf("update channels set secure='%s' where uuid='%s' and hostname='%q'",
-								 type,
-								 switch_event_get_header_nil(event, "caller-unique-id"),
-								 switch_core_get_variable("hostname")
-								 );
+								 type, switch_event_get_header_nil(event, "caller-unique-id"), switch_core_get_variable("hostname")
+				);
 			break;
 		}
 	case SWITCH_EVENT_NAT:
@@ -1017,15 +1113,12 @@
 			if (!strcmp("add", op)) {
 				sql = switch_mprintf("insert into nat (port, proto, sticky, hostname) values (%s, %s, %d,'%q')",
 									 switch_event_get_header_nil(event, "port"),
-									 switch_event_get_header_nil(event, "proto"),
-									 sticky,
-									 switch_core_get_variable("hostname")
-									 );
+									 switch_event_get_header_nil(event, "proto"), sticky, switch_core_get_variable("hostname")
+					);
 			} else if (!strcmp("del", op)) {
 				sql = switch_mprintf("delete from nat where port=%s and proto=%s and hostname='%q'",
 									 switch_event_get_header_nil(event, "port"),
-									 switch_event_get_header_nil(event, "proto"),
-									 switch_core_get_variable("hostname"));
+									 switch_event_get_header_nil(event, "proto"), switch_core_get_variable("hostname"));
 			} else if (!strcmp("status", op)) {
 				/* call show nat api */
 			} else if (!strcmp("status_response", op)) {
@@ -1052,97 +1145,72 @@
 
 static char create_complete_sql[] =
 	"CREATE TABLE complete (\n"
-	"   sticky  INTEGER,\n" 
-	"   a1  VARCHAR(4096),\n" 
-	"   a2  VARCHAR(4096),\n" 
-	"   a3  VARCHAR(4096),\n" 
-	"   a4  VARCHAR(4096),\n" 
-	"   a5  VARCHAR(4096),\n" 
-	"   a6  VARCHAR(4096),\n" 
-	"   a7  VARCHAR(4096),\n" 
-	"   a8  VARCHAR(4096),\n" 
-	"   a9  VARCHAR(4096),\n" 
-	"   a10 VARCHAR(4096),\n" 
-	"   hostname VARCHAR(4096)\n" 
-	");\n";
+	"   sticky  INTEGER,\n"
+	"   a1  VARCHAR(128),\n"
+	"   a2  VARCHAR(128),\n"
+	"   a3  VARCHAR(128),\n"
+	"   a4  VARCHAR(128),\n"
+	"   a5  VARCHAR(128),\n"
+	"   a6  VARCHAR(128),\n"
+	"   a7  VARCHAR(128),\n" "   a8  VARCHAR(128),\n" "   a9  VARCHAR(128),\n" "   a10 VARCHAR(128),\n" "   hostname VARCHAR(256)\n" ");\n";
 
 static char create_alias_sql[] =
-	"CREATE TABLE aliases (\n"
-	"   sticky  INTEGER,\n" 
-	"   alias  VARCHAR(4096),\n" 
-	"   command  VARCHAR(4096),\n" 
-	"   hostname VARCHAR(4096)\n" 
-	");\n";
+	"CREATE TABLE aliases (\n" "   sticky  INTEGER,\n" "   alias  VARCHAR(128),\n" "   command  VARCHAR(4096),\n" "   hostname VARCHAR(256)\n" ");\n";
 
 static char create_channels_sql[] =
 	"CREATE TABLE channels (\n"
-	"   uuid  VARCHAR(4096),\n"
-	"   direction  VARCHAR(4096),\n"
-	"   created  VARCHAR(4096),\n"
+	"   uuid  VARCHAR(256),\n"
+	"   direction  VARCHAR(32),\n"
+	"   created  VARCHAR(128),\n"
 	"   created_epoch  INTEGER,\n"
-	"   name  VARCHAR(4096),\n"
-	"   state  VARCHAR(4096),\n"
-	"   cid_name  VARCHAR(4096),\n"
-	"   cid_num  VARCHAR(4096),\n"
-	"   ip_addr  VARCHAR(4096),\n"
-	"   dest  VARCHAR(4096),\n"
-	"   application  VARCHAR(4096),\n"
+	"   name  VARCHAR(1024),\n"
+	"   state  VARCHAR(64),\n"
+	"   cid_name  VARCHAR(1024),\n"
+	"   cid_num  VARCHAR(256),\n"
+	"   ip_addr  VARCHAR(256),\n"
+	"   dest  VARCHAR(1024),\n"
+	"   application  VARCHAR(128),\n"
 	"   application_data  VARCHAR(4096),\n"
-	"   dialplan VARCHAR(4096),\n"
-	"   context VARCHAR(4096),\n"
-	"   read_codec  VARCHAR(4096),\n" 
-	"   read_rate  VARCHAR(4096),\n" 
-	"   write_codec  VARCHAR(4096),\n" 
-	"   write_rate  VARCHAR(4096),\n" 
-	"   secure VARCHAR(4096),\n"
-	"   hostname VARCHAR(4096),\n" 
-	"   presence_id VARCHAR(4096),\n" 
-	"   presence_data VARCHAR(4096)\n" 
-	");\ncreate index uuindex on channels (uuid,hostname);\n";
+	"   dialplan VARCHAR(128),\n"
+	"   context VARCHAR(128),\n"
+	"   read_codec  VARCHAR(128),\n"
+	"   read_rate  VARCHAR(32),\n"
+	"   write_codec  VARCHAR(128),\n"
+	"   write_rate  VARCHAR(32),\n"
+	"   secure VARCHAR(32),\n"
+	"   hostname VARCHAR(256),\n"
+	"   presence_id VARCHAR(4096),\n" "   presence_data VARCHAR(4096)\n" ");\ncreate index uuindex on channels (uuid,hostname);\n";
 static char create_calls_sql[] =
 	"CREATE TABLE calls (\n"
-	"   call_created  VARCHAR(4096),\n"
+	"   call_created  VARCHAR(128),\n"
 	"   call_created_epoch  INTEGER,\n"
-	"   function  VARCHAR(4096),\n"
-	"   caller_cid_name  VARCHAR(4096),\n"
-	"   caller_cid_num   VARCHAR(4096),\n"
-	"   caller_dest_num  VARCHAR(4096),\n"
-	"   caller_chan_name VARCHAR(4096),\n"
-	"   caller_uuid      VARCHAR(4096),\n"
-	"   callee_cid_name  VARCHAR(4096),\n"
-	"   callee_cid_num   VARCHAR(4096),\n"
-	"   callee_dest_num  VARCHAR(4096),\n" 
-	"   callee_chan_name VARCHAR(4096),\n" 
-	"   callee_uuid      VARCHAR(4096),\n" 
-	"   hostname VARCHAR(4096)\n" 
-	");\n"
-	"create index eruuindex on calls (caller_uuid,hostname);\n"
-	"create index eeuuindex on calls (callee_uuid,hostname);\n";
+	"   function  VARCHAR(1024),\n"
+	"   caller_cid_name  VARCHAR(1024),\n"
+	"   caller_cid_num   VARCHAR(256),\n"
+	"   caller_dest_num  VARCHAR(256),\n"
+	"   caller_chan_name VARCHAR(1024),\n"
+	"   caller_uuid      VARCHAR(256),\n"
+	"   callee_cid_name  VARCHAR(1024),\n"
+	"   callee_cid_num   VARCHAR(256),\n"
+	"   callee_dest_num  VARCHAR(256),\n"
+	"   callee_chan_name VARCHAR(1024),\n"
+	"   callee_uuid      VARCHAR(256),\n"
+	"   hostname VARCHAR(256)\n"
+	");\n" "create index eruuindex on calls (caller_uuid,hostname);\n" "create index eeuuindex on calls (callee_uuid,hostname);\n";
 static char create_interfaces_sql[] =
 	"CREATE TABLE interfaces (\n"
-	"   type             VARCHAR(4096),\n"
-	"   name             VARCHAR(4096),\n" 
-	"   description      VARCHAR(4096),\n" 
-	"   key              VARCHAR(4096),\n" 
-	"   filename         VARCHAR(4096),\n" 
-	"   syntax           VARCHAR(4096),\n" 
-	"   hostname VARCHAR(4096)\n" 
-	");\n";
+	"   type             VARCHAR(128),\n"
+	"   name             VARCHAR(1024),\n"
+	"   description      VARCHAR(4096),\n"
+	"   ikey             VARCHAR(1024),\n"
+	"   filename         VARCHAR(4096),\n" "   syntax           VARCHAR(4096),\n" "   hostname VARCHAR(256)\n" ");\n";
 static char create_tasks_sql[] =
 	"CREATE TABLE tasks (\n"
 	"   task_id             INTEGER,\n"
-	"   task_desc           VARCHAR(4096),\n" 
-	"   task_group          VARCHAR(4096),\n" 
-	"   task_sql_manager    INTEGER,\n" 
-	"   hostname VARCHAR(4096)\n" 
-	");\n";
-static char create_nat_sql[] = 
-	"CREATE TABLE nat (\n"
-	"   sticky  INTEGER,\n" 
-	"	port	INTEGER,\n"
-	"	proto	INTEGER,\n"
-	"   hostname VARCHAR(4096)\n" 
-	");\n";
+	"   task_desc           VARCHAR(4096),\n"
+	"   task_group          VARCHAR(1024),\n" "   task_sql_manager    INTEGER,\n" "   hostname VARCHAR(256)\n" ");\n";
+static char create_nat_sql[] =
+	"CREATE TABLE nat (\n" "   sticky  INTEGER,\n" "	port	INTEGER,\n" "	proto	INTEGER,\n" "   hostname VARCHAR(256)\n" ");\n";
 
 switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_t manage)
 {
@@ -1151,12 +1219,14 @@
 
 	sql_manager.memory_pool = pool;
 	sql_manager.manage = manage;
-	
-	switch_mutex_init(&dbh_mutex, SWITCH_MUTEX_NESTED, sql_manager.memory_pool);
-	switch_core_hash_init(&dbh_hash, sql_manager.memory_pool);
 
- top:
-	
+	switch_mutex_init(&sql_manager.dbh_mutex, SWITCH_MUTEX_NESTED, sql_manager.memory_pool);
+	switch_mutex_init(&sql_manager.io_mutex, SWITCH_MUTEX_NESTED, sql_manager.memory_pool);
+
+	switch_core_hash_init(&sql_manager.dbh_hash, sql_manager.memory_pool);
+
+  top:
+
 	/* Activate SQL database */
 	if (switch_core_db_handle(&dbh) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB!\n");
@@ -1174,18 +1244,18 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Opening DB\n");
 
 	switch (dbh->type) {
 	case SCDB_TYPE_ODBC:
 		{
 			char sql[512] = "";
-			char *tables[] = {"channels", "calls", "interfaces", "tasks", NULL};
+			char *tables[] = { "channels", "calls", "interfaces", "tasks", NULL };
 			int i;
 			const char *hostname = switch_core_get_variable("hostname");
 
-			for(i = 0; tables[i]; i++) {
+			for (i = 0; tables[i]; i++) {
 				switch_snprintf(sql, sizeof(sql), "delete from %s where hostname='%s'", tables[i], hostname);
 				switch_cache_db_execute_sql(dbh, sql, NULL);
 			}
@@ -1205,7 +1275,7 @@
 		break;
 	}
 
-		
+
 	switch_cache_db_test_reactive(dbh, "select hostname from complete", "DROP TABLE complete", create_complete_sql);
 	switch_cache_db_test_reactive(dbh, "select hostname from aliases", "DROP TABLE aliases", create_alias_sql);
 	switch_cache_db_test_reactive(dbh, "select hostname from nat", "DROP TABLE nat", create_nat_sql);
@@ -1217,11 +1287,11 @@
 			char *err;
 			switch_cache_db_test_reactive(dbh, "select hostname from channels", "DROP TABLE channels", create_channels_sql);
 			switch_cache_db_test_reactive(dbh, "select hostname from calls", "DROP TABLE calls", create_calls_sql);
-			switch_cache_db_test_reactive(dbh, "select hostname from interfaces", "DROP TABLE interfaces", create_interfaces_sql);
+			switch_cache_db_test_reactive(dbh, "select ikey from interfaces", "DROP TABLE interfaces", create_interfaces_sql);
 			switch_cache_db_test_reactive(dbh, "select hostname from tasks", "DROP TABLE tasks", create_tasks_sql);
-			
+
 			switch_cache_db_execute_sql(dbh, "begin;delete from channels where hostname='';delete from channels where hostname='';commit;", &err);
-			
+
 			if (err) {
 				runtime.odbc_dsn = NULL;
 				runtime.odbc_user = NULL;
@@ -1242,12 +1312,13 @@
 		}
 		break;
 	}
-	
 
+
 	switch_cache_db_execute_sql(dbh, "delete from complete where sticky=0", NULL);
 	switch_cache_db_execute_sql(dbh, "delete from aliases where sticky=0", NULL);
 	switch_cache_db_execute_sql(dbh, "delete from nat where sticky=0", NULL);
 	switch_cache_db_execute_sql(dbh, "create index alias1 on aliases (alias)", NULL);
+	switch_cache_db_execute_sql(dbh, "create index tasks1 on tasks (hostname,task_id)", NULL);
 	switch_cache_db_execute_sql(dbh, "create index complete1 on complete (a1,hostname)", NULL);
 	switch_cache_db_execute_sql(dbh, "create index complete2 on complete (a2,hostname)", NULL);
 	switch_cache_db_execute_sql(dbh, "create index complete3 on complete (a3,hostname)", NULL);
@@ -1258,13 +1329,13 @@
 	switch_cache_db_execute_sql(dbh, "create index complete8 on complete (a8,hostname)", NULL);
 	switch_cache_db_execute_sql(dbh, "create index complete9 on complete (a9,hostname)", NULL);
 	switch_cache_db_execute_sql(dbh, "create index complete10 on complete (a10,hostname)", NULL);
-	switch_cache_db_execute_sql(dbh, "create unique index nat_map_port_proto on nat (port,proto,hostname)", NULL);
+	switch_cache_db_execute_sql(dbh, "create index nat_map_port_proto on nat (port,proto,hostname)", NULL);
 	switch_cache_db_execute_sql(dbh, "create index channels1 on channels(hostname)", NULL);
 	switch_cache_db_execute_sql(dbh, "create index calls1 on calls(hostname)", NULL);
 
 
 	if (sql_manager.manage) {
-		if (switch_event_bind_removable("core_db", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, 
+		if (switch_event_bind_removable("core_db", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY,
 										core_event_handler, NULL, &sql_manager.event_node) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind event handler!\n");
 		}
@@ -1280,7 +1351,7 @@
 	while (!sql_manager.thread_running) {
 		switch_yield(10000);
 	}
-	
+
 	switch_cache_db_release_db_handle(&dbh);
 
 	return SWITCH_STATUS_SUCCESS;
@@ -1291,7 +1362,7 @@
 	switch_status_t st;
 
 	switch_event_unbind(&sql_manager.event_node);
-	
+
 	if (sql_manager.thread && sql_manager.thread_running) {
 
 		if (sql_manager.manage) {
@@ -1306,7 +1377,7 @@
 
 	sql_close(0);
 
-	switch_core_hash_destroy(&dbh_hash);
+	switch_core_hash_destroy(&sql_manager.dbh_hash);
 
 }
 
@@ -1323,10 +1394,10 @@
 	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_mutex_lock(sql_manager.dbh_mutex);
+
+	for (hi = switch_hash_first(NULL, sql_manager.dbh_hash); hi; hi = switch_hash_next(hi)) {
 		switch_hash_this(hi, &var, NULL, &val);
 		key = (char *) var;
 
@@ -1335,7 +1406,7 @@
 			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;
@@ -1347,22 +1418,20 @@
 			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);
-			
-			
+			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);
+								   "\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);
+	switch_mutex_unlock(sql_manager.dbh_mutex);
 }
 
 /* For Emacs:

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_state_machine.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_state_machine.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_state_machine.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -57,8 +57,7 @@
 static void switch_core_standard_on_destroy(switch_core_session_t *session)
 {
 
-	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard DESTROY\n",
-					  switch_channel_get_name(session->channel));
+	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard DESTROY\n", switch_channel_get_name(session->channel));
 }
 
 static void switch_core_standard_on_reset(switch_core_session_t *session)
@@ -77,11 +76,9 @@
 
 	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard ROUTING\n", switch_channel_get_name(session->channel));
 
-	if (
-		(switch_channel_test_flag(session->channel, CF_ANSWERED) || 
+	if ((switch_channel_test_flag(session->channel, CF_ANSWERED) ||
 		 switch_channel_test_flag(session->channel, CF_EARLY_MEDIA) ||
-		 switch_channel_test_flag(session->channel, CF_SIGNAL_BRIDGE_TTL)) && 
-		switch_channel_test_flag(session->channel, CF_PROXY_MODE)) {
+		 switch_channel_test_flag(session->channel, CF_SIGNAL_BRIDGE_TTL)) && switch_channel_test_flag(session->channel, CF_PROXY_MODE)) {
 		switch_ivr_media(session->uuid_str, SMF_NONE);
 	}
 
@@ -100,7 +97,7 @@
 				for (x = 0; x < argc; x++) {
 					char *dpname = dp[x];
 					char *dparg = NULL;
-					
+
 					if (dpname) {
 						if ((dparg = strchr(dpname, ':'))) {
 							*dparg++ = '\0';
@@ -111,12 +108,12 @@
 					if (!(dialplan_interface = switch_loadable_module_get_dialplan_interface(dpname))) {
 						continue;
 					}
-					
+
 					count++;
-					
+
 					extension = dialplan_interface->hunt_function(session, dparg, NULL);
 					UNPROTECT_INTERFACE(dialplan_interface);
-					
+
 					if (extension) {
 						switch_channel_set_caller_extension(session->channel, extension);
 						switch_channel_set_state(session->channel, CS_EXECUTE);
@@ -129,7 +126,8 @@
 		if (!count) {
 			if (switch_channel_test_flag(session->channel, CF_OUTBOUND)) {
 				if (switch_channel_test_flag(session->channel, CF_ANSWERED)) {
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No Dialplan on answered channel, changing state to HANGUP\n");
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+									  "No Dialplan on answered channel, changing state to HANGUP\n");
 					switch_channel_hangup(session->channel, SWITCH_CAUSE_NO_ROUTE_DESTINATION);
 				} else {
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No Dialplan, changing state to CONSUME_MEDIA\n");
@@ -180,11 +178,13 @@
 		if (switch_channel_test_flag(session->channel, CF_RESET)) {
 			goto top;
 		}
-		
+
 	}
 
-	if (switch_channel_get_state(session->channel) == CS_EXECUTE) {
-		switch_channel_hangup(session->channel, SWITCH_CAUSE_NORMAL_CLEARING);		
+	if (switch_channel_ready(session->channel) && switch_channel_get_state(session->channel) == CS_EXECUTE) {
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "%s has executed the last dialplan instruction, hanging up.\n",
+						  switch_channel_get_name(session->channel));
+		switch_channel_hangup(session->channel, SWITCH_CAUSE_NORMAL_CLEARING);
 	}
 }
 
@@ -303,25 +303,25 @@
 	while ((state = switch_channel_get_state(session->channel)) != CS_DESTROY) {
 
 		switch_channel_wait_for_flag(session->channel, CF_BLOCK_STATE, SWITCH_FALSE, 0, NULL);
-		
+
 		midstate = state;
 		if (state != switch_channel_get_running_state(session->channel) || state >= CS_HANGUP) {
 			int index = 0;
 			int proceed = 1;
 			int global_proceed = 1;
 			int do_extra_handlers = 1;
-			
+
 			switch_channel_set_running_state(session->channel, state);
 			switch_channel_clear_flag(session->channel, CF_TRANSFER);
 			switch_channel_clear_flag(session->channel, CF_REDIRECT);
 
 			switch (state) {
-			case CS_NEW: /* Just created, Waiting for first instructions */
+			case CS_NEW:		/* Just created, Waiting for first instructions */
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "(%s) State NEW\n", switch_channel_get_name(session->channel));
 				break;
 			case CS_DESTROY:
 				goto done;
-			case CS_REPORTING: /* Call Detail */
+			case CS_REPORTING:	/* Call Detail */
 				{
 					switch_core_session_reporting_state(session);
 					switch_channel_set_state(session->channel, CS_DESTROY);
@@ -329,7 +329,7 @@
 				goto done;
 			case CS_HANGUP:	/* Deactivate and end the thread */
 				{
-					switch_core_session_hangup_state(session);				
+					switch_core_session_hangup_state(session, SWITCH_TRUE);
 					switch_channel_set_state(session->channel, CS_REPORTING);
 				}
 
@@ -379,21 +379,26 @@
 			if (endstate == CS_NEW) {
 				switch_cond_next();
 				if (!--new_loops) {
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "%s Timeout waiting for next instruction in CS_NEW!\n", session->uuid_str);
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "%s Timeout waiting for next instruction in CS_NEW!\n",
+									  session->uuid_str);
 					switch_channel_hangup(session->channel, SWITCH_CAUSE_INVALID_CALL_REFERENCE);
 				}
 			} else {
 				switch_core_session_message_t *message;
-					
+
 				while (switch_core_session_dequeue_message(session, &message) == SWITCH_STATUS_SUCCESS) {
 					switch_core_session_receive_message(session, message);
 					message = NULL;
 				}
 
-				switch_channel_set_flag(session->channel, CF_THREAD_SLEEPING);
-				switch_thread_cond_wait(session->cond, session->mutex);
-				switch_channel_clear_flag(session->channel, CF_THREAD_SLEEPING);
-				
+				if (switch_channel_get_state(session->channel) == switch_channel_get_running_state(session->channel)) {
+					switch_channel_set_flag(session->channel, CF_THREAD_SLEEPING);
+					if (switch_channel_get_state(session->channel) == switch_channel_get_running_state(session->channel)) {
+						switch_thread_cond_wait(session->cond, session->mutex);
+					}
+					switch_channel_clear_flag(session->channel, CF_THREAD_SLEEPING);
+				}
+
 				while (switch_core_session_dequeue_message(session, &message) == SWITCH_STATUS_SUCCESS) {
 					switch_core_session_receive_message(session, message);
 					message = NULL;
@@ -430,14 +435,14 @@
 
 	driver_state_handler = endpoint_interface->state_handler;
 	switch_assert(driver_state_handler != NULL);
-	
+
 	STATE_MACRO(destroy, "DESTROY");
 
 	return;
 }
 
 
-SWITCH_DECLARE(void) switch_core_session_hangup_state(switch_core_session_t *session)
+SWITCH_DECLARE(void) switch_core_session_hangup_state(switch_core_session_t *session, switch_bool_t force)
 {
 	const char *hook_var;
 	switch_core_session_t *use_session = NULL;
@@ -455,13 +460,21 @@
 	const switch_state_handler_table_t *application_state_handler = NULL;
 
 
-	if (switch_thread_self() != session->thread_id) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "thread mismatch skipping state handler.\n");
-		return;
+	if (!force) {
+		if (!switch_channel_test_flag(session->channel, CF_EARLY_HANGUP) && !switch_test_flag((&runtime), SCF_EARLY_HANGUP)) {
+			return;
+		}
+
+		if (switch_thread_self() != session->thread_id) {
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "%s thread mismatch skipping state handler.\n",
+							  switch_channel_get_name(session->channel));
+			return;
+		}
 	}
 
 	if (switch_test_flag(session, SSF_HANGUP)) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "handler already called, skipping state handler.\n");
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG10, "%s handler already called, skipping state handler.\n",
+						  switch_channel_get_name(session->channel));
 		return;
 	}
 
@@ -474,15 +487,15 @@
 	switch_channel_set_hangup_time(session->channel);
 
 	switch_core_media_bug_remove_all(session);
-				
+
 	switch_channel_stop_broadcast(session->channel);
-					
+
 	switch_channel_set_variable(session->channel, "hangup_cause", switch_channel_cause2str(cause));
 	switch_channel_set_variable_printf(session->channel, "hangup_cause_q850", "%d", cause_q850);
 	switch_channel_presence(session->channel, "unknown", switch_channel_cause2str(cause), NULL);
-					
+
 	switch_channel_set_timestamps(session->channel);
-					
+
 	STATE_MACRO(hangup, "HANGUP");
 
 	hook_var = switch_channel_get_variable(session->channel, SWITCH_API_HANGUP_HOOK_VARIABLE);
@@ -495,8 +508,8 @@
 		char *cmd = switch_core_session_strdup(session, hook_var);
 		char *arg = NULL;
 		char *expanded = NULL;
-						
-		if ((arg = strchr(cmd, ':')) && *(arg+1) == ':') {
+
+		if ((arg = strchr(cmd, ':')) && *(arg + 1) == ':') {
 			*arg++ = '\0';
 			*arg++ = '\0';
 		} else {
@@ -506,13 +519,13 @@
 		}
 
 		SWITCH_STANDARD_STREAM(stream);
-						
+
 		switch_channel_get_variables(session->channel, &stream.param_event);
 		switch_channel_event_set_data(session->channel, stream.param_event);
 		expanded = switch_channel_expand_variables(session->channel, arg);
 
 		switch_api_execute(cmd, expanded, use_session, &stream);
-						
+
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Hangup Command %s(%s):\n%s\n", cmd, switch_str_nil(expanded),
 						  switch_str_nil((char *) stream.data));
 
@@ -529,7 +542,7 @@
 	}
 
 	switch_set_flag(session, SSF_HANGUP);
-	
+
 }
 
 SWITCH_DECLARE(void) switch_core_session_reporting_state(switch_core_session_t *session)
@@ -550,7 +563,7 @@
 	}
 
 	switch_channel_set_flag(session->channel, CF_REPORTING);
-	
+
 	switch_assert(session != NULL);
 
 	session->thread_running = 1;
@@ -559,7 +572,7 @@
 
 	driver_state_handler = endpoint_interface->state_handler;
 	switch_assert(driver_state_handler != NULL);
-	
+
 	if (!zstr(var)) {
 		if (!strcasecmp(var, "a_only")) {
 			if (switch_channel_get_originator_caller_profile(session->channel)) {
@@ -575,7 +588,7 @@
 	}
 
 	STATE_MACRO(reporting, "REPORTING");
-					
+
 	return;
 }
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_timer.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_timer.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_core_timer.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_cpp.cpp (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_cpp.cpp	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_cpp.cpp	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -341,7 +341,7 @@
 	return false;
 }
 
-SWITCH_DECLARE(const char *)Event::getHeader(char *header_name)
+SWITCH_DECLARE(const char *)Event::getHeader(const char *header_name)
 {
 	this_check("");
 
@@ -515,7 +515,7 @@
 SWITCH_DECLARE_CONSTRUCTOR CoreSession::~CoreSession()
 {
 	this_check_void();
-	destroy();
+	if (allocated) destroy();
 }
 
 SWITCH_DECLARE(char *) CoreSession::getXMLCDR()
@@ -569,7 +569,7 @@
 	sanity_check_noreturn;	
 	this->begin_allow_threads();
 	if (switch_channel_down(channel)) {
-		switch_core_session_hangup_state(session);
+		switch_core_session_hangup_state(session, SWITCH_FALSE);
 	}
 	this->end_allow_threads();
 }
@@ -930,6 +930,8 @@
 		return;
 	}
 
+	allocated = 0;
+
 	switch_safe_free(xml_cdr_text);
 	switch_safe_free(uuid);	
 	switch_safe_free(tts_name);
@@ -941,14 +943,14 @@
 		}
 
 		if (channel) {
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
+							  "%s destroy/unlink session from object\n", switch_channel_get_name(channel));
 			switch_channel_set_private(channel, "CoreSession", NULL);
+			if (switch_channel_up(channel) && switch_test_flag(this, S_HUP) && !switch_channel_test_flag(channel, CF_TRANSFER)) {
+				switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+			}
 		}
-		
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "destroy/unlink session from object\n");
-		
-        if (switch_channel_up(channel) && switch_test_flag(this, S_HUP) && !switch_channel_test_flag(channel, CF_TRANSFER)) {
-            switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
-        }
+
         switch_core_session_rwunlock(session);
 		session = NULL;
 		channel = NULL;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_dso.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_dso.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_dso.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -24,16 +24,18 @@
 
 #ifdef WIN32
 
-SWITCH_DECLARE(void) switch_dso_destroy(switch_dso_lib_t *lib) {
+SWITCH_DECLARE(void) switch_dso_destroy(switch_dso_lib_t *lib)
+{
 	if (lib && *lib) {
 		FreeLibrary(*lib);
 		*lib = NULL;
 	}
 }
 
-SWITCH_DECLARE(switch_dso_lib_t) switch_dso_open(const char *path, int global, char **err) {
-    HINSTANCE lib;
-	
+SWITCH_DECLARE(switch_dso_lib_t) switch_dso_open(const char *path, int global, char **err)
+{
+	HINSTANCE lib;
+
 	lib = LoadLibraryEx(path, NULL, 0);
 
 	if (!lib) {
@@ -48,22 +50,24 @@
 	return lib;
 }
 
-SWITCH_DECLARE(switch_dso_func_t) switch_dso_func_sym(switch_dso_lib_t lib, const char *sym, char **err) {
+SWITCH_DECLARE(switch_dso_func_t) switch_dso_func_sym(switch_dso_lib_t lib, const char *sym, char **err)
+{
 	FARPROC func = GetProcAddress(lib, sym);
 	if (!func) {
 		DWORD error = GetLastError();
 		*err = switch_mprintf("dll sym error [%ul]\n", error);
 	}
-	return (switch_dso_func_t)func;
+	return (switch_dso_func_t) func;
 }
 
-SWITCH_DECLARE(void *) switch_dso_data_sym(switch_dso_lib_t lib, const char *sym, char **err) {
+SWITCH_DECLARE(void *) switch_dso_data_sym(switch_dso_lib_t lib, const char *sym, char **err)
+{
 	FARPROC addr = GetProcAddress(lib, sym);
 	if (!addr) {
 		DWORD error = GetLastError();
 		*err = switch_mprintf("dll sym error [%ul]\n", error);
 	}
-	return (void *)(intptr_t)addr;
+	return (void *) (intptr_t) addr;
 }
 
 
@@ -80,16 +84,18 @@
 
 #include <dlfcn.h>
 
-void switch_dso_destroy(switch_dso_lib_t *lib) {
+void switch_dso_destroy(switch_dso_lib_t *lib)
+{
 	if (lib && *lib) {
 		dlclose(*lib);
 		*lib = NULL;
 	}
 }
 
-switch_dso_lib_t switch_dso_open(const char *path, int global, char **err) {
+switch_dso_lib_t switch_dso_open(const char *path, int global, char **err)
+{
 	void *lib;
-	
+
 	if (global) {
 		lib = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
 	} else {
@@ -108,15 +114,17 @@
 	return lib;
 }
 
-switch_dso_func_t switch_dso_func_sym(switch_dso_lib_t lib, const char *sym, char **err) {
+switch_dso_func_t switch_dso_func_sym(switch_dso_lib_t lib, const char *sym, char **err)
+{
 	void *func = dlsym(lib, sym);
 	if (!func) {
 		*err = strdup(dlerror());
 	}
-	return (switch_dso_func_t)(intptr_t)func;
+	return (switch_dso_func_t) (intptr_t) func;
 }
 
-void *switch_dso_data_sym(switch_dso_lib_t lib, const char *sym, char **err) {
+void *switch_dso_data_sym(switch_dso_lib_t lib, const char *sym, char **err)
+{
 	void *addr = dlsym(lib, sym);
 	if (!addr) {
 		*err = strdup(dlerror());

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_event.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_event.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_event.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -59,6 +59,8 @@
 	char *owner;
 	/*! the subclass name */
 	char *name;
+	/*! the subclass was reserved by a listener so it's ok for a module to reserve it still */
+	int bind;
 };
 
 #define MAX_DISPATCH_VAL 20
@@ -183,21 +185,23 @@
 	"RECORD_START",
 	"RECORD_STOP",
 	"CALL_UPDATE",
+	"FAILURE",
+	"SOCKET_DATA",
 	"ALL"
 };
 
 static int switch_events_match(switch_event_t *event, switch_event_node_t *node)
 {
 	int match = 0;
-	
+
 	if (node->event_id == SWITCH_EVENT_ALL) {
 		match++;
-		
+
 		if (!node->subclass) {
 			return match;
 		}
 	}
-	
+
 	if (match || event->event_id == node->event_id) {
 
 		if (event->subclass_name && node->subclass) {
@@ -345,7 +349,7 @@
 					node->callback(*event);
 				}
 			}
-			
+
 			if (e == SWITCH_EVENT_ALL) {
 				break;
 			}
@@ -403,9 +407,12 @@
 			FREE(subclass);
 			status = SWITCH_STATUS_SUCCESS;
 			switch_thread_rwlock_unlock(RWLOCK);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Subclass reservation %s inuse by listeners, detaching..\n", subclass_name);
+			subclass->bind = 1;
 		}
 	}
-	
+
 	return status;
 }
 
@@ -416,7 +423,12 @@
 	switch_assert(RUNTIME_POOL != NULL);
 	switch_assert(CUSTOM_HASH != NULL);
 
-	if (switch_core_hash_find(CUSTOM_HASH, subclass_name)) {
+	if ((subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name))) {
+		/* a listener reserved it for us, now we can lock it so nobody else can have it */
+		if (subclass->bind) {
+			subclass->bind = 0;
+			return SWITCH_STATUS_SUCCESS;
+		}
 		return SWITCH_STATUS_INUSE;
 	}
 
@@ -424,7 +436,7 @@
 
 	subclass->owner = DUP(owner);
 	subclass->name = DUP(subclass_name);
-	
+
 	switch_core_hash_insert(CUSTOM_HASH, subclass->name, subclass);
 
 	return SWITCH_STATUS_SUCCESS;
@@ -461,7 +473,7 @@
 	int last = 0;
 	switch_hash_index_t *hi;
 	const void *var;
-    void *val;
+	void *val;
 
 	switch_mutex_lock(EVENT_QUEUE_MUTEX);
 	SYSTEM_RUNNING = 0;
@@ -486,10 +498,10 @@
 		}
 		last = THREAD_COUNT;
 	}
-	
+
 	for (x = 0; x < SOFT_MAX_DISPATCH; x++) {
 		void *pop = NULL;
-        switch_event_t *event = NULL;
+		switch_event_t *event = NULL;
 		switch_status_t st;
 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping dispatch thread %d\n", x);
@@ -498,12 +510,12 @@
 		while (switch_queue_trypop(EVENT_DISPATCH_QUEUE[x], &pop) == SWITCH_STATUS_SUCCESS && pop) {
 			event = (switch_event_t *) pop;
 			switch_event_destroy(&event);
-        }
+		}
 	}
 
 	for (x = 0; x < NUMBER_OF_QUEUES; x++) {
 		void *pop = NULL;
-        switch_event_t *event = NULL;
+		switch_event_t *event = NULL;
 		switch_status_t st;
 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping queue thread %d\n", x);
@@ -512,9 +524,9 @@
 		while (switch_queue_trypop(EVENT_QUEUE[x], &pop) == SWITCH_STATUS_SUCCESS && pop) {
 			event = (switch_event_t *) pop;
 			switch_event_destroy(&event);
-        }
+		}
 	}
-	
+
 	for (hi = switch_hash_first(NULL, CUSTOM_HASH); hi; hi = switch_hash_next(hi)) {
 		switch_event_subclass_t *subclass;
 		switch_hash_this(hi, &var, NULL, &val);
@@ -622,7 +634,6 @@
 	if ((event_id != SWITCH_EVENT_CLONE && event_id != SWITCH_EVENT_CUSTOM) && subclass_name) {
 		return SWITCH_STATUS_GENERR;
 	}
-
 #ifdef SWITCH_EVENT_RECYCLE
 	if (switch_queue_trypop(EVENT_RECYCLE_QUEUE, &pop) == SWITCH_STATUS_SUCCESS && pop) {
 		*event = (switch_event_t *) pop;
@@ -668,12 +679,13 @@
 
 	switch_assert(event);
 
-	if (!header_name) return NULL;
-	
+	if (!header_name)
+		return NULL;
+
 	hash = switch_ci_hashfunc_default(header_name, &hlen);
-	
+
 	for (hp = event->headers; hp; hp = hp->next) {
-		if ((!hp->hash || hash == hp->hash) && !strcasecmp(hp->name, header_name) ) {
+		if ((!hp->hash || hash == hp->hash) && !strcasecmp(hp->name, header_name)) {
 			return hp->value;
 		}
 	}
@@ -685,7 +697,7 @@
 	return (event ? event->body : NULL);
 }
 
-SWITCH_DECLARE(switch_status_t) switch_event_del_header(switch_event_t *event, const char *header_name)
+SWITCH_DECLARE(switch_status_t) switch_event_del_header_val(switch_event_t *event, const char *header_name, const char *val)
 {
 	switch_event_header_t *hp, *lp = NULL, *tp;
 	switch_status_t status = SWITCH_STATUS_FALSE;
@@ -697,12 +709,12 @@
 	while (tp) {
 		hp = tp;
 		tp = tp->next;
-		
+
 		x++;
 		switch_assert(x < 1000);
 		hash = switch_ci_hashfunc_default(header_name, &hlen);
 
-		if ((!hp->hash || hash == hp->hash) && !strcasecmp(header_name, hp->name)) {
+		if ((!hp->hash || hash == hp->hash) && !strcasecmp(header_name, hp->name) && (zstr(val) || !strcmp(hp->value, val))) {
 			if (lp) {
 				lp->next = hp->next;
 			} else {
@@ -756,7 +768,7 @@
 	header->name = DUP(header_name);
 	header->value = data;
 	header->hash = switch_ci_hashfunc_default(header->name, &hlen);
-	
+
 	if (stack == SWITCH_STACK_TOP) {
 		header->next = event->headers;
 		event->headers = header;
@@ -795,12 +807,13 @@
 
 SWITCH_DECLARE(switch_status_t) switch_event_set_subclass_name(switch_event_t *event, const char *subclass_name)
 {
-	if (!event || !subclass_name) return SWITCH_STATUS_GENERR;
-	
+	if (!event || !subclass_name)
+		return SWITCH_STATUS_GENERR;
+
 	switch_safe_free(event->subclass_name);
 	event->subclass_name = DUP(subclass_name);
 	switch_event_del_header(event, "Event-Subclass");
-	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Event-Subclass", subclass_name);
+	switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Event-Subclass", event->subclass_name);
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1018,23 +1031,23 @@
 static switch_xml_t add_xml_header(switch_xml_t xml, char *name, char *value, int offset)
 {
 	switch_xml_t header = switch_xml_add_child_d(xml, name, offset);
-	
+
 	if (header) {
 		switch_size_t encode_len = (strlen(value) * 3) + 1;
 		char *encode_buf = malloc(encode_len);
-		
+
 		switch_assert(encode_buf);
- 
+
 		memset(encode_buf, 0, encode_len);
 		switch_url_encode((char *) value, encode_buf, encode_len);
 		switch_xml_set_txt_d(header, encode_buf);
 		free(encode_buf);
 	}
-	
+
 	return header;
 }
 
-SWITCH_DECLARE(switch_xml_t) switch_event_xmlize(switch_event_t *event, const char *fmt, ...)
+SWITCH_DECLARE(switch_xml_t) switch_event_xmlize(switch_event_t *event, const char *fmt,...)
 {
 	switch_event_header_t *hp;
 	char *data = NULL, *body = NULL;
@@ -1158,19 +1171,19 @@
 				goto end;
 			}
 		}
-		
+
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Event queue is full!\n");
 		switch_yield(100000);
 	}
 
- end:
+  end:
 
 	*event = NULL;
 
 	return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_event_bind_removable(const char *id, switch_event_types_t event, const char *subclass_name, 
+SWITCH_DECLARE(switch_status_t) switch_event_bind_removable(const char *id, switch_event_types_t event, const char *subclass_name,
 															switch_event_callback_t callback, void *user_data, switch_event_node_t **node)
 {
 	switch_event_node_t *event_node;
@@ -1187,13 +1200,14 @@
 		if (!(subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name))) {
 			switch_event_reserve_subclass_detailed(id, subclass_name);
 			subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name);
+			subclass->bind = 1;
 		}
 		if (!subclass) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not reserve subclass. '%s'\n", subclass_name);
 			return SWITCH_STATUS_FALSE;
 		}
 	}
-	
+
 	if (event <= SWITCH_EVENT_ALL) {
 		switch_zmalloc(event_node, sizeof(*event_node));
 		switch_mutex_lock(BLOCK);
@@ -1225,8 +1239,8 @@
 }
 
 
-SWITCH_DECLARE(switch_status_t) switch_event_bind(const char *id, switch_event_types_t event, const char *subclass_name, 
-												  switch_event_callback_t callback, void *user_data) 
+SWITCH_DECLARE(switch_status_t) switch_event_bind(const char *id, switch_event_types_t event, const char *subclass_name,
+												  switch_event_callback_t callback, void *user_data)
 {
 	return switch_event_bind_removable(id, event, subclass_name, callback, user_data, NULL);
 }
@@ -1241,7 +1255,7 @@
 	switch_thread_rwlock_wrlock(RWLOCK);
 	switch_mutex_lock(BLOCK);
 	/* <LOCKED> ----------------------------------------------- */
-	for (id = 0; id < SWITCH_EVENT_ALL; id++) {
+	for (id = 0; id <= SWITCH_EVENT_ALL; id++) {
 		lnp = NULL;
 
 		for (np = EVENT_NODES[id]; np;) {
@@ -1253,6 +1267,7 @@
 				} else {
 					EVENT_NODES[n->event_id] = n->next;
 				}
+
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Event Binding deleted for %s:%s\n", n->id, switch_event_name(n->event_id));
 				if (n->subclass) {
 					FREE(n->subclass->owner);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_ivr.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_ivr.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_ivr.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -41,7 +41,7 @@
 SWITCH_DECLARE(switch_status_t) switch_ivr_sound_test(switch_core_session_t *session)
 {
 
-	switch_codec_implementation_t imp = {0};
+	switch_codec_implementation_t imp = { 0 };
 	switch_codec_t codec = { 0 };
 	int16_t peak = 0;
 	int16_t *data;
@@ -54,9 +54,9 @@
 	int period_avg = 0, global_avg = 0;
 	int avg = 0;
 	int period_len;
-	
+
 	switch_core_session_get_read_impl(session, &imp);
-	
+
 	period_len = imp.actual_samples_per_second / imp.samples_per_packet;
 
 	if (switch_core_codec_init(&codec,
@@ -64,17 +64,17 @@
 							   NULL,
 							   imp.samples_per_second,
 							   imp.microseconds_per_packet / 1000,
-							   imp.number_of_channels, 
-							   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, 
+							   imp.number_of_channels,
+							   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
 							   switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec Error L16@%uhz %u channels %dms\n", 
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec Error L16@%uhz %u channels %dms\n",
 						  imp.samples_per_second, imp.number_of_channels, imp.microseconds_per_packet / 1000);
 		return SWITCH_STATUS_FALSE;
 	}
-	
-	while(switch_channel_ready(channel)) {
+
+	while (switch_channel_ready(channel)) {
 		status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
-	
+
 		if (!SWITCH_READ_ACCEPTABLE(status)) {
 			break;
 		}
@@ -88,35 +88,35 @@
 		peak = 0;
 		avg = 0;
 		for (i = 0; i < read_frame->samples; i++) {
-			const int16_t s = (int16_t)abs(data[i]);
+			const int16_t s = (int16_t) abs(data[i]);
 			if (s > peak) {
 				peak = s;
 			}
 			avg += s;
 		}
-		
+
 		avg /= read_frame->samples;
 
 		period_sum += peak;
 		global_sum += peak;
-		
+
 		global_total++;
 		period_total++;
-		
-		period_avg = (int)(period_sum / period_total);
 
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CONSOLE, 
-						  "\npacket_avg=%d packet_peak=%d period_avg=%d global_avg=%d\n\n", avg, peak, period_avg, global_avg); 
-		
-		if (period_total >= period_len) {			
-			global_avg = (int)(global_sum / global_total);
+		period_avg = (int) (period_sum / period_total);
+
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CONSOLE,
+						  "\npacket_avg=%d packet_peak=%d period_avg=%d global_avg=%d\n\n", avg, peak, period_avg, global_avg);
+
+		if (period_total >= period_len) {
+			global_avg = (int) (global_sum / global_total);
 			period_total = 0;
 			period_sum = 0;
 		}
 
 	}
-	
 
+
 	switch_core_codec_destroy(&codec);
 
 	return SWITCH_STATUS_SUCCESS;
@@ -134,20 +134,20 @@
 
 	switch_frame_t write_frame = { 0 };
 	unsigned char *abuf = NULL;
-	switch_codec_implementation_t imp = {0};
+	switch_codec_implementation_t imp = { 0 };
 	switch_codec_t codec = { 0 };
 	int sval = 0;
 	const char *var;
 
 	/*
-	if (!switch_channel_test_flag(channel, CF_OUTBOUND) && !switch_channel_test_flag(channel, CF_PROXY_MODE) && 
-		!switch_channel_media_ready(channel) && !switch_channel_test_flag(channel, CF_SERVICE)) {
-		if ((status = switch_channel_pre_answer(channel)) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot establish media.\n");
-			return SWITCH_STATUS_FALSE;
-		}
-	}
-	*/
+	   if (!switch_channel_test_flag(channel, CF_OUTBOUND) && !switch_channel_test_flag(channel, CF_PROXY_MODE) && 
+	   !switch_channel_media_ready(channel) && !switch_channel_test_flag(channel, CF_SERVICE)) {
+	   if ((status = switch_channel_pre_answer(channel)) != SWITCH_STATUS_SUCCESS) {
+	   switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot establish media.\n");
+	   return SWITCH_STATUS_FALSE;
+	   }
+	   }
+	 */
 
 	if (!switch_channel_media_ready(channel)) {
 		switch_yield(ms * 1000);
@@ -156,24 +156,24 @@
 
 	if (ms > 100 && (var = switch_channel_get_variable(channel, SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE)) && (sval = atoi(var))) {
 		switch_core_session_get_read_impl(session, &imp);
-		
+
 		if (switch_core_codec_init(&codec,
 								   "L16",
 								   NULL,
 								   imp.samples_per_second,
 								   imp.microseconds_per_packet / 1000,
-								   imp.number_of_channels, 
-								   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, 
+								   imp.number_of_channels,
+								   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
 								   switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec Error L16@%uhz %u channels %dms\n", 
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec Error L16@%uhz %u channels %dms\n",
 							  imp.samples_per_second, imp.number_of_channels, imp.microseconds_per_packet / 1000);
 			return SWITCH_STATUS_FALSE;
 		}
 
 
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Codec Activated L16@%uhz %u channels %dms\n", 
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Codec Activated L16@%uhz %u channels %dms\n",
 						  imp.samples_per_second, imp.number_of_channels, imp.microseconds_per_packet / 1000);
-		
+
 		write_frame.codec = &codec;
 		switch_zmalloc(abuf, SWITCH_RECOMMENDED_BUFFER_SIZE);
 		write_frame.data = abuf;
@@ -195,7 +195,7 @@
 	if (sync) {
 		switch_channel_audio_sync(channel);
 	}
-	
+
 	if (!ms) {
 		return SWITCH_STATUS_SUCCESS;
 	}
@@ -209,7 +209,7 @@
 			status = SWITCH_STATUS_FALSE;
 			break;
 		}
-		
+
 		if (switch_channel_test_flag(channel, CF_BREAK)) {
 			switch_channel_clear_flag(channel, CF_BREAK);
 			status = SWITCH_STATUS_BREAK;
@@ -219,14 +219,14 @@
 		if (now > done || left <= 0) {
 			break;
 		}
-		
 
+
 		switch_ivr_parse_all_events(session);
 
 
 		if (args && (args->input_callback || args->buf || args->buflen)) {
 			switch_dtmf_t dtmf;
-			
+
 			/*
 			   dtmf handler function you can hook up to be executed when a digit is dialed during playback 
 			   if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
@@ -244,7 +244,7 @@
 					status = SWITCH_STATUS_BREAK;
 				}
 			}
-			
+
 			if (args->input_callback) {
 				switch_event_t *event = NULL;
 
@@ -272,7 +272,7 @@
 			switch_core_session_write_frame(session, &cng_frame, SWITCH_IO_FLAG_NONE, 0);
 		}
 	}
-	
+
 	if (write_frame.codec) {
 		switch_core_codec_destroy(&codec);
 	}
@@ -461,7 +461,9 @@
 	unsigned long CMD_UNICAST = switch_hashfunc_default("unicast", &hlen);
 	char *lead_frames = switch_event_get_header(event, "lead-frames");
 	char *event_lock = switch_event_get_header(event, "event-lock");
+	char *event_lock_pri = switch_event_get_header(event, "event-lock-pri");
 	switch_status_t status = SWITCH_STATUS_FALSE;
+	int el = 0, elp = 0;
 
 	if (zstr(cmd)) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid Command!\n");
@@ -474,8 +476,14 @@
 
 	if (switch_true(event_lock)) {
 		switch_channel_set_flag_recursive(channel, CF_EVENT_LOCK);
+		el = 1;
 	}
 
+	if (switch_true(event_lock_pri)) {
+		switch_channel_set_flag_recursive(channel, CF_EVENT_LOCK_PRI);
+		elp = 1;
+	}
+
 	if (lead_frames) {
 		switch_frame_t *read_frame;
 		int frame_count = atoi(lead_frames);
@@ -493,73 +501,76 @@
 	}
 
 	if (cmd_hash == CMD_EXECUTE) {
-		switch_application_interface_t *application_interface;
 		char *app_name = switch_event_get_header(event, "execute-app-name");
 		char *app_arg = switch_event_get_header(event, "execute-app-arg");
+		char *content_type = switch_event_get_header(event, "content-type");
 		char *loop_h = switch_event_get_header(event, "loops");
 		char *hold_bleg = switch_event_get_header(event, "hold-bleg");
 		int loops = 1;
 
+		if (zstr(app_arg) && !zstr(content_type) && !strcasecmp(content_type, "text/plain")) {
+			app_arg = switch_event_get_body(event);
+		}
+
 		if (loop_h) {
 			loops = atoi(loop_h);
 		}
 
 		if (app_name) {
-			if ((application_interface = switch_loadable_module_get_application_interface(app_name))) {
-				if (application_interface->application_function) {
-					int x;
-					const char *b_uuid = NULL;
-					switch_core_session_t *b_session = NULL;
+			int x;
+			const char *b_uuid = NULL;
+			switch_core_session_t *b_session = NULL;
 
-					switch_channel_clear_flag(channel, CF_STOP_BROADCAST);
-					switch_channel_set_flag(channel, CF_BROADCAST);
-					if (hold_bleg && switch_true(hold_bleg)) {
-						if ((b_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
-							const char *stream;
-							b_uuid = switch_core_session_strdup(session, b_uuid);
+			switch_channel_clear_flag(channel, CF_STOP_BROADCAST);
+			switch_channel_set_flag(channel, CF_BROADCAST);
+			if (hold_bleg && switch_true(hold_bleg)) {
+				if ((b_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
+					const char *stream;
+					b_uuid = switch_core_session_strdup(session, b_uuid);
 
-							if (!(stream = switch_channel_get_variable_partner(channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
-								stream = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE);
-							}
-
-							if (stream && switch_is_moh(stream)) {
-								if ((b_session = switch_core_session_locate(b_uuid))) {
-									switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
-									switch_ivr_broadcast(b_uuid, stream, SMF_ECHO_ALEG | SMF_LOOP);
-									switch_channel_wait_for_flag(b_channel, CF_BROADCAST, SWITCH_TRUE, 5000, NULL);
-									switch_core_session_rwunlock(b_session);
-								}
-							} else {
-								b_uuid = NULL;
-							}
-						}
+					if (!(stream = switch_channel_get_variable_partner(channel, SWITCH_HOLD_MUSIC_VARIABLE))) {
+						stream = switch_channel_get_variable(channel, SWITCH_HOLD_MUSIC_VARIABLE);
 					}
-					for (x = 0; x < loops || loops < 0; x++) {
-						switch_time_t b4, aftr;
 
-						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Command Execute %s(%s)\n",
-										  switch_channel_get_name(channel), app_name, switch_str_nil(app_arg));
-						b4 = switch_micro_time_now();
-						switch_core_session_exec(session, application_interface, app_arg);
-						aftr = switch_micro_time_now();
-						if (!switch_channel_ready(channel) || switch_channel_test_flag(channel, CF_STOP_BROADCAST) || aftr - b4 < 500000) {
-							break;
-						}
-					}
-
-					if (b_uuid) {
+					if (stream && switch_is_moh(stream)) {
 						if ((b_session = switch_core_session_locate(b_uuid))) {
 							switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
-							switch_channel_stop_broadcast(b_channel);
-							switch_channel_wait_for_flag(b_channel, CF_BROADCAST, SWITCH_FALSE, 5000, NULL);
+							switch_ivr_broadcast(b_uuid, stream, SMF_ECHO_ALEG | SMF_LOOP);
+							switch_channel_wait_for_flag(b_channel, CF_BROADCAST, SWITCH_TRUE, 5000, NULL);
 							switch_core_session_rwunlock(b_session);
 						}
+					} else {
+						b_uuid = NULL;
 					}
+				}
+			}
 
-					switch_channel_clear_flag(channel, CF_BROADCAST);
+			for (x = 0; x < loops || loops < 0; x++) {
+				switch_time_t b4, aftr;
+
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Command Execute %s(%s)\n",
+								  switch_channel_get_name(channel), app_name, switch_str_nil(app_arg));
+				b4 = switch_micro_time_now();
+				if (switch_core_session_execute_application(session, app_name, app_arg) != SWITCH_STATUS_SUCCESS) {
+					goto done;
 				}
-				UNPROTECT_INTERFACE(application_interface);
+
+				aftr = switch_micro_time_now();
+				if (!switch_channel_ready(channel) || switch_channel_test_flag(channel, CF_STOP_BROADCAST) || aftr - b4 < 500000) {
+					break;
+				}
 			}
+
+			if (b_uuid) {
+				if ((b_session = switch_core_session_locate(b_uuid))) {
+					switch_channel_t *b_channel = switch_core_session_get_channel(b_session);
+					switch_channel_stop_broadcast(b_channel);
+					switch_channel_wait_for_flag(b_channel, CF_BROADCAST, SWITCH_FALSE, 5000, NULL);
+					switch_core_session_rwunlock(b_session);
+				}
+			}
+
+			switch_channel_clear_flag(channel, CF_BROADCAST);
 		}
 	} else if (cmd_hash == CMD_UNICAST) {
 		char *local_ip = switch_event_get_header(event, "local-ip");
@@ -604,9 +615,17 @@
 	status = SWITCH_STATUS_SUCCESS;
 
   done:
+
 	switch_channel_clear_flag_recursive(channel, CF_EVENT_PARSE);
-	switch_channel_clear_flag_recursive(channel, CF_EVENT_LOCK);
 
+	if (el) {
+		switch_channel_clear_flag_recursive(channel, CF_EVENT_LOCK);
+	}
+
+	if (elp) {
+		switch_channel_clear_flag_recursive(channel, CF_EVENT_LOCK_PRI);
+	}
+
 	return status;
 }
 
@@ -628,7 +647,7 @@
 {
 	switch_core_session_message_t *message;
 	int i = 0;
-	
+
 	while (switch_core_session_dequeue_message(session, &message) == SWITCH_STATUS_SUCCESS) {
 		i++;
 		switch_core_session_receive_message(session, message);
@@ -645,7 +664,8 @@
 
 	switch_ivr_parse_all_messages(session);
 
-	while (switch_ivr_parse_next_event(session) == SWITCH_STATUS_SUCCESS) x++;
+	while (switch_ivr_parse_next_event(session) == SWITCH_STATUS_SUCCESS)
+		x++;
 
 	if (x) {
 		switch_ivr_sleep(session, 0, SWITCH_TRUE, NULL);
@@ -668,9 +688,9 @@
 	const char *to;
 	int timeout = 0;
 	time_t expires = 0;
-	switch_codec_implementation_t read_impl = {0};
+	switch_codec_implementation_t read_impl = { 0 };
 
-	
+
 	if (switch_channel_test_flag(channel, CF_CONTROLLED)) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot park channels that are under control already.\n");
 		return SWITCH_STATUS_FALSE;
@@ -679,7 +699,7 @@
 	if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_get_state(channel) == CS_RESET) {
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	if ((to = switch_channel_get_variable(channel, "park_timeout"))) {
 		if ((timeout = atoi(to)) < 0) {
 			timeout = 0;
@@ -699,13 +719,13 @@
 	}
 
 	while (switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_CONTROLLED) && switch_channel_test_flag(channel, CF_PARK)) {
-	
+
 		if (!rate && switch_channel_media_ready(channel)) {
 			switch_core_session_get_read_impl(session, &read_impl);
 			rate = read_impl.actual_samples_per_second;
 			bpf = read_impl.decoded_bytes_per_packet;
 		}
-	
+
 		if (rate) {
 			status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, stream_id);
 		} else {
@@ -717,7 +737,7 @@
 			break;
 		} else {
 			if (expires && switch_epoch_time_now(NULL) >= expires) {
-				switch_channel_hangup(channel, SWITCH_CAUSE_RECOVERY_ON_TIMER_EXPIRE);
+				switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
 				break;
 			}
 
@@ -763,8 +783,7 @@
 							tstatus = switch_core_codec_decode(read_codec,
 															   &conninfo->read_codec,
 															   read_frame->data,
-															   read_frame->datalen,
-															   read_impl.actual_samples_per_second, decoded, &dlen, &rate, &flags);
+															   read_frame->datalen, read_impl.actual_samples_per_second, decoded, &dlen, &rate, &flags);
 						}
 						switch (tstatus) {
 						case SWITCH_STATUS_NOOP:
@@ -836,7 +855,8 @@
 	return status;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_session_t *session, switch_input_args_t *args, uint32_t digit_timeout, uint32_t abs_timeout)
+SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_callback(switch_core_session_t *session, switch_input_args_t *args, uint32_t digit_timeout,
+																   uint32_t abs_timeout)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -935,31 +955,31 @@
 	uint32_t eff_timeout = 0;
 	switch_frame_t write_frame = { 0 };
 	unsigned char *abuf = NULL;
-	switch_codec_implementation_t imp = {0};
+	switch_codec_implementation_t imp = { 0 };
 	switch_codec_t codec = { 0 };
 	int sval = 0;
 	const char *var;
 
 	if ((var = switch_channel_get_variable(channel, SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE)) && (sval = atoi(var))) {
 		switch_core_session_get_read_impl(session, &imp);
-	
+
 		if (switch_core_codec_init(&codec,
 								   "L16",
 								   NULL,
 								   imp.samples_per_second,
 								   imp.microseconds_per_packet / 1000,
-								   imp.number_of_channels, 
-								   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, 
+								   imp.number_of_channels,
+								   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
 								   switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec Error L16@%uhz %u channels %dms\n", 
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec Error L16@%uhz %u channels %dms\n",
 							  imp.samples_per_second, imp.number_of_channels, imp.microseconds_per_packet / 1000);
 			return SWITCH_STATUS_FALSE;
 		}
 
 
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Codec Activated L16@%uhz %u channels %dms\n", 
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Codec Activated L16@%uhz %u channels %dms\n",
 						  imp.samples_per_second, imp.number_of_channels, imp.microseconds_per_packet / 1000);
-		
+
 		write_frame.codec = &codec;
 		switch_zmalloc(abuf, SWITCH_RECOMMENDED_BUFFER_SIZE);
 		write_frame.data = abuf;
@@ -1014,7 +1034,7 @@
 		switch_ivr_parse_all_events(session);
 
 
-		
+
 		if (eff_timeout) {
 			digit_elapsed = (uint32_t) ((switch_micro_time_now() - digit_started) / 1000);
 
@@ -1027,7 +1047,7 @@
 		if (switch_channel_has_dtmf(channel)) {
 			switch_dtmf_t dtmf = { 0 };
 			switch_size_t y;
-			
+
 			if (eff_timeout) {
 				eff_timeout = digit_timeout;
 				digit_started = switch_micro_time_now();
@@ -1046,7 +1066,7 @@
 
 				buf[x++] = dtmf.digit;
 				buf[x] = '\0';
-				
+
 				if (x >= buflen || x >= maxdigits) {
 					return SWITCH_STATUS_SUCCESS;
 				}
@@ -1065,7 +1085,7 @@
 				switch_generate_sln_silence((int16_t *) write_frame.data, write_frame.samples, sval);
 				switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0);
 			}
-			
+
 		}
 	}
 
@@ -1183,8 +1203,11 @@
 				switch_channel_wait_for_flag(channel, CF_REQ_MEDIA, SWITCH_FALSE, 250, NULL);
 				switch_yield(250000);
 			} else {
+				switch_status_t st;
 				switch_channel_wait_for_flag(channel, CF_REQ_MEDIA, SWITCH_FALSE, 10000, NULL);
-				switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
+				switch_channel_wait_for_flag(channel, CF_MEDIA_ACK, SWITCH_TRUE, 10000, NULL);
+				switch_channel_wait_for_flag(channel, CF_MEDIA_SET, SWITCH_TRUE, 10000, NULL);
+				st = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
 			}
 
 			if ((flags & SMF_REBRIDGE)
@@ -1194,6 +1217,8 @@
 				switch_assert(other_channel != NULL);
 				switch_core_session_receive_message(other_session, &msg);
 				switch_channel_wait_for_flag(other_channel, CF_REQ_MEDIA, SWITCH_FALSE, 10000, NULL);
+				switch_channel_wait_for_flag(other_channel, CF_MEDIA_ACK, SWITCH_TRUE, 10000, NULL);
+				switch_channel_wait_for_flag(other_channel, CF_MEDIA_SET, SWITCH_TRUE, 10000, NULL);
 				switch_core_session_read_frame(other_session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
 				switch_channel_clear_state_handler(other_channel, NULL);
 				switch_core_session_rwunlock(other_session);
@@ -1239,26 +1264,54 @@
 			swap = 1;
 		}
 
+		switch_channel_set_flag(channel, CF_REDIRECT);
+		switch_channel_set_flag(channel, CF_RESET);
+
 		if ((flags & SMF_FORCE) || !switch_channel_test_flag(channel, CF_PROXY_MODE)) {
-			switch_core_session_receive_message(session, &msg);
-
 			if ((flags & SMF_REBRIDGE) && (other_uuid = switch_channel_get_variable(channel, SWITCH_BRIDGE_VARIABLE)) &&
 				(other_session = switch_core_session_locate(other_uuid))) {
 				other_channel = switch_core_session_get_channel(other_session);
 
+				switch_channel_set_flag(other_channel, CF_RESET);
+				switch_channel_set_flag(other_channel, CF_REDIRECT);
+				switch_channel_set_state(other_channel, CS_PARK);
+				if (switch_core_session_in_thread(session)) {
+					switch_yield(100000);
+				} else {
+					switch_channel_wait_for_state(other_channel, channel, CS_PARK);
+				}
 				switch_core_session_receive_message(other_session, &msg);
-				switch_channel_clear_state_handler(other_channel, NULL);
+				switch_channel_wait_for_flag(other_channel, CF_REQ_MEDIA, SWITCH_FALSE, 10000, NULL);
+				switch_channel_wait_for_flag(other_channel, CF_MEDIA_ACK, SWITCH_TRUE, 10000, NULL);
+				switch_channel_wait_for_flag(other_channel, CF_MEDIA_SET, SWITCH_TRUE, 10000, NULL);
 			}
 
+			switch_core_session_receive_message(session, &msg);
+
+			if (!switch_core_session_in_thread(session)) {
+				switch_channel_set_state(channel, CS_PARK);
+				switch_channel_wait_for_state(channel, channel, CS_PARK);
+				switch_channel_wait_for_flag(channel, CF_REQ_MEDIA, SWITCH_FALSE, 10000, NULL);
+				switch_channel_wait_for_flag(channel, CF_MEDIA_ACK, SWITCH_TRUE, 10000, NULL);
+				switch_channel_wait_for_flag(channel, CF_MEDIA_SET, SWITCH_TRUE, 10000, NULL);
+			}
+
 			if (other_channel) {
-				switch_channel_clear_state_handler(channel, NULL);
 				if (swap) {
 					switch_ivr_signal_bridge(other_session, session);
 				} else {
 					switch_ivr_signal_bridge(session, other_session);
 				}
-				switch_channel_wait_for_flag(channel, CF_BRIDGED, SWITCH_TRUE, 1000, NULL);
-				switch_channel_wait_for_flag(other_channel, CF_BRIDGED, SWITCH_TRUE, 1000, NULL);
+
+				if (switch_core_session_in_thread(session)) {
+                    switch_yield(100000);
+                } else {
+					switch_channel_wait_for_state(other_channel, channel, CS_HIBERNATE);
+				}
+
+				if (!switch_core_session_in_thread(session)) {
+					switch_channel_wait_for_state(channel, other_channel, CS_HIBERNATE);
+				}
 				switch_core_session_rwunlock(other_session);
 			}
 		}
@@ -1300,7 +1353,7 @@
 
 	if ((profile = switch_channel_get_caller_profile(channel))) {
 		const char *var;
-		
+
 		if (zstr(dialplan)) {
 			dialplan = profile->dialplan;
 			if (!zstr(dialplan) && !strcasecmp(dialplan, "inline")) {
@@ -1331,7 +1384,7 @@
 		if ((var = switch_channel_get_variable(channel, "force_transfer_context"))) {
 			context = var;
 		}
-		
+
 		new_profile = switch_caller_profile_clone(session, profile);
 
 		new_profile->dialplan = switch_core_strdup(new_profile->pool, dialplan);
@@ -1384,8 +1437,8 @@
 		msg.from = __FILE__;
 		switch_core_session_receive_message(session, &msg);
 
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Transfer %s to %s[%s@%s]\n", switch_channel_get_name(channel), dialplan, extension,
-						  context);
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Transfer %s to %s[%s@%s]\n", switch_channel_get_name(channel), dialplan,
+						  extension, context);
 		return SWITCH_STATUS_SUCCESS;
 	}
 
@@ -1443,7 +1496,7 @@
 	switch_time_t last_digit_time;
 };
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_new(switch_memory_pool_t *pool, switch_ivr_digit_stream_parser_t **parser)
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_new(switch_memory_pool_t *pool, switch_ivr_digit_stream_parser_t ** parser)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
@@ -1501,7 +1554,7 @@
 	return status;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_new(switch_ivr_digit_stream_parser_t *parser, switch_ivr_digit_stream_t **stream)
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_new(switch_ivr_digit_stream_parser_t *parser, switch_ivr_digit_stream_t ** stream)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
@@ -1517,7 +1570,7 @@
 	return status;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_destroy(switch_ivr_digit_stream_t **stream)
+SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_destroy(switch_ivr_digit_stream_t ** stream)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
@@ -1636,8 +1689,8 @@
 			*stream->digits = '\0';
 		}
 	}
-	
 
+
 	return result;
 }
 
@@ -1772,19 +1825,49 @@
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_caller_profile_t *caller_profile;
 	switch_xml_t variables, cdr, x_main_cp, x_caller_profile, x_caller_extension, x_times, time_tag,
-		x_application, x_callflow, x_inner_extension, x_apps, x_o;
+		x_application, x_callflow, x_inner_extension, x_apps, x_o, x_channel_data, x_field;
 	switch_app_log_t *app_log;
-	char tmp[512];
-	int cdr_off = 0, v_off = 0;
+	char tmp[512], *f;
+	int cdr_off = 0, v_off = 0, cd_off = 0;
 
 	if (!(cdr = switch_xml_new("cdr"))) {
 		return SWITCH_STATUS_SUCCESS;
 	}
 
+	if (!(x_channel_data = switch_xml_add_child_d(cdr, "channel_data", cdr_off++))) {
+		goto error;
+	}
+
+	x_field = switch_xml_add_child_d(x_channel_data, "state", cd_off++);
+	switch_xml_set_txt_d(x_field, switch_channel_state_name(switch_channel_get_state(channel)));
+
+	x_field = switch_xml_add_child_d(x_channel_data, "direction", cd_off++);
+	switch_xml_set_txt_d(x_field, switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND ? "outbound" : "inbound");
+
+	x_field = switch_xml_add_child_d(x_channel_data, "state_number", cd_off++);
+	switch_snprintf(tmp, sizeof(tmp), "%d", switch_channel_get_state(channel));
+	switch_xml_set_txt_d(x_field, tmp);
+
+	if ((f = switch_channel_get_flag_string(channel))) {
+		x_field = switch_xml_add_child_d(x_channel_data, "flags", cd_off++);
+		switch_xml_set_txt_d(x_field, f);
+		free(f);
+	}
+
+	if ((f = switch_channel_get_cap_string(channel))) {
+		x_field = switch_xml_add_child_d(x_channel_data, "caps", cd_off++);
+		switch_xml_set_txt_d(x_field, f);
+		free(f);
+	}
+
+
 	if (!(variables = switch_xml_add_child_d(cdr, "variables", cdr_off++))) {
 		goto error;
 	}
 
+	switch_ivr_set_xml_chan_vars(variables, channel, v_off);
+
+
 	if ((app_log = switch_core_session_get_app_log(session))) {
 		int app_off = 0;
 		switch_app_log_t *ap;
@@ -1803,7 +1886,6 @@
 		}
 	}
 
-	switch_ivr_set_xml_chan_vars(variables, channel, v_off);
 
 	caller_profile = switch_channel_get_caller_profile(channel);
 
@@ -1850,18 +1932,17 @@
 
 			if (caller_profile->caller_extension->children) {
 				switch_caller_profile_t *cp = NULL;
-				int i_off = 0;
+				int i_off = 0, i_app_off = 0;
 				for (cp = caller_profile->caller_extension->children; cp; cp = cp->next) {
-					app_off = 0;
 
 					if (!cp->caller_extension) {
 						continue;
 					}
-					if (!(x_inner_extension = switch_xml_add_child_d(x_caller_extension, "sub_extensions", i_off++))) {
+					if (!(x_inner_extension = switch_xml_add_child_d(x_caller_extension, "sub_extensions", app_off++))) {
 						goto error;
 					}
 
-					if (!(x_caller_extension = switch_xml_add_child_d(x_inner_extension, "extension", cf_off++))) {
+					if (!(x_caller_extension = switch_xml_add_child_d(x_inner_extension, "extension", i_off++))) {
 						goto error;
 					}
 					switch_xml_set_attr_d(x_caller_extension, "name", cp->caller_extension->extension_name);
@@ -1872,7 +1953,7 @@
 					}
 
 					for (ap = cp->caller_extension->applications; ap; ap = ap->next) {
-						if (!(x_application = switch_xml_add_child_d(x_caller_extension, "application", app_off++))) {
+						if (!(x_application = switch_xml_add_child_d(x_caller_extension, "application", i_app_off++))) {
 							goto error;
 						}
 						if (ap == cp->caller_extension->current_application) {
@@ -1962,6 +2043,12 @@
 			switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->hungup);
 			switch_xml_set_txt_d(time_tag, tmp);
 
+			if (!(time_tag = switch_xml_add_child_d(x_times, "resurrect_time", t_off++))) {
+				goto error;
+			}
+			switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->resurrected);
+			switch_xml_set_txt_d(time_tag, tmp);
+
 			if (!(time_tag = switch_xml_add_child_d(x_times, "transfer_time", t_off++))) {
 				goto error;
 			}
@@ -1990,7 +2077,7 @@
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_channel_set_state(channel, CS_PARK);
 	switch_channel_set_flag(channel, CF_TRANSFER);
-	
+
 }
 
 SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint32_t delay_ms)
@@ -2003,8 +2090,8 @@
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	uint32_t interval, samples;
 	uint32_t ts = 0;
-    switch_codec_implementation_t read_impl = {0};
-    switch_core_session_get_read_impl(session, &read_impl);
+	switch_codec_implementation_t read_impl = { 0 };
+	switch_core_session_get_read_impl(session, &read_impl);
 
 
 	if (delay_ms < 1 || delay_ms > 10000) {
@@ -2027,7 +2114,7 @@
 			break;
 		}
 
-		stfu_n_eat(jb, ts, read_frame->data, read_frame->datalen);
+		stfu_n_eat(jb, ts, read_frame->payload, read_frame->data, read_frame->datalen);
 		ts += interval;
 
 		if ((jb_frame = stfu_n_read_a_frame(jb))) {
@@ -2053,7 +2140,7 @@
 	switch_event_t *hint_data;
 	switch_xml_t cfg, xml = NULL, language, macros;
 
-	
+
 	switch_assert(session);
 	channel = switch_core_session_get_channel(session);
 	switch_assert(channel);
@@ -2117,12 +2204,6 @@
 
 	if (sound_path) {
 		switch_channel_set_variable(channel, "sound_prefix", sound_path);
-	} else {
-		switch_channel_set_variable_printf(channel, "sound_prefix", "%s%ssounds%s%s", 
-										   SWITCH_GLOBAL_dirs.base_dir,
-										   SWITCH_PATH_SEPARATOR,
-										   SWITCH_PATH_SEPARATOR,
-										   chan_lang);
 	}
 
 	if ((si = switch_loadable_module_get_say_interface(module_name))) {
@@ -2133,7 +2214,7 @@
 		status = SWITCH_STATUS_FALSE;
 	}
 
- done:
+  done:
 
 	if (hint_data) {
 		switch_event_destroy(&hint_data);
@@ -2146,7 +2227,7 @@
 	if (xml) {
 		switch_xml_free(xml);
 	}
-	
+
 	return status;
 }
 
@@ -2156,18 +2237,18 @@
 
 	if (!buffer) {
 		/*
-		  if buffer is null then it just returns the str without the prefix appended, otherwise buffer contains the prefix followed by the original string
-		*/
+		   if buffer is null then it just returns the str without the prefix appended, otherwise buffer contains the prefix followed by the original string
+		 */
 
 		return str;
 	}
 
 	str_len = strlen(str);
 	memcpy(buffer, prefix, prefix_size);
-	
+
 	if (str_len + prefix_size + 1 > buffer_size) {
-		memcpy(buffer + prefix_size, str, buffer_size-prefix_size - 1);
-		buffer[buffer_size-prefix_size - 1] = '\0';
+		memcpy(buffer + prefix_size, str, buffer_size - prefix_size - 1);
+		buffer[buffer_size - prefix_size - 1] = '\0';
 	} else {
 		memcpy(buffer + prefix_size, str, str_len + 1);
 	}
@@ -2182,16 +2263,16 @@
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
-	char * prefix_buffer = NULL, *prefix;
-	size_t buffer_size =0;
-	size_t prefix_size=0;
+	char *prefix_buffer = NULL, *prefix;
+	size_t buffer_size = 0;
+	size_t prefix_size = 0;
 	if (zstr(data)) {
 		goto error;
 	}
 
 	user = switch_core_session_strdup(session, data);
-	
-	if ((prefix = strchr(user, ' '))){
+
+	if ((prefix = strchr(user, ' '))) {
 		*prefix++ = 0;
 	}
 
@@ -2251,8 +2332,8 @@
 		}
 	}
 
-	switch_channel_set_variable(channel, get_prefixed_str(prefix_buffer,buffer_size,prefix,prefix_size,"user_name") , user);
-	switch_channel_set_variable(channel, get_prefixed_str(prefix_buffer,buffer_size,prefix,prefix_size,"domain_name") , domain);
+	switch_channel_set_variable(channel, get_prefixed_str(prefix_buffer, buffer_size, prefix, prefix_size, "user_name"), user);
+	switch_channel_set_variable(channel, get_prefixed_str(prefix_buffer, buffer_size, prefix, prefix_size, "domain_name"), domain);
 
 	goto done;
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_ivr_async.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_ivr_async.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_ivr_async.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -83,7 +83,6 @@
 	if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
 		return;
 	}
-
 #ifdef SWITCH_VIDEO_IN_THREADS
 	if (switch_channel_test_flag(channel, CF_VIDEO)) {
 		eh.session = session;
@@ -104,7 +103,7 @@
 
 		if (args && (args->input_callback || args->buf || args->buflen)) {
 			switch_dtmf_t dtmf;
-			
+
 			/*
 			   dtmf handler function you can hook up to be executed when a digit is dialed during playback 
 			   if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
@@ -122,7 +121,7 @@
 					status = SWITCH_STATUS_BREAK;
 				}
 			}
-			
+
 			if (args->input_callback) {
 				switch_event_t *event = NULL;
 
@@ -355,8 +354,8 @@
 	switch_status_t status;
 	time_t to = 0;
 	displace_helper_t *dh;
-    switch_codec_implementation_t read_impl = {0};
-    switch_core_session_get_read_impl(session, &read_impl);
+	switch_codec_implementation_t read_impl = { 0 };
+	switch_core_session_get_read_impl(session, &read_impl);
 
 
 	if ((status = switch_channel_pre_answer(channel)) != SWITCH_STATUS_SUCCESS) {
@@ -385,8 +384,7 @@
 	if (switch_core_file_open(&dh->fh,
 							  file,
 							  read_impl.number_of_channels,
-							  read_impl.actual_samples_per_second,
-							  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
+							  read_impl.actual_samples_per_second, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 		switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
 		return SWITCH_STATUS_GENERR;
@@ -447,12 +445,12 @@
 		break;
 	case SWITCH_ABC_TYPE_CLOSE:
 		{
-			switch_codec_implementation_t read_impl = {0};
+			switch_codec_implementation_t read_impl = { 0 };
 			switch_core_session_get_read_impl(session, &read_impl);
 
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Stop recording file %s\n", rh->file);
 			switch_channel_set_private(channel, rh->file, NULL);
-			
+
 			if (switch_event_create(&event, SWITCH_EVENT_RECORD_STOP) == SWITCH_STATUS_SUCCESS) {
 				switch_channel_event_set_data(channel, event);
 				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Record-File-Path", rh->file);
@@ -463,16 +461,17 @@
 				switch_size_t len;
 				uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
 				switch_frame_t frame = { 0 };
-					
+
 				frame.data = data;
 				frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
-					
+
 				while (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS && !switch_test_flag((&frame), SFF_CNG)) {
 					len = (switch_size_t) frame.datalen / 2;
-					if (len) switch_core_file_write(rh->fh, data, &len);
+					if (len)
+						switch_core_file_write(rh->fh, data, &len);
 				}
-				
 
+
 				switch_core_file_close(rh->fh);
 				if (rh->fh->samples_out < rh->fh->samplerate * rh->min_sec) {
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Discarding short file %s\n", rh->file);
@@ -483,7 +482,7 @@
 
 		break;
 	case SWITCH_ABC_TYPE_READ:
-		
+
 		if (rh->fh) {
 			switch_size_t len;
 			uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
@@ -491,10 +490,11 @@
 
 			frame.data = data;
 			frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
-			
+
 			while (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS && !switch_test_flag((&frame), SFF_CNG)) {
 				len = (switch_size_t) frame.datalen / 2;
-				if (len) switch_core_file_write(rh->fh, data, &len);
+				if (len)
+					switch_core_file_write(rh->fh, data, &len);
 			}
 
 		}
@@ -536,7 +536,7 @@
 	struct eavesdrop_pvt *ep = (struct eavesdrop_pvt *) user_data;
 	uint8_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
 	switch_frame_t frame = { 0 };
-	
+
 	frame.data = data;
 	frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE;
 
@@ -548,7 +548,7 @@
 	case SWITCH_ABC_TYPE_WRITE:
 		break;
 	case SWITCH_ABC_TYPE_READ_PING:
-		if (ep->buffer) {			
+		if (ep->buffer) {
 			if (switch_core_media_bug_read(bug, &frame, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
 				switch_buffer_lock(ep->buffer);
 				switch_buffer_zwrite(ep->buffer, frame.data, frame.datalen);
@@ -627,9 +627,10 @@
 		uint32_t tlen;
 		const char *macro_name = "eavesdrop_announce";
 		const char *id_name = NULL;
-		switch_codec_implementation_t tread_impl = {0}, read_impl = {0};
+		switch_codec_implementation_t tread_impl = { 0 }, read_impl = {
+		0};
 		switch_core_session_message_t msg = { 0 };
-		
+
 		if (!switch_channel_media_ready(channel)) {
 			goto end;
 		}
@@ -665,8 +666,8 @@
 			}
 			/* Separate the group */
 			data = strdup(group_name);
-			if ( (argc = switch_separate_string(data, ',', argv, (sizeof(argv) / sizeof(argv[0])))) ) {
-				for ( i = 0; i < argc; i++ ) {
+			if ((argc = switch_separate_string(data, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+				for (i = 0; i < argc; i++) {
 					/* If one of the group matches, then ok */
 					if (argv[i] && !strcmp(argv[i], require_group)) {
 						ok = 1;
@@ -675,7 +676,7 @@
 			}
 			switch_safe_free(data);
 			/* If we didn't find any match, then end */
-			if ( !ok ) {
+			if (!ok) {
 				status = SWITCH_STATUS_BREAK;
 				goto end;
 			}
@@ -736,12 +737,12 @@
 
 
 		msg.from = __FILE__;
-		
+
 		/* Tell the channel we are going to be in a bridge */
 		msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE;
 		switch_core_session_receive_message(session, &msg);
-		
 
+
 		while (switch_channel_ready(tchannel) && switch_channel_ready(channel)) {
 			uint32_t len = sizeof(buf);
 			switch_event_t *event = NULL;
@@ -805,7 +806,7 @@
 							switch_buffer_zero(ep->r_buffer);
 							switch_buffer_unlock(ep->r_buffer);
 						}
-						
+
 						if (ep->w_buffer) {
 							switch_buffer_lock(ep->w_buffer);
 							switch_buffer_zero(ep->w_buffer);
@@ -844,7 +845,7 @@
 
 		}
 
-	end_loop:
+	  end_loop:
 
 		/* Tell the channel we are no longer going to be in a bridge */
 		msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE;
@@ -854,7 +855,7 @@
 
 	  end:
 
-		if ( codec_initialized )
+		if (codec_initialized)
 			switch_core_codec_destroy(&codec);
 
 		if (bug) {
@@ -894,10 +895,10 @@
 	time_t to = 0;
 	switch_media_bug_flag_t flags = SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_PING;
 	uint8_t channels;
-	switch_codec_implementation_t read_impl = {0};
+	switch_codec_implementation_t read_impl = { 0 };
 	struct record_helper *rh = NULL;
 	int file_flags = SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT;
-	
+
 	switch_core_session_get_read_impl(session, &read_impl);
 
 	if ((status = switch_channel_pre_answer(channel)) != SWITCH_STATUS_SUCCESS) {
@@ -910,7 +911,7 @@
 	}
 
 	channels = read_impl.number_of_channels;
-	
+
 	if ((bug = switch_channel_get_private(channel, file))) {
 		return switch_ivr_stop_record_session(session, file);
 	}
@@ -929,13 +930,13 @@
 	if ((p = switch_channel_get_variable(channel, "RECORD_READ_ONLY")) && switch_true(p)) {
 		flags &= ~SMBF_WRITE_STREAM;
 		flags |= SMBF_READ_STREAM;
-	} 
+	}
 
 	if ((p = switch_channel_get_variable(channel, "RECORD_STEREO")) && switch_true(p)) {
 		flags |= SMBF_STEREO;
 		channels = 2;
 	}
-		
+
 	if ((p = switch_channel_get_variable(channel, "RECORD_ANSWER_REQ")) && switch_true(p)) {
 		flags |= SMBF_ANSWER_REQ;
 	}
@@ -964,7 +965,7 @@
 	fh->pre_buffer_datalen = SWITCH_DEFAULT_FILE_BUFFER_LEN;
 
 
-	
+
 	if (!switch_is_file_path(file)) {
 		char *tfile = NULL;
 		char *e;
@@ -985,15 +986,11 @@
 				tfile = NULL;
 			}
 		}
-		
+
 		file = switch_core_session_sprintf(session, "%s%s%s%s%s", switch_str_nil(tfile), tfile ? "]" : "", prefix, SWITCH_PATH_SEPARATOR, file);
 	}
-	
-	if (switch_core_file_open(fh,
-							  file,
-							  channels,
-							  read_impl.actual_samples_per_second,
-							  file_flags, NULL) != SWITCH_STATUS_SUCCESS) {
+
+	if (switch_core_file_open(fh, file, channels, read_impl.actual_samples_per_second, file_flags, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error opening %s\n", file);
 		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 		switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
@@ -1046,7 +1043,7 @@
 	rh->packet_len = read_impl.decoded_bytes_per_packet;
 
 	rh->min_sec = 3;
-	
+
 	if ((p = switch_channel_get_variable(channel, "RECORD_MIN_SEC"))) {
 		int tmp = atoi(p);
 		if (tmp >= 0) {
@@ -1054,7 +1051,7 @@
 		}
 	}
 
-	
+
 	if ((status = switch_core_media_bug_add(session, record_callback, rh, to, flags, &bug)) != SWITCH_STATUS_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error adding media bug for file %s\n", file);
 		switch_core_file_close(fh);
@@ -1066,7 +1063,7 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-typedef struct  {
+typedef struct {
 	SpeexPreprocessState *read_st;
 	SpeexPreprocessState *write_st;
 	SpeexEchoState *read_ec;
@@ -1085,12 +1082,12 @@
 	switch_core_session_t *session = switch_core_media_bug_get_session(bug);
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	pp_cb_t *cb = (pp_cb_t *) user_data;
-	switch_codec_implementation_t read_impl = {0};
+	switch_codec_implementation_t read_impl = { 0 };
 	switch_frame_t *frame = NULL;
 	int y;
 
-    switch_core_session_get_read_impl(session, &read_impl);
-	
+	switch_core_session_get_read_impl(session, &read_impl);
+
 	switch (type) {
 	case SWITCH_ABC_TYPE_INIT:
 		{
@@ -1121,17 +1118,18 @@
 		break;
 	case SWITCH_ABC_TYPE_READ_REPLACE:
 		{
-			if (cb->done) return SWITCH_FALSE;
+			if (cb->done)
+				return SWITCH_FALSE;
 			frame = switch_core_media_bug_get_read_replace_frame(bug);
 
 			if (cb->read_st) {
 
 				if (cb->read_ec) {
-					speex_echo_cancellation(cb->read_ec, (int16_t *)frame->data, (int16_t *)cb->write_data, (int16_t *)cb->read_out);
+					speex_echo_cancellation(cb->read_ec, (int16_t *) frame->data, (int16_t *) cb->write_data, (int16_t *) cb->read_out);
 					memcpy(frame->data, cb->read_out, frame->datalen);
 				}
 
-				y = speex_preprocess_run(cb->read_st, frame->data);				
+				y = speex_preprocess_run(cb->read_st, frame->data);
 			}
 
 			if (cb->write_ec) {
@@ -1141,16 +1139,17 @@
 		break;
 	case SWITCH_ABC_TYPE_WRITE_REPLACE:
 		{
-			if (cb->done) return SWITCH_FALSE;
+			if (cb->done)
+				return SWITCH_FALSE;
 			frame = switch_core_media_bug_get_write_replace_frame(bug);
 
 			if (cb->write_st) {
 
 				if (cb->write_ec) {
-					speex_echo_cancellation(cb->write_ec, (int16_t *)frame->data, (int16_t *)cb->read_data, (int16_t *)cb->write_out);
+					speex_echo_cancellation(cb->write_ec, (int16_t *) frame->data, (int16_t *) cb->read_data, (int16_t *) cb->write_out);
 					memcpy(frame->data, cb->write_out, frame->datalen);
 				}
-				
+
 				y = speex_preprocess_run(cb->write_st, frame->data);
 			}
 
@@ -1173,19 +1172,19 @@
 	switch_status_t status;
 	time_t to = 0;
 	switch_media_bug_flag_t flags = 0;
-	switch_codec_implementation_t read_impl = {0};
+	switch_codec_implementation_t read_impl = { 0 };
 	pp_cb_t *cb;
 	int update = 0;
 	int argc;
 	char *mydata = NULL, *argv[5];
 	int i = 0;
 
-    switch_core_session_get_read_impl(session, &read_impl);
+	switch_core_session_get_read_impl(session, &read_impl);
 
 	if ((cb = switch_channel_get_private(channel, "_preprocess"))) {
 		update = 1;
 	} else {
-		cb = switch_core_session_alloc(session, sizeof(*cb));		
+		cb = switch_core_session_alloc(session, sizeof(*cb));
 	}
 
 
@@ -1198,8 +1197,8 @@
 
 	mydata = strdup(cmds);
 	argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0])));
-	
-	for(i = 0; i < argc; i++) {
+
+	for (i = 0; i < argc; i++) {
 		char *var = argv[i];
 		char *val = NULL;
 		char rw;
@@ -1213,12 +1212,12 @@
 		if (var) {
 			if ((val = strchr(var, '='))) {
 				*val++ = '\0';
-				
+
 				rw = *var++;
-				while(*var == '.' || *var == '_') {
+				while (*var == '.' || *var == '_') {
 					var++;
 				}
-				
+
 				if (rw == 'r') {
 					if (!cb->read_st) {
 						cb->read_st = speex_preprocess_state_init(read_impl.samples_per_packet, read_impl.samples_per_second);
@@ -1237,8 +1236,9 @@
 					mutex = cb->write_mutex;
 				}
 
-				if (mutex) switch_mutex_lock(mutex);
-				
+				if (mutex)
+					switch_mutex_lock(mutex);
+
 				if (st) {
 					err = 0;
 					tr = switch_true(val);
@@ -1254,13 +1254,14 @@
 						speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC, &tr);
 						speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_AGC_LEVEL, &l);
 
-					} else if (!strcasecmp(var, "noise_supress")) {
+					} else if (!strcasecmp(var, "noise_suppress")) {
 						int db = atoi(val);
 						if (db < 0) {
 							r = speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_NOISE_SUPPRESS, &db);
-							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setting NOISE_SUPRESS on %c to %d [%d]\n", rw, db, r);
+							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setting NOISE_SUPPRESS on %c to %d [%d]\n", rw, db,
+											  r);
 						} else {
-							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Syntax error noise_supress should be in -db\n");
+							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Syntax error noise_suppress should be in -db\n");
 						}
 					} else if (!strcasecmp(var, "echo_cancel")) {
 						int tail = 1024;
@@ -1278,10 +1279,10 @@
 									cb->write_ec = NULL;
 								}
 							}
-							
+
 							ec = NULL;
 						}
-						
+
 						if (!ec) {
 							if (rw == 'r') {
 								ec = cb->read_ec = speex_echo_state_init(read_impl.samples_per_packet, tail);
@@ -1296,13 +1297,14 @@
 						}
 
 
-					} else if (!strcasecmp(var, "echo_supress")) {
+					} else if (!strcasecmp(var, "echo_suppress")) {
 						int db = atoi(val);
 						if (db < 0) {
 							speex_preprocess_ctl(st, SPEEX_PREPROCESS_SET_ECHO_SUPPRESS, &db);
-							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setting ECHO_SUPRESS on %c to %d [%d]\n", rw, db, r);
+							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setting ECHO_SUPPRESS on %c to %d [%d]\n", rw, db,
+											  r);
 						} else {
-							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Syntax error echo_supress should be in -db\n");
+							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Syntax error echo_suppress should be in -db\n");
 						}
 					} else {
 						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Warning unknown parameter [%s] \n", var);
@@ -1310,10 +1312,11 @@
 				}
 			}
 
-			if (mutex) switch_mutex_unlock(mutex);
+			if (mutex)
+				switch_mutex_unlock(mutex);
 
 			if (err) {
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Syntax error parsing preprossor commands\n");
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Syntax error parsing preprocessor commands\n");
 			}
 
 		} else {
@@ -1334,7 +1337,7 @@
 		if (cb->read_st) {
 			speex_preprocess_state_destroy(cb->read_st);
 		}
-		
+
 		if (cb->write_st) {
 			speex_preprocess_state_destroy(cb->write_st);
 		}
@@ -1342,11 +1345,11 @@
 		if (cb->read_ec) {
 			speex_echo_state_destroy(cb->read_ec);
 		}
-		
+
 		if (cb->write_ec) {
 			speex_echo_state_destroy(cb->write_ec);
 		}
-		
+
 		return status;
 	}
 
@@ -1355,8 +1358,152 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
+
 typedef struct {
 	switch_core_session_t *session;
+	int mute;
+	int read_level;
+	int write_level;
+	int read_mute;
+	int write_mute;
+} switch_session_audio_t;
+
+static switch_bool_t session_audio_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type)
+{
+	switch_session_audio_t *pvt = (switch_session_audio_t *) user_data;
+	switch_frame_t *frame = NULL;
+	int level = 0, mute = 0;
+
+
+	if (type == SWITCH_ABC_TYPE_READ_REPLACE || type == SWITCH_ABC_TYPE_WRITE_REPLACE) {
+		if (!(pvt->read_level || pvt->write_level || pvt->read_mute || pvt->write_mute)) {
+			switch_channel_set_private(switch_core_session_get_channel(pvt->session), "__audio", NULL);
+			return SWITCH_FALSE;
+		}
+	}
+
+	if (type == SWITCH_ABC_TYPE_READ_REPLACE) {
+		level = pvt->read_level;
+		mute = pvt->read_mute;
+		frame = switch_core_media_bug_get_read_replace_frame(bug);
+	} else if (type == SWITCH_ABC_TYPE_WRITE_REPLACE) {
+		level = pvt->write_level;
+		mute = pvt->write_mute;
+		frame = switch_core_media_bug_get_write_replace_frame(bug);
+	}
+
+	if (frame) {
+		if (mute) {
+			if (mute > 1) {
+				switch_generate_sln_silence(frame->data, frame->datalen / 2, mute);
+			} else {
+				memset(frame->data, 0, frame->datalen);
+			}
+		} else if (level) {
+			switch_change_sln_volume(frame->data, frame->datalen / 2, level);
+		}
+
+		if (type == SWITCH_ABC_TYPE_READ_REPLACE) {
+			switch_core_media_bug_set_read_replace_frame(bug, frame);
+		} else if (type == SWITCH_ABC_TYPE_WRITE_REPLACE) {
+			switch_core_media_bug_set_write_replace_frame(bug, frame);
+		}
+	}
+
+	return SWITCH_TRUE;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_ivr_stop_session_audio(switch_core_session_t *session)
+{
+	switch_media_bug_t *bug;
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+
+	if ((bug = switch_channel_get_private(channel, "__audio"))) {
+		switch_channel_set_private(channel, "__audio", NULL);
+		switch_core_media_bug_remove(session, &bug);
+		return SWITCH_STATUS_SUCCESS;
+	}
+	return SWITCH_STATUS_FALSE;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_ivr_session_audio(switch_core_session_t *session, const char *cmd, const char *direction, int level)
+{
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_media_bug_t *bug;
+	switch_status_t status;
+	switch_session_audio_t *pvt;
+	switch_codec_implementation_t read_impl = { 0 };
+	int existing = 0, c_read = 0, c_write = 0, flags = 0;
+
+	if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
+		return SWITCH_STATUS_FALSE;
+	}
+
+	switch_core_session_get_read_impl(session, &read_impl);
+
+
+	if ((bug = switch_channel_get_private(channel, "__audio"))) {
+		pvt = switch_core_media_bug_get_user_data(bug);
+		existing = 1;
+	} else {
+		if (!(pvt = switch_core_session_alloc(session, sizeof(*pvt)))) {
+			return SWITCH_STATUS_MEMERR;
+		}
+
+		pvt->session = session;
+	}
+
+
+	if (!strcasecmp(direction, "write")) {
+		flags = SMBF_WRITE_REPLACE;
+		c_write = 1;
+	} else if (!strcasecmp(direction, "read")) {
+		flags = SMBF_READ_REPLACE;
+		c_read = 1;
+	} else if (!strcasecmp(direction, "both")) {
+		flags = SMBF_READ_REPLACE | SMBF_WRITE_REPLACE;
+		c_read = c_write = 1;
+	}
+
+
+	if (!strcasecmp(cmd, "mute")) {
+		if (c_read) {
+			pvt->read_mute = level;
+			pvt->read_level = 0;
+		}
+		if (c_write) {
+			pvt->write_mute = level;
+			pvt->write_level = 0;
+		}
+	} else if (!strcasecmp(cmd, "level")) {
+		if (level < 5 && level > -5) {
+			if (c_read) {
+				pvt->read_level = level;
+			}
+			if (c_write) {
+				pvt->write_level = level;
+			}
+		}
+	}
+
+	if (existing) {
+		switch_core_media_bug_set_flag(bug, flags);
+
+	} else {
+		if ((status = switch_core_media_bug_add(session, session_audio_callback, pvt, 0, flags, &bug)) != SWITCH_STATUS_SUCCESS) {
+			return status;
+		}
+
+		switch_channel_set_private(channel, "__audio", bug);
+	}
+
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+
+typedef struct {
+	switch_core_session_t *session;
 	teletone_dtmf_detect_state_t dtmf_detect;
 } switch_inband_dtmf_t;
 
@@ -1385,7 +1532,8 @@
 					switch_channel_queue_dtmf(channel, &dtmf);
 					p++;
 				}
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_DEBUG, "DTMF DETECTED: [%s]\n", digit_str);
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_DEBUG, "DTMF DETECTED: [%s]\n",
+								  digit_str);
 			}
 			switch_core_media_bug_set_read_replace_frame(bug, frame);
 		}
@@ -1417,9 +1565,9 @@
 	switch_media_bug_t *bug;
 	switch_status_t status;
 	switch_inband_dtmf_t *pvt;
-	switch_codec_implementation_t read_impl = {0};
+	switch_codec_implementation_t read_impl = { 0 };
 
-    switch_core_session_get_read_impl(session, &read_impl);
+	switch_core_session_get_read_impl(session, &read_impl);
 
 	if (!(pvt = switch_core_session_alloc(session, sizeof(*pvt)))) {
 		return SWITCH_STATUS_MEMERR;
@@ -1506,8 +1654,8 @@
 {
 	switch_inband_dtmf_generate_t *pvt = (switch_inband_dtmf_generate_t *) user_data;
 	switch_frame_t *frame;
-	switch_codec_implementation_t read_impl = {0};
-    switch_core_session_get_read_impl(pvt->session, &read_impl);
+	switch_codec_implementation_t read_impl = { 0 };
+	switch_core_session_get_read_impl(pvt->session, &read_impl);
 
 	switch (type) {
 	case SWITCH_ABC_TYPE_INIT:
@@ -1553,20 +1701,23 @@
 				frame = switch_core_media_bug_get_write_replace_frame(bug);
 			}
 
-			while (switch_queue_trypop(pvt->digit_queue, &pop) == SWITCH_STATUS_SUCCESS) {
-				switch_dtmf_t *dtmf = (switch_dtmf_t *) pop;
-				char buf[2] = "";
-				int duration = dtmf->duration;
+			if (!switch_buffer_inuse(pvt->audio_buffer)) {
+				if (switch_queue_trypop(pvt->digit_queue, &pop) == SWITCH_STATUS_SUCCESS) {
+					switch_dtmf_t *dtmf = (switch_dtmf_t *) pop;
+					char buf[2] = "";
+					int duration = dtmf->duration;
 
-				buf[0] = dtmf->digit;
-				if (duration > 8000) {
-					duration = 4000;
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_WARNING, "%s Truncating ridiculous DTMF duration %d ms to 1/2 second.\n",
-									  switch_channel_get_name(switch_core_session_get_channel(pvt->session)), dtmf->duration / 8);
+					buf[0] = dtmf->digit;
+					if (duration > 8000) {
+						duration = 4000;
+						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)),
+										  SWITCH_LOG_WARNING, "%s Truncating ridiculous DTMF duration %d ms to 1/2 second.\n",
+										  switch_channel_get_name(switch_core_session_get_channel(pvt->session)), dtmf->duration / 8);
+					}
+					pvt->ts.duration = duration;
+					teletone_run(&pvt->ts, buf);
+					free(pop);
 				}
-				pvt->ts.duration = duration;
-				teletone_run(&pvt->ts, buf);
-				free(pop);
 			}
 
 			if (switch_buffer_inuse(pvt->audio_buffer) && (bytes = switch_buffer_read(pvt->audio_buffer, frame->data, frame->datalen))) {
@@ -1581,6 +1732,7 @@
 			} else {
 				switch_core_media_bug_set_write_replace_frame(bug, frame);
 			}
+
 			switch_mutex_unlock(pvt->mutex);
 		}
 		break;
@@ -1690,7 +1842,7 @@
 			} else {
 				frame = switch_core_media_bug_get_write_replace_frame(bug);
 			}
-			
+
 			for (i = 0; i < cont->index; i++) {
 
 				if (cont->list[i].sleep) {
@@ -1708,31 +1860,35 @@
 						cont->list[i].expires = 0;
 					}
 				}
-				
-				if (!cont->list[i].up) skip = 1;
-				
-				if (skip) return SWITCH_TRUE;
 
+				if (!cont->list[i].up)
+					skip = 1;
+
+				if (skip)
+					return SWITCH_TRUE;
+
 				if (teletone_multi_tone_detect(&cont->list[i].mt, frame->data, frame->samples)) {
 					switch_event_t *event;
 					cont->list[i].hits++;
-					
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_DEBUG, "TONE %s HIT %d/%d\n", 
+
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_DEBUG, "TONE %s HIT %d/%d\n",
 									  cont->list[i].key, cont->list[i].hits, cont->list[i].total_hits);
 					cont->list[i].sleep = cont->list[i].default_sleep;
 					cont->list[i].expires = cont->list[i].default_expires;
-					
+
 					if (cont->list[i].hits >= cont->list[i].total_hits) {
-						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_DEBUG, "TONE %s DETECTED\n", cont->list[i].key);
+						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_DEBUG, "TONE %s DETECTED\n",
+										  cont->list[i].key);
 						cont->list[i].up = 0;
-						
+
 						if (cont->list[i].callback) {
 							if ((rval = cont->list[i].callback(cont->session, cont->list[i].app, cont->list[i].data)) == SWITCH_TRUE) {
-								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_DEBUG, "Re-enabling %s\n", cont->list[i].key);
+								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_DEBUG, "Re-enabling %s\n",
+												  cont->list[i].key);
 								cont->list[i].up = 1;
 								cont->list[i].hits = 0;
 								cont->list[i].sleep = 0;
-								cont->list[i].expires = 0;								
+								cont->list[i].expires = 0;
 							}
 						} else if (cont->list[i].app) {
 							if (switch_event_create(&event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) {
@@ -1740,24 +1896,25 @@
 								switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-name", cont->list[i].app);
 								switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-arg", cont->list[i].data);
 								switch_event_add_header(event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5);
-								switch_core_session_queue_private_event(cont->session, &event);
+								switch_core_session_queue_private_event(cont->session, &event, SWITCH_FALSE);
 							}
 						}
 
 						if (cont->list[i].once) {
 							rval = SWITCH_FALSE;
 						}
-						
+
 						if (switch_event_create(&event, SWITCH_EVENT_DETECTED_TONE) == SWITCH_STATUS_SUCCESS) {
 							switch_event_t *dup;
 							switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detected-Tone", cont->list[i].key);
-							
+
 							if (switch_event_dup(&dup, event) == SWITCH_STATUS_SUCCESS) {
 								switch_event_fire(&dup);
 							}
 
 							if (switch_core_session_queue_event(cont->session, &event) != SWITCH_STATUS_SUCCESS) {
-								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_ERROR, "Event queue failed!\n");
+								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_ERROR,
+												  "Event queue failed!\n");
 								switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "delivery-failure", "true");
 								switch_event_fire(&event);
 							}
@@ -1798,10 +1955,8 @@
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_session_t *session,
 															   const char *key, const char *tone_spec,
-															   const char *flags, time_t timeout, 
-															   int hits, 
-															   const char *app, const char *data, 
-															   switch_tone_detect_callback_t callback)
+															   const char *flags, time_t timeout,
+															   int hits, const char *app, const char *data, switch_tone_detect_callback_t callback)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_status_t status;
@@ -1810,10 +1965,10 @@
 	int i = 0, ok = 0;
 	switch_media_bug_flag_t bflags = 0;
 	const char *var;
-	switch_codec_implementation_t read_impl = {0};
-    switch_core_session_get_read_impl(session, &read_impl);
+	switch_codec_implementation_t read_impl = { 0 };
+	switch_core_session_get_read_impl(session, &read_impl);
 
-	
+
 	if (zstr(key)) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No Key Specified!\n");
 		return SWITCH_STATUS_FALSE;
@@ -1865,7 +2020,7 @@
 		}
 	} while (next);
 	cont->list[cont->index].map.freqs[i++] = 0;
-	
+
 	if (!ok) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid tone spec!\n");
 		return SWITCH_STATUS_FALSE;
@@ -1883,7 +2038,8 @@
 
 	cont->list[cont->index].callback = callback;
 
-	if (!hits) hits = 1;
+	if (!hits)
+		hits = 1;
 
 	cont->list[cont->index].hits = 0;
 	cont->list[cont->index].total_hits = hits;
@@ -1922,14 +2078,14 @@
 		if (strchr(flags, 'o')) {
 			cont->list[cont->index].once = 1;
 		}
-		
+
 		if (strchr(flags, 'r')) {
 			bflags |= SMBF_READ_REPLACE;
 		} else if (strchr(flags, 'w')) {
 			bflags |= SMBF_WRITE_REPLACE;
 		}
 	}
-	
+
 	if (cont->bug_running) {
 		status = SWITCH_STATUS_SUCCESS;
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s bug already running\n", switch_channel_get_name(channel));
@@ -1993,17 +2149,17 @@
 	switch_threadattr_t *thd_attr = NULL;
 	switch_memory_pool_t *pool;
 	bch_t *bch;
-	
+
 	switch_assert(session);
 
 	pool = switch_core_session_get_pool(session);
-	
+
 	bch = switch_core_session_alloc(session, sizeof(*bch));
 	bch->session = session;
 	bch->app = app;
 	bch->flags = flags;
-	
-	
+
+
 	switch_threadattr_create(&thd_attr, pool);
 	switch_threadattr_detach_set(thd_attr, 1);
 	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
@@ -2032,7 +2188,8 @@
 
 	if (md->sr[direction].meta_on && now - md->sr[direction].last_digit > 5) {
 		md->sr[direction].meta_on = SWITCH_FALSE;
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s Meta digit timeout parsing %c\n", switch_channel_get_name(channel), dtmf->digit);
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s Meta digit timeout parsing %c\n", switch_channel_get_name(channel),
+						  dtmf->digit);
 		return SWITCH_STATUS_SUCCESS;
 	}
 
@@ -2062,7 +2219,7 @@
 
 			if (ok && md->sr[direction].map[dval].app) {
 				uint32_t flags = md->sr[direction].map[dval].flags;
-				
+
 				if ((md->sr[direction].map[dval].bind_flags & SBF_EXEC_OPPOSITE)) {
 					if (direction == SWITCH_DTMF_SEND) {
 						flags |= SMF_ECHO_ALEG;
@@ -2086,7 +2243,7 @@
 				if ((md->sr[direction].map[dval].bind_flags & SBF_EXEC_INLINE)) {
 					flags |= SMF_EXEC_INLINE;
 				}
-				
+
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Processing meta digit '%c' [%s]\n",
 								  switch_channel_get_name(channel), dtmf->digit, md->sr[direction].map[dval].app);
 
@@ -2118,15 +2275,15 @@
 SWITCH_DECLARE(switch_status_t) switch_ivr_unbind_dtmf_meta_session(switch_core_session_t *session, uint32_t key)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	
+
 	if (key) {
 		dtmf_meta_data_t *md = switch_channel_get_private(channel, SWITCH_META_VAR_KEY);
-		
+
 		if (!md || key > 9) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid key %u\n", key);
 			return SWITCH_STATUS_FALSE;
 		}
-		
+
 		memset(&md->sr[SWITCH_DTMF_RECV].map[key], 0, sizeof(md->sr[SWITCH_DTMF_RECV].map[key]));
 		memset(&md->sr[SWITCH_DTMF_SEND].map[key], 0, sizeof(md->sr[SWITCH_DTMF_SEND].map[key]));
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "UnBound A-Leg: %d\n", key);
@@ -2163,7 +2320,7 @@
 			md->sr[SWITCH_DTMF_RECV].map[key].app = switch_core_session_strdup(session, app);
 			md->sr[SWITCH_DTMF_RECV].map[key].flags |= SMF_HOLD_BLEG;
 			md->sr[SWITCH_DTMF_RECV].map[key].bind_flags = bind_flags;
-			
+
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Bound A-Leg: %d %s\n", key, app);
 		}
 		if ((bind_flags & SBF_DIAL_BLEG)) {
@@ -2242,14 +2399,14 @@
 				if ((p = switch_stristr("<input>", xmlstr))) {
 					p += 7;
 				}
-				
-				while(p && *p) {
+
+				while (p && *p) {
 					char c;
 
 					if (*p == '<') {
 						break;
 					}
-					
+
 					if (!strncasecmp(p, "pound", 5)) {
 						c = '#';
 						p += 5;
@@ -2266,15 +2423,15 @@
 						c = *p;
 						p++;
 					}
-					
+
 					if (is_dtmf(c)) {
 						switch_dtmf_t dtmf;
 						dtmf.digit = c;
 						dtmf.duration = switch_core_default_dtmf_duration(0);
 						switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_DEBUG, "Queue speech detected dtmf %c\n", c);
-						switch_channel_queue_dtmf(channel, &dtmf);						
+						switch_channel_queue_dtmf(channel, &dtmf);
 					}
-					
+
 				}
 				switch_ivr_resume_detect_speech(sth->session);
 			}
@@ -2425,6 +2582,19 @@
 	return SWITCH_STATUS_FALSE;
 }
 
+SWITCH_DECLARE(switch_status_t) switch_ivr_set_param_detect_speech(switch_core_session_t *session, const char *name, const char *val) 
+{
+	struct speech_thread_handle *sth = switch_channel_get_private(switch_core_session_get_channel(session), SWITCH_SPEECH_KEY);
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	if (sth && sth->ah && name && val) {
+		switch_core_asr_text_param(sth->ah, (char *) name, val);
+		status = SWITCH_STATUS_SUCCESS;
+	}
+
+	return status;
+}
+
 SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, const char *name)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -2450,10 +2620,10 @@
 	switch_status_t status;
 	switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE;
 	struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY);
-	switch_codec_implementation_t read_impl = {0};
+	switch_codec_implementation_t read_impl = { 0 };
 	const char *p;
 	switch_core_session_get_read_impl(session, &read_impl);
-	
+
 	if (!ah) {
 		if (!(ah = switch_core_session_alloc(session, sizeof(*ah)))) {
 			return SWITCH_STATUS_MEMERR;
@@ -2475,10 +2645,10 @@
 	}
 
 	if ((status = switch_core_asr_open(ah,
-							 mod_name,
-							 "L16",
-							 read_impl.actual_samples_per_second, dest, &flags,
-							 switch_core_session_get_pool(session))) == SWITCH_STATUS_SUCCESS) {
+									   mod_name,
+									   "L16",
+									   read_impl.actual_samples_per_second, dest, &flags,
+									   switch_core_session_get_pool(session))) == SWITCH_STATUS_SUCCESS) {
 
 		if (switch_core_asr_load_grammar(ah, grammar, name) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Error loading Grammar\n");
@@ -2662,7 +2832,6 @@
 SWITCH_DECLARE(switch_status_t) switch_ivr_broadcast(const char *uuid, const char *path, switch_media_flag_t flags)
 {
 	switch_channel_t *channel;
-	int nomedia;
 	switch_core_session_t *session, *master;
 	switch_event_t *event;
 	switch_core_session_t *other_session = NULL;
@@ -2671,7 +2840,7 @@
 	char *cause = NULL;
 	char *mypath;
 	char *p;
-	int custom = 0;
+	int app_flags = 0, nomedia = 0;
 
 	switch_assert(path);
 
@@ -2689,19 +2858,10 @@
 		*p++ = '\0';
 		*p++ = '\0';
 		path = p;
-		custom++;
 	}
 
-	if (!custom && (switch_channel_test_flag(channel, CF_EVENT_PARSE))) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Channel [%s][%s] already broadcasting...broadcast aborted\n",
-						  switch_channel_get_name(channel), path);
-		switch_core_session_rwunlock(session);
-		switch_safe_free(mypath);		
-		return SWITCH_STATUS_FALSE;
-	}
-
-
-	if ((nomedia = switch_channel_test_flag(channel, CF_PROXY_MODE))) {
+	if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
+		nomedia = 1;
 		switch_ivr_media(uuid, SMF_REBRIDGE);
 	}
 
@@ -2715,15 +2875,18 @@
 	if ((flags & SMF_ECHO_BLEG) && (other_uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))
 		&& (other_session = switch_core_session_locate(other_uuid))) {
 		if ((flags & SMF_EXEC_INLINE)) {
-			switch_core_session_execute_application(other_session, app, path);
+			switch_core_session_execute_application_get_flags(other_session, app, path, &app_flags);
 			nomedia = 0;
 		} else {
+			switch_core_session_get_app_flags(app, &app_flags);
 			if (switch_event_create(&event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) {
 				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "execute");
 				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-name", app);
 				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-arg", path);
+				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, (flags & SMF_PRIORITY) ? "event-lock-pri" : "event-lock", "true");
+
 				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5);
-				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event-lock", "true");
+
 				if ((flags & SMF_LOOP)) {
 					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "loops", "%d", -1);
 				}
@@ -2731,8 +2894,8 @@
 				if ((flags & SMF_HOLD_BLEG)) {
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hold-bleg", "true");
 				}
-				
-				switch_core_session_queue_private_event(other_session, &event);
+
+				switch_core_session_queue_private_event(other_session, &event, (flags & SMF_PRIORITY));
 			}
 		}
 
@@ -2741,50 +2904,45 @@
 		other_session = NULL;
 	}
 
-	if (switch_stristr("record", app)) {
+	if ((app_flags & SAF_MEDIA_TAP)) {
 		nomedia = 0;
 	}
 
-
 	if ((flags & SMF_ECHO_ALEG)) {
 		if ((flags & SMF_EXEC_INLINE)) {
+			nomedia = 0;
 			switch_core_session_execute_application(session, app, path);
-			nomedia = 0;
 		} else {
 			if (switch_event_create(&event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) {
 				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "execute");
 				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-name", app);
 				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-arg", path);
+				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, (flags & SMF_PRIORITY) ? "event-lock-pri" : "event-lock", "true");
 				switch_event_add_header(event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5);
-				switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event-lock", "true");
+
 				if ((flags & SMF_LOOP)) {
 					switch_event_add_header(event, SWITCH_STACK_BOTTOM, "loops", "%d", -1);
 				}
 				if ((flags & SMF_HOLD_BLEG)) {
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hold-bleg", "true");
 				}
-				switch_core_session_queue_private_event(session, &event);
+
+				switch_core_session_queue_private_event(session, &event, (flags & SMF_PRIORITY));
+
+				if (nomedia)
+					switch_channel_set_flag(channel, CF_BROADCAST_DROP_MEDIA);
 			}
 		}
 		master = session;
 	}
 
-	if (nomedia) {
-		if (switch_event_create(&event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) {
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "nomedia");
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "nomedia-uuid", uuid);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event-lock", "true");
-			switch_core_session_queue_private_event(master, &event);
-		}
-	}
-
 	if (cause) {
 		if (switch_event_create(&event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) {
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "execute");
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-name", "hangup");
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-arg", cause);
-			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "event-lock", "true");
-			switch_core_session_queue_private_event(session, &event);
+			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, (flags & SMF_PRIORITY) ? "event-lock-pri" : "event-lock", "true");
+			switch_core_session_queue_private_event(session, &event, (flags & SMF_PRIORITY));
 		}
 	}
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_ivr_bridge.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_ivr_bridge.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_ivr_bridge.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -30,9 +30,11 @@
  */
 
 #include <switch.h>
-#define DEFAULT_LEAD_FRAMES 5
+#define DEFAULT_LEAD_FRAMES 10
 
 static const switch_state_handler_table_t audio_bridge_peer_state_handlers;
+static void cleanup_proxy_mode_a(switch_core_session_t *session);
+static void cleanup_proxy_mode_b(switch_core_session_t *session);
 
 /* Bridge Related Stuff*/
 /*********************************************************************************/
@@ -66,11 +68,10 @@
 		}
 
 	}
-	
-	switch_core_session_kill_channel(vh->session_b, SWITCH_SIG_BREAK);	
+
+	switch_core_session_kill_channel(vh->session_b, SWITCH_SIG_BREAK);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s video thread ended.\n", switch_channel_get_name(channel));
 
-
 	vh->up = 0;
 	return NULL;
 }
@@ -88,7 +89,8 @@
 #endif
 
 
-static void send_display(switch_core_session_t *session, switch_core_session_t *peer_session) {
+static void send_display(switch_core_session_t *session, switch_core_session_t *peer_session)
+{
 
 	switch_core_session_message_t *msg;
 	switch_caller_profile_t *caller_profile;
@@ -101,7 +103,7 @@
 	if (switch_channel_direction(caller_channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
 		name = caller_profile->callee_id_name;
 		number = caller_profile->callee_id_number;
-		
+
 		if (zstr(name)) {
 			name = caller_profile->destination_number;
 		}
@@ -111,7 +113,7 @@
 	} else {
 		name = caller_profile->caller_id_name;
 		number = caller_profile->caller_id_number;
-		
+
 		if (zstr(name)) {
 			name = caller_profile->destination_number;
 		}
@@ -121,10 +123,10 @@
 	}
 
 	if ((p = strrchr(number, '/'))) {
-		number = p+1;
+		number = p + 1;
 	}
 	if ((p = strrchr(name, '/'))) {
-		name = p+1;
+		name = p + 1;
 	}
 
 	msg = switch_core_session_alloc(peer_session, sizeof(*msg));
@@ -173,13 +175,13 @@
 	int inner_bridge = 0;
 	switch_codec_t silence_codec = { 0 };
 	switch_frame_t silence_frame = { 0 };
-	int16_t silence_data[SWITCH_RECOMMENDED_BUFFER_SIZE/2] = { 0 };
+	int16_t silence_data[SWITCH_RECOMMENDED_BUFFER_SIZE / 2] = { 0 };
 	const char *silence_var;
 	int silence_val = 0, bypass_media_after_bridge = 0;
 	const char *bridge_answer_timeout = NULL;
 	int answer_timeout, sent_update = 0;
 	time_t answer_limit = 0;
-	
+
 #ifdef SWITCH_VIDEO_IN_THREADS
 	switch_thread_t *vid_thread = NULL;
 	struct vid_helper vh = { 0 };
@@ -191,7 +193,7 @@
 	if (!(session_b = switch_core_session_locate(data->b_uuid))) {
 		return NULL;
 	}
-	
+
 	input_callback = data->input_callback;
 	user_data = data->session_data;
 	stream_id = data->stream_id;
@@ -210,7 +212,7 @@
 	}
 
 	inner_bridge = switch_channel_test_flag(chan_a, CF_INNER_BRIDGE);
-	
+
 	if (!switch_channel_test_flag(chan_a, CF_ANSWERED) && (bridge_answer_timeout = switch_channel_get_variable(chan_a, "bridge_answer_timeout"))) {
 		if ((answer_timeout = atoi(bridge_answer_timeout)) < 0) {
 			answer_timeout = 0;
@@ -218,14 +220,14 @@
 			answer_limit = switch_epoch_time_now(NULL) + answer_timeout;
 		}
 	}
-	
 
+
 	switch_channel_set_flag(chan_a, CF_BRIDGED);
 
 	switch_channel_wait_for_flag(chan_b, CF_BRIDGED, SWITCH_TRUE, 10000, chan_a);
 
 	if (!switch_channel_test_flag(chan_b, CF_BRIDGED)) {
-		if (!(switch_channel_test_flag(chan_b, CF_TRANSFER) || switch_channel_test_flag(chan_b, CF_REDIRECT) 
+		if (!(switch_channel_test_flag(chan_b, CF_TRANSFER) || switch_channel_test_flag(chan_b, CF_REDIRECT)
 			  || switch_channel_get_state(chan_b) == CS_RESET)) {
 			switch_channel_hangup(chan_b, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 		}
@@ -239,8 +241,8 @@
 		}
 	}
 
-	if ((silence_var = switch_channel_get_variable(chan_a, "bridge_generate_comfort_noise"))) {		
-		switch_codec_implementation_t read_impl = {0};
+	if ((silence_var = switch_channel_get_variable(chan_a, "bridge_generate_comfort_noise"))) {
+		switch_codec_implementation_t read_impl = { 0 };
 		switch_core_session_get_read_impl(session_a, &read_impl);
 
 		if (!switch_channel_media_ready(chan_a)) {
@@ -259,17 +261,17 @@
 		if (silence_val) {
 			if (switch_core_codec_init(&silence_codec,
 									   "L16",
-									   NULL, 
-									   read_impl.actual_samples_per_second, 
+									   NULL,
+									   read_impl.actual_samples_per_second,
 									   read_impl.microseconds_per_packet / 1000,
 									   1,
-									   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, 
-									   NULL, 
-									   switch_core_session_get_pool(session_a)) != SWITCH_STATUS_SUCCESS) {
-				
+									   SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+									   NULL, switch_core_session_get_pool(session_a)) != SWITCH_STATUS_SUCCESS) {
+
 				silence_val = 0;
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setup generated silence from %s to %s at %d\n", switch_channel_get_name(chan_a), switch_channel_get_name(chan_b), silence_val);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setup generated silence from %s to %s at %d\n", switch_channel_get_name(chan_a),
+								  switch_channel_get_name(chan_b), silence_val);
 				silence_frame.codec = &silence_codec;
 				silence_frame.data = silence_data;
 				silence_frame.buflen = sizeof(silence_data);
@@ -278,7 +280,7 @@
 			}
 		}
 	}
-	
+
 	for (;;) {
 		switch_channel_state_t b_state;
 		switch_status_t status;
@@ -339,14 +341,15 @@
 		}
 #endif
 
-		if (loop_count > DEFAULT_LEAD_FRAMES && switch_channel_media_ack(chan_a) && 
-			(bypass_media_after_bridge || switch_channel_test_flag(chan_a, CF_BYPASS_MEDIA_AFTER_BRIDGE)) && switch_channel_test_flag(chan_a, CF_ANSWERED) && 
-			switch_channel_test_flag(chan_b, CF_ANSWERED)) {
+		if (loop_count > DEFAULT_LEAD_FRAMES && switch_channel_media_ack(chan_a) &&
+			(bypass_media_after_bridge || switch_channel_test_flag(chan_a, CF_BYPASS_MEDIA_AFTER_BRIDGE)) && switch_channel_test_flag(chan_a, CF_ANSWERED)
+			&& switch_channel_test_flag(chan_b, CF_ANSWERED)) {
 			switch_ivr_nomedia(switch_core_session_get_uuid(session_a), SMF_REBRIDGE);
 			bypass_media_after_bridge = 0;
 			switch_channel_clear_flag(chan_a, CF_BYPASS_MEDIA_AFTER_BRIDGE);
+			goto end_of_bridge_loop;
 		}
-		
+
 		/* if 1 channel has DTMF pass it to the other */
 		while (switch_channel_has_dtmf(chan_a)) {
 			switch_dtmf_t dtmf = { 0, 0 };
@@ -411,7 +414,7 @@
 
 		if (ans_a != ans_b) {
 			switch_channel_t *un = ans_a ? chan_b : chan_a;
-			
+
 			if (!switch_channel_test_flag(un, CF_OUTBOUND)) {
 				switch_channel_pass_callee_id(un == chan_b ? chan_a : chan_b, un);
 				if (switch_channel_answer(un) != SWITCH_STATUS_SUCCESS) {
@@ -420,14 +423,16 @@
 				}
 			}
 
-			if (ans_a) ans_b = 1; else ans_a = 1;
+			if (ans_a)
+				ans_b = 1;
+			else
+				ans_a = 1;
 		}
-		
+
 		if (originator && !sent_update && ans_a && ans_b && switch_channel_media_ack(chan_a) && switch_channel_media_ack(chan_b)) {
 			switch_ivr_bridge_display(session_a, session_b);
 			sent_update = 1;
 		}
-
 #ifndef SWITCH_VIDEO_IN_THREADS
 		if (switch_channel_test_flag(chan_a, CF_VIDEO) && switch_channel_test_flag(chan_b, CF_VIDEO)) {
 			/* read video from 1 channel and write it to the other */
@@ -453,15 +458,15 @@
 					continue;
 				}
 			}
-			
+
 			if (data->skip_frames) {
 				data->skip_frames--;
 				continue;
 			}
-			
+
 			if (status != SWITCH_STATUS_BREAK && !switch_channel_test_flag(chan_a, CF_HOLD)) {
 				if (switch_core_session_write_frame(session_b, read_frame, SWITCH_IO_FLAG_NONE, stream_id) != SWITCH_STATUS_SUCCESS) {
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
 									  "%s ending bridge by request from write function\n", switch_channel_get_name(chan_b));
 					goto end_of_bridge_loop;
 				}
@@ -472,7 +477,7 @@
 		}
 	}
 
- end_of_bridge_loop:
+  end_of_bridge_loop:
 
 #ifdef SWITCH_VIDEO_IN_THREADS
 	if (vid_thread) {
@@ -508,12 +513,6 @@
 	}
 
 
-	if (switch_channel_down(chan_b)) {
-		if (originator && switch_channel_ready(chan_a) && !switch_channel_test_flag(chan_a, CF_ANSWERED)) {
-			switch_channel_hangup(chan_a, switch_channel_get_cause(chan_b));
-		}
-	}
-
 	msg.string_arg = data->b_uuid;
 	msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE;
 	msg.from = __FILE__;
@@ -562,6 +561,24 @@
 	switch_channel_set_variable(chan_a, SWITCH_BRIDGE_VARIABLE, NULL);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "BRIDGE THREAD DONE [%s]\n", switch_channel_get_name(chan_a));
 	switch_channel_clear_flag(chan_a, CF_BRIDGED);
+
+	if (switch_channel_test_flag(chan_a, CF_LEG_HOLDING) && switch_channel_ready(chan_b)) {
+		const char *ext = switch_channel_get_variable(chan_a, "hold_hangup_xfer_exten");
+
+		switch_channel_stop_broadcast(chan_b);
+
+		if (zstr(ext)) {
+			switch_call_cause_t cause = switch_channel_get_cause(chan_b);
+			if (cause == SWITCH_CAUSE_NONE) {
+				cause = SWITCH_CAUSE_NORMAL_CLEARING;
+			}
+			switch_channel_hangup(chan_b, cause);
+		} else {
+			switch_channel_set_variable(chan_b, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE, ext);
+		}
+		switch_channel_clear_flag(chan_a, CF_LEG_HOLDING);
+	}
+
 	switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
 	switch_core_session_rwunlock(session_b);
 	return NULL;
@@ -605,21 +622,22 @@
 	switch_channel_clear_state_handler(channel, &audio_bridge_peer_state_handlers);
 
 	state = switch_channel_get_state(channel);
-	
+
 	if (state < CS_HANGUP && switch_true(switch_channel_get_variable(channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE))) {
 		switch_ivr_park_session(session);
 	} else if (state < CS_HANGUP && (var = switch_channel_get_variable(channel, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE))) {
 		transfer_after_bridge(session, var);
 	} else {
-		if (!switch_channel_test_flag(channel, CF_TRANSFER) && !switch_channel_test_flag(channel, CF_REDIRECT) && 
-			!switch_channel_test_flag(channel, CF_XFER_ZOMBIE) && bd && !bd->clean_exit 
-			&& state != CS_PARK && state != CS_ROUTING && !switch_channel_test_flag(channel, CF_INNER_BRIDGE)) {
+		if (!switch_channel_test_flag(channel, CF_TRANSFER) && !switch_channel_test_flag(channel, CF_REDIRECT) &&
+			!switch_channel_test_flag(channel, CF_XFER_ZOMBIE) && bd && !bd->clean_exit
+			&& state != CS_PARK && state != CS_ROUTING && state == CS_EXCHANGE_MEDIA && !switch_channel_test_flag(channel, CF_INNER_BRIDGE)) {
 			switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
 		}
 	}
-	
+
 	if (switch_channel_get_state(channel) == CS_EXCHANGE_MEDIA) {
-		switch_channel_set_state(channel, CS_RESET);
+		switch_channel_set_variable(channel, "park_timeout", "3");
+		switch_channel_set_state(channel, CS_PARK);
 	}
 
 	return SWITCH_STATUS_FALSE;
@@ -680,6 +698,8 @@
 
 	switch_channel_clear_flag(channel, CF_ORIGINATING);
 
+	cleanup_proxy_mode_b(session);
+
 	if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
 		switch_channel_set_state(channel, CS_SOFT_EXECUTE);
 	}
@@ -707,7 +727,7 @@
 	}
 
 	switch_channel_clear_flag_recursive(channel, CF_BRIDGE_ORIGINATOR);
-	
+
 	if ((other_uuid = switch_channel_get_variable(channel, SWITCH_UUID_BRIDGE)) && (other_session = switch_core_session_locate(other_uuid))) {
 		switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
 		switch_event_t *event;
@@ -716,22 +736,20 @@
 
 		switch_channel_set_variable(channel, SWITCH_UUID_BRIDGE, NULL);
 
-		switch_channel_wait_for_state(channel, other_channel, CS_RESET);
+		switch_channel_wait_for_state(other_channel, channel, CS_RESET);
 
-		if (switch_ivr_wait_for_answer(session, other_session) != SWITCH_STATUS_SUCCESS) {
-			switch_core_session_rwunlock(other_session);
-			switch_channel_hangup(channel, SWITCH_CAUSE_ORIGINATOR_CANCEL);
-			return SWITCH_STATUS_FALSE;
-		}
-
 		if (switch_channel_get_state(other_channel) == CS_RESET) {
 			switch_channel_set_state(other_channel, CS_SOFT_EXECUTE);
+			switch_channel_wait_for_state(other_channel, channel, CS_SOFT_EXECUTE);
 		}
 
-		switch_channel_wait_for_state(channel, other_channel, CS_SOFT_EXECUTE);
-
 		switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
 
+		if (switch_ivr_wait_for_answer(session, other_session) != SWITCH_STATUS_SUCCESS) {
+			switch_core_session_rwunlock(other_session);
+			switch_channel_hangup(channel, SWITCH_CAUSE_ORIGINATOR_CANCEL);
+			return SWITCH_STATUS_FALSE;
+		}
 
 		ready_a = switch_channel_ready(channel);
 		ready_b = switch_channel_ready(other_channel);
@@ -769,11 +787,10 @@
 		}
 
 		switch_ivr_multi_threaded_bridge(session, other_session, NULL, NULL, NULL);
-		
+
 		state = switch_channel_get_state(channel);
-		if (!switch_channel_test_flag(channel, CF_TRANSFER) && 
-			!switch_channel_test_flag(channel, CF_REDIRECT) && state < CS_HANGUP 
-			&& state != CS_ROUTING && state != CS_PARK) {
+		if (!switch_channel_test_flag(channel, CF_TRANSFER) &&
+			!switch_channel_test_flag(channel, CF_REDIRECT) && state < CS_HANGUP && state != CS_ROUTING && state != CS_PARK) {
 			switch_channel_set_state(channel, CS_EXECUTE);
 		}
 		switch_core_session_rwunlock(other_session);
@@ -786,13 +803,76 @@
 	return SWITCH_STATUS_FALSE;
 }
 
+static switch_status_t sb_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction)
+{
+	switch_channel_t *channel = NULL;
+	char *key;
+
+	channel = switch_core_session_get_channel(session);
+	switch_assert(channel != NULL);
+
+	if ((key = (char *) switch_channel_get_private(channel, "__bridge_term_key")) && dtmf->digit == *key) {
+		const char *uuid;
+		switch_core_session_t *other_session;
+
+		if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
+			switch_channel_set_state(channel, CS_EXECUTE);
+		} else {
+			if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE)) && (other_session = switch_core_session_locate(uuid))) {
+				switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
+				switch_channel_set_state(other_channel, CS_EXECUTE);
+				switch_core_session_rwunlock(other_session);
+			} else {
+				return SWITCH_STATUS_SUCCESS;
+			}
+		}
+
+		return SWITCH_STATUS_FALSE;
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
+static switch_status_t hanguphook(switch_core_session_t *session)
+{
+	switch_core_session_message_t msg = { 0 };
+	switch_channel_t *channel = NULL;
+
+	channel = switch_core_session_get_channel(session);
+
+	msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE;
+	msg.from = __FILE__;
+	msg.string_arg = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE);
+
+	switch_core_session_receive_message(session, &msg);
+	switch_core_event_hook_remove_state_change(session, hanguphook);
+
+	return SWITCH_STATUS_SUCCESS;
+
+}
+
 static switch_status_t signal_bridge_on_hibernate(switch_core_session_t *session)
 {
 	switch_channel_t *channel = NULL;
+	const char *key;
+	switch_core_session_message_t msg = { 0 };
 
 	channel = switch_core_session_get_channel(session);
 	switch_assert(channel != NULL);
 
+	msg.message_id = SWITCH_MESSAGE_INDICATE_BRIDGE;
+	msg.from = __FILE__;
+	msg.string_arg = switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE);
+
+	switch_core_event_hook_add_state_change(session, hanguphook);
+
+	switch_core_session_receive_message(session, &msg);
+
+	if ((key = switch_channel_get_variable(channel, "bridge_terminate_key"))) {
+		switch_channel_set_private(channel, "__bridge_term_key", switch_core_session_strdup(session, key));
+		switch_core_event_hook_add_recv_dtmf(session, sb_on_dtmf);
+	}
+
 	switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, switch_channel_get_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE));
 
 	return SWITCH_STATUS_SUCCESS;
@@ -809,37 +889,47 @@
 		switch_channel_set_variable(channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
 	}
 
+	if (switch_channel_get_private(channel, "__bridge_term_key")) {
+		switch_core_event_hook_remove_recv_dtmf(session, sb_on_dtmf);
+		switch_channel_set_private(channel, "__bridge_term_key", NULL);
+	}
+
 	switch_channel_set_variable(channel, SWITCH_BRIDGE_VARIABLE, NULL);
 
 	if (uuid && (other_session = switch_core_session_locate(uuid))) {
-        switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
-        const char *sbv = switch_channel_get_variable(other_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE);
+		switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
+		const char *sbv = switch_channel_get_variable(other_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE);
 		const char *var;
 
-        if (!zstr(sbv) && !strcmp(sbv, switch_core_session_get_uuid(session))) {
+		if (!zstr(sbv) && !strcmp(sbv, switch_core_session_get_uuid(session))) {
 
-            switch_channel_set_variable(other_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
-            switch_channel_set_variable(other_channel, SWITCH_BRIDGE_VARIABLE, NULL);
-			
-            if (switch_channel_up(other_channel)) {
+			switch_channel_set_variable(other_channel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL);
+			switch_channel_set_variable(other_channel, SWITCH_BRIDGE_VARIABLE, NULL);
+
+			if (switch_channel_up(other_channel)) {
+
 				if (switch_true(switch_channel_get_variable(other_channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE))) {
 					switch_ivr_park_session(other_session);
 				} else if ((var = switch_channel_get_variable(other_channel, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE))) {
 					transfer_after_bridge(other_session, var);
 				}
-				
-				if (switch_channel_test_flag(other_channel, CF_BRIDGE_ORIGINATOR) &&
-					switch_true(switch_channel_get_variable(other_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE))) {
-					switch_channel_hangup(other_channel, switch_channel_get_cause(channel));	
+
+				if (switch_channel_test_flag(other_channel, CF_BRIDGE_ORIGINATOR)) {
+					if (switch_channel_test_flag(channel, CF_ANSWERED) &&
+						switch_true(switch_channel_get_variable(other_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE))) {
+						switch_channel_hangup(other_channel, switch_channel_get_cause(channel));
+					} else {
+						switch_channel_set_state(other_channel, CS_EXECUTE);
+					}
 				} else {
-					switch_channel_set_state(other_channel, CS_EXECUTE);
+					switch_channel_hangup(other_channel, switch_channel_get_cause(channel));
 				}
-            }
-        }
-		
-        switch_core_session_rwunlock(other_session);
-    }
-	
+			}
+		}
+
+		switch_core_session_rwunlock(other_session);
+	}
+
 	if (switch_channel_test_flag(channel, CF_BRIDGE_ORIGINATOR)) {
 		switch_channel_clear_flag_recursive(channel, CF_BRIDGE_ORIGINATOR);
 		if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_UNBRIDGE) == SWITCH_STATUS_SUCCESS) {
@@ -847,7 +937,7 @@
 			switch_event_fire(&event);
 		}
 	}
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -873,7 +963,7 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
-	if (!switch_channel_ready(caller_channel)) {
+	if (!switch_channel_up(caller_channel)) {
 		switch_channel_hangup(peer_channel, SWITCH_CAUSE_ORIGINATOR_CANCEL);
 		return SWITCH_STATUS_FALSE;
 	}
@@ -912,17 +1002,19 @@
 		switch_channel_event_set_data(caller_channel, event);
 		switch_event_fire(&event);
 	}
-	
-	switch_channel_set_state_flag(caller_channel, CF_TRANSFER);
-	switch_channel_set_state_flag(peer_channel, CF_TRANSFER);
 
+	switch_channel_set_state_flag(caller_channel, CF_RESET);
+	switch_channel_set_state_flag(peer_channel, CF_RESET);
+
 	switch_channel_set_state(caller_channel, CS_HIBERNATE);
 	switch_channel_set_state(peer_channel, CS_HIBERNATE);
-	
+
+#if 0
 	if (switch_channel_test_flag(caller_channel, CF_BRIDGED)) {
 		switch_channel_set_flag(caller_channel, CF_TRANSFER);
 		switch_channel_set_flag(peer_channel, CF_TRANSFER);
 	}
+#endif
 
 	switch_ivr_bridge_display(session, peer_session);
 
@@ -951,8 +1043,8 @@
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Call has no media... Redirecting to signal bridge.\n");
 		return switch_ivr_signal_bridge(session, peer_session);
 	}
-	
 
+
 	switch_channel_set_flag_recursive(caller_channel, CF_MEDIA_BRIDGE_TTL);
 	switch_channel_set_flag_recursive(peer_channel, CF_MEDIA_BRIDGE_TTL);
 
@@ -997,12 +1089,12 @@
 			switch_channel_set_variable(caller_channel, SWITCH_BRIDGE_VARIABLE, switch_core_session_get_uuid(peer_session));
 			switch_channel_set_variable(peer_channel, SWITCH_BRIDGE_VARIABLE, switch_core_session_get_uuid(session));
 
-			if (!switch_channel_media_ready(caller_channel) || 
+			if (!switch_channel_media_ready(caller_channel) ||
 				(!switch_channel_test_flag(peer_channel, CF_ANSWERED) && !switch_channel_test_flag(peer_channel, CF_EARLY_MEDIA))) {
 				if ((status = switch_ivr_wait_for_answer(session, peer_session)) != SWITCH_STATUS_SUCCESS || !switch_channel_ready(caller_channel)) {
 					switch_channel_state_t w_state = switch_channel_get_state(caller_channel);
 					switch_channel_hangup(peer_channel, SWITCH_CAUSE_ALLOTTED_TIMEOUT);
-					if (w_state < CS_HANGUP && w_state != CS_ROUTING && w_state != CS_PARK && 
+					if (w_state < CS_HANGUP && w_state != CS_ROUTING && w_state != CS_PARK &&
 						!switch_channel_test_flag(caller_channel, CF_REDIRECT) && !switch_channel_test_flag(caller_channel, CF_TRANSFER) &&
 						w_state != CS_EXECUTE) {
 						const char *ext = switch_channel_get_variable(peer_channel, "original_destination_number");
@@ -1059,7 +1151,7 @@
 					switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-arg", data);
 					switch_event_add_header(execute_event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5);
 					switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "event-lock", "true");
-					switch_core_session_queue_private_event(session, &execute_event);
+					switch_core_session_queue_private_event(session, &execute_event, SWITCH_FALSE);
 					a_leg->skip_frames = DEFAULT_LEAD_FRAMES;
 				}
 
@@ -1074,36 +1166,20 @@
 					switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "execute-app-arg", data);
 					switch_event_add_header(execute_event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5);
 					switch_event_add_header_string(execute_event, SWITCH_STACK_BOTTOM, "event-lock", "true");
-					switch_core_session_queue_private_event(peer_session, &execute_event);
+					switch_core_session_queue_private_event(peer_session, &execute_event, SWITCH_FALSE);
 					b_leg->skip_frames = DEFAULT_LEAD_FRAMES;
 				}
 			}
-			
+
 			switch_channel_set_private(peer_channel, "_bridge_", b_leg);
 			switch_channel_set_state(peer_channel, CS_EXCHANGE_MEDIA);
 			audio_bridge_thread(NULL, (void *) a_leg);
-			
-			if (switch_channel_test_flag(caller_channel, CF_LEG_HOLDING)) {
-				const char *ext = switch_channel_get_variable(caller_channel, "hold_hangup_xfer_exten");
-				if (!zstr(ext)) {
-					switch_channel_set_variable(peer_channel, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE, ext);
-				}
-				switch_channel_clear_flag(caller_channel, CF_LEG_HOLDING);
-			}
 
-			if (switch_channel_test_flag(peer_channel, CF_LEG_HOLDING)) {
-				const char *ext = switch_channel_get_variable(peer_channel, "hold_hangup_xfer_exten");
-				if (!zstr(ext)) {
-					switch_channel_set_variable(caller_channel, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE, ext);
-				}
-				switch_channel_clear_flag(peer_channel, CF_LEG_HOLDING);
-			}
+			switch_channel_clear_flag_recursive(caller_channel, CF_BRIDGE_ORIGINATOR);
 
-			switch_channel_clear_flag_recursive(caller_channel, CF_BRIDGE_ORIGINATOR);
-			
 			switch_channel_stop_broadcast(peer_channel);
-			
 
+
 			while (switch_channel_get_state(peer_channel) == CS_EXCHANGE_MEDIA) {
 				switch_cond_next();
 			}
@@ -1117,7 +1193,7 @@
 					switch_channel_set_flag(peer_channel, CF_BRIDGED);
 				}
 			}
-			
+
 			if ((cause = switch_channel_get_cause(caller_channel))) {
 				switch_channel_set_variable(peer_channel, SWITCH_BRIDGE_HANGUP_CAUSE_VARIABLE, switch_channel_cause2str(cause));
 			}
@@ -1129,9 +1205,9 @@
 			if (switch_channel_down(peer_channel) && switch_true(switch_channel_get_variable(peer_channel, SWITCH_COPY_XML_CDR_VARIABLE))) {
 				switch_xml_t cdr;
 				char *xml_text;
-				
-				switch_channel_wait_for_state(caller_channel, peer_channel, CS_DESTROY);
 
+				switch_channel_wait_for_state(peer_channel, caller_channel, CS_DESTROY);
+
 				if (switch_ivr_generate_xml_cdr(peer_session, &cdr) == SWITCH_STATUS_SUCCESS) {
 					if ((xml_text = switch_xml_toxml(cdr, SWITCH_FALSE))) {
 						switch_channel_set_variable(caller_channel, "b_leg_cdr", xml_text);
@@ -1165,8 +1241,9 @@
 	}
 
 	state = switch_channel_get_state(caller_channel);
-	
-	if (!switch_channel_test_flag(caller_channel, CF_TRANSFER) && !switch_channel_test_flag(caller_channel, CF_REDIRECT) && 
+
+
+	if (!switch_channel_test_flag(caller_channel, CF_TRANSFER) && !switch_channel_test_flag(caller_channel, CF_REDIRECT) &&
 		!switch_channel_test_flag(caller_channel, CF_XFER_ZOMBIE) && !a_leg->clean_exit && !inner_bridge) {
 		if ((state != CS_EXECUTE && state != CS_SOFT_EXECUTE && state != CS_PARK && state != CS_ROUTING) ||
 			(switch_channel_test_flag(peer_channel, CF_ANSWERED) && state < CS_HANGUP)) {
@@ -1175,24 +1252,44 @@
 				switch_ivr_park_session(session);
 			} else if ((var = switch_channel_get_variable(caller_channel, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE))) {
 				transfer_after_bridge(session, var);
-			} else if (switch_true(switch_channel_get_variable(caller_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE))) {
-				switch_channel_hangup(caller_channel, switch_channel_get_cause(peer_channel));
+			} else if (switch_channel_test_flag(peer_channel, CF_ANSWERED) &&
+					   switch_true(switch_channel_get_variable(caller_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE))) {
+				switch_call_cause_t cause = switch_channel_get_cause(peer_channel);
+				if (cause == SWITCH_CAUSE_NONE) {
+					cause = SWITCH_CAUSE_NORMAL_CLEARING;
+				}
+				switch_channel_hangup(caller_channel, cause);
 			}
 		}
 	}
 
 	if (switch_channel_test_flag(caller_channel, CF_REDIRECT)) {
-		state = switch_channel_get_state(caller_channel);
-		if (!(state == CS_RESET || state == CS_PARK || state == CS_ROUTING)) {
-			switch_channel_set_state(caller_channel, CS_RESET);
+		if (switch_channel_test_flag(caller_channel, CF_RESET)) {
+			switch_channel_clear_flag(caller_channel, CF_RESET);
+		} else {
+			state = switch_channel_get_state(caller_channel);
+			if (!(state == CS_RESET || state == CS_PARK || state == CS_ROUTING)) {
+				switch_channel_set_state(caller_channel, CS_RESET);
+			}
 		}
 	}
-	
+
 	return status;
 }
 
-static void cleanup_proxy_mode(switch_core_session_t *session)
+static void cleanup_proxy_mode_b(switch_core_session_t *session)
 {
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+
+
+	if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
+		switch_ivr_media(switch_core_session_get_uuid(session), SMF_NONE);
+	}
+}
+
+
+static void cleanup_proxy_mode_a(switch_core_session_t *session)
+{
 	switch_core_session_t *sbsession;
 
 	switch_channel_t *channel = switch_core_session_get_channel(session);
@@ -1200,10 +1297,6 @@
 
 	if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
 		const char *sbv = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
-		
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Restore media to %s\n", switch_channel_get_name(channel));
-		switch_ivr_media(switch_core_session_get_uuid(session), SMF_IMMEDIATE);
-
 		if (!zstr(sbv) && (sbsession = switch_core_session_locate(sbv))) {
 			switch_channel_t *sbchannel = switch_core_session_get_channel(sbsession);
 			switch_channel_hangup(sbchannel, SWITCH_CAUSE_ATTENDED_TRANSFER);
@@ -1256,9 +1349,9 @@
 				}
 			}
 
-			cleanup_proxy_mode(originator_session);
-			cleanup_proxy_mode(originatee_session);
-			
+			cleanup_proxy_mode_a(originator_session);
+			cleanup_proxy_mode_a(originatee_session);
+
 			/* override transmit state for originator_channel to bridge to originatee_channel 
 			 * install pointer to originatee_session into originator_channel
 			 * set CF_TRANSFER on both channels and change state to CS_SOFT_EXECUTE to
@@ -1268,8 +1361,8 @@
 
 			switch_channel_set_flag(originator_channel, CF_REDIRECT);
 			switch_channel_set_flag(originatee_channel, CF_REDIRECT);
-			
 
+
 			switch_channel_set_variable(originator_channel, SWITCH_UUID_BRIDGE, switch_core_session_get_uuid(originatee_session));
 			switch_channel_set_variable(originator_channel, SWITCH_BRIDGE_CHANNEL_VARIABLE, switch_channel_get_name(originatee_channel));
 			switch_channel_set_variable(originator_channel, SWITCH_BRIDGE_UUID_VARIABLE, switch_core_session_get_uuid(originatee_session));
@@ -1278,7 +1371,7 @@
 			switch_channel_set_variable(originatee_channel, SWITCH_BRIDGE_UUID_VARIABLE, switch_core_session_get_uuid(originator_session));
 			switch_channel_set_variable(originatee_channel, SWITCH_SIGNAL_BOND_VARIABLE, switch_core_session_get_uuid(originator_session));
 
-			
+
 			originator_cp = switch_channel_get_caller_profile(originator_channel);
 			originatee_cp = switch_channel_get_caller_profile(originatee_channel);
 
@@ -1320,7 +1413,7 @@
 			switch_channel_set_state(originator_channel, state == CS_HIBERNATE ? CS_CONSUME_MEDIA : CS_HIBERNATE);
 			state = switch_channel_get_state(originatee_channel);
 			switch_channel_set_state(originatee_channel, state == CS_HIBERNATE ? CS_CONSUME_MEDIA : CS_HIBERNATE);
-			
+
 			status = SWITCH_STATUS_SUCCESS;
 
 			switch_ivr_bridge_display(originator_session, originatee_session);
@@ -1398,9 +1491,9 @@
 		switch_channel_answer(rchannel);
 	}
 
- 	switch_channel_set_state_flag(rchannel, CF_TRANSFER);
+	switch_channel_set_state_flag(rchannel, CF_TRANSFER);
 	switch_channel_set_state(rchannel, CS_PARK);
-	
+
 	if (bchannel) {
 		switch_channel_set_state_flag(bchannel, CF_TRANSFER);
 		switch_channel_set_state(bchannel, CS_PARK);
@@ -1414,8 +1507,8 @@
 		switch_core_session_rwunlock(bsession);
 	}
 
-	
 
+
 }
 
 /* For Emacs:

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_ivr_menu.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_ivr_menu.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_ivr_menu.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -69,7 +69,7 @@
 	struct switch_ivr_menu_action *next;
 };
 
-static switch_ivr_menu_t *switch_ivr_menu_find(switch_ivr_menu_t * stack, const char *name)
+static switch_ivr_menu_t *switch_ivr_menu_find(switch_ivr_menu_t *stack, const char *name)
 {
 	switch_ivr_menu_t *ret;
 	for (ret = stack; ret; ret = ret->next) {
@@ -79,7 +79,7 @@
 	return ret;
 }
 
-static void switch_ivr_menu_stack_add(switch_ivr_menu_t ** top, switch_ivr_menu_t * bottom)
+static void switch_ivr_menu_stack_add(switch_ivr_menu_t ** top, switch_ivr_menu_t *bottom)
 {
 	switch_ivr_menu_t *ptr;
 
@@ -94,7 +94,7 @@
 }
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_menu_init(switch_ivr_menu_t ** new_menu,
-													 switch_ivr_menu_t * main,
+													 switch_ivr_menu_t *main,
 													 const char *name,
 													 const char *greeting_sound,
 													 const char *short_greeting_sound,
@@ -106,10 +106,7 @@
 													 const char *tts_voice,
 													 int confirm_attempts,
 													 int inter_timeout,
-													 int digit_len,
-													 int timeout, int max_failures,
-													 int max_timeouts,
-													 switch_memory_pool_t *pool)
+													 int digit_len, int timeout, int max_failures, int max_timeouts, switch_memory_pool_t *pool)
 {
 	switch_ivr_menu_t *menu;
 	uint8_t newpool = 0;
@@ -209,13 +206,13 @@
 	}
 
 	menu->buf = switch_core_alloc(menu->pool, 1024);
-	
+
 	*new_menu = menu;
 
 	return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_action(switch_ivr_menu_t * menu, switch_ivr_action_t ivr_action, const char *arg, const char *bind)
+SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_action(switch_ivr_menu_t *menu, switch_ivr_action_t ivr_action, const char *arg, const char *bind)
 {
 	switch_ivr_menu_action_t *action;
 	uint32_t len;
@@ -240,8 +237,8 @@
 	return SWITCH_STATUS_MEMERR;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_function(switch_ivr_menu_t * menu,
-															  switch_ivr_menu_action_function_t * function, const char *arg, const char *bind)
+SWITCH_DECLARE(switch_status_t) switch_ivr_menu_bind_function(switch_ivr_menu_t *menu,
+															  switch_ivr_menu_action_function_t *function, const char *arg, const char *bind)
 {
 	switch_ivr_menu_action_t *action;
 	uint32_t len;
@@ -283,7 +280,7 @@
 	return status;
 }
 
-static switch_status_t play_and_collect(switch_core_session_t *session, switch_ivr_menu_t * menu, char *sound, switch_size_t need)
+static switch_status_t play_and_collect(switch_core_session_t *session, switch_ivr_menu_t *menu, char *sound, switch_size_t need)
 {
 	char terminator;
 	uint32_t len;
@@ -316,7 +313,7 @@
 	args.buflen = len;
 
 	status = switch_ivr_play_file(session, NULL, sound_expanded, &args);
-	
+
 	if (sound_expanded != sound) {
 		switch_safe_free(sound_expanded);
 	}
@@ -329,9 +326,9 @@
 
 	menu->ptr += menu_buf_len;
 	if (menu_buf_len < need) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "waiting for %u/%u digits t/o %d\n", 
-						  (uint32_t)(menu->inlen - strlen(menu->buf)), (uint32_t)need, menu->inter_timeout);
-		status = switch_ivr_collect_digits_count(session, menu->ptr, menu->inlen - strlen(menu->buf), 
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "waiting for %u/%u digits t/o %d\n",
+						  (uint32_t) (menu->inlen - strlen(menu->buf)), (uint32_t) need, menu->inter_timeout);
+		status = switch_ivr_collect_digits_count(session, menu->ptr, menu->inlen - strlen(menu->buf),
 												 need, "#", &terminator, menu_buf_len ? menu->inter_timeout : menu->timeout,
 												 menu->inter_timeout, menu->timeout);
 	}
@@ -359,7 +356,7 @@
 
 			if (menu->confirm_key && *buf != '\0') {
 				if (*menu->confirm_key == *buf) {
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
 									  "approving digits '%s' via confirm key %s\n", menu->buf, menu->confirm_key);
 					break;
 				} else {
@@ -370,7 +367,8 @@
 			att--;
 		}
 		if (!att) {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rejecting digits '%s' via confirm key %s\n", menu->buf, menu->confirm_key);
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "rejecting digits '%s' via confirm key %s\n", menu->buf,
+							  menu->confirm_key);
 			*menu->buf = '\0';
 		}
 	}
@@ -390,7 +388,7 @@
 	switch_ivr_menu_t *menu;
 	switch_channel_t *channel;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	
+
 	if (++stack->stack_count > 12) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Too many levels of recursion.\n");
 		switch_goto_status(SWITCH_STATUS_FALSE, end);
@@ -460,7 +458,7 @@
 					switch_channel_set_variable(channel, "tts_engine", menu->tts_engine);
 					switch_channel_set_variable(channel, "tts_voice", menu->tts_voice);
 				}
-				
+
 				if (ap->re) {
 					switch_regex_t *re = NULL;
 					int ovector[30];
@@ -548,7 +546,7 @@
 				}
 			}
 
-			if (switch_test_flag(menu, SWITCH_IVR_MENU_FLAG_STACK)) {	        /* top level */
+			if (switch_test_flag(menu, SWITCH_IVR_MENU_FLAG_STACK)) {	/* top level */
 				if (switch_test_flag(stack, SWITCH_IVR_MENU_FLAG_FALLTOMAIN)) {	/* catch the fallback and recover */
 					switch_clear_flag(stack, SWITCH_IVR_MENU_FLAG_FALLTOMAIN);
 					status = SWITCH_STATUS_SUCCESS;
@@ -559,7 +557,8 @@
 		}
 		if (!match) {
 			if (*menu->buf) {
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "IVR menu '%s' caught invalid input '%s'\n", menu->name, menu->buf);
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "IVR menu '%s' caught invalid input '%s'\n", menu->name,
+								  menu->buf);
 				if (menu->invalid_sound) {
 					play_and_collect(session, menu, menu->invalid_sound, 0);
 				}
@@ -584,8 +583,8 @@
 		}
 	}
 
- end:
-	
+  end:
+
 	stack->stack_count--;
 
 	return status;
@@ -606,7 +605,7 @@
 	int autocreated;
 };
 
-static switch_ivr_menu_xml_map_t *switch_ivr_menu_stack_xml_find(switch_ivr_menu_xml_ctx_t * xml_ctx, const char *name)
+static switch_ivr_menu_xml_map_t *switch_ivr_menu_stack_xml_find(switch_ivr_menu_xml_ctx_t *xml_ctx, const char *name)
 {
 	switch_ivr_menu_xml_map_t *map = (xml_ctx != NULL ? xml_ctx->map : NULL);
 	int rc = -1;
@@ -618,8 +617,8 @@
 	return (rc == 0 ? map : NULL);
 }
 
-static switch_status_t switch_ivr_menu_stack_xml_add(switch_ivr_menu_xml_ctx_t * xml_ctx, const char *name, int action,
-													 switch_ivr_menu_action_function_t * function)
+static switch_status_t switch_ivr_menu_stack_xml_add(switch_ivr_menu_xml_ctx_t *xml_ctx, const char *name, int action,
+													 switch_ivr_menu_action_function_t *function)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
@@ -656,13 +655,14 @@
 	const char *name;
 	switch_ivr_action_t action;
 } iam[] = {
-	{ "menu-exit", SWITCH_IVR_ACTION_DIE }, 
-	{ "menu-sub", SWITCH_IVR_ACTION_EXECMENU},
-	{ "menu-exec-app", SWITCH_IVR_ACTION_EXECAPP}, 
-	{ "menu-play-sound", SWITCH_IVR_ACTION_PLAYSOUND}, 
-	{ "menu-back", SWITCH_IVR_ACTION_BACK}, 
-	{ "menu-top", SWITCH_IVR_ACTION_TOMAIN}, 
-	{ NULL, 0}
+	{
+	"menu-exit", SWITCH_IVR_ACTION_DIE}, {
+	"menu-sub", SWITCH_IVR_ACTION_EXECMENU}, {
+	"menu-exec-app", SWITCH_IVR_ACTION_EXECAPP}, {
+	"menu-play-sound", SWITCH_IVR_ACTION_PLAYSOUND}, {
+	"menu-back", SWITCH_IVR_ACTION_BACK}, {
+	"menu-top", SWITCH_IVR_ACTION_TOMAIN}, {
+	NULL, 0}
 };
 
 SWITCH_DECLARE(switch_status_t) switch_ivr_menu_str2action(const char *action_name, switch_ivr_action_t *action)
@@ -670,7 +670,7 @@
 	int i;
 
 	if (!zstr(action_name)) {
-		for(i = 0;;i++) {
+		for (i = 0;; i++) {
 			if (!iam[i].name) {
 				break;
 			}
@@ -690,7 +690,7 @@
 	int i;
 
 	if (!zstr(action)) {
-		for(i = 0;;i++) {
+		for (i = 0;; i++) {
 			if (!iam[i].name) {
 				break;
 			}
@@ -740,30 +740,30 @@
 	return status;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_add_custom(switch_ivr_menu_xml_ctx_t * xml_menu_ctx,
-																	 const char *name, switch_ivr_menu_action_function_t * function)
+SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_add_custom(switch_ivr_menu_xml_ctx_t *xml_menu_ctx,
+																	 const char *name, switch_ivr_menu_action_function_t *function)
 {
 	return switch_ivr_menu_stack_xml_add(xml_menu_ctx, name, -1, function);
 }
 
-SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_xml_ctx_t * xml_menu_ctx,
+SWITCH_DECLARE(switch_status_t) switch_ivr_menu_stack_xml_build(switch_ivr_menu_xml_ctx_t *xml_menu_ctx,
 																switch_ivr_menu_t ** menu_stack, switch_xml_t xml_menus, switch_xml_t xml_menu)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
 	if (xml_menu_ctx != NULL && menu_stack != NULL && xml_menu != NULL) {
-		const char *menu_name = switch_xml_attr_soft(xml_menu, "name");	            /* if the attr doesn't exist, return "" */
-		const char *greet_long = switch_xml_attr(xml_menu, "greet-long");	        /* if the attr doesn't exist, return NULL */
-		const char *greet_short = switch_xml_attr(xml_menu, "greet-short");	        /* if the attr doesn't exist, return NULL */
-		const char *invalid_sound = switch_xml_attr(xml_menu, "invalid-sound");	    /* if the attr doesn't exist, return NULL */
-		const char *exit_sound = switch_xml_attr(xml_menu, "exit-sound");	        /* if the attr doesn't exist, return NULL */
-		const char *timeout = switch_xml_attr_soft(xml_menu, "timeout");	        /* if the attr doesn't exist, return "" */
+		const char *menu_name = switch_xml_attr_soft(xml_menu, "name");	/* if the attr doesn't exist, return "" */
+		const char *greet_long = switch_xml_attr(xml_menu, "greet-long");	/* if the attr doesn't exist, return NULL */
+		const char *greet_short = switch_xml_attr(xml_menu, "greet-short");	/* if the attr doesn't exist, return NULL */
+		const char *invalid_sound = switch_xml_attr(xml_menu, "invalid-sound");	/* if the attr doesn't exist, return NULL */
+		const char *exit_sound = switch_xml_attr(xml_menu, "exit-sound");	/* if the attr doesn't exist, return NULL */
+		const char *timeout = switch_xml_attr_soft(xml_menu, "timeout");	/* if the attr doesn't exist, return "" */
 		const char *max_failures = switch_xml_attr_soft(xml_menu, "max-failures");	/* if the attr doesn't exist, return "" */
 		const char *max_timeouts = switch_xml_attr_soft(xml_menu, "max-timeouts");
-		const char *confirm_macro= switch_xml_attr(xml_menu, "confirm-macro");
-		const char *confirm_key= switch_xml_attr(xml_menu, "confirm-key");
-		const char *tts_engine= switch_xml_attr(xml_menu, "tts-engine");
-		const char *tts_voice= switch_xml_attr(xml_menu, "tts-voice");
+		const char *confirm_macro = switch_xml_attr(xml_menu, "confirm-macro");
+		const char *confirm_key = switch_xml_attr(xml_menu, "confirm-key");
+		const char *tts_engine = switch_xml_attr(xml_menu, "tts-engine");
+		const char *tts_voice = switch_xml_attr(xml_menu, "tts-voice");
 		const char *confirm_attempts = switch_xml_attr_soft(xml_menu, "confirm-attempts");
 		const char *digit_len = switch_xml_attr_soft(xml_menu, "digit-len");
 		const char *inter_timeout = switch_xml_attr_soft(xml_menu, "inter-digit-timeout");
@@ -782,7 +782,7 @@
 									  greet_long,
 									  greet_short,
 									  invalid_sound,
-									  exit_sound, 
+									  exit_sound,
 									  confirm_macro,
 									  confirm_key,
 									  tts_engine,
@@ -790,14 +790,12 @@
 									  atoi(confirm_attempts),
 									  atoi(inter_timeout),
 									  atoi(digit_len),
-									  atoi(timeout), 
-									  strlen(max_failures)? atoi(max_failures): 0, 
-									  strlen(max_timeouts)? atoi(max_timeouts): 0, 
-									  xml_menu_ctx->pool);									
+									  atoi(timeout),
+									  strlen(max_failures) ? atoi(max_failures) : 0, strlen(max_timeouts) ? atoi(max_timeouts) : 0, xml_menu_ctx->pool);
 		/* set the menu_stack for the caller */
 		if (status == SWITCH_STATUS_SUCCESS && *menu_stack == NULL) {
 			*menu_stack = menu;
-			
+
 			if (xml_menu_ctx->autocreated) {
 				switch_set_flag(menu, SWITCH_IVR_MENU_FLAG_FREEPOOL);
 			}

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_ivr_originate.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_ivr_originate.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_ivr_originate.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -87,6 +87,7 @@
 	uint8_t ring_ready;
 	uint8_t early_media;
 	uint8_t answered;
+	uint8_t tagged;
 	uint32_t per_channel_timelimit_sec;
 	uint32_t per_channel_progress_timelimit_sec;
 	uint32_t per_channel_delay_start;
@@ -116,6 +117,8 @@
 	int continue_on_timeout;
 	int ringback_ok;
 	int sending_ringback;
+	int bridge_early_media;
+	switch_thread_t *ethread;
 } originate_global_t;
 
 
@@ -139,6 +142,7 @@
 	switch_channel_t *channel = switch_core_session_get_channel(collect->session);
 	char buf[10] = SWITCH_BLANK_STRING;
 	char *p, term;
+	switch_application_interface_t *application_interface = NULL;
 
 	if (collect->session) {
 		if (switch_core_session_read_lock(collect->session) != SWITCH_STATUS_SUCCESS) {
@@ -147,12 +151,11 @@
 	} else {
 		return NULL;
 	}
-	
+
 	switch_ivr_sleep(collect->session, 0, SWITCH_TRUE, NULL);
-	
+
 	if (!strcasecmp(collect->key, "exec")) {
 		char *data;
-		switch_application_interface_t *application_interface;
 		char *app_name, *app_data;
 
 		if (!(data = collect->file)) {
@@ -168,7 +171,6 @@
 		if ((application_interface = switch_loadable_module_get_application_interface(app_name)) == 0) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(collect->session), SWITCH_LOG_ERROR, "Invalid Application %s\n", app_name);
 			switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
-			UNPROTECT_INTERFACE(application_interface);
 			goto wbreak;
 		}
 
@@ -195,10 +197,16 @@
 		memset(buf, 0, sizeof(buf));
 
 		if (collect->file) {
+			switch_status_t status;
 			switch_input_args_t args = { 0 };
 			args.buf = buf;
 			args.buflen = sizeof(buf);
-			switch_ivr_play_file(collect->session, NULL, collect->file, &args);
+			status = switch_ivr_play_file(collect->session, NULL, collect->file, &args);
+			if (!SWITCH_READ_ACCEPTABLE(status)) {
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(collect->session), SWITCH_LOG_ERROR, "%s Error Playing File!",
+								  switch_channel_get_name(channel));
+				switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
+			}
 		} else {
 			switch_ivr_collect_digits_count(collect->session, buf, sizeof(buf), 1, SWITCH_BLANK_STRING, &term, 0, 0, 0);
 		}
@@ -210,10 +218,10 @@
 			}
 		}
 	}
- wbreak:
+  wbreak:
 
 	switch_core_session_rwunlock(collect->session);
-
+	UNPROTECT_INTERFACE(application_interface);
 	return NULL;
 }
 
@@ -229,12 +237,10 @@
 }
 
 static int check_per_channel_timeouts(originate_global_t *oglobals,
-									  originate_status_t *originate_status, 
-									  int max,
-									  time_t start)
+									  originate_status_t *originate_status, int max, time_t start, switch_call_cause_t *force_reason)
 {
-	int x = 0,i,delayed_channels=0,active_channels=0;
-	uint32_t early_exit_time=0, delayed_min=0;
+	int x = 0, i, delayed_channels = 0, active_channels = 0;
+	uint32_t early_exit_time = 0, delayed_min = 0;
 
 	time_t elapsed = switch_epoch_time_now(NULL) - start;
 
@@ -242,7 +248,7 @@
 		return 0;
 	}
 	for (i = 0; i < max; i++) {
-		if (originate_status[i].peer_channel && switch_channel_get_state(originate_status[i].peer_channel) != CS_DESTROY && 
+		if (originate_status[i].peer_channel && switch_channel_get_state(originate_status[i].peer_channel) != CS_DESTROY &&
 			switch_channel_get_state(originate_status[i].peer_channel) != CS_REPORTING) {
 			if (originate_status[i].per_channel_delay_start) {
 				delayed_channels++;
@@ -254,16 +260,16 @@
 
 	if (active_channels == 0 && delayed_channels) {
 		for (i = 0; i < max; i++) {
-			if ( originate_status[i].peer_channel && originate_status[i].per_channel_delay_start && 
-				 (! delayed_min || delayed_min > originate_status[i].per_channel_delay_start) ) {
+			if (originate_status[i].peer_channel && originate_status[i].per_channel_delay_start &&
+				(!delayed_min || delayed_min > originate_status[i].per_channel_delay_start)) {
 				delayed_min = originate_status[i].per_channel_delay_start;
 			}
 		}
 		early_exit_time = delayed_min - (uint32_t) elapsed;
 	}
 	for (i = 0; i < max; i++) {
-		if (originate_status[i].peer_channel && originate_status[i].per_channel_delay_start && 
-			(elapsed > originate_status[i].per_channel_delay_start || active_channels == 0) ) {
+		if (originate_status[i].peer_channel && originate_status[i].per_channel_delay_start &&
+			(elapsed > originate_status[i].per_channel_delay_start || active_channels == 0)) {
 			if (active_channels == 0) {
 				if (originate_status[i].per_channel_timelimit_sec) {
 					if (originate_status[i].per_channel_timelimit_sec > early_exit_time) {
@@ -286,20 +292,20 @@
 				originate_status[i].per_channel_delay_start = 0;
 			}
 
-			if (! originate_status[i].per_channel_delay_start) {
+			if (!originate_status[i].per_channel_delay_start) {
 				switch_channel_clear_flag(originate_status[i].peer_channel, CF_BLOCK_STATE);
 			}
 		}
 
 		if (originate_status[i].peer_channel && switch_channel_up(originate_status[i].peer_channel)) {
 			if (originate_status[i].per_channel_progress_timelimit_sec && elapsed > originate_status[i].per_channel_progress_timelimit_sec &&
-				!(
-				  switch_channel_test_flag(originate_status[i].peer_channel, CF_RING_READY) ||
+				!(switch_channel_test_flag(originate_status[i].peer_channel, CF_RING_READY) ||
 				  switch_channel_test_flag(originate_status[i].peer_channel, CF_ANSWERED) ||
 				  (!oglobals->monitor_early_media_ring && switch_channel_test_flag(originate_status[i].peer_channel, CF_EARLY_MEDIA))
-				  )
+				)
 				) {
 				switch_channel_hangup(originate_status[i].peer_channel, SWITCH_CAUSE_PROGRESS_TIMEOUT);
+				*force_reason = SWITCH_CAUSE_PROGRESS_TIMEOUT;
 				x++;
 			}
 			if (originate_status[i].per_channel_timelimit_sec && elapsed > originate_status[i].per_channel_timelimit_sec) {
@@ -330,24 +336,24 @@
 				bd = "monitor_early_media_ring";
 			}
 			switch_channel_set_variable(channel, "originate_disposition", bd);
-			
+
 			if (oglobals) {
 				if (oglobals->monitor_early_media_ring_total && ++oglobals->monitor_early_media_ring_count < oglobals->monitor_early_media_ring_total) {
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Ring %d/%d\n", 
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Ring %d/%d\n",
 									  oglobals->monitor_early_media_ring_count, oglobals->monitor_early_media_ring_total);
 					return SWITCH_TRUE;
 				}
-	
+
 				switch_channel_set_private(channel, "_oglobals_", NULL);
-				
+
 				if (!oglobals->progress) {
 					oglobals->progress = 1;
 				}
-			
+
 				if (!oglobals->ring_ready && !oglobals->ignore_ring_ready) {
 					oglobals->ring_ready = 1;
 				}
-				
+
 				if (!oglobals->ignore_early_media && !oglobals->early_ok) {
 					oglobals->early_ok = 1;
 				}
@@ -378,10 +384,28 @@
 			caller_channel = NULL;
 		}
 	}
-	
 
+
 	for (i = 0; i < len; i++) {
 		switch_channel_state_t state;
+
+		if (originate_status[i].tagged && originate_status[i].peer_session) {
+			switch_channel_t *channel = switch_core_session_get_channel(originate_status[i].peer_session);
+			uint32_t j;
+
+			if (switch_channel_down(channel)) {
+				switch_call_cause_t cause = switch_channel_get_cause(channel);
+
+				for (j = 0; j < len; j++) {
+					channel = switch_core_session_get_channel(originate_status[j].peer_session);
+					switch_channel_hangup(channel, cause);
+				}
+				oglobals->hups = len;
+				rval = 0;
+				goto end;
+			}
+		}
+
 		if (!(originate_status[i].peer_channel && originate_status[i].peer_session)) {
 			oglobals->hups++;
 			continue;
@@ -411,6 +435,11 @@
 
 		if (switch_channel_test_flag(originate_status[i].peer_channel, CF_EARLY_MEDIA)) {
 
+			if (oglobals->ignore_early_media == 3 && oglobals->bridge_early_media == -1) {
+				oglobals->bridge_early_media = i;
+				oglobals->ringback_ok = 1;
+			}
+
 			if (oglobals->sending_ringback == 1) {
 				send_ringback++;
 				pindex = (uint32_t) i;
@@ -425,11 +454,11 @@
 				if (oglobals->early_ok) {
 					pindex = i;
 				}
-				
+
 				if (oglobals->monitor_early_media_fail) {
 					const char *var = switch_channel_get_variable(originate_status[i].peer_channel, "monitor_early_media_fail");
 					if (!zstr(var)) {
-						char *fail_array[128] = {0};
+						char *fail_array[128] = { 0 };
 						int fail_count = 0;
 						char *fail_data = strdup(var);
 						int fx;
@@ -437,66 +466,61 @@
 
 						switch_assert(fail_data);
 						fail_count = switch_separate_string(fail_data, '!', fail_array, (sizeof(fail_array) / sizeof(fail_array[0])));
-					
-						for(fx = 0; fx < fail_count; fx++) {
+
+						for (fx = 0; fx < fail_count; fx++) {
 							char *cause = fail_array[fx];
 							int hits = 2;
 							char *p, *q;
-						
+
 							if (!(p = strchr(cause, ':'))) {
 								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(originate_status[i].peer_session), SWITCH_LOG_ERROR, "Parse Error\n");
 								continue;
 							}
 							*p++ = '\0';
-						
 
+
 							if (!p) {
 								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(originate_status[i].peer_session), SWITCH_LOG_ERROR, "Parse Error\n");
 								continue;
 							}
-						
 
+
 							if (!(hits = atoi(p))) {
 								hits = 2;
 							}
-						
 
+
 							if (!(p = strchr(p, ':'))) {
 								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(originate_status[i].peer_session), SWITCH_LOG_ERROR, "Parse Error\n");
 								continue;
 							}
 							*p++ = '\0';
-						
+
 							if (!p) {
 								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(originate_status[i].peer_session), SWITCH_LOG_ERROR, "Parse Error\n");
 								continue;
 							}
 
-							for(q = p; q && *q; q++) {
+							for (q = p; q && *q; q++) {
 								if (*q == '+') {
 									*q = ',';
 								}
 							}
 							switch_snprintf(bug_key, sizeof(bug_key), "monitor_early_media_fail_%d", ++y);
-							switch_ivr_tone_detect_session(originate_status[i].peer_session,
-														   bug_key,
-														   p, "r", 0, 
-														   hits, 
-														   "fail", 
-														   cause, monitor_callback);
-						
+							switch_ivr_tone_detect_session(originate_status[i].peer_session, bug_key, p, "r", 0, hits, "fail", cause, monitor_callback);
+
 						}
-					
+
 						switch_safe_free(fail_data);
-					
+
 					}
 				}
-				
+
 				if (oglobals->monitor_early_media_ring) {
 					const char *var = switch_channel_get_variable(originate_status[i].peer_channel, "monitor_early_media_ring");
 					const char *var_total = switch_channel_get_variable(originate_status[i].peer_channel, "monitor_early_media_ring_total");
 					if (!zstr(var)) {
-						char *ring_array[128] = {0};
+						char *ring_array[128] = { 0 };
 						int ring_count = 0;
 						char *ring_data = strdup(var);
 						int fx;
@@ -504,11 +528,11 @@
 
 						switch_assert(ring_data);
 						ring_count = switch_separate_string(ring_data, '!', ring_array, (sizeof(ring_array) / sizeof(ring_array[0])));
-					
-						for(fx = 0; fx < ring_count; fx++) {
+
+						for (fx = 0; fx < ring_count; fx++) {
 							int hits = 2;
 							char *p = ring_array[fx], *q;
-						
+
 							if (!p) {
 								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(originate_status[i].peer_session), SWITCH_LOG_ERROR, "Parse Error\n");
 								continue;
@@ -517,78 +541,75 @@
 							if (!(hits = atoi(p))) {
 								hits = 2;
 							}
-						
+
 							if (!(p = strchr(p, ':'))) {
 								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(originate_status[i].peer_session), SWITCH_LOG_ERROR, "Parse Error\n");
 								continue;
 							}
 							*p++ = '\0';
-						
+
 							if (!p) {
 								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(originate_status[i].peer_session), SWITCH_LOG_ERROR, "Parse Error\n");
 								continue;
 							}
 
-							for(q = p; q && *q; q++) {
+							for (q = p; q && *q; q++) {
 								if (*q == '+') {
 									*q = ',';
 								}
 							}
-						
+
 							switch_channel_set_private(originate_status[i].peer_channel, "_oglobals_", oglobals);
 							switch_snprintf(bug_key, sizeof(bug_key), "monitor_early_media_ring_%d", ++y);
-							switch_ivr_tone_detect_session(originate_status[i].peer_session,
-														   bug_key,
-														   p, "r", 0, hits, "ring", NULL, monitor_callback);
-							
+							switch_ivr_tone_detect_session(originate_status[i].peer_session, bug_key, p, "r", 0, hits, "ring", NULL, monitor_callback);
+
 						}
-					
+
 						if (var_total) {
 							int tmp = atoi(var_total);
 							if (tmp > 0 && tmp < 100) {
-								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(originate_status[i].peer_session), SWITCH_LOG_DEBUG, 
-												  "%s setting ring total to %d\n", 
-												  switch_channel_get_name(originate_status[i].peer_channel), tmp);
+								switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(originate_status[i].peer_session), SWITCH_LOG_DEBUG,
+												  "%s setting ring total to %d\n", switch_channel_get_name(originate_status[i].peer_channel), tmp);
 								oglobals->monitor_early_media_ring_total = tmp;
 							}
 						}
-						
+
 						switch_safe_free(ring_data);
-					
+
 					}
 				}
 			}
-			
+
 			if (!oglobals->monitor_early_media_ring) {
 
 				if (!oglobals->progress) {
 					oglobals->progress = 1;
 				}
-				
+
 				if (!oglobals->ring_ready && !oglobals->ignore_ring_ready) {
 					oglobals->ring_ready = 1;
-					
+
 				}
 			}
 		}
-		
+
 		switch_ivr_parse_all_events(originate_status[i].peer_session);
 
 		state = switch_channel_get_state(originate_status[i].peer_channel);
 		if (state >= CS_HANGUP || state == CS_RESET || switch_channel_test_flag(originate_status[i].peer_channel, CF_TRANSFER) ||
 			switch_channel_test_flag(originate_status[i].peer_channel, CF_REDIRECT) ||
-			switch_channel_test_flag(originate_status[i].peer_channel, CF_BRIDGED) || 
+			switch_channel_test_flag(originate_status[i].peer_channel, CF_BRIDGED) ||
 			!switch_channel_test_flag(originate_status[i].peer_channel, CF_ORIGINATING)
 			) {
 			(oglobals->hups)++;
 		} else if ((switch_channel_test_flag(originate_status[i].peer_channel, CF_ANSWERED) ||
 					(oglobals->early_ok && switch_channel_test_flag(originate_status[i].peer_channel, CF_EARLY_MEDIA)) ||
-					(oglobals->ring_ready && oglobals->return_ring_ready && len == 1 && 
+					(oglobals->ring_ready && oglobals->return_ring_ready && len == 1 &&
 					 switch_channel_test_flag(originate_status[i].peer_channel, CF_RING_READY))
-					)
+				   )
 				   && !switch_channel_test_flag(originate_status[i].peer_channel, CF_TAGGED)
-				   ) {
-			
+			) {
+
 			if (!zstr(oglobals->key)) {
 				struct key_collect *collect;
 
@@ -629,7 +650,7 @@
 		rval = 1;
 	}
 
- end:
+  end:
 
 	if (pindex > -1 && caller_channel && switch_channel_ready(caller_channel) && !switch_channel_media_ready(caller_channel)) {
 		const char *var = switch_channel_get_variable(caller_channel, "inherit_codec");
@@ -637,15 +658,15 @@
 			switch_codec_implementation_t impl = { 0 };
 			char tmp[128] = "";
 
-			
+
 			if (switch_core_session_get_read_impl(originate_status[pindex].peer_session, &impl) == SWITCH_STATUS_SUCCESS) {
 				switch_snprintf(tmp, sizeof(tmp), "%s@%uh@%ui", impl.iananame, impl.samples_per_second, impl.microseconds_per_packet / 1000);
 				switch_channel_set_variable(caller_channel, "absolute_codec_string", tmp);
-				switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_DEBUG, "Setting codec string on %s to %s\n", 
+				switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_DEBUG, "Setting codec string on %s to %s\n",
 								  switch_channel_get_name(caller_channel), tmp);
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(originate_status[pindex].peer_channel), SWITCH_LOG_WARNING, 
-								  "Error inheriting codec.  Channel %s has no read codec yet.\n", 
+				switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(originate_status[pindex].peer_channel), SWITCH_LOG_WARNING,
+								  "Error inheriting codec.  Channel %s has no read codec yet.\n",
 								  switch_channel_get_name(originate_status[pindex].peer_channel));
 			}
 
@@ -653,7 +674,7 @@
 	}
 
 	if (send_ringback) {
-		oglobals->sending_ringback++;	
+		oglobals->sending_ringback++;
 	}
 
 	return rval;
@@ -705,7 +726,7 @@
 	switch_channel_state_t wait_state = 0;
 
 	switch_assert(peer_channel);
-	
+
 	if (switch_channel_get_state(peer_channel) == CS_RESET) {
 		switch_channel_set_state(peer_channel, CS_SOFT_EXECUTE);
 	}
@@ -737,7 +758,7 @@
 		if (switch_channel_test_flag(caller_channel, CF_ANSWERED)) {
 			ringback_data = switch_channel_get_variable(caller_channel, "transfer_ringback");
 		}
-		
+
 		if (!ringback_data) {
 			ringback_data = switch_channel_get_variable(caller_channel, "ringback");
 		}
@@ -764,7 +785,7 @@
 		}
 
 
-		
+
 		if (!ringback.asis) {
 			if ((pass = (uint8_t) switch_test_flag(read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH))) {
 				goto no_ringback;
@@ -787,7 +808,7 @@
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
 								  "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
 								  read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_packet / 1000);
-				
+
 				write_frame.codec = &write_codec;
 				write_frame.datalen = read_codec->implementation->decoded_bytes_per_packet;
 				write_frame.samples = write_frame.datalen / 2;
@@ -795,7 +816,7 @@
 				switch_core_session_set_read_codec(session, &write_codec);
 			}
 		}
-		
+
 		if (switch_channel_test_flag(caller_channel, CF_DISABLE_RINGBACK)) {
 			ringback_data = NULL;
 		}
@@ -842,7 +863,7 @@
 				} else {
 					switch_buffer_create_dynamic(&ringback.audio_buffer, 512, 1024, 0);
 					switch_buffer_set_loops(ringback.audio_buffer, -1);
-							
+
 					teletone_init_session(&ringback.ts, 0, teletone_handler, &ringback);
 					ringback.ts.rate = read_codec->implementation->actual_samples_per_second;
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Play Ringback Tone [%s]\n", ringback_data);
@@ -858,7 +879,7 @@
 		}
 	}
 
- no_ringback:
+  no_ringback:
 
 	if (caller_channel) {
 		wait_state = switch_channel_get_state(caller_channel);
@@ -896,13 +917,13 @@
 		} else {
 			read_frame = NULL;
 		}
-		
+
 		if (read_frame && !pass) {
 
 			if (ringback.fh) {
 				switch_size_t mlen, olen;
 				unsigned int pos = 0;
-				
+
 				if (ringback.asis) {
 					mlen = write_frame.codec->implementation->encoded_bytes_per_packet;
 				} else {
@@ -946,7 +967,7 @@
 		}
 	}
 
- done:
+  done:
 
 	if (ringback.fh) {
 		switch_core_file_close(ringback.fh);
@@ -964,7 +985,7 @@
 
 	switch_safe_free(write_frame.data);
 
- end:
+  end:
 
 	if (!switch_channel_media_ready(peer_channel)) {
 		if (switch_channel_up(peer_channel)) {
@@ -972,7 +993,7 @@
 		}
 		status = SWITCH_STATUS_FALSE;
 	}
-	
+
 	if (caller_channel && !switch_channel_ready(caller_channel)) {
 		status = SWITCH_STATUS_FALSE;
 	}
@@ -987,14 +1008,14 @@
 
 	switch_assert(session && peer_channel);
 	caller_channel = switch_core_session_get_channel(session);
-	
+
 	if ((import = switch_channel_get_variable(caller_channel, varname))) {
 		char *mydata = switch_core_session_strdup(session, import);
 		int i, argc;
 		char *argv[64] = { 0 };
 
 		if ((argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
-			for(i = 0; i < argc; i++) {
+			for (i = 0; i < argc; i++) {
 				if ((val = switch_channel_get_variable(peer_channel, argv[i]))) {
 					switch_channel_set_variable(caller_channel, argv[i], val);
 				}
@@ -1004,40 +1025,33 @@
 }
 
 
-static switch_status_t setup_ringback(originate_global_t *oglobals, 
-									  const char *ringback_data, 
-									  ringback_t *ringback, 
-									  switch_frame_t *write_frame, 
-									  switch_codec_t *write_codec)
+static switch_status_t setup_ringback(originate_global_t *oglobals,
+									  const char *ringback_data, ringback_t *ringback, switch_frame_t *write_frame, switch_codec_t *write_codec)
 {
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
 	switch_channel_t *caller_channel = switch_core_session_get_channel(oglobals->session);
 	switch_codec_t *read_codec = NULL;
 	char *tmp_data = NULL;
 
-	if (!ringback_data) {
-		switch_goto_status(SWITCH_STATUS_GENERR, end);
-	}
-
 	if (!switch_channel_test_flag(caller_channel, CF_ANSWERED)
 		&& !switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)) {
 		if ((status = switch_channel_pre_answer(caller_channel)) != SWITCH_STATUS_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_DEBUG, "%s Media Establishment Failed.\n", 
+			switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_DEBUG, "%s Media Establishment Failed.\n",
 							  switch_channel_get_name(caller_channel));
 			switch_goto_status(SWITCH_STATUS_BREAK, end);
 		}
 	}
 
 	if (oglobals->session && (read_codec = switch_core_session_get_read_codec(oglobals->session))) {
-		if (switch_is_file_path(ringback_data)) {
+		if (ringback_data && switch_is_file_path(ringback_data)) {
 			if (!(strrchr(ringback_data, '.') || strstr(ringback_data, SWITCH_URL_SEPARATOR))) {
 				ringback->asis++;
 			}
 		}
-				
+
 		if (!ringback->asis) {
 			if (switch_test_flag(read_codec, SWITCH_CODEC_FLAG_PASSTHROUGH)) {
-				switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_WARNING, "%s Ringback not supported in passthrough codec mode.\n", 
+				switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(caller_channel), SWITCH_LOG_WARNING, "%s Ringback not supported in passthrough codec mode.\n",
 								  switch_channel_get_name(caller_channel));
 				switch_goto_status(SWITCH_STATUS_GENERR, end);
 			}
@@ -1053,8 +1067,7 @@
 
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(oglobals->session), SWITCH_LOG_DEBUG,
 								  "Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
-								  read_codec->implementation->actual_samples_per_second,
-								  read_codec->implementation->microseconds_per_packet / 1000);
+								  read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_packet / 1000);
 				write_frame->codec = write_codec;
 				write_frame->datalen = read_codec->implementation->decoded_bytes_per_packet;
 				write_frame->samples = write_frame->datalen / 2;
@@ -1066,10 +1079,14 @@
 				read_codec = NULL;
 				switch_goto_status(SWITCH_STATUS_BREAK, end);
 			}
-		}	
+		}
 
 		oglobals->gen_ringback = 1;
 
+		if (zstr(ringback_data)) {
+			switch_goto_status(SWITCH_STATUS_SUCCESS, end);
+		}
+
 		if (switch_is_file_path(ringback_data)) {
 			char *ext;
 
@@ -1081,7 +1098,7 @@
 			}
 
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(oglobals->session), SWITCH_LOG_DEBUG, "Play Ringback File [%s]\n", ringback_data);
-			
+
 			ringback->fhb.channels = read_codec->implementation->number_of_channels;
 			ringback->fhb.samplerate = read_codec->implementation->actual_samples_per_second;
 			if (switch_core_file_open(&ringback->fhb,
@@ -1116,7 +1133,7 @@
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Play Ringback Tone [%s]\n", ringback_data);
 			/* ringback->ts.debug = 1;
 			   ringback->ts.debug_stream = switch_core_get_console(); */
-			
+
 			if (teletone_run(&ringback->ts, ringback_data)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Playing Tone\n");
 				teletone_destroy_session(&ringback->ts);
@@ -1125,13 +1142,13 @@
 			}
 		}
 	}
-			
- end:
 
+  end:
+
 	switch_safe_free(tmp_data);
 
 	return status;
- 
+
 }
 
 
@@ -1147,7 +1164,7 @@
 	const switch_state_handler_table_t *table;
 	const char *cid_name_override;
 	const char *cid_num_override;
-	switch_caller_profile_t *caller_profile_override; 
+	switch_caller_profile_t *caller_profile_override;
 	switch_event_t *ovars;
 	switch_originate_flag_t flags;
 	switch_status_t status;
@@ -1167,24 +1184,19 @@
 static void *SWITCH_THREAD_FUNC enterprise_originate_thread(switch_thread_t *thread, void *obj)
 {
 	enterprise_originate_handle_t *handle = (enterprise_originate_handle_t *) obj;
-	
+
 	handle->done = 0;
-	handle->status = switch_ivr_originate(NULL, &handle->bleg, &handle->cause, 
+	handle->status = switch_ivr_originate(NULL, &handle->bleg, &handle->cause,
 										  handle->bridgeto, handle->timelimit_sec,
 										  handle->table,
 										  handle->cid_name_override,
-										  handle->cid_num_override,
-										  handle->caller_profile_override,
-										  handle->ovars,
-										  handle->flags,
-										  &handle->cancel_cause
-										  );
+										  handle->cid_num_override, handle->caller_profile_override, handle->ovars, handle->flags, &handle->cancel_cause);
 
 
 	handle->done = 1;
 	switch_mutex_lock(handle->mutex);
 	switch_mutex_unlock(handle->mutex);
-	
+
 	if (handle->done != 2) {
 		if (handle->status == SWITCH_STATUS_SUCCESS) {
 			switch_channel_hangup(switch_core_session_get_channel(handle->bleg), SWITCH_CAUSE_LOSE_RACE);
@@ -1203,8 +1215,8 @@
 	switch_status_t status = SWITCH_STATUS_FALSE;
 
 	switch_core_session_read_lock(session);
-	
-	while(rb_data->running && switch_channel_ready(channel)) {
+
+	while (rb_data->running && switch_channel_ready(channel)) {
 		if (status != SWITCH_STATUS_BREAK) {
 			if (zstr(rb_data->ringback_data) || !strcasecmp(rb_data->ringback_data, "silence")) {
 				status = switch_ivr_collect_digits_callback(session, NULL, 0, 0);
@@ -1234,14 +1246,12 @@
 																const switch_state_handler_table_t *table,
 																const char *cid_name_override,
 																const char *cid_num_override,
-																switch_caller_profile_t *caller_profile_override, 
-																switch_event_t *ovars,
-																switch_originate_flag_t flags
-																)
+																switch_caller_profile_t *caller_profile_override,
+																switch_event_t *ovars, switch_originate_flag_t flags)
 {
 	int x_argc = 0;
 	char *x_argv[MAX_PEERS] = { 0 };
-	enterprise_originate_handle_t *hp = NULL, handles[MAX_PEERS] = { { 0 } };
+	enterprise_originate_handle_t *hp = NULL, handles[MAX_PEERS] = { {0} };
 	int i;
 	switch_caller_profile_t *cp = NULL;
 	switch_channel_t *channel = NULL;
@@ -1295,7 +1305,8 @@
 			}
 			/* swallow the opening bracket */
 			while ((data + k) && *(data + k)) {
-				j = k; k++;
+				j = k;
+				k++;
 				/* note that this affects vars[] */
 				data[j] = data[k];
 			}
@@ -1304,8 +1315,8 @@
 		}
 		var_block_count++;
 		continue;
-    
-	var_extract_error:
+
+	  var_extract_error:
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Parse Error!\n");
 		switch_goto_status(SWITCH_STATUS_GENERR, done);
 	}
@@ -1385,7 +1396,7 @@
 	switch_threadattr_create(&thd_attr, pool);
 	switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
 
-	for(i = 0; i < x_argc; i++) {
+	for (i = 0; i < x_argc; i++) {
 		handles[i].session = session;
 		handles[i].bleg = NULL;
 		handles[i].cause = 0;
@@ -1396,18 +1407,18 @@
 		handles[i].cid_name_override = cid_name_override;
 		handles[i].cid_num_override = cid_num_override;
 		handles[i].caller_profile_override = cp;
-		switch_event_dup(&handles[i].ovars, var_event);		
+		switch_event_dup(&handles[i].ovars, var_event);
 		handles[i].flags = flags;
 		switch_mutex_init(&handles[i].mutex, SWITCH_MUTEX_NESTED, pool);
 		switch_mutex_lock(handles[i].mutex);
 		switch_thread_create(&handles[i].thread, thd_attr, enterprise_originate_thread, &handles[i], pool);
 	}
-	
+
 	if (channel && !switch_channel_test_flag(channel, CF_PROXY_MODE) && !switch_channel_test_flag(channel, CF_PROXY_MEDIA)) {
 		if (switch_channel_test_flag(channel, CF_ANSWERED)) {
 			ringback_data = switch_channel_get_variable(channel, "transfer_ringback");
 		}
-		
+
 		if (!ringback_data) {
 			ringback_data = switch_channel_get_variable(channel, "ringback");
 		}
@@ -1426,15 +1437,15 @@
 	}
 
 
-	for(;;) {
+	for (;;) {
 		running = 0;
 		over = 0;
-		
+
 		if (channel && !switch_channel_ready(channel)) {
 			break;
 		}
 
-		for(i = 0; i < x_argc; i++) {
+		for (i = 0; i < x_argc; i++) {
 
 
 			if (handles[i].done == 0) {
@@ -1458,10 +1469,10 @@
 			break;
 		}
 	}
-	
 
- done:
 
+  done:
+
 	if (hp) {
 		*cause = hp->cause;
 		status = hp->status;
@@ -1471,14 +1482,14 @@
 		switch_event_destroy(&hp->ovars);
 	}
 
-	for(i = 0; i < x_argc; i++) {
+	for (i = 0; i < x_argc; i++) {
 		if (hp == &handles[i]) {
 			continue;
 		}
 		handles[i].cancel_cause = SWITCH_CAUSE_LOSE_RACE;
 	}
 
-	for(i = 0; i < x_argc; i++) {
+	for (i = 0; i < x_argc; i++) {
 		if (hp == &handles[i]) {
 			continue;
 		}
@@ -1486,8 +1497,8 @@
 		switch_thread_join(&tstatus, handles[i].thread);
 		switch_event_destroy(&handles[i].ovars);
 	}
-	
 
+
 	if (channel && rb_data.thread) {
 		switch_channel_set_flag(channel, CF_NOT_READY);
 		switch_thread_join(&tstatus, rb_data.thread);
@@ -1495,7 +1506,7 @@
 	}
 
 
- end:
+  end:
 
 	if (var_event && var_event != ovars) {
 		switch_event_destroy(&var_event);
@@ -1507,6 +1518,105 @@
 
 }
 
+struct early_state {
+	originate_global_t *oglobals;
+	originate_status_t *originate_status;
+	switch_mutex_t *mutex;
+	switch_buffer_t *buffer;
+	int ready;
+};
+typedef struct early_state early_state_t;
+
+
+static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void *obj)
+{
+	early_state_t *state = (early_state_t *) obj;
+	originate_status_t originate_status[MAX_PEERS] = { {0} };
+	int16_t mux_data[SWITCH_RECOMMENDED_BUFFER_SIZE / 2] = { 0 };
+	int32_t sample;
+	switch_core_session_t *session;
+	switch_codec_t *read_codec, read_codecs[MAX_PEERS] = { {0} };
+	int i, x, ready = 0, answered = 0;
+	int16_t *data;
+	uint32_t datalen = 0;
+	switch_status_t status;
+	switch_frame_t *read_frame;
+
+	for (i = 0; i < MAX_PEERS && (session = state->originate_status[i].peer_session); i++) {
+		originate_status[i].peer_session = session;
+		switch_core_session_read_lock(session);
+	}
+
+	while (state->ready) {
+		datalen = 0;
+		memset(mux_data, 0, sizeof(mux_data));
+		ready = 0;
+		answered = 0;
+
+		for (i = 0; i < MAX_PEERS && (session = originate_status[i].peer_session); i++) {
+			switch_channel_t *channel = switch_core_session_get_channel(session);
+			if (switch_channel_media_ready(channel)) {
+				ready++;
+
+				if (switch_channel_test_flag(channel, CF_ANSWERED)) {
+					answered++;
+				}
+
+				if (!switch_core_codec_ready((&read_codecs[i]))) {
+					read_codec = switch_core_session_get_read_codec(session);
+
+					if (switch_core_codec_init(&read_codecs[i],
+											   "L16",
+											   NULL,
+											   read_codec->implementation->actual_samples_per_second,
+											   read_codec->implementation->microseconds_per_packet / 1000,
+											   1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+											   switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
+						switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Codec Error!\n");
+					} else {
+						switch_core_session_set_read_codec(session, &read_codecs[i]);
+					}
+				}
+				status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
+				if (SWITCH_READ_ACCEPTABLE(status)) {
+					data = (int16_t *) read_frame->data;
+					if (datalen < read_frame->datalen) {
+						datalen = read_frame->datalen;
+					}
+					for (x = 0; x < (int) read_frame->datalen / 2; x++) {
+						sample = data[x] + mux_data[x];
+						switch_normalize_to_16bit(sample);
+						mux_data[x] = (int16_t) sample;
+					}
+
+				}
+			}
+		}
+		if (datalen) {
+			switch_mutex_lock(state->mutex);
+			switch_buffer_write(state->buffer, mux_data, datalen);
+			switch_mutex_unlock(state->mutex);
+		}
+
+		if (!ready || answered) {
+			break;
+		}
+	}
+
+
+	for (i = 0; i < MAX_PEERS && (session = originate_status[i].peer_session); i++) {
+		if (switch_core_codec_ready((&read_codecs[i]))) {
+			switch_core_codec_destroy(&read_codecs[i]);
+		}
+		switch_core_session_reset(session, SWITCH_FALSE, SWITCH_TRUE);
+		switch_core_session_rwunlock(session);
+	}
+
+	state->oglobals->early_ok = 1;
+
+	return NULL;
+}
+
 #define peer_eligible(_peer) (_peer && !(switch_channel_test_flag(_peer, CF_TRANSFER) || \
 										 switch_channel_test_flag(_peer, CF_REDIRECT) || \
 										 switch_channel_test_flag(_peer, CF_BRIDGED) || \
@@ -1522,13 +1632,10 @@
 													 const switch_state_handler_table_t *table,
 													 const char *cid_name_override,
 													 const char *cid_num_override,
-													 switch_caller_profile_t *caller_profile_override, 
-													 switch_event_t *ovars,
-													 switch_originate_flag_t flags,
-													 switch_call_cause_t *cancel_cause
-													 )
+													 switch_caller_profile_t *caller_profile_override,
+													 switch_event_t *ovars, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause)
 {
-	originate_status_t originate_status[MAX_PEERS] = { { 0 } }; 
+	originate_status_t originate_status[MAX_PEERS] = { {0} };
 	switch_originate_flag_t dftflags = SOF_NONE, myflags = dftflags;
 	char *pipe_names[MAX_PEERS] = { 0 };
 	char *data = NULL;
@@ -1566,18 +1673,20 @@
 	int local_clobber = 0;
 	const char *cancel_key = NULL;
 	const char *holding = NULL;
+	const char *soft_holding = NULL;
 	const char *export_vars = NULL;
+	early_state_t early_state = { 0 };
 
-
 	if (strstr(bridgeto, SWITCH_ENT_ORIGINATE_DELIM)) {
 		return switch_ivr_enterprise_originate(session, bleg, cause, bridgeto, timelimit_sec, table, cid_name_override, cid_num_override,
-										  caller_profile_override, ovars, flags);
+											   caller_profile_override, ovars, flags);
 	}
 
 	oglobals.ringback_ok = 1;
+	oglobals.bridge_early_media = -1;
 
 	if (session) {
-		const char *to_var;
+		const char *to_var, *bypass_media = NULL, *proxy_media = NULL;
 		caller_channel = switch_core_session_get_channel(session);
 		switch_channel_set_flag(caller_channel, CF_ORIGINATOR);
 		oglobals.session = session;
@@ -1587,35 +1696,50 @@
 			timelimit_sec = atoi(to_var);
 		}
 
-		if (switch_true(switch_channel_get_variable(caller_channel, SWITCH_PROXY_MEDIA_VARIABLE))) {
-			switch_channel_set_flag(caller_channel, CF_PROXY_MEDIA);
+		proxy_media = switch_channel_get_variable(caller_channel, SWITCH_PROXY_MEDIA_VARIABLE);
+		bypass_media = switch_channel_get_variable(caller_channel, SWITCH_BYPASS_MEDIA_VARIABLE);
+
+		if (!zstr(proxy_media)) {
+			if (switch_true(proxy_media)) {
+				switch_channel_set_flag(caller_channel, CF_PROXY_MEDIA);
+			} else if (switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA)) {
+				switch_channel_clear_flag(caller_channel, CF_PROXY_MEDIA);
+			}
 		}
 
-		if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE)
-			|| (switch_true(switch_channel_get_variable(caller_channel, SWITCH_BYPASS_MEDIA_VARIABLE)))) {
-			if (!switch_channel_test_flag(caller_channel, CF_ANSWERED)
-				&& !switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)) {
+		if (!zstr(bypass_media)) {
+			if (switch_true(bypass_media)) {
 				switch_channel_set_flag(caller_channel, CF_PROXY_MODE);
-			} else {
-				if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE)) {
-					switch_ivr_media(switch_core_session_get_uuid(session), SMF_REBRIDGE);
-					switch_channel_set_flag(caller_channel, CF_PROXY_MODE);
-				} else {
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, 
-									  "Channel is already up, delaying proxy mode 'till both legs are answered.\n");
-					switch_channel_set_variable(caller_channel, "bypass_media_after_bridge", "true");
-					switch_channel_set_variable(caller_channel, SWITCH_BYPASS_MEDIA_VARIABLE, NULL);
-					switch_channel_clear_flag(caller_channel, CF_PROXY_MODE);
-				}
+			} else if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE)) {
+				switch_ivr_media(switch_core_session_get_uuid(session), SMF_NONE);
 			}
 		}
+
+		switch_channel_set_variable(caller_channel, SWITCH_B_SDP_VARIABLE, NULL);
+
+
+		if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE) && switch_channel_media_ready(caller_channel)) {
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
+							  "Channel is already up, delaying proxy mode 'till both legs are answered.\n");
+			switch_channel_set_variable(caller_channel, "bypass_media_after_bridge", "true");
+			switch_channel_set_variable(caller_channel, SWITCH_BYPASS_MEDIA_VARIABLE, NULL);
+			switch_channel_clear_flag(caller_channel, CF_PROXY_MODE);
+		}
+
+
+		if (switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA) && switch_channel_media_ready(caller_channel)) {
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Channel is already up, proxy media cannot be used anymore\n");
+			switch_channel_set_variable(caller_channel, SWITCH_PROXY_MEDIA_VARIABLE, NULL);
+			switch_channel_clear_flag(caller_channel, CF_PROXY_MEDIA);
+		}
+
 	}
 
 	if (timelimit_sec <= 0) {
 		timelimit_sec = 60;
 	}
 
-	
+
 	oglobals.idx = IDX_NADA;
 	oglobals.early_ok = 1;
 
@@ -1660,7 +1784,8 @@
 			}
 			/* swallow the opening bracket */
 			while ((data + k) && *(data + k)) {
-				j = k; k++;
+				j = k;
+				k++;
 				/* note that this affects vars[] */
 				data[j] = data[k];
 			}
@@ -1669,8 +1794,8 @@
 		}
 		var_block_count++;
 		continue;
-    
-	var_extract_error:
+
+	  var_extract_error:
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Parse Error!\n");
 		status = SWITCH_STATUS_GENERR;
 		goto done;
@@ -1690,7 +1815,7 @@
 	/* Some channel are created from an originating channel and some aren't so not all outgoing calls have a way to get params
 	   so we will normalize dialstring params and channel variables (when there is an originator) into an event that we 
 	   will use as a pseudo hash to consult for params as needed.
-	*/
+	 */
 
 	if (ovars) {
 		var_event = ovars;
@@ -1744,15 +1869,20 @@
 	if (oglobals.session) {
 		switch_event_header_t *hi;
 		const char *cdr_total_var;
+		const char *cdr_var;
 
-		if ((cdr_total_var = switch_channel_get_variable(caller_channel, "failed_xml_cdr_total"))) {
-			int tmp = atoi(cdr_total_var);
-			if (tmp > 0) {
-				cdr_total = tmp;
+		if ((cdr_var = switch_channel_get_variable(caller_channel, "failed_xml_cdr_prefix"))) {
+			char buf[128] = "";
+			switch_snprintf(buf, sizeof(buf), "%s_total", cdr_var);
+			if ((cdr_total_var = switch_channel_get_variable(caller_channel, buf))) {
+				int tmp = atoi(cdr_total_var);
+				if (tmp > 0) {
+					cdr_total = tmp;
+				}
 			}
 		}
-		
 
+
 		/* Copy all the missing applicable channel variables from A-leg into the event */
 		if ((hi = switch_channel_variable_first(caller_channel))) {
 			for (; hi; hi = hi->next) {
@@ -1769,6 +1899,8 @@
 					ok = 1;
 				} else if (!strcasecmp((char *) hi->name, "ignore_early_media")) {
 					ok = 1;
+				} else if (!strcasecmp((char *) hi->name, "bridge_early_media")) {
+					ok = 1;
 				} else if (!strcasecmp((char *) hi->name, "originate_continue_on_timeout")) {
 					ok = 1;
 				} else if (!strcasecmp((char *) hi->name, "ignore_ring_ready")) {
@@ -1796,16 +1928,16 @@
 			switch_channel_variable_last(caller_channel);
 		}
 		/*
-		  if ((hi = switch_channel_variable_first(caller_channel))) {
-		  for (; hi; hi = switch_hash_next(hi)) {
-		  switch_hash_this(hi, &vvar, NULL, &vval);
-		  if (vvar && vval) {
-		  switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, (void *) vvar, (char *) vval);
-		  }
-		  }
-		  switch_channel_variable_last(caller_channel);
-		  }
-		*/
+		   if ((hi = switch_channel_variable_first(caller_channel))) {
+		   for (; hi; hi = switch_hash_next(hi)) {
+		   switch_hash_this(hi, &vvar, NULL, &vval);
+		   if (vvar && vval) {
+		   switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, (void *) vvar, (char *) vval);
+		   }
+		   }
+		   switch_channel_variable_last(caller_channel);
+		   }
+		 */
 	}
 
 	if (caller_channel) {		/* ringback is only useful when there is an originator */
@@ -1826,7 +1958,7 @@
 			ringback_data = NULL;
 		} else if (zstr(ringback_data)) {
 			const char *vvar;
-			
+
 			if ((vvar = switch_channel_get_variable(caller_channel, SWITCH_SEND_SILENCE_WHEN_IDLE_VARIABLE))) {
 				int sval = atoi(vvar);
 
@@ -1837,7 +1969,6 @@
 			}
 		}
 	}
-
 #if 0
 	/* changing behaviour ignore_early_media=true must also be explicitly set for previous behaviour */
 	if (ringback_data) {
@@ -1859,7 +1990,7 @@
 	   rejections should terminate the attempt rather than a timeout, answer, or rejection by all. 
 	   If the value is set to 'true' any fail cause will end the attempt otherwise it can contain a comma (,) separated
 	   list of cause names which should be considered fatal
-	*/
+	 */
 	if ((var = switch_event_get_header(var_event, "fail_on_single_reject")) && switch_true(var)) {
 		fail_on_single_reject_var = strdup(var);
 		fail_on_single_reject = 1;
@@ -1869,6 +2000,13 @@
 		*oglobals.file = '\0';
 	}
 
+	if ((var_val = switch_event_get_header(var_event, "bridge_early_media"))) {
+		if (switch_true(var_val)) {
+			oglobals.early_ok = 0;
+			oglobals.ignore_early_media = 3;
+		}
+	}
+
 	if ((var_val = switch_event_get_header(var_event, "ignore_early_media"))) {
 		if (switch_true(var_val)) {
 			oglobals.early_ok = 0;
@@ -1987,12 +2125,12 @@
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Only calling the first element in the list in this mode.\n");
 			or_argc = 1;
 		}
-		
+
 		for (r = 0; r < or_argc; r++) {
 			char *p, *end = NULL;
 			const char *var_begin, *var_end;
 			oglobals.hups = 0;
-			
+
 			reason = SWITCH_CAUSE_NONE;
 			memset(peer_names, 0, sizeof(peer_names));
 			peer_session = NULL;
@@ -2011,9 +2149,10 @@
 			oglobals.sent_ring = 0;
 			oglobals.progress = 0;
 			myflags = dftflags;
-			
+
 			if (try > 0) {
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Originate attempt %d/%d in %d ms\n", try + 1, retries, sleep_ms);
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Originate attempt %d/%d in %d ms\n", try + 1, retries,
+								  sleep_ms);
 				if (caller_channel) {
 					switch_ivr_sleep(oglobals.session, sleep_ms, SWITCH_TRUE, NULL);
 					if (!switch_channel_ready(caller_channel)) {
@@ -2024,9 +2163,9 @@
 					switch_yield(sleep_ms * 1000);
 				}
 			}
-			
+
 			p = pipe_names[r];
-			while(p && *p) {
+			while (p && *p) {
 				if (*p == '[') {
 					end = switch_find_end_paren(p, '[', ']');
 				}
@@ -2041,7 +2180,7 @@
 
 				p++;
 			}
-			
+
 			and_argc = switch_separate_string(pipe_names[r], ',', peer_names, (sizeof(peer_names) / sizeof(peer_names[0])));
 
 			if ((flags & SOF_NOBLOCK) && and_argc > 1) {
@@ -2087,11 +2226,11 @@
 					new_profile->uuid = SWITCH_BLANK_STRING;
 					new_profile->chan_name = SWITCH_BLANK_STRING;
 					new_profile->destination_number = switch_core_strdup(new_profile->pool, chan_data);
-					
+
 					if (switch_channel_direction(caller_channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
 						const char *callee_id_name = new_profile->callee_id_name;
 						const char *callee_id_number = new_profile->callee_id_number;
-						
+
 						if (zstr(callee_id_number)) {
 							callee_id_number = new_profile->destination_number;
 						}
@@ -2099,7 +2238,7 @@
 						if (zstr(callee_id_name)) {
 							callee_id_name = callee_id_number;
 						}
-						
+
 						new_profile->caller_id_name = callee_id_name;
 						new_profile->caller_id_number = callee_id_number;
 						new_profile->callee_id_name = SWITCH_BLANK_STRING;
@@ -2124,7 +2263,7 @@
 						new_profile->chan_name = SWITCH_BLANK_STRING;
 					} else {
 						if (!cid_name_override) {
-							cid_name_override = "FreeSWITCH";
+							cid_name_override = SWITCH_DEFAULT_CLID_NAME;
 						}
 						if (!cid_num_override) {
 							cid_num_override = "0000000000";
@@ -2150,7 +2289,7 @@
 						myflags |= SOF_FORKED_DIAL;
 					}
 				}
-				
+
 				/* only valid in [] since it's unique to each channel leg */
 
 				if (vdata && (var_begin = switch_stristr("origination_uuid=", vdata))) {
@@ -2159,7 +2298,7 @@
 					var_end = strchr(var_begin, '|');
 
 					if (var_end) {
-						strncpy(tmp, var_begin, var_end-var_begin);
+						strncpy(tmp, var_begin, var_end - var_begin);
 					} else {
 						strncpy(tmp, var_begin, strlen(var_begin));
 					}
@@ -2170,63 +2309,63 @@
 				/* The rest are valid in both {} and [] with [] taking precedence */
 
 				current_variable = NULL;
-				
+
 				if (vdata && (var_begin = switch_stristr("origination_caller_id_number=", vdata))) {
 					var_begin += strlen("origination_caller_id_number=");
 					var_end = strchr(var_begin, '|');
 
 					if (var_end) {
-						strncpy(variable_buffer, var_begin, var_end-var_begin);
+						strncpy(variable_buffer, var_begin, var_end - var_begin);
 					} else {
 						strncpy(variable_buffer, var_begin, strlen(var_begin));
 					}
 
 					current_variable = variable_buffer;
 				}
-				
+
 				if (current_variable || (current_variable = switch_event_get_header(var_event, "origination_caller_id_number"))) {
 					new_profile->caller_id_number = switch_core_strdup(new_profile->pool, current_variable);
 					myflags |= SOF_NO_EFFECTIVE_CID_NUM;
 				}
 
 				current_variable = NULL;
-				
+
 				if (vdata && (var_begin = switch_stristr("origination_caller_id_name=", vdata))) {
 					var_begin += strlen("origination_caller_id_name=");
 					var_end = strchr(var_begin, '|');
 
 					if (var_end) {
-						strncpy(variable_buffer, var_begin, var_end-var_begin);
+						strncpy(variable_buffer, var_begin, var_end - var_begin);
 					} else {
 						strncpy(variable_buffer, var_begin, strlen(var_begin));
 					}
 
 					current_variable = variable_buffer;
 				}
-				
+
 				if (current_variable || (current_variable = switch_event_get_header(var_event, "origination_caller_id_name"))) {
 					new_profile->caller_id_name = switch_core_strdup(new_profile->pool, current_variable);
 					myflags |= SOF_NO_EFFECTIVE_CID_NAME;
 				}
-				
+
 				current_variable = NULL;
-				
+
 				if (vdata && (var_begin = switch_stristr("origination_privacy=", vdata))) {
 					var_begin += strlen("origination_privacy=");
 					var_end = strchr(var_begin, '|');
 
 					if (var_end) {
-						strncpy(variable_buffer, var_begin, var_end-var_begin);
+						strncpy(variable_buffer, var_begin, var_end - var_begin);
 					} else {
 						strncpy(variable_buffer, var_begin, strlen(var_begin));
 					}
 
 					current_variable = variable_buffer;
 				}
-				
+
 				if (current_variable || (current_variable = switch_event_get_header(var_event, "origination_privacy"))) {
 					new_profile->flags = SWITCH_CPF_NONE;
-					
+
 					if (switch_stristr("screen", current_variable)) {
 						switch_set_flag(new_profile, SWITCH_CPF_SCREEN);
 					}
@@ -2243,11 +2382,11 @@
 				current_variable = NULL;
 				switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "originate_early_media", oglobals.early_ok ? "true" : "false");
 
-				if ((reason = switch_core_session_outgoing_channel(oglobals.session, var_event, chan_type, 
+				if ((reason = switch_core_session_outgoing_channel(oglobals.session, var_event, chan_type,
 																   new_profile, &new_session, &pool, myflags, cancel_cause)) != SWITCH_CAUSE_SUCCESS) {
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot create outgoing channel of type [%s] cause: [%s]\n", 
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot create outgoing channel of type [%s] cause: [%s]\n",
 									  chan_type, switch_channel_cause2str(reason));
-					
+
 					if (pool) {
 						switch_core_destroy_memory_pool(&pool);
 					}
@@ -2319,7 +2458,11 @@
 
 				if (originate_status[i].peer_channel) {
 					const char *vvar;
-					
+
+					if (switch_true(switch_channel_get_variable(originate_status[i].peer_channel, "leg_required"))) {
+						originate_status[i].tagged = 1;
+					}
+
 					if ((vvar = switch_channel_get_variable(originate_status[i].peer_channel, "origination_callee_id_name"))) {
 						switch_channel_set_profile_var(originate_status[i].peer_channel, "callee_id_name", vvar);
 					}
@@ -2331,16 +2474,16 @@
 					if ((vvar = switch_channel_get_variable(originate_status[i].peer_channel, "leg_timeout"))) {
 						int val = atoi(vvar);
 						if (val > 0) {
-							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Setting leg timeout to %d\n", 
+							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Setting leg timeout to %d\n",
 											  switch_channel_get_name(originate_status[i].peer_channel), val);
 							originate_status[i].per_channel_timelimit_sec = (uint32_t) val;
 						}
 					}
-					
+
 					if ((vvar = switch_channel_get_variable(originate_status[i].peer_channel, "leg_progress_timeout"))) {
 						int val = atoi(vvar);
 						if (val > 0) {
-							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Setting leg progress timeout to %d\n", 
+							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Setting leg progress timeout to %d\n",
 											  switch_channel_get_name(originate_status[i].peer_channel), val);
 							originate_status[i].per_channel_progress_timelimit_sec = (uint32_t) val;
 						}
@@ -2349,7 +2492,7 @@
 					if ((vvar = switch_channel_get_variable(originate_status[i].peer_channel, "leg_delay_start"))) {
 						int val = atoi(vvar);
 						if (val > 0) {
-							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Setting leg delay start to %d\n", 
+							switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Setting leg delay start to %d\n",
 											  switch_channel_get_name(originate_status[i].peer_channel), val);
 							originate_status[i].per_channel_delay_start = (uint32_t) val;
 
@@ -2412,26 +2555,29 @@
 					if (caller_channel && !switch_channel_ready(caller_channel)) {
 						goto notready;
 					}
-					
+
 					elapsed = switch_epoch_time_now(NULL) - start;
-				
+
 					if (elapsed > (time_t) timelimit_sec) {
 						to++;
 						oglobals.idx = IDX_TIMEOUT;
 						goto notready;
 					}
 
-					if (!oglobals.sent_ring && !oglobals.ignore_ring_ready && 
+					if (!oglobals.sent_ring && !oglobals.ignore_ring_ready &&
 						!oglobals.progress && (progress_timelimit_sec && elapsed > (time_t) progress_timelimit_sec)) {
 						to++;
 						oglobals.idx = IDX_TIMEOUT;
+						if (force_reason == SWITCH_CAUSE_NONE) {
+							force_reason = SWITCH_CAUSE_PROGRESS_TIMEOUT;
+						}
 						goto notready;
 					}
-					
+
 					switch_cond_next();
 				}
 
-				check_per_channel_timeouts(&oglobals, originate_status, and_argc, start);
+				check_per_channel_timeouts(&oglobals, originate_status, and_argc, start, &force_reason);
 
 
 				if (valid_channels == 0) {
@@ -2441,16 +2587,15 @@
 
 			}
 
-		endfor1:
+		  endfor1:
 
 			if (caller_channel) {
-				if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE) || 
+				if (switch_channel_test_flag(caller_channel, CF_PROXY_MODE) ||
 					switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA) || switch_channel_test_flag(caller_channel, CF_DISABLE_RINGBACK)) {
 					ringback_data = NULL;
 				}
 			}
 
-			
 
 #if 0
 			/* changing behaviour ignore_early_media=true must also be explicitly set for previous behaviour */
@@ -2464,18 +2609,24 @@
 			} else {
 				oglobals.ringback_ok = 0;
 			}
-			
+
+			if (caller_channel) {
+				soft_holding = switch_channel_get_variable(caller_channel, SWITCH_SOFT_HOLDING_UUID_VARIABLE);
+			}
+
 			while ((!caller_channel || switch_channel_ready(caller_channel) || switch_channel_test_flag(caller_channel, CF_XFER_ZOMBIE)) &&
-                   check_channel_status(&oglobals, originate_status, and_argc)) {
+				   check_channel_status(&oglobals, originate_status, and_argc)) {
 				time_t elapsed = switch_epoch_time_now(NULL) - start;
-				
+
 				if (cancel_cause && *cancel_cause > 0) {
-					force_reason = *cancel_cause;
+					if (force_reason == SWITCH_CAUSE_NONE) {
+						force_reason = *cancel_cause;
+					}
 					oglobals.idx = IDX_CANCEL;
 					goto notready;
 				}
 
-				check_per_channel_timeouts(&oglobals, originate_status, and_argc, start);
+				check_per_channel_timeouts(&oglobals, originate_status, and_argc, start, &force_reason);
 
 				if (oglobals.session) {
 					switch_ivr_parse_all_events(oglobals.session);
@@ -2483,23 +2634,26 @@
 
 				if (!oglobals.sent_ring && !oglobals.progress && (progress_timelimit_sec && elapsed > (time_t) progress_timelimit_sec)) {
 					oglobals.idx = IDX_TIMEOUT;
+					if (force_reason == SWITCH_CAUSE_NONE) {
+						force_reason = SWITCH_CAUSE_PROGRESS_TIMEOUT;
+					}
 					goto notready;
 				}
 
 				if ((to = (uint8_t) (elapsed >= (time_t) timelimit_sec)) || (fail_on_single_reject && oglobals.hups)) {
 					int ok = 0;
-					
+
 					if (fail_on_single_reject_var && !switch_true(fail_on_single_reject_var)) {
 						ok = 1;
 						for (i = 0; i < and_argc; i++) {
 							switch_channel_t *pchannel;
 							const char *cause_str;
-							
+
 							if (!originate_status[i].peer_session) {
 								continue;
 							}
 							pchannel = switch_core_session_get_channel(originate_status[i].peer_session);
-							
+
 							if (switch_channel_down(pchannel)) {
 								cause_str = switch_channel_cause2str(switch_channel_get_cause(pchannel));
 								if (switch_stristr(cause_str, fail_on_single_reject_var)) {
@@ -2522,7 +2676,7 @@
 					!switch_channel_test_flag(caller_channel, CF_XFER_ZOMBIE) &&
 					(oglobals.ringback_ok
 					 || (switch_channel_test_flag(caller_channel, CF_ANSWERED) || switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)))) {
-					
+
 					switch_status_t tstatus = SWITCH_STATUS_SUCCESS;
 					int silence = 0;
 
@@ -2541,6 +2695,10 @@
 					if (switch_channel_media_ready(caller_channel)) {
 						tstatus = switch_core_session_read_frame(oglobals.session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
 						if (!SWITCH_READ_ACCEPTABLE(tstatus)) {
+							if (soft_holding) {
+								switch_channel_set_flag(caller_channel, CF_XFER_ZOMBIE);
+							}
+
 							if (switch_channel_test_flag(caller_channel, CF_XFER_ZOMBIE)) {
 								continue;
 							}
@@ -2549,11 +2707,27 @@
 					} else {
 						read_frame = NULL;
 					}
-					
-					if (oglobals.ringback_ok && (oglobals.ring_ready || oglobals.instant_ringback || oglobals.sending_ringback > 1)) {
+
+
+					if (oglobals.ringback_ok && (oglobals.ring_ready || oglobals.instant_ringback ||
+												 oglobals.sending_ringback > 1 || oglobals.bridge_early_media > -1)) {
 						if (oglobals.ringback_ok == 1) {
 							switch_status_t rst = setup_ringback(&oglobals, ringback_data, &ringback, &write_frame, &write_codec);
 
+
+							if (oglobals.bridge_early_media > -1) {
+								switch_threadattr_t *thd_attr = NULL;
+								switch_threadattr_create(&thd_attr, switch_core_session_get_pool(session));
+								switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+								early_state.oglobals = &oglobals;
+								early_state.originate_status = originate_status;
+								early_state.ready = 1;
+								switch_mutex_init(&early_state.mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session));
+								switch_buffer_create_dynamic(&early_state.buffer, 1024, 1024, 0);
+								switch_thread_create(&oglobals.ethread, thd_attr, early_thread_run, &early_state, switch_core_session_get_pool(session));
+							}
+
+
 							switch (rst) {
 							case SWITCH_STATUS_SUCCESS:
 								oglobals.ringback_ok++;
@@ -2573,8 +2747,16 @@
 
 							continue;
 						}
-							
-						if (ringback.fh) {
+
+						if (oglobals.bridge_early_media > -1) {
+							write_frame.datalen = 0;
+							switch_mutex_lock(early_state.mutex);
+							if (switch_buffer_inuse(early_state.buffer) >= write_frame.codec->implementation->decoded_bytes_per_packet) {
+								write_frame.datalen = switch_buffer_read(early_state.buffer, write_frame.data,
+																		 write_frame.codec->implementation->decoded_bytes_per_packet);
+							}
+							switch_mutex_unlock(early_state.mutex);
+						} else if (ringback.fh) {
 							switch_size_t mlen, olen;
 							unsigned int pos = 0;
 
@@ -2585,11 +2767,11 @@
 							}
 
 							olen = mlen;
-							
+
 							//if (ringback.fh->resampler && ringback.fh->resampler->rfactor > 1) {
 							//olen = (switch_size_t) (olen * ringback.fh->resampler->rfactor);
 							//}
-							
+
 							switch_core_file_read(ringback.fh, write_frame.data, &olen);
 
 							if (olen == 0) {
@@ -2605,7 +2787,14 @@
 						} else if (ringback.audio_buffer) {
 							if ((write_frame.datalen = (uint32_t) switch_buffer_read_loop(ringback.audio_buffer,
 																						  write_frame.data,
-																						  write_frame.codec->implementation->decoded_bytes_per_packet)) <= 0) {
+																						  write_frame.codec->implementation->decoded_bytes_per_packet)) <=
+								0) {
+
+								if (soft_holding) {
+									switch_channel_set_flag(caller_channel, CF_XFER_ZOMBIE);
+									continue;
+								}
+
 								break;
 							}
 						} else if (ringback.silence) {
@@ -2614,46 +2803,49 @@
 					} else {
 						silence = 600;
 					}
-					
-					if ((ringback.fh || silence || ringback.audio_buffer) && write_frame.codec && write_frame.datalen) {
+
+					if ((ringback.fh || silence || ringback.audio_buffer || oglobals.bridge_early_media > -1) && write_frame.codec && write_frame.datalen) {
 						if (silence) {
 							write_frame.datalen = write_frame.codec->implementation->decoded_bytes_per_packet;
 							switch_generate_sln_silence((int16_t *) write_frame.data, write_frame.datalen / 2, silence);
 						}
-						
+
 						if (switch_core_session_write_frame(oglobals.session, &write_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) {
+							if (soft_holding) {
+								switch_channel_set_flag(caller_channel, CF_XFER_ZOMBIE);
+							}
 							if (switch_channel_test_flag(caller_channel, CF_XFER_ZOMBIE)) {
 								continue;
 							}
 							break;
 						}
 					}
-					
+
 				} else {
 					switch_cond_next();
 				}
-				
+
 			}
-			
+
 		  notready:
 
 			if (caller_channel) {
-				const char *soft_holding = switch_channel_get_variable(caller_channel, SWITCH_SOFT_HOLDING_UUID_VARIABLE);
 				holding = switch_channel_get_variable(caller_channel, SWITCH_HOLDING_UUID_VARIABLE);
 				switch_channel_set_variable(caller_channel, SWITCH_HOLDING_UUID_VARIABLE, NULL);
 
 				if (soft_holding && switch_channel_test_flag(caller_channel, CF_XFER_ZOMBIE)) {
 					holding = soft_holding;
+					soft_holding = NULL;
 					switch_channel_set_variable(caller_channel, SWITCH_SOFT_HOLDING_UUID_VARIABLE, NULL);
 				}
 			}
-			
+
 			if (caller_channel && !switch_channel_ready(caller_channel) && !switch_channel_test_flag(caller_channel, CF_XFER_ZOMBIE)) {
 				oglobals.idx = IDX_CANCEL;
 			}
 
 			if (oglobals.session && (ringback_data || !(switch_channel_test_flag(caller_channel, CF_PROXY_MODE) &&
-											   switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA)))) {
+														switch_channel_test_flag(caller_channel, CF_PROXY_MEDIA)))) {
 				switch_core_session_reset(oglobals.session, SWITCH_FALSE, SWITCH_TRUE);
 			}
 
@@ -2690,17 +2882,17 @@
 						}
 					}
 				}
-				
-			end_search:
 
+			  end_search:
+
 				if (peer_channel && switch_channel_down(peer_channel)) {
 					switch_core_session_rwunlock(peer_session);
 					peer_session = NULL;
 					peer_channel = NULL;
 
 				}
-				
-				if (oglobals.idx == IDX_TIMEOUT || to || oglobals.idx == IDX_KEY_CANCEL || oglobals.idx == IDX_CANCEL || 
+
+				if (oglobals.idx == IDX_TIMEOUT || to || oglobals.idx == IDX_KEY_CANCEL || oglobals.idx == IDX_CANCEL ||
 					(!peer_session && oglobals.idx == IDX_NADA)) {
 					const char *dest = NULL;
 					const char *context = NULL;
@@ -2709,13 +2901,13 @@
 
 					if (caller_channel) {
 						if (zstr(context)) {
-							context = switch_channel_get_variable(caller_channel, "context"); 
+							context = switch_channel_get_variable(caller_channel, "context");
 						}
 						if (zstr(dialplan)) {
-							dialplan = switch_channel_get_variable(caller_channel, "dialplan"); 
+							dialplan = switch_channel_get_variable(caller_channel, "dialplan");
 						}
 					}
-					
+
 					if (zstr(context)) {
 						context = "default";
 					}
@@ -2729,7 +2921,7 @@
 						switch_status_t mstatus = SWITCH_STATUS_FALSE;
 
 						if (caller_channel) {
-							if ((mstatus = switch_channel_caller_extension_masquerade(caller_channel, holding_channel, 1)) == SWITCH_STATUS_SUCCESS) {
+							if ((mstatus = switch_channel_caller_extension_masquerade(caller_channel, holding_channel, 0)) == SWITCH_STATUS_SUCCESS) {
 								switch_channel_restart(holding_channel);
 							}
 						}
@@ -2756,19 +2948,22 @@
 						switch_channel_hangup(peer_channel, SWITCH_CAUSE_ATTENDED_TRANSFER);
 						switch_core_session_rwunlock(peer_session);
 					}
-					force_reason = SWITCH_CAUSE_ATTENDED_TRANSFER;
-				} else {
+					if (force_reason == SWITCH_CAUSE_NONE) {
+						force_reason = SWITCH_CAUSE_ATTENDED_TRANSFER;
+					}
+				} else if (zstr(soft_holding)) {
 
 					if (peer_channel && switch_channel_ready(peer_channel)) {
 						switch_core_session_t *holding_session;
 
-						force_reason = SWITCH_CAUSE_ATTENDED_TRANSFER;
+						if (force_reason == SWITCH_CAUSE_NONE) {
+							force_reason = SWITCH_CAUSE_ATTENDED_TRANSFER;
+						}
 
 						if ((holding_session = switch_core_session_locate(holding))) {
 							switch_channel_set_variable(switch_core_session_get_channel(holding_session), SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE, "true");
 							switch_core_session_rwunlock(holding_session);
 						}
-						
 						switch_ivr_uuid_bridge(holding, switch_core_session_get_uuid(peer_session));
 						holding = NULL;
 						oglobals.idx = IDX_NADA;
@@ -2800,12 +2995,12 @@
 				peer_session = NULL;
 				peer_channel = NULL;
 			}
-			
+
 			for (i = 0; i < and_argc; i++) {
 				if (!peer_eligible(originate_status[i].peer_channel)) {
 					continue;
 				}
-				
+
 				if (i != oglobals.idx) {
 					holding = NULL;
 
@@ -2824,10 +3019,10 @@
 					}
 					if (switch_channel_up(originate_status[i].peer_channel)) {
 						if (caller_channel && i == 0) {
-                            holding = switch_channel_get_variable(caller_channel, SWITCH_SOFT_HOLDING_UUID_VARIABLE);
-                            switch_channel_set_variable(caller_channel, SWITCH_SOFT_HOLDING_UUID_VARIABLE, NULL);
-                        }
-						
+							holding = switch_channel_get_variable(caller_channel, SWITCH_SOFT_HOLDING_UUID_VARIABLE);
+							switch_channel_set_variable(caller_channel, SWITCH_SOFT_HOLDING_UUID_VARIABLE, NULL);
+						}
+
 						if (holding && oglobals.idx != IDX_TIMEOUT && oglobals.idx != IDX_KEY_CANCEL) {
 							switch_core_session_t *holding_session;
 
@@ -2835,19 +3030,21 @@
 								switch_channel_set_variable(switch_core_session_get_channel(holding_session), SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE, "true");
 								switch_core_session_rwunlock(holding_session);
 							}
-							
-                            switch_ivr_uuid_bridge(holding, switch_core_session_get_uuid(originate_status[i].peer_session));
+							switch_ivr_uuid_bridge(holding, switch_core_session_get_uuid(originate_status[i].peer_session));
 							holding = NULL;
-                        } else {
+						} else {
 							switch_channel_hangup(originate_status[i].peer_channel, force_reason ? force_reason : reason);
 						}
 					}
 				}
 			}
-			
+
+
+
 			if (oglobals.idx > IDX_NADA) {
-				peer_session = originate_status[oglobals.idx].peer_session;
-				peer_channel = originate_status[oglobals.idx].peer_channel;
+				if ((peer_session = originate_status[oglobals.idx].peer_session)) {
+					peer_channel = switch_core_session_get_channel(originate_status[oglobals.idx].peer_session);
+				}
 			} else {
 				status = SWITCH_STATUS_FALSE;
 				if (caller_channel && peer_channel) {
@@ -2868,7 +3065,7 @@
 				}
 
 				if (status != SWITCH_STATUS_SUCCESS) {
-					switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(peer_channel), SWITCH_LOG_DEBUG, "%s Media Establishment Failed.\n", 
+					switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(peer_channel), SWITCH_LOG_DEBUG, "%s Media Establishment Failed.\n",
 									  switch_channel_get_name(caller_channel));
 					switch_channel_hangup(peer_channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
 				}
@@ -2891,7 +3088,7 @@
 			}
 
 		  done:
-		
+
 			*cause = SWITCH_CAUSE_NONE;
 
 			if (caller_channel && !switch_channel_ready(caller_channel)) {
@@ -2905,7 +3102,7 @@
 						switch_process_import(oglobals.session, peer_channel, "import");
 					}
 				}
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(oglobals.session), SWITCH_LOG_DEBUG, "Originate Resulted in Success: [%s]\n", 
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(oglobals.session), SWITCH_LOG_DEBUG, "Originate Resulted in Success: [%s]\n",
 								  switch_channel_get_name(peer_channel));
 				*cause = SWITCH_CAUSE_SUCCESS;
 
@@ -2920,7 +3117,7 @@
 				}
 
 				if (peer_channel) {
-					*cause = switch_channel_get_cause(peer_channel);					
+					*cause = switch_channel_get_cause(peer_channel);
 				} else {
 					for (i = 0; i < and_argc; i++) {
 						if (!originate_status[i].peer_channel) {
@@ -2930,23 +3127,23 @@
 						break;
 					}
 				}
-				
+
 				if (cdr_var) {
 					for (i = 0; i < and_argc; i++) {
 						switch_channel_t *channel;
 
 						if (!originate_status[i].peer_session) {
-                            continue;
-                        }
+							continue;
+						}
 
 						channel = switch_core_session_get_channel(originate_status[i].peer_session);
-						
+
 						switch_channel_wait_for_state_timeout(channel, CS_REPORTING, 5000);
-						
+
 						if (!switch_channel_test_flag(channel, CF_TIMESTAMP_SET)) {
 							switch_channel_set_timestamps(channel);
 						}
-						
+
 						if (switch_ivr_generate_xml_cdr(originate_status[i].peer_session, &cdr) == SWITCH_STATUS_SUCCESS) {
 							if ((xml_text = switch_xml_toxml(cdr, SWITCH_FALSE))) {
 								switch_snprintf(buf, sizeof(buf), "%s_%d", cdr_var, ++cdr_total);
@@ -2994,6 +3191,17 @@
 				switch_channel_set_variable(caller_channel, "originate_disposition", switch_channel_cause2str(*cause));
 			}
 
+			early_state.ready = 0;
+
+			if (oglobals.ethread) {
+				switch_status_t st;
+				switch_thread_join(&st, oglobals.ethread);
+			}
+
+			if (early_state.buffer) {
+				switch_buffer_destroy(&early_state.buffer);
+			}
+
 			if (ringback.fh) {
 				switch_core_file_close(ringback.fh);
 				ringback.fh = NULL;
@@ -3016,15 +3224,15 @@
 				if (!originate_status[i].peer_channel) {
 					continue;
 				}
-				
-				if (status == SWITCH_STATUS_SUCCESS) { 
+
+				if (status == SWITCH_STATUS_SUCCESS) {
 					switch_channel_clear_flag(originate_status[i].peer_channel, CF_ORIGINATING);
 					if (bleg && *bleg && *bleg == originate_status[i].peer_session) {
 						continue;
 					}
-				} else if ((state=switch_channel_get_state(originate_status[i].peer_channel)) < CS_HANGUP && 
+				} else if ((state = switch_channel_get_state(originate_status[i].peer_channel)) < CS_HANGUP &&
 						   switch_channel_test_flag(originate_status[i].peer_channel, CF_ORIGINATING)) {
-					if (!(state == CS_RESET || switch_channel_test_flag(originate_status[i].peer_channel, CF_TRANSFER) || 
+					if (!(state == CS_RESET || switch_channel_test_flag(originate_status[i].peer_channel, CF_TRANSFER) ||
 						  switch_channel_test_flag(originate_status[i].peer_channel, CF_REDIRECT) ||
 						  switch_channel_test_flag(originate_status[i].peer_channel, CF_BRIDGED))) {
 						switch_channel_hangup(originate_status[i].peer_channel, *cause);
@@ -3045,7 +3253,7 @@
 					for (i = 0; i < and_argc; i++) {
 						switch_channel_t *pchannel;
 						const char *cause_str;
-						
+
 						if (!originate_status[i].peer_session) {
 							continue;
 						}
@@ -3079,9 +3287,9 @@
 	}
 
 	if (*bleg) {
-		if (session && caller_channel && !switch_channel_get_originatee_caller_profile(caller_channel)) {
+		if (session && caller_channel) {
 			switch_caller_profile_t *cloned_profile, *peer_profile = switch_channel_get_caller_profile(switch_core_session_get_channel(*bleg));
-			
+
 			if (peer_profile) {
 				if ((cloned_profile = switch_caller_profile_clone(session, peer_profile)) != 0) {
 					switch_channel_set_originatee_caller_profile(caller_channel, cloned_profile);
@@ -3102,7 +3310,7 @@
 
 	switch_safe_free(write_frame.data);
 	switch_safe_free(fail_on_single_reject_var);
-	
+
 	if (caller_channel) {
 		switch_channel_clear_flag(caller_channel, CF_ORIGINATOR);
 		switch_channel_clear_flag(caller_channel, CF_XFER_ZOMBIE);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_ivr_play_say.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_ivr_play_say.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_ivr_play_say.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -185,7 +185,7 @@
 		old_sound_prefix = p;
 		switch_channel_set_variable(channel, "sound_prefix", sound_path);
 	}
-	
+
 	if (!(macro = switch_xml_child(language, "macro"))) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't find any macro tags.\n");
 		goto done;
@@ -269,9 +269,10 @@
 					} else {
 						odata = expanded;
 					}
-					
-					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Handle %s:[%s] (%s:%s)\n", func, odata, chan_lang, module_name);
 
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Handle %s:[%s] (%s:%s)\n", func, odata, chan_lang,
+									  module_name);
+
 					if (!strcasecmp(func, "play-file")) {
 						status = switch_ivr_play_file(session, NULL, odata, args);
 					} else if (!strcasecmp(func, "phrase")) {
@@ -357,7 +358,7 @@
 		input = input->next;
 	}
 
- done:
+  done:
 
 	if (hint_data) {
 		switch_event_destroy(&hint_data);
@@ -393,15 +394,22 @@
 	uint32_t org_silence_hits = 0;
 	int asis = 0;
 	int waste_resources = 0;
-    switch_codec_implementation_t read_impl = {0};
+	switch_codec_implementation_t read_impl = { 0 };
 	switch_frame_t write_frame = { 0 };
 	unsigned char write_buf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 };
 	switch_event_t *event;
 	int divisor = 0;
 	int file_flags = SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT;
+	const char *prefix;
 
-    switch_core_session_get_read_impl(session, &read_impl);
+	prefix = switch_channel_get_variable(channel, "sound_prefix");
 
+	if (!prefix) {
+		prefix = SWITCH_GLOBAL_dirs.sounds_dir;
+	}
+
+	switch_core_session_get_read_impl(session, &read_impl);
+
 	if (!(divisor = read_impl.actual_samples_per_second / 8000)) {
 		divisor = 1;
 	}
@@ -414,7 +422,7 @@
 	if (switch_channel_answer(channel) != SWITCH_STATUS_SUCCESS) {
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	if (!switch_channel_media_ready(channel)) {
 		return SWITCH_STATUS_FALSE;
 	}
@@ -438,7 +446,7 @@
 
 
 	if ((vval = switch_channel_get_variable(channel, "record_waste_resources"))) {
-	
+
 		if (switch_true(vval)) {
 			waste_resources = 1400;
 		} else {
@@ -465,17 +473,10 @@
 			return SWITCH_STATUS_FALSE;
 		}
 	}
-	
+
 	if (!strstr(file, SWITCH_URL_SEPARATOR)) {
 		char *ext;
-		const char *prefix;
 
-		prefix = switch_channel_get_variable(channel, "sound_prefix");
-
-		if (!prefix) {
-			prefix = SWITCH_GLOBAL_dirs.base_dir;
-		}
-		
 		if (!switch_is_file_path(file)) {
 			char *tfile = NULL;
 			char *e;
@@ -489,7 +490,7 @@
 					tfile = NULL;
 				}
 			}
-			
+
 			file = switch_core_session_sprintf(session, "%s%s%s%s%s", switch_str_nil(tfile), tfile ? "]" : "", prefix, SWITCH_PATH_SEPARATOR, file);
 		}
 		if ((ext = strrchr(file, '.'))) {
@@ -510,12 +511,11 @@
 		file_flags |= SWITCH_FILE_WRITE_APPEND;
 	}
 
+	if (!fh->prefix) {
+		fh->prefix = prefix;
+	}
 
-	if (switch_core_file_open(fh,
-							  file,
-							  fh->channels,
-							  read_impl.actual_samples_per_second,
-							  file_flags, NULL) != SWITCH_STATUS_SUCCESS) {
+	if (switch_core_file_open(fh, file, fh->channels, read_impl.actual_samples_per_second, file_flags, NULL) != SWITCH_STATUS_SUCCESS) {
 		switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 		switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
 		return SWITCH_STATUS_GENERR;
@@ -586,7 +586,7 @@
 	if (limit) {
 		start = switch_epoch_time_now(NULL);
 	}
-	
+
 	if (fh->thresh) {
 		if (asis) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Can't detect silence on a native recording.\n");
@@ -629,9 +629,9 @@
 
 		if (args && (args->input_callback || args->buf || args->buflen)) {
 			/*
-			  dtmf handler function you can hook up to be executed when a digit is dialed during playback 
-			  if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
-			*/
+			   dtmf handler function you can hook up to be executed when a digit is dialed during playback 
+			   if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
+			 */
 			if (switch_channel_has_dtmf(channel)) {
 				if (!args->input_callback && !args->buf) {
 					status = SWITCH_STATUS_BREAK;
@@ -697,7 +697,7 @@
 		if (!switch_test_flag(fh, SWITCH_FILE_PAUSE) && !switch_test_flag(read_frame, SFF_CNG)) {
 			int16_t *data = read_frame->data;
 			len = (switch_size_t) asis ? read_frame->datalen : read_frame->datalen / 2;
-			
+
 			if (switch_core_file_write(fh, data, &len) != SWITCH_STATUS_SUCCESS) {
 				break;
 			}
@@ -724,7 +724,7 @@
 
 	switch_core_file_close(fh);
 
-	if (read_impl.samples_per_second)  {
+	if (read_impl.samples_per_second) {
 		switch_channel_set_variable_printf(channel, "record_seconds", "%d", fh->samples_out / read_impl.samples_per_second);
 		switch_channel_set_variable_printf(channel, "record_ms", "%d", fh->samples_out / (read_impl.samples_per_second / 1000));
 
@@ -761,8 +761,8 @@
 	switch_frame_t write_frame = { 0 };
 	switch_byte_t data[SWITCH_RECOMMENDED_BUFFER_SIZE];
 	switch_channel_t *channel = switch_core_session_get_channel(session);
-	switch_codec_implementation_t read_impl = {0};
-    switch_core_session_get_read_impl(session, &read_impl);
+	switch_codec_implementation_t read_impl = { 0 };
+	switch_core_session_get_read_impl(session, &read_impl);
 
 	if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
 		return SWITCH_STATUS_FALSE;
@@ -825,9 +825,9 @@
 
 		if (args && (args->input_callback || args->buf || args->buflen)) {
 			/*
-			  dtmf handler function you can hook up to be executed when a digit is dialed during gentones 
-			  if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
-			*/
+			   dtmf handler function you can hook up to be executed when a digit is dialed during gentones 
+			   if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
+			 */
 			if (switch_channel_has_dtmf(channel)) {
 				if (!args->input_callback && !args->buf) {
 					status = SWITCH_STATUS_BREAK;
@@ -911,14 +911,14 @@
 	int eof = 0;
 	switch_size_t bread = 0;
 	int l16 = 0;
-    switch_codec_implementation_t read_impl = {0};
+	switch_codec_implementation_t read_impl = { 0 };
 	char *file_dup;
 	char *argv[128] = { 0 };
 	int argc;
 	int cur;
 	int done = 0;
 
-    switch_core_session_get_read_impl(session, &read_impl);
+	switch_core_session_get_read_impl(session, &read_impl);
 
 	if ((play_delimiter_val = switch_channel_get_variable(channel, "playback_delimiter"))) {
 		play_delimiter = *play_delimiter_val;
@@ -946,27 +946,27 @@
 		l16++;
 	}
 
-	
+
 	if (play_delimiter) {
 		file_dup = switch_core_session_strdup(session, file);
 		argc = switch_separate_string(file_dup, play_delimiter, argv, (sizeof(argv) / sizeof(argv[0])));
 	} else {
 		argc = 1;
-		argv[0] = (char *)file;
+		argv[0] = (char *) file;
 	}
 
-	for(cur = 0; switch_channel_ready(channel) && !done && cur < argc; cur++) {
+	for (cur = 0; switch_channel_ready(channel) && !done && cur < argc; cur++) {
 		file = argv[cur];
 		asis = 0;
 		eof = 0;
-		
+
 		if (cur) {
 			fh->samples = sample_start = 0;
 			if (sleep_val_i) {
 				switch_ivr_sleep(session, sleep_val_i, SWITCH_FALSE, args);
 			}
 		}
-		
+
 		status = SWITCH_STATUS_SUCCESS;
 
 		if ((alt = strchr(file, ':'))) {
@@ -1058,7 +1058,7 @@
 			}
 		}
 
-	
+
 		if (!fh) {
 			fh = &lfh;
 			memset(fh, 0, sizeof(lfh));
@@ -1075,13 +1075,17 @@
 				fh->prebuf = maybe;
 			}
 		}
-		
+
+
+		if (!fh->prefix) {
+			fh->prefix = prefix;
+		}
+
 		if (switch_core_file_open(fh,
 								  file,
 								  read_impl.number_of_channels,
-								  read_impl.actual_samples_per_second,
-								  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
-			switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
+								  read_impl.actual_samples_per_second, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
+			switch_core_session_reset(session, SWITCH_TRUE, SWITCH_FALSE);
 			status = SWITCH_STATUS_NOTFOUND;
 			continue;
 		}
@@ -1153,13 +1157,13 @@
 										   interval, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, pool) == SWITCH_STATUS_SUCCESS) {
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
 									  SWITCH_LOG_DEBUG, "Codec Activated %s@%uhz %u channels %dms\n", codec_name, fh->samplerate, fh->channels, interval);
-				
 
+
 				} else {
 					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG,
 									  "Raw Codec Activation Failed %s@%uhz %u channels %dms\n", codec_name, fh->samplerate, fh->channels, interval);
 					switch_core_file_close(fh);
-					switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
+					switch_core_session_reset(session, SWITCH_TRUE, SWITCH_FALSE);
 					status = SWITCH_STATUS_GENERR;
 					continue;
 				}
@@ -1179,7 +1183,7 @@
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Setup timer failed!\n");
 				switch_core_codec_destroy(&codec);
 				switch_core_file_close(fh);
-				switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
+				switch_core_session_reset(session, SWITCH_TRUE, SWITCH_FALSE);
 				status = SWITCH_STATUS_GENERR;
 				continue;
 			}
@@ -1200,27 +1204,27 @@
 
 			if (!switch_channel_ready(channel)) {
 				status = SWITCH_STATUS_FALSE;
-				break; 
+				break;
 			}
 
 			if (switch_channel_test_flag(channel, CF_BREAK)) {
 				switch_channel_clear_flag(channel, CF_BREAK);
 				status = SWITCH_STATUS_BREAK;
-				break; 
+				break;
 			}
 
 			switch_ivr_parse_all_events(session);
 
 			if (args && (args->input_callback || args->buf || args->buflen)) {
 				/*
-				  dtmf handler function you can hook up to be executed when a digit is dialed during playback 
-				  if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
-				*/
+				   dtmf handler function you can hook up to be executed when a digit is dialed during playback 
+				   if you return anything but SWITCH_STATUS_SUCCESS the playback will stop.
+				 */
 				if (switch_channel_has_dtmf(channel)) {
 					if (!args->input_callback && !args->buf) {
 						status = SWITCH_STATUS_BREAK;
 						done = 1;
-						break; 
+						break;
 					}
 					switch_channel_dequeue_dtmf(channel, &dtmf);
 					if (args->input_callback) {
@@ -1242,7 +1246,7 @@
 
 				if (status != SWITCH_STATUS_SUCCESS) {
 					done = 1;
-					break; 
+					break;
 				}
 			}
 
@@ -1258,7 +1262,7 @@
 					if (eof) {
 						continue;
 					} else {
-						break; 
+						break;
 					}
 				}
 
@@ -1271,7 +1275,7 @@
 			} else if (fh->audio_buffer && (eof || (switch_buffer_inuse(fh->audio_buffer) > (switch_size_t) (framelen)))) {
 				if (!(bread = switch_buffer_read(fh->audio_buffer, abuf, framelen))) {
 					if (eof) {
-						break; 
+						break;
 					} else {
 						continue;
 					}
@@ -1302,7 +1306,7 @@
 			}
 
 			if (done || olen <= 0) {
-				break; 
+				break;
 			}
 
 			if (!asis) {
@@ -1405,18 +1409,18 @@
 				continue;
 			} else if (status != SWITCH_STATUS_SUCCESS) {
 				done = 1;
-				break; 
+				break;
 			}
 
 			if (done) {
-				break; 
+				break;
 			}
 
 			if (timer_name) {
 				if (switch_core_timer_next(&timer) != SWITCH_STATUS_SUCCESS) {
-					break; 
+					break;
 				}
-			} else {				/* time off the channel (if you must) */
+			} else {			/* time off the channel (if you must) */
 				switch_frame_t *read_frame;
 				switch_status_t tstatus;
 				while (switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_HOLD)) {
@@ -1426,7 +1430,7 @@
 				tstatus = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
 
 				if (!SWITCH_READ_ACCEPTABLE(tstatus)) {
-					break; 
+					break;
 				}
 
 				if (args && (args->read_frame_callback)) {
@@ -1437,19 +1441,17 @@
 					}
 					switch_clear_flag(fh, SWITCH_FILE_CALLBACK);
 					if (!ok) {
-						break; 
+						break;
 					}
 				}
 			}
 		}
 
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "done playing file\n");
-		
+
 		if (read_impl.samples_per_second) {
-			switch_channel_set_variable_printf(channel, "playback_seconds", 
-											   "%d", fh->samples_out / read_impl.samples_per_second);
-			switch_channel_set_variable_printf(channel, "playback_ms", 
-											   "%d", fh->samples_out / (read_impl.samples_per_second / 1000) );
+			switch_channel_set_variable_printf(channel, "playback_seconds", "%d", fh->samples_out / read_impl.samples_per_second);
+			switch_channel_set_variable_printf(channel, "playback_ms", "%d", fh->samples_out / (read_impl.samples_per_second / 1000));
 		}
 		switch_channel_set_variable_printf(channel, "playback_samples", "%d", fh->samples_out);
 
@@ -1458,7 +1460,7 @@
 		if (fh->audio_buffer) {
 			switch_buffer_destroy(&fh->audio_buffer);
 		}
-		
+
 		if (fh->sp_audio_buffer) {
 			switch_buffer_destroy(&fh->sp_audio_buffer);
 		}
@@ -1476,7 +1478,7 @@
 
 	switch_safe_free(abuf);
 
-	switch_core_session_reset(session, SWITCH_FALSE, SWITCH_TRUE);
+	switch_core_session_reset(session, SWITCH_FALSE, SWITCH_FALSE);
 	return status;
 }
 
@@ -1494,13 +1496,13 @@
 	int16_t *data;
 	uint32_t listening = 0;
 	int countdown = 0;
-	switch_codec_t raw_codec = {0};
+	switch_codec_t raw_codec = { 0 };
 	int16_t *abuf = NULL;
-	switch_frame_t write_frame = {0};
-	switch_file_handle_t fh = {0};
+	switch_frame_t write_frame = { 0 };
+	switch_file_handle_t fh = { 0 };
 	int32_t sample_count = 0;
-    switch_codec_implementation_t read_impl = {0};
-    switch_core_session_get_read_impl(session, &read_impl);
+	switch_codec_implementation_t read_impl = { 0 };
+	switch_core_session_get_read_impl(session, &read_impl);
 
 
 	if (timeout_ms) {
@@ -1511,9 +1513,8 @@
 		if (switch_core_file_open(&fh,
 								  file,
 								  read_impl.number_of_channels,
-								  read_impl.actual_samples_per_second,
-								  SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
-			switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
+								  read_impl.actual_samples_per_second, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) {
+			switch_core_session_reset(session, SWITCH_TRUE, SWITCH_FALSE);
 			return SWITCH_STATUS_NOTFOUND;
 		}
 		switch_zmalloc(abuf, SWITCH_RECOMMENDED_BUFFER_SIZE);
@@ -1544,7 +1545,7 @@
 	while (switch_channel_ready(channel)) {
 
 		status = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
-		
+
 		if (!SWITCH_READ_ACCEPTABLE(status)) {
 			break;
 		}
@@ -1555,21 +1556,21 @@
 				break;
 			}
 		}
-		
+
 		if (abuf) {
 			switch_size_t olen = raw_codec.implementation->samples_per_packet;
-			
+
 			if (switch_core_file_read(&fh, abuf, &olen) != SWITCH_STATUS_SUCCESS) {
-                break;
-            }
-			
-			write_frame.samples = (uint32_t)olen;
-			write_frame.datalen = (uint32_t)(olen * sizeof(int16_t));
+				break;
+			}
+
+			write_frame.samples = (uint32_t) olen;
+			write_frame.datalen = (uint32_t) (olen * sizeof(int16_t));
 			if ((status = switch_core_session_write_frame(session, &write_frame, SWITCH_IO_FLAG_NONE, 0)) != SWITCH_STATUS_SUCCESS) {
 				break;
 			}
 		}
-		
+
 		if (countdown) {
 			if (!--countdown) {
 				break;
@@ -1579,14 +1580,14 @@
 		}
 
 		data = (int16_t *) read_frame->data;
-		
+
 		for (energy = 0, j = 0, count = 0; count < read_frame->samples; count++) {
 			energy += abs(data[j++]);
 			j += channels;
 		}
-		
+
 		score = (uint32_t) (energy / (read_frame->samples / divisor));
-		
+
 		if (score >= thresh) {
 			listening++;
 		}
@@ -1603,7 +1604,7 @@
 	switch_core_session_reset(session, SWITCH_FALSE, SWITCH_TRUE);
 	switch_core_codec_destroy(&raw_codec);
 
- end:
+  end:
 
 	if (abuf) {
 		switch_core_file_close(&fh);
@@ -1618,10 +1619,7 @@
 												uint32_t max_digits,
 												const char *prompt_audio_file,
 												const char *var_name,
-												char *digit_buffer, 
-												switch_size_t digit_buffer_length, 
-												uint32_t timeout, 
-												const char *valid_terminators)
+												char *digit_buffer, switch_size_t digit_buffer_length, uint32_t timeout, const char *valid_terminators)
 {
 	switch_channel_t *channel;
 	switch_input_args_t args = { 0 };
@@ -1632,7 +1630,7 @@
 	switch_assert(session);
 
 	if (max_digits < min_digits) {
-		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, 
+		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
 						  "Max digits %u is less than Min %u, forcing Max to %u\n", max_digits, min_digits, min_digits);
 		max_digits = min_digits;
 	}
@@ -1640,6 +1638,10 @@
 	channel = switch_core_session_get_channel(session);
 	switch_channel_set_variable(channel, SWITCH_READ_RESULT_VARIABLE, NULL);
 
+	if (var_name) {
+		switch_channel_set_variable(channel, var_name, NULL);
+	}
+
 	if ((min_digits && digit_buffer_length < min_digits) || digit_buffer_length < max_digits) {
 		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Buffer too small!\n");
 		return SWITCH_STATUS_FALSE;
@@ -1691,11 +1693,11 @@
 	default:
 		switch_channel_set_variable(channel, SWITCH_READ_RESULT_VARIABLE, "failure");
 		break;
-		
+
 	}
-	
- end:
 
+  end:
+
 	if (max_digits == 1 && len == 1 && valid_terminators && strchr(valid_terminators, *digit_buffer)) {
 		*digit_buffer = '\0';
 	}
@@ -1715,25 +1717,28 @@
 														   uint32_t timeout,
 														   const char *valid_terminators,
 														   const char *prompt_audio_file,
-														   const char *bad_input_audio_file, 
+														   const char *bad_input_audio_file,
 														   const char *var_name,
-														   char *digit_buffer, 
-														   uint32_t digit_buffer_length,
-														   const char *digits_regex)
+														   char *digit_buffer, uint32_t digit_buffer_length, const char *digits_regex)
 {
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 
-	while(switch_channel_ready(channel) && max_tries) {
+	while (switch_channel_ready(channel) && max_tries) {
 		switch_status_t status;
-		
+
 		memset(digit_buffer, 0, digit_buffer_length);
 		switch_channel_flush_dtmf(channel);
-		status = switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, var_name, 
+		status = switch_ivr_read(session, min_digits, max_digits, prompt_audio_file, var_name,
 								 digit_buffer, digit_buffer_length, timeout, valid_terminators);
 		if (status == SWITCH_STATUS_TIMEOUT && strlen(digit_buffer) >= min_digits) {
 			status = SWITCH_STATUS_SUCCESS;
 		}
 
+		if (status == SWITCH_STATUS_TOO_SMALL && strlen(digit_buffer) == 0) {
+			return SWITCH_STATUS_FALSE;
+		}
+
+
 		if (status == SWITCH_STATUS_SUCCESS) {
 			if (!zstr(digit_buffer)) {
 				if (zstr(digits_regex)) {
@@ -2060,8 +2065,8 @@
 	const char *timer_name, *var;
 	cached_speech_handle_t *cache_obj = NULL;
 	int need_create = 1, need_alloc = 1;
-    switch_codec_implementation_t read_impl = {0};
-    switch_core_session_get_read_impl(session, &read_impl);
+	switch_codec_implementation_t read_impl = { 0 };
+	switch_core_session_get_read_impl(session, &read_impl);
 
 	if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) {
 		return SWITCH_STATUS_FALSE;
@@ -2096,7 +2101,7 @@
 
 	timer_name = switch_channel_get_variable(channel, "timer_name");
 
-	switch_core_session_reset(session, SWITCH_FALSE, SWITCH_TRUE);
+	switch_core_session_reset(session, SWITCH_FALSE, SWITCH_FALSE);
 	read_codec = switch_core_session_get_read_codec(session);
 
 	rate = read_impl.actual_samples_per_second;
@@ -2105,7 +2110,7 @@
 	if (need_create) {
 		memset(sh, 0, sizeof(*sh));
 		if ((status = switch_core_speech_open(sh, tts_name, voice_name, (uint32_t) rate, interval,
-									&flags, switch_core_session_get_pool(session))) != SWITCH_STATUS_SUCCESS) {
+											  &flags, switch_core_session_get_pool(session))) != SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid TTS module!\n");
 			switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
 			if (cache_obj) {
@@ -2132,7 +2137,8 @@
 								   pool) == SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Raw Codec Activated\n");
 		} else {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Raw Codec Activation Failed %s@%uhz 1 channel %dms\n", codec_name, rate, interval);
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Raw Codec Activation Failed %s@%uhz 1 channel %dms\n", codec_name,
+							  rate, interval);
 			flags = 0;
 			switch_core_speech_close(sh, &flags);
 			switch_core_session_reset(session, SWITCH_TRUE, SWITCH_TRUE);
@@ -2158,7 +2164,8 @@
 				}
 				return SWITCH_STATUS_GENERR;
 			}
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setup timer success %u bytes per %d ms!\n", sh->samples * 2, interval);
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setup timer success %u bytes per %d ms!\n", sh->samples * 2,
+							  interval);
 		}
 		/* start a thread to absorb incoming audio */
 		switch_core_service_session(session);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_loadable_module.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_loadable_module.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_loadable_module.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -53,6 +53,7 @@
 	switch_memory_pool_t *pool;
 	switch_status_t status;
 	switch_thread_t *thread;
+	switch_bool_t shutting_down;
 };
 
 struct switch_loadable_module_container {
@@ -75,7 +76,8 @@
 };
 
 static struct switch_loadable_module_container loadable_modules;
-static switch_status_t do_shutdown(switch_loadable_module_t *module, switch_bool_t shutdown, switch_bool_t unload, switch_bool_t fail_if_busy, const char **err);
+static switch_status_t do_shutdown(switch_loadable_module_t *module, switch_bool_t shutdown, switch_bool_t unload, switch_bool_t fail_if_busy,
+								   const char **err);
 static switch_status_t switch_loadable_module_load_module_ex(char *dir, char *fname, switch_bool_t runtime, switch_bool_t global, const char **err);
 
 static void *SWITCH_THREAD_FUNC switch_loadable_module_exec(switch_thread_t *thread, void *obj)
@@ -90,7 +92,7 @@
 	switch_assert(thread != NULL);
 	switch_assert(module != NULL);
 
-	for (restarts = 0; status != SWITCH_STATUS_TERM; restarts++) {
+	for (restarts = 0; status != SWITCH_STATUS_TERM && !module->shutting_down; restarts++) {
 		status = module->switch_module_runtime();
 	}
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Thread ended for %s\n", module->module_interface->module_name);
@@ -443,7 +445,7 @@
 	switch_event_t *event;
 
 	switch_mutex_lock(loadable_modules.mutex);
-	
+
 	if (old_module->module_interface->endpoint_interface) {
 		const switch_endpoint_interface_t *ptr;
 
@@ -451,12 +453,13 @@
 			if (ptr->interface_name) {
 
 				switch_core_session_hupall_endpoint(ptr, SWITCH_CAUSE_MANAGER_REQUEST);
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n", ptr->interface_name);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n",
+								  ptr->interface_name);
 				if (switch_thread_rwlock_trywrlock_timeout(ptr->rwlock, 10) == SWITCH_STATUS_SUCCESS) {
-                    switch_thread_rwlock_unlock(ptr->rwlock);
-                } else {
-                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Giving up on '%s' waiting for existing references.\n", ptr->interface_name);
-                }
+					switch_thread_rwlock_unlock(ptr->rwlock);
+				} else {
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Giving up on '%s' waiting for existing references.\n", ptr->interface_name);
+				}
 
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleting Endpoint '%s'\n", ptr->interface_name);
 				if (switch_event_create(&event, SWITCH_EVENT_MODULE_UNLOAD) == SWITCH_STATUS_SUCCESS) {
@@ -541,13 +544,14 @@
 			if (ptr->interface_name) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleting Application '%s'\n", ptr->interface_name);
 				switch_core_session_hupall_matching_var(SWITCH_CURRENT_APPLICATION_VARIABLE, ptr->interface_name, SWITCH_CAUSE_MANAGER_REQUEST);
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n", ptr->interface_name);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n",
+								  ptr->interface_name);
 				if (switch_thread_rwlock_trywrlock_timeout(ptr->rwlock, 10) == SWITCH_STATUS_SUCCESS) {
 					switch_thread_rwlock_unlock(ptr->rwlock);
 				} else {
-                    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Giving up on '%s' waiting for existing references.\n", ptr->interface_name);
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Giving up on '%s' waiting for existing references.\n", ptr->interface_name);
 				}
-				
+
 				if (switch_event_create(&event, SWITCH_EVENT_MODULE_UNLOAD) == SWITCH_STATUS_SUCCESS) {
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "application");
 					switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
@@ -567,8 +571,9 @@
 			if (ptr->interface_name) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleting API Function '%s'\n", ptr->interface_name);
 
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n", ptr->interface_name);
-				
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n",
+								  ptr->interface_name);
+
 				if (switch_thread_rwlock_trywrlock_timeout(ptr->rwlock, 10) == SWITCH_STATUS_SUCCESS) {
 					switch_thread_rwlock_unlock(ptr->rwlock);
 				} else {
@@ -595,8 +600,9 @@
 			if (ptr->interface_name) {
 				int i;
 
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n", ptr->interface_name);
-				
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n",
+								  ptr->interface_name);
+
 				if (switch_thread_rwlock_trywrlock_timeout(ptr->rwlock, 10) == SWITCH_STATUS_SUCCESS) {
 					switch_thread_rwlock_unlock(ptr->rwlock);
 				} else {
@@ -623,8 +629,9 @@
 
 			if (ptr->interface_name) {
 
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n", ptr->interface_name);
-				
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n",
+								  ptr->interface_name);
+
 				if (switch_thread_rwlock_trywrlock_timeout(ptr->rwlock, 10) == SWITCH_STATUS_SUCCESS) {
 					switch_thread_rwlock_unlock(ptr->rwlock);
 				} else {
@@ -648,8 +655,9 @@
 		for (ptr = old_module->module_interface->asr_interface; ptr; ptr = ptr->next) {
 			if (ptr->interface_name) {
 
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n", ptr->interface_name);
-				
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n",
+								  ptr->interface_name);
+
 				if (switch_thread_rwlock_trywrlock_timeout(ptr->rwlock, 10) == SWITCH_STATUS_SUCCESS) {
 					switch_thread_rwlock_unlock(ptr->rwlock);
 				} else {
@@ -673,8 +681,9 @@
 		for (ptr = old_module->module_interface->directory_interface; ptr; ptr = ptr->next) {
 			if (ptr->interface_name) {
 
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n", ptr->interface_name);
-				
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n",
+								  ptr->interface_name);
+
 				if (switch_thread_rwlock_trywrlock_timeout(ptr->rwlock, 10) == SWITCH_STATUS_SUCCESS) {
 					switch_thread_rwlock_unlock(ptr->rwlock);
 				} else {
@@ -698,8 +707,9 @@
 
 		for (ptr = old_module->module_interface->chat_interface; ptr; ptr = ptr->next) {
 			if (ptr->interface_name) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n", ptr->interface_name);
-				
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n",
+								  ptr->interface_name);
+
 				if (switch_thread_rwlock_trywrlock_timeout(ptr->rwlock, 10) == SWITCH_STATUS_SUCCESS) {
 					switch_thread_rwlock_unlock(ptr->rwlock);
 				} else {
@@ -722,8 +732,9 @@
 
 		for (ptr = old_module->module_interface->say_interface; ptr; ptr = ptr->next) {
 			if (ptr->interface_name) {
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n", ptr->interface_name);
-				
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write lock interface '%s' to wait for existing references.\n",
+								  ptr->interface_name);
+
 				if (switch_thread_rwlock_trywrlock_timeout(ptr->rwlock, 10) == SWITCH_STATUS_SUCCESS) {
 					switch_thread_rwlock_unlock(ptr->rwlock);
 				} else {
@@ -800,7 +811,7 @@
 
 	switch_safe_free(derr)
 
-	if (!interface_struct_handle) {
+		if (!interface_struct_handle) {
 		dso = switch_dso_open(path, load_global, &derr);
 	}
 
@@ -821,7 +832,7 @@
 
 		if (interface_struct_handle && interface_struct_handle->switch_api_version != SWITCH_API_VERSION) {
 			err = "Trying to load an out of date module, please rebuild the module.";
-			break;	
+			break;
 		}
 
 		if (!load_global && interface_struct_handle && switch_test_flag(interface_struct_handle, SMODF_GLOBAL_SYMBOLS)) {
@@ -958,7 +969,7 @@
 
 SWITCH_DECLARE(switch_status_t) switch_loadable_module_exists(const char *mod)
 {
-	switch_status_t status;  
+	switch_status_t status;
 
 	if (zstr(mod)) {
 		return SWITCH_STATUS_FALSE;
@@ -1001,7 +1012,7 @@
 		*err = "No such module!";
 		status = SWITCH_STATUS_FALSE;
 	}
- end:
+  end:
 	switch_mutex_unlock(loadable_modules.mutex);
 
 	if (force) {
@@ -1244,11 +1255,12 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static switch_status_t do_shutdown(switch_loadable_module_t *module, switch_bool_t shutdown, switch_bool_t unload, switch_bool_t fail_if_busy, const char **err)
+static switch_status_t do_shutdown(switch_loadable_module_t *module, switch_bool_t shutdown, switch_bool_t unload, switch_bool_t fail_if_busy,
+								   const char **err)
 {
 	int32_t flags = switch_core_flags();
 	switch_assert(module != NULL);
-	
+
 	if (fail_if_busy && module->module_interface->rwlock && switch_thread_rwlock_trywrlock(module->module_interface->rwlock) != SWITCH_STATUS_SUCCESS) {
 		if (err) {
 			*err = "Module in use.";
@@ -1257,6 +1269,8 @@
 		return SWITCH_STATUS_FALSE;
 	}
 
+	module->shutting_down = SWITCH_TRUE;
+
 	if (shutdown) {
 		switch_loadable_module_unprocess(module);
 		if (module->switch_module_shutdown) {
@@ -1271,7 +1285,7 @@
 		switch_thread_rwlock_unlock(module->module_interface->rwlock);
 	}
 
-	if (unload && module->status != SWITCH_STATUS_NOUNLOAD 	&& !(flags & SCF_VG)) {
+	if (unload && module->status != SWITCH_STATUS_NOUNLOAD && !(flags & SCF_VG)) {
 		switch_memory_pool_t *pool;
 		switch_status_t st;
 
@@ -1287,7 +1301,7 @@
 			switch_core_destroy_memory_pool(&pool);
 		}
 	}
-	
+
 	return SWITCH_STATUS_SUCCESS;
 
 }
@@ -1297,7 +1311,7 @@
 	switch_hash_index_t *hi;
 	void *val;
 	switch_loadable_module_t *module;
-	
+
 	if (!loadable_modules.module_hash) {
 		return;
 	}
@@ -1386,22 +1400,22 @@
 			PROTECT_INTERFACE(i);										\
 		}																\
 		return i;														\
-	}																	
-	
+	}
+
 HASH_FUNC(dialplan)
-HASH_FUNC(timer)
-HASH_FUNC(application)
-HASH_FUNC(api)
-HASH_FUNC(file)
-HASH_FUNC(speech)
-HASH_FUNC(asr)
-HASH_FUNC(directory)
-HASH_FUNC(chat)
+	HASH_FUNC(timer)
+	HASH_FUNC(application)
+	HASH_FUNC(api)
+	HASH_FUNC(file)
+	HASH_FUNC(speech)
+	HASH_FUNC(asr)
+	HASH_FUNC(directory)
+	HASH_FUNC(chat)
 
 
-SWITCH_DECLARE(switch_say_interface_t *) switch_loadable_module_get_say_interface(const char *name)
+	SWITCH_DECLARE(switch_say_interface_t *) switch_loadable_module_get_say_interface(const char *name)
 {
-    return switch_core_hash_find_locked(loadable_modules.say_hash, name, loadable_modules.mutex);
+	return switch_core_hash_find_locked(loadable_modules.say_hash, name, loadable_modules.mutex);
 }
 
 SWITCH_DECLARE(switch_management_interface_t *) switch_loadable_module_get_management_interface(const char *relative_oid)
@@ -1414,7 +1428,7 @@
 	switch_hash_index_t *hi;
 	void *val;
 	switch_codec_interface_t *codec_interface;
-	int i = 0;
+	int i = 0, lock = 0;
 	const switch_codec_implementation_t *imp;
 
 	switch_mutex_lock(loadable_modules.mutex);
@@ -1423,6 +1437,10 @@
 		codec_interface = (switch_codec_interface_t *) val;
 		/* Look for a 20ms implementation because it's the safest choice */
 		for (imp = codec_interface->implementations; imp; imp = imp->next) {
+			if (lock && imp->microseconds_per_packet != lock) {
+				continue;
+			}
+
 			if (imp->microseconds_per_packet / 1000 == 20) {
 				array[i++] = imp;
 				goto found;
@@ -1433,6 +1451,9 @@
 
 	  found:
 
+		if (!lock && i > 0)
+			lock = array[i - 1]->microseconds_per_packet;
+
 		if (i > arraylen) {
 			break;
 		}
@@ -1446,7 +1467,7 @@
 
 SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_implementation_t **array, int arraylen, char **prefs, int preflen)
 {
-	int x, i = 0;
+	int x, i = 0, lock = 0;
 	switch_codec_interface_t *codec_interface;
 	const switch_codec_implementation_t *imp;
 
@@ -1482,49 +1503,56 @@
 		if ((codec_interface = switch_loadable_module_get_codec_interface(name)) != 0) {
 			/* If no specific codec interval is requested opt for 20ms above all else because lots of stuff assumes it */
 			for (imp = codec_interface->implementations; imp; imp = imp->next) {
-				uint8_t match = 1;
-				
+
 				if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) {
+					if (lock && imp->microseconds_per_packet != lock) {
+						continue;
+					}
 
-					if ((!interval && (uint32_t) (imp->microseconds_per_packet / 1000) != 20) || 
+					if ((!interval && (uint32_t) (imp->microseconds_per_packet / 1000) != 20) ||
 						(interval && (uint32_t) (imp->microseconds_per_packet / 1000) != interval)) {
-						match = 0;
+						continue;
 					}
 
-					if (match && ((!rate && (uint32_t) imp->samples_per_second != 8000) || (rate && (uint32_t) imp->samples_per_second != rate))) {
-						match = 0;
+					if (((!rate && (uint32_t) imp->samples_per_second != 8000) || (rate && (uint32_t) imp->samples_per_second != rate))) {
+						continue;
 					}
 				}
 
-				if (match) {
-					array[i++] = imp;
-					goto found;
-				}
+
+				array[i++] = imp;
+				goto found;
+
 			}
 
 			/* Either looking for a specific interval or there was no interval specified and there wasn't one @20ms available */
 			for (imp = codec_interface->implementations; imp; imp = imp->next) {
-				uint8_t match = 1;
-
 				if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) {
 
+					if (lock && imp->microseconds_per_packet != lock) {
+						continue;
+					}
+
 					if (interval && (uint32_t) (imp->microseconds_per_packet / 1000) != interval) {
-						match = 0;
+						continue;
 					}
-					
-					if (match && rate && (uint32_t) imp->samples_per_second != rate) {
-						match = 0;
+
+					if (rate && (uint32_t) imp->samples_per_second != rate) {
+						continue;
 					}
 				}
 
-				if (match) {
-					array[i++] = imp;
-					goto found;
-				}
+				array[i++] = imp;
+				goto found;
+
 			}
 
 		  found:
 
+			if (!lock && i > 0) {
+				lock = array[i - 1]->microseconds_per_packet;
+			}
+
 			UNPROTECT_INTERFACE(codec_interface);
 
 			if (i > arraylen) {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_log.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_log.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_log.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -72,14 +72,20 @@
 static WORD wOldColorAttrs;
 static CONSOLE_SCREEN_BUFFER_INFO csbiInfo;
 
-static WORD 
+static WORD
 #else
-static const char*
+static const char *
 #endif
-COLORS[] = { SWITCH_SEQ_DEFAULT_COLOR, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FMAGEN, SWITCH_SEQ_FCYAN, SWITCH_SEQ_FGREEN, SWITCH_SEQ_FYELLOW };
+ 
+	
+	
+	
+	COLORS[] =
+	{ SWITCH_SEQ_DEFAULT_COLOR, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FRED, SWITCH_SEQ_FMAGEN, SWITCH_SEQ_FCYAN, SWITCH_SEQ_FGREEN,
+SWITCH_SEQ_FYELLOW };
 
 
-static switch_log_node_t* switch_log_node_alloc()
+static switch_log_node_t *switch_log_node_alloc()
 {
 	switch_log_node_t *node = NULL;
 #ifdef SWITCH_LOG_RECYCLE
@@ -97,37 +103,37 @@
 	return node;
 }
 
-SWITCH_DECLARE(switch_log_node_t*) switch_log_node_dup(const switch_log_node_t *node)
+SWITCH_DECLARE(switch_log_node_t *) switch_log_node_dup(const switch_log_node_t *node)
 {
 	switch_log_node_t *newnode = switch_log_node_alloc();
-	
+
 	*newnode = *node;
-	
+
 	if (!zstr(node->data)) {
-		newnode->data = strdup(node->data);	
+		newnode->data = strdup(node->data);
 		switch_assert(node->data);
 	}
-	
+
 	if (!zstr(node->userdata)) {
 		newnode->userdata = strdup(node->userdata);
 		switch_assert(node->userdata);
 	}
-	
+
 	return newnode;
 }
 
 SWITCH_DECLARE(void) switch_log_node_free(switch_log_node_t **pnode)
 {
 	switch_log_node_t *node;
-	
+
 	if (!pnode) {
 		return;
 	}
 
 	node = *pnode;
 
-	if (node) {		
-		switch_safe_free(node->userdata);		
+	if (node) {
+		switch_safe_free(node->userdata);
 		switch_safe_free(node->data);
 #ifdef SWITCH_LOG_RECYCLE
 		if (switch_queue_trypush(LOG_RECYCLE_QUEUE, node) != SWITCH_STATUS_SUCCESS) {
@@ -137,7 +143,7 @@
 		free(node);
 #endif
 	}
-	*pnode = NULL;	
+	*pnode = NULL;
 }
 
 SWITCH_DECLARE(const char *) switch_log_level2str(switch_log_level_t level)
@@ -186,7 +192,7 @@
 		x = atoi(str);
 
 		if (x > SWITCH_LOG_INVALID) {
-			return SWITCH_LOG_INVALID -1;
+			return SWITCH_LOG_INVALID - 1;
 		} else if (x < 0) {
 			return 0;
 		} else {
@@ -315,15 +321,15 @@
 									   const char *userdata, switch_log_level_t level, const char *fmt, ...)
 {
 	va_list ap;
-	
+
 	va_start(ap, fmt);
 	switch_log_vprintf(channel, file, func, line, userdata, level, fmt, ap);
-	va_end(ap);	
+	va_end(ap);
 }
 
 #define do_mods (LOG_QUEUE && THREAD_RUNNING)
 SWITCH_DECLARE(void) switch_log_vprintf(switch_text_channel_t channel, const char *file, const char *func, int line,
-									   const char *userdata, switch_log_level_t level, const char *fmt, va_list ap)
+										const char *userdata, switch_log_level_t level, const char *fmt, va_list ap)
 {
 	char *data = NULL;
 	char *new_fmt = NULL;
@@ -339,16 +345,24 @@
 #else
 	const char *extra_fmt = "%s [%s] %s:%d%c%s";
 #endif
+	switch_log_level_t limit_level = runtime.hard_log_level;
 
+	if (channel == SWITCH_CHANNEL_ID_SESSION && userdata) {
+		switch_core_session_t *session = (switch_core_session_t *) userdata;
+		if (limit_level < session->loglevel) {
+			limit_level = session->loglevel;
+		}
+	}
+
 	if (level > 100) {
-		if ((uint32_t)(level - 100) > runtime.debug_level) {
+		if ((uint32_t) (level - 100) > runtime.debug_level) {
 			return;
 		}
 
 		level = 7;
 	}
 
-	if (level > runtime.hard_log_level) {
+	if (level > limit_level) {
 		return;
 	}
 
@@ -362,8 +376,8 @@
 		switch_time_exp_t tm;
 
 		switch_time_exp_lt(&tm, now);
-		switch_snprintf(date, sizeof(date), "%0.4d-%0.2d-%0.2d %0.2d:%0.2d:%0.2d.%0.6d", 
-						tm.tm_year + 1900, tm.tm_mon+1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec);
+		switch_snprintf(date, sizeof(date), "%0.4d-%0.2d-%0.2d %0.2d:%0.2d:%0.2d.%0.6d",
+						tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec);
 
 		//switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d %T", &tm);
 
@@ -415,7 +429,7 @@
 
 		goto end;
 	}
-	
+
 	if (console_mods_loaded == 0 || !do_mods) {
 		if (handle) {
 			int aok = 1;
@@ -452,11 +466,11 @@
 				}
 			}
 		}
-	} 
+	}
 
 	if (do_mods && level <= MAX_LEVEL) {
 		switch_log_node_t *node = switch_log_node_alloc();
-		
+
 		node->data = data;
 		data = NULL;
 		switch_set_string(node->file, filep);
@@ -466,7 +480,11 @@
 		node->content = content;
 		node->timestamp = now;
 		node->channel = channel;
-		node->userdata = !zstr(userdata) ? strdup(userdata) : NULL;
+		if (channel == SWITCH_CHANNEL_ID_SESSION) {
+			node->userdata = userdata ? strdup(switch_core_session_get_uuid((switch_core_session_t *) userdata)) : NULL;
+		} else {
+			node->userdata = !zstr(userdata) ? strdup(userdata) : NULL;
+		}
 
 		if (switch_queue_trypush(LOG_QUEUE, node) != SWITCH_STATUS_SUCCESS) {
 			switch_log_node_free(&node);
@@ -483,7 +501,7 @@
 SWITCH_DECLARE(switch_status_t) switch_log_init(switch_memory_pool_t *pool, switch_bool_t colorize)
 {
 	switch_threadattr_t *thd_attr;;
-	
+
 	switch_assert(pool != NULL);
 
 	LOG_POOL = pool;
@@ -506,13 +524,13 @@
 
 	if (colorize) {
 #ifdef WIN32
-				hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
-				if (switch_core_get_console() == stdout && hStdout != INVALID_HANDLE_VALUE && GetConsoleScreenBufferInfo(hStdout, &csbiInfo)) {
-					wOldColorAttrs = csbiInfo.wAttributes;
-					COLORIZE = SWITCH_TRUE;
-				}
+		hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
+		if (switch_core_get_console() == stdout && hStdout != INVALID_HANDLE_VALUE && GetConsoleScreenBufferInfo(hStdout, &csbiInfo)) {
+			wOldColorAttrs = csbiInfo.wAttributes;
+			COLORIZE = SWITCH_TRUE;
+		}
 #else
-				COLORIZE = SWITCH_TRUE;
+		COLORIZE = SWITCH_TRUE;
 #endif
 	}
 

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_mprintf.c (from rev 16612, freeswitch/trunk/src/switch_mprintf.c) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_mprintf.c	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_mprintf.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,937 @@
+/*
+** The "printf" code that follows dates from the 1980's.  It is in
+** the public domain.  The original comments are included here for
+** completeness.  They are very out-of-date but might be useful as
+** an historical reference.  Most of the "enhancements" have been backed
+** out so that the functionality is now the same as standard printf().
+**
+**************************************************************************
+**
+** The following modules is an enhanced replacement for the "printf" subroutines
+** found in the standard C library.  The following enhancements are
+** supported:
+**
+**      +  Additional functions.  The standard set of "printf" functions
+**         includes printf, fprintf, sprintf, vprintf, vfprintf, and
+**         vsprintf.  This module adds the following:
+**
+**           *  snprintf -- Works like sprintf, but has an extra argument
+**                          which is the size of the buffer written to.
+**
+**           *  mprintf --  Similar to sprintf.  Writes output to memory
+**                          obtained from malloc.
+**
+**           *  xprintf --  Calls a function to dispose of output.
+**
+**           *  nprintf --  No output, but returns the number of characters
+**                          that would have been output by printf.
+**
+**           *  A v- version (ex: vsnprintf) of every function is also
+**              supplied.
+**
+**      +  A few extensions to the formatting notation are supported:
+**
+**           *  The "=" flag (similar to "-") causes the output to be
+**              be centered in the appropriately sized field.
+**
+**           *  The %b field outputs an integer in binary notation.
+**
+**           *  The %c field now accepts a precision.  The character output
+**              is repeated by the number of times the precision specifies.
+**
+**           *  The %' field works like %c, but takes as its character the
+**              next character of the format string, instead of the next
+**              argument.  For example,  printf("%.78'-")  prints 78 minus
+**              signs, the same as  printf("%.78c",'-').
+**
+**      +  When compiled using GCC on a SPARC, this version of printf is
+**         faster than the library printf for SUN OS 4.1.
+**
+**      +  All functions are fully reentrant.
+**
+*/
+/*
+ * 20090210 (stkn):
+ *    Taken from sqlite-3.3.x,
+ *    renamed SQLITE_ -> SWITCH_,
+ *    renamed visible functions to switch_*
+ *    disabled functions without extra conversion specifiers
+ */
+
+#include <switch.h>
+
+#define LONGDOUBLE_TYPE	long double
+
+/*
+** Conversion types fall into various categories as defined by the
+** following enumeration.
+*/
+#define etRADIX       1			/* Integer types.  %d, %x, %o, and so forth */
+#define etFLOAT       2			/* Floating point.  %f */
+#define etEXP         3			/* Exponentional notation. %e and %E */
+#define etGENERIC     4			/* Floating or exponential, depending on exponent. %g */
+#define etSIZE        5			/* Return number of characters processed so far. %n */
+#define etSTRING      6			/* Strings. %s */
+#define etDYNSTRING   7			/* Dynamically allocated strings. %z */
+#define etPERCENT     8			/* Percent symbol. %% */
+#define etCHARX       9			/* Characters. %c */
+/* The rest are extensions, not normally found in printf() */
+#define etCHARLIT    10			/* Literal characters.  %' */
+#define etSQLESCAPE  11			/* Strings with '\'' doubled.  %q */
+#define etSQLESCAPE2 12			/* Strings with '\'' doubled and enclosed in '',
+								   NULL pointers replaced by SQL NULL.  %Q */
+#ifdef __UNSUPPORTED__
+#define etTOKEN      13			/* a pointer to a Token structure */
+#define etSRCLIST    14			/* a pointer to a SrcList */
+#endif
+#define etPOINTER    15			/* The %p conversion */
+#define etSQLESCAPE3 16
+
+/*
+** An "etByte" is an 8-bit unsigned value.
+*/
+typedef unsigned char etByte;
+
+/*
+** Each builtin conversion character (ex: the 'd' in "%d") is described
+** by an instance of the following structure
+*/
+typedef struct et_info {		/* Information about each format field */
+	char fmttype;				/* The format field code letter */
+	etByte base;				/* The base for radix conversion */
+	etByte flags;				/* One or more of FLAG_ constants below */
+	etByte type;				/* Conversion paradigm */
+	etByte charset;				/* Offset into aDigits[] of the digits string */
+	etByte prefix;				/* Offset into aPrefix[] of the prefix string */
+} et_info;
+
+/*
+** Allowed values for et_info.flags
+*/
+#define FLAG_SIGNED  1			/* True if the value to convert is signed */
+#define FLAG_INTERN  2			/* True if for internal use only */
+#define FLAG_STRING  4			/* Allow infinity precision */
+
+
+/*
+** The following table is searched linearly, so it is good to put the
+** most frequently used conversion types first.
+*/
+static const char aDigits[] = "0123456789ABCDEF0123456789abcdef";
+static const char aPrefix[] = "-x0\000X0";
+static const et_info fmtinfo[] = {
+	{'d', 10, 1, etRADIX, 0, 0},
+	{'s', 0, 4, etSTRING, 0, 0},
+	{'g', 0, 1, etGENERIC, 30, 0},
+	{'z', 0, 6, etDYNSTRING, 0, 0},
+	{'q', 0, 4, etSQLESCAPE, 0, 0},
+	{'Q', 0, 4, etSQLESCAPE2, 0, 0},
+	{'w', 0, 4, etSQLESCAPE3, 0, 0},
+	{'c', 0, 0, etCHARX, 0, 0},
+	{'o', 8, 0, etRADIX, 0, 2},
+	{'u', 10, 0, etRADIX, 0, 0},
+	{'x', 16, 0, etRADIX, 16, 1},
+	{'X', 16, 0, etRADIX, 0, 4},
+#ifndef SWITCH_OMIT_FLOATING_POINT
+	{'f', 0, 1, etFLOAT, 0, 0},
+	{'e', 0, 1, etEXP, 30, 0},
+	{'E', 0, 1, etEXP, 14, 0},
+	{'G', 0, 1, etGENERIC, 14, 0},
+#endif
+	{'i', 10, 1, etRADIX, 0, 0},
+	{'n', 0, 0, etSIZE, 0, 0},
+	{'%', 0, 0, etPERCENT, 0, 0},
+	{'p', 16, 0, etPOINTER, 0, 1},
+#ifdef __UNSUPPORTED__
+	{'T', 0, 2, etTOKEN, 0, 0},
+	{'S', 0, 2, etSRCLIST, 0, 0},
+#endif
+};
+
+#define etNINFO  (sizeof(fmtinfo)/sizeof(fmtinfo[0]))
+
+/*
+** If SWITCH_OMIT_FLOATING_POINT is defined, then none of the floating point
+** conversions will work.
+*/
+#ifndef SWITCH_OMIT_FLOATING_POINT
+/*
+** "*val" is a double such that 0.1 <= *val < 10.0
+** Return the ascii code for the leading digit of *val, then
+** multiply "*val" by 10.0 to renormalize.
+**
+** Example:
+**     input:     *val = 3.14159
+**     output:    *val = 1.4159    function return = '3'
+**
+** The counter *cnt is incremented each time.  After counter exceeds
+** 16 (the number of significant digits in a 64-bit float) '0' is
+** always returned.
+*/
+static int et_getdigit(LONGDOUBLE_TYPE * val, int *cnt)
+{
+	int digit;
+	LONGDOUBLE_TYPE d;
+	if ((*cnt)++ >= 16)
+		return '0';
+	digit = (int) *val;
+	d = digit;
+	digit += '0';
+	*val = (*val - d) * 10.0;
+	return digit;
+}
+#endif /* SWITCH_OMIT_FLOATING_POINT */
+
+/*
+** On machines with a small stack size, you can redefine the
+** SWITCH_PRINT_BUF_SIZE to be less than 350.  But beware - for
+** smaller values some %f conversions may go into an infinite loop.
+*/
+#ifndef SWITCH_PRINT_BUF_SIZE
+# define SWITCH_PRINT_BUF_SIZE 350
+#endif
+#define etBUFSIZE SWITCH_PRINT_BUF_SIZE	/* Size of the output buffer */
+
+/*
+** The root program.  All variations call this core.
+**
+** INPUTS:
+**   func   This is a pointer to a function taking three arguments
+**            1. A pointer to anything.  Same as the "arg" parameter.
+**            2. A pointer to the list of characters to be output
+**               (Note, this list is NOT null terminated.)
+**            3. An integer number of characters to be output.
+**               (Note: This number might be zero.)
+**
+**   arg    This is the pointer to anything which will be passed as the
+**          first argument to "func".  Use it for whatever you like.
+**
+**   fmt    This is the format string, as in the usual print.
+**
+**   ap     This is a pointer to a list of arguments.  Same as in
+**          vfprint.
+**
+** OUTPUTS:
+**          The return value is the total number of characters sent to
+**          the function "func".  Returns -1 on a error.
+**
+** Note that the order in which automatic variables are declared below
+** seems to make a big difference in determining how fast this beast
+** will run.
+*/
+static int vxprintf(void (*func) (void *, const char *, int),	/* Consumer of text */
+					void *arg,	/* First argument to the consumer */
+					int useExtended,	/* Allow extended %-conversions */
+					const char *fmt,	/* Format string */
+					va_list ap	/* arguments */
+	)
+{
+	int c;						/* Next character in the format string */
+	char *bufpt;				/* Pointer to the conversion buffer */
+	int precision;				/* Precision of the current field */
+	int length;					/* Length of the field */
+	int idx;					/* A general purpose loop counter */
+	int count;					/* Total number of characters output */
+	int width;					/* Width of the current field */
+	etByte flag_leftjustify;	/* True if "-" flag is present */
+	etByte flag_plussign;		/* True if "+" flag is present */
+	etByte flag_blanksign;		/* True if " " flag is present */
+	etByte flag_alternateform;	/* True if "#" flag is present */
+	etByte flag_altform2;		/* True if "!" flag is present */
+	etByte flag_zeropad;		/* True if field width constant starts with zero */
+	etByte flag_long;			/* True if "l" flag is present */
+	etByte flag_longlong;		/* True if the "ll" flag is present */
+	etByte done;				/* Loop termination flag */
+	uint64_t longvalue;			/* Value for integer types */
+	LONGDOUBLE_TYPE realvalue;	/* Value for real types */
+	const et_info *infop;		/* Pointer to the appropriate info structure */
+	char buf[etBUFSIZE];		/* Conversion buffer */
+	char prefix;				/* Prefix character.  "+" or "-" or " " or '\0'. */
+	etByte errorflag = 0;		/* True if an error is encountered */
+	etByte xtype = 0;			/* Conversion paradigm */
+	char *zExtra;				/* Extra memory used for etTCLESCAPE conversions */
+	static const char spaces[] = "                                                                         ";
+#define etSPACESIZE (sizeof(spaces)-1)
+#ifndef SWITCH_OMIT_FLOATING_POINT
+	int exp, e2;				/* exponent of real numbers */
+	double rounder;				/* Used for rounding floating point values */
+	etByte flag_dp;				/* True if decimal point should be shown */
+	etByte flag_rtz;			/* True if trailing zeros should be removed */
+	etByte flag_exp;			/* True to force display of the exponent */
+	int nsd;					/* Number of significant digits returned */
+#endif
+
+	func(arg, "", 0);
+	count = length = 0;
+	bufpt = 0;
+	for (; (c = (*fmt)) != 0; ++fmt) {
+		if (c != '%') {
+			int amt;
+			bufpt = (char *) fmt;
+			amt = 1;
+			while ((c = (*++fmt)) != '%' && c != 0)
+				amt++;
+			(*func) (arg, bufpt, amt);
+			count += amt;
+			if (c == 0)
+				break;
+		}
+		if ((c = (*++fmt)) == 0) {
+			errorflag = 1;
+			(*func) (arg, "%", 1);
+			count++;
+			break;
+		}
+		/* Find out what flags are present */
+		flag_leftjustify = flag_plussign = flag_blanksign = flag_alternateform = flag_altform2 = flag_zeropad = 0;
+		done = 0;
+		do {
+			switch (c) {
+			case '-':
+				flag_leftjustify = 1;
+				break;
+			case '+':
+				flag_plussign = 1;
+				break;
+			case ' ':
+				flag_blanksign = 1;
+				break;
+			case '#':
+				flag_alternateform = 1;
+				break;
+			case '!':
+				flag_altform2 = 1;
+				break;
+			case '0':
+				flag_zeropad = 1;
+				break;
+			default:
+				done = 1;
+				break;
+			}
+		} while (!done && (c = (*++fmt)) != 0);
+		/* Get the field width */
+		width = 0;
+		if (c == '*') {
+			width = va_arg(ap, int);
+			if (width < 0) {
+				flag_leftjustify = 1;
+				width = -width;
+			}
+			c = *++fmt;
+		} else {
+			while (c >= '0' && c <= '9') {
+				width = width * 10 + c - '0';
+				c = *++fmt;
+			}
+		}
+		if (width > etBUFSIZE - 10) {
+			width = etBUFSIZE - 10;
+		}
+		/* Get the precision */
+		if (c == '.') {
+			precision = 0;
+			c = *++fmt;
+			if (c == '*') {
+				precision = va_arg(ap, int);
+				if (precision < 0)
+					precision = -precision;
+				c = *++fmt;
+			} else {
+				while (c >= '0' && c <= '9') {
+					precision = precision * 10 + c - '0';
+					c = *++fmt;
+				}
+			}
+		} else {
+			precision = -1;
+		}
+		/* Get the conversion type modifier */
+		if (c == 'l') {
+			flag_long = 1;
+			c = *++fmt;
+			if (c == 'l') {
+				flag_longlong = 1;
+				c = *++fmt;
+			} else {
+				flag_longlong = 0;
+			}
+		} else {
+			flag_long = flag_longlong = 0;
+		}
+		/* Fetch the info entry for the field */
+		infop = 0;
+		for (idx = 0; idx < etNINFO; idx++) {
+			if (c == fmtinfo[idx].fmttype) {
+				infop = &fmtinfo[idx];
+				if (useExtended || (infop->flags & FLAG_INTERN) == 0) {
+					xtype = infop->type;
+				} else {
+					return -1;
+				}
+				break;
+			}
+		}
+		zExtra = 0;
+		if (infop == 0) {
+			return -1;
+		}
+
+
+		/* Limit the precision to prevent overflowing buf[] during conversion */
+		if (precision > etBUFSIZE - 40 && (infop->flags & FLAG_STRING) == 0) {
+			precision = etBUFSIZE - 40;
+		}
+
+		/*
+		 ** At this point, variables are initialized as follows:
+		 **
+		 **   flag_alternateform          TRUE if a '#' is present.
+		 **   flag_altform2               TRUE if a '!' is present.
+		 **   flag_plussign               TRUE if a '+' is present.
+		 **   flag_leftjustify            TRUE if a '-' is present or if the
+		 **                               field width was negative.
+		 **   flag_zeropad                TRUE if the width began with 0.
+		 **   flag_long                   TRUE if the letter 'l' (ell) prefixed
+		 **                               the conversion character.
+		 **   flag_longlong               TRUE if the letter 'll' (ell ell) prefixed
+		 **                               the conversion character.
+		 **   flag_blanksign              TRUE if a ' ' is present.
+		 **   width                       The specified field width.  This is
+		 **                               always non-negative.  Zero is the default.
+		 **   precision                   The specified precision.  The default
+		 **                               is -1.
+		 **   xtype                       The class of the conversion.
+		 **   infop                       Pointer to the appropriate info struct.
+		 */
+		switch (xtype) {
+		case etPOINTER:
+			flag_longlong = sizeof(char *) == sizeof(int64_t);
+			flag_long = sizeof(char *) == sizeof(long int);
+			/* Fall through into the next case */
+		case etRADIX:
+			if (infop->flags & FLAG_SIGNED) {
+				int64_t v;
+				if (flag_longlong)
+					v = va_arg(ap, int64_t);
+				else if (flag_long)
+					v = va_arg(ap, long int);
+				else
+					v = va_arg(ap, int);
+				if (v < 0) {
+					longvalue = -v;
+					prefix = '-';
+				} else {
+					longvalue = v;
+					if (flag_plussign)
+						prefix = '+';
+					else if (flag_blanksign)
+						prefix = ' ';
+					else
+						prefix = 0;
+				}
+			} else {
+				if (flag_longlong)
+					longvalue = va_arg(ap, uint64_t);
+				else if (flag_long)
+					longvalue = va_arg(ap, unsigned long int);
+				else
+					longvalue = va_arg(ap, unsigned int);
+				prefix = 0;
+			}
+			if (longvalue == 0)
+				flag_alternateform = 0;
+			if (flag_zeropad && precision < width - (prefix != 0)) {
+				precision = width - (prefix != 0);
+			}
+			bufpt = &buf[etBUFSIZE - 1];
+			{
+				register const char *cset;	/* Use registers for speed */
+				register int base;
+				cset = &aDigits[infop->charset];
+				base = infop->base;
+				do {			/* Convert to ascii */
+					*(--bufpt) = cset[longvalue % base];
+					longvalue = longvalue / base;
+				} while (longvalue > 0);
+			}
+			length = &buf[etBUFSIZE - 1] - bufpt;
+			for (idx = precision - length; idx > 0; idx--) {
+				*(--bufpt) = '0';	/* Zero pad */
+			}
+			if (prefix)
+				*(--bufpt) = prefix;	/* Add sign */
+			if (flag_alternateform && infop->prefix) {	/* Add "0" or "0x" */
+				const char *pre;
+				char x;
+				pre = &aPrefix[infop->prefix];
+				if (*bufpt != pre[0]) {
+					for (; (x = (*pre)) != 0; pre++)
+						*(--bufpt) = x;
+				}
+			}
+			length = &buf[etBUFSIZE - 1] - bufpt;
+			break;
+		case etFLOAT:
+		case etEXP:
+		case etGENERIC:
+			realvalue = va_arg(ap, double);
+#ifndef SWITCH_OMIT_FLOATING_POINT
+			if (precision < 0)
+				precision = 6;	/* Set default precision */
+			if (precision > etBUFSIZE / 2 - 10)
+				precision = etBUFSIZE / 2 - 10;
+			if (realvalue < 0.0) {
+				realvalue = -realvalue;
+				prefix = '-';
+			} else {
+				if (flag_plussign)
+					prefix = '+';
+				else if (flag_blanksign)
+					prefix = ' ';
+				else
+					prefix = 0;
+			}
+			if (xtype == etGENERIC && precision > 0)
+				precision--;
+#if 0
+			/* Rounding works like BSD when the constant 0.4999 is used.  Wierd! */
+			for (idx = precision, rounder = 0.4999; idx > 0; idx--, rounder *= 0.1);
+#else
+			/* It makes more sense to use 0.5 */
+			for (idx = precision, rounder = 0.5; idx > 0; idx--, rounder *= 0.1) {
+			}
+#endif
+			if (xtype == etFLOAT)
+				realvalue += rounder;
+			/* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
+			exp = 0;
+			if (realvalue > 0.0) {
+				while (realvalue >= 1e32 && exp <= 350) {
+					realvalue *= 1e-32;
+					exp += 32;
+				}
+				while (realvalue >= 1e8 && exp <= 350) {
+					realvalue *= 1e-8;
+					exp += 8;
+				}
+				while (realvalue >= 10.0 && exp <= 350) {
+					realvalue *= 0.1;
+					exp++;
+				}
+				while (realvalue < 1e-8 && exp >= -350) {
+					realvalue *= 1e8;
+					exp -= 8;
+				}
+				while (realvalue < 1.0 && exp >= -350) {
+					realvalue *= 10.0;
+					exp--;
+				}
+				if (exp > 350 || exp < -350) {
+					bufpt = "NaN";
+					length = 3;
+					break;
+				}
+			}
+			bufpt = buf;
+			/*
+			 ** If the field type is etGENERIC, then convert to either etEXP
+			 ** or etFLOAT, as appropriate.
+			 */
+			flag_exp = xtype == etEXP;
+			if (xtype != etFLOAT) {
+				realvalue += rounder;
+				if (realvalue >= 10.0) {
+					realvalue *= 0.1;
+					exp++;
+				}
+			}
+			if (xtype == etGENERIC) {
+				flag_rtz = !flag_alternateform;
+				if (exp < -4 || exp > precision) {
+					xtype = etEXP;
+				} else {
+					precision = precision - exp;
+					xtype = etFLOAT;
+				}
+			} else {
+				flag_rtz = 0;
+			}
+			if (xtype == etEXP) {
+				e2 = 0;
+			} else {
+				e2 = exp;
+			}
+			nsd = 0;
+			flag_dp = (precision > 0) | flag_alternateform | flag_altform2;
+			/* The sign in front of the number */
+			if (prefix) {
+				*(bufpt++) = prefix;
+			}
+			/* Digits prior to the decimal point */
+			if (e2 < 0) {
+				*(bufpt++) = '0';
+			} else {
+				for (; e2 >= 0; e2--) {
+					*(bufpt++) = (char) et_getdigit(&realvalue, &nsd);
+				}
+			}
+			/* The decimal point */
+			if (flag_dp) {
+				*(bufpt++) = '.';
+			}
+			/* "0" digits after the decimal point but before the first
+			 ** significant digit of the number */
+			for (e2++; e2 < 0 && precision > 0; precision--, e2++) {
+				*(bufpt++) = '0';
+			}
+			/* Significant digits after the decimal point */
+			while ((precision--) > 0) {
+				*(bufpt++) = (char) et_getdigit(&realvalue, &nsd);
+			}
+			/* Remove trailing zeros and the "." if no digits follow the "." */
+			if (flag_rtz && flag_dp) {
+				while (bufpt[-1] == '0')
+					*(--bufpt) = 0;
+				assert(bufpt > buf);
+				if (bufpt[-1] == '.') {
+					if (flag_altform2) {
+						*(bufpt++) = '0';
+					} else {
+						*(--bufpt) = 0;
+					}
+				}
+			}
+			/* Add the "eNNN" suffix */
+			if (flag_exp || (xtype == etEXP && exp)) {
+				*(bufpt++) = aDigits[infop->charset];
+				if (exp < 0) {
+					*(bufpt++) = '-';
+					exp = -exp;
+				} else {
+					*(bufpt++) = '+';
+				}
+				if (exp >= 100) {
+					*(bufpt++) = (char) (exp / 100) + '0';	/* 100's digit */
+					exp %= 100;
+				}
+				*(bufpt++) = (char) exp / 10 + '0';	/* 10's digit */
+				*(bufpt++) = exp % 10 + '0';	/* 1's digit */
+			}
+			*bufpt = 0;
+
+			/* The converted number is in buf[] and zero terminated. Output it.
+			 ** Note that the number is in the usual order, not reversed as with
+			 ** integer conversions. */
+			length = bufpt - buf;
+			bufpt = buf;
+
+			/* Special case:  Add leading zeros if the flag_zeropad flag is
+			 ** set and we are not left justified */
+			if (flag_zeropad && !flag_leftjustify && length < width) {
+				int i;
+				int nPad = width - length;
+				for (i = width; i >= nPad; i--) {
+					bufpt[i] = bufpt[i - nPad];
+				}
+				i = prefix != 0;
+				while (nPad--)
+					bufpt[i++] = '0';
+				length = width;
+			}
+#endif
+			break;
+		case etSIZE:
+			*(va_arg(ap, int *)) = count;
+			length = width = 0;
+			break;
+		case etPERCENT:
+			buf[0] = '%';
+			bufpt = buf;
+			length = 1;
+			break;
+		case etCHARLIT:
+		case etCHARX:
+			c = buf[0] = (char) (xtype == etCHARX ? va_arg(ap, int) : *++fmt);
+			if (precision >= 0) {
+				for (idx = 1; idx < precision; idx++)
+					buf[idx] = (char) c;
+				length = precision;
+			} else {
+				length = 1;
+			}
+			bufpt = buf;
+			break;
+		case etSTRING:
+		case etDYNSTRING:
+			bufpt = va_arg(ap, char *);
+			if (bufpt == 0) {
+				bufpt = "";
+			} else if (xtype == etDYNSTRING) {
+				zExtra = bufpt;
+			}
+			length = strlen(bufpt);
+			if (precision >= 0 && precision < length)
+				length = precision;
+			break;
+		case etSQLESCAPE:
+		case etSQLESCAPE2:
+		case etSQLESCAPE3:{
+				int i, j, n, ch, isnull;
+				int needQuote;
+				char *escarg = va_arg(ap, char *);
+				isnull = escarg == 0;
+				if (isnull)
+					escarg = (xtype == etSQLESCAPE2 ? "NULL" : "(NULL)");
+				for (i = n = 0; (ch = escarg[i]) != 0; i++) {
+					if (ch == '\'' || (xtype == etSQLESCAPE3 && ch == '\\'))
+						n++;
+				}
+				needQuote = !isnull && xtype == etSQLESCAPE2;
+				n += i + 1 + needQuote * 2;
+				if (n > etBUFSIZE) {
+					bufpt = zExtra = malloc(n);
+					if (bufpt == 0)
+						return -1;
+				} else {
+					bufpt = buf;
+				}
+				j = 0;
+				if (needQuote)
+					bufpt[j++] = '\'';
+				for (i = 0; (ch = escarg[i]) != 0; i++) {
+					bufpt[j++] = (char) ch;
+					if (ch == '\'' || (xtype == etSQLESCAPE3 && ch == '\\'))
+						bufpt[j++] = (char) ch;
+				}
+				if (needQuote)
+					bufpt[j++] = '\'';
+				bufpt[j] = 0;
+				length = j;
+				/* The precision is ignored on %q and %Q */
+				/* if ( precision>=0 && precision<length ) length = precision; */
+				break;
+			}
+#ifdef __UNSUPPORTED__
+		case etTOKEN:{
+				Token *pToken = va_arg(ap, Token *);
+				if (pToken && pToken->z) {
+					(*func) (arg, (char *) pToken->z, pToken->n);
+				}
+				length = width = 0;
+				break;
+			}
+		case etSRCLIST:{
+				SrcList *pSrc = va_arg(ap, SrcList *);
+				int k = va_arg(ap, int);
+				struct SrcList_item *pItem = &pSrc->a[k];
+				assert(k >= 0 && k < pSrc->nSrc);
+				if (pItem->zDatabase && pItem->zDatabase[0]) {
+					(*func) (arg, pItem->zDatabase, strlen(pItem->zDatabase));
+					(*func) (arg, ".", 1);
+				}
+				(*func) (arg, pItem->zName, strlen(pItem->zName));
+				length = width = 0;
+				break;
+			}
+#endif
+		}						/* End switch over the format type */
+		/*
+		 ** The text of the conversion is pointed to by "bufpt" and is
+		 ** "length" characters long.  The field width is "width".  Do
+		 ** the output.
+		 */
+		if (!flag_leftjustify) {
+			register int nspace;
+			nspace = width - length;
+			if (nspace > 0) {
+				count += nspace;
+				while (nspace >= etSPACESIZE) {
+					(*func) (arg, spaces, etSPACESIZE);
+					nspace -= etSPACESIZE;
+				}
+				if (nspace > 0)
+					(*func) (arg, spaces, nspace);
+			}
+		}
+		if (length > 0) {
+			(*func) (arg, bufpt, length);
+			count += length;
+		}
+		if (flag_leftjustify) {
+			register int nspace;
+			nspace = width - length;
+			if (nspace > 0) {
+				count += nspace;
+				while (nspace >= etSPACESIZE) {
+					(*func) (arg, spaces, etSPACESIZE);
+					nspace -= etSPACESIZE;
+				}
+				if (nspace > 0)
+					(*func) (arg, spaces, nspace);
+			}
+		}
+		if (zExtra) {
+			free(zExtra);
+		}
+	}							/* End for loop over the format string */
+	return errorflag ? -1 : count;
+}								/* End of function */
+
+
+/* This structure is used to store state information about the
+** write to memory that is currently in progress.
+*/
+struct sgMprintf {
+	char *zBase;				/* A base allocation */
+	char *zText;				/* The string collected so far */
+	int nChar;					/* Length of the string so far */
+	int nTotal;					/* Output size if unconstrained */
+	int nAlloc;					/* Amount of space allocated in zText */
+	void *(*xRealloc) (void *, int);	/* Function used to realloc memory */
+};
+
+/*
+** This function implements the callback from vxprintf.
+**
+** This routine add nNewChar characters of text in zNewText to
+** the sgMprintf structure pointed to by "arg".
+*/
+static void mout(void *arg, const char *zNewText, int nNewChar)
+{
+	struct sgMprintf *pM = (struct sgMprintf *) arg;
+	pM->nTotal += nNewChar;
+	if (pM->nChar + nNewChar + 1 > pM->nAlloc) {
+		if (pM->xRealloc == 0) {
+			nNewChar = pM->nAlloc - pM->nChar - 1;
+		} else {
+			pM->nAlloc = pM->nChar + nNewChar * 2 + 1;
+			if (pM->zText == pM->zBase) {
+				pM->zText = pM->xRealloc(0, pM->nAlloc);
+				if (pM->zText && pM->nChar) {
+					memcpy(pM->zText, pM->zBase, pM->nChar);
+				}
+			} else {
+				char *zNew;
+				zNew = pM->xRealloc(pM->zText, pM->nAlloc);
+				if (zNew) {
+					pM->zText = zNew;
+				}
+			}
+		}
+	}
+	if (pM->zText) {
+		if (nNewChar > 0) {
+			memcpy(&pM->zText[pM->nChar], zNewText, nNewChar);
+			pM->nChar += nNewChar;
+		}
+		pM->zText[pM->nChar] = 0;
+	}
+}
+
+/*
+** This routine is a wrapper around xprintf() that invokes mout() as
+** the consumer.
+*/
+static char *base_vprintf(void *(*xRealloc) (void *, int),	/* Routine to realloc memory. May be NULL */
+						  int useInternal,	/* Use internal %-conversions if true */
+						  char *zInitBuf,	/* Initially write here, before mallocing */
+						  int nInitBuf,	/* Size of zInitBuf[] */
+						  const char *zFormat,	/* format string */
+						  va_list ap	/* arguments */
+	)
+{
+	struct sgMprintf sM;
+	sM.zBase = sM.zText = zInitBuf;
+	sM.nChar = sM.nTotal = 0;
+	sM.nAlloc = nInitBuf;
+	sM.xRealloc = xRealloc;
+	vxprintf(mout, &sM, useInternal, zFormat, ap);
+	if (xRealloc) {
+		if (sM.zText == sM.zBase) {
+			sM.zText = xRealloc(0, sM.nChar + 1);
+			if (sM.zText) {
+				memcpy(sM.zText, sM.zBase, sM.nChar + 1);
+			}
+		} else if (sM.nAlloc > sM.nChar + 10) {
+			char *zNew = xRealloc(sM.zText, sM.nChar + 1);
+			if (zNew) {
+				sM.zText = zNew;
+			}
+		}
+	}
+	return sM.zText;
+}
+
+/*
+** Realloc that is a real function, not a macro.
+*/
+static void *printf_realloc(void *old, int size)
+{
+	return realloc(old, size);
+}
+
+/*
+** Print into memory. Use the internal %-conversion extensions.
+*/
+SWITCH_DECLARE(char *) switch_vmprintf(const char *zFormat, va_list ap)
+{
+	char zBase[SWITCH_PRINT_BUF_SIZE];
+	return base_vprintf(printf_realloc, 1, zBase, sizeof(zBase), zFormat, ap);
+}
+
+/*
+** Print into memory. Use the internal %-conversion extensions.
+*/
+SWITCH_DECLARE(char *) switch_mprintf(const char *zFormat, ...)
+{
+	va_list ap;
+	char *z;
+	char zBase[SWITCH_PRINT_BUF_SIZE];
+	va_start(ap, zFormat);
+	z = base_vprintf(printf_realloc, 1, zBase, sizeof(zBase), zFormat, ap);
+	va_end(ap);
+	return z;
+}
+
+#ifdef __UNUSED__
+/*
+** Print into memory. Omit the internal %-conversion extensions.
+*/
+SWITCH_DECLARE(char *) switch_vmprintf(const char *zFormat, va_list ap)
+{
+	char zBase[SWITCH_PRINT_BUF_SIZE];
+	return base_vprintf(printf_realloc, 0, zBase, sizeof(zBase), zFormat, ap);
+}
+
+/*
+** Print into memory.  Omit the internal %-conversion extensions.
+*/
+SWITCH_DECLARE(char *) switch_mprintf(const char *zFormat, ...)
+{
+	va_list ap;
+	char *z;
+	char zBase[SWITCH_PRINT_BUF_SIZE];
+	va_start(ap, zFormat);
+	z = base_vprintf(printf_realloc, 0, zBase, sizeof(zBase), zFormat, ap);
+	va_end(ap);
+	return z;
+}
+
+/*
+** sqlite3_snprintf() works like snprintf() except that it ignores the
+** current locale settings.  This is important for SQLite because we
+** are not able to use a "," as the decimal point in place of "." as
+** specified by some locales.
+*/
+SWITCH_DECLARE(char *) switch_snprintf(int n, char *zBuf, const char *zFormat, ...)
+{
+	char *z;
+	va_list ap;
+
+	va_start(ap, zFormat);
+	z = base_vprintf(0, 0, zBuf, n, zFormat, ap);
+	va_end(ap);
+	return z;
+}
+#endif

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_nat.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_nat.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_nat.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -63,15 +63,15 @@
 static nat_globals_perm_t nat_globals_perm;
 
 static switch_bool_t first_init = SWITCH_TRUE;
+static switch_bool_t initialized = SWITCH_FALSE;
 
 static switch_status_t get_upnp_pubaddr(char *pub_addr)
 {
-	if (UPNP_GetExternalIPAddress(nat_globals.urls.controlURL,
-								   nat_globals.data.servicetype,
-								   pub_addr) == UPNPCOMMAND_SUCCESS) {
+	if (UPNP_GetExternalIPAddress(nat_globals.urls.controlURL, nat_globals.data.servicetype, pub_addr) == UPNPCOMMAND_SUCCESS) {
 		if (!strcmp(pub_addr, "0.0.0.0") || zstr_buf(pub_addr)) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
-							  "uPNP Device (url: %s) returned an invalid external address of '%s'.  Disabling uPNP\n", nat_globals.urls.controlURL, pub_addr);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+							  "uPNP Device (url: %s) returned an invalid external address of '%s'.  Disabling uPNP\n", nat_globals.urls.controlURL,
+							  pub_addr);
 			return SWITCH_STATUS_GENERR;
 		}
 	} else {
@@ -80,11 +80,12 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static int init_upnp (void)
+static int init_upnp(void)
 {
 	struct UPNPDev *devlist;
-	struct UPNPDev *dev;
-	char * descXML;
+	struct UPNPDev *dev = NULL;
+	struct UPNPDev *trydev = NULL;
+	char *descXML;
 	int descXMLsize = 0;
 	const char *multicastif = 0;
 	const char *minissdpdpath = 0;
@@ -96,24 +97,37 @@
 	if (devlist) {
 		dev = devlist;
 		while (dev) {
-			if (strstr (dev->st, "InternetGatewayDevice")) {
+			if (strstr(dev->st, "InternetGatewayDevice")) {
 				break;
 			}
+			if (!trydev && !switch_stristr("printer", dev->descURL)) {
+				trydev = dev;
+			}
+
 			dev = dev->pNext;
 		}
-		if (!dev) {
-			dev = devlist; /* defaulting to first device */
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No InternetGatewayDevice, using first entry as default.\n");
-		}
-		
+
+	}
+
+	if (!dev && trydev) {
+		dev = trydev; /* defaulting to first device */
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No InternetGatewayDevice, using first entry as default (%s).\n", dev->descURL);
+	} else if (devlist && !dev && !trydev) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "No InternetGatewayDevice found and I am NOT going to try your printer because printers should not route to the internet, that would be DAFT\n");
+	}
+	
+	if (dev) {
 		descXML = miniwget(dev->descURL, &descXMLsize);
-		
+
 		nat_globals.descURL = strdup(dev->descURL);
-		
+
 		if (descXML) {
-			parserootdesc (descXML, descXMLsize, &nat_globals.data);
-			free (descXML); descXML = 0;
-			GetUPNPUrls (&nat_globals.urls, &nat_globals.data, dev->descURL);
+			parserootdesc(descXML, descXMLsize, &nat_globals.data);
+			free(descXML);
+			descXML = 0;
+			GetUPNPUrls(&nat_globals.urls, &nat_globals.data, dev->descURL);
+		} else {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Unable to retrieve device description XML (%s).\n", dev->descURL);
 		}
 
 		freeUPNPDevlist(devlist);
@@ -135,7 +149,7 @@
 	fd_set fds;
 	natpmp_t natpmp;
 	const char *err = NULL;
-	
+
 	if ((r = initnatpmp(&natpmp)) < 0) {
 		err = "init failed";
 		goto end;
@@ -147,7 +161,7 @@
 	}
 
 	do {
-		struct timeval timeout = { 1, 0};
+		struct timeval timeout = { 1, 0 };
 		i++;
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking for PMP %d/%d\n", i, max);
 
@@ -164,7 +178,7 @@
 			goto end;
 		}
 		r = readnatpmpresponseorretry(&natpmp, &response);
-	} while(r == NATPMP_TRYAGAIN && i < max);
+	} while (r == NATPMP_TRYAGAIN && i < max);
 
 	if (r < 0) {
 		err = "general error";
@@ -174,10 +188,10 @@
 	pubaddr = inet_ntoa(response.pnu.publicaddress.addr);
 	switch_copy_string(pub_addr, pubaddr, IP_LEN);
 	nat_globals.nat_type = SWITCH_NAT_TYPE_PMP;
-	
+
 	closenatpmp(&natpmp);
 
- end:
+  end:
 
 	if (err) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error checking for PMP [%s]\n", err);
@@ -200,7 +214,7 @@
 {
 	char *addr = NULL;
 	switch_port_t port = 0;
-	
+
 	if (nat_globals.nat_type == SWITCH_NAT_TYPE_UPNP) {
 		addr = "239.255.255.250";
 		port = 1900;
@@ -242,13 +256,13 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-static void *SWITCH_THREAD_FUNC switch_nat_multicast_runtime(switch_thread_t *thread, void *obj)
+static void *SWITCH_THREAD_FUNC switch_nat_multicast_runtime(switch_thread_t * thread, void *obj)
 {
 	char *buf = NULL;
 	char newip[16] = "";
 	char *pos;
 	switch_event_t *event = NULL;
-	
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NAT thread started\n");
 
 	buf = (char *) malloc(MULTICAST_BUFFSIZE);
@@ -271,13 +285,13 @@
 
 			break;
 		}
-		
+
 		if (nat_globals.nat_type == SWITCH_NAT_TYPE_UPNP) {
 			/* look for our desc URL and servicetype in the packet */
 			if (strstr(buf, nat_globals.descURL) && (buf == NULL || strstr(buf, nat_globals.data.servicetype))) {
 				if ((pos = strstr(buf, "NTS:"))) {
 					pos = pos + 4;
-					while(*pos && *pos == ' ') {
+					while (*pos && *pos == ' ') {
 						pos++;
 					}
 					if (!strncmp(pos, "ssdp:alive", 10)) {
@@ -285,10 +299,12 @@
 						/* did pub ip change */
 						newip[0] = '\0';
 						if (get_upnp_pubaddr(newip) != SWITCH_STATUS_SUCCESS) {
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unable to get current pubaddr after receiving UPnP keep alive packet.\n");
+							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+											  "Unable to get current pubaddr after receiving UPnP keep alive packet.\n");
 						}
 					} else if (!strncmp(pos, "ssdp:byebye", 11)) {
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "got UPnP signoff packet.  Your NAT gateway is probably going offline.\n");
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+										  "got UPnP signoff packet.  Your NAT gateway is probably going offline.\n");
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got UPnP signoff packet: \n%s\n", buf);
 					} else {
 						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "got UNKNOWN UPnP keep alive packet: \n%s\n", buf);
@@ -301,31 +317,31 @@
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unable to get current pubaddr after receiving UPnP keep alive packet.\n");
 			}
 		}
-		
+
 		if ((strlen(newip) > 0) && strcmp(newip, "0.0.0.0") && strcmp(newip, nat_globals.pub_addr)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Public IP changed from '%s' to '%s'.\n", nat_globals.pub_addr, newip);
 			do_repub = SWITCH_TRUE;
-			
+
 			switch_event_create(&event, SWITCH_EVENT_TRAP);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "condition", "network-address-change");
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "network-address-previous-v4", nat_globals.pub_addr);
 			switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "network-address-change-v4", newip);
 			switch_event_fire(&event);
-			
+
 			switch_set_string(nat_globals.pub_addr, newip);
 			switch_nat_reinit();
 		}
-		
+
 		if (do_repub) {
 			switch_nat_republish();
-		} 
+		}
 	}
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "NAT thread ending\n");
 	nat_globals_perm.running = 0;
 
 	switch_safe_free(buf);
-	
+
 	return NULL;
 }
 
@@ -340,7 +356,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to initialize NAT thread\n");
 		return;
 	}
-	
+
 	switch_threadattr_create(&thd_attr, nat_globals_perm.pool);
 	switch_threadattr_detach_set(thd_attr, 1);
 	switch_thread_create(&nat_thread_p, thd_attr, switch_nat_multicast_runtime, NULL, nat_globals_perm.pool);
@@ -349,7 +365,7 @@
 SWITCH_DECLARE(void) switch_nat_thread_stop(void)
 {
 	/* don't do anything if no thread ptr */
-	if (!nat_thread_p ) {
+	if (!nat_thread_p) {
 		return;
 	}
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Stopping NAT Task Thread\n");
@@ -358,18 +374,18 @@
 		switch_status_t st;
 
 		nat_globals_perm.running = -1;
-		
+
 		switch_thread_join(&st, nat_thread_p);
 
 		while (nat_globals_perm.running) {
-			switch_yield(1000000); /* can take up to 5s for the thread to terminate, so wait for 10 */
+			switch_yield(1000000);	/* can take up to 5s for the thread to terminate, so wait for 10 */
 			if (++sanity > 10) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Timed out waiting for NAT Task Thread to stop\n");
 				break;
 			}
 		}
 	}
-	
+
 	nat_thread_p = NULL;
 }
 
@@ -377,16 +393,16 @@
 SWITCH_DECLARE(void) switch_nat_init(switch_memory_pool_t *pool)
 {
 	/* try free dynamic data structures prior to resetting to 0 */
-	FreeUPNPUrls(&nat_globals.urls); 
+	FreeUPNPUrls(&nat_globals.urls);
 	switch_safe_free(nat_globals.descURL);
 
 	memset(&nat_globals, 0, sizeof(nat_globals));
-	
+
 	if (first_init) {
 		memset(&nat_globals_perm, 0, sizeof(nat_globals_perm));
 		nat_globals_perm.pool = pool;
 	}
-	
+
 	switch_find_local_ip(nat_globals.pvt_addr, sizeof(nat_globals.pvt_addr), NULL, AF_INET);
 
 
@@ -398,12 +414,13 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Checking for UPnP\n");
 		init_upnp();
 	}
-	
+
 	if (nat_globals.nat_type) {
 		switch_core_set_variable("nat_public_addr", nat_globals.pub_addr);
 		switch_core_set_variable("nat_private_addr", nat_globals.pvt_addr);
 		switch_core_set_variable("nat_type", nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "pmp" : "upnp");
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "NAT detected type: %s, ExtIP: '%s'\n", nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "pmp" : "upnp", nat_globals.pub_addr);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "NAT detected type: %s, ExtIP: '%s'\n",
+						  nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "pmp" : "upnp", nat_globals.pub_addr);
 
 		if (!nat_thread_p) {
 			switch_nat_thread_start();
@@ -412,9 +429,10 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "No PMP or UPnP NAT devices detected!\n");
 	}
 	first_init = SWITCH_FALSE;
+	initialized = SWITCH_TRUE;
 }
 
-static switch_status_t switch_nat_add_mapping_pmp(switch_port_t port, switch_nat_ip_proto_t proto, switch_port_t *external_port)
+static switch_status_t switch_nat_add_mapping_pmp(switch_port_t port, switch_nat_ip_proto_t proto, switch_port_t * external_port)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	natpmpresp_t response;
@@ -422,10 +440,10 @@
 	natpmp_t natpmp;
 
 	initnatpmp(&natpmp);
-	
+
 	if (proto == SWITCH_NAT_TCP) {
 		sendnewportmappingrequest(&natpmp, NATPMP_PROTOCOL_TCP, port, port, 31104000);
-	} else if(proto == SWITCH_NAT_UDP) {
+	} else if (proto == SWITCH_NAT_UDP) {
 		sendnewportmappingrequest(&natpmp, NATPMP_PROTOCOL_UDP, port, port, 31104000);
 	}
 
@@ -437,29 +455,27 @@
 		getnatpmprequesttimeout(&natpmp, &timeout);
 		select(FD_SETSIZE, &fds, NULL, NULL, &timeout);
 		r = readnatpmpresponseorretry(&natpmp, &response);
-	} while(r == NATPMP_TRYAGAIN);
+	} while (r == NATPMP_TRYAGAIN);
 
 	if (r == 0) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mapped public port %hu protocol %s to localport %hu\n",
 						  response.pnu.newportmapping.mappedpublicport,
 						  response.type == NATPMP_RESPTYPE_UDPPORTMAPPING ? "UDP" :
-						  (response.type == NATPMP_RESPTYPE_TCPPORTMAPPING ? "TCP" : "UNKNOWN"),
-						  response.pnu.newportmapping.privateport);
+						  (response.type == NATPMP_RESPTYPE_TCPPORTMAPPING ? "TCP" : "UNKNOWN"), response.pnu.newportmapping.privateport);
 		if (external_port) {
 			*external_port = response.pnu.newportmapping.mappedpublicport;
 		} else if (response.pnu.newportmapping.mappedpublicport != response.pnu.newportmapping.privateport) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "External port %hu protocol %s was not available, it was instead mapped to %hu",
-				response.pnu.newportmapping.privateport,
-				response.type == NATPMP_RESPTYPE_UDPPORTMAPPING ? "UDP" :
-			  	(response.type == NATPMP_RESPTYPE_TCPPORTMAPPING ? "TCP" : "UNKNOWN"),
-				response.pnu.newportmapping.mappedpublicport);
+							  response.pnu.newportmapping.privateport,
+							  response.type == NATPMP_RESPTYPE_UDPPORTMAPPING ? "UDP" :
+							  (response.type == NATPMP_RESPTYPE_TCPPORTMAPPING ? "TCP" : "UNKNOWN"), response.pnu.newportmapping.mappedpublicport);
 		}
-						
+
 		status = SWITCH_STATUS_SUCCESS;
 	}
-	
+
 	closenatpmp(&natpmp);
-	
+
 	return status;
 }
 
@@ -474,7 +490,7 @@
 	if (proto == SWITCH_NAT_TCP) {
 		r = UPNP_AddPortMapping(nat_globals.urls.controlURL, nat_globals.data.servicetype, port_str, port_str,
 								nat_globals.pvt_addr, "FreeSWITCH", "TCP", 0);
-	} else if(proto == SWITCH_NAT_UDP) {
+	} else if (proto == SWITCH_NAT_UDP) {
 		r = UPNP_AddPortMapping(nat_globals.urls.controlURL, nat_globals.data.servicetype, port_str, port_str,
 								nat_globals.pvt_addr, "FreeSWITCH", "UDP", 0);
 	}
@@ -482,7 +498,7 @@
 	if (r == UPNPCOMMAND_SUCCESS) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "mapped public port %s protocol %s to localport %s\n", port_str,
 						  (proto == SWITCH_NAT_TCP) ? "TCP" : (proto == SWITCH_NAT_UDP ? "UDP" : "UNKNOWN"), port_str);
-						  status = SWITCH_STATUS_SUCCESS;
+		status = SWITCH_STATUS_SUCCESS;
 	}
 
 	return status;
@@ -494,12 +510,12 @@
 	natpmpresp_t response;
 	int r;
 	natpmp_t natpmp;
-	
+
 	initnatpmp(&natpmp);
 
 	if (proto == SWITCH_NAT_TCP) {
 		sendnewportmappingrequest(&natpmp, NATPMP_PROTOCOL_TCP, port, port, 0);
-	} else if(proto == SWITCH_NAT_UDP) {
+	} else if (proto == SWITCH_NAT_UDP) {
 		sendnewportmappingrequest(&natpmp, NATPMP_PROTOCOL_UDP, port, port, 0);
 	}
 
@@ -511,17 +527,15 @@
 		getnatpmprequesttimeout(&natpmp, &timeout);
 		select(FD_SETSIZE, &fds, NULL, NULL, &timeout);
 		r = readnatpmpresponseorretry(&natpmp, &response);
-	} while(r == NATPMP_TRYAGAIN);
+	} while (r == NATPMP_TRYAGAIN);
 
 	if (r == 0) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unmapped public port %hu protocol %s to localport %hu\n",
-						  response.pnu.newportmapping.privateport, /* This might be wrong but its so 0 isn't displayed */
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "unmapped public port %hu protocol %s to localport %hu\n", response.pnu.newportmapping.privateport,	/* This might be wrong but its so 0 isn't displayed */
 						  response.type == NATPMP_RESPTYPE_UDPPORTMAPPING ? "UDP" :
-						  (response.type == NATPMP_RESPTYPE_TCPPORTMAPPING ? "TCP" : "UNKNOWN"),
-						  response.pnu.newportmapping.privateport);
+						  (response.type == NATPMP_RESPTYPE_TCPPORTMAPPING ? "TCP" : "UNKNOWN"), response.pnu.newportmapping.privateport);
 		status = SWITCH_STATUS_SUCCESS;
 	}
-	
+
 	closenatpmp(&natpmp);
 
 	return status;
@@ -537,7 +551,7 @@
 
 	if (proto == SWITCH_NAT_TCP) {
 		r = UPNP_DeletePortMapping(nat_globals.urls.controlURL, nat_globals.data.servicetype, port_str, "TCP", 0);
-	} else if(proto == SWITCH_NAT_UDP) {
+	} else if (proto == SWITCH_NAT_UDP) {
 		r = UPNP_DeletePortMapping(nat_globals.urls.controlURL, nat_globals.data.servicetype, port_str, "UDP", 0);
 	}
 
@@ -549,11 +563,12 @@
 	return status;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_nat_add_mapping_internal(switch_port_t port, switch_nat_ip_proto_t proto, switch_port_t *external_port, switch_bool_t sticky, switch_bool_t publish)
+SWITCH_DECLARE(switch_status_t) switch_nat_add_mapping_internal(switch_port_t port, switch_nat_ip_proto_t proto, switch_port_t * external_port,
+																switch_bool_t sticky, switch_bool_t publish)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	switch_event_t *event = NULL;
-	
+
 	switch (nat_globals.nat_type) {
 	case SWITCH_NAT_TYPE_PMP:
 		status = switch_nat_add_mapping_pmp(port, proto, external_port);
@@ -568,9 +583,9 @@
 	default:
 		break;
 	}
-	
+
 	if (publish && status == SWITCH_STATUS_SUCCESS) {
-		switch_event_create(&event, SWITCH_EVENT_NAT);	
+		switch_event_create(&event, SWITCH_EVENT_NAT);
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "op", "add");
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "port", "%d", port);
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", "%d", proto);
@@ -581,7 +596,8 @@
 	return status;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_nat_add_mapping(switch_port_t port, switch_nat_ip_proto_t proto, switch_port_t *external_port, switch_bool_t sticky)
+SWITCH_DECLARE(switch_status_t) switch_nat_add_mapping(switch_port_t port, switch_nat_ip_proto_t proto, switch_port_t * external_port,
+													   switch_bool_t sticky)
 {
 	return switch_nat_add_mapping_internal(port, proto, external_port, sticky, SWITCH_TRUE);
 }
@@ -603,13 +619,13 @@
 	}
 
 	if (status == SWITCH_STATUS_SUCCESS) {
-		switch_event_create(&event, SWITCH_EVENT_NAT);	
+		switch_event_create(&event, SWITCH_EVENT_NAT);
 		switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "op", "del");
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "port", "%d", port);
 		switch_event_add_header(event, SWITCH_STACK_BOTTOM, "proto", "%d", proto);
 		switch_event_fire(&event);
 	}
-	
+
 	return status;
 }
 
@@ -622,15 +638,15 @@
 	SWITCH_STANDARD_STREAM(stream);
 
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Refreshing nat maps\n");
-	
+
 	switch_api_execute("show", "nat_map as xml", NULL, &stream);
-	
+
 	if (!(natxml = switch_xml_parse_str_dup(stream.data))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to parse XML: %s\n", (char *) stream.data);
 		switch_safe_free(stream.data);
 		return;
 	}
-	
+
 	/* iterate the xml and publish the mappings */
 	row = switch_xml_find_child(natxml, "row", "row_id", "1");
 	while (row != NULL) {
@@ -645,18 +661,18 @@
 		if ((child = switch_xml_child(row, "proto_num"))) {
 			sproto = child->txt;
 		}
-		
+
 		if (sport && sproto) {
-			port = (switch_port_t)(atoi(sport));
-			proto = (switch_nat_ip_proto_t)(atoi(sproto));
-			switch_nat_add_mapping_internal(port, proto, NULL, SWITCH_FALSE, SWITCH_FALSE); 
+			port = (switch_port_t) (atoi(sport));
+			proto = (switch_nat_ip_proto_t) (atoi(sproto));
+			switch_nat_add_mapping_internal(port, proto, NULL, SWITCH_FALSE, SWITCH_FALSE);
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to parse port/proto info: XML: %s\n", (char *) stream.data);
 		}
-	
+
 		row = switch_xml_next(row);
 	}
-	
+
 	switch_safe_free(stream.data);
 	switch_xml_free(natxml);
 }
@@ -665,16 +681,20 @@
 {
 	switch_stream_handle_t stream = { 0 };
 	SWITCH_STANDARD_STREAM(stream);
-	
-	stream.write_function(&stream, "Nat Type: %s, ExtIP: %s\n", 
-							(nat_globals.nat_type == SWITCH_NAT_TYPE_UPNP) ? "UPNP" : (nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "NAT-PMP" : "UNKNOWN"),
-							nat_globals.pub_addr);
 
+	stream.write_function(&stream, "Nat Type: %s, ExtIP: %s\n",
+						  (nat_globals.nat_type == SWITCH_NAT_TYPE_UPNP) ? "UPNP" : (nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "NAT-PMP" : "UNKNOWN"),
+						  nat_globals.pub_addr);
+
 	switch_api_execute("show", "nat_map", NULL, &stream);
-	
-	return stream.data; /* caller frees */
+
+	return stream.data;			/* caller frees */
 }
 
+SWITCH_DECLARE(switch_bool_t) switch_nat_is_initialized(void)
+{
+	return initialized;
+}
 
 SWITCH_DECLARE(void) switch_nat_shutdown(void)
 {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_odbc.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_odbc.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_odbc.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -45,7 +45,7 @@
 
 #if (ODBCVER < 0x0300)
 #define SQL_NO_DATA SQL_SUCCESS
-#endif 
+#endif
 
 struct switch_odbc_handle {
 	char *dsn;
@@ -98,7 +98,6 @@
 		switch_safe_free(new_handle->password);
 		switch_safe_free(new_handle);
 	}
-
 #endif
 	return NULL;
 }
@@ -116,7 +115,7 @@
 	if (handle->state == SWITCH_ODBC_STATE_CONNECTED) {
 		result = SQLDisconnect(handle->con);
 		if (result == SWITCH_ODBC_SUCCESS) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Disconnected %d from [%s]\n", result, handle->dsn);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Disconnected %d from [%s]\n", result, handle->dsn);
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Disconnecting [%s]\n", handle->dsn);
 		}
@@ -177,10 +176,10 @@
 		code = __LINE__;
 		goto error;
 	}
-	
-	SQLRowCount (stmt, &m);
-	rc = SQLNumResultCols (stmt, &nresultcols);
-	if (rc != SQL_SUCCESS){
+
+	SQLRowCount(stmt, &m);
+	rc = SQLNumResultCols(stmt, &nresultcols);
+	if (rc != SQL_SUCCESS) {
 		code = __LINE__;
 		goto error;
 	}
@@ -241,9 +240,9 @@
 }
 #endif
 
-SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_statement_handle_free(switch_odbc_statement_handle_t * stmt)
+SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_statement_handle_free(switch_odbc_statement_handle_t *stmt)
 {
-	if (!stmt || ! *stmt) {
+	if (!stmt || !*stmt) {
 		return SWITCH_ODBC_FAIL;
 	}
 #ifdef SWITCH_HAVE_ODBC
@@ -332,7 +331,7 @@
 	} else {
 		handle->is_firebird = FALSE;
 	}
-	
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Connected to [%s]\n", handle->dsn);
 	handle->state = SWITCH_ODBC_STATE_CONNECTED;
 	return SWITCH_ODBC_SUCCESS;
@@ -341,10 +340,7 @@
 #endif
 }
 
-SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec_string(switch_odbc_handle_t *handle,
-																	const char *sql,
-																	char *resbuf,
-																	size_t len)
+SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec_string(switch_odbc_handle_t *handle, const char *sql, char *resbuf, size_t len, char **err)
 {
 #ifdef SWITCH_HAVE_ODBC
 	switch_odbc_status_t sstatus = SWITCH_ODBC_FAIL;
@@ -352,27 +348,33 @@
 	SQLCHAR name[1024];
 	SQLLEN m = 0;
 
-	if (switch_odbc_handle_exec(handle, sql, &stmt) == SWITCH_ODBC_SUCCESS) {
+	if (switch_odbc_handle_exec(handle, sql, &stmt, err) == SWITCH_ODBC_SUCCESS) {
 		SQLSMALLINT NameLength, DataType, DecimalDigits, Nullable;
 		SQLULEN ColumnSize;
+		int result;
+
 		SQLRowCount(stmt, &m);
 
 		if (m <= 0) {
 			goto done;
 		}
 
-		if (SQLFetch(stmt) != SQL_SUCCESS) {
+		result = SQLExecute(stmt);
+		result = SQLFetch(stmt);
+
+		if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO && result != SQL_NO_DATA) {
 			goto done;
 		}
 
 		SQLDescribeCol(stmt, 1, name, sizeof(name), &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable);
 		SQLGetData(stmt, 1, SQL_C_CHAR, (SQLCHAR *) resbuf, (SQLLEN) len, NULL);
+
 		sstatus = SWITCH_ODBC_SUCCESS;
 	} else {
 		return sstatus;
 	}
 
- done:
+  done:
 	switch_odbc_statement_handle_free(&stmt);
 	return sstatus;
 #else
@@ -380,11 +382,13 @@
 #endif
 }
 
-SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_t *handle, const char *sql, switch_odbc_statement_handle_t * rstmt)
+SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_exec(switch_odbc_handle_t *handle, const char *sql, switch_odbc_statement_handle_t *rstmt,
+															 char **err)
 {
 #ifdef SWITCH_HAVE_ODBC
 	SQLHSTMT stmt = NULL;
 	int result;
+	char *err_str = NULL;
 
 	if (!db_is_up(handle)) {
 		goto error;
@@ -413,6 +417,22 @@
 	return SWITCH_ODBC_SUCCESS;
 
   error:
+
+	if (stmt) {
+		err_str = switch_odbc_handle_get_error(handle, stmt);
+	}
+
+	if (err_str) {
+		if (!switch_stristr("already exists", err_str) && !switch_stristr("duplicate key name", err_str)) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, switch_str_nil(err_str));
+		}
+		if (err) {
+			*err = err_str;
+		} else {
+			free(err_str);
+		}
+	}
+
 	if (rstmt) {
 		*rstmt = stmt;
 	} else if (stmt) {
@@ -424,7 +444,8 @@
 
 SWITCH_DECLARE(switch_odbc_status_t) switch_odbc_handle_callback_exec_detailed(const char *file, const char *func, int line,
 																			   switch_odbc_handle_t *handle,
-																			   const char *sql, switch_core_db_callback_func_t callback, void *pdata, char **err)
+																			   const char *sql, switch_core_db_callback_func_t callback, void *pdata,
+																			   char **err)
 {
 #ifdef SWITCH_HAVE_ODBC
 	SQLHSTMT stmt = NULL;
@@ -461,16 +482,16 @@
 	SQLRowCount(stmt, &m);
 
 
-	while(!done) {
+	while (!done) {
 		int name_len = 256;
 		char **names;
 		char **vals;
 		int y = 0;
-		
+
 		result = SQLFetch(stmt);
 
 		if (result != SQL_SUCCESS) {
-			if (result != SQL_NO_DATA){
+			if (result != SQL_NO_DATA) {
 				err_cnt++;
 			}
 			break;
@@ -511,14 +532,14 @@
 		free(names);
 		free(vals);
 	}
-	
+
 	SQLFreeHandle(SQL_HANDLE_STMT, stmt);
 
 	if (!err_cnt) {
 		return SWITCH_ODBC_SUCCESS;
 	}
 
- error:
+  error:
 
 	if (stmt) {
 		err_str = switch_odbc_handle_get_error(handle, stmt);
@@ -533,7 +554,6 @@
 			free(err_str);
 		}
 	}
-	
 
 #endif
 	return SWITCH_ODBC_FAIL;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_pcm.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_pcm.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_pcm.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -59,7 +59,8 @@
 										 switch_codec_t *other_codec,
 										 void *decoded_data,
 										 uint32_t decoded_data_len,
-										 uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, unsigned int *flag)
+										 uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate,
+										 unsigned int *flag)
 {
 	/* NOOP indicates that the audio in is already the same as the audio out, so no conversion was necessary. */
 	if (codec && other_codec && codec->implementation && other_codec->implementation &&
@@ -75,7 +76,8 @@
 										 switch_codec_t *other_codec,
 										 void *encoded_data,
 										 uint32_t encoded_data_len,
-										 uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, unsigned int *flag)
+										 uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate,
+										 unsigned int *flag)
 {
 	if (codec && other_codec && codec->implementation && other_codec->implementation &&
 		codec->implementation->actual_samples_per_second != other_codec->implementation->actual_samples_per_second) {
@@ -266,55 +268,51 @@
 }
 
 
-static void mod_g711_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool)
+static void mod_g711_load(switch_loadable_module_interface_t ** module_interface, switch_memory_pool_t *pool)
 {
 	switch_codec_interface_t *codec_interface;
 	int mpf = 10000, spf = 80, bpf = 160, ebpf = 80, count;
 
 	SWITCH_ADD_CODEC(codec_interface, "G.711 ulaw");
 	for (count = 12; count > 0; count--) {
-		switch_core_codec_add_implementation(pool,
-											 codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 0,							/* the IANA code number */
-											 "PCMU",					/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 8000,						/* samples transferred per second */
-											 8000,						/* actual samples transferred per second */
-											 64000,						/* bits transferred per second */
-											 mpf * count,				/* number of microseconds per frame */
-											 spf * count,				/* number of samples per frame */
-											 bpf * count,				/* number of bytes per frame decompressed */
-											 ebpf * count,				/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 spf * count,				/* number of frames per network packet */
-											 switch_g711u_init,			/* function to initialize a codec handle using this implementation */
-											 switch_g711u_encode,		/* function to encode raw data into encoded data */
-											 switch_g711u_decode,		/* function to decode encoded data into raw data */
-											 switch_g711u_destroy);		/* deinitalize a codec handle using this implementation */
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 0,	/* the IANA code number */
+											 "PCMU",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 8000,	/* samples transferred per second */
+											 8000,	/* actual samples transferred per second */
+											 64000,	/* bits transferred per second */
+											 mpf * count,	/* number of microseconds per frame */
+											 spf * count,	/* number of samples per frame */
+											 bpf * count,	/* number of bytes per frame decompressed */
+											 ebpf * count,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 spf * count,	/* number of frames per network packet */
+											 switch_g711u_init,	/* function to initialize a codec handle using this implementation */
+											 switch_g711u_encode,	/* function to encode raw data into encoded data */
+											 switch_g711u_decode,	/* function to decode encoded data into raw data */
+											 switch_g711u_destroy);	/* deinitalize a codec handle using this implementation */
 	}
 
 	SWITCH_ADD_CODEC(codec_interface, "G.711 alaw");
 	for (count = 12; count > 0; count--) {
-		switch_core_codec_add_implementation(pool,
-											 codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 8,							/* the IANA code number */
-											 "PCMA",					/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 8000,						/* samples transferred per second */
-											 8000,						/* actual samples transferred per second */
-											 64000,						/* bits transferred per second */
-											 mpf * count,				/* number of microseconds per frame */
-											 spf * count,				/* number of samples per frame */
-											 bpf * count,				/* number of bytes per frame decompressed */
-											 ebpf * count,				/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 spf * count,				/* number of frames per network packet */
-											 switch_g711a_init,			/* function to initialize a codec handle using this implementation */
-											 switch_g711a_encode,		/* function to encode raw data into encoded data */
-											 switch_g711a_decode,		/* function to decode encoded data into raw data */
-											 switch_g711a_destroy);		/* deinitalize a codec handle using this implementation */
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 8,	/* the IANA code number */
+											 "PCMA",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 8000,	/* samples transferred per second */
+											 8000,	/* actual samples transferred per second */
+											 64000,	/* bits transferred per second */
+											 mpf * count,	/* number of microseconds per frame */
+											 spf * count,	/* number of samples per frame */
+											 bpf * count,	/* number of bytes per frame decompressed */
+											 ebpf * count,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 spf * count,	/* number of frames per network packet */
+											 switch_g711a_init,	/* function to initialize a codec handle using this implementation */
+											 switch_g711a_encode,	/* function to encode raw data into encoded data */
+											 switch_g711a_decode,	/* function to decode encoded data into raw data */
+											 switch_g711a_destroy);	/* deinitalize a codec handle using this implementation */
 	}
 }
 
@@ -322,52 +320,49 @@
 {
 	switch_codec_interface_t *codec_interface;
 	int mpf = 10000, spf = 80, bpf = 160, ebpf = 160, bps = 128000, rate = 8000, counta = 1, countb = 12;
-	switch_payload_t ianacode[4] = { 0, 10, 117, 119 };
 	int samples_per_frame, bytes_per_frame, ms_per_frame, x;
 
 	/* connect my internal structure to the blank pointer passed to me */
 	*module_interface = switch_loadable_module_create_module_interface(pool, modname);
 
 	SWITCH_ADD_CODEC(codec_interface, "PROXY VIDEO PASS-THROUGH");
-	switch_core_codec_add_implementation(pool, codec_interface,
-										 SWITCH_CODEC_TYPE_VIDEO,	/* enumeration defining the type of the codec */
-										 31,						/* the IANA code number */
-										 "PROXY-VID",				/* the IANA code name */
-										 NULL,						/* default fmtp to send (can be overridden by the init function) */
-										 90000,						/* samples transferred per second */
-										 90000,						/* actual samples transferred per second */
-										 0,							/* bits transferred per second */ 
-										 0,							/* number of microseconds per frame */
-										 0,							/* number of samples per frame */
-										 0,							/* number of bytes per frame decompressed */
-										 0,							/* number of bytes per frame compressed */
-										 1,							/* number of channels represented */ 
-										 1,							/* number of frames per network packet */
-										 switch_proxy_init,			/* function to initialize a codec handle using this implementation */
-										 switch_proxy_encode,		/* function to encode raw data into encoded data */
-										 switch_proxy_decode,		/* function to encode raw data into encoded data */
-										 switch_proxy_destroy);		/* deinitalize a codec handle using this implementation */
+	switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_VIDEO,	/* enumeration defining the type of the codec */
+										 31,	/* the IANA code number */
+										 "PROXY-VID",	/* the IANA code name */
+										 NULL,	/* default fmtp to send (can be overridden by the init function) */
+										 90000,	/* samples transferred per second */
+										 90000,	/* actual samples transferred per second */
+										 0,	/* bits transferred per second */
+										 0,	/* number of microseconds per frame */
+										 0,	/* number of samples per frame */
+										 0,	/* number of bytes per frame decompressed */
+										 0,	/* number of bytes per frame compressed */
+										 1,	/* number of channels represented */
+										 1,	/* number of frames per network packet */
+										 switch_proxy_init,	/* function to initialize a codec handle using this implementation */
+										 switch_proxy_encode,	/* function to encode raw data into encoded data */
+										 switch_proxy_decode,	/* function to encode raw data into encoded data */
+										 switch_proxy_destroy);	/* deinitalize a codec handle using this implementation */
 
 
 	SWITCH_ADD_CODEC(codec_interface, "PROXY PASS-THROUGH");
-	switch_core_codec_add_implementation(pool, codec_interface,
-										 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-										 0,							/* the IANA code number */
-										 "PROXY",					/* the IANA code name */
-										 NULL,						/* default fmtp to send (can be overridden by the init function) */
-										 8000,						/* samples transferred per second */
-										 8000,						/* actual samples transferred per second */
-										 0,							/* bits transferred per second */
-										 20000,						/* number of microseconds per frame */
-										 160,						/* number of samples per frame */
-										 320,						/* number of bytes per frame decompressed */
-										 320,						/* number of bytes per frame compressed */
-										 1,							/* number of channels represented */
-										 1,							/* number of frames per network packet */
-										 switch_proxy_init,			/* function to initialize a codec handle using this implementation */
-										 switch_proxy_encode,		/* function to encode raw data into encoded data */
-										 switch_proxy_decode,		/* function to decode encoded data into raw data */
-										 switch_proxy_destroy);		/* deinitalize a codec handle using this implementation */
+	switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+										 0,	/* the IANA code number */
+										 "PROXY",	/* the IANA code name */
+										 NULL,	/* default fmtp to send (can be overridden by the init function) */
+										 8000,	/* samples transferred per second */
+										 8000,	/* actual samples transferred per second */
+										 0,	/* bits transferred per second */
+										 20000,	/* number of microseconds per frame */
+										 160,	/* number of samples per frame */
+										 320,	/* number of bytes per frame decompressed */
+										 320,	/* number of bytes per frame compressed */
+										 1,	/* number of channels represented */
+										 1,	/* number of frames per network packet */
+										 switch_proxy_init,	/* function to initialize a codec handle using this implementation */
+										 switch_proxy_encode,	/* function to encode raw data into encoded data */
+										 switch_proxy_decode,	/* function to decode encoded data into raw data */
+										 switch_proxy_destroy);	/* deinitalize a codec handle using this implementation */
 
 	SWITCH_ADD_CODEC(codec_interface, "RAW Signed Linear (16 bit)");
 
@@ -379,7 +374,7 @@
 		}
 		for (; countb > 0; countb--) {
 			switch_core_codec_add_implementation(pool, codec_interface,
-												 SWITCH_CODEC_TYPE_AUDIO, ianacode[counta], "L16", NULL, rate, rate, bps,
+												 SWITCH_CODEC_TYPE_AUDIO, 10, "L16", NULL, rate, rate, bps,
 												 mpf * countb, spf * countb, bpf * countb, ebpf * countb, 1, spf * countb,
 												 switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy);
 		}
@@ -389,6 +384,65 @@
 		bpf = bpf * 2;
 		ebpf = ebpf * 2;
 	}
+
+	samples_per_frame = 240;
+	bytes_per_frame = 480;
+	ms_per_frame = 20000;
+
+	for (x = 0; x < 5; x++) {
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 10,	/* the IANA code number */
+											 "L16",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 12000,	/* samples transferred per second */
+											 12000,	/* actual samples transferred per second */
+											 192000,	/* bits transferred per second */
+											 ms_per_frame,	/* number of microseconds per frame */
+											 samples_per_frame,	/* number of samples per frame */
+											 bytes_per_frame,	/* number of bytes per frame decompressed */
+											 bytes_per_frame,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 1,	/* number of frames per network packet */
+											 switch_raw_init,	/* function to initialize a codec handle using this implementation */
+											 switch_raw_encode,	/* function to encode raw data into encoded data */
+											 switch_raw_decode,	/* function to decode encoded data into raw data */
+											 switch_raw_destroy);	/* deinitalize a codec handle using this implementation */
+
+		samples_per_frame += 240;
+		bytes_per_frame += 480;
+		ms_per_frame += 20000;
+
+	}
+
+	samples_per_frame = 480;
+	bytes_per_frame = 960;
+	ms_per_frame = 20000;
+
+	for (x = 0; x < 3; x++) {
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 10,	/* the IANA code number */
+											 "L16",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 24000,	/* samples transferred per second */
+											 24000,	/* actual samples transferred per second */
+											 384000,	/* bits transferred per second */
+											 ms_per_frame,	/* number of microseconds per frame */
+											 samples_per_frame,	/* number of samples per frame */
+											 bytes_per_frame,	/* number of bytes per frame decompressed */
+											 bytes_per_frame,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 1,	/* number of frames per network packet */
+											 switch_raw_init,	/* function to initialize a codec handle using this implementation */
+											 switch_raw_encode,	/* function to encode raw data into encoded data */
+											 switch_raw_decode,	/* function to decode encoded data into raw data */
+											 switch_raw_destroy);	/* deinitalize a codec handle using this implementation */
+
+		samples_per_frame += 480;
+		bytes_per_frame += 960;
+		ms_per_frame += 20000;
+
+	}
+
 	/* these formats below are for file playing. */
 
 	samples_per_frame = 96;
@@ -396,29 +450,28 @@
 	ms_per_frame = 2000;
 
 	for (x = 0; x < 5; x++) {
-		switch_core_codec_add_implementation(pool, codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 118, 						/* the IANA code number */
-											 "L16",						/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 48000,						/* samples transferred per second */
-											 48000,						/* actual samples transferred per second */
-											 768000,					/* bits transferred per second */
-											 ms_per_frame,				/* number of microseconds per frame */
-											 samples_per_frame,			/* number of samples per frame */
-											 bytes_per_frame,			/* number of bytes per frame decompressed */
-											 bytes_per_frame,			/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 1,							/* number of frames per network packet */
-											 switch_raw_init,			/* function to initialize a codec handle using this implementation */
-											 switch_raw_encode,			/* function to encode raw data into encoded data */
-											 switch_raw_decode,			/* function to decode encoded data into raw data */
-											 switch_raw_destroy);		/* deinitalize a codec handle using this implementation */
-		
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 10,	/* the IANA code number */
+											 "L16",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 48000,	/* samples transferred per second */
+											 48000,	/* actual samples transferred per second */
+											 768000,	/* bits transferred per second */
+											 ms_per_frame,	/* number of microseconds per frame */
+											 samples_per_frame,	/* number of samples per frame */
+											 bytes_per_frame,	/* number of bytes per frame decompressed */
+											 bytes_per_frame,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 1,	/* number of frames per network packet */
+											 switch_raw_init,	/* function to initialize a codec handle using this implementation */
+											 switch_raw_encode,	/* function to encode raw data into encoded data */
+											 switch_raw_decode,	/* function to decode encoded data into raw data */
+											 switch_raw_destroy);	/* deinitalize a codec handle using this implementation */
+
 		samples_per_frame += 96;
 		bytes_per_frame += 192;
 		ms_per_frame += 2000;
-		
+
 	}
 
 
@@ -427,92 +480,87 @@
 	ms_per_frame = 2000;
 
 	for (x = 0; x < 4; x++) {
-		switch_core_codec_add_implementation(pool, codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 10, 						/* the IANA code number */
-											 "L16",						/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 8000,						/* samples transferred per second */
-											 8000,						/* actual samples transferred per second */
-											 128000,					/* bits transferred per second */
-											 ms_per_frame,				/* number of microseconds per frame */
-											 samples_per_frame,			/* number of samples per frame */
-											 bytes_per_frame,			/* number of bytes per frame decompressed */
-											 bytes_per_frame,			/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 1,							/* number of frames per network packet */
-											 switch_raw_init,			/* function to initialize a codec handle using this implementation */
-											 switch_raw_encode,			/* function to encode raw data into encoded data */
-											 switch_raw_decode,			/* function to decode encoded data into raw data */
-											 switch_raw_destroy);		/* deinitalize a codec handle using this implementation */
-		
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 10,	/* the IANA code number */
+											 "L16",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 8000,	/* samples transferred per second */
+											 8000,	/* actual samples transferred per second */
+											 128000,	/* bits transferred per second */
+											 ms_per_frame,	/* number of microseconds per frame */
+											 samples_per_frame,	/* number of samples per frame */
+											 bytes_per_frame,	/* number of bytes per frame decompressed */
+											 bytes_per_frame,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 1,	/* number of frames per network packet */
+											 switch_raw_init,	/* function to initialize a codec handle using this implementation */
+											 switch_raw_encode,	/* function to encode raw data into encoded data */
+											 switch_raw_decode,	/* function to decode encoded data into raw data */
+											 switch_raw_destroy);	/* deinitalize a codec handle using this implementation */
+
 		samples_per_frame += 16;
 		bytes_per_frame += 32;
 		ms_per_frame += 2000;
-		
+
 	}
 
-
-
 	samples_per_frame = 32;
 	bytes_per_frame = 64;
 	ms_per_frame = 2000;
 
 	for (x = 0; x < 4; x++) {
-		switch_core_codec_add_implementation(pool, codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 10, 						/* the IANA code number */
-											 "L16",						/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 16000,						/* samples transferred per second */
-											 16000,						/* actual samples transferred per second */
-											 256000,					/* bits transferred per second */
-											 ms_per_frame,				/* number of microseconds per frame */
-											 samples_per_frame,			/* number of samples per frame */
-											 bytes_per_frame,			/* number of bytes per frame decompressed */
-											 bytes_per_frame,			/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 1,							/* number of frames per network packet */
-											 switch_raw_init,			/* function to initialize a codec handle using this implementation */
-											 switch_raw_encode,			/* function to encode raw data into encoded data */
-											 switch_raw_decode,			/* function to decode encoded data into raw data */
-											 switch_raw_destroy);		/* deinitalize a codec handle using this implementation */
-		
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 10,	/* the IANA code number */
+											 "L16",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 16000,	/* samples transferred per second */
+											 16000,	/* actual samples transferred per second */
+											 256000,	/* bits transferred per second */
+											 ms_per_frame,	/* number of microseconds per frame */
+											 samples_per_frame,	/* number of samples per frame */
+											 bytes_per_frame,	/* number of bytes per frame decompressed */
+											 bytes_per_frame,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 1,	/* number of frames per network packet */
+											 switch_raw_init,	/* function to initialize a codec handle using this implementation */
+											 switch_raw_encode,	/* function to encode raw data into encoded data */
+											 switch_raw_decode,	/* function to decode encoded data into raw data */
+											 switch_raw_destroy);	/* deinitalize a codec handle using this implementation */
+
 		samples_per_frame += 32;
 		bytes_per_frame += 64;
 		ms_per_frame += 2000;
-		
+
 	}
 
 
 	samples_per_frame = 64;
 	bytes_per_frame = 128;
 	ms_per_frame = 2000;
-	
+
 	for (x = 0; x < 4; x++) {
-		switch_core_codec_add_implementation(pool, codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 10, 						/* the IANA code number */
-											 "L16",						/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 32000,						/* samples transferred per second */
-											 32000,						/* actual samples transferred per second */
-											 512000,					/* bits transferred per second */
-											 ms_per_frame,				/* number of microseconds per frame */
-											 samples_per_frame,			/* number of samples per frame */
-											 bytes_per_frame,			/* number of bytes per frame decompressed */
-											 bytes_per_frame,			/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 1,							/* number of frames per network packet */
-											 switch_raw_init,			/* function to initialize a codec handle using this implementation */
-											 switch_raw_encode,			/* function to encode raw data into encoded data */
-											 switch_raw_decode,			/* function to decode encoded data into raw data */
-											 switch_raw_destroy);		/* deinitalize a codec handle using this implementation */
-		
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 10,	/* the IANA code number */
+											 "L16",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 32000,	/* samples transferred per second */
+											 32000,	/* actual samples transferred per second */
+											 512000,	/* bits transferred per second */
+											 ms_per_frame,	/* number of microseconds per frame */
+											 samples_per_frame,	/* number of samples per frame */
+											 bytes_per_frame,	/* number of bytes per frame decompressed */
+											 bytes_per_frame,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 1,	/* number of frames per network packet */
+											 switch_raw_init,	/* function to initialize a codec handle using this implementation */
+											 switch_raw_encode,	/* function to encode raw data into encoded data */
+											 switch_raw_decode,	/* function to decode encoded data into raw data */
+											 switch_raw_destroy);	/* deinitalize a codec handle using this implementation */
+
 		samples_per_frame += 64;
 		bytes_per_frame += 128;
 		ms_per_frame += 2000;
-		
+
 	}
 
 	samples_per_frame = 960;
@@ -520,66 +568,63 @@
 	ms_per_frame = 20000;
 	/* 10ms is already registered */
 	for (x = 0; x < 3; x++) {
-		switch_core_codec_add_implementation(pool, codec_interface,
-											 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-											 118, 						/* the IANA code number */
-											 "L16",						/* the IANA code name */
-											 NULL,						/* default fmtp to send (can be overridden by the init function) */
-											 48000,						/* samples transferred per second */
-											 48000,						/* actual samples transferred per second */
-											 768000,					/* bits transferred per second */
-											 ms_per_frame,				/* number of microseconds per frame */
-											 samples_per_frame,			/* number of samples per frame */
-											 bytes_per_frame,			/* number of bytes per frame decompressed */
-											 bytes_per_frame,			/* number of bytes per frame compressed */
-											 1,							/* number of channels represented */
-											 1,							/* number of frames per network packet */
-											 switch_raw_init,			/* function to initialize a codec handle using this implementation */
-											 switch_raw_encode,			/* function to encode raw data into encoded data */
-											 switch_raw_decode,			/* function to decode encoded data into raw data */
-											 switch_raw_destroy);		/* deinitalize a codec handle using this implementation */
+		switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+											 10,	/* the IANA code number */
+											 "L16",	/* the IANA code name */
+											 NULL,	/* default fmtp to send (can be overridden by the init function) */
+											 48000,	/* samples transferred per second */
+											 48000,	/* actual samples transferred per second */
+											 768000,	/* bits transferred per second */
+											 ms_per_frame,	/* number of microseconds per frame */
+											 samples_per_frame,	/* number of samples per frame */
+											 bytes_per_frame,	/* number of bytes per frame decompressed */
+											 bytes_per_frame,	/* number of bytes per frame compressed */
+											 1,	/* number of channels represented */
+											 1,	/* number of frames per network packet */
+											 switch_raw_init,	/* function to initialize a codec handle using this implementation */
+											 switch_raw_encode,	/* function to encode raw data into encoded data */
+											 switch_raw_decode,	/* function to decode encoded data into raw data */
+											 switch_raw_destroy);	/* deinitalize a codec handle using this implementation */
 		samples_per_frame += 480;
 		bytes_per_frame += 960;
 		ms_per_frame += 10000;
 	}
 
-	switch_core_codec_add_implementation(pool, codec_interface,
-										 SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
-										 118,						/* the IANA code number */
-										 "L16", 					/* the IANA code name */
-										 NULL, 						/* default fmtp to send (can be overridden by the init function) */
-										 22050, 					/* samples transferred per second */
-										 22050, 					/* actual samples transferred per second */
-										 352800,					/* bits transferred per second */
-										 20000, 					/* number of microseconds per frame */
-										 441, 						/* number of samples per frame */
-										 882, 						/* number of bytes per frame decompressed */
-										 882, 						/* number of bytes per frame compressed */
-										 1, 						/* number of channels represented */
-										 1, 						/* number of frames per network packet */
-										 switch_raw_init, 			/* function to initialize a codec handle using this implementation */
-										 switch_raw_encode, 		/* function to encode raw data into encoded data */
-										 switch_raw_decode, 		/* function to decode encoded data into raw data */
-										 switch_raw_destroy);		/* deinitalize a codec handle using this implementation */
+	switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+										 10,	/* the IANA code number */
+										 "L16",	/* the IANA code name */
+										 NULL,	/* default fmtp to send (can be overridden by the init function) */
+										 22050,	/* samples transferred per second */
+										 22050,	/* actual samples transferred per second */
+										 352800,	/* bits transferred per second */
+										 20000,	/* number of microseconds per frame */
+										 441,	/* number of samples per frame */
+										 882,	/* number of bytes per frame decompressed */
+										 882,	/* number of bytes per frame compressed */
+										 1,	/* number of channels represented */
+										 1,	/* number of frames per network packet */
+										 switch_raw_init,	/* function to initialize a codec handle using this implementation */
+										 switch_raw_encode,	/* function to encode raw data into encoded data */
+										 switch_raw_decode,	/* function to decode encoded data into raw data */
+										 switch_raw_destroy);	/* deinitalize a codec handle using this implementation */
 
-	switch_core_codec_add_implementation(pool, codec_interface,
-										 SWITCH_CODEC_TYPE_AUDIO, 	/* enumeration defining the type of the codec */
-										 118, 						/* the IANA code number */
-										 "L16", 					/* the IANA code name */
-										 NULL, 						/* default fmtp to send (can be overridden by the init function) */
-										 11025, 					/* samples transferred per second */
-										 11025, 					/* actual samples transferred per second */
-										 176400,					/* bits transferred per second */
-										 40000, 					/* number of microseconds per frame */
-										 441, 						/* number of samples per frame */
-										 882, 						/* number of bytes per frame decompressed */
-										 882, 						/* number of bytes per frame compressed */
-										 1, 						/* number of channels represented */
-										 1, 						/* number of frames per network packet */
-										 switch_raw_init, 			/* function to initialize a codec handle using this implementation */
-										 switch_raw_encode, 		/* function to encode raw data into encoded data */
-										 switch_raw_decode, 		/* function to decode encoded data into raw data */
-										 switch_raw_destroy);		/* deinitalize a codec handle using this implementation */
+	switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO,	/* enumeration defining the type of the codec */
+										 10,	/* the IANA code number */
+										 "L16",	/* the IANA code name */
+										 NULL,	/* default fmtp to send (can be overridden by the init function) */
+										 11025,	/* samples transferred per second */
+										 11025,	/* actual samples transferred per second */
+										 176400,	/* bits transferred per second */
+										 40000,	/* number of microseconds per frame */
+										 441,	/* number of samples per frame */
+										 882,	/* number of bytes per frame decompressed */
+										 882,	/* number of bytes per frame compressed */
+										 1,	/* number of channels represented */
+										 1,	/* number of frames per network packet */
+										 switch_raw_init,	/* function to initialize a codec handle using this implementation */
+										 switch_raw_encode,	/* function to encode raw data into encoded data */
+										 switch_raw_decode,	/* function to decode encoded data into raw data */
+										 switch_raw_destroy);	/* deinitalize a codec handle using this implementation */
 
 
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_regex.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_regex.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_regex.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -71,7 +71,7 @@
 			expression = abuf;
 		}
 	}
-	
+
 	if (*expression == '/') {
 		char *opts = NULL;
 		tmp = strdup(expression + 1);
@@ -168,15 +168,15 @@
 	substituted[y++] = '\0';
 }
 
-SWITCH_DECLARE(switch_status_t) switch_regex_match_partial(const char *target, const char *expression, int * partial)
+SWITCH_DECLARE(switch_status_t) switch_regex_match_partial(const char *target, const char *expression, int *partial)
 {
 	const char *error = NULL;	/* Used to hold any errors                                           */
 	int error_offset = 0;		/* Holds the offset of an error                                      */
 	pcre *pcre_prepared = NULL;	/* Holds the compiled regex                                          */
 	int match_count = 0;		/* Number of times the regex was matched                             */
-	int offset_vectors[2];		/* not used, but has to exist or pcre won't even try to find a match */
+	int offset_vectors[255];	/* not used, but has to exist or pcre won't even try to find a match */
 	int pcre_flags = 0;
-	
+
 	/* Compile the expression */
 	pcre_prepared = pcre_compile(expression, 0, &error, &error_offset, NULL);
 
@@ -194,13 +194,14 @@
 		/* We definitely didn't match anything */
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	if (*partial) {
 		pcre_flags = PCRE_PARTIAL;
 	}
-	
+
 	/* So far so good, run the regex */
-	match_count = pcre_exec(pcre_prepared, NULL, target, (int) strlen(target), 0, pcre_flags, offset_vectors, sizeof(offset_vectors) / sizeof(offset_vectors[0]));
+	match_count =
+		pcre_exec(pcre_prepared, NULL, target, (int) strlen(target), 0, pcre_flags, offset_vectors, sizeof(offset_vectors) / sizeof(offset_vectors[0]));
 
 	/* Clean up */
 	if (pcre_prepared) {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_resample.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_resample.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_resample.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -53,18 +53,16 @@
 #define resample_buffer(a, b, c) a > b ? ((a / 1000) / 2) * c : ((b / 1000) / 2) * c
 
 SWITCH_DECLARE(switch_status_t) switch_resample_perform_create(switch_audio_resampler_t **new_resampler,
-															   uint32_t from_rate, uint32_t to_rate, 
+															   uint32_t from_rate, uint32_t to_rate,
 															   uint32_t to_size,
-															   int quality,
-															   uint32_t channels,
-															   const char *file, const char *func, int line)
+															   int quality, uint32_t channels, const char *file, const char *func, int line)
 {
 	int err = 0;
 	switch_audio_resampler_t *resampler;
 	double lto_rate, lfrom_rate;
 
 	switch_zmalloc(resampler, sizeof(*resampler));
-	
+
 	resampler->resampler = speex_resampler_init(channels ? channels : 1, from_rate, to_rate, quality, &err);
 
 	if (!resampler->resampler) {
@@ -74,11 +72,11 @@
 
 	*new_resampler = resampler;
 	lto_rate = (double) resampler->to_rate;
-    lfrom_rate = (double) resampler->from_rate;
+	lfrom_rate = (double) resampler->from_rate;
 	resampler->from_rate = from_rate;
-    resampler->to_rate = to_rate;
-    resampler->factor = (lto_rate / lfrom_rate);
-    resampler->rfactor = (lfrom_rate / lto_rate);
+	resampler->to_rate = to_rate;
+	resampler->factor = (lto_rate / lfrom_rate);
+	resampler->rfactor = (lfrom_rate / lto_rate);
 	resampler->to_size = resample_buffer(to_rate, from_rate, (uint32_t) to_size);
 	resampler->to = malloc(resampler->to_size * sizeof(int16_t));
 
@@ -195,7 +193,7 @@
 	for (i = 0; i < samples; i++, sum_rnd = 0) {
 		for (x = 0; x < 6; x++) {
 			rnd2 = rnd2 * 31821U + 13849U;
-			sum_rnd += rnd2 ;
+			sum_rnd += rnd2;
 		}
 		//switch_normalize_to_16bit(sum_rnd);
 		*data = (int16_t) ((int16_t) sum_rnd / (int) divisor);
@@ -217,7 +215,7 @@
 
 	for (i = 0; i < samples; i++, sum_rnd = 0) {
 		for (x = 0; x < 10; x++) {
-			rnd = rnd + (int16_t)((x + i) * rnd2);
+			rnd = rnd + (int16_t) ((x + i) * rnd2);
 			sum_rnd += rnd;
 		}
 		switch_normalize_to_16bit(sum_rnd);
@@ -257,8 +255,8 @@
 	uint32_t j = 0, k = 0;
 
 	switch_zmalloc(buf, len);
-	
-	for(i = 0; i < samples; i++) {
+
+	for (i = 0; i < samples; i++) {
 		for (j = 0; j < channels; j++) {
 			int32_t z = buf[i] + data[k++];
 			switch_normalize_to_16bit(z);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_rtp.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_rtp.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_rtp.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -140,7 +140,7 @@
 	switch_socket_t *sock_input, *sock_output;
 	switch_pollfd_t *read_pollfd;
 	switch_pollfd_t *jb_pollfd;
-	
+
 	switch_sockaddr_t *local_addr;
 	rtp_msg_t send_msg;
 
@@ -219,8 +219,9 @@
 #ifdef ENABLE_ZRTP
 	zrtp_session_t *zrtp_session;
 	zrtp_profile_t *zrtp_profile;
-	zrtp_stream_t *zrtp_ctx;
+	zrtp_stream_t *zrtp_stream;
 	int zrtp_mitm_tries;
+	int zinit;
 #endif
 
 #ifdef RTP_DEBUG_WRITE_DELTA
@@ -251,11 +252,10 @@
 		rtp_session->stuncount--;
 		goto end;
 	}
-
 #if 0
 	if (rtp_session->last_stun) {
 		elapsed = (unsigned int) ((switch_micro_time_now() - rtp_session->last_stun) / 1000);
-		
+
 		if (elapsed > 30000) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No stun for a long time (PUNT!)\n");
 			status = SWITCH_STATUS_FALSE;
@@ -282,7 +282,7 @@
 
 	switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_stun_addr, 0, (void *) packet, &bytes);
 	rtp_session->stuncount = rtp_session->default_stuncount;
-	
+
   end:
 	WRITE_DEC(rtp_session);
 
@@ -425,7 +425,7 @@
 	task->runtime = switch_epoch_time_now(NULL) + 900;
 }
 
-static int zrtp_send_rtp_callback(const zrtp_stream_t* stream, char* rtp_packet, unsigned int rtp_packet_length)
+static int zrtp_send_rtp_callback(const zrtp_stream_t *stream, char *rtp_packet, unsigned int rtp_packet_length)
 {
 	switch_rtp_t *rtp_session = zrtp_stream_get_userdata(stream);
 	switch_size_t len = rtp_packet_length;
@@ -438,44 +438,74 @@
 static void zrtp_event_callback(zrtp_stream_t *stream, unsigned event)
 {
 	switch_rtp_t *rtp_session = zrtp_stream_get_userdata(stream);
+	zrtp_session_info_t zrtp_session_info;
 	switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	switch_event_t *fsevent = NULL;
-	
-	zrtp_session_info_t zrtp_session_info;
+	const char *type;
 
+	type = switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO) ? "video" : "audio";
+
 	switch (event) {
 	case ZRTP_EVENT_IS_SECURE:
 		{
 			switch_set_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_SEND);
 			switch_set_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_RECV);
-			switch_set_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
-			switch_set_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
-			if (zrtp_status_ok == zrtp_session_get(rtp_session->zrtp_session, &zrtp_session_info)) {
+			if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) {
+				switch_set_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
+				switch_set_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
+			}
+			if (zrtp_status_ok == zrtp_session_get(stream->session, &zrtp_session_info)) {
 				if (zrtp_session_info.sas_is_ready) {
-					
-					switch_channel_set_variable(channel, "zrtp_secure_media_confirmed", "true");
-					switch_channel_set_variable(channel, "zrtp_sas1_string", rtp_session->zrtp_session->sas1.buffer);
-					switch_channel_set_variable(channel, "zrtp_sas2_string", rtp_session->zrtp_session->sas2.buffer);
-					
-					zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid, 
-									  &rtp_session->zrtp_session->peer_zid, zrtp_session_info.sas_is_verified^1);
-					
+
+					switch_channel_set_variable_name_printf(channel, "true", "zrtp_secure_media_confirmed_%s", type);
+					switch_channel_set_variable_name_printf(channel, stream->session->sas1.buffer, "zrtp_sas1_string_%s", type);
+					switch_channel_set_variable_name_printf(channel, stream->session->sas2.buffer, "zrtp_sas2_string", type);
+
+					zrtp_verified_set(zrtp_global, &stream->session->zid, &stream->session->peer_zid, zrtp_session_info.sas_is_verified ^ 1);
+
 				}
 			}
+
+			if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) {
+				switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
+
+				if (session) {
+					switch_channel_t *channel = switch_core_session_get_channel(session);
+					switch_rtp_t *video_rtp_session = switch_channel_get_private(channel, "__zrtp_video_rtp_session");
+
+					if (!video_rtp_session) {
+						video_rtp_session = switch_channel_get_private_partner(channel, "__zrtp_video_rtp_session");
+					}
+
+					if (video_rtp_session) {
+						if (zrtp_status_ok != zrtp_stream_attach(stream->session, &video_rtp_session->zrtp_stream)) {
+							abort();
+						}
+						zrtp_stream_set_userdata(video_rtp_session->zrtp_stream, video_rtp_session);
+						if (switch_true(switch_channel_get_variable(channel, "zrtp_enrollment"))) {
+							zrtp_stream_registration_start(video_rtp_session->zrtp_stream, video_rtp_session->ssrc);
+						} else {
+							zrtp_stream_start(video_rtp_session->zrtp_stream, video_rtp_session->ssrc);
+						}
+					}
+				}
+			}
+
+			if (switch_event_create(&fsevent, SWITCH_EVENT_CALL_SECURE) == SWITCH_STATUS_SUCCESS) {
+				switch_event_add_header(fsevent, SWITCH_STACK_BOTTOM, "secure_media_type", "%s", type);
+				switch_event_add_header(fsevent, SWITCH_STACK_BOTTOM, "secure_type", "zrtp:%s:%s", stream->session->sas1.buffer,
+										stream->session->sas2.buffer);
+				switch_event_add_header_string(fsevent, SWITCH_STACK_BOTTOM, "caller-unique-id", switch_channel_get_uuid(channel));
+				switch_event_fire(&fsevent);
+			}
 		}
-		if (switch_event_create(&fsevent, SWITCH_EVENT_CALL_SECURE) == SWITCH_STATUS_SUCCESS) {
-			switch_event_add_header(fsevent, SWITCH_STACK_BOTTOM, "secure_type", "zrtp:%s:%s",
-									rtp_session->zrtp_session->sas1.buffer, rtp_session->zrtp_session->sas2.buffer);
-			switch_event_add_header_string(fsevent, SWITCH_STACK_BOTTOM, "caller-unique-id", switch_channel_get_uuid(channel));
-			switch_event_fire(&fsevent);
-		}
 		break;
 #if 0
 	case ZRTP_EVENT_NO_ZRTP_QUICK:
 		{
-			if (rtp_session->zrtp_ctx != NULL) {
-				zrtp_stream_stop(rtp_session->zrtp_ctx);
+			if (stream != NULL) {
+				zrtp_stream_stop(stream);
 			}
 		}
 		break;
@@ -483,19 +513,18 @@
 	case ZRTP_EVENT_IS_CLIENT_ENROLLMENT:
 		{
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Enrolled complete!\n");
-			switch_channel_set_variable(channel, "zrtp_enroll_complete", "true");
+			switch_channel_set_variable_name_printf(channel, "true", "zrtp_enroll_complete_%s", type);
 		}
 		break;
 
 	case ZRTP_EVENT_USER_ALREADY_ENROLLED:
 		{
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "User already enrolled!\n");
-			switch_channel_set_variable(channel, "zrtp_already_enrolled", "true");
-			
-			if (zrtp_status_ok == zrtp_session_get(rtp_session->zrtp_session, &zrtp_session_info)) {
+			switch_channel_set_variable_name_printf(channel, "true", "zrtp_already_enrolled_%s", type);
+
+			if (zrtp_status_ok == zrtp_session_get(stream->session, &zrtp_session_info)) {
 				if (zrtp_session_info.sas_is_ready) {
-					zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid, 
-									  &rtp_session->zrtp_session->peer_zid, zrtp_session_info.sas_is_verified^1);
+					zrtp_verified_set(zrtp_global, &stream->session->zid, &stream->session->peer_zid, zrtp_session_info.sas_is_verified ^ 1);
 				}
 			}
 		}
@@ -504,26 +533,24 @@
 	case ZRTP_EVENT_NEW_USER_ENROLLED:
 		{
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "New user enrolled!\n");
-			switch_channel_set_variable(channel, "zrtp_new_user_enrolled", "true");
+			switch_channel_set_variable_name_printf(channel, "true", "zrtp_new_user_enrolled_%s", type);
 
-			if (zrtp_status_ok == zrtp_session_get(rtp_session->zrtp_session, &zrtp_session_info)) {
+			if (zrtp_status_ok == zrtp_session_get(stream->session, &zrtp_session_info)) {
 				if (zrtp_session_info.sas_is_ready) {
-					zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid, 
-									  &rtp_session->zrtp_session->peer_zid, zrtp_session_info.sas_is_verified^1);
+					zrtp_verified_set(zrtp_global, &stream->session->zid, &stream->session->peer_zid, zrtp_session_info.sas_is_verified ^ 1);
 				}
 			}
 		}
 		break;
-		
+
 	case ZRTP_EVENT_USER_UNENROLLED:
 		{
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "User unenrolled!\n");
-			switch_channel_set_variable(channel, "zrtp_user_unenrolled", "true");
-			
-			if (zrtp_status_ok == zrtp_session_get(rtp_session->zrtp_session, &zrtp_session_info)) {
+			switch_channel_set_variable_name_printf(channel, "true", "zrtp_user_unenrolled_%s", type);
+
+			if (zrtp_status_ok == zrtp_session_get(stream->session, &zrtp_session_info)) {
 				if (zrtp_session_info.sas_is_ready) {
-					zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid, 
-									  &rtp_session->zrtp_session->peer_zid, zrtp_session_info.sas_is_verified^1);
+					zrtp_verified_set(zrtp_global, &stream->session->zid, &stream->session->peer_zid, zrtp_session_info.sas_is_verified ^ 1);
 				}
 			}
 		}
@@ -531,7 +558,7 @@
 
 	case ZRTP_EVENT_IS_PENDINGCLEAR:
 		{
-			switch_channel_set_variable(channel, "zrtp_secure_media_confirmed", "false");
+			switch_channel_set_variable_name_printf(channel, "false", "zrtp_secure_media_confirmed_%s", type);
 			switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_SEND);
 			switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_RECV);
 			switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
@@ -542,7 +569,7 @@
 
 	case ZRTP_EVENT_NO_ZRTP:
 		{
-			switch_channel_set_variable(channel, "zrtp_secure_media_confirmed", "false");
+			switch_channel_set_variable_name_printf(channel, "false", "zrtp_secure_media_confirmed_%s", type);
 		}
 		break;
 
@@ -551,28 +578,10 @@
 	}
 }
 
-static void zrtp_logger(int level, const char *data, int len)
+static void zrtp_logger(int level, const char *data, int len, int offset)
 {
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s", data);
 }
-
-static void zrtp_handler(switch_rtp_t *rtp_session, switch_socket_t *sock, void *data, switch_size_t datalen, switch_sockaddr_t *from_addr)
-{
-	zrtp_status_t status = zrtp_status_fail;
-	unsigned int len = datalen;
-
-	status = zrtp_process_srtp(rtp_session->zrtp_ctx, (char*)data, &len);
-	switch(status) {
-	case zrtp_status_ok:
-		break;
-	case zrtp_status_drop:
-		break;
-	case zrtp_status_fail:
-		break;
-	default:
-		break;
-	}
-}
 #endif
 
 SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool_t *pool)
@@ -580,9 +589,9 @@
 #ifdef ENABLE_ZRTP
 	const char *zid_string = switch_core_get_variable("switch_serial");
 	const char *zrtp_enabled = switch_core_get_variable("zrtp_enabled");
-	zrtp_on = zrtp_enabled ? switch_true(zrtp_enabled) : 0;
 	zrtp_config_t zrtp_config;
 	char zrtp_cache_path[256] = "";
+	zrtp_on = zrtp_enabled ? switch_true(zrtp_enabled) : 0;
 #endif
 	if (global_init) {
 		return;
@@ -595,23 +604,24 @@
 		zrtp_config.is_mitm = 1;
 		zrtp_config.lic_mode = ZRTP_LICENSE_MODE_ACTIVE;
 		switch_snprintf(zrtp_cache_path, sizeof(zrtp_cache_path), "%s%szrtp.dat", SWITCH_GLOBAL_dirs.db_dir, SWITCH_PATH_SEPARATOR);
-		zrtp_zstrcpyc( ZSTR_GV(zrtp_config.def_cache_path), zrtp_cache_path);
+		zrtp_zstrcpyc(ZSTR_GV(zrtp_config.def_cache_path), zrtp_cache_path);
 		zrtp_config.cb.event_cb.on_zrtp_protocol_event = zrtp_event_callback;
 		zrtp_config.cb.misc_cb.on_send_packet = zrtp_send_rtp_callback;
 		zrtp_config.cb.event_cb.on_zrtp_security_event = zrtp_event_callback;
-		
-		zrtp_log_set_log_engine(zrtp_logger);
+
+		zrtp_log_set_log_engine((zrtp_log_engine *) zrtp_logger);
 		zrtp_log_set_level(4);
 		if (zrtp_status_ok == zrtp_init(&zrtp_config, &zrtp_global)) {
-		
+
 			memcpy(zid, zid_string, 12);
-			switch_scheduler_add_task(switch_epoch_time_now(NULL) + 900, zrtp_cache_save_callback, "zrtp_cache_save", "core", 0, NULL, SSHF_NONE | SSHF_NO_DEL);
+			switch_scheduler_add_task(switch_epoch_time_now(NULL) + 900, zrtp_cache_save_callback, "zrtp_cache_save", "core", 0, NULL,
+									  SSHF_NONE | SSHF_NO_DEL);
 		} else {
 			switch_core_set_variable("zrtp_enabled", NULL);
 			zrtp_on = 0;
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "ZRTP init failed!\n");
 		}
-		
+
 	}
 #endif
 	srtp_init();
@@ -629,15 +639,15 @@
 {
 	switch_core_port_allocator_t *alloc = NULL;
 	switch_hash_index_t *hi;
-    const void *var;
-    void *val;
+	const void *var;
+	void *val;
 
 	switch_mutex_lock(port_lock);
 
 	for (hi = switch_hash_first(NULL, alloc_hash); hi; hi = switch_hash_next(hi)) {
 		switch_hash_this(hi, &var, NULL, &val);
 		if ((alloc = (switch_core_port_allocator_t *) val)) {
-			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroy port allocator for %s\n", (char *)var);
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Destroy port allocator for %s\n", (char *) var);
 			switch_core_port_allocator_destroy(&alloc);
 		}
 	}
@@ -827,7 +837,7 @@
 		switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
 	}
 
-	switch_socket_create_pollfd(&rtp_session->read_pollfd, rtp_session->sock_input, SWITCH_POLLIN | SWITCH_POLLERR, rtp_session->pool);	
+	switch_socket_create_pollfd(&rtp_session->read_pollfd, rtp_session->sock_input, SWITCH_POLLIN | SWITCH_POLLERR, rtp_session->pool);
 
 	status = SWITCH_STATUS_SUCCESS;
 	*err = "Success";
@@ -854,8 +864,8 @@
 SWITCH_DECLARE(void) switch_rtp_set_max_missed_packets(switch_rtp_t *rtp_session, uint32_t max)
 {
 	if (rtp_session->missed_count >= max) {
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, 
-						  "new max missed packets(%d->%d) greater than current missed packets(%d). RTP will timeout.\n", 
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+						  "new max missed packets(%d->%d) greater than current missed packets(%d). RTP will timeout.\n",
 						  rtp_session->missed_count, max, rtp_session->missed_count);
 	}
 
@@ -878,7 +888,7 @@
 }
 
 
-SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_session, const char *host, switch_port_t port, 
+SWITCH_DECLARE(switch_status_t) switch_rtp_set_remote_address(switch_rtp_t *rtp_session, const char *host, switch_port_t port,
 															  switch_bool_t change_adv_addr, const char **err)
 {
 	switch_sockaddr_t *remote_addr;
@@ -899,21 +909,15 @@
 		rtp_session->remote_port = port;
 	}
 
-	if (rtp_session->sock_input &&
-		switch_sockaddr_get_family(rtp_session->remote_addr) ==
-		switch_sockaddr_get_family(rtp_session->local_addr)) {
-			rtp_session->sock_output = rtp_session->sock_input;
-	}
-	else {
-		if (rtp_session->sock_output &&
-			rtp_session->sock_output != rtp_session->sock_input) {
-				switch_socket_close(rtp_session->sock_output);
+	if (rtp_session->sock_input && switch_sockaddr_get_family(rtp_session->remote_addr) == switch_sockaddr_get_family(rtp_session->local_addr)) {
+		rtp_session->sock_output = rtp_session->sock_input;
+	} else {
+		if (rtp_session->sock_output && rtp_session->sock_output != rtp_session->sock_input) {
+			switch_socket_close(rtp_session->sock_output);
 		}
 		if ((status = switch_socket_create(&rtp_session->sock_output,
-			switch_sockaddr_get_family(rtp_session->remote_addr),
-			SOCK_DGRAM, 0, rtp_session->pool)) !=
-			SWITCH_STATUS_SUCCESS)
-		{
+										   switch_sockaddr_get_family(rtp_session->remote_addr),
+										   SOCK_DGRAM, 0, rtp_session->pool)) != SWITCH_STATUS_SUCCESS) {
 			*err = "Socket Error!";
 		}
 	}
@@ -954,7 +958,7 @@
 	rtp_session->crypto_keys[direction] = crypto_key;
 
 	memset(policy, 0, sizeof(*policy));
-	
+
 	switch (crypto_key->type) {
 	case AES_CM_128_HMAC_SHA1_80:
 		crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy->rtp);
@@ -1045,32 +1049,53 @@
 	rtp_session->ms_per_packet = ms_per_packet;
 	rtp_session->samples_per_interval = rtp_session->conf_samples_per_interval = samples_per_interval;
 	rtp_session->missed_count = 0;
-	rtp_session->samples_per_second = (uint32_t)((double)(1000.0f / (double)(rtp_session->ms_per_packet / 1000)) * (double)rtp_session->samples_per_interval);
+	rtp_session->samples_per_second =
+		(uint32_t) ((double) (1000.0f / (double) (rtp_session->ms_per_packet / 1000)) * (double) rtp_session->samples_per_interval);
 
 	return SWITCH_STATUS_SUCCESS;
 }
 
 SWITCH_DECLARE(switch_status_t) switch_rtp_change_interval(switch_rtp_t *rtp_session, uint32_t ms_per_packet, uint32_t samples_per_interval)
 {
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	int change_timer = 0;
 
+	if (rtp_session->ms_per_packet && rtp_session->ms_per_packet != ms_per_packet) {
+		change_timer = 1;
+	}
+
 	switch_rtp_set_interval(rtp_session, ms_per_packet, samples_per_interval);
-	
-	if (rtp_session->timer_name) {
+
+	if (change_timer && rtp_session->timer_name) {
+		READ_INC(rtp_session);
+		WRITE_INC(rtp_session);
+
 		if (rtp_session->timer.timer_interface) {
 			switch_core_timer_destroy(&rtp_session->timer);
 		}
-		if (switch_core_timer_init(&rtp_session->timer, 
-								   rtp_session->timer_name, ms_per_packet / 1000, samples_per_interval, rtp_session->pool) == SWITCH_STATUS_SUCCESS) {
+		if ((status = switch_core_timer_init(&rtp_session->timer,
+											 rtp_session->timer_name, ms_per_packet / 1000,
+											 samples_per_interval, rtp_session->pool)) == SWITCH_STATUS_SUCCESS) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
 							  "RE-Starting timer [%s] %d bytes per %dms\n", rtp_session->timer_name, samples_per_interval, ms_per_packet);
 		} else {
 			memset(&rtp_session->timer, 0, sizeof(rtp_session->timer));
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
 							  "Problem RE-Starting timer [%s] %d bytes per %dms\n", rtp_session->timer_name, samples_per_interval, ms_per_packet / 1000);
-			return SWITCH_STATUS_FALSE;
 		}
+
+		WRITE_DEC(rtp_session);
+		READ_DEC(rtp_session);
 	}
-		
+
+	return status;
+}
+
+SWITCH_DECLARE(switch_status_t) switch_rtp_set_ssrc(switch_rtp_t *rtp_session, uint32_t ssrc) 
+{
+	rtp_session->ssrc = ssrc;
+	rtp_session->send_msg.header.ssrc = htonl(rtp_session->ssrc);
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1113,7 +1138,8 @@
 
 
 	rtp_session->seq = (uint16_t) rand();
-	rtp_session->ssrc = (uint32_t) ((intptr_t) &rtp_session + (uint32_t) switch_epoch_time_now(NULL));
+	rtp_session->ssrc = (uint32_t) ((intptr_t) rtp_session + (uint32_t) switch_epoch_time_now(NULL));
+
 	rtp_session->send_msg.header.ssrc = htonl(rtp_session->ssrc);
 	rtp_session->send_msg.header.ts = 0;
 	rtp_session->send_msg.header.m = 0;
@@ -1167,51 +1193,73 @@
 
 #ifdef ENABLE_ZRTP
 	if (zrtp_on) {
+		switch_rtp_t *master_rtp_session = NULL;
+
 		int initiator = 0;
 		switch_channel_t *channel = switch_core_session_get_channel(session);
 		const char *zrtp_enabled = switch_channel_get_variable(channel, "zrtp_secure_media");
 		const char *srtp_enabled = switch_channel_get_variable(channel, "sip_secure_media");
 
 		if (switch_true(srtp_enabled) && switch_true(zrtp_enabled)) {
-			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "You can not have ZRTP and SRTP enabled simultaneously, ZRTP will be disabled for this call!\n");
+			switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
+							  "You can not have ZRTP and SRTP enabled simultaneously, ZRTP will be disabled for this call!\n");
 			switch_channel_set_variable(channel, "zrtp_secure_media", NULL);
 			zrtp_enabled = NULL;
 		}
 
+
 		if (switch_true(zrtp_enabled)) {
+			if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) {
+				switch_channel_set_private(channel, "__zrtp_video_rtp_session", rtp_session);
+				master_rtp_session = switch_channel_get_private(channel, "__zrtp_audio_rtp_session");
+			} else {
+				switch_channel_set_private(channel, "__zrtp_audio_rtp_session", rtp_session);
+				master_rtp_session = rtp_session;
+			}
+
+
 			if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
 				initiator = 1;
 			}
-			
-			rtp_session->zrtp_profile = switch_core_alloc(rtp_session->pool, sizeof(*rtp_session->zrtp_profile));
-			zrtp_profile_defaults(rtp_session->zrtp_profile, zrtp_global);
-			
-			rtp_session->zrtp_profile->allowclear = 0;
-			rtp_session->zrtp_profile->disclose_bit = 0;
-			rtp_session->zrtp_profile->cache_ttl = -1;
-			
-			if (zrtp_status_ok != zrtp_session_init(zrtp_global, rtp_session->zrtp_profile, zid, initiator, &rtp_session->zrtp_session)) {
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error! zRTP INIT Failed\n");
-				zrtp_session_down(rtp_session->zrtp_session);
-				rtp_session->zrtp_session = NULL;
+
+			if (rtp_session == master_rtp_session) {
+				rtp_session->zrtp_profile = switch_core_alloc(rtp_session->pool, sizeof(*rtp_session->zrtp_profile));
+				zrtp_profile_defaults(rtp_session->zrtp_profile, zrtp_global);
+
+				rtp_session->zrtp_profile->allowclear = 0;
+				rtp_session->zrtp_profile->disclose_bit = 0;
+				rtp_session->zrtp_profile->cache_ttl = -1;
+
+				if (zrtp_status_ok != zrtp_session_init(zrtp_global, rtp_session->zrtp_profile, zid, initiator, &rtp_session->zrtp_session)) {
+					switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error! zRTP INIT Failed\n");
+					zrtp_session_down(rtp_session->zrtp_session);
+					rtp_session->zrtp_session = NULL;
+					goto end;
+				}
+
+				zrtp_session_set_userdata(rtp_session->zrtp_session, session);
+
+
+				if (zrtp_status_ok != zrtp_stream_attach(master_rtp_session->zrtp_session, &rtp_session->zrtp_stream)) {
+					abort();
+				}
+
+				zrtp_stream_set_userdata(rtp_session->zrtp_stream, rtp_session);
+
+				if (switch_true(switch_channel_get_variable(channel, "zrtp_enrollment"))) {
+					zrtp_stream_registration_start(rtp_session->zrtp_stream, rtp_session->ssrc);
+				} else {
+					zrtp_stream_start(rtp_session->zrtp_stream, rtp_session->ssrc);
+				}
 			}
-			
-			zrtp_session_set_userdata(rtp_session->zrtp_session, rtp_session);
-			
-			if (zrtp_status_ok != zrtp_stream_attach(rtp_session->zrtp_session, &rtp_session->zrtp_ctx)) {
-				abort();
-			}
-			zrtp_stream_set_userdata(rtp_session->zrtp_ctx, rtp_session);
-			
-			if (switch_true(switch_channel_get_variable(channel, "zrtp_enrollment"))) {
-				zrtp_stream_registration_start(rtp_session->zrtp_ctx, rtp_session->ssrc);
-			} else {
-				zrtp_stream_start(rtp_session->zrtp_ctx, rtp_session->ssrc);
-			}
+
 		}
 	}
-#endif	
 
+  end:
+
+#endif
+
 	rtp_session->ready = 1;
 	*new_rtp_session = rtp_session;
 
@@ -1297,10 +1345,10 @@
 SWITCH_DECLARE(switch_status_t) switch_rtp_activate_stun_ping(switch_rtp_t *rtp_session, const char *stun_ip, switch_port_t stun_port,
 															  uint32_t packet_count, switch_bool_t funny)
 {
-	
-	if (switch_sockaddr_info_get(&rtp_session->remote_stun_addr, stun_ip, SWITCH_UNSPEC, 
+
+	if (switch_sockaddr_info_get(&rtp_session->remote_stun_addr, stun_ip, SWITCH_UNSPEC,
 								 stun_port, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS || !rtp_session->remote_stun_addr) {
-		
+
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error resolving stun ping addr\n");
 		return SWITCH_STATUS_FALSE;
 	}
@@ -1361,7 +1409,7 @@
 	switch_mutex_lock(rtp_session->flag_mutex);
 	switch_set_flag(rtp_session, SWITCH_RTP_FLAG_BREAK);
 	switch_set_flag(rtp_session, SWITCH_RTP_FLAG_FLUSH);
-	
+
 	if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK)) {
 		switch_mutex_unlock(rtp_session->flag_mutex);
 		return;
@@ -1399,7 +1447,8 @@
 	}
 
 	switch_mutex_lock(rtp_session->flag_mutex);
-	ret = (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO) && rtp_session->sock_input && rtp_session->sock_output && rtp_session->remote_addr && rtp_session->ready == 2) ? 1 : 0;
+	ret = (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO) && rtp_session->sock_input && rtp_session->sock_output && rtp_session->remote_addr
+		   && rtp_session->ready == 2) ? 1 : 0;
 	switch_mutex_unlock(rtp_session->flag_mutex);
 
 	return ret;
@@ -1444,7 +1493,7 @@
 	(*rtp_session)->sock_input = NULL;
 	switch_socket_close(sock);
 
-	if ( (*rtp_session)->sock_output != sock ) {
+	if ((*rtp_session)->sock_output != sock) {
 		sock = (*rtp_session)->sock_output;
 		(*rtp_session)->sock_output = NULL;
 		switch_socket_close(sock);
@@ -1469,8 +1518,8 @@
 	/* ZRTP */
 	if (zrtp_on) {
 
-		if ((*rtp_session)->zrtp_ctx != NULL) {
-			zrtp_stream_stop((*rtp_session)->zrtp_ctx);
+		if ((*rtp_session)->zrtp_stream != NULL) {
+			zrtp_stream_stop((*rtp_session)->zrtp_stream);
 		}
 
 		if (switch_test_flag((*rtp_session), SWITCH_ZRTP_FLAG_SECURE_SEND)) {
@@ -1567,7 +1616,7 @@
 
 		for (x = 0; x < loops; x++) {
 			switch_size_t wrote = switch_rtp_write_manual(rtp_session,
-														  rtp_session->dtmf_data.out_digit_packet, 4, 0, 
+														  rtp_session->dtmf_data.out_digit_packet, 4, 0,
 														  rtp_session->te, rtp_session->dtmf_data.timestamp_dtmf, &flags);
 
 			rtp_session->stats.outbound.raw_bytes += wrote;
@@ -1579,7 +1628,7 @@
 							  rtp_session->dtmf_data.timestamp_dtmf,
 							  rtp_session->dtmf_data.out_digit_sofar,
 							  rtp_session->dtmf_data.out_digit_sub_sofar, rtp_session->dtmf_data.out_digit_dur, rtp_session->seq);
-			if (rtp_session->rtp_bugs & RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833) {
+			if (loops == 1 && rtp_session->rtp_bugs & RTP_BUG_SONUS_SEND_INVALID_TIMESTAMP_2833) {
 				rtp_session->dtmf_data.timestamp_dtmf = rtp_session->last_write_ts + samples;
 			}
 		}
@@ -1628,13 +1677,13 @@
 					rtp_session->dtmf_data.timestamp_dtmf = (uint32_t) (rtp_session->dtmf_data.timestamp_dtmf + offset);
 				}
 			}
-			
+
 			wrote = switch_rtp_write_manual(rtp_session,
 											rtp_session->dtmf_data.out_digit_packet,
 											4,
 											rtp_session->rtp_bugs & RTP_BUG_CISCO_SKIP_MARK_BIT_2833 ? 0 : 1,
 											rtp_session->te, rtp_session->dtmf_data.timestamp_dtmf, &flags);
-			
+
 			rtp_session->stats.outbound.raw_bytes += wrote;
 			rtp_session->stats.outbound.dtmf_packet_count++;
 
@@ -1675,7 +1724,7 @@
 	if (!switch_rtp_ready(rtp_session) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA)) {
 		return;
 	}
-	
+
 	READ_INC(rtp_session);
 
 	if (switch_rtp_ready(rtp_session)) {
@@ -1686,19 +1735,18 @@
 				switch_clear_flag(rtp_session, SWITCH_RTP_FLAG_DEBUG_RTP_READ);
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "RTP HAS NO SESSION!\n");
 			} else {
-				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), 
-								  SWITCH_LOG_CONSOLE, "%s FLUSH\n",
-								  switch_channel_get_name(switch_core_session_get_channel(session))
-								  );
+				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
+								  SWITCH_LOG_CONSOLE, "%s FLUSH\n", switch_channel_get_name(switch_core_session_get_channel(session))
+					);
 			}
 		}
 
 		if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_NOBLOCK)) {
 			was_blocking = 1;
-			switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_NOBLOCK);		
+			switch_set_flag_locked(rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
 			switch_socket_opt_set(rtp_session->sock_input, SWITCH_SO_NONBLOCK, TRUE);
 		}
-	
+
 		do {
 			if (switch_rtp_ready(rtp_session)) {
 				bytes = sizeof(rtp_msg_t);
@@ -1711,14 +1759,14 @@
 			} else {
 				break;
 			}
-		} while(bytes > 0);
-		
+		} while (bytes > 0);
+
 		if (was_blocking && switch_rtp_ready(rtp_session)) {
 			switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
 			switch_socket_opt_set(rtp_session->sock_input, SWITCH_SO_NONBLOCK, FALSE);
 		}
 	}
-	
+
 	READ_DEC(rtp_session);
 }
 
@@ -1728,7 +1776,7 @@
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	stfu_frame_t *jb_frame;
-	
+
 	switch_assert(bytes);
 
 	*bytes = sizeof(rtp_msg_t);
@@ -1744,16 +1792,22 @@
 			rtp_session->stats.inbound.media_packet_count++;
 			rtp_session->stats.inbound.media_bytes += *bytes;
 		}
-		
+
 		rtp_session->stats.inbound.packet_count++;
 	}
 
+	if (rtp_session->te && rtp_session->recv_msg.header.pt == rtp_session->te) {
+		return SWITCH_STATUS_SUCCESS;
+	}
+
+
 	if (rtp_session->jb && rtp_session->recv_msg.header.version == 2 && *bytes) {
 		if (rtp_session->recv_msg.header.m && rtp_session->recv_msg.header.pt != rtp_session->te) {
 			stfu_n_reset(rtp_session->jb);
 		}
-		
-		stfu_n_eat(rtp_session->jb, ntohl(rtp_session->recv_msg.header.ts), rtp_session->recv_msg.body, *bytes - rtp_header_len);				
+
+		stfu_n_eat(rtp_session->jb, ntohl(rtp_session->recv_msg.header.ts), rtp_session->recv_msg.header.pt,
+				   rtp_session->recv_msg.body, *bytes - rtp_header_len);
 		*bytes = 0;
 		status = SWITCH_STATUS_FALSE;
 	}
@@ -1768,7 +1822,8 @@
 			}
 			*bytes = jb_frame->dlen + rtp_header_len;
 			rtp_session->recv_msg.header.ts = htonl(jb_frame->ts);
-			rtp_session->recv_msg.header.pt = rtp_session->payload;
+			rtp_session->recv_msg.header.pt = jb_frame->pt;
+
 			status = SWITCH_STATUS_SUCCESS;
 		}
 	}
@@ -1806,13 +1861,14 @@
 
 	while (switch_rtp_ready(rtp_session)) {
 		int do_cng = 0;
+		bytes = 0;
 
 		if (rtp_session->timer.interval) {
 			if ((switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOFLUSH) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_STICKY_FLUSH)) &&
 				rtp_session->read_pollfd) {
-				if (switch_poll(rtp_session->read_pollfd, 1, &fdr, 1) == SWITCH_STATUS_SUCCESS) {
+				if (switch_poll(rtp_session->read_pollfd, 1, &fdr, 0) == SWITCH_STATUS_SUCCESS) {
 					rtp_session->hot_hits += rtp_session->samples_per_interval;
-					
+
 					if (rtp_session->hot_hits >= rtp_session->samples_per_second * 5) {
 						switch_set_flag(rtp_session, SWITCH_RTP_FLAG_FLUSH);
 						hot_socket = 1;
@@ -1828,8 +1884,8 @@
 			} else {
 				if (rtp_session->sync_packets) {
 #if 0
-					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, 
-									  "Auto-Flush catching up %d packets (%d)ms.\n", 
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
+									  "Auto-Flush catching up %d packets (%d)ms.\n",
 									  rtp_session->sync_packets, (rtp_session->ms_per_packet * rtp_session->sync_packets) / 1000);
 #endif
 					rtp_session->sync_packets = 0;
@@ -1838,7 +1894,8 @@
 			}
 		}
 
-	recvfrom:
+	  recvfrom:
+		bytes = 0;
 
 		if (!switch_rtp_ready(rtp_session)) {
 			break;
@@ -1854,8 +1911,8 @@
 			if (rtp_session->dtmf_data.out_digit_dur > 0) {
 				do_2833(rtp_session);
 			}
-		} 
-		
+		}
+
 		if (poll_status == SWITCH_STATUS_SUCCESS) {
 			status = read_rtp_packet(rtp_session, &bytes, flags);
 		} else {
@@ -1865,8 +1922,16 @@
 			}
 
 			poll_loop = 1;
-			rtp_session->missed_count += (poll_sec * 1000 ) / (rtp_session->ms_per_packet ? rtp_session->ms_per_packet : 20 / 1000);
+			rtp_session->missed_count += (poll_sec * 1000) / (rtp_session->ms_per_packet ? rtp_session->ms_per_packet / 1000 : 20);
 			bytes = 0;
+
+			if (rtp_session->max_missed_packets) {
+				if (rtp_session->missed_count >= rtp_session->max_missed_packets) {
+					ret = -2;
+					goto end;
+				}
+			}
+
 			if (rtp_session->dtmf_data.out_digit_dur == 0 || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) {
 				return_cng_frame();
 			}
@@ -1887,8 +1952,8 @@
 		}
 
 		check = !bytes;
-		
-		if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BREAK) || (bytes && bytes == 4 && *((int *)&rtp_session->recv_msg) == UINT_MAX)) {
+
+		if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_BREAK) || (bytes && bytes == 4 && *((int *) &rtp_session->recv_msg) == UINT_MAX)) {
 			switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_BREAK);
 			do_2833(rtp_session);
 			bytes = 0;
@@ -1900,7 +1965,7 @@
 			switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_FLUSH);
 			bytes = 0;
 		}
-		
+
 		if (bytes && bytes < 5) {
 			continue;
 		}
@@ -1908,7 +1973,7 @@
 		if (!bytes && poll_loop) {
 			goto recvfrom;
 		}
-		
+
 		if (bytes && rtp_session->recv_msg.header.m && rtp_session->recv_msg.header.pt != rtp_session->te) {
 			rtp_flush_read_buffer(rtp_session, SWITCH_RTP_FLUSH_ONCE);
 		}
@@ -1926,36 +1991,34 @@
 				const char *my_host;
 
 				char bufa[30], bufb[30], bufc[30];
-				
-				
+
+
 				tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->from_addr);
 				old_host = switch_get_addr(bufb, sizeof(bufb), rtp_session->remote_addr);
 				my_host = switch_get_addr(bufc, sizeof(bufc), rtp_session->local_addr);
 
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_CONSOLE,
-								  "R %s b=%ld %s:%u %s:%u %s:%u pt=%d ts=%u m=%d\n", 
+								  "R %s b=%ld %s:%u %s:%u %s:%u pt=%d ts=%u m=%d\n",
 								  switch_channel_get_name(switch_core_session_get_channel(session)),
-								  (long)bytes,
+								  (long) bytes,
 								  my_host, switch_sockaddr_get_port(rtp_session->local_addr),
-								  old_host, rtp_session->remote_port, 
+								  old_host, rtp_session->remote_port,
 								  tx_host, switch_sockaddr_get_port(rtp_session->from_addr),
 								  rtp_session->recv_msg.header.pt, ntohl(rtp_session->recv_msg.header.ts), rtp_session->recv_msg.header.m);
-			
+
 			}
 		}
-		
+
 		/* ignore packets not meant for us unless the auto-adjust window is open */
 		if (bytes) {
 			if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ)) {
 				if (((rtp_session->cng_pt && rtp_session->recv_msg.header.pt == rtp_session->cng_pt) || rtp_session->recv_msg.header.pt == 13)) {
-					bytes = 0;
-					goto recvfrom;			 
-					
-				} 
+					goto recvfrom;
+
+				}
 			} else if (!switch_cmp_addr(rtp_session->from_addr, rtp_session->remote_addr)) {
-				bytes = 0;
-				goto recvfrom;			 
-				
+				goto recvfrom;
+
 			}
 		}
 
@@ -1970,8 +2033,8 @@
 					char adj_port[5];
 
 					tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->from_addr);
-					old_host = switch_get_addr(bufb, sizeof(bufb), rtp_session->remote_addr);			
-	
+					old_host = switch_get_addr(bufb, sizeof(bufb), rtp_session->remote_addr);
+
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
 									  "Auto Changing port from %s:%u to %s:%u\n", old_host, old, tx_host,
 									  switch_sockaddr_get_port(rtp_session->from_addr));
@@ -1979,7 +2042,7 @@
 					if (channel) {
 						switch_channel_set_variable(channel, "remote_media_ip_reported", switch_channel_get_variable(channel, "remote_media_ip"));
 						switch_channel_set_variable(channel, "remote_media_ip", tx_host);
-						switch_snprintf (adj_port, sizeof(adj_port), "%u", switch_sockaddr_get_port(rtp_session->from_addr));
+						switch_snprintf(adj_port, sizeof(adj_port), "%u", switch_sockaddr_get_port(rtp_session->from_addr));
 						switch_channel_set_variable(channel, "remote_media_port_reported", switch_channel_get_variable(channel, "remote_media_port"));
 						switch_channel_set_variable(channel, "remote_media_port", adj_port);
 						switch_channel_set_variable(channel, "rtp_auto_adjust", "true");
@@ -1993,7 +2056,7 @@
 				switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
 			}
 		}
-		
+
 		if (bytes && rtp_session->autoadj_window) {
 			if (--rtp_session->autoadj_window == 0) {
 				switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
@@ -2012,14 +2075,14 @@
 
 			if (rtp_session->recv_msg.header.pt && (rtp_session->recv_msg.header.pt == rtp_session->cng_pt || rtp_session->recv_msg.header.pt == 13)) {
 				return_cng_frame();
-			} 
+			}
 		}
 
 		if (!bytes && (io_flags & SWITCH_IO_FLAG_NOBLOCK)) {
 			return_cng_frame();
 		}
 
-		
+
 		if (check && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTO_CNG) &&
 			rtp_session->timer.samplecount >= (rtp_session->last_write_samplecount + (rtp_session->samples_per_interval * 50))) {
 			uint8_t data[10] = { 0 };
@@ -2032,23 +2095,41 @@
 		if (check || bytes) {
 			do_2833(rtp_session);
 		}
+#ifdef ENABLE_ZRTP
+		/* ZRTP Recv */
+		if (bytes) {
+			unsigned int sbytes = (int) bytes;
+			zrtp_status_t stat = 0;
 
+			stat = zrtp_process_srtp(rtp_session->zrtp_stream, (void *) &rtp_session->recv_msg, &sbytes);
+
+			switch (stat) {
+			case zrtp_status_ok:
+				bytes = sbytes;
+				break;
+			case zrtp_status_drop:
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat);
+				bytes = 0;
+				goto do_continue;
+			case zrtp_status_fail:
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat);
+				ret = -1;
+				goto end;
+			default:
+				break;
+			}
+		}
+#endif
+
 		if (bytes && rtp_session->recv_msg.header.version != 2) {
 			uint8_t *data = (uint8_t *) rtp_session->recv_msg.body;
+
 			if (rtp_session->recv_msg.header.version == 0) {
-#ifdef ENABLE_ZRTP
-				if (zrtp_on && ZRTP_PACKETS_MAGIC == zrtp_ntoh32(rtp_session->recv_msg.header.ts)) {
-					zrtp_handler(rtp_session, rtp_session->sock_input, (void *) &rtp_session->recv_msg, bytes, rtp_session->from_addr);
-				} else {
-#endif
-					if (rtp_session->ice_user) {
-						handle_ice(rtp_session, (void *) &rtp_session->recv_msg, bytes);
-					} else if (rtp_session->remote_stun_addr) {
-						handle_stun_ping_reply(rtp_session, (void *) &rtp_session->recv_msg, bytes);
-					}
-#ifdef ENABLE_ZRTP
+				if (rtp_session->ice_user) {
+					handle_ice(rtp_session, (void *) &rtp_session->recv_msg, bytes);
+				} else if (rtp_session->remote_stun_addr) {
+					handle_stun_ping_reply(rtp_session, (void *) &rtp_session->recv_msg, bytes);
 				}
-#endif
 			}
 
 			if (rtp_session->invalid_handler) {
@@ -2102,32 +2183,6 @@
 
 			bytes = sbytes;
 		}
-
-#ifdef ENABLE_ZRTP
-		/* ZRTP Recv */
-		if (bytes && switch_test_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_RECV)) {
-			unsigned int sbytes = (int) bytes;
-			zrtp_status_t stat = 0;
-			
-			stat = zrtp_process_srtp(rtp_session->zrtp_ctx, (void *)&rtp_session->recv_msg, &sbytes);
-			
-			switch (stat) {
-			case zrtp_status_ok:
-				break;
-			case zrtp_status_drop:
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat);
-				break;
-			case zrtp_status_fail:
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat);
-				ret = -1;
-				goto end;
-			default:
-				break;
-			}
-			bytes = sbytes;
-		}
-#endif
-
 #ifdef DEBUG_2833
 		if (rtp_session->dtmf_data.in_digit_sanity && !(rtp_session->dtmf_data.in_digit_sanity % 100)) {
 			printf("sanity %d\n", rtp_session->dtmf_data.in_digit_sanity);
@@ -2145,7 +2200,7 @@
 		   we put up with as much as we can so we don't have to deal with being punished for
 		   doing it right. Nice guys finish last!
 		 */
-		if (bytes && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) && 
+		if (bytes && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) &&
 			!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PASS_RFC2833) && rtp_session->recv_msg.header.pt == rtp_session->te) {
 			switch_size_t len = bytes - rtp_header_len;
 			unsigned char *packet = (unsigned char *) rtp_session->recv_msg.body;
@@ -2179,8 +2234,8 @@
 					rtp_session->dtmf_data.in_digit_seq = 0;
 				}
 			}
-#ifdef DEBUG_2833			
-			printf("packet[%d]: %02x %02x %02x %02x\n", (int) len, (unsigned) packet[0],(unsigned)
+#ifdef DEBUG_2833
+			printf("packet[%d]: %02x %02x %02x %02x\n", (int) len, (unsigned) packet[0], (unsigned)
 				   packet[1], (unsigned) packet[2], (unsigned) packet[3]);
 #endif
 
@@ -2188,9 +2243,9 @@
 
 				rtp_session->dtmf_data.in_digit_seq = in_digit_seq;
 #ifdef DEBUG_2833
-				
-				printf("read: %c %u %u %u %u %d %d %s\n", 
-					   key, in_digit_seq, rtp_session->dtmf_data.in_digit_seq, 
+
+				printf("read: %c %u %u %u %u %d %d %s\n",
+					   key, in_digit_seq, rtp_session->dtmf_data.in_digit_seq,
 					   ts, duration, rtp_session->recv_msg.header.m, end, end && !rtp_session->dtmf_data.in_digit_ts ? "ignored" : "");
 #endif
 				/* only set sanity if we do NOT ignore the packet */
@@ -2198,10 +2253,10 @@
 					rtp_session->dtmf_data.in_digit_sanity = 2000;
 				}
 
-				if (rtp_session->dtmf_data.last_duration > duration && ts == rtp_session->dtmf_data.in_digit_ts) {
+				if (rtp_session->dtmf_data.last_duration > duration && rtp_session->dtmf_data.last_duration > 0xFC17 && ts == rtp_session->dtmf_data.in_digit_ts) {
 					rtp_session->dtmf_data.flip++;
 				}
-				
+
 				if (end) {
 					if (rtp_session->dtmf_data.in_digit_ts) {
 						switch_dtmf_t dtmf = { key, duration };
@@ -2216,9 +2271,8 @@
 							printf("you're welcome!\n");
 #endif
 						}
-
 #ifdef DEBUG_2833
-						printf("done digit=%c ts=%u start_ts=%u dur=%u ddur=%u\n", 
+						printf("done digit=%c ts=%u start_ts=%u dur=%u ddur=%u\n",
 							   dtmf.digit, ts, rtp_session->dtmf_data.in_digit_ts, duration, dtmf.duration);
 #endif
 						switch_rtp_queue_rfc2833_in(rtp_session, &dtmf);
@@ -2244,29 +2298,28 @@
 				rtp_session->dtmf_data.last_duration = duration;
 			} else {
 #ifdef DEBUG_2833
-				printf("drop: %c %u %u %u %u %d %d\n", 
+				printf("drop: %c %u %u %u %u %d %d\n",
 					   key, in_digit_seq, rtp_session->dtmf_data.in_digit_seq, ts, duration, rtp_session->recv_msg.header.m, end);
 #endif
 				switch_cond_next();
 				goto recvfrom;
 			}
 		}
-		
+
 		if (rtp_session->dtmf_data.in_digit_ts) {
 			if (!switch_rtp_ready(rtp_session)) {
 				goto end;
 			}
-			switch_cond_next();
-			goto recvfrom;
+			return_cng_frame();
 		}
 
-	timer_check:
+	  timer_check:
 
 		if (do_cng) {
 			uint8_t *data = (uint8_t *) rtp_session->recv_msg.body;
 			int fdr;
-			
-			if ((poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, 1)) == SWITCH_STATUS_SUCCESS) {
+
+			if ((poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, 0)) == SWITCH_STATUS_SUCCESS) {
 				goto recvfrom;
 			}
 
@@ -2286,7 +2339,7 @@
 					switch_cond_next();
 					continue;
 				}
-				
+
 				return_cng_frame();
 			}
 		}
@@ -2308,7 +2361,7 @@
 		break;
 
 	  do_continue:
-		
+
 		if (!bytes && !rtp_session->timer.interval) {
 			switch_yield(sleep_mss);
 		}
@@ -2476,17 +2529,45 @@
 	if (zrtp_on && switch_test_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV)) {
 		zrtp_session_info_t zrtp_session_info;
 
-		if (zrtp_status_ok == zrtp_session_get(rtp_session->zrtp_session, &zrtp_session_info)) { 
-			if (zrtp_session_info.sas_is_ready) {    
-				frame->extra_data = rtp_session->zrtp_ctx;
-				switch_set_flag(frame, SFF_ZRTP);
-				if (rtp_session->zrtp_mitm_tries > ZRTP_MITM_TRIES) {
-					zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid, 
-									  &rtp_session->zrtp_session->peer_zid, zrtp_session_info.sas_is_verified^1);
-					switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
+		if (rtp_session->zrtp_session && (zrtp_status_ok == zrtp_session_get(rtp_session->zrtp_session, &zrtp_session_info))) {
+			if (zrtp_session_info.sas_is_ready) {
+				switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
+				switch_channel_t *channel = switch_core_session_get_channel(session);
+
+				const char *uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
+				if (uuid) {
+					switch_core_session_t *other_session;
+
+					if ((other_session = switch_core_session_locate(uuid))) {
+						switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
+						switch_rtp_t *other_rtp_session = switch_channel_get_private(other_channel, "__zrtp_audio_rtp_session");
+
+						if (other_rtp_session) {
+							if (zrtp_status_ok == zrtp_session_get(other_rtp_session->zrtp_session, &zrtp_session_info)) {
+								if (rtp_session->zrtp_mitm_tries > ZRTP_MITM_TRIES) {
+									switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
+									switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
+									switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
+									switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
+								} else if (zrtp_status_ok == zrtp_resolve_mitm_call(other_rtp_session->zrtp_stream, rtp_session->zrtp_stream)) {
+									switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
+									switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
+									switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
+									switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
+									zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid,
+													  &rtp_session->zrtp_session->peer_zid, zrtp_session_info.sas_is_verified ^ 1);
+									rtp_session->zrtp_mitm_tries++;
+								}
+							}
+						}
+
+						switch_core_session_rwunlock(other_session);
+					}
 				}
-				rtp_session->zrtp_mitm_tries++;
 			}
+		} else {
+			switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
+			switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
 		}
 	}
 #endif
@@ -2565,7 +2646,7 @@
 			rtp_session->ts = (uint32_t) timestamp;
 		} else if (rtp_session->timer.timer_interface) {
 			rtp_session->ts = rtp_session->timer.samplecount;
-			
+
 			if (rtp_session->ts <= rtp_session->last_write_ts) {
 				rtp_session->ts = rtp_session->last_write_ts + rtp_session->samples_per_interval;
 			}
@@ -2581,13 +2662,12 @@
 			m++;
 		}
 
-		if (rtp_session->timer.interval && 
-			(rtp_session->timer.samplecount - rtp_session->last_write_samplecount) > rtp_session->samples_per_interval * 10) {
+		if (rtp_session->timer.interval && (rtp_session->timer.samplecount - rtp_session->last_write_samplecount) > rtp_session->samples_per_interval * 10) {
 			m++;
 		}
 
-		if (!rtp_session->timer.interval && 
-			((unsigned)((switch_micro_time_now() - rtp_session->last_write_timestamp))) > (rtp_session->ms_per_packet * 10)) {
+		if (!rtp_session->timer.interval &&
+			((unsigned) ((switch_micro_time_now() - rtp_session->last_write_timestamp))) > (rtp_session->ms_per_packet * 10)) {
 			m++;
 		}
 
@@ -2744,17 +2824,19 @@
 		}
 #ifdef ENABLE_ZRTP
 		/* ZRTP Send */
-		if (switch_test_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_SEND)) {
+		if (1) {
 			unsigned int sbytes = (int) bytes;
 			zrtp_status_t stat = zrtp_status_fail;
-			
-			stat = zrtp_process_rtp(rtp_session->zrtp_ctx, (void*)send_msg, &sbytes);
 
+			stat = zrtp_process_rtp(rtp_session->zrtp_stream, (void *) send_msg, &sbytes);
+
 			switch (stat) {
 			case zrtp_status_ok:
 				break;
 			case zrtp_status_drop:
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat);
+				ret = (int) bytes;
+				goto end;
 				break;
 			case zrtp_status_fail:
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat);
@@ -2762,7 +2844,7 @@
 			default:
 				break;
 			}
-			
+
 			bytes = sbytes;
 		}
 #endif
@@ -2771,7 +2853,7 @@
 		{
 			switch_time_t now = switch_time_now();
 			int delta = (int) (now - rtp_session->send_time) / 1000;
-			printf("WRITE %d delta %d\n", (int)bytes, delta);
+			printf("WRITE %d delta %d\n", (int) bytes, delta);
 			rtp_session->send_time = now;
 		}
 #endif
@@ -2789,21 +2871,21 @@
 				const char *my_host;
 
 				char bufa[30], bufb[30], bufc[30];
-				
-				
+
+
 				tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->from_addr);
 				old_host = switch_get_addr(bufb, sizeof(bufb), rtp_session->remote_addr);
 				my_host = switch_get_addr(bufc, sizeof(bufc), rtp_session->local_addr);
 
 				switch_log_printf(SWITCH_CHANNEL_SESSION_LOG_CLEAN(session), SWITCH_LOG_CONSOLE,
-								  "W %s b=%ld %s:%u %s:%u %s:%u pt=%d ts=%u m=%d\n", 
+								  "W %s b=%ld %s:%u %s:%u %s:%u pt=%d ts=%u m=%d\n",
 								  switch_channel_get_name(switch_core_session_get_channel(session)),
-								  (long)bytes,
+								  (long) bytes,
 								  my_host, switch_sockaddr_get_port(rtp_session->local_addr),
-								  old_host, rtp_session->remote_port, 
+								  old_host, rtp_session->remote_port,
 								  tx_host, switch_sockaddr_get_port(rtp_session->from_addr),
 								  send_msg->header.pt, ntohl(send_msg->header.ts), send_msg->header.m);
-			
+
 			}
 		}
 
@@ -2918,11 +3000,11 @@
 	uint32_t len, ts = 0;
 	switch_payload_t payload = 0;
 	rtp_msg_t *send_msg = NULL;
-	
+
 	if (!switch_rtp_ready(rtp_session) || !rtp_session->remote_addr) {
 		return -1;
 	}
-
+	
 	if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA)) {
 		switch_size_t bytes;
 		char bufa[30];
@@ -2933,8 +3015,8 @@
 		}
 		bytes = frame->packetlen;
 		tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->remote_addr);
-		
 
+
 		send_msg = frame->packet;
 
 		if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) {
@@ -2944,29 +3026,54 @@
 		if (switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_addr, 0, frame->packet, &bytes) != SWITCH_STATUS_SUCCESS) {
 			return -1;
 		}
-		
 
+
 		rtp_session->stats.outbound.raw_bytes += bytes;
 		rtp_session->stats.outbound.media_bytes += bytes;
 		rtp_session->stats.outbound.media_packet_count++;
 		rtp_session->stats.outbound.packet_count++;
-
 		return (int) bytes;
 	}
-
 #ifdef ENABLE_ZRTP
-	if (zrtp_on && switch_test_flag(frame, SFF_ZRTP) && switch_test_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND)) {
+	if (zrtp_on && switch_test_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND)) {
 		zrtp_session_info_t zrtp_session_info;
 
-		if (zrtp_status_ok == zrtp_session_get(rtp_session->zrtp_session, &zrtp_session_info)) { 
-			if (zrtp_session_info.sas_is_ready) {    
-				if (rtp_session->zrtp_mitm_tries > ZRTP_MITM_TRIES) {
-					switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
-				} else if(zrtp_status_ok == zrtp_resolve_mitm_call(frame->extra_data, rtp_session->zrtp_ctx)) {
-					switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
-					zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid, 
-									  &rtp_session->zrtp_session->peer_zid, zrtp_session_info.sas_is_verified^1);
-					rtp_session->zrtp_mitm_tries++;
+		if (zrtp_status_ok == zrtp_session_get(rtp_session->zrtp_session, &zrtp_session_info)) {
+			if (zrtp_session_info.sas_is_ready) {
+				switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
+				switch_channel_t *channel = switch_core_session_get_channel(session);
+
+				const char *uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
+				if (uuid) {
+					switch_core_session_t *other_session;
+
+					if ((other_session = switch_core_session_locate(uuid))) {
+						switch_channel_t *other_channel = switch_core_session_get_channel(other_session);
+						switch_rtp_t *other_rtp_session = switch_channel_get_private(other_channel, "__zrtp_audio_rtp_session");
+
+
+						if (other_rtp_session) {
+							if (zrtp_status_ok == zrtp_session_get(other_rtp_session->zrtp_session, &zrtp_session_info)) {
+								if (rtp_session->zrtp_mitm_tries > ZRTP_MITM_TRIES) {
+									switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
+									switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
+									switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
+									switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
+								} else if (zrtp_status_ok == zrtp_resolve_mitm_call(other_rtp_session->zrtp_stream, rtp_session->zrtp_stream)) {
+									switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
+									switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
+									switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_RECV);
+									switch_clear_flag(other_rtp_session, SWITCH_ZRTP_FLAG_SECURE_MITM_SEND);
+									zrtp_verified_set(zrtp_global, &rtp_session->zrtp_session->zid,
+													  &rtp_session->zrtp_session->peer_zid, zrtp_session_info.sas_is_verified ^ 1);
+									rtp_session->zrtp_mitm_tries++;
+								}
+								rtp_session->zrtp_mitm_tries++;
+							}
+						}
+
+						switch_core_session_rwunlock(other_session);
+					}
 				}
 			}
 		}
@@ -2981,14 +3088,14 @@
 		if (rtp_session->cng_pt) {
 			payload = rtp_session->cng_pt;
 		} else {
-			return (int)frame->packetlen;
+			return (int) frame->packetlen;
 		}
 	} else {
 		payload = rtp_session->payload;
 	}
 
 	if (switch_test_flag(frame, SFF_RTP_HEADER)) {
-		switch_size_t wrote = switch_rtp_write_manual(rtp_session, frame->data, frame->datalen, 
+		switch_size_t wrote = switch_rtp_write_manual(rtp_session, frame->data, frame->datalen,
 													  frame->m, frame->payload, (uint32_t) (frame->timestamp), &frame->flags);
 
 		rtp_session->stats.outbound.raw_bytes += wrote;
@@ -3010,6 +3117,10 @@
 		ts = switch_test_flag(rtp_session, SWITCH_RTP_FLAG_RAW_WRITE) ? (uint32_t) frame->timestamp : 0;
 	}
 
+	if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_VIDEO)) {
+		send_msg->header.pt = rtp_session->payload;
+	}
+
 	return rtp_common_write(rtp_session, send_msg, data, len, payload, ts, &frame->flags);
 }
 
@@ -3073,17 +3184,19 @@
 	}
 #ifdef ENABLE_ZRTP
 	/* ZRTP Send */
-	if (switch_test_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_SEND)) {
+	if (1) {
 		unsigned int sbytes = (int) bytes;
 		zrtp_status_t stat = zrtp_status_fail;
-		
-		stat = zrtp_process_rtp(rtp_session->zrtp_ctx, (void*)&rtp_session->write_msg, &sbytes);
-		
+
+		stat = zrtp_process_rtp(rtp_session->zrtp_stream, (void *) &rtp_session->write_msg, &sbytes);
+
 		switch (stat) {
 		case zrtp_status_ok:
 			break;
 		case zrtp_status_drop:
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat);
+			ret = (int) bytes;
+			goto end;
 			break;
 		case zrtp_status_fail:
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat);
@@ -3091,10 +3204,11 @@
 		default:
 			break;
 		}
-		
+
 		bytes = sbytes;
 	}
 #endif
+
 	if (switch_socket_sendto(rtp_session->sock_output, rtp_session->remote_addr, 0, (void *) &rtp_session->write_msg, &bytes) != SWITCH_STATUS_SUCCESS) {
 		rtp_session->seq--;
 		ret = -1;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_scheduler.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_scheduler.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_scheduler.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -308,7 +308,7 @@
 		switch_status_t st;
 
 		globals.task_thread_running = -1;
-		
+
 		switch_thread_join(&st, task_thread_p);
 
 		while (globals.task_thread_running) {

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_stun.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_stun.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_stun.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -343,7 +343,7 @@
 	char *p = ipstr;
 
 	ip = (switch_stun_ip_t *) attribute->value;
-	i = (uint8_t *) &ip->address;
+	i = (uint8_t *) & ip->address;
 	*ipstr = 0;
 	for (x = 0; x < 4; x++) {
 		sprintf(p, "%u%s", i[x], x == 3 ? "" : ".");
@@ -386,14 +386,14 @@
 	uint8_t *i, x;
 	char *p = ipstr;
 
-	attribute = (switch_stun_packet_attribute_t *) ((uint8_t *) &packet->first_attribute + ntohs(packet->header.length));
+	attribute = (switch_stun_packet_attribute_t *) ((uint8_t *) & packet->first_attribute + ntohs(packet->header.length));
 	attribute->type = htons(SWITCH_STUN_ATTR_MAPPED_ADDRESS);
 	attribute->length = htons(8);
 	ip = (switch_stun_ip_t *) attribute->value;
 
 	ip->port = htons(port);
 	ip->family = 1;
-	i = (uint8_t *) &ip->address;
+	i = (uint8_t *) & ip->address;
 
 	for (x = 0; x < 4; x++) {
 		i[x] = (uint8_t) atoi(p);
@@ -415,7 +415,7 @@
 	if (ulen % 4 != 0) {
 		return 0;
 	}
-	attribute = (switch_stun_packet_attribute_t *) ((uint8_t *) &packet->first_attribute + ntohs(packet->header.length));
+	attribute = (switch_stun_packet_attribute_t *) ((uint8_t *) & packet->first_attribute + ntohs(packet->header.length));
 	attribute->type = htons(SWITCH_STUN_ATTR_USERNAME);
 	attribute->length = htons(ulen);
 	if (username) {
@@ -432,10 +432,10 @@
 {
 	switch_sockaddr_t *addr = NULL;
 	char buf[30];
-	
+
 	switch_sockaddr_info_get(&addr, host, SWITCH_UNSPEC, 0, 0, pool);
 	return switch_core_strdup(pool, switch_str_nil(switch_get_addr(buf, sizeof(buf), addr)));
-	
+
 }
 
 SWITCH_DECLARE(switch_status_t) switch_stun_lookup(char **ip,
@@ -508,7 +508,7 @@
 		buf[bytes++] = 0;
 		buf[bytes++] = 0;
 	}
-	
+
 	switch_socket_sendto(sock, remote_addr, 0, (void *) packet, &bytes);
 	started = switch_micro_time_now();
 
@@ -549,7 +549,7 @@
 		case SWITCH_STUN_ATTR_MAPPED_ADDRESS:
 			if (attr->type) {
 				if (funny) {
-					switch_stun_ip_t *tmp = (switch_stun_ip_t *)attr->value;
+					switch_stun_ip_t *tmp = (switch_stun_ip_t *) attr->value;
 					tmp->address ^= ntohl(0xabcdabcd);
 				}
 				switch_stun_packet_attribute_get_mapped_address(attr, rip, &rport);

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_swig.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_swig.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_swig.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /*
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_time.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_time.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_time.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -45,6 +45,32 @@
 
 #define MAX_TICK UINT32_MAX - 1024
 
+#define MAX_ELEMENTS 3600
+#define IDLE_SPEED 100
+
+#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
+static int MONO = 1;
+#else
+static int MONO = 0;
+#endif
+
+#if defined(HAVE_CLOCK_NANOSLEEP)
+static int NANO = 1;
+#else
+static int NANO = 0;
+#endif
+
+
+static int OFFSET = 0;
+
+static int COND = 0;
+
+static int MATRIX = 1;
+
+static int STEP_MS = 10;
+static int STEP_MIC = 10000;
+static uint32_t TICK_PER_SEC = 1000;
+
 static int MS_PER_TICK = 10;
 
 static switch_memory_pool_t *module_pool = NULL;
@@ -66,11 +92,6 @@
 SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime);
 SWITCH_MODULE_DEFINITION(CORE_SOFTTIMER_MODULE, softtimer_load, softtimer_shutdown, softtimer_runtime);
 
-#define MAX_ELEMENTS 3600
-#define IDLE_SPEED 100
-#define STEP_MS 1
-#define STEP_MIC 1000
-
 struct timer_private {
 	switch_size_t reference;
 	switch_size_t start;
@@ -85,32 +106,167 @@
 	uint32_t roll;
 	switch_mutex_t *mutex;
 	switch_thread_cond_t *cond;
+	switch_thread_rwlock_t *rwlock;
 };
 typedef struct timer_matrix timer_matrix_t;
 
 static timer_matrix_t TIMER_MATRIX[MAX_ELEMENTS + 1];
 
+static void os_yield(void)
+{
+#if defined(WIN32)
+	SwitchToThread();
+#else
+	sched_yield();
+#endif
+}
+
 static void do_sleep(switch_interval_time_t t)
 {
+#if defined(HAVE_CLOCK_NANOSLEEP) || defined(DARWIN)
+	struct timespec ts;
+#endif
+
 #if defined(WIN32)
 	if (t < 1000) {
 		t = 1000;
 	}
 #endif
 
-#if defined(DARWIN)
-	struct timespec ts;
+#if !defined(DARWIN)
+	if (t > 100000 || !NANO) {
+		apr_sleep(t);
+		return;
+	}
+#endif
+
+#if defined(HAVE_CLOCK_NANOSLEEP)
+	t -= OFFSET;
+	ts.tv_sec = t / 1000000;
+	ts.tv_nsec = ((t % 1000000) * 1000);
+	clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, NULL);
+
+#elif defined(DARWIN)
 	ts.tv_sec = t / APR_USEC_PER_SEC;
 	ts.tv_nsec = (t % APR_USEC_PER_SEC) * 1000;
-	
 	nanosleep(&ts, NULL);
-	sched_yield();
 #else
 	apr_sleep(t);
 #endif
 
+#if defined(DARWIN)
+	sched_yield();
+#endif
+
 }
 
+static switch_interval_time_t average_time(switch_interval_time_t t, int reps)
+{
+	int x = 0;
+	switch_time_t start, stop, sum = 0;
+
+	for (x = 0; x < reps; x++) {
+		start = switch_time_now();
+		do_sleep(t);
+		stop = switch_time_now();
+		sum += (stop - start);
+	}
+
+	return sum / reps;
+
+}
+
+#define calc_step() if (step > 11) step -= 10; else if (step > 1) step--
+SWITCH_DECLARE(void) switch_time_calibrate_clock(void)
+{
+	int x;
+	switch_interval_time_t avg, val = 1000, want = 1000;
+	int over = 0, under = 0, good = 0, step = 50, diff = 0, retry = 0, lastgood = 0;
+
+#ifdef HAVE_CLOCK_GETRES
+	struct timespec ts;
+	clock_getres(CLOCK_MONOTONIC, &ts);
+	if (ts.tv_nsec / 1000 > 1500) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+						  "Timer resolution of %ld microseconds detected!\n"
+						  "Do you have your kernel timer set to higher than 1 kHz? You may experience audio problems.\n", ts.tv_nsec / 1000);
+		do_sleep(5000000);
+		switch_time_set_cond_yield(SWITCH_TRUE);
+		return;
+	}
+#endif
+
+  top:
+	val = 1000;
+	step = 50;
+	over = under = good = 0;
+	OFFSET = 0;
+
+	for (x = 0; x < 100; x++) {
+		avg = average_time(val, 50);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Test: %ld Average: %ld Step: %d\n", (long) val, (long) avg, step);
+
+		diff = abs((int) (want - avg));
+		if (diff > 1500) {
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+							  "Abnormally large timer gap %d detected!\n"
+							  "Do you have your kernel timer set to higher than 1 kHz? You may experience audio problems.\n", diff);
+			do_sleep(5000000);
+			switch_time_set_cond_yield(SWITCH_TRUE);
+			return;
+		}
+
+		if (diff <= 100) {
+			lastgood = (int) val;
+		}
+
+		if (diff <= 2) {
+			under = over = 0;
+			lastgood = (int) val;
+			if (++good > 10) {
+				break;
+			}
+		} else if (avg > want) {
+			if (under) {
+				calc_step();
+			}
+			under = good = 0;
+			if ((val - step) < 0) {
+				if (++retry > 2)
+					break;
+				goto top;
+			}
+			val -= step;
+			over++;
+		} else if (avg < want) {
+			if (over) {
+				calc_step();
+			}
+			over = good = 0;
+			if ((val - step) < 0) {
+				if (++retry > 2)
+					break;
+				goto top;
+			}
+			val += step;
+			under++;
+		}
+	}
+
+	if (good >= 10) {
+		OFFSET = (int) (want - val);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Timer offset of %d calculated\n", OFFSET);
+	} else if (lastgood) {
+		OFFSET = (int) (want - lastgood);
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Timer offset of %d calculated (fallback)\n", OFFSET);
+		switch_time_set_cond_yield(SWITCH_TRUE);
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Timer offset NOT calculated\n");
+		switch_time_set_cond_yield(SWITCH_TRUE);
+	}
+}
+
+
 SWITCH_DECLARE(switch_time_t) switch_micro_time_now(void)
 {
 	return (globals.RUNNING == 1 && runtime.timestamp) ? runtime.timestamp : switch_time_now();
@@ -126,19 +282,35 @@
 	return now;
 }
 
-#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
-static int MONO = 1;
-#else
-static int MONO = 0;
-#endif
-
-
 SWITCH_DECLARE(void) switch_time_set_monotonic(switch_bool_t enable)
 {
 	MONO = enable ? 1 : 0;
 	switch_time_sync();
 }
 
+
+SWITCH_DECLARE(void) switch_time_set_matrix(switch_bool_t enable)
+{
+	MATRIX = enable ? 1 : 0;
+	switch_time_sync();
+}
+
+SWITCH_DECLARE(void) switch_time_set_nanosleep(switch_bool_t enable)
+{
+#if defined(HAVE_CLOCK_NANOSLEEP)
+	NANO = enable ? 1 : 0;
+#endif
+}
+
+SWITCH_DECLARE(void) switch_time_set_cond_yield(switch_bool_t enable)
+{
+	COND = enable ? 1 : 0;
+	if (COND) {
+		MATRIX = 1;
+	}
+	switch_time_sync();
+}
+
 static switch_time_t time_now(int64_t offset)
 {
 	switch_time_t now;
@@ -174,17 +346,16 @@
 SWITCH_DECLARE(void) switch_sleep(switch_interval_time_t t)
 {
 
-	if (!globals.RUNNING || t < 1000 || t >= 10000) {
+	if (globals.RUNNING != 1 || t < 1000 || t >= 10000) {
 		do_sleep(t);
 		return;
 	}
-
 #ifndef DISABLE_1MS_COND
 	if (globals.use_cond_yield == 1) {
 		switch_cond_yield(t);
 		return;
 	}
-#endif	
+#endif
 
 	do_sleep(t);
 }
@@ -192,6 +363,10 @@
 
 SWITCH_DECLARE(void) switch_cond_next(void)
 {
+	if (session_manager.session_count > 1000) {
+		os_yield();
+		return;
+	}
 #ifdef DISABLE_1MS_COND
 	do_sleep(1000);
 #else
@@ -208,14 +383,15 @@
 SWITCH_DECLARE(void) switch_cond_yield(switch_interval_time_t t)
 {
 	switch_time_t want;
-	if (!t) return;
+	if (!t)
+		return;
 
 	if (globals.RUNNING != 1 || !runtime.timestamp || globals.use_cond_yield != 1) {
 		do_sleep(t);
 		return;
 	}
 	want = runtime.timestamp + t;
-	while(globals.RUNNING == 1 && globals.use_cond_yield == 1 && runtime.timestamp < want) {
+	while (globals.RUNNING == 1 && globals.use_cond_yield == 1 && runtime.timestamp < want) {
 		switch_mutex_lock(TIMER_MATRIX[1].mutex);
 		if (runtime.timestamp < want) {
 			switch_thread_cond_wait(TIMER_MATRIX[1].cond, TIMER_MATRIX[1].mutex);
@@ -257,6 +433,10 @@
 
 		if (timer->interval > 0 && timer->interval < MS_PER_TICK) {
 			MS_PER_TICK = timer->interval;
+			STEP_MS = 1;
+			STEP_MIC = 1000;
+			TICK_PER_SEC = 10000;
+			switch_time_sync();
 		}
 
 		return SWITCH_STATUS_SUCCESS;
@@ -324,32 +504,39 @@
 #else
 	int cond_index = 1;
 #endif
-	int delta = (int)(private_info->reference - TIMER_MATRIX[timer->interval].tick);
+	int delta = (int) (private_info->reference - TIMER_MATRIX[timer->interval].tick);
 
 	/* sync up timer if it's not been called for a while otherwise it will return instantly several times until it catches up */
-	if (delta < -1) { 
+	if (delta < -1) {
 		private_info->reference = timer->tick = TIMER_MATRIX[timer->interval].tick;
 	}
 	timer_step(timer);
 
+	if (!MATRIX) {
+		do_sleep(1000 * timer->interval);
+		goto end;
+	}
+
 	while (globals.RUNNING == 1 && private_info->ready && TIMER_MATRIX[timer->interval].tick < private_info->reference) {
 		check_roll();
-		if (globals.use_cond_yield == 1) {
-			switch_mutex_lock(TIMER_MATRIX[cond_index].mutex);		
-			if (TIMER_MATRIX[timer->interval].tick < private_info->reference) {
-				switch_thread_cond_wait(TIMER_MATRIX[cond_index].cond, TIMER_MATRIX[cond_index].mutex);	
+
+		if (session_manager.session_count > runtime.tipping_point) {
+			os_yield();
+		} else {
+			if (globals.use_cond_yield == 1) {
+				switch_mutex_lock(TIMER_MATRIX[cond_index].mutex);
+				if (TIMER_MATRIX[timer->interval].tick < private_info->reference) {
+					switch_thread_cond_wait(TIMER_MATRIX[cond_index].cond, TIMER_MATRIX[cond_index].mutex);
+				}
+				switch_mutex_unlock(TIMER_MATRIX[cond_index].mutex);
+			} else {
+				do_sleep(1000);
 			}
-			switch_mutex_unlock(TIMER_MATRIX[cond_index].mutex);
-		} else {
-			do_sleep(1000);
 		}
 	}
-	
-	if (globals.RUNNING == 1) {
-		return SWITCH_STATUS_SUCCESS;
-	}
 
-	return SWITCH_STATUS_FALSE;
+  end:
+	return globals.RUNNING == 1 ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE;
 }
 
 static switch_status_t timer_check(switch_timer_t *timer, switch_bool_t step)
@@ -406,6 +593,13 @@
 	switch_time_t ts = 0, last = 0;
 	int fwd_errs = 0, rev_errs = 0;
 
+#ifdef HAVE_CPU_SET_MACROS
+	cpu_set_t set;
+	CPU_ZERO(&set);
+	CPU_SET(0, &set);
+	sched_setaffinity(0, sizeof(set), &set);
+#endif
+
 	switch_time_sync();
 
 	globals.STARTED = globals.RUNNING = 1;
@@ -421,6 +615,7 @@
 			if (ts == last) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Broken MONOTONIC Clock Detected!, Support Disabled.\n");
 				MONO = 0;
+				NANO = 0;
 				runtime.reference = switch_time_now();
 				runtime.initiated = runtime.reference;
 				break;
@@ -435,15 +630,20 @@
 	fwd_errs = rev_errs = 0;
 
 #ifndef DISABLE_1MS_COND
-	switch_mutex_init(&TIMER_MATRIX[1].mutex, SWITCH_MUTEX_NESTED, module_pool);
-	switch_thread_cond_create(&TIMER_MATRIX[1].cond, module_pool);
+	if (!NANO) {
+		switch_mutex_init(&TIMER_MATRIX[1].mutex, SWITCH_MUTEX_NESTED, module_pool);
+		switch_thread_cond_create(&TIMER_MATRIX[1].cond, module_pool);
+	}
 #endif
 
-	globals.use_cond_yield = globals.RUNNING == 1;
 
+	switch_time_sync();
+
+	globals.use_cond_yield = COND;
+	globals.RUNNING = 1;
+
 	while (globals.RUNNING == 1) {
 		runtime.reference += STEP_MIC;
-
 		while ((ts = time_now(runtime.offset)) < runtime.reference) {
 			if (ts < last) {
 				if (MONO) {
@@ -461,11 +661,16 @@
 			} else {
 				rev_errs = 0;
 			}
-			do_sleep(STEP_MIC);
+
+			if (session_manager.session_count > runtime.tipping_point) {
+				os_yield();
+			} else {
+				do_sleep(1000);
+			}
+
 			last = ts;
 		}
 
-
 		if (ts > (runtime.reference + too_late)) {
 			if (MONO) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Virtual Migration Detected! Syncing Clock\n");
@@ -495,7 +700,7 @@
 		current_ms += STEP_MS;
 		tick += STEP_MS;
 
-		if (tick >= 1000) {
+		if (tick >= TICK_PER_SEC) {
 			if (runtime.sps <= 0) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Over Session Rate of %d!\n", runtime.sps_total);
 			}
@@ -505,7 +710,6 @@
 			switch_mutex_unlock(runtime.throttle_mutex);
 			tick = 0;
 		}
-
 #ifndef DISABLE_1MS_COND
 		TIMER_MATRIX[1].tick++;
 		if (switch_mutex_trylock(TIMER_MATRIX[1].mutex) == SWITCH_STATUS_SUCCESS) {
@@ -519,12 +723,13 @@
 #endif
 
 
-		if ((current_ms % MS_PER_TICK) == 0) {
+		if (MATRIX && (current_ms % MS_PER_TICK) == 0) {
 			for (x = MS_PER_TICK; x <= MAX_ELEMENTS; x += MS_PER_TICK) {
 				if ((current_ms % x) == 0) {
 					if (TIMER_MATRIX[x].count) {
 						TIMER_MATRIX[x].tick++;
 #ifdef DISABLE_1MS_COND
+
 						if (TIMER_MATRIX[x].mutex && switch_mutex_trylock(TIMER_MATRIX[x].mutex) == SWITCH_STATUS_SUCCESS) {
 							switch_thread_cond_broadcast(TIMER_MATRIX[x].cond);
 							switch_mutex_unlock(TIMER_MATRIX[x].mutex);
@@ -545,7 +750,7 @@
 	}
 
 	globals.use_cond_yield = 0;
-	
+
 	for (x = MS_PER_TICK; x <= MAX_ELEMENTS; x += MS_PER_TICK) {
 		if (TIMER_MATRIX[x].mutex && switch_mutex_trylock(TIMER_MATRIX[x].mutex) == SWITCH_STATUS_SUCCESS) {
 			switch_thread_cond_broadcast(TIMER_MATRIX[x].cond);
@@ -569,26 +774,26 @@
    and use switch_* functions for the output.
 */
 
-static void tm2switchtime(struct tm * tm, switch_time_exp_t *xt ) 
+static void tm2switchtime(struct tm *tm, switch_time_exp_t *xt)
 {
 
 	if (!xt || !tm) {
-	    return;
+		return;
 	}
-	memset( xt, 0, sizeof(xt) );
+	memset(xt, 0, sizeof(xt));
 
-	xt->tm_sec  	= tm->tm_sec;
-	xt->tm_min  	= tm->tm_min;
-	xt->tm_hour 	= tm->tm_hour;
-	xt->tm_mday 	= tm->tm_mday;
-	xt->tm_mon  	= tm->tm_mon;
-	xt->tm_year 	= tm->tm_year;
-	xt->tm_wday 	= tm->tm_wday;
-	xt->tm_yday 	= tm->tm_yday;
-	xt->tm_isdst 	= tm->tm_isdst;
+	xt->tm_sec = tm->tm_sec;
+	xt->tm_min = tm->tm_min;
+	xt->tm_hour = tm->tm_hour;
+	xt->tm_mday = tm->tm_mday;
+	xt->tm_mon = tm->tm_mon;
+	xt->tm_year = tm->tm_year;
+	xt->tm_wday = tm->tm_wday;
+	xt->tm_yday = tm->tm_yday;
+	xt->tm_isdst = tm->tm_isdst;
 
 #if defined(HAVE_STRUCT_TM_TM_GMTOFF)
-	xt->tm_gmtoff 	= tm->tm_gmtoff;
+	xt->tm_gmtoff = tm->tm_gmtoff;
 #endif
 
 	return;
@@ -606,14 +811,14 @@
 static switch_timezones_list_t TIMEZONES_LIST = { 0 };
 static switch_event_node_t *NODE = NULL;
 
-const char *switch_lookup_timezone( const char *tz_name )
+const char *switch_lookup_timezone(const char *tz_name)
 {
 	char *value = NULL;
 
-	if ( tz_name && (value = switch_core_hash_find(TIMEZONES_LIST.hash, tz_name))==NULL ) {
-	    switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timezone '%s' not found!\n", tz_name);
+	if (tz_name && (value = switch_core_hash_find(TIMEZONES_LIST.hash, tz_name)) == NULL) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timezone '%s' not found!\n", tz_name);
 	}
-	
+
 	return value;
 }
 
@@ -638,7 +843,7 @@
 		if ((x_lists = switch_xml_child(cfg, "timezones"))) {
 			for (x_list = switch_xml_child(x_lists, "zone"); x_list; x_list = x_list->next) {
 				const char *name = switch_xml_attr(x_list, "name");
-				const char *value= switch_xml_attr(x_list, "value");
+				const char *value = switch_xml_attr(x_list, "value");
 
 				if (zstr(name)) {
 					continue;
@@ -648,16 +853,14 @@
 					continue;
 				}
 
-				switch_core_hash_insert(TIMEZONES_LIST.hash, 
-										name, 
-										switch_core_strdup(TIMEZONES_LIST.pool, value) );
+				switch_core_hash_insert(TIMEZONES_LIST.hash, name, switch_core_strdup(TIMEZONES_LIST.pool, value));
 				total++;
 			}
 		}
-		
+
 		switch_xml_free(xml);
 	}
-	
+
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Timezone %sloaded %d definitions\n", reload ? "re" : "", total);
 }
 
@@ -668,7 +871,7 @@
 	switch_mutex_unlock(globals.mutex);
 }
 
-static void tztime(const time_t * const timep, const char *tzstring, struct tm * const tmp );
+static void tztime(const time_t *const timep, const char *tzstring, struct tm *const tmp);
 
 SWITCH_DECLARE(switch_status_t) switch_time_exp_tz_name(const char *tz, switch_time_exp_t *tm, switch_time_t thetime)
 {
@@ -676,24 +879,24 @@
 	const char *tz_name = tz;
 	const char *tzdef;
 	time_t timep;
-	
+
 	if (!thetime) {
 		thetime = switch_micro_time_now();
 	}
 
-	timep =  (thetime) / (int64_t) (1000000);
+	timep = (thetime) / (int64_t) (1000000);
 
 	if (!zstr(tz_name)) {
-		tzdef = switch_lookup_timezone( tz_name );
+		tzdef = switch_lookup_timezone(tz_name);
 	} else {
 		/* We set the default timezone to GMT. */
-		tz_name="GMT";
-		tzdef="GMT";
+		tz_name = "GMT";
+		tzdef = "GMT";
 	}
-	
-	if (tzdef) { /* The lookup of the zone may fail. */
-		tztime( &timep, tzdef, &xtm );
-		tm2switchtime( &xtm, tm);
+
+	if (tzdef) {				/* The lookup of the zone may fail. */
+		tztime(&timep, tzdef, &xtm);
+		tm2switchtime(&xtm, tm);
 		return SWITCH_STATUS_SUCCESS;
 	}
 
@@ -717,19 +920,19 @@
 		thetime = switch_micro_time_now();
 	}
 
-	timep =  (thetime) / (int64_t) (1000000);
+	timep = (thetime) / (int64_t) (1000000);
 
 	if (!zstr(tz_name)) {
-		tzdef = switch_lookup_timezone( tz_name );
+		tzdef = switch_lookup_timezone(tz_name);
 	} else {
 		/* We set the default timezone to GMT. */
-		tz_name="GMT";
-		tzdef="GMT";
+		tz_name = "GMT";
+		tzdef = "GMT";
 	}
-	
-	if (tzdef) { /* The lookup of the zone may fail. */
-		tztime( &timep, tzdef, &tm );
-		tm2switchtime( &tm, &stm );
+
+	if (tzdef) {				/* The lookup of the zone may fail. */
+		tztime(&timep, tzdef, &tm);
+		tm2switchtime(&tm, &stm);
 		switch_strftime_nocheck(date, &retsize, len, zstr(format) ? "%Y-%m-%d %T" : format, &stm);
 		if (!zstr_buf(date)) {
 			return SWITCH_STATUS_SUCCESS;
@@ -746,7 +949,7 @@
 #if defined(WIN32)
 	timeBeginPeriod(1);
 #endif
-	
+
 	memset(&globals, 0, sizeof(globals));
 	switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, module_pool);
 
@@ -766,6 +969,21 @@
 	timer_interface->timer_check = timer_check;
 	timer_interface->timer_destroy = timer_destroy;
 
+	if (!switch_test_flag((&runtime), SCF_USE_CLOCK_RT)) {
+		switch_time_set_nanosleep(SWITCH_FALSE);
+	}
+
+	if (switch_test_flag((&runtime), SCF_USE_COND_TIMING)) {
+		switch_time_set_cond_yield(SWITCH_TRUE);
+	}
+
+	if (switch_test_flag((&runtime), SCF_CALIBRATE_CLOCK)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Calibrating timer, please wait...\n");
+		switch_time_calibrate_clock();
+	} else {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Clock calibration disabled.\n");
+	}
+
 	/* indicate that the module should continue to be loaded */
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -845,7 +1063,7 @@
 #ifndef TZ_MAX_TYPES
 
 #ifndef NOSOLAR
-#define TZ_MAX_TYPES	256 /* Limited by what (unsigned char)'s can hold */
+#define TZ_MAX_TYPES	256		/* Limited by what (unsigned char)'s can hold */
 #endif /* !defined NOSOLAR */
 
 #ifdef NOSOLAR
@@ -853,18 +1071,18 @@
 ** Must be at least 14 for Europe/Riga as of Jan 12 1995,
 ** as noted by Earl Chew <earl@hpato.aus.hp.com>.
 */
-#define TZ_MAX_TYPES	20	/* Maximum number of local time types */
+#define TZ_MAX_TYPES	20		/* Maximum number of local time types */
 #endif /* !defined NOSOLAR */
 
 #endif /* !defined TZ_MAX_TYPES */
 
 #ifndef TZ_MAX_CHARS
-#define TZ_MAX_CHARS	50	/* Maximum number of abbreviation characters */
+#define TZ_MAX_CHARS	50		/* Maximum number of abbreviation characters */
 				/* (limited by what unsigned chars can hold) */
 #endif /* !defined TZ_MAX_CHARS */
 
 #ifndef TZ_MAX_LEAPS
-#define TZ_MAX_LEAPS	50	/* Maximum number of leap second corrections */
+#define TZ_MAX_LEAPS	50		/* Maximum number of leap second corrections */
 #endif /* !defined TZ_MAX_LEAPS */
 
 #ifdef TZNAME_MAX
@@ -886,8 +1104,8 @@
 #define SECSPERDAY	((long) SECSPERHOUR * HOURSPERDAY)
 #define MONSPERYEAR	12
 
-#define JULIAN_DAY		0	/* Jn - Julian day */
-#define DAY_OF_YEAR		1	/* n - day of year */
+#define JULIAN_DAY		0		/* Jn - Julian day */
+#define DAY_OF_YEAR		1		/* n - day of year */
 #define MONTH_NTH_DAY_OF_WEEK	2	/* Mm.n.d - month, week, day of week */
 
 #define EPOCH_YEAR	1970
@@ -987,51 +1205,51 @@
 	    
    ************************************************************************** */
 
-static const char	gmt[] = "GMT";
+static const char gmt[] = "GMT";
 
 #define CHARS_DEF BIGGEST(BIGGEST(TZ_MAX_CHARS + 1, sizeof gmt), (2 * (MY_TZNAME_MAX + 1)))
 
 struct rule {
-	int		r_type;		/* type of rule--see below */
-	int		r_day;		/* day number of rule */
-	int		r_week;		/* week number of rule */
-	int		r_mon;		/* month number of rule */
-	long		r_time;		/* transition time of rule */
+	int r_type;					/* type of rule--see below */
+	int r_day;					/* day number of rule */
+	int r_week;					/* week number of rule */
+	int r_mon;					/* month number of rule */
+	long r_time;				/* transition time of rule */
 };
 
-struct ttinfo {				/* time type information */
-	long		tt_gmtoff;	/* UTC offset in seconds */
-	int		tt_isdst;	/* used to set tm_isdst */
-	int		tt_abbrind;	/* abbreviation list index */
-	int		tt_ttisstd;	/* TRUE if transition is std time */
-	int		tt_ttisgmt;	/* TRUE if transition is UTC */
+struct ttinfo {					/* time type information */
+	long tt_gmtoff;				/* UTC offset in seconds */
+	int tt_isdst;				/* used to set tm_isdst */
+	int tt_abbrind;				/* abbreviation list index */
+	int tt_ttisstd;				/* TRUE if transition is std time */
+	int tt_ttisgmt;				/* TRUE if transition is UTC */
 };
 
-struct lsinfo {				/* leap second information */
-	time_t		ls_trans;	/* transition time */
-	long		ls_corr;	/* correction to apply */
+struct lsinfo {					/* leap second information */
+	time_t ls_trans;			/* transition time */
+	long ls_corr;				/* correction to apply */
 };
 
 
 struct state {
-	int		leapcnt;
-	int		timecnt;
-	int		typecnt;
-	int		charcnt;
-	time_t		ats[TZ_MAX_TIMES];
-	unsigned char	types[TZ_MAX_TIMES];
-	struct ttinfo	ttis[TZ_MAX_TYPES];
-	char		chars[/* LINTED constant */CHARS_DEF];
-	struct lsinfo	lsis[TZ_MAX_LEAPS];
+	int leapcnt;
+	int timecnt;
+	int typecnt;
+	int charcnt;
+	time_t ats[TZ_MAX_TIMES];
+	unsigned char types[TZ_MAX_TIMES];
+	struct ttinfo ttis[TZ_MAX_TYPES];
+	char chars[ /* LINTED constant */ CHARS_DEF];
+	struct lsinfo lsis[TZ_MAX_LEAPS];
 };
 
 
-static const int	mon_lengths[2][MONSPERYEAR] = {
-	{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
-	{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
+static const int mon_lengths[2][MONSPERYEAR] = {
+	{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
+	{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
 };
 
-static const int	year_lengths[2] = {
+static const int year_lengths[2] = {
 	DAYSPERNYEAR, DAYSPERLYEAR
 };
 
@@ -1051,9 +1269,8 @@
 {
 	register char c;
 
-	while ((c = *strp) != '\0' && !is_digit(c) && c != ',' && c != '-' &&
-		c != '+')
-			++strp;
+	while ((c = *strp) != '\0' && !is_digit(c) && c != ',' && c != '-' && c != '+')
+		++strp;
 	return strp;
 }
 
@@ -1065,10 +1282,10 @@
     Otherwise, return a pointer to the first character not part of the number.
 */
 
-static const char *getnum(register const char *strp, int * const nump, const int min, const int max)
+static const char *getnum(register const char *strp, int *const nump, const int min, const int max)
 {
-	register char	c;
-	register int	num;
+	register char c;
+	register int num;
 
 	if (strp == NULL || !is_digit(c = *strp))
 		return NULL;
@@ -1076,11 +1293,11 @@
 	do {
 		num = num * 10 + (c - '0');
 		if (num > max)
-			return NULL;	/* illegal value */
+			return NULL;		/* illegal value */
 		c = *++strp;
 	} while (is_digit(c));
 	if (num < min)
-		return NULL;		/* illegal value */
+		return NULL;			/* illegal value */
 	*nump = num;
 	return strp;
 }
@@ -1093,16 +1310,16 @@
     of seconds.
 */
 
-static const char *getsecs(register const char *strp, long * const secsp)
+static const char *getsecs(register const char *strp, long *const secsp)
 {
-	int	num;
+	int num;
 
 	/*
-	** `HOURSPERDAY * DAYSPERWEEK - 1' allows quasi-Posix rules like
-	** "M10.4.6/26", which does not conform to Posix,
-	** but which specifies the equivalent of
-	** ``02:00 on the first Sunday on or after 23 Oct''.
-	*/
+	 ** `HOURSPERDAY * DAYSPERWEEK - 1' allows quasi-Posix rules like
+	 ** "M10.4.6/26", which does not conform to Posix,
+	 ** but which specifies the equivalent of
+	 ** ``02:00 on the first Sunday on or after 23 Oct''.
+	 */
 	strp = getnum(strp, &num, 0, HOURSPERDAY * DAYSPERWEEK - 1);
 	if (strp == NULL)
 		return NULL;
@@ -1132,9 +1349,9 @@
     Otherwise, return a pointer to the first character not part of the time.
 */
 
-static const char *getoffset(register const char *strp, long * const offsetp)
+static const char *getoffset(register const char *strp, long *const offsetp)
 {
-	register int	neg = 0;
+	register int neg = 0;
 
 	if (*strp == '-') {
 		neg = 1;
@@ -1143,7 +1360,7 @@
 		++strp;
 	strp = getsecs(strp, offsetp);
 	if (strp == NULL)
-		return NULL;		/* illegal time */
+		return NULL;			/* illegal time */
 	if (neg)
 		*offsetp = -*offsetp;
 	return strp;
@@ -1156,19 +1373,19 @@
     Otherwise, return a pointer to the first character not part of the rule.
 */
 
-static const char *getrule(const char *strp, register struct rule * const rulep)
+static const char *getrule(const char *strp, register struct rule *const rulep)
 {
 	if (*strp == 'J') {
 		/*
-		** Julian day.
-		*/
+		 ** Julian day.
+		 */
 		rulep->r_type = JULIAN_DAY;
 		++strp;
 		strp = getnum(strp, &rulep->r_day, 1, DAYSPERNYEAR);
 	} else if (*strp == 'M') {
 		/*
-		** Month, week, day.
-		*/
+		 ** Month, week, day.
+		 */
 		rulep->r_type = MONTH_NTH_DAY_OF_WEEK;
 		++strp;
 		strp = getnum(strp, &rulep->r_mon, 1, MONSPERYEAR);
@@ -1184,20 +1401,22 @@
 		strp = getnum(strp, &rulep->r_day, 0, DAYSPERWEEK - 1);
 	} else if (is_digit(*strp)) {
 		/*
-		** Day of year.
-		*/
+		 ** Day of year.
+		 */
 		rulep->r_type = DAY_OF_YEAR;
 		strp = getnum(strp, &rulep->r_day, 0, DAYSPERLYEAR - 1);
-	} else	return NULL;		/* invalid format */
+	} else
+		return NULL;			/* invalid format */
 	if (strp == NULL)
 		return NULL;
 	if (*strp == '/') {
 		/*
-		** Time specified.
-		*/
+		 ** Time specified.
+		 */
 		++strp;
 		strp = getsecs(strp, &rulep->r_time);
-	} else	rulep->r_time = 2 * SECSPERHOUR;	/* default = 2:00:00 */
+	} else
+		rulep->r_time = 2 * SECSPERHOUR;	/* default = 2:00:00 */
 	return strp;
 }
 
@@ -1208,12 +1427,12 @@
     calculate the Epoch-relative time that rule takes effect.
 */
 
-static time_t transtime(const time_t janfirst, const int year, register const struct rule * const rulep, const long offset)
+static time_t transtime(const time_t janfirst, const int year, register const struct rule *const rulep, const long offset)
 {
-	register int	leapyear;
-	register time_t	value;
-	register int	i;
-	int		d, m1, yy0, yy1, yy2, dow;
+	register int leapyear;
+	register time_t value;
+	register int i;
+	int d, m1, yy0, yy1, yy2, dow;
 
 	INITIALIZE(value);
 	leapyear = isleap(year);
@@ -1221,12 +1440,12 @@
 
 	case JULIAN_DAY:
 		/*
-		** Jn - Julian day, 1 == January 1, 60 == March 1 even in leap
-		** years.
-		** In non-leap years, or if the day number is 59 or less, just
-		** add SECSPERDAY times the day number-1 to the time of
-		** January 1, midnight, to get the day.
-		*/
+		 ** Jn - Julian day, 1 == January 1, 60 == March 1 even in leap
+		 ** years.
+		 ** In non-leap years, or if the day number is 59 or less, just
+		 ** add SECSPERDAY times the day number-1 to the time of
+		 ** January 1, midnight, to get the day.
+		 */
 		value = janfirst + (rulep->r_day - 1) * SECSPERDAY;
 		if (leapyear && rulep->r_day >= 60)
 			value += SECSPERDAY;
@@ -1234,62 +1453,60 @@
 
 	case DAY_OF_YEAR:
 		/*
-		** n - day of year.
-		** Just add SECSPERDAY times the day number to the time of
-		** January 1, midnight, to get the day.
-		*/
+		 ** n - day of year.
+		 ** Just add SECSPERDAY times the day number to the time of
+		 ** January 1, midnight, to get the day.
+		 */
 		value = janfirst + rulep->r_day * SECSPERDAY;
 		break;
 
 	case MONTH_NTH_DAY_OF_WEEK:
 		/*
-		** Mm.n.d - nth "dth day" of month m.
-		*/
+		 ** Mm.n.d - nth "dth day" of month m.
+		 */
 		value = janfirst;
 		for (i = 0; i < rulep->r_mon - 1; ++i)
 			value += mon_lengths[leapyear][i] * SECSPERDAY;
 
 		/*
-		** Use Zeller's Congruence to get day-of-week of first day of
-		** month.
-		*/
+		 ** Use Zeller's Congruence to get day-of-week of first day of
+		 ** month.
+		 */
 		m1 = (rulep->r_mon + 9) % 12 + 1;
 		yy0 = (rulep->r_mon <= 2) ? (year - 1) : year;
 		yy1 = yy0 / 100;
 		yy2 = yy0 % 100;
-		dow = ((26 * m1 - 2) / 10 +
-			1 + yy2 + yy2 / 4 + yy1 / 4 - 2 * yy1) % 7;
+		dow = ((26 * m1 - 2) / 10 + 1 + yy2 + yy2 / 4 + yy1 / 4 - 2 * yy1) % 7;
 		if (dow < 0)
 			dow += DAYSPERWEEK;
 
 		/*
-		** "dow" is the day-of-week of the first day of the month.  Get
-		** the day-of-month (zero-origin) of the first "dow" day of the
-		** month.
-		*/
+		 ** "dow" is the day-of-week of the first day of the month.  Get
+		 ** the day-of-month (zero-origin) of the first "dow" day of the
+		 ** month.
+		 */
 		d = rulep->r_day - dow;
 		if (d < 0)
 			d += DAYSPERWEEK;
 		for (i = 1; i < rulep->r_week; ++i) {
-			if (d + DAYSPERWEEK >=
-				mon_lengths[leapyear][rulep->r_mon - 1])
-					break;
+			if (d + DAYSPERWEEK >= mon_lengths[leapyear][rulep->r_mon - 1])
+				break;
 			d += DAYSPERWEEK;
 		}
 
 		/*
-		** "d" is the day-of-month (zero-origin) of the day we want.
-		*/
+		 ** "d" is the day-of-month (zero-origin) of the day we want.
+		 */
 		value += d * SECSPERDAY;
 		break;
 	}
 
 	/*
-	** "value" is the Epoch-relative time of 00:00:00 UTC on the day in
-	** question.  To get the Epoch-relative time of the specified local
-	** time on that day, add the transition time and the current offset
-	** from UTC.
-	*/
+	 ** "value" is the Epoch-relative time of 00:00:00 UTC on the day in
+	 ** question.  To get the Epoch-relative time of the specified local
+	 ** time on that day, add the transition time and the current offset
+	 ** from UTC.
+	 */
 	return value + rulep->r_time + offset;
 }
 
@@ -1300,17 +1517,17 @@
     appropriate.
 */
 
-static int tzparse(const char *name, register struct state * const sp, const int lastditch)
+static int tzparse(const char *name, register struct state *const sp, const int lastditch)
 {
-	const char *			stdname;
-	const char *			dstname;
-	size_t				stdlen;
-	size_t				dstlen;
-	long				stdoffset;
-	long				dstoffset;
-	register time_t *		atp;
-	register unsigned char *	typep;
-	register char *			cp;
+	const char *stdname;
+	const char *dstname;
+	size_t stdlen;
+	size_t dstlen;
+	long stdoffset;
+	long dstoffset;
+	register time_t *atp;
+	register unsigned char *typep;
+	register char *cp;
 
 
 	INITIALIZE(dstname);
@@ -1334,7 +1551,7 @@
 			return -1;
 	}
 
-	sp->leapcnt = 0;		/* so, we're off a little */
+	sp->leapcnt = 0;			/* so, we're off a little */
 
 	if (*name != '\0') {
 		dstname = name;
@@ -1342,24 +1559,21 @@
 		dstlen = name - dstname;	/* length of DST zone name */
 		if (dstlen < 3)
 			return -1;
-		if (*name != '\0' && *name != ',' && *name != ';') 
-		{
+		if (*name != '\0' && *name != ',' && *name != ';') {
 			name = getoffset(name, &dstoffset);
 			if (name == NULL)
 				return -1;
-		} 
-		else	
-		    dstoffset = stdoffset - SECSPERHOUR;
+		} else
+			dstoffset = stdoffset - SECSPERHOUR;
 
 		/* Go parsing the daylight saving stuff */
-		if (*name == ',' || *name == ';') 
-		{
-			struct rule	start;
-			struct rule	end;
-			register int	year;
-			register time_t	janfirst;
-			time_t		starttime;
-			time_t		endtime;
+		if (*name == ',' || *name == ';') {
+			struct rule start;
+			struct rule end;
+			register int year;
+			register time_t janfirst;
+			time_t starttime;
+			time_t endtime;
 
 			++name;
 			if ((name = getrule(name, &start)) == NULL)
@@ -1374,8 +1588,8 @@
 			sp->typecnt = 2;	/* standard time and DST */
 
 			/*
-			** Two transitions per year, from EPOCH_YEAR to 2037.
-			*/
+			 ** Two transitions per year, from EPOCH_YEAR to 2037.
+			 */
 			sp->timecnt = 2 * (2037 - EPOCH_YEAR + 1);
 
 			if (sp->timecnt > TZ_MAX_TIMES)
@@ -1383,7 +1597,7 @@
 
 			sp->ttis[0].tt_gmtoff = -dstoffset;
 			sp->ttis[0].tt_isdst = 1;
-			sp->ttis[0].tt_abbrind = (int)(stdlen + 1);
+			sp->ttis[0].tt_abbrind = (int) (stdlen + 1);
 			sp->ttis[1].tt_gmtoff = -stdoffset;
 			sp->ttis[1].tt_isdst = 0;
 			sp->ttis[1].tt_abbrind = 0;
@@ -1393,10 +1607,8 @@
 			janfirst = 0;
 
 			for (year = EPOCH_YEAR; year <= 2037; ++year) {
-				starttime = transtime(janfirst, year, &start,
-					stdoffset);
-				endtime = transtime(janfirst, year, &end,
-					dstoffset);
+				starttime = transtime(janfirst, year, &start, stdoffset);
+				endtime = transtime(janfirst, year, &end, dstoffset);
 				if (starttime > endtime) {
 					*atp++ = endtime;
 					*typep++ = 1;	/* DST ends */
@@ -1413,24 +1625,23 @@
 			}
 
 		} else {
-			register long	theirstdoffset;
-			register long	theirdstoffset;
-			register long	theiroffset;
-			register int	isdst;
-			register int	i;
-			register int	j;
+			register long theirstdoffset;
+			register long theirdstoffset;
+			register long theiroffset;
+			register int isdst;
+			register int i;
+			register int j;
 
 			if (*name != '\0')
 				return -1;
 			/*
-			    Initial values of theirstdoffset and theirdstoffset.
-			*/
+			   Initial values of theirstdoffset and theirdstoffset.
+			 */
 			theirstdoffset = 0;
 			for (i = 0; i < sp->timecnt; ++i) {
 				j = sp->types[i];
 				if (!sp->ttis[j].tt_isdst) {
-					theirstdoffset =
-						-sp->ttis[j].tt_gmtoff;
+					theirstdoffset = -sp->ttis[j].tt_gmtoff;
 					break;
 				}
 			}
@@ -1438,63 +1649,61 @@
 			for (i = 0; i < sp->timecnt; ++i) {
 				j = sp->types[i];
 				if (sp->ttis[j].tt_isdst) {
-					theirdstoffset =
-						-sp->ttis[j].tt_gmtoff;
+					theirdstoffset = -sp->ttis[j].tt_gmtoff;
 					break;
 				}
 			}
 			/*
-			** Initially we're assumed to be in standard time.
-			*/
+			 ** Initially we're assumed to be in standard time.
+			 */
 			isdst = FALSE;
 			theiroffset = theirstdoffset;
 			/*
-			** Now juggle transition times and types
-			** tracking offsets as you do.
-			*/
+			 ** Now juggle transition times and types
+			 ** tracking offsets as you do.
+			 */
 			for (i = 0; i < sp->timecnt; ++i) {
 				j = sp->types[i];
-				sp->types[i] = (unsigned char)sp->ttis[j].tt_isdst;
+				sp->types[i] = (unsigned char) sp->ttis[j].tt_isdst;
 				if (sp->ttis[j].tt_ttisgmt) {
 					/* No adjustment to transition time */
 				} else {
 					/*
-					** If summer time is in effect, and the
-					** transition time was not specified as
-					** standard time, add the summer time
-					** offset to the transition time;
-					** otherwise, add the standard time
-					** offset to the transition time.
-					*/
+					 ** If summer time is in effect, and the
+					 ** transition time was not specified as
+					 ** standard time, add the summer time
+					 ** offset to the transition time;
+					 ** otherwise, add the standard time
+					 ** offset to the transition time.
+					 */
 					/*
-					** Transitions from DST to DDST
-					** will effectively disappear since
-					** POSIX provides for only one DST
-					** offset.
-					*/
+					 ** Transitions from DST to DDST
+					 ** will effectively disappear since
+					 ** POSIX provides for only one DST
+					 ** offset.
+					 */
 					if (isdst && !sp->ttis[j].tt_ttisstd) {
-						sp->ats[i] += dstoffset -
-							theirdstoffset;
+						sp->ats[i] += dstoffset - theirdstoffset;
 					} else {
-						sp->ats[i] += stdoffset -
-							theirstdoffset;
+						sp->ats[i] += stdoffset - theirstdoffset;
 					}
 				}
 				theiroffset = -sp->ttis[j].tt_gmtoff;
 				if (sp->ttis[j].tt_isdst)
 					theirdstoffset = theiroffset;
-				else	theirstdoffset = theiroffset;
+				else
+					theirstdoffset = theiroffset;
 			}
 			/*
-			** Finally, fill in ttis.
-			** ttisstd and ttisgmt need not be handled.
-			*/
+			 ** Finally, fill in ttis.
+			 ** ttisstd and ttisgmt need not be handled.
+			 */
 			sp->ttis[0].tt_gmtoff = -stdoffset;
 			sp->ttis[0].tt_isdst = FALSE;
 			sp->ttis[0].tt_abbrind = 0;
 			sp->ttis[1].tt_gmtoff = -dstoffset;
 			sp->ttis[1].tt_isdst = TRUE;
-			sp->ttis[1].tt_abbrind = (int)(stdlen + 1);
+			sp->ttis[1].tt_abbrind = (int) (stdlen + 1);
 			sp->typecnt = 2;
 		}
 	} else {
@@ -1506,9 +1715,9 @@
 		sp->ttis[0].tt_abbrind = 0;
 	}
 
-	sp->charcnt = (int)(stdlen + 1);
+	sp->charcnt = (int) (stdlen + 1);
 	if (dstlen != 0)
-		sp->charcnt += (int)(dstlen + 1);
+		sp->charcnt += (int) (dstlen + 1);
 	if ((size_t) sp->charcnt > sizeof sp->chars)
 		return -1;
 	cp = sp->chars;
@@ -1531,17 +1740,17 @@
 #define switch_assert(expr) assert(expr)
 #endif
 
-static void timesub(const time_t * const timep, const long offset, register const struct state * const sp, register struct tm * const tmp)
+static void timesub(const time_t *const timep, const long offset, register const struct state *const sp, register struct tm *const tmp)
 {
-	register const struct lsinfo *	lp;
-	register long			days;
-	register time_t			rem;
-	register int			y;
-	register int			yleap;
-	register const int *		ip;
-	register long			corr;
-	register int			hit;
-	register int			i;
+	register const struct lsinfo *lp;
+	register long days;
+	register time_t rem;
+	register int y;
+	register int yleap;
+	register const int *ip;
+	register long corr;
+	register int hit;
+	register int i;
 
 	switch_assert(timep != NULL);
 	switch_assert(sp != NULL);
@@ -1555,32 +1764,27 @@
 		lp = &sp->lsis[i];
 		if (*timep >= lp->ls_trans) {
 			if (*timep == lp->ls_trans) {
-				hit = ((i == 0 && lp->ls_corr > 0) ||
-					(i > 0 && lp->ls_corr > sp->lsis[i - 1].ls_corr));
+				hit = ((i == 0 && lp->ls_corr > 0) || (i > 0 && lp->ls_corr > sp->lsis[i - 1].ls_corr));
 				if (hit)
-					while (i > 0 &&
-						sp->lsis[i].ls_trans ==
-						sp->lsis[i - 1].ls_trans + 1 &&
-						sp->lsis[i].ls_corr ==
-						sp->lsis[i - 1].ls_corr + 1) {
-							++hit;
-							--i;
+					while (i > 0 && sp->lsis[i].ls_trans == sp->lsis[i - 1].ls_trans + 1 && sp->lsis[i].ls_corr == sp->lsis[i - 1].ls_corr + 1) {
+						++hit;
+						--i;
 					}
 			}
 			corr = lp->ls_corr;
 			break;
 		}
 	}
-	days = (long)(*timep / SECSPERDAY);
+	days = (long) (*timep / SECSPERDAY);
 	rem = *timep % SECSPERDAY;
 
 
-#ifdef mc68k 
+#ifdef mc68k
 	/* If this is for CPU bugs workarounds, i would remove this anyway. Who would use it on an old mc68k ? */
 	if (*timep == 0x80000000) {
 		/*
-		** A 3B1 muffs the division on the most negative number.
-		*/
+		 ** A 3B1 muffs the division on the most negative number.
+		 */
 		days = -24855;
 		rem = -11648;
 	}
@@ -1600,9 +1804,9 @@
 	tmp->tm_min = (int) (rem / SECSPERMIN);
 
 	/*
-	** A positive leap second requires a special
-	** representation.  This uses "... ??:59:60" et seq.
-	*/
+	 ** A positive leap second requires a special
+	 ** representation.  This uses "... ??:59:60" et seq.
+	 */
 	tmp->tm_sec = (int) (rem % SECSPERMIN) + hit;
 	tmp->tm_wday = (int) ((EPOCH_WDAY + days) % DAYSPERWEEK);
 
@@ -1614,14 +1818,12 @@
 #define LEAPS_THRU_END_OF(y)	((y) / 4 - (y) / 100 + (y) / 400)
 
 	while (days < 0 || days >= (long) year_lengths[yleap = isleap(y)]) {
-		register int	newy;
+		register int newy;
 
-		newy = (int)(y + days / DAYSPERNYEAR);
+		newy = (int) (y + days / DAYSPERNYEAR);
 		if (days < 0)
 			--newy;
-		days -= (newy - y) * DAYSPERNYEAR +
-			LEAPS_THRU_END_OF(newy - 1) -
-			LEAPS_THRU_END_OF(y - 1);
+		days -= (newy - y) * DAYSPERNYEAR + LEAPS_THRU_END_OF(newy - 1) - LEAPS_THRU_END_OF(y - 1);
 		y = newy;
 	}
 
@@ -1644,29 +1846,26 @@
 	    
    ************************************************************************** */
 
-static void tztime(const time_t * const timep, const char *tzstring, struct tm * const tmp )
+static void tztime(const time_t *const timep, const char *tzstring, struct tm *const tmp)
 {
-	struct state 			*tzptr, 
-					*sp;
-	const time_t			t = *timep;
-	register int			i;
-	register const struct ttinfo 	*ttisp;
+	struct state *tzptr, *sp;
+	const time_t t = *timep;
+	register int i;
+	register const struct ttinfo *ttisp;
 
-	if ( tzstring == NULL )
+	if (tzstring == NULL)
 		tzstring = gmt;
 
-	tzptr = (struct state *) malloc(sizeof (struct state));
+	tzptr = (struct state *) malloc(sizeof(struct state));
 	sp = tzptr;
 
-	if (tzptr != NULL) 
-	{
-	
+	if (tzptr != NULL) {
+
 		memset(tzptr, 0, sizeof(struct state));
 
 		(void) tzparse(tzstring, tzptr, FALSE);
 
-		if (sp->timecnt == 0 || t < sp->ats[0]) 
-		{
+		if (sp->timecnt == 0 || t < sp->ats[0]) {
 			i = 0;
 			while (sp->ttis[i].tt_isdst)
 				if (++i >= sp->typecnt) {
@@ -1682,14 +1881,13 @@
 		ttisp = &sp->ttis[i];
 
 		/*
-		    To get (wrong) behavior that's compatible with System V Release 2.0
-		    you'd replace the statement below with
-		    t += ttisp->tt_gmtoff;
-		    timesub(&t, 0L, sp, tmp);
-		*/
-		if ( tmp != NULL ) /* Just a check not to assert */
-		{
-	    		timesub( &t, ttisp->tt_gmtoff, sp, tmp);
+		   To get (wrong) behavior that's compatible with System V Release 2.0
+		   you'd replace the statement below with
+		   t += ttisp->tt_gmtoff;
+		   timesub(&t, 0L, sp, tmp);
+		 */
+		if (tmp != NULL) {		/* Just a check not to assert */
+			timesub(&t, ttisp->tt_gmtoff, sp, tmp);
 			tmp->tm_isdst = ttisp->tt_isdst;
 #if defined(HAVE_STRUCT_TM_TM_ZONE)
 			tmp->tm_zone = &sp->chars[ttisp->tt_abbrind];

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_utils.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_utils.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_utils.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -93,7 +93,7 @@
 	new_frame = malloc(sizeof(*new_frame));
 
 	switch_assert(new_frame);
-	
+
 	*new_frame = *orig;
 	switch_set_flag(new_frame, SFF_DYNAMIC);
 
@@ -102,7 +102,7 @@
 
 	memcpy(new_frame->data, orig->data, orig->datalen);
 	new_frame->codec = NULL;
-	
+
 	*clone = new_frame;
 
 	return SWITCH_STATUS_SUCCESS;
@@ -113,7 +113,7 @@
 	if (!frame || !*frame || !switch_test_flag((*frame), SFF_DYNAMIC)) {
 		return SWITCH_STATUS_FALSE;
 	}
-	
+
 	switch_safe_free((*frame)->data);
 	free(*frame);
 	*frame = NULL;
@@ -121,7 +121,8 @@
 	return SWITCH_STATUS_SUCCESS;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_network_list_create(switch_network_list_t **list, const char *name, switch_bool_t default_type, switch_memory_pool_t *pool)
+SWITCH_DECLARE(switch_status_t) switch_network_list_create(switch_network_list_t **list, const char *name, switch_bool_t default_type,
+														   switch_memory_pool_t *pool)
 {
 	switch_network_list_t *new_list;
 
@@ -164,12 +165,15 @@
 	return ok;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_network_list_add_cidr_token(switch_network_list_t *list, const char *cidr_str, switch_bool_t ok, const char *token)
+SWITCH_DECLARE(switch_status_t) switch_network_list_perform_add_cidr_token(switch_network_list_t *list, const char *cidr_str, switch_bool_t ok,
+																		   const char *token)
 {
 	uint32_t ip, mask, bits;
 	switch_network_node_t *node;
 
 	if (switch_parse_cidr(cidr_str, &ip, &mask, &bits)) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Adding %s (%s) [%s] to list %s\n",
+						  cidr_str, ok ? "allow" : "deny", switch_str_nil(token), list->name);
 		return SWITCH_STATUS_GENERR;
 	}
 
@@ -184,13 +188,43 @@
 	if (!zstr(token)) {
 		node->token = switch_core_strdup(list->pool, token);
 	}
-	
+
 	node->next = list->node_head;
 	list->node_head = node;
 
-	return SWITCH_STATUS_SUCCESS;	
+	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Adding %s (%s) [%s] to list %s\n",
+					  cidr_str, ok ? "allow" : "deny", switch_str_nil(token), list->name);
+
+	return SWITCH_STATUS_SUCCESS;
 }
 
+SWITCH_DECLARE(switch_status_t) switch_network_list_add_cidr_token(switch_network_list_t *list, const char *cidr_str, switch_bool_t ok, const char *token)
+{
+	char *cidr_str_dup = NULL;
+	switch_status_t status = SWITCH_STATUS_SUCCESS;
+
+	if (strchr(cidr_str, ',')) {
+		char *argv[32] = { 0 };
+		int i, argc;
+		cidr_str_dup = strdup(cidr_str);
+
+		switch_assert(cidr_str_dup);
+		if ((argc = switch_separate_string(cidr_str_dup, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
+			for (i = 0; i < argc; i++) {
+				switch_status_t this_status;
+				if ((this_status = switch_network_list_perform_add_cidr_token(list, argv[i], ok, token)) != SWITCH_STATUS_SUCCESS) {
+					status = this_status;
+				}
+			}
+		}
+	} else {
+		status = switch_network_list_perform_add_cidr_token(list, cidr_str, ok, token);
+	}
+
+	switch_safe_free(cidr_str_dup);
+	return status;
+}
+
 SWITCH_DECLARE(switch_status_t) switch_network_list_add_host_mask(switch_network_list_t *list, const char *host, const char *mask_str, switch_bool_t ok)
 {
 	int ip, mask;
@@ -210,7 +244,7 @@
 	mask = (mask & 0x33333333) + ((mask >> 2) & 0x33333333);
 	node->bits = (((mask + (mask >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24;
 	node->str = switch_core_sprintf(list->pool, "%s:%s", host, mask_str);
-	
+
 	node->next = list->node_head;
 	list->node_head = node;
 
@@ -429,13 +463,10 @@
 	return 1;
 }
 
-SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to, 
-												  const char *from, 
-												  const char *headers, 
-												  const char *body, 
-												  const char *file,
-												  const char *convert_cmd,
-												  const char *convert_ext)
+SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to,
+												  const char *from,
+												  const char *headers,
+												  const char *body, const char *file, const char *convert_cmd, const char *convert_ext)
 {
 	char *bound = "XXXX_boundary_XXXX";
 	const char *mime_type = "audio/inline";
@@ -457,7 +488,7 @@
 				newfile = switch_mprintf("%s.%s", dupfile, convert_ext);
 			}
 		}
-		
+
 		if (newfile) {
 			char cmd[1024] = "";
 			switch_snprintf(cmd, sizeof(cmd), "%s %s %s", convert_cmd, file, newfile);
@@ -499,7 +530,7 @@
 			switch_snprintf(buf, B64BUFFLEN, "--%s\nContent-Type: text/plain\n\n", bound);
 		}
 		if (!write_buf(fd, buf)) {
-			rval = SWITCH_FALSE; 
+			rval = SWITCH_FALSE;
 			goto end;
 		}
 
@@ -583,7 +614,6 @@
 	if (zstr(from)) {
 		from = "freeswitch";
 	}
-
 #ifdef WIN32
 	switch_snprintf(buf, B64BUFFLEN, "type %s | %s -f %s %s %s", filename, runtime.mailer_app, from, runtime.mailer_app_args, to);
 #else
@@ -605,8 +635,8 @@
 
 	rval = SWITCH_TRUE;
 
- end:	
-	
+  end:
+
 	if (newfile) {
 		unlink(newfile);
 		free(newfile);
@@ -808,11 +838,11 @@
 
 	if (!me || getifaddrs(&ifaddrs) < 0) {
 		return -1;
-	}	
+	}
 
-	for(i = ifaddrs; i; i = i->ifa_next) {
-		struct sockaddr_in *s = (struct sockaddr_in *)i->ifa_addr;
-		struct sockaddr_in *m = (struct sockaddr_in *)i->ifa_netmask;
+	for (i = ifaddrs; i; i = i->ifa_next) {
+		struct sockaddr_in *s = (struct sockaddr_in *) i->ifa_addr;
+		struct sockaddr_in *m = (struct sockaddr_in *) i->ifa_netmask;
 
 		if (s && m && s->sin_addr.s_addr == me->sin_addr.s_addr) {
 			*mask = m->sin_addr.s_addr;
@@ -820,9 +850,9 @@
 			return 0;
 		}
 	}
-	
+
 	freeifaddrs(ifaddrs);
-	
+
 	return -2;
 }
 #elif defined(__linux__)
@@ -834,16 +864,16 @@
 
 	static struct ifreq ifreqs[20] = { {{{0}}} };
 	struct ifconf ifconf;
-	int  nifaces, i;
+	int nifaces, i;
 	int sock;
 	int r = -1;
-	
-	memset(&ifconf,0,sizeof(ifconf));
-	ifconf.ifc_buf = (char*) (ifreqs);
+
+	memset(&ifconf, 0, sizeof(ifconf));
+	ifconf.ifc_buf = (char *) (ifreqs);
 	ifconf.ifc_len = sizeof(ifreqs);
-	
 
-	if ((sock = socket(AF_INET,SOCK_STREAM, 0)) < 0) {
+
+	if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
 		goto end;
 	}
 
@@ -853,17 +883,17 @@
 
 	nifaces = ifconf.ifc_len / sizeof(struct ifreq);
 
-	for(i = 0; i < nifaces; i++) {
+	for (i = 0; i < nifaces; i++) {
 		struct sockaddr_in *sin = NULL;
 		struct in_addr ip;
 
 		ioctl(sock, SIOCGIFADDR, &ifreqs[i]);
-		sin = (struct sockaddr_in *)&ifreqs[i].ifr_addr;
+		sin = (struct sockaddr_in *) &ifreqs[i].ifr_addr;
 		ip = sin->sin_addr;
 
 		if (ip.s_addr == me->sin_addr.s_addr) {
 			ioctl(sock, SIOCGIFNETMASK, &ifreqs[i]);
-			sin = (struct sockaddr_in *)&ifreqs[i].ifr_addr;
+			sin = (struct sockaddr_in *) &ifreqs[i].ifr_addr;
 			//mask = sin->sin_addr;
 			*mask = sin->sin_addr.s_addr;
 			r = 0;
@@ -871,9 +901,9 @@
 		}
 
 	}
-	
- end:
-	
+
+  end:
+
 	close(sock);
 	return r;
 
@@ -900,20 +930,20 @@
 		goto end;
 	}
 
-    interface_count = bytes / sizeof(INTERFACE_INFO);
+	interface_count = bytes / sizeof(INTERFACE_INFO);
 
 	for (x = 0; x < interface_count; ++x) {
-		struct sockaddr_in *addr = (struct sockaddr_in *) & (interfaces[x].iiAddress);
+		struct sockaddr_in *addr = (struct sockaddr_in *) &(interfaces[x].iiAddress);
 
 		if (addr->sin_addr.s_addr == me->sin_addr.s_addr) {
-			struct sockaddr_in *netmask = (struct sockaddr_in *) & (interfaces[x].iiNetmask);
+			struct sockaddr_in *netmask = (struct sockaddr_in *) &(interfaces[x].iiNetmask);
 			*mask = netmask->sin_addr.s_addr;
 			r = 0;
 			break;
 		}
-    }
+	}
 
-end:
+  end:
 	closesocket(sock);
 	return r;
 }
@@ -931,18 +961,18 @@
 SWITCH_DECLARE(switch_status_t) switch_resolve_host(const char *host, char *buf, size_t buflen)
 {
 
-    struct addrinfo *ai;
-    int err;
-	
-    if ((err = getaddrinfo(host, 0, 0, &ai))) {
-        return SWITCH_STATUS_FALSE;
-    }
+	struct addrinfo *ai;
+	int err;
 
+	if ((err = getaddrinfo(host, 0, 0, &ai))) {
+		return SWITCH_STATUS_FALSE;
+	}
+
 	get_addr(buf, buflen, ai->ai_addr, sizeof(*ai->ai_addr));
 
-    freeaddrinfo(ai);
+	freeaddrinfo(ai);
 
-    return SWITCH_STATUS_SUCCESS;
+	return SWITCH_STATUS_SUCCESS;
 }
 
 
@@ -969,7 +999,7 @@
 	if (len < 16) {
 		return status;
 	}
-	
+
 	switch (family) {
 	case AF_INET:
 		switch_copy_string(buf, "127.0.0.1", len);
@@ -977,7 +1007,7 @@
 		break;
 	case AF_INET6:
 		switch_copy_string(buf, "::1", len);
-		base = "2001:503:BA3E::2:30"; // DNS Root server A 
+		base = "2001:503:BA3E::2:30";	// DNS Root server A 
 		break;
 	default:
 		base = "127.0.0.1";
@@ -1005,7 +1035,7 @@
 	freeaddrinfo(address_info);
 
 	if (!getnameinfo((const struct sockaddr *) &l_address, l_address_len, buf, len, NULL, 0, NI_NUMERICHOST)) {
-		status = SWITCH_STATUS_SUCCESS;	
+		status = SWITCH_STATUS_SUCCESS;
 		if (mask) {
 			get_netmask((struct sockaddr_in *) &l_address, mask);
 		}
@@ -1043,9 +1073,9 @@
 				goto doh;
 			}
 
-			switch_copy_string(buf, get_addr(abuf, sizeof(abuf), (struct sockaddr*)&iface_out, sizeof(iface_out)), len);
+			switch_copy_string(buf, get_addr(abuf, sizeof(abuf), (struct sockaddr *) &iface_out, sizeof(iface_out)), len);
 			if (mask) {
-				get_netmask((struct sockaddr_in*)&iface_out, mask);
+				get_netmask((struct sockaddr_in *) &iface_out, mask);
 			}
 
 			status = SWITCH_STATUS_SUCCESS;
@@ -1340,9 +1370,9 @@
 
 SWITCH_DECLARE(int) get_addr_int(switch_sockaddr_t *sa)
 {
-	struct sockaddr_in *s = (struct sockaddr_in *)&sa->sa;
+	struct sockaddr_in *s = (struct sockaddr_in *) &sa->sa;
 
-	return ntohs((unsigned short)s->sin_addr.s_addr);
+	return ntohs((unsigned short) s->sin_addr.s_addr);
 }
 
 SWITCH_DECLARE(int) switch_cmp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *sa2)
@@ -1356,37 +1386,41 @@
 	struct sockaddr *ss1;
 	struct sockaddr *ss2;
 
-	if (!(sa1 && sa2)) return 0;
+	if (!(sa1 && sa2))
+		return 0;
 
-	s1 = (struct sockaddr_in *)&sa1->sa;
-	s2 = (struct sockaddr_in *)&sa2->sa;
+	s1 = (struct sockaddr_in *) &sa1->sa;
+	s2 = (struct sockaddr_in *) &sa2->sa;
 
-	s16 = (struct sockaddr_in6 *)&sa1->sa;
-	s26 = (struct sockaddr_in6 *)&sa2->sa;
+	s16 = (struct sockaddr_in6 *) &sa1->sa;
+	s26 = (struct sockaddr_in6 *) &sa2->sa;
 
-	ss1 = (struct sockaddr *)&sa1->sa;
-	ss2 = (struct sockaddr *)&sa2->sa;
-	
-	if (ss1->sa_family != ss2->sa_family) return 0;
+	ss1 = (struct sockaddr *) &sa1->sa;
+	ss2 = (struct sockaddr *) &sa2->sa;
 
+	if (ss1->sa_family != ss2->sa_family)
+		return 0;
+
 	switch (ss1->sa_family) {
 	case AF_INET:
-		return (s1->sin_addr.s_addr == s2->sin_addr.s_addr && s1->sin_port == s2->sin_port);	
+		return (s1->sin_addr.s_addr == s2->sin_addr.s_addr && s1->sin_port == s2->sin_port);
 	case AF_INET6:
 		if (s16->sin6_addr.s6_addr && s26->sin6_addr.s6_addr) {
 			int i;
 
-			if (s16->sin6_port != s26->sin6_port) return 0;
+			if (s16->sin6_port != s26->sin6_port)
+				return 0;
 
-			for(i = 0; i < 4; i++) {
-				if (*((int32_t *)s16->sin6_addr.s6_addr + i) != *((int32_t *)s26->sin6_addr.s6_addr + i)) return 0;
+			for (i = 0; i < 4; i++) {
+				if (*((int32_t *) s16->sin6_addr.s6_addr + i) != *((int32_t *) s26->sin6_addr.s6_addr + i))
+					return 0;
 			}
 
 			return 1;
 		}
 	}
-	
-	return 0;	
+
+	return 0;
 }
 
 
@@ -1396,7 +1430,7 @@
 	*buf = '\0';
 
 	if (sa) {
-		getnameinfo(sa, salen, buf, (socklen_t)len, NULL, 0, NI_NUMERICHOST);
+		getnameinfo(sa, salen, buf, (socklen_t) len, NULL, 0, NI_NUMERICHOST);
 	}
 	return buf;
 }
@@ -1406,23 +1440,18 @@
 	unsigned short port = 0;
 	if (sa) {
 		switch (sa->sa_family) {
-			case AF_INET:
-				port = ntohs(((struct sockaddr_in*)sa)->sin_port);
-				break;
-			case AF_INET6:
-				port = ntohs(((struct sockaddr_in6*)sa)->sin6_port);
-				break;
+		case AF_INET:
+			port = ntohs(((struct sockaddr_in *) sa)->sin_port);
+			break;
+		case AF_INET6:
+			port = ntohs(((struct sockaddr_in6 *) sa)->sin6_port);
+			break;
 		}
 	}
 	return port;
 }
 
-SWITCH_DECLARE(int) switch_build_uri(char *uri,
-									 switch_size_t size,
-									 const char *scheme,
-									 const char *user,
-									 const switch_sockaddr_t *sa,
-									 int flags)
+SWITCH_DECLARE(int) switch_build_uri(char *uri, switch_size_t size, const char *scheme, const char *user, const switch_sockaddr_t *sa, int flags)
 {
 	char host[NI_MAXHOST], serv[NI_MAXSERV];
 	struct sockaddr_in6 si6;
@@ -1433,22 +1462,20 @@
 		memcpy(&si6, &sa->sa, sa->salen);
 		si6.sin6_scope_id = 0;
 
-		addr = (const struct sockaddr*) &si6;
+		addr = (const struct sockaddr *) &si6;
 	} else {
-		addr = (const struct sockaddr*) (intptr_t)&sa->sa;
+		addr = (const struct sockaddr *) (intptr_t) & sa->sa;
 	}
 
 	if (getnameinfo(addr, sa->salen, host, sizeof(host), serv, sizeof(serv),
-		((flags & SWITCH_URI_NUMERIC_HOST) ? NI_NUMERICHOST : 0) | ((flags & SWITCH_URI_NUMERIC_PORT) ? NI_NUMERICSERV : 0)) != 0) {
-			return 0;
+					((flags & SWITCH_URI_NUMERIC_HOST) ? NI_NUMERICHOST : 0) | ((flags & SWITCH_URI_NUMERIC_PORT) ? NI_NUMERICSERV : 0)) != 0) {
+		return 0;
 	}
 
 	colon = strchr(host, ':');
 
 	return switch_snprintf(uri, size, "%s:%s%s%s%s%s%s%s", scheme,
-		user ? user : "", user ? "@" : "",
-		colon ? "[" : "", host, colon ? "]" : "",
-		serv[0] ? ":" : "", serv[0] ? serv : "");
+						   user ? user : "", user ? "@" : "", colon ? "[" : "", host, colon ? "]" : "", serv[0] ? ":" : "", serv[0] ? serv : "");
 }
 
 SWITCH_DECLARE(char) switch_rfc2833_to_char(int event)
@@ -1545,6 +1572,51 @@
 	return unescaped;
 }
 
+SWITCH_DECLARE(char *) switch_escape_string(const char *in, char *out, switch_size_t outlen)
+{
+	const char *p;
+	char *o = out;
+
+	for (p = in; *p; p++) {
+		switch (*p) {
+		case '\n':
+			*o++ = '\\';
+			*o++ = 'n';
+			break;
+		case '\r':
+			*o++ = '\\';
+			*o++ = 'r';
+			break;
+		case '\t':
+			*o++ = '\\';
+			*o++ = 't';
+			break;
+		case ' ':
+			*o++ = '\\';
+			*o++ = 's';
+			break;
+		case '$':
+			*o++ = '\\';
+			*o++ = '$';
+			break;
+		default:
+			*o++ = *p;
+			break;
+		}
+	}
+
+	*o++ = '\0';
+
+	return out;
+}
+
+SWITCH_DECLARE(char *) switch_escape_string_pool(const char *in, switch_memory_pool_t *pool)
+{
+	int len = strlen(in) * 2;
+	char *buf = switch_core_alloc(pool, len);
+	return switch_escape_string(in, buf, len);
+}
+
 /* Helper function used when separating strings to remove quotes, leading /
    trailing spaces, and to convert escaped characters. */
 static char *cleanup_separated_string(char *str, char delim)
@@ -1565,7 +1637,7 @@
 
 		if (*ptr == ESCAPE_META) {
 			e = *(ptr + 1);
-			if (e == '\'' || e == '"' || (delim && e == delim) || (e = unescape_char(*(ptr + 1))) != *(ptr + 1)) {
+			if (e == '\'' || e == '"' || (delim && e == delim) || e == ESCAPE_META || (e = unescape_char(*(ptr + 1))) != *(ptr + 1)) {
 				++ptr;
 				*dest++ = e;
 				end = dest;
@@ -1586,6 +1658,7 @@
 	if (end) {
 		*end = '\0';
 	}
+
 	return start;
 }
 
@@ -1594,15 +1667,16 @@
 	unsigned int count = 0;
 	char *d;
 	size_t dlen = strlen(delim);
-	
+
 	array[count++] = buf;
 
-	while (count < arraylen && array[count-1]) {
-		if ((d = strstr(array[count-1], delim))) {
+	while (count < arraylen && array[count - 1]) {
+		if ((d = strstr(array[count - 1], delim))) {
 			*d = '\0';
 			d += dlen;
 			array[count++] = d;
-		} else break;
+		} else
+			break;
 	}
 
 	return count;
@@ -1643,8 +1717,10 @@
 		}
 	}
 	/* strip quotes, escaped chars and leading / trailing spaces */
-	for (i = 0; i < count; ++i) {
-		array[i] = cleanup_separated_string(array[i], delim);
+	if (count > 1) {
+		for (i = 0; i < count; ++i) {
+			array[i] = cleanup_separated_string(array[i], delim);
+		}
 	}
 	return count;
 }
@@ -1701,8 +1777,10 @@
 		}
 	}
 	/* strip quotes, escaped chars and leading / trailing spaces */
-	for (i = 0; i < count; ++i) {
-		array[i] = cleanup_separated_string(array[i], 0);
+	if (count > 1) {
+		for (i = 0; i < count; ++i) {
+			array[i] = cleanup_separated_string(array[i], 0);
+		}
 	}
 	return count;
 }
@@ -1794,7 +1872,7 @@
 	size_t string_len = strlen(string);
 	size_t i;
 	size_t n = 0;
-	size_t dest_len = string_len + 1; /* +1 for the opening quote  */
+	size_t dest_len = string_len + 1;	/* +1 for the opening quote  */
 	char *dest, *tmp;
 
 	dest = (char *) malloc(sizeof(char) * dest_len);
@@ -1816,7 +1894,7 @@
 #else
 		case '\'':
 			/* We replace ' by '\'' */
-			dest_len+=3;
+			dest_len += 3;
 			tmp = (char *) realloc(dest, sizeof(char) * (dest_len));
 			switch_assert(tmp);
 			dest = tmp;
@@ -1829,9 +1907,9 @@
 		default:
 			dest[n++] = string[i];
 		}
-  }
-  
-	dest_len += 2; /* +2 for the closing quote and the null character */
+	}
+
+	dest_len += 2;				/* +2 for the closing quote and the null character */
 	tmp = (char *) realloc(dest, sizeof(char) * (dest_len));
 	switch_assert(tmp);
 	dest = tmp;
@@ -1918,96 +1996,96 @@
 
 const short _switch_C_toupper_[1 + SWITCH_CTYPE_NUM_CHARS] = {
 	EOF,
-	0x00,	0x01,	0x02,	0x03,	0x04,	0x05,	0x06,	0x07,
-	0x08,	0x09,	0x0a,	0x0b,	0x0c,	0x0d,	0x0e,	0x0f,
-	0x10,	0x11,	0x12,	0x13,	0x14,	0x15,	0x16,	0x17,
-	0x18,	0x19,	0x1a,	0x1b,	0x1c,	0x1d,	0x1e,	0x1f,
-	0x20,	0x21,	0x22,	0x23,	0x24,	0x25,	0x26,	0x27,
-	0x28,	0x29,	0x2a,	0x2b,	0x2c,	0x2d,	0x2e,	0x2f,
-	0x30,	0x31,	0x32,	0x33,	0x34,	0x35,	0x36,	0x37,
-	0x38,	0x39,	0x3a,	0x3b,	0x3c,	0x3d,	0x3e,	0x3f,
-	0x40,	0x41,	0x42,	0x43,	0x44,	0x45,	0x46,	0x47,
-	0x48,	0x49,	0x4a,	0x4b,	0x4c,	0x4d,	0x4e,	0x4f,
-	0x50,	0x51,	0x52,	0x53,	0x54,	0x55,	0x56,	0x57,
-	0x58,	0x59,	0x5a,	0x5b,	0x5c,	0x5d,	0x5e,	0x5f,
-	0x60,	'A',	'B',	'C',	'D',	'E',	'F',	'G',
-	'H',	'I',	'J',	'K',	'L',	'M',	'N',	'O',
-	'P',	'Q',	'R',	'S',	'T',	'U',	'V',	'W',
-	'X',	'Y',	'Z',	0x7b,	0x7c,	0x7d,	0x7e,	0x7f,
-	0x80,	0x81,	0x82,	0x83,	0x84,	0x85,	0x86,	0x87,
-	0x88,	0x89,	0x8a,	0x8b,	0x8c,	0x8d,	0x8e,	0x8f,
-	0x90,	0x91,	0x92,	0x93,	0x94,	0x95,	0x96,	0x97,
-	0x98,	0x99,	0x9a,	0x9b,	0x9c,	0x9d,	0x9e,	0x9f,
-	0xa0,	0xa1,	0xa2,	0xa3,	0xa4,	0xa5,	0xa6,	0xa7,
-	0xa8,	0xa9,	0xaa,	0xab,	0xac,	0xad,	0xae,	0xaf,
-	0xb0,	0xb1,	0xb2,	0xb3,	0xb4,	0xb5,	0xb6,	0xb7,
-	0xb8,	0xb9,	0xba,	0xbb,	0xbc,	0xbd,	0xbe,	0xbf,
-	0xc0,	0xc1,	0xc2,	0xc3,	0xc4,	0xc5,	0xc6,	0xc7,
-	0xc8,	0xc9,	0xca,	0xcb,	0xcc,	0xcd,	0xce,	0xcf,
-	0xd0,	0xd1,	0xd2,	0xd3,	0xd4,	0xd5,	0xd6,	0xd7,
-	0xd8,	0xd9,	0xda,	0xdb,	0xdc,	0xdd,	0xde,	0xdf,
-	0xe0,	0xe1,	0xe2,	0xe3,	0xe4,	0xe5,	0xe6,	0xe7,
-	0xe8,	0xe9,	0xea,	0xeb,	0xec,	0xed,	0xee,	0xef,
-	0xf0,	0xf1,	0xf2,	0xf3,	0xf4,	0xf5,	0xf6,	0xf7,
-	0xf8,	0xf9,	0xfa,	0xfb,	0xfc,	0xfd,	0xfe,	0xff
+	0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+	0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+	0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+	0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+	0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+	0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+	0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+	0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+	0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
+	0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f,
+	0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57,
+	0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+	0x60, 'A', 'B', 'C', 'D', 'E', 'F', 'G',
+	'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
+	'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
+	'X', 'Y', 'Z', 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
+	0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+	0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+	0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
+	0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
+	0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
+	0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
+	0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
+	0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
+	0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+	0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+	0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
+	0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
+	0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
+	0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
+	0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
+	0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
 };
 
 const short *_switch_toupper_tab_ = _switch_C_toupper_;
 
 SWITCH_DECLARE(int) switch_toupper(int c)
 {
-	if ((unsigned int)c > 255)
-		return(c);
+	if ((unsigned int) c > 255)
+		return (c);
 	if (c < -1)
 		return EOF;
-	return((_switch_toupper_tab_ + 1)[c]);
+	return ((_switch_toupper_tab_ + 1)[c]);
 }
 
 const short _switch_C_tolower_[1 + SWITCH_CTYPE_NUM_CHARS] = {
 	EOF,
-	0x00,	0x01,	0x02,	0x03,	0x04,	0x05,	0x06,	0x07,
-	0x08,	0x09,	0x0a,	0x0b,	0x0c,	0x0d,	0x0e,	0x0f,
-	0x10,	0x11,	0x12,	0x13,	0x14,	0x15,	0x16,	0x17,
-	0x18,	0x19,	0x1a,	0x1b,	0x1c,	0x1d,	0x1e,	0x1f,
-	0x20,	0x21,	0x22,	0x23,	0x24,	0x25,	0x26,	0x27,
-	0x28,	0x29,	0x2a,	0x2b,	0x2c,	0x2d,	0x2e,	0x2f,
-	0x30,	0x31,	0x32,	0x33,	0x34,	0x35,	0x36,	0x37,
-	0x38,	0x39,	0x3a,	0x3b,	0x3c,	0x3d,	0x3e,	0x3f,
-	0x40,	'a',	'b',	'c',	'd',	'e',	'f',	'g',
-	'h',	'i',	'j',	'k',	'l',	'm',	'n',	'o',
-	'p',	'q',	'r',	's',	't',	'u',	'v',	'w',
-	'x',	'y',	'z',	0x5b,	0x5c,	0x5d,	0x5e,	0x5f,
-	0x60,	0x61,	0x62,	0x63,	0x64,	0x65,	0x66,	0x67,
-	0x68,	0x69,	0x6a,	0x6b,	0x6c,	0x6d,	0x6e,	0x6f,
-	0x70,	0x71,	0x72,	0x73,	0x74,	0x75,	0x76,	0x77,
-	0x78,	0x79,	0x7a,	0x7b,	0x7c,	0x7d,	0x7e,	0x7f,
-	0x80,	0x81,	0x82,	0x83,	0x84,	0x85,	0x86,	0x87,
-	0x88,	0x89,	0x8a,	0x8b,	0x8c,	0x8d,	0x8e,	0x8f,
-	0x90,	0x91,	0x92,	0x93,	0x94,	0x95,	0x96,	0x97,
-	0x98,	0x99,	0x9a,	0x9b,	0x9c,	0x9d,	0x9e,	0x9f,
-	0xa0,	0xa1,	0xa2,	0xa3,	0xa4,	0xa5,	0xa6,	0xa7,
-	0xa8,	0xa9,	0xaa,	0xab,	0xac,	0xad,	0xae,	0xaf,
-	0xb0,	0xb1,	0xb2,	0xb3,	0xb4,	0xb5,	0xb6,	0xb7,
-	0xb8,	0xb9,	0xba,	0xbb,	0xbc,	0xbd,	0xbe,	0xbf,
-	0xc0,	0xc1,	0xc2,	0xc3,	0xc4,	0xc5,	0xc6,	0xc7,
-	0xc8,	0xc9,	0xca,	0xcb,	0xcc,	0xcd,	0xce,	0xcf,
-	0xd0,	0xd1,	0xd2,	0xd3,	0xd4,	0xd5,	0xd6,	0xd7,
-	0xd8,	0xd9,	0xda,	0xdb,	0xdc,	0xdd,	0xde,	0xdf,
-	0xe0,	0xe1,	0xe2,	0xe3,	0xe4,	0xe5,	0xe6,	0xe7,
-	0xe8,	0xe9,	0xea,	0xeb,	0xec,	0xed,	0xee,	0xef,
-	0xf0,	0xf1,	0xf2,	0xf3,	0xf4,	0xf5,	0xf6,	0xf7,
-	0xf8,	0xf9,	0xfa,	0xfb,	0xfc,	0xfd,	0xfe,	0xff
+	0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
+	0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+	0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
+	0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
+	0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27,
+	0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f,
+	0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
+	0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f,
+	0x40, 'a', 'b', 'c', 'd', 'e', 'f', 'g',
+	'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
+	'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
+	'x', 'y', 'z', 0x5b, 0x5c, 0x5d, 0x5e, 0x5f,
+	0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
+	0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
+	0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77,
+	0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f,
+	0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+	0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
+	0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
+	0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f,
+	0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7,
+	0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf,
+	0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
+	0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf,
+	0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
+	0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf,
+	0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7,
+	0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf,
+	0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7,
+	0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef,
+	0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
+	0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff
 };
 
 const short *_switch_tolower_tab_ = _switch_C_tolower_;
 
 SWITCH_DECLARE(int) switch_tolower(int c)
 {
-	if ((unsigned int)c > 255)
-		return(c);
+	if ((unsigned int) c > 255)
+		return (c);
 	if (c < -1)
 		return EOF;
-	return((_switch_tolower_tab_ + 1)[c]);
+	return ((_switch_tolower_tab_ + 1)[c]);
 }
 
 /*
@@ -2064,136 +2142,136 @@
 
 const int _switch_C_ctype_[1 + SWITCH_CTYPE_NUM_CHARS] = {
 	0,
-	_C,	_C,	_C,	_C,	_C,	_C,	_C,	_C,
-	_C,	_C|_S,	_C|_S,	_C|_S,	_C|_S,	_C|_S,	_C,	_C,
-	_C,	_C,	_C,	_C,	_C,	_C,	_C,	_C,
-	_C,	_C,	_C,	_C,	_C,	_C,	_C,	_C,
-   _S|_B,	_P,	_P,	_P,	_P,	_P,	_P,	_P,
-	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P,
-	_N,	_N,	_N,	_N,	_N,	_N,	_N,	_N,
-	_N,	_N,	_P,	_P,	_P,	_P,	_P,	_P,
-	_P,	_U|_X,	_U|_X,	_U|_X,	_U|_X,	_U|_X,	_U|_X,	_U,
-	_U,	_U,	_U,	_U,	_U,	_U,	_U,	_U,
-	_U,	_U,	_U,	_U,	_U,	_U,	_U,	_U,
-	_U,	_U,	_U,	_P,	_P,	_P,	_P,	_P,
-	_P,	_L|_X,	_L|_X,	_L|_X,	_L|_X,	_L|_X,	_L|_X,	_L,
-	_L,	_L,	_L,	_L,	_L,	_L,	_L,	_L,
-	_L,	_L,	_L,	_L,	_L,	_L,	_L,	_L,
+	_C, _C, _C, _C, _C, _C, _C, _C,
+	_C, _C | _S, _C | _S, _C | _S, _C | _S, _C | _S, _C, _C,
+	_C, _C, _C, _C, _C, _C, _C, _C,
+	_C, _C, _C, _C, _C, _C, _C, _C,
+	_S | _B, _P, _P, _P, _P, _P, _P, _P,
+	_P, _P, _P, _P, _P, _P, _P, _P,
+	_N, _N, _N, _N, _N, _N, _N, _N,
+	_N, _N, _P, _P, _P, _P, _P, _P,
+	_P, _U | _X, _U | _X, _U | _X, _U | _X, _U | _X, _U | _X, _U,
+	_U, _U, _U, _U, _U, _U, _U, _U,
+	_U, _U, _U, _U, _U, _U, _U, _U,
+	_U, _U, _U, _P, _P, _P, _P, _P,
+	_P, _L | _X, _L | _X, _L | _X, _L | _X, _L | _X, _L | _X, _L,
+	_L, _L, _L, _L, _L, _L, _L, _L,
+	_L, _L, _L, _L, _L, _L, _L, _L,
 /* determine printability based on the IS0 8859 8-bit standard */
-	_L,	_L,	_L,	_P,	_P,	_P,	_P,	_C,
+	_L, _L, _L, _P, _P, _P, _P, _C,
 
-	_C,	_C,	_C,	_C,	_C,	_C,	_C,	_C, /* 80 */
-	_C,	_C,	_C,	_C,	_C,	_C,	_C,	_C, /* 88 */
-	_C,	_C,	_C,	_C,	_C,	_C,	_C,	_C, /* 90 */
-	_C,	_C,	_C,	_C,	_C,	_C,	_C,	_C, /* 98 */
-	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P, /* A0 */
-	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P, /* A8 */
-	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P, /* B0 */
-	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P, /* B8 */
-	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P, /* C0 */
-	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P, /* C8 */
-	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P, /* D0 */
-	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P, /* D8 */
-	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P, /* E0 */
-	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P, /* E8 */
-	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P, /* F0 */
-	_P,	_P,	_P,	_P,	_P,	_P,	_P,	_P  /* F8 */
+	_C, _C, _C, _C, _C, _C, _C, _C,	/* 80 */
+	_C, _C, _C, _C, _C, _C, _C, _C,	/* 88 */
+	_C, _C, _C, _C, _C, _C, _C, _C,	/* 90 */
+	_C, _C, _C, _C, _C, _C, _C, _C,	/* 98 */
+	_P, _P, _P, _P, _P, _P, _P, _P,	/* A0 */
+	_P, _P, _P, _P, _P, _P, _P, _P,	/* A8 */
+	_P, _P, _P, _P, _P, _P, _P, _P,	/* B0 */
+	_P, _P, _P, _P, _P, _P, _P, _P,	/* B8 */
+	_P, _P, _P, _P, _P, _P, _P, _P,	/* C0 */
+	_P, _P, _P, _P, _P, _P, _P, _P,	/* C8 */
+	_P, _P, _P, _P, _P, _P, _P, _P,	/* D0 */
+	_P, _P, _P, _P, _P, _P, _P, _P,	/* D8 */
+	_P, _P, _P, _P, _P, _P, _P, _P,	/* E0 */
+	_P, _P, _P, _P, _P, _P, _P, _P,	/* E8 */
+	_P, _P, _P, _P, _P, _P, _P, _P,	/* F0 */
+	_P, _P, _P, _P, _P, _P, _P, _P	/* F8 */
 };
 
 const int *_switch_ctype_ = _switch_C_ctype_;
 
 SWITCH_DECLARE(int) switch_isalnum(int c)
 {
-	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char)c] & (_U|_L|_N)));
+	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char) c] & (_U | _L | _N)));
 }
 
 SWITCH_DECLARE(int) switch_isalpha(int c)
 {
-	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char)c] & (_U|_L)));
+	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char) c] & (_U | _L)));
 }
 
 SWITCH_DECLARE(int) switch_iscntrl(int c)
 {
-	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char)c] & _C));
+	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char) c] & _C));
 }
 
 SWITCH_DECLARE(int) switch_isdigit(int c)
 {
-	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char)c] & _N));
+	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char) c] & _N));
 }
 
 SWITCH_DECLARE(int) switch_isgraph(int c)
 {
-	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char)c] & (_P|_U|_L|_N)));
+	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char) c] & (_P | _U | _L | _N)));
 }
 
 SWITCH_DECLARE(int) switch_islower(int c)
 {
-	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char)c] & _L));
+	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char) c] & _L));
 }
 
 SWITCH_DECLARE(int) switch_isprint(int c)
 {
-	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char)c] & (_P|_U|_L|_N|_B)));
+	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char) c] & (_P | _U | _L | _N | _B)));
 }
 
 SWITCH_DECLARE(int) switch_ispunct(int c)
 {
-	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char)c] & _P));
+	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char) c] & _P));
 }
 
 SWITCH_DECLARE(int) switch_isspace(int c)
 {
-	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char)c] & _S));
+	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char) c] & _S));
 }
 
 SWITCH_DECLARE(int) switch_isupper(int c)
 {
-	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char)c] & _U));
+	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char) c] & _U));
 }
 
 SWITCH_DECLARE(int) switch_isxdigit(int c)
 {
-	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char)c] & (_N|_X)));
+	return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char) c] & (_N | _X)));
 }
 
 SWITCH_DECLARE(int) switch_number_cmp(const char *exp, int val)
 {
-    char *p;
-	
-    if ((p=strchr(exp, '-'))) {
-        int min;
-        int max;
+	char *p;
 
-        min = atol(exp);
-        p++;
-        max = atol(p);
+	if ((p = strchr(exp, '-'))) {
+		int min;
+		int max;
 
-        if (val >= min && val <= max) {
-            return 1;
-        }
-    } else if ((p=strchr(exp, ','))) {
-        const char *cur = exp;
+		min = atol(exp);
 		p++;
-        while(cur) {
-            if (atol(cur) == val) {
-                return 1;
-            }
-			
-            cur = p;
-			if (p && p+1) {
-				if ((p = strchr((p+1), ','))) {
+		max = atol(p);
+
+		if (val >= min && val <= max) {
+			return 1;
+		}
+	} else if ((p = strchr(exp, ','))) {
+		const char *cur = exp;
+		p++;
+		while (cur) {
+			if (atol(cur) == val) {
+				return 1;
+			}
+
+			cur = p;
+			if (p && p + 1) {
+				if ((p = strchr((p + 1), ','))) {
 					p++;
 				}
 			}
-        }
-    } else {
-        if (atol(exp) == val) {
-            return 1;
-        }
-    }
+		}
+	} else {
+		if (atol(exp) == val) {
+			return 1;
+		}
+	}
 
-    return 0;
+	return 0;
 
 }
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_xml.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_xml.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_xml.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -63,13 +63,13 @@
 #include <apr_file_io.h>
 
 typedef struct {
-	size_t gl_pathc;	/* Count of total paths so far. */
-	size_t gl_matchc;	/* Count of paths matching pattern. */
-	size_t gl_offs;		/* Reserved at beginning of gl_pathv. */
-	int gl_flags;		/* Copy of flags parameter to glob. */
-	char **gl_pathv;	/* List of paths matching pattern. */
+	size_t gl_pathc;			/* Count of total paths so far. */
+	size_t gl_matchc;			/* Count of paths matching pattern. */
+	size_t gl_offs;				/* Reserved at beginning of gl_pathv. */
+	int gl_flags;				/* Copy of flags parameter to glob. */
+	char **gl_pathv;			/* List of paths matching pattern. */
 	/* Copy of errfunc parameter to glob. */
-	int (*gl_errfunc)(const char *, int);	
+	int (*gl_errfunc) (const char *, int);
 } glob_t;
 
 /* Believed to have been introduced in 1003.2-1992 */
@@ -92,7 +92,7 @@
 #define	GLOB_QUOTE		0x0400	/* Quote special chars with \. */
 #define	GLOB_LIMIT		0x1000	/* limit number of returned paths */
 
-int	glob(const char *, int, int (*)(const char *, int), glob_t *);
+int glob(const char *, int, int (*)(const char *, int), glob_t *);
 void globfree(glob_t *);
 
 #endif
@@ -105,7 +105,7 @@
 #endif
 
 #define SWITCH_XML_WS   "\t\r\n "	/* whitespace */
-#define SWITCH_XML_ERRL 128			/* maximum error string length */
+#define SWITCH_XML_ERRL 128		/* maximum error string length */
 
 static int preprocess(const char *cwd, const char *file, int write_fd, int rlevel);
 
@@ -166,7 +166,7 @@
 	char buf[1024] = "";
 	/*switch_xml_section_t sections = SWITCH_XML_SECTION_RESULT; */
 	uint32_t sections = SWITCH_XML_SECTION_RESULT;
-	
+
 	if (str) {
 		for (x = 0; x < strlen(str); x++) {
 			buf[x] = (char) tolower((int) str[x]);
@@ -252,8 +252,7 @@
 }
 
 SWITCH_DECLARE(switch_status_t) switch_xml_bind_search_function_ret(switch_xml_search_function_t function,
-																	switch_xml_section_t sections, void *user_data,
-																	switch_xml_binding_t **ret_binding)
+																	switch_xml_section_t sections, void *user_data, switch_xml_binding_t **ret_binding)
 {
 	switch_xml_binding_t *binding = NULL, *ptr = NULL;
 	assert(function != NULL);
@@ -302,18 +301,18 @@
 	return p;
 }
 
-SWITCH_DECLARE(switch_xml_t) switch_xml_find_child_multi(switch_xml_t node, const char *childname, ...)
+SWITCH_DECLARE(switch_xml_t) switch_xml_find_child_multi(switch_xml_t node, const char *childname,...)
 {
 	switch_xml_t p = NULL;
-	const char *names[256] = {0};
-	const char *vals[256] = {0};
+	const char *names[256] = { 0 };
+	const char *vals[256] = { 0 };
 	int x, i = 0;
 	va_list ap;
 	const char *attrname, *value = NULL;
 
 	va_start(ap, childname);
-	
-	while(i < 255) {
+
+	while (i < 255) {
 		if ((attrname = va_arg(ap, const char *))) {
 			value = va_arg(ap, const char *);
 		}
@@ -331,7 +330,7 @@
 	if (!(childname && i)) {
 		return node;
 	}
-	
+
 	for (p = switch_xml_child(node, childname); p; p = p->next) {
 		for (x = 0; x < i; x++) {
 			if (names[x] && vals[x]) {
@@ -353,7 +352,7 @@
 		}
 	}
 
- done:
+  done:
 
 	return p;
 }
@@ -398,6 +397,12 @@
 
 	while (root->xml.parent)
 		root = (switch_xml_root_t) root->xml.parent;	/* root tag */
+
+	/* Make sure root is really a switch_xml_root_t (Issues with switch_xml_toxml) */
+	if (!root->xml.is_switch_xml_root_t) {
+		return NULL;
+	}
+
 	for (i = 0; root->attr[i] && xml->name && strcmp(xml->name, root->attr[i][0]); i++);
 	if (!root->attr[i])
 		return NULL;			/* no matching default attributes */
@@ -481,7 +486,7 @@
 	char *e, *r = s, *m = s;
 	long b, c, d, l;
 
-	for (; *s; s++) {	/* normalize line endings */
+	for (; *s; s++) {			/* normalize line endings */
 		while (*s == '\r') {
 			*(s++) = '\n';
 			if (*s == '\n')
@@ -490,7 +495,7 @@
 	}
 
 	for (s = r;;) {
-		while (*s && *s != '&' && (*s != '%' || t != '%') && !isspace((int) (*s)))
+		while (*s && *s != '&' && (*s != '%' || t != '%') && !isspace((unsigned char) (*s)))
 			s++;
 
 		if (!*s)
@@ -503,13 +508,13 @@
 			if (!c || *e != ';') {
 				s++;
 				continue;
-			}					/* not a character ref */
-
+			}
+			/* not a character ref */
 			if (c < 0x80)
 				*(s++) = (char) c;	/* US-ASCII subset */
-			else {					/* multi-byte UTF-8 sequence */
+			else {				/* multi-byte UTF-8 sequence */
 				for (b = 0, d = c; d; d /= 2)
-					b++;			/* number of bits in c */
+					b++;		/* number of bits in c */
 				b = (b - 2) / 5;	/* number of bytes in payload */
 				*(s++) = (char) ((0xFF << (7 - b)) | (c >> (6 * b)));	/* head */
 				while (b)
@@ -525,19 +530,21 @@
 					l = (d = (long) (s - r)) + c + (long) strlen(e);	/* new length */
 					if (l) {
 						if (r == m) {
-							char *tmp = (char *)malloc(l);
+							char *tmp = (char *) malloc(l);
 							if (tmp) {
 								r = strcpy(tmp, r);
 							} else {
-								if (r) free(r);
+								if (r)
+									free(r);
 								return NULL;
 							}
 						} else {
-							char *tmp = (char *)realloc(r, l);
+							char *tmp = (char *) realloc(r, l);
 							if (tmp) {
 								r = tmp;
 							} else {
-								if (r) free(r);
+								if (r)
+									free(r);
 								return NULL;
 							}
 						}
@@ -598,15 +605,15 @@
 	if (!*(xml->txt))
 		xml->txt = s;			/* initial character content */
 	else {						/* allocate our own memory and make a copy */
-		if ((xml->flags & SWITCH_XML_TXTM)) { /* allocate some space */
-			char *tmp = (char *)realloc(xml->txt, (l = strlen(xml->txt)) + len);
+		if ((xml->flags & SWITCH_XML_TXTM)) {	/* allocate some space */
+			char *tmp = (char *) realloc(xml->txt, (l = strlen(xml->txt)) + len);
 			if (tmp) {
 				xml->txt = tmp;
 			} else {
 				return;
 			}
 		} else {
-			char *tmp = (char *)malloc((l = strlen(xml->txt)) + len);
+			char *tmp = (char *) malloc((l = strlen(xml->txt)) + len);
 			if (tmp) {
 				xml->txt = strcpy(tmp, xml->txt);
 			} else {
@@ -665,7 +672,8 @@
 		s += strspn(s + 1, SWITCH_XML_WS) + 1;	/* skip whitespace after target */
 	}
 
-	if (!root) return;
+	if (!root)
+		return;
 
 	if (!strcmp(target, "xml")) {	/* <?xml ... ?> */
 		if ((s = strstr(s, "standalone")) && !strncmp(s + strspn(s + 10, SWITCH_XML_WS "='\"") + 10, "yes", 3))
@@ -674,20 +682,24 @@
 	}
 
 	if (!root->pi[0]) {
-		root->pi = (char ***)malloc(sizeof(char **));
-		if (!root->pi) return;
-		*(root->pi) = NULL;	/* first pi */
+		root->pi = (char ***) malloc(sizeof(char **));
+		if (!root->pi)
+			return;
+		*(root->pi) = NULL;		/* first pi */
 	}
 
 	while (root->pi[i] && strcmp(target, root->pi[i][0]))
 		i++;					/* find target */
 	if (!root->pi[i]) {			/* new target */
-		char ***ssstmp = (char ***)realloc(root->pi, sizeof(char **) * (i + 2));
-		if (!ssstmp) return;
-		root->pi = ssstmp; 
-		if (!root->pi) return;
-		root->pi[i] = (char **)malloc(sizeof(char *) * 3);
-		if (!root->pi[i]) return;
+		char ***ssstmp = (char ***) realloc(root->pi, sizeof(char **) * (i + 2));
+		if (!ssstmp)
+			return;
+		root->pi = ssstmp;
+		if (!root->pi)
+			return;
+		root->pi[i] = (char **) malloc(sizeof(char *) * 3);
+		if (!root->pi[i])
+			return;
 		root->pi[i][0] = target;
 		root->pi[i][1] = (char *) (root->pi[i + 1] = NULL);	/* terminate pi list */
 		root->pi[i][2] = strdup("");	/* empty document position list */
@@ -695,12 +707,14 @@
 
 	while (root->pi[i][j])
 		j++;					/* find end of instruction list for this target */
-	sstmp = (char **)realloc(root->pi[i], sizeof(char *) * (j + 3));
-	if (!sstmp) return;
+	sstmp = (char **) realloc(root->pi[i], sizeof(char *) * (j + 3));
+	if (!sstmp)
+		return;
 	root->pi[i] = sstmp;
-	stmp = (char *)realloc(root->pi[i][j + 1], j + 1);
-	if (!stmp) return;
-	root->pi[i][j + 2] = stmp; 
+	stmp = (char *) realloc(root->pi[i][j + 1], j + 1);
+	if (!stmp)
+		return;
+	root->pi[i][j + 2] = stmp;
 	strcpy(root->pi[i][j + 2] + j - 1, (root->xml.name) ? ">" : "<");
 	root->pi[i][j + 1] = NULL;	/* null terminate pi list for this target */
 	root->pi[i][j] = s;			/* set instruction */
@@ -713,27 +727,27 @@
 	int i, j;
 	char **sstmp;
 
-	pe = (char **)memcpy(malloc(sizeof(SWITCH_XML_NIL)), SWITCH_XML_NIL, sizeof(SWITCH_XML_NIL));
-	
+	pe = (char **) memcpy(malloc(sizeof(SWITCH_XML_NIL)), SWITCH_XML_NIL, sizeof(SWITCH_XML_NIL));
+
 	for (s[len] = '\0'; s;) {
 		while (*s && *s != '<' && *s != '%')
 			s++;				/* find next declaration */
 
 		if (!*s)
 			break;
-		else if (!strncmp(s, "<!ENTITY", 8)) {			/* parse entity definitions */
+		else if (!strncmp(s, "<!ENTITY", 8)) {	/* parse entity definitions */
 			c = s += strspn(s + 8, SWITCH_XML_WS) + 8;	/* skip white space separator */
-			n = s + strspn(s, SWITCH_XML_WS "%");		/* find name */
+			n = s + strspn(s, SWITCH_XML_WS "%");	/* find name */
 			*(s = n + strcspn(n, SWITCH_XML_WS)) = ';';	/* append ; to name */
 
 			v = s + strspn(s + 1, SWITCH_XML_WS) + 1;	/* find value */
-			if ((q = *(v++)) != '"' && q != '\'') {		/* skip externals */
+			if ((q = *(v++)) != '"' && q != '\'') {	/* skip externals */
 				s = strchr(s, '>');
 				continue;
 			}
 
 			for (i = 0, ent = (*c == '%') ? pe : root->ent; ent[i]; i++);
-			sstmp = (char **)realloc(ent, (i + 3) * sizeof(char *));	/* space for next ent */
+			sstmp = (char **) realloc(ent, (i + 3) * sizeof(char *));	/* space for next ent */
 			if (!sstmp) {
 				switch_xml_err(root, v, "Allocation Error!");
 				break;
@@ -770,7 +784,7 @@
 
 			//while (*(n = ++s + strspn(s, SWITCH_XML_WS)) && *n != '>') {
 			// gcc 4.4 you are a creep
-			for(;;) {
+			for (;;) {
 				s++;
 				if (!(*(n = s + strspn(s, SWITCH_XML_WS)) && *n != '>')) {
 					break;
@@ -783,7 +797,7 @@
 				}
 
 				s += strspn(s + 1, SWITCH_XML_WS) + 1;	/* find next token */
-				c = (strncmp(s, "CDATA", 5)) ? (char *)"*" : (char *)" ";	/* is it cdata? */
+				c = (strncmp(s, "CDATA", 5)) ? (char *) "*" : (char *) " ";	/* is it cdata? */
 				if (!strncmp(s, "NOTATION", 8))
 					s += strspn(s + 8, SWITCH_XML_WS) + 8;
 				s = (*s == '(') ? strchr(s, ')') : s + strcspn(s, SWITCH_XML_WS);
@@ -809,15 +823,15 @@
 				}
 
 				if (!root->attr[i]) {	/* new tag name */
-					root->attr = (!i) ? (char ***)malloc(2 * sizeof(char **))
-						: (char ***)realloc(root->attr, (i + 2) * sizeof(char **));
-					root->attr[i] = (char **)malloc(2 * sizeof(char *));
+					root->attr = (!i) ? (char ***) malloc(2 * sizeof(char **))
+						: (char ***) realloc(root->attr, (i + 2) * sizeof(char **));
+					root->attr[i] = (char **) malloc(2 * sizeof(char *));
 					root->attr[i][0] = t;	/* set tag name */
 					root->attr[i][1] = (char *) (root->attr[i + 1] = NULL);
 				}
 
 				for (j = 1; root->attr[i][j]; j += 3);	/* find end of list */
-				sstmp = (char **)realloc(root->attr[i], (j + 4) * sizeof(char *));
+				sstmp = (char **) realloc(root->attr[i], (j + 4) * sizeof(char *));
 
 				if (!sstmp) {
 					switch_xml_err(root, t, "Allocation Error!");
@@ -826,17 +840,17 @@
 
 				root->attr[i] = sstmp;
 				root->attr[i][j + 3] = NULL;	/* null terminate list */
-				root->attr[i][j + 2] = c;		/* is it cdata? */
+				root->attr[i][j + 2] = c;	/* is it cdata? */
 				root->attr[i][j + 1] = (v) ? switch_xml_decode(v, root->ent, *c) : NULL;
-				root->attr[i][j] = n;			/* attribute name  */
+				root->attr[i][j] = n;	/* attribute name  */
 			}
 		} else if (!strncmp(s, "<!--", 4))
-			s = strstr(s + 4, "-->");			/* comments */
-		else if (!strncmp(s, "<?", 2)) {		/* processing instructions */
+			s = strstr(s + 4, "-->");	/* comments */
+		else if (!strncmp(s, "<?", 2)) {	/* processing instructions */
 			if ((s = strstr(c = s + 2, "?>")))
 				switch_xml_proc_inst(root, c, s++ - c);
 		} else if (*s == '<')
-			s = strchr(s, '>');					/* skip other declarations */
+			s = strchr(s, '>');	/* skip other declarations */
 		else if (*(s++) == '%' && !root->standalone)
 			break;
 	}
@@ -857,10 +871,10 @@
 	if (be == -1)
 		return NULL;			/* not UTF-16 */
 
-	u = (char *)malloc(max);
+	u = (char *) malloc(max);
 	for (sl = 2; sl < *len - 1; sl += 2) {
 		c = (be) ? (((*s)[sl] & 0xFF) << 8) | ((*s)[sl + 1] & 0xFF)	/* UTF-16BE */
-			: (((*s)[sl + 1] & 0xFF) << 8) | ((*s)[sl] & 0xFF);		/* UTF-16LE */
+			: (((*s)[sl + 1] & 0xFF) << 8) | ((*s)[sl] & 0xFF);	/* UTF-16LE */
 		if (c >= 0xD800 && c <= 0xDFFF && (sl += 2) < *len - 1) {	/* high-half */
 			d = (be) ? (((*s)[sl] & 0xFF) << 8) | ((*s)[sl + 1] & 0xFF)
 				: (((*s)[sl + 1] & 0xFF) << 8) | ((*s)[sl] & 0xFF);
@@ -869,8 +883,9 @@
 
 		while (l + 6 > max) {
 			char *tmp;
-			tmp = (char *)realloc(u, max += SWITCH_XML_BUFSIZE);
-			if (!tmp) return NULL;
+			tmp = (char *) realloc(u, max += SWITCH_XML_BUFSIZE);
+			if (!tmp)
+				return NULL;
 			u = tmp;
 		}
 		if (c < 0x80)
@@ -884,7 +899,7 @@
 				u[l++] = (char) (0x80 | ((c >> (6 * --b)) & 0x3F));	/* payload */
 		}
 	}
-	return *s = (char *)realloc(u, *len = l);
+	return *s = (char *) realloc(u, *len = l);
 }
 
 /* frees a tag attribute list */
@@ -908,16 +923,16 @@
 	free(attr);
 }
 
-SWITCH_DECLARE(switch_xml_t) switch_xml_parse_str_dynamic(char *s, switch_bool_t dup) 
+SWITCH_DECLARE(switch_xml_t) switch_xml_parse_str_dynamic(char *s, switch_bool_t dup)
 {
 	switch_xml_root_t root;
 	char *data;
-	
+
 	switch_assert(s);
 	data = dup ? strdup(s) : s;
-	
+
 	if ((root = (switch_xml_root_t) switch_xml_parse_str(data, strlen(data)))) {
-		root->dynamic = 1; /* Make sure we free the memory is switch_xml_free() */
+		root->dynamic = 1;		/* Make sure we free the memory is switch_xml_free() */
 		return &root->xml;
 	} else {
 		if (dup) {
@@ -926,7 +941,7 @@
 		return NULL;
 	}
 }
-	
+
 /* parse the given xml string and return an switch_xml structure */
 SWITCH_DECLARE(switch_xml_t) switch_xml_parse_str(char *s, switch_size_t len)
 {
@@ -952,26 +967,26 @@
 		attr = (char **) SWITCH_XML_NIL;
 		d = ++s;
 
-		if (isalpha((int) (*s)) || *s == '_' || *s == ':' || (int8_t) *s < '\0') {	/* new tag */
+		if (isalpha((int) (*s)) || *s == '_' || *s == ':' || (int8_t) * s < '\0') {	/* new tag */
 			if (!root->cur)
 				return switch_xml_err(root, d, "markup outside of root element");
 
 			s += strcspn(s, SWITCH_XML_WS "/>");
 			while (isspace((int) (*s)))
-			*(s++) = '\0';	/* null terminate tag name */
+				*(s++) = '\0';	/* null terminate tag name */
 
 			if (*s && *s != '/' && *s != '>')	/* find tag in default attr list */
 				for (i = 0; (a = root->attr[i]) && strcmp(a[0], d); i++);
 
 			for (l = 0; *s && *s != '/' && *s != '>'; l += 2) {	/* new attrib */
-				attr = (l) ? (char **)realloc(attr, (l + 4) * sizeof(char *))
-					: (char **)malloc(4 * sizeof(char *));	/* allocate space */
-				attr[l + 3] = (l) ? (char *)realloc(attr[l + 1], (l / 2) + 2)
-					: (char *)malloc(2);					/* mem for list of maloced vals */
-				strcpy(attr[l + 3] + (l / 2), " ");			/* value is not malloced */
-				attr[l + 2] = NULL;							/* null terminate list */
-				attr[l + 1] = (char *)"";					/* temporary attribute value */
-				attr[l] = s;								/* set attribute name */
+				attr = (l) ? (char **) realloc(attr, (l + 4) * sizeof(char *))
+					: (char **) malloc(4 * sizeof(char *));	/* allocate space */
+				attr[l + 3] = (l) ? (char *) realloc(attr[l + 1], (l / 2) + 2)
+					: (char *) malloc(2);	/* mem for list of maloced vals */
+				strcpy(attr[l + 3] + (l / 2), " ");	/* value is not malloced */
+				attr[l + 2] = NULL;	/* null terminate list */
+				attr[l + 1] = (char *) "";	/* temporary attribute value */
+				attr[l] = s;	/* set attribute name */
 
 				s += strcspn(s, SWITCH_XML_WS "=/>");
 				if (*s == '=' || isspace((int) (*s))) {
@@ -1084,12 +1099,12 @@
 	switch_size_t l, len = 0;
 	char *s;
 
-	if (!(s = (char *)malloc(SWITCH_XML_BUFSIZE)))
+	if (!(s = (char *) malloc(SWITCH_XML_BUFSIZE)))
 		return NULL;
 	do {
 		len += (l = fread((s + len), 1, SWITCH_XML_BUFSIZE, fp));
 		if (l == SWITCH_XML_BUFSIZE) {
-			char *tmp = (char *)realloc(s, len + SWITCH_XML_BUFSIZE);
+			char *tmp = (char *) realloc(s, len + SWITCH_XML_BUFSIZE);
 			if (!tmp) {
 				free(s);
 				return NULL;
@@ -1128,9 +1143,10 @@
 	} else {					/* mmap failed, read file into memory */
 #endif /* HAVE_MMAP */
 		m = malloc(st.st_size);
-		if (!m) return NULL;
+		if (!m)
+			return NULL;
 		l = read(fd, m, st.st_size);
-		root = (switch_xml_root_t) switch_xml_parse_str((char *)m, l);
+		root = (switch_xml_root_t) switch_xml_parse_str((char *) m, l);
 		root->dynamic = 1;		/* so we know to free s in switch_xml_free() */
 #ifdef HAVE_MMAP
 	}
@@ -1188,20 +1204,19 @@
 	if (write(write_fd, message, sizeof(message)) < 0) {
 		goto end;
 	}
-
 #else
 	int fds[2], pid = 0;
 
 	if (pipe(fds)) {
 		goto end;
-	} else { /* good to go*/
+	} else {					/* good to go */
 		pid = fork();
 
-		if (pid < 0) { /* ok maybe not */
+		if (pid < 0) {			/* ok maybe not */
 			close(fds[0]);
 			close(fds[1]);
 			goto end;
-		} else if (pid) { /* parent */
+		} else if (pid) {		/* parent */
 			char buf[1024] = "";
 			int bytes;
 			close(fds[1]);
@@ -1211,7 +1226,7 @@
 				}
 			}
 			close(fds[0]);
-		} else { /*  child */
+		} else {				/*  child */
 			close(fds[0]);
 			dup2(fds[1], STDOUT_FILENO);
 			switch_system(command, SWITCH_TRUE);
@@ -1220,25 +1235,25 @@
 		}
 	}
 #endif
- end:
+  end:
 
 	return write_fd;
-	
+
 }
 
 static int preprocess_glob(const char *cwd, const char *pattern, int write_fd, int rlevel)
 {
 	char *full_path = NULL;
 	char *dir_path = NULL, *e = NULL;
-    glob_t glob_data;
+	glob_t glob_data;
 	size_t n;
 
 	if (!switch_is_file_path(pattern)) {
 		full_path = switch_mprintf("%s%s%s", cwd, SWITCH_PATH_SEPARATOR, pattern);
 		pattern = full_path;
 	}
-	
-    if (glob(pattern, GLOB_NOCHECK, NULL, &glob_data) != 0) {
+
+	if (glob(pattern, GLOB_NOCHECK, NULL, &glob_data) != 0) {
 		if (stderr) {
 			fprintf(stderr, "Error including %s\n", pattern);
 		}
@@ -1260,9 +1275,9 @@
 		}
 		free(dir_path);
 	}
-    globfree(&glob_data);
+	globfree(&glob_data);
 
- end:
+  end:
 
 	switch_safe_free(full_path);
 
@@ -1276,7 +1291,7 @@
 	char *q, *cmd, buf[2048], ebuf[8192];
 	char *tcmd, *targ;
 	int line = 0;
-	
+
 	if ((read_fd = open(file, O_RDONLY, 0)) < 0) {
 		const char *reason = strerror(errno);
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldnt open %s (%s)\n", file, reason);
@@ -1292,7 +1307,7 @@
 		const char *err = NULL;
 		char *bp = expand_vars(buf, ebuf, sizeof(ebuf), &cur, &err);
 		line++;
-		
+
 		if (err) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error [%s] in file %s line %d\n", err, file, line);
 		}
@@ -1312,8 +1327,8 @@
 			}
 		}
 
-		if ((tcmd = (char *)switch_stristr("X-pre-process", bp))) {
-			if (*(tcmd-1) != '<') {
+		if ((tcmd = (char *) switch_stristr("X-pre-process", bp))) {
+			if (*(tcmd - 1) != '<') {
 				continue;
 			}
 			if ((e = strstr(tcmd, "/>"))) {
@@ -1323,35 +1338,35 @@
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write!\n");
 				}
 			}
-			
-			if (!(tcmd = (char *)switch_stristr("cmd", tcmd))) {
+
+			if (!(tcmd = (char *) switch_stristr("cmd", tcmd))) {
 				continue;
 			}
 
-			if (!(tcmd = (char *)switch_stristr("=", tcmd))) {
+			if (!(tcmd = (char *) switch_stristr("=", tcmd))) {
 				continue;
 			}
 
-			if (!(tcmd = (char *)switch_stristr("\"", tcmd))) {
+			if (!(tcmd = (char *) switch_stristr("\"", tcmd))) {
 				continue;
 			}
-			
+
 			tcmd++;
 
-			
+
 			if ((e = strchr(tcmd, '"'))) {
 				*e++ = '\0';
 			}
 
-			if (!(targ = (char *)switch_stristr("data", e))) {
+			if (!(targ = (char *) switch_stristr("data", e))) {
 				continue;
 			}
 
-			if (!(targ = (char *)switch_stristr("=", targ))) {
+			if (!(targ = (char *) switch_stristr("=", targ))) {
 				continue;
 			}
 
-			if (!(targ = (char *)switch_stristr("\"", targ))) {
+			if (!(targ = (char *) switch_stristr("\"", targ))) {
 				continue;
 			}
 
@@ -1360,26 +1375,26 @@
 			if ((e = strchr(targ, '"'))) {
 				*e++ = '\0';
 			}
-			
+
 			if (!strcasecmp(tcmd, "set")) {
-				char *name = (char *)targ;
+				char *name = (char *) targ;
 				char *val = strchr(name, '=');
-				
+
 				if (val) {
 					char *ve = val++;
 					while (*val && *val == ' ') {
-							val++;
+						val++;
 					}
 					*ve-- = '\0';
 					while (*ve && *ve == ' ') {
 						*ve-- = '\0';
 					}
 				}
-				
+
 				if (name && val) {
 					switch_core_set_variable(name, val);
 				}
-				
+
 			} else if (!strcasecmp(tcmd, "include")) {
 				preprocess_glob(cwd, targ, write_fd, rlevel + 1);
 			} else if (!strcasecmp(tcmd, "exec")) {
@@ -1388,7 +1403,7 @@
 
 			continue;
 		}
-		
+
 		if ((cmd = strstr(bp, "<!--#"))) {
 			if (write(write_fd, bp, (unsigned) (cmd - bp)) != (cmd - bp)) {
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Short write!\n");
@@ -1470,12 +1485,12 @@
 		m = malloc(st.st_size);
 		switch_assert(m);
 		l = read(fd, m, st.st_size);
-		root = (switch_xml_root_t) switch_xml_parse_str((char *)m, l);
+		root = (switch_xml_root_t) switch_xml_parse_str((char *) m, l);
 		root->dynamic = 1;
 		close(fd);
 		return &root->xml;
 	}
-	
+
 	return NULL;
 }
 
@@ -1484,14 +1499,16 @@
 	int fd = -1, write_fd = -1;
 	switch_xml_t xml = NULL;
 	char *new_file = NULL;
-	const char *abs;
+	const char *abs, *absw;
 
-	if ((abs = strrchr(file, '/')) || (abs = strrchr(file, '\\'))) {
-		abs++;
+	abs = strrchr(file, '/');
+	absw = strrchr(file, '\\');
+	if (abs || absw) {
+		abs > absw ? abs++ : (abs = ++absw);
 	} else {
 		abs = file;
 	}
-	
+
 	if (!(new_file = switch_mprintf("%s%s%s.fsxml", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, abs))) {
 		return NULL;
 	}
@@ -1526,12 +1543,9 @@
 
 SWITCH_DECLARE(switch_status_t) switch_xml_locate(const char *section,
 												  const char *tag_name,
-												  const char *key_name, 
-												  const char *key_value, 
-												  switch_xml_t *root, 
-												  switch_xml_t *node,
-												  switch_event_t *params,
-												  switch_bool_t clone)
+												  const char *key_name,
+												  const char *key_value,
+												  switch_xml_t *root, switch_xml_t *node, switch_event_t *params, switch_bool_t clone)
 {
 	switch_xml_t conf = NULL;
 	switch_xml_t tag = NULL;
@@ -1588,7 +1602,7 @@
 			if (clone) {
 				char *x = switch_xml_toxml(tag, SWITCH_FALSE);
 				switch_assert(x);
-				*node = *root = switch_xml_parse_str_dynamic(x, SWITCH_FALSE); /* x will be free()'d in switch_xml_free() */
+				*node = *root = switch_xml_parse_str_dynamic(x, SWITCH_FALSE);	/* x will be free()'d in switch_xml_free() */
 				switch_xml_free(xml);
 			} else {
 				*node = tag;
@@ -1609,8 +1623,7 @@
 	return SWITCH_STATUS_FALSE;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_xml_locate_domain(const char *domain_name, switch_event_t *params,
-														 switch_xml_t *root, switch_xml_t *domain)
+SWITCH_DECLARE(switch_status_t) switch_xml_locate_domain(const char *domain_name, switch_event_t *params, switch_xml_t *root, switch_xml_t *domain)
 {
 	switch_event_t *my_params = NULL;
 	switch_status_t status;
@@ -1631,11 +1644,8 @@
 }
 
 SWITCH_DECLARE(switch_status_t) switch_xml_locate_group(const char *group_name,
-														const char *domain_name, 
-														switch_xml_t *root,
-														switch_xml_t *domain,
-														switch_xml_t *group,
-														switch_event_t *params)
+														const char *domain_name,
+														switch_xml_t *root, switch_xml_t *domain, switch_xml_t *group, switch_event_t *params)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	switch_event_t *my_params = NULL;
@@ -1662,7 +1672,7 @@
 	if ((status = switch_xml_locate_domain(domain_name, params, root, domain)) != SWITCH_STATUS_SUCCESS) {
 		goto end;
 	}
-	
+
 	status = SWITCH_STATUS_FALSE;
 
 	if ((groups = switch_xml_child(*domain, "groups"))) {
@@ -1671,7 +1681,7 @@
 		}
 	}
 
- end:
+  end:
 
 	if (my_params) {
 		switch_event_destroy(&my_params);
@@ -1698,7 +1708,7 @@
 		if ((*user = switch_xml_find_child_multi(tag, "user", "ip", ip, "type", type, NULL))) {
 			return SWITCH_STATUS_SUCCESS;
 		}
-	} 
+	}
 
 	if (user_name) {
 		if (!strcasecmp(key, "id")) {
@@ -1711,19 +1721,16 @@
 			}
 		}
 	}
-	
+
 	return SWITCH_STATUS_FALSE;
-	
+
 }
 
-SWITCH_DECLARE(switch_status_t) switch_xml_locate_user_in_domain(const char *user_name,
-																 switch_xml_t domain,
-																 switch_xml_t *user,
-																 switch_xml_t *ingroup)
+SWITCH_DECLARE(switch_status_t) switch_xml_locate_user_in_domain(const char *user_name, switch_xml_t domain, switch_xml_t *user, switch_xml_t *ingroup)
 {
 	switch_xml_t group = NULL, groups = NULL, users = NULL;
 	switch_status_t status = SWITCH_STATUS_FALSE;
-	
+
 	if ((groups = switch_xml_child(domain, "groups"))) {
 		for (group = switch_xml_child(groups, "group"); group; group = group->next) {
 			if ((users = switch_xml_child(group, "users"))) {
@@ -1740,20 +1747,84 @@
 	return status;
 }
 
+
+SWITCH_DECLARE(switch_xml_t) switch_xml_dup(switch_xml_t xml)
+{
+	char *x = switch_xml_toxml(xml, SWITCH_FALSE);
+	return switch_xml_parse_str_dynamic(x, SWITCH_FALSE); 
+}
+
+
+static void do_merge(switch_xml_t in, switch_xml_t src, const char *container, const char *tag_name) 
+{
+	switch_xml_t itag, tag, param, iparam, iitag;
+
+	if (!(itag = switch_xml_child(in, container))) {
+		itag = switch_xml_add_child_d(in, container, 0);
+	}
+
+	if ((tag = switch_xml_child(src, container))) {
+		for (param = switch_xml_child(tag, tag_name); param; param = param->next) {
+			const char *var = switch_xml_attr(param, "name");
+			const char *val = switch_xml_attr(param, "value");
+			
+			int go = 1;
+
+			for (iparam = switch_xml_child(itag, tag_name); iparam; iparam = iparam->next) {
+				const char *ivar = switch_xml_attr(iparam, "name");
+				
+				if (var && ivar && !strcasecmp(var, ivar)) {
+					go = 0;
+					break;
+				}
+			}
+			
+			if (go) {
+				iitag = switch_xml_add_child_d(itag, tag_name, 0);
+				switch_xml_set_attr_d(iitag, var, val);
+			}
+		}
+	}
+	
+}
+
+
+SWITCH_DECLARE(void) switch_xml_merge_user(switch_xml_t user, switch_xml_t domain, switch_xml_t group)
+{
+
+	do_merge(user, group, "params", "param");
+	do_merge(user, group, "variables", "variable");
+	do_merge(user, domain, "params", "param");
+	do_merge(user, domain, "variables", "variable");
+}
+
+SWITCH_DECLARE(switch_status_t) switch_xml_locate_user_merged(const char *key, const char *user_name, const char *domain_name,
+															  const char *ip, switch_xml_t *user, switch_event_t *params)
+{
+	switch_xml_t xml, domain, group, x_user, x_user_dup;
+	switch_status_t status = SWITCH_STATUS_FALSE;
+
+	if ((status = switch_xml_locate_user(key, user_name, domain_name, ip, &xml, &domain, &x_user, &group, params)) == SWITCH_STATUS_SUCCESS) {
+		x_user_dup = switch_xml_dup(x_user);
+		switch_xml_merge_user(x_user_dup, domain, group);
+		*user = x_user_dup;
+	}
+
+	return status;
+
+}
+
 SWITCH_DECLARE(switch_status_t) switch_xml_locate_user(const char *key,
 													   const char *user_name,
-													   const char *domain_name, 
-													   const char *ip, 
+													   const char *domain_name,
+													   const char *ip,
 													   switch_xml_t *root,
-													   switch_xml_t *domain,
-													   switch_xml_t *user,
-													   switch_xml_t *ingroup,
-													   switch_event_t *params)
+													   switch_xml_t *domain, switch_xml_t *user, switch_xml_t *ingroup, switch_event_t *params)
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	switch_event_t *my_params = NULL, *search_params = NULL;
 	switch_xml_t group = NULL, groups = NULL, users = NULL;
-	
+
 	*root = NULL;
 	*user = NULL;
 	*domain = NULL;
@@ -1781,11 +1852,11 @@
 	if (ip) {
 		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "ip", ip);
 	}
-	
+
 	if ((status = switch_xml_locate_domain(domain_name, params, root, domain)) != SWITCH_STATUS_SUCCESS) {
 		goto end;
 	}
-	
+
 	status = SWITCH_STATUS_FALSE;
 
 	if (params != my_params) {
@@ -1808,9 +1879,9 @@
 	if (status != SWITCH_STATUS_SUCCESS) {
 		status = find_user_in_tag(*domain, ip, user_name, key, params, user);
 	}
-	
- end:
 
+  end:
+
 	if (my_params) {
 		switch_event_destroy(&my_params);
 	}
@@ -1847,16 +1918,16 @@
 SWITCH_DECLARE(void) switch_xml_free_in_thread(switch_xml_t xml, int stacksize)
 {
 	switch_thread_t *thread;
-    switch_threadattr_t *thd_attr;
+	switch_threadattr_t *thd_attr;
 	switch_memory_pool_t *pool = NULL;
 	struct destroy_xml *dx;
 
 	switch_core_new_memory_pool(&pool);
 
 	switch_threadattr_create(&thd_attr, pool);
-    switch_threadattr_detach_set(thd_attr, 1);
+	switch_threadattr_detach_set(thd_attr, 1);
 	/* TBD figure out how much space we need by looking at the xml_t when stacksize == 0 */
-    switch_threadattr_stacksize_set(thd_attr, stacksize);
+	switch_threadattr_stacksize_set(thd_attr, stacksize);
 
 	dx = switch_core_alloc(pool, sizeof(*dx));
 	dx->pool = pool;
@@ -1922,7 +1993,7 @@
 		r = switch_xml_root();
 	}
 
- done:
+  done:
 
 	switch_mutex_unlock(XML_LOCK);
 
@@ -1954,7 +2025,7 @@
 {
 	switch_status_t status = SWITCH_STATUS_FALSE;
 	switch_mutex_lock(XML_LOCK);
-	
+
 	if (MAIN_XML_ROOT) {
 		switch_xml_t xml = MAIN_XML_ROOT;
 		MAIN_XML_ROOT = NULL;
@@ -1990,7 +2061,8 @@
 	const char *e = NULL;
 	int immune = 0;
 
-	if (!(s && *s)) return *dst;	
+	if (!(s && *s))
+		return *dst;
 
 	if (len) {
 		e = s + len;
@@ -1998,8 +2070,9 @@
 
 	while (s != e) {
 		while (*dlen + 10 > *max) {
-			char *tmp = (char *)realloc(*dst, *max += SWITCH_XML_BUFSIZE);
-			if (!tmp) return *dst;
+			char *tmp = (char *) realloc(*dst, *max += SWITCH_XML_BUFSIZE);
+			if (!tmp)
+				return *dst;
 			*dst = tmp;
 		}
 
@@ -2008,39 +2081,39 @@
 				return *dst;
 			}
 			(*dst)[(*dlen)++] = *s;
-		} else 
+		} else
 			switch (*s) {
-		case '\0':
-			return *dst;
-		case '&':
-			*dlen += sprintf(*dst + *dlen, "&amp;");
-			break;
-		case '<':
-			if (*(s+1) == '!') {
+			case '\0':
+				return *dst;
+			case '&':
+				*dlen += sprintf(*dst + *dlen, "&amp;");
+				break;
+			case '<':
+				if (*(s + 1) == '!') {
+					(*dst)[(*dlen)++] = *s;
+					immune++;
+					break;
+				}
+				*dlen += sprintf(*dst + *dlen, "&lt;");
+				break;
+			case '>':
+				*dlen += sprintf(*dst + *dlen, "&gt;");
+				break;
+			case '"':
+				*dlen += sprintf(*dst + *dlen, (a) ? "&quot;" : "\"");
+				break;
+			case '\n':
+				*dlen += sprintf(*dst + *dlen, (a) ? "&#xA;" : "\n");
+				break;
+			case '\t':
+				*dlen += sprintf(*dst + *dlen, (a) ? "&#x9;" : "\t");
+				break;
+			case '\r':
+				*dlen += sprintf(*dst + *dlen, "&#xD;");
+				break;
+			default:
 				(*dst)[(*dlen)++] = *s;
-				immune++;
-				break;
 			}
-			*dlen += sprintf(*dst + *dlen, "&lt;");
-			break;
-		case '>':
-			*dlen += sprintf(*dst + *dlen, "&gt;");
-			break;
-		case '"':
-			*dlen += sprintf(*dst + *dlen, (a) ? "&quot;" : "\"");
-			break;
-		case '\n':
-			*dlen += sprintf(*dst + *dlen, (a) ? "&#xA;" : "\n");
-			break;
-		case '\t':
-			*dlen += sprintf(*dst + *dlen, (a) ? "&#x9;" : "\t");
-			break;
-		case '\r':
-			*dlen += sprintf(*dst + *dlen, "&#xD;");
-			break;
-		default:
-			(*dst)[(*dlen)++] = *s;
-		}
 		s++;
 	}
 	return *dst;
@@ -2050,24 +2123,25 @@
 /* Recursively converts each tag to xml appending it to *s. Reallocates *s if
    its length exceeds max. start is the location of the previous tag in the
    parent tag's character content. Returns *s. */
-static char *switch_xml_toxml_r(switch_xml_t xml, char **s, switch_size_t *len, switch_size_t *max, switch_size_t start, char ***attr, uint32_t * count)
+static char *switch_xml_toxml_r(switch_xml_t xml, char **s, switch_size_t *len, switch_size_t *max, switch_size_t start, char ***attr, uint32_t *count)
 {
 	int i, j;
 	char *txt;
 	switch_size_t off;
 	uint32_t lcount;
 
-tailrecurse:
+  tailrecurse:
 	off = 0;
 	lcount = 0;
-	txt = (char *)(xml->parent) ? xml->parent->txt : (char *)"";
+	txt = (char *) (xml->parent) ? xml->parent->txt : (char *) "";
 
 	/* parent character content up to this tag */
 	*s = switch_xml_ampencode(txt + start, xml->off - start, s, len, max, 0);
 
 	while (*len + strlen(xml->name) + 5 + (strlen(XML_INDENT) * (*count)) + 1 > *max) {	/* reallocate s */
-		char *tmp = (char *)realloc(*s, *max += SWITCH_XML_BUFSIZE);
-		if (!tmp) return *s;
+		char *tmp = (char *) realloc(*s, *max += SWITCH_XML_BUFSIZE);
+		if (!tmp)
+			return *s;
 		*s = tmp;
 	}
 
@@ -2083,8 +2157,9 @@
 		if (switch_xml_attr(xml, xml->attr[i]) != xml->attr[i + 1])
 			continue;
 		while (*len + strlen(xml->attr[i]) + 7 + (strlen(XML_INDENT) * (*count)) > *max) {	/* reallocate s */
-			char *tmp = (char *)realloc(*s, *max += SWITCH_XML_BUFSIZE);
-			if (!tmp) return *s;
+			char *tmp = (char *) realloc(*s, *max += SWITCH_XML_BUFSIZE);
+			if (!tmp)
+				return *s;
 			*s = tmp;
 		}
 
@@ -2098,8 +2173,9 @@
 		if (!attr[i][j + 1] || switch_xml_attr(xml, attr[i][j]) != attr[i][j + 1])
 			continue;			/* skip duplicates and non-values */
 		while (*len + strlen(attr[i][j]) + 8 + (strlen(XML_INDENT) * (*count)) > *max) {	/* reallocate s */
-			char *tmp = (char *)realloc(*s, *max += SWITCH_XML_BUFSIZE);
-			if (!tmp) return *s;
+			char *tmp = (char *) realloc(*s, *max += SWITCH_XML_BUFSIZE);
+			if (!tmp)
+				return *s;
 			*s = tmp;
 		}
 
@@ -2119,10 +2195,11 @@
 	}
 
 	while (*len + strlen(xml->name) + 5 + (strlen(XML_INDENT) * (*count)) > *max) {	/* reallocate s */
-			char *tmp = (char *)realloc(*s, *max += SWITCH_XML_BUFSIZE);
-			if (!tmp) return *s;
-			*s = tmp;
-		}
+		char *tmp = (char *) realloc(*s, *max += SWITCH_XML_BUFSIZE);
+		if (!tmp)
+			return *s;
+		*s = tmp;
+	}
 
 	if (xml->child || xml->txt) {
 		if (*(*s + (*len) - 1) == '\n') {
@@ -2154,7 +2231,7 @@
 {
 	char *r, *s;
 	switch_mutex_lock(XML_GEN_LOCK);
-	s = (char *)malloc(SWITCH_XML_BUFSIZE);
+	s = (char *) malloc(SWITCH_XML_BUFSIZE);
 	switch_assert(s);
 	r = switch_xml_toxml_buf(xml, s, SWITCH_XML_BUFSIZE, 0, prn_header);
 	switch_mutex_unlock(XML_GEN_LOCK);
@@ -2171,7 +2248,7 @@
 	char *s, *t, *n, *r;
 	int i, j, k;
 	uint32_t count = 0;
-	
+
 	s = buf;
 	assert(s != NULL);
 	memset(s, 0, max);
@@ -2179,9 +2256,9 @@
 	if (prn_header) {
 		len += sprintf(s + len, "<?xml version=\"1.0\"?>\n");
 	}
-	
+
 	if (!xml || !xml->name) {
-		if (!(r = (char *)realloc(s, len + 1))) {
+		if (!(r = (char *) realloc(s, len + 1))) {
 			abort();
 		}
 		return r;
@@ -2198,7 +2275,7 @@
 				continue;		/* not pre-root */
 			}
 			while (len + strlen(t = root->pi[i][0]) + strlen(n) + 7 > max) {
-				if (!(r = (char *)realloc(s, max += SWITCH_XML_BUFSIZE))) {
+				if (!(r = (char *) realloc(s, max += SWITCH_XML_BUFSIZE))) {
 					abort();
 				}
 				s = r;
@@ -2219,7 +2296,7 @@
 				continue;		/* not post-root */
 			}
 			while (len + strlen(t = root->pi[i][0]) + strlen(n) + 7 > max) {
-				if (!(r = (char *)realloc(s, max += SWITCH_XML_BUFSIZE))) {
+				if (!(r = (char *) realloc(s, max += SWITCH_XML_BUFSIZE))) {
 					abort();
 				}
 				s = r;
@@ -2228,7 +2305,7 @@
 		}
 	}
 
-	if (!(r = (char *)realloc(s, len + 1))) {
+	if (!(r = (char *) realloc(s, len + 1))) {
 		abort();
 	}
 
@@ -2243,8 +2320,8 @@
 	char **a, *s;
 	switch_xml_t orig_xml;
 
-tailrecurse:
- 	root = (switch_xml_root_t) xml;
+  tailrecurse:
+	root = (switch_xml_root_t) xml;
 	if (!xml) {
 		return;
 	}
@@ -2264,11 +2341,11 @@
 	}
 
 	switch_xml_free(xml->child);
-	/*switch_xml_free(xml->ordered);*/
+	/*switch_xml_free(xml->ordered); */
 
 	if (!xml->parent) {			/* free root tag allocations */
 #if (_MSC_VER >= 1400)			// VC8+
-		__analysis_assume(sizeof(root->ent) > 44); /* tail recursion confuses code analysis */
+		__analysis_assume(sizeof(root->ent) > 44);	/* tail recursion confuses code analysis */
 #endif
 		for (i = 10; root->ent[i]; i += 2)	/* 0 - 9 are default entities (<>&"') */
 			if ((s = root->ent[i + 1]) < root->s || s > root->e)
@@ -2331,13 +2408,15 @@
 		"apos;", "&#39;", "amp;", "&#38;", NULL
 	};
 	switch_xml_root_t root = (switch_xml_root_t) malloc(sizeof(struct switch_xml_root));
-	if (!root) return NULL;
+	if (!root)
+		return NULL;
 	memset(root, '\0', sizeof(struct switch_xml_root));
 	root->xml.name = (char *) name;
 	root->cur = &root->xml;
-	strcpy(root->err, root->xml.txt = (char *)"");
-	root->ent = (char **)memcpy(malloc(sizeof(ent)), ent, sizeof(ent));
+	strcpy(root->err, root->xml.txt = (char *) "");
+	root->ent = (char **) memcpy(malloc(sizeof(ent)), ent, sizeof(ent));
 	root->attr = root->pi = (char ***) (root->xml.attr = SWITCH_XML_NIL);
+	root->xml.is_switch_xml_root_t = SWITCH_TRUE;
 	return &root->xml;
 }
 
@@ -2387,14 +2466,16 @@
 {
 	switch_xml_t child;
 
-	if (!xml) return NULL;
-	if (!(child = (switch_xml_t) malloc(sizeof(struct switch_xml)))) return NULL;
+	if (!xml)
+		return NULL;
+	if (!(child = (switch_xml_t) malloc(sizeof(struct switch_xml))))
+		return NULL;
 	memset(child, '\0', sizeof(struct switch_xml));
 	child->name = (char *) name;
 	child->attr = SWITCH_XML_NIL;
 	child->off = off;
 	child->parent = xml;
-	child->txt = (char *)"";
+	child->txt = (char *) "";
 
 	return switch_xml_insert(child, xml, off);
 }
@@ -2425,18 +2506,20 @@
 		if (!value)
 			return xml;			/* nothing to do */
 		if (xml->attr == SWITCH_XML_NIL) {	/* first attribute */
-			xml->attr = (char **)malloc(4 * sizeof(char *));
-			if (!xml->attr) return NULL;
+			xml->attr = (char **) malloc(4 * sizeof(char *));
+			if (!xml->attr)
+				return NULL;
 			xml->attr[1] = strdup("");	/* empty list of malloced names/vals */
 		} else {
-			char **tmp = (char **)realloc(xml->attr, (l + 4) * sizeof(char *));
-			if (!tmp) return xml;
+			char **tmp = (char **) realloc(xml->attr, (l + 4) * sizeof(char *));
+			if (!tmp)
+				return xml;
 			xml->attr = tmp;
 		}
 
 		xml->attr[l] = (char *) name;	/* set attribute name */
 		xml->attr[l + 2] = NULL;	/* null terminate attribute list */
-		xml->attr[l + 3] = (char *)realloc(xml->attr[l + 1], (c = (int) strlen(xml->attr[l + 1])) + 2);
+		xml->attr[l + 3] = (char *) realloc(xml->attr[l + 1], (c = (int) strlen(xml->attr[l + 1])) + 2);
 		strcpy(xml->attr[l + 3] + c, " ");	/* set name/value as not malloced */
 		if (xml->flags & SWITCH_XML_DUP)
 			xml->attr[l + 3][c] = SWITCH_XML_NAMEM;
@@ -2458,8 +2541,9 @@
 		if (xml->attr[c + 1][l / 2] & SWITCH_XML_NAMEM)
 			free(xml->attr[l]);
 		memmove(xml->attr + l, xml->attr + l + 2, (c - l + 2) * sizeof(char *));
-		tmp =(char **)realloc(xml->attr, (c + 2) * sizeof(char *));
-		if (!tmp) return xml;
+		tmp = (char **) realloc(xml->attr, (c + 2) * sizeof(char *));
+		if (!tmp)
+			return xml;
 		xml->attr = tmp;
 		memmove(xml->attr[c + 1] + (l / 2), xml->attr[c + 1] + (l / 2) + 1, (c / 2) - (l / 2));	/* fix list of which name/vals are malloced */
 	}
@@ -2590,24 +2674,24 @@
 #define MAXPATHLEN 256
 #endif
 
-static int	 compare(const void *, const void *);
-static int	 glob0(const char *, glob_t *, size_t *);
-static int	 glob1(char *, glob_t *, size_t *);
-static int	 glob2(char *, char *, char *, char *, glob_t *, size_t *);
-static int	 glob3(char *, char *, char *, char *, char *, glob_t *, size_t *);
-static int	 globextend(const char *, glob_t *, size_t *);
-static int	 match(char *, char *, char *);
+static int compare(const void *, const void *);
+static int glob0(const char *, glob_t *, size_t *);
+static int glob1(char *, glob_t *, size_t *);
+static int glob2(char *, char *, char *, char *, glob_t *, size_t *);
+static int glob3(char *, char *, char *, char *, char *, glob_t *, size_t *);
+static int globextend(const char *, glob_t *, size_t *);
+static int match(char *, char *, char *);
 
 #pragma warning(push)
 #pragma warning(disable:4310)
 
-int glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *pglob)
+int glob(const char *pattern, int flags, int (*errfunc) (const char *, int), glob_t *pglob)
 {
 	const unsigned char *patnext;
 	size_t limit;
 	char c;
 	char *bufnext, *bufend, patbuf[MAXPATHLEN];
-	
+
 	patnext = (unsigned char *) pattern;
 	if (!(flags & GLOB_APPEND)) {
 		pglob->gl_pathc = 0;
@@ -2624,13 +2708,13 @@
 	pglob->gl_flags = flags & ~GLOB_MAGCHAR;
 	pglob->gl_errfunc = errfunc;
 	pglob->gl_matchc = 0;
-	
+
 	bufnext = patbuf;
 	bufend = bufnext + MAXPATHLEN - 1;
 	while (bufnext < bufend && (c = *patnext++) != EOS)
 		*bufnext++ = c;
 	*bufnext = EOS;
-	
+
 	return glob0(patbuf, pglob, &limit);
 }
 
@@ -2646,66 +2730,64 @@
 	int c, err;
 	size_t oldpathc;
 	char *bufnext, patbuf[MAXPATHLEN];
-	
+
 	qpatnext = pattern;
 	oldpathc = pglob->gl_pathc;
 	bufnext = patbuf;
-	
+
 	/* We don't need to check for buffer overflow any more. */
 	while ((c = *qpatnext++) != EOS) {
 		switch (c) {
-			case SEP:
-				*bufnext++ = WIN_SEP;
-				break;
-			case LBRACKET:
-				c = *qpatnext;
+		case SEP:
+			*bufnext++ = WIN_SEP;
+			break;
+		case LBRACKET:
+			c = *qpatnext;
+			if (c == NOT)
+				++qpatnext;
+			if (*qpatnext == EOS || strchr((char *) qpatnext + 1, RBRACKET) == NULL) {
+				*bufnext++ = LBRACKET;
 				if (c == NOT)
-					++qpatnext;
-				if (*qpatnext == EOS ||
-					strchr((char *) qpatnext+1, RBRACKET) == NULL) {
-					*bufnext++ = LBRACKET;
-					if (c == NOT)
-						--qpatnext;
-					break;
-				}
-				*bufnext++ = M_SET;
-				if (c == NOT)
-					*bufnext++ = M_NOT;
-				c = *qpatnext++;
-				do {
-					*bufnext++ = CHAR(c);
-					if (*qpatnext == RANGE &&
-						(c = qpatnext[1]) != RBRACKET) {
-						*bufnext++ = M_RNG;
-						*bufnext++ = CHAR(c);
-						qpatnext += 2;
-					}
-				} while ((c = *qpatnext++) != RBRACKET);
-				pglob->gl_flags |= GLOB_MAGCHAR;
-				*bufnext++ = M_END;
+					--qpatnext;
 				break;
-			case QUESTION:
-				pglob->gl_flags |= GLOB_MAGCHAR;
-				*bufnext++ = M_ONE;
-				break;
-			case STAR:
-				pglob->gl_flags |= GLOB_MAGCHAR;
-				/* collapse adjacent stars to one,
-				 * to avoid exponential behavior
-				 */
-				if (bufnext == patbuf || bufnext[-1] != M_ALL)
-					*bufnext++ = M_ALL;
-				break;
-			default:
+			}
+			*bufnext++ = M_SET;
+			if (c == NOT)
+				*bufnext++ = M_NOT;
+			c = *qpatnext++;
+			do {
 				*bufnext++ = CHAR(c);
-				break;
+				if (*qpatnext == RANGE && (c = qpatnext[1]) != RBRACKET) {
+					*bufnext++ = M_RNG;
+					*bufnext++ = CHAR(c);
+					qpatnext += 2;
+				}
+			} while ((c = *qpatnext++) != RBRACKET);
+			pglob->gl_flags |= GLOB_MAGCHAR;
+			*bufnext++ = M_END;
+			break;
+		case QUESTION:
+			pglob->gl_flags |= GLOB_MAGCHAR;
+			*bufnext++ = M_ONE;
+			break;
+		case STAR:
+			pglob->gl_flags |= GLOB_MAGCHAR;
+			/* collapse adjacent stars to one,
+			 * to avoid exponential behavior
+			 */
+			if (bufnext == patbuf || bufnext[-1] != M_ALL)
+				*bufnext++ = M_ALL;
+			break;
+		default:
+			*bufnext++ = CHAR(c);
+			break;
 		}
 	}
 	*bufnext = EOS;
-	
+
 	if ((err = glob1(patbuf, pglob, limit)) != 0)
-		return(err);
-	
+		return (err);
+
 	/*
 	 * If there was no match we are going to append the pattern
 	 * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified
@@ -2713,33 +2795,29 @@
 	 * GLOB_NOMAGIC is there just for compatibility with csh.
 	 */
 	if (pglob->gl_pathc == oldpathc) {
-		if (((pglob->gl_flags & GLOB_NOCHECK) ||
-			 ((pglob->gl_flags & GLOB_NOMAGIC) &&
-			  !(pglob->gl_flags & GLOB_MAGCHAR))))
-			return(globextend(pattern, pglob, limit));
+		if (((pglob->gl_flags & GLOB_NOCHECK) || ((pglob->gl_flags & GLOB_NOMAGIC) && !(pglob->gl_flags & GLOB_MAGCHAR))))
+			return (globextend(pattern, pglob, limit));
 		else
-			return(GLOB_NOMATCH);
+			return (GLOB_NOMATCH);
 	}
 	if (!(pglob->gl_flags & GLOB_NOSORT))
-		qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc,
-			  pglob->gl_pathc - oldpathc, sizeof(char *), compare);
-	return(0);
+		qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc, pglob->gl_pathc - oldpathc, sizeof(char *), compare);
+	return (0);
 }
 
 static int compare(const void *p, const void *q)
 {
-	return(strcmp(*(char **)p, *(char **)q));
+	return (strcmp(*(char **) p, *(char **) q));
 }
 
 static int glob1(char *pattern, glob_t *pglob, size_t *limit)
 {
 	char pathbuf[MAXPATHLEN];
-	
+
 	/* A null pathname is invalid -- POSIX 1003.1 sect. 2.4. */
 	if (*pattern == EOS)
-		return(0);
-	return(glob2(pathbuf, pathbuf, pathbuf + MAXPATHLEN - 1,
-				 pattern, pglob, limit));
+		return (0);
+	return (glob2(pathbuf, pathbuf, pathbuf + MAXPATHLEN - 1, pattern, pglob, limit));
 }
 
 /*
@@ -2752,27 +2830,27 @@
 	struct stat sb;
 	char *p, *q;
 	int anymeta;
-	
+
 	/*
 	 * Loop over pattern segments until end of pattern or until
 	 * segment with meta character found.
 	 */
 	for (anymeta = 0;;) {
-		if (*pattern == EOS) {		/* End of pattern? */
+		if (*pattern == EOS) {	/* End of pattern? */
 			*pathend = EOS;
 			if (stat(pathbuf, &sb))
-				return(0);
-			
-			if (((pglob->gl_flags & GLOB_MARK) && pathend[-1] != SEP && pathend[-1] != WIN_SEP) && (_S_IFDIR & sb.st_mode) ) {
+				return (0);
+
+			if (((pglob->gl_flags & GLOB_MARK) && pathend[-1] != SEP && pathend[-1] != WIN_SEP) && (_S_IFDIR & sb.st_mode)) {
 				if (pathend + 1 > pathend_last)
 					return (GLOB_ABORTED);
 				*pathend++ = WIN_SEP;
 				*pathend = EOS;
 			}
 			++pglob->gl_matchc;
-			return(globextend(pathbuf, pglob, limit));
+			return (globextend(pathbuf, pglob, limit));
 		}
-		
+
 		/* Find end of next segment, copy tentatively to pathend. */
 		q = pathend;
 		p = pattern;
@@ -2783,8 +2861,8 @@
 				return (GLOB_ABORTED);
 			*q++ = *p++;
 		}
-		
-		if (!anymeta) {		/* No expansion, do next segment. */
+
+		if (!anymeta) {			/* No expansion, do next segment. */
 			pathend = q;
 			pattern = p;
 			while (*pattern == SEP || *pattern == WIN_SEP) {
@@ -2792,9 +2870,8 @@
 					return (GLOB_ABORTED);
 				*pathend++ = *pattern++;
 			}
-		} else			/* Need expansion, recurse. */
-			return(glob3(pathbuf, pathend, pathend_last, pattern, p,
-						 pglob, limit));
+		} else					/* Need expansion, recurse. */
+			return (glob3(pathbuf, pathend, pathend_last, pattern, p, pglob, limit));
 	}
 	/* NOTREACHED */
 }
@@ -2802,63 +2879,60 @@
 static int glob3(char *pathbuf, char *pathend, char *pathend_last, char *pattern, char *restpattern, glob_t *pglob, size_t *limit)
 {
 	int err;
-	apr_dir_t * dirp;
-	apr_pool_t * pool;
-	
+	apr_dir_t *dirp;
+	apr_pool_t *pool;
+
 	apr_pool_create(&pool, NULL);
-	
+
 	if (pathend > pathend_last)
 		return (GLOB_ABORTED);
 	*pathend = EOS;
 	errno = 0;
-	
-	if (apr_dir_open (&dirp, pathbuf, pool) != APR_SUCCESS) {
+
+	if (apr_dir_open(&dirp, pathbuf, pool) != APR_SUCCESS) {
 		/* TODO: don't call for ENOENT or ENOTDIR? */
 		apr_pool_destroy(pool);
 		if (pglob->gl_errfunc) {
-			if (pglob->gl_errfunc(pathbuf, errno) ||
-			    pglob->gl_flags & GLOB_ERR)
+			if (pglob->gl_errfunc(pathbuf, errno) || pglob->gl_flags & GLOB_ERR)
 				return (GLOB_ABORTED);
 		}
-		return(0);
+		return (0);
 	}
-	
+
 	err = 0;
-	
+
 	/* Search directory for matching names. */
-	while (dirp)
-	{
+	while (dirp) {
 		apr_finfo_t dp;
 		unsigned char *sc;
 		char *dc;
-		
+
 		if (apr_dir_read(&dp, APR_FINFO_NAME, dirp) != APR_SUCCESS)
 			break;
 		if (!(dp.valid & APR_FINFO_NAME) || !(dp.name) || !strlen(dp.name))
 			break;
-		
+
 		/* Initial DOT must be matched literally. */
 		if (dp.name[0] == DOT && *pattern != DOT)
 			continue;
 		dc = pathend;
 		sc = (unsigned char *) dp.name;
-		
+
 		while (dc < pathend_last && (*dc++ = *sc++) != EOS);
-		
+
 		if (!match(pathend, pattern, restpattern)) {
 			*pathend = EOS;
 			continue;
 		}
-		err = glob2(pathbuf, --dc, pathend_last, restpattern,
-					pglob, limit);
+		err = glob2(pathbuf, --dc, pathend_last, restpattern, pglob, limit);
 		if (err)
 			break;
 	}
-	
-	if (dirp) 
-		apr_dir_close (dirp);
+
+	if (dirp)
+		apr_dir_close(dirp);
 	apr_pool_destroy(pool);
-	return(err);
+	return (err);
 }
 
 
@@ -2879,45 +2953,43 @@
 static int globextend(const char *path, glob_t *pglob, size_t *limit)
 {
 	char **pathv;
-	char * copy;
+	char *copy;
 	size_t i;
 	size_t newsize, len;
 	const char *p;
-	
+
 	if (*limit && pglob->gl_pathc > *limit) {
 		errno = 0;
 		return (GLOB_NOSPACE);
 	}
-	
+
 	newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs);
-	pathv = pglob->gl_pathv ?
-	realloc((char *)pglob->gl_pathv, newsize) :
-	malloc(newsize);
+	pathv = pglob->gl_pathv ? realloc((char *) pglob->gl_pathv, newsize) : malloc(newsize);
 	if (pathv == NULL) {
 		if (pglob->gl_pathv) {
 			free(pglob->gl_pathv);
 			pglob->gl_pathv = NULL;
 		}
-		return(GLOB_NOSPACE);
+		return (GLOB_NOSPACE);
 	}
-	
+
 	if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
 		/* first time around -- clear initial gl_offs items */
 		pathv += pglob->gl_offs;
-		for (i = pglob->gl_offs; i-- > 0; )
+		for (i = pglob->gl_offs; i-- > 0;)
 			*--pathv = NULL;
 	}
 	pglob->gl_pathv = pathv;
-	
+
 	for (p = path; *p++;)
 		continue;
-	len = (size_t)(p - path);
+	len = (size_t) (p - path);
 	if ((copy = malloc(len)) != NULL) {
 		memcpy(copy, path, len);
 		pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
 	}
 	pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
-	return(copy == NULL ? GLOB_NOSPACE : 0);
+	return (copy == NULL ? GLOB_NOSPACE : 0);
 }
 
 /*
@@ -2929,49 +3001,49 @@
 	int ok, negate_range;
 	char c, k;
 	char s1[6];
-	
+
 	while (pat < patend) {
 		c = *pat++;
 		switch (c & M_MASK) {
-			case M_ALL:
-				if (pat == patend)
-					return(1);
-				do
-					if (match(name, pat, patend))
-						return(1);
-				while (*name++ != EOS);
-				return(0);
-			case M_ONE:
-				if (*name++ == EOS)
-					return(0);
-				break;
-			case M_SET:
-				ok = 0;
-				if ((k = *name++) == EOS)
-					return(0);
-				if ((negate_range = ((*pat & M_MASK) == M_NOT)) != EOS)
-					++pat;
-				while (((c = *pat++) & M_MASK) != M_END)
-					if ((*pat & M_MASK) == M_RNG) {
-						memset(s1, 0, sizeof(s1));
-						s1[0] = c;
-						s1[2] = k;
-						s1[4] = pat[1];
-						if (strcoll(&s1[0], &s1[2]) <= 0 && strcoll(&s1[2], &s1[4]) <= 0)
-							ok = 1;
-						pat += 2;
-					} else if (c == k)
+		case M_ALL:
+			if (pat == patend)
+				return (1);
+			do
+				if (match(name, pat, patend))
+					return (1);
+			while (*name++ != EOS);
+			return (0);
+		case M_ONE:
+			if (*name++ == EOS)
+				return (0);
+			break;
+		case M_SET:
+			ok = 0;
+			if ((k = *name++) == EOS)
+				return (0);
+			if ((negate_range = ((*pat & M_MASK) == M_NOT)) != EOS)
+				++pat;
+			while (((c = *pat++) & M_MASK) != M_END)
+				if ((*pat & M_MASK) == M_RNG) {
+					memset(s1, 0, sizeof(s1));
+					s1[0] = c;
+					s1[2] = k;
+					s1[4] = pat[1];
+					if (strcoll(&s1[0], &s1[2]) <= 0 && strcoll(&s1[2], &s1[4]) <= 0)
 						ok = 1;
-				if (ok == negate_range)
-					return(0);
-				break;
-			default:
-				if (*name++ != c)
-					return(0);
-				break;
+					pat += 2;
+				} else if (c == k)
+					ok = 1;
+			if (ok == negate_range)
+				return (0);
+			break;
+		default:
+			if (*name++ != c)
+				return (0);
+			break;
 		}
 	}
-	return(*name == EOS);
+	return (*name == EOS);
 }
 
 /* Free allocated data belonging to a glob_t structure. */
@@ -2979,7 +3051,7 @@
 {
 	size_t i;
 	char **pp;
-	
+
 	if (pglob->gl_pathv != NULL) {
 		pp = pglob->gl_pathv + pglob->gl_offs;
 		for (i = pglob->gl_pathc; i--; ++pp)
@@ -2989,6 +3061,7 @@
 		pglob->gl_pathv = NULL;
 	}
 }
+
 #pragma warning(pop)
 #endif
 

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_xml_config.c (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_xml_config.c	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/src/switch_xml_config.c	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,6 +1,6 @@
 /* 
  * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2005-2009, Anthony Minessale II <anthm@freeswitch.org>
+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
  *
  * Version: MPL 1.1
  *
@@ -35,21 +35,21 @@
 SWITCH_DECLARE_DATA switch_xml_config_string_options_t switch_config_string_strdup = { NULL, 0, NULL };
 
 static switch_xml_config_enum_item_t switch_config_types_enum[] = {
-	{"int", 	SWITCH_CONFIG_INT		},
-	{"string", 	SWITCH_CONFIG_STRING	},
-	{"bool", 	SWITCH_CONFIG_BOOL		},
-	{"custom", 	SWITCH_CONFIG_CUSTOM	},
-	{"enum", 	SWITCH_CONFIG_ENUM		},
-	{"flag", 	SWITCH_CONFIG_FLAG		},
-	{"flagarray",SWITCH_CONFIG_FLAGARRAY},
-	{ NULL, 0 }
+	{"int", SWITCH_CONFIG_INT},
+	{"string", SWITCH_CONFIG_STRING},
+	{"bool", SWITCH_CONFIG_BOOL},
+	{"custom", SWITCH_CONFIG_CUSTOM},
+	{"enum", SWITCH_CONFIG_ENUM},
+	{"flag", SWITCH_CONFIG_FLAG},
+	{"flagarray", SWITCH_CONFIG_FLAGARRAY},
+	{NULL, 0}
 };
 
 SWITCH_DECLARE(switch_size_t) switch_event_import_xml(switch_xml_t xml, const char *keyname, const char *valuename, switch_event_t **event)
 {
 	switch_xml_t node;
 	switch_size_t count = 0;
-	
+
 	if (!*event) {
 		/* SWITCH_EVENT_CLONE will not insert any generic event headers */
 		switch_event_create(event, SWITCH_EVENT_CLONE);
@@ -64,7 +64,7 @@
 			count++;
 		}
 	}
-	
+
 	return count;
 }
 
@@ -72,7 +72,7 @@
 {
 	switch_xml_t cfg, xml, settings;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
-	
+
 	if (!(xml = switch_xml_open_cfg(file, &cfg, NULL))) {
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Could not open %s\n", file);
 		return SWITCH_STATUS_FALSE;
@@ -81,9 +81,9 @@
 	if ((settings = switch_xml_child(cfg, "settings"))) {
 		status = switch_xml_config_parse(switch_xml_child(settings, "param"), reload, instructions);
 	}
-	
+
 	switch_xml_free(xml);
-	
+
 	return status;
 }
 
@@ -91,8 +91,8 @@
 {
 	if (item->syntax && item->helptext) {
 		switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, level, "Item name: [%s]\nType: %s (%s)\nSyntax: %s\nHelp: %s\n\n",
-		 	item->key, switch_xml_config_enum_int2str(switch_config_types_enum, item->type), 
-			switch_test_flag(item, CONFIG_REQUIRED) ? "required" : "optional", item->syntax, item->helptext);
+						  item->key, switch_xml_config_enum_int2str(switch_config_types_enum, item->type),
+						  switch_test_flag(item, CONFIG_REQUIRED) ? "required" : "optional", item->syntax, item->helptext);
 	}
 }
 
@@ -101,31 +101,31 @@
 	switch_event_t *event = NULL;
 	switch_status_t result;
 	int count = switch_event_import_xml(xml, "name", "value", &event);
-	
+
 	result = switch_xml_config_parse_event(event, count, reload, instructions);
-	
+
 	if (event) {
 		switch_event_destroy(&event);
 	}
-	
+
 	return result;
 }
 
 SWITCH_DECLARE(switch_status_t) switch_xml_config_enum_str2int(switch_xml_config_enum_item_t *enum_options, const char *value, int *out)
 {
-	for (;enum_options->key; enum_options++) {
+	for (; enum_options->key; enum_options++) {
 		if (!strcasecmp(value, enum_options->key)) {
 			*out = enum_options->value;
 			return SWITCH_STATUS_SUCCESS;
 		}
 	}
-	
+
 	return SWITCH_STATUS_FALSE;
 }
 
-SWITCH_DECLARE(const char*) switch_xml_config_enum_int2str(switch_xml_config_enum_item_t *enum_options, int value)
+SWITCH_DECLARE(const char *) switch_xml_config_enum_int2str(switch_xml_config_enum_item_t *enum_options, int value)
 {
-	for (;enum_options->key; enum_options++) {
+	for (; enum_options->key; enum_options++) {
 		if (value == enum_options->value) {
 			return enum_options->key;
 		}
@@ -133,241 +133,245 @@
 	return NULL;
 }
 
-SWITCH_DECLARE(switch_status_t) switch_xml_config_parse_event(switch_event_t *event, int count, switch_bool_t reload, switch_xml_config_item_t *instructions)
+SWITCH_DECLARE(switch_status_t) switch_xml_config_parse_event(switch_event_t *event, int count, switch_bool_t reload,
+															  switch_xml_config_item_t *instructions)
 {
 	switch_xml_config_item_t *item;
 	int matched_count = 0;
-	
+
 	for (item = instructions; item->key; item++) {
 		const char *value = switch_event_get_header(event, item->key);
 		switch_bool_t changed = SWITCH_FALSE;
-		switch_xml_config_callback_t callback = (switch_xml_config_callback_t)item->function;
+		switch_xml_config_callback_t callback = (switch_xml_config_callback_t) item->function;
 		void *ptr = item->ptr;
-		
+
 		//switch_assert(ptr);
-		
+
 		if (value) {
 			matched_count++;
 		}
-		
+
 		if (reload && !switch_test_flag(item, CONFIG_RELOADABLE)) {
 			continue;
 		}
-		
+
 		if (!value && switch_test_flag(item, CONFIG_REQUIRED)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Required parameter [%s] is missing\n", item->key);
 			return SWITCH_STATUS_FALSE;
 		}
-		
-		switch(item->type) {
-			case SWITCH_CONFIG_INT:
-				{
-					switch_xml_config_int_options_t *int_options = (switch_xml_config_int_options_t*)item->data;
-					int *dest = (int*)ptr;
-					int intval;
-					if (value) {
-						if (switch_is_number(value)) {
-							intval = atoi(value);
-						} else {
-							intval = (int)(intptr_t)item->defaultvalue;
-							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s] for parameter [%s], setting default [%d]\n", 
-								value, item->key, intval);
-						}
-						
-						if (int_options) {
-							/* Enforce validation options */
-							if ((int_options->enforce_min && !(intval > int_options->min)) ||
-								(int_options->enforce_max && !(intval < int_options->max))) {
-									/* Validation failed, set default */
-									intval = (int)(intptr_t)item->defaultvalue;
-									/* Then complain */
-									if (int_options->enforce_min && int_options->enforce_max) {
-										switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s] for parameter [%s], should be between [%d] and [%d], setting default [%d]\n", 
-											value, item->key, int_options->min, int_options->max, intval);
- 									} else {
-										switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s] for parameter [%s], should be %s [%d], setting default [%d]\n", 
-											value, item->key, int_options->enforce_min ? "at least" : "at max", int_options->enforce_min ? int_options->min : int_options->max, intval);
-									}
-								}
-						}
+
+		switch (item->type) {
+		case SWITCH_CONFIG_INT:
+			{
+				switch_xml_config_int_options_t *int_options = (switch_xml_config_int_options_t *) item->data;
+				int *dest = (int *) ptr;
+				int intval;
+				if (value) {
+					if (switch_is_number(value)) {
+						intval = atoi(value);
 					} else {
-						intval = (int)(intptr_t)item->defaultvalue;
+						intval = (int) (intptr_t) item->defaultvalue;
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s] for parameter [%s], setting default [%d]\n",
+										  value, item->key, intval);
 					}
-					
-					if (*dest != intval) {
-						*dest = intval;
-						changed = SWITCH_TRUE;
-					}
-				}
-				break;
-			case SWITCH_CONFIG_STRING:
-				{
-					switch_xml_config_string_options_t string_options_default = { 0 };
-					switch_xml_config_string_options_t *string_options = item->data ? (switch_xml_config_string_options_t*)item->data : &string_options_default;
-					const char *newstring = NULL;
-					
-					/* Perform validation */
-					if (value) {
-						if (!zstr(string_options->validation_regex)) {
-							if (switch_regex_match(value, string_options->validation_regex) == SWITCH_STATUS_SUCCESS) {
-								newstring = value; /* Regex match, accept value*/
+
+					if (int_options) {
+						/* Enforce validation options */
+						if ((int_options->enforce_min && !(intval > int_options->min)) || (int_options->enforce_max && !(intval < int_options->max))) {
+							/* Validation failed, set default */
+							intval = (int) (intptr_t) item->defaultvalue;
+							/* Then complain */
+							if (int_options->enforce_min && int_options->enforce_max) {
+								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+												  "Invalid value [%s] for parameter [%s], should be between [%d] and [%d], setting default [%d]\n", value,
+												  item->key, int_options->min, int_options->max, intval);
 							} else {
-								newstring = (char*)item->defaultvalue;  /* Regex failed */
-								if (newstring) {
-									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s] for parameter [%s], setting default [%s]\n", 
-										value, item->key, newstring);
-								} else {
-									switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s] for parameter [%s]\n", value, item->key);
-								}
-								switch_xml_config_item_print_doc(SWITCH_LOG_ERROR, item);
+								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
+												  "Invalid value [%s] for parameter [%s], should be %s [%d], setting default [%d]\n", value, item->key,
+												  int_options->enforce_min ? "at least" : "at max",
+												  int_options->enforce_min ? int_options->min : int_options->max, intval);
 							}
-						} else {
-							newstring = value; /* No validation */
 						}
-					} else {
-						newstring = (char*)item->defaultvalue;
 					}
+				} else {
+					intval = (int) (intptr_t) item->defaultvalue;
+				}
 
-					if (string_options->length > 0) {
-						/* We have a preallocated buffer */
-						char *dest = (char*)ptr;
-						
-						if (newstring) {
-							if (strncasecmp(dest, newstring, string_options->length)) {
-								switch_copy_string(dest, newstring, string_options->length);
-								changed = SWITCH_TRUE;
-							}
+				if (*dest != intval) {
+					*dest = intval;
+					changed = SWITCH_TRUE;
+				}
+			}
+			break;
+		case SWITCH_CONFIG_STRING:
+			{
+				switch_xml_config_string_options_t string_options_default = { 0 };
+				switch_xml_config_string_options_t *string_options =
+					item->data ? (switch_xml_config_string_options_t *) item->data : &string_options_default;
+				const char *newstring = NULL;
+
+				/* Perform validation */
+				if (value) {
+					if (!zstr(string_options->validation_regex)) {
+						if (switch_regex_match(value, string_options->validation_regex) == SWITCH_STATUS_SUCCESS) {
+							newstring = value;	/* Regex match, accept value */
 						} else {
-							if (*dest != '\0') {
-								*dest = '\0';
-								changed = SWITCH_TRUE;
+							newstring = (char *) item->defaultvalue;	/* Regex failed */
+							if (newstring) {
+								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s] for parameter [%s], setting default [%s]\n",
+												  value, item->key, newstring);
+							} else {
+								switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s] for parameter [%s]\n", value, item->key);
 							}
+							switch_xml_config_item_print_doc(SWITCH_LOG_ERROR, item);
 						}
-					} else if (string_options->pool) {
-						/* Pool-allocated buffer */
-						char **dest = (char**)ptr;
-						
-						if (newstring) {
-							if (!*dest || strcmp(*dest, newstring)) {
-								*dest = switch_core_strdup(string_options->pool, newstring);
-							}
-						} else {
-							if (*dest) {
-								changed = SWITCH_TRUE;
-								*dest = NULL;
-							}
-						}
 					} else {
-						/* Dynamically allocated buffer */
-						char **dest = (char**)ptr;
-						
-						if (newstring) {
-							if (!*dest || strcmp(*dest, newstring)) {
-								switch_safe_free(*dest);
-								*dest = strdup(newstring);
-								changed = SWITCH_TRUE;						
-							}	
-						} else {
-							if (*dest) {
-								switch_safe_free(*dest);
-								changed = SWITCH_TRUE;
-							}
-						}
+						newstring = value;	/* No validation */
 					}
+				} else {
+					newstring = (char *) item->defaultvalue;
 				}
-				break;
-			case SWITCH_CONFIG_BOOL:
-				{
-					switch_bool_t *dest = (switch_bool_t*)ptr;
-					switch_bool_t newval = SWITCH_FALSE;
-					
-					if (value && switch_true(value)) {
-						newval = SWITCH_TRUE;
-					} else if (value && switch_false(value)) {
-						newval = SWITCH_FALSE;
-					} else if (value) {
-						/* Value isnt true or false */
-						newval = (switch_bool_t)(intptr_t)item->defaultvalue;
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s] for parameter [%s], setting default [%s]\n",  
-										value, item->key, newval ? "true" : "false");
-						switch_xml_config_item_print_doc(SWITCH_LOG_ERROR, item);
+
+				if (string_options->length > 0) {
+					/* We have a preallocated buffer */
+					char *dest = (char *) ptr;
+
+					if (newstring) {
+						if (strncasecmp(dest, newstring, string_options->length)) {
+							switch_copy_string(dest, newstring, string_options->length);
+							changed = SWITCH_TRUE;
+						}
 					} else {
-						newval = (switch_bool_t)(intptr_t)item->defaultvalue;
+						if (*dest != '\0') {
+							*dest = '\0';
+							changed = SWITCH_TRUE;
+						}
 					}
-					
-					if (*dest != newval) {
-						*dest = newval;
-						changed = SWITCH_TRUE;
-					}
-				}
-				break;
-			case SWITCH_CONFIG_CUSTOM: 
-				break;
-			case SWITCH_CONFIG_ENUM:
-				{
-					switch_xml_config_enum_item_t *enum_options = (switch_xml_config_enum_item_t*)item->data;
-					int *dest = (int*)ptr;
-					int newval = 0;
-					switch_status_t lookup_result = SWITCH_STATUS_SUCCESS;
-					
-					if (value) {
-						lookup_result = switch_xml_config_enum_str2int(enum_options, value, &newval);
+				} else if (string_options->pool) {
+					/* Pool-allocated buffer */
+					char **dest = (char **) ptr;
+
+					if (newstring) {
+						if (!*dest || strcmp(*dest, newstring)) {
+							*dest = switch_core_strdup(string_options->pool, newstring);
+						}
 					} else {
-						newval = (int)(intptr_t)item->defaultvalue; 
+						if (*dest) {
+							changed = SWITCH_TRUE;
+							*dest = NULL;
+						}
 					}
-					
-					if (lookup_result != SWITCH_STATUS_SUCCESS) {
-						newval = (int)(intptr_t)item->defaultvalue;
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s] for parameter [%s]\n",  value, item->key);
-						switch_xml_config_item_print_doc(SWITCH_LOG_ERROR, item);
-					}
-					
-					if (*dest != newval) {
-						changed = SWITCH_TRUE;
-						*dest = newval;
-					}
-				}
-				break;
-			case SWITCH_CONFIG_FLAG:
-				{
-					int32_t *dest = (int32_t*)ptr;
-					int index = (int)(intptr_t)item->data;
-					int8_t currentval = (int8_t)!!(*dest & index);
-					int8_t newval = 0;
-					
-					if (value) {
-						newval = switch_true(value);
+				} else {
+					/* Dynamically allocated buffer */
+					char **dest = (char **) ptr;
+
+					if (newstring) {
+						if (!*dest || strcmp(*dest, newstring)) {
+							switch_safe_free(*dest);
+							*dest = strdup(newstring);
+							changed = SWITCH_TRUE;
+						}
 					} else {
-						newval = (switch_bool_t)(intptr_t)item->defaultvalue;
-					}
-					
-					if (newval != currentval) {
-						changed = SWITCH_TRUE;
-						if (newval) {
-							*dest |= (1 << index);
-						} else {
-							*dest &= ~(1 << index);
+						if (*dest) {
+							switch_safe_free(*dest);
+							changed = SWITCH_TRUE;
 						}
 					}
 				}
-				break;
-			case SWITCH_CONFIG_FLAGARRAY:
-				{
-					int8_t *dest = (int8_t*)ptr;
-					unsigned int index = (unsigned int)(intptr_t)item->data;
-					int8_t newval = value ? !!switch_true(value) : (int8_t)((intptr_t)item->defaultvalue);
-					if (dest[index] != newval) {
-						changed = SWITCH_TRUE;
-						dest[index] = newval;
+			}
+			break;
+		case SWITCH_CONFIG_BOOL:
+			{
+				switch_bool_t *dest = (switch_bool_t *) ptr;
+				switch_bool_t newval = SWITCH_FALSE;
+
+				if (value && switch_true(value)) {
+					newval = SWITCH_TRUE;
+				} else if (value && switch_false(value)) {
+					newval = SWITCH_FALSE;
+				} else if (value) {
+					/* Value isnt true or false */
+					newval = (switch_bool_t) (intptr_t) item->defaultvalue;
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s] for parameter [%s], setting default [%s]\n",
+									  value, item->key, newval ? "true" : "false");
+					switch_xml_config_item_print_doc(SWITCH_LOG_ERROR, item);
+				} else {
+					newval = (switch_bool_t) (intptr_t) item->defaultvalue;
+				}
+
+				if (*dest != newval) {
+					*dest = newval;
+					changed = SWITCH_TRUE;
+				}
+			}
+			break;
+		case SWITCH_CONFIG_CUSTOM:
+			break;
+		case SWITCH_CONFIG_ENUM:
+			{
+				switch_xml_config_enum_item_t *enum_options = (switch_xml_config_enum_item_t *) item->data;
+				int *dest = (int *) ptr;
+				int newval = 0;
+				switch_status_t lookup_result = SWITCH_STATUS_SUCCESS;
+
+				if (value) {
+					lookup_result = switch_xml_config_enum_str2int(enum_options, value, &newval);
+				} else {
+					newval = (int) (intptr_t) item->defaultvalue;
+				}
+
+				if (lookup_result != SWITCH_STATUS_SUCCESS) {
+					newval = (int) (intptr_t) item->defaultvalue;
+					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid value [%s] for parameter [%s]\n", value, item->key);
+					switch_xml_config_item_print_doc(SWITCH_LOG_ERROR, item);
+				}
+
+				if (*dest != newval) {
+					changed = SWITCH_TRUE;
+					*dest = newval;
+				}
+			}
+			break;
+		case SWITCH_CONFIG_FLAG:
+			{
+				int32_t *dest = (int32_t *) ptr;
+				int index = (int) (intptr_t) item->data;
+				int8_t currentval = (int8_t) ! !(*dest & index);
+				int8_t newval = 0;
+
+				if (value) {
+					newval = switch_true(value);
+				} else {
+					newval = (switch_bool_t) (intptr_t) item->defaultvalue;
+				}
+
+				if (newval != currentval) {
+					changed = SWITCH_TRUE;
+					if (newval) {
+						*dest |= (1 << index);
+					} else {
+						*dest &= ~(1 << index);
 					}
 				}
-				break;
-			case SWITCH_CONFIG_LAST:
-				break;
-			default:
-				break;
+			}
+			break;
+		case SWITCH_CONFIG_FLAGARRAY:
+			{
+				int8_t *dest = (int8_t *) ptr;
+				unsigned int index = (unsigned int) (intptr_t) item->data;
+				int8_t newval = value ? !!switch_true(value) : (int8_t) ((intptr_t) item->defaultvalue);
+				if (dest[index] != newval) {
+					changed = SWITCH_TRUE;
+					dest[index] = newval;
+				}
+			}
+			break;
+		case SWITCH_CONFIG_LAST:
+			break;
+		default:
+			break;
 		}
-		
+
 		if (callback) {
 			callback(item, value, (reload ? CONFIG_RELOAD : CONFIG_LOAD), changed);
 		}
@@ -384,14 +388,15 @@
 					break;
 				}
 			}
-			
+
 			if (!found) {
 				/* Tell the user */
-				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Configuration parameter [%s] is unfortunately not valid, you might want to double-check that.\n", header->name);
+				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+								  "Configuration parameter [%s] is unfortunately not valid, you might want to double-check that.\n", header->name);
 			}
 		}
 	}
-	
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -399,35 +404,36 @@
 SWITCH_DECLARE(void) switch_xml_config_cleanup(switch_xml_config_item_t *instructions)
 {
 	switch_xml_config_item_t *item;
-	
+
 	for (item = instructions; item->key; item++) {
-		switch_xml_config_callback_t callback = (switch_xml_config_callback_t)item->function;
-		
+		switch_xml_config_callback_t callback = (switch_xml_config_callback_t) item->function;
+
 		switch (item->type) {
-			case SWITCH_CONFIG_STRING:
-				{
-					char **ptr = (char**)item->ptr;
-					switch_xml_config_string_options_t *string_options = (switch_xml_config_string_options_t*)item->data;
-					/* if (using_strdup) */
-					if (string_options && !string_options->pool && !string_options->length) {
-						switch_safe_free(*ptr);
-					}
+		case SWITCH_CONFIG_STRING:
+			{
+				char **ptr = (char **) item->ptr;
+				switch_xml_config_string_options_t *string_options = (switch_xml_config_string_options_t *) item->data;
+				/* if (using_strdup) */
+				if (string_options && !string_options->pool && !string_options->length) {
+					switch_safe_free(*ptr);
 				}
-				break;
-			default:
-				break;
+			}
+			break;
+		default:
+			break;
 		}
-		
+
 		if (callback) {
 			callback(item, NULL, CONFIG_SHUTDOWN, SWITCH_FALSE);
 		}
-		
+
 	}
 }
 
 
-SWITCH_DECLARE(void) switch_config_perform_set_item(switch_xml_config_item_t *item, const char *key, switch_xml_config_type_t type, int flags, void *ptr, 	
-										const void* defaultvalue, void *data, switch_xml_config_callback_t function, const char *syntax, const char *helptext)
+SWITCH_DECLARE(void) switch_config_perform_set_item(switch_xml_config_item_t *item, const char *key, switch_xml_config_type_t type, int flags, void *ptr,
+													const void *defaultvalue, void *data, switch_xml_config_callback_t function, const char *syntax,
+													const char *helptext)
 {
 	item->key = key;
 	item->type = type;

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/support-d/.bashrc (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/support-d/.bashrc	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/support-d/.bashrc	2010-02-12 00:54:22 UTC (rev 16614)
@@ -12,6 +12,8 @@
     export INPUTRC="/etc/inputrc"
 fi
 
+set -o emacs
+
 export LESSCHARSET="latin1"
 export LESS="-R"
 export CHARSET="ISO-8859-1"
@@ -27,8 +29,8 @@
 alias bcommit='svn commit --no-auth-cache --username=brian'
 alias icommit='svn commit --no-auth-cache --username=intralanman'
 alias dp='emacs /usr/local/freeswitch/conf/dialplan/default.xml'
-alias fstop='top -p `cat /usr/local/freeswitch/log/freeswitch.pid`'
-alias fsgdb='gdb /usr/local/freeswitch/bin/freeswitch `cat /usr/local/freeswitch/log/freeswitch.pid`'
+alias fstop='top -p `cat /usr/local/freeswitch/run/freeswitch.pid`'
+alias fsgdb='gdb /usr/local/freeswitch/bin/freeswitch `cat /usr/local/freeswitch/run/freeswitch.pid`'
 alias fscore='gdb /usr/local/freeswitch/bin/freeswitch `ls -rt core.* | tail -n1`'
 alias emacs='emacs -nw'
 # End of file

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/support-d/.emacs (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/support-d/.emacs	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/support-d/.emacs	2010-02-12 00:54:22 UTC (rev 16614)
@@ -3,7 +3,6 @@
 
 ;;; You can either fine-tune the bells and whistles of this mode or
 ;;; bulk enable them by putting
-
 ;(setq cperl-hairy t)
 (global-unset-key "\C-h")
 (global-set-key "\C-h" 'delete-backward-char)

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/support-d/fscore_pb (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/support-d/fscore_pb	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/support-d/fscore_pb	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,21 +1,30 @@
-#!/bin/bash
+#!/bin/sh
 
 arg=$1
 shift
 
-prefix=$(cat config.status | grep @prefix@ | awk -F, '{print $3}')
-if [ -z "$prefix" ] ; then
+if [ -f "config.status" ] ; then
+    prefix=$(cat config.status | grep @prefix@ | awk -F, '{print $3}')
+fi
+if [ -f "config.status" -a -z "$prefix" ] ; then
     prefix=$(cat config.status | grep '"prefix"' | awk -F\" '{print $4}')
 fi
 
-if [ -z "$prefix" ] ; then
+if [ -z "$prefix" -a -d "/usr/local/freeswitch" ] ; then
     prefix="/usr/local/freeswitch"
 fi
+if [ -z "$prefix" -a -d "/opt/freeswitch" ] ; then
+    prefix="/opt/freeswitch"
+fi
+if [ -z "$prefix" ] ; then
+    echo "Unable to locate freeswitch prefix directory."
+    exit 255
+fi
 
 if [ "$arg" = "gcore" ] ; then
 	user=$1
 	shift
-	fspid=`cat $prefix/log/freeswitch.pid`
+	fspid=`cat $prefix/run/freeswitch.pid`
 	echo "pulling gcore $fspid"
 	gcore -o core $fspid
 else
@@ -38,7 +47,9 @@
 	exit 255
 fi
 
-if [ -z "which gdb" ] ; then
+if [ -x `which gdb` ] ; then
+  echo "Found gdb"
+else
   echo "Unable to locate gdb, is it installed?"
   exit 255
 fi
@@ -80,8 +91,12 @@
 echo "SVN INFO:" >> $post_file
 echo $line >> $post_file
 echo -n "Revision: " >> $post_file
-svnversion . >> $post_file
-svn stat | grep -v \? >> $post_file
+if [ -d ".svn" ] ; then
+    svnversion . >> $post_file
+    svn stat | grep -v \? >> $post_file
+else
+    echo "Not run from an svn managed directory." >> $post_file
+fi
 
 echo "GDB BACKTRACE:" >> $post_file
 echo $line >> $post_file

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Library/FreeSwitchCore.2008.vcproj (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Library/FreeSwitchCore.2008.vcproj	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Library/FreeSwitchCore.2008.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -74,6 +74,7 @@
 			<Tool
 				Name="VCLinkerTool"
 				LinkLibraryDependencies="true"
+				AdditionalDependencies="rpcrt4.lib"
 				OutputFile="$(SolutionDir)$(ConfigurationName)/FreeSwitch.dll"
 				LinkIncremental="2"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\libs\apr\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\sqlite\$(OutDir) DLL&quot;;&quot;$(InputDir)..\..\libs\apr-util\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\apr-iconv\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\libresample\win&quot;;&quot;$(InputDir)..\..\libs\srtp\$(OutDir)&quot;"
@@ -167,6 +168,7 @@
 			<Tool
 				Name="VCLinkerTool"
 				LinkLibraryDependencies="true"
+				AdditionalDependencies="rpcrt4.lib"
 				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/FreeSwitch.dll"
 				LinkIncremental="2"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\libs\apr\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\sqlite\$(OutDir) DLL&quot;;&quot;$(InputDir)..\..\libs\apr-util\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\apr-iconv\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\libresample\win&quot;;&quot;$(InputDir)..\..\libs\srtp\$(OutDir)&quot;"
@@ -256,6 +258,7 @@
 			<Tool
 				Name="VCLinkerTool"
 				LinkLibraryDependencies="true"
+				AdditionalDependencies="rpcrt4.lib"
 				OutputFile="$(SolutionDir)$(ConfigurationName)/FreeSwitch.dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\libs\apr\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\sqlite\$(OutDir) DLL&quot;;&quot;$(InputDir)..\..\libs\apr-util\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\apr-iconv\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\libresample\win&quot;;&quot;$(InputDir)..\..\libs\srtp\$(OutDir)&quot;"
@@ -345,6 +348,7 @@
 			<Tool
 				Name="VCLinkerTool"
 				LinkLibraryDependencies="true"
+				AdditionalDependencies="rpcrt4.lib"
 				OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/FreeSwitch.dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\libs\apr\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\sqlite\$(OutDir) DLL&quot;;&quot;$(InputDir)..\..\libs\apr-util\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\apr-iconv\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\libresample\win&quot;;&quot;$(InputDir)..\..\libs\srtp\$(OutDir)&quot;"
@@ -743,6 +747,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\switch_mprintf.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\switch_nat.c"
 				>
 				<FileConfiguration
@@ -1449,6 +1457,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\include\switch_mprintf.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\include\switch_odbc.h"
 				>
 			</File>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Library/FreeSwitchCore.vcproj (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Library/FreeSwitchCore.vcproj	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Library/FreeSwitchCore.vcproj	2010-02-12 00:54:22 UTC (rev 16614)
@@ -69,6 +69,7 @@
 			<Tool
 				Name="VCLinkerTool"
 				LinkLibraryDependencies="true"
+				AdditionalDependencies="rpcrt4.lib"
 				OutputFile="$(SolutionDir)$(ConfigurationName)/FreeSwitch.dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\libs\apr\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\sqlite\$(OutDir) DLL&quot;;&quot;$(InputDir)..\..\libs\apr-util\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\apr-iconv\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\libresample\win&quot;;&quot;$(InputDir)..\..\libs\srtp\$(OutDir)&quot;"
@@ -158,6 +159,7 @@
 			<Tool
 				Name="VCLinkerTool"
 				LinkLibraryDependencies="true"
+				AdditionalDependencies="rpcrt4.lib"
 				OutputFile="$(SolutionDir)$(ConfigurationName)/FreeSwitch.dll"
 				LinkIncremental="1"
 				AdditionalLibraryDirectories="&quot;$(InputDir)..\..\libs\apr\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\sqlite\$(OutDir) DLL&quot;;&quot;$(InputDir)..\..\libs\apr-util\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\apr-iconv\$(OutDir)&quot;;&quot;$(InputDir)..\..\libs\libresample\win&quot;;&quot;$(InputDir)..\..\libs\srtp\$(OutDir)&quot;"
@@ -445,6 +447,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\switch_mprintf.c"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\switch_nat.c"
 				>
 				<FileConfiguration
@@ -943,6 +949,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\src\include\switch_mprintf.h"
+				>
+			</File>
+			<File
 				RelativePath="..\..\src\include\switch_odbc.h"
 				>
 			</File>

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/create_fusionpbx.sql (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/create_fusionpbx.sql	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/create_fusionpbx.sql	2010-02-12 00:54:22 UTC (rev 16614)
@@ -1,3 +1,3 @@
 CREATE USER 'fusionpbx'@'localhost' IDENTIFIED BY 'fusionpbx';
 GRANT ALL ON *.* TO 'fusionpbx'@'localhost';
-create DATABASE fusionpbx
+

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/freeswitch_freepbx.iss (from rev 16612, freeswitch/trunk/w32/Setup/inno_setup/freeswitch_freepbx.iss) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/freeswitch_freepbx.iss	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/freeswitch_freepbx.iss	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,829 @@
+; 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 16456
+AppPublisher=FreeSWITCH
+AppPublisherURL=http://www.freeswitch.org
+AppSupportURL=http://www.freeswitch.org
+AppUpdatesURL=http://www.freeswitch.org
+DefaultDirName=C:\FreeSWITCH
+DefaultGroupName=FreeSWITCH
+OutputBaseFilename=freeswitch_freepbx
+SetupIconFile=freeswitch.ico
+Compression=lzma
+SolidCompression=true
+AppCopyright=Anthony Minessale II
+AllowUNCPath=false
+OutputDir=Output
+ArchitecturesInstallIn64BitMode=x64
+
+; The define statements below require ISPP (Inno Setup Preprocesso) to be installed.
+; It's part of the QuickStart Pack (http://www.jrsoftware.org/isdl.php
+
+#define FreeSWITCH_32bit "..\..\..\release"
+#define FreeSWITCH_64bit "..\..\..\x64\release"
+
+[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: create_freepbx.sql; DestDir: {app}; Components: FreePBX_WAMP
+Source: create_freepbx.bat; DestDir: {app}; Components: FreePBX_WAMP
+
+; 32 bit release
+Source: {#FreeSWITCH_32bit}\*.exe; DestDir: {app}; Flags: ignoreversion  onlyifdoesntexist 32bit; Components: FreeSWITCH; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\*.dll; DestDir: {app}; Flags: ignoreversion  onlyifdoesntexist 32bit; Components: FreeSWITCH; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\*.lib; DestDir: {app}; Flags: ignoreversion  onlyifdoesntexist 32bit; Components: FreeSWITCH; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\mod\*; DestDir: {app}\mod; Flags: ignoreversion  onlyifdoesntexist 32bit; Components: FreeSWITCH; Check: not Is64BitInstallMode
+Source: ..\..\..\Release_CLR\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist 32bit; Components: FreeSWITCH; Check: not Is64BitInstallMode
+; 64 bit release
+Source: {#FreeSWITCH_64bit}\*.exe; DestDir: {app}; Flags: ignoreversion  onlyifdoesntexist 64bit; Components: FreeSWITCH; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\*.dll; DestDir: {app}; Flags: ignoreversion  onlyifdoesntexist 64bit; Components: FreeSWITCH; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\*.lib; DestDir: {app}; Flags: ignoreversion  onlyifdoesntexist 64bit; Components: FreeSWITCH; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\mod\*; DestDir: {app}\mod; Flags: ignoreversion  onlyifdoesntexist 64bit; Components: FreeSWITCH; Check: Is64BitInstallMode
+Source: ..\..\..\x64\Release_CLR\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist 64bit; Components: FreeSWITCH; Check: Is64BitInstallMode
+
+; shared by 32 and 64 bit install
+Source: {#FreeSWITCH_32bit}\conf\*; DestDir: {app}\conf; Flags: ignoreversion recursesubdirs createallsubdirs  onlyifdoesntexist; Components: FreeSWITCH
+Source: ..\..\..\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; Tasks: 
+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_pbx(); Components: FreePBX_WAMP
+
+Source: {#FreeSWITCH_32bit}\php_ESL.dll; DestDir: {app}\wamp\bin\php\php5.3.0\ext; Flags: ignoreversion recursesubdirs; Components: FreePBX_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
+
+; 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
+
+[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; 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; 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.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 sound_files_16khz sound_files_32khz sound_files_48khz
+[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/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');
+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_fusionpbx.iss (from rev 16612, freeswitch/trunk/w32/Setup/inno_setup/freeswitch_fusionpbx.iss) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/freeswitch_fusionpbx.iss	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/freeswitch_fusionpbx.iss	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,798 @@
+; 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 16287
+AppPublisher=FreeSWITCH
+AppPublisherURL=http://www.freeswitch.org
+AppSupportURL=http://www.freeswitch.org
+AppUpdatesURL=http://www.freeswitch.org
+DefaultDirName=C:\FreeSWITCH
+DefaultGroupName=FreeSWITCH
+OutputBaseFilename=freeswitch_fusionpbx
+SetupIconFile=freeswitch.ico
+Compression=lzma
+SolidCompression=true
+AppCopyright=Anthony Minessale II
+AllowUNCPath=false
+OutputDir=Output
+ArchitecturesInstallIn64BitMode=x64
+
+; The define statements below require ISPP (Inno Setup Preprocesso) to be installed.
+; It's part of the QuickStart Pack (http://www.jrsoftware.org/isdl.php
+
+#define FreeSWITCH_32bit "..\..\..\release"
+#define FreeSWITCH_64bit "..\..\..\x64\release"
+
+[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: expsound.bat; DestDir: {app}; Components: FreeSWITCH
+Source: FusionPBX.url; DestDir: {app}; Components: FusionPBX_WAMP
+Source: create_fusionpbx.sql; DestDir: {app}; Components: FusionPBX_WAMP
+Source: create_fusionpbx.bat; DestDir: {app}; Components: FusionPBX_WAMP
+
+; 32 bit release
+Source: {#FreeSWITCH_32bit}\*.exe; DestDir: {app}; Flags: ignoreversion  onlyifdoesntexist 32bit; Components: FreeSWITCH; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\*.dll; DestDir: {app}; Flags: ignoreversion  onlyifdoesntexist 32bit; Components: FreeSWITCH; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\*.lib; DestDir: {app}; Flags: ignoreversion  onlyifdoesntexist 32bit; Components: FreeSWITCH; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\mod\*; DestDir: {app}\mod; Flags: ignoreversion  onlyifdoesntexist 32bit; Components: FreeSWITCH; Check: not Is64BitInstallMode
+Source: ..\..\..\Release_CLR\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist 32bit; Components: FreeSWITCH; Check: not Is64BitInstallMode
+; 64 bit release
+Source: {#FreeSWITCH_64bit}\*.exe; DestDir: {app}; Flags: ignoreversion  onlyifdoesntexist 64bit; Components: FreeSWITCH; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\*.dll; DestDir: {app}; Flags: ignoreversion  onlyifdoesntexist 64bit; Components: FreeSWITCH; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\*.lib; DestDir: {app}; Flags: ignoreversion  onlyifdoesntexist 64bit; Components: FreeSWITCH; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\mod\*; DestDir: {app}\mod; Flags: ignoreversion  onlyifdoesntexist 64bit; Components: FreeSWITCH; Check: Is64BitInstallMode
+Source: ..\..\..\x64\Release_CLR\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs onlyifdoesntexist 64bit; Components: FreeSWITCH; Check: Is64BitInstallMode
+
+; shared by 32 and 64 bit install
+Source: {#FreeSWITCH_32bit}\conf\*; DestDir: {app}\conf; Flags: ignoreversion recursesubdirs createallsubdirs  onlyifdoesntexist; Components: FreeSWITCH
+Source: ..\..\..\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: FusionPBX_WAMP; Tasks: 
+Source: G:\wamp_source\wamp\*.*; DestDir: {app}\wamp\; Flags: ignoreversion recursesubdirs onlyifdoesntexist; Components: FusionPBX_WAMP
+Source: G:\wamp_source\wamp\license.txt; DestDir: {app}\wamp\; AfterInstall: install_pbx(); Components: FusionPBX_WAMP
+
+Source: {#FreeSWITCH_32bit}\php_ESL.dll; DestDir: {app}\wamp\bin\php\php5.3.0\ext; Flags: ignoreversion recursesubdirs; Components: FusionPBX_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}\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: FusionPBX_WAMP; Flags: runminimized
+Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\WampServer; Filename: {app}\wamp\wampmanager.exe; Tasks: quicklaunchicon; Components: FusionPBX_WAMP
+Name: {commondesktop}\WampServer; Filename: {app}\wamp\wampmanager.exe; Tasks: desktopicon; Components: 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: FusionPBX_WAMP; Flags: runhidden
+Filename: {app}\wamp\install_services.bat; Components: FusionPBX_WAMP; Flags: runhidden
+Filename: {app}\wamp\wampmanager.exe; Description: Launch WampServer 2 now; Components: FusionPBX_WAMP; Flags: shellexec postinstall skipifsilent runhidden
+Filename: {app}\freeswitch.exe; Description: Launch FreeSWITCH now; Flags: shellexec postinstall skipifsilent; Components: FreeSWITCH
+
+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: 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: FusionPBX_WAMP; Description: FusionPBX 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 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_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;

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/fscomm.iss (from rev 16612, freeswitch/trunk/w32/Setup/inno_setup/fscomm.iss) (0 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/fscomm.iss	                        (rev 0)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/fscomm.iss	2010-02-12 00:54:22 UTC (rev 16614)
@@ -0,0 +1,135 @@
+; 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=FSComm
+AppVerName=FSComm svn 16568
+AppPublisherURL=http://wiki.freeswitch.org/wiki/FSComm
+AppSupportURL=http://wiki.freeswitch.org/wiki/FSComm
+AppUpdatesURL=http://wiki.freeswitch.org/wiki/FSComm
+DefaultDirName=C:\FSComm
+DefaultGroupName=FSComm
+SetupIconFile=freeswitch.ico
+OutputBaseFilename=FSComm
+Compression=lzma
+SolidCompression=yes
+OutputDir=Output
+ArchitecturesInstallIn64BitMode=x64
+
+; The define statements below require ISPP (Inno Setup Preprocesso) to be installed.
+; It's part of the QuickStart Pack (http://www.jrsoftware.org/isdl.php
+
+#define QT32Bit_Build "D:\Qt\win32\bin"
+#define QT64Bit_Build "D:\Qt\x64\bin"
+
+#define FreeSWITCH_32bit "..\..\..\release"
+#define FreeSWITCH_64bit "..\..\..\x64\release"
+
+#define FSComm_32bit "..\..\..\fscomm\win32\release"
+#define FSComm_64bit "..\..\..\fscomm\x64\release"
+
+[Languages]
+Name: english; MessagesFile: compiler:Default.isl
+
+[Tasks]
+Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked
+
+[Files]
+
+Source: vcredist_x86.exe; Flags: 32bit; DestDir: {tmp}; Check: not Is64BitInstallMode
+Source: vcredist_x64.exe; Flags: 64bit; DestDir: {tmp}; Check: Is64BitInstallMode
+
+; 32 bit
+Source: freeswitch.ico; DestDir: {app}
+Source: {#FSComm_32bit}\fscomm.exe; DestDir: {app}; Flags: 32bit ignoreversion; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\fs_cli.exe; DestDir: {app}; Flags: 32bit ignoreversion; Check: not Is64BitInstallMode
+Source: ..\..\..\fscomm\conf\*; DestDir: {app}\conf; Flags: 32bit ignoreversion  onlyifdoesntexist recursesubdirs; Check: not Is64BitInstallMode
+
+; 32 bit QT libraries
+Source: {#QT32Bit_Build}\QtCore4.dll; DestDir: {app}; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#QT32Bit_Build}\QtGui4.dll; DestDir: {app}; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#QT32Bit_Build}\QtXml4.dll; DestDir: {app}; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+
+; required FreeSWICTCH modules for 32bit build
+Source: {#FreeSWITCH_32bit}\mod\mod_console.dll; DestDir: {app}\mod; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\mod\mod_logfile.dll; DestDir: {app}\mod; Flags: 32bit  ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\mod\mod_cdr_csv.dll; DestDir: {app}\mod; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\mod\mod_commands.dll; DestDir: {app}\mod; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\mod\mod_dialplan_xml.dll; DestDir: {app}\mod; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\mod\mod_dptools.dll; DestDir: {app}\mod; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\mod\mod_enum.dll; DestDir: {app}\mod; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\mod\mod_event_socket.dll; DestDir: {app}\mod; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\mod\mod_ilbc.dll; DestDir: {app}\mod; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\mod\mod_local_stream.dll; DestDir: {app}\mod; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\mod\mod_loopback.dll; DestDir: {app}\mod; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\mod\mod_PortAudio.dll; DestDir: {app}\mod; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\mod\mod_siren.dll; DestDir: {app}\mod; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\mod\mod_sndfile.dll; DestDir: {app}\mod; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\mod\mod_sofia.dll; DestDir: {app}\mod; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\mod\mod_speex.dll; DestDir: {app}\mod; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\mod\mod_tone_stream.dll; DestDir: {app}\mod; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\mod\mod_voipcodecs.dll; DestDir: {app}\mod; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\mod\mod_celt.dll; DestDir: {app}\mod; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+
+; required FreeSWICTCH dlls for 32bit build
+Source: {#FreeSWITCH_32bit}\pthreadVC2.dll; DestDir: {app}; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\libspandsp.dll; DestDir: {app}; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\libbroadvoice.dll; DestDir: {app}; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\libapr.dll; DestDir: {app}; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\libaprutil.dll; DestDir: {app}; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\libteletone.dll; DestDir: {app}; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+Source: {#FreeSWITCH_32bit}\FreeSwitch.dll; DestDir: {app}; Flags: 32bit ignoreversion  onlyifdoesntexist; Check: not Is64BitInstallMode
+
+; 64 bit FSComm build
+Source: freeswitch.ico; DestDir: {app}
+Source: {#FSComm_64bit}\fscomm.exe; DestDir: {app}; Flags: 64bit ignoreversion; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\fs_cli.exe; DestDir: {app}; Flags: 64bit ignoreversion; Check: Is64BitInstallMode
+Source: ..\..\..\fscomm\conf\*; DestDir: {app}\conf; Flags: 64bit ignoreversion onlyifdoesntexist recursesubdirs; Check: Is64BitInstallMode
+
+; 64 bit QT libraries
+Source: {#QT64Bit_Build}\QtCore4.dll; DestDir: {app}; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#QT64Bit_Build}\QtGui4.dll; DestDir: {app}; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#QT64Bit_Build}\QtXml4.dll; DestDir: {app}; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+
+; required FreeSWICTCH modules for 64bit build
+Source: {#FreeSWITCH_64bit}\mod\mod_console.dll; DestDir: {app}\mod; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\mod\mod_logfile.dll; DestDir: {app}\mod; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\mod\mod_cdr_csv.dll; DestDir: {app}\mod; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\mod\mod_commands.dll; DestDir: {app}\mod; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\mod\mod_dialplan_xml.dll; DestDir: {app}\mod; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\mod\mod_dptools.dll; DestDir: {app}\mod; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\mod\mod_enum.dll; DestDir: {app}\mod; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\mod\mod_event_socket.dll; DestDir: {app}\mod; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\mod\mod_ilbc.dll; DestDir: {app}\mod; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\mod\mod_local_stream.dll; DestDir: {app}\mod; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\mod\mod_loopback.dll; DestDir: {app}\mod; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\mod\mod_PortAudio.dll; DestDir: {app}\mod; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\mod\mod_siren.dll; DestDir: {app}\mod; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\mod\mod_sndfile.dll; DestDir: {app}\mod; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\mod\mod_sofia.dll; DestDir: {app}\mod; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\mod\mod_speex.dll; DestDir: {app}\mod; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\mod\mod_tone_stream.dll; DestDir: {app}\mod; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\mod\mod_voipcodecs.dll; DestDir: {app}\mod; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\mod\mod_celt.dll; DestDir: {app}\mod; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+
+; required FreeSWICTCH dlls for 64bit build
+Source: {#FreeSWITCH_64bit}\pthreadVC2.dll; DestDir: {app}; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\libspandsp.dll; DestDir: {app}; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\libbroadvoice.dll; DestDir: {app}; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\libapr.dll; DestDir: {app}; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\libaprutil.dll; DestDir: {app}; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\libteletone.dll; DestDir: {app}; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+Source: {#FreeSWITCH_64bit}\FreeSwitch.dll; DestDir: {app}; Flags: 64bit ignoreversion  onlyifdoesntexist; Check: Is64BitInstallMode
+
+[Icons]
+Name: {group}\FSComm; Filename: {app}\FSComm.exe; IconFilename: {app}\freeswitch.ico; IconIndex: 0; WorkingDir: {app}\plugins
+Name: {commondesktop}\FSComm; Filename: {app}\FSComm.exe; Tasks: desktopicon; IconFilename: {app}\freeswitch.ico; IconIndex: 0; WorkingDir: {app}\plugins
+
+[Run]
+Filename: {app}\FSComm.exe; Description: {cm:LaunchProgram,FSComm}; Flags: nowait postinstall skipifsilent
+Filename: {tmp}\vcredist_x86.exe; Description: Microsoft Visual C++ 2008 Redistributable Package (x86); Parameters: /q; Flags: 32bit; Check: not Is64BitInstallMode
+Filename: {tmp}\vcredist_x64.exe; Description: Microsoft Visual C++ 2008 Redistributable Package (x64); Parameters: /q; Flags: 64bit; Check: Is64BitInstallMode

Modified: freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/fsgui.iss (16613 => 16614)


--- freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/fsgui.iss	2010-02-11 23:31:03 UTC (rev 16613)
+++ freeswitch/branches/joshrivers/mod_managed_working_branch/w32/Setup/inno_setup/fsgui.iss	2010-02-12 00:54:22 UTC (rev 16614)
@@ -7,7 +7,7 @@
 ; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
 ;AppId={{ED55656F-D567-4B3D-A0B9-617CAB13D519}
 AppName=FsGui
-AppVerName=FsGui svn 15668
+AppVerName=FsGui svn 16045
 AppPublisherURL=http://wiki.freeswitch.org/wiki/Fsgui
 AppSupportURL=http://wiki.freeswitch.org/wiki/Fsgui
 AppUpdatesURL=http://wiki.freeswitch.org/wiki/Fsgui

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/web (from rev 16612, freeswitch/trunk/web)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/web/etc (from rev 16612, freeswitch/trunk/web/etc)

Copied: freeswitch/branches/joshrivers/mod_managed_working_branch/web/planet (from rev 16612, freeswitch/trunk/web/planet)